xref: /onnv-gate/usr/src/uts/intel/sys/acpica.h (revision 12004:93f274d4a367)
134Ssmall /*
234Ssmall  * CDDL HEADER START
334Ssmall  *
434Ssmall  * The contents of this file are subject to the terms of the
52980Srs90106  * Common Development and Distribution License (the "License").
62980Srs90106  * 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 /*
228906SEric.Saxe@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
259652SMichael.Corcoran@Sun.COM /*
26*12004Sjiang.liu@intel.com  * Copyright (c) 2009-2010, Intel Corporation.
279652SMichael.Corcoran@Sun.COM  * All rights reserved.
289652SMichael.Corcoran@Sun.COM  */
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifndef _SYS_ACPICA_H
310Sstevel@tonic-gate #define	_SYS_ACPICA_H
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef __cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate typedef struct {
380Sstevel@tonic-gate 	dev_info_t		*dip;
390Sstevel@tonic-gate 	kmutex_t		mutex;
400Sstevel@tonic-gate 	ddi_iblock_cookie_t	iblock_cookie;
410Sstevel@tonic-gate } AcpiCA;
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /* acpi-user-options options property */
440Sstevel@tonic-gate extern unsigned int acpi_options_prop;
450Sstevel@tonic-gate #define	ACPI_OUSER_MASK		0x0003
460Sstevel@tonic-gate #define	ACPI_OUSER_DFLT		0x0000
470Sstevel@tonic-gate #define	ACPI_OUSER_ON		0x0001
480Sstevel@tonic-gate #define	ACPI_OUSER_OFF		0x0002
490Sstevel@tonic-gate #define	ACPI_OUSER_MADT		0x0004
500Sstevel@tonic-gate #define	ACPI_OUSER_LEGACY	0x0008
510Sstevel@tonic-gate 
520Sstevel@tonic-gate 
530Sstevel@tonic-gate /*
540Sstevel@tonic-gate  * Initialization state of the ACPI CA subsystem
550Sstevel@tonic-gate  */
560Sstevel@tonic-gate #define	ACPICA_NOT_INITIALIZED	(0)
570Sstevel@tonic-gate #define	ACPICA_INITIALIZED	(1)
580Sstevel@tonic-gate 
590Sstevel@tonic-gate extern int acpica_init(void);
600Sstevel@tonic-gate extern void acpica_ec_init(void);
610Sstevel@tonic-gate 
62250Ssmall /*
63250Ssmall  * acpi_status property values
64250Ssmall  */
65250Ssmall #define	ACPI_BOOT_INIT		0x00000001
66250Ssmall #define	ACPI_BOOT_ENABLE	0x00000002
67250Ssmall #define	ACPI_BOOT_BOOTCONF	0x00000010
68250Ssmall 
690Sstevel@tonic-gate #define	SCI_IPL	(LOCK_LEVEL-1)
700Sstevel@tonic-gate 
710Sstevel@tonic-gate /*
720Sstevel@tonic-gate  * definitions of Bus Type
730Sstevel@tonic-gate  */
740Sstevel@tonic-gate #define	BUS_CBUS	1
750Sstevel@tonic-gate #define	BUS_CBUSII	2
760Sstevel@tonic-gate #define	BUS_EISA	3
770Sstevel@tonic-gate #define	BUS_FUTURE	4
780Sstevel@tonic-gate #define	BUS_INTERN	5
790Sstevel@tonic-gate #define	BUS_ISA		6
800Sstevel@tonic-gate #define	BUS_MBI		7
810Sstevel@tonic-gate #define	BUS_MBII	8
822980Srs90106 #define	BUS_PCIE	9
830Sstevel@tonic-gate #define	BUS_MPI		10
840Sstevel@tonic-gate #define	BUS_MPSA	11
850Sstevel@tonic-gate #define	BUS_NUBUS	12
860Sstevel@tonic-gate #define	BUS_PCI		13
870Sstevel@tonic-gate #define	BUS_PCMCIA	14
880Sstevel@tonic-gate #define	BUS_TC		15
890Sstevel@tonic-gate #define	BUS_VL		16
900Sstevel@tonic-gate #define	BUS_VME		17
910Sstevel@tonic-gate #define	BUS_XPRESS	18
920Sstevel@tonic-gate 
930Sstevel@tonic-gate 
940Sstevel@tonic-gate /*
950Sstevel@tonic-gate  * intr_po - polarity definitions
960Sstevel@tonic-gate  */
970Sstevel@tonic-gate #define	INTR_PO_CONFORM		0x00
980Sstevel@tonic-gate #define	INTR_PO_ACTIVE_HIGH	0x01
990Sstevel@tonic-gate #define	INTR_PO_RESERVED	0x02
1000Sstevel@tonic-gate #define	INTR_PO_ACTIVE_LOW	0x03
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate /*
1030Sstevel@tonic-gate  * intr_el edge or level definitions
1040Sstevel@tonic-gate  */
1050Sstevel@tonic-gate #define	INTR_EL_CONFORM		0x00
1060Sstevel@tonic-gate #define	INTR_EL_EDGE		0x01
1070Sstevel@tonic-gate #define	INTR_EL_RESERVED	0x02
1080Sstevel@tonic-gate #define	INTR_EL_LEVEL		0x03
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate /*
1110Sstevel@tonic-gate  * interrupt flags structure
1120Sstevel@tonic-gate  */
1130Sstevel@tonic-gate typedef struct iflag {
1140Sstevel@tonic-gate 	uchar_t	intr_po: 2,
1150Sstevel@tonic-gate 		intr_el: 2,
1160Sstevel@tonic-gate 		bustype: 4;
1170Sstevel@tonic-gate } iflag_t;
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate /* _HID for PCI bus object */
1200Sstevel@tonic-gate #define	HID_PCI_BUS		0x30AD041
1210Sstevel@tonic-gate #define	HID_PCI_EXPRESS_BUS	0x080AD041
1220Sstevel@tonic-gate 
1239652SMichael.Corcoran@Sun.COM /* ACPICA subsystem has been fully initialized except SCI interrupt. */
1249652SMichael.Corcoran@Sun.COM #define	ACPI_FEATURE_FULL_INIT	0x1
1259652SMichael.Corcoran@Sun.COM /* ACPI SCI interrupt has been enabled. */
1269652SMichael.Corcoran@Sun.COM #define	ACPI_FEATURE_SCI_EVENT	0x2
1279652SMichael.Corcoran@Sun.COM /* ACPI device configuration has been enabled. */
1289652SMichael.Corcoran@Sun.COM #define	ACPI_FEATURE_DEVCFG	0x4
1299652SMichael.Corcoran@Sun.COM /* ACPI _OSI method should report support of ACPI Module Device. */
1309652SMichael.Corcoran@Sun.COM #define	ACPI_FEATURE_OSI_MODULE	0x8
1319652SMichael.Corcoran@Sun.COM 
1329652SMichael.Corcoran@Sun.COM /* ACPI device configuration features. */
1339652SMichael.Corcoran@Sun.COM #define	ACPI_DEVCFG_CPU		0x1
1349652SMichael.Corcoran@Sun.COM #define	ACPI_DEVCFG_MEMORY	0x2
1359652SMichael.Corcoran@Sun.COM #define	ACPI_DEVCFG_CONTAINER	0x4
136*12004Sjiang.liu@intel.com #define	ACPI_DEVCFG_PCI		0x8
1379652SMichael.Corcoran@Sun.COM 
1380Sstevel@tonic-gate /*
1399980SDana.Myers@Sun.COM  * master_ops.c
1409980SDana.Myers@Sun.COM  */
1419980SDana.Myers@Sun.COM typedef struct device_id {
1429980SDana.Myers@Sun.COM 	struct device_id *next;
1439980SDana.Myers@Sun.COM 	char 	*id;
1449980SDana.Myers@Sun.COM } device_id_t;
1459980SDana.Myers@Sun.COM 
1469980SDana.Myers@Sun.COM typedef struct property {
1479980SDana.Myers@Sun.COM 	struct property *next;
1489980SDana.Myers@Sun.COM 	char *name;
1499980SDana.Myers@Sun.COM 	char *value;
1509980SDana.Myers@Sun.COM } property_t;
1519980SDana.Myers@Sun.COM 
1529980SDana.Myers@Sun.COM typedef struct master_rec {
1539980SDana.Myers@Sun.COM 	struct master_rec *next;
1549980SDana.Myers@Sun.COM 	device_id_t	*device_ids;
1559980SDana.Myers@Sun.COM 	char		*name;
1569980SDana.Myers@Sun.COM 	char		*description;
1579980SDana.Myers@Sun.COM 	property_t	*properties;
1589980SDana.Myers@Sun.COM } master_rec_t;
1599980SDana.Myers@Sun.COM 
1609980SDana.Myers@Sun.COM extern const master_rec_t *master_file_lookup(device_id_t *);
1619980SDana.Myers@Sun.COM extern device_id_t *mf_alloc_device_id(void);
1629980SDana.Myers@Sun.COM extern void mf_free_device_id(device_id_t *);
1639980SDana.Myers@Sun.COM extern void process_master_file(void);
1649980SDana.Myers@Sun.COM extern void free_master_data(void);
1659980SDana.Myers@Sun.COM 
1669980SDana.Myers@Sun.COM /*
1674667Smh27603  * Function prototypes
1680Sstevel@tonic-gate  */
1694667Smh27603 extern ACPI_STATUS acpica_get_sci(int *, iflag_t *);
1704667Smh27603 extern int acpica_get_bdf(dev_info_t *, int *, int *, int *);
1719652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_eval_int(ACPI_HANDLE, char *, int *);
1729652SMichael.Corcoran@Sun.COM extern void acpica_ddi_save_resources(dev_info_t *);
1739652SMichael.Corcoran@Sun.COM extern void acpica_ddi_restore_resources(dev_info_t *);
17410457SSaurabh.Mishra@Sun.COM extern void acpi_reset_system(void);
1759652SMichael.Corcoran@Sun.COM extern void acpica_get_global_FADT(ACPI_TABLE_FADT **);
17610147SMark.Haywood@Sun.COM extern void acpica_write_cpupm_capabilities(boolean_t, boolean_t);
1779652SMichael.Corcoran@Sun.COM 
1789652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_tag_devinfo(dev_info_t *, ACPI_HANDLE);
1799652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_untag_devinfo(dev_info_t *, ACPI_HANDLE);
1804667Smh27603 extern ACPI_STATUS acpica_get_devinfo(ACPI_HANDLE, dev_info_t **);
1814667Smh27603 extern ACPI_STATUS acpica_get_handle(dev_info_t *, ACPI_HANDLE *);
1828906SEric.Saxe@Sun.COM extern ACPI_STATUS acpica_get_handle_cpu(int, ACPI_HANDLE *);
1839652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_build_processor_map(void);
1849652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_add_processor_to_map(UINT32, ACPI_HANDLE, UINT32);
1859652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_remove_processor_from_map(UINT32);
1869652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_map_cpu(processorid_t, UINT32);
1879652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_unmap_cpu(processorid_t);
1889652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_get_cpu_object_by_cpuid(processorid_t, ACPI_HANDLE *);
1899652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_get_cpu_object_by_procid(UINT32, ACPI_HANDLE *);
1909652SMichael.Corcoran@Sun.COM extern ACPI_STATUS acpica_get_cpu_object_by_apicid(UINT32, ACPI_HANDLE *);
191*12004Sjiang.liu@intel.com extern ACPI_STATUS acpica_get_cpu_id_by_object(ACPI_HANDLE, processorid_t *);
192*12004Sjiang.liu@intel.com extern ACPI_STATUS acpica_get_apicid_by_object(ACPI_HANDLE, UINT32 *);
193*12004Sjiang.liu@intel.com extern ACPI_STATUS acpica_get_procid_by_object(ACPI_HANDLE, UINT32 *);
1949652SMichael.Corcoran@Sun.COM 
1959652SMichael.Corcoran@Sun.COM extern uint64_t acpica_get_core_feature(uint64_t);
1969652SMichael.Corcoran@Sun.COM extern void acpica_set_core_feature(uint64_t);
1979652SMichael.Corcoran@Sun.COM extern void acpica_clear_core_feature(uint64_t);
1989652SMichael.Corcoran@Sun.COM extern uint64_t acpica_get_devcfg_feature(uint64_t);
1999652SMichael.Corcoran@Sun.COM extern void acpica_set_devcfg_feature(uint64_t);
2009652SMichael.Corcoran@Sun.COM extern void acpica_clear_devcfg_feature(uint64_t);
2010Sstevel@tonic-gate 
20211177SDana.Myers@Sun.COM void scan_d2a_map(void);
20311177SDana.Myers@Sun.COM 
2040Sstevel@tonic-gate #ifdef __cplusplus
2050Sstevel@tonic-gate }
2060Sstevel@tonic-gate #endif
2070Sstevel@tonic-gate 
2080Sstevel@tonic-gate #endif /* _SYS_ACPICA_H */
209