xref: /onnv-gate/usr/src/uts/intel/sys/acpica.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3*0Sstevel@tonic-gate  * Use is subject to license terms.
4*0Sstevel@tonic-gate  */
5*0Sstevel@tonic-gate 
6*0Sstevel@tonic-gate #ifndef _SYS_ACPICA_H
7*0Sstevel@tonic-gate #define	_SYS_ACPICA_H
8*0Sstevel@tonic-gate 
9*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
10*0Sstevel@tonic-gate 
11*0Sstevel@tonic-gate #ifdef __cplusplus
12*0Sstevel@tonic-gate extern "C" {
13*0Sstevel@tonic-gate #endif
14*0Sstevel@tonic-gate 
15*0Sstevel@tonic-gate typedef struct {
16*0Sstevel@tonic-gate 	dev_info_t		*dip;
17*0Sstevel@tonic-gate 	kmutex_t		mutex;
18*0Sstevel@tonic-gate 	ddi_iblock_cookie_t	iblock_cookie;
19*0Sstevel@tonic-gate } AcpiCA;
20*0Sstevel@tonic-gate 
21*0Sstevel@tonic-gate /* acpi-user-options options property */
22*0Sstevel@tonic-gate extern unsigned int acpi_options_prop;
23*0Sstevel@tonic-gate #define	ACPI_OUSER_MASK		0x0003
24*0Sstevel@tonic-gate #define	ACPI_OUSER_DFLT		0x0000
25*0Sstevel@tonic-gate #define	ACPI_OUSER_ON		0x0001
26*0Sstevel@tonic-gate #define	ACPI_OUSER_OFF		0x0002
27*0Sstevel@tonic-gate #define	ACPI_OUSER_MADT		0x0004
28*0Sstevel@tonic-gate #define	ACPI_OUSER_LEGACY	0x0008
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate /*
32*0Sstevel@tonic-gate  * Initialization state of the ACPI CA subsystem
33*0Sstevel@tonic-gate  */
34*0Sstevel@tonic-gate #define	ACPICA_NOT_INITIALIZED	(0)
35*0Sstevel@tonic-gate #define	ACPICA_INITIALIZED	(1)
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate extern int acpica_init(void);
38*0Sstevel@tonic-gate extern void acpica_ec_init(void);
39*0Sstevel@tonic-gate extern int acpica_eval_int(ACPI_HANDLE, char *, int *);
40*0Sstevel@tonic-gate extern int acpica_find_pciobj(dev_info_t *, ACPI_HANDLE *);
41*0Sstevel@tonic-gate extern int acpica_find_pcidip(ACPI_HANDLE, dev_info_t **);
42*0Sstevel@tonic-gate 
43*0Sstevel@tonic-gate #define	SCI_IPL	(LOCK_LEVEL-1)
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate /*
46*0Sstevel@tonic-gate  * Mapping table from dip to ACPI object for PCI nodes that might have
47*0Sstevel@tonic-gate  * _PRT. Note: we keep bus/dev/func, but they're not really used;
48*0Sstevel@tonic-gate  * lookups on this table are from dip to acpiobj. b/d/f are there
49*0Sstevel@tonic-gate  * primarily for debugging ease. For peer/root PCI buses, dev and func
50*0Sstevel@tonic-gate  * are irrelevant, and so are set to bogus illegal values; bus is set to
51*0Sstevel@tonic-gate  * the PCI bus *under* that peer-bus node.
52*0Sstevel@tonic-gate  */
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate typedef struct dip_to_acpiobj_t {
55*0Sstevel@tonic-gate 	dev_info_t *dip;
56*0Sstevel@tonic-gate 	ACPI_HANDLE acpiobj;
57*0Sstevel@tonic-gate 	unsigned char bus;
58*0Sstevel@tonic-gate 	unsigned char dev;
59*0Sstevel@tonic-gate 	unsigned char func;
60*0Sstevel@tonic-gate } d2a;
61*0Sstevel@tonic-gate 
62*0Sstevel@tonic-gate /*
63*0Sstevel@tonic-gate  * definitions of Bus Type
64*0Sstevel@tonic-gate  */
65*0Sstevel@tonic-gate #define	BUS_CBUS	1
66*0Sstevel@tonic-gate #define	BUS_CBUSII	2
67*0Sstevel@tonic-gate #define	BUS_EISA	3
68*0Sstevel@tonic-gate #define	BUS_FUTURE	4
69*0Sstevel@tonic-gate #define	BUS_INTERN	5
70*0Sstevel@tonic-gate #define	BUS_ISA		6
71*0Sstevel@tonic-gate #define	BUS_MBI		7
72*0Sstevel@tonic-gate #define	BUS_MBII	8
73*0Sstevel@tonic-gate #define	BUS_MPI		10
74*0Sstevel@tonic-gate #define	BUS_MPSA	11
75*0Sstevel@tonic-gate #define	BUS_NUBUS	12
76*0Sstevel@tonic-gate #define	BUS_PCI		13
77*0Sstevel@tonic-gate #define	BUS_PCMCIA	14
78*0Sstevel@tonic-gate #define	BUS_TC		15
79*0Sstevel@tonic-gate #define	BUS_VL		16
80*0Sstevel@tonic-gate #define	BUS_VME		17
81*0Sstevel@tonic-gate #define	BUS_XPRESS	18
82*0Sstevel@tonic-gate 
83*0Sstevel@tonic-gate 
84*0Sstevel@tonic-gate /*
85*0Sstevel@tonic-gate  * intr_po - polarity definitions
86*0Sstevel@tonic-gate  */
87*0Sstevel@tonic-gate #define	INTR_PO_CONFORM		0x00
88*0Sstevel@tonic-gate #define	INTR_PO_ACTIVE_HIGH	0x01
89*0Sstevel@tonic-gate #define	INTR_PO_RESERVED	0x02
90*0Sstevel@tonic-gate #define	INTR_PO_ACTIVE_LOW	0x03
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate /*
93*0Sstevel@tonic-gate  * intr_el edge or level definitions
94*0Sstevel@tonic-gate  */
95*0Sstevel@tonic-gate #define	INTR_EL_CONFORM		0x00
96*0Sstevel@tonic-gate #define	INTR_EL_EDGE		0x01
97*0Sstevel@tonic-gate #define	INTR_EL_RESERVED	0x02
98*0Sstevel@tonic-gate #define	INTR_EL_LEVEL		0x03
99*0Sstevel@tonic-gate 
100*0Sstevel@tonic-gate /*
101*0Sstevel@tonic-gate  * interrupt flags structure
102*0Sstevel@tonic-gate  */
103*0Sstevel@tonic-gate typedef struct iflag {
104*0Sstevel@tonic-gate 	uchar_t	intr_po: 2,
105*0Sstevel@tonic-gate 		intr_el: 2,
106*0Sstevel@tonic-gate 		bustype: 4;
107*0Sstevel@tonic-gate } iflag_t;
108*0Sstevel@tonic-gate 
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate /* _HID for PCI bus object */
111*0Sstevel@tonic-gate #define	HID_PCI_BUS		0x30AD041
112*0Sstevel@tonic-gate #define	HID_PCI_EXPRESS_BUS	0x080AD041
113*0Sstevel@tonic-gate 
114*0Sstevel@tonic-gate /*
115*0Sstevel@tonic-gate  * Internal functions
116*0Sstevel@tonic-gate  */
117*0Sstevel@tonic-gate extern ACPI_STATUS acpica_get_sci(int *sci_irq, iflag_t *sci_flags);
118*0Sstevel@tonic-gate extern int acpica_get_bdf(dev_info_t *dip, int *bus, int *device, int *func);
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate #ifdef __cplusplus
121*0Sstevel@tonic-gate }
122*0Sstevel@tonic-gate #endif
123*0Sstevel@tonic-gate 
124*0Sstevel@tonic-gate #endif /* _SYS_ACPICA_H */
125