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