Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Module Name: tbutils - Table manipulation utilities |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2006, R. Byron Moore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <acpi/acpi.h> |
| 45 | #include <acpi/actables.h> |
| 46 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | #define _COMPONENT ACPI_TABLES |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 48 | ACPI_MODULE_NAME("tbutils") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 50 | /* Local prototypes */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 51 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 53 | acpi_tb_handle_to_object(u16 table_id, struct acpi_table_desc **table_desc); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 54 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | /******************************************************************************* |
| 57 | * |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 58 | * FUNCTION: acpi_tb_is_table_installed |
| 59 | * |
| 60 | * PARAMETERS: new_table_desc - Descriptor for new table being installed |
| 61 | * |
| 62 | * RETURN: Status - AE_ALREADY_EXISTS if the table is already installed |
| 63 | * |
| 64 | * DESCRIPTION: Determine if an ACPI table is already installed |
| 65 | * |
| 66 | * MUTEX: Table data structures should be locked |
| 67 | * |
| 68 | ******************************************************************************/ |
| 69 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 70 | acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 71 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 72 | struct acpi_table_desc *table_desc; |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 73 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 74 | ACPI_FUNCTION_TRACE(tb_is_table_installed); |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 75 | |
| 76 | /* Get the list descriptor and first table descriptor */ |
| 77 | |
| 78 | table_desc = acpi_gbl_table_lists[new_table_desc->type].next; |
| 79 | |
| 80 | /* Examine all installed tables of this type */ |
| 81 | |
| 82 | while (table_desc) { |
Bob Moore | a18ecf4 | 2005-08-15 03:42:00 -0800 | [diff] [blame] | 83 | /* |
| 84 | * If the table lengths match, perform a full bytewise compare. This |
| 85 | * means that we will allow tables with duplicate oem_table_id(s), as |
| 86 | * long as the tables are different in some way. |
| 87 | * |
| 88 | * Checking if the table has been loaded into the namespace means that |
| 89 | * we don't check for duplicate tables during the initial installation |
| 90 | * of tables within the RSDT/XSDT. |
| 91 | */ |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 92 | if ((table_desc->loaded_into_namespace) && |
Bob Moore | a18ecf4 | 2005-08-15 03:42:00 -0800 | [diff] [blame] | 93 | (table_desc->pointer->length == |
| 94 | new_table_desc->pointer->length) |
| 95 | && |
| 96 | (!ACPI_MEMCMP |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 97 | (table_desc->pointer, new_table_desc->pointer, |
| 98 | new_table_desc->pointer->length))) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 99 | |
Bob Moore | a18ecf4 | 2005-08-15 03:42:00 -0800 | [diff] [blame] | 100 | /* Match: this table is already installed */ |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 101 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 102 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 103 | "Table [%4.4s] already installed: Rev %X OemTableId [%8.8s]\n", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 104 | new_table_desc->pointer->signature, |
| 105 | new_table_desc->pointer->revision, |
| 106 | new_table_desc->pointer-> |
| 107 | oem_table_id)); |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 108 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 109 | new_table_desc->owner_id = table_desc->owner_id; |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 110 | new_table_desc->installed_desc = table_desc; |
| 111 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 112 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | /* Get next table on the list */ |
| 116 | |
| 117 | table_desc = table_desc->next; |
| 118 | } |
| 119 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 120 | return_ACPI_STATUS(AE_OK); |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 121 | } |
| 122 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 123 | /******************************************************************************* |
| 124 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | * FUNCTION: acpi_tb_validate_table_header |
| 126 | * |
| 127 | * PARAMETERS: table_header - Logical pointer to the table |
| 128 | * |
| 129 | * RETURN: Status |
| 130 | * |
| 131 | * DESCRIPTION: Check an ACPI table header for validity |
| 132 | * |
| 133 | * NOTE: Table pointers are validated as follows: |
| 134 | * 1) Table pointer must point to valid physical memory |
| 135 | * 2) Signature must be 4 ASCII chars, even if we don't recognize the |
| 136 | * name |
| 137 | * 3) Table must be readable for length specified in the header |
| 138 | * 4) Table checksum must be valid (with the exception of the FACS |
| 139 | * which has no checksum because it contains variable fields) |
| 140 | * |
| 141 | ******************************************************************************/ |
| 142 | |
| 143 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 144 | acpi_tb_validate_table_header(struct acpi_table_header *table_header) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 146 | acpi_name signature; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 148 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | |
| 150 | /* Verify that this is a valid address */ |
| 151 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 152 | if (!acpi_os_readable(table_header, sizeof(struct acpi_table_header))) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 153 | ACPI_ERROR((AE_INFO, |
| 154 | "Cannot read table header at %p", table_header)); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 155 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | return (AE_BAD_ADDRESS); |
| 157 | } |
| 158 | |
| 159 | /* Ensure that the signature is 4 ASCII characters */ |
| 160 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 161 | ACPI_MOVE_32_TO_32(&signature, table_header->signature); |
| 162 | if (!acpi_ut_valid_acpi_name(signature)) { |
Bob Moore | 4c90ece | 2006-06-08 16:29:00 -0400 | [diff] [blame] | 163 | ACPI_ERROR((AE_INFO, "Invalid table signature 0x%8.8X", |
| 164 | signature)); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 165 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 166 | ACPI_DUMP_BUFFER(table_header, |
| 167 | sizeof(struct acpi_table_header)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | return (AE_BAD_SIGNATURE); |
| 169 | } |
| 170 | |
| 171 | /* Validate the table length */ |
| 172 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 173 | if (table_header->length < sizeof(struct acpi_table_header)) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 174 | ACPI_ERROR((AE_INFO, |
Bob Moore | 4c90ece | 2006-06-08 16:29:00 -0400 | [diff] [blame] | 175 | "Invalid length 0x%X in table with signature %4.4s", |
| 176 | (u32) table_header->length, |
| 177 | ACPI_CAST_PTR(char, &signature))); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 178 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 179 | ACPI_DUMP_BUFFER(table_header, |
| 180 | sizeof(struct acpi_table_header)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | return (AE_BAD_HEADER); |
| 182 | } |
| 183 | |
| 184 | return (AE_OK); |
| 185 | } |
| 186 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | /******************************************************************************* |
| 188 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 189 | * FUNCTION: acpi_tb_sum_table |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 191 | * PARAMETERS: Buffer - Buffer to sum |
| 192 | * Length - Size of the buffer |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 194 | * RETURN: 8 bit sum of buffer |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 196 | * DESCRIPTION: Computes an 8 bit sum of the buffer(length) and returns it. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | * |
| 198 | ******************************************************************************/ |
| 199 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 200 | u8 acpi_tb_sum_table(void *buffer, u32 length) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | { |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 202 | acpi_native_uint i; |
| 203 | u8 sum = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 205 | if (!buffer || !length) { |
| 206 | return (0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | } |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 208 | |
| 209 | for (i = 0; i < length; i++) { |
| 210 | sum = (u8) (sum + ((u8 *) buffer)[i]); |
| 211 | } |
| 212 | return (sum); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | } |
| 214 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | /******************************************************************************* |
| 216 | * |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 217 | * FUNCTION: acpi_tb_generate_checksum |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 219 | * PARAMETERS: Table - Pointer to a valid ACPI table (with a |
| 220 | * standard ACPI header) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 222 | * RETURN: 8 bit checksum of buffer |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 224 | * DESCRIPTION: Computes an 8 bit checksum of the table. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | * |
| 226 | ******************************************************************************/ |
| 227 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 228 | u8 acpi_tb_generate_checksum(struct acpi_table_header * table) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | { |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 230 | u8 checksum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 232 | /* Sum the entire table as-is */ |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 233 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 234 | checksum = acpi_tb_sum_table(table, table->length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 236 | /* Subtract off the existing checksum value in the table */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 238 | checksum = (u8) (checksum - table->checksum); |
| 239 | |
| 240 | /* Compute the final checksum */ |
| 241 | |
| 242 | checksum = (u8) (0 - checksum); |
| 243 | return (checksum); |
| 244 | } |
| 245 | |
| 246 | /******************************************************************************* |
| 247 | * |
| 248 | * FUNCTION: acpi_tb_set_checksum |
| 249 | * |
| 250 | * PARAMETERS: Table - Pointer to a valid ACPI table (with a |
| 251 | * standard ACPI header) |
| 252 | * |
| 253 | * RETURN: None. Sets the table checksum field |
| 254 | * |
| 255 | * DESCRIPTION: Computes an 8 bit checksum of the table and inserts the |
| 256 | * checksum into the table header. |
| 257 | * |
| 258 | ******************************************************************************/ |
| 259 | |
| 260 | void acpi_tb_set_checksum(struct acpi_table_header *table) |
| 261 | { |
| 262 | |
| 263 | table->checksum = acpi_tb_generate_checksum(table); |
| 264 | } |
| 265 | |
| 266 | /******************************************************************************* |
| 267 | * |
| 268 | * FUNCTION: acpi_tb_verify_table_checksum |
| 269 | * |
| 270 | * PARAMETERS: *table_header - ACPI table to verify |
| 271 | * |
| 272 | * RETURN: 8 bit checksum of table |
| 273 | * |
| 274 | * DESCRIPTION: Generates an 8 bit checksum of table and returns and compares |
| 275 | * it to the existing checksum value. |
| 276 | * |
| 277 | ******************************************************************************/ |
| 278 | |
| 279 | acpi_status |
| 280 | acpi_tb_verify_table_checksum(struct acpi_table_header *table_header) |
| 281 | { |
| 282 | u8 checksum; |
| 283 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 284 | ACPI_FUNCTION_TRACE(tb_verify_table_checksum); |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 285 | |
| 286 | /* Compute the checksum on the table */ |
| 287 | |
| 288 | checksum = acpi_tb_generate_checksum(table_header); |
| 289 | |
| 290 | /* Checksum ok? */ |
| 291 | |
| 292 | if (checksum == table_header->checksum) { |
| 293 | return_ACPI_STATUS(AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | } |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 295 | |
| 296 | ACPI_WARNING((AE_INFO, |
| 297 | "Incorrect checksum in table [%4.4s] - is %2.2X, should be %2.2X", |
| 298 | table_header->signature, table_header->checksum, |
| 299 | checksum)); |
| 300 | |
| 301 | return_ACPI_STATUS(AE_BAD_CHECKSUM); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | } |
| 303 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 304 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
| 305 | /******************************************************************************* |
| 306 | * |
| 307 | * FUNCTION: acpi_tb_handle_to_object |
| 308 | * |
| 309 | * PARAMETERS: table_id - Id for which the function is searching |
| 310 | * table_desc - Pointer to return the matching table |
| 311 | * descriptor. |
| 312 | * |
| 313 | * RETURN: Search the tables to find one with a matching table_id and |
| 314 | * return a pointer to that table descriptor. |
| 315 | * |
| 316 | ******************************************************************************/ |
| 317 | |
| 318 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 319 | acpi_tb_handle_to_object(u16 table_id, |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 320 | struct acpi_table_desc **return_table_desc) |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 321 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 322 | u32 i; |
| 323 | struct acpi_table_desc *table_desc; |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 324 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 325 | ACPI_FUNCTION_NAME(tb_handle_to_object); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 326 | |
| 327 | for (i = 0; i < ACPI_TABLE_MAX; i++) { |
| 328 | table_desc = acpi_gbl_table_lists[i].next; |
| 329 | while (table_desc) { |
| 330 | if (table_desc->table_id == table_id) { |
| 331 | *return_table_desc = table_desc; |
| 332 | return (AE_OK); |
| 333 | } |
| 334 | |
| 335 | table_desc = table_desc->next; |
| 336 | } |
| 337 | } |
| 338 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 339 | ACPI_ERROR((AE_INFO, "TableId=%X does not exist", table_id)); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 340 | return (AE_BAD_PARAMETER); |
| 341 | } |
| 342 | #endif |