1*03831d35Sstevel /* 2*03831d35Sstevel * CDDL HEADER START 3*03831d35Sstevel * 4*03831d35Sstevel * The contents of this file are subject to the terms of the 5*03831d35Sstevel * Common Development and Distribution License, Version 1.0 only 6*03831d35Sstevel * (the "License"). You may not use this file except in compliance 7*03831d35Sstevel * with the License. 8*03831d35Sstevel * 9*03831d35Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*03831d35Sstevel * or http://www.opensolaris.org/os/licensing. 11*03831d35Sstevel * See the License for the specific language governing permissions 12*03831d35Sstevel * and limitations under the License. 13*03831d35Sstevel * 14*03831d35Sstevel * When distributing Covered Code, include this CDDL HEADER in each 15*03831d35Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*03831d35Sstevel * If applicable, add the following below this CDDL HEADER, with the 17*03831d35Sstevel * fields enclosed by brackets "[]" replaced with your own identifying 18*03831d35Sstevel * information: Portions Copyright [yyyy] [name of copyright owner] 19*03831d35Sstevel * 20*03831d35Sstevel * CDDL HEADER END 21*03831d35Sstevel */ 22*03831d35Sstevel /* 23*03831d35Sstevel * Copyright 2002-2003 Sun Microsystems, Inc. All rights reserved. 24*03831d35Sstevel * Use is subject to license terms. 25*03831d35Sstevel */ 26*03831d35Sstevel 27*03831d35Sstevel #ifndef _LIBRSC_H 28*03831d35Sstevel #define _LIBRSC_H 29*03831d35Sstevel 30*03831d35Sstevel #pragma ident "%Z%%M% %I% %E% SMI" 31*03831d35Sstevel 32*03831d35Sstevel #include <sys/rmc_comm_lproto.h> 33*03831d35Sstevel #include <sys/rmc_comm_hproto.h> 34*03831d35Sstevel #include <sys/rmc_comm_dp_boot.h> 35*03831d35Sstevel #include <sys/rmcadm.h> 36*03831d35Sstevel 37*03831d35Sstevel #ifdef __cplusplus 38*03831d35Sstevel extern "C" { 39*03831d35Sstevel #endif 40*03831d35Sstevel 41*03831d35Sstevel /* 42*03831d35Sstevel * The structure used to pass messages into and out of this layer. 43*03831d35Sstevel */ 44*03831d35Sstevel typedef struct rscp_msg { 45*03831d35Sstevel rsci8 type; 46*03831d35Sstevel rsci32 len; 47*03831d35Sstevel void *data; 48*03831d35Sstevel void *private; 49*03831d35Sstevel } rscp_msg_t; 50*03831d35Sstevel 51*03831d35Sstevel typedef void rscp_bpmsg_cb_t(bp_msg_t *msg); 52*03831d35Sstevel 53*03831d35Sstevel #define RSC_RMCADM_DRV "/devices/pseudo/rmcadm@0:rmcadm" 54*03831d35Sstevel 55*03831d35Sstevel #define RSC_MAX_RX_BUFFER DP_MAX_MSGLEN 56*03831d35Sstevel 57*03831d35Sstevel 58*03831d35Sstevel /* 59*03831d35Sstevel * this table is used to match request/response in order to provide 60*03831d35Sstevel * backward compatibility to obsolete functions: rscp_send(), rscp_recv(), 61*03831d35Sstevel * 62*03831d35Sstevel * in the old way, send and receive were decoupled: applications sent a 63*03831d35Sstevel * request (rscp_send) and waited for a reply (rscp_recv) using two different 64*03831d35Sstevel * calls. 65*03831d35Sstevel * As the ioctl to the communication driver is a single call, send and receive 66*03831d35Sstevel * cannot be decoupled. So, when the rscp_send is called, this table will tell 67*03831d35Sstevel * which reply is expected and in what time. The reply is then stored in a 68*03831d35Sstevel * temporary buffer. When the rscp_recv is called, it will return the 69*03831d35Sstevel * content of the temporary buffer (if a reply was received) or an error 70*03831d35Sstevel */ 71*03831d35Sstevel typedef struct req_resp_table { 72*03831d35Sstevel 73*03831d35Sstevel uint8_t req_type; 74*03831d35Sstevel uint8_t resp_type; 75*03831d35Sstevel uint16_t resp_size; 76*03831d35Sstevel uint_t timeout; 77*03831d35Sstevel 78*03831d35Sstevel } req_resp_table_t; 79*03831d35Sstevel 80*03831d35Sstevel 81*03831d35Sstevel /* timeout value (millisecs) for request/response sessions */ 82*03831d35Sstevel 83*03831d35Sstevel #define RR_TIMEOUT 10000 84*03831d35Sstevel #define RR_SEPROM_TIMEOUT 10000 85*03831d35Sstevel 86*03831d35Sstevel #define RR_BOOT_INIT_TIMEOUT 1000 87*03831d35Sstevel #define RR_BOOT_LOAD_TIMEOUT 10000 88*03831d35Sstevel #define RR_BOOT_RESET_TIMEOUT 0 89*03831d35Sstevel #define RR_BP_TIMEOUT 1000 90*03831d35Sstevel 91*03831d35Sstevel 92*03831d35Sstevel /* function prototypes */ 93*03831d35Sstevel 94*03831d35Sstevel int rscp_init(void); 95*03831d35Sstevel int rscp_send_recv(rscp_msg_t *, rscp_msg_t *, struct timespec *); 96*03831d35Sstevel int rsc_nmi(void); 97*03831d35Sstevel 98*03831d35Sstevel 99*03831d35Sstevel /* function prototypes for firmware download */ 100*03831d35Sstevel 101*03831d35Sstevel int rscp_register_bpmsg_cb(rscp_bpmsg_cb_t *); 102*03831d35Sstevel int rscp_unregister_bpmsg_cb(rscp_bpmsg_cb_t *); 103*03831d35Sstevel void rscp_send_bpmsg(bp_msg_t *); 104*03831d35Sstevel int rsc_raw_write(char *, int); 105*03831d35Sstevel 106*03831d35Sstevel 107*03831d35Sstevel /* prototypes of obsolete functions */ 108*03831d35Sstevel 109*03831d35Sstevel int rscp_send(rscp_msg_t *); 110*03831d35Sstevel int rscp_recv(rscp_msg_t *, struct timespec *); 111*03831d35Sstevel int rscp_start(void); 112*03831d35Sstevel int rscp_free_msg(rscp_msg_t *); 113*03831d35Sstevel 114*03831d35Sstevel #ifdef __cplusplus 115*03831d35Sstevel } 116*03831d35Sstevel #endif 117*03831d35Sstevel 118*03831d35Sstevel #endif /* _LIBRSC_H */ 119