xref: /onnv-gate/usr/src/uts/sun4u/starcat/sys/mboxsc.h (revision 1708:ea74d8598a3a)
1*1708Sstevel /*
2*1708Sstevel  * CDDL HEADER START
3*1708Sstevel  *
4*1708Sstevel  * The contents of this file are subject to the terms of the
5*1708Sstevel  * Common Development and Distribution License (the "License").
6*1708Sstevel  * You may not use this file except in compliance with the License.
7*1708Sstevel  *
8*1708Sstevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*1708Sstevel  * or http://www.opensolaris.org/os/licensing.
10*1708Sstevel  * See the License for the specific language governing permissions
11*1708Sstevel  * and limitations under the License.
12*1708Sstevel  *
13*1708Sstevel  * When distributing Covered Code, include this CDDL HEADER in each
14*1708Sstevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*1708Sstevel  * If applicable, add the following below this CDDL HEADER, with the
16*1708Sstevel  * fields enclosed by brackets "[]" replaced with your own identifying
17*1708Sstevel  * information: Portions Copyright [yyyy] [name of copyright owner]
18*1708Sstevel  *
19*1708Sstevel  * CDDL HEADER END
20*1708Sstevel  */
21*1708Sstevel 
22*1708Sstevel /*
23*1708Sstevel  * Copyright 2000 Sun Microsystems, Inc.  All rights reserved.
24*1708Sstevel  * Use is subject to license terms.
25*1708Sstevel  */
26*1708Sstevel 
27*1708Sstevel #ifndef	_MBOXSC_H
28*1708Sstevel #define	_MBOXSC_H
29*1708Sstevel 
30*1708Sstevel #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*1708Sstevel 
32*1708Sstevel /*
33*1708Sstevel  * This file defines the Starcat Domain Mailbox Interface, as implemented in
34*1708Sstevel  * the mboxsc module.
35*1708Sstevel  */
36*1708Sstevel 
37*1708Sstevel #ifdef __cplusplus
38*1708Sstevel extern "C" {
39*1708Sstevel #endif
40*1708Sstevel 
41*1708Sstevel #include <sys/types.h>
42*1708Sstevel 
43*1708Sstevel /*
44*1708Sstevel  * Mailbox message types, for use in mboxsc_putmsg() and mboxsc_getmsg() calls.
45*1708Sstevel  * NOTE: Clients should not use the MBOXSC_NUM_MSG_TYPES value, which
46*1708Sstevel  *       is used internally to simplify future code maintenance.
47*1708Sstevel  */
48*1708Sstevel 
49*1708Sstevel #define	MBOXSC_MSG_REQUEST	0x01
50*1708Sstevel #define	MBOXSC_MSG_REPLY	0x02
51*1708Sstevel #define	MBOXSC_MSG_EVENT	0x04
52*1708Sstevel #define	MBOXSC_NUM_MSG_TYPES	3
53*1708Sstevel 
54*1708Sstevel /*
55*1708Sstevel  * Mailbox directions, for use in mboxsc_init().
56*1708Sstevel  */
57*1708Sstevel #define	MBOXSC_MBOX_IN		0
58*1708Sstevel #define	MBOXSC_MBOX_OUT		1
59*1708Sstevel 
60*1708Sstevel 
61*1708Sstevel #ifdef _KERNEL
62*1708Sstevel /*
63*1708Sstevel  * Mailbox control commands, for use in mboxsc_ctrl().
64*1708Sstevel  */
65*1708Sstevel #define	MBOXSC_CMD_VERSION			1
66*1708Sstevel #define	MBOXSC_CMD_MAXVERSION			2
67*1708Sstevel #define	MBOXSC_CMD_MAXDATALEN			3
68*1708Sstevel #define	MBOXSC_CMD_PUTMSG_TIMEOUT_RANGE		4
69*1708Sstevel #define	MBOXSC_CMD_GETMSG_TIMEOUT_RANGE		5
70*1708Sstevel 
71*1708Sstevel /*
72*1708Sstevel  * The argument for the TIMEOUT_RANGE control commands is a pointer to one of
73*1708Sstevel  * these.
74*1708Sstevel  */
75*1708Sstevel typedef struct mboxsc_timeout_range {
76*1708Sstevel 	clock_t min_timeout;
77*1708Sstevel 	clock_t max_timeout;
78*1708Sstevel } mboxsc_timeout_range_t;
79*1708Sstevel 
80*1708Sstevel /*
81*1708Sstevel  * Mailbox interface functions available to in-kernel clients on Starcat
82*1708Sstevel  * Domains.
83*1708Sstevel  * NOTE: The timeout arguments to mboxsc_putmsg() and mboxsc_getmsg() are
84*1708Sstevel  *       interpreted as milliseconds.
85*1708Sstevel  */
86*1708Sstevel extern int mboxsc_init(uint32_t key, int direction, void
87*1708Sstevel 	(*event_handler)(void));
88*1708Sstevel extern int mboxsc_fini(uint32_t key);
89*1708Sstevel extern int mboxsc_putmsg(uint32_t key, uint32_t type, uint32_t cmd,
90*1708Sstevel 	uint64_t *transid, uint32_t length, void *datap, clock_t timeout);
91*1708Sstevel extern int mboxsc_getmsg(uint32_t key, uint32_t *type, uint32_t *cmd,
92*1708Sstevel 	uint64_t *transid, uint32_t *length, void *datap, clock_t timeout);
93*1708Sstevel extern int mboxsc_ctrl(uint32_t key, uint32_t cmd, void *arg);
94*1708Sstevel extern clock_t mboxsc_putmsg_def_timeout(void);
95*1708Sstevel #define	MBOXSC_PUTMSG_DEF_TIMEOUT	mboxsc_putmsg_def_timeout()
96*1708Sstevel 
97*1708Sstevel #ifdef DEBUG
98*1708Sstevel /*
99*1708Sstevel  * The following commands may be passed in to the mboxsc_debug() function to
100*1708Sstevel  * dump data to the console that wouldn't be available through normal
101*1708Sstevel  * (non-debug) functions.
102*1708Sstevel  */
103*1708Sstevel #define	MBOXSC_PRNMBOX		1	/* display a particular mailbox */
104*1708Sstevel #define	MBOXSC_PRNHASHTBL	2	/* display the whole hash table */
105*1708Sstevel #define	MBOXSC_SETDBGMASK	3	/* set the debug mask */
106*1708Sstevel 
107*1708Sstevel /*
108*1708Sstevel  * Debugging interface routine.
109*1708Sstevel  */
110*1708Sstevel extern int mboxsc_debug(int cmd, void *arg);
111*1708Sstevel 
112*1708Sstevel #endif /* DEBUG */
113*1708Sstevel #endif /* _KERNEL */
114*1708Sstevel 
115*1708Sstevel #ifdef __cplusplus
116*1708Sstevel }
117*1708Sstevel #endif
118*1708Sstevel 
119*1708Sstevel #endif /* _MBOXSC_H */
120