summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/utglobal.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/utglobal.c')
-rw-r--r--sys/contrib/dev/acpica/utglobal.c255
1 files changed, 180 insertions, 75 deletions
diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c
index b83d288..03321fd 100644
--- a/sys/contrib/dev/acpica/utglobal.c
+++ b/sys/contrib/dev/acpica/utglobal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
- * $Revision: 1.249 $
+ * $Revision: 202 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,14 +120,98 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acnamesp.h>
-ACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
-
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utglobal")
/*******************************************************************************
*
+ * FUNCTION: AcpiFormatException
+ *
+ * PARAMETERS: Status - The ACPI_STATUS code to be formatted
+ *
+ * RETURN: A string containing the exception text. A valid pointer is
+ * always returned.
+ *
+ * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
+ *
+ ******************************************************************************/
+
+const char *
+AcpiFormatException (
+ ACPI_STATUS Status)
+{
+ ACPI_STATUS SubStatus;
+ const char *Exception = NULL;
+
+
+ ACPI_FUNCTION_NAME ("FormatException");
+
+
+ SubStatus = (Status & ~AE_CODE_MASK);
+
+ switch (Status & AE_CODE_MASK)
+ {
+ case AE_CODE_ENVIRONMENTAL:
+
+ if (SubStatus <= AE_CODE_ENV_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
+ }
+ break;
+
+ case AE_CODE_PROGRAMMER:
+
+ if (SubStatus <= AE_CODE_PGM_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
+ }
+ break;
+
+ case AE_CODE_ACPI_TABLES:
+
+ if (SubStatus <= AE_CODE_TBL_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
+ }
+ break;
+
+ case AE_CODE_AML:
+
+ if (SubStatus <= AE_CODE_AML_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
+ }
+ break;
+
+ case AE_CODE_CONTROL:
+
+ if (SubStatus <= AE_CODE_CTRL_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (!Exception)
+ {
+ /* Exception code was not recognized */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unknown exception code: 0x%8.8X\n", Status));
+
+ return ((const char *) "UNKNOWN_STATUS_CODE");
+ }
+
+ return ((const char *) Exception);
+}
+
+
+/*******************************************************************************
+ *
* Static global variable initialization.
*
******************************************************************************/
@@ -150,6 +234,7 @@ UINT32 AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT;
UINT32 AcpiGbl_NestingLevel = 0;
+
/* Debugger globals */
BOOLEAN AcpiGbl_DbTerminateThreads = FALSE;
@@ -164,6 +249,8 @@ UINT32 AcpiGbl_StartupFlags = 0;
BOOLEAN AcpiGbl_Shutdown = TRUE;
+const UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128};
+
const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] =
{
"\\_S0_",
@@ -182,46 +269,28 @@ const char *AcpiGbl_HighestDstateNames[4] =
"_S4D"
};
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiFormatException
- *
- * PARAMETERS: Status - The ACPI_STATUS code to be formatted
- *
- * RETURN: A string containing the exception text. A valid pointer is
- * always returned.
- *
- * DESCRIPTION: This function translates an ACPI exception into an ASCII string
- * It is here instead of utxface.c so it is always present.
- *
- ******************************************************************************/
-
-const char *
-AcpiFormatException (
- ACPI_STATUS Status)
+/*
+ * Strings supported by the _OSI predefined (internal) method.
+ * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS.
+ */
+const char *AcpiGbl_ValidOsiStrings[ACPI_NUM_OSI_STRINGS] =
{
- const char *Exception = NULL;
-
-
- ACPI_FUNCTION_ENTRY ();
+ /* Operating System Vendor Strings */
+ "Linux",
+ "Windows 2000",
+ "Windows 2001",
+ "Windows 2001.1",
+ "Windows 2001 SP0",
+ "Windows 2001 SP1",
+ "Windows 2001 SP2",
+ "Windows 2001 SP3",
+ "Windows 2001 SP4",
- Exception = AcpiUtValidateException (Status);
- if (!Exception)
- {
- /* Exception code was not recognized */
+ /* Feature Group Strings */
- ACPI_ERROR ((AE_INFO,
- "Unknown exception code: 0x%8.8X", Status));
-
- Exception = "UNKNOWN_STATUS_CODE";
- }
-
- return (ACPI_CAST_PTR (const char, Exception));
-}
-
-ACPI_EXPORT_SYMBOL (AcpiFormatException)
+ "Extended Address Space Descriptor"
+};
/*******************************************************************************
@@ -332,6 +401,35 @@ AcpiUtHexToAsciiChar (
}
+/*******************************************************************************
+ *
+ * Table name globals
+ *
+ * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
+ * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
+ * that are not used by the subsystem are simply ignored.
+ *
+ * Do NOT add any table to this list that is not consumed directly by this
+ * subsystem (No MADT, ECDT, SBST, etc.)
+ *
+ ******************************************************************************/
+
+ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES];
+
+ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES] =
+{
+ /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
+
+ /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
+ /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
+ /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE},
+ /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE},
+ /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
+ /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
+ /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
+};
+
+
/******************************************************************************
*
* Event and Hardware globals
@@ -395,6 +493,7 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
{
+/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
"SystemMemory",
"SystemIO",
"PCI_Config",
@@ -403,6 +502,7 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
"CMOS",
"PCIBARTarget",
"DataTable"
+/*! [End] no source code translation !*/
};
@@ -420,7 +520,7 @@ AcpiUtGetRegionName (
return ("InvalidSpaceId");
}
- return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId]));
+ return ((char *) (uintptr_t) AcpiGbl_RegionTypes[SpaceId]);
}
@@ -440,11 +540,13 @@ AcpiUtGetRegionName (
static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
{
+/*! [Begin] no source code translation (keep these strings as-is) */
"PM_Timer",
"GlobalLock",
"PowerButton",
"SleepButton",
"RealTimeClock",
+/*! [End] no source code translation !*/
};
@@ -458,7 +560,7 @@ AcpiUtGetEventName (
return ("InvalidEventID");
}
- return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId]));
+ return ((char *) (uintptr_t) AcpiGbl_EventTypes[EventId]);
}
@@ -488,6 +590,7 @@ static const char AcpiGbl_BadType[] = "UNDEFINED";
static const char *AcpiGbl_NsTypeNames[] =
{
+/*! [Begin] no source code translation (keep these strings as-is) */
/* 00 */ "Untyped",
/* 01 */ "Integer",
/* 02 */ "String",
@@ -519,6 +622,7 @@ static const char *AcpiGbl_NsTypeNames[] =
/* 28 */ "Extra",
/* 29 */ "Data",
/* 30 */ "Invalid"
+/*! [End] no source code translation !*/
};
@@ -529,10 +633,10 @@ AcpiUtGetTypeName (
if (Type > ACPI_TYPE_INVALID)
{
- return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
+ return ((char *) (uintptr_t) AcpiGbl_BadType);
}
- return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type]));
+ return ((char *) (uintptr_t) AcpiGbl_NsTypeNames[Type]);
}
@@ -586,16 +690,16 @@ AcpiUtGetNodeName (
/* Descriptor must be a namespace node */
- if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
+ if (Node->Descriptor != ACPI_DESC_TYPE_NAMED)
{
return ("####");
}
/* Name must be a valid ACPI name */
- if (!AcpiUtValidAcpiName (Node->Name.Integer))
+ if (!AcpiUtValidAcpiName (* (UINT32 *) Node->Name.Ascii))
{
- Node->Name.Integer = AcpiUtRepairName (Node->Name.Ascii);
+ return ("????");
}
/* Return the name */
@@ -620,6 +724,7 @@ AcpiUtGetNodeName (
static const char *AcpiGbl_DescTypeNames[] =
{
+/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
/* 00 */ "Invalid",
/* 01 */ "Cached",
/* 02 */ "State-Generic",
@@ -636,6 +741,7 @@ static const char *AcpiGbl_DescTypeNames[] =
/* 13 */ "Parser",
/* 14 */ "Operand",
/* 15 */ "Node"
+/*! [End] no source code translation !*/
};
@@ -651,11 +757,10 @@ AcpiUtGetDescriptorName (
if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX)
{
- return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
+ return ((char *) (uintptr_t) AcpiGbl_BadType);
}
- return (ACPI_CAST_PTR (char,
- AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]));
+ return ((char *) (uintptr_t) AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]);
}
@@ -683,7 +788,7 @@ AcpiUtGetMutexName (
UINT32 MutexId)
{
- if (MutexId > ACPI_MAX_MUTEX)
+ if (MutexId > MAX_MUTEX)
{
return ("Invalid Mutex ID");
}
@@ -742,7 +847,7 @@ AcpiUtInitGlobals (
UINT32 i;
- ACPI_FUNCTION_TRACE (UtInitGlobals);
+ ACPI_FUNCTION_TRACE ("UtInitGlobals");
/* Create all memory caches */
@@ -753,24 +858,25 @@ AcpiUtInitGlobals (
return;
}
+ /* ACPI table structure */
+
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ {
+ AcpiGbl_TableLists[i].Next = NULL;
+ AcpiGbl_TableLists[i].Count = 0;
+ }
+
/* Mutex locked flags */
- for (i = 0; i < ACPI_NUM_MUTEX; i++)
+ for (i = 0; i < NUM_MUTEX; i++)
{
AcpiGbl_MutexInfo[i].Mutex = NULL;
AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
AcpiGbl_MutexInfo[i].UseCount = 0;
}
- for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)
- {
- AcpiGbl_OwnerIdMask[i] = 0;
- }
- AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
-
/* GPE support */
- AcpiGpeCount = 0;
AcpiGbl_GpeXruptListHead = NULL;
AcpiGbl_GpeFadtBlocks[0] = NULL;
AcpiGbl_GpeFadtBlocks[1] = NULL;
@@ -782,23 +888,31 @@ AcpiUtInitGlobals (
AcpiGbl_ExceptionHandler = NULL;
AcpiGbl_InitHandler = NULL;
+ /* Global "typed" ACPI table pointers */
+
+ AcpiGbl_RSDP = NULL;
+ AcpiGbl_XSDT = NULL;
+ AcpiGbl_FACS = NULL;
+ AcpiGbl_FADT = NULL;
+ AcpiGbl_DSDT = NULL;
+
/* Global Lock support */
- AcpiGbl_GlobalLockSemaphore = NULL;
- AcpiGbl_GlobalLockMutex = NULL;
AcpiGbl_GlobalLockAcquired = FALSE;
+ AcpiGbl_GlobalLockThreadCount = 0;
AcpiGbl_GlobalLockHandle = 0;
/* Miscellaneous variables */
+ AcpiGbl_TableFlags = ACPI_PHYSICAL_POINTER;
+ AcpiGbl_RsdpOriginalLocation = 0;
AcpiGbl_CmSingleStep = FALSE;
AcpiGbl_DbTerminateThreads = FALSE;
AcpiGbl_Shutdown = FALSE;
AcpiGbl_NsLookupCount = 0;
AcpiGbl_PsFindCount = 0;
AcpiGbl_AcpiHardwarePresent = TRUE;
- AcpiGbl_LastOwnerIdIndex = 0;
- AcpiGbl_NextOwnerIdOffset = 0;
+ AcpiGbl_OwnerIdMask = 0;
AcpiGbl_TraceMethodName = 0;
AcpiGbl_TraceDbgLevel = 0;
AcpiGbl_TraceDbgLayer = 0;
@@ -813,8 +927,9 @@ AcpiUtInitGlobals (
/* Namespace */
AcpiGbl_RootNode = NULL;
+
AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
- AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
+ AcpiGbl_RootNodeStruct.Descriptor = ACPI_DESC_TYPE_NAMED;
AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
AcpiGbl_RootNodeStruct.Child = NULL;
AcpiGbl_RootNodeStruct.Peer = NULL;
@@ -826,17 +941,7 @@ AcpiUtInitGlobals (
AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX;
#endif
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- AcpiGbl_DisplayFinalMemStats = FALSE;
-#endif
-
return_VOID;
}
-/* Public globals */
-
-ACPI_EXPORT_SYMBOL (AcpiDbgLevel)
-ACPI_EXPORT_SYMBOL (AcpiDbgLayer)
-ACPI_EXPORT_SYMBOL (AcpiGpeCount)
-
OpenPOWER on IntegriCloud