static ACPI_STATUS
AcpiTbLoadNamespace (
void)
{
ACPI_STATUS Status;
UINT32 i;
ACPI_TABLE_HEADER *NewDsdt;
ACPI_FUNCTION_TRACE (TbLoadNamespace);
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
/*
* Load the namespace. The DSDT is required, but any SSDT and
* PSDT tables are optional. Verify the DSDT.
*/
if (!AcpiGbl_RootTableList.CurrentTableCount ||
!ACPI_COMPARE_NAME (
&(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature),
ACPI_SIG_DSDT) ||
ACPI_FAILURE (AcpiTbVerifyTable (
&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT])))
{
Status = AE_NO_ACPI_TABLES;
goto UnlockAndExit;
}
/*
* Save the DSDT pointer for simple access. This is the mapped memory
* address. We must take care here because the address of the .Tables
* array can change dynamically as tables are loaded at run-time. Note:
* .Pointer field is not validated until after call to AcpiTbVerifyTable.
*/
AcpiGbl_DSDT = AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer;
/*
* Optionally copy the entire DSDT to local memory (instead of simply
* mapping it.) There are some BIOSs that corrupt or replace the original
* DSDT, creating the need for this option. Default is FALSE, do not copy
* the DSDT.
*/
if (AcpiGbl_CopyDsdtLocally)
{
NewDsdt = AcpiTbCopyDsdt (ACPI_TABLE_INDEX_DSDT);
if (NewDsdt)
{
AcpiGbl_DSDT = NewDsdt;
}
}
/*
* Save the original DSDT header for detection of table corruption
* and/or replacement of the DSDT from outside the OS.
*/
ACPI_MEMCPY (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT,
sizeof (ACPI_TABLE_HEADER));
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
/* Load and parse tables */
Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
ACPI_SIG_SSDT) &&
!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
ACPI_SIG_PSDT)) ||
ACPI_FAILURE (AcpiTbVerifyTable (
&AcpiGbl_RootTableList.Tables[i])))
{
continue;
}
/* Ignore errors while loading tables, get as many as possible */
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
(void) AcpiNsLoadTable (i, AcpiGbl_RootNode);
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (Status);
}
ACPI_STATUS
AcpiUnloadParentTable (
ACPI_HANDLE Object)
{
ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Object);
ACPI_STATUS Status = AE_NOT_EXIST;
ACPI_OWNER_ID OwnerId;
UINT32 i;
ACPI_FUNCTION_TRACE (AcpiUnloadParentTable);
/* Parameter validation */
if (!Object)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* The node OwnerId is currently the same as the parent table ID.
* However, this could change in the future.
*/
OwnerId = Node->OwnerId;
if (!OwnerId)
{
/* OwnerId==0 means DSDT is the owner. DSDT cannot be unloaded */
return_ACPI_STATUS (AE_TYPE);
}
/* Must acquire the interpreter lock during this operation */
Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Find the table in the global table list */
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
{
if (OwnerId != AcpiGbl_RootTableList.Tables[i].OwnerId)
{
continue;
}
/*
* Allow unload of SSDT and OEMx tables only. Do not allow unload
* of the DSDT. No other types of tables should get here, since
* only these types can contain AML and thus are the only types
* that can create namespace objects.
*/
if (ACPI_COMPARE_NAME (
AcpiGbl_RootTableList.Tables[i].Signature.Ascii,
ACPI_SIG_DSDT))
{
Status = AE_TYPE;
break;
}
/* Ensure the table is actually loaded */
if (!AcpiTbIsTableLoaded (i))
{
Status = AE_NOT_EXIST;
break;
}
/* Invoke table handler if present */
if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD,
AcpiGbl_RootTableList.Tables[i].Pointer,
AcpiGbl_TableHandlerContext);
}
/*
* Delete all namespace objects owned by this table. Note that
* these objects can appear anywhere in the namespace by virtue
* of the AML "Scope" operator. Thus, we need to track ownership
* by an ID, not simply a position within the hierarchy.
*/
Status = AcpiTbDeleteNamespaceByOwner (i);
if (ACPI_FAILURE (Status))
{
break;
}
Status = AcpiTbReleaseOwnerId (i);
AcpiTbSetTableLoadedFlag (i, FALSE);
break;
}
(void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
return_ACPI_STATUS (Status);
}
开发者ID:mmadia,项目名称:haiku,代码行数:100,代码来源:tbxfload.c
示例7: AcpiDbReadTable
static ACPI_STATUS
AcpiDbReadTable (
FILE *fp,
ACPI_TABLE_HEADER **Table,
UINT32 *TableLength)
{
ACPI_TABLE_HEADER TableHeader;
UINT32 Actual;
ACPI_STATUS Status;
UINT32 FileSize;
BOOLEAN StandardHeader = TRUE;
/* Get the file size */
FileSize = CmGetFileSize (fp);
if (FileSize == ACPI_UINT32_MAX)
{
return (AE_ERROR);
}
if (FileSize < 4)
{
return (AE_BAD_HEADER);
}
/* Read the signature */
if (fread (&TableHeader, 1, 4, fp) != 4)
{
AcpiOsPrintf ("Could not read the table signature\n");
return (AE_BAD_HEADER);
}
fseek (fp, 0, SEEK_SET);
/* The RSDP table does not have standard ACPI header */
if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD "))
{
*TableLength = FileSize;
StandardHeader = FALSE;
}
else
{
/* Read the table header */
if (fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp) !=
sizeof (ACPI_TABLE_HEADER))
{
AcpiOsPrintf ("Could not read the table header\n");
return (AE_BAD_HEADER);
}
#if 0
/* Validate the table header/length */
Status = AcpiTbValidateTableHeader (&TableHeader);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Table header is invalid!\n");
return (Status);
}
#endif
/* File size must be at least as long as the Header-specified length */
if (TableHeader.Length > FileSize)
{
AcpiOsPrintf (
"TableHeader length [0x%X] greater than the input file size [0x%X]\n",
TableHeader.Length, FileSize);
#ifdef ACPI_ASL_COMPILER
Status = FlCheckForAscii (fp, NULL, FALSE);
if (ACPI_SUCCESS (Status))
{
AcpiOsPrintf ("File appears to be ASCII only, must be binary\n",
TableHeader.Length, FileSize);
}
#endif
return (AE_BAD_HEADER);
}
#ifdef ACPI_OBSOLETE_CODE
/* We only support a limited number of table types */
if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) &&
!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) &&
!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT))
{
AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n",
(char *) TableHeader.Signature);
ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
return (AE_ERROR);
}
#endif
*TableLength = TableHeader.Length;
}
//.........这里部分代码省略.........
开发者ID:queer1,项目名称:acpica,代码行数:101,代码来源:dbfileio.c
示例8: AxExtractTables
int
AxExtractTables (
char *InputPathname,
char *Signature,
unsigned int MinimumInstances)
{
FILE *InputFile;
FILE *OutputFile = NULL;
size_t BytesWritten;
size_t TotalBytesWritten = 0;
size_t BytesConverted;
unsigned int State = AX_STATE_FIND_HEADER;
unsigned int FoundTable = 0;
unsigned int Instances = 0;
unsigned int ThisInstance;
char ThisSignature[4];
int Status = 0;
/* Open input in text mode, output is in binary mode */
InputFile = fopen (InputPathname, "rt");
if (!InputFile)
{
printf ("Could not open %s\n", InputPathname);
return (-1);
}
if (Signature)
{
/* Are there enough instances of the table to continue? */
AxNormalizeSignature (Signature);
Instances = AxCountTableInstances (InputPathname, Signature);
if (Instances < MinimumInstances)
{
printf ("Table %s was not found in %s\n", Signature, InputPathname);
Status = -1;
goto CleanupAndExit;
}
if (Instances == 0)
{
goto CleanupAndExit;
}
}
/* Convert all instances of the table to binary */
while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile))
{
switch (State)
{
case AX_STATE_FIND_HEADER:
/* Ignore lines that are too short to be header lines */
if (strlen (LineBuffer) < AX_MIN_TABLE_NAME_LENGTH)
{
continue;
}
/* Ignore empty lines and lines that start with a space */
if ((LineBuffer[0] == ' ') ||
(LineBuffer[0] == '\n'))
{
continue;
}
/*
* Ignore lines that are not of the form <sig> @ <addr>.
* Examples of lines that must be supported:
*
* DSDT @ 0x737e4000
* XSDT @ 0x737f2fff
* RSD PTR @ 0xf6cd0
* SSDT @ (nil)
*/
if (!strstr (LineBuffer, " @ "))
{
continue;
}
AxNormalizeSignature (LineBuffer);
ACPI_MOVE_NAME (ThisSignature, LineBuffer);
if (Signature)
{
/* Ignore signatures that don't match */
if (!ACPI_COMPARE_NAME (ThisSignature, Signature))
{
continue;
}
}
/*
* Get the instance number for this signature. Only the
//.........这里部分代码省略.........
ACPI_STATUS
AeBuildLocalTables (
ACPI_NEW_TABLE_DESC *ListHead)
{
UINT32 TableCount = 1;
ACPI_PHYSICAL_ADDRESS DsdtAddress = 0;
UINT32 XsdtSize;
ACPI_NEW_TABLE_DESC *NextTable;
UINT32 NextIndex;
ACPI_TABLE_FADT *ExternalFadt = NULL;
/*
* Update the table count. For the DSDT, it is not put into the XSDT.
* For the FADT, this table is already accounted for since we usually
* install a local FADT.
*/
NextTable = ListHead;
while (NextTable)
{
if (!ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) &&
!ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))
{
TableCount++;
}
NextTable = NextTable->Next;
}
XsdtSize = (((TableCount + 1) * sizeof (UINT64)) +
sizeof (ACPI_TABLE_HEADER));
if (AcpiGbl_LoadTestTables)
{
XsdtSize += BASE_XSDT_SIZE;
}
/* Build an XSDT */
LocalXSDT = AcpiOsAllocate (XsdtSize);
if (!LocalXSDT)
{
return (AE_NO_MEMORY);
}
memset (LocalXSDT, 0, XsdtSize);
LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalFADT);
NextIndex = 1;
/*
* Install the user tables. The DSDT must be installed in the FADT.
* All other tables are installed directly into the XSDT.
*/
NextTable = ListHead;
while (NextTable)
{
/*
* Incoming DSDT or FADT are special cases. All other tables are
* just immediately installed into the XSDT.
*/
if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT))
{
if (DsdtAddress)
{
printf ("Already found a DSDT, only one allowed\n");
return (AE_ALREADY_EXISTS);
}
/* The incoming user table is a DSDT */
DsdtAddress = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
DsdtToInstallOverride = NextTable->Table;
}
else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))
{
ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table);
LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
}
else
{
/* Install the table in the XSDT */
LocalXSDT->TableOffsetEntry[NextIndex] =
ACPI_PTR_TO_PHYSADDR (NextTable->Table);
NextIndex++;
}
NextTable = NextTable->Next;
}
/* Install the optional extra local tables */
if (AcpiGbl_LoadTestTables)
{
LocalXSDT->TableOffsetEntry[NextIndex++] = ACPI_PTR_TO_PHYSADDR (&LocalTEST);
LocalXSDT->TableOffsetEntry[NextIndex++] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE);
/* Install two SSDTs to test multiple table support */
LocalXSDT->TableOffsetEntry[NextIndex++] = ACPI_PTR_TO_PHYSADDR (&Ssdt1Code);
LocalXSDT->TableOffsetEntry[NextIndex++] = ACPI_PTR_TO_PHYSADDR (&Ssdt2Code);
//.........这里部分代码省略.........
int
AxExtractTables (
char *InputPathname,
char *Signature,
unsigned int MinimumInstances)
{
FILE *InputFile;
FILE *OutputFile = NULL;
unsigned int BytesConverted;
unsigned int ThisTableBytesWritten = 0;
unsigned int FoundTable = 0;
unsigned int Instances = 0;
unsigned int ThisInstance;
char ThisSignature[5];
char UpperSignature[5];
int Status = 0;
unsigned int State = AX_STATE_FIND_HEADER;
/* Open input in text mode, output is in binary mode */
InputFile = fopen (InputPathname, "rt");
if (!InputFile)
{
printf ("Could not open input file %s\n", InputPathname);
return (-1);
}
if (!AxIsFileAscii (InputFile))
{
fclose (InputFile);
return (-1);
}
if (Signature)
{
strncpy (UpperSignature, Signature, 4);
UpperSignature[4] = 0;
AcpiUtStrupr (UpperSignature);
/* Are there enough instances of the table to continue? */
AxNormalizeSignature (UpperSignature);
Instances = AxCountTableInstances (InputPathname, UpperSignature);
if (Instances < MinimumInstances)
{
printf ("Table [%s] was not found in %s\n",
UpperSignature, InputPathname);
fclose (InputFile);
return (-1);
}
if (Instances == 0)
{
fclose (InputFile);
return (-1);
}
}
/* Convert all instances of the table to binary */
while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile))
{
switch (State)
{
case AX_STATE_FIND_HEADER:
if (!AxIsDataBlockHeader ())
{
continue;
}
ACPI_MOVE_NAME (ThisSignature, Gbl_LineBuffer);
if (Signature)
{
/* Ignore signatures that don't match */
if (!ACPI_COMPARE_NAME (ThisSignature, UpperSignature))
{
continue;
}
}
/*
* Get the instance number for this signature. Only the
* SSDT and PSDT tables can have multiple instances.
*/
ThisInstance = AxGetNextInstance (InputPathname, ThisSignature);
/* Build an output filename and create/open the output file */
if (ThisInstance > 0)
{
/* Add instance number to the output filename */
sprintf (Gbl_OutputFilename, "%4.4s%u.dat",
ThisSignature, ThisInstance);
}
else
//.........这里部分代码省略.........
int
AxExtractToMultiAmlFile (
char *InputPathname)
{
FILE *InputFile;
FILE *OutputFile;
int Status = 0;
unsigned int TotalBytesWritten = 0;
unsigned int ThisTableBytesWritten = 0;
unsigned int BytesConverted;
char ThisSignature[4];
unsigned int State = AX_STATE_FIND_HEADER;
strcpy (Gbl_OutputFilename, AX_MULTI_TABLE_FILENAME);
/* Open the input file in text mode */
InputFile = fopen (InputPathname, "rt");
if (!InputFile)
{
printf ("Could not open input file %s\n", InputPathname);
return (-1);
}
if (!AxIsFileAscii (InputFile))
{
fclose (InputFile);
return (-1);
}
/* Open the output file in binary mode */
OutputFile = fopen (Gbl_OutputFilename, "w+b");
if (!OutputFile)
{
printf ("Could not open output file %s\n", Gbl_OutputFilename);
fclose (InputFile);
return (-1);
}
/* Convert the DSDT and all SSDTs to binary */
while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile))
{
switch (State)
{
case AX_STATE_FIND_HEADER:
if (!AxIsDataBlockHeader ())
{
continue;
}
ACPI_MOVE_NAME (ThisSignature, Gbl_LineBuffer);
/* Only want DSDT and SSDTs */
if (!ACPI_COMPARE_NAME (ThisSignature, ACPI_SIG_DSDT) &&
!ACPI_COMPARE_NAME (ThisSignature, ACPI_SIG_SSDT))
{
continue;
}
/*
* Toss this block header of the form "<sig> @ <addr>" line
* and move on to the actual data block
*/
Gbl_TableCount++;
ThisTableBytesWritten = 0;
State = AX_STATE_EXTRACT_DATA;
continue;
case AX_STATE_EXTRACT_DATA:
/* Empty line or non-data line terminates the data block */
BytesConverted = AxProcessOneTextLine (
OutputFile, ThisSignature, ThisTableBytesWritten);
switch (BytesConverted)
{
case 0:
State = AX_STATE_FIND_HEADER; /* No more data block lines */
continue;
case -1:
goto CleanupAndExit; /* There was a write error */
default: /* Normal case, get next line */
ThisTableBytesWritten += BytesConverted;
TotalBytesWritten += BytesConverted;
continue;
}
default:
Status = -1;
//.........这里部分代码省略.........
ACPI_STATUS
AcpiOsGetTableByName (
char *Signature,
UINT32 Instance,
ACPI_TABLE_HEADER **Table,
ACPI_PHYSICAL_ADDRESS *Address)
{
HKEY Handle = NULL;
LONG WinStatus;
ULONG Type;
ULONG NameSize;
ULONG DataSize;
HKEY SubKey;
ULONG i;
ACPI_TABLE_HEADER *ReturnTable;
ACPI_STATUS Status = AE_OK;
/*
* Windows has no SSDTs in the registry, so multiple instances are
* not supported.
*/
if (Instance > 0)
{
return (AE_LIMIT);
}
/* Get a handle to the table key */
while (1)
{
strcpy (KeyBuffer, "HARDWARE\\ACPI\\");
if (AcpiUtSafeStrcat (KeyBuffer, sizeof (KeyBuffer), Signature))
{
return (AE_BUFFER_OVERFLOW);
}
WinStatus = RegOpenKeyEx (HKEY_LOCAL_MACHINE, KeyBuffer,
0L, KEY_READ, &Handle);
if (WinStatus != ERROR_SUCCESS)
{
/*
* Somewhere along the way, MS changed the registry entry for
* the FADT from
* HARDWARE/ACPI/FACP to
* HARDWARE/ACPI/FADT.
*
* This code allows for both.
*/
if (ACPI_COMPARE_NAME (Signature, "FACP"))
{
Signature = "FADT";
}
else if (ACPI_COMPARE_NAME (Signature, "XSDT"))
{
Signature = "RSDT";
}
else
{
fprintf (stderr,
"Could not find %s in registry at %s: %s (WinStatus=0x%X)\n",
Signature, KeyBuffer, WindowsFormatException (WinStatus), WinStatus);
return (AE_NOT_FOUND);
}
}
else
{
break;
}
}
/* Actual data for the table is down a couple levels */
for (i = 0; ;)
{
WinStatus = RegEnumKey (Handle, i, KeyBuffer, sizeof (KeyBuffer));
i++;
if (WinStatus == ERROR_NO_MORE_ITEMS)
{
break;
}
WinStatus = RegOpenKey (Handle, KeyBuffer, &SubKey);
if (WinStatus != ERROR_SUCCESS)
{
fprintf (stderr, "Could not open %s entry: %s\n",
Signature, WindowsFormatException (WinStatus));
Status = AE_ERROR;
goto Cleanup;
}
RegCloseKey (Handle);
Handle = SubKey;
i = 0;
}
/* Find the (binary) table entry */
for (i = 0; ; i++)
//.........这里部分代码省略.........
/*******************************************************************************
*
* FUNCTION: acpi_tb_load_namespace
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
* the RSDT/XSDT.
*
******************************************************************************/
acpi_status acpi_tb_load_namespace(void)
{
acpi_status status;
u32 i;
struct acpi_table_header *new_dsdt;
struct acpi_table_desc *table;
u32 tables_loaded = 0;
u32 tables_failed = 0;
ACPI_FUNCTION_TRACE(tb_load_namespace);
(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
/*
* Load the namespace. The DSDT is required, but any SSDT and
* PSDT tables are optional. Verify the DSDT.
*/
table = &acpi_gbl_root_table_list.tables[acpi_gbl_dsdt_index];
if (!acpi_gbl_root_table_list.current_table_count ||
!ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_DSDT) ||
ACPI_FAILURE(acpi_tb_validate_table(table))) {
status = AE_NO_ACPI_TABLES;
goto unlock_and_exit;
}
/*
* Save the DSDT pointer for simple access. This is the mapped memory
* address. We must take care here because the address of the .Tables
* array can change dynamically as tables are loaded at run-time. Note:
* .Pointer field is not validated until after call to acpi_tb_validate_table.
*/
acpi_gbl_DSDT = table->pointer;
/*
* Optionally copy the entire DSDT to local memory (instead of simply
* mapping it.) There are some BIOSs that corrupt or replace the original
* DSDT, creating the need for this option. Default is FALSE, do not copy
* the DSDT.
*/
if (acpi_gbl_copy_dsdt_locally) {
new_dsdt = acpi_tb_copy_dsdt(acpi_gbl_dsdt_index);
if (new_dsdt) {
acpi_gbl_DSDT = new_dsdt;
}
}
/*
* Save the original DSDT header for detection of table corruption
* and/or replacement of the DSDT from outside the OS.
*/
memcpy(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
sizeof(struct acpi_table_header));
/* Load and parse tables */
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
status = acpi_ns_load_table(acpi_gbl_dsdt_index, acpi_gbl_root_node);
(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "[DSDT] table load failed"));
tables_failed++;
} else {
tables_loaded++;
}
/* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
table = &acpi_gbl_root_table_list.tables[i];
if (!acpi_gbl_root_table_list.tables[i].address ||
(!ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_SSDT)
&& !ACPI_COMPARE_NAME(table->signature.ascii,
ACPI_SIG_PSDT)
&& !ACPI_COMPARE_NAME(table->signature.ascii,
ACPI_SIG_OSDT))
|| ACPI_FAILURE(acpi_tb_validate_table(table))) {
continue;
}
/* Ignore errors while loading tables, get as many as possible */
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
status = acpi_ns_load_table(i, acpi_gbl_root_node);
(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
//.........这里部分代码省略.........
请发表评论