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