xref: /titanic_50/usr/src/uts/intel/sys/acpica.h (revision 5aefb6555731130ca4fd295960123d71f2d21fe8)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_ACPICA_H
28 #define	_SYS_ACPICA_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 typedef struct {
37 	dev_info_t		*dip;
38 	kmutex_t		mutex;
39 	ddi_iblock_cookie_t	iblock_cookie;
40 } AcpiCA;
41 
42 /* acpi-user-options options property */
43 extern unsigned int acpi_options_prop;
44 #define	ACPI_OUSER_MASK		0x0003
45 #define	ACPI_OUSER_DFLT		0x0000
46 #define	ACPI_OUSER_ON		0x0001
47 #define	ACPI_OUSER_OFF		0x0002
48 #define	ACPI_OUSER_MADT		0x0004
49 #define	ACPI_OUSER_LEGACY	0x0008
50 
51 
52 /*
53  * Initialization state of the ACPI CA subsystem
54  */
55 #define	ACPICA_NOT_INITIALIZED	(0)
56 #define	ACPICA_INITIALIZED	(1)
57 
58 extern int acpica_init(void);
59 extern void acpica_ec_init(void);
60 extern int acpica_eval_int(ACPI_HANDLE, char *, int *);
61 extern int acpica_find_pciobj(dev_info_t *, ACPI_HANDLE *);
62 extern int acpica_find_pcidip(ACPI_HANDLE, dev_info_t **);
63 
64 /*
65  * acpi_status property values
66  */
67 #define	ACPI_BOOT_INIT		0x00000001
68 #define	ACPI_BOOT_ENABLE	0x00000002
69 #define	ACPI_BOOT_BOOTCONF	0x00000010
70 
71 #define	SCI_IPL	(LOCK_LEVEL-1)
72 
73 /*
74  * Mapping table from dip to ACPI object for PCI nodes that might have
75  * _PRT. Note: we keep bus/dev/func, but they're not really used;
76  * lookups on this table are from dip to acpiobj. b/d/f are there
77  * primarily for debugging ease. For peer/root PCI buses, dev and func
78  * are irrelevant, and so are set to bogus illegal values; bus is set to
79  * the PCI bus *under* that peer-bus node.
80  */
81 
82 typedef struct dip_to_acpiobj_t {
83 	dev_info_t *dip;
84 	ACPI_HANDLE acpiobj;
85 	unsigned char bus;
86 	unsigned char dev;
87 	unsigned char func;
88 } d2a;
89 
90 /*
91  * definitions of Bus Type
92  */
93 #define	BUS_CBUS	1
94 #define	BUS_CBUSII	2
95 #define	BUS_EISA	3
96 #define	BUS_FUTURE	4
97 #define	BUS_INTERN	5
98 #define	BUS_ISA		6
99 #define	BUS_MBI		7
100 #define	BUS_MBII	8
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