mirror of
https://github.com/acpica/acpica/
synced 2025-02-19 15:04:30 +03:00
Update for static functions, cleanup
date 2005.03.22.00.10.00; author rmoore1; state Exp;
This commit is contained in:
parent
24357e7111
commit
f90fb160c5
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: tbinstal - ACPI table installation and removal
|
||||
* $Revision: 1.74 $
|
||||
* $Revision: 1.76 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -139,7 +139,7 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
static ACPI_STATUS
|
||||
AcpiTbMatchSignature (
|
||||
char *Signature,
|
||||
ACPI_TABLE_DESC *TableInfo,
|
||||
@ -285,7 +285,8 @@ AcpiTbRecognizeTable (
|
||||
* This can be any one of many valid ACPI tables, it just isn't one of
|
||||
* the tables that is consumed by the core subsystem
|
||||
*/
|
||||
Status = AcpiTbMatchSignature (TableHeader->Signature, TableInfo, SearchType);
|
||||
Status = AcpiTbMatchSignature (TableHeader->Signature,
|
||||
TableInfo, SearchType);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
@ -442,7 +443,8 @@ AcpiTbInitTableDescriptor (
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiTbDeleteAllTables (void)
|
||||
AcpiTbDeleteAllTables (
|
||||
void)
|
||||
{
|
||||
ACPI_TABLE_TYPE Type;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: tbutils - Table manipulation utilities
|
||||
* $Revision: 1.60 $
|
||||
* $Revision: 1.63 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -124,51 +124,6 @@
|
||||
ACPI_MODULE_NAME ("tbutils")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbHandleToObject
|
||||
*
|
||||
* PARAMETERS: TableId - Id for which the function is searching
|
||||
* TableDesc - Pointer to return the matching table
|
||||
* descriptor.
|
||||
*
|
||||
* RETURN: Search the tables to find one with a matching TableId and
|
||||
* return a pointer to that table descriptor.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbHandleToObject (
|
||||
UINT16 TableId,
|
||||
ACPI_TABLE_DESC **ReturnTableDesc)
|
||||
{
|
||||
UINT32 i;
|
||||
ACPI_TABLE_DESC *TableDesc;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("TbHandleToObject");
|
||||
|
||||
|
||||
for (i = 0; i < ACPI_TABLE_MAX; i++)
|
||||
{
|
||||
TableDesc = AcpiGbl_TableLists[i].Next;
|
||||
while (TableDesc)
|
||||
{
|
||||
if (TableDesc->TableId == TableId)
|
||||
{
|
||||
*ReturnTableDesc = TableDesc;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
TableDesc = TableDesc->Next;
|
||||
}
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "TableId=%X does not exist\n", TableId));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbValidateTableHeader
|
||||
@ -320,3 +275,50 @@ AcpiTbChecksum (
|
||||
}
|
||||
|
||||
|
||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbHandleToObject
|
||||
*
|
||||
* PARAMETERS: TableId - Id for which the function is searching
|
||||
* TableDesc - Pointer to return the matching table
|
||||
* descriptor.
|
||||
*
|
||||
* RETURN: Search the tables to find one with a matching TableId and
|
||||
* return a pointer to that table descriptor.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbHandleToObject (
|
||||
UINT16 TableId,
|
||||
ACPI_TABLE_DESC **ReturnTableDesc)
|
||||
{
|
||||
UINT32 i;
|
||||
ACPI_TABLE_DESC *TableDesc;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("TbHandleToObject");
|
||||
|
||||
|
||||
for (i = 0; i < ACPI_TABLE_MAX; i++)
|
||||
{
|
||||
TableDesc = AcpiGbl_TableLists[i].Next;
|
||||
while (TableDesc)
|
||||
{
|
||||
if (TableDesc->TableId == TableId)
|
||||
{
|
||||
*ReturnTableDesc = TableDesc;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
TableDesc = TableDesc->Next;
|
||||
}
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "TableId=%X does not exist\n", TableId));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Module Name: tbxface - Public interfaces to the ACPI subsystem
|
||||
* ACPI table oriented interfaces
|
||||
* $Revision: 1.62 $
|
||||
* $Revision: 1.66 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -140,7 +140,8 @@
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiLoadTables (void)
|
||||
AcpiLoadTables (
|
||||
void)
|
||||
{
|
||||
ACPI_POINTER RsdpAddress;
|
||||
ACPI_STATUS Status;
|
||||
@ -336,7 +337,7 @@ AcpiUnloadTable (
|
||||
/* Find all tables of the requested type */
|
||||
|
||||
TableDesc = AcpiGbl_TableLists[TableType].Next;
|
||||
while (TableDesc);
|
||||
while (TableDesc)
|
||||
{
|
||||
/*
|
||||
* Delete all namespace entries owned by this table. Note that these
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
|
||||
* $Revision: 1.67 $
|
||||
* $Revision: 1.83 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -162,23 +162,47 @@ AcpiTbFindTable (
|
||||
return_ACPI_STATUS (AE_AML_STRING_LIMIT);
|
||||
}
|
||||
|
||||
/* Find the table */
|
||||
|
||||
Status = AcpiGetFirmwareTable (Signature, 1,
|
||||
ACPI_LOGICAL_ADDRESSING, &Table);
|
||||
if (ACPI_FAILURE (Status))
|
||||
if (!ACPI_STRNCMP (Signature, DSDT_SIG, ACPI_NAME_SIZE))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
/*
|
||||
* The DSDT pointer is contained in the FADT, not the RSDT.
|
||||
* This code should suffice, because the only code that would perform
|
||||
* a "find" on the DSDT is the DataTableRegion() AML opcode -- in
|
||||
* which case, the DSDT is guaranteed to be already loaded.
|
||||
* If this becomes insufficient, the FADT will have to be found first.
|
||||
*/
|
||||
if (!AcpiGbl_DSDT)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
Table = AcpiGbl_DSDT;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Find the table */
|
||||
|
||||
Status = AcpiGetFirmwareTable (Signature, 1,
|
||||
ACPI_LOGICAL_ADDRESSING, &Table);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check OemId and OemTableId */
|
||||
|
||||
if ((OemId[0] && ACPI_STRCMP (OemId, Table->OemId)) ||
|
||||
(OemTableId[0] && ACPI_STRCMP (OemTableId, Table->OemTableId)))
|
||||
if ((OemId[0] && ACPI_STRNCMP (
|
||||
OemId, Table->OemId, sizeof (Table->OemId))) ||
|
||||
(OemTableId[0] && ACPI_STRNCMP (
|
||||
OemTableId, Table->OemTableId,
|
||||
sizeof (Table->OemTableId))))
|
||||
{
|
||||
return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
|
||||
Table->Signature));
|
||||
*TablePtr = Table;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
@ -192,17 +216,14 @@ AcpiTbFindTable (
|
||||
* Instance - the non zero instance of the table, allows
|
||||
* support for multiple tables of the same type
|
||||
* Flags - Physical/Virtual support
|
||||
* RetBuffer - pointer to a structure containing a buffer to
|
||||
* receive the table
|
||||
* TablePointer - Where a buffer containing the table is
|
||||
* returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: This function is called to get an ACPI table. The caller
|
||||
* supplies an OutBuffer large enough to contain the entire ACPI
|
||||
* table. Upon completion
|
||||
* the OutBuffer->Length field will indicate the number of bytes
|
||||
* copied into the OutBuffer->BufPtr buffer. This table will be
|
||||
* a complete table including the header.
|
||||
* DESCRIPTION: This function is called to get an ACPI table. A buffer is
|
||||
* allocated for the table and returned in TablePointer.
|
||||
* This table will be a complete table including the header.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -213,12 +234,11 @@ AcpiGetFirmwareTable (
|
||||
UINT32 Flags,
|
||||
ACPI_TABLE_HEADER **TablePointer)
|
||||
{
|
||||
ACPI_POINTER RsdpAddress;
|
||||
ACPI_POINTER Address;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_TABLE_HEADER Header;
|
||||
ACPI_TABLE_DESC TableInfo;
|
||||
ACPI_TABLE_DESC RsdtInfo;
|
||||
ACPI_POINTER Address;
|
||||
ACPI_TABLE_HEADER *Header = NULL;
|
||||
ACPI_TABLE_DESC *TableInfo = NULL;
|
||||
ACPI_TABLE_DESC *RsdtInfo;
|
||||
UINT32 TableCount;
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
@ -229,29 +249,26 @@ AcpiGetFirmwareTable (
|
||||
|
||||
/*
|
||||
* Ensure that at least the table manager is initialized. We don't
|
||||
* require that the entire ACPI subsystem is up for this interface
|
||||
* require that the entire ACPI subsystem is up for this interface.
|
||||
* If we have a buffer, we must have a length too
|
||||
*/
|
||||
|
||||
/*
|
||||
* If we have a buffer, we must have a length too
|
||||
*/
|
||||
if ((Instance == 0) ||
|
||||
(!Signature) ||
|
||||
if ((Instance == 0) ||
|
||||
(!Signature) ||
|
||||
(!TablePointer))
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
RsdtInfo.Pointer = NULL;
|
||||
/* Ensure that we have a RSDP */
|
||||
|
||||
if (!AcpiGbl_RSDP)
|
||||
{
|
||||
/* Get the RSDP */
|
||||
|
||||
Status = AcpiOsGetRootPointer (Flags, &RsdpAddress);
|
||||
Status = AcpiOsGetRootPointer (Flags, &Address);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n"));
|
||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
@ -259,8 +276,8 @@ AcpiGetFirmwareTable (
|
||||
|
||||
if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
|
||||
{
|
||||
Status = AcpiOsMapMemory (RsdpAddress.Pointer.Physical, sizeof (RSDP_DESCRIPTOR),
|
||||
(void **) &AcpiGbl_RSDP);
|
||||
Status = AcpiOsMapMemory (Address.Pointer.Physical,
|
||||
sizeof (RSDP_DESCRIPTOR), (void *) &AcpiGbl_RSDP);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
@ -268,13 +285,13 @@ AcpiGetFirmwareTable (
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiGbl_RSDP = RsdpAddress.Pointer.Logical;
|
||||
AcpiGbl_RSDP = Address.Pointer.Logical;
|
||||
}
|
||||
|
||||
/*
|
||||
* The signature and checksum must both be correct
|
||||
*/
|
||||
if (ACPI_STRNCMP ((char *) AcpiGbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
|
||||
/* The signature and checksum must both be correct */
|
||||
|
||||
if (ACPI_STRNCMP ((char *) AcpiGbl_RSDP, RSDP_SIG,
|
||||
sizeof (RSDP_SIG)-1) != 0)
|
||||
{
|
||||
/* Nope, BAD Signature */
|
||||
|
||||
@ -289,36 +306,57 @@ AcpiGetFirmwareTable (
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the RSDT and validate it */
|
||||
/* Get the RSDT address via the RSDP */
|
||||
|
||||
AcpiTbGetRsdtAddress (&Address);
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
|
||||
AcpiGbl_RSDP,
|
||||
ACPI_HIDWORD (Address.Pointer.Value),
|
||||
ACPI_LODWORD (Address.Pointer.Value)));
|
||||
ACPI_FORMAT_UINT64 (Address.Pointer.Value)));
|
||||
|
||||
/* Insert ProcessorMode flags */
|
||||
|
||||
Address.PointerType |= Flags;
|
||||
|
||||
Status = AcpiTbGetTable (&Address, &RsdtInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
/* Get and validate the RSDT */
|
||||
|
||||
RsdtInfo = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC));
|
||||
if (!RsdtInfo)
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
Status = AcpiTbValidateRsdt (RsdtInfo.Pointer);
|
||||
Status = AcpiTbGetTable (&Address, RsdtInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
Status = AcpiTbValidateRsdt (RsdtInfo->Pointer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Allocate a scratch table header and table descriptor */
|
||||
|
||||
Header = ACPI_MEM_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
|
||||
if (!Header)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
TableInfo = ACPI_MEM_ALLOCATE (sizeof (ACPI_TABLE_DESC));
|
||||
if (!TableInfo)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Get the number of table pointers within the RSDT */
|
||||
|
||||
TableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, RsdtInfo.Pointer);
|
||||
|
||||
TableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, RsdtInfo->Pointer);
|
||||
Address.PointerType = AcpiGbl_TableFlags | Flags;
|
||||
|
||||
/*
|
||||
@ -331,17 +369,18 @@ AcpiGetFirmwareTable (
|
||||
|
||||
if (AcpiGbl_RSDP->Revision < 2)
|
||||
{
|
||||
Address.Pointer.Value = ((RSDT_DESCRIPTOR *) RsdtInfo.Pointer)->TableOffsetEntry[i];
|
||||
Address.Pointer.Value = (ACPI_CAST_PTR (
|
||||
RSDT_DESCRIPTOR, RsdtInfo->Pointer))->TableOffsetEntry[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
Address.Pointer.Value = ACPI_GET_ADDRESS (
|
||||
((XSDT_DESCRIPTOR *) RsdtInfo.Pointer)->TableOffsetEntry[i]);
|
||||
Address.Pointer.Value = ACPI_GET_ADDRESS ((ACPI_CAST_PTR (
|
||||
XSDT_DESCRIPTOR, RsdtInfo->Pointer))->TableOffsetEntry[i]);
|
||||
}
|
||||
|
||||
/* Get the table header */
|
||||
|
||||
Status = AcpiTbGetTableHeader (&Address, &Header);
|
||||
Status = AcpiTbGetTableHeader (&Address, Header);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
@ -349,7 +388,7 @@ AcpiGetFirmwareTable (
|
||||
|
||||
/* Compare table signatures and table instance */
|
||||
|
||||
if (!ACPI_STRNCMP (Header.Signature, Signature, ACPI_NAME_SIZE))
|
||||
if (!ACPI_STRNCMP (Header->Signature, Signature, ACPI_NAME_SIZE))
|
||||
{
|
||||
/* An instance of the table was found */
|
||||
|
||||
@ -358,13 +397,13 @@ AcpiGetFirmwareTable (
|
||||
{
|
||||
/* Found the correct instance, get the entire table */
|
||||
|
||||
Status = AcpiTbGetTableBody (&Address, &Header, &TableInfo);
|
||||
Status = AcpiTbGetTableBody (&Address, Header, TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
*TablePointer = TableInfo.Pointer;
|
||||
*TablePointer = TableInfo->Pointer;
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
@ -376,7 +415,17 @@ AcpiGetFirmwareTable (
|
||||
|
||||
|
||||
Cleanup:
|
||||
AcpiOsUnmapMemory (RsdtInfo.Pointer, (ACPI_SIZE) RsdtInfo.Pointer->Length);
|
||||
AcpiOsUnmapMemory (RsdtInfo->Pointer, (ACPI_SIZE) RsdtInfo->Pointer->Length);
|
||||
ACPI_MEM_FREE (RsdtInfo);
|
||||
|
||||
if (Header)
|
||||
{
|
||||
ACPI_MEM_FREE (Header);
|
||||
}
|
||||
if (TableInfo)
|
||||
{
|
||||
ACPI_MEM_FREE (TableInfo);
|
||||
}
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
@ -415,7 +464,8 @@ AcpiFindRootPointer (
|
||||
Status = AcpiTbFindRsdp (&TableInfo, Flags);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found, %s Flags=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"RSDP structure not found, %s Flags=%X\n",
|
||||
AcpiFormatException (Status), Flags));
|
||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
||||
}
|
||||
@ -439,42 +489,68 @@ AcpiFindRootPointer (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT8 *
|
||||
static UINT8 *
|
||||
AcpiTbScanMemoryForRsdp (
|
||||
UINT8 *StartAddress,
|
||||
UINT32 Length)
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT8 *MemRover;
|
||||
UINT8 *EndAddress;
|
||||
UINT8 Checksum;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("TbScanMemoryForRsdp");
|
||||
|
||||
|
||||
/* Search from given start addr for the requested length */
|
||||
EndAddress = StartAddress + Length;
|
||||
|
||||
for (Offset = 0, MemRover = StartAddress;
|
||||
Offset < Length;
|
||||
Offset += ACPI_RSDP_SCAN_STEP, MemRover += ACPI_RSDP_SCAN_STEP)
|
||||
/* Search from given start address for the requested length */
|
||||
|
||||
for (MemRover = StartAddress; MemRover < EndAddress;
|
||||
MemRover += ACPI_RSDP_SCAN_STEP)
|
||||
{
|
||||
|
||||
/* The signature and checksum must both be correct */
|
||||
|
||||
if (ACPI_STRNCMP ((char *) MemRover,
|
||||
RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 &&
|
||||
AcpiTbChecksum (MemRover, ACPI_RSDP_CHECKSUM_LENGTH) == 0)
|
||||
if (ACPI_STRNCMP ((char *) MemRover, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
|
||||
{
|
||||
/* If so, we have found the RSDP */
|
||||
/* No signature match, keep looking */
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Signature matches, check the appropriate checksum */
|
||||
|
||||
if ((ACPI_CAST_PTR (RSDP_DESCRIPTOR, MemRover))->Revision < 2)
|
||||
{
|
||||
/* ACPI version 1.0 */
|
||||
|
||||
Checksum = AcpiTbChecksum (MemRover, ACPI_RSDP_CHECKSUM_LENGTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Post ACPI 1.0, use ExtendedChecksum */
|
||||
|
||||
Checksum = AcpiTbChecksum (MemRover, ACPI_RSDP_XCHECKSUM_LENGTH);
|
||||
}
|
||||
|
||||
if (Checksum == 0)
|
||||
{
|
||||
/* Checksum valid, we have found a valid RSDP */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"RSDP located at physical address %p\n",MemRover));
|
||||
"RSDP located at physical address %p\n", MemRover));
|
||||
return_PTR (MemRover);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Found an RSDP at physical address %p, but it has a bad checksum\n",
|
||||
MemRover));
|
||||
}
|
||||
|
||||
/* Searched entire block, no RSDP was found */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,"Searched entire block, no RSDP was found.\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Searched entire block, no valid RSDP was found.\n"));
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
@ -487,26 +563,29 @@ AcpiTbScanMemoryForRsdp (
|
||||
* Flags - Current memory mode (logical vs.
|
||||
* physical addressing)
|
||||
*
|
||||
* RETURN: Status
|
||||
* RETURN: Status, RSDP physical address
|
||||
*
|
||||
* DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
|
||||
* pointer structure. If it is found, set *RSDP to point to it.
|
||||
*
|
||||
* NOTE: The RSDP must be either in the first 1K of the Extended
|
||||
* BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section
|
||||
* 5.2.2; assertion #421).
|
||||
* NOTE1: The RSDP must be either in the first 1K of the Extended
|
||||
* BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
|
||||
* Only a 32-bit physical address is necessary.
|
||||
*
|
||||
* NOTE2: This function is always available, regardless of the
|
||||
* initialization state of the rest of ACPI.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
static ACPI_STATUS
|
||||
AcpiTbFindRsdp (
|
||||
ACPI_TABLE_DESC *TableInfo,
|
||||
UINT32 Flags)
|
||||
{
|
||||
UINT8 *TablePtr;
|
||||
UINT8 *MemRover;
|
||||
UINT64 PhysAddr;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT32 PhysicalAddress;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("TbFindRsdp");
|
||||
@ -518,39 +597,65 @@ AcpiTbFindRsdp (
|
||||
if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
|
||||
{
|
||||
/*
|
||||
* 1) Search EBDA (low memory) paragraphs
|
||||
* 1a) Get the location of the EBDA
|
||||
*/
|
||||
Status = AcpiOsMapMemory ((UINT64) ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE,
|
||||
(void **) &TablePtr);
|
||||
Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION,
|
||||
ACPI_EBDA_PTR_LENGTH, (void *) &TablePtr);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
|
||||
ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Could not map memory at %8.8X for length %X\n",
|
||||
ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_LO_RSDP_WINDOW_SIZE);
|
||||
AcpiOsUnmapMemory (TablePtr, ACPI_LO_RSDP_WINDOW_SIZE);
|
||||
ACPI_MOVE_16_TO_32 (&PhysicalAddress, TablePtr);
|
||||
PhysicalAddress <<= 4; /* Convert segment to physical address */
|
||||
AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_PTR_LENGTH);
|
||||
|
||||
if (MemRover)
|
||||
/* EBDA present? */
|
||||
|
||||
if (PhysicalAddress > 0x400)
|
||||
{
|
||||
/* Found it, return the physical address */
|
||||
/*
|
||||
* 1b) Search EBDA paragraphs (EBDA is required to be a
|
||||
* minimum of 1K length)
|
||||
*/
|
||||
Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) PhysicalAddress,
|
||||
ACPI_EBDA_WINDOW_SIZE,
|
||||
(void *) &TablePtr);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Could not map memory at %8.8X for length %X\n",
|
||||
PhysicalAddress, ACPI_EBDA_WINDOW_SIZE));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
PhysAddr = ACPI_LO_RSDP_WINDOW_BASE;
|
||||
PhysAddr += ACPI_PTR_DIFF (MemRover,TablePtr);
|
||||
MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_EBDA_WINDOW_SIZE);
|
||||
AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE);
|
||||
|
||||
TableInfo->PhysicalAddress = PhysAddr;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
if (MemRover)
|
||||
{
|
||||
/* Found it, return the physical address */
|
||||
|
||||
PhysicalAddress += ACPI_PTR_DIFF (MemRover, TablePtr);
|
||||
|
||||
TableInfo->PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
|
||||
* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
|
||||
*/
|
||||
Status = AcpiOsMapMemory ((UINT64) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE,
|
||||
(void **) &TablePtr);
|
||||
Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE,
|
||||
ACPI_HI_RSDP_WINDOW_SIZE,
|
||||
(void *) &TablePtr);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Could not map memory at %8.8X for length %X\n",
|
||||
ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
@ -562,10 +667,9 @@ AcpiTbFindRsdp (
|
||||
{
|
||||
/* Found it, return the physical address */
|
||||
|
||||
PhysAddr = ACPI_HI_RSDP_WINDOW_BASE;
|
||||
PhysAddr += ACPI_PTR_DIFF (MemRover, TablePtr);
|
||||
PhysicalAddress = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr);
|
||||
|
||||
TableInfo->PhysicalAddress = PhysAddr;
|
||||
TableInfo->PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
}
|
||||
@ -576,20 +680,32 @@ AcpiTbFindRsdp (
|
||||
else
|
||||
{
|
||||
/*
|
||||
* 1) Search EBDA (low memory) paragraphs
|
||||
* 1a) Get the location of the EBDA
|
||||
*/
|
||||
MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_LO_RSDP_WINDOW_BASE),
|
||||
ACPI_LO_RSDP_WINDOW_SIZE);
|
||||
if (MemRover)
|
||||
{
|
||||
/* Found it, return the physical address */
|
||||
ACPI_MOVE_16_TO_32 (&PhysicalAddress, ACPI_EBDA_PTR_LOCATION);
|
||||
PhysicalAddress <<= 4; /* Convert segment to physical address */
|
||||
|
||||
TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
/* EBDA present? */
|
||||
|
||||
if (PhysicalAddress > 0x400)
|
||||
{
|
||||
/*
|
||||
* 1b) Search EBDA paragraphs (EBDA is required to be a minimum of
|
||||
* 1K length)
|
||||
*/
|
||||
MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (PhysicalAddress),
|
||||
ACPI_EBDA_WINDOW_SIZE);
|
||||
if (MemRover)
|
||||
{
|
||||
/* Found it, return the physical address */
|
||||
|
||||
TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
|
||||
* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
|
||||
*/
|
||||
MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
|
||||
ACPI_HI_RSDP_WINDOW_SIZE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user