xref: /onnv-gate/usr/src/uts/common/sys/ddi_hp.h (revision 10923:df470fd79c3c)
1*10923SEvan.Yan@Sun.COM /*
2*10923SEvan.Yan@Sun.COM  * CDDL HEADER START
3*10923SEvan.Yan@Sun.COM  *
4*10923SEvan.Yan@Sun.COM  * The contents of this file are subject to the terms of the
5*10923SEvan.Yan@Sun.COM  * Common Development and Distribution License (the "License").
6*10923SEvan.Yan@Sun.COM  * You may not use this file except in compliance with the License.
7*10923SEvan.Yan@Sun.COM  *
8*10923SEvan.Yan@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*10923SEvan.Yan@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*10923SEvan.Yan@Sun.COM  * See the License for the specific language governing permissions
11*10923SEvan.Yan@Sun.COM  * and limitations under the License.
12*10923SEvan.Yan@Sun.COM  *
13*10923SEvan.Yan@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*10923SEvan.Yan@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*10923SEvan.Yan@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*10923SEvan.Yan@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*10923SEvan.Yan@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*10923SEvan.Yan@Sun.COM  *
19*10923SEvan.Yan@Sun.COM  * CDDL HEADER END
20*10923SEvan.Yan@Sun.COM  */
21*10923SEvan.Yan@Sun.COM /*
22*10923SEvan.Yan@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*10923SEvan.Yan@Sun.COM  * Use is subject to license terms.
24*10923SEvan.Yan@Sun.COM  */
25*10923SEvan.Yan@Sun.COM 
26*10923SEvan.Yan@Sun.COM #ifndef	_SYS_DDI_HP_H
27*10923SEvan.Yan@Sun.COM #define	_SYS_DDI_HP_H
28*10923SEvan.Yan@Sun.COM 
29*10923SEvan.Yan@Sun.COM /*
30*10923SEvan.Yan@Sun.COM  * Sun DDI hotplug support definitions
31*10923SEvan.Yan@Sun.COM  */
32*10923SEvan.Yan@Sun.COM 
33*10923SEvan.Yan@Sun.COM #ifdef	__cplusplus
34*10923SEvan.Yan@Sun.COM extern "C" {
35*10923SEvan.Yan@Sun.COM #endif
36*10923SEvan.Yan@Sun.COM 
37*10923SEvan.Yan@Sun.COM /*
38*10923SEvan.Yan@Sun.COM  * ddi_hp_cn_state_t
39*10923SEvan.Yan@Sun.COM  *
40*10923SEvan.Yan@Sun.COM  * Typedef of generic hotplug state machine for Hotplug Connection (CN)
41*10923SEvan.Yan@Sun.COM  */
42*10923SEvan.Yan@Sun.COM typedef enum {
43*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_STATE_EMPTY		= 0x1000, /* Empty */
44*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_STATE_PRESENT		= 0x2000, /* A Device Present */
45*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_STATE_POWERED		= 0x3000, /* Powered */
46*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_STATE_ENABLED		= 0x4000, /* Enabled */
47*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_STATE_PORT_EMPTY	= 0x5000, /* PORT Empty */
48*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_STATE_PORT_PRESENT	= 0x6000, /* A Device Node Present */
49*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_STATE_OFFLINE		= 0x7000, /* Driver not attached */
50*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_STATE_ATTACHED	= 0x8000, /* Device driver attached */
51*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_STATE_MAINTENANCE	= 0x9000, /* Device in maintenance */
52*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_STATE_ONLINE		= 0xa000  /* Device is ready */
53*10923SEvan.Yan@Sun.COM } ddi_hp_cn_state_t;
54*10923SEvan.Yan@Sun.COM 
55*10923SEvan.Yan@Sun.COM /*
56*10923SEvan.Yan@Sun.COM  * ddi_hp_cn_type_t
57*10923SEvan.Yan@Sun.COM  *
58*10923SEvan.Yan@Sun.COM  * Typedef for Hotplug Connection (CN) types.
59*10923SEvan.Yan@Sun.COM  */
60*10923SEvan.Yan@Sun.COM typedef enum {
61*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_TYPE_VIRTUAL_PORT	= 0x1,	/* Virtual Hotplug Port */
62*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_TYPE_PCI		= 0x2,	/* PCI bus slot */
63*10923SEvan.Yan@Sun.COM 	DDI_HP_CN_TYPE_PCIE		= 0x3	/* PCI Express slot */
64*10923SEvan.Yan@Sun.COM } ddi_hp_cn_type_t;
65*10923SEvan.Yan@Sun.COM 
66*10923SEvan.Yan@Sun.COM #define	DDI_HP_CN_TYPE_STR_PORT "Virtual-Port"
67*10923SEvan.Yan@Sun.COM /*
68*10923SEvan.Yan@Sun.COM  * The value set to ddi_hp_cn_info_t->cn_num_dpd_on in the case of the
69*10923SEvan.Yan@Sun.COM  * connection does not depend on any other connections.
70*10923SEvan.Yan@Sun.COM  */
71*10923SEvan.Yan@Sun.COM #define	DDI_HP_CN_NUM_NONE	-1
72*10923SEvan.Yan@Sun.COM 
73*10923SEvan.Yan@Sun.COM /*
74*10923SEvan.Yan@Sun.COM  * ddi_hp_cn_info_t
75*10923SEvan.Yan@Sun.COM  *
76*10923SEvan.Yan@Sun.COM  * Hotplug Connection (CN) information structure
77*10923SEvan.Yan@Sun.COM  */
78*10923SEvan.Yan@Sun.COM typedef struct ddi_hp_cn_info {
79*10923SEvan.Yan@Sun.COM 	char			*cn_name;	/* Name of the Connection */
80*10923SEvan.Yan@Sun.COM 	/*
81*10923SEvan.Yan@Sun.COM 	 * Connection number.
82*10923SEvan.Yan@Sun.COM 	 */
83*10923SEvan.Yan@Sun.COM 	int			cn_num;
84*10923SEvan.Yan@Sun.COM 	/*
85*10923SEvan.Yan@Sun.COM 	 * Depend-on connection number;
86*10923SEvan.Yan@Sun.COM 	 * The connection number on which this connection is depending on.
87*10923SEvan.Yan@Sun.COM 	 * If this connection does not depend on any other connections
88*10923SEvan.Yan@Sun.COM 	 * under the same parent node, then it's cn_num_dpd_on is set to
89*10923SEvan.Yan@Sun.COM 	 * DDI_HP_CN_NUM_NONE.
90*10923SEvan.Yan@Sun.COM 	 */
91*10923SEvan.Yan@Sun.COM 	int			cn_num_dpd_on;
92*10923SEvan.Yan@Sun.COM 
93*10923SEvan.Yan@Sun.COM 	ddi_hp_cn_type_t	cn_type;	/* Type: Port, PCI, PCIE, ... */
94*10923SEvan.Yan@Sun.COM 
95*10923SEvan.Yan@Sun.COM 	/*
96*10923SEvan.Yan@Sun.COM 	 * Description string for types of Connection. Set by bus software
97*10923SEvan.Yan@Sun.COM 	 * and read by users only.
98*10923SEvan.Yan@Sun.COM 	 */
99*10923SEvan.Yan@Sun.COM 	char			*cn_type_str;
100*10923SEvan.Yan@Sun.COM 	/*
101*10923SEvan.Yan@Sun.COM 	 * The child device of this Port.
102*10923SEvan.Yan@Sun.COM 	 * It is NULL if this is a Connector.
103*10923SEvan.Yan@Sun.COM 	 */
104*10923SEvan.Yan@Sun.COM 	dev_info_t		*cn_child;
105*10923SEvan.Yan@Sun.COM 
106*10923SEvan.Yan@Sun.COM 	ddi_hp_cn_state_t	cn_state;	/* Hotplug Connection state */
107*10923SEvan.Yan@Sun.COM 	time32_t		cn_last_change;	/* Last time state changed. */
108*10923SEvan.Yan@Sun.COM } ddi_hp_cn_info_t;
109*10923SEvan.Yan@Sun.COM 
110*10923SEvan.Yan@Sun.COM typedef struct ddi_hp_property {
111*10923SEvan.Yan@Sun.COM 	char	*nvlist_buf;
112*10923SEvan.Yan@Sun.COM 	size_t	buf_size;
113*10923SEvan.Yan@Sun.COM } ddi_hp_property_t;
114*10923SEvan.Yan@Sun.COM 
115*10923SEvan.Yan@Sun.COM #if defined(_SYSCALL32)
116*10923SEvan.Yan@Sun.COM typedef struct ddi_hp_property32 {
117*10923SEvan.Yan@Sun.COM 	caddr32_t	nvlist_buf;
118*10923SEvan.Yan@Sun.COM 	uint32_t	buf_size;
119*10923SEvan.Yan@Sun.COM } ddi_hp_property32_t;
120*10923SEvan.Yan@Sun.COM #endif
121*10923SEvan.Yan@Sun.COM 
122*10923SEvan.Yan@Sun.COM #ifdef	__cplusplus
123*10923SEvan.Yan@Sun.COM }
124*10923SEvan.Yan@Sun.COM #endif
125*10923SEvan.Yan@Sun.COM 
126*10923SEvan.Yan@Sun.COM #endif	/* _SYS_DDI_HP_H */
127