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