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