aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables/tbxfroot.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/tables/tbxfroot.c')
-rw-r--r--drivers/acpi/tables/tbxfroot.c123
1 files changed, 78 insertions, 45 deletions
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index 6e8072ebbac6..dc3c3f6a9f62 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 */