aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utmisc.c
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/utmisc.c
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/utmisc.c')
-rw-r--r--drivers/acpi/utilities/utmisc.c104
1 files changed, 87 insertions, 17 deletions
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 017a87ebc40..4623d7e215d 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/*******************************************************************************