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