aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/hp/common/sba_iommu.c7
-rw-r--r--drivers/acpi/acpi_memhotplug.c11
-rw-r--r--drivers/acpi/acpica/Makefile4
-rw-r--r--drivers/acpi/acpica/acconfig.h10
-rw-r--r--drivers/acpi/acpica/acdebug.h4
-rw-r--r--drivers/acpi/acpica/acglobal.h37
-rw-r--r--drivers/acpi/acpica/achware.h8
-rw-r--r--drivers/acpi/acpica/acinterp.h4
-rw-r--r--drivers/acpi/acpica/aclocal.h16
-rw-r--r--drivers/acpi/acpica/acmacros.h2
-rw-r--r--drivers/acpi/acpica/acnamesp.h25
-rw-r--r--drivers/acpi/acpica/acobject.h1
-rw-r--r--drivers/acpi/acpica/acparser.h2
-rw-r--r--drivers/acpi/acpica/acpredef.h584
-rw-r--r--drivers/acpi/acpica/acutils.h30
-rw-r--r--drivers/acpi/acpica/amlcode.h1
-rw-r--r--drivers/acpi/acpica/dsfield.c18
-rw-r--r--drivers/acpi/acpica/dsmethod.c15
-rw-r--r--drivers/acpi/acpica/dsmthdat.c8
-rw-r--r--drivers/acpi/acpica/dsobject.c23
-rw-r--r--drivers/acpi/acpica/dswload.c41
-rw-r--r--drivers/acpi/acpica/evgpe.c8
-rw-r--r--drivers/acpi/acpica/evgpeblk.c4
-rw-r--r--drivers/acpi/acpica/evrgnini.c45
-rw-r--r--drivers/acpi/acpica/exconfig.c7
-rw-r--r--drivers/acpi/acpica/exdump.c6
-rw-r--r--drivers/acpi/acpica/exfield.c82
-rw-r--r--drivers/acpi/acpica/exfldio.c7
-rw-r--r--drivers/acpi/acpica/exutils.c53
-rw-r--r--drivers/acpi/acpica/hwgpe.c34
-rw-r--r--drivers/acpi/acpica/hwregs.c206
-rw-r--r--drivers/acpi/acpica/hwtimer.c2
-rw-r--r--drivers/acpi/acpica/hwxface.c181
-rw-r--r--drivers/acpi/acpica/nsalloc.c88
-rw-r--r--drivers/acpi/acpica/nsdumpdv.c7
-rw-r--r--drivers/acpi/acpica/nseval.c137
-rw-r--r--drivers/acpi/acpica/nsinit.c15
-rw-r--r--drivers/acpi/acpica/nsload.c3
-rw-r--r--drivers/acpi/acpica/nspredef.c718
-rw-r--r--drivers/acpi/acpica/nsrepair.c203
-rw-r--r--drivers/acpi/acpica/nsutils.c5
-rw-r--r--drivers/acpi/acpica/nsxfeval.c23
-rw-r--r--drivers/acpi/acpica/nsxfname.c237
-rw-r--r--drivers/acpi/acpica/psloop.c119
-rw-r--r--drivers/acpi/acpica/psxface.c4
-rw-r--r--drivers/acpi/acpica/tbutils.c82
-rw-r--r--drivers/acpi/acpica/uteval.c378
-rw-r--r--drivers/acpi/acpica/utglobal.c12
-rw-r--r--drivers/acpi/acpica/utids.c382
-rw-r--r--drivers/acpi/acpica/utinit.c22
-rw-r--r--drivers/acpi/acpica/utmisc.c85
-rw-r--r--drivers/acpi/acpica/utxface.c26
-rw-r--r--drivers/acpi/bus.c2
-rw-r--r--drivers/acpi/container.c11
-rw-r--r--drivers/acpi/dock.c8
-rw-r--r--drivers/acpi/glue.c8
-rw-r--r--drivers/acpi/scan.c163
-rw-r--r--drivers/char/agp/hp-agp.c9
-rw-r--r--drivers/ide/ide-acpi.c5
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c12
-rw-r--r--drivers/platform/x86/sony-laptop.c7
-rw-r--r--drivers/pnp/pnpacpi/core.c6
-rw-r--r--include/acpi/acpi_bus.h12
-rw-r--r--include/acpi/acpixf.h10
-rw-r--r--include/acpi/actbl.h78
-rw-r--r--include/acpi/actbl1.h872
-rw-r--r--include/acpi/actbl2.h868
-rw-r--r--include/acpi/actypes.h92
68 files changed, 4026 insertions, 2169 deletions
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 8cfb001092ab..674a8374c6d9 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -2026,24 +2026,21 @@ acpi_sba_ioc_add(struct acpi_device *device)
2026 struct ioc *ioc; 2026 struct ioc *ioc;
2027 acpi_status status; 2027 acpi_status status;
2028 u64 hpa, length; 2028 u64 hpa, length;
2029 struct acpi_buffer buffer;
2030 struct acpi_device_info *dev_info; 2029 struct acpi_device_info *dev_info;
2031 2030
2032 status = hp_acpi_csr_space(device->handle, &hpa, &length); 2031 status = hp_acpi_csr_space(device->handle, &hpa, &length);
2033 if (ACPI_FAILURE(status)) 2032 if (ACPI_FAILURE(status))
2034 return 1; 2033 return 1;
2035 2034
2036 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; 2035 status = acpi_get_object_info(device->handle, &dev_info);
2037 status = acpi_get_object_info(device->handle, &buffer);
2038 if (ACPI_FAILURE(status)) 2036 if (ACPI_FAILURE(status))
2039 return 1; 2037 return 1;
2040 dev_info = buffer.pointer;
2041 2038
2042 /* 2039 /*
2043 * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI 2040 * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI
2044 * root bridges, and its CSR space includes the IOC function. 2041 * root bridges, and its CSR space includes the IOC function.
2045 */ 2042 */
2046 if (strncmp("HWP0001", dev_info->hardware_id.value, 7) == 0) { 2043 if (strncmp("HWP0001", dev_info->hardware_id.string, 7) == 0) {
2047 hpa += ZX1_IOC_OFFSET; 2044 hpa += ZX1_IOC_OFFSET;
2048 /* zx1 based systems default to kernel page size iommu pages */ 2045 /* zx1 based systems default to kernel page size iommu pages */
2049 if (!iovp_shift) 2046 if (!iovp_shift)
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 9a62224cc278..80eacbe157e2 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -481,26 +481,23 @@ static acpi_status is_memory_device(acpi_handle handle)
481{ 481{
482 char *hardware_id; 482 char *hardware_id;
483 acpi_status status; 483 acpi_status status;
484 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
485 struct acpi_device_info *info; 484 struct acpi_device_info *info;
486 485
487 486 status = acpi_get_object_info(handle, &info);
488 status = acpi_get_object_info(handle, &buffer);
489 if (ACPI_FAILURE(status)) 487 if (ACPI_FAILURE(status))
490 return status; 488 return status;
491 489
492 info = buffer.pointer;
493 if (!(info->valid & ACPI_VALID_HID)) { 490 if (!(info->valid & ACPI_VALID_HID)) {
494 kfree(buffer.pointer); 491 kfree(info);
495 return AE_ERROR; 492 return AE_ERROR;
496 } 493 }
497 494
498 hardware_id = info->hardware_id.value; 495 hardware_id = info->hardware_id.string;
499 if ((hardware_id == NULL) || 496 if ((hardware_id == NULL) ||
500 (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) 497 (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
501 status = AE_ERROR; 498 status = AE_ERROR;
502 499
503 kfree(buffer.pointer); 500 kfree(info);
504 return status; 501 return status;
505} 502}
506 503
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 72ac28da14e3..e7973bc16846 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -28,7 +28,7 @@ acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
28acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \ 28acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \
29 nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ 29 nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \
30 nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ 30 nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \
31 nsparse.o nspredef.o 31 nsparse.o nspredef.o nsrepair.o
32 32
33acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o 33acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o
34 34
@@ -44,4 +44,4 @@ acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o
44 44
45acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ 45acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \
46 utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ 46 utcopy.o utdelete.o utglobal.o utmath.o utobject.o \
47 utstate.o utmutex.o utobject.o utresrc.o utlock.o 47 utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h
index e6777fb883d2..8e679ef5b231 100644
--- a/drivers/acpi/acpica/acconfig.h
+++ b/drivers/acpi/acpica/acconfig.h
@@ -183,7 +183,7 @@
183 183
184/* Operation regions */ 184/* Operation regions */
185 185
186#define ACPI_NUM_PREDEFINED_REGIONS 8 186#define ACPI_NUM_PREDEFINED_REGIONS 9
187#define ACPI_USER_REGION_BEGIN 0x80 187#define ACPI_USER_REGION_BEGIN 0x80
188 188
189/* Maximum space_ids for Operation Regions */ 189/* Maximum space_ids for Operation Regions */
@@ -199,9 +199,15 @@
199#define ACPI_RSDP_CHECKSUM_LENGTH 20 199#define ACPI_RSDP_CHECKSUM_LENGTH 20
200#define ACPI_RSDP_XCHECKSUM_LENGTH 36 200#define ACPI_RSDP_XCHECKSUM_LENGTH 36
201 201
202/* SMBus bidirectional buffer size */ 202/* SMBus and IPMI bidirectional buffer size */
203 203
204#define ACPI_SMBUS_BUFFER_SIZE 34 204#define ACPI_SMBUS_BUFFER_SIZE 34
205#define ACPI_IPMI_BUFFER_SIZE 66
206
207/* _sx_d and _sx_w control methods */
208
209#define ACPI_NUM_sx_d_METHODS 4
210#define ACPI_NUM_sx_w_METHODS 5
205 211
206/****************************************************************************** 212/******************************************************************************
207 * 213 *
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 62c59df3b86c..a4fb001d96f1 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -154,10 +154,6 @@ void
154acpi_db_display_argument_object(union acpi_operand_object *obj_desc, 154acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
155 struct acpi_walk_state *walk_state); 155 struct acpi_walk_state *walk_state);
156 156
157void acpi_db_check_predefined_names(void);
158
159void acpi_db_batch_execute(void);
160
161/* 157/*
162 * dbexec - debugger control method execution 158 * dbexec - debugger control method execution
163 */ 159 */
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 3d87362d17ed..29ba66d5a790 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -58,6 +58,10 @@
58#define ACPI_INIT_GLOBAL(a,b) a 58#define ACPI_INIT_GLOBAL(a,b) a
59#endif 59#endif
60 60
61#ifdef DEFINE_ACPI_GLOBALS
62
63/* Public globals, available from outside ACPICA subsystem */
64
61/***************************************************************************** 65/*****************************************************************************
62 * 66 *
63 * Runtime configuration (static defaults that can be overriden at runtime) 67 * Runtime configuration (static defaults that can be overriden at runtime)
@@ -78,7 +82,7 @@
78 * 5) Allow unresolved references (invalid target name) in package objects 82 * 5) Allow unresolved references (invalid target name) in package objects
79 * 6) Enable warning messages for behavior that is not ACPI spec compliant 83 * 6) Enable warning messages for behavior that is not ACPI spec compliant
80 */ 84 */
81ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); 85u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
82 86
83/* 87/*
84 * Automatically serialize ALL control methods? Default is FALSE, meaning 88 * Automatically serialize ALL control methods? Default is FALSE, meaning
@@ -86,27 +90,36 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
86 * Only change this if the ASL code is poorly written and cannot handle 90 * Only change this if the ASL code is poorly written and cannot handle
87 * reentrancy even though methods are marked "NotSerialized". 91 * reentrancy even though methods are marked "NotSerialized".
88 */ 92 */
89ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); 93u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
90 94
91/* 95/*
92 * Create the predefined _OSI method in the namespace? Default is TRUE 96 * Create the predefined _OSI method in the namespace? Default is TRUE
93 * because ACPI CA is fully compatible with other ACPI implementations. 97 * because ACPI CA is fully compatible with other ACPI implementations.
94 * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. 98 * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
95 */ 99 */
96ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE); 100u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
97 101
98/* 102/*
99 * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and 103 * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and
100 * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only 104 * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only
101 * be enabled just before going to sleep. 105 * be enabled just before going to sleep.
102 */ 106 */
103ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); 107u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
104 108
105/* 109/*
106 * Optionally use default values for the ACPI register widths. Set this to 110 * Optionally use default values for the ACPI register widths. Set this to
107 * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. 111 * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
108 */ 112 */
109ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE); 113u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
114
115/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */
116
117struct acpi_table_fadt acpi_gbl_FADT;
118u32 acpi_current_gpe_count;
119u32 acpi_gbl_trace_flags;
120acpi_name acpi_gbl_trace_method_name;
121
122#endif
110 123
111/***************************************************************************** 124/*****************************************************************************
112 * 125 *
@@ -114,11 +127,6 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
114 * 127 *
115 ****************************************************************************/ 128 ****************************************************************************/
116 129
117/* Runtime configuration of debug print levels */
118
119extern u32 acpi_dbg_level;
120extern u32 acpi_dbg_layer;
121
122/* Procedure nesting level for debug output */ 130/* Procedure nesting level for debug output */
123 131
124extern u32 acpi_gbl_nesting_level; 132extern u32 acpi_gbl_nesting_level;
@@ -127,10 +135,8 @@ extern u32 acpi_gbl_nesting_level;
127 135
128ACPI_EXTERN u32 acpi_gbl_original_dbg_level; 136ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
129ACPI_EXTERN u32 acpi_gbl_original_dbg_layer; 137ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
130ACPI_EXTERN acpi_name acpi_gbl_trace_method_name;
131ACPI_EXTERN u32 acpi_gbl_trace_dbg_level; 138ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
132ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer; 139ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
133ACPI_EXTERN u32 acpi_gbl_trace_flags;
134 140
135/***************************************************************************** 141/*****************************************************************************
136 * 142 *
@@ -142,10 +148,8 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags;
142 * acpi_gbl_root_table_list is the master list of ACPI tables found in the 148 * acpi_gbl_root_table_list is the master list of ACPI tables found in the
143 * RSDT/XSDT. 149 * RSDT/XSDT.
144 * 150 *
145 * acpi_gbl_FADT is a local copy of the FADT, converted to a common format.
146 */ 151 */
147ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list; 152ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list;
148ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT;
149ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS; 153ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS;
150 154
151/* These addresses are calculated from the FADT Event Block addresses */ 155/* These addresses are calculated from the FADT Event Block addresses */
@@ -261,7 +265,8 @@ ACPI_EXTERN u8 acpi_gbl_osi_data;
261extern u8 acpi_gbl_shutdown; 265extern u8 acpi_gbl_shutdown;
262extern u32 acpi_gbl_startup_flags; 266extern u32 acpi_gbl_startup_flags;
263extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; 267extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
264extern const char *acpi_gbl_highest_dstate_names[4]; 268extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS];
269extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS];
265extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; 270extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
266extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; 271extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
267 272
@@ -290,6 +295,7 @@ extern char const *acpi_gbl_exception_names_ctrl[];
290ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; 295ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct;
291ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; 296ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node;
292ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; 297ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device;
298ACPI_EXTERN union acpi_operand_object *acpi_gbl_module_code_list;
293 299
294extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES]; 300extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES];
295extern const struct acpi_predefined_names 301extern const struct acpi_predefined_names
@@ -340,7 +346,6 @@ ACPI_EXTERN struct acpi_fixed_event_handler
340ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; 346ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
341ACPI_EXTERN struct acpi_gpe_block_info 347ACPI_EXTERN struct acpi_gpe_block_info
342*acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; 348*acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
343ACPI_EXTERN u32 acpi_current_gpe_count;
344 349
345/***************************************************************************** 350/*****************************************************************************
346 * 351 *
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h
index 4afa3d8e0efb..36192f142fbb 100644
--- a/drivers/acpi/acpica/achware.h
+++ b/drivers/acpi/acpica/achware.h
@@ -62,6 +62,14 @@ u32 acpi_hw_get_mode(void);
62/* 62/*
63 * hwregs - ACPI Register I/O 63 * hwregs - ACPI Register I/O
64 */ 64 */
65acpi_status
66acpi_hw_validate_register(struct acpi_generic_address *reg,
67 u8 max_bit_width, u64 *address);
68
69acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg);
70
71acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg);
72
65struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id); 73struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
66 74
67acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control); 75acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control);
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index e8db7a3143a5..5db9f2916f7c 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -461,9 +461,9 @@ void acpi_ex_acquire_global_lock(u32 rule);
461 461
462void acpi_ex_release_global_lock(u32 rule); 462void acpi_ex_release_global_lock(u32 rule);
463 463
464void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string); 464void acpi_ex_eisa_id_to_string(char *dest, acpi_integer compressed_id);
465 465
466void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string); 466void acpi_ex_integer_to_string(char *dest, acpi_integer value);
467 467
468/* 468/*
469 * exregion - default op_region handlers 469 * exregion - default op_region handlers
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index ee986edfa0da..81e64f478679 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -369,6 +369,19 @@ union acpi_predefined_info {
369 struct acpi_package_info3 ret_info3; 369 struct acpi_package_info3 ret_info3;
370}; 370};
371 371
372/* Data block used during object validation */
373
374struct acpi_predefined_data {
375 char *pathname;
376 const union acpi_predefined_info *predefined;
377 u32 flags;
378 u8 node_flags;
379};
380
381/* Defines for Flags field above */
382
383#define ACPI_OBJECT_REPAIRED 1
384
372/* 385/*
373 * Bitmapped return value types 386 * Bitmapped return value types
374 * Note: the actual data types must be contiguous, a loop in nspredef.c 387 * Note: the actual data types must be contiguous, a loop in nspredef.c
@@ -885,6 +898,9 @@ struct acpi_bit_register_info {
885#define ACPI_OSI_WIN_XP_SP2 0x05 898#define ACPI_OSI_WIN_XP_SP2 0x05
886#define ACPI_OSI_WINSRV_2003_SP1 0x06 899#define ACPI_OSI_WINSRV_2003_SP1 0x06
887#define ACPI_OSI_WIN_VISTA 0x07 900#define ACPI_OSI_WIN_VISTA 0x07
901#define ACPI_OSI_WINSRV_2008 0x08
902#define ACPI_OSI_WIN_VISTA_SP1 0x09
903#define ACPI_OSI_WIN_7 0x0A
888 904
889#define ACPI_ALWAYS_ILLEGAL 0x00 905#define ACPI_ALWAYS_ILLEGAL 0x00
890 906
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 91ac7d7b4402..3acd9c6760ea 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -340,6 +340,7 @@
340 */ 340 */
341#define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e); 341#define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e);
342#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); 342#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e);
343#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist
343 344
344#else 345#else
345 346
@@ -347,6 +348,7 @@
347 348
348#define ACPI_ERROR_NAMESPACE(s, e) 349#define ACPI_ERROR_NAMESPACE(s, e)
349#define ACPI_ERROR_METHOD(s, n, p, e) 350#define ACPI_ERROR_METHOD(s, n, p, e)
351#define ACPI_WARN_PREDEFINED(plist)
350#endif /* ACPI_NO_ERROR_MESSAGES */ 352#endif /* ACPI_NO_ERROR_MESSAGES */
351 353
352/* 354/*
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 94cdc2b8cb93..09a2764c734b 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -73,6 +73,14 @@
73#define ACPI_NS_WALK_UNLOCK 0x01 73#define ACPI_NS_WALK_UNLOCK 0x01
74#define ACPI_NS_WALK_TEMP_NODES 0x02 74#define ACPI_NS_WALK_TEMP_NODES 0x02
75 75
76/* Object is not a package element */
77
78#define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX
79
80/* Always emit warning message, not dependent on node flags */
81
82#define ACPI_WARN_ALWAYS 0
83
76/* 84/*
77 * nsinit - Namespace initialization 85 * nsinit - Namespace initialization
78 */ 86 */
@@ -144,6 +152,8 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name);
144 152
145void acpi_ns_delete_node(struct acpi_namespace_node *node); 153void acpi_ns_delete_node(struct acpi_namespace_node *node);
146 154
155void acpi_ns_remove_node(struct acpi_namespace_node *node);
156
147void 157void
148acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle); 158acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
149 159
@@ -186,6 +196,8 @@ acpi_ns_dump_objects(acpi_object_type type,
186 */ 196 */
187acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); 197acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
188 198
199void acpi_ns_exec_module_code_list(void);
200
189/* 201/*
190 * nspredef - Support for predefined/reserved names 202 * nspredef - Support for predefined/reserved names
191 */ 203 */
@@ -260,6 +272,19 @@ acpi_ns_get_attached_data(struct acpi_namespace_node *node,
260 acpi_object_handler handler, void **data); 272 acpi_object_handler handler, void **data);
261 273
262/* 274/*
275 * nsrepair - return object repair for predefined methods/objects
276 */
277acpi_status
278acpi_ns_repair_object(struct acpi_predefined_data *data,
279 u32 expected_btypes,
280 u32 package_index,
281 union acpi_operand_object **return_object_ptr);
282
283acpi_status
284acpi_ns_repair_package_list(struct acpi_predefined_data *data,
285 union acpi_operand_object **obj_desc_ptr);
286
287/*
263 * nssearch - Namespace searching and entry 288 * nssearch - Namespace searching and entry
264 */ 289 */
265acpi_status 290acpi_status
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index eb6f038b03d9..b39d682a2140 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -98,6 +98,7 @@
98#define AOPOBJ_SETUP_COMPLETE 0x10 98#define AOPOBJ_SETUP_COMPLETE 0x10
99#define AOPOBJ_SINGLE_DATUM 0x20 99#define AOPOBJ_SINGLE_DATUM 0x20
100#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */ 100#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */
101#define AOPOBJ_MODULE_LEVEL 0x80
101 102
102/****************************************************************************** 103/******************************************************************************
103 * 104 *
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h
index 23ee0fbf5619..22881e8ce229 100644
--- a/drivers/acpi/acpica/acparser.h
+++ b/drivers/acpi/acpica/acparser.h
@@ -62,6 +62,8 @@
62#define ACPI_PARSE_DEFERRED_OP 0x0100 62#define ACPI_PARSE_DEFERRED_OP 0x0100
63#define ACPI_PARSE_DISASSEMBLE 0x0200 63#define ACPI_PARSE_DISASSEMBLE 0x0200
64 64
65#define ACPI_PARSE_MODULE_LEVEL 0x0400
66
65/****************************************************************************** 67/******************************************************************************
66 * 68 *
67 * Parser interfaces 69 * Parser interfaces
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index 63f656ae3604..cd80d1dd1950 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -64,8 +64,8 @@
64 * (Used for _PRW) 64 * (Used for _PRW)
65 * 65 *
66 * 66 *
67 * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the 67 * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each
68 * different types describe the contents of each of the sub-packages. 68 * of the different types describe the contents of each of the sub-packages.
69 * 69 *
70 * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types: 70 * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types:
71 * object type 71 * object type
@@ -91,6 +91,9 @@
91 * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length 91 * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length
92 * (Used for _HPX) 92 * (Used for _HPX)
93 * 93 *
94 * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length
95 * (Used for _ART, _FPS)
96 *
94 *****************************************************************************/ 97 *****************************************************************************/
95 98
96enum acpi_return_package_types { 99enum acpi_return_package_types {
@@ -101,9 +104,11 @@ enum acpi_return_package_types {
101 ACPI_PTYPE2_COUNT = 5, 104 ACPI_PTYPE2_COUNT = 5,
102 ACPI_PTYPE2_PKG_COUNT = 6, 105 ACPI_PTYPE2_PKG_COUNT = 6,
103 ACPI_PTYPE2_FIXED = 7, 106 ACPI_PTYPE2_FIXED = 7,
104 ACPI_PTYPE2_MIN = 8 107 ACPI_PTYPE2_MIN = 8,
108 ACPI_PTYPE2_REV_FIXED = 9
105}; 109};
106 110
111#ifdef ACPI_CREATE_PREDEFINED_TABLE
107/* 112/*
108 * Predefined method/object information table. 113 * Predefined method/object information table.
109 * 114 *
@@ -136,239 +141,384 @@ enum acpi_return_package_types {
136 * is saved here (rather than in a separate table) in order to minimize the 141 * is saved here (rather than in a separate table) in order to minimize the
137 * overall size of the stored data. 142 * overall size of the stored data.
138 */ 143 */
139static const union acpi_predefined_info predefined_names[] = { 144static const union acpi_predefined_info predefined_names[] =
140 {.info = {"_AC0", 0, ACPI_RTYPE_INTEGER}}, 145{
141 {.info = {"_AC1", 0, ACPI_RTYPE_INTEGER}}, 146 {{"_AC0", 0, ACPI_RTYPE_INTEGER}},
142 {.info = {"_AC2", 0, ACPI_RTYPE_INTEGER}}, 147 {{"_AC1", 0, ACPI_RTYPE_INTEGER}},
143 {.info = {"_AC3", 0, ACPI_RTYPE_INTEGER}}, 148 {{"_AC2", 0, ACPI_RTYPE_INTEGER}},
144 {.info = {"_AC4", 0, ACPI_RTYPE_INTEGER}}, 149 {{"_AC3", 0, ACPI_RTYPE_INTEGER}},
145 {.info = {"_AC5", 0, ACPI_RTYPE_INTEGER}}, 150 {{"_AC4", 0, ACPI_RTYPE_INTEGER}},
146 {.info = {"_AC6", 0, ACPI_RTYPE_INTEGER}}, 151 {{"_AC5", 0, ACPI_RTYPE_INTEGER}},
147 {.info = {"_AC7", 0, ACPI_RTYPE_INTEGER}}, 152 {{"_AC6", 0, ACPI_RTYPE_INTEGER}},
148 {.info = {"_AC8", 0, ACPI_RTYPE_INTEGER}}, 153 {{"_AC7", 0, ACPI_RTYPE_INTEGER}},
149 {.info = {"_AC9", 0, ACPI_RTYPE_INTEGER}}, 154 {{"_AC8", 0, ACPI_RTYPE_INTEGER}},
150 {.info = {"_ADR", 0, ACPI_RTYPE_INTEGER}}, 155 {{"_AC9", 0, ACPI_RTYPE_INTEGER}},
151 {.info = {"_AL0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 156 {{"_ADR", 0, ACPI_RTYPE_INTEGER}},
152 {.info = {"_AL1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 157 {{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
153 {.info = {"_AL2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 158 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
154 {.info = {"_AL3", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 159
155 {.info = {"_AL4", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 160 {{"_AL1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
156 {.info = {"_AL5", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 161 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
157 {.info = {"_AL6", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 162
158 {.info = {"_AL7", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 163 {{"_AL2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
159 {.info = {"_AL8", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 164 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
160 {.info = {"_AL9", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 165
161 {.info = {"_ALC", 0, ACPI_RTYPE_INTEGER}}, 166 {{"_AL3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
162 {.info = {"_ALI", 0, ACPI_RTYPE_INTEGER}}, 167 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
163 {.info = {"_ALP", 0, ACPI_RTYPE_INTEGER}}, 168
164 {.info = {"_ALR", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* variable (Pkgs) each 2 (Ints) */ 169 {{"_AL4", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
165 {.info = {"_ALT", 0, ACPI_RTYPE_INTEGER}}, 170 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
166 {.info = {"_BBN", 0, ACPI_RTYPE_INTEGER}}, 171
167 {.info = {"_BCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ 172 {{"_AL5", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
168 {.info = {"_BCM", 1, 0}}, 173 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
169 {.info = {"_BDN", 0, ACPI_RTYPE_INTEGER}}, 174
170 {.info = {"_BFS", 1, 0}}, 175 {{"_AL6", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
171 {.info = {"_BIF", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 176 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
172 9, 177
173 ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER, 4, 0}}, /* fixed (9 Int),(4 Str) */ 178 {{"_AL7", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
174 {.info = {"_BLT", 3, 0}}, 179 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
175 {.info = {"_BMC", 1, 0}}, 180
176 {.info = {"_BMD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* fixed (5 Int) */ 181 {{"_AL8", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
177 {.info = {"_BQC", 0, ACPI_RTYPE_INTEGER}}, 182 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
178 {.info = {"_BST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ 183
179 {.info = {"_BTM", 1, ACPI_RTYPE_INTEGER}}, 184 {{"_AL9", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
180 {.info = {"_BTP", 1, 0}}, 185 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
181 {.info = {"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* see PCI firmware spec 3.0 */ 186
182 {.info = {"_CID", 0, 187 {{"_ALC", 0, ACPI_RTYPE_INTEGER}},
183 ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, 188 {{"_ALI", 0, ACPI_RTYPE_INTEGER}},
184 {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0, 0, 0}}, /* variable (Ints/Strs) */ 189 {{"_ALP", 0, ACPI_RTYPE_INTEGER}},
185 {.info = {"_CRS", 0, ACPI_RTYPE_BUFFER}}, 190 {{"_ALR", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 (Ints) */
186 {.info = {"_CRT", 0, ACPI_RTYPE_INTEGER}}, 191 {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2,0}, 0,0}},
187 {.info = {"_CSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (1 Int(n), n-1 Int) */ 192
188 {.info = {"_CST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_PKG_COUNT, 193 {{"_ALT", 0, ACPI_RTYPE_INTEGER}},
189 ACPI_RTYPE_BUFFER, 1, 194 {{"_ART", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(rev), n Pkg (2 Ref/11 Int) */
190 ACPI_RTYPE_INTEGER, 3, 0}}, /* variable (1 Int(n), n Pkg (1 Buf/3 Int) */ 195 {{{ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER},
191 {.info = {"_DCK", 1, ACPI_RTYPE_INTEGER}}, 196 11, 0}},
192 {.info = {"_DCS", 0, ACPI_RTYPE_INTEGER}}, 197
193 {.info = {"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}}, 198 {{"_BBN", 0, ACPI_RTYPE_INTEGER}},
194 {.info = {"_DDN", 0, ACPI_RTYPE_STRING}}, 199 {{"_BCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
195 {.info = {"_DGS", 0, ACPI_RTYPE_INTEGER}}, 200 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
196 {.info = {"_DIS", 0, 0}}, 201
197 {.info = {"_DMA", 0, ACPI_RTYPE_BUFFER}}, 202 {{"_BCM", 1, 0}},
198 {.info = {"_DOD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ 203 {{"_BCT", 1, ACPI_RTYPE_INTEGER}},
199 {.info = {"_DOS", 1, 0}}, 204 {{"_BDN", 0, ACPI_RTYPE_INTEGER}},
200 {.info = {"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */ 205 {{"_BFS", 1, 0}},
201 {.info = {"_DSS", 1, 0}}, 206 {{"_BIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (9 Int),(4 Str) */
202 {.info = {"_DSW", 3, 0}}, 207 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING}, 4,0}},
203 {.info = {"_EC_", 0, ACPI_RTYPE_INTEGER}}, 208
204 {.info = {"_EDL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 209 {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */
205 {.info = {"_EJ0", 1, 0}}, 210 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4,
206 {.info = {"_EJ1", 1, 0}}, 211 0}},
207 {.info = {"_EJ2", 1, 0}}, 212
208 {.info = {"_EJ3", 1, 0}}, 213 {{"_BLT", 3, 0}},
209 {.info = {"_EJ4", 1, 0}}, 214 {{"_BMA", 1, ACPI_RTYPE_INTEGER}},
210 {.info = {"_EJD", 0, ACPI_RTYPE_STRING}}, 215 {{"_BMC", 1, 0}},
211 {.info = {"_FDE", 0, ACPI_RTYPE_BUFFER}}, 216 {{"_BMD", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (5 Int) */
212 {.info = {"_FDI", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0}}, /* fixed (16 Int) */ 217 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
213 {.info = {"_FDM", 1, 0}}, 218
214 {.info = {"_FIX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ 219 {{"_BMS", 1, ACPI_RTYPE_INTEGER}},
215 {.info = {"_GLK", 0, ACPI_RTYPE_INTEGER}}, 220 {{"_BQC", 0, ACPI_RTYPE_INTEGER}},
216 {.info = {"_GPD", 0, ACPI_RTYPE_INTEGER}}, 221 {{"_BST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
217 {.info = {"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ 222 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}},
218 {.info = {"_GSB", 0, ACPI_RTYPE_INTEGER}}, 223
219 {.info = {"_GTF", 0, ACPI_RTYPE_BUFFER}}, 224 {{"_BTM", 1, ACPI_RTYPE_INTEGER}},
220 {.info = {"_GTM", 0, ACPI_RTYPE_BUFFER}}, 225 {{"_BTP", 1, 0}},
221 {.info = {"_GTS", 1, 0}}, 226 {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */
222 {.info = {"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, 227 {{"_CDM", 0, ACPI_RTYPE_INTEGER}},
223 {.info = {"_HOT", 0, ACPI_RTYPE_INTEGER}}, 228 {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */
224 {.info = {"_HPP", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ 229 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}},
230
231 {{"_CRS", 0, ACPI_RTYPE_BUFFER}},
232 {{"_CRT", 0, ACPI_RTYPE_INTEGER}},
233 {{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */
234 {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
235
236 {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */
237 {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}},
238
239 {{"_DCK", 1, ACPI_RTYPE_INTEGER}},
240 {{"_DCS", 0, ACPI_RTYPE_INTEGER}},
241 {{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}},
242 {{"_DDN", 0, ACPI_RTYPE_STRING}},
243 {{"_DGS", 0, ACPI_RTYPE_INTEGER}},
244 {{"_DIS", 0, 0}},
245 {{"_DMA", 0, ACPI_RTYPE_BUFFER}},
246 {{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
247 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
248
249 {{"_DOS", 1, 0}},
250 {{"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */
251 {{"_DSS", 1, 0}},
252 {{"_DSW", 3, 0}},
253 {{"_DTI", 1, 0}},
254 {{"_EC_", 0, ACPI_RTYPE_INTEGER}},
255 {{"_EDL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs)*/
256 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
257
258 {{"_EJ0", 1, 0}},
259 {{"_EJ1", 1, 0}},
260 {{"_EJ2", 1, 0}},
261 {{"_EJ3", 1, 0}},
262 {{"_EJ4", 1, 0}},
263 {{"_EJD", 0, ACPI_RTYPE_STRING}},
264 {{"_FDE", 0, ACPI_RTYPE_BUFFER}},
265 {{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */
266 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}},
267
268 {{"_FDM", 1, 0}},
269 {{"_FIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
270 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0}, 0, 0}},
271
272 {{"_FIX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
273 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
274
275 {{"_FPS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(rev), n Pkg (5 Int) */
276 {{{ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 5, 0}, 0, 0}},
277
278 {{"_FSL", 1, 0}},
279 {{"_FST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */
280 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}},
281
282 {{"_GAI", 0, ACPI_RTYPE_INTEGER}},
283 {{"_GHL", 0, ACPI_RTYPE_INTEGER}},
284 {{"_GLK", 0, ACPI_RTYPE_INTEGER}},
285 {{"_GPD", 0, ACPI_RTYPE_INTEGER}},
286 {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */
287 {{"_GSB", 0, ACPI_RTYPE_INTEGER}},
288 {{"_GTF", 0, ACPI_RTYPE_BUFFER}},
289 {{"_GTM", 0, ACPI_RTYPE_BUFFER}},
290 {{"_GTS", 1, 0}},
291 {{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
292 {{"_HOT", 0, ACPI_RTYPE_INTEGER}},
293 {{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
294 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}},
225 295
226 /* 296 /*
227 * For _HPX, a single package is returned, containing a variable number of sub-packages. 297 * For _HPX, a single package is returned, containing a Variable-length number
228 * Each sub-package contains a PCI record setting. There are several different type of 298 * of sub-packages. Each sub-package contains a PCI record setting.
229 * record settings, of different lengths, but all elements of all settings are Integers. 299 * There are several different type of record settings, of different
300 * lengths, but all elements of all settings are Integers.
230 */ 301 */
231 {.info = {"_HPX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each (var Ints) */ 302 {{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */
232 {.info = {"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */ 303 {{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
233 {.info = {"_INI", 0, 0}}, 304
234 {.info = {"_IRC", 0, 0}}, 305 {{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */
235 {.info = {"_LCK", 1, 0}}, 306 {{"_INI", 0, 0}},
236 {.info = {"_LID", 0, ACPI_RTYPE_INTEGER}}, 307 {{"_IRC", 0, 0}},
237 {.info = {"_MAT", 0, ACPI_RTYPE_BUFFER}}, 308 {{"_LCK", 1, 0}},
238 {.info = {"_MLS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_STRING, 2, 0, 0, 0}}, /* variable (Pkgs) each (2 Str) */ 309 {{"_LID", 0, ACPI_RTYPE_INTEGER}},
239 {.info = {"_MSG", 1, 0}}, 310 {{"_MAT", 0, ACPI_RTYPE_BUFFER}},
240 {.info = {"_OFF", 0, 0}}, 311 {{"_MBM", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (8 Int) */
241 {.info = {"_ON_", 0, 0}}, 312 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8, 0}, 0, 0}},
242 {.info = {"_OS_", 0, ACPI_RTYPE_STRING}}, 313
243 {.info = {"_OSC", 4, ACPI_RTYPE_BUFFER}}, 314 {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (2 Str) */
244 {.info = {"_OST", 3, 0}}, 315 {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 2,0}, 0,0}},
245 {.info = {"_PCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 316
246 {.info = {"_PCT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */ 317 {{"_MSG", 1, 0}},
247 {.info = {"_PDC", 1, 0}}, 318 {{"_MSM", 4, ACPI_RTYPE_INTEGER}},
248 {.info = {"_PIC", 1, 0}}, 319 {{"_NTT", 0, ACPI_RTYPE_INTEGER}},
249 {.info = {"_PLD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0}}, /* variable (Bufs) */ 320 {{"_OFF", 0, 0}},
250 {.info = {"_PPC", 0, ACPI_RTYPE_INTEGER}}, 321 {{"_ON_", 0, 0}},
251 {.info = {"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* see dig64 spec */ 322 {{"_OS_", 0, ACPI_RTYPE_STRING}},
252 {.info = {"_PR0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 323 {{"_OSC", 4, ACPI_RTYPE_BUFFER}},
253 {.info = {"_PR1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 324 {{"_OST", 3, 0}},
254 {.info = {"_PR2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 325 {{"_PAI", 1, ACPI_RTYPE_INTEGER}},
255 {.info = {"_PRS", 0, ACPI_RTYPE_BUFFER}}, 326 {{"_PCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
327 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
328
329 {{"_PCT", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */
330 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}},
331
332 {{"_PDC", 1, 0}},
333 {{"_PDL", 0, ACPI_RTYPE_INTEGER}},
334 {{"_PIC", 1, 0}},
335 {{"_PIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int),(3 Str) */
336 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, ACPI_RTYPE_STRING}, 3, 0}},
337
338 {{"_PLD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Bufs) */
339 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0,0}, 0,0}},
340
341 {{"_PMC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (11 Int),(3 Str) */
342 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 11, ACPI_RTYPE_STRING}, 3,
343 0}},
344
345 {{"_PMD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
346 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}},
347
348 {{"_PMM", 0, ACPI_RTYPE_INTEGER}},
349 {{"_PPC", 0, ACPI_RTYPE_INTEGER}},
350 {{"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* See dig64 spec */
351 {{"_PR0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
352 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
353
354 {{"_PR1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
355 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
356
357 {{"_PR2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
358 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
359
360 {{"_PR3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
361 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}},
362
363 {{"_PRL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
364 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}},
365
366 {{"_PRS", 0, ACPI_RTYPE_BUFFER}},
256 367
257 /* 368 /*
258 * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there 369 * For _PRT, many BIOSs reverse the 3rd and 4th Package elements (Source
259 * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow 370 * and source_index). This bug is so prevalent that there is code in the
260 * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE 371 * ACPICA Resource Manager to detect this and switch them back. For now,
261 * type to the 2nd element (index 1) in the statement below. 372 * do not allow and issue a warning. To allow this and eliminate the
373 * warning, add the ACPI_RTYPE_REFERENCE type to the 4th element (index 3)
374 * in the statement below.
262 */ 375 */
263 {.info = {"_PRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_FIXED, 4, 376 {{"_PRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */
264 ACPI_RTYPE_INTEGER, 377 {{{ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER,ACPI_RTYPE_INTEGER},
265 ACPI_RTYPE_INTEGER, 378 ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE,
266 ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER}}, /* variable (Pkgs) each (4): Int,Int,Int/Ref,Int */ 379 ACPI_RTYPE_INTEGER}},
267 380
268 {.info = {"_PRW", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_OPTION, 2, 381 {{"_PRW", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */
269 ACPI_RTYPE_INTEGER | 382 {{{ACPI_PTYPE1_OPTION, 2, ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE,
270 ACPI_RTYPE_PACKAGE, 383 ACPI_RTYPE_INTEGER}, ACPI_RTYPE_REFERENCE,0}},
271 ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0}}, /* variable (Pkgs) each: Pkg/Int,Int,[variable Refs] (Pkg is Ref/Int) */ 384
272 385 {{"_PS0", 0, 0}},
273 {.info = {"_PS0", 0, 0}}, 386 {{"_PS1", 0, 0}},
274 {.info = {"_PS1", 0, 0}}, 387 {{"_PS2", 0, 0}},
275 {.info = {"_PS2", 0, 0}}, 388 {{"_PS3", 0, 0}},
276 {.info = {"_PS3", 0, 0}}, 389 {{"_PSC", 0, ACPI_RTYPE_INTEGER}},
277 {.info = {"_PSC", 0, ACPI_RTYPE_INTEGER}}, 390 {{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */
278 {.info = {"_PSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Pkgs) each (5 Int) with count */ 391 {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}},
279 {.info = {"_PSL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 392
280 {.info = {"_PSR", 0, ACPI_RTYPE_INTEGER}}, 393 {{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
281 {.info = {"_PSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0}}, /* variable (Pkgs) each (6 Int) */ 394 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
282 {.info = {"_PSV", 0, ACPI_RTYPE_INTEGER}}, 395
283 {.info = {"_PSW", 1, 0}}, 396 {{"_PSR", 0, ACPI_RTYPE_INTEGER}},
284 {.info = {"_PTC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */ 397 {{"_PSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (6 Int) */
285 {.info = {"_PTS", 1, 0}}, 398 {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6,0}, 0,0}},
286 {.info = {"_PXM", 0, ACPI_RTYPE_INTEGER}}, 399
287 {.info = {"_REG", 2, 0}}, 400 {{"_PSV", 0, ACPI_RTYPE_INTEGER}},
288 {.info = {"_REV", 0, ACPI_RTYPE_INTEGER}}, 401 {{"_PSW", 1, 0}},
289 {.info = {"_RMV", 0, ACPI_RTYPE_INTEGER}}, 402 {{"_PTC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */
290 {.info = {"_ROM", 2, ACPI_RTYPE_BUFFER}}, 403 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}},
291 {.info = {"_RTV", 0, ACPI_RTYPE_INTEGER}}, 404
405 {{"_PTP", 2, ACPI_RTYPE_INTEGER}},
406 {{"_PTS", 1, 0}},
407 {{"_PUR", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Int) */
408 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0}, 0, 0}},
409
410 {{"_PXM", 0, ACPI_RTYPE_INTEGER}},
411 {{"_REG", 2, 0}},
412 {{"_REV", 0, ACPI_RTYPE_INTEGER}},
413 {{"_RMV", 0, ACPI_RTYPE_INTEGER}},
414 {{"_ROM", 2, ACPI_RTYPE_BUFFER}},
415 {{"_RTV", 0, ACPI_RTYPE_INTEGER}},
292 416
293 /* 417 /*
294 * For _S0_ through _S5_, the ACPI spec defines a return Package containing 1 Integer, 418 * For _S0_ through _S5_, the ACPI spec defines a return Package
295 * but most DSDTs have it wrong - 2,3, or 4 integers. Allow this by making the objects "variable length", 419 * containing 1 Integer, but most DSDTs have it wrong - 2,3, or 4 integers.
296 * but all elements must be Integers. 420 * Allow this by making the objects "Variable-length length", but all elements
421 * must be Integers.
297 */ 422 */
298 {.info = {"_S0_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 423 {{"_S0_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
299 {.info = {"_S1_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 424 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
300 {.info = {"_S2_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 425
301 {.info = {"_S3_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 426 {{"_S1_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
302 {.info = {"_S4_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 427 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
303 {.info = {"_S5_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 428
304 429 {{"_S2_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
305 {.info = {"_S1D", 0, ACPI_RTYPE_INTEGER}}, 430 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
306 {.info = {"_S2D", 0, ACPI_RTYPE_INTEGER}}, 431
307 {.info = {"_S3D", 0, ACPI_RTYPE_INTEGER}}, 432 {{"_S3_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
308 {.info = {"_S4D", 0, ACPI_RTYPE_INTEGER}}, 433 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
309 {.info = {"_S0W", 0, ACPI_RTYPE_INTEGER}}, 434
310 {.info = {"_S1W", 0, ACPI_RTYPE_INTEGER}}, 435 {{"_S4_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
311 {.info = {"_S2W", 0, ACPI_RTYPE_INTEGER}}, 436 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
312 {.info = {"_S3W", 0, ACPI_RTYPE_INTEGER}}, 437
313 {.info = {"_S4W", 0, ACPI_RTYPE_INTEGER}}, 438 {{"_S5_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
314 {.info = {"_SBS", 0, ACPI_RTYPE_INTEGER}}, 439 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
315 {.info = {"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */ 440
316 /* Note: the 3-arg definition may be removed for ACPI 4.0 */ 441 {{"_S1D", 0, ACPI_RTYPE_INTEGER}},
317 {.info = {"_SDD", 1, 0}}, 442 {{"_S2D", 0, ACPI_RTYPE_INTEGER}},
318 {.info = {"_SEG", 0, ACPI_RTYPE_INTEGER}}, 443 {{"_S3D", 0, ACPI_RTYPE_INTEGER}},
319 {.info = {"_SLI", 0, ACPI_RTYPE_BUFFER}}, 444 {{"_S4D", 0, ACPI_RTYPE_INTEGER}},
320 {.info = {"_SPD", 1, ACPI_RTYPE_INTEGER}}, 445 {{"_S0W", 0, ACPI_RTYPE_INTEGER}},
321 {.info = {"_SRS", 1, 0}}, 446 {{"_S1W", 0, ACPI_RTYPE_INTEGER}},
322 {.info = {"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */ 447 {{"_S2W", 0, ACPI_RTYPE_INTEGER}},
323 {.info = {"_SST", 1, 0}}, 448 {{"_S3W", 0, ACPI_RTYPE_INTEGER}},
324 {.info = {"_STA", 0, ACPI_RTYPE_INTEGER}}, 449 {{"_S4W", 0, ACPI_RTYPE_INTEGER}},
325 {.info = {"_STM", 3, 0}}, 450 {{"_SBS", 0, ACPI_RTYPE_INTEGER}},
326 {.info = {"_STR", 0, ACPI_RTYPE_BUFFER}}, 451 {{"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */
327 {.info = {"_SUN", 0, ACPI_RTYPE_INTEGER}}, 452 /* Note: the 3-arg definition may be removed for ACPI 4.0 */
328 {.info = {"_SWS", 0, ACPI_RTYPE_INTEGER}}, 453 {{"_SDD", 1, 0}},
329 {.info = {"_TC1", 0, ACPI_RTYPE_INTEGER}}, 454 {{"_SEG", 0, ACPI_RTYPE_INTEGER}},
330 {.info = {"_TC2", 0, ACPI_RTYPE_INTEGER}}, 455 {{"_SHL", 1, ACPI_RTYPE_INTEGER}},
331 {.info = {"_TMP", 0, ACPI_RTYPE_INTEGER}}, 456 {{"_SLI", 0, ACPI_RTYPE_BUFFER}},
332 {.info = {"_TPC", 0, ACPI_RTYPE_INTEGER}}, 457 {{"_SPD", 1, ACPI_RTYPE_INTEGER}},
333 {.info = {"_TPT", 1, 0}}, 458 {{"_SRS", 1, 0}},
334 {.info = {"_TRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, 459 {{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */
335 ACPI_RTYPE_INTEGER, 6, 0}}, /* variable (Pkgs) each 2_ref/6_int */ 460 {{"_SST", 1, 0}},
336 {.info = {"_TSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int with count */ 461 {{"_STA", 0, ACPI_RTYPE_INTEGER}},
337 {.info = {"_TSP", 0, ACPI_RTYPE_INTEGER}}, 462 {{"_STM", 3, 0}},
338 {.info = {"_TSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int */ 463 {{"_STP", 2, ACPI_RTYPE_INTEGER}},
339 {.info = {"_TST", 0, ACPI_RTYPE_INTEGER}}, 464 {{"_STR", 0, ACPI_RTYPE_BUFFER}},
340 {.info = {"_TTS", 1, 0}}, 465 {{"_STV", 2, ACPI_RTYPE_INTEGER}},
341 {.info = {"_TZD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 466 {{"_SUN", 0, ACPI_RTYPE_INTEGER}},
342 {.info = {"_TZM", 0, ACPI_RTYPE_REFERENCE}}, 467 {{"_SWS", 0, ACPI_RTYPE_INTEGER}},
343 {.info = {"_TZP", 0, ACPI_RTYPE_INTEGER}}, 468 {{"_TC1", 0, ACPI_RTYPE_INTEGER}},
344 {.info = {"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, 469 {{"_TC2", 0, ACPI_RTYPE_INTEGER}},
345 {.info = {"_UPC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ 470 {{"_TIP", 1, ACPI_RTYPE_INTEGER}},
346 {.info = {"_UPD", 0, ACPI_RTYPE_INTEGER}}, 471 {{"_TIV", 1, ACPI_RTYPE_INTEGER}},
347 {.info = {"_UPP", 0, ACPI_RTYPE_INTEGER}}, 472 {{"_TMP", 0, ACPI_RTYPE_INTEGER}},
348 {.info = {"_VPO", 0, ACPI_RTYPE_INTEGER}}, 473 {{"_TPC", 0, ACPI_RTYPE_INTEGER}},
474 {{"_TPT", 1, 0}},
475 {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2_ref/6_int */
476 {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 6, 0}},
477
478 {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5_int with count */
479 {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
480
481 {{"_TSP", 0, ACPI_RTYPE_INTEGER}},
482 {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5_int */
483 {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
484
485 {{"_TST", 0, ACPI_RTYPE_INTEGER}},
486 {{"_TTS", 1, 0}},
487 {{"_TZD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
488 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
489
490 {{"_TZM", 0, ACPI_RTYPE_REFERENCE}},
491 {{"_TZP", 0, ACPI_RTYPE_INTEGER}},
492 {{"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
493 {{"_UPC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
494 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}},
495
496 {{"_UPD", 0, ACPI_RTYPE_INTEGER}},
497 {{"_UPP", 0, ACPI_RTYPE_INTEGER}},
498 {{"_VPO", 0, ACPI_RTYPE_INTEGER}},
349 499
350 /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */ 500 /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
351 501
352 {.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, 502 {{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
353 {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* fixed (2 Int), but is optional */ 503 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */
354 {.ret_info = {0, 0, 0, 0, 0, 0}} /* Table terminator */ 504
505 {{{0,0,0,0}, 0,0}} /* Table terminator */
355}; 506};
356 507
357#if 0 508#if 0
358 /* Not implemented */ 509 /* Not implemented */
359 510
360{ 511 {{"_WDG", 0, ACPI_RTYPE_BUFFER}}, /* MS Extension */
361"_WDG", 0, ACPI_RTYPE_BUFFER}, /* MS Extension */ 512 {{"_WED", 1, ACPI_RTYPE_PACKAGE}}, /* MS Extension */
362 513
363{ 514 /* This is an internally implemented control method, no need to check */
364"_WED", 1, ACPI_RTYPE_PACKAGE}, /* MS Extension */ 515 {{"_OSI", 1, ACPI_RTYPE_INTEGER}},
365 516
366 /* This is an internally implemented control method, no need to check */ 517 /* TBD: */
367{ 518
368"_OSI", 1, ACPI_RTYPE_INTEGER}, 519 _PRT - currently ignore reversed entries. attempt to fix here?
520 think about possibly fixing package elements like _BIF, etc.
521#endif
369 522
370 /* TBD: */
371 _PRT - currently ignore reversed entries.attempt to fix here ?
372 think about code that attempts to fix package elements like _BIF, etc.
373#endif 523#endif
374#endif 524#endif
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 897810ba0ccc..863a264b829e 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -324,26 +324,30 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
324acpi_status 324acpi_status
325acpi_ut_evaluate_numeric_object(char *object_name, 325acpi_ut_evaluate_numeric_object(char *object_name,
326 struct acpi_namespace_node *device_node, 326 struct acpi_namespace_node *device_node,
327 acpi_integer * address); 327 acpi_integer *value);
328 328
329acpi_status 329acpi_status
330acpi_ut_execute_HID(struct acpi_namespace_node *device_node, 330acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags);
331 struct acpica_device_id *hid);
332 331
333acpi_status 332acpi_status
334acpi_ut_execute_CID(struct acpi_namespace_node *device_node, 333acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
335 struct acpi_compatible_id_list **return_cid_list); 334 const char **method_names,
335 u8 method_count, u8 *out_values);
336 336
337/*
338 * utids - device ID support
339 */
337acpi_status 340acpi_status
338acpi_ut_execute_STA(struct acpi_namespace_node *device_node, 341acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
339 u32 * status_flags); 342 struct acpica_device_id **return_id);
340 343
341acpi_status 344acpi_status
342acpi_ut_execute_UID(struct acpi_namespace_node *device_node, 345acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
343 struct acpica_device_id *uid); 346 struct acpica_device_id **return_id);
344 347
345acpi_status 348acpi_status
346acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest); 349acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
350 struct acpica_device_id_list **return_cid_list);
347 351
348/* 352/*
349 * utlock - reader/writer locks 353 * utlock - reader/writer locks
@@ -445,6 +449,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
445 */ 449 */
446const char *acpi_ut_validate_exception(acpi_status status); 450const char *acpi_ut_validate_exception(acpi_status status);
447 451
452u8 acpi_ut_is_pci_root_bridge(char *id);
453
448u8 acpi_ut_is_aml_table(struct acpi_table_header *table); 454u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
449 455
450acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); 456acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
@@ -469,6 +475,12 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position);
469acpi_status 475acpi_status
470acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); 476acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
471 477
478void ACPI_INTERNAL_VAR_XFACE
479acpi_ut_predefined_warning(const char *module_name,
480 u32 line_number,
481 char *pathname,
482 u8 node_flags, const char *format, ...);
483
472/* Values for Base above (16=Hex, 10=Decimal) */ 484/* Values for Base above (16=Hex, 10=Decimal) */
473 485
474#define ACPI_ANY_BASE 0 486#define ACPI_ANY_BASE 0
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h
index 067f967eb389..4940249f2524 100644
--- a/drivers/acpi/acpica/amlcode.h
+++ b/drivers/acpi/acpica/amlcode.h
@@ -404,6 +404,7 @@ typedef enum {
404 REGION_SMBUS, 404 REGION_SMBUS,
405 REGION_CMOS, 405 REGION_CMOS,
406 REGION_PCI_BAR, 406 REGION_PCI_BAR,
407 REGION_IPMI,
407 REGION_DATA_TABLE, /* Internal use only */ 408 REGION_DATA_TABLE, /* Internal use only */
408 REGION_FIXED_HW = 0x7F 409 REGION_FIXED_HW = 0x7F
409} AML_REGION_TYPES; 410} AML_REGION_TYPES;
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index 53e27bc5a734..54a225e56a64 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -123,9 +123,12 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
123 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 123 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
124 ACPI_NS_ERROR_IF_FOUND; 124 ACPI_NS_ERROR_IF_FOUND;
125 125
126 /* Mark node temporary if we are executing a method */ 126 /*
127 127 * Mark node temporary if we are executing a normal control
128 if (walk_state->method_node) { 128 * method. (Don't mark if this is a module-level code method)
129 */
130 if (walk_state->method_node &&
131 !(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
129 flags |= ACPI_NS_TEMPORARY; 132 flags |= ACPI_NS_TEMPORARY;
130 } 133 }
131 134
@@ -456,9 +459,12 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
456 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 459 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
457 ACPI_NS_ERROR_IF_FOUND; 460 ACPI_NS_ERROR_IF_FOUND;
458 461
459 /* Mark node(s) temporary if we are executing a method */ 462 /*
460 463 * Mark node(s) temporary if we are executing a normal control
461 if (walk_state->method_node) { 464 * method. (Don't mark if this is a module-level code method)
465 */
466 if (walk_state->method_node &&
467 !(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
462 flags |= ACPI_NS_TEMPORARY; 468 flags |= ACPI_NS_TEMPORARY;
463 } 469 }
464 470
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index 14b8b8ed8023..567a4899a018 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -578,10 +578,15 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
578 } 578 }
579 579
580 /* 580 /*
581 * Delete any namespace objects created anywhere within 581 * Delete any namespace objects created anywhere within the
582 * the namespace by the execution of this method 582 * namespace by the execution of this method. Unless this method
583 * is a module-level executable code method, in which case we
584 * want make the objects permanent.
583 */ 585 */
584 acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); 586 if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) {
587 acpi_ns_delete_namespace_by_owner(method_desc->method.
588 owner_id);
589 }
585 } 590 }
586 591
587 /* Decrement the thread count on the method */ 592 /* Decrement the thread count on the method */
@@ -622,7 +627,9 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
622 627
623 /* No more threads, we can free the owner_id */ 628 /* No more threads, we can free the owner_id */
624 629
625 acpi_ut_release_owner_id(&method_desc->method.owner_id); 630 if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) {
631 acpi_ut_release_owner_id(&method_desc->method.owner_id);
632 }
626 } 633 }
627 634
628 return_VOID; 635 return_VOID;
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c
index 22b1a3ce2c94..7d077bb2f525 100644
--- a/drivers/acpi/acpica/dsmthdat.c
+++ b/drivers/acpi/acpica/dsmthdat.c
@@ -433,10 +433,10 @@ acpi_ds_method_data_get_value(u8 type,
433 433
434 case ACPI_REFCLASS_LOCAL: 434 case ACPI_REFCLASS_LOCAL:
435 435
436 ACPI_ERROR((AE_INFO, 436 /*
437 "Uninitialized Local[%d] at node %p", 437 * No error message for this case, will be trapped again later to
438 index, node)); 438 * detect and ignore cases of Store(local_x,local_x)
439 439 */
440 return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); 440 return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
441 441
442 default: 442 default:
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index 02e6caad4a76..507e1f0bbdfd 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -482,14 +482,27 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
482 if (arg) { 482 if (arg) {
483 /* 483 /*
484 * num_elements was exhausted, but there are remaining elements in the 484 * num_elements was exhausted, but there are remaining elements in the
485 * package_list. 485 * package_list. Truncate the package to num_elements.
486 * 486 *
487 * Note: technically, this is an error, from ACPI spec: "It is an error 487 * Note: technically, this is an error, from ACPI spec: "It is an error
488 * for NumElements to be less than the number of elements in the 488 * for NumElements to be less than the number of elements in the
489 * PackageList". However, for now, we just print an error message and 489 * PackageList". However, we just print an error message and
490 * no exception is returned. 490 * no exception is returned. This provides Windows compatibility. Some
491 * BIOSs will alter the num_elements on the fly, creating this type
492 * of ill-formed package object.
491 */ 493 */
492 while (arg) { 494 while (arg) {
495 /*
496 * We must delete any package elements that were created earlier
497 * and are not going to be used because of the package truncation.
498 */
499 if (arg->common.node) {
500 acpi_ut_remove_reference(ACPI_CAST_PTR
501 (union
502 acpi_operand_object,
503 arg->common.node));
504 arg->common.node = NULL;
505 }
493 506
494 /* Find out how many elements there really are */ 507 /* Find out how many elements there really are */
495 508
@@ -498,7 +511,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
498 } 511 }
499 512
500 ACPI_WARNING((AE_INFO, 513 ACPI_WARNING((AE_INFO,
501 "Package List length (%X) larger than NumElements count (%X), truncated\n", 514 "Package List length (0x%X) larger than NumElements count (0x%X), truncated\n",
502 i, element_count)); 515 i, element_count));
503 } else if (i < element_count) { 516 } else if (i < element_count) {
504 /* 517 /*
@@ -506,7 +519,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
506 * Note: this is not an error, the package is padded out with NULLs. 519 * Note: this is not an error, the package is padded out with NULLs.
507 */ 520 */
508 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 521 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
509 "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", 522 "Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n",
510 i, element_count)); 523 i, element_count));
511 } 524 }
512 525
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index 3023ceaa8d54..6de3a99d4cd4 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -581,21 +581,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
581 if ((!(walk_state->op_info->flags & AML_NSOPCODE) && 581 if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
582 (walk_state->opcode != AML_INT_NAMEPATH_OP)) || 582 (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
583 (!(walk_state->op_info->flags & AML_NAMED))) { 583 (!(walk_state->op_info->flags & AML_NAMED))) {
584#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
585 if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
586 (walk_state->op_info->class == AML_CLASS_CONTROL)) {
587 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
588 "Begin/EXEC: %s (fl %8.8X)\n",
589 walk_state->op_info->name,
590 walk_state->op_info->flags));
591
592 /* Executing a type1 or type2 opcode outside of a method */
593
594 status =
595 acpi_ds_exec_begin_op(walk_state, out_op);
596 return_ACPI_STATUS(status);
597 }
598#endif
599 return_ACPI_STATUS(AE_OK); 584 return_ACPI_STATUS(AE_OK);
600 } 585 }
601 586
@@ -768,7 +753,13 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
768 753
769 /* Execution mode, node cannot already exist, node is temporary */ 754 /* Execution mode, node cannot already exist, node is temporary */
770 755
771 flags |= (ACPI_NS_ERROR_IF_FOUND | ACPI_NS_TEMPORARY); 756 flags |= ACPI_NS_ERROR_IF_FOUND;
757
758 if (!
759 (walk_state->
760 parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
761 flags |= ACPI_NS_TEMPORARY;
762 }
772 } 763 }
773 764
774 /* Add new entry or lookup existing entry */ 765 /* Add new entry or lookup existing entry */
@@ -851,24 +842,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
851 /* Check if opcode had an associated namespace object */ 842 /* Check if opcode had an associated namespace object */
852 843
853 if (!(walk_state->op_info->flags & AML_NSOBJECT)) { 844 if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
854#ifndef ACPI_NO_METHOD_EXECUTION
855#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
856 /* No namespace object. Executable opcode? */
857
858 if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
859 (walk_state->op_info->class == AML_CLASS_CONTROL)) {
860 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
861 "End/EXEC: %s (fl %8.8X)\n",
862 walk_state->op_info->name,
863 walk_state->op_info->flags));
864
865 /* Executing a type1 or type2 opcode outside of a method */
866
867 status = acpi_ds_exec_end_op(walk_state);
868 return_ACPI_STATUS(status);
869 }
870#endif
871#endif
872 return_ACPI_STATUS(AE_OK); 845 return_ACPI_STATUS(AE_OK);
873 } 846 }
874 847
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index b9d8ee69ca6c..afacf4416c73 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -424,8 +424,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
424 /* Read the Status Register */ 424 /* Read the Status Register */
425 425
426 status = 426 status =
427 acpi_read(&status_reg, 427 acpi_hw_read(&status_reg,
428 &gpe_register_info->status_address); 428 &gpe_register_info->status_address);
429 if (ACPI_FAILURE(status)) { 429 if (ACPI_FAILURE(status)) {
430 goto unlock_and_exit; 430 goto unlock_and_exit;
431 } 431 }
@@ -433,8 +433,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
433 /* Read the Enable Register */ 433 /* Read the Enable Register */
434 434
435 status = 435 status =
436 acpi_read(&enable_reg, 436 acpi_hw_read(&enable_reg,
437 &gpe_register_info->enable_address); 437 &gpe_register_info->enable_address);
438 if (ACPI_FAILURE(status)) { 438 if (ACPI_FAILURE(status)) {
439 goto unlock_and_exit; 439 goto unlock_and_exit;
440 } 440 }
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index 7b3463639422..a60aaa7635f3 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -843,14 +843,14 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
843 843
844 /* Disable all GPEs within this register */ 844 /* Disable all GPEs within this register */
845 845
846 status = acpi_write(0x00, &this_register->enable_address); 846 status = acpi_hw_write(0x00, &this_register->enable_address);
847 if (ACPI_FAILURE(status)) { 847 if (ACPI_FAILURE(status)) {
848 goto error_exit; 848 goto error_exit;
849 } 849 }
850 850
851 /* Clear any pending GPE events within this register */ 851 /* Clear any pending GPE events within this register */
852 852
853 status = acpi_write(0xFF, &this_register->status_address); 853 status = acpi_hw_write(0xFF, &this_register->status_address);
854 if (ACPI_FAILURE(status)) { 854 if (ACPI_FAILURE(status)) {
855 goto error_exit; 855 goto error_exit;
856 } 856 }
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 284a7becbe96..cf29c4953028 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -50,8 +50,6 @@
50ACPI_MODULE_NAME("evrgnini") 50ACPI_MODULE_NAME("evrgnini")
51 51
52/* Local prototypes */ 52/* Local prototypes */
53static u8 acpi_ev_match_pci_root_bridge(char *id);
54
55static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node); 53static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node);
56 54
57/******************************************************************************* 55/*******************************************************************************
@@ -332,37 +330,6 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
332 330
333/******************************************************************************* 331/*******************************************************************************
334 * 332 *
335 * FUNCTION: acpi_ev_match_pci_root_bridge
336 *
337 * PARAMETERS: Id - The HID/CID in string format
338 *
339 * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge
340 *
341 * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID.
342 *
343 ******************************************************************************/
344
345static u8 acpi_ev_match_pci_root_bridge(char *id)
346{
347
348 /*
349 * Check if this is a PCI root.
350 * ACPI 3.0+: check for a PCI Express root also.
351 */
352 if (!(ACPI_STRNCMP(id,
353 PCI_ROOT_HID_STRING,
354 sizeof(PCI_ROOT_HID_STRING))) ||
355 !(ACPI_STRNCMP(id,
356 PCI_EXPRESS_ROOT_HID_STRING,
357 sizeof(PCI_EXPRESS_ROOT_HID_STRING)))) {
358 return (TRUE);
359 }
360
361 return (FALSE);
362}
363
364/*******************************************************************************
365 *
366 * FUNCTION: acpi_ev_is_pci_root_bridge 333 * FUNCTION: acpi_ev_is_pci_root_bridge
367 * 334 *
368 * PARAMETERS: Node - Device node being examined 335 * PARAMETERS: Node - Device node being examined
@@ -377,9 +344,10 @@ static u8 acpi_ev_match_pci_root_bridge(char *id)
377static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) 344static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
378{ 345{
379 acpi_status status; 346 acpi_status status;
380 struct acpica_device_id hid; 347 struct acpica_device_id *hid;
381 struct acpi_compatible_id_list *cid; 348 struct acpica_device_id_list *cid;
382 u32 i; 349 u32 i;
350 u8 match;
383 351
384 /* Get the _HID and check for a PCI Root Bridge */ 352 /* Get the _HID and check for a PCI Root Bridge */
385 353
@@ -388,7 +356,10 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
388 return (FALSE); 356 return (FALSE);
389 } 357 }
390 358
391 if (acpi_ev_match_pci_root_bridge(hid.value)) { 359 match = acpi_ut_is_pci_root_bridge(hid->string);
360 ACPI_FREE(hid);
361
362 if (match) {
392 return (TRUE); 363 return (TRUE);
393 } 364 }
394 365
@@ -402,7 +373,7 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
402 /* Check all _CIDs in the returned list */ 373 /* Check all _CIDs in the returned list */
403 374
404 for (i = 0; i < cid->count; i++) { 375 for (i = 0; i < cid->count; i++) {
405 if (acpi_ev_match_pci_root_bridge(cid->id[i].value)) { 376 if (acpi_ut_is_pci_root_bridge(cid->ids[i].string)) {
406 ACPI_FREE(cid); 377 ACPI_FREE(cid);
407 return (TRUE); 378 return (TRUE);
408 } 379 }
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c
index 277fd609611a..24afef81af39 100644
--- a/drivers/acpi/acpica/exconfig.c
+++ b/drivers/acpi/acpica/exconfig.c
@@ -110,8 +110,15 @@ acpi_ex_add_table(u32 table_index,
110 if (ACPI_FAILURE(status)) { 110 if (ACPI_FAILURE(status)) {
111 acpi_ut_remove_reference(obj_desc); 111 acpi_ut_remove_reference(obj_desc);
112 *ddb_handle = NULL; 112 *ddb_handle = NULL;
113 return_ACPI_STATUS(status);
113 } 114 }
114 115
116 /* Execute any module-level code that was found in the table */
117
118 acpi_ex_exit_interpreter();
119 acpi_ns_exec_module_code_list();
120 acpi_ex_enter_interpreter();
121
115 return_ACPI_STATUS(status); 122 return_ACPI_STATUS(status);
116} 123}
117 124
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index ec524614e708..de3446372ddc 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -418,9 +418,9 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
418 case ACPI_EXD_REFERENCE: 418 case ACPI_EXD_REFERENCE:
419 419
420 acpi_ex_out_string("Class Name", 420 acpi_ex_out_string("Class Name",
421 (char *) 421 ACPI_CAST_PTR(char,
422 acpi_ut_get_reference_name 422 acpi_ut_get_reference_name
423 (obj_desc)); 423 (obj_desc)));
424 acpi_ex_dump_reference_obj(obj_desc); 424 acpi_ex_dump_reference_obj(obj_desc);
425 break; 425 break;
426 426
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index 546dcdd86785..0b33d6c887b9 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -72,6 +72,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
72 union acpi_operand_object *buffer_desc; 72 union acpi_operand_object *buffer_desc;
73 acpi_size length; 73 acpi_size length;
74 void *buffer; 74 void *buffer;
75 u32 function;
75 76
76 ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); 77 ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc);
77 78
@@ -97,13 +98,27 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
97 } 98 }
98 } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && 99 } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
99 (obj_desc->field.region_obj->region.space_id == 100 (obj_desc->field.region_obj->region.space_id ==
100 ACPI_ADR_SPACE_SMBUS)) { 101 ACPI_ADR_SPACE_SMBUS
102 || obj_desc->field.region_obj->region.space_id ==
103 ACPI_ADR_SPACE_IPMI)) {
101 /* 104 /*
102 * This is an SMBus read. We must create a buffer to hold the data 105 * This is an SMBus or IPMI read. We must create a buffer to hold
103 * and directly access the region handler. 106 * the data and then directly access the region handler.
107 *
108 * Note: Smbus protocol value is passed in upper 16-bits of Function
104 */ 109 */
105 buffer_desc = 110 if (obj_desc->field.region_obj->region.space_id ==
106 acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE); 111 ACPI_ADR_SPACE_SMBUS) {
112 length = ACPI_SMBUS_BUFFER_SIZE;
113 function =
114 ACPI_READ | (obj_desc->field.attribute << 16);
115 } else { /* IPMI */
116
117 length = ACPI_IPMI_BUFFER_SIZE;
118 function = ACPI_READ;
119 }
120
121 buffer_desc = acpi_ut_create_buffer_object(length);
107 if (!buffer_desc) { 122 if (!buffer_desc) {
108 return_ACPI_STATUS(AE_NO_MEMORY); 123 return_ACPI_STATUS(AE_NO_MEMORY);
109 } 124 }
@@ -112,16 +127,13 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
112 127
113 acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); 128 acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
114 129
115 /* 130 /* Call the region handler for the read */
116 * Perform the read. 131
117 * Note: Smbus protocol value is passed in upper 16-bits of Function
118 */
119 status = acpi_ex_access_region(obj_desc, 0, 132 status = acpi_ex_access_region(obj_desc, 0,
120 ACPI_CAST_PTR(acpi_integer, 133 ACPI_CAST_PTR(acpi_integer,
121 buffer_desc-> 134 buffer_desc->
122 buffer.pointer), 135 buffer.pointer),
123 ACPI_READ | (obj_desc->field. 136 function);
124 attribute << 16));
125 acpi_ex_release_global_lock(obj_desc->common_field.field_flags); 137 acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
126 goto exit; 138 goto exit;
127 } 139 }
@@ -212,6 +224,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
212 u32 length; 224 u32 length;
213 void *buffer; 225 void *buffer;
214 union acpi_operand_object *buffer_desc; 226 union acpi_operand_object *buffer_desc;
227 u32 function;
215 228
216 ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); 229 ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc);
217 230
@@ -234,39 +247,56 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
234 } 247 }
235 } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && 248 } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
236 (obj_desc->field.region_obj->region.space_id == 249 (obj_desc->field.region_obj->region.space_id ==
237 ACPI_ADR_SPACE_SMBUS)) { 250 ACPI_ADR_SPACE_SMBUS
251 || obj_desc->field.region_obj->region.space_id ==
252 ACPI_ADR_SPACE_IPMI)) {
238 /* 253 /*
239 * This is an SMBus write. We will bypass the entire field mechanism 254 * This is an SMBus or IPMI write. We will bypass the entire field
240 * and handoff the buffer directly to the handler. 255 * mechanism and handoff the buffer directly to the handler. For
256 * these address spaces, the buffer is bi-directional; on a write,
257 * return data is returned in the same buffer.
258 *
259 * Source must be a buffer of sufficient size:
260 * ACPI_SMBUS_BUFFER_SIZE or ACPI_IPMI_BUFFER_SIZE.
241 * 261 *
242 * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). 262 * Note: SMBus protocol type is passed in upper 16-bits of Function
243 */ 263 */
244 if (source_desc->common.type != ACPI_TYPE_BUFFER) { 264 if (source_desc->common.type != ACPI_TYPE_BUFFER) {
245 ACPI_ERROR((AE_INFO, 265 ACPI_ERROR((AE_INFO,
246 "SMBus write requires Buffer, found type %s", 266 "SMBus or IPMI write requires Buffer, found type %s",
247 acpi_ut_get_object_type_name(source_desc))); 267 acpi_ut_get_object_type_name(source_desc)));
248 268
249 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 269 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
250 } 270 }
251 271
252 if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { 272 if (obj_desc->field.region_obj->region.space_id ==
273 ACPI_ADR_SPACE_SMBUS) {
274 length = ACPI_SMBUS_BUFFER_SIZE;
275 function =
276 ACPI_WRITE | (obj_desc->field.attribute << 16);
277 } else { /* IPMI */
278
279 length = ACPI_IPMI_BUFFER_SIZE;
280 function = ACPI_WRITE;
281 }
282
283 if (source_desc->buffer.length < length) {
253 ACPI_ERROR((AE_INFO, 284 ACPI_ERROR((AE_INFO,
254 "SMBus write requires Buffer of length %X, found length %X", 285 "SMBus or IPMI write requires Buffer of length %X, found length %X",
255 ACPI_SMBUS_BUFFER_SIZE, 286 length, source_desc->buffer.length));
256 source_desc->buffer.length));
257 287
258 return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); 288 return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
259 } 289 }
260 290
261 buffer_desc = 291 /* Create the bi-directional buffer */
262 acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE); 292
293 buffer_desc = acpi_ut_create_buffer_object(length);
263 if (!buffer_desc) { 294 if (!buffer_desc) {
264 return_ACPI_STATUS(AE_NO_MEMORY); 295 return_ACPI_STATUS(AE_NO_MEMORY);
265 } 296 }
266 297
267 buffer = buffer_desc->buffer.pointer; 298 buffer = buffer_desc->buffer.pointer;
268 ACPI_MEMCPY(buffer, source_desc->buffer.pointer, 299 ACPI_MEMCPY(buffer, source_desc->buffer.pointer, length);
269 ACPI_SMBUS_BUFFER_SIZE);
270 300
271 /* Lock entire transaction if requested */ 301 /* Lock entire transaction if requested */
272 302
@@ -275,12 +305,10 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
275 /* 305 /*
276 * Perform the write (returns status and perhaps data in the 306 * Perform the write (returns status and perhaps data in the
277 * same buffer) 307 * same buffer)
278 * Note: SMBus protocol type is passed in upper 16-bits of Function.
279 */ 308 */
280 status = acpi_ex_access_region(obj_desc, 0, 309 status = acpi_ex_access_region(obj_desc, 0,
281 (acpi_integer *) buffer, 310 (acpi_integer *) buffer,
282 ACPI_WRITE | (obj_desc->field. 311 function);
283 attribute << 16));
284 acpi_ex_release_global_lock(obj_desc->common_field.field_flags); 312 acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
285 313
286 *result_desc = buffer_desc; 314 *result_desc = buffer_desc;
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index 6687be167f5f..d7b3b418fb45 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -120,12 +120,13 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
120 } 120 }
121 121
122 /* 122 /*
123 * Exit now for SMBus address space, it has a non-linear address space 123 * Exit now for SMBus or IPMI address space, it has a non-linear address space
124 * and the request cannot be directly validated 124 * and the request cannot be directly validated
125 */ 125 */
126 if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { 126 if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS ||
127 rgn_desc->region.space_id == ACPI_ADR_SPACE_IPMI) {
127 128
128 /* SMBus has a non-linear address space */ 129 /* SMBus or IPMI has a non-linear address space */
129 130
130 return_ACPI_STATUS(AE_OK); 131 return_ACPI_STATUS(AE_OK);
131 } 132 }
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 87730e944132..7d41f99f7052 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -358,50 +358,67 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
358 * 358 *
359 * FUNCTION: acpi_ex_eisa_id_to_string 359 * FUNCTION: acpi_ex_eisa_id_to_string
360 * 360 *
361 * PARAMETERS: numeric_id - EISA ID to be converted 361 * PARAMETERS: compressed_id - EISAID to be converted
362 * out_string - Where to put the converted string (8 bytes) 362 * out_string - Where to put the converted string (8 bytes)
363 * 363 *
364 * RETURN: None 364 * RETURN: None
365 * 365 *
366 * DESCRIPTION: Convert a numeric EISA ID to string representation 366 * DESCRIPTION: Convert a numeric EISAID to string representation. Return
367 * buffer must be large enough to hold the string. The string
368 * returned is always exactly of length ACPI_EISAID_STRING_SIZE
369 * (includes null terminator). The EISAID is always 32 bits.
367 * 370 *
368 ******************************************************************************/ 371 ******************************************************************************/
369 372
370void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string) 373void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id)
371{ 374{
372 u32 eisa_id; 375 u32 swapped_id;
373 376
374 ACPI_FUNCTION_ENTRY(); 377 ACPI_FUNCTION_ENTRY();
375 378
379 /* The EISAID should be a 32-bit integer */
380
381 if (compressed_id > ACPI_UINT32_MAX) {
382 ACPI_WARNING((AE_INFO,
383 "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating",
384 ACPI_FORMAT_UINT64(compressed_id)));
385 }
386
376 /* Swap ID to big-endian to get contiguous bits */ 387 /* Swap ID to big-endian to get contiguous bits */
377 388
378 eisa_id = acpi_ut_dword_byte_swap(numeric_id); 389 swapped_id = acpi_ut_dword_byte_swap((u32)compressed_id);
379 390
380 out_string[0] = (char)('@' + (((unsigned long)eisa_id >> 26) & 0x1f)); 391 /* First 3 bytes are uppercase letters. Next 4 bytes are hexadecimal */
381 out_string[1] = (char)('@' + ((eisa_id >> 21) & 0x1f)); 392
382 out_string[2] = (char)('@' + ((eisa_id >> 16) & 0x1f)); 393 out_string[0] =
383 out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 12); 394 (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F));
384 out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 8); 395 out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F));
385 out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 4); 396 out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F));
386 out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 0); 397 out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 12);
398 out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 8);
399 out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 4);
400 out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 0);
387 out_string[7] = 0; 401 out_string[7] = 0;
388} 402}
389 403
390/******************************************************************************* 404/*******************************************************************************
391 * 405 *
392 * FUNCTION: acpi_ex_unsigned_integer_to_string 406 * FUNCTION: acpi_ex_integer_to_string
393 * 407 *
394 * PARAMETERS: Value - Value to be converted 408 * PARAMETERS: out_string - Where to put the converted string. At least
395 * out_string - Where to put the converted string (8 bytes) 409 * 21 bytes are needed to hold the largest
410 * possible 64-bit integer.
411 * Value - Value to be converted
396 * 412 *
397 * RETURN: None, string 413 * RETURN: None, string
398 * 414 *
399 * DESCRIPTION: Convert a number to string representation. Assumes string 415 * DESCRIPTION: Convert a 64-bit integer to decimal string representation.
400 * buffer is large enough to hold the string. 416 * Assumes string buffer is large enough to hold the string. The
417 * largest string is (ACPI_MAX64_DECIMAL_DIGITS + 1).
401 * 418 *
402 ******************************************************************************/ 419 ******************************************************************************/
403 420
404void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string) 421void acpi_ex_integer_to_string(char *out_string, acpi_integer value)
405{ 422{
406 u32 count; 423 u32 count;
407 u32 digits_needed; 424 u32 digits_needed;
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index d3b7e37c9eed..c28c41b3180b 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -82,7 +82,7 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
82 82
83 /* Get current value of the enable register that contains this GPE */ 83 /* Get current value of the enable register that contains this GPE */
84 84
85 status = acpi_read(&enable_mask, &gpe_register_info->enable_address); 85 status = acpi_hw_read(&enable_mask, &gpe_register_info->enable_address);
86 if (ACPI_FAILURE(status)) { 86 if (ACPI_FAILURE(status)) {
87 return (status); 87 return (status);
88 } 88 }
@@ -95,7 +95,7 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
95 95
96 /* Write the updated enable mask */ 96 /* Write the updated enable mask */
97 97
98 status = acpi_write(enable_mask, &gpe_register_info->enable_address); 98 status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address);
99 return (status); 99 return (status);
100} 100}
101 101
@@ -130,8 +130,8 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info)
130 130
131 /* Write the entire GPE (runtime) enable register */ 131 /* Write the entire GPE (runtime) enable register */
132 132
133 status = acpi_write(gpe_register_info->enable_for_run, 133 status = acpi_hw_write(gpe_register_info->enable_for_run,
134 &gpe_register_info->enable_address); 134 &gpe_register_info->enable_address);
135 135
136 return (status); 136 return (status);
137} 137}
@@ -163,8 +163,8 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
163 * Write a one to the appropriate bit in the status register to 163 * Write a one to the appropriate bit in the status register to
164 * clear this GPE. 164 * clear this GPE.
165 */ 165 */
166 status = acpi_write(register_bit, 166 status = acpi_hw_write(register_bit,
167 &gpe_event_info->register_info->status_address); 167 &gpe_event_info->register_info->status_address);
168 168
169 return (status); 169 return (status);
170} 170}
@@ -222,7 +222,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
222 222
223 /* GPE currently active (status bit == 1)? */ 223 /* GPE currently active (status bit == 1)? */
224 224
225 status = acpi_read(&in_byte, &gpe_register_info->status_address); 225 status = acpi_hw_read(&in_byte, &gpe_register_info->status_address);
226 if (ACPI_FAILURE(status)) { 226 if (ACPI_FAILURE(status)) {
227 goto unlock_and_exit; 227 goto unlock_and_exit;
228 } 228 }
@@ -266,8 +266,8 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
266 /* Disable all GPEs in this register */ 266 /* Disable all GPEs in this register */
267 267
268 status = 268 status =
269 acpi_write(0x00, 269 acpi_hw_write(0x00,
270 &gpe_block->register_info[i].enable_address); 270 &gpe_block->register_info[i].enable_address);
271 if (ACPI_FAILURE(status)) { 271 if (ACPI_FAILURE(status)) {
272 return (status); 272 return (status);
273 } 273 }
@@ -303,8 +303,8 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
303 /* Clear status on all GPEs in this register */ 303 /* Clear status on all GPEs in this register */
304 304
305 status = 305 status =
306 acpi_write(0xFF, 306 acpi_hw_write(0xFF,
307 &gpe_block->register_info[i].status_address); 307 &gpe_block->register_info[i].status_address);
308 if (ACPI_FAILURE(status)) { 308 if (ACPI_FAILURE(status)) {
309 return (status); 309 return (status);
310 } 310 }
@@ -345,9 +345,9 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
345 345
346 /* Enable all "runtime" GPEs in this register */ 346 /* Enable all "runtime" GPEs in this register */
347 347
348 status = acpi_write(gpe_block->register_info[i].enable_for_run, 348 status =
349 &gpe_block->register_info[i]. 349 acpi_hw_write(gpe_block->register_info[i].enable_for_run,
350 enable_address); 350 &gpe_block->register_info[i].enable_address);
351 if (ACPI_FAILURE(status)) { 351 if (ACPI_FAILURE(status)) {
352 return (status); 352 return (status);
353 } 353 }
@@ -387,9 +387,9 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
387 387
388 /* Enable all "wake" GPEs in this register */ 388 /* Enable all "wake" GPEs in this register */
389 389
390 status = acpi_write(gpe_block->register_info[i].enable_for_wake, 390 status =
391 &gpe_block->register_info[i]. 391 acpi_hw_write(gpe_block->register_info[i].enable_for_wake,
392 enable_address); 392 &gpe_block->register_info[i].enable_address);
393 if (ACPI_FAILURE(status)) { 393 if (ACPI_FAILURE(status)) {
394 return (status); 394 return (status);
395 } 395 }
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 23d5505cb1f7..15c9ed2be853 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -62,6 +62,184 @@ acpi_hw_write_multiple(u32 value,
62 struct acpi_generic_address *register_a, 62 struct acpi_generic_address *register_a,
63 struct acpi_generic_address *register_b); 63 struct acpi_generic_address *register_b);
64 64
65/******************************************************************************
66 *
67 * FUNCTION: acpi_hw_validate_register
68 *
69 * PARAMETERS: Reg - GAS register structure
70 * max_bit_width - Max bit_width supported (32 or 64)
71 * Address - Pointer to where the gas->address
72 * is returned
73 *
74 * RETURN: Status
75 *
76 * DESCRIPTION: Validate the contents of a GAS register. Checks the GAS
77 * pointer, Address, space_id, bit_width, and bit_offset.
78 *
79 ******************************************************************************/
80
81acpi_status
82acpi_hw_validate_register(struct acpi_generic_address *reg,
83 u8 max_bit_width, u64 *address)
84{
85
86 /* Must have a valid pointer to a GAS structure */
87
88 if (!reg) {
89 return (AE_BAD_PARAMETER);
90 }
91
92 /*
93 * Copy the target address. This handles possible alignment issues.
94 * Address must not be null. A null address also indicates an optional
95 * ACPI register that is not supported, so no error message.
96 */
97 ACPI_MOVE_64_TO_64(address, &reg->address);
98 if (!(*address)) {
99 return (AE_BAD_ADDRESS);
100 }
101
102 /* Validate the space_iD */
103
104 if ((reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
105 (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
106 ACPI_ERROR((AE_INFO,
107 "Unsupported address space: 0x%X", reg->space_id));
108 return (AE_SUPPORT);
109 }
110
111 /* Validate the bit_width */
112
113 if ((reg->bit_width != 8) &&
114 (reg->bit_width != 16) &&
115 (reg->bit_width != 32) && (reg->bit_width != max_bit_width)) {
116 ACPI_ERROR((AE_INFO,
117 "Unsupported register bit width: 0x%X",
118 reg->bit_width));
119 return (AE_SUPPORT);
120 }
121
122 /* Validate the bit_offset. Just a warning for now. */
123
124 if (reg->bit_offset != 0) {
125 ACPI_WARNING((AE_INFO,
126 "Unsupported register bit offset: 0x%X",
127 reg->bit_offset));
128 }
129
130 return (AE_OK);
131}
132
133/******************************************************************************
134 *
135 * FUNCTION: acpi_hw_read
136 *
137 * PARAMETERS: Value - Where the value is returned
138 * Reg - GAS register structure
139 *
140 * RETURN: Status
141 *
142 * DESCRIPTION: Read from either memory or IO space. This is a 32-bit max
143 * version of acpi_read, used internally since the overhead of
144 * 64-bit values is not needed.
145 *
146 * LIMITATIONS: <These limitations also apply to acpi_hw_write>
147 * bit_width must be exactly 8, 16, or 32.
148 * space_iD must be system_memory or system_iO.
149 * bit_offset and access_width are currently ignored, as there has
150 * not been a need to implement these.
151 *
152 ******************************************************************************/
153
154acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
155{
156 u64 address;
157 acpi_status status;
158
159 ACPI_FUNCTION_NAME(hw_read);
160
161 /* Validate contents of the GAS register */
162
163 status = acpi_hw_validate_register(reg, 32, &address);
164 if (ACPI_FAILURE(status)) {
165 return (status);
166 }
167
168 /* Initialize entire 32-bit return value to zero */
169
170 *value = 0;
171
172 /*
173 * Two address spaces supported: Memory or IO. PCI_Config is
174 * not supported here because the GAS structure is insufficient
175 */
176 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
177 status = acpi_os_read_memory((acpi_physical_address)
178 address, value, reg->bit_width);
179 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
180
181 status = acpi_hw_read_port((acpi_io_address)
182 address, value, reg->bit_width);
183 }
184
185 ACPI_DEBUG_PRINT((ACPI_DB_IO,
186 "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
187 *value, reg->bit_width, ACPI_FORMAT_UINT64(address),
188 acpi_ut_get_region_name(reg->space_id)));
189
190 return (status);
191}
192
193/******************************************************************************
194 *
195 * FUNCTION: acpi_hw_write
196 *
197 * PARAMETERS: Value - Value to be written
198 * Reg - GAS register structure
199 *
200 * RETURN: Status
201 *
202 * DESCRIPTION: Write to either memory or IO space. This is a 32-bit max
203 * version of acpi_write, used internally since the overhead of
204 * 64-bit values is not needed.
205 *
206 ******************************************************************************/
207
208acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
209{
210 u64 address;
211 acpi_status status;
212
213 ACPI_FUNCTION_NAME(hw_write);
214
215 /* Validate contents of the GAS register */
216
217 status = acpi_hw_validate_register(reg, 32, &address);
218 if (ACPI_FAILURE(status)) {
219 return (status);
220 }
221
222 /*
223 * Two address spaces supported: Memory or IO. PCI_Config is
224 * not supported here because the GAS structure is insufficient
225 */
226 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
227 status = acpi_os_write_memory((acpi_physical_address)
228 address, value, reg->bit_width);
229 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
230
231 status = acpi_hw_write_port((acpi_io_address)
232 address, value, reg->bit_width);
233 }
234
235 ACPI_DEBUG_PRINT((ACPI_DB_IO,
236 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
237 value, reg->bit_width, ACPI_FORMAT_UINT64(address),
238 acpi_ut_get_region_name(reg->space_id)));
239
240 return (status);
241}
242
65/******************************************************************************* 243/*******************************************************************************
66 * 244 *
67 * FUNCTION: acpi_hw_clear_acpi_status 245 * FUNCTION: acpi_hw_clear_acpi_status
@@ -152,15 +330,16 @@ acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control)
152 330
153 ACPI_FUNCTION_TRACE(hw_write_pm1_control); 331 ACPI_FUNCTION_TRACE(hw_write_pm1_control);
154 332
155 status = acpi_write(pm1a_control, &acpi_gbl_FADT.xpm1a_control_block); 333 status =
334 acpi_hw_write(pm1a_control, &acpi_gbl_FADT.xpm1a_control_block);
156 if (ACPI_FAILURE(status)) { 335 if (ACPI_FAILURE(status)) {
157 return_ACPI_STATUS(status); 336 return_ACPI_STATUS(status);
158 } 337 }
159 338
160 if (acpi_gbl_FADT.xpm1b_control_block.address) { 339 if (acpi_gbl_FADT.xpm1b_control_block.address) {
161 status = 340 status =
162 acpi_write(pm1b_control, 341 acpi_hw_write(pm1b_control,
163 &acpi_gbl_FADT.xpm1b_control_block); 342 &acpi_gbl_FADT.xpm1b_control_block);
164 } 343 }
165 return_ACPI_STATUS(status); 344 return_ACPI_STATUS(status);
166} 345}
@@ -218,12 +397,13 @@ acpi_hw_register_read(u32 register_id, u32 * return_value)
218 397
219 case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ 398 case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
220 399
221 status = acpi_read(&value, &acpi_gbl_FADT.xpm2_control_block); 400 status =
401 acpi_hw_read(&value, &acpi_gbl_FADT.xpm2_control_block);
222 break; 402 break;
223 403
224 case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ 404 case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
225 405
226 status = acpi_read(&value, &acpi_gbl_FADT.xpm_timer_block); 406 status = acpi_hw_read(&value, &acpi_gbl_FADT.xpm_timer_block);
227 break; 407 break;
228 408
229 case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ 409 case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
@@ -340,7 +520,8 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
340 * as per the ACPI spec. 520 * as per the ACPI spec.
341 */ 521 */
342 status = 522 status =
343 acpi_read(&read_value, &acpi_gbl_FADT.xpm2_control_block); 523 acpi_hw_read(&read_value,
524 &acpi_gbl_FADT.xpm2_control_block);
344 if (ACPI_FAILURE(status)) { 525 if (ACPI_FAILURE(status)) {
345 goto exit; 526 goto exit;
346 } 527 }
@@ -350,12 +531,13 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
350 ACPI_INSERT_BITS(value, ACPI_PM2_CONTROL_PRESERVED_BITS, 531 ACPI_INSERT_BITS(value, ACPI_PM2_CONTROL_PRESERVED_BITS,
351 read_value); 532 read_value);
352 533
353 status = acpi_write(value, &acpi_gbl_FADT.xpm2_control_block); 534 status =
535 acpi_hw_write(value, &acpi_gbl_FADT.xpm2_control_block);
354 break; 536 break;
355 537
356 case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ 538 case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
357 539
358 status = acpi_write(value, &acpi_gbl_FADT.xpm_timer_block); 540 status = acpi_hw_write(value, &acpi_gbl_FADT.xpm_timer_block);
359 break; 541 break;
360 542
361 case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ 543 case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
@@ -401,7 +583,7 @@ acpi_hw_read_multiple(u32 *value,
401 583
402 /* The first register is always required */ 584 /* The first register is always required */
403 585
404 status = acpi_read(&value_a, register_a); 586 status = acpi_hw_read(&value_a, register_a);
405 if (ACPI_FAILURE(status)) { 587 if (ACPI_FAILURE(status)) {
406 return (status); 588 return (status);
407 } 589 }
@@ -409,7 +591,7 @@ acpi_hw_read_multiple(u32 *value,
409 /* Second register is optional */ 591 /* Second register is optional */
410 592
411 if (register_b->address) { 593 if (register_b->address) {
412 status = acpi_read(&value_b, register_b); 594 status = acpi_hw_read(&value_b, register_b);
413 if (ACPI_FAILURE(status)) { 595 if (ACPI_FAILURE(status)) {
414 return (status); 596 return (status);
415 } 597 }
@@ -452,7 +634,7 @@ acpi_hw_write_multiple(u32 value,
452 634
453 /* The first register is always required */ 635 /* The first register is always required */
454 636
455 status = acpi_write(value, register_a); 637 status = acpi_hw_write(value, register_a);
456 if (ACPI_FAILURE(status)) { 638 if (ACPI_FAILURE(status)) {
457 return (status); 639 return (status);
458 } 640 }
@@ -470,7 +652,7 @@ acpi_hw_write_multiple(u32 value,
470 * and writes have no side effects" 652 * and writes have no side effects"
471 */ 653 */
472 if (register_b->address) { 654 if (register_b->address) {
473 status = acpi_write(value, register_b); 655 status = acpi_hw_write(value, register_b);
474 } 656 }
475 657
476 return (status); 658 return (status);
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index b7f522c8f023..6b282e85d039 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -100,7 +100,7 @@ acpi_status acpi_get_timer(u32 * ticks)
100 } 100 }
101 101
102 status = 102 status =
103 acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT.xpm_timer_block); 103 acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block);
104 104
105 return_ACPI_STATUS(status); 105 return_ACPI_STATUS(status);
106} 106}
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index 9829979f2bdd..647c7b6e6756 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -78,9 +78,22 @@ acpi_status acpi_reset(void)
78 return_ACPI_STATUS(AE_NOT_EXIST); 78 return_ACPI_STATUS(AE_NOT_EXIST);
79 } 79 }
80 80
81 /* Write the reset value to the reset register */ 81 if (reset_reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
82 /*
83 * For I/O space, write directly to the OSL. This bypasses the port
84 * validation mechanism, which may block a valid write to the reset
85 * register.
86 */
87 status =
88 acpi_os_write_port((acpi_io_address) reset_reg->address,
89 acpi_gbl_FADT.reset_value,
90 reset_reg->bit_width);
91 } else {
92 /* Write the reset value to the reset register */
93
94 status = acpi_hw_write(acpi_gbl_FADT.reset_value, reset_reg);
95 }
82 96
83 status = acpi_write(acpi_gbl_FADT.reset_value, reset_reg);
84 return_ACPI_STATUS(status); 97 return_ACPI_STATUS(status);
85} 98}
86 99
@@ -97,67 +110,92 @@ ACPI_EXPORT_SYMBOL(acpi_reset)
97 * 110 *
98 * DESCRIPTION: Read from either memory or IO space. 111 * DESCRIPTION: Read from either memory or IO space.
99 * 112 *
113 * LIMITATIONS: <These limitations also apply to acpi_write>
114 * bit_width must be exactly 8, 16, 32, or 64.
115 * space_iD must be system_memory or system_iO.
116 * bit_offset and access_width are currently ignored, as there has
117 * not been a need to implement these.
118 *
100 ******************************************************************************/ 119 ******************************************************************************/
101acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg) 120acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg)
102{ 121{
122 u32 value;
103 u32 width; 123 u32 width;
104 u64 address; 124 u64 address;
105 acpi_status status; 125 acpi_status status;
106 126
107 ACPI_FUNCTION_NAME(acpi_read); 127 ACPI_FUNCTION_NAME(acpi_read);
108 128
109 /* 129 if (!return_value) {
110 * Must have a valid pointer to a GAS structure, and a non-zero address
111 * within.
112 */
113 if (!reg) {
114 return (AE_BAD_PARAMETER); 130 return (AE_BAD_PARAMETER);
115 } 131 }
116 132
117 /* Get a local copy of the address. Handles possible alignment issues */ 133 /* Validate contents of the GAS register. Allow 64-bit transfers */
118 134
119 ACPI_MOVE_64_TO_64(&address, &reg->address); 135 status = acpi_hw_validate_register(reg, 64, &address);
120 if (!address) { 136 if (ACPI_FAILURE(status)) {
121 return (AE_BAD_ADDRESS); 137 return (status);
122 } 138 }
123 139
124 /* Supported widths are 8/16/32 */
125
126 width = reg->bit_width; 140 width = reg->bit_width;
127 if ((width != 8) && (width != 16) && (width != 32)) { 141 if (width == 64) {
128 return (AE_SUPPORT); 142 width = 32; /* Break into two 32-bit transfers */
129 } 143 }
130 144
131 /* Initialize entire 32-bit return value to zero */ 145 /* Initialize entire 64-bit return value to zero */
132 146
133 *value = 0; 147 *return_value = 0;
148 value = 0;
134 149
135 /* 150 /*
136 * Two address spaces supported: Memory or IO. PCI_Config is 151 * Two address spaces supported: Memory or IO. PCI_Config is
137 * not supported here because the GAS structure is insufficient 152 * not supported here because the GAS structure is insufficient
138 */ 153 */
139 switch (reg->space_id) { 154 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
140 case ACPI_ADR_SPACE_SYSTEM_MEMORY: 155 status = acpi_os_read_memory((acpi_physical_address)
156 address, &value, width);
157 if (ACPI_FAILURE(status)) {
158 return (status);
159 }
160 *return_value = value;
141 161
142 status = acpi_os_read_memory((acpi_physical_address) address, 162 if (reg->bit_width == 64) {
143 value, width);
144 break;
145 163
146 case ACPI_ADR_SPACE_SYSTEM_IO: 164 /* Read the top 32 bits */
147 165
148 status = 166 status = acpi_os_read_memory((acpi_physical_address)
149 acpi_hw_read_port((acpi_io_address) address, value, width); 167 (address + 4), &value, 32);
150 break; 168 if (ACPI_FAILURE(status)) {
169 return (status);
170 }
171 *return_value |= ((u64)value << 32);
172 }
173 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
151 174
152 default: 175 status = acpi_hw_read_port((acpi_io_address)
153 ACPI_ERROR((AE_INFO, 176 address, &value, width);
154 "Unsupported address space: %X", reg->space_id)); 177 if (ACPI_FAILURE(status)) {
155 return (AE_BAD_PARAMETER); 178 return (status);
179 }
180 *return_value = value;
181
182 if (reg->bit_width == 64) {
183
184 /* Read the top 32 bits */
185
186 status = acpi_hw_read_port((acpi_io_address)
187 (address + 4), &value, 32);
188 if (ACPI_FAILURE(status)) {
189 return (status);
190 }
191 *return_value |= ((u64)value << 32);
192 }
156 } 193 }
157 194
158 ACPI_DEBUG_PRINT((ACPI_DB_IO, 195 ACPI_DEBUG_PRINT((ACPI_DB_IO,
159 "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", 196 "Read: %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n",
160 *value, width, ACPI_FORMAT_UINT64(address), 197 ACPI_FORMAT_UINT64(*return_value), reg->bit_width,
198 ACPI_FORMAT_UINT64(address),
161 acpi_ut_get_region_name(reg->space_id))); 199 acpi_ut_get_region_name(reg->space_id)));
162 200
163 return (status); 201 return (status);
@@ -169,7 +207,7 @@ ACPI_EXPORT_SYMBOL(acpi_read)
169 * 207 *
170 * FUNCTION: acpi_write 208 * FUNCTION: acpi_write
171 * 209 *
172 * PARAMETERS: Value - To be written 210 * PARAMETERS: Value - Value to be written
173 * Reg - GAS register structure 211 * Reg - GAS register structure
174 * 212 *
175 * RETURN: Status 213 * RETURN: Status
@@ -177,7 +215,7 @@ ACPI_EXPORT_SYMBOL(acpi_read)
177 * DESCRIPTION: Write to either memory or IO space. 215 * DESCRIPTION: Write to either memory or IO space.
178 * 216 *
179 ******************************************************************************/ 217 ******************************************************************************/
180acpi_status acpi_write(u32 value, struct acpi_generic_address *reg) 218acpi_status acpi_write(u64 value, struct acpi_generic_address *reg)
181{ 219{
182 u32 width; 220 u32 width;
183 u64 address; 221 u64 address;
@@ -185,54 +223,61 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg)
185 223
186 ACPI_FUNCTION_NAME(acpi_write); 224 ACPI_FUNCTION_NAME(acpi_write);
187 225
188 /* 226 /* Validate contents of the GAS register. Allow 64-bit transfers */
189 * Must have a valid pointer to a GAS structure, and a non-zero address
190 * within.
191 */
192 if (!reg) {
193 return (AE_BAD_PARAMETER);
194 }
195
196 /* Get a local copy of the address. Handles possible alignment issues */
197 227
198 ACPI_MOVE_64_TO_64(&address, &reg->address); 228 status = acpi_hw_validate_register(reg, 64, &address);
199 if (!address) { 229 if (ACPI_FAILURE(status)) {
200 return (AE_BAD_ADDRESS); 230 return (status);
201 } 231 }
202 232
203 /* Supported widths are 8/16/32 */
204
205 width = reg->bit_width; 233 width = reg->bit_width;
206 if ((width != 8) && (width != 16) && (width != 32)) { 234 if (width == 64) {
207 return (AE_SUPPORT); 235 width = 32; /* Break into two 32-bit transfers */
208 } 236 }
209 237
210 /* 238 /*
211 * Two address spaces supported: Memory or IO. 239 * Two address spaces supported: Memory or IO. PCI_Config is
212 * PCI_Config is not supported here because the GAS struct is insufficient 240 * not supported here because the GAS structure is insufficient
213 */ 241 */
214 switch (reg->space_id) { 242 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
215 case ACPI_ADR_SPACE_SYSTEM_MEMORY: 243 status = acpi_os_write_memory((acpi_physical_address)
216 244 address, ACPI_LODWORD(value),
217 status = acpi_os_write_memory((acpi_physical_address) address, 245 width);
218 value, width); 246 if (ACPI_FAILURE(status)) {
219 break; 247 return (status);
248 }
220 249
221 case ACPI_ADR_SPACE_SYSTEM_IO: 250 if (reg->bit_width == 64) {
251 status = acpi_os_write_memory((acpi_physical_address)
252 (address + 4),
253 ACPI_HIDWORD(value), 32);
254 if (ACPI_FAILURE(status)) {
255 return (status);
256 }
257 }
258 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
222 259
223 status = acpi_hw_write_port((acpi_io_address) address, value, 260 status = acpi_hw_write_port((acpi_io_address)
261 address, ACPI_LODWORD(value),
224 width); 262 width);
225 break; 263 if (ACPI_FAILURE(status)) {
264 return (status);
265 }
226 266
227 default: 267 if (reg->bit_width == 64) {
228 ACPI_ERROR((AE_INFO, 268 status = acpi_hw_write_port((acpi_io_address)
229 "Unsupported address space: %X", reg->space_id)); 269 (address + 4),
230 return (AE_BAD_PARAMETER); 270 ACPI_HIDWORD(value), 32);
271 if (ACPI_FAILURE(status)) {
272 return (status);
273 }
274 }
231 } 275 }
232 276
233 ACPI_DEBUG_PRINT((ACPI_DB_IO, 277 ACPI_DEBUG_PRINT((ACPI_DB_IO,
234 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", 278 "Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)\n",
235 value, width, ACPI_FORMAT_UINT64(address), 279 ACPI_FORMAT_UINT64(value), reg->bit_width,
280 ACPI_FORMAT_UINT64(address),
236 acpi_ut_get_region_name(reg->space_id))); 281 acpi_ut_get_region_name(reg->space_id)));
237 282
238 return (status); 283 return (status);
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index efc971ab7d65..8a58a1b85aa0 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -96,17 +96,68 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
96 * 96 *
97 * RETURN: None 97 * RETURN: None
98 * 98 *
99 * DESCRIPTION: Delete a namespace node 99 * DESCRIPTION: Delete a namespace node. All node deletions must come through
100 * here. Detaches any attached objects, including any attached
101 * data. If a handler is associated with attached data, it is
102 * invoked before the node is deleted.
100 * 103 *
101 ******************************************************************************/ 104 ******************************************************************************/
102 105
103void acpi_ns_delete_node(struct acpi_namespace_node *node) 106void acpi_ns_delete_node(struct acpi_namespace_node *node)
104{ 107{
108 union acpi_operand_object *obj_desc;
109
110 ACPI_FUNCTION_NAME(ns_delete_node);
111
112 /* Detach an object if there is one */
113
114 acpi_ns_detach_object(node);
115
116 /*
117 * Delete an attached data object if present (an object that was created
118 * and attached via acpi_attach_data). Note: After any normal object is
119 * detached above, the only possible remaining object is a data object.
120 */
121 obj_desc = node->object;
122 if (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
123
124 /* Invoke the attached data deletion handler if present */
125
126 if (obj_desc->data.handler) {
127 obj_desc->data.handler(node, obj_desc->data.pointer);
128 }
129
130 acpi_ut_remove_reference(obj_desc);
131 }
132
133 /* Now we can delete the node */
134
135 (void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
136
137 ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
138 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n",
139 node, acpi_gbl_current_node_count));
140}
141
142/*******************************************************************************
143 *
144 * FUNCTION: acpi_ns_remove_node
145 *
146 * PARAMETERS: Node - Node to be removed/deleted
147 *
148 * RETURN: None
149 *
150 * DESCRIPTION: Remove (unlink) and delete a namespace node
151 *
152 ******************************************************************************/
153
154void acpi_ns_remove_node(struct acpi_namespace_node *node)
155{
105 struct acpi_namespace_node *parent_node; 156 struct acpi_namespace_node *parent_node;
106 struct acpi_namespace_node *prev_node; 157 struct acpi_namespace_node *prev_node;
107 struct acpi_namespace_node *next_node; 158 struct acpi_namespace_node *next_node;
108 159
109 ACPI_FUNCTION_TRACE_PTR(ns_delete_node, node); 160 ACPI_FUNCTION_TRACE_PTR(ns_remove_node, node);
110 161
111 parent_node = acpi_ns_get_parent_node(node); 162 parent_node = acpi_ns_get_parent_node(node);
112 163
@@ -142,12 +193,9 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
142 } 193 }
143 } 194 }
144 195
145 ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); 196 /* Delete the node and any attached objects */
146
147 /* Detach an object if there is one, then delete the node */
148 197
149 acpi_ns_detach_object(node); 198 acpi_ns_delete_node(node);
150 (void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
151 return_VOID; 199 return_VOID;
152} 200}
153 201
@@ -273,25 +321,11 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
273 parent_node, child_node)); 321 parent_node, child_node));
274 } 322 }
275 323
276 /* Now we can free this child object */ 324 /*
277 325 * Delete this child node and move on to the next child in the list.
278 ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); 326 * No need to unlink the node since we are deleting the entire branch.
279 327 */
280 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 328 acpi_ns_delete_node(child_node);
281 "Object %p, Remaining %X\n", child_node,
282 acpi_gbl_current_node_count));
283
284 /* Detach an object if there is one, then free the child node */
285
286 acpi_ns_detach_object(child_node);
287
288 /* Now we can delete the node */
289
290 (void)acpi_os_release_object(acpi_gbl_namespace_cache,
291 child_node);
292
293 /* And move on to the next child in the list */
294
295 child_node = next_node; 329 child_node = next_node;
296 330
297 } while (!(flags & ANOBJ_END_OF_PEER_LIST)); 331 } while (!(flags & ANOBJ_END_OF_PEER_LIST));
@@ -433,7 +467,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
433 467
434 if (deletion_node) { 468 if (deletion_node) {
435 acpi_ns_delete_children(deletion_node); 469 acpi_ns_delete_children(deletion_node);
436 acpi_ns_delete_node(deletion_node); 470 acpi_ns_remove_node(deletion_node);
437 deletion_node = NULL; 471 deletion_node = NULL;
438 } 472 }
439 473
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c
index 41994fe7fbb8..0fe87f1aef16 100644
--- a/drivers/acpi/acpica/nsdumpdv.c
+++ b/drivers/acpi/acpica/nsdumpdv.c
@@ -70,7 +70,6 @@ static acpi_status
70acpi_ns_dump_one_device(acpi_handle obj_handle, 70acpi_ns_dump_one_device(acpi_handle obj_handle,
71 u32 level, void *context, void **return_value) 71 u32 level, void *context, void **return_value)
72{ 72{
73 struct acpi_buffer buffer;
74 struct acpi_device_info *info; 73 struct acpi_device_info *info;
75 acpi_status status; 74 acpi_status status;
76 u32 i; 75 u32 i;
@@ -80,17 +79,15 @@ acpi_ns_dump_one_device(acpi_handle obj_handle,
80 status = 79 status =
81 acpi_ns_dump_one_object(obj_handle, level, context, return_value); 80 acpi_ns_dump_one_object(obj_handle, level, context, return_value);
82 81
83 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; 82 status = acpi_get_object_info(obj_handle, &info);
84 status = acpi_get_object_info(obj_handle, &buffer);
85 if (ACPI_SUCCESS(status)) { 83 if (ACPI_SUCCESS(status)) {
86 info = buffer.pointer;
87 for (i = 0; i < level; i++) { 84 for (i = 0; i < level; i++) {
88 ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " ")); 85 ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " "));
89 } 86 }
90 87
91 ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, 88 ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES,
92 " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", 89 " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
93 info->hardware_id.value, 90 info->hardware_id.string,
94 ACPI_FORMAT_UINT64(info->address), 91 ACPI_FORMAT_UINT64(info->address),
95 info->current_status)); 92 info->current_status));
96 ACPI_FREE(info); 93 ACPI_FREE(info);
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
index 8e7dec1176c9..846d1132feb1 100644
--- a/drivers/acpi/acpica/nseval.c
+++ b/drivers/acpi/acpica/nseval.c
@@ -50,6 +50,11 @@
50#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
51ACPI_MODULE_NAME("nseval") 51ACPI_MODULE_NAME("nseval")
52 52
53/* Local prototypes */
54static void
55acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
56 struct acpi_evaluate_info *info);
57
53/******************************************************************************* 58/*******************************************************************************
54 * 59 *
55 * FUNCTION: acpi_ns_evaluate 60 * FUNCTION: acpi_ns_evaluate
@@ -76,6 +81,7 @@ ACPI_MODULE_NAME("nseval")
76 * MUTEX: Locks interpreter 81 * MUTEX: Locks interpreter
77 * 82 *
78 ******************************************************************************/ 83 ******************************************************************************/
84
79acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) 85acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
80{ 86{
81 acpi_status status; 87 acpi_status status;
@@ -276,3 +282,134 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
276 */ 282 */
277 return_ACPI_STATUS(status); 283 return_ACPI_STATUS(status);
278} 284}
285
286/*******************************************************************************
287 *
288 * FUNCTION: acpi_ns_exec_module_code_list
289 *
290 * PARAMETERS: None
291 *
292 * RETURN: None. Exceptions during method execution are ignored, since
293 * we cannot abort a table load.
294 *
295 * DESCRIPTION: Execute all elements of the global module-level code list.
296 * Each element is executed as a single control method.
297 *
298 ******************************************************************************/
299
300void acpi_ns_exec_module_code_list(void)
301{
302 union acpi_operand_object *prev;
303 union acpi_operand_object *next;
304 struct acpi_evaluate_info *info;
305 u32 method_count = 0;
306
307 ACPI_FUNCTION_TRACE(ns_exec_module_code_list);
308
309 /* Exit now if the list is empty */
310
311 next = acpi_gbl_module_code_list;
312 if (!next) {
313 return_VOID;
314 }
315
316 /* Allocate the evaluation information block */
317
318 info = ACPI_ALLOCATE(sizeof(struct acpi_evaluate_info));
319 if (!info) {
320 return_VOID;
321 }
322
323 /* Walk the list, executing each "method" */
324
325 while (next) {
326 prev = next;
327 next = next->method.mutex;
328
329 /* Clear the link field and execute the method */
330
331 prev->method.mutex = NULL;
332 acpi_ns_exec_module_code(prev, info);
333 method_count++;
334
335 /* Delete the (temporary) method object */
336
337 acpi_ut_remove_reference(prev);
338 }
339
340 ACPI_INFO((AE_INFO,
341 "Executed %u blocks of module-level executable AML code",
342 method_count));
343
344 ACPI_FREE(info);
345 acpi_gbl_module_code_list = NULL;
346 return_VOID;
347}
348
349/*******************************************************************************
350 *
351 * FUNCTION: acpi_ns_exec_module_code
352 *
353 * PARAMETERS: method_obj - Object container for the module-level code
354 * Info - Info block for method evaluation
355 *
356 * RETURN: None. Exceptions during method execution are ignored, since
357 * we cannot abort a table load.
358 *
359 * DESCRIPTION: Execute a control method containing a block of module-level
360 * executable AML code. The control method is temporarily
361 * installed to the root node, then evaluated.
362 *
363 ******************************************************************************/
364
365static void
366acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
367 struct acpi_evaluate_info *info)
368{
369 union acpi_operand_object *root_obj;
370 acpi_status status;
371
372 ACPI_FUNCTION_TRACE(ns_exec_module_code);
373
374 /* Initialize the evaluation information block */
375
376 ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
377 info->prefix_node = acpi_gbl_root_node;
378
379 /*
380 * Get the currently attached root object. Add a reference, because the
381 * ref count will be decreased when the method object is installed to
382 * the root node.
383 */
384 root_obj = acpi_ns_get_attached_object(acpi_gbl_root_node);
385 acpi_ut_add_reference(root_obj);
386
387 /* Install the method (module-level code) in the root node */
388
389 status = acpi_ns_attach_object(acpi_gbl_root_node, method_obj,
390 ACPI_TYPE_METHOD);
391 if (ACPI_FAILURE(status)) {
392 goto exit;
393 }
394
395 /* Execute the root node as a control method */
396
397 status = acpi_ns_evaluate(info);
398
399 ACPI_DEBUG_PRINT((ACPI_DB_INIT, "Executed module-level code at %p\n",
400 method_obj->method.aml_start));
401
402 /* Detach the temporary method object */
403
404 acpi_ns_detach_object(acpi_gbl_root_node);
405
406 /* Restore the original root object */
407
408 status =
409 acpi_ns_attach_object(acpi_gbl_root_node, root_obj,
410 ACPI_TYPE_DEVICE);
411
412 exit:
413 acpi_ut_remove_reference(root_obj);
414 return_VOID;
415}
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 2adfcf329e15..1d5b360eb25b 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -170,6 +170,21 @@ acpi_status acpi_ns_initialize_devices(void)
170 goto error_exit; 170 goto error_exit;
171 } 171 }
172 172
173 /*
174 * Execute the "global" _INI method that may appear at the root. This
175 * support is provided for Windows compatibility (Vista+) and is not
176 * part of the ACPI specification.
177 */
178 info.evaluate_info->prefix_node = acpi_gbl_root_node;
179 info.evaluate_info->pathname = METHOD_NAME__INI;
180 info.evaluate_info->parameters = NULL;
181 info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;
182
183 status = acpi_ns_evaluate(info.evaluate_info);
184 if (ACPI_SUCCESS(status)) {
185 info.num_INI++;
186 }
187
173 /* Walk namespace to execute all _INIs on present devices */ 188 /* Walk namespace to execute all _INIs on present devices */
174 189
175 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 190 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c
index dcd7a6adbbbc..a7234e60e985 100644
--- a/drivers/acpi/acpica/nsload.c
+++ b/drivers/acpi/acpica/nsload.c
@@ -270,8 +270,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
270 270
271 /* Now delete the starting object, and we are done */ 271 /* Now delete the starting object, and we are done */
272 272
273 acpi_ns_delete_node(child_handle); 273 acpi_ns_remove_node(child_handle);
274
275 return_ACPI_STATUS(AE_OK); 274 return_ACPI_STATUS(AE_OK);
276} 275}
277 276
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 7f8e066b12a3..f8427afeebdf 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -42,6 +42,8 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45#define ACPI_CREATE_PREDEFINED_TABLE
46
45#include <acpi/acpi.h> 47#include <acpi/acpi.h>
46#include "accommon.h" 48#include "accommon.h"
47#include "acnamesp.h" 49#include "acnamesp.h"
@@ -72,30 +74,31 @@ ACPI_MODULE_NAME("nspredef")
72 ******************************************************************************/ 74 ******************************************************************************/
73/* Local prototypes */ 75/* Local prototypes */
74static acpi_status 76static acpi_status
75acpi_ns_check_package(char *pathname, 77acpi_ns_check_package(struct acpi_predefined_data *data,
76 union acpi_operand_object **return_object_ptr, 78 union acpi_operand_object **return_object_ptr);
77 const union acpi_predefined_info *predefined); 79
80static acpi_status
81acpi_ns_check_package_list(struct acpi_predefined_data *data,
82 const union acpi_predefined_info *package,
83 union acpi_operand_object **elements, u32 count);
78 84
79static acpi_status 85static acpi_status
80acpi_ns_check_package_elements(char *pathname, 86acpi_ns_check_package_elements(struct acpi_predefined_data *data,
81 union acpi_operand_object **elements, 87 union acpi_operand_object **elements,
82 u8 type1, 88 u8 type1,
83 u32 count1, 89 u32 count1,
84 u8 type2, u32 count2, u32 start_index); 90 u8 type2, u32 count2, u32 start_index);
85 91
86static acpi_status 92static acpi_status
87acpi_ns_check_object_type(char *pathname, 93acpi_ns_check_object_type(struct acpi_predefined_data *data,
88 union acpi_operand_object **return_object_ptr, 94 union acpi_operand_object **return_object_ptr,
89 u32 expected_btypes, u32 package_index); 95 u32 expected_btypes, u32 package_index);
90 96
91static acpi_status 97static acpi_status
92acpi_ns_check_reference(char *pathname, 98acpi_ns_check_reference(struct acpi_predefined_data *data,
93 union acpi_operand_object *return_object); 99 union acpi_operand_object *return_object);
94 100
95static acpi_status 101static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes);
96acpi_ns_repair_object(u32 expected_btypes,
97 u32 package_index,
98 union acpi_operand_object **return_object_ptr);
99 102
100/* 103/*
101 * Names for the types that can be returned by the predefined objects. 104 * Names for the types that can be returned by the predefined objects.
@@ -109,13 +112,13 @@ static const char *acpi_rtype_names[] = {
109 "/Reference", 112 "/Reference",
110}; 113};
111 114
112#define ACPI_NOT_PACKAGE ACPI_UINT32_MAX
113
114/******************************************************************************* 115/*******************************************************************************
115 * 116 *
116 * FUNCTION: acpi_ns_check_predefined_names 117 * FUNCTION: acpi_ns_check_predefined_names
117 * 118 *
118 * PARAMETERS: Node - Namespace node for the method/object 119 * PARAMETERS: Node - Namespace node for the method/object
120 * user_param_count - Number of parameters actually passed
121 * return_status - Status from the object evaluation
119 * return_object_ptr - Pointer to the object returned from the 122 * return_object_ptr - Pointer to the object returned from the
120 * evaluation of a method or object 123 * evaluation of a method or object
121 * 124 *
@@ -135,12 +138,13 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
135 acpi_status status = AE_OK; 138 acpi_status status = AE_OK;
136 const union acpi_predefined_info *predefined; 139 const union acpi_predefined_info *predefined;
137 char *pathname; 140 char *pathname;
141 struct acpi_predefined_data *data;
138 142
139 /* Match the name for this method/object against the predefined list */ 143 /* Match the name for this method/object against the predefined list */
140 144
141 predefined = acpi_ns_check_for_predefined_name(node); 145 predefined = acpi_ns_check_for_predefined_name(node);
142 146
143 /* Get the full pathname to the object, for use in error messages */ 147 /* Get the full pathname to the object, for use in warning messages */
144 148
145 pathname = acpi_ns_get_external_pathname(node); 149 pathname = acpi_ns_get_external_pathname(node);
146 if (!pathname) { 150 if (!pathname) {
@@ -158,28 +162,17 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
158 /* If not a predefined name, we cannot validate the return object */ 162 /* If not a predefined name, we cannot validate the return object */
159 163
160 if (!predefined) { 164 if (!predefined) {
161 goto exit; 165 goto cleanup;
162 }
163
164 /* If the method failed, we cannot validate the return object */
165
166 if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) {
167 goto exit;
168 } 166 }
169 167
170 /* 168 /*
171 * Only validate the return value on the first successful evaluation of 169 * If the method failed or did not actually return an object, we cannot
172 * the method. This ensures that any warnings will only be emitted during 170 * validate the return object
173 * the very first evaluation of the method/object.
174 */ 171 */
175 if (node->flags & ANOBJ_EVALUATED) { 172 if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) {
176 goto exit; 173 goto cleanup;
177 } 174 }
178 175
179 /* Mark the node as having been successfully evaluated */
180
181 node->flags |= ANOBJ_EVALUATED;
182
183 /* 176 /*
184 * If there is no return value, check if we require a return value for 177 * If there is no return value, check if we require a return value for
185 * this predefined name. Either one return value is expected, or none, 178 * this predefined name. Either one return value is expected, or none,
@@ -190,46 +183,67 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
190 if (!return_object) { 183 if (!return_object) {
191 if ((predefined->info.expected_btypes) && 184 if ((predefined->info.expected_btypes) &&
192 (!(predefined->info.expected_btypes & ACPI_RTYPE_NONE))) { 185 (!(predefined->info.expected_btypes & ACPI_RTYPE_NONE))) {
193 ACPI_ERROR((AE_INFO, 186 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
194 "%s: Missing expected return value", 187 ACPI_WARN_ALWAYS,
195 pathname)); 188 "Missing expected return value"));
196 189
197 status = AE_AML_NO_RETURN_VALUE; 190 status = AE_AML_NO_RETURN_VALUE;
198 } 191 }
199 goto exit; 192 goto cleanup;
200 } 193 }
201 194
202 /* 195 /*
203 * We have a return value, but if one wasn't expected, just exit, this is 196 * 1) We have a return value, but if one wasn't expected, just exit, this is
204 * not a problem 197 * not a problem. For example, if the "Implicit Return" feature is
198 * enabled, methods will always return a value.
205 * 199 *
206 * For example, if the "Implicit Return" feature is enabled, methods will 200 * 2) If the return value can be of any type, then we cannot perform any
207 * always return a value 201 * validation, exit.
208 */ 202 */
209 if (!predefined->info.expected_btypes) { 203 if ((!predefined->info.expected_btypes) ||
210 goto exit; 204 (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) {
205 goto cleanup;
211 } 206 }
212 207
208 /* Create the parameter data block for object validation */
209
210 data = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_predefined_data));
211 if (!data) {
212 goto cleanup;
213 }
214 data->predefined = predefined;
215 data->node_flags = node->flags;
216 data->pathname = pathname;
217
213 /* 218 /*
214 * Check that the type of the return object is what is expected for 219 * Check that the type of the return object is what is expected for
215 * this predefined name 220 * this predefined name
216 */ 221 */
217 status = acpi_ns_check_object_type(pathname, return_object_ptr, 222 status = acpi_ns_check_object_type(data, return_object_ptr,
218 predefined->info.expected_btypes, 223 predefined->info.expected_btypes,
219 ACPI_NOT_PACKAGE); 224 ACPI_NOT_PACKAGE_ELEMENT);
220 if (ACPI_FAILURE(status)) { 225 if (ACPI_FAILURE(status)) {
221 goto exit; 226 goto check_validation_status;
222 } 227 }
223 228
224 /* For returned Package objects, check the type of all sub-objects */ 229 /* For returned Package objects, check the type of all sub-objects */
225 230
226 if (return_object->common.type == ACPI_TYPE_PACKAGE) { 231 if (return_object->common.type == ACPI_TYPE_PACKAGE) {
227 status = 232 status = acpi_ns_check_package(data, return_object_ptr);
228 acpi_ns_check_package(pathname, return_object_ptr, 233 }
229 predefined); 234
235check_validation_status:
236 /*
237 * If the object validation failed or if we successfully repaired one
238 * or more objects, mark the parent node to suppress further warning
239 * messages during the next evaluation of the same method/object.
240 */
241 if (ACPI_FAILURE(status) || (data->flags & ACPI_OBJECT_REPAIRED)) {
242 node->flags |= ANOBJ_EVALUATED;
230 } 243 }
244 ACPI_FREE(data);
231 245
232 exit: 246cleanup:
233 ACPI_FREE(pathname); 247 ACPI_FREE(pathname);
234 return (status); 248 return (status);
235} 249}
@@ -268,64 +282,58 @@ acpi_ns_check_parameter_count(char *pathname,
268 param_count = node->object->method.param_count; 282 param_count = node->object->method.param_count;
269 } 283 }
270 284
271 /* Argument count check for non-predefined methods/objects */
272
273 if (!predefined) { 285 if (!predefined) {
274 /* 286 /*
287 * Check the parameter count for non-predefined methods/objects.
288 *
275 * Warning if too few or too many arguments have been passed by the 289 * Warning if too few or too many arguments have been passed by the
276 * caller. An incorrect number of arguments may not cause the method 290 * caller. An incorrect number of arguments may not cause the method
277 * to fail. However, the method will fail if there are too few 291 * to fail. However, the method will fail if there are too few
278 * arguments and the method attempts to use one of the missing ones. 292 * arguments and the method attempts to use one of the missing ones.
279 */ 293 */
280 if (user_param_count < param_count) { 294 if (user_param_count < param_count) {
281 ACPI_WARNING((AE_INFO, 295 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
282 "%s: Insufficient arguments - needs %d, found %d", 296 ACPI_WARN_ALWAYS,
283 pathname, param_count, user_param_count)); 297 "Insufficient arguments - needs %u, found %u",
298 param_count, user_param_count));
284 } else if (user_param_count > param_count) { 299 } else if (user_param_count > param_count) {
285 ACPI_WARNING((AE_INFO, 300 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
286 "%s: Excess arguments - needs %d, found %d", 301 ACPI_WARN_ALWAYS,
287 pathname, param_count, user_param_count)); 302 "Excess arguments - needs %u, found %u",
303 param_count, user_param_count));
288 } 304 }
289 return; 305 return;
290 } 306 }
291 307
292 /* Allow two different legal argument counts (_SCP, etc.) */ 308 /*
293 309 * Validate the user-supplied parameter count.
310 * Allow two different legal argument counts (_SCP, etc.)
311 */
294 required_params_current = predefined->info.param_count & 0x0F; 312 required_params_current = predefined->info.param_count & 0x0F;
295 required_params_old = predefined->info.param_count >> 4; 313 required_params_old = predefined->info.param_count >> 4;
296 314
297 if (user_param_count != ACPI_UINT32_MAX) { 315 if (user_param_count != ACPI_UINT32_MAX) {
298
299 /* Validate the user-supplied parameter count */
300
301 if ((user_param_count != required_params_current) && 316 if ((user_param_count != required_params_current) &&
302 (user_param_count != required_params_old)) { 317 (user_param_count != required_params_old)) {
303 ACPI_WARNING((AE_INFO, 318 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
304 "%s: Parameter count mismatch - " 319 ACPI_WARN_ALWAYS,
305 "caller passed %d, ACPI requires %d", 320 "Parameter count mismatch - "
306 pathname, user_param_count, 321 "caller passed %u, ACPI requires %u",
307 required_params_current)); 322 user_param_count,
323 required_params_current));
308 } 324 }
309 } 325 }
310 326
311 /* 327 /*
312 * Only validate the argument count on the first successful evaluation of
313 * the method. This ensures that any warnings will only be emitted during
314 * the very first evaluation of the method/object.
315 */
316 if (node->flags & ANOBJ_EVALUATED) {
317 return;
318 }
319
320 /*
321 * Check that the ASL-defined parameter count is what is expected for 328 * Check that the ASL-defined parameter count is what is expected for
322 * this predefined name. 329 * this predefined name (parameter count as defined by the ACPI
330 * specification)
323 */ 331 */
324 if ((param_count != required_params_current) && 332 if ((param_count != required_params_current) &&
325 (param_count != required_params_old)) { 333 (param_count != required_params_old)) {
326 ACPI_WARNING((AE_INFO, 334 ACPI_WARN_PREDEFINED((AE_INFO, pathname, node->flags,
327 "%s: Parameter count mismatch - ASL declared %d, ACPI requires %d", 335 "Parameter count mismatch - ASL declared %u, ACPI requires %u",
328 pathname, param_count, required_params_current)); 336 param_count, required_params_current));
329 } 337 }
330} 338}
331 339
@@ -358,9 +366,6 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
358 this_name = predefined_names; 366 this_name = predefined_names;
359 while (this_name->info.name[0]) { 367 while (this_name->info.name[0]) {
360 if (ACPI_COMPARE_NAME(node->name.ascii, this_name->info.name)) { 368 if (ACPI_COMPARE_NAME(node->name.ascii, this_name->info.name)) {
361
362 /* Return pointer to this table entry */
363
364 return (this_name); 369 return (this_name);
365 } 370 }
366 371
@@ -375,17 +380,16 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
375 this_name++; 380 this_name++;
376 } 381 }
377 382
378 return (NULL); 383 return (NULL); /* Not found */
379} 384}
380 385
381/******************************************************************************* 386/*******************************************************************************
382 * 387 *
383 * FUNCTION: acpi_ns_check_package 388 * FUNCTION: acpi_ns_check_package
384 * 389 *
385 * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 390 * PARAMETERS: Data - Pointer to validation data structure
386 * return_object_ptr - Pointer to the object returned from the 391 * return_object_ptr - Pointer to the object returned from the
387 * evaluation of a method or object 392 * evaluation of a method or object
388 * Predefined - Pointer to entry in predefined name table
389 * 393 *
390 * RETURN: Status 394 * RETURN: Status
391 * 395 *
@@ -395,30 +399,26 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
395 ******************************************************************************/ 399 ******************************************************************************/
396 400
397static acpi_status 401static acpi_status
398acpi_ns_check_package(char *pathname, 402acpi_ns_check_package(struct acpi_predefined_data *data,
399 union acpi_operand_object **return_object_ptr, 403 union acpi_operand_object **return_object_ptr)
400 const union acpi_predefined_info *predefined)
401{ 404{
402 union acpi_operand_object *return_object = *return_object_ptr; 405 union acpi_operand_object *return_object = *return_object_ptr;
403 const union acpi_predefined_info *package; 406 const union acpi_predefined_info *package;
404 union acpi_operand_object *sub_package;
405 union acpi_operand_object **elements; 407 union acpi_operand_object **elements;
406 union acpi_operand_object **sub_elements; 408 acpi_status status = AE_OK;
407 acpi_status status;
408 u32 expected_count; 409 u32 expected_count;
409 u32 count; 410 u32 count;
410 u32 i; 411 u32 i;
411 u32 j;
412 412
413 ACPI_FUNCTION_NAME(ns_check_package); 413 ACPI_FUNCTION_NAME(ns_check_package);
414 414
415 /* The package info for this name is in the next table entry */ 415 /* The package info for this name is in the next table entry */
416 416
417 package = predefined + 1; 417 package = data->predefined + 1;
418 418
419 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 419 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
420 "%s Validating return Package of Type %X, Count %X\n", 420 "%s Validating return Package of Type %X, Count %X\n",
421 pathname, package->ret_info.type, 421 data->pathname, package->ret_info.type,
422 return_object->package.count)); 422 return_object->package.count));
423 423
424 /* Extract package count and elements array */ 424 /* Extract package count and elements array */
@@ -429,9 +429,8 @@ acpi_ns_check_package(char *pathname,
429 /* The package must have at least one element, else invalid */ 429 /* The package must have at least one element, else invalid */
430 430
431 if (!count) { 431 if (!count) {
432 ACPI_WARNING((AE_INFO, 432 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
433 "%s: Return Package has no elements (empty)", 433 "Return Package has no elements (empty)"));
434 pathname));
435 434
436 return (AE_AML_OPERAND_VALUE); 435 return (AE_AML_OPERAND_VALUE);
437 } 436 }
@@ -456,15 +455,16 @@ acpi_ns_check_package(char *pathname,
456 if (count < expected_count) { 455 if (count < expected_count) {
457 goto package_too_small; 456 goto package_too_small;
458 } else if (count > expected_count) { 457 } else if (count > expected_count) {
459 ACPI_WARNING((AE_INFO, 458 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
460 "%s: Return Package is larger than needed - " 459 data->node_flags,
461 "found %u, expected %u", pathname, count, 460 "Return Package is larger than needed - "
462 expected_count)); 461 "found %u, expected %u", count,
462 expected_count));
463 } 463 }
464 464
465 /* Validate all elements of the returned package */ 465 /* Validate all elements of the returned package */
466 466
467 status = acpi_ns_check_package_elements(pathname, elements, 467 status = acpi_ns_check_package_elements(data, elements,
468 package->ret_info. 468 package->ret_info.
469 object_type1, 469 object_type1,
470 package->ret_info. 470 package->ret_info.
@@ -473,9 +473,6 @@ acpi_ns_check_package(char *pathname,
473 object_type2, 473 object_type2,
474 package->ret_info. 474 package->ret_info.
475 count2, 0); 475 count2, 0);
476 if (ACPI_FAILURE(status)) {
477 return (status);
478 }
479 break; 476 break;
480 477
481 case ACPI_PTYPE1_VAR: 478 case ACPI_PTYPE1_VAR:
@@ -485,7 +482,7 @@ acpi_ns_check_package(char *pathname,
485 * elements must be of the same type 482 * elements must be of the same type
486 */ 483 */
487 for (i = 0; i < count; i++) { 484 for (i = 0; i < count; i++) {
488 status = acpi_ns_check_object_type(pathname, elements, 485 status = acpi_ns_check_object_type(data, elements,
489 package->ret_info. 486 package->ret_info.
490 object_type1, i); 487 object_type1, i);
491 if (ACPI_FAILURE(status)) { 488 if (ACPI_FAILURE(status)) {
@@ -517,8 +514,7 @@ acpi_ns_check_package(char *pathname,
517 /* These are the required package elements (0, 1, or 2) */ 514 /* These are the required package elements (0, 1, or 2) */
518 515
519 status = 516 status =
520 acpi_ns_check_object_type(pathname, 517 acpi_ns_check_object_type(data, elements,
521 elements,
522 package-> 518 package->
523 ret_info3. 519 ret_info3.
524 object_type[i], 520 object_type[i],
@@ -530,8 +526,7 @@ acpi_ns_check_package(char *pathname,
530 /* These are the optional package elements */ 526 /* These are the optional package elements */
531 527
532 status = 528 status =
533 acpi_ns_check_object_type(pathname, 529 acpi_ns_check_object_type(data, elements,
534 elements,
535 package-> 530 package->
536 ret_info3. 531 ret_info3.
537 tail_object_type, 532 tail_object_type,
@@ -544,11 +539,30 @@ acpi_ns_check_package(char *pathname,
544 } 539 }
545 break; 540 break;
546 541
542 case ACPI_PTYPE2_REV_FIXED:
543
544 /* First element is the (Integer) revision */
545
546 status = acpi_ns_check_object_type(data, elements,
547 ACPI_RTYPE_INTEGER, 0);
548 if (ACPI_FAILURE(status)) {
549 return (status);
550 }
551
552 elements++;
553 count--;
554
555 /* Examine the sub-packages */
556
557 status =
558 acpi_ns_check_package_list(data, package, elements, count);
559 break;
560
547 case ACPI_PTYPE2_PKG_COUNT: 561 case ACPI_PTYPE2_PKG_COUNT:
548 562
549 /* First element is the (Integer) count of sub-packages to follow */ 563 /* First element is the (Integer) count of sub-packages to follow */
550 564
551 status = acpi_ns_check_object_type(pathname, elements, 565 status = acpi_ns_check_object_type(data, elements,
552 ACPI_RTYPE_INTEGER, 0); 566 ACPI_RTYPE_INTEGER, 0);
553 if (ACPI_FAILURE(status)) { 567 if (ACPI_FAILURE(status)) {
554 return (status); 568 return (status);
@@ -566,9 +580,11 @@ acpi_ns_check_package(char *pathname,
566 count = expected_count; 580 count = expected_count;
567 elements++; 581 elements++;
568 582
569 /* Now we can walk the sub-packages */ 583 /* Examine the sub-packages */
570 584
571 /*lint -fallthrough */ 585 status =
586 acpi_ns_check_package_list(data, package, elements, count);
587 break;
572 588
573 case ACPI_PTYPE2: 589 case ACPI_PTYPE2:
574 case ACPI_PTYPE2_FIXED: 590 case ACPI_PTYPE2_FIXED:
@@ -576,176 +592,240 @@ acpi_ns_check_package(char *pathname,
576 case ACPI_PTYPE2_COUNT: 592 case ACPI_PTYPE2_COUNT:
577 593
578 /* 594 /*
579 * These types all return a single package that consists of a variable 595 * These types all return a single Package that consists of a
580 * number of sub-packages 596 * variable number of sub-Packages.
597 *
598 * First, ensure that the first element is a sub-Package. If not,
599 * the BIOS may have incorrectly returned the object as a single
600 * package instead of a Package of Packages (a common error if
601 * there is only one entry). We may be able to repair this by
602 * wrapping the returned Package with a new outer Package.
581 */ 603 */
582 for (i = 0; i < count; i++) { 604 if ((*elements)->common.type != ACPI_TYPE_PACKAGE) {
583 sub_package = *elements;
584 sub_elements = sub_package->package.elements;
585 605
586 /* Each sub-object must be of type Package */ 606 /* Create the new outer package and populate it */
587 607
588 status = 608 status =
589 acpi_ns_check_object_type(pathname, &sub_package, 609 acpi_ns_repair_package_list(data,
590 ACPI_RTYPE_PACKAGE, i); 610 return_object_ptr);
591 if (ACPI_FAILURE(status)) { 611 if (ACPI_FAILURE(status)) {
592 return (status); 612 return (status);
593 } 613 }
594 614
595 /* Examine the different types of sub-packages */ 615 /* Update locals to point to the new package (of 1 element) */
596 616
597 switch (package->ret_info.type) { 617 return_object = *return_object_ptr;
598 case ACPI_PTYPE2: 618 elements = return_object->package.elements;
599 case ACPI_PTYPE2_PKG_COUNT: 619 count = 1;
620 }
600 621
601 /* Each subpackage has a fixed number of elements */ 622 /* Examine the sub-packages */
602 623
603 expected_count = 624 status =
604 package->ret_info.count1 + 625 acpi_ns_check_package_list(data, package, elements, count);
605 package->ret_info.count2; 626 break;
606 if (sub_package->package.count !=
607 expected_count) {
608 count = sub_package->package.count;
609 goto package_too_small;
610 }
611 627
612 status = 628 default:
613 acpi_ns_check_package_elements(pathname,
614 sub_elements,
615 package->
616 ret_info.
617 object_type1,
618 package->
619 ret_info.
620 count1,
621 package->
622 ret_info.
623 object_type2,
624 package->
625 ret_info.
626 count2, 0);
627 if (ACPI_FAILURE(status)) {
628 return (status);
629 }
630 break;
631 629
632 case ACPI_PTYPE2_FIXED: 630 /* Should not get here if predefined info table is correct */
633 631
634 /* Each sub-package has a fixed length */ 632 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
633 "Invalid internal return type in table entry: %X",
634 package->ret_info.type));
635 635
636 expected_count = package->ret_info2.count; 636 return (AE_AML_INTERNAL);
637 if (sub_package->package.count < expected_count) { 637 }
638 count = sub_package->package.count;
639 goto package_too_small;
640 }
641 638
642 /* Check the type of each sub-package element */ 639 return (status);
643 640
644 for (j = 0; j < expected_count; j++) { 641package_too_small:
645 status =
646 acpi_ns_check_object_type(pathname,
647 &sub_elements[j],
648 package->ret_info2.object_type[j], j);
649 if (ACPI_FAILURE(status)) {
650 return (status);
651 }
652 }
653 break;
654 642
655 case ACPI_PTYPE2_MIN: 643 /* Error exit for the case with an incorrect package count */
656 644
657 /* Each sub-package has a variable but minimum length */ 645 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
646 "Return Package is too small - found %u elements, expected %u",
647 count, expected_count));
658 648
659 expected_count = package->ret_info.count1; 649 return (AE_AML_OPERAND_VALUE);
660 if (sub_package->package.count < expected_count) { 650}
661 count = sub_package->package.count;
662 goto package_too_small;
663 }
664 651
665 /* Check the type of each sub-package element */ 652/*******************************************************************************
653 *
654 * FUNCTION: acpi_ns_check_package_list
655 *
656 * PARAMETERS: Data - Pointer to validation data structure
657 * Package - Pointer to package-specific info for method
658 * Elements - Element list of parent package. All elements
659 * of this list should be of type Package.
660 * Count - Count of subpackages
661 *
662 * RETURN: Status
663 *
664 * DESCRIPTION: Examine a list of subpackages
665 *
666 ******************************************************************************/
666 667
667 status = 668static acpi_status
668 acpi_ns_check_package_elements(pathname, 669acpi_ns_check_package_list(struct acpi_predefined_data *data,
669 sub_elements, 670 const union acpi_predefined_info *package,
670 package-> 671 union acpi_operand_object **elements, u32 count)
671 ret_info. 672{
672 object_type1, 673 union acpi_operand_object *sub_package;
673 sub_package-> 674 union acpi_operand_object **sub_elements;
674 package. 675 acpi_status status;
675 count, 0, 0, 676 u32 expected_count;
676 0); 677 u32 i;
677 if (ACPI_FAILURE(status)) { 678 u32 j;
678 return (status);
679 }
680 break;
681 679
682 case ACPI_PTYPE2_COUNT: 680 /* Validate each sub-Package in the parent Package */
683 681
684 /* First element is the (Integer) count of elements to follow */ 682 for (i = 0; i < count; i++) {
683 sub_package = *elements;
684 sub_elements = sub_package->package.elements;
685 685
686 status = 686 /* Each sub-object must be of type Package */
687 acpi_ns_check_object_type(pathname,
688 sub_elements,
689 ACPI_RTYPE_INTEGER,
690 0);
691 if (ACPI_FAILURE(status)) {
692 return (status);
693 }
694 687
695 /* Make sure package is large enough for the Count */ 688 status = acpi_ns_check_object_type(data, &sub_package,
689 ACPI_RTYPE_PACKAGE, i);
690 if (ACPI_FAILURE(status)) {
691 return (status);
692 }
696 693
697 expected_count = 694 /* Examine the different types of expected sub-packages */
698 (u32) (*sub_elements)->integer.value; 695
699 if (sub_package->package.count < expected_count) { 696 switch (package->ret_info.type) {
700 count = sub_package->package.count; 697 case ACPI_PTYPE2:
701 goto package_too_small; 698 case ACPI_PTYPE2_PKG_COUNT:
702 } 699 case ACPI_PTYPE2_REV_FIXED:
700
701 /* Each subpackage has a fixed number of elements */
702
703 expected_count =
704 package->ret_info.count1 + package->ret_info.count2;
705 if (sub_package->package.count < expected_count) {
706 goto package_too_small;
707 }
708
709 status =
710 acpi_ns_check_package_elements(data, sub_elements,
711 package->ret_info.
712 object_type1,
713 package->ret_info.
714 count1,
715 package->ret_info.
716 object_type2,
717 package->ret_info.
718 count2, 0);
719 if (ACPI_FAILURE(status)) {
720 return (status);
721 }
722 break;
703 723
704 /* Check the type of each sub-package element */ 724 case ACPI_PTYPE2_FIXED:
705 725
726 /* Each sub-package has a fixed length */
727
728 expected_count = package->ret_info2.count;
729 if (sub_package->package.count < expected_count) {
730 goto package_too_small;
731 }
732
733 /* Check the type of each sub-package element */
734
735 for (j = 0; j < expected_count; j++) {
706 status = 736 status =
707 acpi_ns_check_package_elements(pathname, 737 acpi_ns_check_object_type(data,
708 (sub_elements 738 &sub_elements[j],
709 + 1), 739 package->
710 package-> 740 ret_info2.
711 ret_info. 741 object_type[j],
712 object_type1, 742 j);
713 (expected_count
714 - 1), 0, 0,
715 1);
716 if (ACPI_FAILURE(status)) { 743 if (ACPI_FAILURE(status)) {
717 return (status); 744 return (status);
718 } 745 }
719 break; 746 }
747 break;
748
749 case ACPI_PTYPE2_MIN:
720 750
721 default: 751 /* Each sub-package has a variable but minimum length */
722 break; 752
753 expected_count = package->ret_info.count1;
754 if (sub_package->package.count < expected_count) {
755 goto package_too_small;
723 } 756 }
724 757
725 elements++; 758 /* Check the type of each sub-package element */
726 }
727 break;
728 759
729 default: 760 status =
761 acpi_ns_check_package_elements(data, sub_elements,
762 package->ret_info.
763 object_type1,
764 sub_package->package.
765 count, 0, 0, 0);
766 if (ACPI_FAILURE(status)) {
767 return (status);
768 }
769 break;
730 770
731 /* Should not get here if predefined info table is correct */ 771 case ACPI_PTYPE2_COUNT:
772
773 /*
774 * First element is the (Integer) count of elements, including
775 * the count field.
776 */
777 status = acpi_ns_check_object_type(data, sub_elements,
778 ACPI_RTYPE_INTEGER,
779 0);
780 if (ACPI_FAILURE(status)) {
781 return (status);
782 }
732 783
733 ACPI_WARNING((AE_INFO, 784 /*
734 "%s: Invalid internal return type in table entry: %X", 785 * Make sure package is large enough for the Count and is
735 pathname, package->ret_info.type)); 786 * is as large as the minimum size
787 */
788 expected_count = (u32)(*sub_elements)->integer.value;
789 if (sub_package->package.count < expected_count) {
790 goto package_too_small;
791 }
792 if (sub_package->package.count <
793 package->ret_info.count1) {
794 expected_count = package->ret_info.count1;
795 goto package_too_small;
796 }
736 797
737 return (AE_AML_INTERNAL); 798 /* Check the type of each sub-package element */
799
800 status =
801 acpi_ns_check_package_elements(data,
802 (sub_elements + 1),
803 package->ret_info.
804 object_type1,
805 (expected_count - 1),
806 0, 0, 1);
807 if (ACPI_FAILURE(status)) {
808 return (status);
809 }
810 break;
811
812 default: /* Should not get here, type was validated by caller */
813
814 return (AE_AML_INTERNAL);
815 }
816
817 elements++;
738 } 818 }
739 819
740 return (AE_OK); 820 return (AE_OK);
741 821
742 package_too_small: 822package_too_small:
743 823
744 /* Error exit for the case with an incorrect package count */ 824 /* The sub-package count was smaller than required */
745 825
746 ACPI_WARNING((AE_INFO, "%s: Return Package is too small - " 826 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
747 "found %u, expected %u", pathname, count, 827 "Return Sub-Package[%u] is too small - found %u elements, expected %u",
748 expected_count)); 828 i, sub_package->package.count, expected_count));
749 829
750 return (AE_AML_OPERAND_VALUE); 830 return (AE_AML_OPERAND_VALUE);
751} 831}
@@ -754,7 +834,7 @@ acpi_ns_check_package(char *pathname,
754 * 834 *
755 * FUNCTION: acpi_ns_check_package_elements 835 * FUNCTION: acpi_ns_check_package_elements
756 * 836 *
757 * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 837 * PARAMETERS: Data - Pointer to validation data structure
758 * Elements - Pointer to the package elements array 838 * Elements - Pointer to the package elements array
759 * Type1 - Object type for first group 839 * Type1 - Object type for first group
760 * Count1 - Count for first group 840 * Count1 - Count for first group
@@ -770,7 +850,7 @@ acpi_ns_check_package(char *pathname,
770 ******************************************************************************/ 850 ******************************************************************************/
771 851
772static acpi_status 852static acpi_status
773acpi_ns_check_package_elements(char *pathname, 853acpi_ns_check_package_elements(struct acpi_predefined_data *data,
774 union acpi_operand_object **elements, 854 union acpi_operand_object **elements,
775 u8 type1, 855 u8 type1,
776 u32 count1, 856 u32 count1,
@@ -786,7 +866,7 @@ acpi_ns_check_package_elements(char *pathname,
786 * The second group can have a count of zero. 866 * The second group can have a count of zero.
787 */ 867 */
788 for (i = 0; i < count1; i++) { 868 for (i = 0; i < count1; i++) {
789 status = acpi_ns_check_object_type(pathname, this_element, 869 status = acpi_ns_check_object_type(data, this_element,
790 type1, i + start_index); 870 type1, i + start_index);
791 if (ACPI_FAILURE(status)) { 871 if (ACPI_FAILURE(status)) {
792 return (status); 872 return (status);
@@ -795,7 +875,7 @@ acpi_ns_check_package_elements(char *pathname,
795 } 875 }
796 876
797 for (i = 0; i < count2; i++) { 877 for (i = 0; i < count2; i++) {
798 status = acpi_ns_check_object_type(pathname, this_element, 878 status = acpi_ns_check_object_type(data, this_element,
799 type2, 879 type2,
800 (i + count1 + start_index)); 880 (i + count1 + start_index));
801 if (ACPI_FAILURE(status)) { 881 if (ACPI_FAILURE(status)) {
@@ -811,12 +891,13 @@ acpi_ns_check_package_elements(char *pathname,
811 * 891 *
812 * FUNCTION: acpi_ns_check_object_type 892 * FUNCTION: acpi_ns_check_object_type
813 * 893 *
814 * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 894 * PARAMETERS: Data - Pointer to validation data structure
815 * return_object_ptr - Pointer to the object returned from the 895 * return_object_ptr - Pointer to the object returned from the
816 * evaluation of a method or object 896 * evaluation of a method or object
817 * expected_btypes - Bitmap of expected return type(s) 897 * expected_btypes - Bitmap of expected return type(s)
818 * package_index - Index of object within parent package (if 898 * package_index - Index of object within parent package (if
819 * applicable - ACPI_NOT_PACKAGE otherwise) 899 * applicable - ACPI_NOT_PACKAGE_ELEMENT
900 * otherwise)
820 * 901 *
821 * RETURN: Status 902 * RETURN: Status
822 * 903 *
@@ -826,7 +907,7 @@ acpi_ns_check_package_elements(char *pathname,
826 ******************************************************************************/ 907 ******************************************************************************/
827 908
828static acpi_status 909static acpi_status
829acpi_ns_check_object_type(char *pathname, 910acpi_ns_check_object_type(struct acpi_predefined_data *data,
830 union acpi_operand_object **return_object_ptr, 911 union acpi_operand_object **return_object_ptr,
831 u32 expected_btypes, u32 package_index) 912 u32 expected_btypes, u32 package_index)
832{ 913{
@@ -834,9 +915,6 @@ acpi_ns_check_object_type(char *pathname,
834 acpi_status status = AE_OK; 915 acpi_status status = AE_OK;
835 u32 return_btype; 916 u32 return_btype;
836 char type_buffer[48]; /* Room for 5 types */ 917 char type_buffer[48]; /* Room for 5 types */
837 u32 this_rtype;
838 u32 i;
839 u32 j;
840 918
841 /* 919 /*
842 * If we get a NULL return_object here, it is a NULL package element, 920 * If we get a NULL return_object here, it is a NULL package element,
@@ -849,10 +927,11 @@ acpi_ns_check_object_type(char *pathname,
849 /* A Namespace node should not get here, but make sure */ 927 /* A Namespace node should not get here, but make sure */
850 928
851 if (ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) { 929 if (ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
852 ACPI_WARNING((AE_INFO, 930 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
853 "%s: Invalid return type - Found a Namespace node [%4.4s] type %s", 931 "Invalid return type - Found a Namespace node [%4.4s] type %s",
854 pathname, return_object->node.name.ascii, 932 return_object->node.name.ascii,
855 acpi_ut_get_type_name(return_object->node.type))); 933 acpi_ut_get_type_name(return_object->node.
934 type)));
856 return (AE_AML_OPERAND_TYPE); 935 return (AE_AML_OPERAND_TYPE);
857 } 936 }
858 937
@@ -897,10 +976,11 @@ acpi_ns_check_object_type(char *pathname,
897 976
898 /* Type mismatch -- attempt repair of the returned object */ 977 /* Type mismatch -- attempt repair of the returned object */
899 978
900 status = acpi_ns_repair_object(expected_btypes, package_index, 979 status = acpi_ns_repair_object(data, expected_btypes,
980 package_index,
901 return_object_ptr); 981 return_object_ptr);
902 if (ACPI_SUCCESS(status)) { 982 if (ACPI_SUCCESS(status)) {
903 return (status); 983 return (AE_OK); /* Repair was successful */
904 } 984 }
905 goto type_error_exit; 985 goto type_error_exit;
906 } 986 }
@@ -908,7 +988,7 @@ acpi_ns_check_object_type(char *pathname,
908 /* For reference objects, check that the reference type is correct */ 988 /* For reference objects, check that the reference type is correct */
909 989
910 if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { 990 if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
911 status = acpi_ns_check_reference(pathname, return_object); 991 status = acpi_ns_check_reference(data, return_object);
912 } 992 }
913 993
914 return (status); 994 return (status);
@@ -917,33 +997,19 @@ acpi_ns_check_object_type(char *pathname,
917 997
918 /* Create a string with all expected types for this predefined object */ 998 /* Create a string with all expected types for this predefined object */
919 999
920 j = 1; 1000 acpi_ns_get_expected_types(type_buffer, expected_btypes);
921 type_buffer[0] = 0;
922 this_rtype = ACPI_RTYPE_INTEGER;
923
924 for (i = 0; i < ACPI_NUM_RTYPES; i++) {
925
926 /* If one of the expected types, concatenate the name of this type */
927
928 if (expected_btypes & this_rtype) {
929 ACPI_STRCAT(type_buffer, &acpi_rtype_names[i][j]);
930 j = 0; /* Use name separator from now on */
931 }
932 this_rtype <<= 1; /* Next Rtype */
933 }
934 1001
935 if (package_index == ACPI_NOT_PACKAGE) { 1002 if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
936 ACPI_WARNING((AE_INFO, 1003 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
937 "%s: Return type mismatch - found %s, expected %s", 1004 "Return type mismatch - found %s, expected %s",
938 pathname, 1005 acpi_ut_get_object_type_name
939 acpi_ut_get_object_type_name(return_object), 1006 (return_object), type_buffer));
940 type_buffer));
941 } else { 1007 } else {
942 ACPI_WARNING((AE_INFO, 1008 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
943 "%s: Return Package type mismatch at index %u - " 1009 "Return Package type mismatch at index %u - "
944 "found %s, expected %s", pathname, package_index, 1010 "found %s, expected %s", package_index,
945 acpi_ut_get_object_type_name(return_object), 1011 acpi_ut_get_object_type_name
946 type_buffer)); 1012 (return_object), type_buffer));
947 } 1013 }
948 1014
949 return (AE_AML_OPERAND_TYPE); 1015 return (AE_AML_OPERAND_TYPE);
@@ -953,7 +1019,7 @@ acpi_ns_check_object_type(char *pathname,
953 * 1019 *
954 * FUNCTION: acpi_ns_check_reference 1020 * FUNCTION: acpi_ns_check_reference
955 * 1021 *
956 * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 1022 * PARAMETERS: Data - Pointer to validation data structure
957 * return_object - Object returned from the evaluation of a 1023 * return_object - Object returned from the evaluation of a
958 * method or object 1024 * method or object
959 * 1025 *
@@ -966,7 +1032,7 @@ acpi_ns_check_object_type(char *pathname,
966 ******************************************************************************/ 1032 ******************************************************************************/
967 1033
968static acpi_status 1034static acpi_status
969acpi_ns_check_reference(char *pathname, 1035acpi_ns_check_reference(struct acpi_predefined_data *data,
970 union acpi_operand_object *return_object) 1036 union acpi_operand_object *return_object)
971{ 1037{
972 1038
@@ -979,94 +1045,46 @@ acpi_ns_check_reference(char *pathname,
979 return (AE_OK); 1045 return (AE_OK);
980 } 1046 }
981 1047
982 ACPI_WARNING((AE_INFO, 1048 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
983 "%s: Return type mismatch - " 1049 "Return type mismatch - unexpected reference object type [%s] %2.2X",
984 "unexpected reference object type [%s] %2.2X", 1050 acpi_ut_get_reference_name(return_object),
985 pathname, acpi_ut_get_reference_name(return_object), 1051 return_object->reference.class));
986 return_object->reference.class));
987 1052
988 return (AE_AML_OPERAND_TYPE); 1053 return (AE_AML_OPERAND_TYPE);
989} 1054}
990 1055
991/******************************************************************************* 1056/*******************************************************************************
992 * 1057 *
993 * FUNCTION: acpi_ns_repair_object 1058 * FUNCTION: acpi_ns_get_expected_types
994 * 1059 *
995 * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 1060 * PARAMETERS: Buffer - Pointer to where the string is returned
996 * package_index - Used to determine if target is in a package 1061 * expected_btypes - Bitmap of expected return type(s)
997 * return_object_ptr - Pointer to the object returned from the
998 * evaluation of a method or object
999 * 1062 *
1000 * RETURN: Status. AE_OK if repair was successful. 1063 * RETURN: Buffer is populated with type names.
1001 * 1064 *
1002 * DESCRIPTION: Attempt to repair/convert a return object of a type that was 1065 * DESCRIPTION: Translate the expected types bitmap into a string of ascii
1003 * not expected. 1066 * names of expected types, for use in warning messages.
1004 * 1067 *
1005 ******************************************************************************/ 1068 ******************************************************************************/
1006 1069
1007static acpi_status 1070static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes)
1008acpi_ns_repair_object(u32 expected_btypes,
1009 u32 package_index,
1010 union acpi_operand_object **return_object_ptr)
1011{ 1071{
1012 union acpi_operand_object *return_object = *return_object_ptr; 1072 u32 this_rtype;
1013 union acpi_operand_object *new_object; 1073 u32 i;
1014 acpi_size length; 1074 u32 j;
1015
1016 switch (return_object->common.type) {
1017 case ACPI_TYPE_BUFFER:
1018
1019 if (!(expected_btypes & ACPI_RTYPE_STRING)) {
1020 return (AE_AML_OPERAND_TYPE);
1021 }
1022
1023 /*
1024 * Have a Buffer, expected a String, convert. Use a to_string
1025 * conversion, no transform performed on the buffer data. The best
1026 * example of this is the _BIF method, where the string data from
1027 * the battery is often (incorrectly) returned as buffer object(s).
1028 */
1029 length = 0;
1030 while ((length < return_object->buffer.length) &&
1031 (return_object->buffer.pointer[length])) {
1032 length++;
1033 }
1034
1035 /* Allocate a new string object */
1036
1037 new_object = acpi_ut_create_string_object(length);
1038 if (!new_object) {
1039 return (AE_NO_MEMORY);
1040 }
1041 1075
1042 /* 1076 j = 1;
1043 * Copy the raw buffer data with no transform. String is already NULL 1077 buffer[0] = 0;
1044 * terminated at Length+1. 1078 this_rtype = ACPI_RTYPE_INTEGER;
1045 */
1046 ACPI_MEMCPY(new_object->string.pointer,
1047 return_object->buffer.pointer, length);
1048 1079
1049 /* Install the new return object */ 1080 for (i = 0; i < ACPI_NUM_RTYPES; i++) {
1050 1081
1051 acpi_ut_remove_reference(return_object); 1082 /* If one of the expected types, concatenate the name of this type */
1052 *return_object_ptr = new_object;
1053 1083
1054 /* 1084 if (expected_btypes & this_rtype) {
1055 * If the object is a package element, we need to: 1085 ACPI_STRCAT(buffer, &acpi_rtype_names[i][j]);
1056 * 1. Decrement the reference count of the orignal object, it was 1086 j = 0; /* Use name separator from now on */
1057 * incremented when building the package
1058 * 2. Increment the reference count of the new object, it will be
1059 * decremented when releasing the package
1060 */
1061 if (package_index != ACPI_NOT_PACKAGE) {
1062 acpi_ut_remove_reference(return_object);
1063 acpi_ut_add_reference(new_object);
1064 } 1087 }
1065 return (AE_OK); 1088 this_rtype <<= 1; /* Next Rtype */
1066
1067 default:
1068 break;
1069 } 1089 }
1070
1071 return (AE_AML_OPERAND_TYPE);
1072} 1090}
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
new file mode 100644
index 000000000000..db2b2a99c3a8
--- /dev/null
+++ b/drivers/acpi/acpica/nsrepair.c
@@ -0,0 +1,203 @@
1/******************************************************************************
2 *
3 * Module Name: nsrepair - Repair for objects returned by predefined methods
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2009, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acnamesp.h"
47#include "acpredef.h"
48
49#define _COMPONENT ACPI_NAMESPACE
50ACPI_MODULE_NAME("nsrepair")
51
52/*******************************************************************************
53 *
54 * FUNCTION: acpi_ns_repair_object
55 *
56 * PARAMETERS: Data - Pointer to validation data structure
57 * expected_btypes - Object types expected
58 * package_index - Index of object within parent package (if
59 * applicable - ACPI_NOT_PACKAGE_ELEMENT
60 * otherwise)
61 * return_object_ptr - Pointer to the object returned from the
62 * evaluation of a method or object
63 *
64 * RETURN: Status. AE_OK if repair was successful.
65 *
66 * DESCRIPTION: Attempt to repair/convert a return object of a type that was
67 * not expected.
68 *
69 ******************************************************************************/
70acpi_status
71acpi_ns_repair_object(struct acpi_predefined_data *data,
72 u32 expected_btypes,
73 u32 package_index,
74 union acpi_operand_object **return_object_ptr)
75{
76 union acpi_operand_object *return_object = *return_object_ptr;
77 union acpi_operand_object *new_object;
78 acpi_size length;
79
80 switch (return_object->common.type) {
81 case ACPI_TYPE_BUFFER:
82
83 /* Does the method/object legally return a string? */
84
85 if (!(expected_btypes & ACPI_RTYPE_STRING)) {
86 return (AE_AML_OPERAND_TYPE);
87 }
88
89 /*
90 * Have a Buffer, expected a String, convert. Use a to_string
91 * conversion, no transform performed on the buffer data. The best
92 * example of this is the _BIF method, where the string data from
93 * the battery is often (incorrectly) returned as buffer object(s).
94 */
95 length = 0;
96 while ((length < return_object->buffer.length) &&
97 (return_object->buffer.pointer[length])) {
98 length++;
99 }
100
101 /* Allocate a new string object */
102
103 new_object = acpi_ut_create_string_object(length);
104 if (!new_object) {
105 return (AE_NO_MEMORY);
106 }
107
108 /*
109 * Copy the raw buffer data with no transform. String is already NULL
110 * terminated at Length+1.
111 */
112 ACPI_MEMCPY(new_object->string.pointer,
113 return_object->buffer.pointer, length);
114
115 /*
116 * If the original object is a package element, we need to:
117 * 1. Set the reference count of the new object to match the
118 * reference count of the old object.
119 * 2. Decrement the reference count of the original object.
120 */
121 if (package_index != ACPI_NOT_PACKAGE_ELEMENT) {
122 new_object->common.reference_count =
123 return_object->common.reference_count;
124
125 if (return_object->common.reference_count > 1) {
126 return_object->common.reference_count--;
127 }
128
129 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
130 data->node_flags,
131 "Converted Buffer to expected String at index %u",
132 package_index));
133 } else {
134 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
135 data->node_flags,
136 "Converted Buffer to expected String"));
137 }
138
139 /* Delete old object, install the new return object */
140
141 acpi_ut_remove_reference(return_object);
142 *return_object_ptr = new_object;
143 data->flags |= ACPI_OBJECT_REPAIRED;
144 return (AE_OK);
145
146 default:
147 break;
148 }
149
150 return (AE_AML_OPERAND_TYPE);
151}
152
153/*******************************************************************************
154 *
155 * FUNCTION: acpi_ns_repair_package_list
156 *
157 * PARAMETERS: Data - Pointer to validation data structure
158 * obj_desc_ptr - Pointer to the object to repair. The new
159 * package object is returned here,
160 * overwriting the old object.
161 *
162 * RETURN: Status, new object in *obj_desc_ptr
163 *
164 * DESCRIPTION: Repair a common problem with objects that are defined to return
165 * a variable-length Package of Packages. If the variable-length
166 * is one, some BIOS code mistakenly simply declares a single
167 * Package instead of a Package with one sub-Package. This
168 * function attempts to repair this error by wrapping a Package
169 * object around the original Package, creating the correct
170 * Package with one sub-Package.
171 *
172 * Names that can be repaired in this manner include:
173 * _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, TSS
174 *
175 ******************************************************************************/
176
177acpi_status
178acpi_ns_repair_package_list(struct acpi_predefined_data *data,
179 union acpi_operand_object **obj_desc_ptr)
180{
181 union acpi_operand_object *pkg_obj_desc;
182
183 /*
184 * Create the new outer package and populate it. The new package will
185 * have a single element, the lone subpackage.
186 */
187 pkg_obj_desc = acpi_ut_create_package_object(1);
188 if (!pkg_obj_desc) {
189 return (AE_NO_MEMORY);
190 }
191
192 pkg_obj_desc->package.elements[0] = *obj_desc_ptr;
193
194 /* Return the new object in the object pointer */
195
196 *obj_desc_ptr = pkg_obj_desc;
197 data->flags |= ACPI_OBJECT_REPAIRED;
198
199 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
200 "Incorrectly formed Package, attempting repair"));
201
202 return (AE_OK);
203}
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index 78277ed08339..ea55ab4f9849 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -88,7 +88,8 @@ acpi_ns_report_error(const char *module_name,
88 88
89 /* There is a non-ascii character in the name */ 89 /* There is a non-ascii character in the name */
90 90
91 ACPI_MOVE_32_TO_32(&bad_name, internal_name); 91 ACPI_MOVE_32_TO_32(&bad_name,
92 ACPI_CAST_PTR(u32, internal_name));
92 acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); 93 acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name);
93 } else { 94 } else {
94 /* Convert path to external format */ 95 /* Convert path to external format */
@@ -836,7 +837,7 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
836 acpi_status status; 837 acpi_status status;
837 char *internal_path; 838 char *internal_path;
838 839
839 ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname); 840 ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname));
840 841
841 if (!pathname) { 842 if (!pathname) {
842 *return_node = prefix_node; 843 *return_node = prefix_node;
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index daf4ad37896d..4929dbdbc8f0 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -535,10 +535,11 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
535 acpi_status status; 535 acpi_status status;
536 struct acpi_namespace_node *node; 536 struct acpi_namespace_node *node;
537 u32 flags; 537 u32 flags;
538 struct acpica_device_id hid; 538 struct acpica_device_id *hid;
539 struct acpi_compatible_id_list *cid; 539 struct acpica_device_id_list *cid;
540 u32 i; 540 u32 i;
541 int found; 541 u8 found;
542 int no_match;
542 543
543 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 544 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
544 if (ACPI_FAILURE(status)) { 545 if (ACPI_FAILURE(status)) {
@@ -582,10 +583,14 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
582 return (AE_CTRL_DEPTH); 583 return (AE_CTRL_DEPTH);
583 } 584 }
584 585
585 if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { 586 no_match = ACPI_STRCMP(hid->string, info->hid);
586 587 ACPI_FREE(hid);
587 /* Get the list of Compatible IDs */
588 588
589 if (no_match) {
590 /*
591 * HID does not match, attempt match within the
592 * list of Compatible IDs (CIDs)
593 */
589 status = acpi_ut_execute_CID(node, &cid); 594 status = acpi_ut_execute_CID(node, &cid);
590 if (status == AE_NOT_FOUND) { 595 if (status == AE_NOT_FOUND) {
591 return (AE_OK); 596 return (AE_OK);
@@ -597,10 +602,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
597 602
598 found = 0; 603 found = 0;
599 for (i = 0; i < cid->count; i++) { 604 for (i = 0; i < cid->count; i++) {
600 if (ACPI_STRNCMP(cid->id[i].value, info->hid, 605 if (ACPI_STRCMP(cid->ids[i].string, info->hid)
601 sizeof(struct 606 == 0) {
602 acpi_compatible_id)) ==
603 0) {
604 found = 1; 607 found = 1;
605 break; 608 break;
606 } 609 }
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index f23593d6add4..ddc84af6336e 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -51,6 +51,11 @@
51#define _COMPONENT ACPI_NAMESPACE 51#define _COMPONENT ACPI_NAMESPACE
52ACPI_MODULE_NAME("nsxfname") 52ACPI_MODULE_NAME("nsxfname")
53 53
54/* Local prototypes */
55static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
56 struct acpica_device_id *source,
57 char *string_area);
58
54/****************************************************************************** 59/******************************************************************************
55 * 60 *
56 * FUNCTION: acpi_get_handle 61 * FUNCTION: acpi_get_handle
@@ -68,6 +73,7 @@ ACPI_MODULE_NAME("nsxfname")
68 * namespace handle. 73 * namespace handle.
69 * 74 *
70 ******************************************************************************/ 75 ******************************************************************************/
76
71acpi_status 77acpi_status
72acpi_get_handle(acpi_handle parent, 78acpi_get_handle(acpi_handle parent,
73 acpi_string pathname, acpi_handle * ret_handle) 79 acpi_string pathname, acpi_handle * ret_handle)
@@ -210,10 +216,38 @@ ACPI_EXPORT_SYMBOL(acpi_get_name)
210 216
211/****************************************************************************** 217/******************************************************************************
212 * 218 *
219 * FUNCTION: acpi_ns_copy_device_id
220 *
221 * PARAMETERS: Dest - Pointer to the destination DEVICE_ID
222 * Source - Pointer to the source DEVICE_ID
223 * string_area - Pointer to where to copy the dest string
224 *
225 * RETURN: Pointer to the next string area
226 *
227 * DESCRIPTION: Copy a single DEVICE_ID, including the string data.
228 *
229 ******************************************************************************/
230static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
231 struct acpica_device_id *source,
232 char *string_area)
233{
234 /* Create the destination DEVICE_ID */
235
236 dest->string = string_area;
237 dest->length = source->length;
238
239 /* Copy actual string and return a pointer to the next string area */
240
241 ACPI_MEMCPY(string_area, source->string, source->length);
242 return (string_area + source->length);
243}
244
245/******************************************************************************
246 *
213 * FUNCTION: acpi_get_object_info 247 * FUNCTION: acpi_get_object_info
214 * 248 *
215 * PARAMETERS: Handle - Object Handle 249 * PARAMETERS: Handle - Object Handle
216 * Buffer - Where the info is returned 250 * return_buffer - Where the info is returned
217 * 251 *
218 * RETURN: Status 252 * RETURN: Status
219 * 253 *
@@ -221,33 +255,37 @@ ACPI_EXPORT_SYMBOL(acpi_get_name)
221 * namespace node and possibly by running several standard 255 * namespace node and possibly by running several standard
222 * control methods (Such as in the case of a device.) 256 * control methods (Such as in the case of a device.)
223 * 257 *
258 * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA,
259 * _ADR, _sx_w, and _sx_d methods.
260 *
261 * Note: Allocates the return buffer, must be freed by the caller.
262 *
224 ******************************************************************************/ 263 ******************************************************************************/
264
225acpi_status 265acpi_status
226acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) 266acpi_get_object_info(acpi_handle handle,
267 struct acpi_device_info **return_buffer)
227{ 268{
228 acpi_status status;
229 struct acpi_namespace_node *node; 269 struct acpi_namespace_node *node;
230 struct acpi_device_info *info; 270 struct acpi_device_info *info;
231 struct acpi_device_info *return_info; 271 struct acpica_device_id_list *cid_list = NULL;
232 struct acpi_compatible_id_list *cid_list = NULL; 272 struct acpica_device_id *hid = NULL;
233 acpi_size size; 273 struct acpica_device_id *uid = NULL;
274 char *next_id_string;
275 acpi_object_type type;
276 acpi_name name;
277 u8 param_count = 0;
278 u8 valid = 0;
279 u32 info_size;
280 u32 i;
281 acpi_status status;
234 282
235 /* Parameter validation */ 283 /* Parameter validation */
236 284
237 if (!handle || !buffer) { 285 if (!handle || !return_buffer) {
238 return (AE_BAD_PARAMETER); 286 return (AE_BAD_PARAMETER);
239 } 287 }
240 288
241 status = acpi_ut_validate_buffer(buffer);
242 if (ACPI_FAILURE(status)) {
243 return (status);
244 }
245
246 info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info));
247 if (!info) {
248 return (AE_NO_MEMORY);
249 }
250
251 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 289 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
252 if (ACPI_FAILURE(status)) { 290 if (ACPI_FAILURE(status)) {
253 goto cleanup; 291 goto cleanup;
@@ -256,66 +294,91 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
256 node = acpi_ns_map_handle_to_node(handle); 294 node = acpi_ns_map_handle_to_node(handle);
257 if (!node) { 295 if (!node) {
258 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 296 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
259 status = AE_BAD_PARAMETER; 297 return (AE_BAD_PARAMETER);
260 goto cleanup;
261 } 298 }
262 299
263 /* Init return structure */ 300 /* Get the namespace node data while the namespace is locked */
264
265 size = sizeof(struct acpi_device_info);
266 301
267 info->type = node->type; 302 info_size = sizeof(struct acpi_device_info);
268 info->name = node->name.integer; 303 type = node->type;
269 info->valid = 0; 304 name = node->name.integer;
270 305
271 if (node->type == ACPI_TYPE_METHOD) { 306 if (node->type == ACPI_TYPE_METHOD) {
272 info->param_count = node->object->method.param_count; 307 param_count = node->object->method.param_count;
273 } 308 }
274 309
275 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 310 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
276 if (ACPI_FAILURE(status)) { 311 if (ACPI_FAILURE(status)) {
277 goto cleanup; 312 return (status);
278 } 313 }
279 314
280 /* If not a device, we are all done */ 315 if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
281
282 if (info->type == ACPI_TYPE_DEVICE) {
283 /* 316 /*
284 * Get extra info for ACPI Devices objects only: 317 * Get extra info for ACPI Device/Processor objects only:
285 * Run the Device _HID, _UID, _CID, _STA, _ADR and _sx_d methods. 318 * Run the Device _HID, _UID, and _CID methods.
286 * 319 *
287 * Note: none of these methods are required, so they may or may 320 * Note: none of these methods are required, so they may or may
288 * not be present for this device. The Info->Valid bitfield is used 321 * not be present for this device. The Info->Valid bitfield is used
289 * to indicate which methods were found and ran successfully. 322 * to indicate which methods were found and run successfully.
290 */ 323 */
291 324
292 /* Execute the Device._HID method */ 325 /* Execute the Device._HID method */
293 326
294 status = acpi_ut_execute_HID(node, &info->hardware_id); 327 status = acpi_ut_execute_HID(node, &hid);
295 if (ACPI_SUCCESS(status)) { 328 if (ACPI_SUCCESS(status)) {
296 info->valid |= ACPI_VALID_HID; 329 info_size += hid->length;
330 valid |= ACPI_VALID_HID;
297 } 331 }
298 332
299 /* Execute the Device._UID method */ 333 /* Execute the Device._UID method */
300 334
301 status = acpi_ut_execute_UID(node, &info->unique_id); 335 status = acpi_ut_execute_UID(node, &uid);
302 if (ACPI_SUCCESS(status)) { 336 if (ACPI_SUCCESS(status)) {
303 info->valid |= ACPI_VALID_UID; 337 info_size += uid->length;
338 valid |= ACPI_VALID_UID;
304 } 339 }
305 340
306 /* Execute the Device._CID method */ 341 /* Execute the Device._CID method */
307 342
308 status = acpi_ut_execute_CID(node, &cid_list); 343 status = acpi_ut_execute_CID(node, &cid_list);
309 if (ACPI_SUCCESS(status)) { 344 if (ACPI_SUCCESS(status)) {
310 size += cid_list->size; 345
311 info->valid |= ACPI_VALID_CID; 346 /* Add size of CID strings and CID pointer array */
347
348 info_size +=
349 (cid_list->list_size -
350 sizeof(struct acpica_device_id_list));
351 valid |= ACPI_VALID_CID;
312 } 352 }
353 }
354
355 /*
356 * Now that we have the variable-length data, we can allocate the
357 * return buffer
358 */
359 info = ACPI_ALLOCATE_ZEROED(info_size);
360 if (!info) {
361 status = AE_NO_MEMORY;
362 goto cleanup;
363 }
364
365 /* Get the fixed-length data */
366
367 if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
368 /*
369 * Get extra info for ACPI Device/Processor objects only:
370 * Run the _STA, _ADR and, sx_w, and _sx_d methods.
371 *
372 * Note: none of these methods are required, so they may or may
373 * not be present for this device. The Info->Valid bitfield is used
374 * to indicate which methods were found and run successfully.
375 */
313 376
314 /* Execute the Device._STA method */ 377 /* Execute the Device._STA method */
315 378
316 status = acpi_ut_execute_STA(node, &info->current_status); 379 status = acpi_ut_execute_STA(node, &info->current_status);
317 if (ACPI_SUCCESS(status)) { 380 if (ACPI_SUCCESS(status)) {
318 info->valid |= ACPI_VALID_STA; 381 valid |= ACPI_VALID_STA;
319 } 382 }
320 383
321 /* Execute the Device._ADR method */ 384 /* Execute the Device._ADR method */
@@ -323,36 +386,100 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
323 status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node, 386 status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node,
324 &info->address); 387 &info->address);
325 if (ACPI_SUCCESS(status)) { 388 if (ACPI_SUCCESS(status)) {
326 info->valid |= ACPI_VALID_ADR; 389 valid |= ACPI_VALID_ADR;
390 }
391
392 /* Execute the Device._sx_w methods */
393
394 status = acpi_ut_execute_power_methods(node,
395 acpi_gbl_lowest_dstate_names,
396 ACPI_NUM_sx_w_METHODS,
397 info->lowest_dstates);
398 if (ACPI_SUCCESS(status)) {
399 valid |= ACPI_VALID_SXWS;
327 } 400 }
328 401
329 /* Execute the Device._sx_d methods */ 402 /* Execute the Device._sx_d methods */
330 403
331 status = acpi_ut_execute_sxds(node, info->highest_dstates); 404 status = acpi_ut_execute_power_methods(node,
405 acpi_gbl_highest_dstate_names,
406 ACPI_NUM_sx_d_METHODS,
407 info->highest_dstates);
332 if (ACPI_SUCCESS(status)) { 408 if (ACPI_SUCCESS(status)) {
333 info->valid |= ACPI_VALID_SXDS; 409 valid |= ACPI_VALID_SXDS;
334 } 410 }
335 } 411 }
336 412
337 /* Validate/Allocate/Clear caller buffer */ 413 /*
414 * Create a pointer to the string area of the return buffer.
415 * Point to the end of the base struct acpi_device_info structure.
416 */
417 next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids);
418 if (cid_list) {
338 419
339 status = acpi_ut_initialize_buffer(buffer, size); 420 /* Point past the CID DEVICE_ID array */
340 if (ACPI_FAILURE(status)) { 421
341 goto cleanup; 422 next_id_string +=
423 ((acpi_size) cid_list->count *
424 sizeof(struct acpica_device_id));
342 } 425 }
343 426
344 /* Populate the return buffer */ 427 /*
428 * Copy the HID, UID, and CIDs to the return buffer. The variable-length
429 * strings are copied to the reserved area at the end of the buffer.
430 *
431 * For HID and CID, check if the ID is a PCI Root Bridge.
432 */
433 if (hid) {
434 next_id_string = acpi_ns_copy_device_id(&info->hardware_id,
435 hid, next_id_string);
436
437 if (acpi_ut_is_pci_root_bridge(hid->string)) {
438 info->flags |= ACPI_PCI_ROOT_BRIDGE;
439 }
440 }
345 441
346 return_info = buffer->pointer; 442 if (uid) {
347 ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info)); 443 next_id_string = acpi_ns_copy_device_id(&info->unique_id,
444 uid, next_id_string);
445 }
348 446
349 if (cid_list) { 447 if (cid_list) {
350 ACPI_MEMCPY(&return_info->compatibility_id, cid_list, 448 info->compatible_id_list.count = cid_list->count;
351 cid_list->size); 449 info->compatible_id_list.list_size = cid_list->list_size;
450
451 /* Copy each CID */
452
453 for (i = 0; i < cid_list->count; i++) {
454 next_id_string =
455 acpi_ns_copy_device_id(&info->compatible_id_list.
456 ids[i], &cid_list->ids[i],
457 next_id_string);
458
459 if (acpi_ut_is_pci_root_bridge(cid_list->ids[i].string)) {
460 info->flags |= ACPI_PCI_ROOT_BRIDGE;
461 }
462 }
352 } 463 }
353 464
465 /* Copy the fixed-length data */
466
467 info->info_size = info_size;
468 info->type = type;
469 info->name = name;
470 info->param_count = param_count;
471 info->valid = valid;
472
473 *return_buffer = info;
474 status = AE_OK;
475
354 cleanup: 476 cleanup:
355 ACPI_FREE(info); 477 if (hid) {
478 ACPI_FREE(hid);
479 }
480 if (uid) {
481 ACPI_FREE(uid);
482 }
356 if (cid_list) { 483 if (cid_list) {
357 ACPI_FREE(cid_list); 484 ACPI_FREE(cid_list);
358 } 485 }
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index c5f6ce19a401..cd7995b3aed4 100644
--- a/drivers/acpi/acpica/psloop.c
+++ b/drivers/acpi/acpica/psloop.c
@@ -86,6 +86,9 @@ static acpi_status
86acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, 86acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
87 union acpi_parse_object *op, acpi_status status); 87 union acpi_parse_object *op, acpi_status status);
88 88
89static void
90acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id);
91
89/******************************************************************************* 92/*******************************************************************************
90 * 93 *
91 * FUNCTION: acpi_ps_get_aml_opcode 94 * FUNCTION: acpi_ps_get_aml_opcode
@@ -390,6 +393,7 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
390{ 393{
391 acpi_status status = AE_OK; 394 acpi_status status = AE_OK;
392 union acpi_parse_object *arg = NULL; 395 union acpi_parse_object *arg = NULL;
396 const struct acpi_opcode_info *op_info;
393 397
394 ACPI_FUNCTION_TRACE_PTR(ps_get_arguments, walk_state); 398 ACPI_FUNCTION_TRACE_PTR(ps_get_arguments, walk_state);
395 399
@@ -449,13 +453,11 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
449 INCREMENT_ARG_LIST(walk_state->arg_types); 453 INCREMENT_ARG_LIST(walk_state->arg_types);
450 } 454 }
451 455
452 /* Special processing for certain opcodes */ 456 /*
453 457 * Handle executable code at "module-level". This refers to
454 /* TBD (remove): Temporary mechanism to disable this code if needed */ 458 * executable opcodes that appear outside of any control method.
455 459 */
456#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE 460 if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2) &&
457
458 if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) &&
459 ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) { 461 ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
460 /* 462 /*
461 * We want to skip If/Else/While constructs during Pass1 because we 463 * We want to skip If/Else/While constructs during Pass1 because we
@@ -469,6 +471,23 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
469 case AML_ELSE_OP: 471 case AML_ELSE_OP:
470 case AML_WHILE_OP: 472 case AML_WHILE_OP:
471 473
474 /*
475 * Currently supported module-level opcodes are:
476 * IF/ELSE/WHILE. These appear to be the most common,
477 * and easiest to support since they open an AML
478 * package.
479 */
480 if (walk_state->pass_number ==
481 ACPI_IMODE_LOAD_PASS1) {
482 acpi_ps_link_module_code(aml_op_start,
483 walk_state->
484 parser_state.
485 pkg_end -
486 aml_op_start,
487 walk_state->
488 owner_id);
489 }
490
472 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, 491 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
473 "Pass1: Skipping an If/Else/While body\n")); 492 "Pass1: Skipping an If/Else/While body\n"));
474 493
@@ -480,10 +499,34 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
480 break; 499 break;
481 500
482 default: 501 default:
502 /*
503 * Check for an unsupported executable opcode at module
504 * level. We must be in PASS1, the parent must be a SCOPE,
505 * The opcode class must be EXECUTE, and the opcode must
506 * not be an argument to another opcode.
507 */
508 if ((walk_state->pass_number ==
509 ACPI_IMODE_LOAD_PASS1)
510 && (op->common.parent->common.aml_opcode ==
511 AML_SCOPE_OP)) {
512 op_info =
513 acpi_ps_get_opcode_info(op->common.
514 aml_opcode);
515 if ((op_info->class ==
516 AML_CLASS_EXECUTE) && (!arg)) {
517 ACPI_WARNING((AE_INFO,
518 "Detected an unsupported executable opcode "
519 "at module-level: [0x%.4X] at table offset 0x%.4X",
520 op->common.aml_opcode,
521 (u32)((aml_op_start - walk_state->parser_state.aml_start)
522 + sizeof(struct acpi_table_header))));
523 }
524 }
483 break; 525 break;
484 } 526 }
485 } 527 }
486#endif 528
529 /* Special processing for certain opcodes */
487 530
488 switch (op->common.aml_opcode) { 531 switch (op->common.aml_opcode) {
489 case AML_METHOD_OP: 532 case AML_METHOD_OP:
@@ -553,6 +596,66 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
553 596
554/******************************************************************************* 597/*******************************************************************************
555 * 598 *
599 * FUNCTION: acpi_ps_link_module_code
600 *
601 * PARAMETERS: aml_start - Pointer to the AML
602 * aml_length - Length of executable AML
603 * owner_id - owner_id of module level code
604 *
605 * RETURN: None.
606 *
607 * DESCRIPTION: Wrap the module-level code with a method object and link the
608 * object to the global list. Note, the mutex field of the method
609 * object is used to link multiple module-level code objects.
610 *
611 ******************************************************************************/
612
613static void
614acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id)
615{
616 union acpi_operand_object *prev;
617 union acpi_operand_object *next;
618 union acpi_operand_object *method_obj;
619
620 /* Get the tail of the list */
621
622 prev = next = acpi_gbl_module_code_list;
623 while (next) {
624 prev = next;
625 next = next->method.mutex;
626 }
627
628 /*
629 * Insert the module level code into the list. Merge it if it is
630 * adjacent to the previous element.
631 */
632 if (!prev ||
633 ((prev->method.aml_start + prev->method.aml_length) != aml_start)) {
634
635 /* Create, initialize, and link a new temporary method object */
636
637 method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
638 if (!method_obj) {
639 return;
640 }
641
642 method_obj->method.aml_start = aml_start;
643 method_obj->method.aml_length = aml_length;
644 method_obj->method.owner_id = owner_id;
645 method_obj->method.flags |= AOPOBJ_MODULE_LEVEL;
646
647 if (!prev) {
648 acpi_gbl_module_code_list = method_obj;
649 } else {
650 prev->method.mutex = method_obj;
651 }
652 } else {
653 prev->method.aml_length += aml_length;
654 }
655}
656
657/*******************************************************************************
658 *
556 * FUNCTION: acpi_ps_complete_op 659 * FUNCTION: acpi_ps_complete_op
557 * 660 *
558 * PARAMETERS: walk_state - Current state 661 * PARAMETERS: walk_state - Current state
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c
index ff06032c0f06..dd9731c29a79 100644
--- a/drivers/acpi/acpica/psxface.c
+++ b/drivers/acpi/acpica/psxface.c
@@ -280,6 +280,10 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
280 goto cleanup; 280 goto cleanup;
281 } 281 }
282 282
283 if (info->obj_desc->method.flags & AOPOBJ_MODULE_LEVEL) {
284 walk_state->parse_flags |= ACPI_PARSE_MODULE_LEVEL;
285 }
286
283 /* Invoke an internal method if necessary */ 287 /* Invoke an internal method if necessary */
284 288
285 if (info->obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { 289 if (info->obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index ef7d2c2d8f0b..1f15497f00d1 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -49,6 +49,12 @@
49ACPI_MODULE_NAME("tbutils") 49ACPI_MODULE_NAME("tbutils")
50 50
51/* Local prototypes */ 51/* Local prototypes */
52static void acpi_tb_fix_string(char *string, acpi_size length);
53
54static void
55acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
56 struct acpi_table_header *header);
57
52static acpi_physical_address 58static acpi_physical_address
53acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); 59acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
54 60
@@ -161,6 +167,59 @@ u8 acpi_tb_tables_loaded(void)
161 167
162/******************************************************************************* 168/*******************************************************************************
163 * 169 *
170 * FUNCTION: acpi_tb_fix_string
171 *
172 * PARAMETERS: String - String to be repaired
173 * Length - Maximum length
174 *
175 * RETURN: None
176 *
177 * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
178 * with a question mark '?'.
179 *
180 ******************************************************************************/
181
182static void acpi_tb_fix_string(char *string, acpi_size length)
183{
184
185 while (length && *string) {
186 if (!ACPI_IS_PRINT(*string)) {
187 *string = '?';
188 }
189 string++;
190 length--;
191 }
192}
193
194/*******************************************************************************
195 *
196 * FUNCTION: acpi_tb_cleanup_table_header
197 *
198 * PARAMETERS: out_header - Where the cleaned header is returned
199 * Header - Input ACPI table header
200 *
201 * RETURN: Returns the cleaned header in out_header
202 *
203 * DESCRIPTION: Copy the table header and ensure that all "string" fields in
204 * the header consist of printable characters.
205 *
206 ******************************************************************************/
207
208static void
209acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
210 struct acpi_table_header *header)
211{
212
213 ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
214
215 acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
216 acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
217 acpi_tb_fix_string(out_header->oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
218 acpi_tb_fix_string(out_header->asl_compiler_id, ACPI_NAME_SIZE);
219}
220
221/*******************************************************************************
222 *
164 * FUNCTION: acpi_tb_print_table_header 223 * FUNCTION: acpi_tb_print_table_header
165 * 224 *
166 * PARAMETERS: Address - Table physical address 225 * PARAMETERS: Address - Table physical address
@@ -176,6 +235,7 @@ void
176acpi_tb_print_table_header(acpi_physical_address address, 235acpi_tb_print_table_header(acpi_physical_address address,
177 struct acpi_table_header *header) 236 struct acpi_table_header *header)
178{ 237{
238 struct acpi_table_header local_header;
179 239
180 /* 240 /*
181 * The reason that the Address is cast to a void pointer is so that we 241 * The reason that the Address is cast to a void pointer is so that we
@@ -192,6 +252,11 @@ acpi_tb_print_table_header(acpi_physical_address address,
192 252
193 /* RSDP has no common fields */ 253 /* RSDP has no common fields */
194 254
255 ACPI_MEMCPY(local_header.oem_id,
256 ACPI_CAST_PTR(struct acpi_table_rsdp,
257 header)->oem_id, ACPI_OEM_ID_SIZE);
258 acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
259
195 ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", 260 ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
196 ACPI_CAST_PTR (void, address), 261 ACPI_CAST_PTR (void, address),
197 (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> 262 (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
@@ -200,18 +265,21 @@ acpi_tb_print_table_header(acpi_physical_address address,
200 header)->length : 20, 265 header)->length : 20,
201 ACPI_CAST_PTR(struct acpi_table_rsdp, 266 ACPI_CAST_PTR(struct acpi_table_rsdp,
202 header)->revision, 267 header)->revision,
203 ACPI_CAST_PTR(struct acpi_table_rsdp, 268 local_header.oem_id));
204 header)->oem_id));
205 } else { 269 } else {
206 /* Standard ACPI table with full common header */ 270 /* Standard ACPI table with full common header */
207 271
272 acpi_tb_cleanup_table_header(&local_header, header);
273
208 ACPI_INFO((AE_INFO, 274 ACPI_INFO((AE_INFO,
209 "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", 275 "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
210 header->signature, ACPI_CAST_PTR (void, address), 276 local_header.signature, ACPI_CAST_PTR(void, address),
211 header->length, header->revision, header->oem_id, 277 local_header.length, local_header.revision,
212 header->oem_table_id, header->oem_revision, 278 local_header.oem_id, local_header.oem_table_id,
213 header->asl_compiler_id, 279 local_header.oem_revision,
214 header->asl_compiler_revision)); 280 local_header.asl_compiler_id,
281 local_header.asl_compiler_revision));
282
215 } 283 }
216} 284}
217 285
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index 006b16c26017..5d54e36ab453 100644
--- a/drivers/acpi/acpica/uteval.c
+++ b/drivers/acpi/acpica/uteval.c
@@ -44,19 +44,10 @@
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include "accommon.h" 45#include "accommon.h"
46#include "acnamesp.h" 46#include "acnamesp.h"
47#include "acinterp.h"
48 47
49#define _COMPONENT ACPI_UTILITIES 48#define _COMPONENT ACPI_UTILITIES
50ACPI_MODULE_NAME("uteval") 49ACPI_MODULE_NAME("uteval")
51 50
52/* Local prototypes */
53static void
54acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length);
55
56static acpi_status
57acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
58 struct acpi_compatible_id *one_cid);
59
60/* 51/*
61 * Strings supported by the _OSI predefined (internal) method. 52 * Strings supported by the _OSI predefined (internal) method.
62 * 53 *
@@ -78,6 +69,9 @@ static struct acpi_interface_info acpi_interfaces_supported[] = {
78 {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ 69 {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */
79 {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ 70 {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */
80 {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ 71 {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */
72 {"Windows 2006.1", ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */
73 {"Windows 2006 SP1", ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */
74 {"Windows 2009", ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */
81 75
82 /* Feature Group Strings */ 76 /* Feature Group Strings */
83 77
@@ -213,7 +207,7 @@ acpi_status acpi_osi_invalidate(char *interface)
213 * RETURN: Status 207 * RETURN: Status
214 * 208 *
215 * DESCRIPTION: Evaluates a namespace object and verifies the type of the 209 * DESCRIPTION: Evaluates a namespace object and verifies the type of the
216 * return object. Common code that simplifies accessing objects 210 * return object. Common code that simplifies accessing objects
217 * that have required return objects of fixed types. 211 * that have required return objects of fixed types.
218 * 212 *
219 * NOTE: Internal function, no parameter validation 213 * NOTE: Internal function, no parameter validation
@@ -298,7 +292,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
298 292
299 if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) { 293 if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) {
300 /* 294 /*
301 * We received a return object, but one was not expected. This can 295 * We received a return object, but one was not expected. This can
302 * happen frequently if the "implicit return" feature is enabled. 296 * happen frequently if the "implicit return" feature is enabled.
303 * Just delete the return object and return AE_OK. 297 * Just delete the return object and return AE_OK.
304 */ 298 */
@@ -340,12 +334,12 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
340 * 334 *
341 * PARAMETERS: object_name - Object name to be evaluated 335 * PARAMETERS: object_name - Object name to be evaluated
342 * device_node - Node for the device 336 * device_node - Node for the device
343 * Address - Where the value is returned 337 * Value - Where the value is returned
344 * 338 *
345 * RETURN: Status 339 * RETURN: Status
346 * 340 *
347 * DESCRIPTION: Evaluates a numeric namespace object for a selected device 341 * DESCRIPTION: Evaluates a numeric namespace object for a selected device
348 * and stores result in *Address. 342 * and stores result in *Value.
349 * 343 *
350 * NOTE: Internal function, no parameter validation 344 * NOTE: Internal function, no parameter validation
351 * 345 *
@@ -354,7 +348,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
354acpi_status 348acpi_status
355acpi_ut_evaluate_numeric_object(char *object_name, 349acpi_ut_evaluate_numeric_object(char *object_name,
356 struct acpi_namespace_node *device_node, 350 struct acpi_namespace_node *device_node,
357 acpi_integer * address) 351 acpi_integer *value)
358{ 352{
359 union acpi_operand_object *obj_desc; 353 union acpi_operand_object *obj_desc;
360 acpi_status status; 354 acpi_status status;
@@ -369,295 +363,7 @@ acpi_ut_evaluate_numeric_object(char *object_name,
369 363
370 /* Get the returned Integer */ 364 /* Get the returned Integer */
371 365
372 *address = obj_desc->integer.value; 366 *value = obj_desc->integer.value;
373
374 /* On exit, we must delete the return object */
375
376 acpi_ut_remove_reference(obj_desc);
377 return_ACPI_STATUS(status);
378}
379
380/*******************************************************************************
381 *
382 * FUNCTION: acpi_ut_copy_id_string
383 *
384 * PARAMETERS: Destination - Where to copy the string
385 * Source - Source string
386 * max_length - Length of the destination buffer
387 *
388 * RETURN: None
389 *
390 * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
391 * Performs removal of a leading asterisk if present -- workaround
392 * for a known issue on a bunch of machines.
393 *
394 ******************************************************************************/
395
396static void
397acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length)
398{
399
400 /*
401 * Workaround for ID strings that have a leading asterisk. This construct
402 * is not allowed by the ACPI specification (ID strings must be
403 * alphanumeric), but enough existing machines have this embedded in their
404 * ID strings that the following code is useful.
405 */
406 if (*source == '*') {
407 source++;
408 }
409
410 /* Do the actual copy */
411
412 ACPI_STRNCPY(destination, source, max_length);
413}
414
415/*******************************************************************************
416 *
417 * FUNCTION: acpi_ut_execute_HID
418 *
419 * PARAMETERS: device_node - Node for the device
420 * Hid - Where the HID is returned
421 *
422 * RETURN: Status
423 *
424 * DESCRIPTION: Executes the _HID control method that returns the hardware
425 * ID of the device.
426 *
427 * NOTE: Internal function, no parameter validation
428 *
429 ******************************************************************************/
430
431acpi_status
432acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
433 struct acpica_device_id *hid)
434{
435 union acpi_operand_object *obj_desc;
436 acpi_status status;
437
438 ACPI_FUNCTION_TRACE(ut_execute_HID);
439
440 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
441 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
442 &obj_desc);
443 if (ACPI_FAILURE(status)) {
444 return_ACPI_STATUS(status);
445 }
446
447 if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
448
449 /* Convert the Numeric HID to string */
450
451 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
452 hid->value);
453 } else {
454 /* Copy the String HID from the returned object */
455
456 acpi_ut_copy_id_string(hid->value, obj_desc->string.pointer,
457 sizeof(hid->value));
458 }
459
460 /* On exit, we must delete the return object */
461
462 acpi_ut_remove_reference(obj_desc);
463 return_ACPI_STATUS(status);
464}
465
466/*******************************************************************************
467 *
468 * FUNCTION: acpi_ut_translate_one_cid
469 *
470 * PARAMETERS: obj_desc - _CID object, must be integer or string
471 * one_cid - Where the CID string is returned
472 *
473 * RETURN: Status
474 *
475 * DESCRIPTION: Return a numeric or string _CID value as a string.
476 * (Compatible ID)
477 *
478 * NOTE: Assumes a maximum _CID string length of
479 * ACPI_MAX_CID_LENGTH.
480 *
481 ******************************************************************************/
482
483static acpi_status
484acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
485 struct acpi_compatible_id *one_cid)
486{
487
488 switch (obj_desc->common.type) {
489 case ACPI_TYPE_INTEGER:
490
491 /* Convert the Numeric CID to string */
492
493 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
494 one_cid->value);
495 return (AE_OK);
496
497 case ACPI_TYPE_STRING:
498
499 if (obj_desc->string.length > ACPI_MAX_CID_LENGTH) {
500 return (AE_AML_STRING_LIMIT);
501 }
502
503 /* Copy the String CID from the returned object */
504
505 acpi_ut_copy_id_string(one_cid->value, obj_desc->string.pointer,
506 ACPI_MAX_CID_LENGTH);
507 return (AE_OK);
508
509 default:
510
511 return (AE_TYPE);
512 }
513}
514
515/*******************************************************************************
516 *
517 * FUNCTION: acpi_ut_execute_CID
518 *
519 * PARAMETERS: device_node - Node for the device
520 * return_cid_list - Where the CID list is returned
521 *
522 * RETURN: Status
523 *
524 * DESCRIPTION: Executes the _CID control method that returns one or more
525 * compatible hardware IDs for the device.
526 *
527 * NOTE: Internal function, no parameter validation
528 *
529 ******************************************************************************/
530
531acpi_status
532acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
533 struct acpi_compatible_id_list ** return_cid_list)
534{
535 union acpi_operand_object *obj_desc;
536 acpi_status status;
537 u32 count;
538 u32 size;
539 struct acpi_compatible_id_list *cid_list;
540 u32 i;
541
542 ACPI_FUNCTION_TRACE(ut_execute_CID);
543
544 /* Evaluate the _CID method for this device */
545
546 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID,
547 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING
548 | ACPI_BTYPE_PACKAGE, &obj_desc);
549 if (ACPI_FAILURE(status)) {
550 return_ACPI_STATUS(status);
551 }
552
553 /* Get the number of _CIDs returned */
554
555 count = 1;
556 if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
557 count = obj_desc->package.count;
558 }
559
560 /* Allocate a worst-case buffer for the _CIDs */
561
562 size = (((count - 1) * sizeof(struct acpi_compatible_id)) +
563 sizeof(struct acpi_compatible_id_list));
564
565 cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size);
566 if (!cid_list) {
567 return_ACPI_STATUS(AE_NO_MEMORY);
568 }
569
570 /* Init CID list */
571
572 cid_list->count = count;
573 cid_list->size = size;
574
575 /*
576 * A _CID can return either a single compatible ID or a package of
577 * compatible IDs. Each compatible ID can be one of the following:
578 * 1) Integer (32 bit compressed EISA ID) or
579 * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss")
580 */
581
582 /* The _CID object can be either a single CID or a package (list) of CIDs */
583
584 if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
585
586 /* Translate each package element */
587
588 for (i = 0; i < count; i++) {
589 status =
590 acpi_ut_translate_one_cid(obj_desc->package.
591 elements[i],
592 &cid_list->id[i]);
593 if (ACPI_FAILURE(status)) {
594 break;
595 }
596 }
597 } else {
598 /* Only one CID, translate to a string */
599
600 status = acpi_ut_translate_one_cid(obj_desc, cid_list->id);
601 }
602
603 /* Cleanup on error */
604
605 if (ACPI_FAILURE(status)) {
606 ACPI_FREE(cid_list);
607 } else {
608 *return_cid_list = cid_list;
609 }
610
611 /* On exit, we must delete the _CID return object */
612
613 acpi_ut_remove_reference(obj_desc);
614 return_ACPI_STATUS(status);
615}
616
617/*******************************************************************************
618 *
619 * FUNCTION: acpi_ut_execute_UID
620 *
621 * PARAMETERS: device_node - Node for the device
622 * Uid - Where the UID is returned
623 *
624 * RETURN: Status
625 *
626 * DESCRIPTION: Executes the _UID control method that returns the hardware
627 * ID of the device.
628 *
629 * NOTE: Internal function, no parameter validation
630 *
631 ******************************************************************************/
632
633acpi_status
634acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
635 struct acpica_device_id *uid)
636{
637 union acpi_operand_object *obj_desc;
638 acpi_status status;
639
640 ACPI_FUNCTION_TRACE(ut_execute_UID);
641
642 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID,
643 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
644 &obj_desc);
645 if (ACPI_FAILURE(status)) {
646 return_ACPI_STATUS(status);
647 }
648
649 if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
650
651 /* Convert the Numeric UID to string */
652
653 acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
654 uid->value);
655 } else {
656 /* Copy the String UID from the returned object */
657
658 acpi_ut_copy_id_string(uid->value, obj_desc->string.pointer,
659 sizeof(uid->value));
660 }
661 367
662 /* On exit, we must delete the return object */ 368 /* On exit, we must delete the return object */
663 369
@@ -716,60 +422,64 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
716 422
717/******************************************************************************* 423/*******************************************************************************
718 * 424 *
719 * FUNCTION: acpi_ut_execute_Sxds 425 * FUNCTION: acpi_ut_execute_power_methods
720 * 426 *
721 * PARAMETERS: device_node - Node for the device 427 * PARAMETERS: device_node - Node for the device
722 * Flags - Where the status flags are returned 428 * method_names - Array of power method names
429 * method_count - Number of methods to execute
430 * out_values - Where the power method values are returned
723 * 431 *
724 * RETURN: Status 432 * RETURN: Status, out_values
725 * 433 *
726 * DESCRIPTION: Executes _STA for selected device and stores results in 434 * DESCRIPTION: Executes the specified power methods for the device and returns
727 * *Flags. 435 * the result(s).
728 * 436 *
729 * NOTE: Internal function, no parameter validation 437 * NOTE: Internal function, no parameter validation
730 * 438 *
731 ******************************************************************************/ 439******************************************************************************/
732 440
733acpi_status 441acpi_status
734acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) 442acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
443 const char **method_names,
444 u8 method_count, u8 *out_values)
735{ 445{
736 union acpi_operand_object *obj_desc; 446 union acpi_operand_object *obj_desc;
737 acpi_status status; 447 acpi_status status;
448 acpi_status final_status = AE_NOT_FOUND;
738 u32 i; 449 u32 i;
739 450
740 ACPI_FUNCTION_TRACE(ut_execute_sxds); 451 ACPI_FUNCTION_TRACE(ut_execute_power_methods);
741 452
742 for (i = 0; i < 4; i++) { 453 for (i = 0; i < method_count; i++) {
743 highest[i] = 0xFF; 454 /*
455 * Execute the power method (_sx_d or _sx_w). The only allowable
456 * return type is an Integer.
457 */
744 status = acpi_ut_evaluate_object(device_node, 458 status = acpi_ut_evaluate_object(device_node,
745 ACPI_CAST_PTR(char, 459 ACPI_CAST_PTR(char,
746 acpi_gbl_highest_dstate_names 460 method_names[i]),
747 [i]),
748 ACPI_BTYPE_INTEGER, &obj_desc); 461 ACPI_BTYPE_INTEGER, &obj_desc);
749 if (ACPI_FAILURE(status)) { 462 if (ACPI_SUCCESS(status)) {
750 if (status != AE_NOT_FOUND) { 463 out_values[i] = (u8)obj_desc->integer.value;
751 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
752 "%s on Device %4.4s, %s\n",
753 ACPI_CAST_PTR(char,
754 acpi_gbl_highest_dstate_names
755 [i]),
756 acpi_ut_get_node_name
757 (device_node),
758 acpi_format_exception
759 (status)));
760
761 return_ACPI_STATUS(status);
762 }
763 } else {
764 /* Extract the Dstate value */
765
766 highest[i] = (u8) obj_desc->integer.value;
767 464
768 /* Delete the return object */ 465 /* Delete the return object */
769 466
770 acpi_ut_remove_reference(obj_desc); 467 acpi_ut_remove_reference(obj_desc);
468 final_status = AE_OK; /* At least one value is valid */
469 continue;
771 } 470 }
471
472 out_values[i] = ACPI_UINT8_MAX;
473 if (status == AE_NOT_FOUND) {
474 continue; /* Ignore if not found */
475 }
476
477 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
478 "Failed %s on Device %4.4s, %s\n",
479 ACPI_CAST_PTR(char, method_names[i]),
480 acpi_ut_get_node_name(device_node),
481 acpi_format_exception(status)));
772 } 482 }
773 483
774 return_ACPI_STATUS(AE_OK); 484 return_ACPI_STATUS(final_status);
775} 485}
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 59e46f257c02..3f2c68f4e959 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -90,7 +90,15 @@ const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
90 "\\_S5_" 90 "\\_S5_"
91}; 91};
92 92
93const char *acpi_gbl_highest_dstate_names[4] = { 93const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = {
94 "_S0W",
95 "_S1W",
96 "_S2W",
97 "_S3W",
98 "_S4W"
99};
100
101const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
94 "_S1D", 102 "_S1D",
95 "_S2D", 103 "_S2D",
96 "_S3D", 104 "_S3D",
@@ -351,6 +359,7 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
351 "SMBus", 359 "SMBus",
352 "SystemCMOS", 360 "SystemCMOS",
353 "PCIBARTarget", 361 "PCIBARTarget",
362 "IPMI",
354 "DataTable" 363 "DataTable"
355}; 364};
356 365
@@ -798,6 +807,7 @@ acpi_status acpi_ut_init_globals(void)
798 807
799 /* Namespace */ 808 /* Namespace */
800 809
810 acpi_gbl_module_code_list = NULL;
801 acpi_gbl_root_node = NULL; 811 acpi_gbl_root_node = NULL;
802 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; 812 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
803 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; 813 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
new file mode 100644
index 000000000000..52eaae404554
--- /dev/null
+++ b/drivers/acpi/acpica/utids.c
@@ -0,0 +1,382 @@
1/******************************************************************************
2 *
3 * Module Name: utids - support for device IDs - HID, UID, CID
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2009, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acinterp.h"
47
48#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("utids")
50
51/* Local prototypes */
52static void acpi_ut_copy_id_string(char *destination, char *source);
53
54/*******************************************************************************
55 *
56 * FUNCTION: acpi_ut_copy_id_string
57 *
58 * PARAMETERS: Destination - Where to copy the string
59 * Source - Source string
60 *
61 * RETURN: None
62 *
63 * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
64 * Performs removal of a leading asterisk if present -- workaround
65 * for a known issue on a bunch of machines.
66 *
67 ******************************************************************************/
68
69static void acpi_ut_copy_id_string(char *destination, char *source)
70{
71
72 /*
73 * Workaround for ID strings that have a leading asterisk. This construct
74 * is not allowed by the ACPI specification (ID strings must be
75 * alphanumeric), but enough existing machines have this embedded in their
76 * ID strings that the following code is useful.
77 */
78 if (*source == '*') {
79 source++;
80 }
81
82 /* Do the actual copy */
83
84 ACPI_STRCPY(destination, source);
85}
86
87/*******************************************************************************
88 *
89 * FUNCTION: acpi_ut_execute_HID
90 *
91 * PARAMETERS: device_node - Node for the device
92 * return_id - Where the string HID is returned
93 *
94 * RETURN: Status
95 *
96 * DESCRIPTION: Executes the _HID control method that returns the hardware
97 * ID of the device. The HID is either an 32-bit encoded EISAID
98 * Integer or a String. A string is always returned. An EISAID
99 * is converted to a string.
100 *
101 * NOTE: Internal function, no parameter validation
102 *
103 ******************************************************************************/
104
105acpi_status
106acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
107 struct acpica_device_id **return_id)
108{
109 union acpi_operand_object *obj_desc;
110 struct acpica_device_id *hid;
111 u32 length;
112 acpi_status status;
113
114 ACPI_FUNCTION_TRACE(ut_execute_HID);
115
116 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
117 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
118 &obj_desc);
119 if (ACPI_FAILURE(status)) {
120 return_ACPI_STATUS(status);
121 }
122
123 /* Get the size of the String to be returned, includes null terminator */
124
125 if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
126 length = ACPI_EISAID_STRING_SIZE;
127 } else {
128 length = obj_desc->string.length + 1;
129 }
130
131 /* Allocate a buffer for the HID */
132
133 hid =
134 ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) +
135 (acpi_size) length);
136 if (!hid) {
137 status = AE_NO_MEMORY;
138 goto cleanup;
139 }
140
141 /* Area for the string starts after DEVICE_ID struct */
142
143 hid->string = ACPI_ADD_PTR(char, hid, sizeof(struct acpica_device_id));
144
145 /* Convert EISAID to a string or simply copy existing string */
146
147 if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
148 acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value);
149 } else {
150 acpi_ut_copy_id_string(hid->string, obj_desc->string.pointer);
151 }
152
153 hid->length = length;
154 *return_id = hid;
155
156cleanup:
157
158 /* On exit, we must delete the return object */
159
160 acpi_ut_remove_reference(obj_desc);
161 return_ACPI_STATUS(status);
162}
163
164/*******************************************************************************
165 *
166 * FUNCTION: acpi_ut_execute_UID
167 *
168 * PARAMETERS: device_node - Node for the device
169 * return_id - Where the string UID is returned
170 *
171 * RETURN: Status
172 *
173 * DESCRIPTION: Executes the _UID control method that returns the unique
174 * ID of the device. The UID is either a 64-bit Integer (NOT an
175 * EISAID) or a string. Always returns a string. A 64-bit integer
176 * is converted to a decimal string.
177 *
178 * NOTE: Internal function, no parameter validation
179 *
180 ******************************************************************************/
181
182acpi_status
183acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
184 struct acpica_device_id **return_id)
185{
186 union acpi_operand_object *obj_desc;
187 struct acpica_device_id *uid;
188 u32 length;
189 acpi_status status;
190
191 ACPI_FUNCTION_TRACE(ut_execute_UID);
192
193 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID,
194 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
195 &obj_desc);
196 if (ACPI_FAILURE(status)) {
197 return_ACPI_STATUS(status);
198 }
199
200 /* Get the size of the String to be returned, includes null terminator */
201
202 if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
203 length = ACPI_MAX64_DECIMAL_DIGITS + 1;
204 } else {
205 length = obj_desc->string.length + 1;
206 }
207
208 /* Allocate a buffer for the UID */
209
210 uid =
211 ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) +
212 (acpi_size) length);
213 if (!uid) {
214 status = AE_NO_MEMORY;
215 goto cleanup;
216 }
217
218 /* Area for the string starts after DEVICE_ID struct */
219
220 uid->string = ACPI_ADD_PTR(char, uid, sizeof(struct acpica_device_id));
221
222 /* Convert an Integer to string, or just copy an existing string */
223
224 if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
225 acpi_ex_integer_to_string(uid->string, obj_desc->integer.value);
226 } else {
227 acpi_ut_copy_id_string(uid->string, obj_desc->string.pointer);
228 }
229
230 uid->length = length;
231 *return_id = uid;
232
233cleanup:
234
235 /* On exit, we must delete the return object */
236
237 acpi_ut_remove_reference(obj_desc);
238 return_ACPI_STATUS(status);
239}
240
241/*******************************************************************************
242 *
243 * FUNCTION: acpi_ut_execute_CID
244 *
245 * PARAMETERS: device_node - Node for the device
246 * return_cid_list - Where the CID list is returned
247 *
248 * RETURN: Status, list of CID strings
249 *
250 * DESCRIPTION: Executes the _CID control method that returns one or more
251 * compatible hardware IDs for the device.
252 *
253 * NOTE: Internal function, no parameter validation
254 *
255 * A _CID method can return either a single compatible ID or a package of
256 * compatible IDs. Each compatible ID can be one of the following:
257 * 1) Integer (32 bit compressed EISA ID) or
258 * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss")
259 *
260 * The Integer CIDs are converted to string format by this function.
261 *
262 ******************************************************************************/
263
264acpi_status
265acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
266 struct acpica_device_id_list **return_cid_list)
267{
268 union acpi_operand_object **cid_objects;
269 union acpi_operand_object *obj_desc;
270 struct acpica_device_id_list *cid_list;
271 char *next_id_string;
272 u32 string_area_size;
273 u32 length;
274 u32 cid_list_size;
275 acpi_status status;
276 u32 count;
277 u32 i;
278
279 ACPI_FUNCTION_TRACE(ut_execute_CID);
280
281 /* Evaluate the _CID method for this device */
282
283 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID,
284 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING
285 | ACPI_BTYPE_PACKAGE, &obj_desc);
286 if (ACPI_FAILURE(status)) {
287 return_ACPI_STATUS(status);
288 }
289
290 /*
291 * Get the count and size of the returned _CIDs. _CID can return either
292 * a Package of Integers/Strings or a single Integer or String.
293 * Note: This section also validates that all CID elements are of the
294 * correct type (Integer or String).
295 */
296 if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
297 count = obj_desc->package.count;
298 cid_objects = obj_desc->package.elements;
299 } else { /* Single Integer or String CID */
300
301 count = 1;
302 cid_objects = &obj_desc;
303 }
304
305 string_area_size = 0;
306 for (i = 0; i < count; i++) {
307
308 /* String lengths include null terminator */
309
310 switch (cid_objects[i]->common.type) {
311 case ACPI_TYPE_INTEGER:
312 string_area_size += ACPI_EISAID_STRING_SIZE;
313 break;
314
315 case ACPI_TYPE_STRING:
316 string_area_size += cid_objects[i]->string.length + 1;
317 break;
318
319 default:
320 status = AE_TYPE;
321 goto cleanup;
322 }
323 }
324
325 /*
326 * Now that we know the length of the CIDs, allocate return buffer:
327 * 1) Size of the base structure +
328 * 2) Size of the CID DEVICE_ID array +
329 * 3) Size of the actual CID strings
330 */
331 cid_list_size = sizeof(struct acpica_device_id_list) +
332 ((count - 1) * sizeof(struct acpica_device_id)) + string_area_size;
333
334 cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size);
335 if (!cid_list) {
336 status = AE_NO_MEMORY;
337 goto cleanup;
338 }
339
340 /* Area for CID strings starts after the CID DEVICE_ID array */
341
342 next_id_string = ACPI_CAST_PTR(char, cid_list->ids) +
343 ((acpi_size) count * sizeof(struct acpica_device_id));
344
345 /* Copy/convert the CIDs to the return buffer */
346
347 for (i = 0; i < count; i++) {
348 if (cid_objects[i]->common.type == ACPI_TYPE_INTEGER) {
349
350 /* Convert the Integer (EISAID) CID to a string */
351
352 acpi_ex_eisa_id_to_string(next_id_string,
353 cid_objects[i]->integer.
354 value);
355 length = ACPI_EISAID_STRING_SIZE;
356 } else { /* ACPI_TYPE_STRING */
357
358 /* Copy the String CID from the returned object */
359
360 acpi_ut_copy_id_string(next_id_string,
361 cid_objects[i]->string.pointer);
362 length = cid_objects[i]->string.length + 1;
363 }
364
365 cid_list->ids[i].string = next_id_string;
366 cid_list->ids[i].length = length;
367 next_id_string += length;
368 }
369
370 /* Finish the CID list */
371
372 cid_list->count = count;
373 cid_list->list_size = cid_list_size;
374 *return_cid_list = cid_list;
375
376cleanup:
377
378 /* On exit, we must delete the _CID return object */
379
380 acpi_ut_remove_reference(obj_desc);
381 return_ACPI_STATUS(status);
382}
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c
index a54ca84eb362..9d0919ebf7b0 100644
--- a/drivers/acpi/acpica/utinit.c
+++ b/drivers/acpi/acpica/utinit.c
@@ -99,33 +99,19 @@ static void acpi_ut_terminate(void)
99 * 99 *
100 * FUNCTION: acpi_ut_subsystem_shutdown 100 * FUNCTION: acpi_ut_subsystem_shutdown
101 * 101 *
102 * PARAMETERS: none 102 * PARAMETERS: None
103 * 103 *
104 * RETURN: none 104 * RETURN: None
105 * 105 *
106 * DESCRIPTION: Shutdown the various subsystems. Don't delete the mutex 106 * DESCRIPTION: Shutdown the various components. Do not delete the mutex
107 * objects here -- because the AML debugger may be still running. 107 * objects here, because the AML debugger may be still running.
108 * 108 *
109 ******************************************************************************/ 109 ******************************************************************************/
110 110
111void acpi_ut_subsystem_shutdown(void) 111void acpi_ut_subsystem_shutdown(void)
112{ 112{
113
114 ACPI_FUNCTION_TRACE(ut_subsystem_shutdown); 113 ACPI_FUNCTION_TRACE(ut_subsystem_shutdown);
115 114
116 /* Just exit if subsystem is already shutdown */
117
118 if (acpi_gbl_shutdown) {
119 ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
120 return_VOID;
121 }
122
123 /* Subsystem appears active, go ahead and shut it down */
124
125 acpi_gbl_shutdown = TRUE;
126 acpi_gbl_startup_flags = 0;
127 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
128
129#ifndef ACPI_ASL_COMPILER 115#ifndef ACPI_ASL_COMPILER
130 116
131 /* Close the acpi_event Handling */ 117 /* Close the acpi_event Handling */
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index fbe782348b0b..61f6315fce9f 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -50,6 +50,11 @@
50#define _COMPONENT ACPI_UTILITIES 50#define _COMPONENT ACPI_UTILITIES
51ACPI_MODULE_NAME("utmisc") 51ACPI_MODULE_NAME("utmisc")
52 52
53/*
54 * Common suffix for messages
55 */
56#define ACPI_COMMON_MSG_SUFFIX \
57 acpi_os_printf(" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
53/******************************************************************************* 58/*******************************************************************************
54 * 59 *
55 * FUNCTION: acpi_ut_validate_exception 60 * FUNCTION: acpi_ut_validate_exception
@@ -120,6 +125,34 @@ const char *acpi_ut_validate_exception(acpi_status status)
120 125
121/******************************************************************************* 126/*******************************************************************************
122 * 127 *
128 * FUNCTION: acpi_ut_is_pci_root_bridge
129 *
130 * PARAMETERS: Id - The HID/CID in string format
131 *
132 * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge
133 *
134 * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID.
135 *
136 ******************************************************************************/
137
138u8 acpi_ut_is_pci_root_bridge(char *id)
139{
140
141 /*
142 * Check if this is a PCI root bridge.
143 * ACPI 3.0+: check for a PCI Express root also.
144 */
145 if (!(ACPI_STRCMP(id,
146 PCI_ROOT_HID_STRING)) ||
147 !(ACPI_STRCMP(id, PCI_EXPRESS_ROOT_HID_STRING))) {
148 return (TRUE);
149 }
150
151 return (FALSE);
152}
153
154/*******************************************************************************
155 *
123 * FUNCTION: acpi_ut_is_aml_table 156 * FUNCTION: acpi_ut_is_aml_table
124 * 157 *
125 * PARAMETERS: Table - An ACPI table 158 * PARAMETERS: Table - An ACPI table
@@ -1037,8 +1070,7 @@ acpi_error(const char *module_name, u32 line_number, const char *format, ...)
1037 1070
1038 va_start(args, format); 1071 va_start(args, format);
1039 acpi_os_vprintf(format, args); 1072 acpi_os_vprintf(format, args);
1040 acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION, module_name, 1073 ACPI_COMMON_MSG_SUFFIX;
1041 line_number);
1042 va_end(args); 1074 va_end(args);
1043} 1075}
1044 1076
@@ -1052,8 +1084,7 @@ acpi_exception(const char *module_name,
1052 1084
1053 va_start(args, format); 1085 va_start(args, format);
1054 acpi_os_vprintf(format, args); 1086 acpi_os_vprintf(format, args);
1055 acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION, module_name, 1087 ACPI_COMMON_MSG_SUFFIX;
1056 line_number);
1057 va_end(args); 1088 va_end(args);
1058} 1089}
1059 1090
@@ -1066,8 +1097,7 @@ acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
1066 1097
1067 va_start(args, format); 1098 va_start(args, format);
1068 acpi_os_vprintf(format, args); 1099 acpi_os_vprintf(format, args);
1069 acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION, module_name, 1100 ACPI_COMMON_MSG_SUFFIX;
1070 line_number);
1071 va_end(args); 1101 va_end(args);
1072} 1102}
1073 1103
@@ -1088,3 +1118,46 @@ ACPI_EXPORT_SYMBOL(acpi_error)
1088ACPI_EXPORT_SYMBOL(acpi_exception) 1118ACPI_EXPORT_SYMBOL(acpi_exception)
1089ACPI_EXPORT_SYMBOL(acpi_warning) 1119ACPI_EXPORT_SYMBOL(acpi_warning)
1090ACPI_EXPORT_SYMBOL(acpi_info) 1120ACPI_EXPORT_SYMBOL(acpi_info)
1121
1122/*******************************************************************************
1123 *
1124 * FUNCTION: acpi_ut_predefined_warning
1125 *
1126 * PARAMETERS: module_name - Caller's module name (for error output)
1127 * line_number - Caller's line number (for error output)
1128 * Pathname - Full pathname to the node
1129 * node_flags - From Namespace node for the method/object
1130 * Format - Printf format string + additional args
1131 *
1132 * RETURN: None
1133 *
1134 * DESCRIPTION: Warnings for the predefined validation module. Messages are
1135 * only emitted the first time a problem with a particular
1136 * method/object is detected. This prevents a flood of error
1137 * messages for methods that are repeatedly evaluated.
1138 *
1139******************************************************************************/
1140
1141void ACPI_INTERNAL_VAR_XFACE
1142acpi_ut_predefined_warning(const char *module_name,
1143 u32 line_number,
1144 char *pathname,
1145 u8 node_flags, const char *format, ...)
1146{
1147 va_list args;
1148
1149 /*
1150 * Warning messages for this method/object will be disabled after the
1151 * first time a validation fails or an object is successfully repaired.
1152 */
1153 if (node_flags & ANOBJ_EVALUATED) {
1154 return;
1155 }
1156
1157 acpi_os_printf("ACPI Warning for %s: ", pathname);
1158
1159 va_start(args, format);
1160 acpi_os_vprintf(format, args);
1161 ACPI_COMMON_MSG_SUFFIX;
1162 va_end(args);
1163}
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 078a22728c6b..b1f5f680bc78 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -251,6 +251,16 @@ acpi_status acpi_initialize_objects(u32 flags)
251 } 251 }
252 252
253 /* 253 /*
254 * Execute any module-level code that was detected during the table load
255 * phase. Although illegal since ACPI 2.0, there are many machines that
256 * contain this type of code. Each block of detected executable AML code
257 * outside of any control method is wrapped with a temporary control
258 * method object and placed on a global list. The methods on this list
259 * are executed below.
260 */
261 acpi_ns_exec_module_code_list();
262
263 /*
254 * Initialize the objects that remain uninitialized. This runs the 264 * Initialize the objects that remain uninitialized. This runs the
255 * executable AML that may be part of the declaration of these objects: 265 * executable AML that may be part of the declaration of these objects:
256 * operation_regions, buffer_fields, Buffers, and Packages. 266 * operation_regions, buffer_fields, Buffers, and Packages.
@@ -318,7 +328,7 @@ ACPI_EXPORT_SYMBOL(acpi_initialize_objects)
318 * 328 *
319 * RETURN: Status 329 * RETURN: Status
320 * 330 *
321 * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. 331 * DESCRIPTION: Shutdown the ACPICA subsystem and release all resources.
322 * 332 *
323 ******************************************************************************/ 333 ******************************************************************************/
324acpi_status acpi_terminate(void) 334acpi_status acpi_terminate(void)
@@ -327,6 +337,19 @@ acpi_status acpi_terminate(void)
327 337
328 ACPI_FUNCTION_TRACE(acpi_terminate); 338 ACPI_FUNCTION_TRACE(acpi_terminate);
329 339
340 /* Just exit if subsystem is already shutdown */
341
342 if (acpi_gbl_shutdown) {
343 ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
344 return_ACPI_STATUS(AE_OK);
345 }
346
347 /* Subsystem appears active, go ahead and shut it down */
348
349 acpi_gbl_shutdown = TRUE;
350 acpi_gbl_startup_flags = 0;
351 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
352
330 /* Terminate the AML Debugger if present */ 353 /* Terminate the AML Debugger if present */
331 354
332 ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE); 355 ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE);
@@ -353,6 +376,7 @@ acpi_status acpi_terminate(void)
353} 376}
354 377
355ACPI_EXPORT_SYMBOL(acpi_terminate) 378ACPI_EXPORT_SYMBOL(acpi_terminate)
379
356#ifndef ACPI_ASL_COMPILER 380#ifndef ACPI_ASL_COMPILER
357#ifdef ACPI_FUTURE_USAGE 381#ifdef ACPI_FUTURE_USAGE
358/******************************************************************************* 382/*******************************************************************************
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 2876fc70c3a9..620183f13e5e 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -141,7 +141,7 @@ int acpi_bus_get_status(struct acpi_device *device)
141EXPORT_SYMBOL(acpi_bus_get_status); 141EXPORT_SYMBOL(acpi_bus_get_status);
142 142
143void acpi_bus_private_data_handler(acpi_handle handle, 143void acpi_bus_private_data_handler(acpi_handle handle,
144 u32 function, void *context) 144 void *context)
145{ 145{
146 return; 146 return;
147} 147}
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 5f2c3c00a315..642bb305cb65 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -202,20 +202,17 @@ container_walk_namespace_cb(acpi_handle handle,
202 u32 lvl, void *context, void **rv) 202 u32 lvl, void *context, void **rv)
203{ 203{
204 char *hid = NULL; 204 char *hid = NULL;
205 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
206 struct acpi_device_info *info; 205 struct acpi_device_info *info;
207 acpi_status status; 206 acpi_status status;
208 int *action = context; 207 int *action = context;
209 208
210 209 status = acpi_get_object_info(handle, &info);
211 status = acpi_get_object_info(handle, &buffer); 210 if (ACPI_FAILURE(status)) {
212 if (ACPI_FAILURE(status) || !buffer.pointer) {
213 return AE_OK; 211 return AE_OK;
214 } 212 }
215 213
216 info = buffer.pointer;
217 if (info->valid & ACPI_VALID_HID) 214 if (info->valid & ACPI_VALID_HID)
218 hid = info->hardware_id.value; 215 hid = info->hardware_id.string;
219 216
220 if (hid == NULL) { 217 if (hid == NULL) {
221 goto end; 218 goto end;
@@ -242,7 +239,7 @@ container_walk_namespace_cb(acpi_handle handle,
242 } 239 }
243 240
244 end: 241 end:
245 kfree(buffer.pointer); 242 kfree(info);
246 243
247 return AE_OK; 244 return AE_OK;
248} 245}
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 9a855669ff12..3a2cfefc71ab 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -233,18 +233,16 @@ static int is_ata(acpi_handle handle)
233static int is_battery(acpi_handle handle) 233static int is_battery(acpi_handle handle)
234{ 234{
235 struct acpi_device_info *info; 235 struct acpi_device_info *info;
236 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
237 int ret = 1; 236 int ret = 1;
238 237
239 if (!ACPI_SUCCESS(acpi_get_object_info(handle, &buffer))) 238 if (!ACPI_SUCCESS(acpi_get_object_info(handle, &info)))
240 return 0; 239 return 0;
241 info = buffer.pointer;
242 if (!(info->valid & ACPI_VALID_HID)) 240 if (!(info->valid & ACPI_VALID_HID))
243 ret = 0; 241 ret = 0;
244 else 242 else
245 ret = !strcmp("PNP0C0A", info->hardware_id.value); 243 ret = !strcmp("PNP0C0A", info->hardware_id.string);
246 244
247 kfree(buffer.pointer); 245 kfree(info);
248 return ret; 246 return ret;
249} 247}
250 248
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index dc36a448de43..c6645f26224b 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -95,15 +95,13 @@ do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv)
95{ 95{
96 acpi_status status; 96 acpi_status status;
97 struct acpi_device_info *info; 97 struct acpi_device_info *info;
98 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
99 struct acpi_find_child *find = context; 98 struct acpi_find_child *find = context;
100 99
101 status = acpi_get_object_info(handle, &buffer); 100 status = acpi_get_object_info(handle, &info);
102 if (ACPI_SUCCESS(status)) { 101 if (ACPI_SUCCESS(status)) {
103 info = buffer.pointer;
104 if (info->address == find->address) 102 if (info->address == find->address)
105 find->handle = handle; 103 find->handle = handle;
106 kfree(buffer.pointer); 104 kfree(info);
107 } 105 }
108 return AE_OK; 106 return AE_OK;
109} 107}
@@ -123,7 +121,7 @@ EXPORT_SYMBOL(acpi_get_child);
123 121
124/* Link ACPI devices with physical devices */ 122/* Link ACPI devices with physical devices */
125static void acpi_glue_data_handler(acpi_handle handle, 123static void acpi_glue_data_handler(acpi_handle handle,
126 u32 function, void *context) 124 void *context)
127{ 125{
128 /* we provide an empty handler */ 126 /* we provide an empty handler */
129} 127}
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5699d979596d..297d8b94fbbc 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -60,13 +60,13 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias,
60 } 60 }
61 61
62 if (acpi_dev->flags.compatible_ids) { 62 if (acpi_dev->flags.compatible_ids) {
63 struct acpi_compatible_id_list *cid_list; 63 struct acpica_device_id_list *cid_list;
64 int i; 64 int i;
65 65
66 cid_list = acpi_dev->pnp.cid_list; 66 cid_list = acpi_dev->pnp.cid_list;
67 for (i = 0; i < cid_list->count; i++) { 67 for (i = 0; i < cid_list->count; i++) {
68 count = snprintf(&modalias[len], size, "%s:", 68 count = snprintf(&modalias[len], size, "%s:",
69 cid_list->id[i].value); 69 cid_list->ids[i].string);
70 if (count < 0 || count >= size) { 70 if (count < 0 || count >= size) {
71 printk(KERN_ERR PREFIX "%s cid[%i] exceeds event buffer size", 71 printk(KERN_ERR PREFIX "%s cid[%i] exceeds event buffer size",
72 acpi_dev->pnp.device_name, i); 72 acpi_dev->pnp.device_name, i);
@@ -287,14 +287,14 @@ int acpi_match_device_ids(struct acpi_device *device,
287 } 287 }
288 288
289 if (device->flags.compatible_ids) { 289 if (device->flags.compatible_ids) {
290 struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; 290 struct acpica_device_id_list *cid_list = device->pnp.cid_list;
291 int i; 291 int i;
292 292
293 for (id = ids; id->id[0]; id++) { 293 for (id = ids; id->id[0]; id++) {
294 /* compare multiple _CID entries against driver ids */ 294 /* compare multiple _CID entries against driver ids */
295 for (i = 0; i < cid_list->count; i++) { 295 for (i = 0; i < cid_list->count; i++) {
296 if (!strcmp((char*)id->id, 296 if (!strcmp((char*)id->id,
297 cid_list->id[i].value)) 297 cid_list->ids[i].string))
298 return 0; 298 return 0;
299 } 299 }
300 } 300 }
@@ -309,6 +309,10 @@ static void acpi_device_release(struct device *dev)
309 struct acpi_device *acpi_dev = to_acpi_device(dev); 309 struct acpi_device *acpi_dev = to_acpi_device(dev);
310 310
311 kfree(acpi_dev->pnp.cid_list); 311 kfree(acpi_dev->pnp.cid_list);
312 if (acpi_dev->flags.hardware_id)
313 kfree(acpi_dev->pnp.hardware_id);
314 if (acpi_dev->flags.unique_id)
315 kfree(acpi_dev->pnp.unique_id);
312 kfree(acpi_dev); 316 kfree(acpi_dev);
313} 317}
314 318
@@ -687,7 +691,7 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd)
687} 691}
688EXPORT_SYMBOL_GPL(acpi_bus_get_ejd); 692EXPORT_SYMBOL_GPL(acpi_bus_get_ejd);
689 693
690void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) 694void acpi_bus_data_handler(acpi_handle handle, void *context)
691{ 695{
692 696
693 /* TBD */ 697 /* TBD */
@@ -1000,33 +1004,89 @@ static int acpi_dock_match(struct acpi_device *device)
1000 return acpi_get_handle(device->handle, "_DCK", &tmp); 1004 return acpi_get_handle(device->handle, "_DCK", &tmp);
1001} 1005}
1002 1006
1007static struct acpica_device_id_list*
1008acpi_add_cid(
1009 struct acpi_device_info *info,
1010 struct acpica_device_id *new_cid)
1011{
1012 struct acpica_device_id_list *cid;
1013 char *next_id_string;
1014 acpi_size cid_length;
1015 acpi_size new_cid_length;
1016 u32 i;
1017
1018
1019 /* Allocate new CID list with room for the new CID */
1020
1021 if (!new_cid)
1022 new_cid_length = info->compatible_id_list.list_size;
1023 else if (info->compatible_id_list.list_size)
1024 new_cid_length = info->compatible_id_list.list_size +
1025 new_cid->length + sizeof(struct acpica_device_id);
1026 else
1027 new_cid_length = sizeof(struct acpica_device_id_list) + new_cid->length;
1028
1029 cid = ACPI_ALLOCATE_ZEROED(new_cid_length);
1030 if (!cid) {
1031 return NULL;
1032 }
1033
1034 cid->list_size = new_cid_length;
1035 cid->count = info->compatible_id_list.count;
1036 if (new_cid)
1037 cid->count++;
1038 next_id_string = (char *) cid->ids + (cid->count * sizeof(struct acpica_device_id));
1039
1040 /* Copy all existing CIDs */
1041
1042 for (i = 0; i < info->compatible_id_list.count; i++) {
1043 cid_length = info->compatible_id_list.ids[i].length;
1044 cid->ids[i].string = next_id_string;
1045 cid->ids[i].length = cid_length;
1046
1047 ACPI_MEMCPY(next_id_string, info->compatible_id_list.ids[i].string,
1048 cid_length);
1049
1050 next_id_string += cid_length;
1051 }
1052
1053 /* Append the new CID */
1054
1055 if (new_cid) {
1056 cid->ids[i].string = next_id_string;
1057 cid->ids[i].length = new_cid->length;
1058
1059 ACPI_MEMCPY(next_id_string, new_cid->string, new_cid->length);
1060 }
1061
1062 return cid;
1063}
1064
1003static void acpi_device_set_id(struct acpi_device *device, 1065static void acpi_device_set_id(struct acpi_device *device,
1004 struct acpi_device *parent, acpi_handle handle, 1066 struct acpi_device *parent, acpi_handle handle,
1005 int type) 1067 int type)
1006{ 1068{
1007 struct acpi_device_info *info; 1069 struct acpi_device_info *info = NULL;
1008 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
1009 char *hid = NULL; 1070 char *hid = NULL;
1010 char *uid = NULL; 1071 char *uid = NULL;
1011 struct acpi_compatible_id_list *cid_list = NULL; 1072 struct acpica_device_id_list *cid_list = NULL;
1012 const char *cid_add = NULL; 1073 char *cid_add = NULL;
1013 acpi_status status; 1074 acpi_status status;
1014 1075
1015 switch (type) { 1076 switch (type) {
1016 case ACPI_BUS_TYPE_DEVICE: 1077 case ACPI_BUS_TYPE_DEVICE:
1017 status = acpi_get_object_info(handle, &buffer); 1078 status = acpi_get_object_info(handle, &info);
1018 if (ACPI_FAILURE(status)) { 1079 if (ACPI_FAILURE(status)) {
1019 printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); 1080 printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__);
1020 return; 1081 return;
1021 } 1082 }
1022 1083
1023 info = buffer.pointer;
1024 if (info->valid & ACPI_VALID_HID) 1084 if (info->valid & ACPI_VALID_HID)
1025 hid = info->hardware_id.value; 1085 hid = info->hardware_id.string;
1026 if (info->valid & ACPI_VALID_UID) 1086 if (info->valid & ACPI_VALID_UID)
1027 uid = info->unique_id.value; 1087 uid = info->unique_id.string;
1028 if (info->valid & ACPI_VALID_CID) 1088 if (info->valid & ACPI_VALID_CID)
1029 cid_list = &info->compatibility_id; 1089 cid_list = &info->compatible_id_list;
1030 if (info->valid & ACPI_VALID_ADR) { 1090 if (info->valid & ACPI_VALID_ADR) {
1031 device->pnp.bus_address = info->address; 1091 device->pnp.bus_address = info->address;
1032 device->flags.bus_address = 1; 1092 device->flags.bus_address = 1;
@@ -1077,55 +1137,46 @@ static void acpi_device_set_id(struct acpi_device *device,
1077 } 1137 }
1078 1138
1079 if (hid) { 1139 if (hid) {
1080 strcpy(device->pnp.hardware_id, hid); 1140 device->pnp.hardware_id = ACPI_ALLOCATE_ZEROED(strlen (hid) + 1);
1081 device->flags.hardware_id = 1; 1141 if (device->pnp.hardware_id) {
1142 strcpy(device->pnp.hardware_id, hid);
1143 device->flags.hardware_id = 1;
1144 }
1082 } 1145 }
1146 if (!device->flags.hardware_id)
1147 device->pnp.hardware_id = "";
1148
1083 if (uid) { 1149 if (uid) {
1084 strcpy(device->pnp.unique_id, uid); 1150 device->pnp.unique_id = ACPI_ALLOCATE_ZEROED(strlen (uid) + 1);
1085 device->flags.unique_id = 1; 1151 if (device->pnp.unique_id) {
1152 strcpy(device->pnp.unique_id, uid);
1153 device->flags.unique_id = 1;
1154 }
1086 } 1155 }
1156 if (!device->flags.unique_id)
1157 device->pnp.unique_id = "";
1158
1087 if (cid_list || cid_add) { 1159 if (cid_list || cid_add) {
1088 struct acpi_compatible_id_list *list; 1160 struct acpica_device_id_list *list;
1089 int size = 0; 1161
1090 int count = 0; 1162 if (cid_add) {
1091 1163 struct acpica_device_id cid;
1092 if (cid_list) { 1164 cid.length = strlen (cid_add) + 1;
1093 size = cid_list->size; 1165 cid.string = cid_add;
1094 } else if (cid_add) { 1166
1095 size = sizeof(struct acpi_compatible_id_list); 1167 list = acpi_add_cid(info, &cid);
1096 cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); 1168 } else {
1097 if (!cid_list) { 1169 list = acpi_add_cid(info, NULL);
1098 printk(KERN_ERR "Memory allocation error\n");
1099 kfree(buffer.pointer);
1100 return;
1101 } else {
1102 cid_list->count = 0;
1103 cid_list->size = size;
1104 }
1105 } 1170 }
1106 if (cid_add)
1107 size += sizeof(struct acpi_compatible_id);
1108 list = kmalloc(size, GFP_KERNEL);
1109 1171
1110 if (list) { 1172 if (list) {
1111 if (cid_list) {
1112 memcpy(list, cid_list, cid_list->size);
1113 count = cid_list->count;
1114 }
1115 if (cid_add) {
1116 strncpy(list->id[count].value, cid_add,
1117 ACPI_MAX_CID_LENGTH);
1118 count++;
1119 device->flags.compatible_ids = 1;
1120 }
1121 list->size = size;
1122 list->count = count;
1123 device->pnp.cid_list = list; 1173 device->pnp.cid_list = list;
1124 } else 1174 if (cid_add)
1125 printk(KERN_ERR PREFIX "Memory allocation error\n"); 1175 device->flags.compatible_ids = 1;
1176 }
1126 } 1177 }
1127 1178
1128 kfree(buffer.pointer); 1179 kfree(info);
1129} 1180}
1130 1181
1131static int acpi_device_set_context(struct acpi_device *device, int type) 1182static int acpi_device_set_context(struct acpi_device *device, int type)
@@ -1310,10 +1361,8 @@ acpi_add_single_object(struct acpi_device **child,
1310end: 1361end:
1311 if (!result) 1362 if (!result)
1312 *child = device; 1363 *child = device;
1313 else { 1364 else
1314 kfree(device->pnp.cid_list); 1365 acpi_device_release(&device->dev);
1315 kfree(device);
1316 }
1317 1366
1318 return result; 1367 return result;
1319} 1368}
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
index 501e293e5ad0..9047b2714653 100644
--- a/drivers/char/agp/hp-agp.c
+++ b/drivers/char/agp/hp-agp.c
@@ -476,7 +476,6 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret)
476{ 476{
477 acpi_handle handle, parent; 477 acpi_handle handle, parent;
478 acpi_status status; 478 acpi_status status;
479 struct acpi_buffer buffer;
480 struct acpi_device_info *info; 479 struct acpi_device_info *info;
481 u64 lba_hpa, sba_hpa, length; 480 u64 lba_hpa, sba_hpa, length;
482 int match; 481 int match;
@@ -488,13 +487,11 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret)
488 /* Look for an enclosing IOC scope and find its CSR space */ 487 /* Look for an enclosing IOC scope and find its CSR space */
489 handle = obj; 488 handle = obj;
490 do { 489 do {
491 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; 490 status = acpi_get_object_info(handle, &info);
492 status = acpi_get_object_info(handle, &buffer);
493 if (ACPI_SUCCESS(status)) { 491 if (ACPI_SUCCESS(status)) {
494 /* TBD check _CID also */ 492 /* TBD check _CID also */
495 info = buffer.pointer; 493 info->hardware_id.string[sizeof(info->hardware_id.length)-1] = '\0';
496 info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; 494 match = (strcmp(info->hardware_id.string, "HWP0001") == 0);
497 match = (strcmp(info->hardware_id.value, "HWP0001") == 0);
498 kfree(info); 495 kfree(info);
499 if (match) { 496 if (match) {
500 status = hp_acpi_csr_space(handle, &sba_hpa, &length); 497 status = hp_acpi_csr_space(handle, &sba_hpa, &length);
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index c509c9916464..c0cf45a11b93 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -114,8 +114,6 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle,
114 unsigned int bus, devnum, func; 114 unsigned int bus, devnum, func;
115 acpi_integer addr; 115 acpi_integer addr;
116 acpi_handle dev_handle; 116 acpi_handle dev_handle;
117 struct acpi_buffer buffer = {.length = ACPI_ALLOCATE_BUFFER,
118 .pointer = NULL};
119 acpi_status status; 117 acpi_status status;
120 struct acpi_device_info *dinfo = NULL; 118 struct acpi_device_info *dinfo = NULL;
121 int ret = -ENODEV; 119 int ret = -ENODEV;
@@ -134,12 +132,11 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle,
134 goto err; 132 goto err;
135 } 133 }
136 134
137 status = acpi_get_object_info(dev_handle, &buffer); 135 status = acpi_get_object_info(dev_handle, &dinfo);
138 if (ACPI_FAILURE(status)) { 136 if (ACPI_FAILURE(status)) {
139 DEBPRINT("get_object_info for device failed\n"); 137 DEBPRINT("get_object_info for device failed\n");
140 goto err; 138 goto err;
141 } 139 }
142 dinfo = buffer.pointer;
143 if (dinfo && (dinfo->valid & ACPI_VALID_ADR) && 140 if (dinfo && (dinfo->valid & ACPI_VALID_ADR) &&
144 dinfo->address == addr) { 141 dinfo->address == addr) {
145 *pcidevfn = addr; 142 *pcidevfn = addr;
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 5befa7e379b7..a9d926b7d805 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -398,23 +398,21 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
398 acpi_handle *phandle = (acpi_handle *)context; 398 acpi_handle *phandle = (acpi_handle *)context;
399 acpi_status status; 399 acpi_status status;
400 struct acpi_device_info *info; 400 struct acpi_device_info *info;
401 struct acpi_buffer info_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
402 int retval = 0; 401 int retval = 0;
403 402
404 status = acpi_get_object_info(handle, &info_buffer); 403 status = acpi_get_object_info(handle, &info);
405 if (ACPI_FAILURE(status)) { 404 if (ACPI_FAILURE(status)) {
406 err("%s: Failed to get device information status=0x%x\n", 405 err("%s: Failed to get device information status=0x%x\n",
407 __func__, status); 406 __func__, status);
408 return retval; 407 return retval;
409 } 408 }
410 info = info_buffer.pointer; 409 info->hardware_id.string[sizeof(info->hardware_id.length) - 1] = '\0';
411 info->hardware_id.value[sizeof(info->hardware_id.value) - 1] = '\0';
412 410
413 if (info->current_status && (info->valid & ACPI_VALID_HID) && 411 if (info->current_status && (info->valid & ACPI_VALID_HID) &&
414 (!strcmp(info->hardware_id.value, IBM_HARDWARE_ID1) || 412 (!strcmp(info->hardware_id.string, IBM_HARDWARE_ID1) ||
415 !strcmp(info->hardware_id.value, IBM_HARDWARE_ID2))) { 413 !strcmp(info->hardware_id.string, IBM_HARDWARE_ID2))) {
416 dbg("found hardware: %s, handle: %p\n", 414 dbg("found hardware: %s, handle: %p\n",
417 info->hardware_id.value, handle); 415 info->hardware_id.string, handle);
418 *phandle = handle; 416 *phandle = handle;
419 /* returning non-zero causes the search to stop 417 /* returning non-zero causes the search to stop
420 * and returns this value to the caller of 418 * and returns this value to the caller of
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index dafaa4a92df5..f9f68e0e7344 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -976,15 +976,12 @@ static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
976 void *context, void **return_value) 976 void *context, void **return_value)
977{ 977{
978 struct acpi_device_info *info; 978 struct acpi_device_info *info;
979 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
980
981 if (ACPI_SUCCESS(acpi_get_object_info(handle, &buffer))) {
982 info = buffer.pointer;
983 979
980 if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) {
984 printk(KERN_WARNING DRV_PFX "method: name: %4.4s, args %X\n", 981 printk(KERN_WARNING DRV_PFX "method: name: %4.4s, args %X\n",
985 (char *)&info->name, info->param_count); 982 (char *)&info->name, info->param_count);
986 983
987 kfree(buffer.pointer); 984 kfree(info);
988 } 985 }
989 986
990 return AE_OK; 987 return AE_OK;
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 9496494f340e..c07fdb94d665 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -194,13 +194,13 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
194 pnpacpi_parse_resource_option_data(dev); 194 pnpacpi_parse_resource_option_data(dev);
195 195
196 if (device->flags.compatible_ids) { 196 if (device->flags.compatible_ids) {
197 struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; 197 struct acpica_device_id_list *cid_list = device->pnp.cid_list;
198 int i; 198 int i;
199 199
200 for (i = 0; i < cid_list->count; i++) { 200 for (i = 0; i < cid_list->count; i++) {
201 if (!ispnpidacpi(cid_list->id[i].value)) 201 if (!ispnpidacpi(cid_list->ids[i].string))
202 continue; 202 continue;
203 pnp_add_id(dev, cid_list->id[i].value); 203 pnp_add_id(dev, cid_list->ids[i].string);
204 } 204 }
205 } 205 }
206 206
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index ca59ee9cc651..af5905eca06f 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -171,17 +171,15 @@ struct acpi_device_dir {
171 171
172typedef char acpi_bus_id[8]; 172typedef char acpi_bus_id[8];
173typedef unsigned long acpi_bus_address; 173typedef unsigned long acpi_bus_address;
174typedef char acpi_hardware_id[15];
175typedef char acpi_unique_id[9];
176typedef char acpi_device_name[40]; 174typedef char acpi_device_name[40];
177typedef char acpi_device_class[20]; 175typedef char acpi_device_class[20];
178 176
179struct acpi_device_pnp { 177struct acpi_device_pnp {
180 acpi_bus_id bus_id; /* Object name */ 178 acpi_bus_id bus_id; /* Object name */
181 acpi_bus_address bus_address; /* _ADR */ 179 acpi_bus_address bus_address; /* _ADR */
182 acpi_hardware_id hardware_id; /* _HID */ 180 char *hardware_id; /* _HID */
183 struct acpi_compatible_id_list *cid_list; /* _CIDs */ 181 struct acpica_device_id_list *cid_list; /* _CIDs */
184 acpi_unique_id unique_id; /* _UID */ 182 char *unique_id; /* _UID */
185 acpi_device_name device_name; /* Driver-determined */ 183 acpi_device_name device_name; /* Driver-determined */
186 acpi_device_class device_class; /* " */ 184 acpi_device_class device_class; /* " */
187}; 185};
@@ -312,7 +310,7 @@ struct acpi_bus_event {
312 310
313extern struct kobject *acpi_kobj; 311extern struct kobject *acpi_kobj;
314extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); 312extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
315void acpi_bus_private_data_handler(acpi_handle, u32, void *); 313void acpi_bus_private_data_handler(acpi_handle, void *);
316int acpi_bus_get_private_data(acpi_handle, void **); 314int acpi_bus_get_private_data(acpi_handle, void **);
317extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); 315extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
318extern int register_acpi_notifier(struct notifier_block *); 316extern int register_acpi_notifier(struct notifier_block *);
@@ -325,7 +323,7 @@ extern void unregister_acpi_bus_notifier(struct notifier_block *nb);
325 */ 323 */
326 324
327int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); 325int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device);
328void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context); 326void acpi_bus_data_handler(acpi_handle handle, void *context);
329int acpi_bus_get_status(struct acpi_device *device); 327int acpi_bus_get_status(struct acpi_device *device);
330int acpi_bus_get_power(acpi_handle handle, int *state); 328int acpi_bus_get_power(acpi_handle handle, int *state);
331int acpi_bus_set_power(acpi_handle handle, int state); 329int acpi_bus_set_power(acpi_handle handle, int state);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 82ec6a3c0500..e723b0fd8e41 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20090521 50#define ACPI_CA_VERSION 0x20090903
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -64,6 +64,7 @@ extern u8 acpi_gbl_enable_interpreter_slack;
64extern u8 acpi_gbl_all_methods_serialized; 64extern u8 acpi_gbl_all_methods_serialized;
65extern u8 acpi_gbl_create_osi_method; 65extern u8 acpi_gbl_create_osi_method;
66extern u8 acpi_gbl_leave_wake_gpes_disabled; 66extern u8 acpi_gbl_leave_wake_gpes_disabled;
67extern u8 acpi_gbl_use_default_register_widths;
67extern acpi_name acpi_gbl_trace_method_name; 68extern acpi_name acpi_gbl_trace_method_name;
68extern u32 acpi_gbl_trace_flags; 69extern u32 acpi_gbl_trace_flags;
69 70
@@ -199,7 +200,8 @@ acpi_evaluate_object_typed(acpi_handle object,
199 acpi_object_type return_type); 200 acpi_object_type return_type);
200 201
201acpi_status 202acpi_status
202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); 203acpi_get_object_info(acpi_handle handle,
204 struct acpi_device_info **return_buffer);
203 205
204acpi_status acpi_install_method(u8 *buffer); 206acpi_status acpi_install_method(u8 *buffer);
205 207
@@ -359,9 +361,9 @@ acpi_status acpi_set_firmware_waking_vector(u32 physical_address);
359acpi_status acpi_set_firmware_waking_vector64(u64 physical_address); 361acpi_status acpi_set_firmware_waking_vector64(u64 physical_address);
360#endif 362#endif
361 363
362acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg); 364acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
363 365
364acpi_status acpi_write(u32 value, struct acpi_generic_address *reg); 366acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
365 367
366acpi_status 368acpi_status
367acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); 369acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 222733d01f36..1b6587952604 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -44,9 +44,23 @@
44#ifndef __ACTBL_H__ 44#ifndef __ACTBL_H__
45#define __ACTBL_H__ 45#define __ACTBL_H__
46 46
47/*******************************************************************************
48 *
49 * Fundamental ACPI tables
50 *
51 * This file contains definitions for the ACPI tables that are directly consumed
52 * by ACPICA. All other tables are consumed by the OS-dependent ACPI-related
53 * device drivers and other OS support code.
54 *
55 * The RSDP and FACS do not use the common ACPI table header. All other ACPI
56 * tables use the header.
57 *
58 ******************************************************************************/
59
47/* 60/*
48 * Values for description table header signatures. Useful because they make 61 * Values for description table header signatures for tables defined in this
49 * it more difficult to inadvertently type in the wrong signature. 62 * file. Useful because they make it more difficult to inadvertently type in
63 * the wrong signature.
50 */ 64 */
51#define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */ 65#define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */
52#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */ 66#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */
@@ -65,11 +79,6 @@
65#pragma pack(1) 79#pragma pack(1)
66 80
67/* 81/*
68 * These are the ACPI tables that are directly consumed by the subsystem.
69 *
70 * The RSDP and FACS do not use the common ACPI table header. All other ACPI
71 * tables use the header.
72 *
73 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 82 * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
74 * This is the only type that is even remotely portable. Anything else is not 83 * This is the only type that is even remotely portable. Anything else is not
75 * portable, so do not use any other bitfield types. 84 * portable, so do not use any other bitfield types.
@@ -77,9 +86,8 @@
77 86
78/******************************************************************************* 87/*******************************************************************************
79 * 88 *
80 * ACPI Table Header. This common header is used by all tables except the 89 * Master ACPI Table Header. This common header is used by all ACPI tables
81 * RSDP and FACS. The define is used for direct inclusion of header into 90 * except the RSDP and FACS.
82 * other ACPI tables
83 * 91 *
84 ******************************************************************************/ 92 ******************************************************************************/
85 93
@@ -95,13 +103,16 @@ struct acpi_table_header {
95 u32 asl_compiler_revision; /* ASL compiler version */ 103 u32 asl_compiler_revision; /* ASL compiler version */
96}; 104};
97 105
98/* 106/*******************************************************************************
107 *
99 * GAS - Generic Address Structure (ACPI 2.0+) 108 * GAS - Generic Address Structure (ACPI 2.0+)
100 * 109 *
101 * Note: Since this structure is used in the ACPI tables, it is byte aligned. 110 * Note: Since this structure is used in the ACPI tables, it is byte aligned.
102 * If misalignment is not supported, access to the Address field must be 111 * If misaliged access is not supported by the hardware, accesses to the
103 * performed with care. 112 * 64-bit Address field must be performed with care.
104 */ 113 *
114 ******************************************************************************/
115
105struct acpi_generic_address { 116struct acpi_generic_address {
106 u8 space_id; /* Address space where struct or register exists */ 117 u8 space_id; /* Address space where struct or register exists */
107 u8 bit_width; /* Size in bits of given register */ 118 u8 bit_width; /* Size in bits of given register */
@@ -113,6 +124,7 @@ struct acpi_generic_address {
113/******************************************************************************* 124/*******************************************************************************
114 * 125 *
115 * RSDP - Root System Description Pointer (Signature is "RSD PTR ") 126 * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
127 * Version 2
116 * 128 *
117 ******************************************************************************/ 129 ******************************************************************************/
118 130
@@ -133,6 +145,7 @@ struct acpi_table_rsdp {
133/******************************************************************************* 145/*******************************************************************************
134 * 146 *
135 * RSDT/XSDT - Root System Description Tables 147 * RSDT/XSDT - Root System Description Tables
148 * Version 1 (both)
136 * 149 *
137 ******************************************************************************/ 150 ******************************************************************************/
138 151
@@ -161,21 +174,29 @@ struct acpi_table_facs {
161 u32 flags; 174 u32 flags;
162 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ 175 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
163 u8 version; /* Version of this table (ACPI 2.0+) */ 176 u8 version; /* Version of this table (ACPI 2.0+) */
164 u8 reserved[31]; /* Reserved, must be zero */ 177 u8 reserved[3]; /* Reserved, must be zero */
178 u32 ospm_flags; /* Flags to be set by OSPM (ACPI 4.0) */
179 u8 reserved1[24]; /* Reserved, must be zero */
165}; 180};
166 181
167/* Flag macros */ 182/* Masks for global_lock flag field above */
168 183
169#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */ 184#define ACPI_GLOCK_PENDING (1) /* 00: Pending global lock ownership */
185#define ACPI_GLOCK_OWNED (1<<1) /* 01: Global lock is owned */
170 186
171/* Global lock flags */ 187/* Masks for Flags field above */
172 188
173#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */ 189#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */
174#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */ 190#define ACPI_FACS_64BIT_WAKE (1<<1) /* 01: 64-bit wake vector supported (ACPI 4.0) */
191
192/* Masks for ospm_flags field above */
193
194#define ACPI_FACS_64BIT_ENVIRONMENT (1) /* 00: 64-bit wake environment is required (ACPI 4.0) */
175 195
176/******************************************************************************* 196/*******************************************************************************
177 * 197 *
178 * FADT - Fixed ACPI Description Table (Signature "FACP") 198 * FADT - Fixed ACPI Description Table (Signature "FACP")
199 * Version 4
179 * 200 *
180 ******************************************************************************/ 201 ******************************************************************************/
181 202
@@ -236,7 +257,7 @@ struct acpi_table_fadt {
236 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ 257 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
237}; 258};
238 259
239/* FADT Boot Architecture Flags (boot_flags) */ 260/* Masks for FADT Boot Architecture Flags (boot_flags) */
240 261
241#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ 262#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */
242#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ 263#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */
@@ -246,7 +267,7 @@ struct acpi_table_fadt {
246 267
247#define FADT2_REVISION_ID 3 268#define FADT2_REVISION_ID 3
248 269
249/* FADT flags */ 270/* Masks for FADT flags */
250 271
251#define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */ 272#define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */
252#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */ 273#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */
@@ -269,7 +290,7 @@ struct acpi_table_fadt {
269#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ 290#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */
270#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */ 291#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */
271 292
272/* FADT Prefered Power Management Profiles */ 293/* Values for preferred_profile (Prefered Power Management Profiles) */
273 294
274enum acpi_prefered_pm_profiles { 295enum acpi_prefered_pm_profiles {
275 PM_UNSPECIFIED = 0, 296 PM_UNSPECIFIED = 0,
@@ -287,14 +308,16 @@ enum acpi_prefered_pm_profiles {
287 308
288#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f) 309#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f)
289 310
311/*
312 * Internal table-related structures
313 */
290union acpi_name_union { 314union acpi_name_union {
291 u32 integer; 315 u32 integer;
292 char ascii[4]; 316 char ascii[4];
293}; 317};
294 318
295/* 319/* Internal ACPI Table Descriptor. One per ACPI table. */
296 * Internal ACPI Table Descriptor. One per ACPI table 320
297 */
298struct acpi_table_desc { 321struct acpi_table_desc {
299 acpi_physical_address address; 322 acpi_physical_address address;
300 struct acpi_table_header *pointer; 323 struct acpi_table_header *pointer;
@@ -304,7 +327,7 @@ struct acpi_table_desc {
304 u8 flags; 327 u8 flags;
305}; 328};
306 329
307/* Flags for above */ 330/* Masks for Flags field above */
308 331
309#define ACPI_TABLE_ORIGIN_UNKNOWN (0) 332#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
310#define ACPI_TABLE_ORIGIN_MAPPED (1) 333#define ACPI_TABLE_ORIGIN_MAPPED (1)
@@ -318,5 +341,6 @@ struct acpi_table_desc {
318 */ 341 */
319 342
320#include <acpi/actbl1.h> 343#include <acpi/actbl1.h>
344#include <acpi/actbl2.h>
321 345
322#endif /* __ACTBL_H__ */ 346#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 59ade0752473..0b9b430b092b 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -46,41 +46,31 @@
46 46
47/******************************************************************************* 47/*******************************************************************************
48 * 48 *
49 * Additional ACPI Tables 49 * Additional ACPI Tables (1)
50 * 50 *
51 * These tables are not consumed directly by the ACPICA subsystem, but are 51 * These tables are not consumed directly by the ACPICA subsystem, but are
52 * included here to support device drivers and the AML disassembler. 52 * included here to support device drivers and the AML disassembler.
53 * 53 *
54 * The tables in this file are fully defined within the ACPI specification.
55 *
54 ******************************************************************************/ 56 ******************************************************************************/
55 57
56/* 58/*
57 * Values for description table header signatures. Useful because they make 59 * Values for description table header signatures for tables defined in this
58 * it more difficult to inadvertently type in the wrong signature. 60 * file. Useful because they make it more difficult to inadvertently type in
61 * the wrong signature.
59 */ 62 */
60#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
61#define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */ 63#define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */
62#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
63#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ 64#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */
64#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
65#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */
66#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ 65#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */
67#define ACPI_SIG_EINJ "EINJ" /* Error Injection table */ 66#define ACPI_SIG_EINJ "EINJ" /* Error Injection table */
68#define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */ 67#define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */
69#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ 68#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */
70#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
71#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */
72#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ 69#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
73#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ 70#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */
74#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ 71#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
75#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
76#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ 72#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */
77#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
78#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
79#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ 73#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */
80#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
81#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */
82#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */
83#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
84 74
85/* 75/*
86 * All tables must be byte-packed to match the ACPI specification, since 76 * All tables must be byte-packed to match the ACPI specification, since
@@ -94,14 +84,20 @@
94 * portable, so do not use any other bitfield types. 84 * portable, so do not use any other bitfield types.
95 */ 85 */
96 86
97/* Common Subtable header (used in MADT, SRAT, etc.) */ 87/*******************************************************************************
88 *
89 * Common subtable headers
90 *
91 ******************************************************************************/
92
93/* Generic subtable header (used in MADT, SRAT, etc.) */
98 94
99struct acpi_subtable_header { 95struct acpi_subtable_header {
100 u8 type; 96 u8 type;
101 u8 length; 97 u8 length;
102}; 98};
103 99
104/* Common Subtable header for WHEA tables (EINJ, ERST, WDAT) */ 100/* Subtable header for WHEA tables (EINJ, ERST, WDAT) */
105 101
106struct acpi_whea_header { 102struct acpi_whea_header {
107 u8 action; 103 u8 action;
@@ -115,116 +111,8 @@ struct acpi_whea_header {
115 111
116/******************************************************************************* 112/*******************************************************************************
117 * 113 *
118 * ASF - Alert Standard Format table (Signature "ASF!") 114 * BERT - Boot Error Record Table (ACPI 4.0)
119 * 115 * Version 1
120 * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003
121 *
122 ******************************************************************************/
123
124struct acpi_table_asf {
125 struct acpi_table_header header; /* Common ACPI table header */
126};
127
128/* ASF subtable header */
129
130struct acpi_asf_header {
131 u8 type;
132 u8 reserved;
133 u16 length;
134};
135
136/* Values for Type field above */
137
138enum acpi_asf_type {
139 ACPI_ASF_TYPE_INFO = 0,
140 ACPI_ASF_TYPE_ALERT = 1,
141 ACPI_ASF_TYPE_CONTROL = 2,
142 ACPI_ASF_TYPE_BOOT = 3,
143 ACPI_ASF_TYPE_ADDRESS = 4,
144 ACPI_ASF_TYPE_RESERVED = 5
145};
146
147/*
148 * ASF subtables
149 */
150
151/* 0: ASF Information */
152
153struct acpi_asf_info {
154 struct acpi_asf_header header;
155 u8 min_reset_value;
156 u8 min_poll_interval;
157 u16 system_id;
158 u32 mfg_id;
159 u8 flags;
160 u8 reserved2[3];
161};
162
163/* 1: ASF Alerts */
164
165struct acpi_asf_alert {
166 struct acpi_asf_header header;
167 u8 assert_mask;
168 u8 deassert_mask;
169 u8 alerts;
170 u8 data_length;
171};
172
173struct acpi_asf_alert_data {
174 u8 address;
175 u8 command;
176 u8 mask;
177 u8 value;
178 u8 sensor_type;
179 u8 type;
180 u8 offset;
181 u8 source_type;
182 u8 severity;
183 u8 sensor_number;
184 u8 entity;
185 u8 instance;
186};
187
188/* 2: ASF Remote Control */
189
190struct acpi_asf_remote {
191 struct acpi_asf_header header;
192 u8 controls;
193 u8 data_length;
194 u16 reserved2;
195};
196
197struct acpi_asf_control_data {
198 u8 function;
199 u8 address;
200 u8 command;
201 u8 value;
202};
203
204/* 3: ASF RMCP Boot Options */
205
206struct acpi_asf_rmcp {
207 struct acpi_asf_header header;
208 u8 capabilities[7];
209 u8 completion_code;
210 u32 enterprise_id;
211 u8 command;
212 u16 parameter;
213 u16 boot_options;
214 u16 oem_parameters;
215};
216
217/* 4: ASF Address */
218
219struct acpi_asf_address {
220 struct acpi_asf_header header;
221 u8 eprom_address;
222 u8 devices;
223};
224
225/*******************************************************************************
226 *
227 * BERT - Boot Error Record Table
228 * 116 *
229 ******************************************************************************/ 117 ******************************************************************************/
230 118
@@ -234,38 +122,43 @@ struct acpi_table_bert {
234 u64 address; /* Physical addresss of the error region */ 122 u64 address; /* Physical addresss of the error region */
235}; 123};
236 124
237/* Boot Error Region */ 125/* Boot Error Region (not a subtable, pointed to by Address field above) */
238 126
239struct acpi_bert_region { 127struct acpi_bert_region {
240 u32 block_status; 128 u32 block_status; /* Type of error information */
241 u32 raw_data_offset; 129 u32 raw_data_offset; /* Offset to raw error data */
242 u32 raw_data_length; 130 u32 raw_data_length; /* Length of raw error data */
243 u32 data_length; 131 u32 data_length; /* Length of generic error data */
244 u32 error_severity; 132 u32 error_severity; /* Severity code */
245}; 133};
246 134
247/* block_status Flags */ 135/* Values for block_status flags above */
248 136
249#define ACPI_BERT_UNCORRECTABLE (1) 137#define ACPI_BERT_UNCORRECTABLE (1)
250#define ACPI_BERT_CORRECTABLE (2) 138#define ACPI_BERT_CORRECTABLE (1<<1)
251#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (4) 139#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (1<<2)
252#define ACPI_BERT_MULTIPLE_CORRECTABLE (8) 140#define ACPI_BERT_MULTIPLE_CORRECTABLE (1<<3)
141#define ACPI_BERT_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */
253 142
254/******************************************************************************* 143/* Values for error_severity above */
255 *
256 * BOOT - Simple Boot Flag Table
257 *
258 ******************************************************************************/
259 144
260struct acpi_table_boot { 145enum acpi_bert_error_severity {
261 struct acpi_table_header header; /* Common ACPI table header */ 146 ACPI_BERT_ERROR_CORRECTABLE = 0,
262 u8 cmos_index; /* Index in CMOS RAM for the boot register */ 147 ACPI_BERT_ERROR_FATAL = 1,
263 u8 reserved[3]; 148 ACPI_BERT_ERROR_CORRECTED = 2,
149 ACPI_BERT_ERROR_NONE = 3,
150 ACPI_BERT_ERROR_RESERVED = 4 /* 4 and greater are reserved */
264}; 151};
265 152
153/*
154 * Note: The generic error data that follows the error_severity field above
155 * uses the struct acpi_hest_generic_data defined under the HEST table below
156 */
157
266/******************************************************************************* 158/*******************************************************************************
267 * 159 *
268 * CPEP - Corrected Platform Error Polling table 160 * CPEP - Corrected Platform Error Polling table (ACPI 4.0)
161 * Version 1
269 * 162 *
270 ******************************************************************************/ 163 ******************************************************************************/
271 164
@@ -277,8 +170,7 @@ struct acpi_table_cpep {
277/* Subtable */ 170/* Subtable */
278 171
279struct acpi_cpep_polling { 172struct acpi_cpep_polling {
280 u8 type; 173 struct acpi_subtable_header header;
281 u8 length;
282 u8 id; /* Processor ID */ 174 u8 id; /* Processor ID */
283 u8 eid; /* Processor EID */ 175 u8 eid; /* Processor EID */
284 u32 interval; /* Polling interval (msec) */ 176 u32 interval; /* Polling interval (msec) */
@@ -286,124 +178,8 @@ struct acpi_cpep_polling {
286 178
287/******************************************************************************* 179/*******************************************************************************
288 * 180 *
289 * DBGP - Debug Port table
290 *
291 ******************************************************************************/
292
293struct acpi_table_dbgp {
294 struct acpi_table_header header; /* Common ACPI table header */
295 u8 type; /* 0=full 16550, 1=subset of 16550 */
296 u8 reserved[3];
297 struct acpi_generic_address debug_port;
298};
299
300/*******************************************************************************
301 *
302 * DMAR - DMA Remapping table
303 * From "Intel Virtualization Technology for Directed I/O", Sept. 2007
304 *
305 ******************************************************************************/
306
307struct acpi_table_dmar {
308 struct acpi_table_header header; /* Common ACPI table header */
309 u8 width; /* Host Address Width */
310 u8 flags;
311 u8 reserved[10];
312};
313
314/* Flags */
315
316#define ACPI_DMAR_INTR_REMAP (1)
317
318/* DMAR subtable header */
319
320struct acpi_dmar_header {
321 u16 type;
322 u16 length;
323};
324
325/* Values for subtable type in struct acpi_dmar_header */
326
327enum acpi_dmar_type {
328 ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,
329 ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
330 ACPI_DMAR_TYPE_ATSR = 2,
331 ACPI_DMAR_TYPE_RESERVED = 3 /* 3 and greater are reserved */
332};
333
334struct acpi_dmar_device_scope {
335 u8 entry_type;
336 u8 length;
337 u16 reserved;
338 u8 enumeration_id;
339 u8 bus;
340};
341
342/* Values for entry_type in struct acpi_dmar_device_scope */
343
344enum acpi_dmar_scope_type {
345 ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
346 ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1,
347 ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2,
348 ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3,
349 ACPI_DMAR_SCOPE_TYPE_HPET = 4,
350 ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */
351};
352
353struct acpi_dmar_pci_path {
354 u8 dev;
355 u8 fn;
356};
357
358/*
359 * DMAR Sub-tables, correspond to Type in struct acpi_dmar_header
360 */
361
362/* 0: Hardware Unit Definition */
363
364struct acpi_dmar_hardware_unit {
365 struct acpi_dmar_header header;
366 u8 flags;
367 u8 reserved;
368 u16 segment;
369 u64 address; /* Register Base Address */
370};
371
372/* Flags */
373
374#define ACPI_DMAR_INCLUDE_ALL (1)
375
376/* 1: Reserved Memory Defininition */
377
378struct acpi_dmar_reserved_memory {
379 struct acpi_dmar_header header;
380 u16 reserved;
381 u16 segment;
382 u64 base_address; /* 4_k aligned base address */
383 u64 end_address; /* 4_k aligned limit address */
384};
385
386/* Flags */
387
388#define ACPI_DMAR_ALLOW_ALL (1)
389
390
391/* 2: Root Port ATS Capability Reporting Structure */
392
393struct acpi_dmar_atsr {
394 struct acpi_dmar_header header;
395 u8 flags;
396 u8 reserved;
397 u16 segment;
398};
399
400/* Flags */
401
402#define ACPI_DMAR_ALL_PORTS (1)
403
404/*******************************************************************************
405 *
406 * ECDT - Embedded Controller Boot Resources Table 181 * ECDT - Embedded Controller Boot Resources Table
182 * Version 1
407 * 183 *
408 ******************************************************************************/ 184 ******************************************************************************/
409 185
@@ -418,14 +194,16 @@ struct acpi_table_ecdt {
418 194
419/******************************************************************************* 195/*******************************************************************************
420 * 196 *
421 * EINJ - Error Injection Table 197 * EINJ - Error Injection Table (ACPI 4.0)
198 * Version 1
422 * 199 *
423 ******************************************************************************/ 200 ******************************************************************************/
424 201
425struct acpi_table_einj { 202struct acpi_table_einj {
426 struct acpi_table_header header; /* Common ACPI table header */ 203 struct acpi_table_header header; /* Common ACPI table header */
427 u32 header_length; 204 u32 header_length;
428 u32 reserved; 205 u8 flags;
206 u8 reserved[3];
429 u32 entries; 207 u32 entries;
430}; 208};
431 209
@@ -435,6 +213,10 @@ struct acpi_einj_entry {
435 struct acpi_whea_header whea_header; /* Common header for WHEA tables */ 213 struct acpi_whea_header whea_header; /* Common header for WHEA tables */
436}; 214};
437 215
216/* Masks for Flags field above */
217
218#define ACPI_EINJ_PRESERVE (1)
219
438/* Values for Action field above */ 220/* Values for Action field above */
439 221
440enum acpi_einj_actions { 222enum acpi_einj_actions {
@@ -470,9 +252,34 @@ struct acpi_einj_trigger {
470 u32 entry_count; 252 u32 entry_count;
471}; 253};
472 254
255/* Command status return values */
256
257enum acpi_einj_command_status {
258 ACPI_EINJ_SUCCESS = 0,
259 ACPI_EINJ_FAILURE = 1,
260 ACPI_EINJ_INVALID_ACCESS = 2,
261 ACPI_EINJ_STATUS_RESERVED = 3 /* 3 and greater are reserved */
262};
263
264/* Error types returned from ACPI_EINJ_GET_ERROR_TYPE (bitfield) */
265
266#define ACPI_EINJ_PROCESSOR_CORRECTABLE (1)
267#define ACPI_EINJ_PROCESSOR_UNCORRECTABLE (1<<1)
268#define ACPI_EINJ_PROCESSOR_FATAL (1<<2)
269#define ACPI_EINJ_MEMORY_CORRECTABLE (1<<3)
270#define ACPI_EINJ_MEMORY_UNCORRECTABLE (1<<4)
271#define ACPI_EINJ_MEMORY_FATAL (1<<5)
272#define ACPI_EINJ_PCIX_CORRECTABLE (1<<6)
273#define ACPI_EINJ_PCIX_UNCORRECTABLE (1<<7)
274#define ACPI_EINJ_PCIX_FATAL (1<<8)
275#define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9)
276#define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10)
277#define ACPI_EINJ_PLATFORM_FATAL (1<<11)
278
473/******************************************************************************* 279/*******************************************************************************
474 * 280 *
475 * ERST - Error Record Serialization Table 281 * ERST - Error Record Serialization Table (ACPI 4.0)
282 * Version 1
476 * 283 *
477 ******************************************************************************/ 284 ******************************************************************************/
478 285
@@ -489,19 +296,23 @@ struct acpi_erst_entry {
489 struct acpi_whea_header whea_header; /* Common header for WHEA tables */ 296 struct acpi_whea_header whea_header; /* Common header for WHEA tables */
490}; 297};
491 298
299/* Masks for Flags field above */
300
301#define ACPI_ERST_PRESERVE (1)
302
492/* Values for Action field above */ 303/* Values for Action field above */
493 304
494enum acpi_erst_actions { 305enum acpi_erst_actions {
495 ACPI_ERST_BEGIN_WRITE_OPERATION = 0, 306 ACPI_ERST_BEGIN_WRITE = 0,
496 ACPI_ERST_BEGIN_READ_OPERATION = 1, 307 ACPI_ERST_BEGIN_READ = 1,
497 ACPI_ERST_BETGIN_CLEAR_OPERATION = 2, 308 ACPI_ERST_BEGIN_CLEAR = 2,
498 ACPI_ERST_END_OPERATION = 3, 309 ACPI_ERST_END = 3,
499 ACPI_ERST_SET_RECORD_OFFSET = 4, 310 ACPI_ERST_SET_RECORD_OFFSET = 4,
500 ACPI_ERST_EXECUTE_OPERATION = 5, 311 ACPI_ERST_EXECUTE_OPERATION = 5,
501 ACPI_ERST_CHECK_BUSY_STATUS = 6, 312 ACPI_ERST_CHECK_BUSY_STATUS = 6,
502 ACPI_ERST_GET_COMMAND_STATUS = 7, 313 ACPI_ERST_GET_COMMAND_STATUS = 7,
503 ACPI_ERST_GET_RECORD_IDENTIFIER = 8, 314 ACPI_ERST_GET_RECORD_ID = 8,
504 ACPI_ERST_SET_RECORD_IDENTIFIER = 9, 315 ACPI_ERST_SET_RECORD_ID = 9,
505 ACPI_ERST_GET_RECORD_COUNT = 10, 316 ACPI_ERST_GET_RECORD_COUNT = 10,
506 ACPI_ERST_BEGIN_DUMMY_WRIITE = 11, 317 ACPI_ERST_BEGIN_DUMMY_WRIITE = 11,
507 ACPI_ERST_NOT_USED = 12, 318 ACPI_ERST_NOT_USED = 12,
@@ -536,9 +347,29 @@ enum acpi_erst_instructions {
536 ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */ 347 ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */
537}; 348};
538 349
350/* Command status return values */
351
352enum acpi_erst_command_status {
353 ACPI_ERST_SUCESS = 0,
354 ACPI_ERST_NO_SPACE = 1,
355 ACPI_ERST_NOT_AVAILABLE = 2,
356 ACPI_ERST_FAILURE = 3,
357 ACPI_ERST_RECORD_EMPTY = 4,
358 ACPI_ERST_NOT_FOUND = 5,
359 ACPI_ERST_STATUS_RESERVED = 6 /* 6 and greater are reserved */
360};
361
362/* Error Record Serialization Information */
363
364struct acpi_erst_info {
365 u16 signature; /* Should be "ER" */
366 u8 data[48];
367};
368
539/******************************************************************************* 369/*******************************************************************************
540 * 370 *
541 * HEST - Hardware Error Source Table 371 * HEST - Hardware Error Source Table (ACPI 4.0)
372 * Version 1
542 * 373 *
543 ******************************************************************************/ 374 ******************************************************************************/
544 375
@@ -551,85 +382,69 @@ struct acpi_table_hest {
551 382
552struct acpi_hest_header { 383struct acpi_hest_header {
553 u16 type; 384 u16 type;
385 u16 source_id;
554}; 386};
555 387
556/* Values for Type field above for subtables */ 388/* Values for Type field above for subtables */
557 389
558enum acpi_hest_types { 390enum acpi_hest_types {
559 ACPI_HEST_TYPE_XPF_MACHINE_CHECK = 0, 391 ACPI_HEST_TYPE_IA32_CHECK = 0,
560 ACPI_HEST_TYPE_XPF_CORRECTED_MACHINE_CHECK = 1, 392 ACPI_HEST_TYPE_IA32_CORRECTED_CHECK = 1,
561 ACPI_HEST_TYPE_XPF_UNUSED = 2, 393 ACPI_HEST_TYPE_IA32_NMI = 2,
562 ACPI_HEST_TYPE_XPF_NON_MASKABLE_INTERRUPT = 3, 394 ACPI_HEST_TYPE_NOT_USED3 = 3,
563 ACPI_HEST_TYPE_IPF_CORRECTED_MACHINE_CHECK = 4, 395 ACPI_HEST_TYPE_NOT_USED4 = 4,
564 ACPI_HEST_TYPE_IPF_CORRECTED_PLATFORM_ERROR = 5, 396 ACPI_HEST_TYPE_NOT_USED5 = 5,
565 ACPI_HEST_TYPE_AER_ROOT_PORT = 6, 397 ACPI_HEST_TYPE_AER_ROOT_PORT = 6,
566 ACPI_HEST_TYPE_AER_ENDPOINT = 7, 398 ACPI_HEST_TYPE_AER_ENDPOINT = 7,
567 ACPI_HEST_TYPE_AER_BRIDGE = 8, 399 ACPI_HEST_TYPE_AER_BRIDGE = 8,
568 ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE = 9, 400 ACPI_HEST_TYPE_GENERIC_ERROR = 9,
569 ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ 401 ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */
570}; 402};
571 403
572/* 404/*
573 * HEST Sub-subtables 405 * HEST substructures contained in subtables
574 */ 406 */
575 407
576/* XPF Machine Check Error Bank */ 408/*
577 409 * IA32 Error Bank(s) - Follows the struct acpi_hest_ia_machine_check and
578struct acpi_hest_xpf_error_bank { 410 * struct acpi_hest_ia_corrected structures.
411 */
412struct acpi_hest_ia_error_bank {
579 u8 bank_number; 413 u8 bank_number;
580 u8 clear_status_on_init; 414 u8 clear_status_on_init;
581 u8 status_format; 415 u8 status_format;
582 u8 config_write_enable; 416 u8 reserved;
583 u32 control_register; 417 u32 control_register;
584 u64 control_init_data; 418 u64 control_data;
585 u32 status_register; 419 u32 status_register;
586 u32 address_register; 420 u32 address_register;
587 u32 misc_register; 421 u32 misc_register;
588}; 422};
589 423
590/* Generic Error Status */ 424/* Common HEST sub-structure for PCI/AER structures below (6,7,8) */
591
592struct acpi_hest_generic_status {
593 u32 block_status;
594 u32 raw_data_offset;
595 u32 raw_data_length;
596 u32 data_length;
597 u32 error_severity;
598};
599
600/* Generic Error Data */
601
602struct acpi_hest_generic_data {
603 u8 section_type[16];
604 u32 error_severity;
605 u16 revision;
606 u8 validation_bits;
607 u8 flags;
608 u32 error_data_length;
609 u8 fru_id[16];
610 u8 fru_text[20];
611};
612
613/* Common HEST structure for PCI/AER types below (6,7,8) */
614 425
615struct acpi_hest_aer_common { 426struct acpi_hest_aer_common {
616 u16 source_id; 427 u16 reserved1;
617 u16 config_write_enable;
618 u8 flags; 428 u8 flags;
619 u8 enabled; 429 u8 enabled;
620 u32 records_to_pre_allocate; 430 u32 records_to_preallocate;
621 u32 max_sections_per_record; 431 u32 max_sections_per_record;
622 u32 bus; 432 u32 bus;
623 u16 device; 433 u16 device;
624 u16 function; 434 u16 function;
625 u16 device_control; 435 u16 device_control;
626 u16 reserved; 436 u16 reserved2;
627 u32 uncorrectable_error_mask; 437 u32 uncorrectable_mask;
628 u32 uncorrectable_error_severity; 438 u32 uncorrectable_severity;
629 u32 correctable_error_mask; 439 u32 correctable_mask;
630 u32 advanced_error_capabilities; 440 u32 advanced_capabilities;
631}; 441};
632 442
443/* Masks for HEST Flags fields */
444
445#define ACPI_HEST_FIRMWARE_FIRST (1)
446#define ACPI_HEST_GLOBAL (1<<1)
447
633/* Hardware Error Notification */ 448/* Hardware Error Notification */
634 449
635struct acpi_hest_notify { 450struct acpi_hest_notify {
@@ -655,71 +470,59 @@ enum acpi_hest_notify_types {
655 ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ 470 ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */
656}; 471};
657 472
473/* Values for config_write_enable bitfield above */
474
475#define ACPI_HEST_TYPE (1)
476#define ACPI_HEST_POLL_INTERVAL (1<<1)
477#define ACPI_HEST_POLL_THRESHOLD_VALUE (1<<2)
478#define ACPI_HEST_POLL_THRESHOLD_WINDOW (1<<3)
479#define ACPI_HEST_ERR_THRESHOLD_VALUE (1<<4)
480#define ACPI_HEST_ERR_THRESHOLD_WINDOW (1<<5)
481
658/* 482/*
659 * HEST subtables 483 * HEST subtables
660 *
661 * From WHEA Design Document, 16 May 2007.
662 * Note: There is no subtable type 2 in this version of the document,
663 * and there are two different subtable type 3s.
664 */ 484 */
665 485
666 /* 0: XPF Machine Check Exception */ 486/* 0: IA32 Machine Check Exception */
667 487
668struct acpi_hest_xpf_machine_check { 488struct acpi_hest_ia_machine_check {
669 struct acpi_hest_header header; 489 struct acpi_hest_header header;
670 u16 source_id; 490 u16 reserved1;
671 u16 config_write_enable;
672 u8 flags; 491 u8 flags;
673 u8 reserved1; 492 u8 enabled;
674 u32 records_to_pre_allocate; 493 u32 records_to_preallocate;
675 u32 max_sections_per_record; 494 u32 max_sections_per_record;
676 u64 global_capability_data; 495 u64 global_capability_data;
677 u64 global_control_data; 496 u64 global_control_data;
678 u8 num_hardware_banks; 497 u8 num_hardware_banks;
679 u8 reserved2[7]; 498 u8 reserved3[7];
680}; 499};
681 500
682/* 1: XPF Corrected Machine Check */ 501/* 1: IA32 Corrected Machine Check */
683 502
684struct acpi_table_hest_xpf_corrected { 503struct acpi_hest_ia_corrected {
685 struct acpi_hest_header header; 504 struct acpi_hest_header header;
686 u16 source_id; 505 u16 reserved1;
687 u16 config_write_enable;
688 u8 flags; 506 u8 flags;
689 u8 enabled; 507 u8 enabled;
690 u32 records_to_pre_allocate; 508 u32 records_to_preallocate;
691 u32 max_sections_per_record; 509 u32 max_sections_per_record;
692 struct acpi_hest_notify notify; 510 struct acpi_hest_notify notify;
693 u8 num_hardware_banks; 511 u8 num_hardware_banks;
694 u8 reserved[3]; 512 u8 reserved2[3];
695}; 513};
696 514
697/* 3: XPF Non-Maskable Interrupt */ 515/* 2: IA32 Non-Maskable Interrupt */
698 516
699struct acpi_hest_xpf_nmi { 517struct acpi_hest_ia_nmi {
700 struct acpi_hest_header header; 518 struct acpi_hest_header header;
701 u16 source_id;
702 u32 reserved; 519 u32 reserved;
703 u32 records_to_pre_allocate; 520 u32 records_to_preallocate;
704 u32 max_sections_per_record; 521 u32 max_sections_per_record;
705 u32 max_raw_data_length; 522 u32 max_raw_data_length;
706}; 523};
707 524
708/* 4: IPF Corrected Machine Check */ 525/* 3,4,5: Not used */
709
710struct acpi_hest_ipf_corrected {
711 struct acpi_hest_header header;
712 u8 enabled;
713 u8 reserved;
714};
715
716/* 5: IPF Corrected Platform Error */
717
718struct acpi_hest_ipf_corrected_platform {
719 struct acpi_hest_header header;
720 u8 enabled;
721 u8 reserved;
722};
723 526
724/* 6: PCI Express Root Port AER */ 527/* 6: PCI Express Root Port AER */
725 528
@@ -741,143 +544,61 @@ struct acpi_hest_aer {
741struct acpi_hest_aer_bridge { 544struct acpi_hest_aer_bridge {
742 struct acpi_hest_header header; 545 struct acpi_hest_header header;
743 struct acpi_hest_aer_common aer; 546 struct acpi_hest_aer_common aer;
744 u32 secondary_uncorrectable_error_mask; 547 u32 uncorrectable_mask2;
745 u32 secondary_uncorrectable_error_severity; 548 u32 uncorrectable_severity2;
746 u32 secondary_advanced_capabilities; 549 u32 advanced_capabilities2;
747}; 550};
748 551
749/* 9: Generic Hardware Error Source */ 552/* 9: Generic Hardware Error Source */
750 553
751struct acpi_hest_generic { 554struct acpi_hest_generic {
752 struct acpi_hest_header header; 555 struct acpi_hest_header header;
753 u16 source_id;
754 u16 related_source_id; 556 u16 related_source_id;
755 u8 config_write_enable; 557 u8 reserved;
756 u8 enabled; 558 u8 enabled;
757 u32 records_to_pre_allocate; 559 u32 records_to_preallocate;
758 u32 max_sections_per_record; 560 u32 max_sections_per_record;
759 u32 max_raw_data_length; 561 u32 max_raw_data_length;
760 struct acpi_generic_address error_status_address; 562 struct acpi_generic_address error_status_address;
761 struct acpi_hest_notify notify; 563 struct acpi_hest_notify notify;
762 u32 error_status_block_length; 564 u32 error_block_length;
763}; 565};
764 566
765/******************************************************************************* 567/* Generic Error Status block */
766 *
767 * HPET - High Precision Event Timer table
768 *
769 ******************************************************************************/
770 568
771struct acpi_table_hpet { 569struct acpi_hest_generic_status {
772 struct acpi_table_header header; /* Common ACPI table header */ 570 u32 block_status;
773 u32 id; /* Hardware ID of event timer block */ 571 u32 raw_data_offset;
774 struct acpi_generic_address address; /* Address of event timer block */ 572 u32 raw_data_length;
775 u8 sequence; /* HPET sequence number */ 573 u32 data_length;
776 u16 minimum_tick; /* Main counter min tick, periodic mode */ 574 u32 error_severity;
777 u8 flags;
778}; 575};
779 576
780/*! Flags */ 577/* Values for block_status flags above */
781 578
782#define ACPI_HPET_PAGE_PROTECT (1) /* 00: No page protection */ 579#define ACPI_HEST_UNCORRECTABLE (1)
783#define ACPI_HPET_PAGE_PROTECT_4 (1<<1) /* 01: 4KB page protected */ 580#define ACPI_HEST_CORRECTABLE (1<<1)
784#define ACPI_HPET_PAGE_PROTECT_64 (1<<2) /* 02: 64KB page protected */ 581#define ACPI_HEST_MULTIPLE_UNCORRECTABLE (1<<2)
582#define ACPI_HEST_MULTIPLE_CORRECTABLE (1<<3)
583#define ACPI_HEST_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */
785 584
786/*! [End] no source code translation !*/ 585/* Generic Error Data entry */
787 586
788/******************************************************************************* 587struct acpi_hest_generic_data {
789 * 588 u8 section_type[16];
790 * IBFT - Boot Firmware Table 589 u32 error_severity;
791 * 590 u16 revision;
792 ******************************************************************************/ 591 u8 validation_bits;
793
794struct acpi_table_ibft {
795 struct acpi_table_header header; /* Common ACPI table header */
796 u8 reserved[12];
797};
798
799/* IBFT common subtable header */
800
801struct acpi_ibft_header {
802 u8 type;
803 u8 version;
804 u16 length;
805 u8 index;
806 u8 flags; 592 u8 flags;
807}; 593 u32 error_data_length;
808 594 u8 fru_id[16];
809/* Values for Type field above */ 595 u8 fru_text[20];
810
811enum acpi_ibft_type {
812 ACPI_IBFT_TYPE_NOT_USED = 0,
813 ACPI_IBFT_TYPE_CONTROL = 1,
814 ACPI_IBFT_TYPE_INITIATOR = 2,
815 ACPI_IBFT_TYPE_NIC = 3,
816 ACPI_IBFT_TYPE_TARGET = 4,
817 ACPI_IBFT_TYPE_EXTENSIONS = 5,
818 ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */
819};
820
821/* IBFT subtables */
822
823struct acpi_ibft_control {
824 struct acpi_ibft_header header;
825 u16 extensions;
826 u16 initiator_offset;
827 u16 nic0_offset;
828 u16 target0_offset;
829 u16 nic1_offset;
830 u16 target1_offset;
831};
832
833struct acpi_ibft_initiator {
834 struct acpi_ibft_header header;
835 u8 sns_server[16];
836 u8 slp_server[16];
837 u8 primary_server[16];
838 u8 secondary_server[16];
839 u16 name_length;
840 u16 name_offset;
841};
842
843struct acpi_ibft_nic {
844 struct acpi_ibft_header header;
845 u8 ip_address[16];
846 u8 subnet_mask_prefix;
847 u8 origin;
848 u8 gateway[16];
849 u8 primary_dns[16];
850 u8 secondary_dns[16];
851 u8 dhcp[16];
852 u16 vlan;
853 u8 mac_address[6];
854 u16 pci_address;
855 u16 name_length;
856 u16 name_offset;
857};
858
859struct acpi_ibft_target {
860 struct acpi_ibft_header header;
861 u8 target_ip_address[16];
862 u16 target_ip_socket;
863 u8 target_boot_lun[8];
864 u8 chap_type;
865 u8 nic_association;
866 u16 target_name_length;
867 u16 target_name_offset;
868 u16 chap_name_length;
869 u16 chap_name_offset;
870 u16 chap_secret_length;
871 u16 chap_secret_offset;
872 u16 reverse_chap_name_length;
873 u16 reverse_chap_name_offset;
874 u16 reverse_chap_secret_length;
875 u16 reverse_chap_secret_offset;
876}; 596};
877 597
878/******************************************************************************* 598/*******************************************************************************
879 * 599 *
880 * MADT - Multiple APIC Description Table 600 * MADT - Multiple APIC Description Table
601 * Version 3
881 * 602 *
882 ******************************************************************************/ 603 ******************************************************************************/
883 604
@@ -887,16 +608,16 @@ struct acpi_table_madt {
887 u32 flags; 608 u32 flags;
888}; 609};
889 610
890/* Flags */ 611/* Masks for Flags field above */
891 612
892#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */ 613#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */
893 614
894/* Values for PCATCompat flag */ 615/* Values for PCATCompat flag */
895 616
896#define ACPI_MADT_DUAL_PIC 0 617#define ACPI_MADT_DUAL_PIC 0
897#define ACPI_MADT_MULTIPLE_APIC 1 618#define ACPI_MADT_MULTIPLE_APIC 1
898 619
899/* Values for subtable type in struct acpi_subtable_header */ 620/* Values for MADT subtable type in struct acpi_subtable_header */
900 621
901enum acpi_madt_type { 622enum acpi_madt_type {
902 ACPI_MADT_TYPE_LOCAL_APIC = 0, 623 ACPI_MADT_TYPE_LOCAL_APIC = 0,
@@ -1007,11 +728,11 @@ struct acpi_madt_interrupt_source {
1007 u32 flags; /* Interrupt Source Flags */ 728 u32 flags; /* Interrupt Source Flags */
1008}; 729};
1009 730
1010/* Flags field above */ 731/* Masks for Flags field above */
1011 732
1012#define ACPI_MADT_CPEI_OVERRIDE (1) 733#define ACPI_MADT_CPEI_OVERRIDE (1)
1013 734
1014/* 9: Processor Local X2_APIC (07/2008) */ 735/* 9: Processor Local X2APIC (ACPI 4.0) */
1015 736
1016struct acpi_madt_local_x2apic { 737struct acpi_madt_local_x2apic {
1017 struct acpi_subtable_header header; 738 struct acpi_subtable_header header;
@@ -1021,7 +742,7 @@ struct acpi_madt_local_x2apic {
1021 u32 uid; /* ACPI processor UID */ 742 u32 uid; /* ACPI processor UID */
1022}; 743};
1023 744
1024/* 10: Local X2APIC NMI (07/2008) */ 745/* 10: Local X2APIC NMI (ACPI 4.0) */
1025 746
1026struct acpi_madt_local_x2apic_nmi { 747struct acpi_madt_local_x2apic_nmi {
1027 struct acpi_subtable_header header; 748 struct acpi_subtable_header header;
@@ -1058,28 +779,34 @@ struct acpi_madt_local_x2apic_nmi {
1058 779
1059/******************************************************************************* 780/*******************************************************************************
1060 * 781 *
1061 * MCFG - PCI Memory Mapped Configuration table and sub-table 782 * MSCT - Maximum System Characteristics Table (ACPI 4.0)
783 * Version 1
1062 * 784 *
1063 ******************************************************************************/ 785 ******************************************************************************/
1064 786
1065struct acpi_table_mcfg { 787struct acpi_table_msct {
1066 struct acpi_table_header header; /* Common ACPI table header */ 788 struct acpi_table_header header; /* Common ACPI table header */
1067 u8 reserved[8]; 789 u32 proximity_offset; /* Location of proximity info struct(s) */
790 u32 max_proximity_domains; /* Max number of proximity domains */
791 u32 max_clock_domains; /* Max number of clock domains */
792 u64 max_address; /* Max physical address in system */
1068}; 793};
1069 794
1070/* Subtable */ 795/* Subtable - Maximum Proximity Domain Information. Version 1 */
1071 796
1072struct acpi_mcfg_allocation { 797struct acpi_msct_proximity {
1073 u64 address; /* Base address, processor-relative */ 798 u8 revision;
1074 u16 pci_segment; /* PCI segment group number */ 799 u8 length;
1075 u8 start_bus_number; /* Starting PCI Bus number */ 800 u32 range_start; /* Start of domain range */
1076 u8 end_bus_number; /* Final PCI Bus number */ 801 u32 range_end; /* End of domain range */
1077 u32 reserved; 802 u32 processor_capacity;
803 u64 memory_capacity; /* In bytes */
1078}; 804};
1079 805
1080/******************************************************************************* 806/*******************************************************************************
1081 * 807 *
1082 * SBST - Smart Battery Specification Table 808 * SBST - Smart Battery Specification Table
809 * Version 1
1083 * 810 *
1084 ******************************************************************************/ 811 ******************************************************************************/
1085 812
@@ -1093,6 +820,7 @@ struct acpi_table_sbst {
1093/******************************************************************************* 820/*******************************************************************************
1094 * 821 *
1095 * SLIT - System Locality Distance Information Table 822 * SLIT - System Locality Distance Information Table
823 * Version 1
1096 * 824 *
1097 ******************************************************************************/ 825 ******************************************************************************/
1098 826
@@ -1104,60 +832,8 @@ struct acpi_table_slit {
1104 832
1105/******************************************************************************* 833/*******************************************************************************
1106 * 834 *
1107 * SPCR - Serial Port Console Redirection table
1108 *
1109 ******************************************************************************/
1110
1111struct acpi_table_spcr {
1112 struct acpi_table_header header; /* Common ACPI table header */
1113 u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
1114 u8 reserved[3];
1115 struct acpi_generic_address serial_port;
1116 u8 interrupt_type;
1117 u8 pc_interrupt;
1118 u32 interrupt;
1119 u8 baud_rate;
1120 u8 parity;
1121 u8 stop_bits;
1122 u8 flow_control;
1123 u8 terminal_type;
1124 u8 reserved1;
1125 u16 pci_device_id;
1126 u16 pci_vendor_id;
1127 u8 pci_bus;
1128 u8 pci_device;
1129 u8 pci_function;
1130 u32 pci_flags;
1131 u8 pci_segment;
1132 u32 reserved2;
1133};
1134
1135/*******************************************************************************
1136 *
1137 * SPMI - Server Platform Management Interface table
1138 *
1139 ******************************************************************************/
1140
1141struct acpi_table_spmi {
1142 struct acpi_table_header header; /* Common ACPI table header */
1143 u8 reserved;
1144 u8 interface_type;
1145 u16 spec_revision; /* Version of IPMI */
1146 u8 interrupt_type;
1147 u8 gpe_number; /* GPE assigned */
1148 u8 reserved1;
1149 u8 pci_device_flag;
1150 u32 interrupt;
1151 struct acpi_generic_address ipmi_register;
1152 u8 pci_segment;
1153 u8 pci_bus;
1154 u8 pci_device;
1155 u8 pci_function;
1156};
1157
1158/*******************************************************************************
1159 *
1160 * SRAT - System Resource Affinity Table 835 * SRAT - System Resource Affinity Table
836 * Version 3
1161 * 837 *
1162 ******************************************************************************/ 838 ******************************************************************************/
1163 839
@@ -1192,6 +868,10 @@ struct acpi_srat_cpu_affinity {
1192 u32 reserved; /* Reserved, must be zero */ 868 u32 reserved; /* Reserved, must be zero */
1193}; 869};
1194 870
871/* Flags */
872
873#define ACPI_SRAT_CPU_USE_AFFINITY (1) /* 00: Use affinity structure */
874
1195/* 1: Memory Affinity */ 875/* 1: Memory Affinity */
1196 876
1197struct acpi_srat_mem_affinity { 877struct acpi_srat_mem_affinity {
@@ -1211,7 +891,7 @@ struct acpi_srat_mem_affinity {
1211#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ 891#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */
1212#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ 892#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */
1213 893
1214/* 2: Processor Local X2_APIC Affinity (07/2008) */ 894/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */
1215 895
1216struct acpi_srat_x2apic_cpu_affinity { 896struct acpi_srat_x2apic_cpu_affinity {
1217 struct acpi_subtable_header header; 897 struct acpi_subtable_header header;
@@ -1219,122 +899,14 @@ struct acpi_srat_x2apic_cpu_affinity {
1219 u32 proximity_domain; 899 u32 proximity_domain;
1220 u32 apic_id; 900 u32 apic_id;
1221 u32 flags; 901 u32 flags;
902 u32 clock_domain;
903 u32 reserved2;
1222}; 904};
1223 905
1224/* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */ 906/* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */
1225 907
1226#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ 908#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
1227 909
1228/*******************************************************************************
1229 *
1230 * TCPA - Trusted Computing Platform Alliance table
1231 *
1232 ******************************************************************************/
1233
1234struct acpi_table_tcpa {
1235 struct acpi_table_header header; /* Common ACPI table header */
1236 u16 reserved;
1237 u32 max_log_length; /* Maximum length for the event log area */
1238 u64 log_address; /* Address of the event log area */
1239};
1240
1241/*******************************************************************************
1242 *
1243 * UEFI - UEFI Boot optimization Table
1244 *
1245 ******************************************************************************/
1246
1247struct acpi_table_uefi {
1248 struct acpi_table_header header; /* Common ACPI table header */
1249 u8 identifier[16]; /* UUID identifier */
1250 u16 data_offset; /* Offset of remaining data in table */
1251 u8 data;
1252};
1253
1254/*******************************************************************************
1255 *
1256 * WDAT - Watchdog Action Table
1257 *
1258 ******************************************************************************/
1259
1260struct acpi_table_wdat {
1261 struct acpi_table_header header; /* Common ACPI table header */
1262 u32 header_length; /* Watchdog Header Length */
1263 u16 pci_segment; /* PCI Segment number */
1264 u8 pci_bus; /* PCI Bus number */
1265 u8 pci_device; /* PCI Device number */
1266 u8 pci_function; /* PCI Function number */
1267 u8 reserved[3];
1268 u32 timer_period; /* Period of one timer count (msec) */
1269 u32 max_count; /* Maximum counter value supported */
1270 u32 min_count; /* Minimum counter value */
1271 u8 flags;
1272 u8 reserved2[3];
1273 u32 entries; /* Number of watchdog entries that follow */
1274};
1275
1276/* WDAT Instruction Entries (actions) */
1277
1278struct acpi_wdat_entry {
1279 struct acpi_whea_header whea_header; /* Common header for WHEA tables */
1280};
1281
1282/* Values for Action field above */
1283
1284enum acpi_wdat_actions {
1285 ACPI_WDAT_RESET = 1,
1286 ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4,
1287 ACPI_WDAT_GET_COUNTDOWN = 5,
1288 ACPI_WDAT_SET_COUNTDOWN = 6,
1289 ACPI_WDAT_GET_RUNNING_STATE = 8,
1290 ACPI_WDAT_SET_RUNNING_STATE = 9,
1291 ACPI_WDAT_GET_STOPPED_STATE = 10,
1292 ACPI_WDAT_SET_STOPPED_STATE = 11,
1293 ACPI_WDAT_GET_REBOOT = 16,
1294 ACPI_WDAT_SET_REBOOT = 17,
1295 ACPI_WDAT_GET_SHUTDOWN = 18,
1296 ACPI_WDAT_SET_SHUTDOWN = 19,
1297 ACPI_WDAT_GET_STATUS = 32,
1298 ACPI_WDAT_SET_STATUS = 33,
1299 ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */
1300};
1301
1302/* Values for Instruction field above */
1303
1304enum acpi_wdat_instructions {
1305 ACPI_WDAT_READ_VALUE = 0,
1306 ACPI_WDAT_READ_COUNTDOWN = 1,
1307 ACPI_WDAT_WRITE_VALUE = 2,
1308 ACPI_WDAT_WRITE_COUNTDOWN = 3,
1309 ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */
1310 ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */
1311};
1312
1313/*******************************************************************************
1314 *
1315 * WDRT - Watchdog Resource Table
1316 *
1317 ******************************************************************************/
1318
1319struct acpi_table_wdrt {
1320 struct acpi_table_header header; /* Common ACPI table header */
1321 u32 header_length; /* Watchdog Header Length */
1322 u8 pci_segment; /* PCI Segment number */
1323 u8 pci_bus; /* PCI Bus number */
1324 u8 pci_device; /* PCI Device number */
1325 u8 pci_function; /* PCI Function number */
1326 u32 timer_period; /* Period of one timer count (msec) */
1327 u32 max_count; /* Maximum counter value supported */
1328 u32 min_count; /* Minimum counter value */
1329 u8 flags;
1330 u8 reserved[3];
1331 u32 entries; /* Number of watchdog entries that follow */
1332};
1333
1334/* Flags */
1335
1336#define ACPI_WDRT_TIMER_ENABLED (1) /* 00: Timer enabled */
1337
1338/* Reset to default packing */ 910/* Reset to default packing */
1339 911
1340#pragma pack() 912#pragma pack()
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
new file mode 100644
index 000000000000..6f3dce9991e1
--- /dev/null
+++ b/include/acpi/actbl2.h
@@ -0,0 +1,868 @@
1#ifndef __ACTBL2_H__
2#define __ACTBL2_H__
3
4/*******************************************************************************
5 *
6 * Additional ACPI Tables (2)
7 *
8 * These tables are not consumed directly by the ACPICA subsystem, but are
9 * included here to support device drivers and the AML disassembler.
10 *
11 * The tables in this file are defined by third-party specifications, and are
12 * not defined directly by the ACPI specification itself.
13 *
14 ******************************************************************************/
15
16/*
17 * Values for description table header signatures for tables defined in this
18 * file. Useful because they make it more difficult to inadvertently type in
19 * the wrong signature.
20 */
21#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
22#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
23#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
24#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */
25#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
26#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */
27#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
28#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
29#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
30#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
31#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
32#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
33#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */
34#define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */
35#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */
36#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
37
38/*
39 * All tables must be byte-packed to match the ACPI specification, since
40 * the tables are provided by the system BIOS.
41 */
42#pragma pack(1)
43
44/*
45 * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
46 * This is the only type that is even remotely portable. Anything else is not
47 * portable, so do not use any other bitfield types.
48 */
49
50/*******************************************************************************
51 *
52 * ASF - Alert Standard Format table (Signature "ASF!")
53 * Revision 0x10
54 *
55 * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003
56 *
57 ******************************************************************************/
58
59struct acpi_table_asf {
60 struct acpi_table_header header; /* Common ACPI table header */
61};
62
63/* ASF subtable header */
64
65struct acpi_asf_header {
66 u8 type;
67 u8 reserved;
68 u16 length;
69};
70
71/* Values for Type field above */
72
73enum acpi_asf_type {
74 ACPI_ASF_TYPE_INFO = 0,
75 ACPI_ASF_TYPE_ALERT = 1,
76 ACPI_ASF_TYPE_CONTROL = 2,
77 ACPI_ASF_TYPE_BOOT = 3,
78 ACPI_ASF_TYPE_ADDRESS = 4,
79 ACPI_ASF_TYPE_RESERVED = 5
80};
81
82/*
83 * ASF subtables
84 */
85
86/* 0: ASF Information */
87
88struct acpi_asf_info {
89 struct acpi_asf_header header;
90 u8 min_reset_value;
91 u8 min_poll_interval;
92 u16 system_id;
93 u32 mfg_id;
94 u8 flags;
95 u8 reserved2[3];
96};
97
98/* Masks for Flags field above */
99
100#define ACPI_ASF_SMBUS_PROTOCOLS (1)
101
102/* 1: ASF Alerts */
103
104struct acpi_asf_alert {
105 struct acpi_asf_header header;
106 u8 assert_mask;
107 u8 deassert_mask;
108 u8 alerts;
109 u8 data_length;
110};
111
112struct acpi_asf_alert_data {
113 u8 address;
114 u8 command;
115 u8 mask;
116 u8 value;
117 u8 sensor_type;
118 u8 type;
119 u8 offset;
120 u8 source_type;
121 u8 severity;
122 u8 sensor_number;
123 u8 entity;
124 u8 instance;
125};
126
127/* 2: ASF Remote Control */
128
129struct acpi_asf_remote {
130 struct acpi_asf_header header;
131 u8 controls;
132 u8 data_length;
133 u16 reserved2;
134};
135
136struct acpi_asf_control_data {
137 u8 function;
138 u8 address;
139 u8 command;
140 u8 value;
141};
142
143/* 3: ASF RMCP Boot Options */
144
145struct acpi_asf_rmcp {
146 struct acpi_asf_header header;
147 u8 capabilities[7];
148 u8 completion_code;
149 u32 enterprise_id;
150 u8 command;
151 u16 parameter;
152 u16 boot_options;
153 u16 oem_parameters;
154};
155
156/* 4: ASF Address */
157
158struct acpi_asf_address {
159 struct acpi_asf_header header;
160 u8 eprom_address;
161 u8 devices;
162};
163
164/*******************************************************************************
165 *
166 * BOOT - Simple Boot Flag Table
167 * Version 1
168 *
169 * Conforms to the "Simple Boot Flag Specification", Version 2.1
170 *
171 ******************************************************************************/
172
173struct acpi_table_boot {
174 struct acpi_table_header header; /* Common ACPI table header */
175 u8 cmos_index; /* Index in CMOS RAM for the boot register */
176 u8 reserved[3];
177};
178
179/*******************************************************************************
180 *
181 * DBGP - Debug Port table
182 * Version 1
183 *
184 * Conforms to the "Debug Port Specification", Version 1.00, 2/9/2000
185 *
186 ******************************************************************************/
187
188struct acpi_table_dbgp {
189 struct acpi_table_header header; /* Common ACPI table header */
190 u8 type; /* 0=full 16550, 1=subset of 16550 */
191 u8 reserved[3];
192 struct acpi_generic_address debug_port;
193};
194
195/*******************************************************************************
196 *
197 * DMAR - DMA Remapping table
198 * Version 1
199 *
200 * Conforms to "Intel Virtualization Technology for Directed I/O",
201 * Version 1.2, Sept. 2008
202 *
203 ******************************************************************************/
204
205struct acpi_table_dmar {
206 struct acpi_table_header header; /* Common ACPI table header */
207 u8 width; /* Host Address Width */
208 u8 flags;
209 u8 reserved[10];
210};
211
212/* Masks for Flags field above */
213
214#define ACPI_DMAR_INTR_REMAP (1)
215
216/* DMAR subtable header */
217
218struct acpi_dmar_header {
219 u16 type;
220 u16 length;
221};
222
223/* Values for subtable type in struct acpi_dmar_header */
224
225enum acpi_dmar_type {
226 ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,
227 ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
228 ACPI_DMAR_TYPE_ATSR = 2,
229 ACPI_DMAR_HARDWARE_AFFINITY = 3,
230 ACPI_DMAR_TYPE_RESERVED = 4 /* 4 and greater are reserved */
231};
232
233/* DMAR Device Scope structure */
234
235struct acpi_dmar_device_scope {
236 u8 entry_type;
237 u8 length;
238 u16 reserved;
239 u8 enumeration_id;
240 u8 bus;
241};
242
243/* Values for entry_type in struct acpi_dmar_device_scope */
244
245enum acpi_dmar_scope_type {
246 ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
247 ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1,
248 ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2,
249 ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3,
250 ACPI_DMAR_SCOPE_TYPE_HPET = 4,
251 ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */
252};
253
254struct acpi_dmar_pci_path {
255 u8 dev;
256 u8 fn;
257};
258
259/*
260 * DMAR Sub-tables, correspond to Type in struct acpi_dmar_header
261 */
262
263/* 0: Hardware Unit Definition */
264
265struct acpi_dmar_hardware_unit {
266 struct acpi_dmar_header header;
267 u8 flags;
268 u8 reserved;
269 u16 segment;
270 u64 address; /* Register Base Address */
271};
272
273/* Masks for Flags field above */
274
275#define ACPI_DMAR_INCLUDE_ALL (1)
276
277/* 1: Reserved Memory Defininition */
278
279struct acpi_dmar_reserved_memory {
280 struct acpi_dmar_header header;
281 u16 reserved;
282 u16 segment;
283 u64 base_address; /* 4_k aligned base address */
284 u64 end_address; /* 4_k aligned limit address */
285};
286
287/* Masks for Flags field above */
288
289#define ACPI_DMAR_ALLOW_ALL (1)
290
291/* 2: Root Port ATS Capability Reporting Structure */
292
293struct acpi_dmar_atsr {
294 struct acpi_dmar_header header;
295 u8 flags;
296 u8 reserved;
297 u16 segment;
298};
299
300/* Masks for Flags field above */
301
302#define ACPI_DMAR_ALL_PORTS (1)
303
304/* 3: Remapping Hardware Static Affinity Structure */
305
306struct acpi_dmar_rhsa {
307 struct acpi_dmar_header header;
308 u32 reserved;
309 u64 base_address;
310 u32 proximity_domain;
311};
312
313/*******************************************************************************
314 *
315 * HPET - High Precision Event Timer table
316 * Version 1
317 *
318 * Conforms to "IA-PC HPET (High Precision Event Timers) Specification",
319 * Version 1.0a, October 2004
320 *
321 ******************************************************************************/
322
323struct acpi_table_hpet {
324 struct acpi_table_header header; /* Common ACPI table header */
325 u32 id; /* Hardware ID of event timer block */
326 struct acpi_generic_address address; /* Address of event timer block */
327 u8 sequence; /* HPET sequence number */
328 u16 minimum_tick; /* Main counter min tick, periodic mode */
329 u8 flags;
330};
331
332/* Masks for Flags field above */
333
334#define ACPI_HPET_PAGE_PROTECT_MASK (3)
335
336/* Values for Page Protect flags */
337
338enum acpi_hpet_page_protect {
339 ACPI_HPET_NO_PAGE_PROTECT = 0,
340 ACPI_HPET_PAGE_PROTECT4 = 1,
341 ACPI_HPET_PAGE_PROTECT64 = 2
342};
343
344/*******************************************************************************
345 *
346 * IBFT - Boot Firmware Table
347 * Version 1
348 *
349 * Conforms to "iSCSI Boot Firmware Table (iBFT) as Defined in ACPI 3.0b
350 * Specification", Version 1.01, March 1, 2007
351 *
352 * Note: It appears that this table is not intended to appear in the RSDT/XSDT.
353 * Therefore, it is not currently supported by the disassembler.
354 *
355 ******************************************************************************/
356
357struct acpi_table_ibft {
358 struct acpi_table_header header; /* Common ACPI table header */
359 u8 reserved[12];
360};
361
362/* IBFT common subtable header */
363
364struct acpi_ibft_header {
365 u8 type;
366 u8 version;
367 u16 length;
368 u8 index;
369 u8 flags;
370};
371
372/* Values for Type field above */
373
374enum acpi_ibft_type {
375 ACPI_IBFT_TYPE_NOT_USED = 0,
376 ACPI_IBFT_TYPE_CONTROL = 1,
377 ACPI_IBFT_TYPE_INITIATOR = 2,
378 ACPI_IBFT_TYPE_NIC = 3,
379 ACPI_IBFT_TYPE_TARGET = 4,
380 ACPI_IBFT_TYPE_EXTENSIONS = 5,
381 ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */
382};
383
384/* IBFT subtables */
385
386struct acpi_ibft_control {
387 struct acpi_ibft_header header;
388 u16 extensions;
389 u16 initiator_offset;
390 u16 nic0_offset;
391 u16 target0_offset;
392 u16 nic1_offset;
393 u16 target1_offset;
394};
395
396struct acpi_ibft_initiator {
397 struct acpi_ibft_header header;
398 u8 sns_server[16];
399 u8 slp_server[16];
400 u8 primary_server[16];
401 u8 secondary_server[16];
402 u16 name_length;
403 u16 name_offset;
404};
405
406struct acpi_ibft_nic {
407 struct acpi_ibft_header header;
408 u8 ip_address[16];
409 u8 subnet_mask_prefix;
410 u8 origin;
411 u8 gateway[16];
412 u8 primary_dns[16];
413 u8 secondary_dns[16];
414 u8 dhcp[16];
415 u16 vlan;
416 u8 mac_address[6];
417 u16 pci_address;
418 u16 name_length;
419 u16 name_offset;
420};
421
422struct acpi_ibft_target {
423 struct acpi_ibft_header header;
424 u8 target_ip_address[16];
425 u16 target_ip_socket;
426 u8 target_boot_lun[8];
427 u8 chap_type;
428 u8 nic_association;
429 u16 target_name_length;
430 u16 target_name_offset;
431 u16 chap_name_length;
432 u16 chap_name_offset;
433 u16 chap_secret_length;
434 u16 chap_secret_offset;
435 u16 reverse_chap_name_length;
436 u16 reverse_chap_name_offset;
437 u16 reverse_chap_secret_length;
438 u16 reverse_chap_secret_offset;
439};
440
441/*******************************************************************************
442 *
443 * IVRS - I/O Virtualization Reporting Structure
444 * Version 1
445 *
446 * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification",
447 * Revision 1.26, February 2009.
448 *
449 ******************************************************************************/
450
451struct acpi_table_ivrs {
452 struct acpi_table_header header; /* Common ACPI table header */
453 u32 info; /* Common virtualization info */
454 u64 reserved;
455};
456
457/* Values for Info field above */
458
459#define ACPI_IVRS_PHYSICAL_SIZE 0x00007F00 /* 7 bits, physical address size */
460#define ACPI_IVRS_VIRTUAL_SIZE 0x003F8000 /* 7 bits, virtual address size */
461#define ACPI_IVRS_ATS_RESERVED 0x00400000 /* ATS address translation range reserved */
462
463/* IVRS subtable header */
464
465struct acpi_ivrs_header {
466 u8 type; /* Subtable type */
467 u8 flags;
468 u16 length; /* Subtable length */
469 u16 device_id; /* ID of IOMMU */
470};
471
472/* Values for subtable Type above */
473
474enum acpi_ivrs_type {
475 ACPI_IVRS_TYPE_HARDWARE = 0x10,
476 ACPI_IVRS_TYPE_MEMORY1 = 0x20,
477 ACPI_IVRS_TYPE_MEMORY2 = 0x21,
478 ACPI_IVRS_TYPE_MEMORY3 = 0x22
479};
480
481/* Masks for Flags field above for IVHD subtable */
482
483#define ACPI_IVHD_TT_ENABLE (1)
484#define ACPI_IVHD_PASS_PW (1<<1)
485#define ACPI_IVHD_RES_PASS_PW (1<<2)
486#define ACPI_IVHD_ISOC (1<<3)
487#define ACPI_IVHD_IOTLB (1<<4)
488
489/* Masks for Flags field above for IVMD subtable */
490
491#define ACPI_IVMD_UNITY (1)
492#define ACPI_IVMD_READ (1<<1)
493#define ACPI_IVMD_WRITE (1<<2)
494#define ACPI_IVMD_EXCLUSION_RANGE (1<<3)
495
496/*
497 * IVRS subtables, correspond to Type in struct acpi_ivrs_header
498 */
499
500/* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */
501
502struct acpi_ivrs_hardware {
503 struct acpi_ivrs_header header;
504 u16 capability_offset; /* Offset for IOMMU control fields */
505 u64 base_address; /* IOMMU control registers */
506 u16 pci_segment_group;
507 u16 info; /* MSI number and unit ID */
508 u32 reserved;
509};
510
511/* Masks for Info field above */
512
513#define ACPI_IVHD_MSI_NUMBER_MASK 0x001F /* 5 bits, MSI message number */
514#define ACPI_IVHD_UNIT_ID_MASK 0x1F00 /* 5 bits, unit_iD */
515
516/*
517 * Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure.
518 * Upper two bits of the Type field are the (encoded) length of the structure.
519 * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries
520 * are reserved for future use but not defined.
521 */
522struct acpi_ivrs_de_header {
523 u8 type;
524 u16 id;
525 u8 data_setting;
526};
527
528/* Length of device entry is in the top two bits of Type field above */
529
530#define ACPI_IVHD_ENTRY_LENGTH 0xC0
531
532/* Values for device entry Type field above */
533
534enum acpi_ivrs_device_entry_type {
535 /* 4-byte device entries, all use struct acpi_ivrs_device4 */
536
537 ACPI_IVRS_TYPE_PAD4 = 0,
538 ACPI_IVRS_TYPE_ALL = 1,
539 ACPI_IVRS_TYPE_SELECT = 2,
540 ACPI_IVRS_TYPE_START = 3,
541 ACPI_IVRS_TYPE_END = 4,
542
543 /* 8-byte device entries */
544
545 ACPI_IVRS_TYPE_PAD8 = 64,
546 ACPI_IVRS_TYPE_NOT_USED = 65,
547 ACPI_IVRS_TYPE_ALIAS_SELECT = 66, /* Uses struct acpi_ivrs_device8a */
548 ACPI_IVRS_TYPE_ALIAS_START = 67, /* Uses struct acpi_ivrs_device8a */
549 ACPI_IVRS_TYPE_EXT_SELECT = 70, /* Uses struct acpi_ivrs_device8b */
550 ACPI_IVRS_TYPE_EXT_START = 71, /* Uses struct acpi_ivrs_device8b */
551 ACPI_IVRS_TYPE_SPECIAL = 72 /* Uses struct acpi_ivrs_device8c */
552};
553
554/* Values for Data field above */
555
556#define ACPI_IVHD_INIT_PASS (1)
557#define ACPI_IVHD_EINT_PASS (1<<1)
558#define ACPI_IVHD_NMI_PASS (1<<2)
559#define ACPI_IVHD_SYSTEM_MGMT (3<<4)
560#define ACPI_IVHD_LINT0_PASS (1<<6)
561#define ACPI_IVHD_LINT1_PASS (1<<7)
562
563/* Types 0-4: 4-byte device entry */
564
565struct acpi_ivrs_device4 {
566 struct acpi_ivrs_de_header header;
567};
568
569/* Types 66-67: 8-byte device entry */
570
571struct acpi_ivrs_device8a {
572 struct acpi_ivrs_de_header header;
573 u8 reserved1;
574 u16 used_id;
575 u8 reserved2;
576};
577
578/* Types 70-71: 8-byte device entry */
579
580struct acpi_ivrs_device8b {
581 struct acpi_ivrs_de_header header;
582 u32 extended_data;
583};
584
585/* Values for extended_data above */
586
587#define ACPI_IVHD_ATS_DISABLED (1<<31)
588
589/* Type 72: 8-byte device entry */
590
591struct acpi_ivrs_device8c {
592 struct acpi_ivrs_de_header header;
593 u8 handle;
594 u16 used_id;
595 u8 variety;
596};
597
598/* Values for Variety field above */
599
600#define ACPI_IVHD_IOAPIC 1
601#define ACPI_IVHD_HPET 2
602
603/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */
604
605struct acpi_ivrs_memory {
606 struct acpi_ivrs_header header;
607 u16 aux_data;
608 u64 reserved;
609 u64 start_address;
610 u64 memory_length;
611};
612
613/*******************************************************************************
614 *
615 * MCFG - PCI Memory Mapped Configuration table and sub-table
616 * Version 1
617 *
618 * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005
619 *
620 ******************************************************************************/
621
622struct acpi_table_mcfg {
623 struct acpi_table_header header; /* Common ACPI table header */
624 u8 reserved[8];
625};
626
627/* Subtable */
628
629struct acpi_mcfg_allocation {
630 u64 address; /* Base address, processor-relative */
631 u16 pci_segment; /* PCI segment group number */
632 u8 start_bus_number; /* Starting PCI Bus number */
633 u8 end_bus_number; /* Final PCI Bus number */
634 u32 reserved;
635};
636
637/*******************************************************************************
638 *
639 * SPCR - Serial Port Console Redirection table
640 * Version 1
641 *
642 * Conforms to "Serial Port Console Redirection Table",
643 * Version 1.00, January 11, 2002
644 *
645 ******************************************************************************/
646
647struct acpi_table_spcr {
648 struct acpi_table_header header; /* Common ACPI table header */
649 u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
650 u8 reserved[3];
651 struct acpi_generic_address serial_port;
652 u8 interrupt_type;
653 u8 pc_interrupt;
654 u32 interrupt;
655 u8 baud_rate;
656 u8 parity;
657 u8 stop_bits;
658 u8 flow_control;
659 u8 terminal_type;
660 u8 reserved1;
661 u16 pci_device_id;
662 u16 pci_vendor_id;
663 u8 pci_bus;
664 u8 pci_device;
665 u8 pci_function;
666 u32 pci_flags;
667 u8 pci_segment;
668 u32 reserved2;
669};
670
671/* Masks for pci_flags field above */
672
673#define ACPI_SPCR_DO_NOT_DISABLE (1)
674
675/*******************************************************************************
676 *
677 * SPMI - Server Platform Management Interface table
678 * Version 5
679 *
680 * Conforms to "Intelligent Platform Management Interface Specification
681 * Second Generation v2.0", Document Revision 1.0, February 12, 2004 with
682 * June 12, 2009 markup.
683 *
684 ******************************************************************************/
685
686struct acpi_table_spmi {
687 struct acpi_table_header header; /* Common ACPI table header */
688 u8 interface_type;
689 u8 reserved; /* Must be 1 */
690 u16 spec_revision; /* Version of IPMI */
691 u8 interrupt_type;
692 u8 gpe_number; /* GPE assigned */
693 u8 reserved1;
694 u8 pci_device_flag;
695 u32 interrupt;
696 struct acpi_generic_address ipmi_register;
697 u8 pci_segment;
698 u8 pci_bus;
699 u8 pci_device;
700 u8 pci_function;
701 u8 reserved2;
702};
703
704/* Values for interface_type above */
705
706enum acpi_spmi_interface_types {
707 ACPI_SPMI_NOT_USED = 0,
708 ACPI_SPMI_KEYBOARD = 1,
709 ACPI_SPMI_SMI = 2,
710 ACPI_SPMI_BLOCK_TRANSFER = 3,
711 ACPI_SPMI_SMBUS = 4,
712 ACPI_SPMI_RESERVED = 5 /* 5 and above are reserved */
713};
714
715/*******************************************************************************
716 *
717 * TCPA - Trusted Computing Platform Alliance table
718 * Version 1
719 *
720 * Conforms to "TCG PC Specific Implementation Specification",
721 * Version 1.1, August 18, 2003
722 *
723 ******************************************************************************/
724
725struct acpi_table_tcpa {
726 struct acpi_table_header header; /* Common ACPI table header */
727 u16 reserved;
728 u32 max_log_length; /* Maximum length for the event log area */
729 u64 log_address; /* Address of the event log area */
730};
731
732/*******************************************************************************
733 *
734 * UEFI - UEFI Boot optimization Table
735 * Version 1
736 *
737 * Conforms to "Unified Extensible Firmware Interface Specification",
738 * Version 2.3, May 8, 2009
739 *
740 ******************************************************************************/
741
742struct acpi_table_uefi {
743 struct acpi_table_header header; /* Common ACPI table header */
744 u8 identifier[16]; /* UUID identifier */
745 u16 data_offset; /* Offset of remaining data in table */
746};
747
748/*******************************************************************************
749 *
750 * WAET - Windows ACPI Emulated devices Table
751 * Version 1
752 *
753 * Conforms to "Windows ACPI Emulated Devices Table", version 1.0, April 6, 2009
754 *
755 ******************************************************************************/
756
757struct acpi_table_waet {
758 struct acpi_table_header header; /* Common ACPI table header */
759 u32 flags;
760};
761
762/* Masks for Flags field above */
763
764#define ACPI_WAET_RTC_NO_ACK (1) /* RTC requires no int acknowledge */
765#define ACPI_WAET_TIMER_ONE_READ (1<<1) /* PM timer requires only one read */
766
767/*******************************************************************************
768 *
769 * WDAT - Watchdog Action Table
770 * Version 1
771 *
772 * Conforms to "Hardware Watchdog Timers Design Specification",
773 * Copyright 2006 Microsoft Corporation.
774 *
775 ******************************************************************************/
776
777struct acpi_table_wdat {
778 struct acpi_table_header header; /* Common ACPI table header */
779 u32 header_length; /* Watchdog Header Length */
780 u16 pci_segment; /* PCI Segment number */
781 u8 pci_bus; /* PCI Bus number */
782 u8 pci_device; /* PCI Device number */
783 u8 pci_function; /* PCI Function number */
784 u8 reserved[3];
785 u32 timer_period; /* Period of one timer count (msec) */
786 u32 max_count; /* Maximum counter value supported */
787 u32 min_count; /* Minimum counter value */
788 u8 flags;
789 u8 reserved2[3];
790 u32 entries; /* Number of watchdog entries that follow */
791};
792
793/* Masks for Flags field above */
794
795#define ACPI_WDAT_ENABLED (1)
796#define ACPI_WDAT_STOPPED 0x80
797
798/* WDAT Instruction Entries (actions) */
799
800struct acpi_wdat_entry {
801 u8 action;
802 u8 instruction;
803 u16 reserved;
804 struct acpi_generic_address register_region;
805 u32 value; /* Value used with Read/Write register */
806 u32 mask; /* Bitmask required for this register instruction */
807};
808
809/* Values for Action field above */
810
811enum acpi_wdat_actions {
812 ACPI_WDAT_RESET = 1,
813 ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4,
814 ACPI_WDAT_GET_COUNTDOWN = 5,
815 ACPI_WDAT_SET_COUNTDOWN = 6,
816 ACPI_WDAT_GET_RUNNING_STATE = 8,
817 ACPI_WDAT_SET_RUNNING_STATE = 9,
818 ACPI_WDAT_GET_STOPPED_STATE = 10,
819 ACPI_WDAT_SET_STOPPED_STATE = 11,
820 ACPI_WDAT_GET_REBOOT = 16,
821 ACPI_WDAT_SET_REBOOT = 17,
822 ACPI_WDAT_GET_SHUTDOWN = 18,
823 ACPI_WDAT_SET_SHUTDOWN = 19,
824 ACPI_WDAT_GET_STATUS = 32,
825 ACPI_WDAT_SET_STATUS = 33,
826 ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */
827};
828
829/* Values for Instruction field above */
830
831enum acpi_wdat_instructions {
832 ACPI_WDAT_READ_VALUE = 0,
833 ACPI_WDAT_READ_COUNTDOWN = 1,
834 ACPI_WDAT_WRITE_VALUE = 2,
835 ACPI_WDAT_WRITE_COUNTDOWN = 3,
836 ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */
837 ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */
838};
839
840/*******************************************************************************
841 *
842 * WDRT - Watchdog Resource Table
843 * Version 1
844 *
845 * Conforms to "Watchdog Timer Hardware Requirements for Windows Server 2003",
846 * Version 1.01, August 28, 2006
847 *
848 ******************************************************************************/
849
850struct acpi_table_wdrt {
851 struct acpi_table_header header; /* Common ACPI table header */
852 struct acpi_generic_address control_register;
853 struct acpi_generic_address count_register;
854 u16 pci_device_id;
855 u16 pci_vendor_id;
856 u8 pci_bus; /* PCI Bus number */
857 u8 pci_device; /* PCI Device number */
858 u8 pci_function; /* PCI Function number */
859 u8 pci_segment; /* PCI Segment number */
860 u16 max_count; /* Maximum counter value supported */
861 u8 units;
862};
863
864/* Reset to default packing */
865
866#pragma pack()
867
868#endif /* __ACTBL2_H__ */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 37ba576d06e8..ef4601149f49 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -338,7 +338,7 @@ typedef u32 acpi_physical_address;
338 338
339/* PM Timer ticks per second (HZ) */ 339/* PM Timer ticks per second (HZ) */
340 340
341#define PM_TIMER_FREQUENCY 3579545 341#define PM_TIMER_FREQUENCY 3579545
342 342
343/******************************************************************************* 343/*******************************************************************************
344 * 344 *
@@ -732,7 +732,8 @@ typedef u8 acpi_adr_space_type;
732#define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4 732#define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4
733#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5 733#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5
734#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6 734#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6
735#define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7 735#define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7
736#define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 8
736#define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127 737#define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127
737 738
738/* 739/*
@@ -921,7 +922,7 @@ typedef
921void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context); 922void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
922 923
923typedef 924typedef
924void (*acpi_object_handler) (acpi_handle object, u32 function, void *data); 925void (*acpi_object_handler) (acpi_handle object, void *data);
925 926
926typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function); 927typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function);
927 928
@@ -969,38 +970,60 @@ acpi_status(*acpi_walk_callback) (acpi_handle obj_handle,
969#define ACPI_INTERRUPT_NOT_HANDLED 0x00 970#define ACPI_INTERRUPT_NOT_HANDLED 0x00
970#define ACPI_INTERRUPT_HANDLED 0x01 971#define ACPI_INTERRUPT_HANDLED 0x01
971 972
972/* Length of _HID, _UID, _CID, and UUID values */ 973/* Length of 32-bit EISAID values when converted back to a string */
974
975#define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */
976
977/* Length of UUID (string) values */
973 978
974#define ACPI_DEVICE_ID_LENGTH 0x09
975#define ACPI_MAX_CID_LENGTH 48
976#define ACPI_UUID_LENGTH 16 979#define ACPI_UUID_LENGTH 16
977 980
978/* Common string version of device HIDs and UIDs */ 981/* Structures used for device/processor HID, UID, CID */
979 982
980struct acpica_device_id { 983struct acpica_device_id {
981 char value[ACPI_DEVICE_ID_LENGTH]; 984 u32 length; /* Length of string + null */
985 char *string;
982}; 986};
983 987
984/* Common string version of device CIDs */ 988struct acpica_device_id_list {
985 989 u32 count; /* Number of IDs in Ids array */
986struct acpi_compatible_id { 990 u32 list_size; /* Size of list, including ID strings */
987 char value[ACPI_MAX_CID_LENGTH]; 991 struct acpica_device_id ids[1]; /* ID array */
988}; 992};
989 993
990struct acpi_compatible_id_list { 994/*
991 u32 count; 995 * Structure returned from acpi_get_object_info.
992 u32 size; 996 * Optimized for both 32- and 64-bit builds
993 struct acpi_compatible_id id[1]; 997 */
998struct acpi_device_info {
999 u32 info_size; /* Size of info, including ID strings */
1000 u32 name; /* ACPI object Name */
1001 acpi_object_type type; /* ACPI object Type */
1002 u8 param_count; /* If a method, required parameter count */
1003 u8 valid; /* Indicates which optional fields are valid */
1004 u8 flags; /* Miscellaneous info */
1005 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */
1006 u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */
1007 u32 current_status; /* _STA value */
1008 acpi_integer address; /* _ADR value */
1009 struct acpica_device_id hardware_id; /* _HID value */
1010 struct acpica_device_id unique_id; /* _UID value */
1011 struct acpica_device_id_list compatible_id_list; /* _CID list <must be last> */
994}; 1012};
995 1013
996/* Structure and flags for acpi_get_object_info */ 1014/* Values for Flags field above (acpi_get_object_info) */
1015
1016#define ACPI_PCI_ROOT_BRIDGE 0x01
997 1017
998#define ACPI_VALID_STA 0x0001 1018/* Flags for Valid field above (acpi_get_object_info) */
999#define ACPI_VALID_ADR 0x0002 1019
1000#define ACPI_VALID_HID 0x0004 1020#define ACPI_VALID_STA 0x01
1001#define ACPI_VALID_UID 0x0008 1021#define ACPI_VALID_ADR 0x02
1002#define ACPI_VALID_CID 0x0010 1022#define ACPI_VALID_HID 0x04
1003#define ACPI_VALID_SXDS 0x0020 1023#define ACPI_VALID_UID 0x08
1024#define ACPI_VALID_CID 0x10
1025#define ACPI_VALID_SXDS 0x20
1026#define ACPI_VALID_SXWS 0x40
1004 1027
1005/* Flags for _STA method */ 1028/* Flags for _STA method */
1006 1029
@@ -1011,29 +1034,6 @@ struct acpi_compatible_id_list {
1011#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ 1034#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */
1012#define ACPI_STA_BATTERY_PRESENT 0x10 1035#define ACPI_STA_BATTERY_PRESENT 0x10
1013 1036
1014#define ACPI_COMMON_OBJ_INFO \
1015 acpi_object_type type; /* ACPI object type */ \
1016 acpi_name name /* ACPI object Name */
1017
1018struct acpi_obj_info_header {
1019 ACPI_COMMON_OBJ_INFO;
1020};
1021
1022/* Structure returned from Get Object Info */
1023
1024struct acpi_device_info {
1025 ACPI_COMMON_OBJ_INFO;
1026
1027 u32 param_count; /* If a method, required parameter count */
1028 u32 valid; /* Indicates which fields below are valid */
1029 u32 current_status; /* _STA value */
1030 acpi_integer address; /* _ADR value if any */
1031 struct acpica_device_id hardware_id; /* _HID value if any */
1032 struct acpica_device_id unique_id; /* _UID value if any */
1033 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */
1034 struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */
1035};
1036
1037/* Context structs for address space handlers */ 1037/* Context structs for address space handlers */
1038 1038
1039struct acpi_pci_id { 1039struct acpi_pci_id {