17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24*ba3594baSGarrett D'Amore  *
2570025d76Sjohnny  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifndef	_SYS_HOTPLUG_HPCTRL_H
307c478bd9Sstevel@tonic-gate #define	_SYS_HOTPLUG_HPCTRL_H
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * ****************************************************************
347c478bd9Sstevel@tonic-gate  * Hot Plug Controller interfaces for PCI and CompactPCI platforms.
357c478bd9Sstevel@tonic-gate  * ****************************************************************
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate #include <sys/types.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
407c478bd9Sstevel@tonic-gate extern "C" {
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * Type definition for slot handle. This is an opaque pointer
457c478bd9Sstevel@tonic-gate  * created by the HPS framework.
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate typedef void *hpc_slot_t;
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #define	HPC_SLOT_OPS_VERSION	0
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /*
527c478bd9Sstevel@tonic-gate  * slot operations structure definition.
537c478bd9Sstevel@tonic-gate  *
547c478bd9Sstevel@tonic-gate  *	Function		Description
557c478bd9Sstevel@tonic-gate  *	--------		-----------
567c478bd9Sstevel@tonic-gate  *	xxx_op_connect		CONNECT the slot to the bus to enable
577c478bd9Sstevel@tonic-gate  *				access to the adapter.
587c478bd9Sstevel@tonic-gate  *	xxx_op_disconnect	DISCONNECT the slot from the bus. For PCI,
597c478bd9Sstevel@tonic-gate  *				this disables the power to the slot.
607c478bd9Sstevel@tonic-gate  *	xxx_op_insert		Prepare the slot for card insertion. This
617c478bd9Sstevel@tonic-gate  *				may not be applicable for all bus types.
627c478bd9Sstevel@tonic-gate  *	xxx_op_remove		Prepare the slot for card removal. This
637c478bd9Sstevel@tonic-gate  *				may not be applicable for all bus types.
647c478bd9Sstevel@tonic-gate  *	xxx_op_control		Perform misc. commands to control the
657c478bd9Sstevel@tonic-gate  *				LEDs, get status information, etc.
667c478bd9Sstevel@tonic-gate  */
677c478bd9Sstevel@tonic-gate typedef struct hpc_slot_ops {
687c478bd9Sstevel@tonic-gate 	int	hpc_version;			/* HPC_SLOT_OPS_VERSION */
697c478bd9Sstevel@tonic-gate 	int	(*hpc_op_connect)(caddr_t ops_arg, hpc_slot_t slot_hdl,
707c478bd9Sstevel@tonic-gate 			void *data, uint_t flags);
717c478bd9Sstevel@tonic-gate 	int	(*hpc_op_disconnect)(caddr_t ops_arg, hpc_slot_t slot_hdl,
727c478bd9Sstevel@tonic-gate 			void *data, uint_t flags);
737c478bd9Sstevel@tonic-gate 	int	(*hpc_op_insert)(caddr_t ops_arg, hpc_slot_t slot_hdl,
747c478bd9Sstevel@tonic-gate 			void *data, uint_t flags);
757c478bd9Sstevel@tonic-gate 	int	(*hpc_op_remove)(caddr_t ops_arg, hpc_slot_t slot_hdl,
767c478bd9Sstevel@tonic-gate 			void *data, uint_t flags);
777c478bd9Sstevel@tonic-gate 	int	(*hpc_op_control)(caddr_t ops_arg, hpc_slot_t slot_hdl,
787c478bd9Sstevel@tonic-gate 			int request, caddr_t arg);
797c478bd9Sstevel@tonic-gate } hpc_slot_ops_t;
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate #define	HPC_SLOT_INFO_VERSION	1
827c478bd9Sstevel@tonic-gate #define	PCI_SLOT_NAME_LEN	256
837c478bd9Sstevel@tonic-gate /*
847c478bd9Sstevel@tonic-gate  * Slot information structure.
857c478bd9Sstevel@tonic-gate  */
867c478bd9Sstevel@tonic-gate typedef struct hpc_slot_info {
877c478bd9Sstevel@tonic-gate 	uint16_t	version;		/* HPC_SLOT_INFO_VERSION */
887c478bd9Sstevel@tonic-gate 	uint16_t	slot_type;		/* slot type: PCI, ... */
897c478bd9Sstevel@tonic-gate 	uint16_t	slot_flags;
907c478bd9Sstevel@tonic-gate 	union {
917c478bd9Sstevel@tonic-gate 	    /* pci bus slot */
927c478bd9Sstevel@tonic-gate 	    struct pci_slot_info {
937c478bd9Sstevel@tonic-gate 		uint16_t	device_number;		/* PCI device number */
947c478bd9Sstevel@tonic-gate 		uint16_t	slot_capabilities;	/* 64bit, etc. */
957c478bd9Sstevel@tonic-gate 		char		slot_logical_name[PCI_SLOT_NAME_LEN];
967c478bd9Sstevel@tonic-gate 	    } pci;
977c478bd9Sstevel@tonic-gate 	    struct sbd_slot_info {
987c478bd9Sstevel@tonic-gate 		int		slot_num;
997c478bd9Sstevel@tonic-gate 	    } sbd;
1007c478bd9Sstevel@tonic-gate 	    /* other bus types go here... */
1017c478bd9Sstevel@tonic-gate 	} slot;
1027c478bd9Sstevel@tonic-gate } hpc_slot_info_t;
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /* short names for bus specific fields in hpc_slot_info structure */
1057c478bd9Sstevel@tonic-gate #define	pci_dev_num		slot.pci.device_number
1067c478bd9Sstevel@tonic-gate #define	pci_slot_name		slot.pci.slot_logical_name
1077c478bd9Sstevel@tonic-gate #define	pci_slot_capabilities	slot.pci.slot_capabilities
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #define	sbd_slot_num		slot.sbd.slot_num
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate /* slot_type definitions */
1127c478bd9Sstevel@tonic-gate #define	HPC_SLOT_TYPE_PCI	0x1		/* PCI bus slot */
1137c478bd9Sstevel@tonic-gate #define	HPC_SLOT_TYPE_CPCI	0x2		/* Compact PCI bus slot */
1147c478bd9Sstevel@tonic-gate #define	HPC_SLOT_TYPE_SBD	0x3		/* System bus slot */
11570025d76Sjohnny #define	HPC_SLOT_TYPE_PCIE	0x4		/* PCI Express slot */
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate /* bit definitions in slot_capabilities field for PCI or cPCI bus slots */
1187c478bd9Sstevel@tonic-gate #define	HPC_SLOT_64BITS		0x0001	/* slot is a 64bit slot */
1197c478bd9Sstevel@tonic-gate #define	HPC_SLOT_TEST		0x0002	/* testing capability on the slot */
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /* slot_flags definitions */
1227c478bd9Sstevel@tonic-gate #define	HPC_SLOT_NO_AUTO_ENABLE	0x1	/* No auto-enable on registration */
1237c478bd9Sstevel@tonic-gate #define	HPC_SLOT_CREATE_DEVLINK	0x2	/* create device link under /dev/cfg */
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate /*
1267c478bd9Sstevel@tonic-gate  * xxx_op_control command definitions.
1277c478bd9Sstevel@tonic-gate  *
1287c478bd9Sstevel@tonic-gate  * 	Command (request)	   arg			Descritpion
1297c478bd9Sstevel@tonic-gate  *	-----------------	   ---			-----------
1307c478bd9Sstevel@tonic-gate  *	HPC_CTRL_GET_LED_STATE	   hpc_led_info *	Get state of an LED.
1317c478bd9Sstevel@tonic-gate  *	HPC_CTRL_SET_LED_STATE	   hpc_led_info *	Set state of an LED.
1327c478bd9Sstevel@tonic-gate  *	HPC_CTRL_GET_SLOT_STATE	   hpc_slot_state_t *	Get the slot state.
1337c478bd9Sstevel@tonic-gate  *	HPC_CTRL_DEV_CONFIGURED	   NULL 		Board is configured.
1347c478bd9Sstevel@tonic-gate  *	HPC_CTRL_DEV_UNCONFIGURED  NULL 		Board is unconfigured.
1357c478bd9Sstevel@tonic-gate  *	HPC_CTRL_DEV_CONFIG_FAILURE NULL	Board Configuration Failed
1367c478bd9Sstevel@tonic-gate  *	HPC_CTRL_DEV_UNCONFIG_FAILURE NULL	Board Unconfiguration Failed
1377c478bd9Sstevel@tonic-gate  *	HPC_CTRL_GET_BOARD_TYPE    hpc_board_type_t *	Get board type info.
1387c478bd9Sstevel@tonic-gate  *	HPC_CTRL_DISABLE_AUTOCFG   NULL			Disable auto config-
1397c478bd9Sstevel@tonic-gate  *							uration for this slot.
1407c478bd9Sstevel@tonic-gate  *	HPC_CTRL_ENABLE_AUTOCFG    NULL			Enable auto config-
1417c478bd9Sstevel@tonic-gate  *							uration for this slot.
1427c478bd9Sstevel@tonic-gate  *	HPC_CTRL_DISABLE_SLOT	   NULL			Disable the slot for
1437c478bd9Sstevel@tonic-gate  *							hot plug operations.
1447c478bd9Sstevel@tonic-gate  *	HPC_CTRL_ENABLE_SLOT	   NULL			ReEnable the slot for
1457c478bd9Sstevel@tonic-gate  *							hot plug operations.
1467c478bd9Sstevel@tonic-gate  */
1477c478bd9Sstevel@tonic-gate #define	HPC_CTRL_GET_LED_STATE		0x1
1487c478bd9Sstevel@tonic-gate #define	HPC_CTRL_SET_LED_STATE		0x2
1497c478bd9Sstevel@tonic-gate #define	HPC_CTRL_GET_SLOT_STATE		0x3
1507c478bd9Sstevel@tonic-gate #define	HPC_CTRL_DEV_CONFIGURED		0x4
1517c478bd9Sstevel@tonic-gate #define	HPC_CTRL_DEV_UNCONFIGURED	0x5
1527c478bd9Sstevel@tonic-gate #define	HPC_CTRL_GET_BOARD_TYPE		0x6
1537c478bd9Sstevel@tonic-gate #define	HPC_CTRL_DISABLE_AUTOCFG	0x7
1547c478bd9Sstevel@tonic-gate #define	HPC_CTRL_ENABLE_AUTOCFG		0x8
1557c478bd9Sstevel@tonic-gate #define	HPC_CTRL_DISABLE_SLOT		0x9
1567c478bd9Sstevel@tonic-gate #define	HPC_CTRL_ENABLE_SLOT		0xa
1577c478bd9Sstevel@tonic-gate #define	HPC_CTRL_DISABLE_ENUM		0xb
1587c478bd9Sstevel@tonic-gate #define	HPC_CTRL_ENABLE_ENUM		0xc
1597c478bd9Sstevel@tonic-gate #define	HPC_CTRL_DEV_CONFIG_FAILURE	0xd
1607c478bd9Sstevel@tonic-gate #define	HPC_CTRL_DEV_UNCONFIG_FAILURE	0xe
1617c478bd9Sstevel@tonic-gate #define	HPC_CTRL_DEV_CONFIG_START	0xf
1627c478bd9Sstevel@tonic-gate #define	HPC_CTRL_DEV_UNCONFIG_START	0x10
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate /*
1657c478bd9Sstevel@tonic-gate  * type definitions for led information.
1667c478bd9Sstevel@tonic-gate  *
1677c478bd9Sstevel@tonic-gate  * Note: ATTN/ACTIVE leds are platform specific and they may not be
1687c478bd9Sstevel@tonic-gate  *	 available on all platforms.
1697c478bd9Sstevel@tonic-gate  */
1707c478bd9Sstevel@tonic-gate typedef enum { HPC_FAULT_LED, HPC_POWER_LED, HPC_ATTN_LED,
1717c478bd9Sstevel@tonic-gate 	HPC_ACTIVE_LED} hpc_led_t;
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate typedef enum { HPC_LED_OFF, HPC_LED_ON, HPC_LED_BLINK } hpc_led_state_t;
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate typedef struct hpc_led_info {
1767c478bd9Sstevel@tonic-gate 	hpc_led_t	led;	/* led id: HPC_POWER_LED, HPC_FAULT_LED, ... */
1777c478bd9Sstevel@tonic-gate 	hpc_led_state_t	state;	/* led state: HPC_LED_ON, HPC_LED_OFF, ... */
1787c478bd9Sstevel@tonic-gate } hpc_led_info_t;
1797c478bd9Sstevel@tonic-gate 
1807c478bd9Sstevel@tonic-gate /*
1817c478bd9Sstevel@tonic-gate  * type definition for slot state.
1827c478bd9Sstevel@tonic-gate  *
1837c478bd9Sstevel@tonic-gate  *	HPC_SLOT_EMPTY		Slot has no card present.
1847c478bd9Sstevel@tonic-gate  *	HPC_SLOT_CONNECTED	Card is present in the slot and it is
1857c478bd9Sstevel@tonic-gate  *				connected to the bus.
1867c478bd9Sstevel@tonic-gate  *	HPC_SLOT_DISCONNECTED	Card is present in the slot and it is
1877c478bd9Sstevel@tonic-gate  *				disconnected from the bus.
1887c478bd9Sstevel@tonic-gate  *	HPC_SLOT_UNKNOWN	If the HPC driver can not figure out
1897c478bd9Sstevel@tonic-gate  *				the receptacle state. This is possible
1907c478bd9Sstevel@tonic-gate  *				on Compact PCI Hot Swap platform.
1917c478bd9Sstevel@tonic-gate  */
1927c478bd9Sstevel@tonic-gate typedef enum { HPC_SLOT_EMPTY, HPC_SLOT_DISCONNECTED,
1937c478bd9Sstevel@tonic-gate 	HPC_SLOT_CONNECTED, HPC_SLOT_UNKNOWN } hpc_slot_state_t;
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate /*
1967c478bd9Sstevel@tonic-gate  * type definition for board type.
1977c478bd9Sstevel@tonic-gate  *
1987c478bd9Sstevel@tonic-gate  *	HPC_BOARD_UNKNOWN	Board is either not present or unknown.
19970025d76Sjohnny  *	HPC_BOARD_PCI_HOTPLUG	PCI or PCIe adapter.
2007c478bd9Sstevel@tonic-gate  *	HPC_BOARD_CPCI_NON_HS	Non Hot Swap cPCI board.
2017c478bd9Sstevel@tonic-gate  *	HPC_BOARD_CPCI_BASIC_HS	Basic Hot Swap cPCI board.
2027c478bd9Sstevel@tonic-gate  *	HPC_BOARD_CPCI_FULL_HS	Full Hot Swap cPCI board.
2037c478bd9Sstevel@tonic-gate  *	HPC_BOARD_CPCI_HS	Indicates if HSC driver can not determine
2047c478bd9Sstevel@tonic-gate  *				the type of Hot Swap board.
2057c478bd9Sstevel@tonic-gate  */
2067c478bd9Sstevel@tonic-gate typedef enum { HPC_BOARD_UNKNOWN, HPC_BOARD_PCI_HOTPLUG,
2077c478bd9Sstevel@tonic-gate 	HPC_BOARD_CPCI_NON_HS, HPC_BOARD_CPCI_BASIC_HS,
2087c478bd9Sstevel@tonic-gate 	HPC_BOARD_CPCI_FULL_HS, HPC_BOARD_CPCI_HS } hpc_board_type_t;
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate /*
2117c478bd9Sstevel@tonic-gate  * Event type definitions (for hpc_event_notify() interface).
2127c478bd9Sstevel@tonic-gate  *
2137c478bd9Sstevel@tonic-gate  *	Event			   Descritpion
2147c478bd9Sstevel@tonic-gate  *	-----			   -----------
2157c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_INSERTION   Card is inserted in the slot.
2167c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_REMOVAL	   Card is removed from the slot.
2177c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_POWER_ON	   Slot is powered ON.
2187c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_POWER_OFF   Slot is powered OFF.
2197c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_LATCH_OPEN  LATCH on the slot is open.
2207c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_LATCH_SHUT  LATCH on the slot is shut.
2217c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_ENUM	   ENUM# signal is generated on the bus
2227c478bd9Sstevel@tonic-gate  *				   and it may be generated from this slot.
2237c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_NOT_HEALTHY HEALTHY# signal is lost on this slot.
2247c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_HEALTHY_OK  HEALTHY# signal on this slot is OK now.
2257c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_CONFIGURE   Configure the occupant in the slot.
2267c478bd9Sstevel@tonic-gate  *	HPC_EVENT_SLOT_UNCONFIGURE Unconfigure the occupant in the slot.
2277c478bd9Sstevel@tonic-gate  */
2287c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_INSERTION	0x00000001
2297c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_REMOVAL		0x00000002
2307c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_POWER_ON		0x00000004
2317c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_POWER_OFF	0x00000008
2327c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_LATCH_OPEN	0x00000010
2337c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_LATCH_SHUT	0x00000020
2347c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_ENUM		0x00000040
2357c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_NOT_HEALTHY	0x00000080
2367c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_HEALTHY_OK	0x00000100
2377c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_CONFIGURE	0x00000200
2387c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_UNCONFIGURE	0x00000400
2397c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_BLUE_LED_ON	0x00000800
2407c478bd9Sstevel@tonic-gate #define	HPC_EVENT_SLOT_BLUE_LED_OFF	0x00001000
2417c478bd9Sstevel@tonic-gate #define	HPC_EVENT_CLEAR_ENUM		0x00002000
2427c478bd9Sstevel@tonic-gate #define	HPC_EVENT_PROCESS_ENUM		0x00004000
2437c478bd9Sstevel@tonic-gate #define	HPC_EVENT_ENABLE_ENUM		0x00008000
2447c478bd9Sstevel@tonic-gate #define	HPC_EVENT_DISABLE_ENUM		0x00010000
2457c478bd9Sstevel@tonic-gate #define	HPC_EVENT_BUS_ENUM		HPC_EVENT_SLOT_ENUM
24670025d76Sjohnny #define	HPC_EVENT_SLOT_ATTN		0x00020000
24770025d76Sjohnny #define	HPC_EVENT_SLOT_POWER_FAULT  	0x00040000
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate /*
2507c478bd9Sstevel@tonic-gate  * return values for errors from HPS framework interfaces.
2517c478bd9Sstevel@tonic-gate  */
2527c478bd9Sstevel@tonic-gate #define	HPC_SUCCESS			0x0
2537c478bd9Sstevel@tonic-gate #define	HPC_ERR_INVALID			0x1	/* invalid arguments */
2547c478bd9Sstevel@tonic-gate #define	HPC_ERR_SLOT_NOTREGISTERED	0x2	/* slot is not registered */
2557c478bd9Sstevel@tonic-gate #define	HPC_ERR_SLOT_DUPLICATE		0x3	/* slot is already registered */
2567c478bd9Sstevel@tonic-gate #define	HPC_ERR_BUS_NOTREGISTERED	0x4	/* slot is not registered */
2577c478bd9Sstevel@tonic-gate #define	HPC_ERR_BUS_DUPLICATE		0x5	/* slot is already registered */
2587c478bd9Sstevel@tonic-gate #define	HPC_ERR_NOTSUPPORTED		0x6	/* operation not supported */
2597c478bd9Sstevel@tonic-gate #define	HPC_ERR_FAILED			0x7	/* operation failed */
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate /* return values for event notifications */
2627c478bd9Sstevel@tonic-gate #define	HPC_EVENT_CLAIMED		0x10	/* HPC event is claimed */
2637c478bd9Sstevel@tonic-gate #define	HPC_EVENT_UNCLAIMED		-1	/* HPC event is not claimed */
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate /* definitions for slot (un)registration events */
2667c478bd9Sstevel@tonic-gate #define	HPC_SLOT_ONLINE		1	/* slot is registered */
2677c478bd9Sstevel@tonic-gate #define	HPC_SLOT_OFFLINE	2	/* slot is unregistered */
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate /*
2707c478bd9Sstevel@tonic-gate  * function prototype definitions for interfaces between HPC driver
2717c478bd9Sstevel@tonic-gate  * and Hot Plug Services framework.
2727c478bd9Sstevel@tonic-gate  */
2737c478bd9Sstevel@tonic-gate extern int hpc_slot_register(dev_info_t *dip, char *bus_path,
2747c478bd9Sstevel@tonic-gate 	hpc_slot_info_t *slot_info, hpc_slot_t *slot_hdl,
2757c478bd9Sstevel@tonic-gate 	hpc_slot_ops_t *slot_ops, caddr_t ops_arg, uint_t flags);
2767c478bd9Sstevel@tonic-gate extern int hpc_slot_unregister(hpc_slot_t *slot_hdl);
2777c478bd9Sstevel@tonic-gate extern struct hpc_slot_ops *hpc_alloc_slot_ops(int sleepflag);
2787c478bd9Sstevel@tonic-gate extern void hpc_free_slot_ops(hpc_slot_ops_t *ops);
2797c478bd9Sstevel@tonic-gate extern int hpc_slot_event_notify(hpc_slot_t slot_hdl, uint_t event,
2807c478bd9Sstevel@tonic-gate 	uint_t flags);
2817c478bd9Sstevel@tonic-gate extern boolean_t hpc_bus_registered(hpc_slot_t slot_hdl);
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate /*
2847c478bd9Sstevel@tonic-gate  * *****************************************************************
2857c478bd9Sstevel@tonic-gate  * Implementation specific data structures and definitons. These are
2867c478bd9Sstevel@tonic-gate  * the private interfaces between cfgadm plug-in and the PCI nexus
2877c478bd9Sstevel@tonic-gate  * driver.
2887c478bd9Sstevel@tonic-gate  * *****************************************************************
2897c478bd9Sstevel@tonic-gate  */
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate /*
2927c478bd9Sstevel@tonic-gate  * Data structure used for DEVCTL_AP_CONTROL ioctl on the AP.
2937c478bd9Sstevel@tonic-gate  */
2947c478bd9Sstevel@tonic-gate struct hpc_control_data {
2957c478bd9Sstevel@tonic-gate 	uint_t	cmd;		/* HPC_CTRL_* command */
2967c478bd9Sstevel@tonic-gate 	void	*data;		/* pointer to data that is exchanged */
2977c478bd9Sstevel@tonic-gate };
2987c478bd9Sstevel@tonic-gate 
2997c478bd9Sstevel@tonic-gate struct hpc_control32_data {
3007c478bd9Sstevel@tonic-gate 	uint_t	  cmd;		/* HPC_CTRL_* command */
3017c478bd9Sstevel@tonic-gate 	caddr32_t data;		/* pointer to data that is exchanged */
3027c478bd9Sstevel@tonic-gate };
3037c478bd9Sstevel@tonic-gate 
3047c478bd9Sstevel@tonic-gate /* misc. control commands for DEVCTL_AP_CONTROL ioctl interface */
3057c478bd9Sstevel@tonic-gate #define	HPC_CTRL_GET_SLOT_INFO	0x100
3067c478bd9Sstevel@tonic-gate #define	HPC_CTRL_GET_CARD_INFO	0x101
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate /* card information structure to get data from the PCI config header */
3097c478bd9Sstevel@tonic-gate typedef struct hpc_card_info {
3107c478bd9Sstevel@tonic-gate 	uint8_t	prog_class;	/* PCI_CONF_PROGCLASS byte */
3117c478bd9Sstevel@tonic-gate 	uint8_t	base_class;	/* PCI_CONF_BASCLASS byte */
3127c478bd9Sstevel@tonic-gate 	uint8_t	sub_class;	/* PCI_CONF_SUBCLASS byte */
3137c478bd9Sstevel@tonic-gate 	uint8_t	header_type;	/* PCI_CONF_HEADER byte */
3147c478bd9Sstevel@tonic-gate } hpc_card_info_t;
3157c478bd9Sstevel@tonic-gate 
3167c478bd9Sstevel@tonic-gate /* Slot occupant information structure */
3177c478bd9Sstevel@tonic-gate #define	HPC_MAX_OCCUPANTS	128
3187c478bd9Sstevel@tonic-gate typedef struct hpc_occupant_info {
3197c478bd9Sstevel@tonic-gate 	int	i;
3207c478bd9Sstevel@tonic-gate 	char	*id[HPC_MAX_OCCUPANTS];
3217c478bd9Sstevel@tonic-gate } hpc_occupant_info_t;
3227c478bd9Sstevel@tonic-gate 
3237c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3247c478bd9Sstevel@tonic-gate }
3257c478bd9Sstevel@tonic-gate #endif
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate #endif	/* _SYS_HOTPLUG_HPCTRL_H */
328