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