xref: /titanic_50/usr/src/uts/intel/sys/acpica.h (revision 5e1c72e1529d41fe7e1babf69acebeed897f9610)
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  * Copyright (c) 2009, Intel Corporation.
27  * All rights reserved.
28  */
29 
30 #ifndef _SYS_ACPICA_H
31 #define	_SYS_ACPICA_H
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 typedef struct {
38 	dev_info_t		*dip;
39 	kmutex_t		mutex;
40 	ddi_iblock_cookie_t	iblock_cookie;
41 } AcpiCA;
42 
43 /* acpi-user-options options property */
44 extern unsigned int acpi_options_prop;
45 #define	ACPI_OUSER_MASK		0x0003
46 #define	ACPI_OUSER_DFLT		0x0000
47 #define	ACPI_OUSER_ON		0x0001
48 #define	ACPI_OUSER_OFF		0x0002
49 #define	ACPI_OUSER_MADT		0x0004
50 #define	ACPI_OUSER_LEGACY	0x0008
51 
52 
53 /*
54  * Initialization state of the ACPI CA subsystem
55  */
56 #define	ACPICA_NOT_INITIALIZED	(0)
57 #define	ACPICA_INITIALIZED	(1)
58 
59 extern int acpica_init(void);
60 extern void acpica_ec_init(void);
61 
62 /*
63  * acpi_status property values
64  */
65 #define	ACPI_BOOT_INIT		0x00000001
66 #define	ACPI_BOOT_ENABLE	0x00000002
67 #define	ACPI_BOOT_BOOTCONF	0x00000010
68 
69 #define	SCI_IPL	(LOCK_LEVEL-1)
70 
71 /*
72  * definitions of Bus Type
73  */
74 #define	BUS_CBUS	1
75 #define	BUS_CBUSII	2
76 #define	BUS_EISA	3
77 #define	BUS_FUTURE	4
78 #define	BUS_INTERN	5
79 #define	BUS_ISA		6
80 #define	BUS_MBI		7
81 #define	BUS_MBII	8
82 #define	BUS_PCIE	9
83 #define	BUS_MPI		10
84 #define	BUS_MPSA	11
85 #define	BUS_NUBUS	12
86 #define	BUS_PCI		13
87 #define	BUS_PCMCIA	14
88 #define	BUS_TC		15
89 #define	BUS_VL		16
90 #define	BUS_VME		17
91 #define	BUS_XPRESS	18
92 
93 
94 /*
95  * intr_po - polarity definitions
96  */
97 #define	INTR_PO_CONFORM		0x00
98 #define	INTR_PO_ACTIVE_HIGH	0x01
99 #define	INTR_PO_RESERVED	0x02
100 #define	INTR_PO_ACTIVE_LOW	0x03
101 
102 /*
103  * intr_el edge or level definitions
104  */
105 #define	INTR_EL_CONFORM		0x00
106 #define	INTR_EL_EDGE		0x01
107 #define	INTR_EL_RESERVED	0x02
108 #define	INTR_EL_LEVEL		0x03
109 
110 /*
111  * interrupt flags structure
112  */
113 typedef struct iflag {
114 	uchar_t	intr_po: 2,
115 		intr_el: 2,
116 		bustype: 4;
117 } iflag_t;
118 
119 /* _HID for PCI bus object */
120 #define	HID_PCI_BUS		0x30AD041
121 #define	HID_PCI_EXPRESS_BUS	0x080AD041
122 
123 /* ACPICA subsystem has been fully initialized except SCI interrupt. */
124 #define	ACPI_FEATURE_FULL_INIT	0x1
125 /* ACPI SCI interrupt has been enabled. */
126 #define	ACPI_FEATURE_SCI_EVENT	0x2
127 /* ACPI device configuration has been enabled. */
128 #define	ACPI_FEATURE_DEVCFG	0x4
129 /* ACPI _OSI method should report support of ACPI Module Device. */
130 #define	ACPI_FEATURE_OSI_MODULE	0x8
131 
132 /* ACPI device configuration features. */
133 #define	ACPI_DEVCFG_CPU		0x1
134 #define	ACPI_DEVCFG_MEMORY	0x2
135 #define	ACPI_DEVCFG_CONTAINER	0x4
136 
137 /*
138  * Function prototypes
139  */
140 extern ACPI_STATUS acpica_get_sci(int *, iflag_t *);
141 extern int acpica_get_bdf(dev_info_t *, int *, int *, int *);
142 extern ACPI_STATUS acpica_eval_int(ACPI_HANDLE, char *, int *);
143 extern void acpica_ddi_save_resources(dev_info_t *);
144 extern void acpica_ddi_restore_resources(dev_info_t *);
145 extern void acpica_get_global_FADT(ACPI_TABLE_FADT **);
146 
147 extern ACPI_STATUS acpica_tag_devinfo(dev_info_t *, ACPI_HANDLE);
148 extern ACPI_STATUS acpica_untag_devinfo(dev_info_t *, ACPI_HANDLE);
149 extern ACPI_STATUS acpica_get_devinfo(ACPI_HANDLE, dev_info_t **);
150 extern ACPI_STATUS acpica_get_handle(dev_info_t *, ACPI_HANDLE *);
151 extern ACPI_STATUS acpica_get_handle_cpu(int, ACPI_HANDLE *);
152 extern ACPI_STATUS acpica_build_processor_map(void);
153 extern ACPI_STATUS acpica_add_processor_to_map(UINT32, ACPI_HANDLE, UINT32);
154 extern ACPI_STATUS acpica_remove_processor_from_map(UINT32);
155 extern ACPI_STATUS acpica_map_cpu(processorid_t, UINT32);
156 extern ACPI_STATUS acpica_unmap_cpu(processorid_t);
157 extern ACPI_STATUS acpica_get_cpu_object_by_cpuid(processorid_t, ACPI_HANDLE *);
158 extern ACPI_STATUS acpica_get_cpu_object_by_procid(UINT32, ACPI_HANDLE *);
159 extern ACPI_STATUS acpica_get_cpu_object_by_apicid(UINT32, ACPI_HANDLE *);
160 
161 extern uint64_t acpica_get_core_feature(uint64_t);
162 extern void acpica_set_core_feature(uint64_t);
163 extern void acpica_clear_core_feature(uint64_t);
164 extern uint64_t acpica_get_devcfg_feature(uint64_t);
165 extern void acpica_set_devcfg_feature(uint64_t);
166 extern void acpica_clear_devcfg_feature(uint64_t);
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif /* _SYS_ACPICA_H */
173