mirror of
https://github.com/acpica/acpica/
synced 2025-03-15 10:42:55 +03:00
Additional changes for new AcpiOsPhysicalTableOverride function.
Code cleanup; fix unmap bug for partially-mapped tables.
This commit is contained in:
parent
4a31754f8e
commit
9a3f444a3f
@ -313,8 +313,10 @@ AcpiTbAddTable (
|
||||
/*
|
||||
* ACPI Table Override:
|
||||
* Allow the host to override dynamically loaded tables.
|
||||
* NOTE: the table is fully mapped at this point, and the mapping will
|
||||
* be deleted by TbTableOverride if the table is actually overridden.
|
||||
*/
|
||||
AcpiTbTableOverride (TableDesc);
|
||||
(void) AcpiTbTableOverride (TableDesc->Pointer, TableDesc);
|
||||
|
||||
/* Add the table to the global root table list */
|
||||
|
||||
@ -338,18 +340,23 @@ Release:
|
||||
*
|
||||
* FUNCTION: AcpiTbTableOverride
|
||||
*
|
||||
* PARAMETERS: TableDesc - Table descriptor initialized for the
|
||||
* original table.
|
||||
* PARAMETERS: TableHeader - Header for the original table
|
||||
* TableDesc - Table descriptor initialized for the
|
||||
* original table. May or may not be mapped.
|
||||
*
|
||||
* RETURN: If overridden, installs new table within the input table
|
||||
* RETURN: Pointer to the entire new table. NULL if table not overridden.
|
||||
* If overridden, installs the new table within the input table
|
||||
* descriptor.
|
||||
*
|
||||
* DESCRIPTION: Attempt table override by calling the OSL override functions.
|
||||
* Note: If the table is overridden, then the entire new table
|
||||
* is mapped and returned by this function.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
ACPI_TABLE_HEADER *
|
||||
AcpiTbTableOverride (
|
||||
ACPI_TABLE_HEADER *TableHeader,
|
||||
ACPI_TABLE_DESC *TableDesc)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
@ -362,7 +369,7 @@ AcpiTbTableOverride (
|
||||
|
||||
/* (1) Attempt logical override (returns a logical address) */
|
||||
|
||||
Status = AcpiOsTableOverride (TableDesc->Pointer, &NewTable);
|
||||
Status = AcpiOsTableOverride (TableHeader, &NewTable);
|
||||
if (ACPI_SUCCESS (Status) && NewTable)
|
||||
{
|
||||
NewAddress = ACPI_PTR_TO_PHYSADDR (NewTable);
|
||||
@ -374,20 +381,20 @@ AcpiTbTableOverride (
|
||||
|
||||
/* (2) Attempt physical override (returns a physical address) */
|
||||
|
||||
Status = AcpiOsPhysicalTableOverride (TableDesc->Pointer,
|
||||
Status = AcpiOsPhysicalTableOverride (TableHeader,
|
||||
&NewAddress, &NewTableLength);
|
||||
if (ACPI_SUCCESS (Status) && NewAddress && NewTableLength)
|
||||
{
|
||||
/* Map memory for the new table */
|
||||
/* Map the entire new table */
|
||||
|
||||
NewTable = AcpiOsMapMemory (NewAddress, NewTableLength);
|
||||
if (!NewTable)
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
|
||||
"%4.4s %p Attempted physical table override failed",
|
||||
TableDesc->Pointer->Signature,
|
||||
TableHeader->Signature,
|
||||
ACPI_CAST_PTR (void, TableDesc->Address)));
|
||||
return;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
OverrideType = "Physical";
|
||||
@ -395,18 +402,18 @@ AcpiTbTableOverride (
|
||||
goto FinishOverride;
|
||||
}
|
||||
|
||||
return; /* There was no override */
|
||||
return (NULL); /* There was no override */
|
||||
|
||||
|
||||
FinishOverride:
|
||||
|
||||
ACPI_INFO ((AE_INFO,
|
||||
"%4.4s %p %s table override, new table: %p",
|
||||
TableDesc->Pointer->Signature,
|
||||
TableHeader->Signature,
|
||||
ACPI_CAST_PTR (void, TableDesc->Address),
|
||||
OverrideType, NewTable));
|
||||
|
||||
/* We can now unmap/delete the original table */
|
||||
/* We can now unmap/delete the original table (if fully mapped) */
|
||||
|
||||
AcpiTbDeleteTable (TableDesc);
|
||||
|
||||
@ -416,6 +423,8 @@ FinishOverride:
|
||||
TableDesc->Pointer = NewTable;
|
||||
TableDesc->Length = NewTableLength;
|
||||
TableDesc->Flags = NewFlags;
|
||||
|
||||
return (NewTable);
|
||||
}
|
||||
|
||||
|
||||
|
@ -511,6 +511,8 @@ AcpiTbInstallTable (
|
||||
UINT32 TableIndex)
|
||||
{
|
||||
ACPI_TABLE_HEADER *Table;
|
||||
ACPI_TABLE_HEADER *FinalTable;
|
||||
ACPI_TABLE_DESC *TableDesc;
|
||||
|
||||
|
||||
if (!Address)
|
||||
@ -525,6 +527,8 @@ AcpiTbInstallTable (
|
||||
Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
|
||||
if (!Table)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Could not map memory for table [%s] at %p",
|
||||
Signature, ACPI_CAST_PTR (void, Address)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -539,16 +543,17 @@ AcpiTbInstallTable (
|
||||
goto UnmapAndExit;
|
||||
}
|
||||
|
||||
/* Initialize the table entry */
|
||||
/*
|
||||
* Initialize the table entry. Set the pointer to NULL, since the
|
||||
* table is not fully mapped at this time.
|
||||
*/
|
||||
TableDesc = &AcpiGbl_RootTableList.Tables[TableIndex];
|
||||
|
||||
AcpiGbl_RootTableList.Tables[TableIndex].Address = Address;
|
||||
AcpiGbl_RootTableList.Tables[TableIndex].Pointer = Table;
|
||||
AcpiGbl_RootTableList.Tables[TableIndex].Length = Table->Length;
|
||||
AcpiGbl_RootTableList.Tables[TableIndex].Flags = ACPI_TABLE_ORIGIN_MAPPED;
|
||||
|
||||
ACPI_MOVE_32_TO_32 (
|
||||
&(AcpiGbl_RootTableList.Tables[TableIndex].Signature),
|
||||
Table->Signature);
|
||||
TableDesc->Address = Address;
|
||||
TableDesc->Pointer = NULL;
|
||||
TableDesc->Length = Table->Length;
|
||||
TableDesc->Flags = ACPI_TABLE_ORIGIN_MAPPED;
|
||||
ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature);
|
||||
|
||||
/*
|
||||
* ACPI Table Override:
|
||||
@ -556,21 +561,31 @@ AcpiTbInstallTable (
|
||||
* Before we install the table, let the host OS override it with a new
|
||||
* one if desired. Any table within the RSDT/XSDT can be replaced,
|
||||
* including the DSDT which is pointed to by the FADT.
|
||||
*
|
||||
* NOTE: If the table is overridden, then FinalTable will contain a
|
||||
* mapped pointer to the full new table. If the table is not overridden,
|
||||
* then the table will be fully mapped elsewhere (in verify table).
|
||||
* In any case, we must unmap the header that was mapped above.
|
||||
*/
|
||||
AcpiTbTableOverride (&AcpiGbl_RootTableList.Tables[TableIndex]);
|
||||
FinalTable = AcpiTbTableOverride (Table, TableDesc);
|
||||
if (!FinalTable)
|
||||
{
|
||||
FinalTable = Table; /* There was no override */
|
||||
}
|
||||
|
||||
Table = AcpiGbl_RootTableList.Tables[TableIndex].Pointer;
|
||||
AcpiTbPrintTableHeader (AcpiGbl_RootTableList.Tables[TableIndex].Address,
|
||||
Table);
|
||||
AcpiTbPrintTableHeader (TableDesc->Address, FinalTable);
|
||||
|
||||
/* Set the global integer width (based upon revision of the DSDT) */
|
||||
|
||||
if (TableIndex == ACPI_TABLE_INDEX_DSDT)
|
||||
{
|
||||
/* Global integer width is based upon revision of the DSDT */
|
||||
|
||||
AcpiUtSetIntegerWidth (Table->Revision);
|
||||
AcpiUtSetIntegerWidth (FinalTable->Revision);
|
||||
}
|
||||
|
||||
UnmapAndExit:
|
||||
|
||||
/* Always unmap the table header that we mapped above */
|
||||
|
||||
AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
|
||||
}
|
||||
|
||||
|
@ -156,8 +156,9 @@ ACPI_STATUS
|
||||
AcpiTbVerifyTable (
|
||||
ACPI_TABLE_DESC *TableDesc);
|
||||
|
||||
void
|
||||
ACPI_TABLE_HEADER *
|
||||
AcpiTbTableOverride (
|
||||
ACPI_TABLE_HEADER *TableHeader,
|
||||
ACPI_TABLE_DESC *TableDesc);
|
||||
|
||||
ACPI_STATUS
|
||||
|
Loading…
x
Reference in New Issue
Block a user