xref: /illumos-gate/usr/src/uts/common/sys/sysevent/dr.h (revision 41e0a469c3dbc14deb2b200f6ca6f6e00b5865d0)
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_SYSEVENT_DR_H
27 #define	_SYS_SYSEVENT_DR_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 /*
34  * dr.h contains the publicly defined sysevent attribute names and values
35  * for all DR type sysevents.  Additions/removals/changes are subject to
36  * PSARC approval.
37  */
38 
39 /*
40  * Event type EC_DR/ESC_DR_AP_STATE_CHANGE event schema
41  *	Event Class 	- EC_DR
42  *	Event Sub-Class - ESC_DR_AP_STATE_CHANGE
43  *	Event Publisher	- SUNW:kern:[dr_subsystem_name]
44  *	Attribute Name	- DR_AP_ID
45  *	Attribute Type	- SE_DATA_TYPE_STRING
46  *	Attribute Value	- [Attachment Point Identifier]
47  *	Attribute Name	- DR_HINT
48  *	Attribute Type	- SE_DATA_TYPE_STRING
49  *	Attribute Value	- DR_RESERVED_ATTR | DR_HINT_INSERT | DR_HINT_REMOVE
50  */
51 #define	DR_AP_ID	"dr_ap_id"	/* Attachment point id */
52 #define	DR_HINT	"dr_hint"		/* Operation hint */
53 #define	DR_HINT_INSERT	"dr_insert"	/* Insert hint */
54 #define	DR_HINT_REMOVE	"dr_remove"	/* Remove hint */
55 #define	DR_RESERVED_ATTR	""
56 
57 /*
58  * Useful macros for insert/remove event.
59  */
60 #define	SE_NO_HINT		0x0
61 #define	SE_HINT_INSERT		0x1
62 #define	SE_HINT_REMOVE		0x2
63 #define	SE_HINT2STR(h)		((h) == SE_HINT_INSERT ? DR_HINT_INSERT : \
64 				    (h) == SE_HINT_REMOVE ? DR_HINT_REMOVE : \
65 				    DR_RESERVED_ATTR)
66 /*
67  * Event type EC_DR/ESC_DR_REQ event schema
68  *	Event Class	- EC_DR
69  *	Event Sub-Class	- ESC_DR_REQ
70  *	Event Publisher	- SUNW:kern:[dr_subsystem_name]
71  *	Attribute Name	- DR_AP_ID
72  *	Attribute Type	- SE_DATA_TYPE_STRING
73  *	Attribute Value	- [Attachment Point Name]
74  *	Attribute Name	- DR_REQ_TYPE
75  *	Attribute Type	- SE_DATA_TYPE_STRING
76  *	Attribute Value	- DR_RESERVED_ATTR | DR_REQ_INCOMING_RES |
77  *			DR_REQ_OUTGOING_RES | DR_REQ_INVESTIGATE_RES
78  */
79 #define	DR_REQ_TYPE	"dr_request_type"	/* User request type */
80 #define	DR_REQ_INCOMING_RES	"dr_request_incoming_resource"
81 #define	DR_REQ_OUTGOING_RES	"dr_request_outgoing_resource"
82 #define	DR_REQ_INVESTIGATE_RES	"dr_request_investigate_resource"
83 
84 #define	SE_INVESTIGATE_RES	0x0
85 #define	SE_INCOMING_RES		0x1
86 #define	SE_OUTGOING_RES		0x2
87 #define	SE_REQ2STR(h)		((h) == SE_INCOMING_RES ? \
88 					DR_REQ_INCOMING_RES : \
89 					(h) == SE_OUTGOING_RES ? \
90 					DR_REQ_OUTGOING_RES : \
91 					DR_REQ_INVESTIGATE_RES)
92 /*
93  * 	Event Class 	- EC_DR
94  * 	Event Sub-Class - ESC_DR_TARGET_STATE_CHANGE
95  * 	Event Publisher	- SUNW:kern:<driver-name>
96  * 	Attribute Name	- DR_TARGET_ID
97  * 	Attribute Type	- [SE_DATA_TYPE_STRING]
98  * 	Attribute Value	- </physical_path_to_hba:target>
99  * 	Attribute Name	- DR_HINT
100  * 	Attribute Type	- [SE_DATA_TYPE_STRING]
101  * 	Attribute Value	- DR_RESERVED_ATTR | DR_HINT_INSERT | DR_HINT_REMOVE
102  */
103 #define	DR_TARGET_ID	"dr_target_id"
104 
105 #ifdef	__cplusplus
106 }
107 #endif
108 
109 #endif /* _SYS_SYSEVENT_DR_H */
110