Deleted Added
sdiff udiff text old ( 126372 ) new ( 131440 )
full compact
1/******************************************************************************
2 *
3 * Module Name: tbxfroot - Find the root ACPI table (RSDT)
4 * $Revision: 73 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.

--- 468 unchanged lines hidden (view full) ---

481/*******************************************************************************
482 *
483 * FUNCTION: AcpiTbFindRsdp
484 *
485 * PARAMETERS: *TableInfo - Where the table info is returned
486 * Flags - Current memory mode (logical vs.
487 * physical addressing)
488 *
489 * RETURN: Status, RSDP physical address
490 *
491 * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
492 * pointer structure. If it is found, set *RSDP to point to it.
493 *
494 * NOTE1: The RSDP must be either in the first 1K of the Extended
495 * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
496 * Only a 32-bit physical address is necessary.
497 *
498 * NOTE2: This function is always available, regardless of the
499 * initialization state of the rest of ACPI.
500 *
501 ******************************************************************************/
502
503ACPI_STATUS
504AcpiTbFindRsdp (
505 ACPI_TABLE_DESC *TableInfo,
506 UINT32 Flags)
507{
508 UINT8 *TablePtr;
509 UINT8 *MemRover;
510 UINT32 PhysicalAddress;
511 ACPI_STATUS Status;
512
513
514 ACPI_FUNCTION_TRACE ("TbFindRsdp");
515
516
517 /*
518 * Scan supports either 1) Logical addressing or 2) Physical addressing
519 */
520 if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
521 {
522 /*
523 * 1a) Get the location of the EBDA
524 */
525 Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION,
526 ACPI_EBDA_PTR_LENGTH,
527 (void *) &TablePtr);
528 if (ACPI_FAILURE (Status))
529 {
530 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n",
531 ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
532 return_ACPI_STATUS (Status);
533 }
534
535 ACPI_MOVE_16_TO_32 (&PhysicalAddress, TablePtr);
536 PhysicalAddress <<= 4; /* Convert segment to physical address */
537 AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_PTR_LENGTH);
538
539 /* EBDA present? */
540
541 if (PhysicalAddress > 0x400)
542 {
543 /*
544 * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of 1K length)
545 */
546 Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) PhysicalAddress,
547 ACPI_EBDA_WINDOW_SIZE,
548 (void *) &TablePtr);
549 if (ACPI_FAILURE (Status))
550 {
551 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n",
552 PhysicalAddress, ACPI_EBDA_WINDOW_SIZE));
553 return_ACPI_STATUS (Status);
554 }
555
556 MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_EBDA_WINDOW_SIZE);
557 AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE);
558
559 if (MemRover)
560 {
561 /* Found it, return the physical address */
562
563 PhysicalAddress += ACPI_PTR_DIFF (MemRover, TablePtr);
564
565 TableInfo->PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress;
566 return_ACPI_STATUS (AE_OK);
567 }
568 }
569
570 /*
571 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
572 */
573 Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE,
574 ACPI_HI_RSDP_WINDOW_SIZE,
575 (void *) &TablePtr);
576 if (ACPI_FAILURE (Status))
577 {
578 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n",
579 ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
580 return_ACPI_STATUS (Status);
581 }
582
583 MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
584 AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
585
586 if (MemRover)
587 {
588 /* Found it, return the physical address */
589
590 PhysicalAddress = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr);
591
592 TableInfo->PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress;
593 return_ACPI_STATUS (AE_OK);
594 }
595 }
596
597 /*
598 * Physical addressing
599 */
600 else
601 {
602 /*
603 * 1a) Get the location of the EBDA
604 */
605 ACPI_MOVE_16_TO_32 (&PhysicalAddress, ACPI_EBDA_PTR_LOCATION);
606 PhysicalAddress <<= 4; /* Convert segment to physical address */
607
608 /* EBDA present? */
609
610 if (PhysicalAddress > 0x400)
611 {
612 /*
613 * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of 1K length)
614 */
615 MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (PhysicalAddress),
616 ACPI_EBDA_WINDOW_SIZE);
617 if (MemRover)
618 {
619 /* Found it, return the physical address */
620
621 TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
622 return_ACPI_STATUS (AE_OK);
623 }
624 }
625
626 /*
627 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
628 */
629 MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
630 ACPI_HI_RSDP_WINDOW_SIZE);
631 if (MemRover)
632 {
633 /* Found it, return the physical address */
634
635 TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
636 return_ACPI_STATUS (AE_OK);
637 }
638 }
639
640 /* RSDP signature was not found */
641
642 return_ACPI_STATUS (AE_NOT_FOUND);
643}
644
645#endif
646