diff options
Diffstat (limited to 'sys/contrib/dev/acpica/tbxface.c')
-rw-r--r-- | sys/contrib/dev/acpica/tbxface.c | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tbxface.c index 025eada..b4bb3fe 100644 --- a/sys/contrib/dev/acpica/tbxface.c +++ b/sys/contrib/dev/acpica/tbxface.c @@ -2,7 +2,7 @@ * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces - * $Revision: 64 $ + * $Revision: 1.70 $ * *****************************************************************************/ @@ -10,7 +10,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 @@ -140,7 +140,8 @@ ******************************************************************************/ ACPI_STATUS -AcpiLoadTables (void) +AcpiLoadTables ( + void) { ACPI_POINTER RsdpAddress; ACPI_STATUS Status; @@ -156,7 +157,7 @@ AcpiLoadTables (void) if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("AcpiLoadTables: Could not get RSDP, %s\n", - AcpiFormatException (Status))); + AcpiFormatException (Status))); goto ErrorExit; } @@ -168,7 +169,7 @@ AcpiLoadTables (void) if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("AcpiLoadTables: RSDP Failed validation: %s\n", - AcpiFormatException (Status))); + AcpiFormatException (Status))); goto ErrorExit; } @@ -178,7 +179,7 @@ AcpiLoadTables (void) if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n", - AcpiFormatException (Status))); + AcpiFormatException (Status))); goto ErrorExit; } @@ -187,21 +188,21 @@ AcpiLoadTables (void) Status = AcpiTbGetRequiredTables (); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n", - AcpiFormatException (Status))); + ACPI_REPORT_ERROR (( + "AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n", + AcpiFormatException (Status))); goto ErrorExit; } ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); - /* Load the namespace from the tables */ Status = AcpiNsLoadNamespace (); if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load namespace: %s\n", - AcpiFormatException (Status))); + AcpiFormatException (Status))); goto ErrorExit; } @@ -260,11 +261,26 @@ AcpiLoadTable ( return_ACPI_STATUS (Status); } + /* Check signature for a valid table type */ + + Status = AcpiTbRecognizeTable (&TableInfo, ACPI_TABLE_ALL); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Install the new table into the local data structures */ Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { + if (Status == AE_ALREADY_EXISTS) + { + /* Table already exists, no error */ + + Status = AE_OK; + } + /* Free table allocated by AcpiTbGetTableBody */ AcpiTbDeleteSingleTable (&TableInfo); @@ -332,7 +348,6 @@ AcpiUnloadTable ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Find all tables of the requested type */ TableDesc = AcpiGbl_TableLists[TableType].Next; @@ -344,8 +359,8 @@ AcpiUnloadTable ( * "Scope" operator. Thus, we need to track ownership by an ID, not * simply a position within the hierarchy */ - AcpiNsDeleteNamespaceByOwner (TableDesc->TableId); - + AcpiNsDeleteNamespaceByOwner (TableDesc->OwnerId); + AcpiUtReleaseOwnerId (&TableDesc->OwnerId); TableDesc = TableDesc->Next; } @@ -406,7 +421,6 @@ AcpiGetTableHeader ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Get a pointer to the entire table */ Status = AcpiTbGetTablePtr (TableType, Instance, &TblPtr); @@ -415,19 +429,17 @@ AcpiGetTableHeader ( return_ACPI_STATUS (Status); } - /* - * The function will return a NULL pointer if the table is not loaded - */ + /* The function will return a NULL pointer if the table is not loaded */ + if (TblPtr == NULL) { return_ACPI_STATUS (AE_NOT_EXIST); } - /* - * Copy the header to the caller's buffer - */ + /* Copy the header to the caller's buffer */ + ACPI_MEMCPY ((void *) OutTableHeader, (void *) TblPtr, - sizeof (ACPI_TABLE_HEADER)); + sizeof (ACPI_TABLE_HEADER)); return_ACPI_STATUS (Status); } @@ -492,7 +504,6 @@ AcpiGetTable ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Get a pointer to the entire table */ Status = AcpiTbGetTablePtr (TableType, Instance, &TblPtr); @@ -514,9 +525,8 @@ AcpiGetTable ( if (TableType == ACPI_TABLE_RSDP) { - /* - * RSD PTR is the only "table" without a header - */ + /* RSD PTR is the only "table" without a header */ + TableLength = sizeof (RSDP_DESCRIPTOR); } else |