aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2006-03-31 00:00:00 -0500
committerLen Brown <len.brown@intel.com>2006-06-14 02:04:16 -0400
commit793c2388cae3fd023b3b5166354931752d42353c (patch)
tree6859cde48677cf1e9b9766cd1d95081a863c060c /drivers/acpi
parent61686124f47d7c4b78610346c5f8f9d8a6d46bb5 (diff)
ACPI: ACPICA 20060331
Implemented header file support for the following additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR, SPMI, TCPA, and WDRT. With this support, all current and known ACPI tables are now defined in the ACPICA headers and are available for use by device drivers and other software. Implemented support to allow tables that contain ACPI names with invalid characters to be loaded. Previously, this would cause the table load to fail, but since there are several known cases of such tables on existing machines, this change was made to enable ACPI support for them. Also, this matches the behavior of the Microsoft ACPI implementation. https://bugzilla.novell.com/show_bug.cgi?id=147621 Fixed a couple regressions introduced during the memory optimization in the 20060317 release. The namespace node definition required additional reorganization and an internal datatype that had been changed to 8-bit was restored to 32-bit. (Valery Podrezov) Fixed a problem where a null pointer passed to acpi_ut_delete_generic_state() could be passed through to acpi_os_release_object which is unexpected. Such null pointers are now trapped and ignored, matching the behavior of the previous implementation before the deployment of acpi_os_release_object(). (Valery Podrezov, Fiodor Suietov) Fixed a memory mapping leak during the deletion of a SystemMemory operation region where a cached memory mapping was not deleted. This became a noticeable problem for operation regions that are defined within frequently used control methods. (Dana Meyers) Reorganized the ACPI table header files into two main files: one for the ACPI tables consumed by the ACPICA core, and another for the miscellaneous ACPI tables that are consumed by the drivers and other software. The various FADT definitions were merged into one common section and three different tables (ACPI 1.0, 1.0+, and 2.0) Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/bus.c2
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c2
-rw-r--r--drivers/acpi/dispatcher/dswexec.c1
-rw-r--r--drivers/acpi/events/evrgnini.c13
-rw-r--r--drivers/acpi/executer/exdump.c6
-rw-r--r--drivers/acpi/executer/exnames.c2
-rw-r--r--drivers/acpi/hardware/hwtimer.c4
-rw-r--r--drivers/acpi/namespace/nsalloc.c2
-rw-r--r--drivers/acpi/namespace/nsdump.c3
-rw-r--r--drivers/acpi/namespace/nssearch.c50
-rw-r--r--drivers/acpi/parser/psloop.c12
-rw-r--r--drivers/acpi/parser/psscope.c4
-rw-r--r--drivers/acpi/resources/rslist.c8
-rw-r--r--drivers/acpi/system.c2
-rw-r--r--drivers/acpi/tables.c4
-rw-r--r--drivers/acpi/tables/tbconvrt.c31
-rw-r--r--drivers/acpi/tables/tbrsdt.c3
-rw-r--r--drivers/acpi/tables/tbutils.c122
-rw-r--r--drivers/acpi/tables/tbxfroot.c9
-rw-r--r--drivers/acpi/utilities/utdebug.c38
-rw-r--r--drivers/acpi/utilities/utdelete.c16
-rw-r--r--drivers/acpi/utilities/utglobal.c2
-rw-r--r--drivers/acpi/utilities/utinit.c6
-rw-r--r--drivers/acpi/utilities/utmisc.c104
-rw-r--r--drivers/acpi/utilities/utresrc.c6
-rw-r--r--drivers/acpi/utilities/utstate.c10
26 files changed, 329 insertions, 133 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 9c4ac0191f64..b3a214db56f6 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -43,7 +43,7 @@ ACPI_MODULE_NAME("acpi_bus")
43extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); 43extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
44#endif 44#endif
45 45
46FADT_DESCRIPTOR acpi_fadt; 46struct fadt_descriptor acpi_fadt;
47EXPORT_SYMBOL(acpi_fadt); 47EXPORT_SYMBOL(acpi_fadt);
48 48
49struct acpi_device *acpi_root; 49struct acpi_device *acpi_root;
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index 238916ce5412..7dc59fc7344f 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -502,7 +502,7 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
502 * Delete any namespace entries created immediately underneath 502 * Delete any namespace entries created immediately underneath
503 * the method 503 * the method
504 */ 504 */
505 if (method_node->child) { 505 if (method_node && method_node->child) {
506 acpi_ns_delete_namespace_subtree(method_node); 506 acpi_ns_delete_namespace_subtree(method_node);
507 } 507 }
508 508
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c
index 198949f41048..8b740b370eb1 100644
--- a/drivers/acpi/dispatcher/dswexec.c
+++ b/drivers/acpi/dispatcher/dswexec.c
@@ -49,7 +49,6 @@
49#include <acpi/acinterp.h> 49#include <acpi/acinterp.h>
50#include <acpi/acnamesp.h> 50#include <acpi/acnamesp.h>
51#include <acpi/acdebug.h> 51#include <acpi/acdebug.h>
52#include <acpi/acdisasm.h>
53 52
54#define _COMPONENT ACPI_DISPATCHER 53#define _COMPONENT ACPI_DISPATCHER
55ACPI_MODULE_NAME("dswexec") 54ACPI_MODULE_NAME("dswexec")
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c
index db98747fe54d..d1809f4240a4 100644
--- a/drivers/acpi/events/evrgnini.c
+++ b/drivers/acpi/events/evrgnini.c
@@ -75,7 +75,18 @@ acpi_ev_system_memory_region_setup(acpi_handle handle,
75 75
76 if (function == ACPI_REGION_DEACTIVATE) { 76 if (function == ACPI_REGION_DEACTIVATE) {
77 if (*region_context) { 77 if (*region_context) {
78 ACPI_FREE(*region_context); 78 local_region_context =
79 (struct acpi_mem_space_context *)*region_context;
80
81 /* Delete a cached mapping if present */
82
83 if (local_region_context->mapped_length) {
84 acpi_os_unmap_memory(local_region_context->
85 mapped_logical_address,
86 local_region_context->
87 mapped_length);
88 }
89 ACPI_FREE(local_region_context);
79 *region_context = NULL; 90 *region_context = NULL;
80 } 91 }
81 return_ACPI_STATUS(AE_OK); 92 return_ACPI_STATUS(AE_OK);
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c
index 56db58b8e23a..1dfebf9e7074 100644
--- a/drivers/acpi/executer/exdump.c
+++ b/drivers/acpi/executer/exdump.c
@@ -61,6 +61,10 @@ static void acpi_ex_out_pointer(char *title, void *value);
61 61
62static void acpi_ex_out_address(char *title, acpi_physical_address value); 62static void acpi_ex_out_address(char *title, acpi_physical_address value);
63 63
64static void
65acpi_ex_dump_object(union acpi_operand_object *obj_desc,
66 struct acpi_exdump_info *info);
67
64static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); 68static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc);
65 69
66static void 70static void
@@ -263,7 +267,7 @@ static struct acpi_exdump_info acpi_ex_dump_field_common[7] = {
263 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} 267 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"}
264}; 268};
265 269
266static struct acpi_exdump_info acpi_ex_dump_node[6] = { 270static struct acpi_exdump_info acpi_ex_dump_node[5] = {
267 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, 271 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL},
268 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, 272 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"},
269 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, 273 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"},
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c
index 80bbc20756a1..085b18f8dd00 100644
--- a/drivers/acpi/executer/exnames.c
+++ b/drivers/acpi/executer/exnames.c
@@ -179,7 +179,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
179 179
180 for (index = 0; 180 for (index = 0;
181 (index < ACPI_NAME_SIZE) 181 (index < ACPI_NAME_SIZE)
182 && (acpi_ut_valid_acpi_character(*aml_address)); index++) { 182 && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) {
183 char_buf[index] = *aml_address++; 183 char_buf[index] = *aml_address++;
184 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); 184 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
185 } 185 }
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c
index 9d53e46bc331..a559ac17b132 100644
--- a/drivers/acpi/hardware/hwtimer.c
+++ b/drivers/acpi/hardware/hwtimer.c
@@ -66,7 +66,7 @@ acpi_status acpi_get_timer_resolution(u32 * resolution)
66 return_ACPI_STATUS(AE_BAD_PARAMETER); 66 return_ACPI_STATUS(AE_BAD_PARAMETER);
67 } 67 }
68 68
69 if (0 == acpi_gbl_FADT->tmr_val_ext) { 69 if (acpi_gbl_FADT->tmr_val_ext == 0) {
70 *resolution = 24; 70 *resolution = 24;
71 } else { 71 } else {
72 *resolution = 32; 72 *resolution = 32;
@@ -153,7 +153,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
153 if (start_ticks < end_ticks) { 153 if (start_ticks < end_ticks) {
154 delta_ticks = end_ticks - start_ticks; 154 delta_ticks = end_ticks - start_ticks;
155 } else if (start_ticks > end_ticks) { 155 } else if (start_ticks > end_ticks) {
156 if (0 == acpi_gbl_FADT->tmr_val_ext) { 156 if (acpi_gbl_FADT->tmr_val_ext == 0) {
157 157
158 /* 24-bit Timer */ 158 /* 24-bit Timer */
159 159
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c
index 8b921c96d6a5..c92c03693a16 100644
--- a/drivers/acpi/namespace/nsalloc.c
+++ b/drivers/acpi/namespace/nsalloc.c
@@ -211,6 +211,8 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp
211 acpi_ut_get_node_name(parent_node), 211 acpi_ut_get_node_name(parent_node),
212 acpi_ut_get_type_name(parent_node->type), 212 acpi_ut_get_type_name(parent_node->type),
213 parent_node)); 213 parent_node));
214
215 return_VOID;
214} 216}
215 217
216/******************************************************************************* 218/*******************************************************************************
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
index e275373b1705..5662d2def62f 100644
--- a/drivers/acpi/namespace/nsdump.c
+++ b/drivers/acpi/namespace/nsdump.c
@@ -204,6 +204,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
204 } 204 }
205 205
206 if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { 206 if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
207 this_node->name.integer =
208 acpi_ut_repair_name(this_node->name.integer);
209
207 ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", 210 ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X",
208 this_node->name.integer)); 211 this_node->name.integer));
209 } 212 }
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c
index c929f45071c0..51adec5a23d6 100644
--- a/drivers/acpi/namespace/nssearch.c
+++ b/drivers/acpi/namespace/nssearch.c
@@ -128,9 +128,8 @@ acpi_ns_search_node(u32 target_name,
128 next_node->object); 128 next_node->object);
129 } 129 }
130 130
131 /* 131 /* Found matching entry */
132 * Found matching entry. 132
133 */
134 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 133 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
135 "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", 134 "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
136 ACPI_CAST_PTR(char, &target_name), 135 ACPI_CAST_PTR(char, &target_name),
@@ -248,10 +247,8 @@ acpi_ns_search_parent_tree(u32 target_name,
248 return_ACPI_STATUS(status); 247 return_ACPI_STATUS(status);
249 } 248 }
250 249
251 /* 250 /* Not found here, go up another level (until we reach the root) */
252 * Not found here, go up another level 251
253 * (until we reach the root)
254 */
255 parent_node = acpi_ns_get_parent_node(parent_node); 252 parent_node = acpi_ns_get_parent_node(parent_node);
256 } 253 }
257 254
@@ -307,12 +304,29 @@ acpi_ns_search_and_enter(u32 target_name,
307 return_ACPI_STATUS(AE_BAD_PARAMETER); 304 return_ACPI_STATUS(AE_BAD_PARAMETER);
308 } 305 }
309 306
310 /* Name must consist of printable characters */ 307 /*
311 308 * Name must consist of valid ACPI characters. We will repair the name if
309 * necessary because we don't want to abort because of this, but we want
310 * all namespace names to be printable. A warning message is appropriate.
311 *
312 * This issue came up because there are in fact machines that exhibit
313 * this problem, and we want to be able to enable ACPI support for them,
314 * even though there are a few bad names.
315 */
312 if (!acpi_ut_valid_acpi_name(target_name)) { 316 if (!acpi_ut_valid_acpi_name(target_name)) {
313 ACPI_ERROR((AE_INFO, "Bad character in ACPI Name: %X", 317 target_name = acpi_ut_repair_name(target_name);
314 target_name)); 318
315 return_ACPI_STATUS(AE_BAD_CHARACTER); 319 /* Report warning only if in strict mode or debug mode */
320
321 if (!acpi_gbl_enable_interpreter_slack) {
322 ACPI_WARNING((AE_INFO,
323 "Found bad character(s) in name, repaired: [%4.4s]\n",
324 ACPI_CAST_PTR(char, &target_name)));
325 } else {
326 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
327 "Found bad character(s) in name, repaired: [%4.4s]\n",
328 ACPI_CAST_PTR(char, &target_name)));
329 }
316 } 330 }
317 331
318 /* Try to find the name in the namespace level specified by the caller */ 332 /* Try to find the name in the namespace level specified by the caller */
@@ -328,10 +342,8 @@ acpi_ns_search_and_enter(u32 target_name,
328 status = AE_ALREADY_EXISTS; 342 status = AE_ALREADY_EXISTS;
329 } 343 }
330 344
331 /* 345 /* Either found it or there was an error: finished either way */
332 * Either found it or there was an error 346
333 * -- finished either way
334 */
335 return_ACPI_STATUS(status); 347 return_ACPI_STATUS(status);
336 } 348 }
337 349
@@ -357,9 +369,8 @@ acpi_ns_search_and_enter(u32 target_name,
357 } 369 }
358 } 370 }
359 371
360 /* 372 /* In execute mode, just search, never add names. Exit now */
361 * In execute mode, just search, never add names. Exit now. 373
362 */
363 if (interpreter_mode == ACPI_IMODE_EXECUTE) { 374 if (interpreter_mode == ACPI_IMODE_EXECUTE) {
364 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 375 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
365 "%4.4s Not found in %p [Not adding]\n", 376 "%4.4s Not found in %p [Not adding]\n",
@@ -379,6 +390,5 @@ acpi_ns_search_and_enter(u32 target_name,
379 390
380 acpi_ns_install_node(walk_state, node, new_node, type); 391 acpi_ns_install_node(walk_state, node, new_node, type);
381 *return_node = new_node; 392 *return_node = new_node;
382
383 return_ACPI_STATUS(AE_OK); 393 return_ACPI_STATUS(AE_OK);
384} 394}
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c
index 14052cb648c1..3a29ce680370 100644
--- a/drivers/acpi/parser/psloop.c
+++ b/drivers/acpi/parser/psloop.c
@@ -747,7 +747,19 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
747 if (ACPI_FAILURE(status2)) { 747 if (ACPI_FAILURE(status2)) {
748 return_ACPI_STATUS(status2); 748 return_ACPI_STATUS(status2);
749 } 749 }
750
751 status2 =
752 acpi_ds_result_stack_pop
753 (walk_state);
754 if (ACPI_FAILURE(status2)) {
755 return_ACPI_STATUS(status2);
756 }
757
758 acpi_ut_delete_generic_state
759 (acpi_ut_pop_generic_state
760 (&walk_state->control_state));
750 } 761 }
762
751 acpi_ps_pop_scope(parser_state, &op, 763 acpi_ps_pop_scope(parser_state, &op,
752 &walk_state->arg_types, 764 &walk_state->arg_types,
753 &walk_state->arg_count); 765 &walk_state->arg_count);
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c
index 9233a4044d6b..424ab1c20da5 100644
--- a/drivers/acpi/parser/psscope.c
+++ b/drivers/acpi/parser/psscope.c
@@ -143,7 +143,7 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state,
143acpi_status 143acpi_status
144acpi_ps_push_scope(struct acpi_parse_state *parser_state, 144acpi_ps_push_scope(struct acpi_parse_state *parser_state,
145 union acpi_parse_object *op, 145 union acpi_parse_object *op,
146 u32 remaining_args, u8 arg_count) 146 u32 remaining_args, u32 arg_count)
147{ 147{
148 union acpi_generic_state *scope; 148 union acpi_generic_state *scope;
149 149
@@ -196,7 +196,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state,
196 196
197void 197void
198acpi_ps_pop_scope(struct acpi_parse_state *parser_state, 198acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
199 union acpi_parse_object **op, u32 * arg_list, u8 * arg_count) 199 union acpi_parse_object **op, u32 * arg_list, u32 * arg_count)
200{ 200{
201 union acpi_generic_state *scope = parser_state->scope; 201 union acpi_generic_state *scope = parser_state->scope;
202 202
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
index 50bbb19bf4ae..1b2d1e717e74 100644
--- a/drivers/acpi/resources/rslist.c
+++ b/drivers/acpi/resources/rslist.c
@@ -64,10 +64,11 @@ ACPI_MODULE_NAME("rslist")
64acpi_status 64acpi_status
65acpi_rs_convert_aml_to_resources(u8 * aml, 65acpi_rs_convert_aml_to_resources(u8 * aml,
66 u32 length, 66 u32 length,
67 u32 offset, 67 u32 offset, u8 resource_index, void **context)
68 u8 resource_index, void **resource_ptr)
69{ 68{
70 struct acpi_resource *resource = *resource_ptr; 69 struct acpi_resource **resource_ptr =
70 ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context);
71 struct acpi_resource *resource;
71 acpi_status status; 72 acpi_status status;
72 73
73 ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); 74 ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources");
@@ -76,6 +77,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml,
76 * Check that the input buffer and all subsequent pointers into it 77 * Check that the input buffer and all subsequent pointers into it
77 * are aligned on a native word boundary. Most important on IA64 78 * are aligned on a native word boundary. Most important on IA64
78 */ 79 */
80 resource = *resource_ptr;
79 if (ACPI_IS_MISALIGNED(resource)) { 81 if (ACPI_IS_MISALIGNED(resource)) {
80 ACPI_WARNING((AE_INFO, 82 ACPI_WARNING((AE_INFO,
81 "Misaligned resource pointer %p", resource)); 83 "Misaligned resource pointer %p", resource));
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index e4308c7a6743..1943bec18848 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -39,7 +39,7 @@ ACPI_MODULE_NAME("acpi_system")
39#define ACPI_SYSTEM_FILE_EVENT "event" 39#define ACPI_SYSTEM_FILE_EVENT "event"
40#define ACPI_SYSTEM_FILE_DSDT "dsdt" 40#define ACPI_SYSTEM_FILE_DSDT "dsdt"
41#define ACPI_SYSTEM_FILE_FADT "fadt" 41#define ACPI_SYSTEM_FILE_FADT "fadt"
42extern FADT_DESCRIPTOR acpi_fadt; 42extern struct fadt_descriptor acpi_fadt;
43 43
44/* -------------------------------------------------------------------------- 44/* --------------------------------------------------------------------------
45 FS Interface (/proc) 45 FS Interface (/proc)
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 7f37c7cc5ef1..ed5e8816d83d 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -282,8 +282,8 @@ acpi_get_table_header_early(enum acpi_table_id id,
282 282
283 /* Map the DSDT header via the pointer in the FADT */ 283 /* Map the DSDT header via the pointer in the FADT */
284 if (id == ACPI_DSDT) { 284 if (id == ACPI_DSDT) {
285 struct fadt_descriptor_rev2 *fadt = 285 struct fadt_descriptor *fadt =
286 (struct fadt_descriptor_rev2 *)*header; 286 (struct fadt_descriptor *)*header;
287 287
288 if (fadt->revision == 3 && fadt->Xdsdt) { 288 if (fadt->revision == 3 && fadt->Xdsdt) {
289 *header = (void *)__acpi_map_table(fadt->Xdsdt, 289 *header = (void *)__acpi_map_table(fadt->Xdsdt,
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c
index 5155b27cf032..a913a927d321 100644
--- a/drivers/acpi/tables/tbconvrt.c
+++ b/drivers/acpi/tables/tbconvrt.c
@@ -54,12 +54,12 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
54 acpi_physical_address address); 54 acpi_physical_address address);
55 55
56static void 56static void
57acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, 57acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt,
58 struct fadt_descriptor_rev1 *original_fadt); 58 struct fadt_descriptor_rev1 *original_fadt);
59 59
60static void 60static void
61acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, 61acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt,
62 struct fadt_descriptor_rev2 *original_fadt); 62 struct fadt_descriptor *original_fadt);
63 63
64u8 acpi_fadt_is_v1; 64u8 acpi_fadt_is_v1;
65ACPI_EXPORT_SYMBOL(acpi_fadt_is_v1) 65ACPI_EXPORT_SYMBOL(acpi_fadt_is_v1)
@@ -120,7 +120,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
120{ 120{
121 acpi_size table_size; 121 acpi_size table_size;
122 u32 i; 122 u32 i;
123 XSDT_DESCRIPTOR *new_table; 123 struct xsdt_descriptor *new_table;
124 124
125 ACPI_FUNCTION_ENTRY(); 125 ACPI_FUNCTION_ENTRY();
126 126
@@ -151,12 +151,12 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
151 if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { 151 if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
152 ACPI_STORE_ADDRESS(new_table->table_offset_entry[i], 152 ACPI_STORE_ADDRESS(new_table->table_offset_entry[i],
153 (ACPI_CAST_PTR 153 (ACPI_CAST_PTR
154 (struct rsdt_descriptor_rev1, 154 (struct rsdt_descriptor,
155 table_info->pointer))-> 155 table_info->pointer))->
156 table_offset_entry[i]); 156 table_offset_entry[i]);
157 } else { 157 } else {
158 new_table->table_offset_entry[i] = 158 new_table->table_offset_entry[i] =
159 (ACPI_CAST_PTR(XSDT_DESCRIPTOR, 159 (ACPI_CAST_PTR(struct xsdt_descriptor,
160 table_info->pointer))-> 160 table_info->pointer))->
161 table_offset_entry[i]; 161 table_offset_entry[i];
162 } 162 }
@@ -218,7 +218,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
218 ******************************************************************************/ 218 ******************************************************************************/
219 219
220static void 220static void
221acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, 221acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt,
222 struct fadt_descriptor_rev1 *original_fadt) 222 struct fadt_descriptor_rev1 *original_fadt)
223{ 223{
224 224
@@ -364,14 +364,13 @@ acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
364 ******************************************************************************/ 364 ******************************************************************************/
365 365
366static void 366static void
367acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, 367acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt,
368 struct fadt_descriptor_rev2 *original_fadt) 368 struct fadt_descriptor *original_fadt)
369{ 369{
370 370
371 /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ 371 /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
372 372
373 ACPI_MEMCPY(local_fadt, original_fadt, 373 ACPI_MEMCPY(local_fadt, original_fadt, sizeof(struct fadt_descriptor));
374 sizeof(struct fadt_descriptor_rev2));
375 374
376 /* 375 /*
377 * "X" fields are optional extensions to the original V1.0 fields, so 376 * "X" fields are optional extensions to the original V1.0 fields, so
@@ -490,7 +489,7 @@ acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
490 489
491acpi_status acpi_tb_convert_table_fadt(void) 490acpi_status acpi_tb_convert_table_fadt(void)
492{ 491{
493 struct fadt_descriptor_rev2 *local_fadt; 492 struct fadt_descriptor *local_fadt;
494 struct acpi_table_desc *table_desc; 493 struct acpi_table_desc *table_desc;
495 494
496 ACPI_FUNCTION_TRACE("tb_convert_table_fadt"); 495 ACPI_FUNCTION_TRACE("tb_convert_table_fadt");
@@ -507,13 +506,13 @@ acpi_status acpi_tb_convert_table_fadt(void)
507 506
508 /* Allocate buffer for the ACPI 2.0(+) FADT */ 507 /* Allocate buffer for the ACPI 2.0(+) FADT */
509 508
510 local_fadt = ACPI_ALLOCATE_ZEROED(sizeof(struct fadt_descriptor_rev2)); 509 local_fadt = ACPI_ALLOCATE_ZEROED(sizeof(struct fadt_descriptor));
511 if (!local_fadt) { 510 if (!local_fadt) {
512 return_ACPI_STATUS(AE_NO_MEMORY); 511 return_ACPI_STATUS(AE_NO_MEMORY);
513 } 512 }
514 513
515 if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { 514 if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) {
516 if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { 515 if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor)) {
517 516
518 /* Length is too short to be a V2.0 table */ 517 /* Length is too short to be a V2.0 table */
519 518
@@ -538,7 +537,7 @@ acpi_status acpi_tb_convert_table_fadt(void)
538 /* Global FADT pointer will point to the new common V2.0 FADT */ 537 /* Global FADT pointer will point to the new common V2.0 FADT */
539 538
540 acpi_gbl_FADT = local_fadt; 539 acpi_gbl_FADT = local_fadt;
541 acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR); 540 acpi_gbl_FADT->length = sizeof(struct fadt_descriptor);
542 541
543 /* Free the original table */ 542 /* Free the original table */
544 543
@@ -550,7 +549,7 @@ acpi_status acpi_tb_convert_table_fadt(void)
550 table_desc->pointer = 549 table_desc->pointer =
551 ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); 550 ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT);
552 table_desc->allocation = ACPI_MEM_ALLOCATED; 551 table_desc->allocation = ACPI_MEM_ALLOCATED;
553 table_desc->length = sizeof(struct fadt_descriptor_rev2); 552 table_desc->length = sizeof(struct fadt_descriptor);
554 553
555 /* Dump the entire FADT */ 554 /* Dump the entire FADT */
556 555
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
index 946d2f2d611d..9e0ebe625ed9 100644
--- a/drivers/acpi/tables/tbrsdt.c
+++ b/drivers/acpi/tables/tbrsdt.c
@@ -280,7 +280,8 @@ acpi_status acpi_tb_get_table_rsdt(void)
280 return_ACPI_STATUS(status); 280 return_ACPI_STATUS(status);
281 } 281 }
282 282
283 acpi_gbl_XSDT = ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info.pointer); 283 acpi_gbl_XSDT =
284 ACPI_CAST_PTR(struct xsdt_descriptor, table_info.pointer);
284 285
285 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); 286 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT));
286 return_ACPI_STATUS(status); 287 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index b463d4b88823..f8d28ae8811d 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -193,73 +193,119 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
193 193
194/******************************************************************************* 194/*******************************************************************************
195 * 195 *
196 * FUNCTION: acpi_tb_verify_table_checksum 196 * FUNCTION: acpi_tb_sum_table
197 * 197 *
198 * PARAMETERS: *table_header - ACPI table to verify 198 * PARAMETERS: Buffer - Buffer to sum
199 * Length - Size of the buffer
199 * 200 *
200 * RETURN: 8 bit checksum of table 201 * RETURN: 8 bit sum of buffer
201 * 202 *
202 * DESCRIPTION: Does an 8 bit checksum of table and returns status. A correct 203 * DESCRIPTION: Computes an 8 bit sum of the buffer(length) and returns it.
203 * table should have a checksum of 0.
204 * 204 *
205 ******************************************************************************/ 205 ******************************************************************************/
206 206
207acpi_status 207u8 acpi_tb_sum_table(void *buffer, u32 length)
208acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) 208{
209 acpi_native_uint i;
210 u8 sum = 0;
211
212 if (!buffer || !length) {
213 return (0);
214 }
215
216 for (i = 0; i < length; i++) {
217 sum = (u8) (sum + ((u8 *) buffer)[i]);
218 }
219 return (sum);
220}
221
222/*******************************************************************************
223 *
224 * FUNCTION: acpi_tb_generate_checksum
225 *
226 * PARAMETERS: Table - Pointer to a valid ACPI table (with a
227 * standard ACPI header)
228 *
229 * RETURN: 8 bit checksum of buffer
230 *
231 * DESCRIPTION: Computes an 8 bit checksum of the table.
232 *
233 ******************************************************************************/
234
235u8 acpi_tb_generate_checksum(struct acpi_table_header * table)
209{ 236{
210 u8 checksum; 237 u8 checksum;
211 acpi_status status = AE_OK;
212 238
213 ACPI_FUNCTION_TRACE("tb_verify_table_checksum"); 239 /* Sum the entire table as-is */
214 240
215 /* Compute the checksum on the table */ 241 checksum = acpi_tb_sum_table(table, table->length);
216 242
217 checksum = 243 /* Subtract off the existing checksum value in the table */
218 acpi_tb_generate_checksum(table_header, table_header->length);
219 244
220 /* Return the appropriate exception */ 245 checksum = (u8) (checksum - table->checksum);
221 246
222 if (checksum) { 247 /* Compute the final checksum */
223 ACPI_WARNING((AE_INFO,
224 "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)",
225 table_header->signature,
226 (u32) table_header->checksum, (u32) checksum));
227 248
228 status = AE_BAD_CHECKSUM; 249 checksum = (u8) (0 - checksum);
229 } 250 return (checksum);
230 return_ACPI_STATUS(status);
231} 251}
232 252
233/******************************************************************************* 253/*******************************************************************************
234 * 254 *
235 * FUNCTION: acpi_tb_generate_checksum 255 * FUNCTION: acpi_tb_set_checksum
236 * 256 *
237 * PARAMETERS: Buffer - Buffer to checksum 257 * PARAMETERS: Table - Pointer to a valid ACPI table (with a
238 * Length - Size of the buffer 258 * standard ACPI header)
239 * 259 *
240 * RETURN: 8 bit checksum of buffer 260 * RETURN: None. Sets the table checksum field
241 * 261 *
242 * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. 262 * DESCRIPTION: Computes an 8 bit checksum of the table and inserts the
263 * checksum into the table header.
243 * 264 *
244 ******************************************************************************/ 265 ******************************************************************************/
245 266
246u8 acpi_tb_generate_checksum(void *buffer, u32 length) 267void acpi_tb_set_checksum(struct acpi_table_header *table)
247{ 268{
248 u8 *end_buffer;
249 u8 *rover;
250 u8 sum = 0;
251 269
252 if (buffer && length) { 270 table->checksum = acpi_tb_generate_checksum(table);
271}
272
273/*******************************************************************************
274 *
275 * FUNCTION: acpi_tb_verify_table_checksum
276 *
277 * PARAMETERS: *table_header - ACPI table to verify
278 *
279 * RETURN: 8 bit checksum of table
280 *
281 * DESCRIPTION: Generates an 8 bit checksum of table and returns and compares
282 * it to the existing checksum value.
283 *
284 ******************************************************************************/
285
286acpi_status
287acpi_tb_verify_table_checksum(struct acpi_table_header *table_header)
288{
289 u8 checksum;
290
291 ACPI_FUNCTION_TRACE("tb_verify_table_checksum");
292
293 /* Compute the checksum on the table */
253 294
254 /* Buffer and Length are valid */ 295 checksum = acpi_tb_generate_checksum(table_header);
255 296
256 end_buffer = ACPI_ADD_PTR(u8, buffer, length); 297 /* Checksum ok? */
257 298
258 for (rover = buffer; rover < end_buffer; rover++) { 299 if (checksum == table_header->checksum) {
259 sum = (u8) (sum + *rover); 300 return_ACPI_STATUS(AE_OK);
260 }
261 } 301 }
262 return (sum); 302
303 ACPI_WARNING((AE_INFO,
304 "Incorrect checksum in table [%4.4s] - is %2.2X, should be %2.2X",
305 table_header->signature, table_header->checksum,
306 checksum));
307
308 return_ACPI_STATUS(AE_BAD_CHECKSUM);
263} 309}
264 310
265#ifdef ACPI_OBSOLETE_FUNCTIONS 311#ifdef ACPI_OBSOLETE_FUNCTIONS
@@ -278,7 +324,7 @@ u8 acpi_tb_generate_checksum(void *buffer, u32 length)
278 324
279acpi_status 325acpi_status
280acpi_tb_handle_to_object(u16 table_id, 326acpi_tb_handle_to_object(u16 table_id,
281 struct acpi_table_desc ** return_table_desc) 327 struct acpi_table_desc **return_table_desc)
282{ 328{
283 u32 i; 329 u32 i;
284 struct acpi_table_desc *table_desc; 330 struct acpi_table_desc *table_desc;
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index 1b6d8c510e95..550284f5d1ed 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -81,15 +81,14 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp)
81 81
82 /* Check the standard checksum */ 82 /* Check the standard checksum */
83 83
84 if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { 84 if (acpi_tb_sum_table(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
85 return (AE_BAD_CHECKSUM); 85 return (AE_BAD_CHECKSUM);
86 } 86 }
87 87
88 /* Check extended checksum if table version >= 2 */ 88 /* Check extended checksum if table version >= 2 */
89 89
90 if ((rsdp->revision >= 2) && 90 if ((rsdp->revision >= 2) &&
91 (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 91 (acpi_tb_sum_table(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
92 0)) {
93 return (AE_BAD_CHECKSUM); 92 return (AE_BAD_CHECKSUM);
94 } 93 }
95 94
@@ -308,12 +307,12 @@ acpi_get_firmware_table(acpi_string signature,
308 if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { 307 if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
309 address.pointer.value = 308 address.pointer.value =
310 (ACPI_CAST_PTR 309 (ACPI_CAST_PTR
311 (RSDT_DESCRIPTOR, 310 (struct rsdt_descriptor,
312 rsdt_info->pointer))->table_offset_entry[i]; 311 rsdt_info->pointer))->table_offset_entry[i];
313 } else { 312 } else {
314 address.pointer.value = 313 address.pointer.value =
315 (ACPI_CAST_PTR 314 (ACPI_CAST_PTR
316 (XSDT_DESCRIPTOR, 315 (struct xsdt_descriptor,
317 rsdt_info->pointer))->table_offset_entry[i]; 316 rsdt_info->pointer))->table_offset_entry[i];
318 } 317 }
319 318
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index a8c350643d57..5ec1cfcc611d 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -517,20 +517,13 @@ acpi_ut_ptr_exit(u32 line_number,
517 * 517 *
518 ******************************************************************************/ 518 ******************************************************************************/
519 519
520void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) 520void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
521{ 521{
522 acpi_native_uint i = 0; 522 acpi_native_uint i = 0;
523 acpi_native_uint j; 523 acpi_native_uint j;
524 u32 temp32; 524 u32 temp32;
525 u8 buf_char; 525 u8 buf_char;
526 526
527 /* Only dump the buffer if tracing is enabled */
528
529 if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
530 (component_id & acpi_dbg_layer))) {
531 return;
532 }
533
534 if ((count < 4) || (count & 0x01)) { 527 if ((count < 4) || (count & 0x01)) {
535 display = DB_BYTE_DISPLAY; 528 display = DB_BYTE_DISPLAY;
536 } 529 }
@@ -556,6 +549,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
556 } 549 }
557 550
558 switch (display) { 551 switch (display) {
552 case DB_BYTE_DISPLAY:
559 default: /* Default is BYTE display */ 553 default: /* Default is BYTE display */
560 554
561 acpi_os_printf("%02X ", buffer[i + j]); 555 acpi_os_printf("%02X ", buffer[i + j]);
@@ -613,3 +607,31 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
613 607
614 return; 608 return;
615} 609}
610
611/*******************************************************************************
612 *
613 * FUNCTION: acpi_ut_dump_buffer
614 *
615 * PARAMETERS: Buffer - Buffer to dump
616 * Count - Amount to dump, in bytes
617 * Display - BYTE, WORD, DWORD, or QWORD display
618 * component_iD - Caller's component ID
619 *
620 * RETURN: None
621 *
622 * DESCRIPTION: Generic dump buffer in both hex and ascii.
623 *
624 ******************************************************************************/
625
626void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
627{
628
629 /* Only dump the buffer if tracing is enabled */
630
631 if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
632 (component_id & acpi_dbg_layer))) {
633 return;
634 }
635
636 acpi_ut_dump_buffer2(buffer, count, display);
637}
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 51356e8eb999..b4e34a2f81f7 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -202,8 +202,20 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
202 if (handler_desc) { 202 if (handler_desc) {
203 if (handler_desc->address_space.handler_flags & 203 if (handler_desc->address_space.handler_flags &
204 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { 204 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
205 obj_pointer = 205
206 second_desc->extra.region_context; 206 /* Deactivate region and free region context */
207
208 if (handler_desc->address_space.setup) {
209 (void)handler_desc->
210 address_space.setup(object,
211 ACPI_REGION_DEACTIVATE,
212 handler_desc->
213 address_space.
214 context,
215 &second_desc->
216 extra.
217 region_context);
218 }
207 } 219 }
208 220
209 acpi_ut_remove_reference(handler_desc); 221 acpi_ut_remove_reference(handler_desc);
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 8a05bb5ef4fe..e8ae417c9848 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -642,7 +642,7 @@ char *acpi_ut_get_node_name(void *object)
642 /* Name must be a valid ACPI name */ 642 /* Name must be a valid ACPI name */
643 643
644 if (!acpi_ut_valid_acpi_name(node->name.integer)) { 644 if (!acpi_ut_valid_acpi_name(node->name.integer)) {
645 return ("????"); 645 node->name.integer = acpi_ut_repair_name(node->name.integer);
646 } 646 }
647 647
648 /* Return the name */ 648 /* Return the name */
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
index 40313de6977d..7538b165b6e5 100644
--- a/drivers/acpi/utilities/utinit.c
+++ b/drivers/acpi/utilities/utinit.c
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utinit")
50 50
51/* Local prototypes */ 51/* Local prototypes */
52static void 52static void
53acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset); 53acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset);
54 54
55static void acpi_ut_terminate(void); 55static void acpi_ut_terminate(void);
56 56
@@ -69,12 +69,12 @@ static void acpi_ut_terminate(void);
69 ******************************************************************************/ 69 ******************************************************************************/
70 70
71static void 71static void
72acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) 72acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset)
73{ 73{
74 74
75 ACPI_WARNING((AE_INFO, 75 ACPI_WARNING((AE_INFO,
76 "Invalid FADT value %s=%X at offset %X FADT=%p", 76 "Invalid FADT value %s=%X at offset %X FADT=%p",
77 register_name, value, (u32) offset, acpi_gbl_FADT)); 77 register_name, value, offset, acpi_gbl_FADT));
78} 78}
79 79
80/****************************************************************************** 80/******************************************************************************
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 017a87ebc40b..4623d7e215d3 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -49,6 +49,33 @@ ACPI_MODULE_NAME("utmisc")
49 49
50/******************************************************************************* 50/*******************************************************************************
51 * 51 *
52 * FUNCTION: acpi_ut_is_aml_table
53 *
54 * PARAMETERS: Table - An ACPI table
55 *
56 * RETURN: TRUE if table contains executable AML; FALSE otherwise
57 *
58 * DESCRIPTION: Check ACPI Signature for a table that contains AML code.
59 * Currently, these are DSDT,SSDT,PSDT. All other table types are
60 * data tables that do not contain AML code.
61 *
62 ******************************************************************************/
63u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
64{
65
66 /* Ignore tables that contain AML */
67
68 if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) ||
69 ACPI_COMPARE_NAME(table->signature, PSDT_SIG) ||
70 ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) {
71 return (TRUE);
72 }
73
74 return (FALSE);
75}
76
77/*******************************************************************************
78 *
52 * FUNCTION: acpi_ut_allocate_owner_id 79 * FUNCTION: acpi_ut_allocate_owner_id
53 * 80 *
54 * PARAMETERS: owner_id - Where the new owner ID is returned 81 * PARAMETERS: owner_id - Where the new owner ID is returned
@@ -60,6 +87,7 @@ ACPI_MODULE_NAME("utmisc")
60 * when the method exits or the table is unloaded. 87 * when the method exits or the table is unloaded.
61 * 88 *
62 ******************************************************************************/ 89 ******************************************************************************/
90
63acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) 91acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
64{ 92{
65 acpi_native_uint i; 93 acpi_native_uint i;
@@ -469,6 +497,41 @@ acpi_ut_display_init_pathname(u8 type,
469 497
470/******************************************************************************* 498/*******************************************************************************
471 * 499 *
500 * FUNCTION: acpi_ut_valid_acpi_char
501 *
502 * PARAMETERS: Char - The character to be examined
503 *
504 * RETURN: TRUE if the character is valid, FALSE otherwise
505 *
506 * DESCRIPTION: Check for a valid ACPI character. Must be one of:
507 * 1) Upper case alpha
508 * 2) numeric
509 * 3) underscore
510 *
511 * We allow a '!' as the last character because of the ASF! table
512 *
513 ******************************************************************************/
514
515u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position)
516{
517
518 if (!((character >= 'A' && character <= 'Z') ||
519 (character >= '0' && character <= '9') || (character == '_'))) {
520
521 /* Allow a '!' in the last position */
522
523 if (character == '!' && position == 3) {
524 return (TRUE);
525 }
526
527 return (FALSE);
528 }
529
530 return (TRUE);
531}
532
533/*******************************************************************************
534 *
472 * FUNCTION: acpi_ut_valid_acpi_name 535 * FUNCTION: acpi_ut_valid_acpi_name
473 * 536 *
474 * PARAMETERS: Name - The name to be examined 537 * PARAMETERS: Name - The name to be examined
@@ -484,19 +547,13 @@ acpi_ut_display_init_pathname(u8 type,
484 547
485u8 acpi_ut_valid_acpi_name(u32 name) 548u8 acpi_ut_valid_acpi_name(u32 name)
486{ 549{
487 char *name_ptr = (char *)&name;
488 char character;
489 acpi_native_uint i; 550 acpi_native_uint i;
490 551
491 ACPI_FUNCTION_ENTRY(); 552 ACPI_FUNCTION_ENTRY();
492 553
493 for (i = 0; i < ACPI_NAME_SIZE; i++) { 554 for (i = 0; i < ACPI_NAME_SIZE; i++) {
494 character = *name_ptr; 555 if (!acpi_ut_valid_acpi_char
495 name_ptr++; 556 ((ACPI_CAST_PTR(char, &name))[i], i)) {
496
497 if (!((character == '_') ||
498 (character >= 'A' && character <= 'Z') ||
499 (character >= '0' && character <= '9'))) {
500 return (FALSE); 557 return (FALSE);
501 } 558 }
502 } 559 }
@@ -506,24 +563,37 @@ u8 acpi_ut_valid_acpi_name(u32 name)
506 563
507/******************************************************************************* 564/*******************************************************************************
508 * 565 *
509 * FUNCTION: acpi_ut_valid_acpi_character 566 * FUNCTION: acpi_ut_repair_name
510 * 567 *
511 * PARAMETERS: Character - The character to be examined 568 * PARAMETERS: Name - The ACPI name to be repaired
512 * 569 *
513 * RETURN: 1 if Character may appear in a name, else 0 570 * RETURN: Repaired version of the name
514 * 571 *
515 * DESCRIPTION: Check for a printable character 572 * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
573 * return the new name.
516 * 574 *
517 ******************************************************************************/ 575 ******************************************************************************/
518 576
519u8 acpi_ut_valid_acpi_character(char character) 577acpi_name acpi_ut_repair_name(acpi_name name)
520{ 578{
579 char *name_ptr = ACPI_CAST_PTR(char, &name);
580 char new_name[ACPI_NAME_SIZE];
581 acpi_native_uint i;
521 582
522 ACPI_FUNCTION_ENTRY(); 583 for (i = 0; i < ACPI_NAME_SIZE; i++) {
584 new_name[i] = name_ptr[i];
585
586 /*
587 * Replace a bad character with something printable, yet technically
588 * still invalid. This prevents any collisions with existing "good"
589 * names in the namespace.
590 */
591 if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) {
592 new_name[i] = '*';
593 }
594 }
523 595
524 return ((u8) ((character == '_') || 596 return (*ACPI_CAST_PTR(u32, new_name));
525 (character >= 'A' && character <= 'Z') ||
526 (character >= '0' && character <= '9')));
527} 597}
528 598
529/******************************************************************************* 599/*******************************************************************************
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
index 4c24e6d5400a..1e680794c6df 100644
--- a/drivers/acpi/utilities/utresrc.c
+++ b/drivers/acpi/utilities/utresrc.c
@@ -258,7 +258,7 @@ static const u8 acpi_gbl_resource_types[] = {
258acpi_status 258acpi_status
259acpi_ut_walk_aml_resources(u8 * aml, 259acpi_ut_walk_aml_resources(u8 * aml,
260 acpi_size aml_length, 260 acpi_size aml_length,
261 acpi_walk_aml_callback user_function, void *context) 261 acpi_walk_aml_callback user_function, void **context)
262{ 262{
263 acpi_status status; 263 acpi_status status;
264 u8 *end_aml; 264 u8 *end_aml;
@@ -319,7 +319,7 @@ acpi_ut_walk_aml_resources(u8 * aml,
319 /* Return the pointer to the end_tag if requested */ 319 /* Return the pointer to the end_tag if requested */
320 320
321 if (!user_function) { 321 if (!user_function) {
322 *(void **)context = aml; 322 *context = aml;
323 } 323 }
324 324
325 /* Normal exit */ 325 /* Normal exit */
@@ -610,7 +610,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
610 610
611 status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer, 611 status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer,
612 obj_desc->buffer.length, NULL, 612 obj_desc->buffer.length, NULL,
613 end_tag); 613 (void **)end_tag);
614 614
615 return_ACPI_STATUS(status); 615 return_ACPI_STATUS(status);
616} 616}
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
index 637c5f964879..aec5034cd978 100644
--- a/drivers/acpi/utilities/utstate.c
+++ b/drivers/acpi/utilities/utstate.c
@@ -321,8 +321,8 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
321 * 321 *
322 * RETURN: None 322 * RETURN: None
323 * 323 *
324 * DESCRIPTION: Put a state object back into the global state cache. The object 324 * DESCRIPTION: Release a state object to the state cache. NULL state objects
325 * is not actually freed at this time. 325 * are ignored.
326 * 326 *
327 ******************************************************************************/ 327 ******************************************************************************/
328 328
@@ -330,6 +330,10 @@ void acpi_ut_delete_generic_state(union acpi_generic_state *state)
330{ 330{
331 ACPI_FUNCTION_TRACE("ut_delete_generic_state"); 331 ACPI_FUNCTION_TRACE("ut_delete_generic_state");
332 332
333 (void)acpi_os_release_object(acpi_gbl_state_cache, state); 333 /* Ignore null state */
334
335 if (state) {
336 (void)acpi_os_release_object(acpi_gbl_state_cache, state);
337 }
334 return_VOID; 338 return_VOID;
335} 339}