summaryrefslogtreecommitdiff
path: root/source/components/tables/tbxfroot.c
diff options
context:
space:
mode:
authoraystarik <aystarik>2005-06-29 18:59:37 +0000
committeraystarik <aystarik>2005-06-29 18:59:37 +0000
commit66bcdd870f65056c7864062d0de87457d936ea9e (patch)
tree34cb6d4be76c6b3c3042f7501942132dfd12c2ec /source/components/tables/tbxfroot.c
parentdf689ed7e1ed37ab0710274b84e90637ca686d6b (diff)
downloadacpica-66bcdd870f65056c7864062d0de87457d936ea9e.tar.gz
Map RSDP before accessing
date 2001.09.19.21.43.00; author rmoore1; state Exp;
Diffstat (limited to 'source/components/tables/tbxfroot.c')
-rw-r--r--source/components/tables/tbxfroot.c92
1 files changed, 66 insertions, 26 deletions
diff --git a/source/components/tables/tbxfroot.c b/source/components/tables/tbxfroot.c
index 267f01f2e..f3d232d9a 100644
--- a/source/components/tables/tbxfroot.c
+++ b/source/components/tables/tbxfroot.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
- * $Revision: 1.45 $
+ * $Revision: 1.50 $
*
*****************************************************************************/
@@ -132,6 +132,7 @@
* FUNCTION: AcpiFindRootPointer
*
* PARAMETERS: **RsdpPhysicalAddress - Where to place the RSDP address
+ * Flags - Logical/Physical addressing
*
* RETURN: Status, Physical address of the RSDP
*
@@ -141,6 +142,7 @@
ACPI_STATUS
AcpiFindRootPointer (
+ UINT32 Flags,
ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
{
ACPI_TABLE_DESC TableInfo;
@@ -152,10 +154,10 @@ AcpiFindRootPointer (
/* Get the RSDP */
- Status = AcpiTbFindRsdp (&TableInfo, ACPI_LOGICAL_ADDRESSING);
+ Status = AcpiTbFindRsdp (&TableInfo, Flags);
if (ACPI_FAILURE (Status))
{
- DEBUG_PRINTP (ACPI_ERROR, ("RSDP structure not found\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
@@ -189,6 +191,7 @@ AcpiTbScanMemoryForRsdp (
FUNCTION_TRACE ("TbScanMemoryForRsdp");
+
/* Search from given start addr for the requested length */
for (Offset = 0, MemRover = StartAddress;
@@ -204,14 +207,15 @@ AcpiTbScanMemoryForRsdp (
{
/* If so, we have found the RSDP */
- DEBUG_PRINTP (ACPI_INFO,
- ("RSDP located at physical address %p\n",MemRover));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "RSDP located at physical address %p\n",MemRover));
return_PTR (MemRover);
}
}
/* Searched entire block, no RSDP was found */
- DEBUG_PRINTP (ACPI_INFO,("Searched entire block, no RSDP was found.\n"));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,"Searched entire block, no RSDP was found.\n"));
return_PTR (NULL);
}
@@ -250,7 +254,7 @@ AcpiTbFindRsdp (
FUNCTION_TRACE ("TbFindRsdp");
- /*
+ /*
* Scan supports either 1) Logical addressing or 2) Physical addressing
*/
if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
@@ -279,7 +283,7 @@ AcpiTbFindRsdp (
return_ACPI_STATUS (AE_OK);
}
-
+
/*
* 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
*/
@@ -315,7 +319,7 @@ AcpiTbFindRsdp (
/*
* 1) Search EBDA (low memory) paragraphs
*/
- MemRover = AcpiTbScanMemoryForRsdp ((UINT8 *) LO_RSDP_WINDOW_BASE,
+ MemRover = AcpiTbScanMemoryForRsdp ((UINT8 *) LO_RSDP_WINDOW_BASE,
LO_RSDP_WINDOW_SIZE);
if (MemRover)
{
@@ -328,7 +332,7 @@ AcpiTbFindRsdp (
/*
* 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
*/
- MemRover = AcpiTbScanMemoryForRsdp ((UINT8 *) HI_RSDP_WINDOW_BASE,
+ MemRover = AcpiTbScanMemoryForRsdp ((UINT8 *) HI_RSDP_WINDOW_BASE,
HI_RSDP_WINDOW_SIZE);
if (MemRover)
{
@@ -376,11 +380,10 @@ AcpiGetFirmwareTable (
ACPI_TABLE_HEADER **TablePointer)
{
ACPI_PHYSICAL_ADDRESS PhysicalAddress;
- ACPI_TABLE_DESC TableInfo;
- ACPI_TABLE_HEADER *RsdtPtr;
+ ACPI_TABLE_HEADER *RsdtPtr = NULL;
ACPI_TABLE_HEADER *TablePtr;
ACPI_STATUS Status;
- UINT32 RsdtSize;
+ UINT32 RsdtSize = 0;
UINT32 TableSize;
UINT32 TableCount;
UINT32 i;
@@ -390,12 +393,11 @@ AcpiGetFirmwareTable (
FUNCTION_TRACE ("AcpiGetFirmwareTable");
- /*
+ /*
* Ensure that at least the table manager is initialized. We don't
* require that the entire ACPI subsystem is up for this interface
*/
-
/*
* If we have a buffer, we must have a length too
*/
@@ -406,19 +408,56 @@ AcpiGetFirmwareTable (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Get the RSDP by scanning low memory */
-
- Status = AcpiTbFindRsdp (&TableInfo, Flags);
- if (ACPI_FAILURE (Status))
+ if (!AcpiGbl_RSDP)
{
- DEBUG_PRINTP (ACPI_INFO, ("RSDP structure not found\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ /* Get the RSDP */
+
+ Status = AcpiOsGetRootPointer (Flags, &PhysicalAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ /* Map and validate the RSDP */
+
+ if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
+ {
+ Status = AcpiOsMapMemory (PhysicalAddress, sizeof (RSDP_DESCRIPTOR),
+ (void **) &AcpiGbl_RSDP);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status)
+ }
+ }
+ else
+ {
+ AcpiGbl_RSDP = (void *) (NATIVE_UINT) PhysicalAddress;
+ }
+
+ /*
+ * The signature and checksum must both be correct
+ */
+ if (STRNCMP ((NATIVE_CHAR *) AcpiGbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
+ {
+ /* Nope, BAD Signature */
+
+ Status = AE_BAD_SIGNATURE;
+ goto Cleanup;
+ }
+
+ if (AcpiTbChecksum (AcpiGbl_RSDP, RSDP_CHECKSUM_LENGTH) != 0)
+ {
+ /* Nope, BAD Checksum */
+
+ Status = AE_BAD_CHECKSUM;
+ goto Cleanup;
+ }
}
- AcpiGbl_RSDP = (RSDP_DESCRIPTOR *) (ACPI_TBLPTR) TableInfo.PhysicalAddress;
- DEBUG_PRINTP (ACPI_INFO,
- ("RSDP located at %p, RSDT physical=%8.8lX%8.8lX \n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "RSDP located at %p, RSDT physical=%8.8lX%8.8lX \n",
AcpiGbl_RSDP, HIDWORD(AcpiGbl_RSDP->RsdtPhysicalAddress),
LODWORD(AcpiGbl_RSDP->RsdtPhysicalAddress)));
@@ -445,7 +484,7 @@ AcpiGetFirmwareTable (
/*
- * Search the RSDT/XSDT for the correct instance of the
+ * Search the RSDT/XSDT for the correct instance of the
* requested table
*/
for (i = 0, j = 0; i < TableCount; i++)
@@ -488,7 +527,8 @@ AcpiGetFirmwareTable (
/* Delete table mapping if using virtual addressing */
- if (TableSize)
+ if ((TableSize) &&
+ ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING))
{
AcpiOsUnmapMemory (TablePtr, TableSize);
}