xref: /onnv-gate/usr/src/uts/intel/sys/acpica.h (revision 2980:58e8c2989931)
134Ssmall /*
234Ssmall  * CDDL HEADER START
334Ssmall  *
434Ssmall  * The contents of this file are subject to the terms of the
5*2980Srs90106  * Common Development and Distribution License (the "License").
6*2980Srs90106  * You may not use this file except in compliance with the License.
734Ssmall  *
834Ssmall  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
934Ssmall  * or http://www.opensolaris.org/os/licensing.
1034Ssmall  * See the License for the specific language governing permissions
1134Ssmall  * and limitations under the License.
1234Ssmall  *
1334Ssmall  * When distributing Covered Code, include this CDDL HEADER in each
1434Ssmall  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1534Ssmall  * If applicable, add the following below this CDDL HEADER, with the
1634Ssmall  * fields enclosed by brackets "[]" replaced with your own identifying
1734Ssmall  * information: Portions Copyright [yyyy] [name of copyright owner]
1834Ssmall  *
1934Ssmall  * CDDL HEADER END
2034Ssmall  */
210Sstevel@tonic-gate /*
22*2980Srs90106  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_ACPICA_H
270Sstevel@tonic-gate #define	_SYS_ACPICA_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef __cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate typedef struct {
360Sstevel@tonic-gate 	dev_info_t		*dip;
370Sstevel@tonic-gate 	kmutex_t		mutex;
380Sstevel@tonic-gate 	ddi_iblock_cookie_t	iblock_cookie;
390Sstevel@tonic-gate } AcpiCA;
400Sstevel@tonic-gate 
410Sstevel@tonic-gate /* acpi-user-options options property */
420Sstevel@tonic-gate extern unsigned int acpi_options_prop;
430Sstevel@tonic-gate #define	ACPI_OUSER_MASK		0x0003
440Sstevel@tonic-gate #define	ACPI_OUSER_DFLT		0x0000
450Sstevel@tonic-gate #define	ACPI_OUSER_ON		0x0001
460Sstevel@tonic-gate #define	ACPI_OUSER_OFF		0x0002
470Sstevel@tonic-gate #define	ACPI_OUSER_MADT		0x0004
480Sstevel@tonic-gate #define	ACPI_OUSER_LEGACY	0x0008
490Sstevel@tonic-gate 
500Sstevel@tonic-gate 
510Sstevel@tonic-gate /*
520Sstevel@tonic-gate  * Initialization state of the ACPI CA subsystem
530Sstevel@tonic-gate  */
540Sstevel@tonic-gate #define	ACPICA_NOT_INITIALIZED	(0)
550Sstevel@tonic-gate #define	ACPICA_INITIALIZED	(1)
560Sstevel@tonic-gate 
570Sstevel@tonic-gate extern int acpica_init(void);
580Sstevel@tonic-gate extern void acpica_ec_init(void);
590Sstevel@tonic-gate extern int acpica_eval_int(ACPI_HANDLE, char *, int *);
600Sstevel@tonic-gate extern int acpica_find_pciobj(dev_info_t *, ACPI_HANDLE *);
610Sstevel@tonic-gate extern int acpica_find_pcidip(ACPI_HANDLE, dev_info_t **);
620Sstevel@tonic-gate 
63250Ssmall /*
64250Ssmall  * acpi_status property values
65250Ssmall  */
66250Ssmall #define	ACPI_BOOT_INIT		0x00000001
67250Ssmall #define	ACPI_BOOT_ENABLE	0x00000002
68250Ssmall #define	ACPI_BOOT_BOOTCONF	0x00000010
69250Ssmall 
700Sstevel@tonic-gate #define	SCI_IPL	(LOCK_LEVEL-1)
710Sstevel@tonic-gate 
720Sstevel@tonic-gate /*
730Sstevel@tonic-gate  * Mapping table from dip to ACPI object for PCI nodes that might have
740Sstevel@tonic-gate  * _PRT. Note: we keep bus/dev/func, but they're not really used;
750Sstevel@tonic-gate  * lookups on this table are from dip to acpiobj. b/d/f are there
760Sstevel@tonic-gate  * primarily for debugging ease. For peer/root PCI buses, dev and func
770Sstevel@tonic-gate  * are irrelevant, and so are set to bogus illegal values; bus is set to
780Sstevel@tonic-gate  * the PCI bus *under* that peer-bus node.
790Sstevel@tonic-gate  */
800Sstevel@tonic-gate 
810Sstevel@tonic-gate typedef struct dip_to_acpiobj_t {
820Sstevel@tonic-gate 	dev_info_t *dip;
830Sstevel@tonic-gate 	ACPI_HANDLE acpiobj;
840Sstevel@tonic-gate 	unsigned char bus;
850Sstevel@tonic-gate 	unsigned char dev;
860Sstevel@tonic-gate 	unsigned char func;
870Sstevel@tonic-gate } d2a;
880Sstevel@tonic-gate 
890Sstevel@tonic-gate /*
900Sstevel@tonic-gate  * definitions of Bus Type
910Sstevel@tonic-gate  */
920Sstevel@tonic-gate #define	BUS_CBUS	1
930Sstevel@tonic-gate #define	BUS_CBUSII	2
940Sstevel@tonic-gate #define	BUS_EISA	3
950Sstevel@tonic-gate #define	BUS_FUTURE	4
960Sstevel@tonic-gate #define	BUS_INTERN	5
970Sstevel@tonic-gate #define	BUS_ISA		6
980Sstevel@tonic-gate #define	BUS_MBI		7
990Sstevel@tonic-gate #define	BUS_MBII	8
100*2980Srs90106 #define	BUS_PCIE	9
1010Sstevel@tonic-gate #define	BUS_MPI		10
1020Sstevel@tonic-gate #define	BUS_MPSA	11
1030Sstevel@tonic-gate #define	BUS_NUBUS	12
1040Sstevel@tonic-gate #define	BUS_PCI		13
1050Sstevel@tonic-gate #define	BUS_PCMCIA	14
1060Sstevel@tonic-gate #define	BUS_TC		15
1070Sstevel@tonic-gate #define	BUS_VL		16
1080Sstevel@tonic-gate #define	BUS_VME		17
1090Sstevel@tonic-gate #define	BUS_XPRESS	18
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate /*
1130Sstevel@tonic-gate  * intr_po - polarity definitions
1140Sstevel@tonic-gate  */
1150Sstevel@tonic-gate #define	INTR_PO_CONFORM		0x00
1160Sstevel@tonic-gate #define	INTR_PO_ACTIVE_HIGH	0x01
1170Sstevel@tonic-gate #define	INTR_PO_RESERVED	0x02
1180Sstevel@tonic-gate #define	INTR_PO_ACTIVE_LOW	0x03
1190Sstevel@tonic-gate 
1200Sstevel@tonic-gate /*
1210Sstevel@tonic-gate  * intr_el edge or level definitions
1220Sstevel@tonic-gate  */
1230Sstevel@tonic-gate #define	INTR_EL_CONFORM		0x00
1240Sstevel@tonic-gate #define	INTR_EL_EDGE		0x01
1250Sstevel@tonic-gate #define	INTR_EL_RESERVED	0x02
1260Sstevel@tonic-gate #define	INTR_EL_LEVEL		0x03
1270Sstevel@tonic-gate 
1280Sstevel@tonic-gate /*
1290Sstevel@tonic-gate  * interrupt flags structure
1300Sstevel@tonic-gate  */
1310Sstevel@tonic-gate typedef struct iflag {
1320Sstevel@tonic-gate 	uchar_t	intr_po: 2,
1330Sstevel@tonic-gate 		intr_el: 2,
1340Sstevel@tonic-gate 		bustype: 4;
1350Sstevel@tonic-gate } iflag_t;
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate /* _HID for PCI bus object */
1390Sstevel@tonic-gate #define	HID_PCI_BUS		0x30AD041
1400Sstevel@tonic-gate #define	HID_PCI_EXPRESS_BUS	0x080AD041
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate /*
1430Sstevel@tonic-gate  * Internal functions
1440Sstevel@tonic-gate  */
1450Sstevel@tonic-gate extern ACPI_STATUS acpica_get_sci(int *sci_irq, iflag_t *sci_flags);
1460Sstevel@tonic-gate extern int acpica_get_bdf(dev_info_t *dip, int *bus, int *device, int *func);
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate #ifdef __cplusplus
1490Sstevel@tonic-gate }
1500Sstevel@tonic-gate #endif
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate #endif /* _SYS_ACPICA_H */
153