126947304SEvan Yan /* 226947304SEvan Yan * CDDL HEADER START 326947304SEvan Yan * 426947304SEvan Yan * The contents of this file are subject to the terms of the 526947304SEvan Yan * Common Development and Distribution License (the "License"). 626947304SEvan Yan * You may not use this file except in compliance with the License. 726947304SEvan Yan * 826947304SEvan Yan * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 926947304SEvan Yan * or http://www.opensolaris.org/os/licensing. 1026947304SEvan Yan * See the License for the specific language governing permissions 1126947304SEvan Yan * and limitations under the License. 1226947304SEvan Yan * 1326947304SEvan Yan * When distributing Covered Code, include this CDDL HEADER in each 1426947304SEvan Yan * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1526947304SEvan Yan * If applicable, add the following below this CDDL HEADER, with the 1626947304SEvan Yan * fields enclosed by brackets "[]" replaced with your own identifying 1726947304SEvan Yan * information: Portions Copyright [yyyy] [name of copyright owner] 1826947304SEvan Yan * 1926947304SEvan Yan * CDDL HEADER END 2026947304SEvan Yan */ 2126947304SEvan Yan /* 2226947304SEvan Yan * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 2326947304SEvan Yan * Use is subject to license terms. 24*ffb64830SJordan Paige Hendricks * 25*ffb64830SJordan Paige Hendricks * Copyright 2019 Joyent, Inc. 2626947304SEvan Yan */ 2726947304SEvan Yan 2826947304SEvan Yan #ifndef _SYS_DDI_HP_H 2926947304SEvan Yan #define _SYS_DDI_HP_H 3026947304SEvan Yan 3126947304SEvan Yan /* 3226947304SEvan Yan * Sun DDI hotplug support definitions 33*ffb64830SJordan Paige Hendricks * 34*ffb64830SJordan Paige Hendricks * See the big theory statement in uts/common/os/ddi_hp_impl.c for more 35*ffb64830SJordan Paige Hendricks * information. 3626947304SEvan Yan */ 3726947304SEvan Yan 3826947304SEvan Yan #ifdef __cplusplus 3926947304SEvan Yan extern "C" { 4026947304SEvan Yan #endif 4126947304SEvan Yan 4226947304SEvan Yan /* 4326947304SEvan Yan * ddi_hp_cn_state_t 4426947304SEvan Yan * 4526947304SEvan Yan * Typedef of generic hotplug state machine for Hotplug Connection (CN) 4626947304SEvan Yan */ 4726947304SEvan Yan typedef enum { 4826947304SEvan Yan DDI_HP_CN_STATE_EMPTY = 0x1000, /* Empty */ 4926947304SEvan Yan DDI_HP_CN_STATE_PRESENT = 0x2000, /* A Device Present */ 5026947304SEvan Yan DDI_HP_CN_STATE_POWERED = 0x3000, /* Powered */ 5126947304SEvan Yan DDI_HP_CN_STATE_ENABLED = 0x4000, /* Enabled */ 5226947304SEvan Yan DDI_HP_CN_STATE_PORT_EMPTY = 0x5000, /* PORT Empty */ 5326947304SEvan Yan DDI_HP_CN_STATE_PORT_PRESENT = 0x6000, /* A Device Node Present */ 5426947304SEvan Yan DDI_HP_CN_STATE_OFFLINE = 0x7000, /* Driver not attached */ 5526947304SEvan Yan DDI_HP_CN_STATE_ATTACHED = 0x8000, /* Device driver attached */ 5626947304SEvan Yan DDI_HP_CN_STATE_MAINTENANCE = 0x9000, /* Device in maintenance */ 5726947304SEvan Yan DDI_HP_CN_STATE_ONLINE = 0xa000 /* Device is ready */ 5826947304SEvan Yan } ddi_hp_cn_state_t; 5926947304SEvan Yan 6026947304SEvan Yan /* 6126947304SEvan Yan * ddi_hp_cn_type_t 6226947304SEvan Yan * 6326947304SEvan Yan * Typedef for Hotplug Connection (CN) types. 6426947304SEvan Yan */ 6526947304SEvan Yan typedef enum { 6626947304SEvan Yan DDI_HP_CN_TYPE_VIRTUAL_PORT = 0x1, /* Virtual Hotplug Port */ 6726947304SEvan Yan DDI_HP_CN_TYPE_PCI = 0x2, /* PCI bus slot */ 6826947304SEvan Yan DDI_HP_CN_TYPE_PCIE = 0x3 /* PCI Express slot */ 6926947304SEvan Yan } ddi_hp_cn_type_t; 7026947304SEvan Yan 7126947304SEvan Yan #define DDI_HP_CN_TYPE_STR_PORT "Virtual-Port" 7226947304SEvan Yan /* 7326947304SEvan Yan * The value set to ddi_hp_cn_info_t->cn_num_dpd_on in the case of the 7426947304SEvan Yan * connection does not depend on any other connections. 7526947304SEvan Yan */ 7626947304SEvan Yan #define DDI_HP_CN_NUM_NONE -1 7726947304SEvan Yan 7826947304SEvan Yan /* 7926947304SEvan Yan * ddi_hp_cn_info_t 8026947304SEvan Yan * 81*ffb64830SJordan Paige Hendricks * Hotplug Connection (CN) information structure. 82*ffb64830SJordan Paige Hendricks * A Connection is either a Connector or a Port. 8326947304SEvan Yan */ 8426947304SEvan Yan typedef struct ddi_hp_cn_info { 8526947304SEvan Yan char *cn_name; /* Name of the Connection */ 8626947304SEvan Yan /* 8726947304SEvan Yan * Connection number. 8826947304SEvan Yan */ 8926947304SEvan Yan int cn_num; 9026947304SEvan Yan /* 9126947304SEvan Yan * Depend-on connection number; 9226947304SEvan Yan * The connection number on which this connection is depending on. 9326947304SEvan Yan * If this connection does not depend on any other connections 9426947304SEvan Yan * under the same parent node, then it's cn_num_dpd_on is set to 9526947304SEvan Yan * DDI_HP_CN_NUM_NONE. 9626947304SEvan Yan */ 9726947304SEvan Yan int cn_num_dpd_on; 9826947304SEvan Yan 9926947304SEvan Yan ddi_hp_cn_type_t cn_type; /* Type: Port, PCI, PCIE, ... */ 10026947304SEvan Yan 10126947304SEvan Yan /* 10226947304SEvan Yan * Description string for types of Connection. Set by bus software 10326947304SEvan Yan * and read by users only. 10426947304SEvan Yan */ 10526947304SEvan Yan char *cn_type_str; 10626947304SEvan Yan /* 10726947304SEvan Yan * The child device of this Port. 10826947304SEvan Yan * It is NULL if this is a Connector. 10926947304SEvan Yan */ 11026947304SEvan Yan dev_info_t *cn_child; 11126947304SEvan Yan 11226947304SEvan Yan ddi_hp_cn_state_t cn_state; /* Hotplug Connection state */ 11326947304SEvan Yan time32_t cn_last_change; /* Last time state changed. */ 11426947304SEvan Yan } ddi_hp_cn_info_t; 11526947304SEvan Yan 11626947304SEvan Yan typedef struct ddi_hp_property { 11726947304SEvan Yan char *nvlist_buf; 11826947304SEvan Yan size_t buf_size; 11926947304SEvan Yan } ddi_hp_property_t; 12026947304SEvan Yan 12126947304SEvan Yan #if defined(_SYSCALL32) 12226947304SEvan Yan typedef struct ddi_hp_property32 { 12326947304SEvan Yan caddr32_t nvlist_buf; 12426947304SEvan Yan uint32_t buf_size; 12526947304SEvan Yan } ddi_hp_property32_t; 12626947304SEvan Yan #endif 12726947304SEvan Yan 12826947304SEvan Yan #ifdef __cplusplus 12926947304SEvan Yan } 13026947304SEvan Yan #endif 13126947304SEvan Yan 13226947304SEvan Yan #endif /* _SYS_DDI_HP_H */ 133