From 046b3446b71923e3d33cdbce1edf6769ea8c0371 Mon Sep 17 00:00:00 2001 From: aystarik Date: Wed, 29 Jun 2005 18:18:17 +0000 Subject: [PATCH] Added 2003 copyright to the legal header date 2003.01.06.17.32.00; author rmoore1; state Exp; --- source/components/namespace/nsaccess.c | 4 +- source/components/namespace/nsalloc.c | 4 +- source/components/namespace/nsdump.c | 138 +-- source/components/namespace/nsdumpdv.c | 220 ++++ source/components/namespace/nseval.c | 45 +- source/components/namespace/nsinit.c | 92 +- source/components/namespace/nsload.c | 238 ++--- source/components/namespace/nsnames.c | 24 +- source/components/namespace/nsobject.c | 84 +- source/components/namespace/nsparse.c | 250 +++++ source/components/namespace/nssearch.c | 100 +- source/components/namespace/nsutils.c | 262 +++-- source/components/namespace/nswalk.c | 4 +- source/components/namespace/nsxfeval.c | 870 ++++++++++++++++ source/components/namespace/nsxfname.c | 8 +- source/components/namespace/nsxfobj.c | 736 +------------ source/components/resources/rsaddr.c | 67 +- source/components/resources/rscalc.c | 64 +- source/components/resources/rscreate.c | 182 ++-- source/components/resources/rsdump.c | 43 +- source/components/resources/rsio.c | 35 +- source/components/resources/rsirq.c | 52 +- source/components/resources/rslist.c | 35 +- source/components/resources/rsmemory.c | 22 +- source/components/resources/rsmisc.c | 28 +- source/components/resources/rsutils.c | 106 +- source/components/resources/rsxface.c | 6 +- source/components/tables/tbinstal.c | 124 +-- source/components/tables/tbutils.c | 112 +- source/components/tables/tbxface.c | 42 +- source/components/tables/tbxfroot.c | 162 +-- source/components/utilities/utalloc.c | 163 +-- source/components/utilities/utclib.c | 127 +-- source/components/utilities/utcopy.c | 230 +++-- source/components/utilities/utdebug.c | 45 +- source/components/utilities/utdelete.c | 118 ++- source/components/utilities/uteval.c | 381 +++---- source/components/utilities/utglobal.c | 345 +++---- source/components/utilities/utinit.c | 28 +- source/components/utilities/utmath.c | 10 +- source/components/utilities/utmisc.c | 556 +++++++--- source/components/utilities/utobject.c | 159 ++- source/components/utilities/utxface.c | 90 +- source/include/acapps.h | 190 ++++ source/include/acconfig.h | 280 +++++ source/include/acdebug.h | 524 ++++++++++ source/include/acdisasm.h | 452 ++++++++ source/include/acdispat.h | 586 +++++++++++ source/include/acevents.h | 313 ++++++ source/include/acexcep.h | 375 +++++++ source/include/acglobal.h | 390 +++++++ source/include/achware.h | 246 +++++ source/include/acinterp.h | 809 +++++++++++++++ source/include/aclocal.h | 1088 ++++++++++++++++++++ source/include/acmacros.h | 670 ++++++++++++ source/include/acnamesp.h | 581 +++++++++++ source/include/acobject.h | 591 +++++++++++ source/include/acoutput.h | 258 +++++ source/include/acparser.h | 420 ++++++++ source/include/acpi.h | 142 +++ source/include/acpiosxf.h | 413 ++++++++ source/include/acpixf.h | 478 +++++++++ source/include/acresrc.h | 459 +++++++++ source/include/acstruct.h | 281 +++++ source/include/actables.h | 310 ++++++ source/include/actbl.h | 308 ++++++ source/include/actbl1.h | 211 ++++ source/include/actbl2.h | 277 +++++ source/include/actypes.h | 1317 ++++++++++++++++++++++++ source/include/acutils.h | 908 ++++++++++++++++ source/include/amlcode.h | 569 ++++++++++ source/include/amlresrc.h | 423 ++++++++ source/include/platform/acefi.h | 150 +++ source/include/platform/acenv.h | 436 ++++++++ source/include/platform/acfreebsd.h | 200 ++++ source/include/platform/acgcc.h | 132 +++ source/include/platform/acintel.h | 176 ++++ source/include/platform/aclinux.h | 164 +++ source/include/platform/acmsvc.h | 194 ++++ source/include/platform/acwin.h | 194 ++++ source/include/platform/acwin64.h | 165 +++ 81 files changed, 19278 insertions(+), 2813 deletions(-) create mode 100644 source/components/namespace/nsdumpdv.c create mode 100644 source/components/namespace/nsparse.c create mode 100644 source/components/namespace/nsxfeval.c create mode 100644 source/include/acapps.h create mode 100644 source/include/acconfig.h create mode 100644 source/include/acdebug.h create mode 100644 source/include/acdisasm.h create mode 100644 source/include/acdispat.h create mode 100644 source/include/acevents.h create mode 100644 source/include/acexcep.h create mode 100644 source/include/acglobal.h create mode 100644 source/include/achware.h create mode 100644 source/include/acinterp.h create mode 100644 source/include/aclocal.h create mode 100644 source/include/acmacros.h create mode 100644 source/include/acnamesp.h create mode 100644 source/include/acobject.h create mode 100644 source/include/acoutput.h create mode 100644 source/include/acparser.h create mode 100644 source/include/acpi.h create mode 100644 source/include/acpiosxf.h create mode 100644 source/include/acpixf.h create mode 100644 source/include/acresrc.h create mode 100644 source/include/acstruct.h create mode 100644 source/include/actables.h create mode 100644 source/include/actbl.h create mode 100644 source/include/actbl1.h create mode 100644 source/include/actbl2.h create mode 100644 source/include/actypes.h create mode 100644 source/include/acutils.h create mode 100644 source/include/amlcode.h create mode 100644 source/include/amlresrc.h create mode 100644 source/include/platform/acefi.h create mode 100644 source/include/platform/acenv.h create mode 100644 source/include/platform/acfreebsd.h create mode 100644 source/include/platform/acgcc.h create mode 100644 source/include/platform/acintel.h create mode 100644 source/include/platform/aclinux.h create mode 100644 source/include/platform/acmsvc.h create mode 100644 source/include/platform/acwin.h create mode 100644 source/include/platform/acwin64.h diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index 088c44a9f..59629f1df 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 1.167 $ + * $Revision: 1.168 $ * ******************************************************************************/ @@ -9,7 +9,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 diff --git a/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c index b33692e16..745cb8940 100644 --- a/source/components/namespace/nsalloc.c +++ b/source/components/namespace/nsalloc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities - * $Revision: 1.78 $ + * $Revision: 1.79 $ * ******************************************************************************/ @@ -9,7 +9,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 diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c index 79ee5d419..edd3f3235 100644 --- a/source/components/namespace/nsdump.c +++ b/source/components/namespace/nsdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 1.142 $ + * $Revision: 1.151 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -186,16 +186,13 @@ AcpiNsPrintPathname ( * ******************************************************************************/ -ACPI_STATUS +void AcpiNsDumpPathname ( ACPI_HANDLE Handle, - NATIVE_CHAR *Msg, + char *Msg, UINT32 Level, UINT32 Component) { - ACPI_BUFFER Buffer; - ACPI_STATUS Status; - ACPI_FUNCTION_TRACE ("NsDumpPathname"); @@ -204,21 +201,14 @@ AcpiNsDumpPathname ( if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component)) { - return_ACPI_STATUS (AE_OK); + return_VOID; } /* Convert handle to a full pathname and print it (with supplied message) */ - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - - Status = AcpiNsHandleToPathname (Handle, &Buffer); - if (ACPI_SUCCESS (Status)) - { - AcpiOsPrintf ("%s %s (Node %p)\n", Msg, (char *) Buffer.Pointer, Handle); - ACPI_MEM_FREE (Buffer.Pointer); - } - - return_ACPI_STATUS (Status); + AcpiNsPrintNodePathname (Handle, Msg); + AcpiOsPrintf ("\n"); + return_VOID; } @@ -248,22 +238,14 @@ AcpiNsDumpOneObject ( ACPI_OBJECT_TYPE ObjType; ACPI_OBJECT_TYPE Type; UINT32 BytesToDump; - UINT32 DownstreamSiblingMask = 0; - UINT32 LevelTmp; - UINT32 WhichBit; - UINT32 i; UINT32 DbgLevel; + UINT32 i; ACPI_FUNCTION_NAME ("NsDumpOneObject"); - ThisNode = AcpiNsMapHandleToNode (ObjHandle); - - LevelTmp = Level; - Type = ThisNode->Type; - WhichBit = 1; - + /* Is output enabled? */ if (!(AcpiDbgLevel & Info->DebugLevel)) { @@ -276,6 +258,9 @@ AcpiNsDumpOneObject ( return (AE_OK); } + ThisNode = AcpiNsMapHandleToNode (ObjHandle); + Type = ThisNode->Type; + /* Check if the owner matches */ if ((Info->OwnerId != ACPI_UINT32_MAX) && @@ -286,52 +271,9 @@ AcpiNsDumpOneObject ( /* Indent the object according to the level */ - while (LevelTmp--) - { - /* Print appropriate characters to form tree structure */ + AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " "); - if (LevelTmp) - { - if (DownstreamSiblingMask & WhichBit) - { - AcpiOsPrintf ("|"); - } - else - { - AcpiOsPrintf (" "); - } - - WhichBit <<= 1; - } - else - { - if (AcpiNsExistDownstreamSibling (ThisNode + 1)) - { - DownstreamSiblingMask |= ((UINT32) 1 << (Level - 1)); - AcpiOsPrintf ("+"); - } - else - { - DownstreamSiblingMask &= ACPI_UINT32_MAX ^ ((UINT32) 1 << (Level - 1)); - AcpiOsPrintf ("+"); - } - - if (ThisNode->Child == NULL) - { - AcpiOsPrintf ("-"); - } - else if (AcpiNsExistDownstreamSibling (ThisNode->Child)) - { - AcpiOsPrintf ("+"); - } - else - { - AcpiOsPrintf ("-"); - } - } - } - - /* Check the integrity of our data */ + /* Check the node type and name */ if (Type > ACPI_TYPE_LOCAL_MAX) { @@ -346,7 +288,7 @@ AcpiNsDumpOneObject ( /* * Now we can print out the pertinent information */ - AcpiOsPrintf (" %4.4s %-12s %p", + AcpiOsPrintf ("%4.4s %-12s %p ", ThisNode->Name.Ascii, AcpiUtGetTypeName (Type), ThisNode); DbgLevel = AcpiDbgLevel; @@ -370,7 +312,7 @@ AcpiNsDumpOneObject ( { case ACPI_TYPE_PROCESSOR: - AcpiOsPrintf (" ID %X Len %.4X Addr %p\n", + AcpiOsPrintf ("ID %X Len %.4X Addr %p\n", ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, (char *) ObjDesc->Processor.Address); @@ -379,13 +321,13 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_DEVICE: - AcpiOsPrintf (" Notification object: %p", ObjDesc); + AcpiOsPrintf ("Notify object: %p", ObjDesc); break; case ACPI_TYPE_METHOD: - AcpiOsPrintf (" Args %X Len %.4X Aml %p\n", + AcpiOsPrintf ("Args %X Len %.4X Aml %p\n", (UINT32) ObjDesc->Method.ParamCount, ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); @@ -394,7 +336,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_INTEGER: - AcpiOsPrintf (" = %8.8X%8.8X\n", + AcpiOsPrintf ("= %8.8X%8.8X\n", ACPI_HIDWORD (ObjDesc->Integer.Value), ACPI_LODWORD (ObjDesc->Integer.Value)); break; @@ -404,12 +346,12 @@ AcpiNsDumpOneObject ( if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { - AcpiOsPrintf (" Elements %.2X\n", + AcpiOsPrintf ("Elements %.2X\n", ObjDesc->Package.Count); } else { - AcpiOsPrintf (" [Length not yet evaluated]\n"); + AcpiOsPrintf ("[Length not yet evaluated]\n"); } break; @@ -418,7 +360,7 @@ AcpiNsDumpOneObject ( if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { - AcpiOsPrintf (" Len %.2X", + AcpiOsPrintf ("Len %.2X", ObjDesc->Buffer.Length); /* Dump some of the buffer */ @@ -435,30 +377,22 @@ AcpiNsDumpOneObject ( } else { - AcpiOsPrintf (" [Length not yet evaluated]\n"); + AcpiOsPrintf ("[Length not yet evaluated]\n"); } break; case ACPI_TYPE_STRING: - AcpiOsPrintf (" Len %.2X", ObjDesc->String.Length); - - if (ObjDesc->String.Length > 0) - { - AcpiOsPrintf (" = \"%.32s\"", ObjDesc->String.Pointer); - if (ObjDesc->String.Length > 32) - { - AcpiOsPrintf ("..."); - } - } + AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); + AcpiUtPrintString (ObjDesc->String.Pointer, 32); AcpiOsPrintf ("\n"); break; case ACPI_TYPE_REGION: - AcpiOsPrintf (" [%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); + AcpiOsPrintf ("[%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", @@ -475,7 +409,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf (" [%s]\n", + AcpiOsPrintf ("[%s]\n", AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)); break; @@ -485,7 +419,7 @@ AcpiNsDumpOneObject ( if (ObjDesc->BufferField.BufferObj && ObjDesc->BufferField.BufferObj->Buffer.Node) { - AcpiOsPrintf (" Buf [%4.4s]", + AcpiOsPrintf ("Buf [%4.4s]", ObjDesc->BufferField.BufferObj->Buffer.Node->Name.Ascii); } break; @@ -493,14 +427,14 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_LOCAL_REGION_FIELD: - AcpiOsPrintf (" Rgn [%4.4s]", + AcpiOsPrintf ("Rgn [%4.4s]", ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii); break; case ACPI_TYPE_LOCAL_BANK_FIELD: - AcpiOsPrintf (" Rgn [%4.4s] Bnk [%4.4s]", + AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii, ObjDesc->BankField.BankObj->CommonField.Node->Name.Ascii); break; @@ -508,7 +442,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_LOCAL_INDEX_FIELD: - AcpiOsPrintf (" Idx [%4.4s] Dat [%4.4s]", + AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", ObjDesc->IndexField.IndexObj->CommonField.Node->Name.Ascii, ObjDesc->IndexField.DataObj->CommonField.Node->Name.Ascii); break; @@ -516,12 +450,12 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_LOCAL_ALIAS: - AcpiOsPrintf (" Target %4.4s (%p)\n", ((ACPI_NAMESPACE_NODE *) ObjDesc)->Name.Ascii, ObjDesc); + AcpiOsPrintf ("Target %4.4s (%p)\n", ((ACPI_NAMESPACE_NODE *) ObjDesc)->Name.Ascii, ObjDesc); break; default: - AcpiOsPrintf (" Object %p\n", ObjDesc); + AcpiOsPrintf ("Object %p\n", ObjDesc); break; } @@ -549,9 +483,7 @@ AcpiNsDumpOneObject ( case ACPI_DISPLAY_OBJECTS: - AcpiOsPrintf ("%p O:%p", - ThisNode, ObjDesc); - + AcpiOsPrintf ("O:%p", ObjDesc); if (!ObjDesc) { /* No attached object, we are done */ diff --git a/source/components/namespace/nsdumpdv.c b/source/components/namespace/nsdumpdv.c new file mode 100644 index 000000000..8450d7ee9 --- /dev/null +++ b/source/components/namespace/nsdumpdv.c @@ -0,0 +1,220 @@ +/****************************************************************************** + * + * Module Name: nsdump - table dumping routines for debug + * $Revision: 1.5 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __NSDUMPDV_C__ + +#include "acpi.h" +#include "acnamesp.h" + + +#define _COMPONENT ACPI_NAMESPACE + ACPI_MODULE_NAME ("nsdumpdv") + + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + +/******************************************************************************* + * + * FUNCTION: AcpiNsDumpOneDevice + * + * PARAMETERS: Handle - Node to be dumped + * Level - Nesting level of the handle + * Context - Passed into WalkNamespace + * + * DESCRIPTION: Dump a single Node that represents a device + * This procedure is a UserFunction called by AcpiNsWalkNamespace. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsDumpOneDevice ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) +{ + ACPI_DEVICE_INFO Info; + ACPI_STATUS Status; + UINT32 i; + + + ACPI_FUNCTION_NAME ("NsDumpOneDevice"); + + + Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue); + + Status = AcpiGetObjectInfo (ObjHandle, &Info); + if (ACPI_SUCCESS (Status)) + { + for (i = 0; i < Level; i++) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); + } + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", + Info.HardwareId, + ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address), + Info.CurrentStatus)); + } + + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsDumpRootDevices + * + * PARAMETERS: None + * + * DESCRIPTION: Dump all objects of type "device" + * + ******************************************************************************/ + +void +AcpiNsDumpRootDevices (void) +{ + ACPI_HANDLE SysBusHandle; + ACPI_STATUS Status; + + + ACPI_FUNCTION_NAME ("NsDumpRootDevices"); + + + /* Only dump the table if tracing is enabled */ + + if (!(ACPI_LV_TABLES & AcpiDbgLevel)) + { + return; + } + + Status = AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle); + if (ACPI_FAILURE (Status)) + { + return; + } + + ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n")); + + Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, + ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, + AcpiNsDumpOneDevice, NULL, NULL); +} + +#endif + + diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index 749b5adf8..3f6947621 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -2,7 +2,7 @@ * * Module Name: nseval - Object evaluation interfaces -- includes control * method lookup and execution. - * $Revision: 1.113 $ + * $Revision: 1.121 $ * ******************************************************************************/ @@ -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 @@ -133,12 +133,12 @@ * FUNCTION: AcpiNsEvaluateRelative * * PARAMETERS: Handle - The relative containing object - * *Pathname - Name of method to execute, If NULL, the + * Pathname - Name of method to execute, If NULL, the * handle is the object to execute - * **Params - List of parameters to pass to the method, + * Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. - * *ReturnObject - Where to put method's return value (if + * ReturnObject - Where to put method's return value (if * any). If NULL, no value is returned. * * RETURN: Status @@ -153,14 +153,14 @@ ACPI_STATUS AcpiNsEvaluateRelative ( ACPI_NAMESPACE_NODE *Handle, - NATIVE_CHAR *Pathname, + char *Pathname, ACPI_OPERAND_OBJECT **Params, ACPI_OPERAND_OBJECT **ReturnObject) { ACPI_NAMESPACE_NODE *PrefixNode; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node = NULL; - NATIVE_CHAR *InternalPath = NULL; + char *InternalPath = NULL; ACPI_GENERIC_STATE ScopeInfo; @@ -239,9 +239,9 @@ Cleanup: * FUNCTION: AcpiNsEvaluateByName * * PARAMETERS: Pathname - Fully qualified pathname to the object - * *ReturnObject - Where to put method's return value (if + * ReturnObject - Where to put method's return value (if * any). If NULL, no value is returned. - * **Params - List of parameters to pass to the method, + * Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. * @@ -256,13 +256,13 @@ Cleanup: ACPI_STATUS AcpiNsEvaluateByName ( - NATIVE_CHAR *Pathname, + char *Pathname, ACPI_OPERAND_OBJECT **Params, ACPI_OPERAND_OBJECT **ReturnObject) { ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node = NULL; - NATIVE_CHAR *InternalPath = NULL; + char *InternalPath = NULL; ACPI_FUNCTION_TRACE ("NsEvaluateByName"); @@ -328,10 +328,10 @@ Cleanup: * FUNCTION: AcpiNsEvaluateByHandle * * PARAMETERS: Handle - Method Node to execute - * **Params - List of parameters to pass to the method, + * Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. - * *ReturnObject - Where to put method's return value (if + * ReturnObject - Where to put method's return value (if * any). If NULL, no value is returned. * * RETURN: Status @@ -392,7 +392,6 @@ AcpiNsEvaluateByHandle ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* * Two major cases here: * 1) The object is an actual control method -- execute it. @@ -410,7 +409,6 @@ AcpiNsEvaluateByHandle ( Status = AcpiNsExecuteControlMethod (Node, Params, &LocalReturnObject); } - else { /* @@ -420,7 +418,6 @@ AcpiNsEvaluateByHandle ( Status = AcpiNsGetObjectValue (Node, &LocalReturnObject); } - /* * Check if there is a return value on the stack that must * be dealt with @@ -459,11 +456,11 @@ AcpiNsEvaluateByHandle ( * * FUNCTION: AcpiNsExecuteControlMethod * - * PARAMETERS: MethodNode - The object/method - * **Params - List of parameters to pass to the method, + * PARAMETERS: MethodNode - The method to execute + * Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. - * **ReturnObjDesc - List of result objects to be returned + * ReturnObjDesc - List of result objects to be returned * from the method. * * RETURN: Status @@ -498,10 +495,10 @@ AcpiNsExecuteControlMethod ( return_ACPI_STATUS (AE_NULL_OBJECT); } - ACPI_DUMP_PATHNAME (MethodNode, "NsExecuteControlMethod: Executing", + ACPI_DUMP_PATHNAME (MethodNode, "Execute Method:", ACPI_LV_INFO, _COMPONENT); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %x\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", ObjDesc->Method.AmlStart + 1, ObjDesc->Method.AmlLength - 1)); /* @@ -538,7 +535,8 @@ AcpiNsExecuteControlMethod ( * * FUNCTION: AcpiNsGetObjectValue * - * PARAMETERS: Node - The object + * PARAMETERS: Node - The object + * ReturnObjDesc - Where the objects value is returned * * RETURN: Status * @@ -604,7 +602,8 @@ AcpiNsGetObjectValue ( { Status = AE_CTRL_RETURN_VALUE; *ReturnObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ResolvedNode); - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning obj %p\n", ResolvedNode)); + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n", + *ReturnObjDesc, AcpiUtGetObjectTypeName (*ReturnObjDesc))); } } diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index 3c13867b7..3fd4cda2c 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsinit - namespace initialization - * $Revision: 1.44 $ + * $Revision: 1.55 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -152,7 +152,7 @@ AcpiNsInitializeObjects ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Completing Region/Field/Buffer/Package initialization:")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Completing Region/Field/Buffer/Package initialization:")); /* Set all init info to zero */ @@ -165,19 +165,21 @@ AcpiNsInitializeObjects ( &Info, NULL); if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %x\n", Status)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n", + AcpiFormatException (Status))); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - "\n Initialized %d/%d Regions %d/%d Fields %d/%d Buffers %d/%d Packages (%d nodes)\n", - Info.OpRegionInit, Info.OpRegionCount, - Info.FieldInit, Info.FieldCount, - Info.BufferInit, Info.BufferCount, + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n", + Info.OpRegionInit, Info.OpRegionCount, + Info.FieldInit, Info.FieldCount, + Info.BufferInit, Info.BufferCount, Info.PackageInit, Info.PackageCount, Info.ObjectCount)); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%d Control Methods found\n", Info.MethodCount)); + "%hd Control Methods found\n", Info.MethodCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%d Op Regions found\n", Info.OpRegionCount)); + "%hd Op Regions found\n", Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } @@ -216,7 +218,7 @@ AcpiNsInitializeDevices ( Info.Num_STA = 0; Info.Num_INI = 0; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Executing all Device _STA and_INI methods:")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Executing all Device _STA and_INI methods:")); /* Walk namespace for all objects of type Device */ @@ -225,11 +227,12 @@ AcpiNsInitializeDevices ( if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %x\n", Status)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n", + AcpiFormatException (Status))); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - "\n%d Devices found containing: %d _STA, %d _INI methods\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n", Info.DeviceCount, Info.Num_STA, Info.Num_INI)); return_ACPI_STATUS (Status); @@ -329,7 +332,7 @@ AcpiNsInitOneObject ( /* * Each of these types can contain executable AML code within - * the declaration. + * the declaration. */ switch (Type) { @@ -373,9 +376,11 @@ AcpiNsInitOneObject ( Node->Name.Ascii, AcpiUtGetTypeName (Type), AcpiFormatException (Status))); } - if (!(AcpiDbgLevel & ACPI_LV_INIT)) + /* Print a dot for each object unless we are going to print the entire pathname */ + + if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES)) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, ".")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); } /* @@ -417,9 +422,9 @@ AcpiNsInitOneDevice ( ACPI_FUNCTION_TRACE ("NsInitOneDevice"); - if (!(AcpiDbgLevel & ACPI_LV_INIT)) + if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) && (!(AcpiDbgLevel & ACPI_LV_INFO))) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, ".")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); } Info->DeviceCount++; @@ -446,7 +451,7 @@ AcpiNsInitOneDevice ( /* * Run _STA to determine if we can run _INI on the device. */ - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (Node, "_STA [Method]")); + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Node, "_STA")); Status = AcpiUtExecute_STA (Node, &Flags); if (ACPI_FAILURE (Status)) { @@ -467,29 +472,28 @@ AcpiNsInitOneDevice ( /* * The device is present. Run _INI. */ - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ObjHandle, "_INI [Method]")); + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, ObjHandle, "_INI")); Status = AcpiNsEvaluateRelative (ObjHandle, "_INI", NULL, NULL); - if (AE_NOT_FOUND == Status) + if (ACPI_FAILURE (Status)) { - /* No _INI means device requires no initialization */ + /* No _INI (AE_NOT_FOUND) means device requires no initialization */ + + if (Status != AE_NOT_FOUND) + { + /* Ignore error and move on to next device */ + + #ifdef ACPI_DEBUG_OUTPUT + char *ScopeName = AcpiNsGetExternalPathname (ObjHandle); + + ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n", + ScopeName, AcpiFormatException (Status))); + + ACPI_MEM_FREE (ScopeName); + #endif + } Status = AE_OK; } - - else if (ACPI_FAILURE (Status)) - { - /* Ignore error and move on to next device */ - -#ifdef ACPI_DEBUG - NATIVE_CHAR *ScopeName = AcpiNsGetExternalPathname (ObjHandle); - - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n", - ScopeName, AcpiFormatException (Status))); - - ACPI_MEM_FREE (ScopeName); -#endif - } - else { /* Count of successful INIs */ @@ -497,5 +501,13 @@ AcpiNsInitOneDevice ( Info->Num_INI++; } - return_ACPI_STATUS (AE_OK); + if (AcpiGbl_InitHandler) + { + /* External initialization handler is present, call it */ + + Status = AcpiGbl_InitHandler (ObjHandle, ACPI_INIT_DEVICE_INI); + } + + + return_ACPI_STATUS (Status); } diff --git a/source/components/namespace/nsload.c b/source/components/namespace/nsload.c index cb22b80f3..fb7b63209 100644 --- a/source/components/namespace/nsload.c +++ b/source/components/namespace/nsload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsload - namespace loading/expanding/contracting procedures - * $Revision: 1.55 $ + * $Revision: 1.63 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -118,8 +118,6 @@ #include "acpi.h" #include "acnamesp.h" -#include "amlcode.h" -#include "acparser.h" #include "acdispat.h" @@ -127,182 +125,7 @@ ACPI_MODULE_NAME ("nsload") -/******************************************************************************* - * - * FUNCTION: AcpiLoadNamespace - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Load the name space from what ever is pointed to by DSDT. - * (DSDT points to either the BIOS or a buffer.) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsLoadNamespace ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE ("AcpiLoadNameSpace"); - - - /* There must be at least a DSDT installed */ - - if (AcpiGbl_DSDT == NULL) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n")); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); - } - - /* - * Load the namespace. The DSDT is required, - * but the SSDT and PSDT tables are optional. - */ - Status = AcpiNsLoadTableByType (ACPI_TABLE_DSDT); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Ignore exceptions from these */ - - (void) AcpiNsLoadTableByType (ACPI_TABLE_SSDT); - (void) AcpiNsLoadTableByType (ACPI_TABLE_PSDT); - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - "ACPI Namespace successfully loaded at root %p\n", - AcpiGbl_RootNode)); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsOneParsePass - * - * PARAMETERS: PassNumber - 1 or 2 - * TableDesc - The table to be parsed. - * - * RETURN: Status - * - * DESCRIPTION: Perform one complete parse of an ACPI/AML table. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsOneCompleteParse ( - UINT32 PassNumber, - ACPI_TABLE_DESC *TableDesc) -{ - ACPI_PARSE_OBJECT *ParseRoot; - ACPI_STATUS Status; - ACPI_WALK_STATE *WalkState; - - - ACPI_FUNCTION_TRACE ("NsOneCompleteParse"); - - - /* Create and init a Root Node */ - - ParseRoot = AcpiPsAllocOp (AML_SCOPE_OP); - if (!ParseRoot) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ParseRoot->Named.Name = ACPI_ROOT_NAME; - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, - NULL, NULL, NULL); - if (!WalkState) - { - AcpiPsFreeOp (ParseRoot); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, TableDesc->AmlStart, - TableDesc->AmlLength, NULL, NULL, PassNumber); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - return_ACPI_STATUS (Status); - } - - /* Parse the AML */ - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber)); - Status = AcpiPsParseAml (WalkState); - - AcpiPsDeleteParseTree (ParseRoot); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsParseTable - * - * PARAMETERS: TableDesc - An ACPI table descriptor for table to parse - * StartNode - Where to enter the table into the namespace - * - * RETURN: Status - * - * DESCRIPTION: Parse AML within an ACPI table and return a tree of ops - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsParseTable ( - ACPI_TABLE_DESC *TableDesc, - ACPI_NAMESPACE_NODE *StartNode) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE ("NsParseTable"); - - - /* - * AML Parse, pass 1 - * - * In this pass, we load most of the namespace. Control methods - * are not parsed until later. A parse tree is not created. Instead, - * each Parser Op subtree is deleted when it is finished. This saves - * a great deal of memory, and allows a small cache of parse objects - * to service the entire parse. The second pass of the parse then - * performs another complete parse of the AML.. - */ - Status = AcpiNsOneCompleteParse (1, TableDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * AML Parse, pass 2 - * - * In this pass, we resolve forward references and other things - * that could not be completed during the first pass. - * Another complete parse of the AML is performed, but the - * overhead of this is compensated for by the fact that the - * parse objects are all cached. - */ - Status = AcpiNsOneCompleteParse (2, TableDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - return_ACPI_STATUS (Status); -} - +#ifndef ACPI_NO_METHOD_EXECUTION /******************************************************************************* * @@ -534,6 +357,60 @@ UnlockAndExit: } +/******************************************************************************* + * + * FUNCTION: AcpiLoadNamespace + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Load the name space from what ever is pointed to by DSDT. + * (DSDT points to either the BIOS or a buffer.) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsLoadNamespace ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE ("AcpiLoadNameSpace"); + + + /* There must be at least a DSDT installed */ + + if (AcpiGbl_DSDT == NULL) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n")); + return_ACPI_STATUS (AE_NO_ACPI_TABLES); + } + + /* + * Load the namespace. The DSDT is required, + * but the SSDT and PSDT tables are optional. + */ + Status = AcpiNsLoadTableByType (ACPI_TABLE_DSDT); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Ignore exceptions from these */ + + (void) AcpiNsLoadTableByType (ACPI_TABLE_SSDT); + (void) AcpiNsLoadTableByType (ACPI_TABLE_PSDT); + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + "ACPI Namespace successfully loaded at root %p\n", + AcpiGbl_RootNode)); + + return_ACPI_STATUS (Status); +} + + /******************************************************************************* * * FUNCTION: AcpiNsDeleteSubtree @@ -672,4 +549,5 @@ AcpiNsUnloadNamespace ( return_ACPI_STATUS (Status); } +#endif diff --git a/source/components/namespace/nsnames.c b/source/components/namespace/nsnames.c index 2ec8b571c..1ac3c7883 100644 --- a/source/components/namespace/nsnames.c +++ b/source/components/namespace/nsnames.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsnames - Name manipulation and search - * $Revision: 1.75 $ + * $Revision: 1.82 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -144,9 +144,9 @@ void AcpiNsBuildExternalPath ( ACPI_NAMESPACE_NODE *Node, ACPI_SIZE Size, - NATIVE_CHAR *NameBuffer) + char *NameBuffer) { - UINT32 Index; + ACPI_SIZE Index; ACPI_NAMESPACE_NODE *ParentNode; @@ -180,7 +180,7 @@ AcpiNsBuildExternalPath ( /* Prefix name with the path separator */ Index--; - NameBuffer[Index] = PATH_SEPARATOR; + NameBuffer[Index] = ACPI_PATH_SEPARATOR; } /* Overwrite final separator with the root prefix character */ @@ -191,14 +191,14 @@ AcpiNsBuildExternalPath ( { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not construct pathname; index=%X, size=%X, Path=%s\n", - Index, Size, &NameBuffer[Size])); + (UINT32) Index, (UINT32) Size, &NameBuffer[Size])); } return; } -#ifdef ACPI_DEBUG +#ifdef ACPI_DEBUG_OUTPUT /******************************************************************************* * * FUNCTION: AcpiNsGetExternalPathname @@ -213,11 +213,11 @@ AcpiNsBuildExternalPath ( * ******************************************************************************/ -NATIVE_CHAR * +char * AcpiNsGetExternalPathname ( ACPI_NAMESPACE_NODE *Node) { - NATIVE_CHAR *NameBuffer; + char *NameBuffer; ACPI_SIZE Size; @@ -275,9 +275,9 @@ AcpiNsGetPathnameLength ( Size = 0; NextNode = Node; - while (NextNode != AcpiGbl_RootNode) + while (NextNode && (NextNode != AcpiGbl_RootNode)) { - Size += PATH_SEGMENT_LENGTH; + Size += ACPI_PATH_SEGMENT_LENGTH; NextNode = AcpiNsGetParentNode (NextNode); } @@ -334,7 +334,7 @@ AcpiNsHandleToPathname ( AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) Buffer->Pointer, RequiredSize)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) Buffer->Pointer, (UINT32) RequiredSize)); return_ACPI_STATUS (AE_OK); } diff --git a/source/components/namespace/nsobject.c b/source/components/namespace/nsobject.c index a6547201d..f9e3e41df 100644 --- a/source/components/namespace/nsobject.c +++ b/source/components/namespace/nsobject.c @@ -2,7 +2,7 @@ * * Module Name: nsobject - Utilities for objects attached to namespace * table entries - * $Revision: 1.81 $ + * $Revision: 1.87 $ * ******************************************************************************/ @@ -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 @@ -227,16 +227,9 @@ AcpiNsAttachObject ( { ObjDesc = (ACPI_OPERAND_OBJECT *) Object; - /* If a valid type (non-ANY) was given, just use it */ + /* Use the given type */ - if (ACPI_TYPE_ANY != Type) - { - ObjectType = Type; - } - else - { - ObjectType = INTERNAL_TYPE_DEF_ANY; - } + ObjectType = Type; } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n", @@ -283,13 +276,13 @@ AcpiNsAttachObject ( * * FUNCTION: AcpiNsDetachObject * - * PARAMETERS: Node - An object whose Value will be deleted + * PARAMETERS: Node - An node whose object will be detached * * RETURN: None. * - * DESCRIPTION: Delete the Value associated with a namespace object. If the - * Value is an allocated object, it is freed. Otherwise, the - * field is simply cleared. + * DESCRIPTION: Detach/delete an object associated with a namespace node. + * if the object is an allocated object, it is freed. + * Otherwise, the field is simply cleared. * ******************************************************************************/ @@ -304,8 +297,9 @@ AcpiNsDetachObject ( ObjDesc = Node->Object; - if (!ObjDesc || - (ObjDesc->Common.Type == INTERNAL_TYPE_DATA)) + + if (!ObjDesc || + (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA)) { return_VOID; } @@ -313,11 +307,11 @@ AcpiNsDetachObject ( /* Clear the entry in all cases */ Node->Object = NULL; - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_INTERNAL) + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) { Node->Object = ObjDesc->Common.NextObject; if (Node->Object && - (Node->Object->Common.Type != INTERNAL_TYPE_DATA)) + (ACPI_GET_OBJECT_TYPE (Node->Object) != ACPI_TYPE_LOCAL_DATA)) { Node->Object = Node->Object->Common.NextObject; } @@ -346,6 +340,8 @@ AcpiNsDetachObject ( * RETURN: Current value of the object field from the Node whose * handle is passed * + * DESCRIPTION: Obtain the object attached to a namespace node. + * ******************************************************************************/ ACPI_OPERAND_OBJECT * @@ -362,9 +358,9 @@ AcpiNsGetAttachedObject ( } if (!Node->Object || - ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_INTERNAL) && - (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED)) || - (Node->Object->Common.Type == INTERNAL_TYPE_DATA)) + ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_OPERAND) && + (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED)) || + (ACPI_GET_OBJECT_TYPE (Node->Object) == ACPI_TYPE_LOCAL_DATA)) { return_PTR (NULL); } @@ -380,7 +376,9 @@ AcpiNsGetAttachedObject ( * PARAMETERS: Node - Parent Node to be examined * * RETURN: Current value of the object field from the Node whose - * handle is passed + * handle is passed. + * + * DESCRIPTION: Obtain a secondary object associated with a namespace node. * ******************************************************************************/ @@ -391,10 +389,10 @@ AcpiNsGetSecondaryObject ( ACPI_FUNCTION_TRACE_PTR ("NsGetSecondaryObject", ObjDesc); - if ((!ObjDesc) || - (ObjDesc->Common.Type == INTERNAL_TYPE_DATA) || - (!ObjDesc->Common.NextObject) || - (ObjDesc->Common.NextObject->Common.Type == INTERNAL_TYPE_DATA)) + if ((!ObjDesc) || + (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) || + (!ObjDesc->Common.NextObject) || + (ACPI_GET_OBJECT_TYPE (ObjDesc->Common.NextObject) == ACPI_TYPE_LOCAL_DATA)) { return_PTR (NULL); } @@ -407,11 +405,13 @@ AcpiNsGetSecondaryObject ( * * FUNCTION: AcpiNsAttachData * - * PARAMETERS: + * PARAMETERS: Node - Namespace node + * Handler - Handler to be associated with the data + * Data - Data to be attached * * RETURN: Status * - * DESCRIPTION: + * DESCRIPTION: Low-level attach data. Create and attach a Data object. * ******************************************************************************/ @@ -426,12 +426,13 @@ AcpiNsAttachData ( ACPI_OPERAND_OBJECT *DataDesc; - /* */ + /* We only allow one attachment per handler */ + PrevObjDesc = NULL; ObjDesc = Node->Object; while (ObjDesc) { - if ((ObjDesc->Common.Type == INTERNAL_TYPE_DATA) && + if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) && (ObjDesc->Data.Handler == Handler)) { return (AE_ALREADY_EXISTS); @@ -441,10 +442,9 @@ AcpiNsAttachData ( ObjDesc = ObjDesc->Common.NextObject; } - /* Create an internal object for the data */ - DataDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_DATA); + DataDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_DATA); if (!DataDesc) { return (AE_NO_MEMORY); @@ -453,7 +453,6 @@ AcpiNsAttachData ( DataDesc->Data.Handler = Handler; DataDesc->Data.Pointer = Data; - /* Install the data object */ if (PrevObjDesc) @@ -473,11 +472,13 @@ AcpiNsAttachData ( * * FUNCTION: AcpiNsDetachData * - * PARAMETERS: + * PARAMETERS: Node - Namespace node + * Handler - Handler associated with the data * * RETURN: Status * - * DESCRIPTION: + * DESCRIPTION: Low-level detach data. Delete the data node, but the caller + * is responsible for the actual data. * ******************************************************************************/ @@ -494,7 +495,7 @@ AcpiNsDetachData ( ObjDesc = Node->Object; while (ObjDesc) { - if ((ObjDesc->Common.Type == INTERNAL_TYPE_DATA) && + if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) && (ObjDesc->Data.Handler == Handler)) { if (PrevObjDesc) @@ -522,11 +523,14 @@ AcpiNsDetachData ( * * FUNCTION: AcpiNsGetAttachedData * - * PARAMETERS: + * PARAMETERS: Node - Namespace node + * Handler - Handler associated with the data + * Data - Where the data is returned * * RETURN: Status * - * DESCRIPTION: + * DESCRIPTION: Low level interface to obtain data previously associated with + * a namespace node. * ******************************************************************************/ @@ -542,7 +546,7 @@ AcpiNsGetAttachedData ( ObjDesc = Node->Object; while (ObjDesc) { - if ((ObjDesc->Common.Type == INTERNAL_TYPE_DATA) && + if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) && (ObjDesc->Data.Handler == Handler)) { *Data = ObjDesc->Data.Pointer; diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c new file mode 100644 index 000000000..161f4b09a --- /dev/null +++ b/source/components/namespace/nsparse.c @@ -0,0 +1,250 @@ +/****************************************************************************** + * + * Module Name: nsparse - namespace interface to AML parser + * $Revision: 1.3 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __NSPARSE_C__ + +#include "acpi.h" +#include "acnamesp.h" +#include "acparser.h" +#include "acdispat.h" + + +#define _COMPONENT ACPI_NAMESPACE + ACPI_MODULE_NAME ("nsparse") + + +/******************************************************************************* + * + * FUNCTION: NsOneCompleteParse + * + * PARAMETERS: PassNumber - 1 or 2 + * TableDesc - The table to be parsed. + * + * RETURN: Status + * + * DESCRIPTION: Perform one complete parse of an ACPI/AML table. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsOneCompleteParse ( + UINT32 PassNumber, + ACPI_TABLE_DESC *TableDesc) +{ + ACPI_PARSE_OBJECT *ParseRoot; + ACPI_STATUS Status; + ACPI_WALK_STATE *WalkState; + + + ACPI_FUNCTION_TRACE ("NsOneCompleteParse"); + + + /* Create and init a Root Node */ + + ParseRoot = AcpiPsCreateScopeOp (); + if (!ParseRoot) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + + /* Create and initialize a new walk state */ + + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, + NULL, NULL, NULL); + if (!WalkState) + { + AcpiPsFreeOp (ParseRoot); + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, TableDesc->AmlStart, + TableDesc->AmlLength, NULL, NULL, PassNumber); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + return_ACPI_STATUS (Status); + } + + /* Parse the AML */ + + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber)); + Status = AcpiPsParseAml (WalkState); + + AcpiPsDeleteParseTree (ParseRoot); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsParseTable + * + * PARAMETERS: TableDesc - An ACPI table descriptor for table to parse + * StartNode - Where to enter the table into the namespace + * + * RETURN: Status + * + * DESCRIPTION: Parse AML within an ACPI table and return a tree of ops + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsParseTable ( + ACPI_TABLE_DESC *TableDesc, + ACPI_NAMESPACE_NODE *StartNode) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE ("NsParseTable"); + + + /* + * AML Parse, pass 1 + * + * In this pass, we load most of the namespace. Control methods + * are not parsed until later. A parse tree is not created. Instead, + * each Parser Op subtree is deleted when it is finished. This saves + * a great deal of memory, and allows a small cache of parse objects + * to service the entire parse. The second pass of the parse then + * performs another complete parse of the AML.. + */ + Status = AcpiNsOneCompleteParse (1, TableDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * AML Parse, pass 2 + * + * In this pass, we resolve forward references and other things + * that could not be completed during the first pass. + * Another complete parse of the AML is performed, but the + * overhead of this is compensated for by the fact that the + * parse objects are all cached. + */ + Status = AcpiNsOneCompleteParse (2, TableDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + return_ACPI_STATUS (Status); +} + + diff --git a/source/components/namespace/nssearch.c b/source/components/namespace/nssearch.c index 9e1f3d8ea..cd4ce3252 100644 --- a/source/components/namespace/nssearch.c +++ b/source/components/namespace/nssearch.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nssearch - Namespace search - * $Revision: 1.85 $ + * $Revision: 1.95 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -129,14 +129,15 @@ * FUNCTION: AcpiNsSearchNode * * PARAMETERS: *TargetName - Ascii ACPI name to search for - * *Node - Starting table where search will begin + * *Node - Starting node where search will begin * Type - Object type to match * **ReturnNode - Where the matched Named obj is returned * * RETURN: Status * - * DESCRIPTION: Search a single namespace table. Performs a simple search, - * does not add entries or search parents. + * DESCRIPTION: Search a single level of the namespace. Performs a + * simple search of the specified level, and does not add + * entries or search parents. * * * Named object lists are built (and subsequently dumped) in the @@ -163,15 +164,15 @@ AcpiNsSearchNode ( ACPI_FUNCTION_TRACE ("NsSearchNode"); -#ifdef ACPI_DEBUG +#ifdef ACPI_DEBUG_OUTPUT if (ACPI_LV_NAMES & AcpiDbgLevel) { - NATIVE_CHAR *ScopeName; + char *ScopeName; ScopeName = AcpiNsGetExternalPathname (Node); if (ScopeName) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (type %s)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (%s)\n", ScopeName, Node, (char *) &TargetName, AcpiUtGetTypeName (Type))); ACPI_MEM_FREE (ScopeName); @@ -180,8 +181,8 @@ AcpiNsSearchNode ( #endif /* - * Search for name in this table, which is to say that we must search - * for the name among the children of this object + * Search for name at this namespace level, which is to say that we + * must search for the name among the children of this object */ NextNode = Node->Child; while (NextNode) @@ -191,32 +192,8 @@ AcpiNsSearchNode ( if (NextNode->Name.Integer == TargetName) { /* - * Found matching entry. Capture the type if appropriate, before - * returning the entry. - * - * The DefFieldDefn and BankFieldDefn cases are actually looking up - * the Region in which the field will be defined + * Found matching entry. */ - if ((INTERNAL_TYPE_FIELD_DEFN == Type) || - (INTERNAL_TYPE_BANK_FIELD_DEFN == Type)) - { - Type = ACPI_TYPE_REGION; - } - - /* - * Scope, DefAny, and IndexFieldDefn are bogus "types" which do not - * actually have anything to do with the type of the name being - * looked up. For any other value of Type, if the type stored in - * the entry is Any (i.e. unknown), save the actual type. - */ - if (Type != INTERNAL_TYPE_SCOPE && - Type != INTERNAL_TYPE_DEF_ANY && - Type != INTERNAL_TYPE_INDEX_FIELD_DEFN && - NextNode->Type == ACPI_TYPE_ANY) - { - NextNode->Type = (UINT8) Type; - } - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s Type [%s] found at %p\n", (char *) &TargetName, AcpiUtGetTypeName (NextNode->Type), NextNode)); @@ -241,7 +218,7 @@ AcpiNsSearchNode ( NextNode = NextNode->Peer; } - /* Searched entire table, not found */ + /* Searched entire namespace level, not found */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s Type [%s] not found at %p\n", (char *) &TargetName, AcpiUtGetTypeName (Type), NextNode)); @@ -255,14 +232,14 @@ AcpiNsSearchNode ( * FUNCTION: AcpiNsSearchParentTree * * PARAMETERS: *TargetName - Ascii ACPI name to search for - * *Node - Starting table where search will begin + * *Node - Starting node where search will begin * Type - Object type to match * **ReturnNode - Where the matched Named Obj is returned * * RETURN: Status * * DESCRIPTION: Called when a name has not been found in the current namespace - * table. Before adding it or giving up, ACPI scope rules require + * level. Before adding it or giving up, ACPI scope rules require * searching enclosing scopes in cases identified by AcpiNsLocal(). * * "A name is located by finding the matching name in the current @@ -292,24 +269,21 @@ AcpiNsSearchParentTree ( ParentNode = AcpiNsGetParentNode (Node); /* - * If there is no parent (at the root) or type is "local", we won't be - * searching the parent tree. + * If there is no parent (i.e., we are at the root) or + * type is "local", we won't be searching the parent tree. */ - if ((AcpiNsLocal (Type)) || - (!ParentNode)) + if (!ParentNode) { - if (!ParentNode) - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n", - (char *) &TargetName)); - } - - if (AcpiNsLocal (Type)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] type [%s] must be local to this scope (no parent search)\n", - (char *) &TargetName, AcpiUtGetTypeName (Type))); - } + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n", + (char *) &TargetName)); + return_ACPI_STATUS (AE_NOT_FOUND); + } + if (AcpiNsLocal (Type)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "[%4.4s] type [%s] must be local to this scope (no parent search)\n", + (char *) &TargetName, AcpiUtGetTypeName (Type))); return_ACPI_STATUS (AE_NOT_FOUND); } @@ -354,8 +328,8 @@ AcpiNsSearchParentTree ( * * PARAMETERS: TargetName - Ascii ACPI name to search for (4 chars) * WalkState - Current state of the walk - * *Node - Starting table where search will begin - * InterpreterMode - Add names only in MODE_LoadPassX. + * *Node - Starting node where search will begin + * InterpreterMode - Add names only in ACPI_MODE_LOAD_PASS_x. * Otherwise,search only. * Type - Object type to match * Flags - Flags describing the search restrictions @@ -363,12 +337,12 @@ AcpiNsSearchParentTree ( * * RETURN: Status * - * DESCRIPTION: Search for a name segment in a single name table, + * DESCRIPTION: Search for a name segment in a single namespace level, * optionally adding it if it is not found. If the passed * Type is not Any and the type previously stored in the * entry was Any (i.e. unknown), update the stored type. * - * In IMODE_EXECUTE, search only. + * In ACPI_IMODE_EXECUTE, search only. * In other modes, search and add if not found. * ******************************************************************************/ @@ -394,10 +368,10 @@ AcpiNsSearchAndEnter ( if (!Node || !TargetName || !ReturnNode) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param- Table %p Name %X Return %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param: Node %p Name %X ReturnNode %p\n", Node, TargetName, ReturnNode)); - ACPI_REPORT_ERROR (("NsSearchAndEnter: bad (null) parameter\n")); + ACPI_REPORT_ERROR (("NsSearchAndEnter: Null parameter\n")); return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -405,14 +379,12 @@ AcpiNsSearchAndEnter ( if (!AcpiUtValidAcpiName (TargetName)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "*** Bad character in name: %08x *** \n", + ACPI_REPORT_ERROR (("NsSearchAndEnter: Bad character in ACPI Name: %X\n", TargetName)); - - ACPI_REPORT_ERROR (("NsSearchAndEnter: Bad character in ACPI Name\n")); return_ACPI_STATUS (AE_BAD_CHARACTER); } - /* Try to find the name in the table specified by the caller */ + /* Try to find the name in the namespace level specified by the caller */ *ReturnNode = ACPI_ENTRY_NOT_FOUND; Status = AcpiNsSearchNode (TargetName, Node, Type, ReturnNode); @@ -448,7 +420,7 @@ AcpiNsSearchAndEnter ( (Flags & ACPI_NS_SEARCH_PARENT)) { /* - * Not found in table - search parent tree according + * Not found at this level - search parent tree according * to ACPI specification */ Status = AcpiNsSearchParentTree (TargetName, Node, diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 33c47b1f5..b4c547901 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -2,7 +2,7 @@ * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * parents and siblings and Scope manipulation - * $Revision: 1.106 $ + * $Revision: 1.122 $ * *****************************************************************************/ @@ -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 @@ -126,6 +126,140 @@ ACPI_MODULE_NAME ("nsutils") +/******************************************************************************* + * + * FUNCTION: AcpiNsReportError + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * ComponentId - Caller's component ID (for error output) + * Message - Error message to use on failure + * + * RETURN: None + * + * DESCRIPTION: Print warning message with full pathname + * + ******************************************************************************/ + +void +AcpiNsReportError ( + char *ModuleName, + UINT32 LineNumber, + UINT32 ComponentId, + char *InternalName, + ACPI_STATUS LookupStatus) +{ + ACPI_STATUS Status; + char *Name; + + + /* Convert path to external format */ + + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalName, NULL, &Name); + + AcpiOsPrintf ("%8s-%04d: *** Error: Looking up ", + ModuleName, LineNumber); + + /* Print target name */ + + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf ("[%s]", Name); + } + else + { + AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]"); + } + + AcpiOsPrintf (" in namespace, %s\n", + AcpiFormatException (LookupStatus)); + + if (Name) + { + ACPI_MEM_FREE (Name); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsReportMethodError + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * ComponentId - Caller's component ID (for error output) + * Message - Error message to use on failure + * + * RETURN: None + * + * DESCRIPTION: Print warning message with full pathname + * + ******************************************************************************/ + +void +AcpiNsReportMethodError ( + char *ModuleName, + UINT32 LineNumber, + UINT32 ComponentId, + char *Message, + ACPI_NAMESPACE_NODE *PrefixNode, + char *Path, + ACPI_STATUS MethodStatus) +{ + ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node = PrefixNode; + + + if (Path) + { + Status = AcpiNsGetNodeByPath (Path, PrefixNode, ACPI_NS_NO_UPSEARCH, &Node); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("ReportMethodError: Could not get node\n"); + return; + } + } + + AcpiOsPrintf ("%8s-%04d: *** Error: ", ModuleName, LineNumber); + AcpiNsPrintNodePathname (Node, Message); + AcpiOsPrintf (", %s\n", AcpiFormatException (MethodStatus)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsPrintNodePathname + * + * PARAMETERS: Node - Object + * Msg - Prefix message + * + * DESCRIPTION: Print an object's full namespace pathname + * Manages allocation/freeing of a pathname buffer + * + ******************************************************************************/ + +void +AcpiNsPrintNodePathname ( + ACPI_NAMESPACE_NODE *Node, + char *Msg) +{ + ACPI_BUFFER Buffer; + ACPI_STATUS Status; + + + /* Convert handle to a full pathname and print it (with supplied message) */ + + Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + + Status = AcpiNsHandleToPathname (Node, &Buffer); + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf ("%s [%s] (Node %p)", Msg, (char *) Buffer.Pointer, Node); + ACPI_MEM_FREE (Buffer.Pointer); + } +} + + /******************************************************************************* * * FUNCTION: AcpiNsValidRootPrefix @@ -140,7 +274,7 @@ BOOLEAN AcpiNsValidRootPrefix ( - NATIVE_CHAR Prefix) + char Prefix) { return ((BOOLEAN) (Prefix == '\\')); @@ -161,7 +295,7 @@ AcpiNsValidRootPrefix ( BOOLEAN AcpiNsValidPathSeparator ( - NATIVE_CHAR Sep) + char Sep) { return ((BOOLEAN) (Sep == '.')); @@ -243,7 +377,7 @@ void AcpiNsGetInternalNameLength ( ACPI_NAMESTRING_INFO *Info) { - NATIVE_CHAR *NextExternalChar; + char *NextExternalChar; UINT32 i; @@ -324,10 +458,10 @@ AcpiNsBuildInternalName ( ACPI_NAMESTRING_INFO *Info) { UINT32 NumSegments = Info->NumSegments; - NATIVE_CHAR *InternalName = Info->InternalName; - NATIVE_CHAR *ExternalName = Info->NextExternalChar; - NATIVE_CHAR *Result = NULL; - UINT32 i; + char *InternalName = Info->InternalName; + char *ExternalName = Info->NextExternalChar; + char *Result = NULL; + ACPI_NATIVE_UINT i; ACPI_FUNCTION_TRACE ("NsBuildInternalName"); @@ -377,13 +511,13 @@ AcpiNsBuildInternalName ( else if (NumSegments == 2) { InternalName[i] = AML_DUAL_NAME_PREFIX; - Result = &InternalName[i+1]; + Result = &InternalName[(ACPI_NATIVE_UINT) (i+1)]; } else { InternalName[i] = AML_MULTI_NAME_PREFIX_OP; - InternalName[i+1] = (char) NumSegments; - Result = &InternalName[i+2]; + InternalName[(ACPI_NATIVE_UINT) (i+1)] = (char) NumSegments; + Result = &InternalName[(ACPI_NATIVE_UINT) (i+2)]; } } @@ -404,7 +538,7 @@ AcpiNsBuildInternalName ( { /* Convert the character to uppercase and save it */ - Result[i] = (char) ACPI_TOUPPER (*ExternalName); + Result[i] = (char) ACPI_TOUPPER ((int) *ExternalName); ExternalName++; } } @@ -459,10 +593,10 @@ AcpiNsBuildInternalName ( ACPI_STATUS AcpiNsInternalizeName ( - NATIVE_CHAR *ExternalName, - NATIVE_CHAR **ConvertedName) + char *ExternalName, + char **ConvertedName) { - NATIVE_CHAR *InternalName; + char *InternalName; ACPI_NAMESTRING_INFO Info; ACPI_STATUS Status; @@ -527,12 +661,12 @@ AcpiNsExternalizeName ( UINT32 *ConvertedNameLength, char **ConvertedName) { - UINT32 PrefixLength = 0; - UINT32 NamesIndex = 0; - UINT32 NumSegments = 0; - UINT32 i = 0; - UINT32 j = 0; - UINT32 RequiredLength; + ACPI_NATIVE_UINT NamesIndex = 0; + ACPI_NATIVE_UINT NumSegments = 0; + ACPI_NATIVE_UINT RequiredLength; + ACPI_NATIVE_UINT PrefixLength = 0; + ACPI_NATIVE_UINT i = 0; + ACPI_NATIVE_UINT j = 0; ACPI_FUNCTION_TRACE ("NsExternalizeName"); @@ -557,10 +691,14 @@ AcpiNsExternalizeName ( case '^': for (i = 0; i < InternalNameLength; i++) { - if (InternalName[i] != '^') + if (InternalName[i] == '^') { PrefixLength = i + 1; } + else + { + break; + } } if (i == InternalNameLength) @@ -587,7 +725,7 @@ AcpiNsExternalizeName ( /* 4-byte names */ NamesIndex = PrefixLength + 2; - NumSegments = (UINT32) (UINT8) InternalName[PrefixLength + 1]; + NumSegments = (UINT32) (UINT8) InternalName[(ACPI_NATIVE_UINT) (PrefixLength + 1)]; break; case AML_DUAL_NAME_PREFIX: @@ -668,7 +806,7 @@ AcpiNsExternalizeName ( if (ConvertedNameLength) { - *ConvertedNameLength = RequiredLength; + *ConvertedNameLength = (UINT32) RequiredLength; } return_ACPI_STATUS (AE_OK); @@ -781,7 +919,6 @@ AcpiNsTerminate (void) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *ThisNode; - ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("NsTerminate"); @@ -795,11 +932,7 @@ AcpiNsTerminate (void) * Delete all objects linked to the root * (additional table descriptors) */ - Status = AcpiNsDeleteNamespaceSubtree (ThisNode); - if (ACPI_FAILURE (Status)) - { - ACPI_REPORT_ERROR (("Could not delete namespace subtree\n")); - } + AcpiNsDeleteNamespaceSubtree (ThisNode); /* Detach any object(s) attached to the root */ @@ -839,7 +972,7 @@ UINT32 AcpiNsOpensScope ( ACPI_OBJECT_TYPE Type) { - ACPI_FUNCTION_TRACE_U32 ("NsOpensScope", Type); + ACPI_FUNCTION_TRACE_STR ("NsOpensScope", AcpiUtGetTypeName (Type)); if (!AcpiUtValidObjectType (Type)) @@ -878,30 +1011,28 @@ AcpiNsOpensScope ( ACPI_STATUS AcpiNsGetNodeByPath ( - NATIVE_CHAR *Pathname, + char *Pathname, ACPI_NAMESPACE_NODE *StartNode, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode) { ACPI_GENERIC_STATE ScopeInfo; ACPI_STATUS Status; - NATIVE_CHAR *InternalPath = NULL; + char *InternalPath = NULL; ACPI_FUNCTION_TRACE_PTR ("NsGetNodeByPath", Pathname); - if (!Pathname) + if (Pathname) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } + /* Convert path to internal representation */ - /* Convert path to internal representation */ - - Status = AcpiNsInternalizeName (Pathname, &InternalPath); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); + Status = AcpiNsInternalizeName (Pathname, &InternalPath); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } /* Must lock namespace during lookup */ @@ -931,7 +1062,11 @@ AcpiNsGetNodeByPath ( /* Cleanup */ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - ACPI_MEM_FREE (InternalPath); + + if (InternalPath) + { + ACPI_MEM_FREE (InternalPath); + } return_ACPI_STATUS (Status); } @@ -985,45 +1120,6 @@ AcpiNsFindParentName ( } -#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) - -/******************************************************************************* - * - * FUNCTION: AcpiNsExistDownstreamSibling - * - * PARAMETERS: *Node - pointer to first Node to examine - * - * RETURN: TRUE if sibling is found, FALSE otherwise - * - * DESCRIPTION: Searches remainder of scope being processed to determine - * whether there is a downstream sibling to the current - * object. This function is used to determine what type of - * line drawing character to use when displaying namespace - * trees. - * - ******************************************************************************/ - -BOOLEAN -AcpiNsExistDownstreamSibling ( - ACPI_NAMESPACE_NODE *Node) -{ - - if (!Node) - { - return (FALSE); - } - - if (Node->Name.Integer) - { - return (TRUE); - } - - return (FALSE); -} - -#endif /* ACPI_DEBUG */ - - /******************************************************************************* * * FUNCTION: AcpiNsGetParentNode diff --git a/source/components/namespace/nswalk.c b/source/components/namespace/nswalk.c index f56e0eaaf..dae86a3a0 100644 --- a/source/components/namespace/nswalk.c +++ b/source/components/namespace/nswalk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nswalk - Functions for walking the ACPI namespace - * $Revision: 1.33 $ + * $Revision: 1.34 $ * *****************************************************************************/ @@ -9,7 +9,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 diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c new file mode 100644 index 000000000..b9d4d4951 --- /dev/null +++ b/source/components/namespace/nsxfeval.c @@ -0,0 +1,870 @@ +/******************************************************************************* + * + * Module Name: nsxfeval - Public interfaces to the ACPI subsystem + * ACPI Object evaluation interfaces + * $Revision: 1.7 $ + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + + +#define __NSXFEVAL_C__ + +#include "acpi.h" +#include "acnamesp.h" + + +#define _COMPONENT ACPI_NAMESPACE + ACPI_MODULE_NAME ("nsxfeval") + + +/******************************************************************************* + * + * FUNCTION: AcpiEvaluateObjectTyped + * + * PARAMETERS: Handle - Object handle (optional) + * *Pathname - Object pathname (optional) + * **ExternalParams - List of parameters to pass to method, + * terminated by NULL. May be NULL + * if no parameters are being passed. + * *ReturnBuffer - Where to put method's return value (if + * any). If NULL, no value is returned. + * ReturnType - Expected type of return object + * + * RETURN: Status + * + * DESCRIPTION: Find and evaluate the given object, passing the given + * parameters if necessary. One of "Handle" or "Pathname" must + * be valid (non-null) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvaluateObjectTyped ( + ACPI_HANDLE Handle, + ACPI_STRING Pathname, + ACPI_OBJECT_LIST *ExternalParams, + ACPI_BUFFER *ReturnBuffer, + ACPI_OBJECT_TYPE ReturnType) +{ + ACPI_STATUS Status; + BOOLEAN MustFree = FALSE; + + + ACPI_FUNCTION_TRACE ("AcpiEvaluateObjectTyped"); + + + /* Return buffer must be valid */ + + if (!ReturnBuffer) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + if (ReturnBuffer->Length == ACPI_ALLOCATE_BUFFER) + { + MustFree = TRUE; + } + + /* Evaluate the object */ + + Status = AcpiEvaluateObject (Handle, Pathname, ExternalParams, ReturnBuffer); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Type ANY means "don't care" */ + + if (ReturnType == ACPI_TYPE_ANY) + { + return_ACPI_STATUS (AE_OK); + } + + if (ReturnBuffer->Length == 0) + { + /* Error because caller specifically asked for a return value */ + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "No return value\n")); + + return_ACPI_STATUS (AE_NULL_OBJECT); + } + + /* Examine the object type returned from EvaluateObject */ + + if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType) + { + return_ACPI_STATUS (AE_OK); + } + + /* Return object type does not match requested type */ + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Incorrect return type [%s] requested [%s]\n", + AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type), + AcpiUtGetTypeName (ReturnType))); + + if (MustFree) + { + /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ + + AcpiOsFree (ReturnBuffer->Pointer); + ReturnBuffer->Pointer = NULL; + } + + ReturnBuffer->Length = 0; + return_ACPI_STATUS (AE_TYPE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvaluateObject + * + * PARAMETERS: Handle - Object handle (optional) + * *Pathname - Object pathname (optional) + * **ExternalParams - List of parameters to pass to method, + * terminated by NULL. May be NULL + * if no parameters are being passed. + * *ReturnBuffer - Where to put method's return value (if + * any). If NULL, no value is returned. + * + * RETURN: Status + * + * DESCRIPTION: Find and evaluate the given object, passing the given + * parameters if necessary. One of "Handle" or "Pathname" must + * be valid (non-null) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvaluateObject ( + ACPI_HANDLE Handle, + ACPI_STRING Pathname, + ACPI_OBJECT_LIST *ExternalParams, + ACPI_BUFFER *ReturnBuffer) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT **InternalParams = NULL; + ACPI_OPERAND_OBJECT *InternalReturnObj = NULL; + ACPI_SIZE BufferSpaceNeeded; + UINT32 i; + + + ACPI_FUNCTION_TRACE ("AcpiEvaluateObject"); + + + /* + * If there are parameters to be passed to the object + * (which must be a control method), the external objects + * must be converted to internal objects + */ + if (ExternalParams && ExternalParams->Count) + { + /* + * Allocate a new parameter block for the internal objects + * Add 1 to count to allow for null terminated internal list + */ + InternalParams = ACPI_MEM_CALLOCATE (((ACPI_SIZE) ExternalParams->Count + 1) * + sizeof (void *)); + if (!InternalParams) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* + * Convert each external object in the list to an + * internal object + */ + for (i = 0; i < ExternalParams->Count; i++) + { + Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i], + &InternalParams[i]); + if (ACPI_FAILURE (Status)) + { + AcpiUtDeleteInternalObjectList (InternalParams); + return_ACPI_STATUS (Status); + } + } + InternalParams[ExternalParams->Count] = NULL; + } + + /* + * Three major cases: + * 1) Fully qualified pathname + * 2) No handle, not fully qualified pathname (error) + * 3) Valid handle + */ + if ((Pathname) && + (AcpiNsValidRootPrefix (Pathname[0]))) + { + /* + * The path is fully qualified, just evaluate by name + */ + Status = AcpiNsEvaluateByName (Pathname, InternalParams, + &InternalReturnObj); + } + else if (!Handle) + { + /* + * A handle is optional iff a fully qualified pathname + * is specified. Since we've already handled fully + * qualified names above, this is an error + */ + if (!Pathname) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Both Handle and Pathname are NULL\n")); + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Handle is NULL and Pathname is relative\n")); + } + + Status = AE_BAD_PARAMETER; + } + else + { + /* + * We get here if we have a handle -- and if we have a + * pathname it is relative. The handle will be validated + * in the lower procedures + */ + if (!Pathname) + { + /* + * The null pathname case means the handle is for + * the actual object to be evaluated + */ + Status = AcpiNsEvaluateByHandle (Handle, InternalParams, + &InternalReturnObj); + } + else + { + /* + * Both a Handle and a relative Pathname + */ + Status = AcpiNsEvaluateRelative (Handle, Pathname, InternalParams, + &InternalReturnObj); + } + } + + + /* + * If we are expecting a return value, and all went well above, + * copy the return value to an external object. + */ + if (ReturnBuffer) + { + if (!InternalReturnObj) + { + ReturnBuffer->Length = 0; + } + else + { + if (ACPI_GET_DESCRIPTOR_TYPE (InternalReturnObj) == ACPI_DESC_TYPE_NAMED) + { + /* + * If we received a NS Node as a return object, this means that + * the object we are evaluating has nothing interesting to + * return (such as a mutex, etc.) We return an error because + * these types are essentially unsupported by this interface. + * We don't check up front because this makes it easier to add + * support for various types at a later date if necessary. + */ + Status = AE_TYPE; + InternalReturnObj = NULL; /* No need to delete a NS Node */ + ReturnBuffer->Length = 0; + } + + if (ACPI_SUCCESS (Status)) + { + /* + * Find out how large a buffer is needed + * to contain the returned object + */ + Status = AcpiUtGetObjectSize (InternalReturnObj, + &BufferSpaceNeeded); + if (ACPI_SUCCESS (Status)) + { + /* Validate/Allocate/Clear caller buffer */ + + Status = AcpiUtInitializeBuffer (ReturnBuffer, BufferSpaceNeeded); + if (ACPI_FAILURE (Status)) + { + /* + * Caller's buffer is too small or a new one can't be allocated + */ + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Needed buffer size %X, %s\n", + (UINT32) BufferSpaceNeeded, AcpiFormatException (Status))); + } + else + { + /* + * We have enough space for the object, build it + */ + Status = AcpiUtCopyIobjectToEobject (InternalReturnObj, + ReturnBuffer); + } + } + } + } + } + + /* Delete the return and parameter objects */ + + if (InternalReturnObj) + { + /* + * Delete the internal return object. (Or at least + * decrement the reference count by one) + */ + AcpiUtRemoveReference (InternalReturnObj); + } + + /* + * Free the input parameter list (if we created one), + */ + if (InternalParams) + { + /* Free the allocated parameter block */ + + AcpiUtDeleteInternalObjectList (InternalParams); + } + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiWalkNamespace + * + * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for + * StartObject - Handle in namespace where search begins + * MaxDepth - Depth to which search is to reach + * UserFunction - Called when an object of "Type" is found + * Context - Passed to user function + * ReturnValue - Location where return value of + * UserFunction is put if terminated early + * + * RETURNS Return value from the UserFunction if terminated early. + * Otherwise, returns NULL. + * + * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, + * starting (and ending) at the object specified by StartHandle. + * The UserFunction is called whenever an object that matches + * the type parameter is found. If the user function returns + * a non-zero value, the search is terminated immediately and this + * value is returned to the caller. + * + * The point of this procedure is to provide a generic namespace + * walk routine that can be called from multiple places to + * provide multiple services; the User Function can be tailored + * to each task, whether it is a print function, a compare + * function, etc. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiWalkNamespace ( + ACPI_OBJECT_TYPE Type, + ACPI_HANDLE StartObject, + UINT32 MaxDepth, + ACPI_WALK_CALLBACK UserFunction, + void *Context, + void **ReturnValue) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE ("AcpiWalkNamespace"); + + + /* Parameter validation */ + + if ((Type > ACPI_TYPE_EXTERNAL_MAX) || + (!MaxDepth) || + (!UserFunction)) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* + * Lock the namespace around the walk. + * The namespace will be unlocked/locked around each call + * to the user function - since this function + * must be allowed to make Acpi calls itself. + */ + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, ACPI_NS_WALK_UNLOCK, + UserFunction, Context, ReturnValue); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsGetDeviceCallback + * + * PARAMETERS: Callback from AcpiGetDevice + * + * RETURN: Status + * + * DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non- + * present devices, or if they specified a HID, it filters based + * on that. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiNsGetDeviceCallback ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; + UINT32 Flags; + ACPI_DEVICE_ID Hid; + ACPI_DEVICE_ID Cid; + ACPI_GET_DEVICES_INFO *Info; + + + Info = Context; + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Node = AcpiNsMapHandleToNode (ObjHandle); + Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (!Node) + { + return (AE_BAD_PARAMETER); + } + + /* + * Run _STA to determine if device is present + */ + Status = AcpiUtExecute_STA (Node, &Flags); + if (ACPI_FAILURE (Status)) + { + return (AE_CTRL_DEPTH); + } + + if (!(Flags & 0x01)) + { + /* Don't return at the device or children of the device if not there */ + return (AE_CTRL_DEPTH); + } + + /* + * Filter based on device HID & CID + */ + if (Info->Hid != NULL) + { + Status = AcpiUtExecute_HID (Node, &Hid); + if (Status == AE_NOT_FOUND) + { + return (AE_OK); + } + else if (ACPI_FAILURE (Status)) + { + return (AE_CTRL_DEPTH); + } + + if (ACPI_STRNCMP (Hid.Buffer, Info->Hid, sizeof (Hid.Buffer)) != 0) + { + Status = AcpiUtExecute_CID (Node, &Cid); + if (Status == AE_NOT_FOUND) + { + return (AE_OK); + } + else if (ACPI_FAILURE (Status)) + { + return (AE_CTRL_DEPTH); + } + + /* TBD: Handle CID packages */ + + if (ACPI_STRNCMP (Cid.Buffer, Info->Hid, sizeof (Cid.Buffer)) != 0) + { + return (AE_OK); + } + } + } + + Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue); + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiGetDevices + * + * PARAMETERS: HID - HID to search for. Can be NULL. + * UserFunction - Called when a matching object is found + * Context - Passed to user function + * ReturnValue - Location where return value of + * UserFunction is put if terminated early + * + * RETURNS Return value from the UserFunction if terminated early. + * Otherwise, returns NULL. + * + * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, + * starting (and ending) at the object specified by StartHandle. + * The UserFunction is called whenever an object that matches + * the type parameter is found. If the user function returns + * a non-zero value, the search is terminated immediately and this + * value is returned to the caller. + * + * This is a wrapper for WalkNamespace, but the callback performs + * additional filtering. Please see AcpiGetDeviceCallback. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetDevices ( + char *HID, + ACPI_WALK_CALLBACK UserFunction, + void *Context, + void **ReturnValue) +{ + ACPI_STATUS Status; + ACPI_GET_DEVICES_INFO Info; + + + ACPI_FUNCTION_TRACE ("AcpiGetDevices"); + + + /* Parameter validation */ + + if (!UserFunction) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* + * We're going to call their callback from OUR callback, so we need + * to know what it is, and their context parameter. + */ + Info.Context = Context; + Info.UserFunction = UserFunction; + Info.Hid = HID; + + /* + * Lock the namespace around the walk. + * The namespace will be unlocked/locked around each call + * to the user function - since this function + * must be allowed to make Acpi calls itself. + */ + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, + ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + ACPI_NS_WALK_UNLOCK, + AcpiNsGetDeviceCallback, &Info, + ReturnValue); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiAttachData + * + * PARAMETERS: ObjHandle - Namespace node + * Handler - Handler for this attachment + * Data - Pointer to data to be attached + * + * RETURN: Status + * + * DESCRIPTION: Attach arbitrary data and handler to a namespace node. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiAttachData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler, + void *Data) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + /* Parameter validation */ + + if (!ObjHandle || + !Handler || + !Data) + { + return (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Convert and validate the handle */ + + Node = AcpiNsMapHandleToNode (ObjHandle); + if (!Node) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiNsAttachData (Node, Handler, Data); + +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDetachData + * + * PARAMETERS: ObjHandle - Namespace node handle + * Handler - Handler used in call to AcpiAttachData + * + * RETURN: Status + * + * DESCRIPTION: Remove data that was previously attached to a node. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDetachData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + /* Parameter validation */ + + if (!ObjHandle || + !Handler) + { + return (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Convert and validate the handle */ + + Node = AcpiNsMapHandleToNode (ObjHandle); + if (!Node) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiNsDetachData (Node, Handler); + +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiGetData + * + * PARAMETERS: ObjHandle - Namespace node + * Handler - Handler used in call to AttachData + * Data - Where the data is returned + * + * RETURN: Status + * + * DESCRIPTION: Retrieve data that was previously attached to a namespace node. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler, + void **Data) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + /* Parameter validation */ + + if (!ObjHandle || + !Handler || + !Data) + { + return (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Convert and validate the handle */ + + Node = AcpiNsMapHandleToNode (ObjHandle); + if (!Node) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiNsGetAttachedData (Node, Handler, Data); + +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return (Status); +} + + diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c index e505b3dd5..b06a080ef 100644 --- a/source/components/namespace/nsxfname.c +++ b/source/components/namespace/nsxfname.c @@ -2,7 +2,7 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces - * $Revision: 1.91 $ + * $Revision: 1.94 $ * *****************************************************************************/ @@ -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 @@ -277,7 +277,7 @@ AcpiGetName ( /* Validate/Allocate/Clear caller buffer */ - Status = AcpiUtInitializeBuffer (Buffer, PATH_SEGMENT_LENGTH); + Status = AcpiUtInitializeBuffer (Buffer, ACPI_PATH_SEGMENT_LENGTH); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -287,7 +287,7 @@ AcpiGetName ( ACPI_STRNCPY (Buffer->Pointer, Node->Name.Ascii, ACPI_NAME_SIZE); - ((NATIVE_CHAR *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0; + ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0; Status = AE_OK; diff --git a/source/components/namespace/nsxfobj.c b/source/components/namespace/nsxfobj.c index 3f9e24fc3..1674dda86 100644 --- a/source/components/namespace/nsxfobj.c +++ b/source/components/namespace/nsxfobj.c @@ -2,7 +2,7 @@ * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces - * $Revision: 1.109 $ + * $Revision: 1.115 $ * ******************************************************************************/ @@ -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 @@ -125,320 +125,6 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsxfobj") - -/******************************************************************************* - * - * FUNCTION: AcpiEvaluateObject - * - * PARAMETERS: Handle - Object handle (optional) - * *Pathname - Object pathname (optional) - * **ExternalParams - List of parameters to pass to method, - * terminated by NULL. May be NULL - * if no parameters are being passed. - * *ReturnBuffer - Where to put method's return value (if - * any). If NULL, no value is returned. - * - * RETURN: Status - * - * DESCRIPTION: Find and evaluate the given object, passing the given - * parameters if necessary. One of "Handle" or "Pathname" must - * be valid (non-null) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvaluateObject ( - ACPI_HANDLE Handle, - ACPI_STRING Pathname, - ACPI_OBJECT_LIST *ExternalParams, - ACPI_BUFFER *ReturnBuffer) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **InternalParams = NULL; - ACPI_OPERAND_OBJECT *InternalReturnObj = NULL; - ACPI_SIZE BufferSpaceNeeded; - UINT32 i; - - - ACPI_FUNCTION_TRACE ("AcpiEvaluateObject"); - - - /* - * If there are parameters to be passed to the object - * (which must be a control method), the external objects - * must be converted to internal objects - */ - if (ExternalParams && ExternalParams->Count) - { - /* - * Allocate a new parameter block for the internal objects - * Add 1 to count to allow for null terminated internal list - */ - InternalParams = ACPI_MEM_CALLOCATE ((ExternalParams->Count + 1) * - sizeof (void *)); - if (!InternalParams) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Convert each external object in the list to an - * internal object - */ - for (i = 0; i < ExternalParams->Count; i++) - { - Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i], - &InternalParams[i]); - if (ACPI_FAILURE (Status)) - { - AcpiUtDeleteInternalObjectList (InternalParams); - return_ACPI_STATUS (Status); - } - } - InternalParams[ExternalParams->Count] = NULL; - } - - /* - * Three major cases: - * 1) Fully qualified pathname - * 2) No handle, not fully qualified pathname (error) - * 3) Valid handle - */ - if ((Pathname) && - (AcpiNsValidRootPrefix (Pathname[0]))) - { - /* - * The path is fully qualified, just evaluate by name - */ - Status = AcpiNsEvaluateByName (Pathname, InternalParams, - &InternalReturnObj); - } - else if (!Handle) - { - /* - * A handle is optional iff a fully qualified pathname - * is specified. Since we've already handled fully - * qualified names above, this is an error - */ - if (!Pathname) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Both Handle and Pathname are NULL\n")); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Handle is NULL and Pathname is relative\n")); - } - - Status = AE_BAD_PARAMETER; - } - else - { - /* - * We get here if we have a handle -- and if we have a - * pathname it is relative. The handle will be validated - * in the lower procedures - */ - if (!Pathname) - { - /* - * The null pathname case means the handle is for - * the actual object to be evaluated - */ - Status = AcpiNsEvaluateByHandle (Handle, InternalParams, - &InternalReturnObj); - } - else - { - /* - * Both a Handle and a relative Pathname - */ - Status = AcpiNsEvaluateRelative (Handle, Pathname, InternalParams, - &InternalReturnObj); - } - } - - - /* - * If we are expecting a return value, and all went well above, - * copy the return value to an external object. - */ - if (ReturnBuffer) - { - if (!InternalReturnObj) - { - ReturnBuffer->Length = 0; - } - else - { - if (ACPI_GET_DESCRIPTOR_TYPE (InternalReturnObj) == ACPI_DESC_TYPE_NAMED) - { - /* - * If we received a NS Node as a return object, this means that - * the object we are evaluating has nothing interesting to - * return (such as a mutex, etc.) We return an error because - * these types are essentially unsupported by this interface. - * We don't check up front because this makes it easier to add - * support for various types at a later date if necessary. - */ - Status = AE_TYPE; - InternalReturnObj = NULL; /* No need to delete a NS Node */ - ReturnBuffer->Length = 0; - } - - if (ACPI_SUCCESS (Status)) - { - /* - * Find out how large a buffer is needed - * to contain the returned object - */ - Status = AcpiUtGetObjectSize (InternalReturnObj, - &BufferSpaceNeeded); - if (ACPI_SUCCESS (Status)) - { - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (ReturnBuffer, BufferSpaceNeeded); - if (ACPI_FAILURE (Status)) - { - /* - * Caller's buffer is too small or a new one can't be allocated - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Needed buffer size %X, %s\n", - BufferSpaceNeeded, AcpiFormatException (Status))); - } - else - { - /* - * We have enough space for the object, build it - */ - Status = AcpiUtCopyIobjectToEobject (InternalReturnObj, - ReturnBuffer); - } - } - } - } - } - - /* Delete the return and parameter objects */ - - if (InternalReturnObj) - { - /* - * Delete the internal return object. (Or at least - * decrement the reference count by one) - */ - AcpiUtRemoveReference (InternalReturnObj); - } - - /* - * Free the input parameter list (if we created one), - */ - if (InternalParams) - { - /* Free the allocated parameter block */ - - AcpiUtDeleteInternalObjectList (InternalParams); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiGetNextObject - * - * PARAMETERS: Type - Type of object to be searched for - * Parent - Parent object whose children we are getting - * LastChild - Previous child that was found. - * The NEXT child will be returned - * RetHandle - Where handle to the next object is placed - * - * RETURN: Status - * - * DESCRIPTION: Return the next peer object within the namespace. If Handle is - * valid, Scope is ignored. Otherwise, the first object within - * Scope is returned. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetNextObject ( - ACPI_OBJECT_TYPE Type, - ACPI_HANDLE Parent, - ACPI_HANDLE Child, - ACPI_HANDLE *RetHandle) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_NAMESPACE_NODE *ParentNode = NULL; - ACPI_NAMESPACE_NODE *ChildNode = NULL; - - - /* Parameter validation */ - - if (Type > ACPI_TYPE_MAX) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* If null handle, use the parent */ - - if (!Child) - { - /* Start search at the beginning of the specified scope */ - - ParentNode = AcpiNsMapHandleToNode (Parent); - if (!ParentNode) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - } - else - { - /* Non-null handle, ignore the parent */ - /* Convert and validate the handle */ - - ChildNode = AcpiNsMapHandleToNode (Child); - if (!ChildNode) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - } - - /* Internal function does the real work */ - - Node = AcpiNsGetNextNode (Type, ParentNode, ChildNode); - if (!Node) - { - Status = AE_NOT_FOUND; - goto UnlockAndExit; - } - - if (RetHandle) - { - *RetHandle = AcpiNsConvertEntryToHandle (Node); - } - - -UnlockAndExit: - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - - /******************************************************************************* * * FUNCTION: AcpiGetType @@ -573,415 +259,91 @@ UnlockAndExit: /******************************************************************************* * - * FUNCTION: AcpiWalkNamespace + * FUNCTION: AcpiGetNextObject * - * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for - * StartObject - Handle in namespace where search begins - * MaxDepth - Depth to which search is to reach - * UserFunction - Called when an object of "Type" is found - * Context - Passed to user function - * ReturnValue - Location where return value of - * UserFunction is put if terminated early + * PARAMETERS: Type - Type of object to be searched for + * Parent - Parent object whose children we are getting + * LastChild - Previous child that was found. + * The NEXT child will be returned + * RetHandle - Where handle to the next object is placed * - * RETURNS Return value from the UserFunction if terminated early. - * Otherwise, returns NULL. + * RETURN: Status * - * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, - * starting (and ending) at the object specified by StartHandle. - * The UserFunction is called whenever an object that matches - * the type parameter is found. If the user function returns - * a non-zero value, the search is terminated immediately and this - * value is returned to the caller. - * - * The point of this procedure is to provide a generic namespace - * walk routine that can be called from multiple places to - * provide multiple services; the User Function can be tailored - * to each task, whether it is a print function, a compare - * function, etc. + * DESCRIPTION: Return the next peer object within the namespace. If Handle is + * valid, Scope is ignored. Otherwise, the first object within + * Scope is returned. * ******************************************************************************/ ACPI_STATUS -AcpiWalkNamespace ( +AcpiGetNextObject ( ACPI_OBJECT_TYPE Type, - ACPI_HANDLE StartObject, - UINT32 MaxDepth, - ACPI_WALK_CALLBACK UserFunction, - void *Context, - void **ReturnValue) + ACPI_HANDLE Parent, + ACPI_HANDLE Child, + ACPI_HANDLE *RetHandle) { ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE ("AcpiWalkNamespace"); + ACPI_NAMESPACE_NODE *Node; + ACPI_NAMESPACE_NODE *ParentNode = NULL; + ACPI_NAMESPACE_NODE *ChildNode = NULL; /* Parameter validation */ - if ((Type > ACPI_TYPE_MAX) || - (!MaxDepth) || - (!UserFunction)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * Lock the namespace around the walk. - * The namespace will be unlocked/locked around each call - * to the user function - since this function - * must be allowed to make Acpi calls itself. - */ - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, ACPI_NS_WALK_UNLOCK, - UserFunction, Context, ReturnValue); - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetDeviceCallback - * - * PARAMETERS: Callback from AcpiGetDevice - * - * RETURN: Status - * - * DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non- - * present devices, or if they specified a HID, it filters based - * on that. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsGetDeviceCallback ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - UINT32 Flags; - ACPI_DEVICE_ID Hid; - ACPI_DEVICE_ID Cid; - ACPI_GET_DEVICES_INFO *Info; - - - Info = Context; - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Node = AcpiNsMapHandleToNode (ObjHandle); - Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (!Node) + if (Type > ACPI_TYPE_EXTERNAL_MAX) { return (AE_BAD_PARAMETER); } - /* - * Run _STA to determine if device is present - */ - Status = AcpiUtExecute_STA (Node, &Flags); + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { - return (AE_CTRL_DEPTH); + return (Status); } - if (!(Flags & 0x01)) + /* If null handle, use the parent */ + + if (!Child) { - /* Don't return at the device or children of the device if not there */ - return (AE_CTRL_DEPTH); + /* Start search at the beginning of the specified scope */ + + ParentNode = AcpiNsMapHandleToNode (Parent); + if (!ParentNode) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } } - - /* - * Filter based on device HID & CID - */ - if (Info->Hid != NULL) + else { - Status = AcpiUtExecute_HID (Node, &Hid); - if (Status == AE_NOT_FOUND) - { - return (AE_OK); - } - else if (ACPI_FAILURE (Status)) - { - return (AE_CTRL_DEPTH); - } + /* Non-null handle, ignore the parent */ + /* Convert and validate the handle */ - if (ACPI_STRNCMP (Hid.Buffer, Info->Hid, sizeof (Hid.Buffer)) != 0) + ChildNode = AcpiNsMapHandleToNode (Child); + if (!ChildNode) { - Status = AcpiUtExecute_CID (Node, &Cid); - if (Status == AE_NOT_FOUND) - { - return (AE_OK); - } - else if (ACPI_FAILURE (Status)) - { - return (AE_CTRL_DEPTH); - } - - /* TBD: Handle CID packages */ - - if (ACPI_STRNCMP (Cid.Buffer, Info->Hid, sizeof (Cid.Buffer)) != 0) - { - return (AE_OK); - } + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; } } - Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue); - return (Status); -} + /* Internal function does the real work */ - -/******************************************************************************* - * - * FUNCTION: AcpiGetDevices - * - * PARAMETERS: HID - HID to search for. Can be NULL. - * UserFunction - Called when a matching object is found - * Context - Passed to user function - * ReturnValue - Location where return value of - * UserFunction is put if terminated early - * - * RETURNS Return value from the UserFunction if terminated early. - * Otherwise, returns NULL. - * - * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, - * starting (and ending) at the object specified by StartHandle. - * The UserFunction is called whenever an object that matches - * the type parameter is found. If the user function returns - * a non-zero value, the search is terminated immediately and this - * value is returned to the caller. - * - * This is a wrapper for WalkNamespace, but the callback performs - * additional filtering. Please see AcpiGetDeviceCallback. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetDevices ( - NATIVE_CHAR *HID, - ACPI_WALK_CALLBACK UserFunction, - void *Context, - void **ReturnValue) -{ - ACPI_STATUS Status; - ACPI_GET_DEVICES_INFO Info; - - - ACPI_FUNCTION_TRACE ("AcpiGetDevices"); - - - /* Parameter validation */ - - if (!UserFunction) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * We're going to call their callback from OUR callback, so we need - * to know what it is, and their context parameter. - */ - Info.Context = Context; - Info.UserFunction = UserFunction; - Info.Hid = HID; - - /* - * Lock the namespace around the walk. - * The namespace will be unlocked/locked around each call - * to the user function - since this function - * must be allowed to make Acpi calls itself. - */ - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, - ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, - AcpiNsGetDeviceCallback, &Info, - ReturnValue); - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiAttachData - * - * PARAMETERS: - * - * RETURN: Status - * - * DESCRIPTION: - * - ******************************************************************************/ - -ACPI_STATUS -AcpiAttachData ( - ACPI_HANDLE ObjHandle, - ACPI_OBJECT_HANDLER Handler, - void *Data) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (!ObjHandle || - !Handler || - !Data) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Convert and validate the handle */ - - Node = AcpiNsMapHandleToNode (ObjHandle); + Node = AcpiNsGetNextNode (Type, ParentNode, ChildNode); if (!Node) { - Status = AE_BAD_PARAMETER; + Status = AE_NOT_FOUND; goto UnlockAndExit; } - Status = AcpiNsAttachData (Node, Handler, Data); - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDetachData - * - * PARAMETERS: - * - * RETURN: Status - * - * DESCRIPTION: - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDetachData ( - ACPI_HANDLE ObjHandle, - ACPI_OBJECT_HANDLER Handler) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (!ObjHandle || - !Handler) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Convert and validate the handle */ - - Node = AcpiNsMapHandleToNode (ObjHandle); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiNsDetachData (Node, Handler); - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiGetData - * - * PARAMETERS: - * - * RETURN: Status - * - * DESCRIPTION: - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetData ( - ACPI_HANDLE ObjHandle, - ACPI_OBJECT_HANDLER Handler, - void **Data) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (!ObjHandle || - !Handler || - !Data) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Convert and validate the handle */ - - Node = AcpiNsMapHandleToNode (ObjHandle); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiNsGetAttachedData (Node, Handler, Data); + if (RetHandle) + { + *RetHandle = AcpiNsConvertEntryToHandle (Node); + } + UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } diff --git a/source/components/resources/rsaddr.c b/source/components/resources/rsaddr.c index 04492cb17..d83791b37 100644 --- a/source/components/resources/rsaddr.c +++ b/source/components/resources/rsaddr.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsaddr - Address resource descriptors (16/32/64) - * $Revision: 1.23 $ + * $Revision: 1.28 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -152,8 +152,8 @@ AcpiRsAddress16Resource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; - NATIVE_CHAR *TempPtr; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; + UINT8 *TempPtr; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16); UINT32 Index; UINT16 Temp16; @@ -296,9 +296,9 @@ AcpiRsAddress16Resource ( /* Point the String pointer to the end of this structure */ OutputStruct->Data.Address16.ResourceSource.StringPtr = - (NATIVE_CHAR *)((UINT8 * )OutputStruct + StructSize); + (char *)((UINT8 * )OutputStruct + StructSize); - TempPtr = OutputStruct->Data.Address16.ResourceSource.StringPtr; + TempPtr = (UINT8 *) OutputStruct->Data.Address16.ResourceSource.StringPtr; /* Copy the string into the buffer */ @@ -338,7 +338,7 @@ AcpiRsAddress16Resource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -373,7 +373,7 @@ AcpiRsAddress16Stream ( UINT8 *Buffer = *OutputBuffer; UINT8 *LengthField; UINT8 Temp8; - NATIVE_CHAR *TempPointer = NULL; + char *TempPointer = NULL; ACPI_SIZE ActualBytes; @@ -481,20 +481,19 @@ AcpiRsAddress16Stream ( *Buffer = Temp8; Buffer += 1; - TempPointer = (NATIVE_CHAR *) Buffer; + TempPointer = (char *) Buffer; /* * Copy the string */ - STRCPY (TempPointer, + ACPI_STRCPY (TempPointer, LinkedList->Data.Address16.ResourceSource.StringPtr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - Buffer += (STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) - + 1); + Buffer += (ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) + 1); } /* @@ -542,10 +541,10 @@ AcpiRsAddress32Resource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer; - ACPI_RESOURCE *OutputStruct; + ACPI_RESOURCE *OutputStruct= (void *) *OutputBuffer; UINT16 Temp16; UINT8 Temp8; - NATIVE_CHAR *TempPtr; + UINT8 *TempPtr; ACPI_SIZE StructSize; UINT32 Index; @@ -554,8 +553,6 @@ AcpiRsAddress32Resource ( Buffer = ByteStreamBuffer; - OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; - StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32); /* @@ -695,9 +692,9 @@ AcpiRsAddress32Resource ( /* Point the String pointer to the end of this structure */ OutputStruct->Data.Address32.ResourceSource.StringPtr = - (NATIVE_CHAR *)((UINT8 *)OutputStruct + StructSize); + (char *)((UINT8 *)OutputStruct + StructSize); - TempPtr = OutputStruct->Data.Address32.ResourceSource.StringPtr; + TempPtr = (UINT8 *) OutputStruct->Data.Address32.ResourceSource.StringPtr; /* Copy the string into the buffer */ @@ -735,7 +732,7 @@ AcpiRsAddress32Resource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -770,7 +767,7 @@ AcpiRsAddress32Stream ( UINT8 *Buffer; UINT16 *LengthField; UINT8 Temp8; - NATIVE_CHAR *TempPointer; + char *TempPointer; ACPI_FUNCTION_TRACE ("RsAddress32Stream"); @@ -787,7 +784,7 @@ AcpiRsAddress32Stream ( /* * Set a pointer to the Length field - to be filled in later */ - LengthField = (UINT16 *) Buffer; + LengthField = ACPI_CAST_PTR (UINT16, Buffer); Buffer += 2; /* @@ -879,19 +876,19 @@ AcpiRsAddress32Stream ( *Buffer = Temp8; Buffer += 1; - TempPointer = (NATIVE_CHAR *) Buffer; + TempPointer = (char *) Buffer; /* * Copy the string */ - STRCPY (TempPointer, + ACPI_STRCPY (TempPointer, LinkedList->Data.Address32.ResourceSource.StringPtr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - Buffer += (STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1); + Buffer += (ACPI_STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1); } /* @@ -937,10 +934,10 @@ AcpiRsAddress64Resource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer; - ACPI_RESOURCE *OutputStruct; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16; UINT8 Temp8; - NATIVE_CHAR *TempPtr; + UINT8 *TempPtr; ACPI_SIZE StructSize; UINT32 Index; @@ -949,8 +946,6 @@ AcpiRsAddress64Resource ( Buffer = ByteStreamBuffer; - OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; - StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64); /* @@ -1093,9 +1088,9 @@ AcpiRsAddress64Resource ( /* Point the String pointer to the end of this structure */ OutputStruct->Data.Address64.ResourceSource.StringPtr = - (NATIVE_CHAR *)((UINT8 *)OutputStruct + StructSize); + (char *)((UINT8 *)OutputStruct + StructSize); - TempPtr = OutputStruct->Data.Address64.ResourceSource.StringPtr; + TempPtr = (UINT8 *) OutputStruct->Data.Address64.ResourceSource.StringPtr; /* Copy the string into the buffer */ @@ -1134,7 +1129,7 @@ AcpiRsAddress64Resource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -1169,7 +1164,7 @@ AcpiRsAddress64Stream ( UINT8 *Buffer; UINT16 *LengthField; UINT8 Temp8; - NATIVE_CHAR *TempPointer; + char *TempPointer; ACPI_FUNCTION_TRACE ("RsAddress64Stream"); @@ -1187,7 +1182,7 @@ AcpiRsAddress64Stream ( * Set a pointer to the Length field - to be filled in later */ - LengthField = (UINT16 *)Buffer; + LengthField = ACPI_CAST_PTR (UINT16, Buffer); Buffer += 2; /* @@ -1279,18 +1274,18 @@ AcpiRsAddress64Stream ( *Buffer = Temp8; Buffer += 1; - TempPointer = (NATIVE_CHAR *) Buffer; + TempPointer = (char *) Buffer; /* * Copy the string */ - STRCPY (TempPointer, LinkedList->Data.Address64.ResourceSource.StringPtr); + ACPI_STRCPY (TempPointer, LinkedList->Data.Address64.ResourceSource.StringPtr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - Buffer += (STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1); + Buffer += (ACPI_STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1); } /* diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c index 2ed8a915c..99712f77e 100644 --- a/source/components/resources/rscalc.c +++ b/source/components/resources/rscalc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscalc - Calculate stream and list lengths - * $Revision: 1.39 $ + * $Revision: 1.46 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -127,7 +127,7 @@ /******************************************************************************* * - * FUNCTION: AcpiRsCalculateByteStreamLength + * FUNCTION: AcpiRsGetByteStreamLength * * PARAMETERS: LinkedList - Pointer to the resource linked list * SizeNeeded - UINT32 pointer of the size buffer needed @@ -142,7 +142,7 @@ ******************************************************************************/ ACPI_STATUS -AcpiRsCalculateByteStreamLength ( +AcpiRsGetByteStreamLength ( ACPI_RESOURCE *LinkedList, ACPI_SIZE *SizeNeeded) { @@ -152,7 +152,7 @@ AcpiRsCalculateByteStreamLength ( BOOLEAN Done = FALSE; - ACPI_FUNCTION_TRACE ("RsCalculateByteStreamLength"); + ACPI_FUNCTION_TRACE ("RsGetByteStreamLength"); while (!Done) @@ -276,10 +276,10 @@ AcpiRsCalculateByteStreamLength ( */ SegmentSize = 16; - if (NULL != LinkedList->Data.Address16.ResourceSource.StringPtr) + if (LinkedList->Data.Address16.ResourceSource.StringPtr) { - SegmentSize += (1 + - LinkedList->Data.Address16.ResourceSource.StringLength); + SegmentSize += LinkedList->Data.Address16.ResourceSource.StringLength; + SegmentSize++; } break; @@ -293,10 +293,10 @@ AcpiRsCalculateByteStreamLength ( */ SegmentSize = 26; - if (NULL != LinkedList->Data.Address32.ResourceSource.StringPtr) + if (LinkedList->Data.Address32.ResourceSource.StringPtr) { - SegmentSize += (1 + - LinkedList->Data.Address32.ResourceSource.StringLength); + SegmentSize += LinkedList->Data.Address32.ResourceSource.StringLength; + SegmentSize++; } break; @@ -310,10 +310,10 @@ AcpiRsCalculateByteStreamLength ( */ SegmentSize = 46; - if (NULL != LinkedList->Data.Address64.ResourceSource.StringPtr) + if (LinkedList->Data.Address64.ResourceSource.StringPtr) { - SegmentSize += (1 + - LinkedList->Data.Address64.ResourceSource.StringLength); + SegmentSize += LinkedList->Data.Address64.ResourceSource.StringLength; + SegmentSize++; } break; @@ -328,12 +328,12 @@ AcpiRsCalculateByteStreamLength ( * Resource Source + 1 for the null. */ SegmentSize = 9 + - ((LinkedList->Data.ExtendedIrq.NumberOfInterrupts - 1) * 4); + (((ACPI_SIZE) LinkedList->Data.ExtendedIrq.NumberOfInterrupts - 1) * 4); - if (NULL != ExIrq->ResourceSource.StringPtr) + if (ExIrq && ExIrq->ResourceSource.StringPtr) { - SegmentSize += (1 + - LinkedList->Data.ExtendedIrq.ResourceSource.StringLength); + SegmentSize += LinkedList->Data.ExtendedIrq.ResourceSource.StringLength; + SegmentSize++; } break; @@ -368,7 +368,7 @@ AcpiRsCalculateByteStreamLength ( /******************************************************************************* * - * FUNCTION: AcpiRsCalculateListLength + * FUNCTION: AcpiRsGetListLength * * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream * ByteStreamBufferLength - Size of ByteStreamBuffer @@ -385,7 +385,7 @@ AcpiRsCalculateByteStreamLength ( ******************************************************************************/ ACPI_STATUS -AcpiRsCalculateListLength ( +AcpiRsGetListLength ( UINT8 *ByteStreamBuffer, UINT32 ByteStreamBufferLength, ACPI_SIZE *SizeNeeded) @@ -404,7 +404,7 @@ AcpiRsCalculateListLength ( UINT8 AdditionalBytes; - ACPI_FUNCTION_TRACE ("RsCalculateListLength"); + ACPI_FUNCTION_TRACE ("RsGetListLength"); while (BytesParsed < ByteStreamBufferLength) @@ -823,7 +823,7 @@ AcpiRsCalculateListLength ( /******************************************************************************* * - * FUNCTION: AcpiRsCalculatePciRoutingTableLength + * FUNCTION: AcpiRsGetPciRoutingTableLength * * PARAMETERS: PackageObject - Pointer to the package object * BufferSizeNeeded - UINT32 pointer of the size buffer @@ -839,12 +839,12 @@ AcpiRsCalculateListLength ( ******************************************************************************/ ACPI_STATUS -AcpiRsCalculatePciRoutingTableLength ( +AcpiRsGetPciRoutingTableLength ( ACPI_OPERAND_OBJECT *PackageObject, ACPI_SIZE *BufferSizeNeeded) { UINT32 NumberOfElements; - UINT32 TempSizeNeeded = 0; + ACPI_SIZE TempSizeNeeded = 0; ACPI_OPERAND_OBJECT **TopObjectList; UINT32 Index; ACPI_OPERAND_OBJECT *PackageElement; @@ -853,7 +853,7 @@ AcpiRsCalculatePciRoutingTableLength ( UINT32 TableIndex; - ACPI_FUNCTION_TRACE ("RsCalculatePciRoutingTableLength"); + ACPI_FUNCTION_TRACE ("RsGetPciRoutingTableLength"); NumberOfElements = PackageObject->Package.Count; @@ -890,8 +890,8 @@ AcpiRsCalculatePciRoutingTableLength ( for (TableIndex = 0; TableIndex < 4 && !NameFound; TableIndex++) { - if ((ACPI_TYPE_STRING == (*SubObjectList)->Common.Type) || - ((INTERNAL_TYPE_REFERENCE == (*SubObjectList)->Common.Type) && + if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*SubObjectList)) || + ((ACPI_TYPE_LOCAL_REFERENCE == ACPI_GET_OBJECT_TYPE (*SubObjectList)) && ((*SubObjectList)->Reference.Opcode == AML_INT_NAMEPATH_OP))) { NameFound = TRUE; @@ -910,15 +910,15 @@ AcpiRsCalculatePciRoutingTableLength ( /* * Was a String type found? */ - if (TRUE == NameFound) + if (NameFound) { - if (ACPI_TYPE_STRING == (*SubObjectList)->Common.Type) + if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_STRING) { /* - * The length String.Length field includes the - * terminating NULL + * The length String.Length field does not include the + * terminating NULL, add 1 */ - TempSizeNeeded += (*SubObjectList)->String.Length; + TempSizeNeeded += ((*SubObjectList)->String.Length + 1); } else { diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index 80c2a0bb1..c89ad82ee 100644 --- a/source/components/resources/rscreate.c +++ b/source/components/resources/rscreate.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscreate - Create resource lists/tables - * $Revision: 1.52 $ + * $Revision: 1.64 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -132,7 +132,6 @@ * * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream * OutputBuffer - Pointer to the user's buffer - * OutputBufferLength - Pointer to the size of OutputBuffer * * RETURN: Status - AE_OK if okay, else a valid ACPI_STATUS code * If OutputBuffer is not large enough, OutputBufferLength @@ -160,7 +159,8 @@ AcpiRsCreateResourceList ( ACPI_FUNCTION_TRACE ("RsCreateResourceList"); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamBuffer = %p\n", ByteStreamBuffer)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamBuffer = %p\n", + ByteStreamBuffer)); /* * Params already validated, so we don't re-validate here @@ -172,11 +172,11 @@ AcpiRsCreateResourceList ( * Pass the ByteStreamBuffer into a module that can calculate * the buffer size needed for the linked list */ - Status = AcpiRsCalculateListLength (ByteStreamStart, ByteStreamBufferLength, + Status = AcpiRsGetListLength (ByteStreamStart, ByteStreamBufferLength, &ListSizeNeeded); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n", - Status, ListSizeNeeded)); + Status, (UINT32) ListSizeNeeded)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -199,8 +199,8 @@ AcpiRsCreateResourceList ( return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, OutputBuffer->Length)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } @@ -212,7 +212,6 @@ AcpiRsCreateResourceList ( * PARAMETERS: PackageObject - Pointer to an ACPI_OPERAND_OBJECT * package * OutputBuffer - Pointer to the user's buffer - * OutputBufferLength - Size of OutputBuffer * * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code. * If the OutputBuffer is too small, the error will be @@ -233,13 +232,13 @@ AcpiRsCreatePciRoutingTable ( ACPI_BUFFER *OutputBuffer) { UINT8 *Buffer; - ACPI_OPERAND_OBJECT **TopObjectList = NULL; - ACPI_OPERAND_OBJECT **SubObjectList = NULL; - ACPI_OPERAND_OBJECT *PackageElement = NULL; + ACPI_OPERAND_OBJECT **TopObjectList; + ACPI_OPERAND_OBJECT **SubObjectList; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_SIZE BufferSizeNeeded = 0; - UINT32 NumberOfElements = 0; - UINT32 Index = 0; - ACPI_PCI_ROUTING_TABLE *UserPrt = NULL; + UINT32 NumberOfElements; + UINT32 Index; + ACPI_PCI_ROUTING_TABLE *UserPrt; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_BUFFER PathBuffer; @@ -253,14 +252,15 @@ AcpiRsCreatePciRoutingTable ( /* * Get the required buffer length */ - Status = AcpiRsCalculatePciRoutingTableLength (PackageObject, + Status = AcpiRsGetPciRoutingTableLength (PackageObject, &BufferSizeNeeded); - if (!ACPI_SUCCESS(Status)) + if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", BufferSizeNeeded)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", + (UINT32) BufferSizeNeeded)); /* Validate/Allocate/Clear caller buffer */ @@ -271,13 +271,14 @@ AcpiRsCreatePciRoutingTable ( } /* - * Loop through the ACPI_INTERNAL_OBJECTS - Each object should contain an + * Loop through the ACPI_INTERNAL_OBJECTS - Each object + * should be a package that in turn contains an * ACPI_INTEGER Address, a UINT8 Pin, a Name and a UINT8 SourceIndex. */ TopObjectList = PackageObject->Package.Elements; NumberOfElements = PackageObject->Package.Count; Buffer = OutputBuffer->Pointer; - UserPrt = (ACPI_PCI_ROUTING_TABLE *) Buffer; + UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); for (Index = 0; Index < NumberOfElements; Index++) { @@ -288,100 +289,119 @@ AcpiRsCreatePciRoutingTable ( * be zero because we cleared the return buffer earlier */ Buffer += UserPrt->Length; - UserPrt = (ACPI_PCI_ROUTING_TABLE *) Buffer; + UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); /* * Fill in the Length field with the information we have at this point. - * The minus four is to subtract the size of the UINT8 Source[4] member + * The minus four is to subtract the size of the UINT8 Source[4] member * because it is added below. */ - UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) -4); + UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4); /* - * Dereference the sub-package + * Each element of the top-level package must also be a package */ - PackageElement = *TopObjectList; - - /* - * The SubObjectList will now point to an array of the four IRQ - * elements: Address, Pin, Source and SourceIndex - */ - SubObjectList = PackageElement->Package.Elements; - - /* - * 1) First subobject: Dereference the Address - */ - if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) + if (ACPI_GET_OBJECT_TYPE (*TopObjectList) != ACPI_TYPE_PACKAGE) { - UserPrt->Address = (*SubObjectList)->Integer.Value; + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X]) Need sub-package, found %s\n", + Index, AcpiUtGetObjectTypeName (*TopObjectList))); + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } + + /* Each sub-package must be of length 4 */ + + if ((*TopObjectList)->Package.Count != 4) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X]) Need package of length 4, found length %d\n", + Index, (*TopObjectList)->Package.Count)); + return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT); + } + + /* + * Dereference the sub-package. + * The SubObjectList will now point to an array of the four IRQ + * elements: [Address, Pin, Source, SourceIndex] + */ + SubObjectList = (*TopObjectList)->Package.Elements; + + /* + * 1) First subobject: Dereference the PRT.Address + */ + ObjDesc = SubObjectList[0]; + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) + { + UserPrt->Address = ObjDesc->Integer.Value; } else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X].Address) Need Integer, found %s\n", + Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } /* - * 2) Second subobject: Dereference the Pin + * 2) Second subobject: Dereference the PRT.Pin */ - SubObjectList++; - - if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) + ObjDesc = SubObjectList[1]; + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { - UserPrt->Pin = (UINT32) (*SubObjectList)->Integer.Value; + UserPrt->Pin = (UINT32) ObjDesc->Integer.Value; } else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X].Pin) Need Integer, found %s\n", + Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } /* - * 3) Third subobject: Dereference the Source Name + * 3) Third subobject: Dereference the PRT.SourceName */ - SubObjectList++; - - switch ((*SubObjectList)->Common.Type) + ObjDesc = SubObjectList[2]; + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { - case INTERNAL_TYPE_REFERENCE: + case ACPI_TYPE_LOCAL_REFERENCE: - if ((*SubObjectList)->Reference.Opcode != AML_INT_NAMEPATH_OP) + if (ObjDesc->Reference.Opcode != AML_INT_NAMEPATH_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n", - (*SubObjectList)->Reference.Opcode)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X].Source) Need name, found reference op %X\n", + Index, ObjDesc->Reference.Opcode)); return_ACPI_STATUS (AE_BAD_DATA); } - Node = (*SubObjectList)->Reference.Node; + Node = ObjDesc->Reference.Node; /* Use *remaining* length of the buffer as max for pathname */ PathBuffer.Length = OutputBuffer->Length - - (UINT32) ((UINT8 *) UserPrt->Source - (UINT8 *) OutputBuffer->Pointer); + (UINT32) ((UINT8 *) UserPrt->Source - + (UINT8 *) OutputBuffer->Pointer); PathBuffer.Pointer = UserPrt->Source; - Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) Node, &PathBuffer); + Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer); - UserPrt->Length += STRLEN (UserPrt->Source) + 1; /* include null terminator */ + UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1; /* include null terminator */ break; case ACPI_TYPE_STRING: - STRCPY (UserPrt->Source, - (*SubObjectList)->String.Pointer); + ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer); - /* Add to the Length field the length of the string */ + /* Add to the Length field the length of the string (add 1 for terminator) */ - UserPrt->Length += (*SubObjectList)->String.Length; + UserPrt->Length += ObjDesc->String.Length + 1; break; case ACPI_TYPE_INTEGER: /* - * If this is a number, then the Source Name is NULL, since the + * If this is a number, then the Source Name is NULL, since the * entire buffer was zeroed out, we can leave this alone. * * Add to the Length field the length of the UINT32 NULL @@ -392,8 +412,9 @@ AcpiRsCreatePciRoutingTable ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X].Source) Need Ref/String/Integer, found %s\n", + Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -402,28 +423,28 @@ AcpiRsCreatePciRoutingTable ( UserPrt->Length = ACPI_ROUND_UP_TO_64BITS (UserPrt->Length); /* - * 4) Fourth subobject: Dereference the Source Index + * 4) Fourth subobject: Dereference the PRT.SourceIndex */ - SubObjectList++; - - if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) + ObjDesc = SubObjectList[3]; + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { - UserPrt->SourceIndex = (UINT32) (*SubObjectList)->Integer.Value; + UserPrt->SourceIndex = (UINT32) ObjDesc->Integer.Value; } else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X].SourceIndex) Need Integer, found %s\n", + Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } - /* Point to the next ACPI_OPERAND_OBJECT */ + /* Point to the next ACPI_OPERAND_OBJECT in the top level package */ TopObjectList++; } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, OutputBuffer->Length)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } @@ -458,7 +479,8 @@ AcpiRsCreateByteStream ( ACPI_FUNCTION_TRACE ("RsCreateByteStream"); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n", LinkedListBuffer)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n", + LinkedListBuffer)); /* * Params already validated, so we don't re-validate here @@ -466,11 +488,11 @@ AcpiRsCreateByteStream ( * Pass the LinkedListBuffer into a module that calculates * the buffer size needed for the byte stream. */ - Status = AcpiRsCalculateByteStreamLength (LinkedListBuffer, + Status = AcpiRsGetByteStreamLength (LinkedListBuffer, &ByteStreamSizeNeeded); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamSizeNeeded=%X, %s\n", - ByteStreamSizeNeeded, AcpiFormatException (Status))); + (UINT32) ByteStreamSizeNeeded, AcpiFormatException (Status))); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -493,8 +515,8 @@ AcpiRsCreateByteStream ( return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, OutputBuffer->Length)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index b16eaeb62..46bf04ea9 100644 --- a/source/components/resources/rsdump.c +++ b/source/components/resources/rsdump.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsdump - Functions to display the resource structures. - * $Revision: 1.28 $ + * $Revision: 1.35 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -124,7 +124,7 @@ ACPI_MODULE_NAME ("rsdump") -#ifdef ACPI_DEBUG +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /******************************************************************************* * @@ -269,9 +269,9 @@ AcpiRsDumpDma ( void AcpiRsDumpStartDependFns ( - ACPI_RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - ACPI_RESOURCE_START_DPF *SdfData = (ACPI_RESOURCE_START_DPF *) Data; + ACPI_RESOURCE_START_DPF *SdfData = (ACPI_RESOURCE_START_DPF *) Data; ACPI_FUNCTION_ENTRY (); @@ -976,20 +976,25 @@ AcpiRsDumpAddress64 ( ACPI_ADDRESS_FIXED == Address64Data->MaxAddressFixed ? "" : "not "); - AcpiOsPrintf (" Granularity: %16X\n", - Address64Data->Granularity); + AcpiOsPrintf (" Granularity: %8.8X%8.8X\n", + ACPI_HIDWORD (Address64Data->Granularity), + ACPI_LODWORD (Address64Data->Granularity)); - AcpiOsPrintf (" Address range min: %16X\n", - Address64Data->MinAddressRange); + AcpiOsPrintf (" Address range min: %8.8X%8.8X\n", + ACPI_HIDWORD (Address64Data->MinAddressRange), + ACPI_HIDWORD (Address64Data->MinAddressRange)); - AcpiOsPrintf (" Address range max: %16X\n", - Address64Data->MaxAddressRange); + AcpiOsPrintf (" Address range max: %8.8X%8.8X\n", + ACPI_HIDWORD (Address64Data->MaxAddressRange), + ACPI_HIDWORD (Address64Data->MaxAddressRange)); - AcpiOsPrintf (" Address translation offset: %16X\n", - Address64Data->AddressTranslationOffset); + AcpiOsPrintf (" Address translation offset: %8.8X%8.8X\n", + ACPI_HIDWORD (Address64Data->AddressTranslationOffset), + ACPI_HIDWORD (Address64Data->AddressTranslationOffset)); - AcpiOsPrintf (" Address Length: %16X\n", - Address64Data->AddressLength); + AcpiOsPrintf (" Address Length: %8.8X%8.8X\n", + ACPI_HIDWORD (Address64Data->AddressLength), + ACPI_HIDWORD (Address64Data->AddressLength)); if(0xFF != Address64Data->ResourceSource.Index) { @@ -1093,7 +1098,7 @@ AcpiRsDumpResourceList ( { while (!Done) { - AcpiOsPrintf ("Resource structure %x.\n", Count++); + AcpiOsPrintf ("Resource structure %X.\n", Count++); switch (Resource->Id) { @@ -1200,14 +1205,14 @@ AcpiRsDumpIrqList ( if (AcpiDbgLevel & ACPI_LV_RESOURCES && _COMPONENT & AcpiDbgLayer) { - PrtElement = (ACPI_PCI_ROUTING_TABLE *) Buffer; + PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); while (!Done) { AcpiOsPrintf ("PCI IRQ Routing Table structure %X.\n", Count++); AcpiOsPrintf (" Address: %8.8X%8.8X\n", - ACPI_HIDWORD (PrtElement->Address), + ACPI_HIDWORD (PrtElement->Address), ACPI_LODWORD (PrtElement->Address)); AcpiOsPrintf (" Pin: %X\n", PrtElement->Pin); @@ -1219,7 +1224,7 @@ AcpiRsDumpIrqList ( Buffer += PrtElement->Length; - PrtElement = (ACPI_PCI_ROUTING_TABLE *) Buffer; + PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); if(0 == PrtElement->Length) { diff --git a/source/components/resources/rsio.c b/source/components/resources/rsio.c index 63c46184d..fc72a6db7 100644 --- a/source/components/resources/rsio.c +++ b/source/components/resources/rsio.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsio - IO and DMA resource descriptors - * $Revision: 1.17 $ + * $Revision: 1.23 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -152,7 +152,7 @@ AcpiRsIoResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO); @@ -211,7 +211,7 @@ AcpiRsIoResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -250,7 +250,7 @@ AcpiRsFixedIoResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO); @@ -285,7 +285,7 @@ AcpiRsFixedIoResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -469,7 +469,7 @@ AcpiRsDmaResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT8 Temp8 = 0; UINT8 Index; UINT8 i; @@ -491,7 +491,7 @@ AcpiRsDmaResource ( Buffer += 1; Temp8 = *Buffer; - /* Decode the IRQ bits */ + /* Decode the DMA channel bits */ for (i = 0, Index = 0; Index < 8; Index++) { @@ -501,13 +501,17 @@ AcpiRsDmaResource ( i++; } } + + /* Zero DMA channels is valid */ + OutputStruct->Data.Dma.NumberOfChannels = i; - - - /* - * Calculate the structure size based upon the number of interrupts - */ - StructSize += (OutputStruct->Data.Dma.NumberOfChannels - 1) * 4; + if (i > 0) + { + /* + * Calculate the structure size based upon the number of interrupts + */ + StructSize += ((ACPI_SIZE) i - 1) * 4; + } /* * Point to Byte 2 @@ -522,6 +526,7 @@ AcpiRsDmaResource ( if (0x03 == OutputStruct->Data.Dma.Transfer) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n")); return_ACPI_STATUS (AE_BAD_DATA); } @@ -538,7 +543,7 @@ AcpiRsDmaResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure diff --git a/source/components/resources/rsirq.c b/source/components/resources/rsirq.c index 85133634b..1a871b407 100644 --- a/source/components/resources/rsirq.c +++ b/source/components/resources/rsirq.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsirq - IRQ resource descriptors - * $Revision: 1.23 $ + * $Revision: 1.32 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -152,7 +152,7 @@ AcpiRsIrqResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; UINT8 Index; @@ -183,18 +183,23 @@ AcpiRsIrqResource ( for (i = 0, Index = 0; Index < 16; Index++) { - if((Temp16 >> Index) & 0x01) + if ((Temp16 >> Index) & 0x01) { OutputStruct->Data.Irq.Interrupts[i] = Index; i++; } } - OutputStruct->Data.Irq.NumberOfInterrupts = i; - /* - * Calculate the structure size based upon the number of interrupts - */ - StructSize += (OutputStruct->Data.Irq.NumberOfInterrupts - 1) * 4; + /* Zero interrupts is valid */ + + OutputStruct->Data.Irq.NumberOfInterrupts = i; + if (i > 0) + { + /* + * Calculate the structure size based upon the number of interrupts + */ + StructSize += ((ACPI_SIZE) i - 1) * 4; + } /* * Point to Byte 3 if it is used @@ -226,6 +231,7 @@ AcpiRsIrqResource ( * are allowed (ACPI spec v1.0b ection 6.4.2.1), * so an error will occur if we reach this point */ + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid interrupt polarity/trigger in resource list\n")); return_ACPI_STATUS (AE_BAD_DATA); } } @@ -249,7 +255,7 @@ AcpiRsIrqResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -385,10 +391,10 @@ AcpiRsExtendedIrqResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; - NATIVE_CHAR *TempPtr; + UINT8 *TempPtr; UINT8 Index; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ); @@ -458,8 +464,8 @@ AcpiRsExtendedIrqResource ( */ for (Index = 0; Index < Temp8; Index++) { - OutputStruct->Data.ExtendedIrq.Interrupts[Index] = - (UINT32)*Buffer; + ACPI_MOVE_UNALIGNED32_TO_32 ( + &OutputStruct->Data.ExtendedIrq.Interrupts[Index], Buffer); /* Point to the next IRQ */ @@ -474,7 +480,7 @@ AcpiRsExtendedIrqResource ( * stream that are default. */ if (*BytesConsumed > - (UINT32)(OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) + 5) + ((ACPI_SIZE) OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) + 5) { /* Dereference the Index */ @@ -489,9 +495,9 @@ AcpiRsExtendedIrqResource ( * Point the String pointer to the end of this structure. */ OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr = - (NATIVE_CHAR *)(OutputStruct + StructSize); + (char *)(OutputStruct + StructSize); - TempPtr = OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr; + TempPtr = (UINT8 *) OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr; /* Copy the string into the buffer */ @@ -529,7 +535,7 @@ AcpiRsExtendedIrqResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -565,7 +571,7 @@ AcpiRsExtendedIrqStream ( UINT16 *LengthField; UINT8 Temp8 = 0; UINT8 Index; - NATIVE_CHAR *TempPointer = NULL; + char *TempPointer = NULL; ACPI_FUNCTION_TRACE ("RsExtendedIrqStream"); @@ -580,7 +586,7 @@ AcpiRsExtendedIrqStream ( /* * Set a pointer to the Length field - to be filled in later */ - LengthField = (UINT16 *)Buffer; + LengthField = ACPI_CAST_PTR (UINT16, Buffer); Buffer += 2; /* @@ -635,19 +641,19 @@ AcpiRsExtendedIrqStream ( *Buffer = (UINT8) LinkedList->Data.ExtendedIrq.ResourceSource.Index; Buffer += 1; - TempPointer = (NATIVE_CHAR *) Buffer; + TempPointer = (char *) Buffer; /* * Copy the string */ - STRCPY (TempPointer, + ACPI_STRCPY (TempPointer, LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - Buffer += (STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1); + Buffer += (ACPI_STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1); } /* diff --git a/source/components/resources/rslist.c b/source/components/resources/rslist.c index 9a3983d28..b70fb2fe7 100644 --- a/source/components/resources/rslist.c +++ b/source/components/resources/rslist.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rslist - Linked list utilities - * $Revision: 1.25 $ + * $Revision: 1.32 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -163,6 +163,11 @@ AcpiRsGetResourceType ( * Large Resource Type -- All bits are valid */ return (ResourceStartByte); + + + default: + /* No other types of resource descriptor */ + break; } return (0xFF); @@ -192,7 +197,7 @@ AcpiRsByteStreamToList ( UINT8 *OutputBuffer) { ACPI_STATUS Status; - UINT32 BytesParsed = 0; + ACPI_SIZE BytesParsed = 0; UINT8 ResourceType = 0; ACPI_SIZE BytesConsumed = 0; UINT8 *Buffer = OutputBuffer; @@ -204,7 +209,7 @@ AcpiRsByteStreamToList ( while (BytesParsed < ByteStreamBufferLength && - FALSE == EndTagProcessed) + !EndTagProcessed) { /* * The next byte in the stream is the resource type @@ -360,14 +365,13 @@ AcpiRsByteStreamToList ( default: /* - * Invalid/Unknowns resource type + * Invalid/Unknown resource type */ - Status = AE_AML_ERROR; + Status = AE_AML_INVALID_RESOURCE_TYPE; break; } - - if (!ACPI_SUCCESS(Status)) + if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } @@ -385,7 +389,7 @@ AcpiRsByteStreamToList ( /* * Set the Buffer to the next structure */ - Resource = (ACPI_RESOURCE *)Buffer; + Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer); Resource->Length = ACPI_ALIGN_RESOURCE_SIZE(Resource->Length); Buffer += ACPI_ALIGN_RESOURCE_SIZE(StructureSize); @@ -394,9 +398,9 @@ AcpiRsByteStreamToList ( /* * Check the reason for exiting the while loop */ - if (TRUE != EndTagProcessed) + if (!EndTagProcessed) { - return_ACPI_STATUS (AE_AML_ERROR); + return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); } return_ACPI_STATUS (AE_OK); @@ -410,7 +414,7 @@ AcpiRsByteStreamToList ( * PARAMETERS: LinkedList - Pointer to the resource linked list * ByteSteamSizeNeeded - Calculated size of the byte stream * needed from calling - * AcpiRsCalculateByteStreamLength() + * AcpiRsGetByteStreamLength() * The size of the OutputBuffer is * guaranteed to be >= * ByteStreamSizeNeeded @@ -427,7 +431,7 @@ AcpiRsByteStreamToList ( ACPI_STATUS AcpiRsListToByteStream ( ACPI_RESOURCE *LinkedList, - UINT32 ByteStreamSizeNeeded, + ACPI_SIZE ByteStreamSizeNeeded, UINT8 *OutputBuffer) { ACPI_STATUS Status; @@ -566,13 +570,14 @@ AcpiRsListToByteStream ( * If we get here, everything is out of sync, * so exit with an error */ + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n", + LinkedList->Id)); Status = AE_BAD_DATA; break; } /* switch (LinkedList->Id) */ - - if (!ACPI_SUCCESS(Status)) + if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } diff --git a/source/components/resources/rsmemory.c b/source/components/resources/rsmemory.c index b0e6b1c3e..d011e8541 100644 --- a/source/components/resources/rsmemory.c +++ b/source/components/resources/rsmemory.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmem24 - Memory resource descriptors - * $Revision: 1.17 $ + * $Revision: 1.21 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -152,7 +152,7 @@ AcpiRsMemory24Resource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24); @@ -168,7 +168,7 @@ AcpiRsMemory24Resource ( ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); Buffer += 2; - *BytesConsumed = Temp16 + 3; + *BytesConsumed = (ACPI_SIZE) Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_MEM24; /* @@ -208,7 +208,7 @@ AcpiRsMemory24Resource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -329,7 +329,7 @@ AcpiRsMemory32RangeResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32); @@ -345,7 +345,7 @@ AcpiRsMemory32RangeResource ( ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); Buffer += 2; - *BytesConsumed = Temp16 + 3; + *BytesConsumed = (ACPI_SIZE) Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_MEM32; @@ -395,7 +395,7 @@ AcpiRsMemory32RangeResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -434,7 +434,7 @@ AcpiRsFixedMemory32Resource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32); @@ -450,7 +450,7 @@ AcpiRsFixedMemory32Resource ( ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); Buffer += 2; - *BytesConsumed = Temp16 + 3; + *BytesConsumed = (ACPI_SIZE) Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_FIXED_MEM32; @@ -477,7 +477,7 @@ AcpiRsFixedMemory32Resource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 3061cd38e..2a30dfece 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmisc - Miscellaneous resource descriptors - * $Revision: 1.20 $ + * $Revision: 1.25 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -151,7 +151,7 @@ AcpiRsEndTagResource ( UINT8 **OutputBuffer, ACPI_SIZE *StructureSize) { - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH; @@ -262,7 +262,7 @@ AcpiRsVendorResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; UINT8 Index; @@ -290,7 +290,7 @@ AcpiRsVendorResource ( /* Calculate bytes consumed */ - *BytesConsumed = Temp16 + 3; + *BytesConsumed = (ACPI_SIZE) Temp16 + 3; /* Point to the first vendor byte */ @@ -305,7 +305,7 @@ AcpiRsVendorResource ( /* Calculate bytes consumed */ - *BytesConsumed = Temp16 + 1; + *BytesConsumed = (ACPI_SIZE) Temp16 + 1; /* Point to the first vendor byte */ @@ -331,7 +331,7 @@ AcpiRsVendorResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -394,7 +394,7 @@ AcpiRsVendorStream ( * Small Item, Set the descriptor field */ Temp8 = 0x70; - Temp8 |= LinkedList->Data.VendorSpecific.Length; + Temp8 |= (UINT8) LinkedList->Data.VendorSpecific.Length; *Buffer = Temp8; Buffer += 1; @@ -448,7 +448,7 @@ AcpiRsStartDependFnsResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF); @@ -480,7 +480,7 @@ AcpiRsStartDependFnsResource ( if (3 == OutputStruct->Data.StartDpf.CompatibilityPriority) { - return_ACPI_STATUS (AE_AML_ERROR); + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); } /* @@ -490,7 +490,7 @@ AcpiRsStartDependFnsResource ( if (3 == OutputStruct->Data.StartDpf.PerformanceRobustness) { - return_ACPI_STATUS (AE_AML_ERROR); + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); } } else @@ -505,7 +505,7 @@ AcpiRsStartDependFnsResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -543,7 +543,7 @@ AcpiRsEndDependFnsResource ( UINT8 **OutputBuffer, ACPI_SIZE *StructureSize) { - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH; @@ -563,7 +563,7 @@ AcpiRsEndDependFnsResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c index 8932d122b..9da385f2d 100644 --- a/source/components/resources/rsutils.c +++ b/source/components/resources/rsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsutils - Utilities for the resource manager - * $Revision: 1.28 $ + * $Revision: 1.35 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -149,7 +149,7 @@ AcpiRsGetPrtMethodData ( ACPI_HANDLE Handle, ACPI_BUFFER *RetBuffer) { - ACPI_OPERAND_OBJECT *RetObj; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; @@ -159,46 +159,23 @@ AcpiRsGetPrtMethodData ( /* Parameters guaranteed valid by caller */ /* - * Execute the method, no parameters + * Execute the method, no parameters */ - Status = AcpiNsEvaluateRelative (Handle, "_PRT", NULL, &RetObj); + Status = AcpiUtEvaluateObject (Handle, "_PRT", ACPI_BTYPE_PACKAGE, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - if (!RetObj) - { - /* Return object is required */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRT\n")); - return_ACPI_STATUS (AE_TYPE); - } - /* - * The return object will be a package, so check the parameters. If the - * return object is not a package, then the underlying AML code is corrupt - * or improperly written. - */ - if (ACPI_TYPE_PACKAGE != RetObj->Common.Type) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRT did not return a Package, returned %s\n", - AcpiUtGetTypeName (RetObj->Common.Type))); - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - - /* - * Create a resource linked list from the byte stream buffer that comes + * Create a resource linked list from the byte stream buffer that comes * back from the _CRS method execution. */ - Status = AcpiRsCreatePciRoutingTable (RetObj, RetBuffer); + Status = AcpiRsCreatePciRoutingTable (ObjDesc, RetBuffer); /* On exit, we must delete the object returned by EvaluateObject */ -Cleanup: - - AcpiUtRemoveReference (RetObj); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } @@ -226,7 +203,7 @@ AcpiRsGetCrsMethodData ( ACPI_HANDLE Handle, ACPI_BUFFER *RetBuffer) { - ACPI_OPERAND_OBJECT *RetObj; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; @@ -238,46 +215,22 @@ AcpiRsGetCrsMethodData ( /* * Execute the method, no parameters */ - Status = AcpiNsEvaluateRelative (Handle, "_CRS", NULL, &RetObj); + Status = AcpiUtEvaluateObject (Handle, "_CRS", ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - if (!RetObj) - { - /* Return object is required */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CRS\n")); - return_ACPI_STATUS (AE_TYPE); - } - - /* - * The return object will be a buffer, but check the - * parameters. If the return object is not a buffer, - * then the underlying AML code is corrupt or improperly - * written. - */ - if (ACPI_TYPE_BUFFER != RetObj->Common.Type) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CRS did not return a Buffer, returned %s\n", - AcpiUtGetTypeName (RetObj->Common.Type))); - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - /* * Make the call to create a resource linked list from the * byte stream buffer that comes back from the _CRS method * execution. */ - Status = AcpiRsCreateResourceList (RetObj, RetBuffer); + Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer); /* On exit, we must delete the object returned by evaluateObject */ -Cleanup: - - AcpiUtRemoveReference (RetObj); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } @@ -305,7 +258,7 @@ AcpiRsGetPrsMethodData ( ACPI_HANDLE Handle, ACPI_BUFFER *RetBuffer) { - ACPI_OPERAND_OBJECT *RetObj; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; @@ -317,46 +270,22 @@ AcpiRsGetPrsMethodData ( /* * Execute the method, no parameters */ - Status = AcpiNsEvaluateRelative (Handle, "_PRS", NULL, &RetObj); + Status = AcpiUtEvaluateObject (Handle, "_PRS", ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - if (!RetObj) - { - /* Return object is required */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRS\n")); - return_ACPI_STATUS (AE_TYPE); - } - - /* - * The return object will be a buffer, but check the - * parameters. If the return object is not a buffer, - * then the underlying AML code is corrupt or improperly - * written.. - */ - if (ACPI_TYPE_BUFFER != RetObj->Common.Type) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRS did not return a Buffer, returned %s\n", - AcpiUtGetTypeName (RetObj->Common.Type))); - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - /* * Make the call to create a resource linked list from the * byte stream buffer that comes back from the _CRS method * execution. */ - Status = AcpiRsCreateResourceList (RetObj, RetBuffer); + Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer); /* On exit, we must delete the object returned by evaluateObject */ -Cleanup: - - AcpiUtRemoveReference (RetObj); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } @@ -421,8 +350,9 @@ AcpiRsSetSrsMethodData ( /* * Set up the parameter object */ - Params[0]->Buffer.Length = Buffer.Length; + Params[0]->Buffer.Length = (UINT32) Buffer.Length; Params[0]->Buffer.Pointer = Buffer.Pointer; + Params[0]->Common.Flags = AOPOBJ_DATA_VALID; Params[1] = NULL; /* diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c index 07b9500fa..e9ba94848 100644 --- a/source/components/resources/rsxface.c +++ b/source/components/resources/rsxface.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsxface - Public interfaces to the resource manager - * $Revision: 1.18 $ + * $Revision: 1.20 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -118,8 +118,6 @@ #define __RSXFACE_C__ #include "acpi.h" -#include "acinterp.h" -#include "acnamesp.h" #include "acresrc.h" #define _COMPONENT ACPI_RESOURCES diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index 2790018a5..c5d04c236 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal - * $Revision: 1.53 $ + * $Revision: 1.67 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -141,10 +141,11 @@ ACPI_STATUS AcpiTbMatchSignature ( - NATIVE_CHAR *Signature, - ACPI_TABLE_DESC *TableInfo) + char *Signature, + ACPI_TABLE_DESC *TableInfo, + UINT8 SearchType) { - NATIVE_UINT i; + ACPI_NATIVE_UINT i; ACPI_FUNCTION_TRACE ("TbMatchSignature"); @@ -155,7 +156,12 @@ AcpiTbMatchSignature ( */ for (i = 0; i < NUM_ACPI_TABLES; i++) { - if (!STRNCMP (Signature, AcpiGbl_AcpiTableData[i].Signature, + if ((AcpiGbl_AcpiTableData[i].Flags & ACPI_TABLE_TYPE_MASK) != SearchType) + { + continue; + } + + if (!ACPI_STRNCMP (Signature, AcpiGbl_AcpiTableData[i].Signature, AcpiGbl_AcpiTableData[i].SigLength)) { /* Found a signature match, return index if requested */ @@ -165,13 +171,18 @@ AcpiTbMatchSignature ( TableInfo->Type = (UINT8) i; } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Signature match %4.4s\n", + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Table [%4.4s] matched and is a required ACPI table\n", (char *) AcpiGbl_AcpiTableData[i].Signature)); return_ACPI_STATUS (AE_OK); } } + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Table [%4.4s] is not a required ACPI table - ignored\n", + (char *) Signature)); + return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED); } @@ -180,8 +191,7 @@ AcpiTbMatchSignature ( * * FUNCTION: AcpiTbInstallTable * - * PARAMETERS: TablePtr - Input buffer pointer, optional - * TableInfo - Return value from AcpiTbGetTable + * PARAMETERS: TableInfo - Return value from AcpiTbGetTableBody * * RETURN: Status * @@ -193,7 +203,6 @@ AcpiTbMatchSignature ( ACPI_STATUS AcpiTbInstallTable ( - ACPI_TABLE_HEADER *TablePtr, ACPI_TABLE_DESC *TableInfo) { ACPI_STATUS Status; @@ -201,28 +210,29 @@ AcpiTbInstallTable ( ACPI_FUNCTION_TRACE ("TbInstallTable"); - /* - * Check the table signature and make sure it is recognized - * Also checks the header checksum - */ - Status = AcpiTbRecognizeTable (TablePtr, TableInfo); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Lock tables while installing */ - AcpiUtAcquireMutex (ACPI_MTX_TABLES); + Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n", + TableInfo->Pointer->Signature, AcpiFormatException (Status))); + return_ACPI_STATUS (Status); + } /* Install the table into the global data structure */ Status = AcpiTbInitTableDescriptor (TableInfo->Type, TableInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not install ACPI table [%s], %s\n", + TableInfo->Pointer->Signature, AcpiFormatException (Status))); + } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n", AcpiGbl_AcpiTableData[TableInfo->Type].Name, TableInfo->Pointer)); - AcpiUtReleaseMutex (ACPI_MTX_TABLES); + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); } @@ -231,8 +241,7 @@ AcpiTbInstallTable ( * * FUNCTION: AcpiTbRecognizeTable * - * PARAMETERS: TablePtr - Input buffer pointer, optional - * TableInfo - Return value from AcpiTbGetTable + * PARAMETERS: TableInfo - Return value from AcpiTbGetTableBody * * RETURN: Status * @@ -250,8 +259,8 @@ AcpiTbInstallTable ( ACPI_STATUS AcpiTbRecognizeTable ( - ACPI_TABLE_HEADER *TablePtr, - ACPI_TABLE_DESC *TableInfo) + ACPI_TABLE_DESC *TableInfo, + UINT8 SearchType) { ACPI_TABLE_HEADER *TableHeader; ACPI_STATUS Status; @@ -272,34 +281,26 @@ AcpiTbRecognizeTable ( * We only "recognize" a limited number of ACPI tables -- namely, the * ones that are used by the subsystem (DSDT, FADT, etc.) * - * An AE_NOT_FOUND means that the table was not recognized. + * An AE_TABLE_NOT_SUPPORTED means that the table was not recognized. * This can be any one of many valid ACPI tables, it just isn't one of * the tables that is consumed by the core subsystem */ - Status = AcpiTbMatchSignature (TableHeader->Signature, TableInfo); - if (ACPI_SUCCESS (Status)) + Status = AcpiTbMatchSignature (TableHeader->Signature, TableInfo, SearchType); + if (ACPI_FAILURE (Status)) { - /* Return the table type and length via the info struct */ - - TableInfo->Length = TableHeader->Length; - - /* - * Validate checksum for _most_ tables, - * even the ones whose signature we don't recognize - */ - if (TableInfo->Type != ACPI_TABLE_FACS) - { - Status = AcpiTbVerifyTableChecksum (TableHeader); - if (ACPI_FAILURE (Status) && - (!ACPI_CHECKSUM_ABORT)) - { - /* Ignore the error if configuration says so */ - - Status = AE_OK; - } - } + return_ACPI_STATUS (Status); } + Status = AcpiTbValidateTableHeader (TableHeader); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Return the table type and length via the info struct */ + + TableInfo->Length = (ACPI_SIZE) TableHeader->Length; + return_ACPI_STATUS (Status); } @@ -393,7 +394,6 @@ AcpiTbInitTableDescriptor ( TableDesc->Type = TableInfo->Type; TableDesc->Pointer = TableInfo->Pointer; - TableDesc->BasePointer = TableInfo->BasePointer; TableDesc->Length = TableInfo->Length; TableDesc->Allocation = TableInfo->Allocation; TableDesc->AmlStart = (UINT8 *) (TableDesc->Pointer + 1), @@ -475,11 +475,10 @@ AcpiTbDeleteAcpiTable ( return_VOID; } - AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - /* Free the table */ - - AcpiTbFreeAcpiTablesOfType (&AcpiGbl_AcpiTables[Type]); + if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_TABLES))) + { + return; + } /* Clear the appropriate "typed" global table pointer */ @@ -511,7 +510,11 @@ AcpiTbDeleteAcpiTable ( break; } - AcpiUtReleaseMutex (ACPI_MTX_TABLES); + /* Free the table */ + + AcpiTbFreeAcpiTablesOfType (&AcpiGbl_AcpiTables[Type]); + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_VOID; } @@ -593,12 +596,15 @@ AcpiTbDeleteSingleTable ( case ACPI_MEM_ALLOCATED: - ACPI_MEM_FREE (TableDesc->BasePointer); + ACPI_MEM_FREE (TableDesc->Pointer); break; case ACPI_MEM_MAPPED: - AcpiOsUnmapMemory (TableDesc->BasePointer, TableDesc->Length); + AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length); + break; + + default: break; } } @@ -611,7 +617,7 @@ AcpiTbDeleteSingleTable ( * * PARAMETERS: TableInfo - A table info struct * - * RETURN: None. + * RETURN: Pointer to the next table in the list (of same type) * * DESCRIPTION: Free the memory associated with an internal ACPI table that * is either installed or has never been installed. @@ -626,7 +632,7 @@ AcpiTbUninstallTable ( ACPI_TABLE_DESC *NextDesc; - ACPI_FUNCTION_TRACE_PTR ("TbDeleteSingleTable", TableDesc); + ACPI_FUNCTION_TRACE_PTR ("AcpiTbUninstallTable", TableDesc); if (!TableDesc) diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 3689532df..b81eab12c 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbutils - Table manipulation utilities - * $Revision: 1.48 $ + * $Revision: 1.58 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -118,7 +118,6 @@ #include "acpi.h" #include "actables.h" -#include "acinterp.h" #define _COMPONENT ACPI_TABLES @@ -166,7 +165,6 @@ AcpiTbHandleToObject ( } while (ListHead != &AcpiGbl_AcpiTables[i]); } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "TableId=%X does not exist\n", TableId)); return (AE_BAD_PARAMETER); } @@ -188,7 +186,7 @@ AcpiTbHandleToObject ( * name * 3) Table must be readable for length specified in the header * 4) Table checksum must be valid (with the exception of the FACS - * which has no checksum for some odd reason) + * which has no checksum because it contains variable fields) * ******************************************************************************/ @@ -211,22 +209,21 @@ AcpiTbValidateTableHeader ( return (AE_BAD_ADDRESS); } - /* Ensure that the signature is 4 ASCII characters */ - ACPI_MOVE_UNALIGNED32_TO_32 (&Signature, &TableHeader->Signature); + ACPI_MOVE_UNALIGNED32_TO_32 (&Signature, TableHeader->Signature); if (!AcpiUtValidAcpiName (Signature)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Table signature at %p [%p] has invalid characters\n", TableHeader, &Signature)); - ACPI_REPORT_WARNING (("Invalid table signature %4.4s found\n", (char *) &Signature)); + ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", + (char *) &Signature)); ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER)); return (AE_BAD_SIGNATURE); } - /* Validate the table length */ if (TableHeader->Length < sizeof (ACPI_TABLE_HEADER)) @@ -235,7 +232,8 @@ AcpiTbValidateTableHeader ( "Invalid length in table header %p name %4.4s\n", TableHeader, (char *) &Signature)); - ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", TableHeader->Length)); + ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", + (UINT32) TableHeader->Length)); ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER)); return (AE_BAD_HEADER); } @@ -244,91 +242,6 @@ AcpiTbValidateTableHeader ( } -/******************************************************************************* - * - * FUNCTION: AcpiTbMapAcpiTable - * - * PARAMETERS: PhysicalAddress - Physical address of table to map - * *Size - Size of the table. If zero, the size - * from the table header is used. - * Actual size is returned here. - * **LogicalAddress - Logical address of mapped table - * - * RETURN: Logical address of the mapped table. - * - * DESCRIPTION: Maps the physical address of table into a logical address - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbMapAcpiTable ( - ACPI_PHYSICAL_ADDRESS PhysicalAddress, - UINT32 *Size, - ACPI_TABLE_HEADER **LogicalAddress) -{ - ACPI_TABLE_HEADER *Table; - UINT32 TableSize = *Size; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_NAME ("TbMapAcpiTable"); - - - /* If size is zero, look at the table header to get the actual size */ - - if ((*Size) == 0) - { - /* Get the table header so we can extract the table length */ - - Status = AcpiOsMapMemory (PhysicalAddress, sizeof (ACPI_TABLE_HEADER), - (void **) &Table); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Extract the full table length before we delete the mapping */ - - TableSize = Table->Length; - - /* - * Validate the header and delete the mapping. - * We will create a mapping for the full table below. - */ - Status = AcpiTbValidateTableHeader (Table); - - /* Always unmap the memory for the header */ - - AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER)); - - /* Exit if header invalid */ - - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - - /* Map the physical memory for the correct length */ - - Status = AcpiOsMapMemory (PhysicalAddress, TableSize, (void **) &Table); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Mapped memory for ACPI table, length=%d(%X) at %p\n", - TableSize, TableSize, Table)); - - *Size = TableSize; - *LogicalAddress = Table; - - return (Status); -} - - /******************************************************************************* * * FUNCTION: AcpiTbVerifyTableChecksum @@ -361,13 +274,11 @@ AcpiTbVerifyTableChecksum ( if (Checksum) { - ACPI_REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n", - Checksum, (char *) &TableHeader->Signature)); + ACPI_REPORT_WARNING (("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", + TableHeader->Signature, (UINT32) TableHeader->Checksum, (UINT32) Checksum)); Status = AE_BAD_CHECKSUM; } - - return_ACPI_STATUS (Status); } @@ -387,7 +298,7 @@ AcpiTbVerifyTableChecksum ( UINT8 AcpiTbChecksum ( - const void *Buffer, + void *Buffer, UINT32 Length) { const UINT8 *limit; @@ -406,7 +317,6 @@ AcpiTbChecksum ( sum = (UINT8) (sum + *rover); } } - return (sum); } diff --git a/source/components/tables/tbxface.c b/source/components/tables/tbxface.c index 97ab578ec..96722794c 100644 --- a/source/components/tables/tbxface.c +++ b/source/components/tables/tbxface.c @@ -2,7 +2,7 @@ * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces - * $Revision: 1.50 $ + * $Revision: 1.61 $ * *****************************************************************************/ @@ -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 @@ -119,7 +119,6 @@ #include "acpi.h" #include "acnamesp.h" -#include "acinterp.h" #include "actables.h" @@ -143,9 +142,8 @@ ACPI_STATUS AcpiLoadTables (void) { - ACPI_PHYSICAL_ADDRESS RsdpPhysicalAddress; + ACPI_POINTER RsdpAddress; ACPI_STATUS Status; - UINT32 NumberOfTables = 0; ACPI_FUNCTION_TRACE ("AcpiLoadTables"); @@ -154,7 +152,7 @@ AcpiLoadTables (void) /* Get the RSDP */ Status = AcpiOsGetRootPointer (ACPI_LOGICAL_ADDRESSING, - &RsdpPhysicalAddress); + &RsdpAddress); if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("AcpiLoadTables: Could not get RSDP, %s\n", @@ -164,7 +162,9 @@ AcpiLoadTables (void) /* Map and validate the RSDP */ - Status = AcpiTbVerifyRsdp (RsdpPhysicalAddress); + AcpiGbl_TableFlags = RsdpAddress.PointerType; + + Status = AcpiTbVerifyRsdp (&RsdpAddress); if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("AcpiLoadTables: RSDP Failed validation: %s\n", @@ -174,7 +174,7 @@ AcpiLoadTables (void) /* Get the RSDT via the RSDP */ - Status = AcpiTbGetTableRsdt (&NumberOfTables); + Status = AcpiTbGetTableRsdt (); if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n", @@ -182,9 +182,9 @@ AcpiLoadTables (void) goto ErrorExit; } - /* Now get the rest of the tables */ + /* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */ - Status = AcpiTbGetAllTables (NumberOfTables, NULL); + Status = AcpiTbGetRequiredTables (); if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n", @@ -192,7 +192,7 @@ AcpiLoadTables (void) goto ErrorExit; } - ACPI_DEBUG_PRINT ((ACPI_DB_OK, "ACPI Tables successfully loaded\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); /* Load the namespace from the tables */ @@ -238,6 +238,7 @@ AcpiLoadTable ( { ACPI_STATUS Status; ACPI_TABLE_DESC TableInfo; + ACPI_POINTER Address; ACPI_FUNCTION_TRACE ("AcpiLoadTable"); @@ -250,7 +251,10 @@ AcpiLoadTable ( /* Copy the table to a local buffer */ - Status = AcpiTbGetTable (0, TablePtr, &TableInfo); + Address.PointerType = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING; + Address.Pointer.Logical = TablePtr; + + Status = AcpiTbGetTableBody (&Address, TablePtr, &TableInfo); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -258,10 +262,10 @@ AcpiLoadTable ( /* Install the new table into the local data structures */ - Status = AcpiTbInstallTable (NULL, &TableInfo); + Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { - /* Free table allocated by AcpiTbGetTable */ + /* Free table allocated by AcpiTbGetTableBody */ AcpiTbDeleteSingleTable (&TableInfo); return_ACPI_STATUS (Status); @@ -292,7 +296,7 @@ AcpiLoadTable ( { /* Uninstall table and free the buffer */ - AcpiTbUninstallTable (TableInfo.InstalledDesc); + (void) AcpiTbUninstallTable (TableInfo.InstalledDesc); } return_ACPI_STATUS (Status); @@ -422,7 +426,7 @@ AcpiGetTableHeader ( /* * Copy the header to the caller's buffer */ - MEMCPY ((void *) OutTableHeader, (void *) TblPtr, + ACPI_MEMCPY ((void *) OutTableHeader, (void *) TblPtr, sizeof (ACPI_TABLE_HEADER)); return_ACPI_STATUS (Status); @@ -460,7 +464,7 @@ AcpiGetTable ( { ACPI_TABLE_HEADER *TblPtr; ACPI_STATUS Status; - UINT32 TableLength; + ACPI_SIZE TableLength; ACPI_FUNCTION_TRACE ("AcpiGetTable"); @@ -517,7 +521,7 @@ AcpiGetTable ( } else { - TableLength = TblPtr->Length; + TableLength = (ACPI_SIZE) TblPtr->Length; } /* Validate/Allocate/Clear caller buffer */ @@ -530,7 +534,7 @@ AcpiGetTable ( /* Copy the table to the buffer */ - MEMCPY ((void *) RetBuffer->Pointer, (void *) TblPtr, TableLength); + ACPI_MEMCPY ((void *) RetBuffer->Pointer, (void *) TblPtr, TableLength); return_ACPI_STATUS (AE_OK); } diff --git a/source/components/tables/tbxfroot.c b/source/components/tables/tbxfroot.c index f38342e0f..89028eb1b 100644 --- a/source/components/tables/tbxfroot.c +++ b/source/components/tables/tbxfroot.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * $Revision: 1.57 $ + * $Revision: 1.68 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -141,9 +141,9 @@ ACPI_STATUS AcpiTbFindTable ( - NATIVE_CHAR *Signature, - NATIVE_CHAR *OemId, - NATIVE_CHAR *OemTableId, + char *Signature, + char *OemId, + char *OemTableId, ACPI_TABLE_HEADER **TablePtr) { ACPI_STATUS Status; @@ -155,9 +155,9 @@ AcpiTbFindTable ( /* Validate string lengths */ - if ((STRLEN (Signature) > 4) || - (STRLEN (OemId) > 6) || - (STRLEN (OemTableId) > 8)) + if ((ACPI_STRLEN (Signature) > ACPI_NAME_SIZE) || + (ACPI_STRLEN (OemId) > sizeof (Table->OemId)) || + (ACPI_STRLEN (OemTableId) > sizeof (Table->OemTableId))) { return_ACPI_STATUS (AE_AML_STRING_LIMIT); } @@ -173,8 +173,8 @@ AcpiTbFindTable ( /* Check OemId and OemTableId */ - if ((OemId[0] && STRCMP (OemId, Table->OemId)) || - (OemTableId[0] && STRCMP (OemTableId, Table->OemTableId))) + if ((OemId[0] && ACPI_STRCMP (OemId, Table->OemId)) || + (OemTableId[0] && ACPI_STRCMP (OemTableId, Table->OemTableId))) { return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); } @@ -191,7 +191,7 @@ AcpiTbFindTable ( * PARAMETERS: Signature - Any ACPI table signature * Instance - the non zero instance of the table, allows * support for multiple tables of the same type - * Flags - 0: Physical/Virtual support + * Flags - Physical/Virtual support * RetBuffer - pointer to a structure containing a buffer to * receive the table * @@ -213,12 +213,12 @@ AcpiGetFirmwareTable ( UINT32 Flags, ACPI_TABLE_HEADER **TablePointer) { - ACPI_PHYSICAL_ADDRESS PhysicalAddress; - ACPI_TABLE_HEADER *RsdtPtr = NULL; - ACPI_TABLE_HEADER *TablePtr; + ACPI_POINTER RsdpAddress; + ACPI_POINTER Address; ACPI_STATUS Status; - UINT32 RsdtSize = 0; - UINT32 TableSize; + ACPI_TABLE_HEADER Header; + ACPI_TABLE_DESC TableInfo; + ACPI_TABLE_DESC RsdtInfo; UINT32 TableCount; UINT32 i; UINT32 j; @@ -242,11 +242,13 @@ AcpiGetFirmwareTable ( return_ACPI_STATUS (AE_BAD_PARAMETER); } + RsdtInfo.Pointer = NULL; + if (!AcpiGbl_RSDP) { /* Get the RSDP */ - Status = AcpiOsGetRootPointer (Flags, &PhysicalAddress); + Status = AcpiOsGetRootPointer (Flags, &RsdpAddress); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n")); @@ -257,7 +259,7 @@ AcpiGetFirmwareTable ( if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { - Status = AcpiOsMapMemory (PhysicalAddress, sizeof (RSDP_DESCRIPTOR), + Status = AcpiOsMapMemory (RsdpAddress.Pointer.Physical, sizeof (RSDP_DESCRIPTOR), (void **) &AcpiGbl_RSDP); if (ACPI_FAILURE (Status)) { @@ -266,45 +268,48 @@ AcpiGetFirmwareTable ( } else { - AcpiGbl_RSDP = ACPI_PHYSADDR_TO_PTR (PhysicalAddress); + AcpiGbl_RSDP = RsdpAddress.Pointer.Logical; } /* * The signature and checksum must both be correct */ - if (STRNCMP ((NATIVE_CHAR *) AcpiGbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) + if (ACPI_STRNCMP ((char *) AcpiGbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { /* Nope, BAD Signature */ - Status = AE_BAD_SIGNATURE; - goto Cleanup; + return_ACPI_STATUS (AE_BAD_SIGNATURE); } if (AcpiTbChecksum (AcpiGbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { /* Nope, BAD Checksum */ - Status = AE_BAD_CHECKSUM; - goto Cleanup; + return_ACPI_STATUS (AE_BAD_CHECKSUM); } } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", - AcpiGbl_RSDP, - ACPI_HIDWORD (AcpiGbl_RSDP->RsdtPhysicalAddress), - ACPI_LODWORD (AcpiGbl_RSDP->RsdtPhysicalAddress))); - /* Get the RSDT and validate it */ - PhysicalAddress = AcpiTbGetRsdtAddress (); - Status = AcpiTbGetTablePointer (PhysicalAddress, Flags, &RsdtSize, &RsdtPtr); + AcpiTbGetRsdtAddress (&Address); + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", + AcpiGbl_RSDP, + ACPI_HIDWORD (Address.Pointer.Value), + ACPI_LODWORD (Address.Pointer.Value))); + + /* Insert ProcessorMode flags */ + + Address.PointerType |= Flags; + + Status = AcpiTbGetTable (&Address, &RsdtInfo); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - Status = AcpiTbValidateRsdt (RsdtPtr); + Status = AcpiTbValidateRsdt (RsdtInfo.Pointer); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -312,8 +317,9 @@ AcpiGetFirmwareTable ( /* Get the number of table pointers within the RSDT */ - TableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, RsdtPtr); + TableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, RsdtInfo.Pointer); + Address.PointerType = AcpiGbl_TableFlags | Flags; /* * Search the RSDT/XSDT for the correct instance of the @@ -321,22 +327,21 @@ AcpiGetFirmwareTable ( */ for (i = 0, j = 0; i < TableCount; i++) { - /* Get the next table pointer */ + /* Get the next table pointer, handle RSDT vs. XSDT */ if (AcpiGbl_RSDP->Revision < 2) { - PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) - ((RSDT_DESCRIPTOR *) RsdtPtr)->TableOffsetEntry[i]; + Address.Pointer.Value = ((RSDT_DESCRIPTOR *) RsdtInfo.Pointer)->TableOffsetEntry[i]; } else { - PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) - ACPI_GET_ADDRESS (((XSDT_DESCRIPTOR *) RsdtPtr)->TableOffsetEntry[i]); + Address.Pointer.Value = ACPI_GET_ADDRESS ( + ((XSDT_DESCRIPTOR *) RsdtInfo.Pointer)->TableOffsetEntry[i]); } - /* Get addressibility if necessary */ + /* Get the table header */ - Status = AcpiTbGetTablePointer (PhysicalAddress, Flags, &TableSize, &TablePtr); + Status = AcpiTbGetTableHeader (&Address, &Header); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -344,27 +349,25 @@ AcpiGetFirmwareTable ( /* Compare table signatures and table instance */ - if (!STRNCMP ((char *) TablePtr, Signature, STRLEN (Signature))) + if (!ACPI_STRNCMP (Header.Signature, Signature, ACPI_NAME_SIZE)) { /* An instance of the table was found */ j++; if (j >= Instance) { - /* Found the correct instance */ + /* Found the correct instance, get the entire table */ - *TablePointer = TablePtr; + Status = AcpiTbGetTableBody (&Address, &Header, &TableInfo); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + *TablePointer = TableInfo.Pointer; goto Cleanup; } } - - /* Delete table mapping if using virtual addressing */ - - if ((TableSize) && - ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)) - { - AcpiOsUnmapMemory (TablePtr, TableSize); - } } /* Did not find the table */ @@ -373,24 +376,21 @@ AcpiGetFirmwareTable ( Cleanup: - if (RsdtSize) - { - AcpiOsUnmapMemory (RsdtPtr, RsdtSize); - } + AcpiOsUnmapMemory (RsdtInfo.Pointer, (ACPI_SIZE) RsdtInfo.Pointer->Length); return_ACPI_STATUS (Status); } /* TBD: Move to a new file */ -#ifndef _IA16 +#if ACPI_MACHINE_WIDTH != 16 /******************************************************************************* * * FUNCTION: AcpiFindRootPointer * - * PARAMETERS: **RsdpPhysicalAddress - Where to place the RSDP address - * Flags - Logical/Physical addressing + * PARAMETERS: **RsdpAddress - Where to place the RSDP address + * Flags - Logical/Physical addressing * * RETURN: Status, Physical address of the RSDP * @@ -401,7 +401,7 @@ Cleanup: ACPI_STATUS AcpiFindRootPointer ( UINT32 Flags, - ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress) + ACPI_POINTER *RsdpAddress) { ACPI_TABLE_DESC TableInfo; ACPI_STATUS Status; @@ -415,11 +415,13 @@ AcpiFindRootPointer ( Status = AcpiTbFindRsdp (&TableInfo, Flags); if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found, %s Flags=%X\n", + AcpiFormatException (Status), Flags)); return_ACPI_STATUS (AE_NO_ACPI_TABLES); } - *RsdpPhysicalAddress = TableInfo.PhysicalAddress; + RsdpAddress->PointerType = ACPI_PHYSICAL_POINTER; + RsdpAddress->Pointer.Physical = TableInfo.PhysicalAddress; return_ACPI_STATUS (AE_OK); } @@ -453,12 +455,12 @@ AcpiTbScanMemoryForRsdp ( for (Offset = 0, MemRover = StartAddress; Offset < Length; - Offset += RSDP_SCAN_STEP, MemRover += RSDP_SCAN_STEP) + Offset += ACPI_RSDP_SCAN_STEP, MemRover += ACPI_RSDP_SCAN_STEP) { /* The signature and checksum must both be correct */ - if (STRNCMP ((NATIVE_CHAR *) MemRover, + if (ACPI_STRNCMP ((char *) MemRover, RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 && AcpiTbChecksum (MemRover, ACPI_RSDP_CHECKSUM_LENGTH) == 0) { @@ -518,22 +520,24 @@ AcpiTbFindRsdp ( /* * 1) Search EBDA (low memory) paragraphs */ - Status = AcpiOsMapMemory ((UINT64) LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE, + Status = AcpiOsMapMemory ((UINT64) ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE, (void **) &TablePtr); if (ACPI_FAILURE (Status)) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n", + ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE)); return_ACPI_STATUS (Status); } - MemRover = AcpiTbScanMemoryForRsdp (TablePtr, LO_RSDP_WINDOW_SIZE); - AcpiOsUnmapMemory (TablePtr, LO_RSDP_WINDOW_SIZE); + MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_LO_RSDP_WINDOW_SIZE); + AcpiOsUnmapMemory (TablePtr, ACPI_LO_RSDP_WINDOW_SIZE); if (MemRover) { /* Found it, return the physical address */ - PhysAddr = LO_RSDP_WINDOW_BASE; - PhysAddr += (MemRover - TablePtr); + PhysAddr = ACPI_LO_RSDP_WINDOW_BASE; + PhysAddr += ACPI_PTR_DIFF (MemRover,TablePtr); TableInfo->PhysicalAddress = PhysAddr; return_ACPI_STATUS (AE_OK); @@ -542,22 +546,24 @@ AcpiTbFindRsdp ( /* * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h */ - Status = AcpiOsMapMemory ((UINT64) HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE, + Status = AcpiOsMapMemory ((UINT64) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE, (void **) &TablePtr); if (ACPI_FAILURE (Status)) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n", + ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); return_ACPI_STATUS (Status); } - MemRover = AcpiTbScanMemoryForRsdp (TablePtr, HI_RSDP_WINDOW_SIZE); - AcpiOsUnmapMemory (TablePtr, HI_RSDP_WINDOW_SIZE); + MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE); + AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE); if (MemRover) { /* Found it, return the physical address */ - PhysAddr = HI_RSDP_WINDOW_BASE; - PhysAddr += (MemRover - TablePtr); + PhysAddr = ACPI_HI_RSDP_WINDOW_BASE; + PhysAddr += ACPI_PTR_DIFF (MemRover, TablePtr); TableInfo->PhysicalAddress = PhysAddr; return_ACPI_STATUS (AE_OK); @@ -572,8 +578,8 @@ AcpiTbFindRsdp ( /* * 1) Search EBDA (low memory) paragraphs */ - MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (LO_RSDP_WINDOW_BASE), - LO_RSDP_WINDOW_SIZE); + MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_LO_RSDP_WINDOW_BASE), + ACPI_LO_RSDP_WINDOW_SIZE); if (MemRover) { /* Found it, return the physical address */ @@ -585,8 +591,8 @@ AcpiTbFindRsdp ( /* * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h */ - MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (HI_RSDP_WINDOW_BASE), - HI_RSDP_WINDOW_SIZE); + MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), + ACPI_HI_RSDP_WINDOW_SIZE); if (MemRover) { /* Found it, return the physical address */ diff --git a/source/components/utilities/utalloc.c b/source/components/utilities/utalloc.c index bfd39375f..e9aa6d8bf 100644 --- a/source/components/utilities/utalloc.c +++ b/source/components/utilities/utalloc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utalloc - local cache and memory allocation routines - * $Revision: 1.118 $ + * $Revision: 1.131 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -117,10 +117,6 @@ #define __UTALLOC_C__ #include "acpi.h" -#include "acparser.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acglobal.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utalloc") @@ -164,20 +160,23 @@ AcpiUtReleaseToCache ( else { - AcpiUtAcquireMutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES))) + { + return; + } /* Mark the object as cached */ - MEMSET (Object, 0xCA, CacheInfo->ObjectSize); - ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_CACHED_OBJECT); + ACPI_MEMSET (Object, 0xCA, CacheInfo->ObjectSize); + ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED); /* Put the object at the head of the cache list */ - * (char **) (((char *) Object) + CacheInfo->LinkOffset) = CacheInfo->ListHead; + * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) Object)[CacheInfo->LinkOffset]))) = CacheInfo->ListHead; CacheInfo->ListHead = Object; CacheInfo->CacheDepth++; - AcpiUtReleaseMutex (ACPI_MTX_CACHES); + (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); } } @@ -208,7 +207,11 @@ AcpiUtAcquireFromCache ( CacheInfo = &AcpiGbl_MemoryLists[ListId]; - AcpiUtAcquireMutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES))) + { + return (NULL); + } + ACPI_MEM_TRACKING (CacheInfo->CacheRequests++); /* Check the cache first */ @@ -218,7 +221,7 @@ AcpiUtAcquireFromCache ( /* There is an object available, use it */ Object = CacheInfo->ListHead; - CacheInfo->ListHead = * (char **) (((char *) Object) + CacheInfo->LinkOffset); + CacheInfo->ListHead = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) Object)[CacheInfo->LinkOffset]))); ACPI_MEM_TRACKING (CacheInfo->CacheHits++); CacheInfo->CacheDepth--; @@ -228,11 +231,14 @@ AcpiUtAcquireFromCache ( Object, AcpiGbl_MemoryLists[ListId].ListName)); #endif - AcpiUtReleaseMutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES))) + { + return (NULL); + } /* Clear (zero) the previously used Object */ - MEMSET (Object, 0, CacheInfo->ObjectSize); + ACPI_MEMSET (Object, 0, CacheInfo->ObjectSize); } else @@ -241,7 +247,10 @@ AcpiUtAcquireFromCache ( /* Avoid deadlock with ACPI_MEM_CALLOCATE */ - AcpiUtReleaseMutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES))) + { + return (NULL); + } Object = ACPI_MEM_CALLOCATE (CacheInfo->ObjectSize); ACPI_MEM_TRACKING (CacheInfo->TotalAllocated++); @@ -279,7 +288,7 @@ AcpiUtDeleteGenericCache ( { /* Delete one cached state object */ - Next = * (char **) (((char *) CacheInfo->ListHead) + CacheInfo->LinkOffset); + Next = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) CacheInfo->ListHead)[CacheInfo->LinkOffset]))); ACPI_MEM_FREE (CacheInfo->ListHead); CacheInfo->ListHead = Next; @@ -288,7 +297,6 @@ AcpiUtDeleteGenericCache ( } - /******************************************************************************* * * FUNCTION: AcpiUtValidateBuffer @@ -377,7 +385,7 @@ AcpiUtInitializeBuffer ( /* Clear the buffer */ - MEMSET (Buffer->Pointer, 0, RequiredLength); + ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); break; @@ -393,7 +401,7 @@ AcpiUtInitializeBuffer ( /* Clear the buffer */ - MEMSET (Buffer->Pointer, 0, RequiredLength); + ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); break; @@ -405,10 +413,6 @@ AcpiUtInitializeBuffer ( { Status = AE_BUFFER_OVERFLOW; } - - /* Clear the buffer */ - - MEMSET (Buffer->Pointer, 0, RequiredLength); break; } @@ -436,7 +440,7 @@ void * AcpiUtAllocate ( ACPI_SIZE Size, UINT32 Component, - NATIVE_CHAR *Module, + char *Module, UINT32 Line) { void *Allocation; @@ -460,7 +464,7 @@ AcpiUtAllocate ( /* Report allocation error */ _ACPI_REPORT_ERROR (Module, Line, Component, - ("UtAllocate: Could not allocate size %X\n", Size)); + ("UtAllocate: Could not allocate size %X\n", (UINT32) Size)); return_PTR (NULL); } @@ -488,7 +492,7 @@ void * AcpiUtCallocate ( ACPI_SIZE Size, UINT32 Component, - NATIVE_CHAR *Module, + char *Module, UINT32 Line) { void *Allocation; @@ -512,19 +516,17 @@ AcpiUtCallocate ( /* Report allocation error */ _ACPI_REPORT_ERROR (Module, Line, Component, - ("UtCallocate: Could not allocate size %X\n", Size)); + ("UtCallocate: Could not allocate size %X\n", (UINT32) Size)); return_PTR (NULL); } /* Clear the memory block */ - MEMSET (Allocation, 0, Size); - + ACPI_MEMSET (Allocation, 0, Size); return_PTR (Allocation); } - #ifdef ACPI_DBG_TRACK_ALLOCATIONS /* * These procedures are used for tracking memory leaks in the subsystem, and @@ -538,7 +540,6 @@ AcpiUtCallocate ( */ - /******************************************************************************* * * FUNCTION: AcpiUtAllocateAndTrack @@ -558,14 +559,13 @@ void * AcpiUtAllocateAndTrack ( ACPI_SIZE Size, UINT32 Component, - NATIVE_CHAR *Module, + char *Module, UINT32 Line) { ACPI_DEBUG_MEM_BLOCK *Allocation; ACPI_STATUS Status; - Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK), Component, Module, Line); if (!Allocation) @@ -588,7 +588,6 @@ AcpiUtAllocateAndTrack ( } - /******************************************************************************* * * FUNCTION: AcpiUtCallocateAndTrack @@ -608,14 +607,13 @@ void * AcpiUtCallocateAndTrack ( ACPI_SIZE Size, UINT32 Component, - NATIVE_CHAR *Module, + char *Module, UINT32 Line) { ACPI_DEBUG_MEM_BLOCK *Allocation; ACPI_STATUS Status; - Allocation = AcpiUtCallocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK), Component, Module, Line); if (!Allocation) @@ -623,7 +621,7 @@ AcpiUtCallocateAndTrack ( /* Report allocation error */ _ACPI_REPORT_ERROR (Module, Line, Component, - ("UtCallocate: Could not allocate size %X\n", Size)); + ("UtCallocate: Could not allocate size %X\n", (UINT32) Size)); return (NULL); } @@ -661,10 +659,11 @@ void AcpiUtFreeAndTrack ( void *Allocation, UINT32 Component, - NATIVE_CHAR *Module, + char *Module, UINT32 Line) { ACPI_DEBUG_MEM_BLOCK *DebugBlock; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE_PTR ("UtFree", Allocation); @@ -678,14 +677,20 @@ AcpiUtFreeAndTrack ( return_VOID; } - DebugBlock = (ACPI_DEBUG_MEM_BLOCK *) - (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER)); + DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK, + (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER))); AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalFreed++; AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize -= DebugBlock->Size; - AcpiUtRemoveAllocation (ACPI_MEM_LIST_GLOBAL, DebugBlock, - Component, Module, Line); + Status = AcpiUtRemoveAllocation (ACPI_MEM_LIST_GLOBAL, DebugBlock, + Component, Module, Line); + if (ACPI_FAILURE (Status)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n", + AcpiFormatException (Status))); + } + AcpiOsFree (DebugBlock); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Allocation)); @@ -694,7 +699,6 @@ AcpiUtFreeAndTrack ( } - /******************************************************************************* * * FUNCTION: AcpiUtFindAllocation @@ -765,7 +769,7 @@ AcpiUtTrackAllocation ( ACPI_SIZE Size, UINT8 AllocType, UINT32 Component, - NATIVE_CHAR *Module, + char *Module, UINT32 Line) { ACPI_MEMORY_LIST *MemList; @@ -782,7 +786,11 @@ AcpiUtTrackAllocation ( } MemList = &AcpiGbl_MemoryLists[ListId]; - AcpiUtAcquireMutex (ACPI_MTX_MEMORY); + Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* * Search list for this address to make sure it is not already on the list. @@ -807,7 +815,7 @@ AcpiUtTrackAllocation ( Allocation->Component = Component; Allocation->Line = Line; - STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); + ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); /* Insert at list head */ @@ -823,7 +831,7 @@ AcpiUtTrackAllocation ( UnlockAndExit: - AcpiUtReleaseMutex (ACPI_MTX_MEMORY); + Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); return_ACPI_STATUS (Status); } @@ -848,10 +856,11 @@ AcpiUtRemoveAllocation ( UINT32 ListId, ACPI_DEBUG_MEM_BLOCK *Allocation, UINT32 Component, - NATIVE_CHAR *Module, + char *Module, UINT32 Line) { ACPI_MEMORY_LIST *MemList; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("UtRemoveAllocation"); @@ -873,7 +882,11 @@ AcpiUtRemoveAllocation ( return_ACPI_STATUS (AE_OK); } - AcpiUtAcquireMutex (ACPI_MTX_MEMORY); + Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* Unlink */ @@ -893,12 +906,12 @@ AcpiUtRemoveAllocation ( /* Mark the segment as deleted */ - MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size); + ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", Allocation->Size)); - AcpiUtReleaseMutex (ACPI_MTX_MEMORY); - return_ACPI_STATUS (AE_OK); + Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); + return_ACPI_STATUS (Status); } @@ -977,9 +990,10 @@ AcpiUtDumpAllocationInfo ( void AcpiUtDumpAllocations ( UINT32 Component, - NATIVE_CHAR *Module) + char *Module) { ACPI_DEBUG_MEM_BLOCK *Element; + ACPI_DESCRIPTOR *Descriptor; UINT32 NumOutstanding = 0; @@ -989,40 +1003,44 @@ AcpiUtDumpAllocations ( /* * Walk the allocation list. */ - AcpiUtAcquireMutex (ACPI_MTX_MEMORY); + if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_MEMORY))) + { + return; + } Element = AcpiGbl_MemoryLists[0].ListHead; while (Element) { if ((Element->Component & Component) && - ((Module == NULL) || (0 == STRCMP (Module, Element->Module)))) + ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module)))) { /* Ignore allocated objects that are in a cache */ - if (((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.Type != ACPI_CACHED_OBJECT) + Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace); + if (Descriptor->DescriptorId != ACPI_DESC_TYPE_CACHED) { AcpiOsPrintf ("%p Len %04X %9.9s-%d ", - &Element->UserSpace, Element->Size, Element->Module, + Descriptor, Element->Size, Element->Module, Element->Line); /* Most of the elements will be internal objects. */ - switch (ACPI_GET_DESCRIPTOR_TYPE (&Element->UserSpace)) + switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor)) { - case ACPI_DESC_TYPE_INTERNAL: - AcpiOsPrintf ("ObjType %12.12s R%d", - AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.Type), - ((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.ReferenceCount); + case ACPI_DESC_TYPE_OPERAND: + AcpiOsPrintf ("ObjType %12.12s R%hd", + AcpiUtGetTypeName (Descriptor->Object.Common.Type), + Descriptor->Object.Common.ReferenceCount); break; case ACPI_DESC_TYPE_PARSER: - AcpiOsPrintf ("ParseObj Opcode %04X", - ((ACPI_PARSE_OBJECT *)(&Element->UserSpace))->Opcode); + AcpiOsPrintf ("ParseObj AmlOpcode %04hX", + Descriptor->Op.Asl.AmlOpcode); break; case ACPI_DESC_TYPE_NAMED: AcpiOsPrintf ("Node %4.4s", - (char *) &((ACPI_NAMESPACE_NODE *)(&Element->UserSpace))->Name); + Descriptor->Node.Name.Ascii); break; case ACPI_DESC_TYPE_STATE: @@ -1064,6 +1082,10 @@ AcpiUtDumpAllocations ( case ACPI_DESC_TYPE_STATE_THREAD: AcpiOsPrintf ("THREAD StateObj"); break; + + default: + /* All types should appear above */ + break; } AcpiOsPrintf ( "\n"); @@ -1073,18 +1095,18 @@ AcpiUtDumpAllocations ( Element = Element->Next; } - AcpiUtReleaseMutex (ACPI_MTX_MEMORY); + (void) AcpiUtReleaseMutex (ACPI_MTX_MEMORY); /* Print summary */ if (!NumOutstanding) { - ACPI_DEBUG_PRINT ((ACPI_DB_OK, - "No outstanding allocations.\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "No outstanding allocations.\n")); } else { - ACPI_DEBUG_PRINT ((ACPI_DB_OK, + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%d(%X) Outstanding allocations\n", NumOutstanding, NumOutstanding)); } @@ -1093,6 +1115,5 @@ AcpiUtDumpAllocations ( } - #endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c index ff4804a18..d5f7a4bad 100644 --- a/source/components/utilities/utclib.c +++ b/source/components/utilities/utclib.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: cmclib - Local implementation of C library functions - * $Revision: 1.43 $ + * $Revision: 1.51 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -118,11 +118,6 @@ #define __CMCLIB_C__ #include "acpi.h" -#include "acevents.h" -#include "achware.h" -#include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" /* * These implementations of standard C Library routines can optionally be @@ -130,7 +125,7 @@ * than an inline or assembly implementation */ -#define _COMPONENT MISCELLANEOUS +#define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("cmclib") @@ -149,9 +144,9 @@ ******************************************************************************/ -UINT32 +ACPI_SIZE AcpiUtStrlen ( - const NATIVE_CHAR *String) + const char *String) { UINT32 Length = 0; @@ -181,12 +176,12 @@ AcpiUtStrlen ( * ******************************************************************************/ -NATIVE_CHAR * +char * AcpiUtStrcpy ( - NATIVE_CHAR *DstString, - const NATIVE_CHAR *SrcString) + char *DstString, + const char *SrcString) { - NATIVE_CHAR *String = DstString; + char *String = DstString; /* Move bytes brute force */ @@ -220,13 +215,13 @@ AcpiUtStrcpy ( * ******************************************************************************/ -NATIVE_CHAR * +char * AcpiUtStrncpy ( - NATIVE_CHAR *DstString, - const NATIVE_CHAR *SrcString, - NATIVE_UINT Count) + char *DstString, + const char *SrcString, + ACPI_SIZE Count) { - NATIVE_CHAR *String = DstString; + char *String = DstString; /* Copy the string */ @@ -262,10 +257,10 @@ AcpiUtStrncpy ( * ******************************************************************************/ -UINT32 +int AcpiUtStrcmp ( - const NATIVE_CHAR *String1, - const NATIVE_CHAR *String2) + const char *String1, + const char *String2) { @@ -295,11 +290,11 @@ AcpiUtStrcmp ( * ******************************************************************************/ -UINT32 +int AcpiUtStrncmp ( - const NATIVE_CHAR *String1, - const NATIVE_CHAR *String2, - NATIVE_UINT Count) + const char *String1, + const char *String2, + ACPI_SIZE Count) { @@ -311,7 +306,7 @@ AcpiUtStrncmp ( } } - return ((Count == ACPI_INTEGER_MAX) ? 0 : ((unsigned char) *String1 - + return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *String1 - (unsigned char) *String2)); } @@ -329,12 +324,12 @@ AcpiUtStrncmp ( * ******************************************************************************/ -NATIVE_CHAR * +char * AcpiUtStrcat ( - NATIVE_CHAR *DstString, - const NATIVE_CHAR *SrcString) + char *DstString, + const char *SrcString) { - NATIVE_CHAR *String; + char *String; /* Find end of the destination string */ @@ -366,13 +361,13 @@ AcpiUtStrcat ( * ******************************************************************************/ -NATIVE_CHAR * +char * AcpiUtStrncat ( - NATIVE_CHAR *DstString, - const NATIVE_CHAR *SrcString, - NATIVE_UINT Count) + char *DstString, + const char *SrcString, + ACPI_SIZE Count) { - NATIVE_CHAR *String; + char *String; if (Count) @@ -417,10 +412,10 @@ void * AcpiUtMemcpy ( void *Dest, const void *Src, - NATIVE_UINT Count) + ACPI_SIZE Count) { - NATIVE_CHAR *New = (NATIVE_CHAR *) Dest; - NATIVE_CHAR *Old = (NATIVE_CHAR *) Src; + char *New = (char *) Dest; + char *Old = (char *) Src; while (Count) @@ -452,10 +447,10 @@ AcpiUtMemcpy ( void * AcpiUtMemset ( void *Dest, - NATIVE_UINT Value, - NATIVE_UINT Count) + ACPI_NATIVE_UINT Value, + ACPI_SIZE Count) { - NATIVE_CHAR *New = (NATIVE_CHAR *) Dest; + char *New = (char *) Dest; while (Count) @@ -472,19 +467,7 @@ AcpiUtMemset ( #define NEGATIVE 1 #define POSITIVE 0 - -#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ -#define _ACPI_XS 0x40 /* extra space */ -#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ -#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ -#define _ACPI_DI 0x04 /* '0'-'9' */ -#define _ACPI_LO 0x02 /* 'a'-'z' */ -#define _ACPI_PU 0x10 /* punctuation */ -#define _ACPI_SP 0x08 /* space */ -#define _ACPI_UP 0x01 /* 'A'-'Z' */ -#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ - -static const UINT8 _acpi_ctype[257] = { +const UINT8 _acpi_ctype[257] = { _ACPI_CN, /* 0x0 0. */ _ACPI_CN, /* 0x1 1. */ _ACPI_CN, /* 0x2 2. */ @@ -643,9 +626,9 @@ static const UINT8 _acpi_ctype[257] = { * ******************************************************************************/ -UINT32 +int AcpiUtToUpper ( - UINT32 c) + int c) { return (IS_LOWER(c) ? ((c)-0x20) : (c)); @@ -664,9 +647,9 @@ AcpiUtToUpper ( * ******************************************************************************/ -UINT32 +int AcpiUtToLower ( - UINT32 c) + int c) { return (IS_UPPER(c) ? ((c)+0x20) : (c)); @@ -688,12 +671,12 @@ AcpiUtToLower ( * ******************************************************************************/ -NATIVE_CHAR * +char * AcpiUtStrstr ( - NATIVE_CHAR *String1, - NATIVE_CHAR *String2) + char *String1, + char *String2) { - NATIVE_CHAR *String; + char *String; if (AcpiUtStrlen (String2) > AcpiUtStrlen (String1)) @@ -734,14 +717,14 @@ AcpiUtStrstr ( UINT32 AcpiUtStrtoul ( - const NATIVE_CHAR *String, - NATIVE_CHAR **Terminator, + const char *String, + char **Terminator, UINT32 Base) { UINT32 converted = 0; UINT32 index; UINT32 sign; - const NATIVE_CHAR *StringStart; + const char *StringStart; UINT32 ReturnValue = 0; ACPI_STATUS Status = AE_OK; @@ -832,11 +815,11 @@ AcpiUtStrtoul ( { if (IS_DIGIT (*String)) { - index = *String - '0'; + index = (UINT32) ((UINT8) *String - '0'); } else { - index = AcpiUtToUpper (*String); + index = (UINT32) AcpiUtToUpper (*String); if (IS_UPPER (index)) { index = index - 'A' + 10; @@ -860,7 +843,7 @@ AcpiUtStrtoul ( (UINT32) Base)) { Status = AE_ERROR; - ReturnValue = 0L; /* reset */ + ReturnValue = 0; /* reset */ } else { @@ -879,13 +862,13 @@ done: */ if (Terminator) { - if (converted == 0 && ReturnValue == 0L && String != NULL) + if (converted == 0 && ReturnValue == 0 && String != NULL) { - *Terminator = (NATIVE_CHAR *) StringStart; + *Terminator = (char *) StringStart; } else { - *Terminator = (NATIVE_CHAR *) String; + *Terminator = (char *) String; } } diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c index e39523d85..f69b87984 100644 --- a/source/components/utilities/utcopy.c +++ b/source/components/utilities/utcopy.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utcopy - Internal to external object translation utilities - * $Revision: 1.93 $ + * $Revision: 1.110 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -117,8 +117,6 @@ #define __UTCOPY_C__ #include "acpi.h" -#include "acinterp.h" -#include "acnamesp.h" #include "amlcode.h" @@ -150,7 +148,6 @@ AcpiUtCopyIsimpleToEsimple ( UINT8 *DataSpace, ACPI_SIZE *BufferSpaceUsed) { - ACPI_BUFFER Buffer; ACPI_STATUS Status = AE_OK; @@ -161,7 +158,7 @@ AcpiUtCopyIsimpleToEsimple ( /* * Check for NULL object case (could be an uninitialized - * package element + * package element) */ if (!InternalObject) { @@ -170,26 +167,26 @@ AcpiUtCopyIsimpleToEsimple ( /* Always clear the external object */ - MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT)); + ACPI_MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT)); /* * In general, the external object will be the same type as * the internal object */ - ExternalObject->Type = InternalObject->Common.Type; + ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject); /* However, only a limited number of external types are supported */ - switch (InternalObject->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (InternalObject)) { case ACPI_TYPE_STRING: - ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace; + ExternalObject->String.Pointer = (char *) DataSpace; ExternalObject->String.Length = InternalObject->String.Length; - *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (InternalObject->String.Length + 1); + *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ((ACPI_SIZE) InternalObject->String.Length + 1); - MEMCPY ((void *) DataSpace, (void *) InternalObject->String.Pointer, - InternalObject->String.Length + 1); + ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->String.Pointer, + (ACPI_SIZE) InternalObject->String.Length + 1); break; @@ -199,7 +196,7 @@ AcpiUtCopyIsimpleToEsimple ( ExternalObject->Buffer.Length = InternalObject->Buffer.Length; *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (InternalObject->String.Length); - MEMCPY ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer, + ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer, InternalObject->Buffer.Length); break; @@ -210,52 +207,16 @@ AcpiUtCopyIsimpleToEsimple ( break; - case INTERNAL_TYPE_REFERENCE: + case ACPI_TYPE_LOCAL_REFERENCE: /* * This is an object reference. Attempt to dereference it. */ switch (InternalObject->Reference.Opcode) { - case AML_ZERO_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = 0; - break; - - case AML_ONE_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = 1; - break; - - case AML_ONES_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = ACPI_INTEGER_MAX; - break; - - case AML_REVISION_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = ACPI_CA_SUPPORT_LEVEL; - break; - case AML_INT_NAMEPATH_OP: - /* - * This is a named reference, get the string. We already know that - * we have room for it, use max length - */ - ExternalObject->Type = ACPI_TYPE_STRING; - ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace; - Buffer.Length = MAX_STRING_LENGTH; - Buffer.Pointer = DataSpace; - - Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) InternalObject->Reference.Node, - &Buffer); - - /* Converted (external) string length is returned from above */ - - ExternalObject->String.Length = Buffer.Length; - *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (Buffer.Length); - break; + /* For namepath, return the object handle ("reference") */ default: /* @@ -271,9 +232,9 @@ AcpiUtCopyIsimpleToEsimple ( case ACPI_TYPE_PROCESSOR: - ExternalObject->Processor.ProcId = InternalObject->Processor.ProcId; + ExternalObject->Processor.ProcId = InternalObject->Processor.ProcId; ExternalObject->Processor.PblkAddress = InternalObject->Processor.Address; - ExternalObject->Processor.PblkLength = InternalObject->Processor.Length; + ExternalObject->Processor.PblkLength = InternalObject->Processor.Length; break; @@ -354,7 +315,7 @@ AcpiUtCopyIelementToEelement ( */ TargetObject->Type = ACPI_TYPE_PACKAGE; TargetObject->Package.Count = SourceObject->Package.Count; - TargetObject->Package.Elements = (ACPI_OBJECT *) Info->FreeSpace; + TargetObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace); /* * Pass the new package object back to the package walk routine @@ -366,7 +327,7 @@ AcpiUtCopyIelementToEelement ( * update the buffer length counter */ ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD ( - TargetObject->Package.Count * sizeof (ACPI_OBJECT)); + (ACPI_SIZE) TargetObject->Package.Count * sizeof (ACPI_OBJECT)); break; @@ -416,26 +377,28 @@ AcpiUtCopyIpackageToEpackage ( /* * First package at head of the buffer */ - ExternalObject = (ACPI_OBJECT *) Buffer; + ExternalObject = ACPI_CAST_PTR (ACPI_OBJECT, Buffer); /* * Free space begins right after the first package */ - Info.Length = 0; + Info.Length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); + Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); Info.ObjectSpace = 0; Info.NumPackages = 1; - Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - ExternalObject->Type = InternalObject->Common.Type; - ExternalObject->Package.Count = InternalObject->Package.Count; - ExternalObject->Package.Elements = (ACPI_OBJECT *) Info.FreeSpace; + ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject); + ExternalObject->Package.Count = InternalObject->Package.Count; + ExternalObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info.FreeSpace); /* - * Build an array of ACPI_OBJECTS in the buffer + * Leave room for an array of ACPI_OBJECTS in the buffer * and move the free space past it */ + Info.Length += (ACPI_SIZE) ExternalObject->Package.Count * + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); Info.FreeSpace += ExternalObject->Package.Count * - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); Status = AcpiUtWalkPackageTree (InternalObject, ExternalObject, AcpiUtCopyIelementToEelement, &Info); @@ -470,7 +433,7 @@ AcpiUtCopyIobjectToEobject ( ACPI_FUNCTION_TRACE ("UtCopyIobjectToEobject"); - if (InternalObject->Common.Type == ACPI_TYPE_PACKAGE) + if (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE) { /* * Package object: Copy all subobjects (including @@ -558,15 +521,16 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_STRING: - InternalObject->String.Pointer = ACPI_MEM_CALLOCATE (ExternalObject->String.Length + 1); + InternalObject->String.Pointer = + ACPI_MEM_CALLOCATE ((ACPI_SIZE) ExternalObject->String.Length + 1); if (!InternalObject->String.Pointer) { return_ACPI_STATUS (AE_NO_MEMORY); } - MEMCPY (InternalObject->String.Pointer, - ExternalObject->String.Pointer, - ExternalObject->String.Length); + ACPI_MEMCPY (InternalObject->String.Pointer, + ExternalObject->String.Pointer, + ExternalObject->String.Length); InternalObject->String.Length = ExternalObject->String.Length; break; @@ -574,15 +538,16 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_BUFFER: - InternalObject->Buffer.Pointer = ACPI_MEM_CALLOCATE (ExternalObject->Buffer.Length); + InternalObject->Buffer.Pointer = + ACPI_MEM_CALLOCATE (ExternalObject->Buffer.Length); if (!InternalObject->Buffer.Pointer) { return_ACPI_STATUS (AE_NO_MEMORY); } - MEMCPY (InternalObject->Buffer.Pointer, - ExternalObject->Buffer.Pointer, - ExternalObject->Buffer.Length); + ACPI_MEMCPY (InternalObject->Buffer.Pointer, + ExternalObject->Buffer.Pointer, + ExternalObject->Buffer.Length); InternalObject->Buffer.Length = ExternalObject->Buffer.Length; break; @@ -592,6 +557,10 @@ AcpiUtCopyEsimpleToIsimple ( InternalObject->Integer.Value = ExternalObject->Integer.Value; break; + + default: + /* Other types can't get here */ + break; } *RetInternalObject = InternalObject; @@ -608,10 +577,10 @@ AcpiUtCopyEsimpleToIsimple ( * FUNCTION: AcpiUtCopyEpackageToIpackage * * PARAMETERS: *InternalObject - Pointer to the object we are returning - * *Buffer - Where the object is returned - * *SpaceUsed - Where the length of the object is returned + * *Buffer - Where the object is returned + * *SpaceUsed - Where the length of the object is returned * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: This function is called to place a package object in a user * buffer. A package object by definition contains other objects. @@ -651,11 +620,10 @@ AcpiUtCopyEpackageToIpackage ( FreeSpace = Buffer + sizeof(ACPI_OBJECT); - ExternalObject->Type = InternalObject->Common.Type; + ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject); ExternalObject->Package.Count = InternalObject->Package.Count; ExternalObject->Package.Elements = (ACPI_OBJECT *)FreeSpace; - /* * Build an array of ACPI_OBJECTS in the buffer * and move the free space past it @@ -747,7 +715,8 @@ AcpiUtCopySimpleObject ( /* Copy the entire source object over the destination object*/ - MEMCPY ((char *) DestDesc, (char *) SourceDesc, sizeof (ACPI_OPERAND_OBJECT)); + ACPI_MEMCPY ((char *) DestDesc, (char *) SourceDesc, + sizeof (ACPI_OPERAND_OBJECT)); /* Restore the saved fields */ @@ -756,11 +725,32 @@ AcpiUtCopySimpleObject ( /* Handle the objects with extra data */ - switch (DestDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (DestDesc)) { case ACPI_TYPE_BUFFER: DestDesc->Buffer.Node = NULL; + DestDesc->Common.Flags = SourceDesc->Common.Flags; + + /* + * Allocate and copy the actual buffer if and only if: + * 1) There is a valid buffer (length > 0) + * 2) The buffer is not static (not in an ACPI table) (in this case, + * the actual pointer was already copied above) + */ + if ((SourceDesc->Buffer.Length) && + (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER))) + { + DestDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length); + if (!DestDesc->Buffer.Pointer) + { + return (AE_NO_MEMORY); + } + + ACPI_MEMCPY (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer, + SourceDesc->Buffer.Length); + } + break; case ACPI_TYPE_STRING: @@ -773,16 +763,20 @@ AcpiUtCopySimpleObject ( if ((SourceDesc->String.Length) && (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER))) { - DestDesc->String.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->String.Length); + DestDesc->String.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->String.Length + 1); if (!DestDesc->String.Pointer) { return (AE_NO_MEMORY); } - MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer, - SourceDesc->String.Length); + ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer, + SourceDesc->String.Length + 1); } break; + + default: + /* Nothing to do for other simple objects */ + break; } return (AE_OK); @@ -823,28 +817,40 @@ AcpiUtCopyIelementToIelement ( switch (ObjectType) { - case 0: + case ACPI_COPY_TYPE_SIMPLE: - /* - * This is a simple object, just copy it - */ - TargetObject = AcpiUtCreateInternalObject (SourceObject->Common.Type); - if (!TargetObject) + /* A null source object indicates a (legal) null package element */ + + if (SourceObject) { - return (AE_NO_MEMORY); - } + /* + * This is a simple object, just copy it + */ + TargetObject = AcpiUtCreateInternalObject ( + ACPI_GET_OBJECT_TYPE (SourceObject)); + if (!TargetObject) + { + return (AE_NO_MEMORY); + } - Status = AcpiUtCopySimpleObject (SourceObject, TargetObject); - if (ACPI_FAILURE (Status)) + Status = AcpiUtCopySimpleObject (SourceObject, TargetObject); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + *ThisTargetPtr = TargetObject; + } + else { - return (Status); - } + /* Pass through a null element */ - *ThisTargetPtr = TargetObject; + *ThisTargetPtr = NULL; + } break; - case 1: + case ACPI_COPY_TYPE_PACKAGE: /* * This object is a package - go down another nesting level @@ -857,6 +863,19 @@ AcpiUtCopyIelementToIelement ( } TargetObject->Package.Count = SourceObject->Package.Count; + TargetObject->Common.Flags = SourceObject->Common.Flags; + + /* + * Create the object array + */ + TargetObject->Package.Elements = + ACPI_MEM_CALLOCATE (((ACPI_SIZE) SourceObject->Package.Count + 1) * + sizeof (void *)); + if (!TargetObject->Package.Elements) + { + ACPI_MEM_FREE (TargetObject); + return (AE_NO_MEMORY); + } /* * Pass the new package object back to the package walk routine @@ -904,15 +923,16 @@ AcpiUtCopyIpackageToIpackage ( ACPI_FUNCTION_TRACE ("UtCopyIpackageToIpackage"); - DestObj->Common.Type = SourceObj->Common.Type; + DestObj->Common.Type = ACPI_GET_OBJECT_TYPE (SourceObj); + DestObj->Common.Flags = SourceObj->Common.Flags; DestObj->Package.Count = SourceObj->Package.Count; - /* * Create the object array and walk the source package tree */ - DestObj->Package.Elements = ACPI_MEM_CALLOCATE ((SourceObj->Package.Count + 1) * - sizeof (void *)); + DestObj->Package.Elements = ACPI_MEM_CALLOCATE ( + ((ACPI_SIZE) SourceObj->Package.Count + 1) * + sizeof (void *)); if (!DestObj->Package.Elements) { ACPI_REPORT_ERROR ( @@ -920,10 +940,6 @@ AcpiUtCopyIpackageToIpackage ( return_ACPI_STATUS (AE_NO_MEMORY); } - /* Init */ - - DestObj->Package.NextElement = DestObj->Package.Elements; - /* * Copy the package element-by-element by walking the package "tree". * This handles nested packages of arbitrary depth. @@ -969,7 +985,7 @@ AcpiUtCopyIobjectToIobject ( /* Create the top level object */ - *DestDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type); + *DestDesc = AcpiUtCreateInternalObject (ACPI_GET_OBJECT_TYPE (SourceDesc)); if (!*DestDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -977,7 +993,7 @@ AcpiUtCopyIobjectToIobject ( /* Copy the object and possible subobjects */ - if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE) + if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_PACKAGE) { Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc, WalkState); diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c index 4641320c8..ec65ce4fe 100644 --- a/source/components/utilities/utdebug.c +++ b/source/components/utilities/utdebug.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utdebug - Debug print routines - * $Revision: 1.94 $ + * $Revision: 1.108 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -122,12 +122,11 @@ ACPI_MODULE_NAME ("utdebug") -UINT32 AcpiGbl_PrevThreadId = 0xFFFFFFFF; -char *AcpiGbl_FnEntryStr = "----Entry"; -char *AcpiGbl_FnExitStr = "----Exit-"; +#ifdef ACPI_DEBUG_OUTPUT - -#ifdef ACPI_DEBUG +static UINT32 AcpiGbl_PrevThreadId = 0xFFFFFFFF; +static char *AcpiGbl_FnEntryStr = "----Entry"; +static char *AcpiGbl_FnExitStr = "----Exit-"; /***************************************************************************** @@ -206,7 +205,7 @@ AcpiUtTrackStackPtr ( * ****************************************************************************/ -void +void ACPI_INTERNAL_VAR_XFACE AcpiUtDebugPrint ( UINT32 RequestedDebugLevel, UINT32 LineNumber, @@ -227,7 +226,6 @@ AcpiUtDebugPrint ( return; } - /* * Thread tracking and context switch notification */ @@ -248,15 +246,14 @@ AcpiUtDebugPrint ( * Display the module name, current line number, thread ID (if requested), * current procedure nesting level, and the current procedure name */ - AcpiOsPrintf ("%8s-%04d ", DbgInfo->ModuleName, LineNumber); + AcpiOsPrintf ("%8s-%04ld ", DbgInfo->ModuleName, LineNumber); if (ACPI_LV_THREADS & AcpiDbgLevel) { - AcpiOsPrintf ("[%04X] ", ThreadId, AcpiGbl_NestingLevel, DbgInfo->ProcName); + AcpiOsPrintf ("[%04lX] ", ThreadId); } - AcpiOsPrintf ("[%02d] %-22.22s: ", AcpiGbl_NestingLevel, DbgInfo->ProcName); - + AcpiOsPrintf ("[%02ld] %-22.22s: ", AcpiGbl_NestingLevel, DbgInfo->ProcName); va_start (args, Format); AcpiOsVprintf (Format, args); @@ -283,7 +280,7 @@ AcpiUtDebugPrint ( * ****************************************************************************/ -void +void ACPI_INTERNAL_VAR_XFACE AcpiUtDebugPrintRaw ( UINT32 RequestedDebugLevel, UINT32 LineNumber, @@ -301,7 +298,6 @@ AcpiUtDebugPrintRaw ( } va_start (args, Format); - AcpiOsVprintf (Format, args); } @@ -391,7 +387,7 @@ void AcpiUtTraceStr ( UINT32 LineNumber, ACPI_DEBUG_PRINT_INFO *DbgInfo, - NATIVE_CHAR *String) + char *String) { AcpiGbl_NestingLevel++; @@ -533,7 +529,7 @@ AcpiUtValueExit ( { AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, - "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, + "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, ACPI_HIDWORD (Value), ACPI_LODWORD (Value)); AcpiGbl_NestingLevel--; @@ -596,8 +592,8 @@ AcpiUtDumpBuffer ( UINT32 Display, UINT32 ComponentId) { - UINT32 i = 0; - UINT32 j; + ACPI_NATIVE_UINT i = 0; + ACPI_NATIVE_UINT j; UINT32 Temp32; UINT8 BufChar; @@ -610,6 +606,12 @@ AcpiUtDumpBuffer ( return; } + if ((Count < 4) || (Count & 0x01)) + { + Display = DB_BYTE_DISPLAY; + } + + AcpiOsPrintf ("\nOffset Value\n"); /* * Nasty little dump buffer routine! @@ -618,8 +620,7 @@ AcpiUtDumpBuffer ( { /* Print current offset */ - AcpiOsPrintf ("%05X ", i); - + AcpiOsPrintf ("%05X ", (UINT32) i); /* Print 16 hex chars */ @@ -677,12 +678,10 @@ AcpiUtDumpBuffer ( } } - /* * Print the ASCII equivalent characters * But watch out for the bad unprintable ones... */ - for (j = 0; j < 16; j++) { if (i + j >= Count) diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index 4538bfde9..58bc53928 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utdelete - object deletion and reference count utilities - * $Revision: 1.87 $ + * $Revision: 1.95 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -119,8 +119,6 @@ #include "acpi.h" #include "acinterp.h" #include "acnamesp.h" -#include "actables.h" -#include "acparser.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utdelete") @@ -160,18 +158,19 @@ AcpiUtDeleteInternalObj ( * Must delete or free any pointers within the object that are not * actual ACPI objects (for example, a raw buffer pointer). */ - switch (Object->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (Object)) { - case ACPI_TYPE_STRING: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** String %p, ptr %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n", Object, Object->String.Pointer)); /* Free the actual string buffer */ if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER)) { + /* But only if it is NOT a pointer into an ACPI table */ + ObjPointer = Object->String.Pointer; } break; @@ -179,18 +178,23 @@ AcpiUtDeleteInternalObj ( case ACPI_TYPE_BUFFER: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Buffer %p, ptr %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n", Object, Object->Buffer.Pointer)); /* Free the actual buffer */ - ObjPointer = Object->Buffer.Pointer; + if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER)) + { + /* But only if it is NOT a pointer into an ACPI table */ + + ObjPointer = Object->Buffer.Pointer; + } break; case ACPI_TYPE_PACKAGE: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, " **** Package of count %X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n", Object->Package.Count)); /* @@ -206,33 +210,33 @@ AcpiUtDeleteInternalObj ( case ACPI_TYPE_MUTEX: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Mutex %p, Semaphore %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n", Object, Object->Mutex.Semaphore)); AcpiExUnlinkMutex (Object); - AcpiOsDeleteSemaphore (Object->Mutex.Semaphore); + (void) AcpiOsDeleteSemaphore (Object->Mutex.Semaphore); break; case ACPI_TYPE_EVENT: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Event %p, Semaphore %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n", Object, Object->Event.Semaphore)); - AcpiOsDeleteSemaphore (Object->Event.Semaphore); + (void) AcpiOsDeleteSemaphore (Object->Event.Semaphore); Object->Event.Semaphore = NULL; break; case ACPI_TYPE_METHOD: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Method %p\n", Object)); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Method %p\n", Object)); /* Delete the method semaphore if it exists */ if (Object->Method.Semaphore) { - AcpiOsDeleteSemaphore (Object->Method.Semaphore); + (void) AcpiOsDeleteSemaphore (Object->Method.Semaphore); Object->Method.Semaphore = NULL; } break; @@ -240,7 +244,7 @@ AcpiUtDeleteInternalObj ( case ACPI_TYPE_REGION: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Region %p\n", Object)); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Region %p\n", Object)); SecondDesc = AcpiNsGetSecondaryObject (Object); if (SecondDesc) @@ -266,7 +270,7 @@ AcpiUtDeleteInternalObj ( case ACPI_TYPE_BUFFER_FIELD: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Buffer Field %p\n", Object)); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Buffer Field %p\n", Object)); SecondDesc = AcpiNsGetSecondaryObject (Object); if (SecondDesc) @@ -285,15 +289,15 @@ AcpiUtDeleteInternalObj ( if (ObjPointer) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Object Subptr %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n", ObjPointer)); ACPI_MEM_FREE (ObjPointer); } /* Now the object can be safely deleted */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Object %p [%s]\n", - Object, AcpiUtGetTypeName (Object->Common.Type))); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n", + Object, AcpiUtGetObjectTypeName (Object))); AcpiUtDeleteObjectDesc (Object); return_VOID; @@ -306,14 +310,14 @@ AcpiUtDeleteInternalObj ( * * PARAMETERS: *ObjList - Pointer to the list to be deleted * - * RETURN: Status - the status of the call + * RETURN: None * * DESCRIPTION: This function deletes an internal object list, including both * simple objects and package objects * ******************************************************************************/ -ACPI_STATUS +void AcpiUtDeleteInternalObjectList ( ACPI_OPERAND_OBJECT **ObjList) { @@ -333,8 +337,7 @@ AcpiUtDeleteInternalObjectList ( /* Free the combined parameter pointer list and object array */ ACPI_MEM_FREE (ObjList); - - return_ACPI_STATUS (AE_OK); + return_VOID; } @@ -362,12 +365,12 @@ AcpiUtUpdateRefCount ( ACPI_FUNCTION_NAME ("UtUpdateRefCount"); + if (!Object) { return; } - Count = Object->Common.ReferenceCount; NewCount = Count; @@ -382,7 +385,7 @@ AcpiUtUpdateRefCount ( NewCount++; Object->Common.ReferenceCount = NewCount; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, [Incremented]\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Incremented]\n", Object, NewCount)); break; @@ -391,23 +394,22 @@ AcpiUtUpdateRefCount ( if (Count < 1) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, can't decrement! (Set to 0)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, can't decrement! (Set to 0)\n", Object, NewCount)); NewCount = 0; } - else { NewCount--; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, [Decremented]\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Decremented]\n", Object, NewCount)); } - if (Object->Common.Type == ACPI_TYPE_METHOD) + if (ACPI_GET_OBJECT_TYPE (Object) == ACPI_TYPE_METHOD) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method Obj %p Refs=%X, [Decremented]\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n", Object, NewCount)); } @@ -422,7 +424,7 @@ AcpiUtUpdateRefCount ( case REF_FORCE_DELETE: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, Force delete! (Set to 0)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, Force delete! (Set to 0)\n", Object, Count)); NewCount = 0; @@ -437,12 +439,11 @@ AcpiUtUpdateRefCount ( break; } - /* * Sanity check the reference count, for debug purposes only. * (A deleted object will have a huge reference count) */ - if (Count > MAX_REFERENCE_COUNT) + if (Count > ACPI_MAX_REFERENCE_COUNT) { ACPI_DEBUG_PRINT ((ACPI_DB_WARN, @@ -504,7 +505,7 @@ AcpiUtUpdateObjectReference ( */ if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object %p is NS handle\n", Object)); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", Object)); return_ACPI_STATUS (AE_OK); } @@ -520,7 +521,7 @@ AcpiUtUpdateObjectReference ( * All sub-objects must have their reference count incremented also. * Different object types have different subobjects. */ - switch (Object->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (Object)) { case ACPI_TYPE_DEVICE: @@ -528,7 +529,7 @@ AcpiUtUpdateObjectReference ( Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } AcpiUtUpdateRefCount (Object->Device.SysHandler, Action); @@ -536,7 +537,7 @@ AcpiUtUpdateObjectReference ( break; - case INTERNAL_TYPE_ADDRESS_HANDLER: + case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: /* Must walk list of address handlers */ @@ -568,7 +569,7 @@ AcpiUtUpdateObjectReference ( Object->Package.Elements[i], Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } } break; @@ -578,63 +579,63 @@ AcpiUtUpdateObjectReference ( Status = AcpiUtCreateUpdateStateAndPush ( Object->BufferField.BufferObj, Action, &StateList); - if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } break; - case INTERNAL_TYPE_REGION_FIELD: + case ACPI_TYPE_LOCAL_REGION_FIELD: Status = AcpiUtCreateUpdateStateAndPush ( Object->Field.RegionObj, Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } break; - case INTERNAL_TYPE_BANK_FIELD: + case ACPI_TYPE_LOCAL_BANK_FIELD: Status = AcpiUtCreateUpdateStateAndPush ( Object->BankField.BankObj, Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } Status = AcpiUtCreateUpdateStateAndPush ( Object->BankField.RegionObj, Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } break; - case INTERNAL_TYPE_INDEX_FIELD: + case ACPI_TYPE_LOCAL_INDEX_FIELD: Status = AcpiUtCreateUpdateStateAndPush ( Object->IndexField.IndexObj, Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } Status = AcpiUtCreateUpdateStateAndPush ( Object->IndexField.DataObj, Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } break; case ACPI_TYPE_REGION: - case INTERNAL_TYPE_REFERENCE: + case ACPI_TYPE_LOCAL_REFERENCE: + default: /* No subobjects */ break; @@ -653,6 +654,14 @@ AcpiUtUpdateObjectReference ( } return_ACPI_STATUS (AE_OK); + + +ErrorExit: + + ACPI_REPORT_ERROR (("Could not update object reference count, %s\n", + AcpiFormatException (Status))); + + return_ACPI_STATUS (Status); } @@ -688,8 +697,7 @@ AcpiUtAddReference ( /* * We have a valid ACPI internal object, now increment the reference count */ - AcpiUtUpdateObjectReference (Object, REF_INCREMENT); - + (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT); return_VOID; } @@ -733,7 +741,7 @@ AcpiUtRemoveReference ( return_VOID; } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X\n", Object, Object->Common.ReferenceCount)); /* @@ -741,7 +749,7 @@ AcpiUtRemoveReference ( * if the reference count becomes 0. (Must also decrement the ref count * of all subobjects!) */ - AcpiUtUpdateObjectReference (Object, REF_DECREMENT); + (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT); return_VOID; } diff --git a/source/components/utilities/uteval.c b/source/components/utilities/uteval.c index 585e9aaa3..ddf856523 100644 --- a/source/components/utilities/uteval.c +++ b/source/components/utilities/uteval.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: uteval - Object evaluation - * $Revision: 1.36 $ + * $Revision: 1.45 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -125,6 +125,123 @@ ACPI_MODULE_NAME ("uteval") +/******************************************************************************* + * + * FUNCTION: AcpiUtEvaluateObject + * + * PARAMETERS: PrefixNode - Starting node + * Path - Path to object from starting node + * ExpectedReturnTypes - Bitmap of allowed return types + * ReturnDesc - Where a return value is stored + * + * RETURN: Status + * + * DESCRIPTION: Evaluates a namespace object and verifies the type of the + * return object. Common code that simplifies accessing objects + * that have required return objects of fixed types. + * + * NOTE: Internal function, no parameter validation + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtEvaluateObject ( + ACPI_NAMESPACE_NODE *PrefixNode, + char *Path, + UINT32 ExpectedReturnBtypes, + ACPI_OPERAND_OBJECT **ReturnDesc) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; + UINT32 ReturnBtype; + + + ACPI_FUNCTION_TRACE ("UtEvaluateObject"); + + + /* Evaluate the object/method */ + + Status = AcpiNsEvaluateRelative (PrefixNode, Path, NULL, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + if (Status == AE_NOT_FOUND) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n", + PrefixNode->Name.Ascii, Path)); + } + else + { + ACPI_REPORT_METHOD_ERROR ("Method execution failed", + PrefixNode, Path, Status); + } + + return_ACPI_STATUS (Status); + } + + /* Did we get a return object? */ + + if (!ObjDesc) + { + if (ExpectedReturnBtypes) + { + ACPI_REPORT_METHOD_ERROR ("No object was returned from", + PrefixNode, Path, AE_NOT_EXIST); + + return_ACPI_STATUS (AE_NOT_EXIST); + } + + return_ACPI_STATUS (AE_OK); + } + + /* Map the return object type to the bitmapped type */ + + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + { + case ACPI_TYPE_INTEGER: + ReturnBtype = ACPI_BTYPE_INTEGER; + break; + + case ACPI_TYPE_BUFFER: + ReturnBtype = ACPI_BTYPE_BUFFER; + break; + + case ACPI_TYPE_STRING: + ReturnBtype = ACPI_BTYPE_STRING; + break; + + case ACPI_TYPE_PACKAGE: + ReturnBtype = ACPI_BTYPE_PACKAGE; + break; + + default: + ReturnBtype = 0; + break; + } + + /* Is the return object one of the expected types? */ + + if (!(ExpectedReturnBtypes & ReturnBtype)) + { + ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect", + PrefixNode, Path, AE_TYPE); + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Type returned from %s was incorrect: %X\n", + Path, ACPI_GET_OBJECT_TYPE (ObjDesc))); + + /* On error exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (AE_TYPE); + } + + /* Object type is OK, return it */ + + *ReturnDesc = ObjDesc; + return_ACPI_STATUS (AE_OK); +} + + /******************************************************************************* * * FUNCTION: AcpiUtEvaluateNumericObject @@ -135,8 +252,8 @@ * * RETURN: Status * - * DESCRIPTION: evaluates a numeric namespace object for a selected device - * and stores results in *Address. + * DESCRIPTION: Evaluates a numeric namespace object for a selected device + * and stores result in *Address. * * NOTE: Internal function, no parameter validation * @@ -144,7 +261,7 @@ ACPI_STATUS AcpiUtEvaluateNumericObject ( - NATIVE_CHAR *ObjectName, + char *ObjectName, ACPI_NAMESPACE_NODE *DeviceNode, ACPI_INTEGER *Address) { @@ -155,58 +272,20 @@ AcpiUtEvaluateNumericObject ( ACPI_FUNCTION_TRACE ("UtEvaluateNumericObject"); - /* Execute the method */ - - Status = AcpiNsEvaluateRelative (DeviceNode, ObjectName, NULL, &ObjDesc); + Status = AcpiUtEvaluateObject (DeviceNode, ObjectName, + ACPI_BTYPE_INTEGER, &ObjDesc); if (ACPI_FAILURE (Status)) { - if (Status == AE_NOT_FOUND) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s on %4.4s was not found\n", - ObjectName, (char*)&DeviceNode->Name)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s on %4.4s failed with status %s\n", - ObjectName, (char*)&DeviceNode->Name, - AcpiFormatException (Status))); - } - return_ACPI_STATUS (Status); } + /* Get the returned Integer */ - /* Did we get a return object? */ - - if (!ObjDesc) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from %s\n", - ObjectName)); - return_ACPI_STATUS (AE_TYPE); - } - - /* Is the return object of the correct type? */ - - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) - { - Status = AE_TYPE; - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Type returned from %s was not a number: %X \n", - ObjectName, ObjDesc->Common.Type)); - } - else - { - /* - * Since the structure is a union, setting any field will set all - * of the variables in the union - */ - *Address = ObjDesc->Integer.Value; - } + *Address = ObjDesc->Integer.Value; /* On exit, we must delete the return object */ AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); } @@ -239,66 +318,29 @@ AcpiUtExecute_HID ( ACPI_FUNCTION_TRACE ("UtExecute_HID"); - /* Execute the method */ - - Status = AcpiNsEvaluateRelative (DeviceNode, - METHOD_NAME__HID, NULL, &ObjDesc); + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); if (ACPI_FAILURE (Status)) { - if (Status == AE_NOT_FOUND) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_HID on %4.4s was not found\n", - (char*)&DeviceNode->Name)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_HID on %4.4s failed %s\n", - (char*)&DeviceNode->Name, AcpiFormatException (Status))); - } - return_ACPI_STATUS (Status); } - /* Did we get a return object? */ - - if (!ObjDesc) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _HID\n")); - return_ACPI_STATUS (AE_TYPE); - } + /* Convert the Numeric HID to string */ - /* - * A _HID can return either a Number (32 bit compressed EISA ID) or - * a string - */ - if ((ObjDesc->Common.Type != ACPI_TYPE_INTEGER) && - (ObjDesc->Common.Type != ACPI_TYPE_STRING)) - { - Status = AE_TYPE; - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Type returned from _HID not a number or string: %s(%X) \n", - AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type)); + AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer); } else { - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - /* Convert the Numeric HID to string */ + /* Copy the String HID from the returned object */ - AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer); - } - else - { - /* Copy the String HID from the returned object */ - - STRNCPY(Hid->Buffer, ObjDesc->String.Pointer, sizeof(Hid->Buffer)); - } + ACPI_STRNCPY (Hid->Buffer, ObjDesc->String.Pointer, sizeof(Hid->Buffer)); } /* On exit, we must delete the return object */ AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); } @@ -330,40 +372,20 @@ AcpiUtExecute_CID ( ACPI_FUNCTION_TRACE ("UtExecute_CID"); - /* Execute the method */ - Status = AcpiNsEvaluateRelative (DeviceNode, - METHOD_NAME__CID, NULL, &ObjDesc); + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, &ObjDesc); if (ACPI_FAILURE (Status)) { - if (Status == AE_NOT_FOUND) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_CID on %4.4s was not found\n", - (char *)&DeviceNode->Name)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CID on %4.4s failed %s\n", - (char *)&DeviceNode->Name, AcpiFormatException (Status))); - } - return_ACPI_STATUS (Status); } - /* Did we get a return object? */ - - if (!ObjDesc) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CID\n")); - return_ACPI_STATUS (AE_TYPE); - } - /* * A _CID can return either a single compatible ID or a package of compatible * IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or * string (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss"). */ - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_INTEGER: @@ -376,27 +398,25 @@ AcpiUtExecute_CID ( /* Copy the String CID from the returned object */ - STRNCPY(Cid->Buffer, ObjDesc->String.Pointer, sizeof(Cid->Buffer)); + ACPI_STRNCPY (Cid->Buffer, ObjDesc->String.Pointer, sizeof (Cid->Buffer)); break; case ACPI_TYPE_PACKAGE: /* TBD: Parse package elements; need different return struct, etc. */ + + Status = AE_SUPPORT; break; default: Status = AE_TYPE; - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Type returned from _CID not a number, string, or package: %s(%X) \n", - AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type)); break; } /* On exit, we must delete the return object */ AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); } @@ -426,72 +446,33 @@ AcpiUtExecute_UID ( ACPI_STATUS Status; - ACPI_FUNCTION_NAME ("UtExecute_UID"); + ACPI_FUNCTION_TRACE ("UtExecute_UID"); - /* Execute the method */ - - Status = AcpiNsEvaluateRelative (DeviceNode, - METHOD_NAME__UID, NULL, &ObjDesc); + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); if (ACPI_FAILURE (Status)) { - if (Status == AE_NOT_FOUND) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_UID on %4.4s was not found\n", - (char*)&DeviceNode->Name)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "_UID on %4.4s failed %s\n", - (char*)&DeviceNode->Name, AcpiFormatException (Status))); - } - - return (Status); + return_ACPI_STATUS (Status); } - /* Did we get a return object? */ - - if (!ObjDesc) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _UID\n")); - return (AE_TYPE); - } + /* Convert the Numeric UID to string */ - /* - * A _UID can return either a Number (32 bit compressed EISA ID) or - * a string - */ - if ((ObjDesc->Common.Type != ACPI_TYPE_INTEGER) && - (ObjDesc->Common.Type != ACPI_TYPE_STRING)) - { - Status = AE_TYPE; - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Type returned from _UID was not a number or string: %X \n", - ObjDesc->Common.Type)); + AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer); } else { - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - /* Convert the Numeric UID to string */ + /* Copy the String UID from the returned object */ - AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer); - } - else - { - /* Copy the String UID from the returned object */ - - STRNCPY(Uid->Buffer, ObjDesc->String.Pointer, sizeof(Uid->Buffer)); - } + ACPI_STRNCPY (Uid->Buffer, ObjDesc->String.Pointer, sizeof (Uid->Buffer)); } - /* On exit, we must delete the return object */ AcpiUtRemoveReference (ObjDesc); - - return (Status); + return_ACPI_STATUS (Status); } @@ -523,57 +504,29 @@ AcpiUtExecute_STA ( ACPI_FUNCTION_TRACE ("UtExecute_STA"); - /* Execute the method */ - - Status = AcpiNsEvaluateRelative (DeviceNode, - METHOD_NAME__STA, NULL, &ObjDesc); - if (AE_NOT_FOUND == Status) + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA, + ACPI_BTYPE_INTEGER, &ObjDesc); + if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "_STA on %4.4s was not found, assuming present.\n", - (char*)&DeviceNode->Name)); - - *Flags = 0x0F; - Status = AE_OK; - } - - else if (ACPI_FAILURE (Status)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_STA on %4.4s failed %s\n", - (char*)&DeviceNode->Name, - AcpiFormatException (Status))); - } - - else /* success */ - { - /* Did we get a return object? */ - - if (!ObjDesc) + if (AE_NOT_FOUND == Status) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _STA\n")); - return_ACPI_STATUS (AE_TYPE); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "_STA on %4.4s was not found, assuming device is present\n", + DeviceNode->Name.Ascii)); + + *Flags = 0x0F; + Status = AE_OK; } - /* Is the return object of the correct type? */ - - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) - { - Status = AE_TYPE; - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Type returned from _STA was not a number: %X \n", - ObjDesc->Common.Type)); - } - else - { - /* Extract the status flags */ - - *Flags = (UINT32) ObjDesc->Integer.Value; - } - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); } + /* Extract the status flags */ + + *Flags = (UINT32) ObjDesc->Integer.Value; + + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } diff --git a/source/components/utilities/utglobal.c b/source/components/utilities/utglobal.c index 30a4a922d..46bf5e372 100644 --- a/source/components/utilities/utglobal.c +++ b/source/components/utilities/utglobal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utglobal - Global variables for the ACPI subsystem - * $Revision: 1.151 $ + * $Revision: 1.178 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -118,11 +118,7 @@ #define DEFINE_ACPI_GLOBALS #include "acpi.h" -#include "acevents.h" #include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" - #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utglobal") @@ -148,9 +144,11 @@ AcpiFormatException ( ACPI_STATUS SubStatus; - SubStatus = (Status & ~AE_CODE_MASK); + ACPI_FUNCTION_NAME ("FormatException"); + SubStatus = (Status & ~AE_CODE_MASK); + switch (Status & AE_CODE_MASK) { case AE_CODE_ENVIRONMENTAL: @@ -158,46 +156,56 @@ AcpiFormatException ( if (SubStatus <= AE_CODE_ENV_MAX) { Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; + break; } - break; + goto Unknown; case AE_CODE_PROGRAMMER: if (SubStatus <= AE_CODE_PGM_MAX) { Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; + break; } - break; + goto Unknown; case AE_CODE_ACPI_TABLES: if (SubStatus <= AE_CODE_TBL_MAX) { Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; + break; } - break; + goto Unknown; case AE_CODE_AML: if (SubStatus <= AE_CODE_AML_MAX) { Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; + break; } - break; + goto Unknown; case AE_CODE_CONTROL: if (SubStatus <= AE_CODE_CTRL_MAX) { Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; + break; } - break; + goto Unknown; default: - break; + goto Unknown; } + return ((const char *) Exception); + +Unknown: + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", Status)); return ((const char *) Exception); } @@ -215,10 +223,10 @@ AcpiFormatException ( /* Debug switch - level and trace mask */ -#ifdef ACPI_DEBUG -UINT32 AcpiDbgLevel = DEBUG_DEFAULT; +#ifdef ACPI_DEBUG_OUTPUT +UINT32 AcpiDbgLevel = ACPI_DEBUG_DEFAULT; #else -UINT32 AcpiDbgLevel = NORMAL_DEFAULT; +UINT32 AcpiDbgLevel = ACPI_NORMAL_DEFAULT; #endif /* Debug switch - layer (component) mask */ @@ -230,6 +238,7 @@ UINT32 AcpiGbl_NestingLevel = 0; /* Debugger globals */ BOOLEAN AcpiGbl_DbTerminateThreads = FALSE; +BOOLEAN AcpiGbl_AbortMethod = FALSE; BOOLEAN AcpiGbl_MethodExecuting = FALSE; /* System flags */ @@ -242,9 +251,13 @@ BOOLEAN AcpiGbl_Shutdown = TRUE; const UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128}; -const NATIVE_CHAR *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES] = { - "\\_S0_","\\_S1_","\\_S2_","\\_S3_", - "\\_S4_","\\_S5_","\\_S4B"}; +const char *AcpiGbl_DbSleepStates[ACPI_S_STATE_COUNT] = { + "\\_S0_", + "\\_S1_", + "\\_S2_", + "\\_S3_", + "\\_S4_", + "\\_S5_"}; /****************************************************************************** @@ -255,10 +268,10 @@ const NATIVE_CHAR *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES] = { /* - * Names built-in to the interpreter + * Predefined ACPI Names (Built-in to the Interpreter) * * Initial values are currently supported only for types String and Number. - * To avoid type punning, both are specified as strings in this table. + * Both are specified as strings in this table. * * NOTES: * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run @@ -267,23 +280,25 @@ const NATIVE_CHAR *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES] = { const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = { - {"_GPE", INTERNAL_TYPE_DEF_ANY}, - {"_PR_", INTERNAL_TYPE_DEF_ANY}, - {"_SB_", ACPI_TYPE_DEVICE}, - {"_SI_", INTERNAL_TYPE_DEF_ANY}, - {"_TZ_", INTERNAL_TYPE_DEF_ANY}, - {"_REV", ACPI_TYPE_INTEGER, "2"}, - {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, - {"_GL_", ACPI_TYPE_MUTEX, "0"}, - {NULL, ACPI_TYPE_ANY} /* Table terminator */ + {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_SB_", ACPI_TYPE_DEVICE, NULL}, + {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_TZ_", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_REV", ACPI_TYPE_INTEGER, "2"}, + {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, + {"_GL_", ACPI_TYPE_MUTEX, "0"}, + +#if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) + {"_OSI", ACPI_TYPE_METHOD, "1"}, +#endif + {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */ }; /* * Properties of the ACPI Object Types, both internal and external. - * - * Elements of AcpiNsProperties are bit significant - * and the table is indexed by values of ACPI_OBJECT_TYPE + * The table is indexed by values of ACPI_OBJECT_TYPE */ const UINT8 AcpiGbl_NsProperties[] = @@ -292,16 +307,16 @@ const UINT8 AcpiGbl_NsProperties[] = ACPI_NS_NORMAL, /* 01 Number */ ACPI_NS_NORMAL, /* 02 String */ ACPI_NS_NORMAL, /* 03 Buffer */ - ACPI_NS_LOCAL, /* 04 Package */ + ACPI_NS_NORMAL, /* 04 Package */ ACPI_NS_NORMAL, /* 05 FieldUnit */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 06 Device */ - ACPI_NS_LOCAL, /* 07 AcpiEvent */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 08 Method */ - ACPI_NS_LOCAL, /* 09 Mutex */ - ACPI_NS_LOCAL, /* 10 Region */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 11 Power */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 12 Processor */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 13 Thermal */ + ACPI_NS_NEWSCOPE, /* 06 Device */ + ACPI_NS_NORMAL, /* 07 Event */ + ACPI_NS_NEWSCOPE, /* 08 Method */ + ACPI_NS_NORMAL, /* 09 Mutex */ + ACPI_NS_NORMAL, /* 10 Region */ + ACPI_NS_NEWSCOPE, /* 11 Power */ + ACPI_NS_NEWSCOPE, /* 12 Processor */ + ACPI_NS_NEWSCOPE, /* 13 Thermal */ ACPI_NS_NORMAL, /* 14 BufferField */ ACPI_NS_NORMAL, /* 15 DdbHandle */ ACPI_NS_NORMAL, /* 16 Debug Object */ @@ -314,25 +329,18 @@ const UINT8 AcpiGbl_NsProperties[] = ACPI_NS_NORMAL, /* 23 Address Handler */ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 24 Resource Desc */ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Field */ - ACPI_NS_NORMAL, /* 26 DefFieldDefn */ - ACPI_NS_NORMAL, /* 27 BankFieldDefn */ - ACPI_NS_NORMAL, /* 28 IndexFieldDefn */ - ACPI_NS_NORMAL, /* 29 If */ - ACPI_NS_NORMAL, /* 30 Else */ - ACPI_NS_NORMAL, /* 31 While */ - ACPI_NS_NEWSCOPE, /* 32 Scope */ - ACPI_NS_LOCAL, /* 33 DefAny */ - ACPI_NS_NORMAL, /* 34 Extra */ - ACPI_NS_NORMAL, /* 35 Data */ - ACPI_NS_NORMAL /* 36 Invalid */ + ACPI_NS_NEWSCOPE, /* 26 Scope */ + ACPI_NS_NORMAL, /* 27 Extra */ + ACPI_NS_NORMAL, /* 28 Data */ + ACPI_NS_NORMAL /* 29 Invalid */ }; /* Hex to ASCII conversion table */ -const NATIVE_CHAR AcpiGbl_HexToAscii[] = +static const char AcpiGbl_HexToAscii[] = {'0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F'}; + '8','9','A','B','C','D','E','F'}; /***************************************************************************** * @@ -348,7 +356,7 @@ const NATIVE_CHAR AcpiGbl_HexToAscii[] = * ****************************************************************************/ -UINT8 +char AcpiUtHexToAsciiChar ( ACPI_INTEGER Integer, UINT32 Position) @@ -377,15 +385,15 @@ ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES]; ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] = { - /*********** Name, Signature, Global typed pointer Signature size, How many allowed?, Contains valid AML? */ + /*********** 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_SINGLE}, - /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void **) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE}, - /* FADT 2 */ {FADT_SIG, FADT_SIG, (void **) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE}, - /* FACS 3 */ {FACS_SIG, FACS_SIG, (void **) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE}, - /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE}, - /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE}, - /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE}, + /* 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}, }; @@ -448,20 +456,20 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = /* Region type decoding */ -const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = +const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = { "SystemMemory", "SystemIO", - "PCIConfig", + "PCI_Config", "EmbeddedControl", "SMBus", "CMOS", - "PCIBarTarget", + "PCIBARTarget", "DataTable", }; -NATIVE_CHAR * +char * AcpiUtGetRegionName ( UINT8 SpaceId) { @@ -476,7 +484,7 @@ AcpiUtGetRegionName ( return ("InvalidSpaceID"); } - return ((NATIVE_CHAR *) AcpiGbl_RegionTypes[SpaceId]); + return ((char *) AcpiGbl_RegionTypes[SpaceId]); } @@ -494,7 +502,7 @@ AcpiUtGetRegionName ( /* Event type decoding */ -const NATIVE_CHAR *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = +static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = { "PM_Timer", "GlobalLock", @@ -504,7 +512,7 @@ const NATIVE_CHAR *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = }; -NATIVE_CHAR * +char * AcpiUtGetEventName ( UINT32 EventId) { @@ -514,43 +522,7 @@ AcpiUtGetEventName ( return ("InvalidEventID"); } - return ((NATIVE_CHAR *) AcpiGbl_EventTypes[EventId]); -} - - - - -#ifdef ACPI_DEBUG - -/* - * Strings and procedures used for debug only - * - */ - - -/***************************************************************************** - * - * FUNCTION: AcpiUtGetMutexName - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a mutex ID into a name string (Debug only) - * - ****************************************************************************/ - -NATIVE_CHAR * -AcpiUtGetMutexName ( - UINT32 MutexId) -{ - - if (MutexId > MAX_MTX) - { - return ("Invalid Mutex ID"); - } - - return (AcpiGbl_MutexNames[MutexId]); + return ((char *) AcpiGbl_EventTypes[EventId]); } @@ -575,10 +547,10 @@ AcpiUtGetMutexName ( * indicatewhat type is actually going to be stored for this entry. */ -static const NATIVE_CHAR AcpiGbl_BadType[] = "UNDEFINED"; +static const char AcpiGbl_BadType[] = "UNDEFINED"; #define TYPE_NAME_LENGTH 12 /* Maximum length of each string */ -static const NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */ +static const char *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */ { /* 00 */ "Untyped", /* 01 */ "Integer", @@ -606,77 +578,73 @@ static const NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of AC /* 23 */ "AddrHandler", /* 24 */ "ResourceDesc", /* 25 */ "ResourceFld", - /* 26 */ "RegionFldDfn", - /* 27 */ "BankFldDfn", - /* 28 */ "IndexFldDfn", - /* 29 */ "If", - /* 30 */ "Else", - /* 31 */ "While", - /* 32 */ "Scope", - /* 33 */ "DefAny", - /* 34 */ "Extra", - /* 35 */ "Data", - /* 36 */ "Invalid" + /* 26 */ "Scope", + /* 27 */ "Extra", + /* 28 */ "Data", + /* 39 */ "Invalid" }; -NATIVE_CHAR * +char * AcpiUtGetTypeName ( ACPI_OBJECT_TYPE Type) { - if (Type > INTERNAL_TYPE_INVALID) + if (Type > ACPI_TYPE_INVALID) { - return ((NATIVE_CHAR *) AcpiGbl_BadType); + return ((char *) AcpiGbl_BadType); } - return ((NATIVE_CHAR *) AcpiGbl_NsTypeNames[Type]); + return ((char *) AcpiGbl_NsTypeNames[Type]); } - -/* Data used in keeping track of fields */ - -const NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] = +char * +AcpiUtGetObjectTypeName ( + ACPI_OPERAND_OBJECT *ObjDesc) { - "skip", - "?access?" -}; /* FE = Field Element */ + + if (!ObjDesc) + { + return ("[NULL Object Descriptor]"); + } + + return (AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc))); +} -const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] = +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + +/* + * Strings and procedures used for debug only + */ + + +/***************************************************************************** + * + * FUNCTION: AcpiUtGetMutexName + * + * PARAMETERS: None. + * + * RETURN: Status + * + * DESCRIPTION: Translate a mutex ID into a name string (Debug only) + * + ****************************************************************************/ + +char * +AcpiUtGetMutexName ( + UINT32 MutexId) { - "Error", - "MTR", - "MEQ", - "MLE", - "MLT", - "MGE", - "MGT" -}; + if (MutexId > MAX_MTX) + { + return ("Invalid Mutex ID"); + } -/* Access type decoding */ + return (AcpiGbl_MutexNames[MutexId]); +} -const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] = -{ - "AnyAcc", - "ByteAcc", - "WordAcc", - "DWordAcc", - "QWordAcc", - "BufferAcc", -}; - - -/* Update rule decoding */ - -const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = -{ - "Preserve", - "WriteAsOnes", - "WriteAsZeros" -}; #endif @@ -685,7 +653,7 @@ const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = * * FUNCTION: AcpiUtValidObjectType * - * PARAMETERS: None. + * PARAMETERS: Type - Object type to be validated * * RETURN: TRUE if valid object type * @@ -698,13 +666,11 @@ AcpiUtValidObjectType ( ACPI_OBJECT_TYPE Type) { - if (Type > ACPI_TYPE_MAX) + if (Type > ACPI_TYPE_LOCAL_MAX) { - if ((Type < INTERNAL_TYPE_BEGIN) || - (Type > INTERNAL_TYPE_MAX)) - { - return (FALSE); - } + /* Note: Assumes all TYPEs are contiguous (external/local) */ + + return (FALSE); } return (TRUE); @@ -731,7 +697,10 @@ AcpiUtAllocateOwnerId ( ACPI_FUNCTION_TRACE ("UtAllocateOwnerId"); - AcpiUtAcquireMutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES))) + { + return (0); + } switch (IdType) { @@ -757,11 +726,12 @@ AcpiUtAllocateOwnerId ( AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID; } break; + + default: + break; } - - AcpiUtReleaseMutex (ACPI_MTX_CACHES); - + (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); return_VALUE (OwnerId); } @@ -788,26 +758,26 @@ AcpiUtInitGlobals ( /* Memory allocation and cache lists */ - MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS); + ACPI_MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS); AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_GENERIC_STATE *) NULL)->Common.Next), NULL); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Next), NULL); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE2_OBJECT *) NULL)->Next), NULL); + AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL); + AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL); AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next), NULL); AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_WALK_STATE *) NULL)->Next), NULL); AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize = sizeof (ACPI_NAMESPACE_NODE); AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize = sizeof (ACPI_GENERIC_STATE); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJECT); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE2_OBJECT); + AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJ_COMMON); + AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE_OBJ_NAMED); AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ObjectSize = sizeof (ACPI_OPERAND_OBJECT); AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ObjectSize = sizeof (ACPI_WALK_STATE); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].MaxCacheDepth = MAX_STATE_CACHE_DEPTH; - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].MaxCacheDepth = MAX_PARSE_CACHE_DEPTH; - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].MaxCacheDepth = MAX_EXTPARSE_CACHE_DEPTH; - AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].MaxCacheDepth = MAX_OBJECT_CACHE_DEPTH; - AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].MaxCacheDepth = MAX_WALK_CACHE_DEPTH; + AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].MaxCacheDepth = ACPI_MAX_STATE_CACHE_DEPTH; + AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].MaxCacheDepth = ACPI_MAX_PARSE_CACHE_DEPTH; + AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].MaxCacheDepth = ACPI_MAX_EXTPARSE_CACHE_DEPTH; + AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].MaxCacheDepth = ACPI_MAX_OBJECT_CACHE_DEPTH; + AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].MaxCacheDepth = ACPI_MAX_WALK_CACHE_DEPTH; ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].ListName = "Global Memory Allocation"); ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ListName = "Namespace Nodes"); @@ -842,6 +812,7 @@ AcpiUtInitGlobals ( AcpiGbl_SysNotify.Handler = NULL; AcpiGbl_DrvNotify.Handler = NULL; + AcpiGbl_InitHandler = NULL; /* Global "typed" ACPI table pointers */ @@ -859,6 +830,7 @@ AcpiUtInitGlobals ( /* Miscellaneous variables */ + AcpiGbl_TableFlags = ACPI_PHYSICAL_POINTER; AcpiGbl_RsdpOriginalLocation = 0; AcpiGbl_CmSingleStep = FALSE; AcpiGbl_DbTerminateThreads = FALSE; @@ -875,22 +847,23 @@ AcpiUtInitGlobals ( AcpiGbl_GpeRegisterInfo = NULL; AcpiGbl_GpeNumberInfo = NULL; + AcpiGbl_EventsInitialized = FALSE; /* Namespace */ AcpiGbl_RootNode = NULL; - AcpiGbl_RootNodeStruct.Name = ACPI_ROOT_NAME; + AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; AcpiGbl_RootNodeStruct.Descriptor = ACPI_DESC_TYPE_NAMED; - AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_ANY; + AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; AcpiGbl_RootNodeStruct.Child = NULL; AcpiGbl_RootNodeStruct.Peer = NULL; AcpiGbl_RootNodeStruct.Object = NULL; AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; -#ifdef ACPI_DEBUG - AcpiGbl_LowestStackPointer = ACPI_UINT32_MAX; +#ifdef ACPI_DEBUG_OUTPUT + AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX; #endif return_VOID; diff --git a/source/components/utilities/utinit.c b/source/components/utilities/utinit.c index c9848d4a0..58dd64e34 100644 --- a/source/components/utilities/utinit.c +++ b/source/components/utilities/utinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utinit - Common ACPI subsystem initialization - * $Revision: 1.108 $ + * $Revision: 1.116 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -118,7 +118,6 @@ #define __UTINIT_C__ #include "acpi.h" -#include "achware.h" #include "acnamesp.h" #include "acevents.h" @@ -126,7 +125,6 @@ ACPI_MODULE_NAME ("utinit") - /******************************************************************************* * * FUNCTION: AcpiUtFadtRegisterError @@ -144,14 +142,14 @@ static void AcpiUtFadtRegisterError ( - NATIVE_CHAR *RegisterName, + char *RegisterName, UINT32 Value, ACPI_SIZE Offset) { ACPI_REPORT_WARNING ( - ("Invalid FADT value %s=%lX at offset %lX FADT=%p\n", - RegisterName, Value, Offset, AcpiGbl_FADT)); + ("Invalid FADT value %s=%X at offset %X FADT=%p\n", + RegisterName, Value, (UINT32) Offset, AcpiGbl_FADT)); } @@ -284,7 +282,7 @@ AcpiUtTerminate (void) * ******************************************************************************/ -ACPI_STATUS +void AcpiUtSubsystemShutdown (void) { @@ -295,7 +293,7 @@ AcpiUtSubsystemShutdown (void) if (AcpiGbl_Shutdown) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "ACPI Subsystem is already terminated\n")); - return_ACPI_STATUS (AE_OK); + return_VOID; } /* Subsystem appears active, go ahead and shut it down */ @@ -303,21 +301,21 @@ AcpiUtSubsystemShutdown (void) AcpiGbl_Shutdown = TRUE; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n")); - /* Close the Namespace */ - - AcpiNsTerminate (); - /* Close the AcpiEvent Handling */ AcpiEvTerminate (); + /* Close the Namespace */ + + AcpiNsTerminate (); + /* Close the globals */ AcpiUtTerminate (); /* Purge the local caches */ - AcpiPurgeCachedObjects (); + (void) AcpiPurgeCachedObjects (); /* Debug only - display leftover memory allocation, if any */ @@ -325,7 +323,7 @@ AcpiUtSubsystemShutdown (void) AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL); #endif - return_ACPI_STATUS (AE_OK); + return_VOID; } diff --git a/source/components/utilities/utmath.c b/source/components/utilities/utmath.c index 79da3e1a4..af59ca6dc 100644 --- a/source/components/utilities/utmath.c +++ b/source/components/utilities/utmath.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmath - Integer math support routines - * $Revision: 1.10 $ + * $Revision: 1.12 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -293,7 +293,7 @@ AcpiUtDivide ( */ Partial1 = Quotient.Part.Lo * Divisor.Part.Hi; Partial2.Full = (ACPI_INTEGER) Quotient.Part.Lo * Divisor.Part.Lo; - Partial3.Full = Partial2.Part.Hi + Partial1; + Partial3.Full = (ACPI_INTEGER) Partial2.Part.Hi + Partial1; Remainder.Part.Hi = Partial3.Part.Lo; Remainder.Part.Lo = Partial2.Part.Lo; @@ -318,8 +318,8 @@ AcpiUtDivide ( } Remainder.Full = Remainder.Full - Dividend.Full; - Remainder.Part.Hi = -((INT32) Remainder.Part.Hi); - Remainder.Part.Lo = -((INT32) Remainder.Part.Lo); + Remainder.Part.Hi = (UINT32) -((INT32) Remainder.Part.Hi); + Remainder.Part.Lo = (UINT32) -((INT32) Remainder.Part.Lo); if (Remainder.Part.Lo) { diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index 6856a2918..193fda648 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmisc - common utility procedures - * $Revision: 1.65 $ + * $Revision: 1.93 $ * ******************************************************************************/ @@ -9,7 +9,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 @@ -118,60 +118,253 @@ #define __UTMISC_C__ #include "acpi.h" -#include "acevents.h" -#include "achware.h" #include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acdebug.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utmisc") -#ifdef ACPI_DEBUG +/******************************************************************************* + * + * FUNCTION: AcpiUtPrintString + * + * PARAMETERS: String - Null terminated ASCII string + * + * RETURN: None + * + * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape + * sequences. + * + ******************************************************************************/ + +void +AcpiUtPrintString ( + char *String, + UINT8 MaxLength) +{ + UINT32 i; + + + if (!String) + { + AcpiOsPrintf ("<\"NULL STRING PTR\">"); + return; + } + + AcpiOsPrintf ("\""); + for (i = 0; String[i] && (i < MaxLength); i++) + { + /* Escape sequences */ + + switch (String[i]) + { + case 0x07: + AcpiOsPrintf ("\\a"); /* BELL */ + break; + + case 0x08: + AcpiOsPrintf ("\\b"); /* BACKSPACE */ + break; + + case 0x0C: + AcpiOsPrintf ("\\f"); /* FORMFEED */ + break; + + case 0x0A: + AcpiOsPrintf ("\\n"); /* LINEFEED */ + break; + + case 0x0D: + AcpiOsPrintf ("\\r"); /* CARRIAGE RETURN*/ + break; + + case 0x09: + AcpiOsPrintf ("\\t"); /* HORIZONTAL TAB */ + break; + + case 0x0B: + AcpiOsPrintf ("\\v"); /* VERTICAL TAB */ + break; + + case '\'': /* Single Quote */ + case '\"': /* Double Quote */ + case '\\': /* Backslash */ + AcpiOsPrintf ("\\%c", (int) String[i]); + break; + + default: + + /* Check for printable character or hex escape */ + + if (ACPI_IS_PRINT (String[i])) + { + /* This is a normal character */ + + AcpiOsPrintf ("%c", (int) String[i]); + } + else + { + /* All others will be Hex escapes */ + + AcpiOsPrintf ("\\x%2.2X", (INT32) String[i]); + } + break; + } + } + AcpiOsPrintf ("\""); + + if (i == MaxLength && String[i]) + { + AcpiOsPrintf ("..."); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtDwordByteSwap + * + * PARAMETERS: Value - Value to be converted + * + * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes) + * + ******************************************************************************/ + +UINT32 +AcpiUtDwordByteSwap ( + UINT32 Value) +{ + union + { + UINT32 Value; + UINT8 Bytes[4]; + } Out; + + union + { + UINT32 Value; + UINT8 Bytes[4]; + } In; + + + ACPI_FUNCTION_ENTRY (); + + + In.Value = Value; + + Out.Bytes[0] = In.Bytes[3]; + Out.Bytes[1] = In.Bytes[2]; + Out.Bytes[2] = In.Bytes[1]; + Out.Bytes[3] = In.Bytes[0]; + + return (Out.Value); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtSetIntegerWidth + * + * PARAMETERS: Revision From DSDT header + * + * RETURN: None + * + * DESCRIPTION: Set the global integer bit width based upon the revision + * of the DSDT. For Revision 1 and 0, Integers are 32 bits. + * For Revision 2 and above, Integers are 64 bits. Yes, this + * makes a difference. + * + ******************************************************************************/ + +void +AcpiUtSetIntegerWidth ( + UINT8 Revision) +{ + + if (Revision <= 1) + { + AcpiGbl_IntegerBitWidth = 32; + AcpiGbl_IntegerByteWidth = 4; + } + else + { + AcpiGbl_IntegerBitWidth = 64; + AcpiGbl_IntegerByteWidth = 8; + } +} + + +#ifdef ACPI_DEBUG_OUTPUT /******************************************************************************* * * FUNCTION: AcpiUtDisplayInitPathname * * PARAMETERS: ObjHandle - Handle whose pathname will be displayed - * Path - Additional path string to be appended + * Path - Additional path string to be appended. + * (NULL if no extra path) * * RETURN: ACPI_STATUS * - * DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY + * DESCRIPTION: Display full pathname of an object, DEBUG ONLY * ******************************************************************************/ void AcpiUtDisplayInitPathname ( - ACPI_HANDLE ObjHandle, + UINT8 Type, + ACPI_NAMESPACE_NODE *ObjHandle, char *Path) { ACPI_STATUS Status; ACPI_BUFFER Buffer; - ACPI_FUNCTION_NAME ("UtDisplayInitPathname"); + ACPI_FUNCTION_ENTRY (); + /* Only print the path if the appropriate debug level is enabled */ + + if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES)) + { + return; + } + + /* Get the full pathname to the node */ + Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); - if (ACPI_SUCCESS (Status)) + if (ACPI_FAILURE (Status)) { - if (Path) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s.%s\n", (char *) Buffer.Pointer, Path)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s\n", (char *) Buffer.Pointer)); - } - - ACPI_MEM_FREE (Buffer.Pointer); + return; } + + /* Print what we're doing */ + + switch (Type) + { + case ACPI_TYPE_METHOD: + AcpiOsPrintf ("Executing "); + break; + + default: + AcpiOsPrintf ("Initializing "); + break; + } + + /* Print the object type and pathname */ + + AcpiOsPrintf ("%-12s %s", AcpiUtGetTypeName (Type), (char *) Buffer.Pointer); + + /* Extra path is used to append names like _STA, _INI, etc. */ + + if (Path) + { + AcpiOsPrintf (".%s", Path); + } + AcpiOsPrintf ("\n"); + + ACPI_MEM_FREE (Buffer.Pointer); } #endif @@ -195,7 +388,7 @@ BOOLEAN AcpiUtValidAcpiName ( UINT32 Name) { - NATIVE_CHAR *NamePtr = (NATIVE_CHAR *) &Name; + char *NamePtr = (char *) &Name; UINT32 i; @@ -230,7 +423,7 @@ AcpiUtValidAcpiName ( BOOLEAN AcpiUtValidAcpiCharacter ( - NATIVE_CHAR Character) + char Character) { ACPI_FUNCTION_ENTRY (); @@ -241,6 +434,169 @@ AcpiUtValidAcpiCharacter ( } +/******************************************************************************* + * + * FUNCTION: AcpiUtStrtoul64 + * + * PARAMETERS: String - Null terminated string + * Terminater - Where a pointer to the terminating byte is returned + * Base - Radix of the string + * + * RETURN: Converted value + * + * DESCRIPTION: Convert a string into an unsigned value. + * + ******************************************************************************/ +#define NEGATIVE 1 +#define POSITIVE 0 + +ACPI_STATUS +AcpiUtStrtoul64 ( + char *String, + UINT32 Base, + ACPI_INTEGER *RetInteger) +{ + UINT32 Index; + ACPI_INTEGER ReturnValue = 0; + ACPI_STATUS Status = AE_OK; + ACPI_INTEGER Dividend; + ACPI_INTEGER Quotient; + + + *RetInteger = 0; + + switch (Base) + { + case 0: + case 8: + case 10: + case 16: + break; + + default: + /* + * The specified Base parameter is not in the domain of + * this function: + */ + return (AE_BAD_PARAMETER); + } + + /* + * skip over any white space in the buffer: + */ + while (ACPI_IS_SPACE (*String) || *String == '\t') + { + ++String; + } + + /* + * If the input parameter Base is zero, then we need to + * determine if it is octal, decimal, or hexadecimal: + */ + if (Base == 0) + { + if (*String == '0') + { + if (ACPI_TOLOWER (*(++String)) == 'x') + { + Base = 16; + ++String; + } + else + { + Base = 8; + } + } + else + { + Base = 10; + } + } + + /* + * For octal and hexadecimal bases, skip over the leading + * 0 or 0x, if they are present. + */ + if (Base == 8 && *String == '0') + { + String++; + } + + if (Base == 16 && + *String == '0' && + ACPI_TOLOWER (*(++String)) == 'x') + { + String++; + } + + /* Main loop: convert the string to an unsigned long */ + + while (*String) + { + if (ACPI_IS_DIGIT (*String)) + { + Index = ((UINT8) *String) - '0'; + } + else + { + Index = (UINT8) ACPI_TOUPPER (*String); + if (ACPI_IS_UPPER ((char) Index)) + { + Index = Index - 'A' + 10; + } + else + { + goto ErrorExit; + } + } + + if (Index >= Base) + { + goto ErrorExit; + } + + /* Check to see if value is out of range: */ + + Dividend = ACPI_INTEGER_MAX - (ACPI_INTEGER) Index; + (void) AcpiUtShortDivide (&Dividend, Base, &Quotient, NULL); + if (ReturnValue > Quotient) + { + goto ErrorExit; + } + + ReturnValue *= Base; + ReturnValue += Index; + ++String; + } + + *RetInteger = ReturnValue; + return (Status); + + +ErrorExit: + switch (Base) + { + case 8: + Status = AE_BAD_OCTAL_CONSTANT; + break; + + case 10: + Status = AE_BAD_DECIMAL_CONSTANT; + break; + + case 16: + Status = AE_BAD_HEX_CONSTANT; + break; + + default: + /* Base validated above */ + break; + } + + return (Status); +} + + /******************************************************************************* * * FUNCTION: AcpiUtStrupr @@ -253,11 +609,11 @@ AcpiUtValidAcpiCharacter ( * ******************************************************************************/ -NATIVE_CHAR * +char * AcpiUtStrupr ( - NATIVE_CHAR *SrcString) + char *SrcString) { - NATIVE_CHAR *String; + char *String; ACPI_FUNCTION_ENTRY (); @@ -267,11 +623,10 @@ AcpiUtStrupr ( for (String = SrcString; *String; ) { - *String = (char) TOUPPER (*String); + *String = (char) ACPI_TOUPPER (*String); String++; } - return (SrcString); } @@ -341,7 +696,7 @@ AcpiUtMutexTerminate ( */ for (i = 0; i < NUM_MTX; i++) { - AcpiUtDeleteMutex (i); + (void) AcpiUtDeleteMutex (i); } return_VOID; @@ -375,7 +730,6 @@ AcpiUtCreateMutex ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - if (!AcpiGbl_AcpiMutexInfo[MutexId].Mutex) { Status = AcpiOsCreateSemaphore (1, 1, @@ -415,7 +769,6 @@ AcpiUtDeleteMutex ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - Status = AcpiOsDeleteSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex); AcpiGbl_AcpiMutexInfo[MutexId].Mutex = NULL; @@ -454,7 +807,6 @@ AcpiUtAcquireMutex ( return (AE_BAD_PARAMETER); } - ThisThreadId = AcpiOsGetThreadId (); /* @@ -485,14 +837,12 @@ AcpiUtAcquireMutex ( } } - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X attempting to acquire Mutex [%s]\n", ThisThreadId, AcpiUtGetMutexName (MutexId))); Status = AcpiOsWaitSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex, - 1, WAIT_FOREVER); - + 1, ACPI_WAIT_FOREVER); if (ACPI_SUCCESS (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", @@ -501,7 +851,6 @@ AcpiUtAcquireMutex ( AcpiGbl_AcpiMutexInfo[MutexId].UseCount++; AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ThisThreadId; } - else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n", @@ -547,7 +896,6 @@ AcpiUtReleaseMutex ( return (AE_BAD_PARAMETER); } - /* * Mutex must be acquired in order to release it! */ @@ -560,7 +908,6 @@ AcpiUtReleaseMutex ( return (AE_NOT_ACQUIRED); } - /* * Deadlock prevention. Check if this thread owns any mutexes of value * greater than this one. If so, the thread has violated the mutex @@ -584,7 +931,6 @@ AcpiUtReleaseMutex ( } } - /* Mark unlocked FIRST */ AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; @@ -646,7 +992,6 @@ AcpiUtCreateUpdateStateAndPush ( return (AE_NO_MEMORY); } - AcpiUtPushGenericState (StateList, State); return (AE_OK); } @@ -685,7 +1030,6 @@ AcpiUtCreatePkgStateAndPush ( return (AE_NO_MEMORY); } - AcpiUtPushGenericState (StateList, State); return (AE_OK); } @@ -954,7 +1298,6 @@ AcpiUtCreateControlState ( return_PTR (NULL); } - /* Init fields specific to the control struct */ State->Common.DataType = ACPI_DESC_TYPE_STATE_CONTROL; @@ -1014,116 +1357,6 @@ AcpiUtDeleteGenericStateCache ( } -/******************************************************************************* - * - * FUNCTION: AcpiUtResolveReference - * - * PARAMETERS: ACPI_PKG_CALLBACK - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: Resolve a reference object to an actual value - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtResolveReference ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context) -{ - ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context; - - - switch (ObjectType) - { - case ACPI_COPY_TYPE_SIMPLE: - - /* - * Simple object - check for a reference - */ - if (SourceObject->Common.Type == INTERNAL_TYPE_REFERENCE) - { - switch (SourceObject->Reference.Opcode) - { - case AML_ZERO_OP: - - SourceObject->Common.Type = ACPI_TYPE_INTEGER; - SourceObject->Integer.Value = 0; - break; - - case AML_ONE_OP: - - SourceObject->Common.Type = ACPI_TYPE_INTEGER; - SourceObject->Integer.Value = 1; - break; - - case AML_ONES_OP: - - SourceObject->Common.Type = ACPI_TYPE_INTEGER; - SourceObject->Integer.Value = ACPI_INTEGER_MAX; - break; - } - } - break; - - - case ACPI_COPY_TYPE_PACKAGE: - - /* Package object - nothing much to do here, let the walk handle it */ - - Info->NumPackages++; - State->Pkg.ThisTargetObj = NULL; - break; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtResolvePackageReferences - * - * PARAMETERS: ObjDesc - The Package object on which to resolve refs - * - * RETURN: Status - * - * DESCRIPTION: Walk through a package and turn internal references into values - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtResolvePackageReferences ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_PKG_INFO Info; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE ("UtResolvePackageReferences"); - - - if (ObjDesc->Common.Type != ACPI_TYPE_PACKAGE) - { - /* The object must be a package */ - - ACPI_REPORT_ERROR (("Expecting a Package object\n")); - return_ACPI_STATUS (AE_TYPE); - } - - Info.Length = 0; - Info.ObjectSpace = 0; - Info.NumPackages = 1; - - Status = AcpiUtWalkPackageTree (ObjDesc, NULL, - AcpiUtResolveReference, &Info); - - return_ACPI_STATUS (Status); -} - - /******************************************************************************* * * FUNCTION: AcpiUtWalkPackageTree @@ -1161,6 +1394,8 @@ AcpiUtWalkPackageTree ( while (State) { + /* Get one element of the package */ + ThisIndex = State->Pkg.Index; ThisSourceObj = (ACPI_OPERAND_OBJECT *) State->Pkg.SourceObject->Package.Elements[ThisIndex]; @@ -1174,8 +1409,8 @@ AcpiUtWalkPackageTree ( * case below. */ if ((!ThisSourceObj) || - (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_INTERNAL) || - (ThisSourceObj->Common.Type != ACPI_TYPE_PACKAGE)) + (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_OPERAND) || + (ACPI_GET_OBJECT_TYPE (ThisSourceObj) != ACPI_TYPE_PACKAGE)) { Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj, State, Context); @@ -1268,6 +1503,7 @@ AcpiUtGenerateChecksum ( UINT32 i; signed char Sum = 0; + for (i = 0; i < Length; i++) { Sum = (signed char) (Sum + Buffer[i]); @@ -1351,7 +1587,7 @@ AcpiUtGetResourceEndTag ( void AcpiUtReportError ( - NATIVE_CHAR *ModuleName, + char *ModuleName, UINT32 LineNumber, UINT32 ComponentId) { @@ -1378,7 +1614,7 @@ AcpiUtReportError ( void AcpiUtReportWarning ( - NATIVE_CHAR *ModuleName, + char *ModuleName, UINT32 LineNumber, UINT32 ComponentId) { @@ -1404,7 +1640,7 @@ AcpiUtReportWarning ( void AcpiUtReportInfo ( - NATIVE_CHAR *ModuleName, + char *ModuleName, UINT32 LineNumber, UINT32 ComponentId) { diff --git a/source/components/utilities/utobject.c b/source/components/utilities/utobject.c index cad11715b..40c3713ee 100644 --- a/source/components/utilities/utobject.c +++ b/source/components/utilities/utobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 1.68 $ + * $Revision: 1.82 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -117,9 +117,7 @@ #define __UTOBJECT_C__ #include "acpi.h" -#include "acinterp.h" #include "acnamesp.h" -#include "actables.h" #include "amlcode.h" @@ -131,10 +129,9 @@ * * FUNCTION: AcpiUtCreateInternalObjectDbg * - * PARAMETERS: Address - Address of the memory to deallocate - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller + * PARAMETERS: ModuleName - Source file name of caller + * LineNumber - Line number of caller + * ComponentId - Component type of caller * Type - ACPI Type of the new object * * RETURN: Object - The new object. Null on failure @@ -151,7 +148,7 @@ ACPI_OPERAND_OBJECT * AcpiUtCreateInternalObjectDbg ( - NATIVE_CHAR *ModuleName, + char *ModuleName, UINT32 LineNumber, UINT32 ComponentId, ACPI_OBJECT_TYPE Type) @@ -185,13 +182,17 @@ AcpiUtCreateInternalObjectDbg ( return_PTR (NULL); } - SecondObject->Common.Type = INTERNAL_TYPE_EXTRA; + SecondObject->Common.Type = ACPI_TYPE_LOCAL_EXTRA; SecondObject->Common.ReferenceCount = 1; /* Link the second object to the first */ Object->Common.NextObject = SecondObject; break; + + default: + /* All others have no secondary object */ + break; } /* Save the object type in the object descriptor */ @@ -208,11 +209,66 @@ AcpiUtCreateInternalObjectDbg ( } +/******************************************************************************* + * + * FUNCTION: AcpiUtCreateBufferObject + * + * PARAMETERS: BufferSize - Size of buffer to be created + * + * RETURN: Pointer to a new Buffer object + * + * DESCRIPTION: Create a fully initialized buffer object + * + ******************************************************************************/ + +ACPI_OPERAND_OBJECT * +AcpiUtCreateBufferObject ( + ACPI_SIZE BufferSize) +{ + ACPI_OPERAND_OBJECT *BufferDesc; + UINT8 *Buffer; + + + ACPI_FUNCTION_TRACE_U32 ("UtCreateBufferObject", BufferSize); + + + /* + * Create a new Buffer object + */ + BufferDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); + if (!BufferDesc) + { + return_PTR (NULL); + } + + /* Allocate the actual buffer */ + + Buffer = ACPI_MEM_CALLOCATE (BufferSize); + if (!Buffer) + { + ACPI_REPORT_ERROR (("CreateBuffer: could not allocate size %X\n", + (UINT32) BufferSize)); + AcpiUtRemoveReference (BufferDesc); + return_PTR (NULL); + } + + /* Complete buffer object initialization */ + + BufferDesc->Buffer.Flags |= AOPOBJ_DATA_VALID; + BufferDesc->Buffer.Pointer = Buffer; + BufferDesc->Buffer.Length = (UINT32) BufferSize; + + /* Return the new buffer descriptor */ + + return_PTR (BufferDesc); +} + + /******************************************************************************* * * FUNCTION: AcpiUtValidInternalObject * - * PARAMETERS: Operand - Object to be validated + * PARAMETERS: Object - Object to be validated * * RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT * @@ -230,8 +286,7 @@ AcpiUtValidInternalObject ( if (!Object) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Null Object Ptr\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Null Object Ptr\n")); return (FALSE); } @@ -239,7 +294,7 @@ AcpiUtValidInternalObject ( switch (ACPI_GET_DESCRIPTOR_TYPE (Object)) { - case ACPI_DESC_TYPE_INTERNAL: + case ACPI_DESC_TYPE_OPERAND: /* The object appears to be a valid ACPI_OPERAND_OBJECT */ @@ -257,10 +312,17 @@ AcpiUtValidInternalObject ( "**** Obj %p is a parser obj, not ACPI obj\n", Object)); break; + case ACPI_DESC_TYPE_CACHED: + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "**** Obj %p has already been released to internal cache\n", Object)); + break; + default: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Obj %p is of unknown type\n", Object)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "**** Obj %p has unknown descriptor type %X\n", Object, + ACPI_GET_DESCRIPTOR_TYPE (Object))); break; } @@ -275,7 +337,6 @@ AcpiUtValidInternalObject ( * PARAMETERS: ModuleName - Caller's module name (for error output) * LineNumber - Caller's line number (for error output) * ComponentId - Caller's component ID (for error output) - * Message - Error message to use on failure * * RETURN: Pointer to newly allocated object descriptor. Null on error * @@ -286,7 +347,7 @@ AcpiUtValidInternalObject ( void * AcpiUtAllocateObjectDescDbg ( - NATIVE_CHAR *ModuleName, + char *ModuleName, UINT32 LineNumber, UINT32 ComponentId) { @@ -305,13 +366,12 @@ AcpiUtAllocateObjectDescDbg ( return_PTR (NULL); } - /* Mark the descriptor type */ - ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_INTERNAL); + ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_OPERAND); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", - Object, sizeof (ACPI_OPERAND_OBJECT))); + Object, (UINT32) sizeof (ACPI_OPERAND_OBJECT))); return_PTR (Object); } @@ -321,7 +381,7 @@ AcpiUtAllocateObjectDescDbg ( * * FUNCTION: AcpiUtDeleteObjectDesc * - * PARAMETERS: Object - Acpi internal object to be deleted + * PARAMETERS: Object - An Acpi internal object to be deleted * * RETURN: None. * @@ -338,7 +398,7 @@ AcpiUtDeleteObjectDesc ( /* Object must be an ACPI_OPERAND_OBJECT */ - if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_INTERNAL) + if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Obj %p is not an ACPI object\n", Object)); @@ -357,7 +417,7 @@ AcpiUtDeleteObjectDesc ( * * PARAMETERS: None * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Purge the global state object cache. Used during subsystem * termination. @@ -381,12 +441,12 @@ AcpiUtDeleteObjectCache ( * FUNCTION: AcpiUtGetSimpleObjectSize * * PARAMETERS: *InternalObject - Pointer to the object we are examining - * *RetLength - Where the length is returned + * *ObjLength - Where the length is returned * * RETURN: Status * * DESCRIPTION: This function is called to determine the space required to - * contain a simple object for return to an API user. + * contain a simple object for return to an external user. * * The length includes the object structure plus any additional * needed space. @@ -413,7 +473,6 @@ AcpiUtGetSimpleObjectSize ( return_ACPI_STATUS (AE_OK); } - /* Start with the length of the Acpi object */ Length = sizeof (ACPI_OBJECT); @@ -426,26 +485,23 @@ AcpiUtGetSimpleObjectSize ( return_ACPI_STATUS (Status); } - /* * The final length depends on the object type * Strings and Buffers are packed right up against the parent object and * must be accessed bytewise or there may be alignment problems on * certain processors */ - - switch (InternalObject->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (InternalObject)) { - case ACPI_TYPE_STRING: - Length += InternalObject->String.Length + 1; + Length += (ACPI_SIZE) InternalObject->String.Length + 1; break; case ACPI_TYPE_BUFFER: - Length += InternalObject->Buffer.Length; + Length += (ACPI_SIZE) InternalObject->Buffer.Length; break; @@ -459,19 +515,10 @@ AcpiUtGetSimpleObjectSize ( break; - case INTERNAL_TYPE_REFERENCE: + case ACPI_TYPE_LOCAL_REFERENCE: switch (InternalObject->Reference.Opcode) { - case AML_ZERO_OP: - case AML_ONE_OP: - case AML_ONES_OP: - case AML_REVISION_OP: - - /* These Constant opcodes will be resolved to Integers */ - - break; - case AML_INT_NAMEPATH_OP: /* @@ -485,7 +532,7 @@ AcpiUtGetSimpleObjectSize ( /* * No other reference opcodes are supported. - * Notably, Locals and Args are not supported, by this may be + * Notably, Locals and Args are not supported, but this may be * required eventually. */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -500,12 +547,11 @@ AcpiUtGetSimpleObjectSize ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n", - InternalObject->Common.Type, InternalObject)); + ACPI_GET_OBJECT_TYPE (InternalObject), InternalObject)); Status = AE_TYPE; break; } - /* * Account for the space required by the object rounded up to the next * multiple of the machine word size. This keeps each object aligned @@ -523,7 +569,7 @@ AcpiUtGetSimpleObjectSize ( * * PARAMETERS: ACPI_PKG_CALLBACK * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: Get the length of one package element. * @@ -566,6 +612,13 @@ AcpiUtGetElementLength ( Info->NumPackages++; State->Pkg.ThisTargetObj = NULL; break; + + + default: + + /* No other types allowed */ + + return (AE_BAD_PARAMETER); } return (Status); @@ -577,12 +630,12 @@ AcpiUtGetElementLength ( * FUNCTION: AcpiUtGetPackageObjectSize * * PARAMETERS: *InternalObject - Pointer to the object we are examining - * *RetLength - Where the length is returned + * *ObjLength - Where the length is returned * * RETURN: Status * * DESCRIPTION: This function is called to determine the space required to - * contain a package object for return to an API user. + * contain a package object for return to an external user. * * This is moderately complex since a package contains other * objects including packages. @@ -618,7 +671,7 @@ AcpiUtGetPackageObjectSize ( * Round up to the next machine word. */ Info.Length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) * - Info.NumPackages; + (ACPI_SIZE) Info.NumPackages; /* Return the total package length */ @@ -632,7 +685,7 @@ AcpiUtGetPackageObjectSize ( * FUNCTION: AcpiUtGetObjectSize * * PARAMETERS: *InternalObject - Pointer to the object we are examining - * *RetLength - Where the length will be returned + * *ObjLength - Where the length will be returned * * RETURN: Status * @@ -652,8 +705,8 @@ AcpiUtGetObjectSize( ACPI_FUNCTION_ENTRY (); - if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_INTERNAL) && - (InternalObject->Common.Type == ACPI_TYPE_PACKAGE)) + if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_OPERAND) && + (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE)) { Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength); } diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index c416e5b43..f9f26d8ff 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utxface - External interfaces for "global" ACPI functions - * $Revision: 1.91 $ + * $Revision: 1.101 $ * *****************************************************************************/ @@ -9,7 +9,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 @@ -119,15 +119,10 @@ #include "acpi.h" #include "acevents.h" -#include "achware.h" #include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acdebug.h" -#include "acexcep.h" #include "acparser.h" #include "acdispat.h" - +#include "acdebug.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utxface") @@ -198,7 +193,7 @@ AcpiInitializeSubsystem ( /* If configured, initialize the AML debugger */ - ACPI_DEBUGGER_EXEC (AcpiDbInitialize ()); + ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ()); return_ACPI_STATUS (Status); } @@ -229,14 +224,14 @@ AcpiEnableSubsystem ( /* * Install the default OpRegion handlers. These are installed unless - * other handlers have already been installed via the + * other handlers have already been installed via the * InstallAddressSpaceHandler interface */ if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); - Status = AcpiEvInstallDefaultAddressSpaceHandlers (); + Status = AcpiEvInitAddressSpaces (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -265,6 +260,8 @@ AcpiEnableSubsystem ( { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); + AcpiGbl_OriginalMode = AcpiHwGetMode(); + Status = AcpiEnable (); if (ACPI_FAILURE (Status)) { @@ -303,6 +300,31 @@ AcpiEnableSubsystem ( } } + return_ACPI_STATUS (Status); +} + +/******************************************************************************* + * + * FUNCTION: AcpiInitializeObjects + * + * PARAMETERS: Flags - Init/enable Options + * + * RETURN: Status + * + * DESCRIPTION: Completes namespace initialization by initializing device + * objects and executing AML code for Regions, buffers, etc. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInitializeObjects ( + UINT32 Flags) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE ("AcpiInitializeObjects"); + /* * Initialize all device objects in the namespace * This runs the _STA and _INI methods. @@ -361,6 +383,9 @@ AcpiEnableSubsystem ( ACPI_STATUS AcpiTerminate (void) { + ACPI_STATUS Status; + + ACPI_FUNCTION_TRACE ("AcpiTerminate"); @@ -378,7 +403,7 @@ AcpiTerminate (void) AcpiUtMutexTerminate (); -#ifdef ENABLE_DEBUGGER +#ifdef ACPI_DEBUGGER /* Shut down the debugger */ @@ -387,10 +412,8 @@ AcpiTerminate (void) /* Now we can shutdown the OS-dependent layer */ - AcpiOsTerminate (); - - - return_ACPI_STATUS (AE_OK); + Status = AcpiOsTerminate (); + return_ACPI_STATUS (Status); } @@ -517,6 +540,41 @@ AcpiGetSystemInfo ( } +/***************************************************************************** + * + * FUNCTION: AcpiInstallInitializationHandler + * + * PARAMETERS: Handler - Callback procedure + * + * RETURN: Status + * + * DESCRIPTION: Install an initialization handler + * + * TBD: When a second function is added, must save the Function also. + * + ****************************************************************************/ + +ACPI_STATUS +AcpiInstallInitializationHandler ( + ACPI_INIT_HANDLER Handler, + UINT32 Function) +{ + + if (!Handler) + { + return (AE_BAD_PARAMETER); + } + + if (AcpiGbl_InitHandler) + { + return (AE_ALREADY_EXISTS); + } + + AcpiGbl_InitHandler = Handler; + return AE_OK; +} + + /***************************************************************************** * * FUNCTION: AcpiPurgeCachedObjects diff --git a/source/include/acapps.h b/source/include/acapps.h new file mode 100644 index 000000000..1d2af4754 --- /dev/null +++ b/source/include/acapps.h @@ -0,0 +1,190 @@ +/****************************************************************************** + * + * Module Name: acapps - common include for ACPI applications/tools + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef _ACAPPS +#define _ACAPPS + + +#ifdef _MSC_VER /* disable some level-4 warnings */ +#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */ +#endif + +extern UINT8 *DsdtPtr; +extern UINT32 AcpiDsdtLength; +extern UINT8 *AmlStart; +extern UINT32 AmlLength; + + +extern int AcpiGbl_Optind; +extern char *AcpiGbl_Optarg; + +int +AcpiGetopt( + int argc, + char **argv, + char *opts); + +ACPI_STATUS +AdInitialize ( + void); + +char * +FlGenerateFilename ( + char *InputFilename, + char *Suffix); + +ACPI_STATUS +FlSplitInputPathname ( + char *InputPath, + char **OutDirectoryPath, + char **OutFilename); + +ACPI_STATUS +AdAmlDisassemble ( + BOOLEAN OutToFile, + char *Filename, + char *Prefix, + char **OutFilename, + BOOLEAN GetAllTables); + +void +AdPrintStatistics (void); + +ACPI_STATUS +AdFindDsdt( + UINT8 **DsdtPtr, + UINT32 *DsdtLength); + +void +AdDumpTables (void); + +ACPI_STATUS +AdGetTables ( + char *Filename, + BOOLEAN GetAllTables); + +ACPI_STATUS +AdParseTables (void); + +ACPI_STATUS +AdDisplayTables ( + char *Filename); + +ACPI_STATUS +AdDisplayStatistics (void); + + +#endif /* _ACAPPS */ + diff --git a/source/include/acconfig.h b/source/include/acconfig.h new file mode 100644 index 000000000..e52878b08 --- /dev/null +++ b/source/include/acconfig.h @@ -0,0 +1,280 @@ +/****************************************************************************** + * + * Name: acconfig.h - Global configuration constants + * $Revision: 1.124 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef _ACCONFIG_H +#define _ACCONFIG_H + + +/****************************************************************************** + * + * Compile-time options + * + *****************************************************************************/ + +/* + * ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the + * ACPI subsystem. This includes the DEBUG_PRINT output + * statements. When disabled, all DEBUG_PRINT + * statements are compiled out. + * + * ACPI_APPLICATION - Use this switch if the subsystem is going to be run + * at the application level. + * + */ + + +/****************************************************************************** + * + * Subsystem Constants + * + *****************************************************************************/ + + +/* Version string */ + +#define ACPI_CA_VERSION 0x20021217 + +/* Version of ACPI supported */ + +#define ACPI_CA_SUPPORT_LEVEL 2 + +/* Maximum objects in the various object caches */ + +#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */ +#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ +#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ +#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ + +/* String size constants */ + +#define ACPI_MAX_STRING_LENGTH 512 +#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */ + +/* Maximum count for a semaphore object */ + +#define ACPI_MAX_SEMAPHORE_COUNT 256 + +/* Max reference count (for debug only) */ + +#define ACPI_MAX_REFERENCE_COUNT 0x400 + +/* Size of cached memory mapping for system memory operation region */ + +#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 + + +/****************************************************************************** + * + * Configuration of subsystem behavior + * + *****************************************************************************/ + + +/* + * Should the subystem abort the loading of an ACPI table if the + * table checksum is incorrect? + */ +#define ACPI_CHECKSUM_ABORT FALSE + + +/****************************************************************************** + * + * ACPI Specification constants (Do not change unless the specification changes) + * + *****************************************************************************/ + +/* Number of distinct GPE register blocks and register width */ + +#define ACPI_MAX_GPE_BLOCKS 2 +#define ACPI_GPE_REGISTER_WIDTH 8 + +/* + * Method info (in WALK_STATE), containing local variables and argumetns + */ +#define ACPI_METHOD_NUM_LOCALS 8 +#define ACPI_METHOD_MAX_LOCAL 7 + +#define ACPI_METHOD_NUM_ARGS 7 +#define ACPI_METHOD_MAX_ARG 6 + +/* Maximum length of resulting string when converting from a buffer */ + +#define ACPI_MAX_STRING_CONVERSION 200 + +/* + * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG + */ +#define ACPI_OBJ_NUM_OPERANDS 8 +#define ACPI_OBJ_MAX_OPERAND 7 + +/* Names within the namespace are 4 bytes long */ + +#define ACPI_NAME_SIZE 4 +#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ +#define ACPI_PATH_SEPARATOR '.' + +/* Constants used in searching for the RSDP in low memory */ + +#define ACPI_LO_RSDP_WINDOW_BASE 0 /* Physical Address */ +#define ACPI_HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */ +#define ACPI_LO_RSDP_WINDOW_SIZE 0x400 +#define ACPI_HI_RSDP_WINDOW_SIZE 0x20000 +#define ACPI_RSDP_SCAN_STEP 16 + +/* Operation regions */ + +#define ACPI_NUM_PREDEFINED_REGIONS 8 +#define ACPI_USER_REGION_BEGIN 0x80 + +/* Maximum SpaceIds for Operation Regions */ + +#define ACPI_MAX_ADDRESS_SPACE 255 + +/* Array sizes. Used for range checking also */ + +#define ACPI_NUM_ACCESS_TYPES 6 +#define ACPI_NUM_UPDATE_RULES 3 +#define ACPI_NUM_LOCK_RULES 2 +#define ACPI_NUM_MATCH_OPS 6 +#define ACPI_NUM_OPCODES 256 +#define ACPI_NUM_FIELD_NAMES 2 + +/* RSDP checksums */ + +#define ACPI_RSDP_CHECKSUM_LENGTH 20 +#define ACPI_RSDP_XCHECKSUM_LENGTH 36 + +/* SMBus bidirectional buffer size */ + +#define ACPI_SMBUS_BUFFER_SIZE 34 + + +/****************************************************************************** + * + * ACPI AML Debugger + * + *****************************************************************************/ + + +#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ + +#define ACPI_DEBUGGER_COMMAND_PROMPT '-' +#define ACPI_DEBUGGER_EXECUTE_PROMPT '%' + + +#endif /* _ACCONFIG_H */ + diff --git a/source/include/acdebug.h b/source/include/acdebug.h new file mode 100644 index 000000000..b05d4f9f6 --- /dev/null +++ b/source/include/acdebug.h @@ -0,0 +1,524 @@ +/****************************************************************************** + * + * Name: acdebug.h - ACPI/AML debugger + * $Revision: 1.66 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACDEBUG_H__ +#define __ACDEBUG_H__ + + +#define ACPI_DEBUG_BUFFER_SIZE 4196 + +typedef struct CommandInfo +{ + char *Name; /* Command Name */ + UINT8 MinArgs; /* Minimum arguments required */ + +} COMMAND_INFO; + + +typedef struct ArgumentInfo +{ + char *Name; /* Argument Name */ + +} ARGUMENT_INFO; + + +#define PARAM_LIST(pl) pl + +#define DBTEST_OUTPUT_LEVEL(lvl) if (AcpiGbl_DbOpt_verbose) + +#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ + AcpiOsPrintf PARAM_LIST(fp);} + +#define EX_NO_SINGLE_STEP 1 +#define EX_SINGLE_STEP 2 + + +/* Prototypes */ + + +/* + * dbapi - external debugger interfaces + */ + +ACPI_STATUS +AcpiDbInitialize ( + void); + +void +AcpiDbTerminate ( + void); + +ACPI_STATUS +AcpiDbSingleStep ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + UINT32 OpType); + + +/* + * dbcmds - debug commands and output routines + */ + +void +AcpiDbDisplayTableInfo ( + char *TableArg); + +void +AcpiDbUnloadAcpiTable ( + char *TableArg, + char *InstanceArg); + +void +AcpiDbSetMethodBreakpoint ( + char *Location, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +void +AcpiDbSetMethodCallBreakpoint ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDbDisassembleAml ( + char *Statements, + ACPI_PARSE_OBJECT *Op); + +void +AcpiDbDumpNamespace ( + char *StartArg, + char *DepthArg); + +void +AcpiDbDumpNamespaceByOwner ( + char *OwnerArg, + char *DepthArg); + +void +AcpiDbSendNotify ( + char *Name, + UINT32 Value); + +void +AcpiDbSetMethodData ( + char *TypeArg, + char *IndexArg, + char *ValueArg); + +ACPI_STATUS +AcpiDbDisplayObjects ( + char *ObjTypeArg, + char *DisplayCountArg); + +ACPI_STATUS +AcpiDbFindNameInNamespace ( + char *NameArg); + +void +AcpiDbSetScope ( + char *Name); + +void +AcpiDbFindReferences ( + char *ObjectArg); + +void +AcpiDbDisplayLocks (void); + + +void +AcpiDbDisplayResources ( + char *ObjectArg); + +void +AcpiDbCheckIntegrity ( + void); + +ACPI_STATUS +AcpiDbIntegrityWalk ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +ACPI_STATUS +AcpiDbWalkAndMatchName ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +ACPI_STATUS +AcpiDbWalkForReferences ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +ACPI_STATUS +AcpiDbWalkForSpecificObjects ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + + +/* + * dbdisply - debug display commands + */ + +void +AcpiDbDisplayMethodInfo ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDbDecodeAndDisplayObject ( + char *Target, + char *OutputType); + +void +AcpiDbDecodeNode ( + ACPI_NAMESPACE_NODE *Node); + +void +AcpiDbDisplayResultObject ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDbDisplayAllMethods ( + char *DisplayCountArg); + +void +AcpiDbDisplayInternalObject ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +void +AcpiDbDisplayArguments ( + void); + +void +AcpiDbDisplayLocals ( + void); + +void +AcpiDbDisplayResults ( + void); + +void +AcpiDbDisplayCallingTree ( + void); + +void +AcpiDbDisplayArgumentObject ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +void +AcpiDbDumpParserDescriptor ( + ACPI_PARSE_OBJECT *Op); + +void * +AcpiDbGetPointer ( + void *Target); + +void +AcpiDbDecodeInternalObject ( + ACPI_OPERAND_OBJECT *ObjDesc); + + +/* + * dbexec - debugger control method execution + */ + +void +AcpiDbExecute ( + char *Name, + char **Args, + UINT32 Flags); + +void +AcpiDbCreateExecutionThreads ( + char *NumThreadsArg, + char *NumLoopsArg, + char *MethodNameArg); + +ACPI_STATUS +AcpiDbExecuteMethod ( + ACPI_DB_METHOD_INFO *Info, + ACPI_BUFFER *ReturnObj); + +void +AcpiDbExecuteSetup ( + ACPI_DB_METHOD_INFO *Info); + +UINT32 +AcpiDbGetOutstandingAllocations ( + void); + +void ACPI_SYSTEM_XFACE +AcpiDbMethodThread ( + void *Context); + + +/* + * dbfileio - Debugger file I/O commands + */ + +ACPI_OBJECT_TYPE +AcpiDbMatchArgument ( + char *UserArgument, + ARGUMENT_INFO *Arguments); + +ACPI_STATUS +AeLocalLoadTable ( + ACPI_TABLE_HEADER *TablePtr); + +void +AcpiDbCloseDebugFile ( + void); + +void +AcpiDbOpenDebugFile ( + char *Name); + +ACPI_STATUS +AcpiDbLoadAcpiTable ( + char *Filename); + +ACPI_STATUS +AcpiDbGetAcpiTable ( + char *Filename); + +/* + * dbhistry - debugger HISTORY command + */ + +void +AcpiDbAddToHistory ( + char *CommandLine); + +void +AcpiDbDisplayHistory (void); + +char * +AcpiDbGetFromHistory ( + char *CommandNumArg); + + +/* + * dbinput - user front-end to the AML debugger + */ + +ACPI_STATUS +AcpiDbCommandDispatch ( + char *InputBuffer, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +void ACPI_SYSTEM_XFACE +AcpiDbExecuteThread ( + void *Context); + +ACPI_STATUS +AcpiDbUserCommands ( + char Prompt, + ACPI_PARSE_OBJECT *Op); + +void +AcpiDbDisplayHelp ( + char *HelpType); + +char * +AcpiDbGetNextToken ( + char *String, + char **Next); + +UINT32 +AcpiDbGetLine ( + char *InputBuffer); + +UINT32 +AcpiDbMatchCommand ( + char *UserCommand); + +void +AcpiDbSingleThread ( + void); + + +/* + * dbstats - Generation and display of ACPI table statistics + */ + +void +AcpiDbGenerateStatistics ( + ACPI_PARSE_OBJECT *Root, + BOOLEAN IsMethod); + + +ACPI_STATUS +AcpiDbDisplayStatistics ( + char *TypeArg); + +ACPI_STATUS +AcpiDbClassifyOneObject ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +void +AcpiDbCountNamespaceObjects ( + void); + +void +AcpiDbEnumerateObject ( + ACPI_OPERAND_OBJECT *ObjDesc); + + +/* + * dbutils - AML debugger utilities + */ + +void +AcpiDbSetOutputDestination ( + UINT32 Where); + +void +AcpiDbDumpBuffer ( + UINT32 Address); + +void +AcpiDbDumpObject ( + ACPI_OBJECT *ObjDesc, + UINT32 Level); + +void +AcpiDbPrepNamestring ( + char *Name); + + +ACPI_STATUS +AcpiDbSecondPassParse ( + ACPI_PARSE_OBJECT *Root); + +ACPI_NAMESPACE_NODE * +AcpiDbLocalNsLookup ( + char *Name); + + +#endif /* __ACDEBUG_H__ */ diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h new file mode 100644 index 000000000..79230493a --- /dev/null +++ b/source/include/acdisasm.h @@ -0,0 +1,452 @@ +/****************************************************************************** + * + * Name: acdisasm.h - AML disassembler + * $Revision: 1.8 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACDISASM_H__ +#define __ACDISASM_H__ + +#include "amlresrc.h" + + +#define BLOCK_NONE 0 +#define BLOCK_PAREN 1 +#define BLOCK_BRACE 2 +#define BLOCK_COMMA_LIST 4 + +extern const char *AcpiGbl_IoDecode[2]; +extern const char *AcpiGbl_WordDecode[4]; +extern const char *AcpiGbl_ConsumeDecode[2]; +extern const char *AcpiGbl_MinDecode[2]; +extern const char *AcpiGbl_MaxDecode[2]; +extern const char *AcpiGbl_DECDecode[2]; +extern const char *AcpiGbl_RNGDecode[4]; +extern const char *AcpiGbl_MEMDecode[4]; +extern const char *AcpiGbl_RWDecode[2]; +extern const char *AcpiGbl_IrqDecode[2]; +extern const char *AcpiGbl_HEDecode[2]; +extern const char *AcpiGbl_LLDecode[2]; +extern const char *AcpiGbl_SHRDecode[2]; +extern const char *AcpiGbl_TYPDecode[4]; +extern const char *AcpiGbl_BMDecode[2]; +extern const char *AcpiGbl_SIZDecode[4]; +extern const char *AcpiGbl_LockRule[ACPI_NUM_LOCK_RULES]; +extern const char *AcpiGbl_AccessTypes[ACPI_NUM_ACCESS_TYPES]; +extern const char *AcpiGbl_UpdateRules[ACPI_NUM_UPDATE_RULES]; +extern const char *AcpiGbl_MatchOps[ACPI_NUM_MATCH_OPS]; + + +typedef struct acpi_op_walk_info +{ + UINT32 Level; + UINT32 BitOffset; + +} ACPI_OP_WALK_INFO; + +typedef +ACPI_STATUS (*ASL_WALK_CALLBACK) ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + + +/* + * dmwalk + */ + +void +AcpiDmWalkParseTree ( + ACPI_PARSE_OBJECT *Op, + ASL_WALK_CALLBACK DescendingCallback, + ASL_WALK_CALLBACK AscendingCallback, + void *Context); + +ACPI_STATUS +AcpiDmDescendingOp ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +ACPI_STATUS +AcpiDmAscendingOp ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + + +/* + * dmopcode + */ + +void +AcpiDmValidateName ( + char *Name, + ACPI_PARSE_OBJECT *Op); + +UINT32 +AcpiDmDumpName ( + char *Name); + +void +AcpiDmUnicode ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmDisassemble ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Origin, + UINT32 NumOpcodes); + +void +AcpiDmNamestring ( + char *Name); + +void +AcpiDmDisplayPath ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmDisassembleOneOp ( + ACPI_WALK_STATE *WalkState, + ACPI_OP_WALK_INFO *Info, + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmDecodeInternalObject ( + ACPI_OPERAND_OBJECT *ObjDesc); + +void +AcpiDmDecodeNode ( + ACPI_NAMESPACE_NODE *Node); + +UINT32 +AcpiDmBlockType ( + ACPI_PARSE_OBJECT *Op); + +UINT32 +AcpiDmListType ( + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiPsDisplayObjectPathname ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmMethodFlags ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmFieldFlags ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmAddressSpace ( + UINT8 SpaceId); + +void +AcpiDmRegionFlags ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmMatchOp ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmMatchKeyword ( + ACPI_PARSE_OBJECT *Op); + +BOOLEAN +AcpiDmCommaIfListMember ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmCommaIfFieldMember ( + ACPI_PARSE_OBJECT *Op); + + +/* + * dmbuffer + */ + +void +AcpiIsEisaId ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmEisaId ( + UINT32 EncodedId); + +BOOLEAN +AcpiDmIsUnicodeBuffer ( + ACPI_PARSE_OBJECT *Op); + +BOOLEAN +AcpiDmIsStringBuffer ( + ACPI_PARSE_OBJECT *Op); + + +/* + * dmresrc + */ + +void +AcpiDmDisasmByteList ( + UINT32 Level, + UINT8 *ByteData, + UINT32 ByteCount); + +void +AcpiDmByteList ( + ACPI_OP_WALK_INFO *Info, + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmResourceDescriptor ( + ACPI_OP_WALK_INFO *Info, + UINT8 *ByteData, + UINT32 ByteCount); + +BOOLEAN +AcpiDmIsResourceDescriptor ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmIndent ( + UINT32 Level); + +void +AcpiDmBitList ( + UINT16 Mask); + +void +AcpiDmDecodeAttribute ( + UINT8 Attribute); + +/* + * dmresrcl + */ + +void +AcpiDmIoFlags ( + UINT8 Flags); + +void +AcpiDmMemoryFlags ( + UINT8 Flags, + UINT8 SpecificFlags); + +void +AcpiDmWordDescriptor ( + ASL_WORD_ADDRESS_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmDwordDescriptor ( + ASL_DWORD_ADDRESS_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmQwordDescriptor ( + ASL_QWORD_ADDRESS_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmMemory24Descriptor ( + ASL_MEMORY_24_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmMemory32Descriptor ( + ASL_MEMORY_32_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmFixedMem32Descriptor ( + ASL_FIXED_MEMORY_32_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmGenericRegisterDescriptor ( + ASL_GENERAL_REGISTER_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmInterruptDescriptor ( + ASL_EXTENDED_XRUPT_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmVendorLargeDescriptor ( + ASL_LARGE_VENDOR_DESC *Resource, + UINT32 Length, + UINT32 Level); + + +/* + * dmresrcs + */ + +void +AcpiDmIrqDescriptor ( + ASL_IRQ_FORMAT_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmDmaDescriptor ( + ASL_DMA_FORMAT_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmIoDescriptor ( + ASL_IO_PORT_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmFixedIoDescriptor ( + ASL_FIXED_IO_PORT_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmStartDependentDescriptor ( + ASL_START_DEPENDENT_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmEndDependentDescriptor ( + ASL_START_DEPENDENT_DESC *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmVendorSmallDescriptor ( + ASL_SMALL_VENDOR_DESC *Resource, + UINT32 Length, + UINT32 Level); + + +#endif /* __ACDISASM_H__ */ diff --git a/source/include/acdispat.h b/source/include/acdispat.h new file mode 100644 index 000000000..b7acfabc1 --- /dev/null +++ b/source/include/acdispat.h @@ -0,0 +1,586 @@ +/****************************************************************************** + * + * Name: acdispat.h - dispatcher (parser to interpreter interface) + * $Revision: 1.56 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + + +#ifndef _ACDISPAT_H_ +#define _ACDISPAT_H_ + + +#define NAMEOF_LOCAL_NTE "__L0" +#define NAMEOF_ARG_NTE "__A0" + + +/* Common interfaces */ + +ACPI_STATUS +AcpiDsObjStackPush ( + void *Object, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsObjStackPop ( + UINT32 PopCount, + ACPI_WALK_STATE *WalkState); + +void * +AcpiDsObjStackGetValue ( + UINT32 Index, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsObjStackPopObject ( + ACPI_OPERAND_OBJECT **Object, + ACPI_WALK_STATE *WalkState); + + +/* dsopcode - support for late evaluation */ + +ACPI_STATUS +AcpiDsExecuteArguments ( + ACPI_NAMESPACE_NODE *Node, + ACPI_NAMESPACE_NODE *ScopeNode, + UINT32 AmlLength, + UINT8 *AmlStart); + +ACPI_STATUS +AcpiDsGetBufferFieldArguments ( + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiDsGetRegionArguments ( + ACPI_OPERAND_OBJECT *RgnDesc); + +ACPI_STATUS +AcpiDsGetBufferArguments ( + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiDsGetPackageArguments ( + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiDsInitBufferField ( + UINT16 AmlOpcode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT *BufferDesc, + ACPI_OPERAND_OBJECT *OffsetDesc, + ACPI_OPERAND_OBJECT *LengthDesc, + ACPI_OPERAND_OBJECT *ResultDesc); + +ACPI_STATUS +AcpiDsEvalBufferFieldOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiDsEvalRegionOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiDsEvalDataObjectOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiDsInitializeRegion ( + ACPI_HANDLE ObjHandle); + + +/* dsctrl - Parser/Interpreter interface, control stack routines */ + + +ACPI_STATUS +AcpiDsExecBeginControlOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiDsExecEndControlOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + + +/* dsexec - Parser/Interpreter interface, method execution callbacks */ + + +ACPI_STATUS +AcpiDsGetPredicateValue ( + ACPI_WALK_STATE *WalkState, + ACPI_OPERAND_OBJECT *ResultObj); + +ACPI_STATUS +AcpiDsExecBeginOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT **OutOp); + +ACPI_STATUS +AcpiDsExecEndOp ( + ACPI_WALK_STATE *State); + + +/* dsfield - Parser/Interpreter interface for AML fields */ + +ACPI_STATUS +AcpiDsGetFieldNames ( + ACPI_CREATE_FIELD_INFO *Info, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Arg); + +ACPI_STATUS +AcpiDsCreateField ( + ACPI_PARSE_OBJECT *Op, + ACPI_NAMESPACE_NODE *RegionNode, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsCreateBankField ( + ACPI_PARSE_OBJECT *Op, + ACPI_NAMESPACE_NODE *RegionNode, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsCreateIndexField ( + ACPI_PARSE_OBJECT *Op, + ACPI_NAMESPACE_NODE *RegionNode, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsCreateBufferField ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsInitFieldObjects ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState); + + +/* dsload - Parser/Interpreter interface, namespace load callbacks */ + +ACPI_STATUS +AcpiDsLoad1BeginOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT **OutOp); + +ACPI_STATUS +AcpiDsLoad1EndOp ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsLoad2BeginOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT **OutOp); + +ACPI_STATUS +AcpiDsLoad2EndOp ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsInitCallbacks ( + ACPI_WALK_STATE *WalkState, + UINT32 PassNumber); + + +/* dsmthdat - method data (locals/args) */ + + +ACPI_STATUS +AcpiDsStoreObjectToLocal ( + UINT16 Opcode, + UINT32 Index, + ACPI_OPERAND_OBJECT *SrcDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsMethodDataGetEntry ( + UINT16 Opcode, + UINT32 Index, + ACPI_WALK_STATE *WalkState, + ACPI_OPERAND_OBJECT ***Node); + +void +AcpiDsMethodDataDeleteAll ( + ACPI_WALK_STATE *WalkState); + +BOOLEAN +AcpiDsIsMethodValue ( + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_OBJECT_TYPE +AcpiDsMethodDataGetType ( + UINT16 Opcode, + UINT32 Index, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsMethodDataGetValue ( + UINT16 Opcode, + UINT32 Index, + ACPI_WALK_STATE *WalkState, + ACPI_OPERAND_OBJECT **DestDesc); + +void +AcpiDsMethodDataDeleteValue ( + UINT16 Opcode, + UINT32 Index, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsMethodDataInitArgs ( + ACPI_OPERAND_OBJECT **Params, + UINT32 MaxParamCount, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsMethodDataGetNode ( + UINT16 Opcode, + UINT32 Index, + ACPI_WALK_STATE *WalkState, + ACPI_NAMESPACE_NODE **Node); + +void +AcpiDsMethodDataInit ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsMethodDataSetValue ( + UINT16 Opcode, + UINT32 Index, + ACPI_OPERAND_OBJECT *Object, + ACPI_WALK_STATE *WalkState); + + +/* dsmethod - Parser/Interpreter interface - control method parsing */ + +ACPI_STATUS +AcpiDsParseMethod ( + ACPI_HANDLE ObjHandle); + +ACPI_STATUS +AcpiDsCallControlMethod ( + ACPI_THREAD_STATE *Thread, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiDsRestartControlMethod ( + ACPI_WALK_STATE *WalkState, + ACPI_OPERAND_OBJECT *ReturnDesc); + +ACPI_STATUS +AcpiDsTerminateControlMethod ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsBeginMethodExecution ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_NAMESPACE_NODE *CallingMethodNode); + + +/* dsobj - Parser/Interpreter interface - object initialization and conversion */ + +ACPI_STATUS +AcpiDsInitOneObject ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + +ACPI_STATUS +AcpiDsInitializeObjects ( + ACPI_TABLE_DESC *TableDesc, + ACPI_NAMESPACE_NODE *StartNode); + +ACPI_STATUS +AcpiDsBuildInternalBufferObj ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + UINT32 BufferLength, + ACPI_OPERAND_OBJECT **ObjDescPtr); + +ACPI_STATUS +AcpiDsBuildInternalPackageObj ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *op, + UINT32 PackageLength, + ACPI_OPERAND_OBJECT **ObjDesc); + +ACPI_STATUS +AcpiDsBuildInternalObject ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + ACPI_OPERAND_OBJECT **ObjDescPtr); + +ACPI_STATUS +AcpiDsInitObjectFromOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + UINT16 Opcode, + ACPI_OPERAND_OBJECT **ObjDesc); + +ACPI_STATUS +AcpiDsCreateNode ( + ACPI_WALK_STATE *WalkState, + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op); + + +/* dsutils - Parser/Interpreter interface utility routines */ + +BOOLEAN +AcpiDsIsResultUsed ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState); + +void +AcpiDsDeleteResultIfNotUsed ( + ACPI_PARSE_OBJECT *Op, + ACPI_OPERAND_OBJECT *ResultObj, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsCreateOperand ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Arg, + UINT32 ArgsRemaining); + +ACPI_STATUS +AcpiDsCreateOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *FirstArg); + +ACPI_STATUS +AcpiDsResolveOperands ( + ACPI_WALK_STATE *WalkState); + +void +AcpiDsClearOperands ( + ACPI_WALK_STATE *WalkState); + + +/* + * dswscope - Scope Stack manipulation + */ + +ACPI_STATUS +AcpiDsScopeStackPush ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_TYPE Type, + ACPI_WALK_STATE *WalkState); + + +ACPI_STATUS +AcpiDsScopeStackPop ( + ACPI_WALK_STATE *WalkState); + +void +AcpiDsScopeStackClear ( + ACPI_WALK_STATE *WalkState); + + +/* dswstate - parser WALK_STATE management routines */ + +ACPI_WALK_STATE * +AcpiDsCreateWalkState ( + ACPI_OWNER_ID OwnerId, + ACPI_PARSE_OBJECT *Origin, + ACPI_OPERAND_OBJECT *MthDesc, + ACPI_THREAD_STATE *Thread); + +ACPI_STATUS +AcpiDsInitAmlWalk ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + ACPI_NAMESPACE_NODE *MethodNode, + UINT8 *AmlStart, + UINT32 AmlLength, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObjDesc, + UINT32 PassNumber); + +ACPI_STATUS +AcpiDsObjStackDeleteAll ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsObjStackPopAndDelete ( + UINT32 PopCount, + ACPI_WALK_STATE *WalkState); + +void +AcpiDsDeleteWalkState ( + ACPI_WALK_STATE *WalkState); + +ACPI_WALK_STATE * +AcpiDsPopWalkState ( + ACPI_THREAD_STATE *Thread); + +void +AcpiDsPushWalkState ( + ACPI_WALK_STATE *WalkState, + ACPI_THREAD_STATE *Thread); + +ACPI_STATUS +AcpiDsResultStackPop ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsResultStackPush ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsResultStackClear ( + ACPI_WALK_STATE *WalkState); + +ACPI_WALK_STATE * +AcpiDsGetCurrentWalkState ( + ACPI_THREAD_STATE *Thread); + +void +AcpiDsDeleteWalkStateCache ( + void); + +ACPI_STATUS +AcpiDsResultInsert ( + void *Object, + UINT32 Index, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsResultRemove ( + ACPI_OPERAND_OBJECT **Object, + UINT32 Index, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsResultPop ( + ACPI_OPERAND_OBJECT **Object, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsResultPush ( + ACPI_OPERAND_OBJECT *Object, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiDsResultPopFromBottom ( + ACPI_OPERAND_OBJECT **Object, + ACPI_WALK_STATE *WalkState); + +#endif /* _ACDISPAT_H_ */ diff --git a/source/include/acevents.h b/source/include/acevents.h new file mode 100644 index 000000000..cbf628fda --- /dev/null +++ b/source/include/acevents.h @@ -0,0 +1,313 @@ +/****************************************************************************** + * + * Name: acevents.h - Event subcomponent prototypes and defines + * $Revision: 1.81 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACEVENTS_H__ +#define __ACEVENTS_H__ + + +ACPI_STATUS +AcpiEvInitialize ( + void); + +ACPI_STATUS +AcpiEvHandlerInitialize ( + void); + + +/* + * Evfixed - Fixed event handling + */ + +ACPI_STATUS +AcpiEvFixedEventInitialize ( + void); + +UINT32 +AcpiEvFixedEventDetect ( + void); + +UINT32 +AcpiEvFixedEventDispatch ( + UINT32 Event); + + +/* + * Evmisc + */ + +BOOLEAN +AcpiEvIsNotifyObject ( + ACPI_NAMESPACE_NODE *Node); + +ACPI_STATUS +AcpiEvAcquireGlobalLock( + UINT16 Timeout); + +ACPI_STATUS +AcpiEvReleaseGlobalLock( + void); + +ACPI_STATUS +AcpiEvInitGlobalLockHandler ( + void); + +UINT32 +AcpiEvGetGpeRegisterIndex ( + UINT32 GpeNumber); + +UINT32 +AcpiEvGetGpeNumberIndex ( + UINT32 GpeNumber); + +ACPI_STATUS +AcpiEvQueueNotifyRequest ( + ACPI_NAMESPACE_NODE *Node, + UINT32 NotifyValue); + +void ACPI_SYSTEM_XFACE +AcpiEvNotifyDispatch ( + void *Context); + + +/* + * Evgpe - GPE handling and dispatch + */ + +ACPI_STATUS +AcpiEvGpeInitialize ( + void); + +ACPI_STATUS +AcpiEvInitGpeControlMethods ( + void); + +UINT32 +AcpiEvGpeDispatch ( + UINT32 GpeNumber); + +UINT32 +AcpiEvGpeDetect ( + void); + +/* + * Evregion - Address Space handling + */ + +ACPI_STATUS +AcpiEvInitAddressSpaces ( + void); + +ACPI_STATUS +AcpiEvAddressSpaceDispatch ( + ACPI_OPERAND_OBJECT *RegionObj, + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + void *Value); + +ACPI_STATUS +AcpiEvAddrHandlerHelper ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + +ACPI_STATUS +AcpiEvAttachRegion ( + ACPI_OPERAND_OBJECT *HandlerObj, + ACPI_OPERAND_OBJECT *RegionObj, + BOOLEAN AcpiNsIsLocked); + +void +AcpiEvDetachRegion ( + ACPI_OPERAND_OBJECT *RegionObj, + BOOLEAN AcpiNsIsLocked); + + +/* + * Evregini - Region initialization and setup + */ + +ACPI_STATUS +AcpiEvSystemMemoryRegionSetup ( + ACPI_HANDLE Handle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + +ACPI_STATUS +AcpiEvIoSpaceRegionSetup ( + ACPI_HANDLE Handle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + +ACPI_STATUS +AcpiEvPciConfigRegionSetup ( + ACPI_HANDLE Handle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + +ACPI_STATUS +AcpiEvCmosRegionSetup ( + ACPI_HANDLE Handle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + +ACPI_STATUS +AcpiEvPciBarRegionSetup ( + ACPI_HANDLE Handle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + +ACPI_STATUS +AcpiEvDefaultRegionSetup ( + ACPI_HANDLE Handle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + +ACPI_STATUS +AcpiEvInitializeRegion ( + ACPI_OPERAND_OBJECT *RegionObj, + BOOLEAN AcpiNsLocked); + + +/* + * Evsci - SCI (System Control Interrupt) handling/dispatch + */ + +UINT32 +AcpiEvInstallSciHandler ( + void); + +ACPI_STATUS +AcpiEvRemoveSciHandler ( + void); + +UINT32 +AcpiEvInitializeSCI ( + UINT32 ProgramSCI); + +void +AcpiEvTerminate ( + void); + + +#endif /* __ACEVENTS_H__ */ diff --git a/source/include/acexcep.h b/source/include/acexcep.h new file mode 100644 index 000000000..7e641db9b --- /dev/null +++ b/source/include/acexcep.h @@ -0,0 +1,375 @@ +/****************************************************************************** + * + * Name: acexcep.h - Exception codes returned by the ACPI subsystem + * $Revision: 1.67 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACEXCEP_H__ +#define __ACEXCEP_H__ + + +/* + * Exceptions returned by external ACPI interfaces + */ + +#define AE_CODE_ENVIRONMENTAL 0x0000 +#define AE_CODE_PROGRAMMER 0x1000 +#define AE_CODE_ACPI_TABLES 0x2000 +#define AE_CODE_AML 0x3000 +#define AE_CODE_CONTROL 0x4000 +#define AE_CODE_MASK 0xF000 + + +#define ACPI_SUCCESS(a) (!(a)) +#define ACPI_FAILURE(a) (a) + + +#define AE_OK (ACPI_STATUS) 0x0000 + +/* + * Environmental exceptions + */ +#define AE_ERROR (ACPI_STATUS) (0x0001 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_ACPI_TABLES (ACPI_STATUS) (0x0002 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_NAMESPACE (ACPI_STATUS) (0x0003 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_MEMORY (ACPI_STATUS) (0x0004 | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_FOUND (ACPI_STATUS) (0x0005 | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_EXIST (ACPI_STATUS) (0x0006 | AE_CODE_ENVIRONMENTAL) +#define AE_ALREADY_EXISTS (ACPI_STATUS) (0x0007 | AE_CODE_ENVIRONMENTAL) +#define AE_TYPE (ACPI_STATUS) (0x0008 | AE_CODE_ENVIRONMENTAL) +#define AE_NULL_OBJECT (ACPI_STATUS) (0x0009 | AE_CODE_ENVIRONMENTAL) +#define AE_NULL_ENTRY (ACPI_STATUS) (0x000A | AE_CODE_ENVIRONMENTAL) +#define AE_BUFFER_OVERFLOW (ACPI_STATUS) (0x000B | AE_CODE_ENVIRONMENTAL) +#define AE_STACK_OVERFLOW (ACPI_STATUS) (0x000C | AE_CODE_ENVIRONMENTAL) +#define AE_STACK_UNDERFLOW (ACPI_STATUS) (0x000D | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_IMPLEMENTED (ACPI_STATUS) (0x000E | AE_CODE_ENVIRONMENTAL) +#define AE_VERSION_MISMATCH (ACPI_STATUS) (0x000F | AE_CODE_ENVIRONMENTAL) +#define AE_SUPPORT (ACPI_STATUS) (0x0010 | AE_CODE_ENVIRONMENTAL) +#define AE_SHARE (ACPI_STATUS) (0x0011 | AE_CODE_ENVIRONMENTAL) +#define AE_LIMIT (ACPI_STATUS) (0x0012 | AE_CODE_ENVIRONMENTAL) +#define AE_TIME (ACPI_STATUS) (0x0013 | AE_CODE_ENVIRONMENTAL) +#define AE_UNKNOWN_STATUS (ACPI_STATUS) (0x0014 | AE_CODE_ENVIRONMENTAL) +#define AE_ACQUIRE_DEADLOCK (ACPI_STATUS) (0x0015 | AE_CODE_ENVIRONMENTAL) +#define AE_RELEASE_DEADLOCK (ACPI_STATUS) (0x0016 | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_ACQUIRED (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL) +#define AE_ALREADY_ACQUIRED (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_HARDWARE_RESPONSE (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_GLOBAL_LOCK (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL) +#define AE_LOGICAL_ADDRESS (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL) +#define AE_ABORT_METHOD (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL) + +#define AE_CODE_ENV_MAX 0x001C + +/* + * Programmer exceptions + */ +#define AE_BAD_PARAMETER (ACPI_STATUS) (0x0001 | AE_CODE_PROGRAMMER) +#define AE_BAD_CHARACTER (ACPI_STATUS) (0x0002 | AE_CODE_PROGRAMMER) +#define AE_BAD_PATHNAME (ACPI_STATUS) (0x0003 | AE_CODE_PROGRAMMER) +#define AE_BAD_DATA (ACPI_STATUS) (0x0004 | AE_CODE_PROGRAMMER) +#define AE_BAD_ADDRESS (ACPI_STATUS) (0x0005 | AE_CODE_PROGRAMMER) +#define AE_ALIGNMENT (ACPI_STATUS) (0x0006 | AE_CODE_PROGRAMMER) +#define AE_BAD_HEX_CONSTANT (ACPI_STATUS) (0x0007 | AE_CODE_PROGRAMMER) +#define AE_BAD_OCTAL_CONSTANT (ACPI_STATUS) (0x0008 | AE_CODE_PROGRAMMER) +#define AE_BAD_DECIMAL_CONSTANT (ACPI_STATUS) (0x0009 | AE_CODE_PROGRAMMER) + +#define AE_CODE_PGM_MAX 0x0009 + + +/* + * Acpi table exceptions + */ +#define AE_BAD_SIGNATURE (ACPI_STATUS) (0x0001 | AE_CODE_ACPI_TABLES) +#define AE_BAD_HEADER (ACPI_STATUS) (0x0002 | AE_CODE_ACPI_TABLES) +#define AE_BAD_CHECKSUM (ACPI_STATUS) (0x0003 | AE_CODE_ACPI_TABLES) +#define AE_BAD_VALUE (ACPI_STATUS) (0x0004 | AE_CODE_ACPI_TABLES) +#define AE_TABLE_NOT_SUPPORTED (ACPI_STATUS) (0x0005 | AE_CODE_ACPI_TABLES) +#define AE_INVALID_TABLE_LENGTH (ACPI_STATUS) (0x0006 | AE_CODE_ACPI_TABLES) + +#define AE_CODE_TBL_MAX 0x0006 + + +/* + * AML exceptions. These are caused by problems with + * the actual AML byte stream + */ +#define AE_AML_ERROR (ACPI_STATUS) (0x0001 | AE_CODE_AML) +#define AE_AML_PARSE (ACPI_STATUS) (0x0002 | AE_CODE_AML) +#define AE_AML_BAD_OPCODE (ACPI_STATUS) (0x0003 | AE_CODE_AML) +#define AE_AML_NO_OPERAND (ACPI_STATUS) (0x0004 | AE_CODE_AML) +#define AE_AML_OPERAND_TYPE (ACPI_STATUS) (0x0005 | AE_CODE_AML) +#define AE_AML_OPERAND_VALUE (ACPI_STATUS) (0x0006 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_LOCAL (ACPI_STATUS) (0x0007 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_ARG (ACPI_STATUS) (0x0008 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_ELEMENT (ACPI_STATUS) (0x0009 | AE_CODE_AML) +#define AE_AML_NUMERIC_OVERFLOW (ACPI_STATUS) (0x000A | AE_CODE_AML) +#define AE_AML_REGION_LIMIT (ACPI_STATUS) (0x000B | AE_CODE_AML) +#define AE_AML_BUFFER_LIMIT (ACPI_STATUS) (0x000C | AE_CODE_AML) +#define AE_AML_PACKAGE_LIMIT (ACPI_STATUS) (0x000D | AE_CODE_AML) +#define AE_AML_DIVIDE_BY_ZERO (ACPI_STATUS) (0x000E | AE_CODE_AML) +#define AE_AML_BAD_NAME (ACPI_STATUS) (0x000F | AE_CODE_AML) +#define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) (0x0010 | AE_CODE_AML) +#define AE_AML_INTERNAL (ACPI_STATUS) (0x0011 | AE_CODE_AML) +#define AE_AML_INVALID_SPACE_ID (ACPI_STATUS) (0x0012 | AE_CODE_AML) +#define AE_AML_STRING_LIMIT (ACPI_STATUS) (0x0013 | AE_CODE_AML) +#define AE_AML_NO_RETURN_VALUE (ACPI_STATUS) (0x0014 | AE_CODE_AML) +#define AE_AML_METHOD_LIMIT (ACPI_STATUS) (0x0015 | AE_CODE_AML) +#define AE_AML_NOT_OWNER (ACPI_STATUS) (0x0016 | AE_CODE_AML) +#define AE_AML_MUTEX_ORDER (ACPI_STATUS) (0x0017 | AE_CODE_AML) +#define AE_AML_MUTEX_NOT_ACQUIRED (ACPI_STATUS) (0x0018 | AE_CODE_AML) +#define AE_AML_INVALID_RESOURCE_TYPE (ACPI_STATUS) (0x0019 | AE_CODE_AML) +#define AE_AML_INVALID_INDEX (ACPI_STATUS) (0x001A | AE_CODE_AML) +#define AE_AML_REGISTER_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_AML) +#define AE_AML_NO_WHILE (ACPI_STATUS) (0x001C | AE_CODE_AML) +#define AE_AML_ALIGNMENT (ACPI_STATUS) (0x001D | AE_CODE_AML) +#define AE_AML_NO_RESOURCE_END_TAG (ACPI_STATUS) (0x001E | AE_CODE_AML) +#define AE_AML_BAD_RESOURCE_VALUE (ACPI_STATUS) (0x001F | AE_CODE_AML) +#define AE_AML_CIRCULAR_REFERENCE (ACPI_STATUS) (0x0020 | AE_CODE_AML) + +#define AE_CODE_AML_MAX 0x0020 + +/* + * Internal exceptions used for control + */ +#define AE_CTRL_RETURN_VALUE (ACPI_STATUS) (0x0001 | AE_CODE_CONTROL) +#define AE_CTRL_PENDING (ACPI_STATUS) (0x0002 | AE_CODE_CONTROL) +#define AE_CTRL_TERMINATE (ACPI_STATUS) (0x0003 | AE_CODE_CONTROL) +#define AE_CTRL_TRUE (ACPI_STATUS) (0x0004 | AE_CODE_CONTROL) +#define AE_CTRL_FALSE (ACPI_STATUS) (0x0005 | AE_CODE_CONTROL) +#define AE_CTRL_DEPTH (ACPI_STATUS) (0x0006 | AE_CODE_CONTROL) +#define AE_CTRL_END (ACPI_STATUS) (0x0007 | AE_CODE_CONTROL) +#define AE_CTRL_TRANSFER (ACPI_STATUS) (0x0008 | AE_CODE_CONTROL) +#define AE_CTRL_BREAK (ACPI_STATUS) (0x0009 | AE_CODE_CONTROL) +#define AE_CTRL_CONTINUE (ACPI_STATUS) (0x000A | AE_CODE_CONTROL) +#define AE_CTRL_SKIP (ACPI_STATUS) (0x000B | AE_CODE_CONTROL) + +#define AE_CODE_CTRL_MAX 0x000B + + +#ifdef DEFINE_ACPI_GLOBALS + +/* + * String versions of the exception codes above + * These strings must match the corresponding defines exactly + */ +char const *AcpiGbl_ExceptionNames_Env[] = +{ + "AE_OK", + "AE_ERROR", + "AE_NO_ACPI_TABLES", + "AE_NO_NAMESPACE", + "AE_NO_MEMORY", + "AE_NOT_FOUND", + "AE_NOT_EXIST", + "AE_ALREADY_EXISTS", + "AE_TYPE", + "AE_NULL_OBJECT", + "AE_NULL_ENTRY", + "AE_BUFFER_OVERFLOW", + "AE_STACK_OVERFLOW", + "AE_STACK_UNDERFLOW", + "AE_NOT_IMPLEMENTED", + "AE_VERSION_MISMATCH", + "AE_SUPPORT", + "AE_SHARE", + "AE_LIMIT", + "AE_TIME", + "AE_UNKNOWN_STATUS", + "AE_ACQUIRE_DEADLOCK", + "AE_RELEASE_DEADLOCK", + "AE_NOT_ACQUIRED", + "AE_ALREADY_ACQUIRED", + "AE_NO_HARDWARE_RESPONSE", + "AE_NO_GLOBAL_LOCK", + "AE_LOGICAL_ADDRESS", + "AE_ABORT_METHOD" +}; + +char const *AcpiGbl_ExceptionNames_Pgm[] = +{ + "AE_BAD_PARAMETER", + "AE_BAD_CHARACTER", + "AE_BAD_PATHNAME", + "AE_BAD_DATA", + "AE_BAD_ADDRESS", + "AE_ALIGNMENT", + "AE_BAD_HEX_CONSTANT", + "AE_BAD_OCTAL_CONSTANT", + "AE_BAD_DECIMAL_CONSTANT" +}; + +char const *AcpiGbl_ExceptionNames_Tbl[] = +{ + "AE_BAD_SIGNATURE", + "AE_BAD_HEADER", + "AE_BAD_CHECKSUM", + "AE_BAD_VALUE", + "AE_TABLE_NOT_SUPPORTED", + "AE_INVALID_TABLE_LENGTH" +}; + +char const *AcpiGbl_ExceptionNames_Aml[] = +{ + "AE_AML_ERROR", + "AE_AML_PARSE", + "AE_AML_BAD_OPCODE", + "AE_AML_NO_OPERAND", + "AE_AML_OPERAND_TYPE", + "AE_AML_OPERAND_VALUE", + "AE_AML_UNINITIALIZED_LOCAL", + "AE_AML_UNINITIALIZED_ARG", + "AE_AML_UNINITIALIZED_ELEMENT", + "AE_AML_NUMERIC_OVERFLOW", + "AE_AML_REGION_LIMIT", + "AE_AML_BUFFER_LIMIT", + "AE_AML_PACKAGE_LIMIT", + "AE_AML_DIVIDE_BY_ZERO", + "AE_AML_BAD_NAME", + "AE_AML_NAME_NOT_FOUND", + "AE_AML_INTERNAL", + "AE_AML_INVALID_SPACE_ID", + "AE_AML_STRING_LIMIT", + "AE_AML_NO_RETURN_VALUE", + "AE_AML_METHOD_LIMIT", + "AE_AML_NOT_OWNER", + "AE_AML_MUTEX_ORDER", + "AE_AML_MUTEX_NOT_ACQUIRED", + "AE_AML_INVALID_RESOURCE_TYPE", + "AE_AML_INVALID_INDEX", + "AE_AML_REGISTER_LIMIT", + "AE_AML_NO_WHILE", + "AE_AML_ALIGNMENT", + "AE_AML_NO_RESOURCE_END_TAG", + "AE_AML_BAD_RESOURCE_VALUE", + "AE_AML_CIRCULAR_REFERENCE" +}; + +char const *AcpiGbl_ExceptionNames_Ctrl[] = +{ + "AE_CTRL_RETURN_VALUE", + "AE_CTRL_PENDING", + "AE_CTRL_TERMINATE", + "AE_CTRL_TRUE", + "AE_CTRL_FALSE", + "AE_CTRL_DEPTH", + "AE_CTRL_END", + "AE_CTRL_TRANSFER", + "AE_CTRL_BREAK", + "AE_CTRL_CONTINUE", + "AE_CTRL_SKIP" +}; + +#endif /* ACPI GLOBALS */ + + +#endif /* __ACEXCEP_H__ */ diff --git a/source/include/acglobal.h b/source/include/acglobal.h new file mode 100644 index 000000000..11ee12d78 --- /dev/null +++ b/source/include/acglobal.h @@ -0,0 +1,390 @@ +/****************************************************************************** + * + * Name: acglobal.h - Declarations for global variables + * $Revision: 1.136 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACGLOBAL_H__ +#define __ACGLOBAL_H__ + + +/* + * Ensure that the globals are actually defined only once. + * + * The use of these defines allows a single list of globals (here) in order + * to simplify maintenance of the code. + */ +#ifdef DEFINE_ACPI_GLOBALS +#define ACPI_EXTERN +#else +#define ACPI_EXTERN extern +#endif + + +/***************************************************************************** + * + * Debug support + * + ****************************************************************************/ + +/* Runtime configuration of debug print levels */ + +extern UINT32 AcpiDbgLevel; +extern UINT32 AcpiDbgLayer; + +/* Procedure nesting level for debug output */ + +extern UINT32 AcpiGbl_NestingLevel; + + +/***************************************************************************** + * + * ACPI Table globals + * + ****************************************************************************/ + +/* + * Table pointers. + * Although these pointers are somewhat redundant with the global AcpiTable, + * they are convenient because they are typed pointers. + * + * These tables are single-table only; meaning that there can be at most one + * of each in the system. Each global points to the actual table. + * + */ +ACPI_EXTERN UINT32 AcpiGbl_TableFlags; +ACPI_EXTERN UINT32 AcpiGbl_RsdtTableCount; +ACPI_EXTERN RSDP_DESCRIPTOR *AcpiGbl_RSDP; +ACPI_EXTERN XSDT_DESCRIPTOR *AcpiGbl_XSDT; +ACPI_EXTERN FADT_DESCRIPTOR *AcpiGbl_FADT; +ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT; +ACPI_EXTERN FACS_DESCRIPTOR *AcpiGbl_FACS; +ACPI_EXTERN ACPI_COMMON_FACS AcpiGbl_CommonFACS; + +/* + * Handle both ACPI 1.0 and ACPI 2.0 Integer widths + * If we are running a method that exists in a 32-bit ACPI table. + * Use only 32 bits of the Integer for conversion. + */ +ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth; +ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth; + +/* + * Since there may be multiple SSDTs and PSDTS, a single pointer is not + * sufficient; Therefore, there isn't one! + */ + + +/* + * ACPI Table info arrays + */ +extern ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES]; +extern ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES]; + +/* + * Predefined mutex objects. This array contains the + * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. + * (The table maps local handles to the real OS handles) + */ +ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_AcpiMutexInfo [NUM_MTX]; + + +/***************************************************************************** + * + * Miscellaneous globals + * + ****************************************************************************/ + + +ACPI_EXTERN ACPI_MEMORY_LIST AcpiGbl_MemoryLists[ACPI_NUM_MEM_LISTS]; +ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DrvNotify; +ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SysNotify; +ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler; +ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk; +ACPI_EXTERN ACPI_HANDLE AcpiGbl_GlobalLockSemaphore; + +ACPI_EXTERN UINT32 AcpiGbl_GlobalLockThreadCount; +ACPI_EXTERN UINT32 AcpiGbl_OriginalMode; +ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation; +ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount; +ACPI_EXTERN UINT32 AcpiGbl_PsFindCount; +ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave; +ACPI_EXTERN UINT16 AcpiGbl_NextTableOwnerId; +ACPI_EXTERN UINT16 AcpiGbl_NextMethodOwnerId; +ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle; +ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration; +ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired; +ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall; +ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent; +ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; +ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized; + +extern BOOLEAN AcpiGbl_Shutdown; +extern UINT32 AcpiGbl_StartupFlags; +extern const UINT8 AcpiGbl_DecodeTo8bit[8]; +extern const char *AcpiGbl_DbSleepStates[ACPI_S_STATE_COUNT]; +extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; +extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS]; + + +/***************************************************************************** + * + * Namespace globals + * + ****************************************************************************/ + +#define NUM_NS_TYPES ACPI_TYPE_INVALID+1 + +#if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) +#define NUM_PREDEFINED_NAMES 10 +#else +#define NUM_PREDEFINED_NAMES 9 +#endif + +ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct; +ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode; + +extern const UINT8 AcpiGbl_NsProperties[NUM_NS_TYPES]; +extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; + +#ifdef ACPI_DEBUG_OUTPUT +ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeCount; +ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeSize; +ACPI_EXTERN UINT32 AcpiGbl_MaxConcurrentNodeCount; +ACPI_EXTERN ACPI_SIZE AcpiGbl_EntryStackPointer; +ACPI_EXTERN ACPI_SIZE AcpiGbl_LowestStackPointer; +ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting; +#endif + +/***************************************************************************** + * + * Interpreter globals + * + ****************************************************************************/ + + +ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList; + +/* Control method single step flag */ + +ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep; + + +/***************************************************************************** + * + * Parser globals + * + ****************************************************************************/ + +ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot; + +/***************************************************************************** + * + * Hardware globals + * + ****************************************************************************/ + +extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; +ACPI_EXTERN UINT8 AcpiGbl_SleepTypeA; +ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB; + + +/***************************************************************************** + * + * Event and GPE globals + * + ****************************************************************************/ + +extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; +ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; + +ACPI_EXTERN ACPI_HANDLE AcpiGbl_GpeObjHandle; +ACPI_EXTERN UINT32 AcpiGbl_GpeRegisterCount; +ACPI_EXTERN UINT32 AcpiGbl_GpeNumberMax; +ACPI_EXTERN ACPI_GPE_REGISTER_INFO *AcpiGbl_GpeRegisterInfo; +ACPI_EXTERN ACPI_GPE_NUMBER_INFO *AcpiGbl_GpeNumberInfo; +ACPI_EXTERN ACPI_GPE_BLOCK_INFO AcpiGbl_GpeBlockInfo[ACPI_MAX_GPE_BLOCKS]; + +/* + * GPE translation table + * Indexed by the GPE number, returns a valid index into the global GPE tables. + * + * This table is needed because the GPE numbers supported by block 1 do not + * have to be contiguous with the GPE numbers supported by block 0. + */ +ACPI_EXTERN ACPI_GPE_INDEX_INFO *AcpiGbl_GpeNumberToIndex; + + +/***************************************************************************** + * + * Debugger globals + * + ****************************************************************************/ + + +ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags; + +#ifdef ACPI_DISASSEMBLER + +ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm; +ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose; +#endif + + +#ifdef ACPI_DEBUGGER + +extern BOOLEAN AcpiGbl_MethodExecuting; +extern BOOLEAN AcpiGbl_AbortMethod; +extern BOOLEAN AcpiGbl_DbTerminateThreads; + +ACPI_EXTERN int optind; +ACPI_EXTERN char *optarg; + +ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables; +ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats; +ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods; + + +ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]; +ACPI_EXTERN char AcpiGbl_DbLineBuf[80]; +ACPI_EXTERN char AcpiGbl_DbParsedBuf[80]; +ACPI_EXTERN char AcpiGbl_DbScopeBuf[40]; +ACPI_EXTERN char AcpiGbl_DbDebugFilename[40]; +ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile; +ACPI_EXTERN char *AcpiGbl_DbBuffer; +ACPI_EXTERN char *AcpiGbl_DbFilename; +ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel; +ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel; +ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr; +ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode; + +/* + * Statistic globals + */ +ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1]; +ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1]; +ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCountMisc; +ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCountMisc; +ACPI_EXTERN UINT32 AcpiGbl_NumNodes; +ACPI_EXTERN UINT32 AcpiGbl_NumObjects; + + +ACPI_EXTERN UINT32 AcpiGbl_SizeOfParseTree; +ACPI_EXTERN UINT32 AcpiGbl_SizeOfMethodTrees; +ACPI_EXTERN UINT32 AcpiGbl_SizeOfNodeEntries; +ACPI_EXTERN UINT32 AcpiGbl_SizeOfAcpiObjects; + +#endif /* ACPI_DEBUGGER */ + + +#endif /* __ACGLOBAL_H__ */ diff --git a/source/include/achware.h b/source/include/achware.h new file mode 100644 index 000000000..0bb4c3c76 --- /dev/null +++ b/source/include/achware.h @@ -0,0 +1,246 @@ +/****************************************************************************** + * + * Name: achware.h -- hardware specific interfaces + * $Revision: 1.61 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACHWARE_H__ +#define __ACHWARE_H__ + + +/* PM Timer ticks per second (HZ) */ +#define PM_TIMER_FREQUENCY 3579545 + + +/* Prototypes */ + + +ACPI_STATUS +AcpiHwInitialize ( + void); + +ACPI_STATUS +AcpiHwShutdown ( + void); + +ACPI_STATUS +AcpiHwInitializeSystemInfo ( + void); + +ACPI_STATUS +AcpiHwSetMode ( + UINT32 Mode); + +UINT32 +AcpiHwGetMode ( + void); + +UINT32 +AcpiHwGetModeCapabilities ( + void); + +/* Register I/O Prototypes */ + +ACPI_BIT_REGISTER_INFO * +AcpiHwGetBitRegisterInfo ( + UINT32 RegisterId); + +ACPI_STATUS +AcpiHwRegisterRead ( + BOOLEAN UseLock, + UINT32 RegisterId, + UINT32 *ReturnValue); + +ACPI_STATUS +AcpiHwRegisterWrite ( + BOOLEAN UseLock, + UINT32 RegisterId, + UINT32 Value); + +ACPI_STATUS +AcpiHwLowLevelRead ( + UINT32 Width, + UINT32 *Value, + ACPI_GENERIC_ADDRESS *Reg, + UINT32 Offset); + +ACPI_STATUS +AcpiHwLowLevelWrite ( + UINT32 Width, + UINT32 Value, + ACPI_GENERIC_ADDRESS *Reg, + UINT32 Offset); + +ACPI_STATUS +AcpiHwClearAcpiStatus ( + void); + + +/* GPE support */ + +UINT8 +AcpiHwGetGpeBitMask ( + UINT32 GpeNumber); + +ACPI_STATUS +AcpiHwEnableGpe ( + UINT32 GpeNumber); + +void +AcpiHwEnableGpeForWakeup ( + UINT32 GpeNumber); + +ACPI_STATUS +AcpiHwDisableGpe ( + UINT32 GpeNumber); + +void +AcpiHwDisableGpeForWakeup ( + UINT32 GpeNumber); + +ACPI_STATUS +AcpiHwClearGpe ( + UINT32 GpeNumber); + +ACPI_STATUS +AcpiHwGetGpeStatus ( + UINT32 GpeNumber, + ACPI_EVENT_STATUS *EventStatus); + +ACPI_STATUS +AcpiHwDisableNonWakeupGpes ( + void); + +ACPI_STATUS +AcpiHwEnableNonWakeupGpes ( + void); + + +/* ACPI Timer prototypes */ + +ACPI_STATUS +AcpiGetTimerResolution ( + UINT32 *Resolution); + +ACPI_STATUS +AcpiGetTimer ( + UINT32 *Ticks); + +ACPI_STATUS +AcpiGetTimerDuration ( + UINT32 StartTicks, + UINT32 EndTicks, + UINT32 *TimeElapsed); + + +#endif /* __ACHWARE_H__ */ diff --git a/source/include/acinterp.h b/source/include/acinterp.h new file mode 100644 index 000000000..7a429ddc3 --- /dev/null +++ b/source/include/acinterp.h @@ -0,0 +1,809 @@ +/****************************************************************************** + * + * Name: acinterp.h - Interpreter subcomponent prototypes and defines + * $Revision: 1.145 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACINTERP_H__ +#define __ACINTERP_H__ + + +#define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1])) + + +ACPI_STATUS +AcpiExResolveOperands ( + UINT16 Opcode, + ACPI_OPERAND_OBJECT **StackPtr, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExCheckObjectType ( + ACPI_OBJECT_TYPE TypeNeeded, + ACPI_OBJECT_TYPE ThisType, + void *Object); + +/* + * exxface - External interpreter interfaces + */ + +ACPI_STATUS +AcpiExLoadTable ( + ACPI_TABLE_TYPE TableId); + +ACPI_STATUS +AcpiExExecuteMethod ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObjDesc); + + +/* + * exconvrt - object conversion + */ + +ACPI_STATUS +AcpiExConvertToInteger ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ResultDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExConvertToBuffer ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ResultDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExConvertToString ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ResultDesc, + UINT32 Base, + UINT32 MaxLength, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExConvertToTargetType ( + ACPI_OBJECT_TYPE DestinationType, + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT **ResultDesc, + ACPI_WALK_STATE *WalkState); + +UINT32 +AcpiExConvertToAscii ( + ACPI_INTEGER Integer, + UINT32 Base, + UINT8 *String, + UINT8 MaxLength); + +/* + * exfield - ACPI AML (p-code) execution - field manipulation + */ + +ACPI_STATUS +AcpiExExtractFromField ( + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength); + +ACPI_STATUS +AcpiExInsertIntoField ( + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength); + +ACPI_STATUS +AcpiExSetupRegion ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 FieldDatumByteOffset); + +ACPI_STATUS +AcpiExAccessRegion ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 FieldDatumByteOffset, + ACPI_INTEGER *Value, + UINT32 ReadWrite); + +BOOLEAN +AcpiExRegisterOverflow ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_INTEGER Value); + +ACPI_STATUS +AcpiExFieldDatumIo ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 FieldDatumByteOffset, + ACPI_INTEGER *Value, + UINT32 ReadWrite); + +ACPI_STATUS +AcpiExWriteWithUpdateRule ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_INTEGER Mask, + ACPI_INTEGER FieldValue, + UINT32 FieldDatumByteOffset); + +void +AcpiExGetBufferDatum( + ACPI_INTEGER *Datum, + void *Buffer, + UINT32 ByteGranularity, + UINT32 Offset); + +void +AcpiExSetBufferDatum ( + ACPI_INTEGER MergedDatum, + void *Buffer, + UINT32 ByteGranularity, + UINT32 Offset); + +ACPI_STATUS +AcpiExReadDataFromField ( + ACPI_WALK_STATE *WalkState, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **RetBufferDesc); + +ACPI_STATUS +AcpiExWriteDataToField ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ResultDesc); + +/* + * exmisc - ACPI AML (p-code) execution - specific opcodes + */ + +ACPI_STATUS +AcpiExOpcode_3A_0T_0R ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExOpcode_3A_1T_1R ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExOpcode_6A_0T_1R ( + ACPI_WALK_STATE *WalkState); + +BOOLEAN +AcpiExDoMatch ( + UINT32 MatchOp, + ACPI_INTEGER PackageValue, + ACPI_INTEGER MatchValue); + +ACPI_STATUS +AcpiExGetObjectReference ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ReturnDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExResolveMultiple ( + ACPI_WALK_STATE *WalkState, + ACPI_OPERAND_OBJECT *Operand, + ACPI_OBJECT_TYPE *ReturnType, + ACPI_OPERAND_OBJECT **ReturnDesc); + +ACPI_STATUS +AcpiExConcatTemplate ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT *ObjDesc2, + ACPI_OPERAND_OBJECT **ActualReturnDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExDoConcatenate ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT *ObjDesc2, + ACPI_OPERAND_OBJECT **ActualReturnDesc, + ACPI_WALK_STATE *WalkState); + +BOOLEAN +AcpiExDoLogicalOp ( + UINT16 Opcode, + ACPI_INTEGER Operand0, + ACPI_INTEGER Operand1); + +ACPI_INTEGER +AcpiExDoMathOp ( + UINT16 Opcode, + ACPI_INTEGER Operand0, + ACPI_INTEGER Operand1); + +ACPI_STATUS +AcpiExCreateMutex ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExCreateProcessor ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExCreatePowerResource ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExCreateRegion ( + UINT8 *AmlStart, + UINT32 AmlLength, + UINT8 RegionSpace, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExCreateTableRegion ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExCreateEvent ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExCreateAlias ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExCreateMethod ( + UINT8 *AmlStart, + UINT32 AmlLength, + ACPI_WALK_STATE *WalkState); + + +/* + * exconfig - dynamic table load/unload + */ + +ACPI_STATUS +AcpiExAddTable ( + ACPI_TABLE_HEADER *Table, + ACPI_NAMESPACE_NODE *ParentNode, + ACPI_OPERAND_OBJECT **DdbHandle); + +ACPI_STATUS +AcpiExLoadOp ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT *Target, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExLoadTableOp ( + ACPI_WALK_STATE *WalkState, + ACPI_OPERAND_OBJECT **ReturnDesc); + +ACPI_STATUS +AcpiExUnloadTable ( + ACPI_OPERAND_OBJECT *DdbHandle); + + +/* + * exmutex - mutex support + */ + +ACPI_STATUS +AcpiExAcquireMutex ( + ACPI_OPERAND_OBJECT *TimeDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExReleaseMutex ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +void +AcpiExReleaseAllMutexes ( + ACPI_THREAD_STATE *Thread); + +void +AcpiExUnlinkMutex ( + ACPI_OPERAND_OBJECT *ObjDesc); + +void +AcpiExLinkMutex ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_THREAD_STATE *Thread); + +/* + * exprep - ACPI AML (p-code) execution - prep utilities + */ + +ACPI_STATUS +AcpiExPrepCommonFieldObject ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT8 FieldFlags, + UINT8 FieldAttribute, + UINT32 FieldBitPosition, + UINT32 FieldBitLength); + +ACPI_STATUS +AcpiExPrepFieldValue ( + ACPI_CREATE_FIELD_INFO *Info); + +/* + * exsystem - Interface to OS services + */ + +ACPI_STATUS +AcpiExSystemDoNotifyOp ( + ACPI_OPERAND_OBJECT *Value, + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiExSystemDoSuspend( + UINT32 Time); + +ACPI_STATUS +AcpiExSystemDoStall ( + UINT32 Time); + +ACPI_STATUS +AcpiExSystemAcquireMutex( + ACPI_OPERAND_OBJECT *Time, + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiExSystemReleaseMutex( + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiExSystemSignalEvent( + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiExSystemWaitEvent( + ACPI_OPERAND_OBJECT *Time, + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiExSystemResetEvent( + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiExSystemWaitSemaphore ( + ACPI_HANDLE Semaphore, + UINT16 Timeout); + + +/* + * exmonadic - ACPI AML (p-code) execution, monadic operators + */ + +ACPI_STATUS +AcpiExOpcode_1A_0T_0R ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExOpcode_1A_0T_1R ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExOpcode_1A_1T_1R ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExOpcode_1A_1T_0R ( + ACPI_WALK_STATE *WalkState); + +/* + * exdyadic - ACPI AML (p-code) execution, dyadic operators + */ + +ACPI_STATUS +AcpiExOpcode_2A_0T_0R ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExOpcode_2A_0T_1R ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExOpcode_2A_1T_1R ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExOpcode_2A_2T_1R ( + ACPI_WALK_STATE *WalkState); + + +/* + * exresolv - Object resolution and get value functions + */ + +ACPI_STATUS +AcpiExResolveToValue ( + ACPI_OPERAND_OBJECT **StackPtr, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExResolveNodeToValue ( + ACPI_NAMESPACE_NODE **StackPtr, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExResolveObjectToValue ( + ACPI_OPERAND_OBJECT **StackPtr, + ACPI_WALK_STATE *WalkState); + + +/* + * exdump - Scanner debug output routines + */ + +void +AcpiExDumpOperand ( + ACPI_OPERAND_OBJECT *EntryDesc); + +void +AcpiExDumpOperands ( + ACPI_OPERAND_OBJECT **Operands, + ACPI_INTERPRETER_MODE InterpreterMode, + char *Ident, + UINT32 NumLevels, + char *Note, + char *ModuleName, + UINT32 LineNumber); + +void +AcpiExDumpObjectDescriptor ( + ACPI_OPERAND_OBJECT *Object, + UINT32 Flags); + +void +AcpiExDumpNode ( + ACPI_NAMESPACE_NODE *Node, + UINT32 Flags); + +void +AcpiExOutString ( + char *Title, + char *Value); + +void +AcpiExOutPointer ( + char *Title, + void *Value); + +void +AcpiExOutInteger ( + char *Title, + UINT32 Value); + +void +AcpiExOutAddress ( + char *Title, + ACPI_PHYSICAL_ADDRESS Value); + + +/* + * exnames - interpreter/scanner name load/execute + */ + +char * +AcpiExAllocateNameString ( + UINT32 PrefixCount, + UINT32 NumNameSegs); + +UINT32 +AcpiExGoodChar ( + UINT32 Character); + +ACPI_STATUS +AcpiExNameSegment ( + UINT8 **InAmlAddress, + char *NameString); + +ACPI_STATUS +AcpiExGetNameString ( + ACPI_OBJECT_TYPE DataType, + UINT8 *InAmlAddress, + char **OutNameString, + UINT32 *OutNameLength); + +ACPI_STATUS +AcpiExDoName ( + ACPI_OBJECT_TYPE DataType, + ACPI_INTERPRETER_MODE LoadExecMode); + + +/* + * exstore - Object store support + */ + +ACPI_STATUS +AcpiExStore ( + ACPI_OPERAND_OBJECT *ValDesc, + ACPI_OPERAND_OBJECT *DestDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExStoreObjectToIndex ( + ACPI_OPERAND_OBJECT *ValDesc, + ACPI_OPERAND_OBJECT *DestDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExStoreObjectToNode ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_NAMESPACE_NODE *Node, + ACPI_WALK_STATE *WalkState); + + +/* + * exstoren + */ + +ACPI_STATUS +AcpiExResolveObject ( + ACPI_OPERAND_OBJECT **SourceDescPtr, + ACPI_OBJECT_TYPE TargetType, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExStoreObjectToObject ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *DestDesc, + ACPI_OPERAND_OBJECT **NewDesc, + ACPI_WALK_STATE *WalkState); + + +/* + * excopy - object copy + */ + +ACPI_STATUS +AcpiExStoreBufferToBuffer ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *TargetDesc); + +ACPI_STATUS +AcpiExStoreStringToString ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *TargetDesc); + +ACPI_STATUS +AcpiExCopyIntegerToIndexField ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *TargetDesc); + +ACPI_STATUS +AcpiExCopyIntegerToBankField ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *TargetDesc); + +ACPI_STATUS +AcpiExCopyDataToNamedField ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_NAMESPACE_NODE *Node); + +ACPI_STATUS +AcpiExCopyIntegerToBufferField ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *TargetDesc); + +/* + * exutils - interpreter/scanner utilities + */ + +ACPI_STATUS +AcpiExEnterInterpreter ( + void); + +void +AcpiExExitInterpreter ( + void); + +void +AcpiExTruncateFor32bitTable ( + ACPI_OPERAND_OBJECT *ObjDesc); + +BOOLEAN +AcpiExAcquireGlobalLock ( + UINT32 Rule); + +void +AcpiExReleaseGlobalLock ( + BOOLEAN Locked); + +UINT32 +AcpiExDigitsNeeded ( + ACPI_INTEGER Value, + UINT32 Base); + +void +AcpiExEisaIdToString ( + UINT32 NumericId, + char *OutString); + +void +AcpiExUnsignedIntegerToString ( + ACPI_INTEGER Value, + char *OutString); + + +/* + * exregion - default OpRegion handlers + */ + +ACPI_STATUS +AcpiExSystemMemorySpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext); + +ACPI_STATUS +AcpiExSystemIoSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext); + +ACPI_STATUS +AcpiExPciConfigSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext); + +ACPI_STATUS +AcpiExCmosSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext); + +ACPI_STATUS +AcpiExPciBarSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext); + +ACPI_STATUS +AcpiExEmbeddedControllerSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext); + +ACPI_STATUS +AcpiExSmBusSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext); + + +ACPI_STATUS +AcpiExDataTableSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext); + +#endif /* __INTERP_H__ */ diff --git a/source/include/aclocal.h b/source/include/aclocal.h new file mode 100644 index 000000000..bff65655c --- /dev/null +++ b/source/include/aclocal.h @@ -0,0 +1,1088 @@ +/****************************************************************************** + * + * Name: aclocal.h - Internal data types used across the ACPI subsystem + * $Revision: 1.186 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACLOCAL_H__ +#define __ACLOCAL_H__ + + +#define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */ + +typedef void* ACPI_MUTEX; +typedef UINT32 ACPI_MUTEX_HANDLE; + + +/* Total number of aml opcodes defined */ + +#define AML_NUM_OPCODES 0x7E + + +/***************************************************************************** + * + * Mutex typedefs and structs + * + ****************************************************************************/ + + +/* + * Predefined handles for the mutex objects used within the subsystem + * All mutex objects are automatically created by AcpiUtMutexInitialize. + * + * The acquire/release ordering protocol is implied via this list. Mutexes + * with a lower value must be acquired before mutexes with a higher value. + * + * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames table also! + */ + +#define ACPI_MTX_EXECUTE 0 +#define ACPI_MTX_INTERPRETER 1 +#define ACPI_MTX_PARSER 2 +#define ACPI_MTX_DISPATCHER 3 +#define ACPI_MTX_TABLES 4 +#define ACPI_MTX_OP_REGIONS 5 +#define ACPI_MTX_NAMESPACE 6 +#define ACPI_MTX_EVENTS 7 +#define ACPI_MTX_HARDWARE 8 +#define ACPI_MTX_CACHES 9 +#define ACPI_MTX_MEMORY 10 +#define ACPI_MTX_DEBUG_CMD_COMPLETE 11 +#define ACPI_MTX_DEBUG_CMD_READY 12 + +#define MAX_MTX 12 +#define NUM_MTX MAX_MTX+1 + + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +#ifdef DEFINE_ACPI_GLOBALS + +/* Names for the mutexes used in the subsystem */ + +static char *AcpiGbl_MutexNames[] = +{ + "ACPI_MTX_Execute", + "ACPI_MTX_Interpreter", + "ACPI_MTX_Parser", + "ACPI_MTX_Dispatcher", + "ACPI_MTX_Tables", + "ACPI_MTX_OpRegions", + "ACPI_MTX_Namespace", + "ACPI_MTX_Events", + "ACPI_MTX_Hardware", + "ACPI_MTX_Caches", + "ACPI_MTX_Memory", + "ACPI_MTX_DebugCmdComplete", + "ACPI_MTX_DebugCmdReady", +}; + +#endif +#endif + + +/* Table for the global mutexes */ + +typedef struct acpi_mutex_info +{ + ACPI_MUTEX Mutex; + UINT32 UseCount; + UINT32 OwnerId; + +} ACPI_MUTEX_INFO; + +/* This owner ID means that the mutex is not in use (unlocked) */ + +#define ACPI_MUTEX_NOT_ACQUIRED (UINT32) (-1) + + +/* Lock flag parameter for various interfaces */ + +#define ACPI_MTX_DO_NOT_LOCK 0 +#define ACPI_MTX_LOCK 1 + + +typedef UINT16 ACPI_OWNER_ID; +#define ACPI_OWNER_TYPE_TABLE 0x0 +#define ACPI_OWNER_TYPE_METHOD 0x1 +#define ACPI_FIRST_METHOD_ID 0x0000 +#define ACPI_FIRST_TABLE_ID 0x8000 + +/* TBD: [Restructure] get rid of the need for this! */ + +#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0x8000 + + +/* Field access granularities */ + +#define ACPI_FIELD_BYTE_GRANULARITY 1 +#define ACPI_FIELD_WORD_GRANULARITY 2 +#define ACPI_FIELD_DWORD_GRANULARITY 4 +#define ACPI_FIELD_QWORD_GRANULARITY 8 + +/***************************************************************************** + * + * Namespace typedefs and structs + * + ****************************************************************************/ + + +/* Operational modes of the AML interpreter/scanner */ + +typedef enum +{ + ACPI_IMODE_LOAD_PASS1 = 0x01, + ACPI_IMODE_LOAD_PASS2 = 0x02, + ACPI_IMODE_EXECUTE = 0x0E + +} ACPI_INTERPRETER_MODE; + + +/* + * The Node describes a named object that appears in the AML + * An AcpiNode is used to store Nodes. + * + * DataType is used to differentiate between internal descriptors, and MUST + * be the first byte in this structure. + */ + +typedef union acpi_name_union +{ + UINT32 Integer; + char Ascii[4]; + +} ACPI_NAME_UNION; + +typedef struct acpi_namespace_node +{ + UINT8 Descriptor; /* Used to differentiate object descriptor types */ + UINT8 Type; /* Type associated with this name */ + UINT16 OwnerId; + ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */ + + + union acpi_operand_object *Object; /* Pointer to attached ACPI object (optional) */ + struct acpi_namespace_node *Child; /* first child */ + struct acpi_namespace_node *Peer; /* Next peer*/ + UINT16 ReferenceCount; /* Current count of references and children */ + UINT8 Flags; + +} ACPI_NAMESPACE_NODE; + + +#define ACPI_ENTRY_NOT_FOUND NULL + + +/* Node flags */ + +#define ANOBJ_RESERVED 0x01 +#define ANOBJ_END_OF_PEER_LIST 0x02 +#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ +#define ANOBJ_METHOD_ARG 0x08 +#define ANOBJ_METHOD_LOCAL 0x10 +#define ANOBJ_METHOD_NO_RETVAL 0x20 +#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 + +#define ANOBJ_IS_BIT_OFFSET 0x80 + + +/* + * ACPI Table Descriptor. One per ACPI table + */ +typedef struct acpi_table_desc +{ + struct acpi_table_desc *Prev; + struct acpi_table_desc *Next; + struct acpi_table_desc *InstalledDesc; + ACPI_TABLE_HEADER *Pointer; + UINT8 *AmlStart; + UINT64 PhysicalAddress; + UINT32 AmlLength; + ACPI_SIZE Length; + UINT32 Count; + ACPI_OWNER_ID TableId; + UINT8 Type; + UINT8 Allocation; + BOOLEAN LoadedIntoNamespace; + +} ACPI_TABLE_DESC; + + +typedef struct acpi_find_context +{ + char *SearchFor; + ACPI_HANDLE *List; + UINT32 *Count; + +} ACPI_FIND_CONTEXT; + + +typedef struct acpi_ns_search_data +{ + ACPI_NAMESPACE_NODE *Node; + +} ACPI_NS_SEARCH_DATA; + + +/* + * Predefined Namespace items + */ +typedef struct acpi_predefined_names +{ + char *Name; + UINT8 Type; + char *Val; + +} ACPI_PREDEFINED_NAMES; + + +/* Object types used during package copies */ + + +#define ACPI_COPY_TYPE_SIMPLE 0 +#define ACPI_COPY_TYPE_PACKAGE 1 + +/* Info structure used to convert external<->internal namestrings */ + +typedef struct acpi_namestring_info +{ + char *ExternalName; + char *NextExternalChar; + char *InternalName; + UINT32 Length; + UINT32 NumSegments; + UINT32 NumCarats; + BOOLEAN FullyQualified; + +} ACPI_NAMESTRING_INFO; + + +/* Field creation info */ + +typedef struct acpi_create_field_info +{ + ACPI_NAMESPACE_NODE *RegionNode; + ACPI_NAMESPACE_NODE *FieldNode; + ACPI_NAMESPACE_NODE *RegisterNode; + ACPI_NAMESPACE_NODE *DataRegisterNode; + UINT32 BankValue; + UINT32 FieldBitPosition; + UINT32 FieldBitLength; + UINT8 FieldFlags; + UINT8 Attribute; + UINT8 FieldType; + +} ACPI_CREATE_FIELD_INFO; + + +/***************************************************************************** + * + * Event typedefs and structs + * + ****************************************************************************/ + +/* Information about each GPE register block */ + +typedef struct acpi_gpe_block_info +{ + ACPI_GENERIC_ADDRESS *BlockAddress; + UINT16 RegisterCount; + UINT8 BlockBaseNumber; + +} ACPI_GPE_BLOCK_INFO; + +/* Information about a particular GPE register pair */ + +typedef struct acpi_gpe_register_info +{ + ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */ + ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */ + UINT8 Status; /* Current value of status reg */ + UINT8 Enable; /* Current value of enable reg */ + UINT8 WakeEnable; /* Mask of bits to keep enabled when sleeping */ + UINT8 BaseGpeNumber; /* Base GPE number for this register */ + +} ACPI_GPE_REGISTER_INFO; + + +#define ACPI_GPE_LEVEL_TRIGGERED 1 +#define ACPI_GPE_EDGE_TRIGGERED 2 + + +/* Information about each particular GPE level */ + +typedef struct acpi_gpe_number_info +{ + ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */ + ACPI_GPE_HANDLER Handler; /* Address of handler, if any */ + void *Context; /* Context to be passed to handler */ + UINT8 Type; /* Level or Edge */ + UINT8 BitMask; + + +} ACPI_GPE_NUMBER_INFO; + + +typedef struct acpi_gpe_index_info +{ + UINT8 NumberIndex; + +} ACPI_GPE_INDEX_INFO; + +/* Information about each particular fixed event */ + +typedef struct acpi_fixed_event_handler +{ + ACPI_EVENT_HANDLER Handler; /* Address of handler. */ + void *Context; /* Context to be passed to handler */ + +} ACPI_FIXED_EVENT_HANDLER; + + +typedef struct acpi_fixed_event_info +{ + UINT8 StatusRegisterId; + UINT8 EnableRegisterId; + UINT16 StatusBitMask; + UINT16 EnableBitMask; + +} ACPI_FIXED_EVENT_INFO; + +/* Information used during field processing */ + +typedef struct acpi_field_info +{ + UINT8 SkipField; + UINT8 FieldFlag; + UINT32 PkgLength; + +} ACPI_FIELD_INFO; + + +/***************************************************************************** + * + * Generic "state" object for stacks + * + ****************************************************************************/ + + +#define ACPI_CONTROL_NORMAL 0xC0 +#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1 +#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2 +#define ACPI_CONTROL_PREDICATE_FALSE 0xC3 +#define ACPI_CONTROL_PREDICATE_TRUE 0xC4 + + +/* Forward declarations */ +struct acpi_walk_state; +struct acpi_obj_mutex; +union acpi_parse_object; + + +#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ + UINT8 DataType; /* To differentiate various internal objs */\ + UINT8 Flags; \ + UINT16 Value; \ + UINT16 State; \ + UINT16 Reserved; \ + void *Next; \ + +typedef struct acpi_common_state +{ + ACPI_STATE_COMMON +} ACPI_COMMON_STATE; + + +/* + * Update state - used to traverse complex objects such as packages + */ +typedef struct acpi_update_state +{ + ACPI_STATE_COMMON + union acpi_operand_object *Object; + +} ACPI_UPDATE_STATE; + + +/* + * Pkg state - used to traverse nested package structures + */ +typedef struct acpi_pkg_state +{ + ACPI_STATE_COMMON + union acpi_operand_object *SourceObject; + union acpi_operand_object *DestObject; + struct acpi_walk_state *WalkState; + void *ThisTargetObj; + UINT32 NumPackages; + UINT16 Index; + +} ACPI_PKG_STATE; + + +/* + * Control state - one per if/else and while constructs. + * Allows nesting of these constructs + */ +typedef struct acpi_control_state +{ + ACPI_STATE_COMMON + union acpi_parse_object *PredicateOp; + UINT8 *AmlPredicateStart; /* Start of if/while predicate */ + UINT8 *PackageEnd; /* End of if/while block */ + UINT16 Opcode; + +} ACPI_CONTROL_STATE; + + +/* + * Scope state - current scope during namespace lookups + */ +typedef struct acpi_scope_state +{ + ACPI_STATE_COMMON + ACPI_NAMESPACE_NODE *Node; + +} ACPI_SCOPE_STATE; + + +typedef struct acpi_pscope_state +{ + ACPI_STATE_COMMON + union acpi_parse_object *Op; /* current op being parsed */ + UINT8 *ArgEnd; /* current argument end */ + UINT8 *PkgEnd; /* current package end */ + UINT32 ArgList; /* next argument to parse */ + UINT32 ArgCount; /* Number of fixed arguments */ + +} ACPI_PSCOPE_STATE; + + +/* + * Thread state - one per thread across multiple walk states. Multiple walk + * states are created when there are nested control methods executing. + */ +typedef struct acpi_thread_state +{ + ACPI_STATE_COMMON + struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */ + union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */ + UINT32 ThreadId; /* Running thread ID */ + UINT16 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */ + +} ACPI_THREAD_STATE; + + +/* + * Result values - used to accumulate the results of nested + * AML arguments + */ +typedef struct acpi_result_values +{ + ACPI_STATE_COMMON + union acpi_operand_object *ObjDesc [ACPI_OBJ_NUM_OPERANDS]; + UINT8 NumResults; + UINT8 LastInsert; + +} ACPI_RESULT_VALUES; + + +typedef +ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) ( + struct acpi_walk_state *WalkState, + union acpi_parse_object **OutOp); + +typedef +ACPI_STATUS (*ACPI_PARSE_UPWARDS) ( + struct acpi_walk_state *WalkState); + + +/* + * Notify info - used to pass info to the deferred notify + * handler/dispatcher. + */ +typedef struct acpi_notify_info +{ + ACPI_STATE_COMMON + ACPI_NAMESPACE_NODE *Node; + union acpi_operand_object *HandlerObj; + +} ACPI_NOTIFY_INFO; + + +/* Generic state is union of structs above */ + +typedef union acpi_generic_state +{ + ACPI_COMMON_STATE Common; + ACPI_CONTROL_STATE Control; + ACPI_UPDATE_STATE Update; + ACPI_SCOPE_STATE Scope; + ACPI_PSCOPE_STATE ParseScope; + ACPI_PKG_STATE Pkg; + ACPI_THREAD_STATE Thread; + ACPI_RESULT_VALUES Results; + ACPI_NOTIFY_INFO Notify; + +} ACPI_GENERIC_STATE; + + +/***************************************************************************** + * + * Interpreter typedefs and structs + * + ****************************************************************************/ + +typedef +ACPI_STATUS (*ACPI_EXECUTE_OP) ( + struct acpi_walk_state *WalkState); + + +/***************************************************************************** + * + * Parser typedefs and structs + * + ****************************************************************************/ + +/* + * AML opcode, name, and argument layout + */ +typedef struct acpi_opcode_info +{ +#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) + char *Name; /* Opcode name (disassembler/debug only) */ +#endif + UINT32 ParseArgs; /* Grammar/Parse time arguments */ + UINT32 RuntimeArgs; /* Interpret time arguments */ + UINT32 Flags; /* Misc flags */ + UINT8 ObjectType; /* Corresponding internal object type */ + UINT8 Class; /* Opcode class */ + UINT8 Type; /* Opcode type */ + +} ACPI_OPCODE_INFO; + + +typedef union acpi_parse_value +{ + ACPI_INTEGER Integer; /* integer constant (Up to 64 bits) */ + UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */ + UINT32 Integer32; /* integer constant, 32 bits only */ + UINT16 Integer16; /* integer constant, 16 bits only */ + UINT8 Integer8; /* integer constant, 8 bits only */ + UINT32 Size; /* bytelist or field size */ + char *String; /* NULL terminated string */ + UINT8 *Buffer; /* buffer or string */ + char *Name; /* NULL terminated string */ + union acpi_parse_object *Arg; /* arguments and contained ops */ + +} ACPI_PARSE_VALUE; + + +#define ACPI_PARSE_COMMON \ + UINT8 DataType; /* To differentiate various internal objs */\ + UINT8 Flags; /* Type of Op */\ + UINT16 AmlOpcode; /* AML opcode */\ + UINT32 AmlOffset; /* offset of declaration in AML */\ + union acpi_parse_object *Parent; /* parent op */\ + union acpi_parse_object *Next; /* next op */\ + ACPI_DISASM_ONLY_MEMBERS (\ + UINT8 DisasmFlags; /* Used during AML disassembly */\ + UINT8 DisasmOpcode; /* Subtype used for disassembly */\ + char AmlOpName[16]) /* op name (debug only) */\ + /* NON-DEBUG members below: */\ + ACPI_NAMESPACE_NODE *Node; /* for use by interpreter */\ + ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ + + +#define ACPI_DASM_BUFFER 0x00 +#define ACPI_DASM_RESOURCE 0x01 +#define ACPI_DASM_STRING 0x02 +#define ACPI_DASM_UNICODE 0x03 +#define ACPI_DASM_EISAID 0x04 +#define ACPI_DASM_MATCHOP 0x05 + +/* + * generic operation (for example: If, While, Store) + */ +typedef struct acpi_parse_obj_common +{ + ACPI_PARSE_COMMON +} ACPI_PARSE_OBJ_COMMON; + + +/* + * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions), + * and bytelists. + */ +typedef struct acpi_parse_obj_named +{ + ACPI_PARSE_COMMON + UINT8 *Path; + UINT8 *Data; /* AML body or bytelist data */ + UINT32 Length; /* AML length */ + UINT32 Name; /* 4-byte name or zero if no name */ + +} ACPI_PARSE_OBJ_NAMED; + + +/* The parse node is the fundamental element of the parse tree */ + +typedef struct acpi_parse_obj_asl +{ + ACPI_PARSE_COMMON + + union acpi_parse_object *Child; + + + union acpi_parse_object *ParentMethod; + char *Filename; + char *ExternalName; + char *Namepath; + char NameSeg[4]; + UINT32 ExtraValue; + UINT32 Column; + UINT32 LineNumber; + UINT32 LogicalLineNumber; + UINT32 LogicalByteOffset; + UINT32 EndLine; + UINT32 EndLogicalLine; + UINT32 AcpiBtype; + UINT32 AmlLength; + UINT32 AmlSubtreeLength; + UINT32 FinalAmlLength; + UINT32 FinalAmlOffset; + UINT32 CompileFlags; + UINT16 ParseOpcode; + UINT8 AmlOpcodeLength; + UINT8 AmlPkgLenBytes; + UINT8 Extra; + char ParseOpName[12]; + +} ACPI_PARSE_OBJ_ASL; + + +typedef union acpi_parse_object +{ + ACPI_PARSE_OBJ_COMMON Common; + ACPI_PARSE_OBJ_NAMED Named; + ACPI_PARSE_OBJ_ASL Asl; + +} ACPI_PARSE_OBJECT; + + +/* + * Parse state - one state per parser invocation and each control + * method. + */ +typedef struct acpi_parse_state +{ + UINT32 AmlSize; + UINT8 *AmlStart; /* first AML byte */ + UINT8 *Aml; /* next AML byte */ + UINT8 *AmlEnd; /* (last + 1) AML byte */ + UINT8 *PkgStart; /* current package begin */ + UINT8 *PkgEnd; /* current package end */ + union acpi_parse_object *StartOp; /* root of parse tree */ + struct acpi_namespace_node *StartNode; + union acpi_generic_state *Scope; /* current scope */ + union acpi_parse_object *StartScope; + +} ACPI_PARSE_STATE; + + +/* Parse object flags */ + +#define ACPI_PARSEOP_GENERIC 0x01 +#define ACPI_PARSEOP_NAMED 0x02 +#define ACPI_PARSEOP_DEFERRED 0x04 +#define ACPI_PARSEOP_BYTELIST 0x08 +#define ACPI_PARSEOP_IN_CACHE 0x80 + +/* Parse object DisasmFlags */ + +#define ACPI_PARSEOP_IGNORE 0x01 +#define ACPI_PARSEOP_PARAMLIST 0x02 +#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 +#define ACPI_PARSEOP_SPECIAL 0x10 + + +/***************************************************************************** + * + * Hardware (ACPI registers) and PNP + * + ****************************************************************************/ + +#define PCI_ROOT_HID_STRING "PNP0A03" + +typedef struct acpi_bit_register_info +{ + UINT8 ParentRegister; + UINT8 BitPosition; + UINT16 AccessBitMask; + +} ACPI_BIT_REGISTER_INFO; + + +/* + * Register IDs + * These are the full ACPI registers + */ +#define ACPI_REGISTER_PM1_STATUS 0x01 +#define ACPI_REGISTER_PM1_ENABLE 0x02 +#define ACPI_REGISTER_PM1_CONTROL 0x03 +#define ACPI_REGISTER_PM1A_CONTROL 0x04 +#define ACPI_REGISTER_PM1B_CONTROL 0x05 +#define ACPI_REGISTER_PM2_CONTROL 0x06 +#define ACPI_REGISTER_PM_TIMER 0x07 +#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08 +#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 + + +/* Masks used to access the BitRegisters */ + +#define ACPI_BITMASK_TIMER_STATUS 0x0001 +#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010 +#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020 +#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 +#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 +#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 +#define ACPI_BITMASK_WAKE_STATUS 0x8000 + +#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ + ACPI_BITMASK_BUS_MASTER_STATUS | \ + ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ + ACPI_BITMASK_POWER_BUTTON_STATUS | \ + ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ + ACPI_BITMASK_RT_CLOCK_STATUS | \ + ACPI_BITMASK_WAKE_STATUS) + +#define ACPI_BITMASK_TIMER_ENABLE 0x0001 +#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 +#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 +#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 +#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 + +#define ACPI_BITMASK_SCI_ENABLE 0x0001 +#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 +#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 +#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00 +#define ACPI_BITMASK_SLEEP_ENABLE 0x2000 + +#define ACPI_BITMASK_ARB_DISABLE 0x0001 + + +/* Raw bit position of each BitRegister */ + +#define ACPI_BITPOSITION_TIMER_STATUS 0x00 +#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04 +#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05 +#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 +#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 +#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A +#define ACPI_BITPOSITION_WAKE_STATUS 0x0F + +#define ACPI_BITPOSITION_TIMER_ENABLE 0x00 +#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05 +#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 +#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 +#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A + +#define ACPI_BITPOSITION_SCI_ENABLE 0x00 +#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 +#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 +#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A +#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D + +#define ACPI_BITPOSITION_ARB_DISABLE 0x00 + + +/***************************************************************************** + * + * Resource descriptors + * + ****************************************************************************/ + + +/* ResourceType values */ + +#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 +#define ACPI_RESOURCE_TYPE_IO_RANGE 1 +#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2 + +/* Resource descriptor types and masks */ + +#define ACPI_RDESC_TYPE_LARGE 0x80 +#define ACPI_RDESC_TYPE_SMALL 0x00 + +#define ACPI_RDESC_TYPE_MASK 0x80 +#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ + + +/* + * Small resource descriptor types + * Note: The 3 length bits (2:0) must be zero + */ +#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20 +#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28 +#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30 +#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38 +#define ACPI_RDESC_TYPE_IO_PORT 0x40 +#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48 +#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70 +#define ACPI_RDESC_TYPE_END_TAG 0x78 + +/* + * Large resource descriptor types + */ + +#define ACPI_RDESC_TYPE_MEMORY_24 0x81 +#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82 +#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84 +#define ACPI_RDESC_TYPE_MEMORY_32 0x85 +#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86 +#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87 +#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88 +#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89 +#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A + + +/* String version of device HIDs and UIDs */ + +#define ACPI_DEVICE_ID_LENGTH 0x09 + +typedef struct acpi_device_id +{ + char Buffer[ACPI_DEVICE_ID_LENGTH]; + +} ACPI_DEVICE_ID; + + +/***************************************************************************** + * + * Miscellaneous + * + ****************************************************************************/ + +#define ACPI_ASCII_ZERO 0x30 + + +/***************************************************************************** + * + * Debugger + * + ****************************************************************************/ + +typedef struct acpi_db_method_info +{ + ACPI_HANDLE ThreadGate; + char *Name; + char **Args; + UINT32 Flags; + UINT32 NumLoops; + char Pathname[128]; + +} ACPI_DB_METHOD_INFO; + +typedef struct acpi_integrity_info +{ + UINT32 Nodes; + UINT32 Objects; + +} ACPI_INTEGRITY_INFO; + + +#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 +#define ACPI_DB_CONSOLE_OUTPUT 0x02 +#define ACPI_DB_DUPLICATE_OUTPUT 0x03 + + +/***************************************************************************** + * + * Debug + * + ****************************************************************************/ + +typedef struct acpi_debug_print_info +{ + UINT32 ComponentId; + char *ProcName; + char *ModuleName; + +} ACPI_DEBUG_PRINT_INFO; + + +/* Entry for a memory allocation (debug only) */ + +#define ACPI_MEM_MALLOC 0 +#define ACPI_MEM_CALLOC 1 +#define ACPI_MAX_MODULE_NAME 16 + +#define ACPI_COMMON_DEBUG_MEM_HEADER \ + struct acpi_debug_mem_block *Previous; \ + struct acpi_debug_mem_block *Next; \ + UINT32 Size; \ + UINT32 Component; \ + UINT32 Line; \ + char Module[ACPI_MAX_MODULE_NAME]; \ + UINT8 AllocType; + +typedef struct acpi_debug_mem_header +{ + ACPI_COMMON_DEBUG_MEM_HEADER + +} ACPI_DEBUG_MEM_HEADER; + +typedef struct acpi_debug_mem_block +{ + ACPI_COMMON_DEBUG_MEM_HEADER + UINT64 UserSpace; + +} ACPI_DEBUG_MEM_BLOCK; + + +#define ACPI_MEM_LIST_GLOBAL 0 +#define ACPI_MEM_LIST_NSNODE 1 + +#define ACPI_MEM_LIST_FIRST_CACHE_LIST 2 +#define ACPI_MEM_LIST_STATE 2 +#define ACPI_MEM_LIST_PSNODE 3 +#define ACPI_MEM_LIST_PSNODE_EXT 4 +#define ACPI_MEM_LIST_OPERAND 5 +#define ACPI_MEM_LIST_WALK 6 +#define ACPI_MEM_LIST_MAX 6 +#define ACPI_NUM_MEM_LISTS 7 + + +typedef struct acpi_memory_list +{ + void *ListHead; + UINT16 LinkOffset; + UINT16 MaxCacheDepth; + UINT16 CacheDepth; + UINT16 ObjectSize; + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + + /* Statistics for debug memory tracking only */ + + UINT32 TotalAllocated; + UINT32 TotalFreed; + UINT32 CurrentTotalSize; + UINT32 CacheRequests; + UINT32 CacheHits; + char *ListName; +#endif + +} ACPI_MEMORY_LIST; + + +#endif /* __ACLOCAL_H__ */ diff --git a/source/include/acmacros.h b/source/include/acmacros.h new file mode 100644 index 000000000..0440037cc --- /dev/null +++ b/source/include/acmacros.h @@ -0,0 +1,670 @@ +/****************************************************************************** + * + * Name: acmacros.h - C macros for the entire subsystem. + * $Revision: 1.137 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACMACROS_H__ +#define __ACMACROS_H__ + + +/* + * Data manipulation macros + */ + +#define ACPI_LOWORD(l) ((UINT16)(UINT32)(l)) +#define ACPI_HIWORD(l) ((UINT16)((((UINT32)(l)) >> 16) & 0xFFFF)) +#define ACPI_LOBYTE(l) ((UINT8)(UINT16)(l)) +#define ACPI_HIBYTE(l) ((UINT8)((((UINT16)(l)) >> 8) & 0xFF)) + + +#if ACPI_MACHINE_WIDTH == 16 + +/* + * For 16-bit addresses, we have to assume that the upper 32 bits + * are zero. + */ +#define ACPI_LODWORD(l) ((UINT32)(l)) +#define ACPI_HIDWORD(l) ((UINT32)(0)) + +#define ACPI_GET_ADDRESS(a) ((a).Lo) +#define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(UINT32)(b);} +#define ACPI_VALID_ADDRESS(a) ((a).Hi | (a).Lo) + +#else +#ifdef ACPI_NO_INTEGER64_SUPPORT +/* + * ACPI_INTEGER is 32-bits, no 64-bit support on this platform + */ +#define ACPI_LODWORD(l) ((UINT32)(l)) +#define ACPI_HIDWORD(l) ((UINT32)(0)) + +#define ACPI_GET_ADDRESS(a) (a) +#define ACPI_STORE_ADDRESS(a,b) ((a)=(b)) +#define ACPI_VALID_ADDRESS(a) (a) + +#else + +/* + * Full 64-bit address/integer on both 32-bit and 64-bit platforms + */ +#define ACPI_LODWORD(l) ((UINT32)(UINT64)(l)) +#define ACPI_HIDWORD(l) ((UINT32)(((*(UINT64_STRUCT *)(void *)(&l))).Hi)) + +#define ACPI_GET_ADDRESS(a) (a) +#define ACPI_STORE_ADDRESS(a,b) ((a)=(ACPI_PHYSICAL_ADDRESS)(b)) +#define ACPI_VALID_ADDRESS(a) (a) +#endif +#endif + + /* + * Extract a byte of data using a pointer. Any more than a byte and we + * get into potential aligment issues -- see the STORE macros below + */ +#define ACPI_GET8(addr) (*(UINT8*)(addr)) + +/* Pointer arithmetic */ + +#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (ACPI_NATIVE_UINT)(b)) +#define ACPI_PTR_DIFF(a,b) (ACPI_NATIVE_UINT) ((char *)(a) - (char *)(b)) + +/* Pointer/Integer type conversions */ + +#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(ACPI_NATIVE_UINT)i) +#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) +#define ACPI_OFFSET(d,f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) +#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) + +#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p)) +#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) + +#if ACPI_MACHINE_WIDTH == 16 +#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_UNALIGNED32_TO_32(d,s) +#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) +#define ACPI_PTR_TO_PHYSADDR(i) (UINT32) (char *)(i) +#else +#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) +#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) +#endif + +/* + * Macros for moving data around to/from buffers that are possibly unaligned. + * If the hardware supports the transfer of unaligned data, just do the store. + * Otherwise, we have to move one byte at a time. + */ + +#ifdef _HW_ALIGNMENT_SUPPORT + +/* The hardware supports unaligned transfers, just do the move */ + +#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) +#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s) + +#else +/* + * The hardware does not support unaligned transfers. We must move the + * data one byte at a time. These macros work whether the source or + * the destination (or both) is/are unaligned. + */ + +#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ + ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];} + +#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ + ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ + ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ + ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];} + +#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) {(*(UINT32*)(void *)(d)) = 0; ACPI_MOVE_UNALIGNED16_TO_16(d,s);} + +#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ + ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ + ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ + ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\ + ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[4];\ + ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[5];\ + ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\ + ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];} + +#endif + + +/* + * Fast power-of-two math macros for non-optimized compilers + */ + +#define _ACPI_DIV(value,PowerOf2) ((UINT32) ((value) >> (PowerOf2))) +#define _ACPI_MUL(value,PowerOf2) ((UINT32) ((value) << (PowerOf2))) +#define _ACPI_MOD(value,Divisor) ((UINT32) ((value) & ((Divisor) -1))) + +#define ACPI_DIV_2(a) _ACPI_DIV(a,1) +#define ACPI_MUL_2(a) _ACPI_MUL(a,1) +#define ACPI_MOD_2(a) _ACPI_MOD(a,2) + +#define ACPI_DIV_4(a) _ACPI_DIV(a,2) +#define ACPI_MUL_4(a) _ACPI_MUL(a,2) +#define ACPI_MOD_4(a) _ACPI_MOD(a,4) + +#define ACPI_DIV_8(a) _ACPI_DIV(a,3) +#define ACPI_MUL_8(a) _ACPI_MUL(a,3) +#define ACPI_MOD_8(a) _ACPI_MOD(a,8) + +#define ACPI_DIV_16(a) _ACPI_DIV(a,4) +#define ACPI_MUL_16(a) _ACPI_MUL(a,4) +#define ACPI_MOD_16(a) _ACPI_MOD(a,16) + + +/* + * Rounding macros (Power of two boundaries only) + */ +#define ACPI_ROUND_DOWN(value,boundary) (((ACPI_NATIVE_UINT)(value)) & (~(((ACPI_NATIVE_UINT) boundary)-1))) +#define ACPI_ROUND_UP(value,boundary) ((((ACPI_NATIVE_UINT)(value)) + (((ACPI_NATIVE_UINT) boundary)-1)) & (~(((ACPI_NATIVE_UINT) boundary)-1))) + +#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) +#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) +#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) + +#define ACPI_ROUND_UP_TO_32BITS(a) ACPI_ROUND_UP(a,4) +#define ACPI_ROUND_UP_TO_64BITS(a) ACPI_ROUND_UP(a,8) +#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) + + +#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) +#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) + +#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) + +/* Generic (non-power-of-two) rounding */ + +#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) + +/* + * Bitmask creation + * Bit positions start at zero. + * MASK_BITS_ABOVE creates a mask starting AT the position and above + * MASK_BITS_BELOW creates a mask starting one bit BELOW the position + */ +#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((UINT32) (position)))) +#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((UINT32) (position))) + +#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) + +/* Macros for GAS addressing */ + +#if ACPI_MACHINE_WIDTH != 16 + +#define ACPI_PCI_DEVICE_MASK (UINT64) 0x0000FFFF00000000 +#define ACPI_PCI_FUNCTION_MASK (UINT64) 0x00000000FFFF0000 +#define ACPI_PCI_REGISTER_MASK (UINT64) 0x000000000000FFFF + +/* + * Obsolete + */ + +/* +#define ACPI_PCI_FUNCTION(a) (UINT16) ((((UINT64)((UINT64)(a) & ACPI_PCI_FUNCTION_MASK)) >> 16)) +#define ACPI_PCI_DEVICE(a) (UINT16) ((((UINT64)((UINT64)(a) & ACPI_PCI_DEVICE_MASK)) >> 32)) +#define ACPI_PCI_REGISTER(a) (UINT16) (((UINT64)((UINT64)(a) & ACPI_PCI_REGISTER_MASK))) +*/ + + +#define ACPI_PCI_DEVICE(a) (UINT16) ((ACPI_HIDWORD ((a))) & 0x0000FFFF) +#define ACPI_PCI_FUNCTION(a) (UINT16) ((ACPI_LODWORD ((a))) >> 16) +#define ACPI_PCI_REGISTER(a) (UINT16) ((ACPI_LODWORD ((a))) & 0x0000FFFF) + +#else + +/* No support for GAS and PCI IDs in 16-bit mode */ + +#define ACPI_PCI_FUNCTION(a) (UINT16) ((a) & 0xFFFF0000) +#define ACPI_PCI_DEVICE(a) (UINT16) ((a) & 0x0000FFFF) +#define ACPI_PCI_REGISTER(a) (UINT16) ((a) & 0x0000FFFF) + +#endif + + +/* Bitfields within ACPI registers */ + +#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) ((Val << Pos) & Mask) +#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) + +/* + * An ACPI_NAMESPACE_NODE * can appear in some contexts, + * where a pointer to an ACPI_OPERAND_OBJECT can also + * appear. This macro is used to distinguish them. + * + * The "Descriptor" field is the first field in both structures. + */ +#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId) +#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId = t) + + +/* Macro to test the object type */ + +#define ACPI_GET_OBJECT_TYPE(d) (((ACPI_OPERAND_OBJECT *)(void *)(d))->Common.Type) + +/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ + +#define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) + +/* + * Macros for the master AML opcode table + */ +#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) +#define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {Name,(UINT32)(PArgs),(UINT32)(IArgs),(UINT32)(Flags),ObjType,Class,Type} +#else +#define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {(UINT32)(PArgs),(UINT32)(IArgs),(UINT32)(Flags),ObjType,Class,Type} +#endif + +#ifdef ACPI_DISASSEMBLER +#define ACPI_DISASM_ONLY_MEMBERS(a) a; +#else +#define ACPI_DISASM_ONLY_MEMBERS(a) +#endif + +#define ARG_TYPE_WIDTH 5 +#define ARG_1(x) ((UINT32)(x)) +#define ARG_2(x) ((UINT32)(x) << (1 * ARG_TYPE_WIDTH)) +#define ARG_3(x) ((UINT32)(x) << (2 * ARG_TYPE_WIDTH)) +#define ARG_4(x) ((UINT32)(x) << (3 * ARG_TYPE_WIDTH)) +#define ARG_5(x) ((UINT32)(x) << (4 * ARG_TYPE_WIDTH)) +#define ARG_6(x) ((UINT32)(x) << (5 * ARG_TYPE_WIDTH)) + +#define ARGI_LIST1(a) (ARG_1(a)) +#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) +#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) +#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) +#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) +#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) + +#define ARGP_LIST1(a) (ARG_1(a)) +#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) +#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) +#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) +#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) +#define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) + +#define GET_CURRENT_ARG_TYPE(List) (List & ((UINT32) 0x1F)) +#define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH)) + + +/* + * Build a GAS structure from earlier ACPI table entries (V1.0 and 0.71 extensions) + * + * 1) Address space + * 2) Length in bytes -- convert to length in bits + * 3) Bit offset is zero + * 4) Reserved field is zero + * 5) Expand address to 64 bits + */ +#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d) do {a.AddressSpaceId = (UINT8) d;\ + a.RegisterBitWidth = (UINT8) ACPI_MUL_8 (b);\ + a.RegisterBitOffset = 0;\ + a.Reserved = 0;\ + ACPI_STORE_ADDRESS (a.Address,(ACPI_PHYSICAL_ADDRESS) c);} while (0) + +/* ACPI V1.0 entries -- address space is always I/O */ + +#define ASL_BUILD_GAS_FROM_V1_ENTRY(a,b,c) ASL_BUILD_GAS_FROM_ENTRY(a,b,c,ACPI_ADR_SPACE_SYSTEM_IO) + + +/* + * Reporting macros that are never compiled out + */ + +#define ACPI_PARAM_LIST(pl) pl + +/* + * Error reporting. These versions add callers module and line#. Since + * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only + * use it in debug mode. + */ + +#ifdef ACPI_DEBUG_OUTPUT + +#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \ + AcpiOsPrintf ACPI_PARAM_LIST(fp);} +#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError(_THIS_MODULE,__LINE__,_COMPONENT); \ + AcpiOsPrintf ACPI_PARAM_LIST(fp);} +#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning(_THIS_MODULE,__LINE__,_COMPONENT); \ + AcpiOsPrintf ACPI_PARAM_LIST(fp);} +#define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError(_THIS_MODULE,__LINE__,_COMPONENT, s, e); + +#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e); + +#else + +#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo("ACPI",__LINE__,_COMPONENT); \ + AcpiOsPrintf ACPI_PARAM_LIST(fp);} +#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError("ACPI",__LINE__,_COMPONENT); \ + AcpiOsPrintf ACPI_PARAM_LIST(fp);} +#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning("ACPI",__LINE__,_COMPONENT); \ + AcpiOsPrintf ACPI_PARAM_LIST(fp);} +#define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError("ACPI",__LINE__,_COMPONENT, s, e); + +#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError("ACPI",__LINE__,_COMPONENT, s, n, p, e); + +#endif + +/* Error reporting. These versions pass thru the module and line# */ + +#define _ACPI_REPORT_INFO(a,b,c,fp) {AcpiUtReportInfo(a,b,c); \ + AcpiOsPrintf ACPI_PARAM_LIST(fp);} +#define _ACPI_REPORT_ERROR(a,b,c,fp) {AcpiUtReportError(a,b,c); \ + AcpiOsPrintf ACPI_PARAM_LIST(fp);} +#define _ACPI_REPORT_WARNING(a,b,c,fp) {AcpiUtReportWarning(a,b,c); \ + AcpiOsPrintf ACPI_PARAM_LIST(fp);} + +/* + * Debug macros that are conditionally compiled + */ + +#ifdef ACPI_DEBUG_OUTPUT + +#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name; + +/* + * Function entry tracing. + * The first parameter should be the procedure name as a quoted string. This is declared + * as a local string ("_ProcName) so that it can be also used by the function exit macros below. + */ + +#define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _Dbg; \ + _Dbg.ComponentId = _COMPONENT; \ + _Dbg.ProcName = a; \ + _Dbg.ModuleName = _THIS_MODULE; + +#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a)\ + AcpiUtTrace(__LINE__,&_Dbg) +#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a)\ + AcpiUtTracePtr(__LINE__,&_Dbg,(void *)b) +#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a)\ + AcpiUtTraceU32(__LINE__,&_Dbg,(UINT32)b) +#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a)\ + AcpiUtTraceStr(__LINE__,&_Dbg,(char *)b) + +#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr() + +/* + * Function exit tracing. + * WARNING: These macros include a return statement. This is usually considered + * bad form, but having a separate exit macro is very ugly and difficult to maintain. + * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros + * so that "_ProcName" is defined. + */ +#ifdef ACPI_USE_DO_WHILE_0 +#define ACPI_DO_WHILE0(a) do a while(0) +#else +#define ACPI_DO_WHILE0(a) a +#endif + +#define return_VOID ACPI_DO_WHILE0 ({AcpiUtExit(__LINE__,&_Dbg);return;}) +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({AcpiUtStatusExit(__LINE__,&_Dbg,(s));return((s));}) +#define return_VALUE(s) ACPI_DO_WHILE0 ({AcpiUtValueExit(__LINE__,&_Dbg,(ACPI_INTEGER)(s));return((s));}) +#define return_PTR(s) ACPI_DO_WHILE0 ({AcpiUtPtrExit(__LINE__,&_Dbg,(UINT8 *)(s));return((s));}) + +/* Conditional execution */ + +#define ACPI_DEBUG_EXEC(a) a +#define ACPI_NORMAL_EXEC(a) + +#define ACPI_DEBUG_DEFINE(a) a; +#define ACPI_DEBUG_ONLY_MEMBERS(a) a; +#define _VERBOSE_STRUCTURES + + +/* Stack and buffer dumping */ + +#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand(a) +#define ACPI_DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__) + + +#define ACPI_DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b) +#define ACPI_DUMP_TABLES(a,b) AcpiNsDumpTables(a,b) +#define ACPI_DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d) +#define ACPI_DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a) +#define ACPI_DUMP_BUFFER(a,b) AcpiUtDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) +#define ACPI_BREAK_MSG(a) AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,(a)) + + +/* + * Generate INT3 on ACPI_ERROR (Debug only!) + */ + +#define ACPI_ERROR_BREAK +#ifdef ACPI_ERROR_BREAK +#define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \ + AcpiOsSignal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n") +#else +#define ACPI_BREAK_ON_ERROR(lvl) +#endif + +/* + * Master debug print macros + * Print iff: + * 1) Debug print for the current component is enabled + * 2) Debug error level or trace level for the print statement is enabled + */ + +#define ACPI_DEBUG_PRINT(pl) AcpiUtDebugPrint ACPI_PARAM_LIST(pl) +#define ACPI_DEBUG_PRINT_RAW(pl) AcpiUtDebugPrintRaw ACPI_PARAM_LIST(pl) + + +#else +/* + * This is the non-debug case -- make everything go away, + * leaving no executable debug code! + */ + +#define ACPI_MODULE_NAME(name) +#define _THIS_MODULE "" + +#define ACPI_DEBUG_EXEC(a) +#define ACPI_NORMAL_EXEC(a) a; + +#define ACPI_DEBUG_DEFINE(a) +#define ACPI_DEBUG_ONLY_MEMBERS(a) +#define ACPI_FUNCTION_NAME(a) +#define ACPI_FUNCTION_TRACE(a) +#define ACPI_FUNCTION_TRACE_PTR(a,b) +#define ACPI_FUNCTION_TRACE_U32(a,b) +#define ACPI_FUNCTION_TRACE_STR(a,b) +#define ACPI_FUNCTION_EXIT +#define ACPI_FUNCTION_STATUS_EXIT(s) +#define ACPI_FUNCTION_VALUE_EXIT(s) +#define ACPI_FUNCTION_ENTRY() +#define ACPI_DUMP_STACK_ENTRY(a) +#define ACPI_DUMP_OPERANDS(a,b,c,d,e) +#define ACPI_DUMP_ENTRY(a,b) +#define ACPI_DUMP_TABLES(a,b) +#define ACPI_DUMP_PATHNAME(a,b,c,d) +#define ACPI_DUMP_RESOURCE_LIST(a) +#define ACPI_DUMP_BUFFER(a,b) +#define ACPI_DEBUG_PRINT(pl) +#define ACPI_DEBUG_PRINT_RAW(pl) +#define ACPI_BREAK_MSG(a) + +#define return_VOID return +#define return_ACPI_STATUS(s) return(s) +#define return_VALUE(s) return(s) +#define return_PTR(s) return(s) + +#endif + +/* + * Some code only gets executed when the debugger is built in. + * Note that this is entirely independent of whether the + * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not. + */ +#ifdef ACPI_DEBUGGER +#define ACPI_DEBUGGER_EXEC(a) a +#else +#define ACPI_DEBUGGER_EXEC(a) +#endif + + +/* + * For 16-bit code, we want to shrink some things even though + * we are using ACPI_DEBUG_OUTPUT to get the debug output + */ +#if ACPI_MACHINE_WIDTH == 16 +#undef ACPI_DEBUG_ONLY_MEMBERS +#undef _VERBOSE_STRUCTURES +#define ACPI_DEBUG_ONLY_MEMBERS(a) +#endif + + +#ifdef ACPI_DEBUG_OUTPUT +/* + * 1) Set name to blanks + * 2) Copy the object name + */ +#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->Common.Name, ' ', sizeof (a->Common.Name));\ + ACPI_STRNCPY (a->Common.Name, AcpiGbl_NsTypeNames[b], sizeof (a->Common.Name)) +#else + +#define ACPI_ADD_OBJECT_NAME(a,b) +#endif + + +/* + * Memory allocation tracking (DEBUG ONLY) + */ + +#ifndef ACPI_DBG_TRACK_ALLOCATIONS + +/* Memory allocation */ + +#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_FREE(a) AcpiOsFree(a) +#define ACPI_MEM_TRACKING(a) + + +#else + +/* Memory allocation */ + +#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocateAndTrack((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_TRACKING(a) a + +#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ + + +#define ACPI_GET_STACK_POINTER _asm {mov eax, ebx} + +#endif /* ACMACROS_H */ diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h new file mode 100644 index 000000000..05fc64d87 --- /dev/null +++ b/source/include/acnamesp.h @@ -0,0 +1,581 @@ +/****************************************************************************** + * + * Name: acnamesp.h - Namespace subcomponent prototypes and defines + * $Revision: 1.133 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACNAMESP_H__ +#define __ACNAMESP_H__ + + +/* To search the entire name space, pass this as SearchBase */ + +#define ACPI_NS_ALL ((ACPI_HANDLE)0) + +/* + * Elements of AcpiNsProperties are bit significant + * and should be one-to-one with values of ACPI_OBJECT_TYPE + */ +#define ACPI_NS_NORMAL 0 +#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ +#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ + + +/* Definitions of the predefined namespace names */ + +#define ACPI_UNKNOWN_NAME (UINT32) 0x3F3F3F3F /* Unknown name is "????" */ +#define ACPI_ROOT_NAME (UINT32) 0x5F5F5F5C /* Root name is "\___" */ +#define ACPI_SYS_BUS_NAME (UINT32) 0x5F53425F /* Sys bus name is "_SB_" */ + +#define ACPI_NS_ROOT_PATH "\\" +#define ACPI_NS_SYSTEM_BUS "_SB_" + + +/* Flags for AcpiNsLookup, AcpiNsSearchAndEnter */ + +#define ACPI_NS_NO_UPSEARCH 0 +#define ACPI_NS_SEARCH_PARENT 0x01 +#define ACPI_NS_DONT_OPEN_SCOPE 0x02 +#define ACPI_NS_NO_PEER_SEARCH 0x04 +#define ACPI_NS_ERROR_IF_FOUND 0x08 + +#define ACPI_NS_WALK_UNLOCK TRUE +#define ACPI_NS_WALK_NO_UNLOCK FALSE + + +ACPI_STATUS +AcpiNsLoadNamespace ( + void); + +ACPI_STATUS +AcpiNsInitializeObjects ( + void); + +ACPI_STATUS +AcpiNsInitializeDevices ( + void); + + +/* Namespace init - nsxfinit */ + +ACPI_STATUS +AcpiNsInitOneDevice ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +ACPI_STATUS +AcpiNsInitOneObject ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + + +ACPI_STATUS +AcpiNsWalkNamespace ( + ACPI_OBJECT_TYPE Type, + ACPI_HANDLE StartObject, + UINT32 MaxDepth, + BOOLEAN UnlockBeforeCallback, + ACPI_WALK_CALLBACK UserFunction, + void *Context, + void **ReturnValue); + +ACPI_NAMESPACE_NODE * +AcpiNsGetNextNode ( + ACPI_OBJECT_TYPE Type, + ACPI_NAMESPACE_NODE *Parent, + ACPI_NAMESPACE_NODE *Child); + +void +AcpiNsDeleteNamespaceByOwner ( + UINT16 TableId); + + +/* Namespace loading - nsload */ + +ACPI_STATUS +AcpiNsOneCompleteParse ( + UINT32 PassNumber, + ACPI_TABLE_DESC *TableDesc); + +ACPI_STATUS +AcpiNsParseTable ( + ACPI_TABLE_DESC *TableDesc, + ACPI_NAMESPACE_NODE *Scope); + +ACPI_STATUS +AcpiNsLoadTable ( + ACPI_TABLE_DESC *TableDesc, + ACPI_NAMESPACE_NODE *Node); + +ACPI_STATUS +AcpiNsLoadTableByType ( + ACPI_TABLE_TYPE TableType); + + +/* + * Top-level namespace access - nsaccess + */ + +ACPI_STATUS +AcpiNsRootInitialize ( + void); + +ACPI_STATUS +AcpiNsLookup ( + ACPI_GENERIC_STATE *ScopeInfo, + char *Name, + ACPI_OBJECT_TYPE Type, + ACPI_INTERPRETER_MODE InterpreterMode, + UINT32 Flags, + ACPI_WALK_STATE *WalkState, + ACPI_NAMESPACE_NODE **RetNode); + + +/* + * Named object allocation/deallocation - nsalloc + */ + +ACPI_NAMESPACE_NODE * +AcpiNsCreateNode ( + UINT32 Name); + +void +AcpiNsDeleteNode ( + ACPI_NAMESPACE_NODE *Node); + +void +AcpiNsDeleteNamespaceSubtree ( + ACPI_NAMESPACE_NODE *ParentHandle); + +void +AcpiNsDetachObject ( + ACPI_NAMESPACE_NODE *Node); + +void +AcpiNsDeleteChildren ( + ACPI_NAMESPACE_NODE *Parent); + +int +AcpiNsCompareNames ( + char *Name1, + char *Name2); + +/* + * Namespace modification - nsmodify + */ + +ACPI_STATUS +AcpiNsUnloadNamespace ( + ACPI_HANDLE Handle); + +ACPI_STATUS +AcpiNsDeleteSubtree ( + ACPI_HANDLE StartHandle); + + +/* + * Namespace dump/print utilities - nsdump + */ + +void +AcpiNsDumpTables ( + ACPI_HANDLE SearchBase, + UINT32 MaxDepth); + +void +AcpiNsDumpEntry ( + ACPI_HANDLE Handle, + UINT32 DebugLevel); + +void +AcpiNsDumpPathname ( + ACPI_HANDLE Handle, + char *Msg, + UINT32 Level, + UINT32 Component); + +void +AcpiNsPrintPathname ( + UINT32 NumSegments, + char *Pathname); + +ACPI_STATUS +AcpiNsDumpOneDevice ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + +void +AcpiNsDumpRootDevices ( + void); + +ACPI_STATUS +AcpiNsDumpOneObject ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + +void +AcpiNsDumpObjects ( + ACPI_OBJECT_TYPE Type, + UINT8 DisplayType, + UINT32 MaxDepth, + UINT32 OwnderId, + ACPI_HANDLE StartHandle); + + +/* + * Namespace evaluation functions - nseval + */ + +ACPI_STATUS +AcpiNsEvaluateByHandle ( + ACPI_NAMESPACE_NODE *PrefixNode, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObject); + +ACPI_STATUS +AcpiNsEvaluateByName ( + char *Pathname, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObject); + +ACPI_STATUS +AcpiNsEvaluateRelative ( + ACPI_NAMESPACE_NODE *PrefixNode, + char *Pathname, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObject); + +ACPI_STATUS +AcpiNsExecuteControlMethod ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObjDesc); + +ACPI_STATUS +AcpiNsGetObjectValue ( + ACPI_NAMESPACE_NODE *ObjectNode, + ACPI_OPERAND_OBJECT **ReturnObjDesc); + + +/* + * Parent/Child/Peer utility functions + */ + +ACPI_NAME +AcpiNsFindParentName ( + ACPI_NAMESPACE_NODE *NodeToSearch); + + +/* + * Name and Scope manipulation - nsnames + */ + +UINT32 +AcpiNsOpensScope ( + ACPI_OBJECT_TYPE Type); + +void +AcpiNsBuildExternalPath ( + ACPI_NAMESPACE_NODE *Node, + ACPI_SIZE Size, + char *NameBuffer); + +char * +AcpiNsGetExternalPathname ( + ACPI_NAMESPACE_NODE *Node); + +char * +AcpiNsNameOfCurrentScope ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiNsHandleToPathname ( + ACPI_HANDLE TargetHandle, + ACPI_BUFFER *Buffer); + +BOOLEAN +AcpiNsPatternMatch ( + ACPI_NAMESPACE_NODE *ObjNode, + char *SearchFor); + +ACPI_STATUS +AcpiNsGetNodeByPath ( + char *ExternalPathname, + ACPI_NAMESPACE_NODE *InPrefixNode, + UINT32 Flags, + ACPI_NAMESPACE_NODE **OutNode); + +ACPI_SIZE +AcpiNsGetPathnameLength ( + ACPI_NAMESPACE_NODE *Node); + + +/* + * Object management for namespace nodes - nsobject + */ + +ACPI_STATUS +AcpiNsAttachObject ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OPERAND_OBJECT *Object, + ACPI_OBJECT_TYPE Type); + +ACPI_OPERAND_OBJECT * +AcpiNsGetAttachedObject ( + ACPI_NAMESPACE_NODE *Node); + +ACPI_OPERAND_OBJECT * +AcpiNsGetSecondaryObject ( + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiNsAttachData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_HANDLER Handler, + void *Data); + +ACPI_STATUS +AcpiNsDetachData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_HANDLER Handler); + +ACPI_STATUS +AcpiNsGetAttachedData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_HANDLER Handler, + void **Data); + + +/* + * Namespace searching and entry - nssearch + */ + +ACPI_STATUS +AcpiNsSearchAndEnter ( + UINT32 EntryName, + ACPI_WALK_STATE *WalkState, + ACPI_NAMESPACE_NODE *Node, + ACPI_INTERPRETER_MODE InterpreterMode, + ACPI_OBJECT_TYPE Type, + UINT32 Flags, + ACPI_NAMESPACE_NODE **RetNode); + +ACPI_STATUS +AcpiNsSearchNode ( + UINT32 EntryName, + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_TYPE Type, + ACPI_NAMESPACE_NODE **RetNode); + +void +AcpiNsInstallNode ( + ACPI_WALK_STATE *WalkState, + ACPI_NAMESPACE_NODE *ParentNode, + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_TYPE Type); + + +/* + * Utility functions - nsutils + */ + +BOOLEAN +AcpiNsValidRootPrefix ( + char Prefix); + +BOOLEAN +AcpiNsValidPathSeparator ( + char Sep); + +ACPI_OBJECT_TYPE +AcpiNsGetType ( + ACPI_NAMESPACE_NODE *Node); + +UINT32 +AcpiNsLocal ( + ACPI_OBJECT_TYPE Type); + +void +AcpiNsReportError ( + char *ModuleName, + UINT32 LineNumber, + UINT32 ComponentId, + char *InternalName, + ACPI_STATUS LookupStatus); + +void +AcpiNsReportMethodError ( + char *ModuleName, + UINT32 LineNumber, + UINT32 ComponentId, + char *Message, + ACPI_NAMESPACE_NODE *Node, + char *Path, + ACPI_STATUS LookupStatus); + +void +AcpiNsPrintNodePathname ( + ACPI_NAMESPACE_NODE *Node, + char *Msg); + +ACPI_STATUS +AcpiNsBuildInternalName ( + ACPI_NAMESTRING_INFO *Info); + +void +AcpiNsGetInternalNameLength ( + ACPI_NAMESTRING_INFO *Info); + +ACPI_STATUS +AcpiNsInternalizeName ( + char *DottedName, + char **ConvertedName); + +ACPI_STATUS +AcpiNsExternalizeName ( + UINT32 InternalNameLength, + char *InternalName, + UINT32 *ConvertedNameLength, + char **ConvertedName); + +ACPI_NAMESPACE_NODE * +AcpiNsMapHandleToNode ( + ACPI_HANDLE Handle); + +ACPI_HANDLE +AcpiNsConvertEntryToHandle( + ACPI_NAMESPACE_NODE *Node); + +void +AcpiNsTerminate ( + void); + +ACPI_NAMESPACE_NODE * +AcpiNsGetParentNode ( + ACPI_NAMESPACE_NODE *Node); + + +ACPI_NAMESPACE_NODE * +AcpiNsGetNextValidNode ( + ACPI_NAMESPACE_NODE *Node); + + +#endif /* __ACNAMESP_H__ */ diff --git a/source/include/acobject.h b/source/include/acobject.h new file mode 100644 index 000000000..1329bff69 --- /dev/null +++ b/source/include/acobject.h @@ -0,0 +1,591 @@ + +/****************************************************************************** + * + * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) + * $Revision: 1.118 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef _ACOBJECT_H +#define _ACOBJECT_H + + +/* + * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher + * to the interpreter, and to keep track of the various handlers such as + * address space handlers and notify handlers. The object is a constant + * size in order to allow it to be cached and reused. + */ + +/******************************************************************************* + * + * Common Descriptors + * + ******************************************************************************/ + +/* + * Common area for all objects. + * + * DataType is used to differentiate between internal descriptors, and MUST + * be the first byte in this structure. + */ +#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\ + UINT8 Descriptor; /* To differentiate various internal objs */\ + UINT8 Type; /* ACPI_OBJECT_TYPE */\ + UINT16 ReferenceCount; /* For object deletion management */\ + union acpi_operand_object *NextObject; /* Objects linked to parent NS node */\ + UINT8 Flags; \ + +/* Values for flag byte above */ + +#define AOPOBJ_AML_CONSTANT 0x01 +#define AOPOBJ_STATIC_POINTER 0x02 +#define AOPOBJ_DATA_VALID 0x04 +#define AOPOBJ_OBJECT_INITIALIZED 0x08 +#define AOPOBJ_SETUP_COMPLETE 0x10 +#define AOPOBJ_SINGLE_DATUM 0x20 + + +/* + * Common bitfield for the field objects + * "Field Datum" -- a datum from the actual field object + * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field + */ +#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\ + UINT8 FieldFlags; /* Access, update, and lock bits */\ + UINT8 Attribute; /* From AccessAs keyword */\ + UINT8 AccessByteWidth; /* Read/Write size in bytes */\ + UINT32 BitLength; /* Length of field in bits */\ + UINT32 BaseByteOffset; /* Byte offset within containing object */\ + UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\ + UINT8 DatumValidBits; /* Valid bit in first "Field datum" */\ + UINT8 EndFieldValidBits; /* Valid bits in the last "field datum" */\ + UINT8 EndBufferValidBits; /* Valid bits in the last "buffer datum" */\ + UINT32 Value; /* Value to store into the Bank or Index register */\ + ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */ + + +/* + * Fields common to both Strings and Buffers + */ +#define ACPI_COMMON_BUFFER_INFO \ + UINT32 Length; + + +/* + * Common fields for objects that support ASL notifications + */ +#define ACPI_COMMON_NOTIFY_INFO \ + union acpi_operand_object *SysHandler; /* Handler for system notifies */\ + union acpi_operand_object *DrvHandler; /* Handler for driver notifies */\ + union acpi_operand_object *AddrHandler; /* Handler for Address space */ + + +/****************************************************************************** + * + * Basic data types + * + *****************************************************************************/ + +typedef struct acpi_object_common +{ + ACPI_OBJECT_COMMON_HEADER + +} ACPI_OBJECT_COMMON; + + +typedef struct acpi_object_integer +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_INTEGER Value; + +} ACPI_OBJECT_INTEGER; + + +typedef struct acpi_object_string /* Null terminated, ASCII characters only */ +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_BUFFER_INFO + char *Pointer; /* String in AML stream or allocated string */ + +} ACPI_OBJECT_STRING; + + +typedef struct acpi_object_buffer +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_BUFFER_INFO + UINT8 *Pointer; /* Buffer in AML stream or allocated buffer */ + ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */ + UINT8 *AmlStart; + UINT32 AmlLength; + +} ACPI_OBJECT_BUFFER; + + +typedef struct acpi_object_package +{ + ACPI_OBJECT_COMMON_HEADER + + UINT32 Count; /* # of elements in package */ + UINT32 AmlLength; + UINT8 *AmlStart; + ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */ + union acpi_operand_object **Elements; /* Array of pointers to AcpiObjects */ + +} ACPI_OBJECT_PACKAGE; + + +/****************************************************************************** + * + * Complex data types + * + *****************************************************************************/ + +typedef struct acpi_object_event +{ + ACPI_OBJECT_COMMON_HEADER + void *Semaphore; + +} ACPI_OBJECT_EVENT; + + +#define INFINITE_CONCURRENCY 0xFF + +typedef struct acpi_object_method +{ + ACPI_OBJECT_COMMON_HEADER + UINT8 MethodFlags; + UINT8 ParamCount; + UINT32 AmlLength; + void *Semaphore; + UINT8 *AmlStart; + UINT8 Concurrency; + UINT8 ThreadCount; + ACPI_OWNER_ID OwningId; + +} ACPI_OBJECT_METHOD; + + +typedef struct acpi_object_mutex +{ + ACPI_OBJECT_COMMON_HEADER + UINT16 SyncLevel; + UINT16 AcquisitionDepth; + struct acpi_thread_state *OwnerThread; + void *Semaphore; + union acpi_operand_object *Prev; /* Link for list of acquired mutexes */ + union acpi_operand_object *Next; /* Link for list of acquired mutexes */ + ACPI_NAMESPACE_NODE *Node; /* containing object */ + +} ACPI_OBJECT_MUTEX; + + +typedef struct acpi_object_region +{ + ACPI_OBJECT_COMMON_HEADER + + UINT8 SpaceId; + union acpi_operand_object *AddrHandler; /* Handler for system notifies */ + ACPI_NAMESPACE_NODE *Node; /* containing object */ + union acpi_operand_object *Next; + UINT32 Length; + ACPI_PHYSICAL_ADDRESS Address; + +} ACPI_OBJECT_REGION; + + +/****************************************************************************** + * + * Objects that can be notified. All share a common NotifyInfo area. + * + *****************************************************************************/ + +typedef struct acpi_object_notify_common /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_NOTIFY_INFO + +} ACPI_OBJECT_NOTIFY_COMMON; + + +typedef struct acpi_object_device +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_NOTIFY_INFO + +} ACPI_OBJECT_DEVICE; + + +typedef struct acpi_object_power_resource +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_NOTIFY_INFO + UINT32 SystemLevel; + UINT32 ResourceOrder; + +} ACPI_OBJECT_POWER_RESOURCE; + + +typedef struct acpi_object_processor +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_NOTIFY_INFO + UINT32 ProcId; + UINT32 Length; + ACPI_IO_ADDRESS Address; + +} ACPI_OBJECT_PROCESSOR; + + +typedef struct acpi_object_thermal_zone +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_NOTIFY_INFO + +} ACPI_OBJECT_THERMAL_ZONE; + + +/****************************************************************************** + * + * Fields. All share a common header/info field. + * + *****************************************************************************/ + +typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_FIELD_INFO + union acpi_operand_object *RegionObj; /* Containing Operation Region object */ + /* (REGION/BANK fields only) */ +} ACPI_OBJECT_FIELD_COMMON; + + +typedef struct acpi_object_region_field +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_FIELD_INFO + union acpi_operand_object *RegionObj; /* Containing OpRegion object */ + +} ACPI_OBJECT_REGION_FIELD; + + +typedef struct acpi_object_bank_field +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_FIELD_INFO + union acpi_operand_object *RegionObj; /* Containing OpRegion object */ + union acpi_operand_object *BankObj; /* BankSelect Register object */ + +} ACPI_OBJECT_BANK_FIELD; + + +typedef struct acpi_object_index_field +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_FIELD_INFO + + /* + * No "RegionObj" pointer needed since the Index and Data registers + * are each field definitions unto themselves. + */ + union acpi_operand_object *IndexObj; /* Index register */ + union acpi_operand_object *DataObj; /* Data register */ + +} ACPI_OBJECT_INDEX_FIELD; + + +/* The BufferField is different in that it is part of a Buffer, not an OpRegion */ + +typedef struct acpi_object_buffer_field +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_FIELD_INFO + union acpi_operand_object *BufferObj; /* Containing Buffer object */ + +} ACPI_OBJECT_BUFFER_FIELD; + + +/****************************************************************************** + * + * Objects for handlers + * + *****************************************************************************/ + +typedef struct acpi_object_notify_handler +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_NAMESPACE_NODE *Node; /* Parent device */ + ACPI_NOTIFY_HANDLER Handler; + void *Context; + +} ACPI_OBJECT_NOTIFY_HANDLER; + + +/* Flags for address handler */ + +#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1 + + +typedef struct acpi_object_addr_handler +{ + ACPI_OBJECT_COMMON_HEADER + UINT8 SpaceId; + UINT16 Hflags; + ACPI_ADR_SPACE_HANDLER Handler; + ACPI_NAMESPACE_NODE *Node; /* Parent device */ + void *Context; + ACPI_ADR_SPACE_SETUP Setup; + union acpi_operand_object *RegionList; /* regions using this handler */ + union acpi_operand_object *Next; + +} ACPI_OBJECT_ADDR_HANDLER; + + +/****************************************************************************** + * + * Special internal objects + * + *****************************************************************************/ + +/* + * The Reference object type is used for these opcodes: + * Arg[0-6], Local[0-7], IndexOp, NameOp, ZeroOp, OneOp, OnesOp, DebugOp + */ +typedef struct acpi_object_reference +{ + ACPI_OBJECT_COMMON_HEADER + UINT8 TargetType; /* Used for IndexOp */ + UINT16 Opcode; + UINT32 Offset; /* Used for ArgOp, LocalOp, and IndexOp */ + void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */ + ACPI_NAMESPACE_NODE *Node; + union acpi_operand_object **Where; + +} ACPI_OBJECT_REFERENCE; + + +/* + * Extra object is used as additional storage for types that + * have AML code in their declarations (TermArgs) that must be + * evaluated at run time. + * + * Currently: Region and FieldUnit types + */ +typedef struct acpi_object_extra +{ + ACPI_OBJECT_COMMON_HEADER + UINT8 ByteFill1; + UINT16 WordFill1; + UINT32 AmlLength; + UINT8 *AmlStart; + ACPI_NAMESPACE_NODE *Method_REG; /* _REG method for this region (if any) */ + void *RegionContext; /* Region-specific data */ + +} ACPI_OBJECT_EXTRA; + + +/* Additional data that can be attached to namespace nodes */ + +typedef struct acpi_object_data +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_OBJECT_HANDLER Handler; + void *Pointer; + +} ACPI_OBJECT_DATA; + + +/* Structure used when objects are cached for reuse */ + +typedef struct acpi_object_cache_list +{ + ACPI_OBJECT_COMMON_HEADER + union acpi_operand_object *Next; /* Link for object cache and internal lists*/ + +} ACPI_OBJECT_CACHE_LIST; + + +/****************************************************************************** + * + * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above + * + *****************************************************************************/ + +typedef union acpi_operand_object +{ + ACPI_OBJECT_COMMON Common; + ACPI_OBJECT_INTEGER Integer; + ACPI_OBJECT_STRING String; + ACPI_OBJECT_BUFFER Buffer; + ACPI_OBJECT_PACKAGE Package; + ACPI_OBJECT_EVENT Event; + ACPI_OBJECT_METHOD Method; + ACPI_OBJECT_MUTEX Mutex; + ACPI_OBJECT_REGION Region; + ACPI_OBJECT_NOTIFY_COMMON CommonNotify; + ACPI_OBJECT_DEVICE Device; + ACPI_OBJECT_POWER_RESOURCE PowerResource; + ACPI_OBJECT_PROCESSOR Processor; + ACPI_OBJECT_THERMAL_ZONE ThermalZone; + ACPI_OBJECT_FIELD_COMMON CommonField; + ACPI_OBJECT_REGION_FIELD Field; + ACPI_OBJECT_BUFFER_FIELD BufferField; + ACPI_OBJECT_BANK_FIELD BankField; + ACPI_OBJECT_INDEX_FIELD IndexField; + ACPI_OBJECT_NOTIFY_HANDLER NotifyHandler; + ACPI_OBJECT_ADDR_HANDLER AddrHandler; + ACPI_OBJECT_REFERENCE Reference; + ACPI_OBJECT_EXTRA Extra; + ACPI_OBJECT_DATA Data; + ACPI_OBJECT_CACHE_LIST Cache; + +} ACPI_OPERAND_OBJECT; + + +/****************************************************************************** + * + * ACPI_DESCRIPTOR - objects that share a common descriptor identifier + * + *****************************************************************************/ + + +/* Object descriptor types */ + +#define ACPI_DESC_TYPE_CACHED 0x11 /* Used only when object is cached */ +#define ACPI_DESC_TYPE_STATE 0x20 +#define ACPI_DESC_TYPE_STATE_UPDATE 0x21 +#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22 +#define ACPI_DESC_TYPE_STATE_CONTROL 0x23 +#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24 +#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25 +#define ACPI_DESC_TYPE_STATE_WSCOPE 0x26 +#define ACPI_DESC_TYPE_STATE_RESULT 0x27 +#define ACPI_DESC_TYPE_STATE_NOTIFY 0x28 +#define ACPI_DESC_TYPE_STATE_THREAD 0x29 +#define ACPI_DESC_TYPE_WALK 0x44 +#define ACPI_DESC_TYPE_PARSER 0x66 +#define ACPI_DESC_TYPE_OPERAND 0x88 +#define ACPI_DESC_TYPE_NAMED 0xAA + + +typedef union acpi_descriptor +{ + UINT8 DescriptorId; /* To differentiate various internal objs */\ + ACPI_OPERAND_OBJECT Object; + ACPI_NAMESPACE_NODE Node; + ACPI_PARSE_OBJECT Op; + +} ACPI_DESCRIPTOR; + + +#endif /* _ACOBJECT_H */ diff --git a/source/include/acoutput.h b/source/include/acoutput.h new file mode 100644 index 000000000..a9a338bfb --- /dev/null +++ b/source/include/acoutput.h @@ -0,0 +1,258 @@ +/****************************************************************************** + * + * Name: acoutput.h -- debug output + * $Revision: 1.93 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACOUTPUT_H__ +#define __ACOUTPUT_H__ + +/* + * Debug levels and component IDs. These are used to control the + * granularity of the output of the DEBUG_PRINT macro -- on a per- + * component basis and a per-exception-type basis. + */ + +/* Component IDs are used in the global "DebugLayer" */ + +#define ACPI_UTILITIES 0x00000001 +#define ACPI_HARDWARE 0x00000002 +#define ACPI_EVENTS 0x00000004 +#define ACPI_TABLES 0x00000008 +#define ACPI_NAMESPACE 0x00000010 +#define ACPI_PARSER 0x00000020 +#define ACPI_DISPATCHER 0x00000040 +#define ACPI_EXECUTER 0x00000080 +#define ACPI_RESOURCES 0x00000100 +#define ACPI_CA_DEBUGGER 0x00000200 +#define ACPI_OS_SERVICES 0x00000400 +#define ACPI_CA_DISASSEMBLER 0x00000800 + +/* Component IDs for ACPI tools and utilities */ + +#define ACPI_COMPILER 0x00001000 +#define ACPI_TOOLS 0x00002000 + +#define ACPI_ALL_COMPONENTS 0x00003FFF +#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) + + +/* Component IDs reserved for ACPI drivers */ + +#define ACPI_ALL_DRIVERS 0xFFFF0000 + + +/* + * Raw debug output levels, do not use these in the DEBUG_PRINT macros + */ +#define ACPI_LV_ERROR 0x00000001 +#define ACPI_LV_WARN 0x00000002 +#define ACPI_LV_INIT 0x00000004 +#define ACPI_LV_DEBUG_OBJECT 0x00000008 +#define ACPI_LV_INFO 0x00000010 +#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F + +/* Trace verbosity level 1 [Standard Trace Level] */ + +#define ACPI_LV_INIT_NAMES 0x00000020 +#define ACPI_LV_PARSE 0x00000040 +#define ACPI_LV_LOAD 0x00000080 +#define ACPI_LV_DISPATCH 0x00000100 +#define ACPI_LV_EXEC 0x00000200 +#define ACPI_LV_NAMES 0x00000400 +#define ACPI_LV_OPREGION 0x00000800 +#define ACPI_LV_BFIELD 0x00001000 +#define ACPI_LV_TABLES 0x00002000 +#define ACPI_LV_VALUES 0x00004000 +#define ACPI_LV_OBJECTS 0x00008000 +#define ACPI_LV_RESOURCES 0x00010000 +#define ACPI_LV_USER_REQUESTS 0x00020000 +#define ACPI_LV_PACKAGE 0x00040000 +#define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS + +/* Trace verbosity level 2 [Function tracing and memory allocation] */ + +#define ACPI_LV_ALLOCATIONS 0x00100000 +#define ACPI_LV_FUNCTIONS 0x00200000 +#define ACPI_LV_OPTIMIZATIONS 0x00400000 +#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1 +#define ACPI_LV_ALL ACPI_LV_VERBOSITY2 + +/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ + +#define ACPI_LV_MUTEX 0x01000000 +#define ACPI_LV_THREADS 0x02000000 +#define ACPI_LV_IO 0x04000000 +#define ACPI_LV_INTERRUPTS 0x08000000 +#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 + +/* Exceptionally verbose output -- also used in the global "DebugLevel" */ + +#define ACPI_LV_AML_DISASSEMBLE 0x10000000 +#define ACPI_LV_VERBOSE_INFO 0x20000000 +#define ACPI_LV_FULL_TABLES 0x40000000 +#define ACPI_LV_EVENTS 0x80000000 + +#define ACPI_LV_VERBOSE 0xF0000000 + + +/* + * Debug level macros that are used in the DEBUG_PRINT macros + */ +#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,__LINE__,&_Dbg + +/* Exception level -- used in the global "DebugLevel" */ + +#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) +#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) +#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) +#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) +#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) +#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) + + +/* Trace level -- also used in the global "DebugLevel" */ + +#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) +#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) +#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE) +#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH) +#define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD) +#define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC) +#define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES) +#define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION) +#define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD) +#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) +#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) +#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) +#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) +#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) +#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) +#define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES) +#define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO) +#define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS) +#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) +#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) +#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) + +#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) + + +/* Defaults for DebugLevel, debug and normal */ + +#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) +#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) +#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) + + +#endif /* __ACOUTPUT_H__ */ diff --git a/source/include/acparser.h b/source/include/acparser.h new file mode 100644 index 000000000..ee2fc8cf6 --- /dev/null +++ b/source/include/acparser.h @@ -0,0 +1,420 @@ +/****************************************************************************** + * + * Module Name: acparser.h - AML Parser subcomponent prototypes and defines + * $Revision: 1.65 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + + +#ifndef __ACPARSER_H__ +#define __ACPARSER_H__ + + +#define OP_HAS_RETURN_VALUE 1 + +/* variable # arguments */ + +#define ACPI_VAR_ARGS ACPI_UINT32_MAX + + +#define ACPI_PARSE_DELETE_TREE 0x0001 +#define ACPI_PARSE_NO_TREE_DELETE 0x0000 +#define ACPI_PARSE_TREE_MASK 0x0001 + +#define ACPI_PARSE_LOAD_PASS1 0x0010 +#define ACPI_PARSE_LOAD_PASS2 0x0020 +#define ACPI_PARSE_EXECUTE 0x0030 +#define ACPI_PARSE_MODE_MASK 0x0030 + +#define ACPI_PARSE_DEFERRED_OP 0x0100 + +/* Parser external interfaces */ + +ACPI_STATUS +AcpiPsxLoadTable ( + UINT8 *PcodeAddr, + UINT32 PcodeLength); + +ACPI_STATUS +AcpiPsxExecute ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObjDesc); + + +/****************************************************************************** + * + * Parser interfaces + * + *****************************************************************************/ + + +/* psargs - Parse AML opcode arguments */ + +UINT8 * +AcpiPsGetNextPackageEnd ( + ACPI_PARSE_STATE *ParserState); + +UINT32 +AcpiPsGetNextPackageLength ( + ACPI_PARSE_STATE *ParserState); + +char * +AcpiPsGetNextNamestring ( + ACPI_PARSE_STATE *ParserState); + +void +AcpiPsGetNextSimpleArg ( + ACPI_PARSE_STATE *ParserState, + UINT32 ArgType, + ACPI_PARSE_OBJECT *Arg); + +ACPI_STATUS +AcpiPsGetNextNamepath ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_STATE *ParserState, + ACPI_PARSE_OBJECT *Arg, + BOOLEAN MethodCall); + +ACPI_PARSE_OBJECT * +AcpiPsGetNextField ( + ACPI_PARSE_STATE *ParserState); + +ACPI_STATUS +AcpiPsGetNextArg ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_STATE *ParserState, + UINT32 ArgType, + ACPI_PARSE_OBJECT **ReturnArg); + + +/* psfind */ + +ACPI_PARSE_OBJECT * +AcpiPsFindName ( + ACPI_PARSE_OBJECT *Scope, + UINT32 Name, + UINT32 Opcode); + +ACPI_PARSE_OBJECT* +AcpiPsGetParent ( + ACPI_PARSE_OBJECT *Op); + + +/* psopcode - AML Opcode information */ + +const ACPI_OPCODE_INFO * +AcpiPsGetOpcodeInfo ( + UINT16 Opcode); + +char * +AcpiPsGetOpcodeName ( + UINT16 Opcode); + + +/* psparse - top level parsing routines */ + +UINT32 +AcpiPsGetOpcodeSize ( + UINT32 Opcode); + +void +AcpiPsCompleteThisOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiPsNextParseState ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + ACPI_STATUS CallbackStatus); + +ACPI_STATUS +AcpiPsFindObject ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT **OutOp); + +void +AcpiPsDeleteParseTree ( + ACPI_PARSE_OBJECT *root); + +ACPI_STATUS +AcpiPsParseLoop ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiPsParseAml ( + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiPsParseTable ( + UINT8 *aml, + UINT32 amlSize, + ACPI_PARSE_DOWNWARDS DescendingCallback, + ACPI_PARSE_UPWARDS AscendingCallback, + ACPI_PARSE_OBJECT **RootObject); + +UINT16 +AcpiPsPeekOpcode ( + ACPI_PARSE_STATE *state); + + +/* psscope - Scope stack management routines */ + + +ACPI_STATUS +AcpiPsInitScope ( + ACPI_PARSE_STATE *ParserState, + ACPI_PARSE_OBJECT *Root); + +ACPI_PARSE_OBJECT * +AcpiPsGetParentScope ( + ACPI_PARSE_STATE *state); + +BOOLEAN +AcpiPsHasCompletedScope ( + ACPI_PARSE_STATE *ParserState); + +void +AcpiPsPopScope ( + ACPI_PARSE_STATE *ParserState, + ACPI_PARSE_OBJECT **Op, + UINT32 *ArgList, + UINT32 *ArgCount); + +ACPI_STATUS +AcpiPsPushScope ( + ACPI_PARSE_STATE *ParserState, + ACPI_PARSE_OBJECT *Op, + UINT32 RemainingArgs, + UINT32 ArgCount); + +void +AcpiPsCleanupScope ( + ACPI_PARSE_STATE *state); + + +/* pstree - parse tree manipulation routines */ + +void +AcpiPsAppendArg( + ACPI_PARSE_OBJECT *op, + ACPI_PARSE_OBJECT *arg); + +ACPI_PARSE_OBJECT* +AcpiPsFind ( + ACPI_PARSE_OBJECT *Scope, + char *Path, + UINT16 Opcode, + UINT32 Create); + +ACPI_PARSE_OBJECT * +AcpiPsGetArg( + ACPI_PARSE_OBJECT *op, + UINT32 argn); + +ACPI_PARSE_OBJECT * +AcpiPsGetChild ( + ACPI_PARSE_OBJECT *op); + +ACPI_PARSE_OBJECT * +AcpiPsGetDepthNext ( + ACPI_PARSE_OBJECT *Origin, + ACPI_PARSE_OBJECT *Op); + + +/* pswalk - parse tree walk routines */ + +ACPI_STATUS +AcpiPsWalkParsedAml ( + ACPI_PARSE_OBJECT *StartOp, + ACPI_PARSE_OBJECT *EndOp, + ACPI_OPERAND_OBJECT *MthDesc, + ACPI_NAMESPACE_NODE *StartNode, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **CallerReturnDesc, + ACPI_OWNER_ID OwnerId, + ACPI_PARSE_DOWNWARDS DescendingCallback, + ACPI_PARSE_UPWARDS AscendingCallback); + +ACPI_STATUS +AcpiPsGetNextWalkOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + ACPI_PARSE_UPWARDS AscendingCallback); + +ACPI_STATUS +AcpiPsDeleteCompletedOp ( + ACPI_WALK_STATE *WalkState); + + +/* psutils - parser utilities */ + +ACPI_PARSE_OBJECT * +AcpiPsCreateScopeOp ( + void); + +void +AcpiPsInitOp ( + ACPI_PARSE_OBJECT *op, + UINT16 opcode); + +ACPI_PARSE_OBJECT * +AcpiPsAllocOp ( + UINT16 opcode); + +void +AcpiPsFreeOp ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiPsDeleteParseCache ( + void); + +BOOLEAN +AcpiPsIsLeadingChar ( + UINT32 c); + +BOOLEAN +AcpiPsIsPrefixChar ( + UINT32 c); + +UINT32 +AcpiPsGetName( + ACPI_PARSE_OBJECT *op); + +void +AcpiPsSetName( + ACPI_PARSE_OBJECT *op, + UINT32 name); + + +/* psdump - display parser tree */ + +UINT32 +AcpiPsSprintPath ( + char *BufferStart, + UINT32 BufferSize, + ACPI_PARSE_OBJECT *Op); + +UINT32 +AcpiPsSprintOp ( + char *BufferStart, + UINT32 BufferSize, + ACPI_PARSE_OBJECT *Op); + +void +AcpiPsShow ( + ACPI_PARSE_OBJECT *op); + + +#endif /* __ACPARSER_H__ */ diff --git a/source/include/acpi.h b/source/include/acpi.h new file mode 100644 index 000000000..293270890 --- /dev/null +++ b/source/include/acpi.h @@ -0,0 +1,142 @@ +/****************************************************************************** + * + * Name: acpi.h - Master include file, Publics and external data. + * $Revision: 1.56 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACPI_H__ +#define __ACPI_H__ + +/* + * Common includes for all ACPI driver files + * We put them here because we don't want to duplicate them + * in the rest of the source code again and again. + */ +#include "acconfig.h" /* Configuration constants */ +#include "platform/acenv.h" /* Target environment specific items */ +#include "actypes.h" /* Fundamental common data types */ +#include "acexcep.h" /* ACPI exception codes */ +#include "acmacros.h" /* C macros */ +#include "actbl.h" /* ACPI table definitions */ +#include "aclocal.h" /* Internal data types */ +#include "acoutput.h" /* Error output and Debug macros */ +#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer*/ +#include "acpixf.h" /* ACPI core subsystem external interfaces */ +#include "acobject.h" /* ACPI internal object */ +#include "acstruct.h" /* Common structures */ +#include "acglobal.h" /* All global variables */ +#include "achware.h" /* Hardware defines and interfaces */ +#include "acutils.h" /* Utility interfaces */ + + +#endif /* __ACPI_H__ */ diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h new file mode 100644 index 000000000..42e51a163 --- /dev/null +++ b/source/include/acpiosxf.h @@ -0,0 +1,413 @@ + +/****************************************************************************** + * + * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These + * interfaces must be implemented by OSL to interface the + * ACPI components to the host operating system. + * + *****************************************************************************/ + + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exer + se the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACPIOSXF_H__ +#define __ACPIOSXF_H__ + +#include "platform/acenv.h" +#include "actypes.h" + + +/* Priorities for AcpiOsQueueForExecution */ + +#define OSD_PRIORITY_GPE 1 +#define OSD_PRIORITY_HIGH 2 +#define OSD_PRIORITY_MED 3 +#define OSD_PRIORITY_LO 4 + +#define ACPI_NO_UNIT_LIMIT ((UINT32) -1) +#define ACPI_MUTEX_SEM 1 + + +/* Functions for AcpiOsSignal */ + +#define ACPI_SIGNAL_FATAL 0 +#define ACPI_SIGNAL_BREAKPOINT 1 + +typedef struct acpi_signal_fatal_info +{ + UINT32 Type; + UINT32 Code; + UINT32 Argument; + +} ACPI_SIGNAL_FATAL_INFO; + + +/* + * Types specific to the OS service interfaces + */ + +typedef UINT32 +(ACPI_SYSTEM_XFACE *OSD_HANDLER) ( + void *Context); + +typedef void +(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) ( + void *Context); + + +/* + * OSL Initialization and shutdown primitives + */ + +ACPI_STATUS +AcpiOsInitialize ( + void); + +ACPI_STATUS +AcpiOsTerminate ( + void); + + +/* + * ACPI Table interfaces + */ + +ACPI_STATUS +AcpiOsGetRootPointer ( + UINT32 Flags, + ACPI_POINTER *Address); + +ACPI_STATUS +AcpiOsTableOverride ( + ACPI_TABLE_HEADER *ExistingTable, + ACPI_TABLE_HEADER **NewTable); + + +/* + * Synchronization primitives + */ + +ACPI_STATUS +AcpiOsCreateSemaphore ( + UINT32 MaxUnits, + UINT32 InitialUnits, + ACPI_HANDLE *OutHandle); + +ACPI_STATUS +AcpiOsDeleteSemaphore ( + ACPI_HANDLE Handle); + +ACPI_STATUS +AcpiOsWaitSemaphore ( + ACPI_HANDLE Handle, + UINT32 Units, + UINT16 Timeout); + +ACPI_STATUS +AcpiOsSignalSemaphore ( + ACPI_HANDLE Handle, + UINT32 Units); + + +/* + * Memory allocation and mapping + */ + +void * +AcpiOsAllocate ( + ACPI_SIZE Size); + +void +AcpiOsFree ( + void * Memory); + +ACPI_STATUS +AcpiOsMapMemory ( + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_SIZE Size, + void **LogicalAddress); + +void +AcpiOsUnmapMemory ( + void *LogicalAddress, + ACPI_SIZE Size); + +ACPI_STATUS +AcpiOsGetPhysicalAddress ( + void *LogicalAddress, + ACPI_PHYSICAL_ADDRESS *PhysicalAddress); + + +/* + * Interrupt handlers + */ + +ACPI_STATUS +AcpiOsInstallInterruptHandler ( + UINT32 InterruptNumber, + OSD_HANDLER ServiceRoutine, + void *Context); + +ACPI_STATUS +AcpiOsRemoveInterruptHandler ( + UINT32 InterruptNumber, + OSD_HANDLER ServiceRoutine); + + +/* + * Threads and Scheduling + */ + +UINT32 +AcpiOsGetThreadId ( + void); + +ACPI_STATUS +AcpiOsQueueForExecution ( + UINT32 Priority, + OSD_EXECUTION_CALLBACK Function, + void *Context); + +void +AcpiOsSleep ( + UINT32 Seconds, + UINT32 Milliseconds); + +void +AcpiOsStall ( + UINT32 Microseconds); + + +/* + * Platform and hardware-independent I/O interfaces + */ + +ACPI_STATUS +AcpiOsReadPort ( + ACPI_IO_ADDRESS Address, + void *Value, + UINT32 Width); + +ACPI_STATUS +AcpiOsWritePort ( + ACPI_IO_ADDRESS Address, + ACPI_INTEGER Value, + UINT32 Width); + + +/* + * Platform and hardware-independent physical memory interfaces + */ + +ACPI_STATUS +AcpiOsReadMemory ( + ACPI_PHYSICAL_ADDRESS Address, + void *Value, + UINT32 Width); + +ACPI_STATUS +AcpiOsWriteMemory ( + ACPI_PHYSICAL_ADDRESS Address, + ACPI_INTEGER Value, + UINT32 Width); + + +/* + * Platform and hardware-independent PCI configuration space access + */ + +ACPI_STATUS +AcpiOsReadPciConfiguration ( + ACPI_PCI_ID *PciId, + UINT32 Register, + void *Value, + UINT32 Width); + +ACPI_STATUS +AcpiOsWritePciConfiguration ( + ACPI_PCI_ID *PciId, + UINT32 Register, + ACPI_INTEGER Value, + UINT32 Width); + +/* + * Interim function needed for PCI IRQ routing + */ +void +AcpiOsDerivePciId( + ACPI_HANDLE rhandle, + ACPI_HANDLE chandle, + ACPI_PCI_ID **PciId); + +/* + * Miscellaneous + */ + +BOOLEAN +AcpiOsReadable ( + void *Pointer, + UINT32 Length); + +BOOLEAN +AcpiOsWritable ( + void *Pointer, + UINT32 Length); + +UINT32 +AcpiOsGetTimer ( + void); + +ACPI_STATUS +AcpiOsSignal ( + UINT32 Function, + void *Info); + +/* + * Debug print routines + */ + +void ACPI_INTERNAL_VAR_XFACE +AcpiOsPrintf ( + const char *Format, + ...); + +void +AcpiOsVprintf ( + const char *Format, + va_list Args); + +void +AcpiOsRedirectOutput ( + void *Destination); + + +/* + * Debug input + */ + +UINT32 +AcpiOsGetLine ( + char *Buffer); + + +/* + * Debug + */ + +void +AcpiOsDbgAssert( + void *FailedAssertion, + void *FileName, + UINT32 LineNumber, + char *Message); + + +#endif /* __ACPIOSXF_H__ */ diff --git a/source/include/acpixf.h b/source/include/acpixf.h new file mode 100644 index 000000000..e7b4cb52f --- /dev/null +++ b/source/include/acpixf.h @@ -0,0 +1,478 @@ + +/****************************************************************************** + * + * Name: acpixf.h - External interfaces to the ACPI subsystem + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + + +#ifndef __ACXFACE_H__ +#define __ACXFACE_H__ + +#include "actypes.h" +#include "actbl.h" + + + /* + * Global interfaces + */ + +ACPI_STATUS +AcpiInitializeSubsystem ( + void); + +ACPI_STATUS +AcpiEnableSubsystem ( + UINT32 Flags); + +ACPI_STATUS +AcpiInitializeObjects ( + UINT32 Flags); + +ACPI_STATUS +AcpiTerminate ( + void); + +ACPI_STATUS +AcpiSubsystemStatus ( + void); + +ACPI_STATUS +AcpiEnable ( + void); + +ACPI_STATUS +AcpiDisable ( + void); + +ACPI_STATUS +AcpiGetSystemInfo ( + ACPI_BUFFER *RetBuffer); + +const char * +AcpiFormatException ( + ACPI_STATUS Exception); + +ACPI_STATUS +AcpiPurgeCachedObjects ( + void); + +ACPI_STATUS +AcpiInstallInitializationHandler ( + ACPI_INIT_HANDLER Handler, + UINT32 Function); + +/* + * ACPI Memory manager + */ + +void * +AcpiAllocate ( + UINT32 Size); + +void * +AcpiCallocate ( + UINT32 Size); + +void +AcpiFree ( + void *Address); + + +/* + * ACPI table manipulation interfaces + */ + +ACPI_STATUS +AcpiFindRootPointer ( + UINT32 Flags, + ACPI_POINTER *RsdpAddress); + +ACPI_STATUS +AcpiLoadTables ( + void); + +ACPI_STATUS +AcpiLoadTable ( + ACPI_TABLE_HEADER *TablePtr); + +ACPI_STATUS +AcpiUnloadTable ( + ACPI_TABLE_TYPE TableType); + +ACPI_STATUS +AcpiGetTableHeader ( + ACPI_TABLE_TYPE TableType, + UINT32 Instance, + ACPI_TABLE_HEADER *OutTableHeader); + +ACPI_STATUS +AcpiGetTable ( + ACPI_TABLE_TYPE TableType, + UINT32 Instance, + ACPI_BUFFER *RetBuffer); + +ACPI_STATUS +AcpiGetFirmwareTable ( + ACPI_STRING Signature, + UINT32 Instance, + UINT32 Flags, + ACPI_TABLE_HEADER **TablePointer); + + +/* + * Namespace and name interfaces + */ + +ACPI_STATUS +AcpiWalkNamespace ( + ACPI_OBJECT_TYPE Type, + ACPI_HANDLE StartObject, + UINT32 MaxDepth, + ACPI_WALK_CALLBACK UserFunction, + void *Context, + void * *ReturnValue); + +ACPI_STATUS +AcpiGetDevices ( + char *HID, + ACPI_WALK_CALLBACK UserFunction, + void *Context, + void **ReturnValue); + +ACPI_STATUS +AcpiGetName ( + ACPI_HANDLE Handle, + UINT32 NameType, + ACPI_BUFFER *RetPathPtr); + +ACPI_STATUS +AcpiGetHandle ( + ACPI_HANDLE Parent, + ACPI_STRING Pathname, + ACPI_HANDLE *RetHandle); + +ACPI_STATUS +AcpiAttachData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler, + void *Data); + +ACPI_STATUS +AcpiDetachData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler); + +ACPI_STATUS +AcpiGetData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler, + void **Data); + + +/* + * Object manipulation and enumeration + */ + +ACPI_STATUS +AcpiEvaluateObject ( + ACPI_HANDLE Object, + ACPI_STRING Pathname, + ACPI_OBJECT_LIST *ParameterObjects, + ACPI_BUFFER *ReturnObjectBuffer); + +ACPI_STATUS +AcpiEvaluateObjectTyped ( + ACPI_HANDLE Object, + ACPI_STRING Pathname, + ACPI_OBJECT_LIST *ExternalParams, + ACPI_BUFFER *ReturnBuffer, + ACPI_OBJECT_TYPE ReturnType); + +ACPI_STATUS +AcpiGetObjectInfo ( + ACPI_HANDLE Device, + ACPI_DEVICE_INFO *Info); + +ACPI_STATUS +AcpiGetNextObject ( + ACPI_OBJECT_TYPE Type, + ACPI_HANDLE Parent, + ACPI_HANDLE Child, + ACPI_HANDLE *OutHandle); + +ACPI_STATUS +AcpiGetType ( + ACPI_HANDLE Object, + ACPI_OBJECT_TYPE *OutType); + +ACPI_STATUS +AcpiGetParent ( + ACPI_HANDLE Object, + ACPI_HANDLE *OutHandle); + + +/* + * Event handler interfaces + */ + +ACPI_STATUS +AcpiInstallFixedEventHandler ( + UINT32 AcpiEvent, + ACPI_EVENT_HANDLER Handler, + void *Context); + +ACPI_STATUS +AcpiRemoveFixedEventHandler ( + UINT32 AcpiEvent, + ACPI_EVENT_HANDLER Handler); + +ACPI_STATUS +AcpiInstallNotifyHandler ( + ACPI_HANDLE Device, + UINT32 HandlerType, + ACPI_NOTIFY_HANDLER Handler, + void *Context); + +ACPI_STATUS +AcpiRemoveNotifyHandler ( + ACPI_HANDLE Device, + UINT32 HandlerType, + ACPI_NOTIFY_HANDLER Handler); + +ACPI_STATUS +AcpiInstallAddressSpaceHandler ( + ACPI_HANDLE Device, + ACPI_ADR_SPACE_TYPE SpaceId, + ACPI_ADR_SPACE_HANDLER Handler, + ACPI_ADR_SPACE_SETUP Setup, + void *Context); + +ACPI_STATUS +AcpiRemoveAddressSpaceHandler ( + ACPI_HANDLE Device, + ACPI_ADR_SPACE_TYPE SpaceId, + ACPI_ADR_SPACE_HANDLER Handler); + +ACPI_STATUS +AcpiInstallGpeHandler ( + UINT32 GpeNumber, + UINT32 Type, + ACPI_GPE_HANDLER Handler, + void *Context); + +ACPI_STATUS +AcpiAcquireGlobalLock ( + UINT16 Timeout, + UINT32 *Handle); + +ACPI_STATUS +AcpiReleaseGlobalLock ( + UINT32 Handle); + +ACPI_STATUS +AcpiRemoveGpeHandler ( + UINT32 GpeNumber, + ACPI_GPE_HANDLER Handler); + +ACPI_STATUS +AcpiEnableEvent ( + UINT32 AcpiEvent, + UINT32 Type, + UINT32 Flags); + +ACPI_STATUS +AcpiDisableEvent ( + UINT32 AcpiEvent, + UINT32 Type, + UINT32 Flags); + +ACPI_STATUS +AcpiClearEvent ( + UINT32 AcpiEvent, + UINT32 Type); + +ACPI_STATUS +AcpiGetEventStatus ( + UINT32 AcpiEvent, + UINT32 Type, + ACPI_EVENT_STATUS *EventStatus); + +/* + * Resource interfaces + */ + +ACPI_STATUS +AcpiGetCurrentResources( + ACPI_HANDLE DeviceHandle, + ACPI_BUFFER *RetBuffer); + +ACPI_STATUS +AcpiGetPossibleResources( + ACPI_HANDLE DeviceHandle, + ACPI_BUFFER *RetBuffer); + +ACPI_STATUS +AcpiSetCurrentResources ( + ACPI_HANDLE DeviceHandle, + ACPI_BUFFER *InBuffer); + +ACPI_STATUS +AcpiGetIrqRoutingTable ( + ACPI_HANDLE BusDeviceHandle, + ACPI_BUFFER *RetBuffer); + + +/* + * Hardware (ACPI device) interfaces + */ + +ACPI_STATUS +AcpiGetRegister ( + UINT32 RegisterId, + UINT32 *ReturnValue, + UINT32 Flags); + +ACPI_STATUS +AcpiSetRegister ( + UINT32 RegisterId, + UINT32 Value, + UINT32 Flags); + +ACPI_STATUS +AcpiSetFirmwareWakingVector ( + ACPI_PHYSICAL_ADDRESS PhysicalAddress); + +ACPI_STATUS +AcpiGetFirmwareWakingVector ( + ACPI_PHYSICAL_ADDRESS *PhysicalAddress); + +ACPI_STATUS +AcpiGetSleepTypeData ( + UINT8 SleepState, + UINT8 *Slp_TypA, + UINT8 *Slp_TypB); + +ACPI_STATUS +AcpiEnterSleepStatePrep ( + UINT8 SleepState); + +ACPI_STATUS +AcpiEnterSleepState ( + UINT8 SleepState); + +ACPI_STATUS +AcpiLeaveSleepState ( + UINT8 SleepState); + + +#endif /* __ACXFACE_H__ */ diff --git a/source/include/acresrc.h b/source/include/acresrc.h new file mode 100644 index 000000000..55a04596b --- /dev/null +++ b/source/include/acresrc.h @@ -0,0 +1,459 @@ +/****************************************************************************** + * + * Name: acresrc.h - Resource Manager function prototypes + * $Revision: 1.35 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACRESRC_H__ +#define __ACRESRC_H__ + + +/* + * Function prototypes called from Acpi* APIs + */ + +ACPI_STATUS +AcpiRsGetPrtMethodData ( + ACPI_HANDLE Handle, + ACPI_BUFFER *RetBuffer); + + +ACPI_STATUS +AcpiRsGetCrsMethodData ( + ACPI_HANDLE Handle, + ACPI_BUFFER *RetBuffer); + +ACPI_STATUS +AcpiRsGetPrsMethodData ( + ACPI_HANDLE Handle, + ACPI_BUFFER *RetBuffer); + +ACPI_STATUS +AcpiRsSetSrsMethodData ( + ACPI_HANDLE Handle, + ACPI_BUFFER *RetBuffer); + +ACPI_STATUS +AcpiRsCreateResourceList ( + ACPI_OPERAND_OBJECT *ByteStreamBuffer, + ACPI_BUFFER *OutputBuffer); + +ACPI_STATUS +AcpiRsCreateByteStream ( + ACPI_RESOURCE *LinkedListBuffer, + ACPI_BUFFER *OutputBuffer); + +ACPI_STATUS +AcpiRsCreatePciRoutingTable ( + ACPI_OPERAND_OBJECT *PackageObject, + ACPI_BUFFER *OutputBuffer); + + +/* + * Function prototypes called from AcpiRsCreate* + */ +void +AcpiRsDumpIrq ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpAddress16 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpAddress32 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpAddress64 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpDma ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpIo ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpExtendedIrq ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpFixedIo ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpFixedMemory32 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpMemory24 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpMemory32 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpStartDependFns ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpVendorSpecific ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpResourceList ( + ACPI_RESOURCE *Resource); + +void +AcpiRsDumpIrqList ( + UINT8 *RouteTable); + +ACPI_STATUS +AcpiRsGetByteStreamStart ( + UINT8 *ByteStreamBuffer, + UINT8 **ByteStreamStart, + UINT32 *Size); + +ACPI_STATUS +AcpiRsGetListLength ( + UINT8 *ByteStreamBuffer, + UINT32 ByteStreamBufferLength, + ACPI_SIZE *SizeNeeded); + +ACPI_STATUS +AcpiRsGetByteStreamLength ( + ACPI_RESOURCE *LinkedListBuffer, + ACPI_SIZE *SizeNeeded); + +ACPI_STATUS +AcpiRsGetPciRoutingTableLength ( + ACPI_OPERAND_OBJECT *PackageObject, + ACPI_SIZE *BufferSizeNeeded); + +ACPI_STATUS +AcpiRsByteStreamToList ( + UINT8 *ByteStreamBuffer, + UINT32 ByteStreamBufferLength, + UINT8 *OutputBuffer); + +ACPI_STATUS +AcpiRsListToByteStream ( + ACPI_RESOURCE *LinkedList, + ACPI_SIZE ByteStreamSizeNeeded, + UINT8 *OutputBuffer); + +ACPI_STATUS +AcpiRsIoResource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsFixedIoResource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsIoStream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsFixedIoStream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsIrqResource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsIrqStream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsDmaResource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsDmaStream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsAddress16Resource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsAddress16Stream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsAddress32Resource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsAddress32Stream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsAddress64Resource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsAddress64Stream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsStartDependFnsResource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsEndDependFnsResource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsStartDependFnsStream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsEndDependFnsStream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsMemory24Resource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsMemory24Stream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsMemory32RangeResource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsFixedMemory32Resource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsMemory32RangeStream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsFixedMemory32Stream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsExtendedIrqResource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsExtendedIrqStream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsEndTagResource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsEndTagStream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +ACPI_STATUS +AcpiRsVendorResource ( + UINT8 *ByteStreamBuffer, + ACPI_SIZE *BytesConsumed, + UINT8 **OutputBuffer, + ACPI_SIZE *StructureSize); + +ACPI_STATUS +AcpiRsVendorStream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + ACPI_SIZE *BytesConsumed); + +UINT8 +AcpiRsGetResourceType ( + UINT8 ResourceStartByte); + +#endif /* __ACRESRC_H__ */ diff --git a/source/include/acstruct.h b/source/include/acstruct.h new file mode 100644 index 000000000..c428167ac --- /dev/null +++ b/source/include/acstruct.h @@ -0,0 +1,281 @@ +/****************************************************************************** + * + * Name: acstruct.h - Internal structs + * $Revision: 1.25 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACSTRUCT_H__ +#define __ACSTRUCT_H__ + + +/***************************************************************************** + * + * Tree walking typedefs and structs + * + ****************************************************************************/ + + +/* + * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through + * the tree (for whatever reason), and for control method execution. + */ + +#define ACPI_NEXT_OP_DOWNWARD 1 +#define ACPI_NEXT_OP_UPWARD 2 + +#define ACPI_WALK_NON_METHOD 0 +#define ACPI_WALK_METHOD 1 +#define ACPI_WALK_METHOD_RESTART 2 +#define ACPI_WALK_CONST_REQUIRED 3 +#define ACPI_WALK_CONST_OPTIONAL 4 + +typedef struct acpi_walk_state +{ + UINT8 DataType; /* To differentiate various internal objs MUST BE FIRST!*/\ + ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */ + BOOLEAN LastPredicate; /* Result of last predicate */ + UINT8 CurrentResult; /* */ + UINT8 NextOpInfo; /* Info about NextOp */ + UINT8 NumOperands; /* Stack pointer for Operands[] array */ + UINT8 ReturnUsed; + UINT8 WalkType; + UINT16 Opcode; /* Current AML opcode */ + UINT8 ScopeDepth; + UINT8 Reserved1; + UINT32 ArgCount; /* push for fixed or var args */ + UINT32 AmlOffset; + UINT32 ArgTypes; + UINT32 MethodBreakpoint; /* For single stepping */ + UINT32 UserBreakpoint; /* User AML breakpoint */ + UINT32 ParseFlags; + UINT32 PrevArgTypes; + + UINT8 *AmlLastWhile; + struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ + union acpi_operand_object **CallerReturnDesc; + ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */ + struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ + struct acpi_namespace_node *MethodCallNode; /* Called method Node*/ + ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */ + union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */ + struct acpi_namespace_node *MethodNode; /* Method Node if running a method */ + ACPI_PARSE_OBJECT *Op; /* Current parser op */ + union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ + const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */ + ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */ + union acpi_operand_object **Params; + ACPI_PARSE_STATE ParserState; /* Current state of parser */ + union acpi_operand_object *ResultObj; + ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */ + union acpi_operand_object *ReturnDesc; /* Return object, if any */ + ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */ + + ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */ + ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */ + ACPI_PARSE_DOWNWARDS DescendingCallback; + ACPI_PARSE_UPWARDS AscendingCallback; + ACPI_THREAD_STATE *Thread; + struct acpi_walk_state *Next; /* Next WalkState in list */ + +} ACPI_WALK_STATE; + + +/* Info used by AcpiPsInitObjects */ + +typedef struct acpi_init_walk_info +{ + UINT16 MethodCount; + UINT16 DeviceCount; + UINT16 OpRegionCount; + UINT16 FieldCount; + UINT16 BufferCount; + UINT16 PackageCount; + UINT16 OpRegionInit; + UINT16 FieldInit; + UINT16 BufferInit; + UINT16 PackageInit; + UINT16 ObjectCount; + ACPI_TABLE_DESC *TableDesc; + +} ACPI_INIT_WALK_INFO; + + +/* Info used by AcpiNsInitializeDevices */ + +typedef struct acpi_device_walk_info +{ + UINT16 DeviceCount; + UINT16 Num_STA; + UINT16 Num_INI; + ACPI_TABLE_DESC *TableDesc; + +} ACPI_DEVICE_WALK_INFO; + + +/* TBD: [Restructure] Merge with struct above */ + +typedef struct acpi_walk_info +{ + UINT32 DebugLevel; + UINT32 OwnerId; + UINT8 DisplayType; + +} ACPI_WALK_INFO; + +/* Display Types */ + +#define ACPI_DISPLAY_SUMMARY 0 +#define ACPI_DISPLAY_OBJECTS 1 + +typedef struct acpi_get_devices_info +{ + ACPI_WALK_CALLBACK UserFunction; + void *Context; + char *Hid; + +} ACPI_GET_DEVICES_INFO; + + +typedef union acpi_aml_operands +{ + ACPI_OPERAND_OBJECT *Operands[7]; + + struct + { + ACPI_OBJECT_INTEGER *Type; + ACPI_OBJECT_INTEGER *Code; + ACPI_OBJECT_INTEGER *Argument; + + } Fatal; + + struct + { + ACPI_OPERAND_OBJECT *Source; + ACPI_OBJECT_INTEGER *Index; + ACPI_OPERAND_OBJECT *Target; + + } Index; + + struct + { + ACPI_OPERAND_OBJECT *Source; + ACPI_OBJECT_INTEGER *Index; + ACPI_OBJECT_INTEGER *Length; + ACPI_OPERAND_OBJECT *Target; + + } Mid; + +} ACPI_AML_OPERANDS; + + +#endif diff --git a/source/include/actables.h b/source/include/actables.h new file mode 100644 index 000000000..fa05e36bb --- /dev/null +++ b/source/include/actables.h @@ -0,0 +1,310 @@ +/****************************************************************************** + * + * Name: actables.h - ACPI table management + * $Revision: 1.44 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACTABLES_H__ +#define __ACTABLES_H__ + + +/* Used in AcpiTbMapAcpiTable for size parameter if table header is to be used */ + +#define SIZE_IN_HEADER 0 + + +ACPI_STATUS +AcpiTbHandleToObject ( + UINT16 TableId, + ACPI_TABLE_DESC **TableDesc); + +/* + * tbconvrt - Table conversion routines + */ + +ACPI_STATUS +AcpiTbConvertToXsdt ( + ACPI_TABLE_DESC *TableInfo); + +ACPI_STATUS +AcpiTbConvertTableFadt ( + void); + +ACPI_STATUS +AcpiTbBuildCommonFacs ( + ACPI_TABLE_DESC *TableInfo); + +UINT32 +AcpiTbGetTableCount ( + RSDP_DESCRIPTOR *RSDP, + ACPI_TABLE_HEADER *RSDT); + +/* + * tbget - Table "get" routines + */ + +ACPI_STATUS +AcpiTbGetTable ( + ACPI_POINTER *Address, + ACPI_TABLE_DESC *TableInfo); + +ACPI_STATUS +AcpiTbGetTableHeader ( + ACPI_POINTER *Address, + ACPI_TABLE_HEADER *ReturnHeader); + +ACPI_STATUS +AcpiTbGetTableBody ( + ACPI_POINTER *Address, + ACPI_TABLE_HEADER *Header, + ACPI_TABLE_DESC *TableInfo); + +ACPI_STATUS +AcpiTbGetThisTable ( + ACPI_POINTER *Address, + ACPI_TABLE_HEADER *Header, + ACPI_TABLE_DESC *TableInfo); + +ACPI_STATUS +AcpiTbTableOverride ( + ACPI_TABLE_HEADER *Header, + ACPI_TABLE_DESC *TableInfo); + +ACPI_STATUS +AcpiTbGetTablePtr ( + ACPI_TABLE_TYPE TableType, + UINT32 Instance, + ACPI_TABLE_HEADER **TablePtrLoc); + +ACPI_STATUS +AcpiTbVerifyRsdp ( + ACPI_POINTER *Address); + +void +AcpiTbGetRsdtAddress ( + ACPI_POINTER *OutAddress); + +ACPI_STATUS +AcpiTbValidateRsdt ( + ACPI_TABLE_HEADER *TablePtr); + +ACPI_STATUS +AcpiTbGetRequiredTables ( + void); + +ACPI_STATUS +AcpiTbGetPrimaryTable ( + ACPI_POINTER *Address, + ACPI_TABLE_DESC *TableInfo); + +ACPI_STATUS +AcpiTbGetSecondaryTable ( + ACPI_POINTER *Address, + ACPI_STRING Signature, + ACPI_TABLE_DESC *TableInfo); + +/* + * tbinstall - Table installation + */ + +ACPI_STATUS +AcpiTbInstallTable ( + ACPI_TABLE_DESC *TableInfo); + +ACPI_STATUS +AcpiTbMatchSignature ( + char *Signature, + ACPI_TABLE_DESC *TableInfo, + UINT8 SearchType); + +ACPI_STATUS +AcpiTbRecognizeTable ( + ACPI_TABLE_DESC *TableInfo, + UINT8 SearchType); + +ACPI_STATUS +AcpiTbInitTableDescriptor ( + ACPI_TABLE_TYPE TableType, + ACPI_TABLE_DESC *TableInfo); + + +/* + * tbremove - Table removal and deletion + */ + +void +AcpiTbDeleteAcpiTables ( + void); + +void +AcpiTbDeleteAcpiTable ( + ACPI_TABLE_TYPE Type); + +void +AcpiTbDeleteSingleTable ( + ACPI_TABLE_DESC *TableDesc); + +ACPI_TABLE_DESC * +AcpiTbUninstallTable ( + ACPI_TABLE_DESC *TableDesc); + +void +AcpiTbFreeAcpiTablesOfType ( + ACPI_TABLE_DESC *TableInfo); + + +/* + * tbrsd - RSDP, RSDT utilities + */ + +ACPI_STATUS +AcpiTbGetTableRsdt ( + void); + +UINT8 * +AcpiTbScanMemoryForRsdp ( + UINT8 *StartAddress, + UINT32 Length); + +ACPI_STATUS +AcpiTbFindRsdp ( + ACPI_TABLE_DESC *TableInfo, + UINT32 Flags); + + +/* + * tbutils - common table utilities + */ + +ACPI_STATUS +AcpiTbFindTable ( + char *Signature, + char *OemId, + char *OemTableId, + ACPI_TABLE_HEADER **TablePtr); + +ACPI_STATUS +AcpiTbVerifyTableChecksum ( + ACPI_TABLE_HEADER *TableHeader); + +UINT8 +AcpiTbChecksum ( + void *Buffer, + UINT32 Length); + +ACPI_STATUS +AcpiTbValidateTableHeader ( + ACPI_TABLE_HEADER *TableHeader); + + +#endif /* __ACTABLES_H__ */ diff --git a/source/include/actbl.h b/source/include/actbl.h new file mode 100644 index 000000000..46be60123 --- /dev/null +++ b/source/include/actbl.h @@ -0,0 +1,308 @@ +/****************************************************************************** + * + * Name: actbl.h - Table data structures defined in ACPI specification + * $Revision: 1.56 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACTBL_H__ +#define __ACTBL_H__ + + +/* + * Values for description table header signatures + */ +#define RSDP_NAME "RSDP" +#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ +#define APIC_SIG "APIC" /* Multiple APIC Description Table */ +#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ +#define FADT_SIG "FACP" /* Fixed ACPI Description Table */ +#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ +#define PSDT_SIG "PSDT" /* Persistent System Description Table */ +#define RSDT_SIG "RSDT" /* Root System Description Table */ +#define XSDT_SIG "XSDT" /* Extended System Description Table */ +#define SSDT_SIG "SSDT" /* Secondary System Description Table */ +#define SBST_SIG "SBST" /* Smart Battery Specification Table */ +#define SPIC_SIG "SPIC" /* IOSAPIC table */ +#define BOOT_SIG "BOOT" /* Boot table */ + + +#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ + +/* values of Mapic.Model */ + +#define DUAL_PIC 0 +#define MULTIPLE_APIC 1 + +/* values of Type in APIC_HEADER */ + +#define APIC_PROC 0 +#define APIC_IO 1 + + +/* + * Common table types. The base code can remain + * constant if the underlying tables are changed + */ +#define RSDT_DESCRIPTOR RSDT_DESCRIPTOR_REV2 +#define XSDT_DESCRIPTOR XSDT_DESCRIPTOR_REV2 +#define FACS_DESCRIPTOR FACS_DESCRIPTOR_REV2 +#define FADT_DESCRIPTOR FADT_DESCRIPTOR_REV2 + + +#pragma pack(1) + +/* + * Architecture-independent tables + * The architecture dependent tables are in separate files + */ +typedef struct rsdp_descriptor /* Root System Descriptor Pointer */ +{ + char Signature [8]; /* ACPI signature, contains "RSD PTR " */ + UINT8 Checksum; /* To make sum of struct == 0 */ + char OemId [6]; /* OEM identification */ + UINT8 Revision; /* Must be 0 for 1.0, 2 for 2.0 */ + UINT32 RsdtPhysicalAddress; /* 32-bit physical address of RSDT */ + UINT32 Length; /* XSDT Length in bytes including hdr */ + UINT64 XsdtPhysicalAddress; /* 64-bit physical address of XSDT */ + UINT8 ExtendedChecksum; /* Checksum of entire table */ + char Reserved [3]; /* Reserved field must be 0 */ + +} RSDP_DESCRIPTOR; + + +typedef struct acpi_table_header /* ACPI common table header */ +{ + char Signature [4]; /* ACPI signature (4 ASCII characters) */ + UINT32 Length; /* Length of table, in bytes, including header */ + UINT8 Revision; /* ACPI Specification minor version # */ + UINT8 Checksum; /* To make sum of entire table == 0 */ + char OemId [6]; /* OEM identification */ + char OemTableId [8]; /* OEM table identification */ + UINT32 OemRevision; /* OEM revision number */ + char AslCompilerId [4]; /* ASL compiler vendor ID */ + UINT32 AslCompilerRevision; /* ASL compiler revision number */ + +} ACPI_TABLE_HEADER; + + +typedef struct acpi_common_facs /* Common FACS for internal use */ +{ + UINT32 *GlobalLock; + UINT64 *FirmwareWakingVector; + UINT8 VectorWidth; + +} ACPI_COMMON_FACS; + + +typedef struct /* APIC Table */ +{ + ACPI_TABLE_HEADER Header; /* ACPI table header */ + UINT32 LocalApicAddress; /* Physical address for accessing local APICs */ + UINT32_BIT PCATCompat : 1; /* a one indicates system also has dual 8259s */ + UINT32_BIT Reserved1 : 31; + +} APIC_TABLE; + + +typedef struct /* APIC Header */ +{ + UINT8 Type; /* APIC type. Either APIC_PROC or APIC_IO */ + UINT8 Length; /* Length of APIC structure */ + +} APIC_HEADER; + + +typedef struct /* Processor APIC */ +{ + APIC_HEADER Header; + UINT8 ProcessorApicId; /* ACPI processor id */ + UINT8 LocalApicId; /* Processor's local APIC id */ + UINT32_BIT ProcessorEnabled: 1; /* Processor is usable if set */ + UINT32_BIT Reserved1 : 31; + +} PROCESSOR_APIC; + + +typedef struct /* IO APIC */ +{ + APIC_HEADER Header; + UINT8 IoApicId; /* I/O APIC ID */ + UINT8 Reserved; /* Reserved - must be zero */ + UINT32 IoApicAddress; /* APIC's physical address */ + UINT32 Vector; /* Interrupt vector index where INTI + * lines start */ +} IO_APIC; + + +/* + * IA64 TBD: Add SAPIC Tables + */ + +/* + * IA64 TBD: Modify Smart Battery Description to comply with ACPI IA64 + * extensions. + */ +typedef struct /* Smart Battery Description Table */ +{ + ACPI_TABLE_HEADER Header; + UINT32 WarningLevel; + UINT32 LowLevel; + UINT32 CriticalLevel; + +} SMART_BATTERY_DESCRIPTION_TABLE; + + +#pragma pack() + + +/* + * ACPI Table information. We save the table address, length, + * and type of memory allocation (mapped or allocated) for each + * table for 1) when we exit, and 2) if a new table is installed + */ +#define ACPI_MEM_NOT_ALLOCATED 0 +#define ACPI_MEM_ALLOCATED 1 +#define ACPI_MEM_MAPPED 2 + +/* Definitions for the Flags bitfield member of ACPI_TABLE_SUPPORT */ + +#define ACPI_TABLE_SINGLE 0x00 +#define ACPI_TABLE_MULTIPLE 0x01 +#define ACPI_TABLE_EXECUTABLE 0x02 + +#define ACPI_TABLE_ROOT 0x00 +#define ACPI_TABLE_PRIMARY 0x10 +#define ACPI_TABLE_SECONDARY 0x20 +#define ACPI_TABLE_OTHER 0x30 +#define ACPI_TABLE_TYPE_MASK 0x30 + +/* Data about each known table type */ + +typedef struct _AcpiTableSupport +{ + char *Name; + char *Signature; + void **GlobalPtr; + UINT8 SigLength; + UINT8 Flags; + +} ACPI_TABLE_SUPPORT; + + +/* + * Get the architecture-specific tables + */ +#include "actbl1.h" /* Acpi 1.0 table definitions */ +#include "actbl2.h" /* Acpi 2.0 table definitions */ + +#endif /* __ACTBL_H__ */ diff --git a/source/include/actbl1.h b/source/include/actbl1.h new file mode 100644 index 000000000..c15c38044 --- /dev/null +++ b/source/include/actbl1.h @@ -0,0 +1,211 @@ +/****************************************************************************** + * + * Name: actbl1.h - ACPI 1.0 tables + * $Revision: 1.26 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACTBL1_H__ +#define __ACTBL1_H__ + +#pragma pack(1) + +/* + * ACPI 1.0 Root System Description Table (RSDT) + */ +typedef struct rsdt_descriptor_rev1 +{ + ACPI_TABLE_HEADER Header; /* ACPI Table header */ + UINT32 TableOffsetEntry [1]; /* Array of pointers to other */ + /* ACPI tables */ +} RSDT_DESCRIPTOR_REV1; + + +/* + * ACPI 1.0 Firmware ACPI Control Structure (FACS) + */ +typedef struct facs_descriptor_rev1 +{ + char Signature[4]; /* ACPI Signature */ + UINT32 Length; /* Length of structure, in bytes */ + UINT32 HardwareSignature; /* Hardware configuration signature */ + UINT32 FirmwareWakingVector; /* ACPI OS waking vector */ + UINT32 GlobalLock; /* Global Lock */ + UINT32_BIT S4Bios_f : 1; /* Indicates if S4BIOS support is present */ + UINT32_BIT Reserved1 : 31; /* Must be 0 */ + UINT8 Resverved3 [40]; /* Reserved - must be zero */ + +} FACS_DESCRIPTOR_REV1; + + +/* + * ACPI 1.0 Fixed ACPI Description Table (FADT) + */ +typedef struct fadt_descriptor_rev1 +{ + ACPI_TABLE_HEADER Header; /* ACPI Table header */ + UINT32 FirmwareCtrl; /* Physical address of FACS */ + UINT32 Dsdt; /* Physical address of DSDT */ + UINT8 Model; /* System Interrupt Model */ + UINT8 Reserved1; /* Reserved */ + UINT16 SciInt; /* System vector of SCI interrupt */ + UINT32 SmiCmd; /* Port address of SMI command port */ + UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */ + UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */ + UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */ + UINT8 Reserved2; /* Reserved - must be zero */ + UINT32 Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */ + UINT32 Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */ + UINT32 Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */ + UINT32 Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */ + UINT32 Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */ + UINT32 PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ + UINT32 Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */ + UINT32 Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */ + UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */ + UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */ + UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */ + UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */ + UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */ + UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */ + UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */ + UINT8 Reserved3; /* Reserved */ + UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */ + UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */ + UINT16 FlushSize; /* Size of area read to flush caches */ + UINT16 FlushStride; /* Stride used in flushing caches */ + UINT8 DutyOffset; /* Bit location of duty cycle field in p_cnt reg */ + UINT8 DutyWidth; /* Bit width of duty cycle field in p_cnt reg */ + UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */ + UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */ + UINT8 Century; /* Index to century in RTC CMOS RAM */ + UINT8 Reserved4; /* Reserved */ + UINT8 Reserved4a; /* Reserved */ + UINT8 Reserved4b; /* Reserved */ + UINT32_BIT WbInvd : 1; /* The wbinvd instruction works properly */ + UINT32_BIT WbInvdFlush : 1; /* The wbinvd flushes but does not invalidate */ + UINT32_BIT ProcC1 : 1; /* All processors support C1 state */ + UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */ + UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */ + UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */ + UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */ + UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ + UINT32_BIT TmrValExt : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */ + UINT32_BIT Reserved5 : 23; /* Reserved - must be zero */ + +} FADT_DESCRIPTOR_REV1; + +#pragma pack() + +#endif /* __ACTBL1_H__ */ + + diff --git a/source/include/actbl2.h b/source/include/actbl2.h new file mode 100644 index 000000000..64eae0e9b --- /dev/null +++ b/source/include/actbl2.h @@ -0,0 +1,277 @@ +/****************************************************************************** + * + * Name: actbl2.h - ACPI Specification Revision 2.0 Tables + * $Revision: 1.32 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACTBL2_H__ +#define __ACTBL2_H__ + +/* + * Prefered Power Management Profiles + */ +#define PM_UNSPECIFIED 0 +#define PM_DESKTOP 1 +#define PM_MOBILE 2 +#define PM_WORKSTATION 3 +#define PM_ENTERPRISE_SERVER 4 +#define PM_SOHO_SERVER 5 +#define PM_APPLIANCE_PC 6 + +/* + * ACPI Boot Arch Flags + */ +#define BAF_LEGACY_DEVICES 0x0001 +#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 + +#define FADT2_REVISION_ID 3 + + +#pragma pack(1) + +/* + * ACPI 2.0 Root System Description Table (RSDT) + */ +typedef struct rsdt_descriptor_rev2 +{ + ACPI_TABLE_HEADER Header; /* ACPI table header */ + UINT32 TableOffsetEntry [1]; /* Array of pointers to */ + /* ACPI table headers */ +} RSDT_DESCRIPTOR_REV2; + + +/* + * ACPI 2.0 Extended System Description Table (XSDT) + */ +typedef struct xsdt_descriptor_rev2 +{ + ACPI_TABLE_HEADER Header; /* ACPI table header */ + UINT64 TableOffsetEntry [1]; /* Array of pointers to */ + /* ACPI table headers */ +} XSDT_DESCRIPTOR_REV2; + + +/* + * ACPI 2.0 Firmware ACPI Control Structure (FACS) + */ +typedef struct facs_descriptor_rev2 +{ + char Signature[4]; /* ACPI signature */ + UINT32 Length; /* Length of structure, in bytes */ + UINT32 HardwareSignature; /* Hardware configuration signature */ + UINT32 FirmwareWakingVector; /* 32bit physical address of the Firmware Waking Vector. */ + UINT32 GlobalLock; /* Global Lock used to synchronize access to shared hardware resources */ + UINT32 S4Bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */ + UINT32_BIT Reserved1 : 31; /* Must be 0 */ + UINT64 XFirmwareWakingVector; /* 64bit physical address of the Firmware Waking Vector. */ + UINT8 Version; /* Version of this table */ + UINT8 Reserved3 [31]; /* Reserved - must be zero */ + +} FACS_DESCRIPTOR_REV2; + + +/* + * ACPI 2.0 Generic Address Structure (GAS) + */ +typedef struct acpi_generic_address +{ + UINT8 AddressSpaceId; /* Address space where struct or register exists. */ + UINT8 RegisterBitWidth; /* Size in bits of given register */ + UINT8 RegisterBitOffset; /* Bit offset within the register */ + UINT8 Reserved; /* Must be 0 */ + UINT64 Address; /* 64-bit address of struct or register */ + +} ACPI_GENERIC_ADDRESS; + + +/* + * ACPI 2.0 Fixed ACPI Description Table (FADT) + */ +typedef struct fadt_descriptor_rev2 +{ + ACPI_TABLE_HEADER Header; /* ACPI table header */ + UINT32 V1_FirmwareCtrl; /* 32-bit physical address of FACS */ + UINT32 V1_Dsdt; /* 32-bit physical address of DSDT */ + UINT8 Reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ + UINT8 Prefer_PM_Profile; /* Conveys preferred power management profile to OSPM. */ + UINT16 SciInt; /* System vector of SCI interrupt */ + UINT32 SmiCmd; /* Port address of SMI command port */ + UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */ + UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */ + UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */ + UINT8 PstateCnt; /* Processor performance state control*/ + UINT32 V1_Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */ + UINT32 V1_Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */ + UINT32 V1_Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */ + UINT32 V1_Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */ + UINT32 V1_Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */ + UINT32 V1_PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ + UINT32 V1_Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */ + UINT32 V1_Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */ + UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */ + UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */ + UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */ + UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */ + UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */ + UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */ + UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */ + UINT8 CstCnt; /* Support for the _CST object and C States change notification.*/ + UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */ + UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */ + UINT16 FlushSize; /* Number of flush strides that need to be read */ + UINT16 FlushStride; /* Processor's memory cache line width, in bytes */ + UINT8 DutyOffset; /* Processor's duty cycle index in processor's P_CNT reg*/ + UINT8 DutyWidth; /* Processor's duty cycle value bit width in P_CNT register.*/ + UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */ + UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */ + UINT8 Century; /* Index to century in RTC CMOS RAM */ + UINT16 IapcBootArch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ + UINT8 Reserved2; /* Reserved */ + UINT32_BIT WbInvd : 1; /* The wbinvd instruction works properly */ + UINT32_BIT WbInvdFlush : 1; /* The wbinvd flushes but does not invalidate */ + UINT32_BIT ProcC1 : 1; /* All processors support C1 state */ + UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */ + UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */ + UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */ + UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */ + UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ + UINT32_BIT TmrValExt : 1; /* Indicates tmr_val is 32 bits 0=24-bits*/ + UINT32_BIT DockCap : 1; /* Supports Docking */ + UINT32_BIT ResetRegSup : 1; /* Indicates system supports system reset via the FADT RESET_REG*/ + UINT32_BIT SealedCase : 1; /* Indicates system has no internal expansion capabilities and case is sealed. */ + UINT32_BIT Headless : 1; /* Indicates system does not have local video capabilities or local input devices.*/ + UINT32_BIT CpuSwSleep : 1; /* Indicates to OSPM that a processor native instruction */ + /* Must be executed after writing the SLP_TYPx register. */ + UINT32_BIT Reserved6 : 18; /* Reserved - must be zero */ + + ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */ + UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system. */ + UINT8 Reserved7[3]; /* These three bytes must be zero */ + UINT64 XFirmwareCtrl; /* 64-bit physical address of FACS */ + UINT64 XDsdt; /* 64-bit physical address of DSDT */ + ACPI_GENERIC_ADDRESS XPm1aEvtBlk; /* Extended Power Mgt 1a AcpiEvent Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm1bEvtBlk; /* Extended Power Mgt 1b AcpiEvent Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm1aCntBlk; /* Extended Power Mgt 1a Control Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm1bCntBlk; /* Extended Power Mgt 1b Control Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm2CntBlk; /* Extended Power Mgt 2 Control Reg Blk address */ + ACPI_GENERIC_ADDRESS XPmTmrBlk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ + ACPI_GENERIC_ADDRESS XGpe0Blk; /* Extended General Purpose AcpiEvent 0 Reg Blk address */ + ACPI_GENERIC_ADDRESS XGpe1Blk; /* Extended General Purpose AcpiEvent 1 Reg Blk address */ + +} FADT_DESCRIPTOR_REV2; + + +#pragma pack() + +#endif /* __ACTBL2_H__ */ + diff --git a/source/include/actypes.h b/source/include/actypes.h new file mode 100644 index 000000000..52f5c9fb0 --- /dev/null +++ b/source/include/actypes.h @@ -0,0 +1,1317 @@ +/****************************************************************************** + * + * Name: actypes.h - Common data types for the entire ACPI subsystem + * $Revision: 1.250 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACTYPES_H__ +#define __ACTYPES_H__ + +/*! [Begin] no source code translation (keep the typedefs) */ + + + +/* + * Data type ranges + */ +#define ACPI_UINT8_MAX (UINT8) 0xFF +#define ACPI_UINT16_MAX (UINT16) 0xFFFF +#define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF +#define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFF +#define ACPI_ASCII_MAX 0x7F + + +#ifdef DEFINE_ALTERNATE_TYPES +/* + * Types used only in translated source, defined here to enable + * cross-platform compilation only. + */ +typedef int s32; +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +typedef COMPILER_DEPENDENT_UINT64 u64; + +#endif + + +/* + * Data types - Fixed across all compilation models (16/32/64) + * + * BOOLEAN Logical Boolean. + * INT8 8-bit (1 byte) signed value + * UINT8 8-bit (1 byte) unsigned value + * INT16 16-bit (2 byte) signed value + * UINT16 16-bit (2 byte) unsigned value + * INT32 32-bit (4 byte) signed value + * UINT32 32-bit (4 byte) unsigned value + * INT64 64-bit (8 byte) signed value + * UINT64 64-bit (8 byte) unsigned value + * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value + * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value + */ + +#ifndef ACPI_MACHINE_WIDTH +#error ACPI_MACHINE_WIDTH not defined +#endif + +#if ACPI_MACHINE_WIDTH == 64 + +/*! [Begin] no source code translation (keep the typedefs) */ + +/* + * 64-bit type definitions + */ +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned short UINT16; +typedef int INT32; +typedef unsigned int UINT32; +typedef COMPILER_DEPENDENT_INT64 INT64; +typedef COMPILER_DEPENDENT_UINT64 UINT64; + +/*! [End] no source code translation !*/ + +typedef INT64 ACPI_NATIVE_INT; +typedef UINT64 ACPI_NATIVE_UINT; + +typedef UINT64 ACPI_TABLE_PTR; +typedef UINT64 ACPI_IO_ADDRESS; +typedef UINT64 ACPI_PHYSICAL_ADDRESS; +typedef UINT64 ACPI_SIZE; + +#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ +#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ +#define ACPI_MAX_PTR ACPI_UINT64_MAX +#define ACPI_SIZE_MAX ACPI_UINT64_MAX + + +#elif ACPI_MACHINE_WIDTH == 16 + +/*! [Begin] no source code translation (keep the typedefs) */ + +/* + * 16-bit type definitions + */ +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned int UINT16; +typedef long INT32; +typedef int INT16; +typedef unsigned long UINT32; + +typedef struct +{ + UINT32 Lo; + UINT32 Hi; + +} UINT64; + +/*! [End] no source code translation !*/ + +typedef UINT16 ACPI_NATIVE_UINT; +typedef INT16 ACPI_NATIVE_INT; + +typedef UINT32 ACPI_TABLE_PTR; +typedef UINT32 ACPI_IO_ADDRESS; +typedef char *ACPI_PHYSICAL_ADDRESS; +typedef UINT16 ACPI_SIZE; + +#define ALIGNED_ADDRESS_BOUNDARY 0x00000002 +#define _HW_ALIGNMENT_SUPPORT +#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ +#define ACPI_MAX_PTR ACPI_UINT16_MAX +#define ACPI_SIZE_MAX ACPI_UINT16_MAX + +/* + * (16-bit only) internal integers must be 32-bits, so + * 64-bit integers cannot be supported + */ +#define ACPI_NO_INTEGER64_SUPPORT + + +#elif ACPI_MACHINE_WIDTH == 32 + +/*! [Begin] no source code translation (keep the typedefs) */ + +/* + * 32-bit type definitions (default) + */ +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned short UINT16; +typedef int INT32; +typedef unsigned int UINT32; +typedef COMPILER_DEPENDENT_INT64 INT64; +typedef COMPILER_DEPENDENT_UINT64 UINT64; + +/*! [End] no source code translation !*/ + +typedef INT32 ACPI_NATIVE_INT; +typedef UINT32 ACPI_NATIVE_UINT; + +typedef UINT64 ACPI_TABLE_PTR; +typedef UINT32 ACPI_IO_ADDRESS; +typedef UINT64 ACPI_PHYSICAL_ADDRESS; +typedef UINT32 ACPI_SIZE; + +#define ALIGNED_ADDRESS_BOUNDARY 0x00000004 +#define _HW_ALIGNMENT_SUPPORT +#define ACPI_MAX_PTR ACPI_UINT32_MAX +#define ACPI_SIZE_MAX ACPI_UINT32_MAX + +#else +#error unknown ACPI_MACHINE_WIDTH +#endif + + +/* + * Miscellaneous common types + */ +typedef UINT32 UINT32_BIT; +typedef ACPI_NATIVE_UINT ACPI_PTRDIFF; + +/* + * Pointer overlays to avoid lots of typecasting for + * code that accepts both physical and logical pointers. + */ +typedef union acpi_pointers +{ + ACPI_PHYSICAL_ADDRESS Physical; + void *Logical; + ACPI_TABLE_PTR Value; + +} ACPI_POINTERS; + +typedef struct acpi_pointer +{ + UINT32 PointerType; + union acpi_pointers Pointer; + +} ACPI_POINTER; + +/* PointerTypes for above */ + +#define ACPI_PHYSICAL_POINTER 0x01 +#define ACPI_LOGICAL_POINTER 0x02 + +/* Processor mode */ + +#define ACPI_PHYSICAL_ADDRESSING 0x04 +#define ACPI_LOGICAL_ADDRESSING 0x08 +#define ACPI_MEMORY_MODE 0x0C + +#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER +#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER +#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER + + +/* + * Useful defines + */ +#ifdef FALSE +#undef FALSE +#endif +#define FALSE (1 == 0) + +#ifdef TRUE +#undef TRUE +#endif +#define TRUE (1 == 1) + +#ifndef NULL +#define NULL (void *) 0 +#endif + + +/* + * Local datatypes + */ +typedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */ +typedef UINT32 ACPI_NAME; /* 4-byte ACPI name */ +typedef char* ACPI_STRING; /* Null terminated ASCII string */ +typedef void* ACPI_HANDLE; /* Actually a ptr to an Node */ + +typedef struct uint64_struct +{ + UINT32 Lo; + UINT32 Hi; + +} UINT64_STRUCT; + +typedef union uint64_overlay +{ + UINT64 Full; + UINT64_STRUCT Part; + +} UINT64_OVERLAY; + +typedef struct uint32_struct +{ + UINT32 Lo; + UINT32 Hi; + +} UINT32_STRUCT; + + +/* + * Acpi integer width. In ACPI version 1, integers are + * 32 bits. In ACPI version 2, integers are 64 bits. + * Note that this pertains to the ACPI integer type only, not + * other integers used in the implementation of the ACPI CA + * subsystem. + */ +#ifdef ACPI_NO_INTEGER64_SUPPORT + +/* 32-bit integers only, no 64-bit support */ + +typedef UINT32 ACPI_INTEGER; +#define ACPI_INTEGER_MAX ACPI_UINT32_MAX +#define ACPI_INTEGER_BIT_SIZE 32 +#define ACPI_MAX_BCD_VALUE 99999999 +#define ACPI_MAX_BCD_DIGITS 8 +#define ACPI_MAX_DECIMAL_DIGITS 10 + +#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ + + +#else + +/* 64-bit integers */ + +typedef UINT64 ACPI_INTEGER; +#define ACPI_INTEGER_MAX ACPI_UINT64_MAX +#define ACPI_INTEGER_BIT_SIZE 64 +#define ACPI_MAX_BCD_VALUE 9999999999999999 +#define ACPI_MAX_BCD_DIGITS 16 +#define ACPI_MAX_DECIMAL_DIGITS 19 + +#if ACPI_MACHINE_WIDTH == 64 +#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ +#endif +#endif + + +/* + * Constants with special meanings + */ +#define ACPI_ROOT_OBJECT (ACPI_HANDLE) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) + + +/* + * Initialization sequence + */ +#define ACPI_FULL_INITIALIZATION 0x00 +#define ACPI_NO_ADDRESS_SPACE_INIT 0x01 +#define ACPI_NO_HARDWARE_INIT 0x02 +#define ACPI_NO_EVENT_INIT 0x04 +#define ACPI_NO_HANDLER_INIT 0x08 +#define ACPI_NO_ACPI_ENABLE 0x10 +#define ACPI_NO_DEVICE_INIT 0x20 +#define ACPI_NO_OBJECT_INIT 0x40 + +/* + * Initialization state + */ +#define ACPI_INITIALIZED_OK 0x01 + +/* + * Power state values + */ + +#define ACPI_STATE_UNKNOWN (UINT8) 0xFF + +#define ACPI_STATE_S0 (UINT8) 0 +#define ACPI_STATE_S1 (UINT8) 1 +#define ACPI_STATE_S2 (UINT8) 2 +#define ACPI_STATE_S3 (UINT8) 3 +#define ACPI_STATE_S4 (UINT8) 4 +#define ACPI_STATE_S5 (UINT8) 5 +#define ACPI_S_STATES_MAX ACPI_STATE_S5 +#define ACPI_S_STATE_COUNT 6 + +#define ACPI_STATE_D0 (UINT8) 0 +#define ACPI_STATE_D1 (UINT8) 1 +#define ACPI_STATE_D2 (UINT8) 2 +#define ACPI_STATE_D3 (UINT8) 3 +#define ACPI_D_STATES_MAX ACPI_STATE_D3 +#define ACPI_D_STATE_COUNT 4 + +#define ACPI_STATE_C0 (UINT8) 0 +#define ACPI_STATE_C1 (UINT8) 1 +#define ACPI_STATE_C2 (UINT8) 2 +#define ACPI_STATE_C3 (UINT8) 3 +#define ACPI_C_STATES_MAX ACPI_STATE_C3 +#define ACPI_C_STATE_COUNT 4 + +/* + * Sleep type invalid value + */ +#define ACPI_SLEEP_TYPE_MAX 0x7 +#define ACPI_SLEEP_TYPE_INVALID 0xFF + +/* + * Standard notify values + */ +#define ACPI_NOTIFY_BUS_CHECK (UINT8) 0 +#define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 1 +#define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 2 +#define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 3 +#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 4 +#define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 5 +#define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 6 +#define ACPI_NOTIFY_POWER_FAULT (UINT8) 7 + + +/* + * Table types. These values are passed to the table related APIs + */ +typedef UINT32 ACPI_TABLE_TYPE; + +#define ACPI_TABLE_RSDP (ACPI_TABLE_TYPE) 0 +#define ACPI_TABLE_DSDT (ACPI_TABLE_TYPE) 1 +#define ACPI_TABLE_FADT (ACPI_TABLE_TYPE) 2 +#define ACPI_TABLE_FACS (ACPI_TABLE_TYPE) 3 +#define ACPI_TABLE_PSDT (ACPI_TABLE_TYPE) 4 +#define ACPI_TABLE_SSDT (ACPI_TABLE_TYPE) 5 +#define ACPI_TABLE_XSDT (ACPI_TABLE_TYPE) 6 +#define ACPI_TABLE_MAX 6 +#define NUM_ACPI_TABLES (ACPI_TABLE_MAX+1) + + +/* + * Types associated with ACPI names and objects. The first group of + * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition + * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore, + * only add to the first group if the spec changes. + * + * Types must be kept in sync with the global AcpiNsProperties + * and AcpiNsTypeNames arrays. + */ +typedef UINT32 ACPI_OBJECT_TYPE; + +#define ACPI_TYPE_ANY 0x00 +#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ +#define ACPI_TYPE_STRING 0x02 +#define ACPI_TYPE_BUFFER 0x03 +#define ACPI_TYPE_PACKAGE 0x04 /* ByteConst, multiple DataTerm/Constant/SuperName */ +#define ACPI_TYPE_FIELD_UNIT 0x05 +#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ +#define ACPI_TYPE_EVENT 0x07 +#define ACPI_TYPE_METHOD 0x08 /* Name, ByteConst, multiple Code */ +#define ACPI_TYPE_MUTEX 0x09 +#define ACPI_TYPE_REGION 0x0A +#define ACPI_TYPE_POWER 0x0B /* Name,ByteConst,WordConst,multi Node */ +#define ACPI_TYPE_PROCESSOR 0x0C /* Name,ByteConst,DWordConst,ByteConst,multi NmO */ +#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ +#define ACPI_TYPE_BUFFER_FIELD 0x0E +#define ACPI_TYPE_DDB_HANDLE 0x0F +#define ACPI_TYPE_DEBUG_OBJECT 0x10 + +#define ACPI_TYPE_EXTERNAL_MAX 0x10 + +/* + * These are object types that do not map directly to the ACPI + * ObjectType() operator. They are used for various internal purposes only. + * If new predefined ACPI_TYPEs are added (via the ACPI specification), these + * internal types must move upwards. (There is code that depends on these + * values being contiguous with the external types above.) + */ +#define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 +#define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 +#define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 +#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, RefOf, Index */ +#define ACPI_TYPE_LOCAL_ALIAS 0x15 +#define ACPI_TYPE_LOCAL_NOTIFY 0x16 +#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x17 +#define ACPI_TYPE_LOCAL_RESOURCE 0x18 +#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x19 +#define ACPI_TYPE_LOCAL_SCOPE 0x1A /* 1 Name, multiple ObjectList Nodes */ + +#define ACPI_TYPE_NS_NODE_MAX 0x1A /* Last typecode used within a NS Node */ + +/* + * These are special object types that never appear in + * a Namespace node, only in an ACPI_OPERAND_OBJECT + */ +#define ACPI_TYPE_LOCAL_EXTRA 0x1B +#define ACPI_TYPE_LOCAL_DATA 0x1C + +#define ACPI_TYPE_LOCAL_MAX 0x1C + +/* All types above here are invalid */ + +#define ACPI_TYPE_INVALID 0x1D +#define ACPI_TYPE_NOT_FOUND 0xFF + + +/* + * Bitmapped ACPI types. Used internally only + */ +#define ACPI_BTYPE_ANY 0x00000000 +#define ACPI_BTYPE_INTEGER 0x00000001 +#define ACPI_BTYPE_STRING 0x00000002 +#define ACPI_BTYPE_BUFFER 0x00000004 +#define ACPI_BTYPE_PACKAGE 0x00000008 +#define ACPI_BTYPE_FIELD_UNIT 0x00000010 +#define ACPI_BTYPE_DEVICE 0x00000020 +#define ACPI_BTYPE_EVENT 0x00000040 +#define ACPI_BTYPE_METHOD 0x00000080 +#define ACPI_BTYPE_MUTEX 0x00000100 +#define ACPI_BTYPE_REGION 0x00000200 +#define ACPI_BTYPE_POWER 0x00000400 +#define ACPI_BTYPE_PROCESSOR 0x00000800 +#define ACPI_BTYPE_THERMAL 0x00001000 +#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 +#define ACPI_BTYPE_DDB_HANDLE 0x00004000 +#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 +#define ACPI_BTYPE_REFERENCE 0x00010000 +#define ACPI_BTYPE_RESOURCE 0x00020000 + +#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) + +#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) +#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) +#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) +#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ +#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF + +/* + * All I/O + */ +#define ACPI_READ 0 +#define ACPI_WRITE 1 +#define ACPI_IO_MASK 1 + + +/* + * AcpiEvent Types: Fixed & General Purpose + */ +typedef UINT32 ACPI_EVENT_TYPE; + +#define ACPI_EVENT_FIXED 0 +#define ACPI_EVENT_GPE 1 + +/* + * Fixed events + */ +#define ACPI_EVENT_PMTIMER 0 +#define ACPI_EVENT_GLOBAL 1 +#define ACPI_EVENT_POWER_BUTTON 2 +#define ACPI_EVENT_SLEEP_BUTTON 3 +#define ACPI_EVENT_RTC 4 +#define ACPI_EVENT_MAX 4 +#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 + +#define ACPI_GPE_INVALID 0xFF +#define ACPI_GPE_MAX 0xFF +#define ACPI_NUM_GPE 256 + +#define ACPI_EVENT_LEVEL_TRIGGERED 1 +#define ACPI_EVENT_EDGE_TRIGGERED 2 + +/* + * GPEs + */ +#define ACPI_EVENT_WAKE_ENABLE 0x1 +#define ACPI_EVENT_WAKE_DISABLE 0x1 + + +/* + * AcpiEvent Status: + * ------------- + * The encoding of ACPI_EVENT_STATUS is illustrated below. + * Note that a set bit (1) indicates the property is TRUE + * (e.g. if bit 0 is set then the event is enabled). + * +-------------+-+-+-+ + * | Bits 31:3 |2|1|0| + * +-------------+-+-+-+ + * | | | | + * | | | +- Enabled? + * | | +--- Enabled for wake? + * | +----- Set? + * +----------- + */ +typedef UINT32 ACPI_EVENT_STATUS; + +#define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00 +#define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 +#define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 +#define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 + + +/* Notify types */ + +#define ACPI_SYSTEM_NOTIFY 0 +#define ACPI_DEVICE_NOTIFY 1 +#define ACPI_MAX_NOTIFY_HANDLER_TYPE 1 + +#define ACPI_MAX_SYS_NOTIFY 0x7f + + +/* Address Space (Operation Region) Types */ + +typedef UINT8 ACPI_ADR_SPACE_TYPE; + +#define ACPI_ADR_SPACE_SYSTEM_MEMORY (ACPI_ADR_SPACE_TYPE) 0 +#define ACPI_ADR_SPACE_SYSTEM_IO (ACPI_ADR_SPACE_TYPE) 1 +#define ACPI_ADR_SPACE_PCI_CONFIG (ACPI_ADR_SPACE_TYPE) 2 +#define ACPI_ADR_SPACE_EC (ACPI_ADR_SPACE_TYPE) 3 +#define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4 +#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 +#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 +#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 7 +#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127 + + +/* + * BitRegister IDs + * These are bitfields defined within the full ACPI registers + */ +#define ACPI_BITREG_TIMER_STATUS 0x00 +#define ACPI_BITREG_BUS_MASTER_STATUS 0x01 +#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 +#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 +#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 +#define ACPI_BITREG_RT_CLOCK_STATUS 0x05 +#define ACPI_BITREG_WAKE_STATUS 0x06 + +#define ACPI_BITREG_TIMER_ENABLE 0x07 +#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x08 +#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x09 +#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0A +#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0B +#define ACPI_BITREG_WAKE_ENABLE 0x0C + +#define ACPI_BITREG_SCI_ENABLE 0x0D +#define ACPI_BITREG_BUS_MASTER_RLD 0x0E +#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x0F +#define ACPI_BITREG_SLEEP_TYPE_A 0x10 +#define ACPI_BITREG_SLEEP_TYPE_B 0x11 +#define ACPI_BITREG_SLEEP_ENABLE 0x12 + +#define ACPI_BITREG_ARB_DISABLE 0x13 + +#define ACPI_BITREG_MAX 0x13 +#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 + + +/* + * External ACPI object definition + */ +typedef union acpi_object +{ + ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */ + struct + { + ACPI_OBJECT_TYPE Type; + ACPI_INTEGER Value; /* The actual number */ + } Integer; + + struct + { + ACPI_OBJECT_TYPE Type; + UINT32 Length; /* # of bytes in string, excluding trailing null */ + char *Pointer; /* points to the string value */ + } String; + + struct + { + ACPI_OBJECT_TYPE Type; + UINT32 Length; /* # of bytes in buffer */ + UINT8 *Pointer; /* points to the buffer */ + } Buffer; + + struct + { + ACPI_OBJECT_TYPE Type; + UINT32 Fill1; + ACPI_HANDLE Handle; /* object reference */ + } Reference; + + struct + { + ACPI_OBJECT_TYPE Type; + UINT32 Count; /* # of elements in package */ + union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */ + } Package; + + struct + { + ACPI_OBJECT_TYPE Type; + UINT32 ProcId; + ACPI_IO_ADDRESS PblkAddress; + UINT32 PblkLength; + } Processor; + + struct + { + ACPI_OBJECT_TYPE Type; + UINT32 SystemLevel; + UINT32 ResourceOrder; + } PowerResource; + +} ACPI_OBJECT; + + +/* + * List of objects, used as a parameter list for control method evaluation + */ +typedef struct acpi_object_list +{ + UINT32 Count; + ACPI_OBJECT *Pointer; + +} ACPI_OBJECT_LIST; + + +/* + * Miscellaneous common Data Structures used by the interfaces + */ +#define ACPI_NO_BUFFER 0 +#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1) +#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2) + +typedef struct acpi_buffer +{ + ACPI_SIZE Length; /* Length in bytes of the buffer */ + void *Pointer; /* pointer to buffer */ + +} ACPI_BUFFER; + + +/* + * NameType for AcpiGetName + */ +#define ACPI_FULL_PATHNAME 0 +#define ACPI_SINGLE_NAME 1 +#define ACPI_NAME_TYPE_MAX 1 + + +/* + * Structure and flags for AcpiGetSystemInfo + */ +#define ACPI_SYS_MODE_UNKNOWN 0x0000 +#define ACPI_SYS_MODE_ACPI 0x0001 +#define ACPI_SYS_MODE_LEGACY 0x0002 +#define ACPI_SYS_MODES_MASK 0x0003 + + +/* + * ACPI Table Info. One per ACPI table _type_ + */ +typedef struct acpi_table_info +{ + UINT32 Count; + +} ACPI_TABLE_INFO; + + +/* + * System info returned by AcpiGetSystemInfo() + */ +typedef struct acpi_system_info +{ + UINT32 AcpiCaVersion; + UINT32 Flags; + UINT32 TimerResolution; + UINT32 Reserved1; + UINT32 Reserved2; + UINT32 DebugLevel; + UINT32 DebugLayer; + UINT32 NumTableTypes; + ACPI_TABLE_INFO TableInfo [NUM_ACPI_TABLES]; + +} ACPI_SYSTEM_INFO; + + +/* + * Various handlers and callback procedures + */ +typedef +UINT32 (*ACPI_EVENT_HANDLER) ( + void *Context); + +typedef +void (*ACPI_GPE_HANDLER) ( + void *Context); + +typedef +void (*ACPI_NOTIFY_HANDLER) ( + ACPI_HANDLE Device, + UINT32 Value, + void *Context); + +typedef +void (*ACPI_OBJECT_HANDLER) ( + ACPI_HANDLE Object, + UINT32 Function, + void *Data); + +typedef +ACPI_STATUS (*ACPI_INIT_HANDLER) ( + ACPI_HANDLE Object, + UINT32 Function); + +#define ACPI_INIT_DEVICE_INI 1 + + +/* Address Spaces (Operation Regions */ + +typedef +ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext); + +#define ACPI_DEFAULT_HANDLER NULL + + +typedef +ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) ( + ACPI_HANDLE RegionHandle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + +#define ACPI_REGION_ACTIVATE 0 +#define ACPI_REGION_DEACTIVATE 1 + +typedef +ACPI_STATUS (*ACPI_WALK_CALLBACK) ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + + +/* Interrupt handler return values */ + +#define ACPI_INTERRUPT_NOT_HANDLED 0x00 +#define ACPI_INTERRUPT_HANDLED 0x01 + + +/* Structure and flags for AcpiGetDeviceInfo */ + +#define ACPI_VALID_HID 0x1 +#define ACPI_VALID_UID 0x2 +#define ACPI_VALID_ADR 0x4 +#define ACPI_VALID_STA 0x8 + + +#define ACPI_COMMON_OBJ_INFO \ + ACPI_OBJECT_TYPE Type; /* ACPI object type */ \ + ACPI_NAME Name /* ACPI object Name */ + + +typedef struct acpi_obj_info_header +{ + ACPI_COMMON_OBJ_INFO; + +} ACPI_OBJ_INFO_HEADER; + + +typedef struct +{ + ACPI_COMMON_OBJ_INFO; + + UINT32 Valid; /* Are the next bits legit? */ + char HardwareId[9]; /* _HID value if any */ + char UniqueId[9]; /* _UID value if any */ + ACPI_INTEGER Address; /* _ADR value if any */ + UINT32 CurrentStatus; /* _STA value */ +} ACPI_DEVICE_INFO; + + +/* Context structs for address space handlers */ + +typedef struct acpi_pci_id +{ + UINT16 Segment; + UINT16 Bus; + UINT16 Device; + UINT16 Function; + +} ACPI_PCI_ID; + + +typedef struct acpi_mem_space_context +{ + UINT32 Length; + ACPI_PHYSICAL_ADDRESS Address; + ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress; + UINT8 *MappedLogicalAddress; + ACPI_SIZE MappedLength; + +} ACPI_MEM_SPACE_CONTEXT; + + +/* + * Definitions for Resource Attributes + */ + +/* + * Memory Attributes + */ +#define ACPI_READ_ONLY_MEMORY (UINT8) 0x00 +#define ACPI_READ_WRITE_MEMORY (UINT8) 0x01 + +#define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00 +#define ACPI_CACHABLE_MEMORY (UINT8) 0x01 +#define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02 +#define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03 + +/* + * IO Attributes + * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh. + * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh. + */ +#define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01 +#define ACPI_ISA_ONLY_RANGES (UINT8) 0x02 +#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) + +/* + * IO Port Descriptor Decode + */ +#define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */ +#define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */ + +/* + * IRQ Attributes + */ +#define ACPI_EDGE_SENSITIVE (UINT8) 0x00 +#define ACPI_LEVEL_SENSITIVE (UINT8) 0x01 + +#define ACPI_ACTIVE_HIGH (UINT8) 0x00 +#define ACPI_ACTIVE_LOW (UINT8) 0x01 + +#define ACPI_EXCLUSIVE (UINT8) 0x00 +#define ACPI_SHARED (UINT8) 0x01 + +/* + * DMA Attributes + */ +#define ACPI_COMPATIBILITY (UINT8) 0x00 +#define ACPI_TYPE_A (UINT8) 0x01 +#define ACPI_TYPE_B (UINT8) 0x02 +#define ACPI_TYPE_F (UINT8) 0x03 + +#define ACPI_NOT_BUS_MASTER (UINT8) 0x00 +#define ACPI_BUS_MASTER (UINT8) 0x01 + +#define ACPI_TRANSFER_8 (UINT8) 0x00 +#define ACPI_TRANSFER_8_16 (UINT8) 0x01 +#define ACPI_TRANSFER_16 (UINT8) 0x02 + +/* + * Start Dependent Functions Priority definitions + */ +#define ACPI_GOOD_CONFIGURATION (UINT8) 0x00 +#define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01 +#define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02 + +/* + * 16, 32 and 64-bit Address Descriptor resource types + */ +#define ACPI_MEMORY_RANGE (UINT8) 0x00 +#define ACPI_IO_RANGE (UINT8) 0x01 +#define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02 + +#define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00 +#define ACPI_ADDRESS_FIXED (UINT8) 0x01 + +#define ACPI_POS_DECODE (UINT8) 0x00 +#define ACPI_SUB_DECODE (UINT8) 0x01 + +#define ACPI_PRODUCER (UINT8) 0x00 +#define ACPI_CONSUMER (UINT8) 0x01 + + +/* + * Structures used to describe device resources + */ +typedef struct acpi_resource_irq +{ + UINT32 EdgeLevel; + UINT32 ActiveHighLow; + UINT32 SharedExclusive; + UINT32 NumberOfInterrupts; + UINT32 Interrupts[1]; + +} ACPI_RESOURCE_IRQ; + +typedef struct ACPI_RESOURCE_DMA +{ + UINT32 Type; + UINT32 BusMaster; + UINT32 Transfer; + UINT32 NumberOfChannels; + UINT32 Channels[1]; + +} ACPI_RESOURCE_DMA; + +typedef struct acpi_resource_start_dpf +{ + UINT32 CompatibilityPriority; + UINT32 PerformanceRobustness; + +} ACPI_RESOURCE_START_DPF; + +/* + * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not + * needed because it has no fields + */ + +typedef struct acpi_resource_io +{ + UINT32 IoDecode; + UINT32 MinBaseAddress; + UINT32 MaxBaseAddress; + UINT32 Alignment; + UINT32 RangeLength; + +} ACPI_RESOURCE_IO; + +typedef struct acpi_resource_fixed_io +{ + UINT32 BaseAddress; + UINT32 RangeLength; + +} ACPI_RESOURCE_FIXED_IO; + +typedef struct acpi_resource_vendor +{ + UINT32 Length; + UINT8 Reserved[1]; + +} ACPI_RESOURCE_VENDOR; + +typedef struct acpi_resource_end_tag +{ + UINT8 Checksum; + +} ACPI_RESOURCE_END_TAG; + +typedef struct acpi_resource_mem24 +{ + UINT32 ReadWriteAttribute; + UINT32 MinBaseAddress; + UINT32 MaxBaseAddress; + UINT32 Alignment; + UINT32 RangeLength; + +} ACPI_RESOURCE_MEM24; + +typedef struct acpi_resource_mem32 +{ + UINT32 ReadWriteAttribute; + UINT32 MinBaseAddress; + UINT32 MaxBaseAddress; + UINT32 Alignment; + UINT32 RangeLength; + +} ACPI_RESOURCE_MEM32; + +typedef struct acpi_resource_fixed_mem32 +{ + UINT32 ReadWriteAttribute; + UINT32 RangeBaseAddress; + UINT32 RangeLength; + +} ACPI_RESOURCE_FIXED_MEM32; + +typedef struct acpi_memory_attribute +{ + UINT16 CacheAttribute; + UINT16 ReadWriteAttribute; + +} ACPI_MEMORY_ATTRIBUTE; + +typedef struct acpi_io_attribute +{ + UINT16 RangeAttribute; + UINT16 Reserved; + +} ACPI_IO_ATTRIBUTE; + +typedef struct acpi_bus_attribute +{ + UINT16 Reserved1; + UINT16 Reserved2; + +} ACPI_BUS_ATTRIBUTE; + +typedef union acpi_resource_attribute +{ + ACPI_MEMORY_ATTRIBUTE Memory; + ACPI_IO_ATTRIBUTE Io; + ACPI_BUS_ATTRIBUTE Bus; + +} ACPI_RESOURCE_ATTRIBUTE; + +typedef struct acpi_resource_source +{ + UINT32 Index; + UINT32 StringLength; + char *StringPtr; + +} ACPI_RESOURCE_SOURCE; + +typedef struct acpi_resource_address16 +{ + UINT32 ResourceType; + UINT32 ProducerConsumer; + UINT32 Decode; + UINT32 MinAddressFixed; + UINT32 MaxAddressFixed; + ACPI_RESOURCE_ATTRIBUTE Attribute; + UINT32 Granularity; + UINT32 MinAddressRange; + UINT32 MaxAddressRange; + UINT32 AddressTranslationOffset; + UINT32 AddressLength; + ACPI_RESOURCE_SOURCE ResourceSource; + +} ACPI_RESOURCE_ADDRESS16; + +typedef struct acpi_resource_address32 +{ + UINT32 ResourceType; + UINT32 ProducerConsumer; + UINT32 Decode; + UINT32 MinAddressFixed; + UINT32 MaxAddressFixed; + ACPI_RESOURCE_ATTRIBUTE Attribute; + UINT32 Granularity; + UINT32 MinAddressRange; + UINT32 MaxAddressRange; + UINT32 AddressTranslationOffset; + UINT32 AddressLength; + ACPI_RESOURCE_SOURCE ResourceSource; + +} ACPI_RESOURCE_ADDRESS32; + +typedef struct acpi_resource_address64 +{ + UINT32 ResourceType; + UINT32 ProducerConsumer; + UINT32 Decode; + UINT32 MinAddressFixed; + UINT32 MaxAddressFixed; + ACPI_RESOURCE_ATTRIBUTE Attribute; + UINT64 Granularity; + UINT64 MinAddressRange; + UINT64 MaxAddressRange; + UINT64 AddressTranslationOffset; + UINT64 AddressLength; + ACPI_RESOURCE_SOURCE ResourceSource; + +} ACPI_RESOURCE_ADDRESS64; + +typedef struct acpi_resource_ext_irq +{ + UINT32 ProducerConsumer; + UINT32 EdgeLevel; + UINT32 ActiveHighLow; + UINT32 SharedExclusive; + UINT32 NumberOfInterrupts; + ACPI_RESOURCE_SOURCE ResourceSource; + UINT32 Interrupts[1]; + +} ACPI_RESOURCE_EXT_IRQ; + + +/* ACPI_RESOURCE_TYPEs */ + +#define ACPI_RSTYPE_IRQ 0 +#define ACPI_RSTYPE_DMA 1 +#define ACPI_RSTYPE_START_DPF 2 +#define ACPI_RSTYPE_END_DPF 3 +#define ACPI_RSTYPE_IO 4 +#define ACPI_RSTYPE_FIXED_IO 5 +#define ACPI_RSTYPE_VENDOR 6 +#define ACPI_RSTYPE_END_TAG 7 +#define ACPI_RSTYPE_MEM24 8 +#define ACPI_RSTYPE_MEM32 9 +#define ACPI_RSTYPE_FIXED_MEM32 10 +#define ACPI_RSTYPE_ADDRESS16 11 +#define ACPI_RSTYPE_ADDRESS32 12 +#define ACPI_RSTYPE_ADDRESS64 13 +#define ACPI_RSTYPE_EXT_IRQ 14 + +typedef UINT32 ACPI_RESOURCE_TYPE; + +typedef union acpi_resource_data +{ + ACPI_RESOURCE_IRQ Irq; + ACPI_RESOURCE_DMA Dma; + ACPI_RESOURCE_START_DPF StartDpf; + ACPI_RESOURCE_IO Io; + ACPI_RESOURCE_FIXED_IO FixedIo; + ACPI_RESOURCE_VENDOR VendorSpecific; + ACPI_RESOURCE_END_TAG EndTag; + ACPI_RESOURCE_MEM24 Memory24; + ACPI_RESOURCE_MEM32 Memory32; + ACPI_RESOURCE_FIXED_MEM32 FixedMemory32; + ACPI_RESOURCE_ADDRESS16 Address16; + ACPI_RESOURCE_ADDRESS32 Address32; + ACPI_RESOURCE_ADDRESS64 Address64; + ACPI_RESOURCE_EXT_IRQ ExtendedIrq; + +} ACPI_RESOURCE_DATA; + +typedef struct acpi_resource +{ + ACPI_RESOURCE_TYPE Id; + UINT32 Length; + ACPI_RESOURCE_DATA Data; + +} ACPI_RESOURCE; + +#define ACPI_RESOURCE_LENGTH 12 +#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ + +#define ACPI_SIZEOF_RESOURCE(Type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type)) + +#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length) + +#ifdef _HW_ALIGNMENT_SUPPORT +#define ACPI_ALIGN_RESOURCE_SIZE(Length) (Length) +#else +#define ACPI_ALIGN_RESOURCE_SIZE(Length) ACPI_ROUND_UP_TO_NATIVE_WORD(Length) +#endif + +/* + * END: of definitions for Resource Attributes + */ + + +typedef struct acpi_pci_routing_table +{ + UINT32 Length; + UINT32 Pin; + ACPI_INTEGER Address; /* here for 64-bit alignment */ + UINT32 SourceIndex; + char Source[4]; /* pad to 64 bits so sizeof() works in all cases */ + +} ACPI_PCI_ROUTING_TABLE; + +/* + * END: of definitions for PCI Routing tables + */ + + +#endif /* __ACTYPES_H__ */ diff --git a/source/include/acutils.h b/source/include/acutils.h new file mode 100644 index 000000000..8d0430efa --- /dev/null +++ b/source/include/acutils.h @@ -0,0 +1,908 @@ +/****************************************************************************** + * + * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures + * $Revision: 1.153 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef _ACUTILS_H +#define _ACUTILS_H + + +typedef +ACPI_STATUS (*ACPI_PKG_CALLBACK) ( + UINT8 ObjectType, + ACPI_OPERAND_OBJECT *SourceObject, + ACPI_GENERIC_STATE *State, + void *Context); + + +ACPI_STATUS +AcpiUtWalkPackageTree ( + ACPI_OPERAND_OBJECT *SourceObject, + void *TargetObject, + ACPI_PKG_CALLBACK WalkCallback, + void *Context); + + +typedef struct acpi_pkg_info +{ + UINT8 *FreeSpace; + ACPI_SIZE Length; + UINT32 ObjectSpace; + UINT32 NumPackages; + +} ACPI_PKG_INFO; + +#define REF_INCREMENT (UINT16) 0 +#define REF_DECREMENT (UINT16) 1 +#define REF_FORCE_DELETE (UINT16) 2 + +/* AcpiUtDumpBuffer */ + +#define DB_BYTE_DISPLAY 1 +#define DB_WORD_DISPLAY 2 +#define DB_DWORD_DISPLAY 4 +#define DB_QWORD_DISPLAY 8 + + +/* Global initialization interfaces */ + +void +AcpiUtInitGlobals ( + void); + +void +AcpiUtTerminate ( + void); + + +/* + * UtInit - miscellaneous initialization and shutdown + */ + +ACPI_STATUS +AcpiUtHardwareInitialize ( + void); + +void +AcpiUtSubsystemShutdown ( + void); + +ACPI_STATUS +AcpiUtValidateFadt ( + void); + +/* + * UtGlobal - Global data structures and procedures + */ + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + +char * +AcpiUtGetMutexName ( + UINT32 MutexId); + +#endif + +char * +AcpiUtGetTypeName ( + ACPI_OBJECT_TYPE Type); + +char * +AcpiUtGetObjectTypeName ( + ACPI_OPERAND_OBJECT *ObjDesc); + +char * +AcpiUtGetRegionName ( + UINT8 SpaceId); + +char * +AcpiUtGetEventName ( + UINT32 EventId); + +char +AcpiUtHexToAsciiChar ( + ACPI_INTEGER Integer, + UINT32 Position); + +BOOLEAN +AcpiUtValidObjectType ( + ACPI_OBJECT_TYPE Type); + +ACPI_OWNER_ID +AcpiUtAllocateOwnerId ( + UINT32 IdType); + + +/* + * UtClib - Local implementations of C library functions + */ + +#ifndef ACPI_USE_SYSTEM_CLIBRARY + +ACPI_SIZE +AcpiUtStrlen ( + const char *String); + +char * +AcpiUtStrcpy ( + char *DstString, + const char *SrcString); + +char * +AcpiUtStrncpy ( + char *DstString, + const char *SrcString, + ACPI_SIZE Count); + +int +AcpiUtStrncmp ( + const char *String1, + const char *String2, + ACPI_SIZE Count); + +int +AcpiUtStrcmp ( + const char *String1, + const char *String2); + +char * +AcpiUtStrcat ( + char *DstString, + const char *SrcString); + +char * +AcpiUtStrncat ( + char *DstString, + const char *SrcString, + ACPI_SIZE Count); + +UINT32 +AcpiUtStrtoul ( + const char *String, + char **Terminator, + UINT32 Base); + +char * +AcpiUtStrstr ( + char *String1, + char *String2); + +void * +AcpiUtMemcpy ( + void *Dest, + const void *Src, + ACPI_SIZE Count); + +void * +AcpiUtMemset ( + void *Dest, + ACPI_NATIVE_UINT Value, + ACPI_SIZE Count); + +int +AcpiUtToUpper ( + int c); + +int +AcpiUtToLower ( + int c); + +extern const UINT8 _acpi_ctype[]; + +#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ +#define _ACPI_XS 0x40 /* extra space */ +#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ +#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ +#define _ACPI_DI 0x04 /* '0'-'9' */ +#define _ACPI_LO 0x02 /* 'a'-'z' */ +#define _ACPI_PU 0x10 /* punctuation */ +#define _ACPI_SP 0x08 /* space */ +#define _ACPI_UP 0x01 /* 'A'-'Z' */ +#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ + +#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) +#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) +#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) +#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) +#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) +#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) +#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) +#define ACPI_IS_ASCII(c) ((c) < 0x80) + +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ + +/* + * UtCopy - Object construction and conversion interfaces + */ + +ACPI_STATUS +AcpiUtBuildSimpleObject( + ACPI_OPERAND_OBJECT *Obj, + ACPI_OBJECT *UserObj, + UINT8 *DataSpace, + UINT32 *BufferSpaceUsed); + +ACPI_STATUS +AcpiUtBuildPackageObject ( + ACPI_OPERAND_OBJECT *Obj, + UINT8 *Buffer, + UINT32 *SpaceUsed); + +ACPI_STATUS +AcpiUtCopyIelementToEelement ( + UINT8 ObjectType, + ACPI_OPERAND_OBJECT *SourceObject, + ACPI_GENERIC_STATE *State, + void *Context); + +ACPI_STATUS +AcpiUtCopyIelementToIelement ( + UINT8 ObjectType, + ACPI_OPERAND_OBJECT *SourceObject, + ACPI_GENERIC_STATE *State, + void *Context); + +ACPI_STATUS +AcpiUtCopyIobjectToEobject ( + ACPI_OPERAND_OBJECT *Obj, + ACPI_BUFFER *RetBuffer); + +ACPI_STATUS +AcpiUtCopyEsimpleToIsimple( + ACPI_OBJECT *UserObj, + ACPI_OPERAND_OBJECT **ReturnObj); + +ACPI_STATUS +AcpiUtCopyEobjectToIobject ( + ACPI_OBJECT *Obj, + ACPI_OPERAND_OBJECT **InternalObj); + +ACPI_STATUS +AcpiUtCopyISimpleToIsimple ( + ACPI_OPERAND_OBJECT *SourceObj, + ACPI_OPERAND_OBJECT *DestObj); + +ACPI_STATUS +AcpiUtCopyIpackageToIpackage ( + ACPI_OPERAND_OBJECT *SourceObj, + ACPI_OPERAND_OBJECT *DestObj, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiUtCopySimpleObject ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *DestDesc); + +ACPI_STATUS +AcpiUtCopyIobjectToIobject ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT **DestDesc, + ACPI_WALK_STATE *WalkState); + + +/* + * UtCreate - Object creation + */ + +ACPI_STATUS +AcpiUtUpdateObjectReference ( + ACPI_OPERAND_OBJECT *Object, + UINT16 Action); + + +/* + * UtDebug - Debug interfaces + */ + +void +AcpiUtInitStackPtrTrace ( + void); + +void +AcpiUtTrackStackPtr ( + void); + +void +AcpiUtTrace ( + UINT32 LineNumber, + ACPI_DEBUG_PRINT_INFO *DbgInfo); + +void +AcpiUtTracePtr ( + UINT32 LineNumber, + ACPI_DEBUG_PRINT_INFO *DbgInfo, + void *Pointer); + +void +AcpiUtTraceU32 ( + UINT32 LineNumber, + ACPI_DEBUG_PRINT_INFO *DbgInfo, + UINT32 Integer); + +void +AcpiUtTraceStr ( + UINT32 LineNumber, + ACPI_DEBUG_PRINT_INFO *DbgInfo, + char *String); + +void +AcpiUtExit ( + UINT32 LineNumber, + ACPI_DEBUG_PRINT_INFO *DbgInfo); + +void +AcpiUtStatusExit ( + UINT32 LineNumber, + ACPI_DEBUG_PRINT_INFO *DbgInfo, + ACPI_STATUS Status); + +void +AcpiUtValueExit ( + UINT32 LineNumber, + ACPI_DEBUG_PRINT_INFO *DbgInfo, + ACPI_INTEGER Value); + +void +AcpiUtPtrExit ( + UINT32 LineNumber, + ACPI_DEBUG_PRINT_INFO *DbgInfo, + UINT8 *Ptr); + +void +AcpiUtReportInfo ( + char *ModuleName, + UINT32 LineNumber, + UINT32 ComponentId); + +void +AcpiUtReportError ( + char *ModuleName, + UINT32 LineNumber, + UINT32 ComponentId); + +void +AcpiUtReportWarning ( + char *ModuleName, + UINT32 LineNumber, + UINT32 ComponentId); + +void +AcpiUtDumpBuffer ( + UINT8 *Buffer, + UINT32 Count, + UINT32 Display, + UINT32 componentId); + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtDebugPrint ( + UINT32 RequestedDebugLevel, + UINT32 LineNumber, + ACPI_DEBUG_PRINT_INFO *DbgInfo, + char *Format, + ...) ACPI_PRINTF_LIKE_FUNC; + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtDebugPrintRaw ( + UINT32 RequestedDebugLevel, + UINT32 LineNumber, + ACPI_DEBUG_PRINT_INFO *DbgInfo, + char *Format, + ...) ACPI_PRINTF_LIKE_FUNC; + + +/* + * UtDelete - Object deletion + */ + +void +AcpiUtDeleteInternalObj ( + ACPI_OPERAND_OBJECT *Object); + +void +AcpiUtDeleteInternalPackageObject ( + ACPI_OPERAND_OBJECT *Object); + +void +AcpiUtDeleteInternalSimpleObject ( + ACPI_OPERAND_OBJECT *Object); + +void +AcpiUtDeleteInternalObjectList ( + ACPI_OPERAND_OBJECT **ObjList); + + +/* + * UtEval - object evaluation + */ + +/* Method name strings */ + +#define METHOD_NAME__HID "_HID" +#define METHOD_NAME__CID "_CID" +#define METHOD_NAME__UID "_UID" +#define METHOD_NAME__ADR "_ADR" +#define METHOD_NAME__STA "_STA" +#define METHOD_NAME__REG "_REG" +#define METHOD_NAME__SEG "_SEG" +#define METHOD_NAME__BBN "_BBN" +#define METHOD_NAME__PRT "_PRT" + + +ACPI_STATUS +AcpiUtEvaluateObject ( + ACPI_NAMESPACE_NODE *PrefixNode, + char *Path, + UINT32 ExpectedReturnBtypes, + ACPI_OPERAND_OBJECT **ReturnDesc); + +ACPI_STATUS +AcpiUtEvaluateNumericObject ( + char *ObjectName, + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_INTEGER *Address); + +ACPI_STATUS +AcpiUtExecute_HID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID *Hid); + +ACPI_STATUS +AcpiUtExecute_CID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID *Cid); + +ACPI_STATUS +AcpiUtExecute_STA ( + ACPI_NAMESPACE_NODE *DeviceNode, + UINT32 *StatusFlags); + +ACPI_STATUS +AcpiUtExecute_UID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID *Uid); + + +/* + * UtMutex - mutual exclusion interfaces + */ + +ACPI_STATUS +AcpiUtMutexInitialize ( + void); + +void +AcpiUtMutexTerminate ( + void); + +ACPI_STATUS +AcpiUtCreateMutex ( + ACPI_MUTEX_HANDLE MutexId); + +ACPI_STATUS +AcpiUtDeleteMutex ( + ACPI_MUTEX_HANDLE MutexId); + +ACPI_STATUS +AcpiUtAcquireMutex ( + ACPI_MUTEX_HANDLE MutexId); + +ACPI_STATUS +AcpiUtReleaseMutex ( + ACPI_MUTEX_HANDLE MutexId); + + +/* + * UtObject - internal object create/delete/cache routines + */ + +ACPI_OPERAND_OBJECT * +AcpiUtCreateInternalObjectDbg ( + char *ModuleName, + UINT32 LineNumber, + UINT32 ComponentId, + ACPI_OBJECT_TYPE Type); + +void * +AcpiUtAllocateObjectDescDbg ( + char *ModuleName, + UINT32 LineNumber, + UINT32 ComponentId); + +#define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_THIS_MODULE,__LINE__,_COMPONENT,t) +#define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_THIS_MODULE,__LINE__,_COMPONENT) + +void +AcpiUtDeleteObjectDesc ( + ACPI_OPERAND_OBJECT *Object); + +BOOLEAN +AcpiUtValidInternalObject ( + void *Object); + +ACPI_OPERAND_OBJECT * +AcpiUtCreateBufferObject ( + ACPI_SIZE BufferSize); + + +/* + * UtRefCnt - Object reference count management + */ + +void +AcpiUtAddReference ( + ACPI_OPERAND_OBJECT *Object); + +void +AcpiUtRemoveReference ( + ACPI_OPERAND_OBJECT *Object); + +/* + * UtSize - Object size routines + */ + +ACPI_STATUS +AcpiUtGetSimpleObjectSize ( + ACPI_OPERAND_OBJECT *Obj, + ACPI_SIZE *ObjLength); + +ACPI_STATUS +AcpiUtGetPackageObjectSize ( + ACPI_OPERAND_OBJECT *Obj, + ACPI_SIZE *ObjLength); + +ACPI_STATUS +AcpiUtGetObjectSize( + ACPI_OPERAND_OBJECT *Obj, + ACPI_SIZE *ObjLength); + +ACPI_STATUS +AcpiUtGetElementLength ( + UINT8 ObjectType, + ACPI_OPERAND_OBJECT *SourceObject, + ACPI_GENERIC_STATE *State, + void *Context); + + +/* + * UtState - Generic state creation/cache routines + */ + +void +AcpiUtPushGenericState ( + ACPI_GENERIC_STATE **ListHead, + ACPI_GENERIC_STATE *State); + +ACPI_GENERIC_STATE * +AcpiUtPopGenericState ( + ACPI_GENERIC_STATE **ListHead); + + +ACPI_GENERIC_STATE * +AcpiUtCreateGenericState ( + void); + +ACPI_THREAD_STATE * +AcpiUtCreateThreadState ( + void); + +ACPI_GENERIC_STATE * +AcpiUtCreateUpdateState ( + ACPI_OPERAND_OBJECT *Object, + UINT16 Action); + +ACPI_GENERIC_STATE * +AcpiUtCreatePkgState ( + void *InternalObject, + void *ExternalObject, + UINT16 Index); + +ACPI_STATUS +AcpiUtCreateUpdateStateAndPush ( + ACPI_OPERAND_OBJECT *Object, + UINT16 Action, + ACPI_GENERIC_STATE **StateList); + +ACPI_STATUS +AcpiUtCreatePkgStateAndPush ( + void *InternalObject, + void *ExternalObject, + UINT16 Index, + ACPI_GENERIC_STATE **StateList); + +ACPI_GENERIC_STATE * +AcpiUtCreateControlState ( + void); + +void +AcpiUtDeleteGenericState ( + ACPI_GENERIC_STATE *State); + +void +AcpiUtDeleteGenericStateCache ( + void); + +void +AcpiUtDeleteObjectCache ( + void); + +/* + * utmisc + */ + +void +AcpiUtPrintString ( + char *String, + UINT8 MaxLength); + +ACPI_STATUS +AcpiUtDivide ( + ACPI_INTEGER *InDividend, + ACPI_INTEGER *InDivisor, + ACPI_INTEGER *OutQuotient, + ACPI_INTEGER *OutRemainder); + +ACPI_STATUS +AcpiUtShortDivide ( + ACPI_INTEGER *InDividend, + UINT32 Divisor, + ACPI_INTEGER *OutQuotient, + UINT32 *OutRemainder); + +BOOLEAN +AcpiUtValidAcpiName ( + UINT32 Name); + +BOOLEAN +AcpiUtValidAcpiCharacter ( + char Character); + +ACPI_STATUS +AcpiUtStrtoul64 ( + char *String, + UINT32 Base, + ACPI_INTEGER *RetInteger); + +char * +AcpiUtStrupr ( + char *SrcString); + +UINT8 * +AcpiUtGetResourceEndTag ( + ACPI_OPERAND_OBJECT *ObjDesc); + +UINT8 +AcpiUtGenerateChecksum ( + UINT8 *Buffer, + UINT32 Length); + +UINT32 +AcpiUtDwordByteSwap ( + UINT32 Value); + +void +AcpiUtSetIntegerWidth ( + UINT8 Revision); + +#ifdef ACPI_DEBUG_OUTPUT +void +AcpiUtDisplayInitPathname ( + UINT8 Type, + ACPI_NAMESPACE_NODE *ObjHandle, + char *Path); + +#endif + + +/* + * Utalloc - memory allocation and object caching + */ + +void * +AcpiUtAcquireFromCache ( + UINT32 ListId); + +void +AcpiUtReleaseToCache ( + UINT32 ListId, + void *Object); + +void +AcpiUtDeleteGenericCache ( + UINT32 ListId); + +ACPI_STATUS +AcpiUtValidateBuffer ( + ACPI_BUFFER *Buffer); + +ACPI_STATUS +AcpiUtInitializeBuffer ( + ACPI_BUFFER *Buffer, + ACPI_SIZE RequiredLength); + + +/* Memory allocation functions */ + +void * +AcpiUtAllocate ( + ACPI_SIZE Size, + UINT32 Component, + char *Module, + UINT32 Line); + +void * +AcpiUtCallocate ( + ACPI_SIZE Size, + UINT32 Component, + char *Module, + UINT32 Line); + + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + +void * +AcpiUtAllocateAndTrack ( + ACPI_SIZE Size, + UINT32 Component, + char *Module, + UINT32 Line); + +void * +AcpiUtCallocateAndTrack ( + ACPI_SIZE Size, + UINT32 Component, + char *Module, + UINT32 Line); + +void +AcpiUtFreeAndTrack ( + void *Address, + UINT32 Component, + char *Module, + UINT32 Line); + +ACPI_DEBUG_MEM_BLOCK * +AcpiUtFindAllocation ( + UINT32 ListId, + void *Allocation); + +ACPI_STATUS +AcpiUtTrackAllocation ( + UINT32 ListId, + ACPI_DEBUG_MEM_BLOCK *Address, + ACPI_SIZE Size, + UINT8 AllocType, + UINT32 Component, + char *Module, + UINT32 Line); + +ACPI_STATUS +AcpiUtRemoveAllocation ( + UINT32 ListId, + ACPI_DEBUG_MEM_BLOCK *Address, + UINT32 Component, + char *Module, + UINT32 Line); + +void +AcpiUtDumpAllocationInfo ( + void); + +void +AcpiUtDumpAllocations ( + UINT32 Component, + char *Module); +#endif + + +#endif /* _ACUTILS_H */ diff --git a/source/include/amlcode.h b/source/include/amlcode.h new file mode 100644 index 000000000..9ad376805 --- /dev/null +++ b/source/include/amlcode.h @@ -0,0 +1,569 @@ +/****************************************************************************** + * + * Name: amlcode.h - Definitions for AML, as included in "definition blocks" + * Declarations and definitions contained herein are derived + * directly from the ACPI specification. + * $Revision: 1.72 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __AMLCODE_H__ +#define __AMLCODE_H__ + +/* primary opcodes */ + +#define AML_NULL_CHAR (UINT16) 0x00 + +#define AML_ZERO_OP (UINT16) 0x00 +#define AML_ONE_OP (UINT16) 0x01 +#define AML_UNASSIGNED (UINT16) 0x02 +#define AML_ALIAS_OP (UINT16) 0x06 +#define AML_NAME_OP (UINT16) 0x08 +#define AML_BYTE_OP (UINT16) 0x0a +#define AML_WORD_OP (UINT16) 0x0b +#define AML_DWORD_OP (UINT16) 0x0c +#define AML_STRING_OP (UINT16) 0x0d +#define AML_QWORD_OP (UINT16) 0x0e /* ACPI 2.0 */ +#define AML_SCOPE_OP (UINT16) 0x10 +#define AML_BUFFER_OP (UINT16) 0x11 +#define AML_PACKAGE_OP (UINT16) 0x12 +#define AML_VAR_PACKAGE_OP (UINT16) 0x13 /* ACPI 2.0 */ +#define AML_METHOD_OP (UINT16) 0x14 +#define AML_DUAL_NAME_PREFIX (UINT16) 0x2e +#define AML_MULTI_NAME_PREFIX_OP (UINT16) 0x2f +#define AML_NAME_CHAR_SUBSEQ (UINT16) 0x30 +#define AML_NAME_CHAR_FIRST (UINT16) 0x41 +#define AML_OP_PREFIX (UINT16) 0x5b +#define AML_ROOT_PREFIX (UINT16) 0x5c +#define AML_PARENT_PREFIX (UINT16) 0x5e +#define AML_LOCAL_OP (UINT16) 0x60 +#define AML_LOCAL0 (UINT16) 0x60 +#define AML_LOCAL1 (UINT16) 0x61 +#define AML_LOCAL2 (UINT16) 0x62 +#define AML_LOCAL3 (UINT16) 0x63 +#define AML_LOCAL4 (UINT16) 0x64 +#define AML_LOCAL5 (UINT16) 0x65 +#define AML_LOCAL6 (UINT16) 0x66 +#define AML_LOCAL7 (UINT16) 0x67 +#define AML_ARG_OP (UINT16) 0x68 +#define AML_ARG0 (UINT16) 0x68 +#define AML_ARG1 (UINT16) 0x69 +#define AML_ARG2 (UINT16) 0x6a +#define AML_ARG3 (UINT16) 0x6b +#define AML_ARG4 (UINT16) 0x6c +#define AML_ARG5 (UINT16) 0x6d +#define AML_ARG6 (UINT16) 0x6e +#define AML_STORE_OP (UINT16) 0x70 +#define AML_REF_OF_OP (UINT16) 0x71 +#define AML_ADD_OP (UINT16) 0x72 +#define AML_CONCAT_OP (UINT16) 0x73 +#define AML_SUBTRACT_OP (UINT16) 0x74 +#define AML_INCREMENT_OP (UINT16) 0x75 +#define AML_DECREMENT_OP (UINT16) 0x76 +#define AML_MULTIPLY_OP (UINT16) 0x77 +#define AML_DIVIDE_OP (UINT16) 0x78 +#define AML_SHIFT_LEFT_OP (UINT16) 0x79 +#define AML_SHIFT_RIGHT_OP (UINT16) 0x7a +#define AML_BIT_AND_OP (UINT16) 0x7b +#define AML_BIT_NAND_OP (UINT16) 0x7c +#define AML_BIT_OR_OP (UINT16) 0x7d +#define AML_BIT_NOR_OP (UINT16) 0x7e +#define AML_BIT_XOR_OP (UINT16) 0x7f +#define AML_BIT_NOT_OP (UINT16) 0x80 +#define AML_FIND_SET_LEFT_BIT_OP (UINT16) 0x81 +#define AML_FIND_SET_RIGHT_BIT_OP (UINT16) 0x82 +#define AML_DEREF_OF_OP (UINT16) 0x83 +#define AML_CONCAT_RES_OP (UINT16) 0x84 /* ACPI 2.0 */ +#define AML_MOD_OP (UINT16) 0x85 /* ACPI 2.0 */ +#define AML_NOTIFY_OP (UINT16) 0x86 +#define AML_SIZE_OF_OP (UINT16) 0x87 +#define AML_INDEX_OP (UINT16) 0x88 +#define AML_MATCH_OP (UINT16) 0x89 +#define AML_CREATE_DWORD_FIELD_OP (UINT16) 0x8a +#define AML_CREATE_WORD_FIELD_OP (UINT16) 0x8b +#define AML_CREATE_BYTE_FIELD_OP (UINT16) 0x8c +#define AML_CREATE_BIT_FIELD_OP (UINT16) 0x8d +#define AML_TYPE_OP (UINT16) 0x8e +#define AML_CREATE_QWORD_FIELD_OP (UINT16) 0x8f /* ACPI 2.0 */ +#define AML_LAND_OP (UINT16) 0x90 +#define AML_LOR_OP (UINT16) 0x91 +#define AML_LNOT_OP (UINT16) 0x92 +#define AML_LEQUAL_OP (UINT16) 0x93 +#define AML_LGREATER_OP (UINT16) 0x94 +#define AML_LLESS_OP (UINT16) 0x95 +#define AML_TO_BUFFER_OP (UINT16) 0x96 /* ACPI 2.0 */ +#define AML_TO_DECSTRING_OP (UINT16) 0x97 /* ACPI 2.0 */ +#define AML_TO_HEXSTRING_OP (UINT16) 0x98 /* ACPI 2.0 */ +#define AML_TO_INTEGER_OP (UINT16) 0x99 /* ACPI 2.0 */ +#define AML_TO_STRING_OP (UINT16) 0x9c /* ACPI 2.0 */ +#define AML_COPY_OP (UINT16) 0x9d /* ACPI 2.0 */ +#define AML_MID_OP (UINT16) 0x9e /* ACPI 2.0 */ +#define AML_CONTINUE_OP (UINT16) 0x9f /* ACPI 2.0 */ +#define AML_IF_OP (UINT16) 0xa0 +#define AML_ELSE_OP (UINT16) 0xa1 +#define AML_WHILE_OP (UINT16) 0xa2 +#define AML_NOOP_OP (UINT16) 0xa3 +#define AML_RETURN_OP (UINT16) 0xa4 +#define AML_BREAK_OP (UINT16) 0xa5 +#define AML_BREAK_POINT_OP (UINT16) 0xcc +#define AML_ONES_OP (UINT16) 0xff + +/* prefixed opcodes */ + +#define AML_EXTOP (UINT16) 0x005b + + +#define AML_MUTEX_OP (UINT16) 0x5b01 +#define AML_EVENT_OP (UINT16) 0x5b02 +#define AML_SHIFT_RIGHT_BIT_OP (UINT16) 0x5b10 +#define AML_SHIFT_LEFT_BIT_OP (UINT16) 0x5b11 +#define AML_COND_REF_OF_OP (UINT16) 0x5b12 +#define AML_CREATE_FIELD_OP (UINT16) 0x5b13 +#define AML_LOAD_TABLE_OP (UINT16) 0x5b1f /* ACPI 2.0 */ +#define AML_LOAD_OP (UINT16) 0x5b20 +#define AML_STALL_OP (UINT16) 0x5b21 +#define AML_SLEEP_OP (UINT16) 0x5b22 +#define AML_ACQUIRE_OP (UINT16) 0x5b23 +#define AML_SIGNAL_OP (UINT16) 0x5b24 +#define AML_WAIT_OP (UINT16) 0x5b25 +#define AML_RESET_OP (UINT16) 0x5b26 +#define AML_RELEASE_OP (UINT16) 0x5b27 +#define AML_FROM_BCD_OP (UINT16) 0x5b28 +#define AML_TO_BCD_OP (UINT16) 0x5b29 +#define AML_UNLOAD_OP (UINT16) 0x5b2a +#define AML_REVISION_OP (UINT16) 0x5b30 +#define AML_DEBUG_OP (UINT16) 0x5b31 +#define AML_FATAL_OP (UINT16) 0x5b32 +#define AML_REGION_OP (UINT16) 0x5b80 +#define AML_FIELD_OP (UINT16) 0x5b81 +#define AML_DEVICE_OP (UINT16) 0x5b82 +#define AML_PROCESSOR_OP (UINT16) 0x5b83 +#define AML_POWER_RES_OP (UINT16) 0x5b84 +#define AML_THERMAL_ZONE_OP (UINT16) 0x5b85 +#define AML_INDEX_FIELD_OP (UINT16) 0x5b86 +#define AML_BANK_FIELD_OP (UINT16) 0x5b87 +#define AML_DATA_REGION_OP (UINT16) 0x5b88 /* ACPI 2.0 */ + + +/* Bogus opcodes (they are actually two separate opcodes) */ + +#define AML_LGREATEREQUAL_OP (UINT16) 0x9295 +#define AML_LLESSEQUAL_OP (UINT16) 0x9294 +#define AML_LNOTEQUAL_OP (UINT16) 0x9293 + + +/* + * Internal opcodes + * Use only "Unknown" AML opcodes, don't attempt to use + * any valid ACPI ASCII values (A-Z, 0-9, '-') + */ + +#define AML_INT_NAMEPATH_OP (UINT16) 0x002d +#define AML_INT_NAMEDFIELD_OP (UINT16) 0x0030 +#define AML_INT_RESERVEDFIELD_OP (UINT16) 0x0031 +#define AML_INT_ACCESSFIELD_OP (UINT16) 0x0032 +#define AML_INT_BYTELIST_OP (UINT16) 0x0033 +#define AML_INT_STATICSTRING_OP (UINT16) 0x0034 +#define AML_INT_METHODCALL_OP (UINT16) 0x0035 +#define AML_INT_RETURN_VALUE_OP (UINT16) 0x0036 +#define AML_INT_EVAL_SUBTREE_OP (UINT16) 0x0037 + + +#define ARG_NONE 0x0 + +/* + * Argument types for the AML Parser + * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments. + * There can be up to 31 unique argument types + */ + +#define ARGP_BYTEDATA 0x01 +#define ARGP_BYTELIST 0x02 +#define ARGP_CHARLIST 0x03 +#define ARGP_DATAOBJ 0x04 +#define ARGP_DATAOBJLIST 0x05 +#define ARGP_DWORDDATA 0x06 +#define ARGP_FIELDLIST 0x07 +#define ARGP_NAME 0x08 +#define ARGP_NAMESTRING 0x09 +#define ARGP_OBJLIST 0x0A +#define ARGP_PKGLENGTH 0x0B +#define ARGP_SUPERNAME 0x0C +#define ARGP_TARGET 0x0D +#define ARGP_TERMARG 0x0E +#define ARGP_TERMLIST 0x0F +#define ARGP_WORDDATA 0x10 +#define ARGP_QWORDDATA 0x11 +#define ARGP_SIMPLENAME 0x12 + +/* + * Resolved argument types for the AML Interpreter + * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments. + * There can be up to 31 unique argument types (0 is end-of-arg-list indicator) + * + * Note: If and when 5 bits becomes insufficient, it would probably be best + * to convert to a 6-byte array of argument types, allowing 8 bits per argument. + */ + +/* "Standard" ACPI types are 1-15 (0x0F) */ + +#define ARGI_INTEGER ACPI_TYPE_INTEGER /* 1 */ +#define ARGI_STRING ACPI_TYPE_STRING /* 2 */ +#define ARGI_BUFFER ACPI_TYPE_BUFFER /* 3 */ +#define ARGI_PACKAGE ACPI_TYPE_PACKAGE /* 4 */ +#define ARGI_EVENT ACPI_TYPE_EVENT +#define ARGI_MUTEX ACPI_TYPE_MUTEX +#define ARGI_REGION ACPI_TYPE_REGION +#define ARGI_DDBHANDLE ACPI_TYPE_DDB_HANDLE + +/* Custom types are 0x10 through 0x1F */ + +#define ARGI_IF 0x10 +#define ARGI_ANYOBJECT 0x11 +#define ARGI_ANYTYPE 0x12 +#define ARGI_COMPUTEDATA 0x13 /* Buffer, String, or Integer */ +#define ARGI_DATAOBJECT 0x14 /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/ +#define ARGI_COMPLEXOBJ 0x15 /* Buffer, String, or package (Used by INDEX op only) */ +#define ARGI_INTEGER_REF 0x16 +#define ARGI_OBJECT_REF 0x17 +#define ARGI_DEVICE_REF 0x18 +#define ARGI_REFERENCE 0x19 +#define ARGI_TARGETREF 0x1A /* Target, subject to implicit conversion */ +#define ARGI_FIXED_TARGET 0x1B /* Target, no implicit conversion */ +#define ARGI_SIMPLE_TARGET 0x1C /* Name, Local, Arg -- no implicit conversion */ +#define ARGI_BUFFERSTRING 0x1D +#define ARGI_REF_OR_STRING 0x1E /* Reference or String (Used by DEREFOF op only) */ + +#define ARGI_INVALID_OPCODE 0xFFFFFFFF + + +/* + * hash offsets + */ +#define AML_EXTOP_HASH_OFFSET 22 +#define AML_LNOT_HASH_OFFSET 19 + + +/* + * opcode groups and types + */ + +#define OPGRP_NAMED 0x01 +#define OPGRP_FIELD 0x02 +#define OPGRP_BYTELIST 0x04 + + +/* + * Opcode information + */ + +/* Opcode flags */ + +#define AML_HAS_ARGS 0x0800 +#define AML_HAS_TARGET 0x0400 +#define AML_HAS_RETVAL 0x0200 +#define AML_NSOBJECT 0x0100 +#define AML_NSOPCODE 0x0080 +#define AML_NSNODE 0x0040 +#define AML_NAMED 0x0020 +#define AML_DEFER 0x0010 +#define AML_FIELD 0x0008 +#define AML_CREATE 0x0004 +#define AML_MATH 0x0002 +#define AML_LOGICAL 0x0001 +#define AML_CONSTANT 0x1000 + +/* Convenient flag groupings */ + +#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ +#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ +#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET +#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Monadic2R */ +#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ +#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ +#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Dyadic2R */ +#define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL +#define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS +#define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL +#define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL + + +/* + * The opcode Type is used in a dispatch table, do not change + * without updating the table. + */ +#define AML_TYPE_EXEC_1A_0T_0R 0x00 /* Monadic1 */ +#define AML_TYPE_EXEC_1A_0T_1R 0x01 /* Monadic2 */ +#define AML_TYPE_EXEC_1A_1T_0R 0x02 +#define AML_TYPE_EXEC_1A_1T_1R 0x03 /* Monadic2R */ +#define AML_TYPE_EXEC_2A_0T_0R 0x04 /* Dyadic1 */ +#define AML_TYPE_EXEC_2A_0T_1R 0x05 /* Dyadic2 */ +#define AML_TYPE_EXEC_2A_1T_1R 0x06 /* Dyadic2R */ +#define AML_TYPE_EXEC_2A_2T_1R 0x07 +#define AML_TYPE_EXEC_3A_0T_0R 0x08 +#define AML_TYPE_EXEC_3A_1T_1R 0x09 +#define AML_TYPE_EXEC_6A_0T_1R 0x0A +/* End of types used in dispatch table */ + +#define AML_TYPE_LITERAL 0x0B +#define AML_TYPE_CONSTANT 0x0C +#define AML_TYPE_METHOD_ARGUMENT 0x0D +#define AML_TYPE_LOCAL_VARIABLE 0x0E +#define AML_TYPE_DATA_TERM 0x0F + +/* Generic for an op that returns a value */ + +#define AML_TYPE_METHOD_CALL 0x10 + +/* Misc */ + +#define AML_TYPE_CREATE_FIELD 0x11 +#define AML_TYPE_CREATE_OBJECT 0x12 +#define AML_TYPE_CONTROL 0x13 +#define AML_TYPE_NAMED_NO_OBJ 0x14 +#define AML_TYPE_NAMED_FIELD 0x15 +#define AML_TYPE_NAMED_SIMPLE 0x16 +#define AML_TYPE_NAMED_COMPLEX 0x17 +#define AML_TYPE_RETURN 0x18 + +#define AML_TYPE_UNDEFINED 0x19 +#define AML_TYPE_BOGUS 0x1A + + +/* + * Opcode classes + */ +#define AML_CLASS_EXECUTE 0x00 +#define AML_CLASS_CREATE 0x01 +#define AML_CLASS_ARGUMENT 0x02 +#define AML_CLASS_NAMED_OBJECT 0x03 +#define AML_CLASS_CONTROL 0x04 +#define AML_CLASS_ASCII 0x05 +#define AML_CLASS_PREFIX 0x06 +#define AML_CLASS_INTERNAL 0x07 +#define AML_CLASS_RETURN_VALUE 0x08 +#define AML_CLASS_METHOD_CALL 0x09 +#define AML_CLASS_UNKNOWN 0x0A + + +/* Predefined Operation Region SpaceIDs */ + +typedef enum +{ + REGION_MEMORY = 0, + REGION_IO, + REGION_PCI_CONFIG, + REGION_EC, + REGION_SMBUS, + REGION_CMOS, + REGION_PCI_BAR, + REGION_DATA_TABLE, /* Internal use only */ + REGION_FIXED_HW = 0x7F + +} AML_REGION_TYPES; + + +/* Comparison operation codes for MatchOp operator */ + +typedef enum +{ + MATCH_MTR = 0, + MATCH_MEQ = 1, + MATCH_MLE = 2, + MATCH_MLT = 3, + MATCH_MGE = 4, + MATCH_MGT = 5 + +} AML_MATCH_OPERATOR; + +#define MAX_MATCH_OPERATOR 5 + + +/* + * FieldFlags + * + * This byte is extracted from the AML and includes three separate + * pieces of information about the field: + * 1) The field access type + * 2) The field update rule + * 3) The lock rule for the field + * + * Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.) + * 04 : LockRule (1 == Lock) + * 05 - 06 : UpdateRule + */ +#define AML_FIELD_ACCESS_TYPE_MASK 0x0F +#define AML_FIELD_LOCK_RULE_MASK 0x10 +#define AML_FIELD_UPDATE_RULE_MASK 0x60 + + +/* 1) Field Access Types */ + +typedef enum +{ + AML_FIELD_ACCESS_ANY = 0x00, + AML_FIELD_ACCESS_BYTE = 0x01, + AML_FIELD_ACCESS_WORD = 0x02, + AML_FIELD_ACCESS_DWORD = 0x03, + AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ + AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */ + +} AML_ACCESS_TYPE; + + +/* 2) Field Lock Rules */ + +typedef enum +{ + AML_FIELD_LOCK_NEVER = 0x00, + AML_FIELD_LOCK_ALWAYS = 0x10 + +} AML_LOCK_RULE; + + +/* 3) Field Update Rules */ + +typedef enum +{ + AML_FIELD_UPDATE_PRESERVE = 0x00, + AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, + AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40 + +} AML_UPDATE_RULE; + + +/* + * Field Access Attributes. + * This byte is extracted from the AML via the + * AccessAs keyword + */ +typedef enum +{ + AML_FIELD_ATTRIB_SMB_QUICK = 0x02, + AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, + AML_FIELD_ATTRIB_SMB_BYTE = 0x06, + AML_FIELD_ATTRIB_SMB_WORD = 0x08, + AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, + AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, + AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D + +} AML_ACCESS_ATTRIBUTE; + + +/* bit fields in MethodFlags byte */ + +#define METHOD_FLAGS_ARG_COUNT 0x07 +#define METHOD_FLAGS_SERIALIZED 0x08 +#define METHOD_FLAGS_SYNCH_LEVEL 0xF0 + + +#endif /* __AMLCODE_H__ */ diff --git a/source/include/amlresrc.h b/source/include/amlresrc.h new file mode 100644 index 000000000..ccb4f54aa --- /dev/null +++ b/source/include/amlresrc.h @@ -0,0 +1,423 @@ + +/****************************************************************************** + * + * Module Name: amlresrc.h - AML resource descriptors + * $Revision: 1.23 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + + +#ifndef __AMLRESRC_H +#define __AMLRESRC_H + + +#define ASL_RESNAME_ADDRESS "_ADR" +#define ASL_RESNAME_ALIGNMENT "_ALN" +#define ASL_RESNAME_ADDRESSSPACE "_ASI" +#define ASL_RESNAME_BASEADDRESS "_BAS" +#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ +#define ASL_RESNAME_DECODE "_DEC" +#define ASL_RESNAME_DMA "_DMA" +#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ +#define ASL_RESNAME_GRANULARITY "_GRA" +#define ASL_RESNAME_INTERRUPT "_INT" +#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */ +#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */ +#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ +#define ASL_RESNAME_LENGTH "_LEN" +#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ +#define ASL_RESNAME_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ +#define ASL_RESNAME_MAXADDR "_MAX" +#define ASL_RESNAME_MINADDR "_MIN" +#define ASL_RESNAME_MAXTYPE "_MAF" +#define ASL_RESNAME_MINTYPE "_MIF" +#define ASL_RESNAME_REGISTERBITOFFSET "_RBO" +#define ASL_RESNAME_REGISTERBITWIDTH "_RBW" +#define ASL_RESNAME_RANGETYPE "_RNG" +#define ASL_RESNAME_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */ +#define ASL_RESNAME_TRANSLATION "_TRA" +#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ +#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ +#define ASL_RESNAME_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */ + + +/* Default sizes for "small" resource descriptors */ + +#define ASL_RDESC_IRQ_SIZE 0x02 +#define ASL_RDESC_DMA_SIZE 0x02 +#define ASL_RDESC_ST_DEPEND_SIZE 0x00 +#define ASL_RDESC_END_DEPEND_SIZE 0x00 +#define ASL_RDESC_IO_SIZE 0x07 +#define ASL_RDESC_FIXED_IO_SIZE 0x03 +#define ASL_RDESC_END_TAG_SIZE 0x01 + + +typedef struct asl_resource_node +{ + UINT32 BufferLength; + void *Buffer; + struct asl_resource_node *Next; + +} ASL_RESOURCE_NODE; + + +/* + * Resource descriptors defined in the ACPI specification. + * + * Alignment must be BYTE because these descriptors + * are used to overlay the AML byte stream. + */ +#pragma pack(1) + +typedef struct asl_irq_format_desc +{ + UINT8 DescriptorType; + UINT16 IrqMask; + UINT8 Flags; + +} ASL_IRQ_FORMAT_DESC; + + +typedef struct asl_irq_noflags_desc +{ + UINT8 DescriptorType; + UINT16 IrqMask; + +} ASL_IRQ_NOFLAGS_DESC; + + +typedef struct asl_dma_format_desc +{ + UINT8 DescriptorType; + UINT8 DmaChannelMask; + UINT8 Flags; + +} ASL_DMA_FORMAT_DESC; + + +typedef struct asl_start_dependent_desc +{ + UINT8 DescriptorType; + UINT8 Flags; + +} ASL_START_DEPENDENT_DESC; + + +typedef struct asl_start_dependent_noprio_desc +{ + UINT8 DescriptorType; + +} ASL_START_DEPENDENT_NOPRIO_DESC; + + +typedef struct asl_end_dependent_desc +{ + UINT8 DescriptorType; + +} ASL_END_DEPENDENT_DESC; + + +typedef struct asl_io_port_desc +{ + UINT8 DescriptorType; + UINT8 Information; + UINT16 AddressMin; + UINT16 AddressMax; + UINT8 Alignment; + UINT8 Length; + +} ASL_IO_PORT_DESC; + + +typedef struct asl_fixed_io_port_desc +{ + UINT8 DescriptorType; + UINT16 BaseAddress; + UINT8 Length; + +} ASL_FIXED_IO_PORT_DESC; + + +typedef struct asl_small_vendor_desc +{ + UINT8 DescriptorType; + UINT8 VendorDefined[7]; + +} ASL_SMALL_VENDOR_DESC; + + +typedef struct asl_end_tag_desc +{ + UINT8 DescriptorType; + UINT8 Checksum; + +} ASL_END_TAG_DESC; + + +/* LARGE descriptors */ + +typedef struct asl_memory_24_desc +{ + UINT8 DescriptorType; + UINT16 Length; + UINT8 Information; + UINT16 AddressMin; + UINT16 AddressMax; + UINT16 Alignment; + UINT16 RangeLength; + +} ASL_MEMORY_24_DESC; + + +typedef struct asl_large_vendor_desc +{ + UINT8 DescriptorType; + UINT16 Length; + UINT8 VendorDefined[1]; + +} ASL_LARGE_VENDOR_DESC; + + +typedef struct asl_memory_32_desc +{ + UINT8 DescriptorType; + UINT16 Length; + UINT8 Information; + UINT32 AddressMin; + UINT32 AddressMax; + UINT32 Alignment; + UINT32 RangeLength; + +} ASL_MEMORY_32_DESC; + + +typedef struct asl_fixed_memory_32_desc +{ + UINT8 DescriptorType; + UINT16 Length; + UINT8 Information; + UINT32 BaseAddress; + UINT32 RangeLength; + +} ASL_FIXED_MEMORY_32_DESC; + + +typedef struct asl_qword_address_desc +{ + UINT8 DescriptorType; + UINT16 Length; + UINT8 ResourceType; + UINT8 Flags; + UINT8 SpecificFlags; + UINT64 Granularity; + UINT64 AddressMin; + UINT64 AddressMax; + UINT64 TranslationOffset; + UINT64 AddressLength; + UINT8 OptionalFields[2]; + +} ASL_QWORD_ADDRESS_DESC; + + +typedef struct asl_dword_address_desc +{ + UINT8 DescriptorType; + UINT16 Length; + UINT8 ResourceType; + UINT8 Flags; + UINT8 SpecificFlags; + UINT32 Granularity; + UINT32 AddressMin; + UINT32 AddressMax; + UINT32 TranslationOffset; + UINT32 AddressLength; + UINT8 OptionalFields[2]; + +} ASL_DWORD_ADDRESS_DESC; + + +typedef struct asl_word_address_desc +{ + UINT8 DescriptorType; + UINT16 Length; + UINT8 ResourceType; + UINT8 Flags; + UINT8 SpecificFlags; + UINT16 Granularity; + UINT16 AddressMin; + UINT16 AddressMax; + UINT16 TranslationOffset; + UINT16 AddressLength; + UINT8 OptionalFields[2]; + +} ASL_WORD_ADDRESS_DESC; + + +typedef struct asl_extended_xrupt_desc +{ + UINT8 DescriptorType; + UINT16 Length; + UINT8 Flags; + UINT8 TableLength; + UINT32 InterruptNumber[1]; + /* ResSourceIndex, ResSource optional fields follow */ + +} ASL_EXTENDED_XRUPT_DESC; + + +typedef struct asl_general_register_desc +{ + UINT8 DescriptorType; + UINT16 Length; + UINT8 AddressSpaceId; + UINT8 BitWidth; + UINT8 BitOffset; + UINT8 Reserved; + UINT64 Address; + +} ASL_GENERAL_REGISTER_DESC; + +/* restore default alignment */ + +#pragma pack() + +/* Union of all resource descriptors, sow we can allocate the worst case */ + +typedef union asl_resource_desc +{ + ASL_IRQ_FORMAT_DESC Irq; + ASL_DMA_FORMAT_DESC Dma; + ASL_START_DEPENDENT_DESC Std; + ASL_END_DEPENDENT_DESC End; + ASL_IO_PORT_DESC Iop; + ASL_FIXED_IO_PORT_DESC Fio; + ASL_SMALL_VENDOR_DESC Smv; + ASL_END_TAG_DESC Et; + + ASL_MEMORY_24_DESC M24; + ASL_LARGE_VENDOR_DESC Lgv; + ASL_MEMORY_32_DESC M32; + ASL_FIXED_MEMORY_32_DESC F32; + ASL_QWORD_ADDRESS_DESC Qas; + ASL_DWORD_ADDRESS_DESC Das; + ASL_WORD_ADDRESS_DESC Was; + ASL_EXTENDED_XRUPT_DESC Exx; + ASL_GENERAL_REGISTER_DESC Grg; + UINT32 U32Item; + UINT16 U16Item; + UINT8 U8Item; + +} ASL_RESOURCE_DESC; + + +#endif + diff --git a/source/include/platform/acefi.h b/source/include/platform/acefi.h new file mode 100644 index 000000000..3746171fd --- /dev/null +++ b/source/include/platform/acefi.h @@ -0,0 +1,150 @@ +/****************************************************************************** + * + * Name: acefi.h - OS specific defines, etc. + * $Revision: 1.13 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACEFI_H__ +#define __ACEFI_H__ + +#define ACPI_OS_NAME "AED EFI" + +#include +#include +#include + + +/* _int64 works for both IA32 and IA64 */ + +#define COMPILER_DEPENDENT_INT64 __int64 +#define COMPILER_DEPENDENT_UINT64 unsigned __int64 + +/* + * Calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces + */ +#define ACPI_SYSTEM_XFACE +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE + +/* warn C4142: redefinition of type */ + +#pragma warning(disable:4142) + + +#endif /* __ACEFI_H__ */ diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h new file mode 100644 index 000000000..591136b02 --- /dev/null +++ b/source/include/platform/acenv.h @@ -0,0 +1,436 @@ +/****************************************************************************** + * + * Name: acenv.h - Generation environment specific items + * $Revision: 1.103 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACENV_H__ +#define __ACENV_H__ + + +/* + * Configuration for ACPI tools and utilities + */ + +#ifdef _ACPI_DUMP_APP +#ifndef MSDOS +#define ACPI_DEBUG_OUTPUT +#endif +#define ACPI_APPLICATION +#define ACPI_DISASSEMBLER +#define ACPI_NO_METHOD_EXECUTION +#define ACPI_USE_SYSTEM_CLIBRARY +#endif + +#ifdef _ACPI_EXEC_APP +#undef DEBUGGER_THREADING +#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED +#define ACPI_DEBUG_OUTPUT +#define ACPI_APPLICATION +#define ACPI_DEBUGGER +#define ACPI_DISASSEMBLER +#define ACPI_USE_SYSTEM_CLIBRARY +#endif + +#ifdef _ACPI_ASL_COMPILER +#define ACPI_DEBUG_OUTPUT +#define ACPI_APPLICATION +#define ACPI_DISASSEMBLER +#define ACPI_CONSTANT_EVAL_ONLY +#define ACPI_USE_SYSTEM_CLIBRARY +#endif + +/* + * Environment configuration. The purpose of this file is to interface to the + * local generation environment. + * + * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library. + * Otherwise, local versions of string/memory functions will be used. + * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and + * the standard header files may be used. + * + * The ACPI subsystem only uses low level C library functions that do not call + * operating system services and may therefore be inlined in the code. + * + * It may be necessary to tailor these include files to the target + * generation environment. + * + * + * Functions and constants used from each header: + * + * string.h: memcpy + * memset + * strcat + * strcmp + * strcpy + * strlen + * strncmp + * strncat + * strncpy + * + * stdlib.h: strtoul + * + * stdarg.h: va_list + * va_arg + * va_start + * va_end + * + */ + +/*! [Begin] no source code translation */ + +#if defined(_LINUX) +#include "aclinux.h" + +#elif defined(_AED_EFI) +#include "acefi.h" + +#elif defined(WIN32) +#include "acwin.h" + +#elif defined(WIN64) +#include "acwin64.h" + +#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ +#include "acdos16.h" + +#elif defined(__FreeBSD__) +#include "acfreebsd.h" + +#elif defined(MODESTO) +#include "acmodesto.h" + +#elif defined(NETWARE) +#include "acnetware.h" + +#else + +/* All other environments */ + +#define ACPI_USE_STANDARD_HEADERS + +#define COMPILER_DEPENDENT_INT64 long long +#define COMPILER_DEPENDENT_UINT64 unsigned long long + + +/* Name of host operating system (returned by the _OS_ namespace object) */ + +#define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem" + +/* This macro is used to tag functions as "printf-like" because + * some compilers can catch printf format string problems. MSVC + * doesn't, so this is proprocessed away. + */ +#define ACPI_PRINTF_LIKE_FUNC + +#endif + +/* + * Memory allocation tracking. Used only if + * 1) This is the debug version + * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) + */ +#ifdef ACPI_DEBUG_OUTPUT +#if ACPI_MACHINE_WIDTH != 16 +#define ACPI_DBG_TRACK_ALLOCATIONS +#endif +#endif + +/*! [End] no source code translation !*/ + + +/* + * Debugger threading model + * Use single threaded if the entire subsystem is contained in an application + * Use multiple threaded when the subsystem is running in the kernel. + * + * By default the model is single threaded if ACPI_APPLICATION is set, + * multi-threaded if ACPI_APPLICATION is not set. + */ +#define DEBUGGER_SINGLE_THREADED 0 +#define DEBUGGER_MULTI_THREADED 1 + +#ifdef ACPI_APPLICATION +#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED + +#else +#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED +#endif + + +/****************************************************************************** + * + * C library configuration + * + *****************************************************************************/ + +#ifdef ACPI_USE_SYSTEM_CLIBRARY +/* + * Use the standard C library headers. + * We want to keep these to a minimum. + */ + +#ifdef ACPI_USE_STANDARD_HEADERS +/* + * Use the standard headers from the standard locations + */ +#include +#include +#include +#include + +#endif /* ACPI_USE_STANDARD_HEADERS */ + +/* + * We will be linking to the standard Clib functions + */ + +#define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) +#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s)) +#define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s)) +#define ACPI_STRCPY(d,s) (void) strcpy((d), (s)) +#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n)) +#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (ACPI_SIZE)(n)) +#define ACPI_STRCMP(d,s) strcmp((d), (s)) +#define ACPI_STRCAT(d,s) (void) strcat((d), (s)) +#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (ACPI_SIZE)(n)) +#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n)) +#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) +#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) + +#define ACPI_TOUPPER toupper +#define ACPI_TOLOWER tolower +#define ACPI_IS_XDIGIT isxdigit +#define ACPI_IS_DIGIT isdigit +#define ACPI_IS_SPACE isspace +#define ACPI_IS_UPPER isupper +#define ACPI_IS_PRINT isprint +#define ACPI_IS_ALPHA isalpha +#define ACPI_IS_ASCII isascii + +/****************************************************************************** + * + * Not using native C library, use local implementations + * + *****************************************************************************/ +#else + +/* + * Use local definitions of C library macros and functions + * NOTE: The function implementations may not be as efficient + * as an inline or assembly code implementation provided by a + * native C library. + */ + +#ifndef va_arg + +#ifndef _VALIST +#define _VALIST +typedef char *va_list; +#endif /* _VALIST */ + +/* + * Storage alignment properties + */ + +#define _AUPBND (sizeof (ACPI_NATIVE_INT) - 1) +#define _ADNBND (sizeof (ACPI_NATIVE_INT) - 1) + +/* + * Variable argument list macro definitions + */ + +#define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) +#define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND)))) +#define va_end(ap) (void) 0 +#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND)))) + +#endif /* va_arg */ + + +#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2)) +#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s)) +#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s)) +#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s)) +#define ACPI_STRNCPY(d,s,n) (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n)) +#define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n)) +#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s)) +#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s)) +#define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n)) +#define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n)) +#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n)) +#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n)) +#define ACPI_TOUPPER AcpiUtToUpper +#define ACPI_TOLOWER AcpiUtToLower + +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ + + +/****************************************************************************** + * + * Assembly code macros + * + *****************************************************************************/ + +/* + * Handle platform- and compiler-specific assembly language differences. + * These should already have been defined by the platform includes above. + * + * Notes: + * 1) Interrupt 3 is used to break into a debugger + * 2) Interrupts are turned off during ACPI register setup + */ + +/* Unrecognized compiler, use defaults */ + +#ifndef ACPI_ASM_MACROS + +/* + * Calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces + */ +#define ACPI_SYSTEM_XFACE +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE + +#define ACPI_ASM_MACROS +#define BREAKPOINT3 +#define ACPI_DISABLE_IRQS() +#define ACPI_ENABLE_IRQS() +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) + +#endif /* ACPI_ASM_MACROS */ + + +#ifdef ACPI_APPLICATION + +/* Don't want software interrupts within a ring3 application */ + +#undef BREAKPOINT3 +#define BREAKPOINT3 +#endif + + +/****************************************************************************** + * + * Compiler-specific information is contained in the compiler-specific + * headers. + * + *****************************************************************************/ +#endif /* __ACENV_H__ */ diff --git a/source/include/platform/acfreebsd.h b/source/include/platform/acfreebsd.h new file mode 100644 index 000000000..6ade7cef4 --- /dev/null +++ b/source/include/platform/acfreebsd.h @@ -0,0 +1,200 @@ +/****************************************************************************** + * + * Name: acfreebsd.h - OS specific defines, etc. + * $Revision: 1.11 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACFREEBSD_H__ +#define __ACFREEBSD_H__ + +/* + * XXX this is technically correct, but will cause problems with some ASL + * which only works if the string names a Microsoft operating system. + */ +#define ACPI_OS_NAME "FreeBSD" + +/* FreeBSD uses GCC */ + +#include "acgcc.h" +#include + +#ifdef _KERNEL +#include +#include +#include +#include +#include + +#define asm __asm +#define __cli() disable_intr() +#define __sti() enable_intr() + +#ifdef ACPI_DEBUG_OUTPUT +#ifdef DEBUGGER_THREADING +#undef DEBUGGER_THREADING +#endif /* DEBUGGER_THREADING */ +#define DEBUGGER_THREADING 0 /* integrated with DDB */ +#include "opt_ddb.h" +#ifdef DDB +#define ACPI_DEBUGGER +#endif /* DDB */ +#endif /* ACPI_DEBUG_OUTPUT */ + +#else /* _KERNEL */ + +/* Not building kernel code, so use libc */ +#define ACPI_USE_STANDARD_HEADERS + +#define __cli() +#define __sti() + +#endif /* _KERNEL */ + +/* Always use FreeBSD code over our local versions */ +#define ACPI_USE_SYSTEM_CLIBRARY + +/* FreeBSD doesn't have strupr, should be fixed. (move to libkern) */ +static __inline char * +strupr(char *str) +{ + char *c = str; + while(*c) { + *c = toupper(*c); + c++; + } + return(str); +} + +#ifdef _KERNEL +/* Or strstr (used in debugging mode, also move to libkern) */ +static __inline char * +strstr(char *s, char *find) +{ + char c, sc; + size_t len; + + if ((c = *find++) != 0) { + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while (sc != c); + } while (strncmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} +#endif /* _KERNEL */ + +#endif /* __ACFREEBSD_H__ */ diff --git a/source/include/platform/acgcc.h b/source/include/platform/acgcc.h new file mode 100644 index 000000000..8c040d7c2 --- /dev/null +++ b/source/include/platform/acgcc.h @@ -0,0 +1,132 @@ +/****************************************************************************** + * + * Name: acgcc.h - GCC specific defines, etc. + * $Revision: 1.25 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACGCC_H__ +#define __ACGCC_H__ + +/* This macro is used to tag functions as "printf-like" because + * some compilers (like GCC) can catch printf format string problems. + */ +#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5))) + +/* Some compilers complain about unused variables. Sometimes we don't want to + * use all the variables (most specifically for _THIS_MODULE). This allow us + * to to tell the compiler warning in a per-variable manner that a variable + * is unused. + */ +#define ACPI_UNUSED_VAR __attribute__ ((unused)) + +#endif /* __ACGCC_H__ */ diff --git a/source/include/platform/acintel.h b/source/include/platform/acintel.h new file mode 100644 index 000000000..2eaec5d70 --- /dev/null +++ b/source/include/platform/acintel.h @@ -0,0 +1,176 @@ +/****************************************************************************** + * + * Name: acintel.h - VC specific defines, etc. + * $Revision: 1.10 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACINTEL_H__ +#define __ACINTEL_H__ + + +#define COMPILER_DEPENDENT_INT64 __int64 +#define COMPILER_DEPENDENT_UINT64 unsigned __int64 + +/* + * Calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces + */ +#define ACPI_SYSTEM_XFACE +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE + +/* + * Math helper functions + */ +#define ACPI_DIV_64_BY_32(n, n_hi, n_lo, d32, q32, r32) \ +{ \ + q32 = n / d32; \ + r32 = n % d32; \ +} + +#define ACPI_SHIFT_RIGHT_64(n, n_hi, n_lo) \ +{ \ + n <<= 1; \ +} + +/* remark 981 - operands evaluated in no particular order */ +#pragma warning(disable:981) + +/* warn C4100: unreferenced formal parameter */ +#pragma warning(disable:4100) + +/* warn C4127: conditional expression is constant */ +#pragma warning(disable:4127) + +/* warn C4706: assignment within conditional expression */ +#pragma warning(disable:4706) + +/* This macro is used to tag functions as "printf-like" because + * some compilers can catch printf format string problems. MSVC + * doesn't, so this is proprocessed away. + */ +#define ACPI_PRINTF_LIKE_FUNC + +/* Some compilers complain about unused variables. Sometimes we don't want to + * use all the variables (most specifically for _THIS_MODULE). This allow us + * to to tell the compiler warning in a per-variable manner that a variable + * is unused. However, MSVC doesn't do this. + */ +#define ACPI_UNUSED_VAR + +#endif /* __ACINTEL_H__ */ diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h new file mode 100644 index 000000000..50bac8648 --- /dev/null +++ b/source/include/platform/aclinux.h @@ -0,0 +1,164 @@ +/****************************************************************************** + * + * Name: aclinux.h - OS specific defines, etc. + * $Revision: 1.30 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACLINUX_H__ +#define __ACLINUX_H__ + +#define ACPI_OS_NAME "Linux" + +#define ACPI_USE_SYSTEM_CLIBRARY + +#ifdef __KERNEL__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define strtoul simple_strtoul + +#define ACPI_MACHINE_WIDTH BITS_PER_LONG + +#else /* !__KERNEL__ */ + +#include +#include +#include +#include +#include + +#if defined(__ia64__) || defined(__x86_64__) +#define ACPI_MACHINE_WIDTH 64 +#define COMPILER_DEPENDENT_INT64 long +#define COMPILER_DEPENDENT_UINT64 unsigned long +#else +#define ACPI_MACHINE_WIDTH 32 +#define COMPILER_DEPENDENT_INT64 long long +#define COMPILER_DEPENDENT_UINT64 unsigned long long +#define ACPI_USE_NATIVE_DIVIDE +#endif + +#endif /* __KERNEL__ */ + +/* Linux uses GCC */ + +#include "acgcc.h" + +#endif /* __ACLINUX_H__ */ diff --git a/source/include/platform/acmsvc.h b/source/include/platform/acmsvc.h new file mode 100644 index 000000000..cedc65a56 --- /dev/null +++ b/source/include/platform/acmsvc.h @@ -0,0 +1,194 @@ +/****************************************************************************** + * + * Name: acmsvc.h - VC specific defines, etc. + * $Revision: 1.16 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACMSVC_H__ +#define __ACMSVC_H__ + +#define COMPILER_DEPENDENT_INT64 __int64 +#define COMPILER_DEPENDENT_UINT64 unsigned __int64 + +/* + * Calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces + */ +#define ACPI_SYSTEM_XFACE __cdecl +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE __cdecl + +#ifndef _LINT +/* + * Math helper functions + */ +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ +{ \ + __asm mov edx, n_hi \ + __asm mov eax, n_lo \ + __asm div d32 \ + __asm mov q32, eax \ + __asm mov r32, edx \ +} + +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ +{ \ + __asm shr n_hi, 1 \ + __asm rcr n_lo, 1 \ +} +#else + +/* Fake versions to make lint happy */ + +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ +{ \ + q32 = n_hi / d32; \ + r32 = n_lo / d32; \ +} + +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ +{ \ + n_hi >>= 1; \ + n_lo >>= 1; \ +} +#endif + +/* warn C4100: unreferenced formal parameter */ +#pragma warning(disable:4100) + +/* warn C4127: conditional expression is constant */ +#pragma warning(disable:4127) + +/* warn C4706: assignment within conditional expression */ +#pragma warning(disable:4706) + +/* This macro is used to tag functions as "printf-like" because + * some compilers can catch printf format string problems. MSVC + * doesn't, so this is proprocessed away. + */ +#define ACPI_PRINTF_LIKE_FUNC + +/* Some compilers complain about unused variables. Sometimes we don't want to + * use all the variables (most specifically for _THIS_MODULE). This allow us + * to to tell the compiler warning in a per-variable manner that a variable + * is unused. However, MSVC doesn't do this. + */ +#define ACPI_UNUSED_VAR + + +#endif /* __ACMSVC_H__ */ diff --git a/source/include/platform/acwin.h b/source/include/platform/acwin.h new file mode 100644 index 000000000..6322e41e5 --- /dev/null +++ b/source/include/platform/acwin.h @@ -0,0 +1,194 @@ +/****************************************************************************** + * + * Name: acwin.h - OS specific defines, etc. + * $Revision: 1.15 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACWIN_H__ +#define __ACWIN_H__ + +/*! [Begin] no source code translation (Keep the include) */ + +/* Windows uses VC */ +#ifdef _MSC_VER +#include "acmsvc.h" +#endif +/*! [End] no source code translation !*/ + +#define ACPI_OS_NAME "Windows" + +#define ACPI_MACHINE_WIDTH 32 + +#define strupr _strupr +#define isascii __isascii + +#define ACPI_USE_STANDARD_HEADERS + +/* + * Handle platform- and compiler-specific assembly language differences. + * + * Notes: + * 1) Interrupt 3 is used to break into a debugger + * 2) Interrupts are turned off during ACPI register setup + */ + +/*! [Begin] no source code translation */ + +#define ACPI_ASM_MACROS +#define BREAKPOINT3 __asm {int 3} +#define ACPI_DISABLE_IRQS() __asm {cli} +#define ACPI_ENABLE_IRQS() __asm {sti} +#define ACPI_FLUSH_CPU_CACHE() __asm {WBINVD} + + +/* + * For Acpi applications, we don't want to try to access the global lock + */ +#ifdef ACPI_APPLICATION +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) if (AcpiGbl_GlobalLockPresent) Acq = TRUE; +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) Pnd = 0; +#else +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) __asm { \ + __asm mov ecx, GLptr \ + __asm acq10: \ + __asm mov eax, [ecx] \ + __asm mov edx, eax \ + __asm and edx, 0xFFFFFFFE \ + __asm bts edx, 1 \ + __asm adc edx, 0 \ + __asm lock cmpxchg dword ptr [ecx], edx \ + __asm jnz acq10 \ + \ + __asm cmp dl, 3 \ + __asm sbb eax, eax \ + __asm mov Acq, al \ +} + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) __asm { \ + __asm mov ecx, GLptr \ + __asm Rel10: \ + __asm mov eax, [ecx] \ + __asm mov edx, eax \ + __asm and edx, 0xFFFFFFFC \ + __asm lock cmpxchg dword ptr [ecx], edx \ + __asm jnz Rel10 \ + \ + __asm cmp dl, 3 \ + __asm and eax, 1 \ + __asm mov Pnd, al \ +} + +#endif + + +#endif /* __ACWIN_H__ */ diff --git a/source/include/platform/acwin64.h b/source/include/platform/acwin64.h new file mode 100644 index 000000000..63a13d02a --- /dev/null +++ b/source/include/platform/acwin64.h @@ -0,0 +1,165 @@ +/****************************************************************************** + * + * Name: acwin.h - OS specific defines, etc. + * $Revision: 1.10 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACWIN64_H__ +#define __ACWIN64_H__ + +/*! [Begin] no source code translation (Keep the include) */ + +#include "acintel.h" +/*! [End] no source code translation !*/ + +#define ACPI_OS_NAME "Windows" + +#define ACPI_MACHINE_WIDTH 64 + +#define strupr _strupr +#define ACPI_USE_STANDARD_HEADERS + +/* + * Handle platform- and compiler-specific assembly language differences. + * + * Notes: + * 1) Interrupt 3 is used to break into a debugger + * 2) Interrupts are turned off during ACPI register setup + */ + +/*! [Begin] no source code translation */ + +#define ACPI_ASM_MACROS +#define causeinterrupt(level) +#define BREAKPOINT3 +#define ACPI_DISABLE_IRQS() +#define ACPI_ENABLE_IRQS() +#define ACPI_FLUSH_CPU_CACHE() + + +/* + * For Acpi applications, we don't want to try to access the global lock + */ +#ifdef ACPI_APPLICATION +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) if (AcpiGbl_GlobalLockPresent) {Acq = 0xFF;} else {Acq = 0;} +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) if (AcpiGbl_GlobalLockPresent) {Pnd = 0xFF;} else {Pnd = 0;} +#else + +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) + +#endif + + +#endif /* __ACWIN_H__ */