xref: /titanic_52/usr/src/uts/common/sys/ddi_hp.h (revision 69112edd987c28fa551d4f8d9362a84a45365f17)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_DDI_HP_H
27 #define	_SYS_DDI_HP_H
28 
29 /*
30  * Sun DDI hotplug support definitions
31  */
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * ddi_hp_cn_state_t
39  *
40  * Typedef of generic hotplug state machine for Hotplug Connection (CN)
41  */
42 typedef enum {
43 	DDI_HP_CN_STATE_EMPTY		= 0x1000, /* Empty */
44 	DDI_HP_CN_STATE_PRESENT		= 0x2000, /* A Device Present */
45 	DDI_HP_CN_STATE_POWERED		= 0x3000, /* Powered */
46 	DDI_HP_CN_STATE_ENABLED		= 0x4000, /* Enabled */
47 	DDI_HP_CN_STATE_PORT_EMPTY	= 0x5000, /* PORT Empty */
48 	DDI_HP_CN_STATE_PORT_PRESENT	= 0x6000, /* A Device Node Present */
49 	DDI_HP_CN_STATE_OFFLINE		= 0x7000, /* Driver not attached */
50 	DDI_HP_CN_STATE_ATTACHED	= 0x8000, /* Device driver attached */
51 	DDI_HP_CN_STATE_MAINTENANCE	= 0x9000, /* Device in maintenance */
52 	DDI_HP_CN_STATE_ONLINE		= 0xa000  /* Device is ready */
53 } ddi_hp_cn_state_t;
54 
55 /*
56  * ddi_hp_cn_type_t
57  *
58  * Typedef for Hotplug Connection (CN) types.
59  */
60 typedef enum {
61 	DDI_HP_CN_TYPE_VIRTUAL_PORT	= 0x1,	/* Virtual Hotplug Port */
62 	DDI_HP_CN_TYPE_PCI		= 0x2,	/* PCI bus slot */
63 	DDI_HP_CN_TYPE_PCIE		= 0x3	/* PCI Express slot */
64 } ddi_hp_cn_type_t;
65 
66 #define	DDI_HP_CN_TYPE_STR_PORT "Virtual-Port"
67 /*
68  * The value set to ddi_hp_cn_info_t->cn_num_dpd_on in the case of the
69  * connection does not depend on any other connections.
70  */
71 #define	DDI_HP_CN_NUM_NONE	-1
72 
73 /*
74  * ddi_hp_cn_info_t
75  *
76  * Hotplug Connection (CN) information structure
77  */
78 typedef struct ddi_hp_cn_info {
79 	char			*cn_name;	/* Name of the Connection */
80 	/*
81 	 * Connection number.
82 	 */
83 	int			cn_num;
84 	/*
85 	 * Depend-on connection number;
86 	 * The connection number on which this connection is depending on.
87 	 * If this connection does not depend on any other connections
88 	 * under the same parent node, then it's cn_num_dpd_on is set to
89 	 * DDI_HP_CN_NUM_NONE.
90 	 */
91 	int			cn_num_dpd_on;
92 
93 	ddi_hp_cn_type_t	cn_type;	/* Type: Port, PCI, PCIE, ... */
94 
95 	/*
96 	 * Description string for types of Connection. Set by bus software
97 	 * and read by users only.
98 	 */
99 	char			*cn_type_str;
100 	/*
101 	 * The child device of this Port.
102 	 * It is NULL if this is a Connector.
103 	 */
104 	dev_info_t		*cn_child;
105 
106 	ddi_hp_cn_state_t	cn_state;	/* Hotplug Connection state */
107 	time32_t		cn_last_change;	/* Last time state changed. */
108 } ddi_hp_cn_info_t;
109 
110 typedef struct ddi_hp_property {
111 	char	*nvlist_buf;
112 	size_t	buf_size;
113 } ddi_hp_property_t;
114 
115 #if defined(_SYSCALL32)
116 typedef struct ddi_hp_property32 {
117 	caddr32_t	nvlist_buf;
118 	uint32_t	buf_size;
119 } ddi_hp_property32_t;
120 #endif
121 
122 #ifdef	__cplusplus
123 }
124 #endif
125 
126 #endif	/* _SYS_DDI_HP_H */
127