xref: /titanic_51/usr/src/uts/intel/sys/acpica.h (revision 0f6e7ba6e1c0f032e0e839fdba06b2e0ddb0c0d4)
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 2006 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 extern int acpica_eval_int(ACPI_HANDLE, char *, int *);
60 extern int acpica_find_pciobj(dev_info_t *, ACPI_HANDLE *);
61 extern int acpica_find_pcidip(ACPI_HANDLE, dev_info_t **);
62 
63 /*
64  * acpi_status property values
65  */
66 #define	ACPI_BOOT_INIT		0x00000001
67 #define	ACPI_BOOT_ENABLE	0x00000002
68 #define	ACPI_BOOT_BOOTCONF	0x00000010
69 
70 #define	SCI_IPL	(LOCK_LEVEL-1)
71 
72 /*
73  * Mapping table from dip to ACPI object for PCI nodes that might have
74  * _PRT. Note: we keep bus/dev/func, but they're not really used;
75  * lookups on this table are from dip to acpiobj. b/d/f are there
76  * primarily for debugging ease. For peer/root PCI buses, dev and func
77  * are irrelevant, and so are set to bogus illegal values; bus is set to
78  * the PCI bus *under* that peer-bus node.
79  */
80 
81 typedef struct dip_to_acpiobj_t {
82 	dev_info_t *dip;
83 	ACPI_HANDLE acpiobj;
84 	unsigned char bus;
85 	unsigned char dev;
86 	unsigned char func;
87 } d2a;
88 
89 /*
90  * definitions of Bus Type
91  */
92 #define	BUS_CBUS	1
93 #define	BUS_CBUSII	2
94 #define	BUS_EISA	3
95 #define	BUS_FUTURE	4
96 #define	BUS_INTERN	5
97 #define	BUS_ISA		6
98 #define	BUS_MBI		7
99 #define	BUS_MBII	8
100 #define	BUS_PCIE	9
101 #define	BUS_MPI		10
102 #define	BUS_MPSA	11
103 #define	BUS_NUBUS	12
104 #define	BUS_PCI		13
105 #define	BUS_PCMCIA	14
106 #define	BUS_TC		15
107 #define	BUS_VL		16
108 #define	BUS_VME		17
109 #define	BUS_XPRESS	18
110 
111 
112 /*
113  * intr_po - polarity definitions
114  */
115 #define	INTR_PO_CONFORM		0x00
116 #define	INTR_PO_ACTIVE_HIGH	0x01
117 #define	INTR_PO_RESERVED	0x02
118 #define	INTR_PO_ACTIVE_LOW	0x03
119 
120 /*
121  * intr_el edge or level definitions
122  */
123 #define	INTR_EL_CONFORM		0x00
124 #define	INTR_EL_EDGE		0x01
125 #define	INTR_EL_RESERVED	0x02
126 #define	INTR_EL_LEVEL		0x03
127 
128 /*
129  * interrupt flags structure
130  */
131 typedef struct iflag {
132 	uchar_t	intr_po: 2,
133 		intr_el: 2,
134 		bustype: 4;
135 } iflag_t;
136 
137 
138 /* _HID for PCI bus object */
139 #define	HID_PCI_BUS		0x30AD041
140 #define	HID_PCI_EXPRESS_BUS	0x080AD041
141 
142 /*
143  * Internal functions
144  */
145 extern ACPI_STATUS acpica_get_sci(int *sci_irq, iflag_t *sci_flags);
146 extern int acpica_get_bdf(dev_info_t *dip, int *bus, int *device, int *func);
147 
148 #ifdef __cplusplus
149 }
150 #endif
151 
152 #endif /* _SYS_ACPICA_H */
153