aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-04-18 22:49:35 -0400
committerLen Brown <len.brown@intel.com>2005-07-12 00:08:52 -0400
commit44f6c01242da4e162f28d8e1216a8c7a91174605 (patch)
tree53f724764f1bd9036dfb049a643d198125cc9edc /drivers/acpi/tables
parentebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (diff)
ACPICA 20050408 from Bob Moore
Fixed three cases in the interpreter where an "index" argument to an ASL function was still (internally) 32 bits instead of the required 64 bits. This was the Index argument to the Index, Mid, and Match operators. The "strupr" function is now permanently local (acpi_ut_strupr), since this is not a POSIX-defined function and not present in most kernel-level C libraries. References to the C library strupr function have been removed from the headers. Completed the deployment of static functions/prototypes. All prototypes with the static attribute have been moved from the headers to the owning C file. ACPICA 20050329 from Bob Moore An error is now generated if an attempt is made to create a Buffer Field of length zero (A CreateField with a length operand of zero.) The interpreter now issues a warning whenever executable code at the module level is detected during ACPI table load. This will give some idea of the prevalence of this type of code. Implemented support for references to named objects (other than control methods) within package objects. Enhanced package object output for the debug object. Package objects are now completely dumped, showing all elements. Enhanced miscellaneous object output for the debug object. Any object can now be written to the debug object (for example, a device object can be written, and the type of the object will be displayed.) The "static" qualifier has been added to all local functions across the core subsystem. The number of "long" lines (> 80 chars) within the source has been significantly reduced, by about 1/3. Cleaned up all header files to ensure that all CA/iASL functions are prototyped (even static functions) and the formatting is consistent. Two new header files have been added, acopcode.h and acnames.h. Removed several obsolete functions that were no longer used. Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables')
-rw-r--r--drivers/acpi/tables/tbconvrt.c105
-rw-r--r--drivers/acpi/tables/tbget.c63
-rw-r--r--drivers/acpi/tables/tbgetall.c45
-rw-r--r--drivers/acpi/tables/tbinstal.c31
-rw-r--r--drivers/acpi/tables/tbrsdt.c19
-rw-r--r--drivers/acpi/tables/tbutils.c97
-rw-r--r--drivers/acpi/tables/tbxface.c39
-rw-r--r--drivers/acpi/tables/tbxfroot.c123
8 files changed, 324 insertions, 198 deletions
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c
index 334327c1f66..92e0c31539b 100644
--- a/drivers/acpi/tables/tbconvrt.c
+++ b/drivers/acpi/tables/tbconvrt.c
@@ -50,6 +50,24 @@
50#define _COMPONENT ACPI_TABLES 50#define _COMPONENT ACPI_TABLES
51 ACPI_MODULE_NAME ("tbconvrt") 51 ACPI_MODULE_NAME ("tbconvrt")
52 52
53/* Local prototypes */
54
55static void
56acpi_tb_init_generic_address (
57 struct acpi_generic_address *new_gas_struct,
58 u8 register_bit_width,
59 acpi_physical_address address);
60
61static void
62acpi_tb_convert_fadt1 (
63 struct fadt_descriptor_rev2 *local_fadt,
64 struct fadt_descriptor_rev1 *original_fadt);
65
66static void
67acpi_tb_convert_fadt2 (
68 struct fadt_descriptor_rev2 *local_fadt,
69 struct fadt_descriptor_rev2 *original_fadt);
70
53 71
54u8 acpi_fadt_is_v1; 72u8 acpi_fadt_is_v1;
55EXPORT_SYMBOL(acpi_fadt_is_v1); 73EXPORT_SYMBOL(acpi_fadt_is_v1);
@@ -142,11 +160,13 @@ acpi_tb_convert_to_xsdt (
142 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { 160 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
143 if (acpi_gbl_RSDP->revision < 2) { 161 if (acpi_gbl_RSDP->revision < 2) {
144 ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], 162 ACPI_STORE_ADDRESS (new_table->table_offset_entry[i],
145 (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, table_info->pointer))->table_offset_entry[i]); 163 (ACPI_CAST_PTR (struct rsdt_descriptor_rev1,
164 table_info->pointer))->table_offset_entry[i]);
146 } 165 }
147 else { 166 else {
148 new_table->table_offset_entry[i] = 167 new_table->table_offset_entry[i] =
149 (ACPI_CAST_PTR (XSDT_DESCRIPTOR, table_info->pointer))->table_offset_entry[i]; 168 (ACPI_CAST_PTR (XSDT_DESCRIPTOR,
169 table_info->pointer))->table_offset_entry[i];
150 } 170 }
151 } 171 }
152 172
@@ -164,7 +184,7 @@ acpi_tb_convert_to_xsdt (
164} 184}
165 185
166 186
167/****************************************************************************** 187/*******************************************************************************
168 * 188 *
169 * FUNCTION: acpi_tb_init_generic_address 189 * FUNCTION: acpi_tb_init_generic_address
170 * 190 *
@@ -201,7 +221,7 @@ acpi_tb_init_generic_address (
201 * PARAMETERS: local_fadt - Pointer to new FADT 221 * PARAMETERS: local_fadt - Pointer to new FADT
202 * original_fadt - Pointer to old FADT 222 * original_fadt - Pointer to old FADT
203 * 223 *
204 * RETURN: Populates local_fadt 224 * RETURN: None, populates local_fadt
205 * 225 *
206 * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format 226 * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format
207 * 227 *
@@ -213,7 +233,6 @@ acpi_tb_convert_fadt1 (
213 struct fadt_descriptor_rev1 *original_fadt) 233 struct fadt_descriptor_rev1 *original_fadt)
214{ 234{
215 235
216
217 /* ACPI 1.0 FACS */ 236 /* ACPI 1.0 FACS */
218 /* The BIOS stored FADT should agree with Revision 1.0 */ 237 /* The BIOS stored FADT should agree with Revision 1.0 */
219 acpi_fadt_is_v1 = 1; 238 acpi_fadt_is_v1 = 1;
@@ -232,7 +251,8 @@ acpi_tb_convert_fadt1 (
232 ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); 251 ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt);
233 252
234 /* 253 /*
235 * System Interrupt Model isn't used in ACPI 2.0 (local_fadt->Reserved1 = 0;) 254 * System Interrupt Model isn't used in ACPI 2.0
255 * (local_fadt->Reserved1 = 0;)
236 */ 256 */
237 257
238 /* 258 /*
@@ -269,7 +289,8 @@ acpi_tb_convert_fadt1 (
269 * that immediately follows. 289 * that immediately follows.
270 */ 290 */
271 ACPI_MEMCPY (&local_fadt->reset_register, 291 ACPI_MEMCPY (&local_fadt->reset_register,
272 &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, original_fadt))->reset_register, 292 &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus,
293 original_fadt))->reset_register,
273 sizeof (struct acpi_generic_address) + 1); 294 sizeof (struct acpi_generic_address) + 1);
274 } 295 }
275 else { 296 else {
@@ -304,7 +325,8 @@ acpi_tb_convert_fadt1 (
304 325
305 acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, 326 acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable,
306 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), 327 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
307 (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + 328 (acpi_physical_address)
329 (local_fadt->xpm1a_evt_blk.address +
308 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); 330 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
309 331
310 /* PM1B is optional; leave null if not present */ 332 /* PM1B is optional; leave null if not present */
@@ -312,7 +334,8 @@ acpi_tb_convert_fadt1 (
312 if (local_fadt->xpm1b_evt_blk.address) { 334 if (local_fadt->xpm1b_evt_blk.address) {
313 acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, 335 acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
314 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), 336 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
315 (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + 337 (acpi_physical_address)
338 (local_fadt->xpm1b_evt_blk.address +
316 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); 339 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
317 } 340 }
318} 341}
@@ -325,7 +348,7 @@ acpi_tb_convert_fadt1 (
325 * PARAMETERS: local_fadt - Pointer to new FADT 348 * PARAMETERS: local_fadt - Pointer to new FADT
326 * original_fadt - Pointer to old FADT 349 * original_fadt - Pointer to old FADT
327 * 350 *
328 * RETURN: Populates local_fadt 351 * RETURN: None, populates local_fadt
329 * 352 *
330 * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. 353 * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format.
331 * Handles optional "X" fields. 354 * Handles optional "X" fields.
@@ -348,7 +371,8 @@ acpi_tb_convert_fadt2 (
348 * is zero. 371 * is zero.
349 */ 372 */
350 if (!(local_fadt->xfirmware_ctrl)) { 373 if (!(local_fadt->xfirmware_ctrl)) {
351 ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl); 374 ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl,
375 local_fadt->V1_firmware_ctrl);
352 } 376 }
353 377
354 if (!(local_fadt->Xdsdt)) { 378 if (!(local_fadt->Xdsdt)) {
@@ -357,32 +381,38 @@ acpi_tb_convert_fadt2 (
357 381
358 if (!(local_fadt->xpm1a_evt_blk.address)) { 382 if (!(local_fadt->xpm1a_evt_blk.address)) {
359 acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, 383 acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk,
360 local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); 384 local_fadt->pm1_evt_len,
385 (acpi_physical_address) local_fadt->V1_pm1a_evt_blk);
361 } 386 }
362 387
363 if (!(local_fadt->xpm1b_evt_blk.address)) { 388 if (!(local_fadt->xpm1b_evt_blk.address)) {
364 acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, 389 acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk,
365 local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); 390 local_fadt->pm1_evt_len,
391 (acpi_physical_address) local_fadt->V1_pm1b_evt_blk);
366 } 392 }
367 393
368 if (!(local_fadt->xpm1a_cnt_blk.address)) { 394 if (!(local_fadt->xpm1a_cnt_blk.address)) {
369 acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, 395 acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk,
370 local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); 396 local_fadt->pm1_cnt_len,
397 (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk);
371 } 398 }
372 399
373 if (!(local_fadt->xpm1b_cnt_blk.address)) { 400 if (!(local_fadt->xpm1b_cnt_blk.address)) {
374 acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, 401 acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk,
375 local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); 402 local_fadt->pm1_cnt_len,
403 (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk);
376 } 404 }
377 405
378 if (!(local_fadt->xpm2_cnt_blk.address)) { 406 if (!(local_fadt->xpm2_cnt_blk.address)) {
379 acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, 407 acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk,
380 local_fadt->pm2_cnt_len, (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); 408 local_fadt->pm2_cnt_len,
409 (acpi_physical_address) local_fadt->V1_pm2_cnt_blk);
381 } 410 }
382 411
383 if (!(local_fadt->xpm_tmr_blk.address)) { 412 if (!(local_fadt->xpm_tmr_blk.address)) {
384 acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, 413 acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk,
385 local_fadt->pm_tm_len, (acpi_physical_address) local_fadt->V1_pm_tmr_blk); 414 local_fadt->pm_tm_len,
415 (acpi_physical_address) local_fadt->V1_pm_tmr_blk);
386 } 416 }
387 417
388 if (!(local_fadt->xgpe0_blk.address)) { 418 if (!(local_fadt->xgpe0_blk.address)) {
@@ -399,18 +429,24 @@ acpi_tb_convert_fadt2 (
399 429
400 acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, 430 acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable,
401 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), 431 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
402 (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + 432 (acpi_physical_address)
433 (local_fadt->xpm1a_evt_blk.address +
403 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); 434 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
404 acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id; 435
436 acpi_gbl_xpm1a_enable.address_space_id =
437 local_fadt->xpm1a_evt_blk.address_space_id;
405 438
406 /* PM1B is optional; leave null if not present */ 439 /* PM1B is optional; leave null if not present */
407 440
408 if (local_fadt->xpm1b_evt_blk.address) { 441 if (local_fadt->xpm1b_evt_blk.address) {
409 acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, 442 acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
410 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), 443 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
411 (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + 444 (acpi_physical_address)
445 (local_fadt->xpm1b_evt_blk.address +
412 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); 446 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
413 acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id; 447
448 acpi_gbl_xpm1b_enable.address_space_id =
449 local_fadt->xpm1b_evt_blk.address_space_id;
414 } 450 }
415} 451}
416 452
@@ -432,7 +468,8 @@ acpi_tb_convert_fadt2 (
432 ******************************************************************************/ 468 ******************************************************************************/
433 469
434acpi_status 470acpi_status
435acpi_tb_convert_table_fadt (void) 471acpi_tb_convert_table_fadt (
472 void)
436{ 473{
437 struct fadt_descriptor_rev2 *local_fadt; 474 struct fadt_descriptor_rev2 *local_fadt;
438 struct acpi_table_desc *table_desc; 475 struct acpi_table_desc *table_desc;
@@ -446,7 +483,8 @@ acpi_tb_convert_table_fadt (void)
446 * at least as long as the version 1.0 FADT 483 * at least as long as the version 1.0 FADT
447 */ 484 */
448 if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { 485 if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) {
449 ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", acpi_gbl_FADT->length)); 486 ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n",
487 acpi_gbl_FADT->length));
450 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); 488 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
451 } 489 }
452 490
@@ -461,8 +499,9 @@ acpi_tb_convert_table_fadt (void)
461 if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { 499 if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) {
462 /* Length is too short to be a V2.0 table */ 500 /* Length is too short to be a V2.0 table */
463 501
464 ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", 502 ACPI_REPORT_WARNING ((
465 acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); 503 "Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n",
504 acpi_gbl_FADT->length, acpi_gbl_FADT->revision));
466 505
467 acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); 506 acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
468 } 507 }
@@ -478,9 +517,8 @@ acpi_tb_convert_table_fadt (void)
478 acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); 517 acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
479 } 518 }
480 519
481 /* 520 /* Global FADT pointer will point to the new common V2.0 FADT */
482 * Global FADT pointer will point to the new common V2.0 FADT 521
483 */
484 acpi_gbl_FADT = local_fadt; 522 acpi_gbl_FADT = local_fadt;
485 acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); 523 acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR);
486 524
@@ -508,7 +546,7 @@ acpi_tb_convert_table_fadt (void)
508 546
509/******************************************************************************* 547/*******************************************************************************
510 * 548 *
511 * FUNCTION: acpi_tb_convert_table_facs 549 * FUNCTION: acpi_tb_build_common_facs
512 * 550 *
513 * PARAMETERS: table_info - Info for currently installed FACS 551 * PARAMETERS: table_info - Info for currently installed FACS
514 * 552 *
@@ -530,12 +568,14 @@ acpi_tb_build_common_facs (
530 /* Absolute minimum length is 24, but the ACPI spec says 64 */ 568 /* Absolute minimum length is 24, but the ACPI spec says 64 */
531 569
532 if (acpi_gbl_FACS->length < 24) { 570 if (acpi_gbl_FACS->length < 24) {
533 ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", acpi_gbl_FACS->length)); 571 ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n",
572 acpi_gbl_FACS->length));
534 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); 573 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
535 } 574 }
536 575
537 if (acpi_gbl_FACS->length < 64) { 576 if (acpi_gbl_FACS->length < 64) {
538 ACPI_REPORT_WARNING (("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", 577 ACPI_REPORT_WARNING ((
578 "FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n",
539 acpi_gbl_FACS->length)); 579 acpi_gbl_FACS->length));
540 } 580 }
541 581
@@ -548,7 +588,8 @@ acpi_tb_build_common_facs (
548 (!(acpi_gbl_FACS->xfirmware_waking_vector))) { 588 (!(acpi_gbl_FACS->xfirmware_waking_vector))) {
549 /* ACPI 1.0 FACS or short table or optional X_ field is zero */ 589 /* ACPI 1.0 FACS or short table or optional X_ field is zero */
550 590
551 acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, &(acpi_gbl_FACS->firmware_waking_vector)); 591 acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64,
592 &(acpi_gbl_FACS->firmware_waking_vector));
552 acpi_gbl_common_fACS.vector_width = 32; 593 acpi_gbl_common_fACS.vector_width = 32;
553 } 594 }
554 else { 595 else {
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c
index 896f3ddda62..4ab2aadc613 100644
--- a/drivers/acpi/tables/tbget.c
+++ b/drivers/acpi/tables/tbget.c
@@ -49,6 +49,19 @@
49#define _COMPONENT ACPI_TABLES 49#define _COMPONENT ACPI_TABLES
50 ACPI_MODULE_NAME ("tbget") 50 ACPI_MODULE_NAME ("tbget")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_tb_get_this_table (
56 struct acpi_pointer *address,
57 struct acpi_table_header *header,
58 struct acpi_table_desc *table_info);
59
60static acpi_status
61acpi_tb_table_override (
62 struct acpi_table_header *header,
63 struct acpi_table_desc *table_info);
64
52 65
53/******************************************************************************* 66/*******************************************************************************
54 * 67 *
@@ -76,9 +89,8 @@ acpi_tb_get_table (
76 ACPI_FUNCTION_TRACE ("tb_get_table"); 89 ACPI_FUNCTION_TRACE ("tb_get_table");
77 90
78 91
79 /* 92 /* Get the header in order to get signature and table size */
80 * Get the header in order to get signature and table size 93
81 */
82 status = acpi_tb_get_table_header (address, &header); 94 status = acpi_tb_get_table_header (address, &header);
83 if (ACPI_FAILURE (status)) { 95 if (ACPI_FAILURE (status)) {
84 return_ACPI_STATUS (status); 96 return_ACPI_STATUS (status);
@@ -127,8 +139,8 @@ acpi_tb_get_table_header (
127 139
128 140
129 /* 141 /*
130 * Flags contains the current processor mode (Virtual or Physical addressing) 142 * Flags contains the current processor mode (Virtual or Physical
131 * The pointer_type is either Logical or Physical 143 * addressing) The pointer_type is either Logical or Physical
132 */ 144 */
133 switch (address->pointer_type) { 145 switch (address->pointer_type) {
134 case ACPI_PHYSMODE_PHYSPTR: 146 case ACPI_PHYSMODE_PHYSPTR:
@@ -136,7 +148,8 @@ acpi_tb_get_table_header (
136 148
137 /* Pointer matches processor mode, copy the header */ 149 /* Pointer matches processor mode, copy the header */
138 150
139 ACPI_MEMCPY (return_header, address->pointer.logical, sizeof (struct acpi_table_header)); 151 ACPI_MEMCPY (return_header, address->pointer.logical,
152 sizeof (struct acpi_table_header));
140 break; 153 break;
141 154
142 155
@@ -144,10 +157,11 @@ acpi_tb_get_table_header (
144 157
145 /* Create a logical address for the physical pointer*/ 158 /* Create a logical address for the physical pointer*/
146 159
147 status = acpi_os_map_memory (address->pointer.physical, sizeof (struct acpi_table_header), 160 status = acpi_os_map_memory (address->pointer.physical,
148 (void *) &header); 161 sizeof (struct acpi_table_header), (void *) &header);
149 if (ACPI_FAILURE (status)) { 162 if (ACPI_FAILURE (status)) {
150 ACPI_REPORT_ERROR (("Could not map memory at %8.8X%8.8X for length %X\n", 163 ACPI_REPORT_ERROR ((
164 "Could not map memory at %8.8X%8.8X for length %X\n",
151 ACPI_FORMAT_UINT64 (address->pointer.physical), 165 ACPI_FORMAT_UINT64 (address->pointer.physical),
152 sizeof (struct acpi_table_header))); 166 sizeof (struct acpi_table_header)));
153 return_ACPI_STATUS (status); 167 return_ACPI_STATUS (status);
@@ -210,9 +224,8 @@ acpi_tb_get_table_body (
210 return_ACPI_STATUS (AE_BAD_PARAMETER); 224 return_ACPI_STATUS (AE_BAD_PARAMETER);
211 } 225 }
212 226
213 /* 227 /* Attempt table override. */
214 * Attempt table override. 228
215 */
216 status = acpi_tb_table_override (header, table_info); 229 status = acpi_tb_table_override (header, table_info);
217 if (ACPI_SUCCESS (status)) { 230 if (ACPI_SUCCESS (status)) {
218 /* Table was overridden by the host OS */ 231 /* Table was overridden by the host OS */
@@ -241,7 +254,7 @@ acpi_tb_get_table_body (
241 * 254 *
242 ******************************************************************************/ 255 ******************************************************************************/
243 256
244acpi_status 257static acpi_status
245acpi_tb_table_override ( 258acpi_tb_table_override (
246 struct acpi_table_header *header, 259 struct acpi_table_header *header,
247 struct acpi_table_desc *table_info) 260 struct acpi_table_desc *table_info)
@@ -315,7 +328,7 @@ acpi_tb_table_override (
315 * 328 *
316 ******************************************************************************/ 329 ******************************************************************************/
317 330
318acpi_status 331static acpi_status
319acpi_tb_get_this_table ( 332acpi_tb_get_this_table (
320 struct acpi_pointer *address, 333 struct acpi_pointer *address,
321 struct acpi_table_header *header, 334 struct acpi_table_header *header,
@@ -330,8 +343,8 @@ acpi_tb_get_this_table (
330 343
331 344
332 /* 345 /*
333 * Flags contains the current processor mode (Virtual or Physical addressing) 346 * Flags contains the current processor mode (Virtual or Physical
334 * The pointer_type is either Logical or Physical 347 * addressing) The pointer_type is either Logical or Physical
335 */ 348 */
336 switch (address->pointer_type) { 349 switch (address->pointer_type) {
337 case ACPI_PHYSMODE_PHYSPTR: 350 case ACPI_PHYSMODE_PHYSPTR:
@@ -341,7 +354,8 @@ acpi_tb_get_this_table (
341 354
342 full_table = ACPI_MEM_ALLOCATE (header->length); 355 full_table = ACPI_MEM_ALLOCATE (header->length);
343 if (!full_table) { 356 if (!full_table) {
344 ACPI_REPORT_ERROR (("Could not allocate table memory for [%4.4s] length %X\n", 357 ACPI_REPORT_ERROR ((
358 "Could not allocate table memory for [%4.4s] length %X\n",
345 header->signature, header->length)); 359 header->signature, header->length));
346 return_ACPI_STATUS (AE_NO_MEMORY); 360 return_ACPI_STATUS (AE_NO_MEMORY);
347 } 361 }
@@ -362,12 +376,14 @@ acpi_tb_get_this_table (
362 * Just map the table's physical memory 376 * Just map the table's physical memory
363 * into our address space. 377 * into our address space.
364 */ 378 */
365 status = acpi_os_map_memory (address->pointer.physical, (acpi_size) header->length, 379 status = acpi_os_map_memory (address->pointer.physical,
366 (void *) &full_table); 380 (acpi_size) header->length, (void *) &full_table);
367 if (ACPI_FAILURE (status)) { 381 if (ACPI_FAILURE (status)) {
368 ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", 382 ACPI_REPORT_ERROR ((
383 "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n",
369 header->signature, 384 header->signature,
370 ACPI_FORMAT_UINT64 (address->pointer.physical), header->length)); 385 ACPI_FORMAT_UINT64 (address->pointer.physical),
386 header->length));
371 return (status); 387 return (status);
372 } 388 }
373 389
@@ -465,9 +481,8 @@ acpi_tb_get_table_ptr (
465 return_ACPI_STATUS (AE_OK); 481 return_ACPI_STATUS (AE_OK);
466 } 482 }
467 483
468 /* 484 /* Check for instance out of range */
469 * Check for instance out of range 485
470 */
471 if (instance > acpi_gbl_table_lists[table_type].count) { 486 if (instance > acpi_gbl_table_lists[table_type].count) {
472 return_ACPI_STATUS (AE_NOT_EXIST); 487 return_ACPI_STATUS (AE_NOT_EXIST);
473 } 488 }
diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c
index adc4270988b..eea5b8cb5eb 100644
--- a/drivers/acpi/tables/tbgetall.c
+++ b/drivers/acpi/tables/tbgetall.c
@@ -49,6 +49,19 @@
49#define _COMPONENT ACPI_TABLES 49#define _COMPONENT ACPI_TABLES
50 ACPI_MODULE_NAME ("tbgetall") 50 ACPI_MODULE_NAME ("tbgetall")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_tb_get_primary_table (
56 struct acpi_pointer *address,
57 struct acpi_table_desc *table_info);
58
59static acpi_status
60acpi_tb_get_secondary_table (
61 struct acpi_pointer *address,
62 acpi_string signature,
63 struct acpi_table_desc *table_info);
64
52 65
53/******************************************************************************* 66/*******************************************************************************
54 * 67 *
@@ -63,7 +76,7 @@
63 * 76 *
64 ******************************************************************************/ 77 ******************************************************************************/
65 78
66acpi_status 79static acpi_status
67acpi_tb_get_primary_table ( 80acpi_tb_get_primary_table (
68 struct acpi_pointer *address, 81 struct acpi_pointer *address,
69 struct acpi_table_desc *table_info) 82 struct acpi_table_desc *table_info)
@@ -81,9 +94,8 @@ acpi_tb_get_primary_table (
81 return_ACPI_STATUS (AE_OK); 94 return_ACPI_STATUS (AE_OK);
82 } 95 }
83 96
84 /* 97 /* Get the header in order to get signature and table size */
85 * Get the header in order to get signature and table size 98
86 */
87 status = acpi_tb_get_table_header (address, &header); 99 status = acpi_tb_get_table_header (address, &header);
88 if (ACPI_FAILURE (status)) { 100 if (ACPI_FAILURE (status)) {
89 return_ACPI_STATUS (status); 101 return_ACPI_STATUS (status);
@@ -130,7 +142,7 @@ acpi_tb_get_primary_table (
130 * 142 *
131 ******************************************************************************/ 143 ******************************************************************************/
132 144
133acpi_status 145static acpi_status
134acpi_tb_get_secondary_table ( 146acpi_tb_get_secondary_table (
135 struct acpi_pointer *address, 147 struct acpi_pointer *address,
136 acpi_string signature, 148 acpi_string signature,
@@ -153,7 +165,8 @@ acpi_tb_get_secondary_table (
153 /* Signature must match request */ 165 /* Signature must match request */
154 166
155 if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) { 167 if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) {
156 ACPI_REPORT_ERROR (("Incorrect table signature - wanted [%s] found [%4.4s]\n", 168 ACPI_REPORT_ERROR ((
169 "Incorrect table signature - wanted [%s] found [%4.4s]\n",
157 signature, header.signature)); 170 signature, header.signature));
158 return_ACPI_STATUS (AE_BAD_SIGNATURE); 171 return_ACPI_STATUS (AE_BAD_SIGNATURE);
159 } 172 }
@@ -230,7 +243,8 @@ acpi_tb_get_required_tables (
230 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { 243 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
231 /* Get the table address from the common internal XSDT */ 244 /* Get the table address from the common internal XSDT */
232 245
233 address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; 246 address.pointer.value =
247 acpi_gbl_XSDT->table_offset_entry[i];
234 248
235 /* 249 /*
236 * Get the tables needed by this subsystem (FADT and any SSDTs). 250 * Get the tables needed by this subsystem (FADT and any SSDTs).
@@ -252,18 +266,18 @@ acpi_tb_get_required_tables (
252 } 266 }
253 267
254 /* 268 /*
255 * Convert the FADT to a common format. This allows earlier revisions of the 269 * Convert the FADT to a common format. This allows earlier revisions of
256 * table to coexist with newer versions, using common access code. 270 * the table to coexist with newer versions, using common access code.
257 */ 271 */
258 status = acpi_tb_convert_table_fadt (); 272 status = acpi_tb_convert_table_fadt ();
259 if (ACPI_FAILURE (status)) { 273 if (ACPI_FAILURE (status)) {
260 ACPI_REPORT_ERROR (("Could not convert FADT to internal common format\n")); 274 ACPI_REPORT_ERROR ((
275 "Could not convert FADT to internal common format\n"));
261 return_ACPI_STATUS (status); 276 return_ACPI_STATUS (status);
262 } 277 }
263 278
264 /* 279 /* Get the FACS (Pointed to by the FADT) */
265 * Get the FACS (Pointed to by the FADT) 280
266 */
267 address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl; 281 address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl;
268 282
269 status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info); 283 status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info);
@@ -282,9 +296,8 @@ acpi_tb_get_required_tables (
282 return_ACPI_STATUS (status); 296 return_ACPI_STATUS (status);
283 } 297 }
284 298
285 /* 299 /* Get/install the DSDT (Pointed to by the FADT) */
286 * Get/install the DSDT (Pointed to by the FADT) 300
287 */
288 address.pointer.value = acpi_gbl_FADT->Xdsdt; 301 address.pointer.value = acpi_gbl_FADT->Xdsdt;
289 302
290 status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info); 303 status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info);
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 85d5bb01022..629b64c8193 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -49,6 +49,14 @@
49#define _COMPONENT ACPI_TABLES 49#define _COMPONENT ACPI_TABLES
50 ACPI_MODULE_NAME ("tbinstal") 50 ACPI_MODULE_NAME ("tbinstal")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_tb_match_signature (
56 char *signature,
57 struct acpi_table_desc *table_info,
58 u8 search_type);
59
52 60
53/******************************************************************************* 61/*******************************************************************************
54 * 62 *
@@ -56,6 +64,7 @@
56 * 64 *
57 * PARAMETERS: Signature - Table signature to match 65 * PARAMETERS: Signature - Table signature to match
58 * table_info - Return data 66 * table_info - Return data
67 * search_type - Table type to match (primary/secondary)
59 * 68 *
60 * RETURN: Status 69 * RETURN: Status
61 * 70 *
@@ -64,7 +73,7 @@
64 * 73 *
65 ******************************************************************************/ 74 ******************************************************************************/
66 75
67acpi_status 76static acpi_status
68acpi_tb_match_signature ( 77acpi_tb_match_signature (
69 char *signature, 78 char *signature,
70 struct acpi_table_desc *table_info, 79 struct acpi_table_desc *table_info,
@@ -76,9 +85,8 @@ acpi_tb_match_signature (
76 ACPI_FUNCTION_TRACE ("tb_match_signature"); 85 ACPI_FUNCTION_TRACE ("tb_match_signature");
77 86
78 87
79 /* 88 /* Search for a signature match among the known table types */
80 * Search for a signature match among the known table types 89
81 */
82 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { 90 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) {
83 if (!(acpi_gbl_table_data[i].flags & search_type)) { 91 if (!(acpi_gbl_table_data[i].flags & search_type)) {
84 continue; 92 continue;
@@ -161,6 +169,7 @@ acpi_tb_install_table (
161 * FUNCTION: acpi_tb_recognize_table 169 * FUNCTION: acpi_tb_recognize_table
162 * 170 *
163 * PARAMETERS: table_info - Return value from acpi_tb_get_table_body 171 * PARAMETERS: table_info - Return value from acpi_tb_get_table_body
172 * search_type - Table type to match (primary/secondary)
164 * 173 *
165 * RETURN: Status 174 * RETURN: Status
166 * 175 *
@@ -203,7 +212,8 @@ acpi_tb_recognize_table (
203 * This can be any one of many valid ACPI tables, it just isn't one of 212 * This can be any one of many valid ACPI tables, it just isn't one of
204 * the tables that is consumed by the core subsystem 213 * the tables that is consumed by the core subsystem
205 */ 214 */
206 status = acpi_tb_match_signature (table_header->signature, table_info, search_type); 215 status = acpi_tb_match_signature (table_header->signature,
216 table_info, search_type);
207 if (ACPI_FAILURE (status)) { 217 if (ACPI_FAILURE (status)) {
208 return_ACPI_STATUS (status); 218 return_ACPI_STATUS (status);
209 } 219 }
@@ -253,9 +263,8 @@ acpi_tb_init_table_descriptor (
253 return_ACPI_STATUS (AE_NO_MEMORY); 263 return_ACPI_STATUS (AE_NO_MEMORY);
254 } 264 }
255 265
256 /* 266 /* Install the table into the global data structure */
257 * Install the table into the global data structure 267
258 */
259 list_head = &acpi_gbl_table_lists[table_type]; 268 list_head = &acpi_gbl_table_lists[table_type];
260 269
261 /* 270 /*
@@ -316,7 +325,8 @@ acpi_tb_init_table_descriptor (
316 table_desc->aml_start = (u8 *) (table_desc->pointer + 1), 325 table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
317 table_desc->aml_length = (u32) (table_desc->length - 326 table_desc->aml_length = (u32) (table_desc->length -
318 (u32) sizeof (struct acpi_table_header)); 327 (u32) sizeof (struct acpi_table_header));
319 table_desc->table_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_TABLE); 328 table_desc->table_id = acpi_ut_allocate_owner_id (
329 ACPI_OWNER_TYPE_TABLE);
320 table_desc->loaded_into_namespace = FALSE; 330 table_desc->loaded_into_namespace = FALSE;
321 331
322 /* 332 /*
@@ -349,7 +359,8 @@ acpi_tb_init_table_descriptor (
349 ******************************************************************************/ 359 ******************************************************************************/
350 360
351void 361void
352acpi_tb_delete_all_tables (void) 362acpi_tb_delete_all_tables (
363 void)
353{ 364{
354 acpi_table_type type; 365 acpi_table_type type;
355 366
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
index 9c6913238d5..b7ffe39c362 100644
--- a/drivers/acpi/tables/tbrsdt.c
+++ b/drivers/acpi/tables/tbrsdt.c
@@ -84,8 +84,9 @@ acpi_tb_verify_rsdp (
84 /* 84 /*
85 * Obtain access to the RSDP structure 85 * Obtain access to the RSDP structure
86 */ 86 */
87 status = acpi_os_map_memory (address->pointer.physical, sizeof (struct rsdp_descriptor), 87 status = acpi_os_map_memory (address->pointer.physical,
88 (void *) &rsdp); 88 sizeof (struct rsdp_descriptor),
89 (void *) &rsdp);
89 if (ACPI_FAILURE (status)) { 90 if (ACPI_FAILURE (status)) {
90 return_ACPI_STATUS (status); 91 return_ACPI_STATUS (status);
91 } 92 }
@@ -154,9 +155,9 @@ cleanup:
154 * 155 *
155 * FUNCTION: acpi_tb_get_rsdt_address 156 * FUNCTION: acpi_tb_get_rsdt_address
156 * 157 *
157 * PARAMETERS: None 158 * PARAMETERS: out_address - Where the address is returned
158 * 159 *
159 * RETURN: RSDT physical address 160 * RETURN: None, Address
160 * 161 *
161 * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the 162 * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
162 * version of the RSDP 163 * version of the RSDP
@@ -181,7 +182,8 @@ acpi_tb_get_rsdt_address (
181 out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; 182 out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
182 } 183 }
183 else { 184 else {
184 out_address->pointer.value = acpi_gbl_RSDP->xsdt_physical_address; 185 out_address->pointer.value =
186 acpi_gbl_RSDP->xsdt_physical_address;
185 } 187 }
186} 188}
187 189
@@ -224,7 +226,8 @@ acpi_tb_validate_rsdt (
224 if (no_match) { 226 if (no_match) {
225 /* Invalid RSDT or XSDT signature */ 227 /* Invalid RSDT or XSDT signature */
226 228
227 ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); 229 ACPI_REPORT_ERROR ((
230 "Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
228 231
229 ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20); 232 ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20);
230 233
@@ -282,6 +285,7 @@ acpi_tb_get_table_rsdt (
282 if (ACPI_FAILURE (status)) { 285 if (ACPI_FAILURE (status)) {
283 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n", 286 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n",
284 acpi_format_exception (status))); 287 acpi_format_exception (status)));
288
285 return_ACPI_STATUS (status); 289 return_ACPI_STATUS (status);
286 } 290 }
287 291
@@ -299,7 +303,8 @@ acpi_tb_get_table_rsdt (
299 303
300 /* Get the number of tables defined in the RSDT or XSDT */ 304 /* Get the number of tables defined in the RSDT or XSDT */
301 305
302 acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info.pointer); 306 acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP,
307 table_info.pointer);
303 308
304 /* Convert and/or copy to an XSDT structure */ 309 /* Convert and/or copy to an XSDT structure */
305 310
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index fede5804c78..e69d01d443d 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -49,48 +49,14 @@
49#define _COMPONENT ACPI_TABLES 49#define _COMPONENT ACPI_TABLES
50 ACPI_MODULE_NAME ("tbutils") 50 ACPI_MODULE_NAME ("tbutils")
51 51
52/* Local prototypes */
52 53
53/******************************************************************************* 54#ifdef ACPI_OBSOLETE_FUNCTIONS
54 *
55 * FUNCTION: acpi_tb_handle_to_object
56 *
57 * PARAMETERS: table_id - Id for which the function is searching
58 * table_desc - Pointer to return the matching table
59 * descriptor.
60 *
61 * RETURN: Search the tables to find one with a matching table_id and
62 * return a pointer to that table descriptor.
63 *
64 ******************************************************************************/
65#ifdef ACPI_FUTURE_USAGE
66acpi_status 55acpi_status
67acpi_tb_handle_to_object ( 56acpi_tb_handle_to_object (
68 u16 table_id, 57 u16 table_id,
69 struct acpi_table_desc **return_table_desc) 58 struct acpi_table_desc **table_desc);
70{ 59#endif
71 u32 i;
72 struct acpi_table_desc *table_desc;
73
74
75 ACPI_FUNCTION_NAME ("tb_handle_to_object");
76
77
78 for (i = 0; i < ACPI_TABLE_MAX; i++) {
79 table_desc = acpi_gbl_table_lists[i].next;
80 while (table_desc) {
81 if (table_desc->table_id == table_id) {
82 *return_table_desc = table_desc;
83 return (AE_OK);
84 }
85
86 table_desc = table_desc->next;
87 }
88 }
89
90 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id));
91 return (AE_BAD_PARAMETER);
92}
93#endif /* ACPI_FUTURE_USAGE */
94 60
95 61
96/******************************************************************************* 62/*******************************************************************************
@@ -128,6 +94,7 @@ acpi_tb_validate_table_header (
128 if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) { 94 if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) {
129 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 95 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
130 "Cannot read table header at %p\n", table_header)); 96 "Cannot read table header at %p\n", table_header));
97
131 return (AE_BAD_ADDRESS); 98 return (AE_BAD_ADDRESS);
132 } 99 }
133 100
@@ -141,6 +108,7 @@ acpi_tb_validate_table_header (
141 108
142 ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", 109 ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n",
143 (char *) &signature)); 110 (char *) &signature));
111
144 ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); 112 ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header));
145 return (AE_BAD_SIGNATURE); 113 return (AE_BAD_SIGNATURE);
146 } 114 }
@@ -154,6 +122,7 @@ acpi_tb_validate_table_header (
154 122
155 ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", 123 ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n",
156 (u32) table_header->length)); 124 (u32) table_header->length));
125
157 ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); 126 ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header));
158 return (AE_BAD_HEADER); 127 return (AE_BAD_HEADER);
159 } 128 }
@@ -193,8 +162,10 @@ acpi_tb_verify_table_checksum (
193 /* Return the appropriate exception */ 162 /* Return the appropriate exception */
194 163
195 if (checksum) { 164 if (checksum) {
196 ACPI_REPORT_WARNING (("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", 165 ACPI_REPORT_WARNING ((
197 table_header->signature, (u32) table_header->checksum, (u32) checksum)); 166 "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n",
167 table_header->signature, (u32) table_header->checksum,
168 (u32) checksum));
198 169
199 status = AE_BAD_CHECKSUM; 170 status = AE_BAD_CHECKSUM;
200 } 171 }
@@ -209,7 +180,7 @@ acpi_tb_verify_table_checksum (
209 * PARAMETERS: Buffer - Buffer to checksum 180 * PARAMETERS: Buffer - Buffer to checksum
210 * Length - Size of the buffer 181 * Length - Size of the buffer
211 * 182 *
212 * RETURNS 8 bit checksum of buffer 183 * RETURN: 8 bit checksum of buffer
213 * 184 *
214 * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. 185 * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it.
215 * 186 *
@@ -238,3 +209,47 @@ acpi_tb_checksum (
238} 209}
239 210
240 211
212#ifdef ACPI_OBSOLETE_FUNCTIONS
213/*******************************************************************************
214 *
215 * FUNCTION: acpi_tb_handle_to_object
216 *
217 * PARAMETERS: table_id - Id for which the function is searching
218 * table_desc - Pointer to return the matching table
219 * descriptor.
220 *
221 * RETURN: Search the tables to find one with a matching table_id and
222 * return a pointer to that table descriptor.
223 *
224 ******************************************************************************/
225
226acpi_status
227acpi_tb_handle_to_object (
228 u16 table_id,
229 struct acpi_table_desc **return_table_desc)
230{
231 u32 i;
232 struct acpi_table_desc *table_desc;
233
234
235 ACPI_FUNCTION_NAME ("tb_handle_to_object");
236
237
238 for (i = 0; i < ACPI_TABLE_MAX; i++) {
239 table_desc = acpi_gbl_table_lists[i].next;
240 while (table_desc) {
241 if (table_desc->table_id == table_id) {
242 *return_table_desc = table_desc;
243 return (AE_OK);
244 }
245
246 table_desc = table_desc->next;
247 }
248 }
249
250 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id));
251 return (AE_BAD_PARAMETER);
252}
253#endif
254
255
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 7715043461c..0c0b9085dbe 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -67,7 +67,8 @@
67 ******************************************************************************/ 67 ******************************************************************************/
68 68
69acpi_status 69acpi_status
70acpi_load_tables (void) 70acpi_load_tables (
71 void)
71{ 72{
72 struct acpi_pointer rsdp_address; 73 struct acpi_pointer rsdp_address;
73 acpi_status status; 74 acpi_status status;
@@ -82,7 +83,7 @@ acpi_load_tables (void)
82 &rsdp_address); 83 &rsdp_address);
83 if (ACPI_FAILURE (status)) { 84 if (ACPI_FAILURE (status)) {
84 ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n", 85 ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n",
85 acpi_format_exception (status))); 86 acpi_format_exception (status)));
86 goto error_exit; 87 goto error_exit;
87 } 88 }
88 89
@@ -93,7 +94,7 @@ acpi_load_tables (void)
93 status = acpi_tb_verify_rsdp (&rsdp_address); 94 status = acpi_tb_verify_rsdp (&rsdp_address);
94 if (ACPI_FAILURE (status)) { 95 if (ACPI_FAILURE (status)) {
95 ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n", 96 ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n",
96 acpi_format_exception (status))); 97 acpi_format_exception (status)));
97 goto error_exit; 98 goto error_exit;
98 } 99 }
99 100
@@ -102,7 +103,7 @@ acpi_load_tables (void)
102 status = acpi_tb_get_table_rsdt (); 103 status = acpi_tb_get_table_rsdt ();
103 if (ACPI_FAILURE (status)) { 104 if (ACPI_FAILURE (status)) {
104 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n", 105 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n",
105 acpi_format_exception (status))); 106 acpi_format_exception (status)));
106 goto error_exit; 107 goto error_exit;
107 } 108 }
108 109
@@ -110,20 +111,20 @@ acpi_load_tables (void)
110 111
111 status = acpi_tb_get_required_tables (); 112 status = acpi_tb_get_required_tables ();
112 if (ACPI_FAILURE (status)) { 113 if (ACPI_FAILURE (status)) {
113 ACPI_REPORT_ERROR (("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", 114 ACPI_REPORT_ERROR ((
114 acpi_format_exception (status))); 115 "acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n",
116 acpi_format_exception (status)));
115 goto error_exit; 117 goto error_exit;
116 } 118 }
117 119
118 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); 120 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
119 121
120
121 /* Load the namespace from the tables */ 122 /* Load the namespace from the tables */
122 123
123 status = acpi_ns_load_namespace (); 124 status = acpi_ns_load_namespace ();
124 if (ACPI_FAILURE (status)) { 125 if (ACPI_FAILURE (status)) {
125 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n", 126 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n",
126 acpi_format_exception (status))); 127 acpi_format_exception (status)));
127 goto error_exit; 128 goto error_exit;
128 } 129 }
129 130
@@ -139,7 +140,6 @@ error_exit:
139 140
140 141
141#ifdef ACPI_FUTURE_USAGE 142#ifdef ACPI_FUTURE_USAGE
142
143/******************************************************************************* 143/*******************************************************************************
144 * 144 *
145 * FUNCTION: acpi_load_table 145 * FUNCTION: acpi_load_table
@@ -250,7 +250,6 @@ acpi_unload_table (
250 return_ACPI_STATUS (AE_BAD_PARAMETER); 250 return_ACPI_STATUS (AE_BAD_PARAMETER);
251 } 251 }
252 252
253
254 /* Find all tables of the requested type */ 253 /* Find all tables of the requested type */
255 254
256 table_desc = acpi_gbl_table_lists[table_type].next; 255 table_desc = acpi_gbl_table_lists[table_type].next;
@@ -321,7 +320,6 @@ acpi_get_table_header (
321 return_ACPI_STATUS (AE_BAD_PARAMETER); 320 return_ACPI_STATUS (AE_BAD_PARAMETER);
322 } 321 }
323 322
324
325 /* Get a pointer to the entire table */ 323 /* Get a pointer to the entire table */
326 324
327 status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); 325 status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr);
@@ -329,23 +327,20 @@ acpi_get_table_header (
329 return_ACPI_STATUS (status); 327 return_ACPI_STATUS (status);
330 } 328 }
331 329
332 /* 330 /* The function will return a NULL pointer if the table is not loaded */
333 * The function will return a NULL pointer if the table is not loaded 331
334 */
335 if (tbl_ptr == NULL) { 332 if (tbl_ptr == NULL) {
336 return_ACPI_STATUS (AE_NOT_EXIST); 333 return_ACPI_STATUS (AE_NOT_EXIST);
337 } 334 }
338 335
339 /* 336 /* Copy the header to the caller's buffer */
340 * Copy the header to the caller's buffer 337
341 */
342 ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr, 338 ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr,
343 sizeof (struct acpi_table_header)); 339 sizeof (struct acpi_table_header));
344 340
345 return_ACPI_STATUS (status); 341 return_ACPI_STATUS (status);
346} 342}
347 343
348
349#endif /* ACPI_FUTURE_USAGE */ 344#endif /* ACPI_FUTURE_USAGE */
350 345
351/******************************************************************************* 346/*******************************************************************************
@@ -404,7 +399,6 @@ acpi_get_table (
404 return_ACPI_STATUS (AE_BAD_PARAMETER); 399 return_ACPI_STATUS (AE_BAD_PARAMETER);
405 } 400 }
406 401
407
408 /* Get a pointer to the entire table */ 402 /* Get a pointer to the entire table */
409 403
410 status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); 404 status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr);
@@ -423,9 +417,8 @@ acpi_get_table (
423 /* Get the table length */ 417 /* Get the table length */
424 418
425 if (table_type == ACPI_TABLE_RSDP) { 419 if (table_type == ACPI_TABLE_RSDP) {
426 /* 420 /* RSD PTR is the only "table" without a header */
427 * RSD PTR is the only "table" without a header 421
428 */
429 table_length = sizeof (struct rsdp_descriptor); 422 table_length = sizeof (struct rsdp_descriptor);
430 } 423 }
431 else { 424 else {
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index 6e8072ebbac..dc3c3f6a9f6 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -50,6 +50,18 @@
50#define _COMPONENT ACPI_TABLES 50#define _COMPONENT ACPI_TABLES
51 ACPI_MODULE_NAME ("tbxfroot") 51 ACPI_MODULE_NAME ("tbxfroot")
52 52
53/* Local prototypes */
54
55static acpi_status
56acpi_tb_find_rsdp (
57 struct acpi_table_desc *table_info,
58 u32 flags);
59
60static u8 *
61acpi_tb_scan_memory_for_rsdp (
62 u8 *start_address,
63 u32 length);
64
53 65
54/******************************************************************************* 66/*******************************************************************************
55 * 67 *
@@ -57,7 +69,8 @@
57 * 69 *
58 * PARAMETERS: Signature - String with ACPI table signature 70 * PARAMETERS: Signature - String with ACPI table signature
59 * oem_id - String with the table OEM ID 71 * oem_id - String with the table OEM ID
60 * oem_table_id - String with the OEM Table ID. 72 * oem_table_id - String with the OEM Table ID
73 * table_ptr - Where the table pointer is returned
61 * 74 *
62 * RETURN: Status 75 * RETURN: Status
63 * 76 *
@@ -99,14 +112,13 @@ acpi_tb_find_table (
99 if (!acpi_gbl_DSDT) { 112 if (!acpi_gbl_DSDT) {
100 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 113 return_ACPI_STATUS (AE_NO_ACPI_TABLES);
101 } 114 }
102
103 table = acpi_gbl_DSDT; 115 table = acpi_gbl_DSDT;
104 } 116 }
105 else { 117 else {
106 /* Find the table */ 118 /* Find the table */
107 119
108 status = acpi_get_firmware_table (signature, 1, 120 status = acpi_get_firmware_table (signature, 1,
109 ACPI_LOGICAL_ADDRESSING, &table); 121 ACPI_LOGICAL_ADDRESSING, &table);
110 if (ACPI_FAILURE (status)) { 122 if (ACPI_FAILURE (status)) {
111 return_ACPI_STATUS (status); 123 return_ACPI_STATUS (status);
112 } 124 }
@@ -114,14 +126,19 @@ acpi_tb_find_table (
114 126
115 /* Check oem_id and oem_table_id */ 127 /* Check oem_id and oem_table_id */
116 128
117 if ((oem_id[0] && ACPI_STRNCMP ( 129 if ((oem_id[0] && ACPI_STRNCMP (
118 oem_id, table->oem_id, sizeof (table->oem_id))) || 130 oem_id, table->oem_id,
131 sizeof (table->oem_id))) ||
132
119 (oem_table_id[0] && ACPI_STRNCMP ( 133 (oem_table_id[0] && ACPI_STRNCMP (
120 oem_table_id, table->oem_table_id, sizeof (table->oem_table_id)))) { 134 oem_table_id, table->oem_table_id,
135 sizeof (table->oem_table_id)))) {
121 return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); 136 return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
122 } 137 }
123 138
124 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", table->signature)); 139 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
140 table->signature));
141
125 *table_ptr = table; 142 *table_ptr = table;
126 return_ACPI_STATUS (AE_OK); 143 return_ACPI_STATUS (AE_OK);
127} 144}
@@ -191,8 +208,8 @@ acpi_get_firmware_table (
191 /* Map and validate the RSDP */ 208 /* Map and validate the RSDP */
192 209
193 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { 210 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
194 status = acpi_os_map_memory (address.pointer.physical, sizeof (struct rsdp_descriptor), 211 status = acpi_os_map_memory (address.pointer.physical,
195 (void *) &acpi_gbl_RSDP); 212 sizeof (struct rsdp_descriptor), (void *) &acpi_gbl_RSDP);
196 if (ACPI_FAILURE (status)) { 213 if (ACPI_FAILURE (status)) {
197 return_ACPI_STATUS (status); 214 return_ACPI_STATUS (status);
198 } 215 }
@@ -203,7 +220,8 @@ acpi_get_firmware_table (
203 220
204 /* The signature and checksum must both be correct */ 221 /* The signature and checksum must both be correct */
205 222
206 if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { 223 if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG,
224 sizeof (RSDP_SIG)-1) != 0) {
207 /* Nope, BAD Signature */ 225 /* Nope, BAD Signature */
208 226
209 return_ACPI_STATUS (AE_BAD_SIGNATURE); 227 return_ACPI_STATUS (AE_BAD_SIGNATURE);
@@ -313,7 +331,8 @@ acpi_get_firmware_table (
313 331
314 332
315cleanup: 333cleanup:
316 acpi_os_unmap_memory (rsdt_info->pointer, (acpi_size) rsdt_info->pointer->length); 334 acpi_os_unmap_memory (rsdt_info->pointer,
335 (acpi_size) rsdt_info->pointer->length);
317 ACPI_MEM_FREE (rsdt_info); 336 ACPI_MEM_FREE (rsdt_info);
318 337
319 if (header) { 338 if (header) {
@@ -335,8 +354,8 @@ EXPORT_SYMBOL(acpi_get_firmware_table);
335 * 354 *
336 * FUNCTION: acpi_find_root_pointer 355 * FUNCTION: acpi_find_root_pointer
337 * 356 *
338 * PARAMETERS: **rsdp_address - Where to place the RSDP address 357 * PARAMETERS: Flags - Logical/Physical addressing
339 * Flags - Logical/Physical addressing 358 * rsdp_address - Where to place the RSDP address
340 * 359 *
341 * RETURN: Status, Physical address of the RSDP 360 * RETURN: Status, Physical address of the RSDP
342 * 361 *
@@ -363,6 +382,7 @@ acpi_find_root_pointer (
363 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 382 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
364 "RSDP structure not found, %s Flags=%X\n", 383 "RSDP structure not found, %s Flags=%X\n",
365 acpi_format_exception (status), flags)); 384 acpi_format_exception (status), flags));
385
366 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 386 return_ACPI_STATUS (AE_NO_ACPI_TABLES);
367 } 387 }
368 388
@@ -385,7 +405,7 @@ acpi_find_root_pointer (
385 * 405 *
386 ******************************************************************************/ 406 ******************************************************************************/
387 407
388u8 * 408static u8 *
389acpi_tb_scan_memory_for_rsdp ( 409acpi_tb_scan_memory_for_rsdp (
390 u8 *start_address, 410 u8 *start_address,
391 u32 length) 411 u32 length)
@@ -406,7 +426,8 @@ acpi_tb_scan_memory_for_rsdp (
406 mem_rover += ACPI_RSDP_SCAN_STEP) { 426 mem_rover += ACPI_RSDP_SCAN_STEP) {
407 /* The signature and checksum must both be correct */ 427 /* The signature and checksum must both be correct */
408 428
409 if (ACPI_STRNCMP ((char *) mem_rover, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { 429 if (ACPI_STRNCMP ((char *) mem_rover,
430 RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) {
410 /* No signature match, keep looking */ 431 /* No signature match, keep looking */
411 432
412 continue; 433 continue;
@@ -450,7 +471,7 @@ acpi_tb_scan_memory_for_rsdp (
450 * 471 *
451 * FUNCTION: acpi_tb_find_rsdp 472 * FUNCTION: acpi_tb_find_rsdp
452 * 473 *
453 * PARAMETERS: *table_info - Where the table info is returned 474 * PARAMETERS: table_info - Where the table info is returned
454 * Flags - Current memory mode (logical vs. 475 * Flags - Current memory mode (logical vs.
455 * physical addressing) 476 * physical addressing)
456 * 477 *
@@ -468,7 +489,7 @@ acpi_tb_scan_memory_for_rsdp (
468 * 489 *
469 ******************************************************************************/ 490 ******************************************************************************/
470 491
471acpi_status 492static acpi_status
472acpi_tb_find_rsdp ( 493acpi_tb_find_rsdp (
473 struct acpi_table_desc *table_info, 494 struct acpi_table_desc *table_info,
474 u32 flags) 495 u32 flags)
@@ -483,43 +504,49 @@ acpi_tb_find_rsdp (
483 504
484 505
485 /* 506 /*
486 * Scan supports either 1) Logical addressing or 2) Physical addressing 507 * Scan supports either logical addressing or physical addressing
487 */ 508 */
488 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { 509 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
489 /* 510 /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
490 * 1a) Get the location of the EBDA 511
491 */ 512 status = acpi_os_map_memory (
492 status = acpi_os_map_memory ((acpi_physical_address) ACPI_EBDA_PTR_LOCATION, 513 (acpi_physical_address) ACPI_EBDA_PTR_LOCATION,
493 ACPI_EBDA_PTR_LENGTH, 514 ACPI_EBDA_PTR_LENGTH, (void *) &table_ptr);
494 (void *) &table_ptr);
495 if (ACPI_FAILURE (status)) { 515 if (ACPI_FAILURE (status)) {
496 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 516 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
497 "Could not map memory at %8.8X for length %X\n", 517 "Could not map memory at %8.8X for length %X\n",
498 ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); 518 ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
519
499 return_ACPI_STATUS (status); 520 return_ACPI_STATUS (status);
500 } 521 }
501 522
502 ACPI_MOVE_16_TO_32 (&physical_address, table_ptr); 523 ACPI_MOVE_16_TO_32 (&physical_address, table_ptr);
503 physical_address <<= 4; /* Convert segment to physical address */ 524
525 /* Convert segment part to physical address */
526
527 physical_address <<= 4;
504 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH); 528 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH);
505 529
506 /* EBDA present? */ 530 /* EBDA present? */
507 531
508 if (physical_address > 0x400) { 532 if (physical_address > 0x400) {
509 /* 533 /*
510 * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of 1_k length) 534 * 1b) Search EBDA paragraphs (EBDa is required to be a
535 * minimum of 1_k length)
511 */ 536 */
512 status = acpi_os_map_memory ((acpi_physical_address) physical_address, 537 status = acpi_os_map_memory (
513 ACPI_EBDA_WINDOW_SIZE, 538 (acpi_physical_address) physical_address,
514 (void *) &table_ptr); 539 ACPI_EBDA_WINDOW_SIZE, (void *) &table_ptr);
515 if (ACPI_FAILURE (status)) { 540 if (ACPI_FAILURE (status)) {
516 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 541 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
517 "Could not map memory at %8.8X for length %X\n", 542 "Could not map memory at %8.8X for length %X\n",
518 physical_address, ACPI_EBDA_WINDOW_SIZE)); 543 physical_address, ACPI_EBDA_WINDOW_SIZE));
544
519 return_ACPI_STATUS (status); 545 return_ACPI_STATUS (status);
520 } 546 }
521 547
522 mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_EBDA_WINDOW_SIZE); 548 mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr,
549 ACPI_EBDA_WINDOW_SIZE);
523 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); 550 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE);
524 551
525 if (mem_rover) { 552 if (mem_rover) {
@@ -527,7 +554,8 @@ acpi_tb_find_rsdp (
527 554
528 physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); 555 physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr);
529 556
530 table_info->physical_address = (acpi_physical_address) physical_address; 557 table_info->physical_address =
558 (acpi_physical_address) physical_address;
531 return_ACPI_STATUS (AE_OK); 559 return_ACPI_STATUS (AE_OK);
532 } 560 }
533 } 561 }
@@ -535,13 +563,15 @@ acpi_tb_find_rsdp (
535 /* 563 /*
536 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh 564 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
537 */ 565 */
538 status = acpi_os_map_memory ((acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, 566 status = acpi_os_map_memory (
539 ACPI_HI_RSDP_WINDOW_SIZE, 567 (acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE,
540 (void *) &table_ptr); 568 ACPI_HI_RSDP_WINDOW_SIZE, (void *) &table_ptr);
569
541 if (ACPI_FAILURE (status)) { 570 if (ACPI_FAILURE (status)) {
542 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 571 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
543 "Could not map memory at %8.8X for length %X\n", 572 "Could not map memory at %8.8X for length %X\n",
544 ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); 573 ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
574
545 return_ACPI_STATUS (status); 575 return_ACPI_STATUS (status);
546 } 576 }
547 577
@@ -551,9 +581,11 @@ acpi_tb_find_rsdp (
551 if (mem_rover) { 581 if (mem_rover) {
552 /* Found it, return the physical address */ 582 /* Found it, return the physical address */
553 583
554 physical_address = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); 584 physical_address =
585 ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr);
555 586
556 table_info->physical_address = (acpi_physical_address) physical_address; 587 table_info->physical_address =
588 (acpi_physical_address) physical_address;
557 return_ACPI_STATUS (AE_OK); 589 return_ACPI_STATUS (AE_OK);
558 } 590 }
559 } 591 }
@@ -562,9 +594,8 @@ acpi_tb_find_rsdp (
562 * Physical addressing 594 * Physical addressing
563 */ 595 */
564 else { 596 else {
565 /* 597 /* 1a) Get the location of the EBDA */
566 * 1a) Get the location of the EBDA 598
567 */
568 ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION); 599 ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION);
569 physical_address <<= 4; /* Convert segment to physical address */ 600 physical_address <<= 4; /* Convert segment to physical address */
570 601
@@ -572,9 +603,11 @@ acpi_tb_find_rsdp (
572 603
573 if (physical_address > 0x400) { 604 if (physical_address > 0x400) {
574 /* 605 /*
575 * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of 1_k length) 606 * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of
607 * 1_k length)
576 */ 608 */
577 mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (physical_address), 609 mem_rover = acpi_tb_scan_memory_for_rsdp (
610 ACPI_PHYSADDR_TO_PTR (physical_address),
578 ACPI_EBDA_WINDOW_SIZE); 611 ACPI_EBDA_WINDOW_SIZE);
579 if (mem_rover) { 612 if (mem_rover) {
580 /* Found it, return the physical address */ 613 /* Found it, return the physical address */
@@ -584,10 +617,10 @@ acpi_tb_find_rsdp (
584 } 617 }
585 } 618 }
586 619
587 /* 620 /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */
588 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh 621
589 */ 622 mem_rover = acpi_tb_scan_memory_for_rsdp (
590 mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), 623 ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
591 ACPI_HI_RSDP_WINDOW_SIZE); 624 ACPI_HI_RSDP_WINDOW_SIZE);
592 if (mem_rover) { 625 if (mem_rover) {
593 /* Found it, return the physical address */ 626 /* Found it, return the physical address */