xref: /titanic_51/usr/src/uts/intel/sys/acpica.h (revision 432cf5a9b515358a45da17e9cfe523ee72f9c4e6)
17c478bd9Sstevel@tonic-gate /*
28e56767dSsmall  * CDDL HEADER START
38e56767dSsmall  *
48e56767dSsmall  * The contents of this file are subject to the terms of the
59e26e16fSrs90106  * Common Development and Distribution License (the "License").
69e26e16fSrs90106  * You may not use this file except in compliance with the License.
78e56767dSsmall  *
88e56767dSsmall  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
98e56767dSsmall  * or http://www.opensolaris.org/os/licensing.
108e56767dSsmall  * See the License for the specific language governing permissions
118e56767dSsmall  * and limitations under the License.
128e56767dSsmall  *
138e56767dSsmall  * When distributing Covered Code, include this CDDL HEADER in each
148e56767dSsmall  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
158e56767dSsmall  * If applicable, add the following below this CDDL HEADER, with the
168e56767dSsmall  * fields enclosed by brackets "[]" replaced with your own identifying
178e56767dSsmall  * information: Portions Copyright [yyyy] [name of copyright owner]
188e56767dSsmall  *
198e56767dSsmall  * CDDL HEADER END
208e56767dSsmall  */
218e56767dSsmall /*
220e751525SEric Saxe  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
25fa96bd91SMichael Corcoran /*
26fa96bd91SMichael Corcoran  * Copyright (c) 2009, Intel Corporation.
27fa96bd91SMichael Corcoran  * All rights reserved.
28fa96bd91SMichael Corcoran  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_ACPICA_H
317c478bd9Sstevel@tonic-gate #define	_SYS_ACPICA_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef __cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate typedef struct {
387c478bd9Sstevel@tonic-gate 	dev_info_t		*dip;
397c478bd9Sstevel@tonic-gate 	kmutex_t		mutex;
407c478bd9Sstevel@tonic-gate 	ddi_iblock_cookie_t	iblock_cookie;
417c478bd9Sstevel@tonic-gate } AcpiCA;
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /* acpi-user-options options property */
447c478bd9Sstevel@tonic-gate extern unsigned int acpi_options_prop;
457c478bd9Sstevel@tonic-gate #define	ACPI_OUSER_MASK		0x0003
467c478bd9Sstevel@tonic-gate #define	ACPI_OUSER_DFLT		0x0000
477c478bd9Sstevel@tonic-gate #define	ACPI_OUSER_ON		0x0001
487c478bd9Sstevel@tonic-gate #define	ACPI_OUSER_OFF		0x0002
497c478bd9Sstevel@tonic-gate #define	ACPI_OUSER_MADT		0x0004
507c478bd9Sstevel@tonic-gate #define	ACPI_OUSER_LEGACY	0x0008
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * Initialization state of the ACPI CA subsystem
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate #define	ACPICA_NOT_INITIALIZED	(0)
577c478bd9Sstevel@tonic-gate #define	ACPICA_INITIALIZED	(1)
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate extern int acpica_init(void);
607c478bd9Sstevel@tonic-gate extern void acpica_ec_init(void);
617c478bd9Sstevel@tonic-gate 
62f7534bc1Ssmall /*
63f7534bc1Ssmall  * acpi_status property values
64f7534bc1Ssmall  */
65f7534bc1Ssmall #define	ACPI_BOOT_INIT		0x00000001
66f7534bc1Ssmall #define	ACPI_BOOT_ENABLE	0x00000002
67f7534bc1Ssmall #define	ACPI_BOOT_BOOTCONF	0x00000010
68f7534bc1Ssmall 
697c478bd9Sstevel@tonic-gate #define	SCI_IPL	(LOCK_LEVEL-1)
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate /*
727c478bd9Sstevel@tonic-gate  * definitions of Bus Type
737c478bd9Sstevel@tonic-gate  */
747c478bd9Sstevel@tonic-gate #define	BUS_CBUS	1
757c478bd9Sstevel@tonic-gate #define	BUS_CBUSII	2
767c478bd9Sstevel@tonic-gate #define	BUS_EISA	3
777c478bd9Sstevel@tonic-gate #define	BUS_FUTURE	4
787c478bd9Sstevel@tonic-gate #define	BUS_INTERN	5
797c478bd9Sstevel@tonic-gate #define	BUS_ISA		6
807c478bd9Sstevel@tonic-gate #define	BUS_MBI		7
817c478bd9Sstevel@tonic-gate #define	BUS_MBII	8
829e26e16fSrs90106 #define	BUS_PCIE	9
837c478bd9Sstevel@tonic-gate #define	BUS_MPI		10
847c478bd9Sstevel@tonic-gate #define	BUS_MPSA	11
857c478bd9Sstevel@tonic-gate #define	BUS_NUBUS	12
867c478bd9Sstevel@tonic-gate #define	BUS_PCI		13
877c478bd9Sstevel@tonic-gate #define	BUS_PCMCIA	14
887c478bd9Sstevel@tonic-gate #define	BUS_TC		15
897c478bd9Sstevel@tonic-gate #define	BUS_VL		16
907c478bd9Sstevel@tonic-gate #define	BUS_VME		17
917c478bd9Sstevel@tonic-gate #define	BUS_XPRESS	18
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate /*
957c478bd9Sstevel@tonic-gate  * intr_po - polarity definitions
967c478bd9Sstevel@tonic-gate  */
977c478bd9Sstevel@tonic-gate #define	INTR_PO_CONFORM		0x00
987c478bd9Sstevel@tonic-gate #define	INTR_PO_ACTIVE_HIGH	0x01
997c478bd9Sstevel@tonic-gate #define	INTR_PO_RESERVED	0x02
1007c478bd9Sstevel@tonic-gate #define	INTR_PO_ACTIVE_LOW	0x03
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate /*
1037c478bd9Sstevel@tonic-gate  * intr_el edge or level definitions
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate #define	INTR_EL_CONFORM		0x00
1067c478bd9Sstevel@tonic-gate #define	INTR_EL_EDGE		0x01
1077c478bd9Sstevel@tonic-gate #define	INTR_EL_RESERVED	0x02
1087c478bd9Sstevel@tonic-gate #define	INTR_EL_LEVEL		0x03
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate /*
1117c478bd9Sstevel@tonic-gate  * interrupt flags structure
1127c478bd9Sstevel@tonic-gate  */
1137c478bd9Sstevel@tonic-gate typedef struct iflag {
1147c478bd9Sstevel@tonic-gate 	uchar_t	intr_po: 2,
1157c478bd9Sstevel@tonic-gate 		intr_el: 2,
1167c478bd9Sstevel@tonic-gate 		bustype: 4;
1177c478bd9Sstevel@tonic-gate } iflag_t;
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /* _HID for PCI bus object */
1207c478bd9Sstevel@tonic-gate #define	HID_PCI_BUS		0x30AD041
1217c478bd9Sstevel@tonic-gate #define	HID_PCI_EXPRESS_BUS	0x080AD041
1227c478bd9Sstevel@tonic-gate 
123fa96bd91SMichael Corcoran /* ACPICA subsystem has been fully initialized except SCI interrupt. */
124fa96bd91SMichael Corcoran #define	ACPI_FEATURE_FULL_INIT	0x1
125fa96bd91SMichael Corcoran /* ACPI SCI interrupt has been enabled. */
126fa96bd91SMichael Corcoran #define	ACPI_FEATURE_SCI_EVENT	0x2
127fa96bd91SMichael Corcoran /* ACPI device configuration has been enabled. */
128fa96bd91SMichael Corcoran #define	ACPI_FEATURE_DEVCFG	0x4
129fa96bd91SMichael Corcoran /* ACPI _OSI method should report support of ACPI Module Device. */
130fa96bd91SMichael Corcoran #define	ACPI_FEATURE_OSI_MODULE	0x8
131fa96bd91SMichael Corcoran 
132fa96bd91SMichael Corcoran /* ACPI device configuration features. */
133fa96bd91SMichael Corcoran #define	ACPI_DEVCFG_CPU		0x1
134fa96bd91SMichael Corcoran #define	ACPI_DEVCFG_MEMORY	0x2
135fa96bd91SMichael Corcoran #define	ACPI_DEVCFG_CONTAINER	0x4
136fa96bd91SMichael Corcoran 
1377c478bd9Sstevel@tonic-gate /*
138aa2aa9a6SDana Myers  * master_ops.c
139aa2aa9a6SDana Myers  */
140aa2aa9a6SDana Myers typedef struct device_id {
141aa2aa9a6SDana Myers 	struct device_id *next;
142aa2aa9a6SDana Myers 	char 	*id;
143aa2aa9a6SDana Myers } device_id_t;
144aa2aa9a6SDana Myers 
145aa2aa9a6SDana Myers typedef struct property {
146aa2aa9a6SDana Myers 	struct property *next;
147aa2aa9a6SDana Myers 	char *name;
148aa2aa9a6SDana Myers 	char *value;
149aa2aa9a6SDana Myers } property_t;
150aa2aa9a6SDana Myers 
151aa2aa9a6SDana Myers typedef struct master_rec {
152aa2aa9a6SDana Myers 	struct master_rec *next;
153aa2aa9a6SDana Myers 	device_id_t	*device_ids;
154aa2aa9a6SDana Myers 	char		*name;
155aa2aa9a6SDana Myers 	char		*description;
156aa2aa9a6SDana Myers 	property_t	*properties;
157aa2aa9a6SDana Myers } master_rec_t;
158aa2aa9a6SDana Myers 
159aa2aa9a6SDana Myers extern const master_rec_t *master_file_lookup(device_id_t *);
160aa2aa9a6SDana Myers extern device_id_t *mf_alloc_device_id(void);
161aa2aa9a6SDana Myers extern void mf_free_device_id(device_id_t *);
162aa2aa9a6SDana Myers extern void process_master_file(void);
163aa2aa9a6SDana Myers extern void free_master_data(void);
164aa2aa9a6SDana Myers 
165aa2aa9a6SDana Myers /*
1665cff7825Smh27603  * Function prototypes
1677c478bd9Sstevel@tonic-gate  */
1685cff7825Smh27603 extern ACPI_STATUS acpica_get_sci(int *, iflag_t *);
1695cff7825Smh27603 extern int acpica_get_bdf(dev_info_t *, int *, int *, int *);
1705cff7825Smh27603 extern ACPI_STATUS acpica_eval_int(ACPI_HANDLE, char *, int *);
1712df1fe9cSrandyf extern void acpica_ddi_save_resources(dev_info_t *);
1722df1fe9cSrandyf extern void acpica_ddi_restore_resources(dev_info_t *);
1734cf02d40SSaurabh Misra extern void acpi_reset_system(void);
1740e751525SEric Saxe extern void acpica_get_global_FADT(ACPI_TABLE_FADT **);
17578d5422cSMark Haywood extern void acpica_write_cpupm_capabilities(boolean_t, boolean_t);
1767c478bd9Sstevel@tonic-gate 
177fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_tag_devinfo(dev_info_t *, ACPI_HANDLE);
178fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_untag_devinfo(dev_info_t *, ACPI_HANDLE);
179fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_get_devinfo(ACPI_HANDLE, dev_info_t **);
180fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_get_handle(dev_info_t *, ACPI_HANDLE *);
181fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_get_handle_cpu(int, ACPI_HANDLE *);
182fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_build_processor_map(void);
183fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_add_processor_to_map(UINT32, ACPI_HANDLE, UINT32);
184fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_remove_processor_from_map(UINT32);
185fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_map_cpu(processorid_t, UINT32);
186fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_unmap_cpu(processorid_t);
187fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_get_cpu_object_by_cpuid(processorid_t, ACPI_HANDLE *);
188fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_get_cpu_object_by_procid(UINT32, ACPI_HANDLE *);
189fa96bd91SMichael Corcoran extern ACPI_STATUS acpica_get_cpu_object_by_apicid(UINT32, ACPI_HANDLE *);
190fa96bd91SMichael Corcoran 
191fa96bd91SMichael Corcoran extern uint64_t acpica_get_core_feature(uint64_t);
192fa96bd91SMichael Corcoran extern void acpica_set_core_feature(uint64_t);
193fa96bd91SMichael Corcoran extern void acpica_clear_core_feature(uint64_t);
194fa96bd91SMichael Corcoran extern uint64_t acpica_get_devcfg_feature(uint64_t);
195fa96bd91SMichael Corcoran extern void acpica_set_devcfg_feature(uint64_t);
196fa96bd91SMichael Corcoran extern void acpica_clear_devcfg_feature(uint64_t);
197fa96bd91SMichael Corcoran 
198*432cf5a9SDana Myers void scan_d2a_map(void);
199*432cf5a9SDana Myers 
2007c478bd9Sstevel@tonic-gate #ifdef __cplusplus
2017c478bd9Sstevel@tonic-gate }
2027c478bd9Sstevel@tonic-gate #endif
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate #endif /* _SYS_ACPICA_H */
205