xref: /titanic_50/usr/src/uts/sun4u/serengeti/sys/ssm.h (revision b494511a9cf72b1fc4eb13a0e593f55c624ab829)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_SSM_H
28 #define	_SYS_SSM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>		/* needed by <sys/dditypes.h> */
37 #include <sys/dditypes.h>	/* needed for definition of dev_info_t */
38 #include <sys/mutex.h>
39 
40 /*
41  * ssm soft state macros: IIIIMMMM
42  *                 instance-minor no
43  */
44 #define	SSM_INSTANCE_SHIFT	4
45 #define	SSM_BOARD_MASK		0xff
46 
47 
48 struct ssm_soft_state {
49 	dev_info_t	*dip;		/* own dev info */
50 	int		ssm_nodeid;	/* node id */
51 	dev_info_t	*top_node;
52 	int		initialized;	/* instance has been initialized */
53 	kmutex_t	ssm_sft_lock;	/* protects this struct */
54 	ddi_iblock_cookie_t ssm_fm_ibc; /* returned ibc from our parent */
55 	int		ssm_fm_cap;	/* our fm capability */
56 };
57 
58 typedef struct {
59 	int	instance;	/* instance for this wildcat node */
60 	int	wnode;		/* node num */
61 } ssm_sbdp_info_t;
62 
63 /*
64  * useful debugging stuff
65  */
66 #define	SSM_ATTACH_DEBUG	0x0002
67 #define	SSM_CTLOPS_DEBUG	0x0004
68 #define	SSM_EVENT_DEBUG		0x0008
69 
70 #define	_SSM_IOCTL		(('m' << 16) | ('p' << 8))
71 #define	SSM_TEARDOWN_SBD	(_SSM_IOCTL | 0x1)
72 
73 #ifdef DEBUG
74 #define	CMD2EVNT(m)	((m) == SGDR_BD_ABSENT	? SG_EVT_BOARD_ABSENT :	\
75 			    (m) == SGDR_BD_PRESENT ? SG_EVT_BOARD_PRESENT :\
76 			    (m) == SGDR_UNASSIGN ? SG_EVT_UNASSIGN : 	\
77 			    (m) == SGDR_ASSIGN ? SG_EVT_ASSIGN :	\
78 			    (m) == SGDR_UNAVAILABLE ? SG_EVT_UNAVAILABLE :\
79 			    (m) == SGDR_AVAILABLE ? SG_EVT_AVAILABLE : 	\
80 			    (m) == SGDR_POWER_OFF ? SG_EVT_POWER_OFF : 	\
81 			    (m) == SGDR_POWER_ON ? SG_EVT_POWER_ON :	\
82 			    (m) == SGDR_PASSED_TEST ? SG_EVT_PASSED_TEST :\
83 			    (m) == SGDR_FAILED_TEST ? SG_EVT_FAILED_TEST :\
84 			    0)
85 
86 #define	EVNT2STR(c)	((c) == SG_EVT_BOARD_ABSENT ? "board_absent" :\
87 			    (c) == SG_EVT_BOARD_PRESENT ? "board_present" :\
88 			    (c) == SG_EVT_UNASSIGN ? "unassign" :	\
89 			    (c) == SG_EVT_ASSIGN ? "assign" :		\
90 			    (c) == SG_EVT_UNAVAILABLE ? "unavailable" :	\
91 			    (c) == SG_EVT_AVAILABLE ? "available" :	\
92 			    (c) == SG_EVT_POWER_OFF ? "power_off" :	\
93 			    (c) == SG_EVT_POWER_ON	? "power_on" :	\
94 			    (c) == SG_EVT_PASSED_TEST ? "passed_test" :	\
95 			    (c) == SG_EVT_FAILED_TEST ? "failed_test" :	\
96 			    NULL)
97 #endif
98 
99 #ifdef	__cplusplus
100 }
101 #endif
102 
103 #endif /* _SYS_SSM_H */
104