summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/dbfileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/dbfileio.c')
-rw-r--r--sys/contrib/dev/acpica/dbfileio.c134
1 files changed, 46 insertions, 88 deletions
diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c
index f03ebc3..11c0206 100644
--- a/sys/contrib/dev/acpica/dbfileio.c
+++ b/sys/contrib/dev/acpica/dbfileio.c
@@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
- * $Revision: 69 $
+ * $Revision: 72 $
*
******************************************************************************/
@@ -10,7 +10,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 - 2003, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -137,49 +137,6 @@ FILE *AcpiGbl_DebugFile = NULL;
#endif
-ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr = NULL;
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbMatchArgument
- *
- * PARAMETERS: UserArgument - User command line
- * Arguments - Array of commands to match against
- *
- * RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found
- *
- * DESCRIPTION: Search command array for a command match
- *
- ******************************************************************************/
-
-ACPI_OBJECT_TYPE
-AcpiDbMatchArgument (
- NATIVE_CHAR *UserArgument,
- ARGUMENT_INFO *Arguments)
-{
- UINT32 i;
-
-
- if (!UserArgument || UserArgument[0] == 0)
- {
- return (ACPI_TYPE_NOT_FOUND);
- }
-
- for (i = 0; Arguments[i].Name; i++)
- {
- if (ACPI_STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name)
- {
- return (i);
- }
- }
-
- /* Argument not recognized */
-
- return (ACPI_TYPE_NOT_FOUND);
-}
-
-
#ifdef ACPI_DEBUGGER
/*******************************************************************************
*
@@ -208,7 +165,6 @@ AcpiDbCloseDebugFile (
AcpiOsPrintf ("Debug output file %s closed\n", AcpiGbl_DbDebugFilename);
}
#endif
-
}
@@ -226,7 +182,7 @@ AcpiDbCloseDebugFile (
void
AcpiDbOpenDebugFile (
- NATIVE_CHAR *Name)
+ char *Name)
{
#ifdef ACPI_APPLICATION
@@ -252,11 +208,11 @@ AcpiDbOpenDebugFile (
#ifdef ACPI_APPLICATION
/*******************************************************************************
*
- * FUNCTION: AcpiDbLoadTable
+ * FUNCTION: AcpiDbReadTable
*
* PARAMETERS: fp - File that contains table
- * TablePtr - Return value, buffer with table
- * TableLenght - Return value, length of table
+ * Table - Return value, buffer with table
+ * TableLength - Return value, length of table
*
* RETURN: Status
*
@@ -265,9 +221,9 @@ AcpiDbOpenDebugFile (
******************************************************************************/
static ACPI_STATUS
-AcpiDbLoadTable(
+AcpiDbReadTable (
FILE *fp,
- ACPI_TABLE_HEADER **TablePtr,
+ ACPI_TABLE_HEADER **Table,
UINT32 *TableLength)
{
ACPI_TABLE_HEADER TableHeader;
@@ -285,7 +241,6 @@ AcpiDbLoadTable(
return (AE_BAD_SIGNATURE);
}
-
/* Validate the table header/length */
Status = AcpiTbValidateTableHeader (&TableHeader);
@@ -296,7 +251,6 @@ AcpiDbLoadTable(
return (AE_ERROR);
}
-
/* We only support a limited number of table types */
if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&
@@ -311,21 +265,20 @@ AcpiDbLoadTable(
/* Allocate a buffer for the table */
*TableLength = TableHeader.Length;
- *TablePtr = AcpiOsAllocate ((size_t) *TableLength);
- if (!*TablePtr)
+ *Table = AcpiOsAllocate ((size_t) *TableLength);
+ if (!*Table)
{
AcpiOsPrintf ("Could not allocate memory for ACPI table %4.4s (size=%X)\n",
TableHeader.Signature, TableHeader.Length);
return (AE_NO_MEMORY);
}
-
- AmlStart = (UINT8 *) *TablePtr + sizeof (TableHeader);
+ AmlStart = (UINT8 *) *Table + sizeof (TableHeader);
AmlLength = *TableLength - sizeof (TableHeader);
/* Copy the header to the buffer */
- ACPI_MEMCPY (*TablePtr, &TableHeader, sizeof (TableHeader));
+ ACPI_MEMCPY (*Table, &TableHeader, sizeof (TableHeader));
/* Get the rest of the table */
@@ -334,8 +287,7 @@ AcpiDbLoadTable(
{
/* Now validate the checksum */
- Status = AcpiTbVerifyTableChecksum (*TablePtr);
-
+ Status = AcpiTbVerifyTableChecksum (*Table);
return (AE_OK);
}
@@ -345,10 +297,9 @@ AcpiDbLoadTable(
return (AE_OK);
}
-
AcpiOsPrintf ("Error - could not read the table file\n");
- AcpiOsFree (*TablePtr);
- *TablePtr = NULL;
+ AcpiOsFree (*Table);
+ *Table = NULL;
*TableLength = 0;
return (AE_ERROR);
@@ -360,7 +311,7 @@ AcpiDbLoadTable(
*
* FUNCTION: AeLocalLoadTable
*
- * PARAMETERS: TablePtr - pointer to a buffer containing the entire
+ * PARAMETERS: Table - pointer to a buffer containing the entire
* table to be loaded
*
* RETURN: Status
@@ -370,13 +321,11 @@ AcpiDbLoadTable(
* a valid header. The header fields will be verified, and if it
* is determined that the table is invalid, the call will fail.
*
- * If the call fails an appropriate status will be returned.
- *
******************************************************************************/
ACPI_STATUS
AeLocalLoadTable (
- ACPI_TABLE_HEADER *TablePtr)
+ ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_TABLE_DESC TableInfo;
@@ -384,13 +333,14 @@ AeLocalLoadTable (
ACPI_FUNCTION_TRACE ("AeLocalLoadTable");
- if (!TablePtr)
+
+ if (!Table)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- TableInfo.Pointer = TablePtr;
- Status = AcpiTbRecognizeTable (&TableInfo, ACPI_TABLE_SECONDARY);
+ TableInfo.Pointer = Table;
+ Status = AcpiTbRecognizeTable (&TableInfo, ACPI_TABLE_ALL);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -407,8 +357,8 @@ AeLocalLoadTable (
return_ACPI_STATUS (Status);
}
-
#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
+
Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode);
if (ACPI_FAILURE (Status))
{
@@ -426,9 +376,10 @@ AeLocalLoadTable (
#ifdef ACPI_APPLICATION
/*******************************************************************************
*
- * FUNCTION: AcpiDbGetAcpiTable
+ * FUNCTION: AcpiDbReadTableFromFile
*
- * PARAMETERS: Filname - File where table is located
+ * PARAMETERS: Filename - File where table is located
+ * Table - Where a pointer to the table is returned
*
* RETURN: Status
*
@@ -437,8 +388,9 @@ AeLocalLoadTable (
******************************************************************************/
ACPI_STATUS
-AcpiDbGetAcpiTable (
- NATIVE_CHAR *Filename)
+AcpiDbReadTableFromFile (
+ char *Filename,
+ ACPI_TABLE_HEADER **Table)
{
FILE *fp;
UINT32 TableLength;
@@ -450,15 +402,14 @@ AcpiDbGetAcpiTable (
fp = fopen (Filename, "rb");
if (!fp)
{
- AcpiOsPrintf ("Could not open file %s\n", Filename);
+ AcpiOsPrintf ("Could not open input file %s\n", Filename);
return (AE_ERROR);
}
-
/* Get the entire file */
fprintf (stderr, "Loading Acpi table from file %s\n", Filename);
- Status = AcpiDbLoadTable (fp, &AcpiGbl_DbTablePtr, &TableLength);
+ Status = AcpiDbReadTable (fp, Table, &TableLength);
fclose(fp);
if (ACPI_FAILURE (Status))
@@ -474,9 +425,10 @@ AcpiDbGetAcpiTable (
/*******************************************************************************
*
- * FUNCTION: AcpiDbLoadAcpiTable
+ * FUNCTION: AcpiDbGetTableFromFile
*
- * PARAMETERS: Filname - File where table is located
+ * PARAMETERS: Filename - File where table is located
+ * Table - Where a pointer to the table is returned
*
* RETURN: Status
*
@@ -485,14 +437,16 @@ AcpiDbGetAcpiTable (
******************************************************************************/
ACPI_STATUS
-AcpiDbLoadAcpiTable (
- NATIVE_CHAR *Filename)
+AcpiDbGetTableFromFile (
+ char *Filename,
+ ACPI_TABLE_HEADER **ReturnTable)
{
#ifdef ACPI_APPLICATION
ACPI_STATUS Status;
+ ACPI_TABLE_HEADER *Table;
- Status = AcpiDbGetAcpiTable (Filename);
+ Status = AcpiDbReadTableFromFile (Filename, &Table);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -500,13 +454,13 @@ AcpiDbLoadAcpiTable (
/* Attempt to recognize and install the table */
- Status = AeLocalLoadTable (AcpiGbl_DbTablePtr);
+ Status = AeLocalLoadTable (Table);
if (ACPI_FAILURE (Status))
{
if (Status == AE_ALREADY_EXISTS)
{
AcpiOsPrintf ("Table %4.4s is already installed\n",
- AcpiGbl_DbTablePtr->Signature);
+ Table->Signature);
}
else
{
@@ -518,14 +472,18 @@ AcpiDbLoadAcpiTable (
}
fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded\n",
- AcpiGbl_DbTablePtr->Signature);
+ Table->Signature);
AcpiGbl_AcpiHardwarePresent = FALSE;
+ if (ReturnTable)
+ {
+ *ReturnTable = Table;
+ }
+
#endif /* ACPI_APPLICATION */
return (AE_OK);
}
-
#endif /* ACPI_DEBUGGER */
OpenPOWER on IntegriCloud