xref: /illumos-gate/usr/src/uts/intel/sys/acpica.h (revision c211fc479225fa54805cf480633bf6689ca9a2db)
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  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_ACPICA_H
27 #define	_SYS_ACPICA_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 typedef struct {
34 	dev_info_t		*dip;
35 	kmutex_t		mutex;
36 	ddi_iblock_cookie_t	iblock_cookie;
37 } AcpiCA;
38 
39 /* acpi-user-options options property */
40 extern unsigned int acpi_options_prop;
41 #define	ACPI_OUSER_MASK		0x0003
42 #define	ACPI_OUSER_DFLT		0x0000
43 #define	ACPI_OUSER_ON		0x0001
44 #define	ACPI_OUSER_OFF		0x0002
45 #define	ACPI_OUSER_MADT		0x0004
46 #define	ACPI_OUSER_LEGACY	0x0008
47 
48 
49 /*
50  * Initialization state of the ACPI CA subsystem
51  */
52 #define	ACPICA_NOT_INITIALIZED	(0)
53 #define	ACPICA_INITIALIZED	(1)
54 
55 extern int acpica_init(void);
56 extern void acpica_ec_init(void);
57 
58 /*
59  * acpi_status property values
60  */
61 #define	ACPI_BOOT_INIT		0x00000001
62 #define	ACPI_BOOT_ENABLE	0x00000002
63 #define	ACPI_BOOT_BOOTCONF	0x00000010
64 
65 #define	SCI_IPL	(LOCK_LEVEL-1)
66 
67 /*
68  * definitions of Bus Type
69  */
70 #define	BUS_CBUS	1
71 #define	BUS_CBUSII	2
72 #define	BUS_EISA	3
73 #define	BUS_FUTURE	4
74 #define	BUS_INTERN	5
75 #define	BUS_ISA		6
76 #define	BUS_MBI		7
77 #define	BUS_MBII	8
78 #define	BUS_PCIE	9
79 #define	BUS_MPI		10
80 #define	BUS_MPSA	11
81 #define	BUS_NUBUS	12
82 #define	BUS_PCI		13
83 #define	BUS_PCMCIA	14
84 #define	BUS_TC		15
85 #define	BUS_VL		16
86 #define	BUS_VME		17
87 #define	BUS_XPRESS	18
88 
89 
90 /*
91  * intr_po - polarity definitions
92  */
93 #define	INTR_PO_CONFORM		0x00
94 #define	INTR_PO_ACTIVE_HIGH	0x01
95 #define	INTR_PO_RESERVED	0x02
96 #define	INTR_PO_ACTIVE_LOW	0x03
97 
98 /*
99  * intr_el edge or level definitions
100  */
101 #define	INTR_EL_CONFORM		0x00
102 #define	INTR_EL_EDGE		0x01
103 #define	INTR_EL_RESERVED	0x02
104 #define	INTR_EL_LEVEL		0x03
105 
106 /*
107  * interrupt flags structure
108  */
109 typedef struct iflag {
110 	uchar_t	intr_po: 2,
111 		intr_el: 2,
112 		bustype: 4;
113 } iflag_t;
114 
115 /* _HID for PCI bus object */
116 #define	HID_PCI_BUS		0x30AD041
117 #define	HID_PCI_EXPRESS_BUS	0x080AD041
118 
119 /*
120  * Function prototypes
121  */
122 extern ACPI_STATUS acpica_get_sci(int *, iflag_t *);
123 extern int acpica_get_bdf(dev_info_t *, int *, int *, int *);
124 extern ACPI_STATUS acpica_get_devinfo(ACPI_HANDLE, dev_info_t **);
125 extern ACPI_STATUS acpica_get_handle(dev_info_t *, ACPI_HANDLE *);
126 extern ACPI_STATUS acpica_get_handle_cpu(int, ACPI_HANDLE *);
127 extern ACPI_STATUS acpica_eval_int(ACPI_HANDLE, char *, int *);
128 extern void acpica_map_cpu(processorid_t, UINT32);
129 extern void acpica_build_processor_map();
130 extern void acpica_ddi_save_resources(dev_info_t *);
131 extern void acpica_ddi_restore_resources(dev_info_t *);
132 extern void acpica_get_global_FADT(ACPI_TABLE_FADT **);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif /* _SYS_ACPICA_H */
139