From e031ab5da47b5f6c28c3cc5d576128b2d8d202e6 Mon Sep 17 00:00:00 2001 From: jkim Date: Thu, 22 Mar 2007 17:24:05 +0000 Subject: Vendor import of Intel ACPI-CA 20070320 --- sys/contrib/dev/acpica/utinit.c | 158 +++++----------------------------------- 1 file changed, 17 insertions(+), 141 deletions(-) (limited to 'sys/contrib/dev/acpica/utinit.c') diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utinit.c index f346eea..b16d542 100644 --- a/sys/contrib/dev/acpica/utinit.c +++ b/sys/contrib/dev/acpica/utinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utinit - Common ACPI subsystem initialization - * $Revision: 1.123 $ + * $Revision: 1.135 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. * All rights reserved. * * 2. License @@ -120,138 +120,17 @@ #include #include #include +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utinit") /* Local prototypes */ -static void -AcpiUtFadtRegisterError ( - char *RegisterName, - UINT32 Value, - ACPI_SIZE Offset); - static void AcpiUtTerminate ( void); -/******************************************************************************* - * - * FUNCTION: AcpiUtFadtRegisterError - * - * PARAMETERS: RegisterName - Pointer to string identifying register - * Value - Actual register contents value - * Offset - Byte offset in the FADT - * - * RETURN: AE_BAD_VALUE - * - * DESCRIPTION: Display failure message - * - ******************************************************************************/ - -static void -AcpiUtFadtRegisterError ( - char *RegisterName, - UINT32 Value, - ACPI_SIZE Offset) -{ - - ACPI_REPORT_WARNING ( - ("Invalid FADT value %s=%X at offset %X FADT=%p\n", - RegisterName, Value, (UINT32) Offset, AcpiGbl_FADT)); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiUtValidateFadt - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Validate various ACPI registers in the FADT - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtValidateFadt ( - void) -{ - - /* - * Verify Fixed ACPI Description Table fields, - * but don't abort on any problems, just display error - */ - if (AcpiGbl_FADT->Pm1EvtLen < 4) - { - AcpiUtFadtRegisterError ("PM1_EVT_LEN", - (UINT32) AcpiGbl_FADT->Pm1EvtLen, - ACPI_FADT_OFFSET (Pm1EvtLen)); - } - - if (!AcpiGbl_FADT->Pm1CntLen) - { - AcpiUtFadtRegisterError ("PM1_CNT_LEN", 0, - ACPI_FADT_OFFSET (Pm1CntLen)); - } - - if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address)) - { - AcpiUtFadtRegisterError ("X_PM1a_EVT_BLK", 0, - ACPI_FADT_OFFSET (XPm1aEvtBlk.Address)); - } - - if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aCntBlk.Address)) - { - AcpiUtFadtRegisterError ("X_PM1a_CNT_BLK", 0, - ACPI_FADT_OFFSET (XPm1aCntBlk.Address)); - } - - if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address)) - { - AcpiUtFadtRegisterError ("X_PM_TMR_BLK", 0, - ACPI_FADT_OFFSET (XPmTmrBlk.Address)); - } - - if ((ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address) && - !AcpiGbl_FADT->Pm2CntLen)) - { - AcpiUtFadtRegisterError ("PM2_CNT_LEN", - (UINT32) AcpiGbl_FADT->Pm2CntLen, - ACPI_FADT_OFFSET (Pm2CntLen)); - } - - if (AcpiGbl_FADT->PmTmLen < 4) - { - AcpiUtFadtRegisterError ("PM_TM_LEN", - (UINT32) AcpiGbl_FADT->PmTmLen, - ACPI_FADT_OFFSET (PmTmLen)); - } - - /* Length of GPE blocks must be a multiple of 2 */ - - if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) && - (AcpiGbl_FADT->Gpe0BlkLen & 1)) - { - AcpiUtFadtRegisterError ("(x)GPE0_BLK_LEN", - (UINT32) AcpiGbl_FADT->Gpe0BlkLen, - ACPI_FADT_OFFSET (Gpe0BlkLen)); - } - - if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) && - (AcpiGbl_FADT->Gpe1BlkLen & 1)) - { - AcpiUtFadtRegisterError ("(x)GPE1_BLK_LEN", - (UINT32) AcpiGbl_FADT->Gpe1BlkLen, - ACPI_FADT_OFFSET (Gpe1BlkLen)); - } - - return (AE_OK); -} - - /****************************************************************************** * * FUNCTION: AcpiUtTerminate @@ -274,10 +153,9 @@ AcpiUtTerminate ( ACPI_GPE_XRUPT_INFO *NextGpeXruptInfo; - ACPI_FUNCTION_TRACE ("UtTerminate"); + ACPI_FUNCTION_TRACE (UtTerminate); - /* Free global tables, etc. */ /* Free global GPE blocks and related info structures */ GpeXruptInfo = AcpiGbl_GpeXruptListHead; @@ -287,14 +165,14 @@ AcpiUtTerminate ( while (GpeBlock) { NextGpeBlock = GpeBlock->Next; - ACPI_MEM_FREE (GpeBlock->EventInfo); - ACPI_MEM_FREE (GpeBlock->RegisterInfo); - ACPI_MEM_FREE (GpeBlock); + ACPI_FREE (GpeBlock->EventInfo); + ACPI_FREE (GpeBlock->RegisterInfo); + ACPI_FREE (GpeBlock); GpeBlock = NextGpeBlock; } NextGpeXruptInfo = GpeXruptInfo->Next; - ACPI_MEM_FREE (GpeXruptInfo); + ACPI_FREE (GpeXruptInfo); GpeXruptInfo = NextGpeXruptInfo; } @@ -320,22 +198,23 @@ AcpiUtSubsystemShutdown ( void) { - ACPI_FUNCTION_TRACE ("UtSubsystemShutdown"); + ACPI_FUNCTION_TRACE (UtSubsystemShutdown); /* Just exit if subsystem is already shutdown */ if (AcpiGbl_Shutdown) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "ACPI Subsystem is already terminated\n")); + ACPI_ERROR ((AE_INFO, + "ACPI Subsystem is already terminated")); return_VOID; } /* Subsystem appears active, go ahead and shut it down */ AcpiGbl_Shutdown = TRUE; + AcpiGbl_StartupFlags = 0; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Shutting down ACPI Subsystem...\n")); + "Shutting down ACPI Subsystem\n")); /* Close the AcpiEvent Handling */ @@ -345,6 +224,10 @@ AcpiUtSubsystemShutdown ( AcpiNsTerminate (); + /* Delete the ACPI tables */ + + AcpiTbTerminate (); + /* Close the globals */ AcpiUtTerminate (); @@ -352,13 +235,6 @@ AcpiUtSubsystemShutdown ( /* Purge the local caches */ (void) AcpiUtDeleteCaches (); - - /* Debug only - display leftover memory allocation, if any */ - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL); -#endif - return_VOID; } -- cgit v1.1