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 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_PCIEHPC_ACPI_H
28 #define	_PCIEHPC_ACPI_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/acpi/acpi.h>
35 #include <sys/acpica.h>
36 #include <sys/hotplug/pci/pcie_hp.h>
37 #include <sys/hotplug/pci/pciehpc.h>
38 
39 /* soft state data structure for ACPI hot plug mode */
40 typedef struct pciehpc_acpi {
41 	/* handle for the ACPI device for the bus node with HPC */
42 	ACPI_HANDLE	bus_obj;
43 
44 	/* handle for the ACPI device for the slot (dev#0,func#0) */
45 	ACPI_HANDLE	slot_dev_obj;
46 
47 	/* ACPI control methods present on the bus node */
48 	uint16_t	bus_methods;
49 
50 	/* ACPI control methods on the slot device functions */
51 	uint16_t	slot_methods;
52 } pciehpc_acpi_t;
53 
54 /* bit definitions in acpi_bus_methods */
55 #define	PCIEHPC_ACPI_OSC_PRESENT	0x0001
56 #define	PCIEHPC_ACPI_OSHP_PRESENT	0x0002
57 #define	PCIEHPC_ACPI_SUN_PRESENT	0x0004
58 #define	PCIEHPC_ACPI_STA_PRESENT	0x0008
59 #define	PCIEHPC_ACPI_EJ0_PRESENT	0x0010
60 #define	PCIEHPC_ACPI_HPP_PRESENT	0x0020
61 #define	PCIEHPC_ACPI_HPX_PRESENT	0x0040
62 #define	PCIEHPC_ACPI_PS0_PRESENT	0x0080
63 #define	PCIEHPC_ACPI_DSM_PRESENT	0x0080
64 #define	PCIEHPC_ACPI_STR_PRESENT	0x0100
65 
66 /* Device status bit as returned by _STA method (see 6.3.7 of ACPI 3.0) */
67 #define	DEV_STS_PRESENT		0x1	/* device is present */
68 #define	DEV_STS_ENABLED		0x2	/* device is enabled */
69 #define	DEV_STS_SHOWN_UI	0x4	/* device should be shown in UI */
70 #define	DEV_STS_FUNC_OK		0x8	/* device functioning normally */
71 #define	STATUS_NORMAL	\
72 	(DEV_STS_PRESENT | DEV_STS_ENABLED | DEV_STS_SHOWN_UI | DEV_STS_FUNC_OK)
73 
74 #ifdef	__cplusplus
75 }
76 #endif
77 
78 #endif	/* _PCIEHPC_ACPI_H */
79