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 #include <sys/rmc_comm_lproto.h> 31*03831d35Sstevel #include <sys/rmc_comm_hproto.h> 32*03831d35Sstevel #include <sys/rmc_comm_dp_boot.h> 33*03831d35Sstevel #include <sys/rmcadm.h> 34*03831d35Sstevel 35*03831d35Sstevel #ifdef __cplusplus 36*03831d35Sstevel extern "C" { 37*03831d35Sstevel #endif 38*03831d35Sstevel 39*03831d35Sstevel /* 40*03831d35Sstevel * The structure used to pass messages into and out of this layer. 41*03831d35Sstevel */ 42*03831d35Sstevel typedef struct rscp_msg { 43*03831d35Sstevel rsci8 type; 44*03831d35Sstevel rsci32 len; 45*03831d35Sstevel void *data; 46*03831d35Sstevel void *private; 47*03831d35Sstevel } rscp_msg_t; 48*03831d35Sstevel 49*03831d35Sstevel typedef void rscp_bpmsg_cb_t(bp_msg_t *msg); 50*03831d35Sstevel 51*03831d35Sstevel #define RSC_RMCADM_DRV "/devices/pseudo/rmcadm@0:rmcadm" 52*03831d35Sstevel 53*03831d35Sstevel #define RSC_MAX_RX_BUFFER DP_MAX_MSGLEN 54*03831d35Sstevel 55*03831d35Sstevel 56*03831d35Sstevel /* 57*03831d35Sstevel * this table is used to match request/response in order to provide 58*03831d35Sstevel * backward compatibility to obsolete functions: rscp_send(), rscp_recv(), 59*03831d35Sstevel * 60*03831d35Sstevel * in the old way, send and receive were decoupled: applications sent a 61*03831d35Sstevel * request (rscp_send) and waited for a reply (rscp_recv) using two different 62*03831d35Sstevel * calls. 63*03831d35Sstevel * As the ioctl to the communication driver is a single call, send and receive 64*03831d35Sstevel * cannot be decoupled. So, when the rscp_send is called, this table will tell 65*03831d35Sstevel * which reply is expected and in what time. The reply is then stored in a 66*03831d35Sstevel * temporary buffer. When the rscp_recv is called, it will return the 67*03831d35Sstevel * content of the temporary buffer (if a reply was received) or an error 68*03831d35Sstevel */ 69*03831d35Sstevel typedef struct req_resp_table { 70*03831d35Sstevel 71*03831d35Sstevel uint8_t req_type; 72*03831d35Sstevel uint8_t resp_type; 73*03831d35Sstevel uint16_t resp_size; 74*03831d35Sstevel uint_t timeout; 75*03831d35Sstevel 76*03831d35Sstevel } req_resp_table_t; 77*03831d35Sstevel 78*03831d35Sstevel 79*03831d35Sstevel /* timeout value (millisecs) for request/response sessions */ 80*03831d35Sstevel 81*03831d35Sstevel #define RR_TIMEOUT 10000 82*03831d35Sstevel #define RR_SEPROM_TIMEOUT 10000 83*03831d35Sstevel 84*03831d35Sstevel #define RR_BOOT_INIT_TIMEOUT 1000 85*03831d35Sstevel #define RR_BOOT_LOAD_TIMEOUT 10000 86*03831d35Sstevel #define RR_BOOT_RESET_TIMEOUT 0 87*03831d35Sstevel #define RR_BP_TIMEOUT 1000 88*03831d35Sstevel 89*03831d35Sstevel 90*03831d35Sstevel /* function prototypes */ 91*03831d35Sstevel 92*03831d35Sstevel int rscp_init(void); 93*03831d35Sstevel int rscp_send_recv(rscp_msg_t *, rscp_msg_t *, struct timespec *); 94*03831d35Sstevel int rsc_nmi(void); 95*03831d35Sstevel 96*03831d35Sstevel 97*03831d35Sstevel /* function prototypes for firmware download */ 98*03831d35Sstevel 99*03831d35Sstevel int rscp_register_bpmsg_cb(rscp_bpmsg_cb_t *); 100*03831d35Sstevel int rscp_unregister_bpmsg_cb(rscp_bpmsg_cb_t *); 101*03831d35Sstevel void rscp_send_bpmsg(bp_msg_t *); 102*03831d35Sstevel int rsc_raw_write(char *, int); 103*03831d35Sstevel 104*03831d35Sstevel 105*03831d35Sstevel /* prototypes of obsolete functions */ 106*03831d35Sstevel 107*03831d35Sstevel int rscp_send(rscp_msg_t *); 108*03831d35Sstevel int rscp_recv(rscp_msg_t *, struct timespec *); 109*03831d35Sstevel int rscp_start(void); 110*03831d35Sstevel int rscp_free_msg(rscp_msg_t *); 111*03831d35Sstevel 112*03831d35Sstevel #ifdef __cplusplus 113*03831d35Sstevel } 114*03831d35Sstevel #endif 115*03831d35Sstevel 116*03831d35Sstevel #endif /* _LIBRSC_H */ 117