aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/tables')
-rw-r--r--drivers/acpi/tables/tbfadt.c2
-rw-r--r--drivers/acpi/tables/tbfind.c34
-rw-r--r--drivers/acpi/tables/tbinstal.c24
-rw-r--r--drivers/acpi/tables/tbutils.c4
-rw-r--r--drivers/acpi/tables/tbxface.c91
-rw-r--r--drivers/acpi/tables/tbxfroot.c2
6 files changed, 134 insertions, 23 deletions
diff --git a/drivers/acpi/tables/tbfadt.c b/drivers/acpi/tables/tbfadt.c
index 002bb33003af..949d4114eb9f 100644
--- a/drivers/acpi/tables/tbfadt.c
+++ b/drivers/acpi/tables/tbfadt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2007, R. Byron Moore 8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/tables/tbfind.c b/drivers/acpi/tables/tbfind.c
index 058c064948e1..9ca3afc98c80 100644
--- a/drivers/acpi/tables/tbfind.c
+++ b/drivers/acpi/tables/tbfind.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2007, R. Byron Moore 8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -70,12 +70,22 @@ acpi_tb_find_table(char *signature,
70{ 70{
71 acpi_native_uint i; 71 acpi_native_uint i;
72 acpi_status status; 72 acpi_status status;
73 struct acpi_table_header header;
73 74
74 ACPI_FUNCTION_TRACE(tb_find_table); 75 ACPI_FUNCTION_TRACE(tb_find_table);
75 76
77 /* Normalize the input strings */
78
79 ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header));
80 ACPI_STRNCPY(header.signature, signature, ACPI_NAME_SIZE);
81 ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
82 ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
83
84 /* Search for the table */
85
76 for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { 86 for (i = 0; i < acpi_gbl_root_table_list.count; ++i) {
77 if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature), 87 if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature),
78 signature, ACPI_NAME_SIZE)) { 88 header.signature, ACPI_NAME_SIZE)) {
79 89
80 /* Not the requested table */ 90 /* Not the requested table */
81 91
@@ -104,20 +114,24 @@ acpi_tb_find_table(char *signature,
104 114
105 if (!ACPI_MEMCMP 115 if (!ACPI_MEMCMP
106 (acpi_gbl_root_table_list.tables[i].pointer->signature, 116 (acpi_gbl_root_table_list.tables[i].pointer->signature,
107 signature, ACPI_NAME_SIZE) && (!oem_id[0] 117 header.signature, ACPI_NAME_SIZE) && (!oem_id[0]
108 || 118 ||
109 !ACPI_MEMCMP 119 !ACPI_MEMCMP
110 (acpi_gbl_root_table_list. 120 (acpi_gbl_root_table_list.
111 tables[i].pointer->oem_id, 121 tables[i].pointer->
112 oem_id, ACPI_OEM_ID_SIZE)) 122 oem_id,
123 header.oem_id,
124 ACPI_OEM_ID_SIZE))
113 && (!oem_table_id[0] 125 && (!oem_table_id[0]
114 || !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i]. 126 || !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i].
115 pointer->oem_table_id, oem_table_id, 127 pointer->oem_table_id,
128 header.oem_table_id,
116 ACPI_OEM_TABLE_ID_SIZE))) { 129 ACPI_OEM_TABLE_ID_SIZE))) {
117 *table_index = i; 130 *table_index = i;
118 131
119 ACPI_DEBUG_PRINT((ACPI_DB_TABLES, 132 ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
120 "Found table [%4.4s]\n", signature)); 133 "Found table [%4.4s]\n",
134 header.signature));
121 return_ACPI_STATUS(AE_OK); 135 return_ACPI_STATUS(AE_OK);
122 } 136 }
123 } 137 }
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 3bc0c67a9283..402f93e1ff20 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2007, R. Byron Moore 8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -125,13 +125,20 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc,
125 125
126 /* The table must be either an SSDT or a PSDT or an OEMx */ 126 /* The table must be either an SSDT or a PSDT or an OEMx */
127 127
128 if ((!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)) 128 if (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)&&
129 && 129 !ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)&&
130 (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)) 130 strncmp(table_desc->pointer->signature, "OEM", 3)) {
131 && (strncmp(table_desc->pointer->signature, "OEM", 3))) { 131 /* Check for a printable name */
132 ACPI_ERROR((AE_INFO, 132 if (acpi_ut_valid_acpi_name(
133 "Table has invalid signature [%4.4s], must be SSDT, PSDT or OEMx", 133 *(u32 *) table_desc->pointer->signature)) {
134 table_desc->pointer->signature)); 134 ACPI_ERROR((AE_INFO, "Table has invalid signature "
135 "[%4.4s], must be SSDT or PSDT",
136 table_desc->pointer->signature));
137 } else {
138 ACPI_ERROR((AE_INFO, "Table has invalid signature "
139 "(0x%8.8X), must be SSDT or PSDT",
140 *(u32 *) table_desc->pointer->signature));
141 }
135 return_ACPI_STATUS(AE_BAD_SIGNATURE); 142 return_ACPI_STATUS(AE_BAD_SIGNATURE);
136 } 143 }
137 144
@@ -162,6 +169,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc,
162 169
163 acpi_tb_delete_table(table_desc); 170 acpi_tb_delete_table(table_desc);
164 *table_index = i; 171 *table_index = i;
172 status = AE_ALREADY_EXISTS;
165 goto release; 173 goto release;
166 } 174 }
167 175
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 010f19652f80..bc019b9b6a68 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2007, R. Byron Moore 8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -212,7 +212,7 @@ acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length)
212 212
213 if (checksum) { 213 if (checksum) {
214 ACPI_WARNING((AE_INFO, 214 ACPI_WARNING((AE_INFO,
215 "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", 215 "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X",
216 table->signature, table->checksum, 216 table->signature, table->checksum,
217 (u8) (table->checksum - checksum))); 217 (u8) (table->checksum - checksum)));
218 218
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index a9e3331fee5d..fb57b93c2495 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2007, R. Byron Moore 9 * Copyright (C) 2000 - 2008, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -635,6 +635,95 @@ acpi_status acpi_load_tables(void)
635ACPI_EXPORT_SYMBOL(acpi_load_tables) 635ACPI_EXPORT_SYMBOL(acpi_load_tables)
636 636
637 637
638/*******************************************************************************
639 *
640 * FUNCTION: acpi_install_table_handler
641 *
642 * PARAMETERS: Handler - Table event handler
643 * Context - Value passed to the handler on each event
644 *
645 * RETURN: Status
646 *
647 * DESCRIPTION: Install table event handler
648 *
649 ******************************************************************************/
650acpi_status
651acpi_install_table_handler(acpi_tbl_handler handler, void *context)
652{
653 acpi_status status;
654
655 ACPI_FUNCTION_TRACE(acpi_install_table_handler);
656
657 if (!handler) {
658 return_ACPI_STATUS(AE_BAD_PARAMETER);
659 }
660
661 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
662 if (ACPI_FAILURE(status)) {
663 return_ACPI_STATUS(status);
664 }
665
666 /* Don't allow more than one handler */
667
668 if (acpi_gbl_table_handler) {
669 status = AE_ALREADY_EXISTS;
670 goto cleanup;
671 }
672
673 /* Install the handler */
674
675 acpi_gbl_table_handler = handler;
676 acpi_gbl_table_handler_context = context;
677
678 cleanup:
679 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
680 return_ACPI_STATUS(status);
681}
682
683ACPI_EXPORT_SYMBOL(acpi_install_table_handler)
684
685/*******************************************************************************
686 *
687 * FUNCTION: acpi_remove_table_handler
688 *
689 * PARAMETERS: Handler - Table event handler that was installed
690 * previously.
691 *
692 * RETURN: Status
693 *
694 * DESCRIPTION: Remove table event handler
695 *
696 ******************************************************************************/
697acpi_status acpi_remove_table_handler(acpi_tbl_handler handler)
698{
699 acpi_status status;
700
701 ACPI_FUNCTION_TRACE(acpi_remove_table_handler);
702
703 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
704 if (ACPI_FAILURE(status)) {
705 return_ACPI_STATUS(status);
706 }
707
708 /* Make sure that the installed handler is the same */
709
710 if (!handler || handler != acpi_gbl_table_handler) {
711 status = AE_BAD_PARAMETER;
712 goto cleanup;
713 }
714
715 /* Remove the handler */
716
717 acpi_gbl_table_handler = NULL;
718
719 cleanup:
720 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
721 return_ACPI_STATUS(status);
722}
723
724ACPI_EXPORT_SYMBOL(acpi_remove_table_handler)
725
726
638static int __init acpi_no_auto_ssdt_setup(char *s) { 727static int __init acpi_no_auto_ssdt_setup(char *s) {
639 728
640 printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n"); 729 printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n");
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index 9ecb4b6c1e7d..b8c0dfa084f6 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2007, R. Byron Moore 8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without