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