aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
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/utilities
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/utilities')
-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
7 files changed, 145 insertions, 37 deletions
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}