mirror of
https://github.com/acpica/acpica/
synced 2025-01-15 22:09:17 +03:00
Function renames; dynamic table load/unload
date 2000.04.19.22.35.00; author rmoore1; state Exp;
This commit is contained in:
parent
6edebc5073
commit
28ad2d0cfa
@ -168,6 +168,10 @@ TbInstallTable (
|
||||
TableType = TableInfo->Type;
|
||||
TableHeader = TableInfo->Pointer;
|
||||
|
||||
/* Lock tables while installing */
|
||||
|
||||
CmAcquireMutex (MTX_TABLES);
|
||||
|
||||
/* Install the table into the global data structure */
|
||||
|
||||
Status = TbInitTableDescriptor (TableInfo->Type, TableInfo);
|
||||
@ -176,20 +180,19 @@ TbInstallTable (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Initialize the typed global pointer for this table */
|
||||
|
||||
if (Gbl_AcpiTableData[TableType].GlobalPtr)
|
||||
{
|
||||
*(Gbl_AcpiTableData[TableType].GlobalPtr) = TableHeader;
|
||||
}
|
||||
|
||||
DEBUG_PRINT (ACPI_INFO, ("%s located at %p\n",
|
||||
Gbl_AcpiTableData[TableType].Name, TableHeader));
|
||||
|
||||
CmReleaseMutex (MTX_TABLES);
|
||||
|
||||
/* Validate checksum for _most_ tables */
|
||||
|
||||
if (TableType != TABLE_FACS)
|
||||
{
|
||||
/* But don't abort if the checksum is wrong */
|
||||
/* TBD: make this a configuration option? */
|
||||
|
||||
TbVerifyTableChecksum (TableHeader);
|
||||
}
|
||||
|
||||
@ -246,20 +249,14 @@ TbRecognizeTable (
|
||||
TableType = i;
|
||||
Status = Gbl_AcpiTableData[i].Status;
|
||||
|
||||
/* Set the appropriate global pointer (if there is one) to point to the newly recognized table */
|
||||
|
||||
if (Gbl_AcpiTableData[i].GlobalPtr)
|
||||
{
|
||||
*(Gbl_AcpiTableData[i].GlobalPtr) = TableInfo->Pointer;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the table type via the info struct */
|
||||
/* Return the table type and length via the info struct */
|
||||
|
||||
TableInfo->Type = (UINT8) TableType;
|
||||
TableInfo->Length = TableHeader->Length;
|
||||
|
||||
/*
|
||||
* Bad_Signature means that the table is bad or not one of the recognized tables
|
||||
@ -346,7 +343,7 @@ TbInitTableDescriptor (
|
||||
|
||||
if (ListHead->Pointer)
|
||||
{
|
||||
TbFreeAcpiTable (ListHead);
|
||||
return_ACPI_STATUS (AE_EXIST);
|
||||
}
|
||||
|
||||
TableDesc->Count = 1;
|
||||
@ -393,9 +390,23 @@ TbInitTableDescriptor (
|
||||
|
||||
/* Common initialization of the table descriptor */
|
||||
|
||||
TableDesc->Pointer = TableInfo->Pointer;
|
||||
TableDesc->Length = TableInfo->Length;
|
||||
TableDesc->Allocation = TableInfo->Allocation;
|
||||
TableDesc->Pointer = TableInfo->Pointer;
|
||||
TableDesc->Length = TableInfo->Length;
|
||||
TableDesc->Allocation = TableInfo->Allocation;
|
||||
TableDesc->AmlPointer = (UINT8 *) (TableDesc->Pointer + 1),
|
||||
TableDesc->AmlLength = (UINT32) (TableDesc->Length - (UINT32) sizeof (ACPI_TABLE_HEADER));
|
||||
TableDesc->TableId = Gbl_TbNextTableId;
|
||||
TableDesc->LoadedIntoNamespace = FALSE;
|
||||
|
||||
Gbl_TbNextTableId++;
|
||||
|
||||
|
||||
/* Set the appropriate global pointer (if there is one) to point to the newly installed table */
|
||||
|
||||
if (Gbl_AcpiTableData[TableType].GlobalPtr)
|
||||
{
|
||||
*(Gbl_AcpiTableData[TableType].GlobalPtr) = TableInfo->Pointer;
|
||||
}
|
||||
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
|
@ -124,6 +124,48 @@
|
||||
MODULE_NAME ("tbutils");
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: TbSystemTablePointer
|
||||
*
|
||||
* PARAMETERS: *Where - Pointer to be examined
|
||||
*
|
||||
* RETURN: TRUE if Where is within the AML stream (in one of the ACPI
|
||||
* system tables such as the DSDT or an SSDT.)
|
||||
* FALSE otherwise
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
TbHandleToObject (
|
||||
UINT16 TableId,
|
||||
ACPI_TABLE_DESC **TableDesc)
|
||||
{
|
||||
UINT32 i;
|
||||
ACPI_TABLE_DESC *ListHead;
|
||||
|
||||
|
||||
for (i = 0; i < ACPI_TABLE_MAX; i++)
|
||||
{
|
||||
ListHead = &Gbl_AcpiTables[i];
|
||||
do
|
||||
{
|
||||
if (ListHead->TableId == TableId)
|
||||
{
|
||||
*TableDesc = ListHead;
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
ListHead = ListHead->Next;
|
||||
|
||||
} while (ListHead != &Gbl_AcpiTables[i]);
|
||||
}
|
||||
|
||||
|
||||
DEBUG_PRINT (ACPI_ERROR, ("TableId=0x%X does not exist\n", TableId));
|
||||
return AE_BAD_PARAMETER;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -118,10 +118,10 @@
|
||||
#define __TBAPI_C__
|
||||
|
||||
#include <acpi.h>
|
||||
#include <interpreter.h>
|
||||
#include <acobject.h>
|
||||
#include <interp.h>
|
||||
#include <tables.h>
|
||||
#include <methods.h>
|
||||
#include <acpiobj.h>
|
||||
#include <pnp.h>
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ AcpiLoadFirmwareTables (void)
|
||||
|
||||
/* Get the RSDT first */
|
||||
|
||||
Status = TbGetTableRsdt (&NumberOfTables, NULL);
|
||||
Status = TbGetTableRsdt (&NumberOfTables);
|
||||
if (Status != AE_OK)
|
||||
{
|
||||
goto ErrorExit;
|
||||
@ -176,7 +176,7 @@ AcpiLoadFirmwareTables (void)
|
||||
|
||||
|
||||
ErrorExit:
|
||||
DEBUG_PRINT (ACPI_ERROR, ("Failure during ACPI Table initialization: %x\n", Status));
|
||||
DEBUG_PRINT (ACPI_ERROR, ("Failure during ACPI Table Init: %s\n", CmFormatException (Status)));
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
@ -251,17 +251,34 @@ ACPI_STATUS
|
||||
AcpiUnloadTable (
|
||||
ACPI_TABLE_TYPE TableType)
|
||||
{
|
||||
ACPI_TABLE_DESC *ListHead;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("AcpiUnloadTable");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (TableType > ACPI_TABLE_MAX)
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Delete existing table if there is one */
|
||||
|
||||
/* Find all tables of the requested type */
|
||||
|
||||
TbDeleteAcpiTable (TableType);
|
||||
ListHead = &Gbl_AcpiTables[TableType];
|
||||
do
|
||||
{
|
||||
/* Delete the entire namespace under this table NTE */
|
||||
|
||||
NsDeleteNamespaceByOwner (ListHead->TableId);
|
||||
|
||||
/* Delete (or unmap) the actual table */
|
||||
|
||||
TbDeleteAcpiTable (TableType);
|
||||
|
||||
} while (ListHead != &Gbl_AcpiTables[TableType]);
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user