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