From 2608583e58df6167d5572de06971c657a3842c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 3 Apr 2008 20:49:28 +0000 Subject: [PATCH] merging acpica-20080321 in trunk git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24783 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/acpi/common/16bit.h | 2 +- .../kernel/bus_managers/acpi/common/a16find.c | 4 +- .../bus_managers/acpi/common/a16utils.obj | Bin 2665 -> 2670 bytes .../kernel/bus_managers/acpi/common/adfile.c | 4 +- .../kernel/bus_managers/acpi/common/adisasm.c | 66 +- .../kernel/bus_managers/acpi/common/adwalk.c | 4 +- .../bus_managers/acpi/common/dmrestag.c | 4 +- .../kernel/bus_managers/acpi/common/dmtable.c | 149 +++- .../bus_managers/acpi/common/dmtbdump.c | 310 +++++++- .../bus_managers/acpi/common/dmtbinfo.c | 150 +++- .../kernel/bus_managers/acpi/common/getopt.c | 4 +- .../bus_managers/acpi/compiler/Makefile | 4 +- .../bus_managers/acpi/compiler/aslanalyze.c | 12 +- .../bus_managers/acpi/compiler/aslcodegen.c | 4 +- .../bus_managers/acpi/compiler/aslcompile.c | 14 +- .../bus_managers/acpi/compiler/aslcompiler.h | 14 +- .../bus_managers/acpi/compiler/aslcompiler.l | 4 +- .../bus_managers/acpi/compiler/asldefine.h | 6 +- .../bus_managers/acpi/compiler/aslerror.c | 30 +- .../bus_managers/acpi/compiler/aslfiles.c | 6 +- .../bus_managers/acpi/compiler/aslfold.c | 4 +- .../bus_managers/acpi/compiler/aslglobal.h | 9 +- .../bus_managers/acpi/compiler/asllength.c | 4 +- .../bus_managers/acpi/compiler/asllisting.c | 4 +- .../bus_managers/acpi/compiler/aslload.c | 7 +- .../bus_managers/acpi/compiler/asllookup.c | 70 +- .../bus_managers/acpi/compiler/aslmain.c | 152 +--- .../bus_managers/acpi/compiler/aslmap.c | 6 +- .../bus_managers/acpi/compiler/aslopcodes.c | 4 +- .../bus_managers/acpi/compiler/asloperands.c | 19 +- .../bus_managers/acpi/compiler/aslopt.c | 4 +- .../bus_managers/acpi/compiler/aslresource.c | 4 +- .../bus_managers/acpi/compiler/aslrestype1.c | 4 +- .../bus_managers/acpi/compiler/aslrestype2.c | 4 +- .../bus_managers/acpi/compiler/aslstartup.c | 452 ++++++++++++ .../bus_managers/acpi/compiler/aslstubs.c | 12 +- .../bus_managers/acpi/compiler/asltransform.c | 31 +- .../bus_managers/acpi/compiler/asltree.c | 5 +- .../bus_managers/acpi/compiler/asltypes.h | 10 +- .../bus_managers/acpi/compiler/aslutils.c | 18 +- .../bus_managers/acpi/debugger/dbcmds.c | 46 +- .../bus_managers/acpi/debugger/dbdisply.c | 52 +- .../bus_managers/acpi/debugger/dbexec.c | 130 +++- .../bus_managers/acpi/debugger/dbfileio.c | 6 +- .../bus_managers/acpi/debugger/dbhistry.c | 4 +- .../bus_managers/acpi/debugger/dbinput.c | 6 +- .../bus_managers/acpi/debugger/dbstats.c | 55 +- .../bus_managers/acpi/debugger/dbutils.c | 52 +- .../bus_managers/acpi/debugger/dbxface.c | 4 +- .../bus_managers/acpi/disassembler/dmbuffer.c | 4 +- .../bus_managers/acpi/disassembler/dmnames.c | 4 +- .../bus_managers/acpi/disassembler/dmobject.c | 21 +- .../bus_managers/acpi/disassembler/dmopcode.c | 15 +- .../bus_managers/acpi/disassembler/dmresrc.c | 7 +- .../bus_managers/acpi/disassembler/dmresrcl.c | 4 +- .../bus_managers/acpi/disassembler/dmresrcs.c | 4 +- .../bus_managers/acpi/disassembler/dmutils.c | 4 +- .../bus_managers/acpi/disassembler/dmwalk.c | 4 +- .../kernel/bus_managers/acpi/events/evevent.c | 6 +- .../kernel/bus_managers/acpi/events/evgpe.c | 100 ++- .../bus_managers/acpi/events/evgpeblk.c | 25 +- .../kernel/bus_managers/acpi/events/evmisc.c | 126 ++-- .../bus_managers/acpi/events/evregion.c | 14 +- .../bus_managers/acpi/events/evrgnini.c | 4 +- .../kernel/bus_managers/acpi/events/evsci.c | 5 +- .../kernel/bus_managers/acpi/events/evxface.c | 23 +- .../bus_managers/acpi/events/evxfevnt.c | 4 +- .../bus_managers/acpi/events/evxfregn.c | 4 +- .../bus_managers/acpi/hardware/hwacpi.c | 4 +- .../kernel/bus_managers/acpi/hardware/hwgpe.c | 4 +- .../bus_managers/acpi/hardware/hwregs.c | 37 +- .../bus_managers/acpi/hardware/hwsleep.c | 15 +- .../bus_managers/acpi/hardware/hwtimer.c | 4 +- .../kernel/bus_managers/acpi/include/acapps.h | 5 +- .../bus_managers/acpi/include/acconfig.h | 17 +- .../bus_managers/acpi/include/acdebug.h | 15 +- .../bus_managers/acpi/include/acdisasm.h | 48 +- .../bus_managers/acpi/include/acdispat.h | 43 +- .../bus_managers/acpi/include/acevents.h | 4 +- .../bus_managers/acpi/include/acexcep.h | 4 +- .../bus_managers/acpi/include/acglobal.h | 132 ++-- .../bus_managers/acpi/include/achware.h | 4 +- .../bus_managers/acpi/include/acinterp.h | 22 +- .../bus_managers/acpi/include/aclocal.h | 35 +- .../bus_managers/acpi/include/acmacros.h | 125 +--- .../bus_managers/acpi/include/acnames.h | 4 +- .../bus_managers/acpi/include/acnamesp.h | 7 +- .../bus_managers/acpi/include/acobject.h | 7 +- .../bus_managers/acpi/include/acopcode.h | 8 +- .../bus_managers/acpi/include/acoutput.h | 4 +- .../bus_managers/acpi/include/acparser.h | 8 +- .../kernel/bus_managers/acpi/include/acpi.h | 4 +- .../bus_managers/acpi/include/acpiosxf.h | 2 +- .../kernel/bus_managers/acpi/include/acpixf.h | 15 +- .../bus_managers/acpi/include/acresrc.h | 5 +- .../bus_managers/acpi/include/acstruct.h | 7 +- .../bus_managers/acpi/include/actables.h | 4 +- .../kernel/bus_managers/acpi/include/actbl.h | 4 +- .../kernel/bus_managers/acpi/include/actbl1.h | 666 +++++++++++++++++- .../kernel/bus_managers/acpi/include/actbl2.h | 4 +- .../bus_managers/acpi/include/actypes.h | 168 ++--- .../bus_managers/acpi/include/acutils.h | 12 +- .../bus_managers/acpi/include/amlcode.h | 4 +- .../bus_managers/acpi/include/amlresrc.h | 4 +- .../acpi/include/platform/acdos16.h | 7 +- .../acpi/include/platform/acefi.h | 4 +- .../acpi/include/platform/acenv.h | 6 +- .../acpi/include/platform/acfreebsd.h | 26 +- .../acpi/include/platform/acgcc.h | 4 +- .../acpi/include/platform/acintel.h | 4 +- .../acpi/include/platform/aclinux.h | 7 +- .../acpi/include/platform/acmsvc.h | 4 +- .../acpi/include/platform/acnetbsd.h | 4 +- .../acpi/include/platform/acwin.h | 4 +- .../acpi/include/platform/acwin64.h | 4 +- .../acpi/interpreter/dispatcher/dsfield.c | 192 ++--- .../acpi/interpreter/dispatcher/dsinit.c | 4 +- .../acpi/interpreter/dispatcher/dsmethod.c | 62 +- .../acpi/interpreter/dispatcher/dsmthdat.c | 6 +- .../acpi/interpreter/dispatcher/dsobject.c | 147 +++- .../acpi/interpreter/dispatcher/dsopcode.c | 280 +++++++- .../acpi/interpreter/dispatcher/dsutils.c | 173 ++++- .../acpi/interpreter/dispatcher/dswexec.c | 91 +-- .../acpi/interpreter/dispatcher/dswload.c | 40 +- .../acpi/interpreter/dispatcher/dswscope.c | 4 +- .../acpi/interpreter/dispatcher/dswstate.c | 577 ++++----------- .../acpi/interpreter/executer/exconfig.c | 107 ++- .../acpi/interpreter/executer/exconvrt.c | 4 +- .../acpi/interpreter/executer/excreate.c | 133 +--- .../acpi/interpreter/executer/exdump.c | 62 +- .../acpi/interpreter/executer/exfield.c | 61 +- .../acpi/interpreter/executer/exfldio.c | 48 +- .../acpi/interpreter/executer/exmisc.c | 4 +- .../acpi/interpreter/executer/exmutex.c | 258 +++++-- .../acpi/interpreter/executer/exnames.c | 4 +- .../acpi/interpreter/executer/exoparg1.c | 30 +- .../acpi/interpreter/executer/exoparg2.c | 27 +- .../acpi/interpreter/executer/exoparg3.c | 5 +- .../acpi/interpreter/executer/exoparg6.c | 13 +- .../acpi/interpreter/executer/exprep.c | 15 +- .../acpi/interpreter/executer/exregion.c | 15 +- .../acpi/interpreter/executer/exresnte.c | 16 +- .../acpi/interpreter/executer/exresolv.c | 59 +- .../acpi/interpreter/executer/exresop.c | 15 +- .../acpi/interpreter/executer/exstore.c | 113 ++- .../acpi/interpreter/executer/exstoren.c | 4 +- .../acpi/interpreter/executer/exstorob.c | 4 +- .../acpi/interpreter/executer/exsystem.c | 5 +- .../acpi/interpreter/executer/exutils.c | 78 +- .../acpi/interpreter/parser/psargs.c | 58 +- .../acpi/interpreter/parser/psloop.c | 68 +- .../acpi/interpreter/parser/psopcode.c | 36 +- .../acpi/interpreter/parser/psparse.c | 45 +- .../acpi/interpreter/parser/psscope.c | 4 +- .../acpi/interpreter/parser/pstree.c | 6 +- .../acpi/interpreter/parser/psutils.c | 4 +- .../acpi/interpreter/parser/pswalk.c | 4 +- .../acpi/interpreter/parser/psxface.c | 4 +- .../bus_managers/acpi/namespace/nsaccess.c | 97 ++- .../bus_managers/acpi/namespace/nsalloc.c | 15 +- .../bus_managers/acpi/namespace/nsdump.c | 8 +- .../bus_managers/acpi/namespace/nsdumpdv.c | 4 +- .../bus_managers/acpi/namespace/nseval.c | 4 +- .../bus_managers/acpi/namespace/nsinit.c | 14 +- .../bus_managers/acpi/namespace/nsload.c | 8 +- .../bus_managers/acpi/namespace/nsnames.c | 10 +- .../bus_managers/acpi/namespace/nsobject.c | 4 +- .../bus_managers/acpi/namespace/nsparse.c | 29 +- .../bus_managers/acpi/namespace/nssearch.c | 4 +- .../bus_managers/acpi/namespace/nsutils.c | 5 +- .../bus_managers/acpi/namespace/nswalk.c | 9 +- .../bus_managers/acpi/namespace/nsxfeval.c | 39 +- .../bus_managers/acpi/namespace/nsxfname.c | 4 +- .../bus_managers/acpi/namespace/nsxfobj.c | 4 +- .../bus_managers/acpi/resources/rsaddr.c | 4 +- .../bus_managers/acpi/resources/rscalc.c | 32 +- .../bus_managers/acpi/resources/rscreate.c | 4 +- .../bus_managers/acpi/resources/rsdump.c | 10 +- .../bus_managers/acpi/resources/rsinfo.c | 4 +- .../kernel/bus_managers/acpi/resources/rsio.c | 43 +- .../bus_managers/acpi/resources/rsirq.c | 47 +- .../bus_managers/acpi/resources/rslist.c | 4 +- .../bus_managers/acpi/resources/rsmemory.c | 4 +- .../bus_managers/acpi/resources/rsmisc.c | 16 +- .../bus_managers/acpi/resources/rsutils.c | 10 +- .../bus_managers/acpi/resources/rsxface.c | 4 +- .../kernel/bus_managers/acpi/tables/tbfadt.c | 37 +- .../kernel/bus_managers/acpi/tables/tbfind.c | 24 +- .../bus_managers/acpi/tables/tbinstal.c | 22 +- .../kernel/bus_managers/acpi/tables/tbutils.c | 8 +- .../kernel/bus_managers/acpi/tables/tbxface.c | 112 ++- .../bus_managers/acpi/tables/tbxfroot.c | 8 +- .../bus_managers/acpi/utilities/utalloc.c | 14 +- .../bus_managers/acpi/utilities/utcache.c | 11 +- .../bus_managers/acpi/utilities/utclib.c | 4 +- .../bus_managers/acpi/utilities/utcopy.c | 180 ++--- .../bus_managers/acpi/utilities/utdebug.c | 28 +- .../bus_managers/acpi/utilities/utdelete.c | 27 +- .../bus_managers/acpi/utilities/uteval.c | 21 +- .../bus_managers/acpi/utilities/utglobal.c | 77 +- .../bus_managers/acpi/utilities/utinit.c | 7 +- .../bus_managers/acpi/utilities/utmath.c | 6 +- .../bus_managers/acpi/utilities/utmisc.c | 8 +- .../bus_managers/acpi/utilities/utmutex.c | 4 +- .../bus_managers/acpi/utilities/utobject.c | 90 ++- .../bus_managers/acpi/utilities/utresrc.c | 4 +- .../bus_managers/acpi/utilities/utstate.c | 4 +- .../bus_managers/acpi/utilities/uttrack.c | 14 +- .../bus_managers/acpi/utilities/utxface.c | 56 +- 209 files changed, 5516 insertions(+), 2451 deletions(-) create mode 100755 src/add-ons/kernel/bus_managers/acpi/compiler/aslstartup.c diff --git a/src/add-ons/kernel/bus_managers/acpi/common/16bit.h b/src/add-ons/kernel/bus_managers/acpi/common/16bit.h index 6173256377..4eebbe35d0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/16bit.h +++ b/src/add-ons/kernel/bus_managers/acpi/common/16bit.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/a16find.c b/src/add-ons/kernel/bus_managers/acpi/common/a16find.c index 4f85e029be..d90c5f21cc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/a16find.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/a16find.c @@ -2,7 +2,7 @@ * * Module Name: a16find - 16-bit (real mode) routines to find ACPI * tables in memory - * $Revision: 1.41 $ + * $Revision: 1.43 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/a16utils.obj b/src/add-ons/kernel/bus_managers/acpi/common/a16utils.obj index fac87b16b55cf2d56a47f64535fe69fe7ae172c8..696723d9b34030d4e25c1248450ec6d046e2d276 100644 GIT binary patch delta 38 qcmaDU@=j!eA|vlcMIS~+-pRR)-xzr}Co}P}0jWZcJ0LM%E*Svc8wyAO delta 53 zcmaDS@=|1i;zlJO#>x4N-!`W)@v&_#<+#Hr!*GOCfRRa@;fMf`QeikE3Z#4(RJ)iM G7)k)b5eSignature); AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length); AcpiOsPrintf (" * Revision 0x%2.2X\n", Table->Revision); + + /* Print and validate the table checksum */ + + AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum); + + Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length); + if (Checksum) + { + AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X", + (UINT8) (Table->Checksum - Checksum)); + } + AcpiOsPrintf ("\n"); + AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId); AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId); AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision); - AcpiOsPrintf (" * Creator ID \"%.4s\"\n", Table->AslCompilerId); - AcpiOsPrintf (" * Creator Revision 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); + AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId); + AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); AcpiOsPrintf (" */\n"); /* Create AML output filename based on input filename */ @@ -674,6 +705,8 @@ AdCreateTableHeader ( "DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n", NewFilename, Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); + + ACPI_FREE (NewFilename); } @@ -904,6 +937,7 @@ AdParseDeferredOps ( case AML_CREATE_BYTE_FIELD_OP: case AML_CREATE_BIT_FIELD_OP: case AML_CREATE_FIELD_OP: + case AML_BANK_FIELD_OP: /* Nothing to do in these cases */ @@ -1046,7 +1080,8 @@ AdGetLocalTables ( ACPI_STATUS AdParseTable ( - ACPI_TABLE_HEADER *Table) + ACPI_TABLE_HEADER *Table, + BOOLEAN LoadTable) { ACPI_STATUS Status = AE_OK; ACPI_WALK_STATE *WalkState; @@ -1102,16 +1137,19 @@ AdParseTable ( /* Pass 2 */ - Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table, - Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex); - if (ACPI_FAILURE (Status)) + if (LoadTable) { - return Status; + Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table, + Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex); + if (ACPI_FAILURE (Status)) + { + return Status; + } } fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature); - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0, NULL); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c b/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c index 6fd47d1f69..0cf22736cc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: adwalk - Application-level disassembler parse tree walk routines - * $Revision: 1.5 $ + * $Revision: 1.7 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c b/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c index 3f26a93ad8..22aaedc0c3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dmrestag - Add tags to resource descriptors (Application-level) - * $Revision: 1.10 $ + * $Revision: 1.12 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c b/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c index b3455a6824..4713efe418 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dmtable - Support for ACPI tables that contain no AML code - * $Revision: 1.11 $ + * $Revision: 1.16 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -137,6 +137,16 @@ AcpiDmCheckAscii ( /* These tables map a subtable type to a description string */ +static const char *AcpiDmAsfSubnames[] = +{ + "ASF Information", + "ASF Alerts", + "ASF Remote Control", + "ASF RMCP Boot Options", + "ASF Address", + "Unknown SubTable Type" /* Reserved */ +}; + static const char *AcpiDmDmarSubnames[] = { "Hardware Unit Definition", @@ -144,6 +154,31 @@ static const char *AcpiDmDmarSubnames[] = "Unknown SubTable Type" /* Reserved */ }; +static const char *AcpiDmHestSubnames[] = +{ + "XPF Machine Check Exception", + "XPF Corrected Machine Check", + "NOT USED???", + "XPF Non-Maskable Interrupt", + "IPF Corrected Machine Check", + "IPF Corrected Platform Error", + "PCI Express Root Port AER", + "PCI Express AER (AER Endpoint)", + "PCI Express/PCI-X Bridge AERn", + "Generic Hardware Error Source", + "Unknown SubTable Type" /* Reserved */ +}; + +static const char *AcpiDmHestNotifySubnames[] = +{ + "Polled", + "External Interrupt", + "Local Interrupt", + "SCI", + "NMI", + "Unknown Notify Type" /* Reserved */ +}; + static const char *AcpiDmMadtSubnames[] = { "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */ @@ -180,16 +215,21 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] = { {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, "Alert Standard Format table"}, {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, "Simple Boot Flag Table"}, + {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, "Boot Error Record Table"}, {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, "Corrected Platform Error Polling table"}, {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, "Debug Port table"}, {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, "DMA Remapping table"}, {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, "Embedded Controller Boot Resources Table"}, + {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, "Error Injection table"}, + {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, "Error Record Serialization Table"}, {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"}, + {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, "Hardware Error Source Table"}, {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"}, {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"}, {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"}, + {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, "System Locality Information Table"}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, "Serial Port Console Redirection table"}, {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"}, @@ -284,6 +324,7 @@ void AcpiDmDumpDataTable ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_DMTABLE_DATA *TableData; UINT32 Length; @@ -314,7 +355,11 @@ AcpiDmDumpDataTable ( * All other tables must use the common ACPI table header, dump it now */ Length = Table->Length; - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); + if (ACPI_FAILURE (Status)) + { + return; + } AcpiOsPrintf ("\n"); /* Match signature and dispatch appropriately */ @@ -419,7 +464,7 @@ AcpiDmLineHeader2 ( * TableOffset - Starting offset within the table for this * sub-descriptor (0 if main table) * Table - The ACPI table - * SubtableLength - Lenghth of this sub-descriptor + * SubtableLength - Length of this sub-descriptor * Info - Info table for this ACPI table * * RETURN: None @@ -428,7 +473,7 @@ AcpiDmLineHeader2 ( * ******************************************************************************/ -void +ACPI_STATUS AcpiDmDumpTable ( UINT32 TableLength, UINT32 TableOffset, @@ -442,12 +487,13 @@ AcpiDmDumpTable ( UINT8 Temp8; UINT16 Temp16; ACPI_DMTABLE_DATA *TableData; + BOOLEAN LastOutputBlankLine = FALSE; if (!Info) { AcpiOsPrintf ("Display not implemented\n"); - return; + return (AE_NOT_IMPLEMENTED); } /* Walk entire Info table; Null name terminates */ @@ -466,7 +512,8 @@ AcpiDmDumpTable ( if ((CurrentOffset >= TableLength) || (SubtableLength && (Info->Offset >= SubtableLength))) { - return; + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return (AE_BAD_DATA); } /* Generate the byte length for this field */ @@ -478,10 +525,13 @@ AcpiDmDumpTable ( case ACPI_DMT_SPACEID: case ACPI_DMT_MADT: case ACPI_DMT_SRAT: + case ACPI_DMT_ASF: + case ACPI_DMT_HESTNTYP: ByteLength = 1; break; case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: + case ACPI_DMT_HEST: ByteLength = 2; break; case ACPI_DMT_UINT24: @@ -506,14 +556,32 @@ AcpiDmDumpTable ( ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1; break; case ACPI_DMT_GAS: - AcpiOsPrintf ("\n"); + if (!LastOutputBlankLine) + { + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + } ByteLength = sizeof (ACPI_GENERIC_ADDRESS); break; + case ACPI_DMT_HESTNTFY: + if (!LastOutputBlankLine) + { + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + } + ByteLength = sizeof (ACPI_HEST_NOTIFY); + break; default: ByteLength = 0; break; } + if (CurrentOffset + ByteLength > TableLength) + { + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return (AE_BAD_DATA); + } + /* Start a new line and decode the opcode */ AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name); @@ -571,9 +639,11 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT56: - AcpiOsPrintf ("%6.6X%8.8X\n", - ACPI_HIDWORD (ACPI_GET64 (Target)) & 0x00FFFFFF, - ACPI_LODWORD (ACPI_GET64 (Target))); + for (Temp8 = 0; Temp8 < 7; Temp8++) + { + AcpiOsPrintf ("%2.2X", Target[Temp8]); + } + AcpiOsPrintf ("\n"); break; case ACPI_DMT_UINT64: @@ -649,6 +719,21 @@ AcpiDmDumpTable ( AcpiOsPrintf ("\n"); AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, CurrentOffset, Target, 0, AcpiDmTableInfoGas); + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + break; + + case ACPI_DMT_ASF: + + /* ASF subtable types */ + + Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */ + if (Temp16 > ACPI_ASF_TYPE_RESERVED) + { + Temp16 = ACPI_ASF_TYPE_RESERVED; + } + + AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]); break; case ACPI_DMT_DMAR: @@ -664,6 +749,42 @@ AcpiDmDumpTable ( AcpiOsPrintf ("%4.4X <%s>\n", *Target, AcpiDmDmarSubnames[Temp16]); break; + case ACPI_DMT_HEST: + + /* HEST subtable types */ + + Temp16 = *Target; + if (Temp16 > ACPI_HEST_TYPE_RESERVED) + { + Temp16 = ACPI_HEST_TYPE_RESERVED; + } + + AcpiOsPrintf ("%4.4X (%s)\n", *Target, AcpiDmHestSubnames[Temp16]); + break; + + case ACPI_DMT_HESTNTFY: + + AcpiOsPrintf ("\n"); + AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, + CurrentOffset, Target, 0, AcpiDmTableInfoHestNotify); + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + break; + + case ACPI_DMT_HESTNTYP: + + /* HEST Notify types */ + + Temp8 = *Target; + if (Temp8 > ACPI_HEST_NOTIFY_RESERVED) + { + Temp8 = ACPI_HEST_NOTIFY_RESERVED; + } + + AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]); + break; + + case ACPI_DMT_MADT: /* MADT subtable types */ @@ -691,14 +812,16 @@ AcpiDmDumpTable ( break; case ACPI_DMT_EXIT: - return; + return (AE_OK); default: ACPI_ERROR ((AE_INFO, "**** Invalid table opcode [%X] ****\n", Info->Opcode)); - return; + return (AE_SUPPORT); } } + + return (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c b/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c index c0e0d62b0a..186c9543d9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code - * $Revision: 1.14 $ + * $Revision: 1.18 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -289,6 +289,7 @@ void AcpiDmDumpAsf ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_HEADER); ACPI_ASF_INFO *SubTable; ACPI_DMTABLE_INFO *InfoTable; @@ -307,7 +308,12 @@ AcpiDmDumpAsf ( { /* Common sub-table header */ - AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoAsfHdr); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Header.Length, AcpiDmTableInfoAsfHdr); + if (ACPI_FAILURE (Status)) + { + return; + } switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */ { @@ -349,8 +355,12 @@ AcpiDmDumpAsf ( return; } - AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Header.Length, InfoTable); - + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Header.Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } /* Dump variable-length extra data */ @@ -362,7 +372,12 @@ AcpiDmDumpAsf ( for (i = 0; i < DataCount; i++) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Table->Length, DataOffset, DataTable, DataLength, DataInfoTable); + Status = AcpiDmDumpTable (Table->Length, DataOffset, + DataTable, DataLength, DataInfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength); DataOffset += DataLength; @@ -381,6 +396,11 @@ AcpiDmDumpAsf ( AcpiOsPrintf ("%2.2X ", *DataTable); DataTable++; DataOffset++; + if (DataOffset > Table->Length) + { + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return; + } } AcpiOsPrintf ("\n"); @@ -391,6 +411,12 @@ AcpiDmDumpAsf ( /* Point to next sub-table */ + if (!SubTable->Header.Length) + { + AcpiOsPrintf ("Invalid zero subtable header length\n"); + return; + } + Offset += SubTable->Header.Length; SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length); } @@ -414,6 +440,7 @@ void AcpiDmDumpCpep ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_CPEP_POLLING *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_CPEP); @@ -421,7 +448,11 @@ AcpiDmDumpCpep ( /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -429,7 +460,12 @@ AcpiDmDumpCpep ( while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, AcpiDmTableInfoCpep0); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoCpep0); + if (ACPI_FAILURE (Status)) + { + return; + } /* Point to next sub-table */ @@ -456,6 +492,7 @@ void AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_DMAR_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_DMAR); @@ -468,7 +505,11 @@ AcpiDmDumpDmar ( /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -478,7 +519,12 @@ AcpiDmDumpDmar ( /* Common sub-table header */ AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoDmarHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoDmarHdr); + if (ACPI_FAILURE (Status)) + { + return; + } switch (SubTable->Type) { @@ -495,7 +541,12 @@ AcpiDmDumpDmar ( return; } - AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } /* * Currently, a common flag indicates whether there are any @@ -509,8 +560,12 @@ AcpiDmDumpDmar ( while (ScopeOffset < SubTable->Length) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, - ScopeTable->Length, AcpiDmTableInfoDmarScope); + Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, + ScopeTable->Length, AcpiDmTableInfoDmarScope); + if (ACPI_FAILURE (Status)) + { + return; + } /* Dump the PCI Path entries for this device scope */ @@ -546,6 +601,180 @@ AcpiDmDumpDmar ( } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpEinj + * + * PARAMETERS: Table - A EINJ table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a EINJ. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpEinj ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_WHEA_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_EINJ); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + 0, AcpiDmTableInfoEinj0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += sizeof (ACPI_WHEA_HEADER); + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + sizeof (ACPI_WHEA_HEADER)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpErst + * + * PARAMETERS: Table - A ERST table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a ERST. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpErst ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_WHEA_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_ERST); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + 0, AcpiDmTableInfoEinj0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += sizeof (ACPI_WHEA_HEADER); + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + sizeof (ACPI_WHEA_HEADER)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpHest + * + * PARAMETERS: Table - A HEST table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a HEST. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpHest ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_HEST_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_HEST); + ACPI_DMTABLE_INFO *InfoTable; + UINT32 SubTableLength; + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* TBD: add new subtable types as examples become available */ + + switch (SubTable->Type) + { + case ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE: + InfoTable = AcpiDmTableInfoHest9; + SubTableLength = sizeof (ACPI_HEST_GENERIC); + break; + + default: + AcpiOsPrintf ("\n**** Unknown HEST sub-table type %X\n", SubTable->Type); + return; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + 0, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += SubTableLength; + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpMadt @@ -563,6 +792,7 @@ void AcpiDmDumpMadt ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_SUBTABLE_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_MADT); @@ -571,7 +801,11 @@ AcpiDmDumpMadt ( /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -581,7 +815,12 @@ AcpiDmDumpMadt ( /* Common sub-table header */ AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoMadtHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoMadtHdr); + if (ACPI_FAILURE (Status)) + { + return; + } switch (SubTable->Type) { @@ -617,7 +856,12 @@ AcpiDmDumpMadt ( return; } - AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } /* Point to next sub-table */ @@ -643,13 +887,18 @@ void AcpiDmDumpMcfg ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_MCFG); ACPI_MCFG_ALLOCATION *SubTable; /* Main table */ - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -664,7 +913,11 @@ AcpiDmDumpMcfg ( } AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoMcfg0); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoMcfg0); + if (ACPI_FAILURE (Status)) + { + return; + } /* Point to next sub-table (each subtable is of fixed length) */ @@ -691,6 +944,7 @@ void AcpiDmDumpSlit ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; UINT32 Offset; UINT8 *Row; UINT32 Localities; @@ -700,7 +954,11 @@ AcpiDmDumpSlit ( /* Main table */ - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit); + if (ACPI_FAILURE (Status)) + { + return; + } /* Display the Locality NxN Matrix */ @@ -759,6 +1017,7 @@ void AcpiDmDumpSrat ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_SRAT); ACPI_SUBTABLE_HEADER *SubTable; ACPI_DMTABLE_INFO *InfoTable; @@ -766,7 +1025,11 @@ AcpiDmDumpSrat ( /* Main table */ - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -787,7 +1050,12 @@ AcpiDmDumpSrat ( } AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } /* Point to next sub-table */ diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c b/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c index c58b2bf5b2..bd1d4c8c91 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dmtbinfo - Table info for non-AML tables - * $Revision: 1.12 $ + * $Revision: 1.17 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -130,10 +130,14 @@ #define ACPI_HDR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEADER,f) #define ACPI_RSDP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_RSDP,f) #define ACPI_BOOT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BOOT,f) +#define ACPI_BERT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BERT,f) #define ACPI_CPEP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_CPEP,f) #define ACPI_DBGP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DBGP,f) #define ACPI_DMAR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DMAR,f) #define ACPI_ECDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ECDT,f) +#define ACPI_EINJ_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_EINJ,f) +#define ACPI_ERST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ERST,f) +#define ACPI_HEST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEST,f) #define ACPI_HPET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HPET,f) #define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f) #define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f) @@ -145,7 +149,7 @@ #define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f) #define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f) -/* Sub-tables */ +/* Subtables */ #define ACPI_ASF0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_INFO,f) #define ACPI_ASF1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT,f) @@ -158,6 +162,9 @@ #define ACPI_DMARS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f) #define ACPI_DMAR0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f) #define ACPI_DMAR1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f) +#define ACPI_EINJ0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) +#define ACPI_HEST9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_GENERIC,f) +#define ACPI_HESTN_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) #define ACPI_MADT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f) #define ACPI_MADT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_APIC,f) #define ACPI_MADT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f) @@ -396,11 +403,11 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] = * ******************************************************************************/ -/* Common sub-table header (one per sub-table) */ +/* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] = { - {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Type), "Sub-Table Type"}, + {ACPI_DMT_ASF, ACPI_ASF0_OFFSET (Header.Type), "Subtable Type"}, {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Reserved), "Reserved"}, {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (Header.Length), "Length"}, {ACPI_DMT_EXIT, 0, NULL} @@ -494,6 +501,20 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] = }; +/******************************************************************************* + * + * BERT - Boot Error Record table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoBert[] = +{ + {ACPI_DMT_UINT32, ACPI_BERT_OFFSET (RegionLength), "Boot Error Region Length"}, + {ACPI_DMT_UINT64, ACPI_BERT_OFFSET (Address), "Boot Error Region Address"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + /******************************************************************************* * * BOOT - Simple Boot Flag Table @@ -522,7 +543,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] = ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] = { - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Sub-Table Type"}, + {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Subtable Type"}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Length), "Length"}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID"}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID"}, @@ -558,11 +579,11 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] = {ACPI_DMT_EXIT, 0, NULL} }; -/* Common sub-table header (one per sub-table) */ +/* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[] = { - {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Sub-Table Type"}, + {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Subtable Type"}, {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Header.Length), "Length"}, {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Header.Flags), "Flags"}, {ACPI_DMT_UINT24, ACPI_DMAR0_OFFSET (Header.Reserved[0]), "Reserved"}, @@ -580,7 +601,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[] = {ACPI_DMT_EXIT, 0, NULL} }; -/* DMAR sub-tables */ +/* DMAR Subtables */ /* 0: Hardware Unit Definition */ @@ -617,6 +638,91 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] = }; +/******************************************************************************* + * + * EINJ - Error Injection table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[] = +{ + {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (HeaderLength), "Injection Header Length"}, + {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Entries), "Injection Entry Count"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[] = +{ + {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Action), "Action"}, + {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Instruction), "Instruction"}, + {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Flags), "Flags"}, + {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_GAS, ACPI_EINJ0_OFFSET (RegisterRegion), "Register Region"}, + {ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Value), "Value"}, + {ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Mask), "Mask"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * + * ERST - Error Record Serialization table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoErst[] = +{ + {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (HeaderLength), "Serialization Header Length"}, + {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Entries), "Instruction Entry Count"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * + * HEST - Hardware Error Source table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] = +{ + {ACPI_DMT_UINT32, ACPI_HEST_OFFSET (ErrorSourceCount), "Error Source Count"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[] = +{ + {ACPI_DMT_HEST, ACPI_HEST9_OFFSET (Header.Type), "Subtable Type"}, + {ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (SourceId), "Source Id"}, + {ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (RelatedSourceId), "Related Source Id"}, + {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (ConfigWriteEnable), "Configuration Write Enable"}, + {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Enabled), "Enabled"}, + {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (RecordsToPreAllocate), "Records To Preallocate"}, + {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"}, + {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxRawDataLength), "Max Raw Data Length"}, + {ACPI_DMT_GAS, ACPI_HEST9_OFFSET (ErrorStatusAddress), "Error Status Address"}, + {ACPI_DMT_HESTNTFY, ACPI_HEST9_OFFSET (Notify), "Notify"}, + {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (ErrorStatusBlockLength), "Error Status Block Length"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[10] = +{ + {ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type"}, + {ACPI_DMT_UINT8, ACPI_HESTN_OFFSET (Length), "Notify Length"}, + {ACPI_DMT_UINT16, ACPI_HESTN_OFFSET (ConfigWriteEnable), "Configuration Write Enable"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollInterval), "PollInterval"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (Vector), "Vector"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdValue), "Polling Threshold Value"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdWindow), "Polling Threshold Window"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdValue), "Error Threshold Value"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdWindow), "Error Threshold Window"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + /******************************************************************************* * * HPET - High Precision Event Timer table @@ -651,16 +757,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[] = {ACPI_DMT_EXIT, 0, NULL} }; -/* Common sub-table header (one per sub-table) */ +/* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[] = { - {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Sub-Table Type"}, + {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Subtable Type"}, {ACPI_DMT_UINT8, ACPI_MADTH_OFFSET (Length), "Length"}, {ACPI_DMT_EXIT, 0, NULL} }; -/* MADT sub-tables */ +/* MADT Subtables */ /* 0: processor APIC */ @@ -775,7 +881,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] = /******************************************************************************* * - * MCFG - PCI Memory Mapped Configuration table and sub-table + * MCFG - PCI Memory Mapped Configuration table and Subtable * ******************************************************************************/ @@ -811,6 +917,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] = }; +/******************************************************************************* + * + * SLIC - Software Licensing Description Table. NOT FULLY IMPLEMENTED + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[] = +{ + {ACPI_DMT_EXIT, 0, NULL} +}; + + /******************************************************************************* * * SLIT - System Locality Information Table @@ -883,7 +1001,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] = /******************************************************************************* * - * SRAT - System Resource Affinity Table and sub-tables + * SRAT - System Resource Affinity Table and Subtables * ******************************************************************************/ @@ -896,7 +1014,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] = { - {ACPI_DMT_SRAT, ACPI_SRAT0_OFFSET (Header.Type), "Sub-Table Type"}, + {ACPI_DMT_SRAT, ACPI_SRAT0_OFFSET (Header.Type), "Subtable Type"}, {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (Header.Length), "Length"}, {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ProximityDomainLo), "Proximity Domain Low(8)"}, {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ApicId), "Apic ID"}, @@ -910,7 +1028,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] = { - {ACPI_DMT_SRAT, ACPI_SRAT1_OFFSET (Header.Type), "Sub-Table Type"}, + {ACPI_DMT_SRAT, ACPI_SRAT1_OFFSET (Header.Type), "Subtable Type"}, {ACPI_DMT_UINT8, ACPI_SRAT1_OFFSET (Header.Length), "Length"}, {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain"}, {ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved"}, diff --git a/src/add-ons/kernel/bus_managers/acpi/common/getopt.c b/src/add-ons/kernel/bus_managers/acpi/common/getopt.c index 485ee31b9c..0bda43c4e7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/getopt.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/getopt.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: getopt - * $Revision: 1.9 $ + * $Revision: 1.11 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/Makefile b/src/add-ons/kernel/bus_managers/acpi/compiler/Makefile index 33eaa797f4..cdeeddd0ca 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/Makefile +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/Makefile @@ -4,7 +4,7 @@ PROG= iasl SRCS= aslcompilerparse.c aslcompilerlex.c aslanalyze.c aslcodegen.c \ aslcompile.c aslerror.c aslfiles.c asllength.c \ asllisting.c aslload.c asllookup.c aslmain.c aslmap.c aslopcodes.c \ - asloperands.c aslresource.c aslrestype1.c aslrestype2.c \ + asloperands.c aslresource.c aslrestype1.c aslrestype2.c aslstartup.c \ asltree.c aslutils.c asltransform.c aslfold.c aslstubs.c aslopt.c \ ../common/getopt.c \ ../utilities/utalloc.c \ @@ -13,12 +13,14 @@ SRCS= aslcompilerparse.c aslcompilerlex.c aslanalyze.c aslcodegen.c \ ../utilities/utdebug.c \ ../utilities/utdelete.c \ ../utilities/utglobal.c \ + ../utilities/utinit.c \ ../utilities/utobject.c \ ../utilities/utmisc.c \ ../utilities/utmath.c \ ../utilities/utmutex.c \ ../utilities/utresrc.c \ ../utilities/utstate.c \ + ../utilities/utxface.c \ ../namespace/nsaccess.c \ ../namespace/nsalloc.c \ ../namespace/nsdump.c \ diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslanalyze.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslanalyze.c index 9b33624061..6f4bf00681 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslanalyze.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslanalyze.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslanalyze.c - check for semantic errors - * $Revision: 1.114 $ + * $Revision: 1.118 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -272,7 +272,11 @@ AnMapArgTypeToBtype ( return (ACPI_BTYPE_MUTEX); case ARGI_DDBHANDLE: - return (ACPI_BTYPE_DDB_HANDLE); + /* + * DDBHandleObject := SuperName + * ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload + */ + return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE); /* Interchangeable types */ /* @@ -956,9 +960,9 @@ AnMethodAnalysisWalkBegin ( MethodInfo->ValidArgTypes[ActualArgs] = AnMapObjTypeToBtype (NextType); NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + ActualArgs++; } - ActualArgs++; NextType = NextType->Asl.Next; } diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcodegen.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcodegen.c index e537585ce3..bfbcef3c3a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcodegen.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcodegen.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslcodegen - AML code generation - * $Revision: 1.61 $ + * $Revision: 1.63 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompile.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompile.c index 7a1583c893..32359f6e7b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompile.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompile.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslcompile - top level compile module - * $Revision: 1.96 $ + * $Revision: 1.99 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -914,16 +914,6 @@ CmCleanupAndExit ( } UtDisplaySummary (ASL_FILE_STDOUT); - - /* - * Return non-zero exit code if there have been errors, unless the - * global ignore error flag has been set - */ - if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors)) - { - exit (1); - } - exit (0); } diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.h b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.h index a1f40ba6a9..9f23deaf91 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.h +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslcompiler.h - common include file for iASL - * $Revision: 1.147 $ + * $Revision: 1.151 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -188,6 +188,12 @@ AslPushInputFileStack ( FILE *InputFile, char *Filename); +/* + * aslstartup - called from main + */ +ACPI_STATUS +AslDoOnePathname ( + char *Pathname); /* * aslcompile - compile mainline @@ -307,6 +313,10 @@ void AePrintErrorLog ( UINT32 FileId); +void +AeClearErrorLog ( + void); + ACPI_PHYSICAL_ADDRESS AeLocalGetRootPointer ( void); diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.l b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.l index ce83599212..5934b83151 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.l +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.l @@ -3,7 +3,7 @@ /****************************************************************************** * * Module Name: aslcompiler.l - Flex input file - * $Revision: 1.78 $ + * $Revision: 1.80 $ * *****************************************************************************/ @@ -11,7 +11,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asldefine.h b/src/add-ons/kernel/bus_managers/acpi/compiler/asldefine.h index d7fd756c2d..577cb0a95e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asldefine.h +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/asldefine.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: asldefine.h - Common defines for the iASL compiler - * $Revision: 1.6 $ + * $Revision: 1.9 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -128,7 +128,7 @@ #define IntelAcpiCA "Intel ACPI Component Architecture" #define CompilerId "ASL Optimizing Compiler" #define DisassemblerId "AML Disassembler" -#define CompilerCopyright "Copyright (C) 2000 - 2006 Intel Corporation" +#define CompilerCopyright "Copyright (C) 2000 - 2008 Intel Corporation" #define CompilerCompliance "Supports ACPI Specification Revision 3.0a" #define CompilerName "iasl" #define CompilerCreatorId "INTL" diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslerror.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslerror.c index 3fab09cac6..37a24af84d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslerror.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslerror.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslerror - Error handling and statistics - * $Revision: 1.91 $ + * $Revision: 1.95 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -128,6 +128,26 @@ AeAddToErrorLog ( ASL_ERROR_MSG *Enode); +void +AeClearErrorLog ( + void) +{ + ASL_ERROR_MSG *Enode = Gbl_ErrorLog; + ASL_ERROR_MSG *Next; + + /* Walk the error node list */ + + while (Enode) + { + Next = Enode->Next; + ACPI_FREE (Enode); + Enode = Next; + } + + Gbl_ErrorLog = NULL; +} + + /******************************************************************************* * * FUNCTION: AeAddToErrorLog @@ -288,7 +308,8 @@ AePrintException ( if (Actual) { fprintf (OutputFile, - "[*** iASL: Seek error on source code temp file ***]"); + "[*** iASL: Seek error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); } else { @@ -296,7 +317,8 @@ AePrintException ( if (!RActual) { fprintf (OutputFile, - "[*** iASL: Read error on source code temp file ***]"); + "[*** iASL: Read error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); } else while (RActual && SourceByte && (SourceByte != '\n')) diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslfiles.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslfiles.c index 616fdd4bd4..e6d9304801 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslfiles.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslfiles.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslfiles - file I/O suppoert - * $Revision: 1.53 $ + * $Revision: 1.56 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -369,6 +369,8 @@ FlPrintFile ( va_start (Args, Format); Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args); + va_end (Args); + if (Actual == -1) { FlFileError (FileId, ASL_MSG_WRITE); diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslfold.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslfold.c index 0f19e5c1f7..0d8ddf75e1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslfold.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslfold.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslfold - Constant folding - * $Revision: 1.19 $ + * $Revision: 1.21 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslglobal.h b/src/add-ons/kernel/bus_managers/acpi/compiler/aslglobal.h index d31fc541f8..5e7dad2b4d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslglobal.h +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslglobal.h @@ -3,7 +3,7 @@ /****************************************************************************** * * Module Name: aslglobal.h - Global variable definitions - * $Revision: 1.55 $ + * $Revision: 1.58 $ * *****************************************************************************/ @@ -11,7 +11,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -144,7 +144,7 @@ extern FILE *AslCompilerin; extern int AslCompilerdebug; extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; extern char *AslCompilertext; -extern char hex[]; +extern char HexLookup[]; #define ASL_LINE_BUFFER_SIZE 512 #define ASL_MSG_BUFFER_SIZE 4096 @@ -171,6 +171,9 @@ extern UINT32 Gbl_ExceptionCount[]; /* Option flags */ +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE); + ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asllength.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asllength.c index 6ebe2a2d32..45184dd4e9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asllength.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/asllength.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: asllength - Tree walk to determine package and opcode lengths - * $Revision: 1.36 $ + * $Revision: 1.38 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asllisting.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asllisting.c index b8e6492220..2c1675856a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asllisting.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/asllisting.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: asllisting - Listing file generation - * $Revision: 1.62 $ + * $Revision: 1.64 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslload.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslload.c index d23e4e030b..9691ab3cf7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslload.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 1.76 $ + * $Revision: 1.79 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -672,7 +672,8 @@ LdNamespace1Begin ( Node->Type = (UINT8) ObjectType; Status = AE_OK; } - else if (Node->Flags & ANOBJ_IS_EXTERNAL) + else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && + (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)) { /* * Allow one create on an object or segment that was diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asllookup.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asllookup.c index ebc806ae9f..3592be3ba6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asllookup.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/asllookup.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: asllookup- Namespace lookup - * $Revision: 1.102 $ + * $Revision: 1.106 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -174,6 +174,13 @@ LkIsObjectUsed ( void *Context, void **ReturnValue); +static ACPI_STATUS +LsDoOnePathname ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + /******************************************************************************* * @@ -416,6 +423,18 @@ LsDoOneNamespaceObject ( } +/******************************************************************************* + * + * FUNCTION: LsSetupNsList + * + * PARAMETERS: Handle - local file handle + * + * RETURN: None + * + * DESCRIPTION: Set the namespace output file to the input handle + * + ******************************************************************************/ + void LsSetupNsList (void * Handle) { @@ -425,6 +444,44 @@ LsSetupNsList (void * Handle) } +/******************************************************************************* + * + * FUNCTION: LsDoOnePathname + * + * PARAMETERS: ACPI_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Print the full pathname for a namespace node. + * + ******************************************************************************/ + +static ACPI_STATUS +LsDoOnePathname ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) +{ + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + ACPI_STATUS Status; + ACPI_BUFFER TargetPath; + + + TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + Status = AcpiNsHandleToPathname (Node, &TargetPath); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer); + ACPI_FREE (TargetPath.Pointer); + + return (AE_OK); +} + + /******************************************************************************* * * FUNCTION: LsDisplayNamespace @@ -463,6 +520,15 @@ LsDisplayNamespace ( Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, NULL, NULL); + + /* Print the full pathname for each namespace node */ + + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n"); + + Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, FALSE, LsDoOnePathname, + NULL, NULL); + return (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslmain.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslmain.c index 6b0c87bcab..ecff54aea3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslmain.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslmain.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslmain - compiler main and utilities - * $Revision: 1.94 $ + * $Revision: 1.99 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -130,15 +130,6 @@ #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslmain") -BOOLEAN AslToFile = TRUE; -BOOLEAN DoCompile = TRUE; -BOOLEAN DoSignon = TRUE; - -char hex[] = -{ - '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' -}; - /* Local prototypes */ static void @@ -157,16 +148,11 @@ static void AslInitialize ( void); -static void +static int AslCommandLine ( int argc, char **argv); -#ifdef _DEBUG -#if ACPI_MACHINE_WIDTH != 16 -#include -#endif -#endif /******************************************************************************* * @@ -186,7 +172,7 @@ Options ( { printf ("General Output:\n"); - printf (" -p Specify filename prefix for all output files (including .aml)\n"); + printf (" -p Specify path/filename prefix for all output files\n"); printf (" -vi Less verbose errors and warnings for use with IDEs\n"); printf (" -vo Enable optimization comments\n"); printf (" -vr Disable remarks\n"); @@ -280,7 +266,7 @@ Usage ( void) { - printf ("Usage: %s [Options] [InputFile]\n\n", CompilerName); + printf ("Usage: %s [Options] [Files]\n\n", CompilerName); Options (); } @@ -336,7 +322,7 @@ AslInitialize ( * ******************************************************************************/ -static void +static int AslCommandLine ( int argc, char **argv) @@ -402,7 +388,7 @@ AslCommandLine ( switch (AcpiGbl_Optarg[0]) { case '^': - DoCompile = FALSE; + Gbl_DoCompile = FALSE; break; case 'c': @@ -436,7 +422,7 @@ AslCommandLine ( /* Get all ACPI tables */ Gbl_GetAllTables = TRUE; - DoCompile = FALSE; + Gbl_DoCompile = FALSE; break; @@ -652,7 +638,7 @@ AslCommandLine ( break; case 's': - DoSignon = FALSE; + Gbl_DoSignon = FALSE; break; default: @@ -701,9 +687,7 @@ AslCommandLine ( /* Next parameter must be the input filename */ - Gbl_Files[ASL_FILE_INPUT].Filename = argv[AcpiGbl_Optind]; - - if (!Gbl_Files[ASL_FILE_INPUT].Filename && + if (!argv[AcpiGbl_Optind] && !Gbl_DisasmFlag && !Gbl_GetAllTables) { @@ -711,7 +695,7 @@ AslCommandLine ( BadCommandLine = TRUE; } - if (DoSignon) + if (Gbl_DoSignon) { AslCompilerSignon (ASL_FILE_STDOUT); } @@ -725,11 +709,7 @@ AslCommandLine ( exit (1); } - if ((AcpiGbl_Optind + 1) < argc) - { - printf ("Warning: extra arguments (%d) after input filename are ignored\n\n", - argc - AcpiGbl_Optind - 1); - } + return (AcpiGbl_Optind); } @@ -741,8 +721,8 @@ AslCommandLine ( * * RETURN: Program termination code * - * DESCRIPTION: C main routine for the Asl Compiler. Handle command line - * options and begin the compile. + * DESCRIPTION: C main routine for the Asl Compiler. Handle command line + * options and begin the compile for each file on the command line * ******************************************************************************/ @@ -752,118 +732,30 @@ main ( char **argv) { ACPI_STATUS Status; - char *Prefix; + int Index; #ifdef _DEBUG -#if ACPI_MACHINE_WIDTH != 16 _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); -#endif #endif /* Init and command line */ AslInitialize (); - AslCommandLine (argc, argv); + Index = AslCommandLine (argc, argv); - /* - * If -p not specified, we will use the input filename as the - * output filename prefix - */ - Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename, - &Gbl_DirectoryPath, &Prefix); - if (ACPI_FAILURE (Status)) + /* Process each pathname/filename in the list, with possible wildcards */ + + while (argv[Index]) { - return -1; - } - - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = Prefix; - } - - /* AML Disassembly (Optional) */ - - if (Gbl_DisasmFlag || Gbl_GetAllTables) - { - /* ACPI CA subsystem initialization */ - - Status = AdInitialize (); + Status = AslDoOnePathname (argv[Index]); if (ACPI_FAILURE (Status)) { - return -1; + return (-1); } - Status = AcpiAllocateRootTable (4); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n", - AcpiFormatException (Status)); - return -1; - } - - /* This is where the disassembly happens */ - - AcpiGbl_DbOpt_disasm = TRUE; - Status = AdAmlDisassemble (AslToFile, - Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_OutputFilenamePrefix, - &Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_GetAllTables); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - /* - * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the - * .DSL disassembly file, which can now be compiled if requested - */ - if (DoCompile) - { - AcpiOsPrintf ("\nCompiling \"%s\"\n", - Gbl_Files[ASL_FILE_INPUT].Filename); - } - } - - /* - * ASL Compilation (Optional) - */ - if (DoCompile) - { - /* - * If -p not specified, we will use the input filename as the - * output filename prefix - */ - Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename, - &Gbl_DirectoryPath, &Prefix); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = Prefix; - } - - /* ACPI CA subsystem initialization (Must be re-initialized) */ - - Status = AcpiOsInitialize (); - AcpiUtInitGlobals (); - Status = AcpiUtMutexInitialize (); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - Status = AcpiNsRootInitialize (); - if (ACPI_FAILURE (Status)) - { - return -1; - } - Status = CmDoCompile (); + Index++; } return (0); diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslmap.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslmap.c index 72a8d8f9d6..77b5bda2ce 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslmap.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslmap.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslmap - parser to AML opcode mapping table - * $Revision: 1.85 $ + * $Revision: 1.88 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -308,7 +308,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_EJ3", 1, 0}, {"_EJ4", 1, 0}, {"_EJD", 0, ASL_RSVD_RETURN_VALUE}, - {"_ERR", 2, ASL_RSVD_RETURN_VALUE}, + {"_ERR", 3, ASL_RSVD_RETURN_VALUE}, {"_FDE", 0, ASL_RSVD_RETURN_VALUE}, {"_FDI", 0, ASL_RSVD_RETURN_VALUE}, {"_FDM", 1, 0}, diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslopcodes.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslopcodes.c index 28ea17aa93..4caaa560ba 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslopcodes.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslopcodes.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslopcode - AML opcode generation - * $Revision: 1.73 $ + * $Revision: 1.75 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asloperands.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asloperands.c index b97d2dde8e..e1a7cc9312 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asloperands.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/asloperands.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: asloperands - AML operand processing - * $Revision: 1.60 $ + * $Revision: 1.64 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -949,6 +949,7 @@ OpnDoDefinitionBlock ( ACPI_PARSE_OBJECT *Child; ACPI_SIZE Length; ACPI_NATIVE_UINT i; + char *Filename; /* @@ -966,7 +967,19 @@ OpnDoDefinitionBlock ( *Child->Asl.Value.Buffer && (Gbl_UseDefaultAmlFilename)) { - Gbl_OutputFilenamePrefix = (char *) Child->Asl.Value.Buffer; + /* + * We will use the AML filename that is embedded in the source file + * for the output filename. + */ + Filename = ACPI_ALLOCATE (strlen (Gbl_DirectoryPath) + + strlen ((char *) Child->Asl.Value.Buffer) + 1); + + /* Prepend the current directory path */ + + strcpy (Filename, Gbl_DirectoryPath); + strcat (Filename, (char *) Child->Asl.Value.Buffer); + + Gbl_OutputFilenamePrefix = Filename; } Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslopt.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslopt.c index 502f0245ab..d2ffb54f38 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslopt.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslopt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: aslopt- Compiler optimizations - * $Revision: 1.25 $ + * $Revision: 1.27 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslresource.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslresource.c index 9ae494ddcd..5228102a42 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslresource.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslresource.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslresource - Resource templates and descriptors - * $Revision: 1.42 $ + * $Revision: 1.44 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1.c index c62a35f266..d1c01a78c0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslrestype1 - Short (type1) resource templates and descriptors - * $Revision: 1.39 $ + * $Revision: 1.41 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2.c index 2467c9bcee..5aee3cb1b5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslrestype2 - Long (type2) resource templates and descriptors - * $Revision: 1.50 $ + * $Revision: 1.52 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslstartup.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslstartup.c new file mode 100755 index 0000000000..f3238bb92e --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslstartup.c @@ -0,0 +1,452 @@ + +/****************************************************************************** + * + * Module Name: aslstartup - Compiler startup routines, called from main + * $Revision: 1.5 $ + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2008, 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. + * + *****************************************************************************/ + + +#include "aslcompiler.h" +#include "acnamesp.h" +#include "actables.h" +#include "acapps.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslstartup") + + +#define ASL_MAX_FILES 256 +char *FileList[ASL_MAX_FILES]; +int FileCount; +BOOLEAN AslToFile = TRUE; + + +/* Local prototypes */ + +static void +AslInitializeGlobals ( + void); + +static char ** +AsDoWildcard ( + char *DirectoryPathname, + char *FileSpecifier); + +static ACPI_STATUS +AslDoOneFile ( + char *Filename); + + +/******************************************************************************* + * + * FUNCTION: AslInitializeGlobals + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Re-initialize globals needed to restart the compiler. This + * allows multiple files to be disassembled and/or compiled. + * + ******************************************************************************/ + +static void +AslInitializeGlobals ( + void) +{ + UINT32 i; + + + /* Init compiler globals */ + + Gbl_CurrentColumn = 0; + Gbl_CurrentLineNumber = 1; + Gbl_LogicalLineNumber = 1; + Gbl_CurrentLineOffset = 0; + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + + Gbl_ErrorLog = NULL; + Gbl_NextError = NULL; + + AslGbl_NextEvent = 0; + for (i = 0; i < ASL_NUM_REPORT_LEVELS; i++) + { + Gbl_ExceptionCount[i] = 0; + } + + Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL; +} + + +/****************************************************************************** + * + * FUNCTION: AsDoWildcard + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Process files via wildcards. This function is for the Windows + * case only. + * + ******************************************************************************/ + +static char ** +AsDoWildcard ( + char *DirectoryPathname, + char *FileSpecifier) +{ +#ifdef WIN32 + void *DirInfo; + char *Filename; + + + FileCount = 0; + + /* Open parent directory */ + + DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier, REQUEST_FILE_ONLY); + if (!DirInfo) + { + /* Either the directory of file does not exist */ + + Gbl_Files[ASL_FILE_INPUT].Filename = FileSpecifier; + FlFileError (ASL_FILE_INPUT, ASL_MSG_OPEN); + AslAbort (); + } + + /* Process each file that matches the wildcard specification */ + + while ((Filename = AcpiOsGetNextFilename (DirInfo))) + { + /* Add the filename to the file list */ + + FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1); + strcpy (FileList[FileCount], Filename); + FileCount++; + + if (FileCount >= ASL_MAX_FILES) + { + printf ("Max files reached\n"); + FileList[0] = NULL; + return (FileList); + } + } + + /* Cleanup */ + + AcpiOsCloseDirectory (DirInfo); + FileList[FileCount] = NULL; + return (FileList); + +#else + /* + * Linux/Unix cases - Wildcards are expanded by the shell automatically. + * Just return the filename in a null terminated list + */ + FileList[0] = AcpiOsAllocate (strlen (FileSpecifier) + 1); + strcpy (FileList[0], FileSpecifier); + FileList[1] = NULL; + + return (FileList); +#endif +} + + +/******************************************************************************* + * + * FUNCTION: AslDoOneFile + * + * PARAMETERS: Filename - Name of the file + * + * RETURN: Status + * + * DESCRIPTION: Process a single file - either disassemble, compile, or both + * + ******************************************************************************/ + +static ACPI_STATUS +AslDoOneFile ( + char *Filename) +{ + ACPI_STATUS Status; + + + Gbl_Files[ASL_FILE_INPUT].Filename = Filename; + + /* Re-initialize "some" compiler globals */ + + AslInitializeGlobals (); + + /* + * AML Disassembly (Optional) + */ + if (Gbl_DisasmFlag || Gbl_GetAllTables) + { + /* ACPI CA subsystem initialization */ + + Status = AdInitialize (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Status = AcpiAllocateRootTable (4); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n", + AcpiFormatException (Status)); + return (Status); + } + + /* This is where the disassembly happens */ + + AcpiGbl_DbOpt_disasm = TRUE; + Status = AdAmlDisassemble (AslToFile, + Gbl_Files[ASL_FILE_INPUT].Filename, + Gbl_OutputFilenamePrefix, + &Gbl_Files[ASL_FILE_INPUT].Filename, + Gbl_GetAllTables); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Shutdown compiler and ACPICA subsystem */ + + AeClearErrorLog (); + AcpiTerminate (); + + /* + * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the + * .DSL disassembly file, which can now be compiled if requested + */ + if (Gbl_DoCompile) + { + AcpiOsPrintf ("\nCompiling \"%s\"\n", + Gbl_Files[ASL_FILE_INPUT].Filename); + } + } + + /* + * ASL Compilation (Optional) + */ + if (Gbl_DoCompile) + { + /* + * If -p not specified, we will use the input filename as the + * output filename prefix + */ + if (Gbl_UseDefaultAmlFilename) + { + Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename; + } + + /* ACPI CA subsystem initialization (Must be re-initialized) */ + + Status = AdInitialize (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Status = CmDoCompile (); + AcpiTerminate (); + + /* + * Return non-zero exit code if there have been errors, unless the + * global ignore error flag has been set + */ + if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors)) + { + return (AE_ERROR); + } + + AeClearErrorLog (); + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AslDoOnePathname + * + * PARAMETERS: Pathname - Full pathname, possibly with wildcards + * + * RETURN: Status + * + * DESCRIPTION: Process one pathname, possible terminated with a wildcard + * specification. If a wildcard, it is expanded and the multiple + * files are processed. + * + ******************************************************************************/ + +ACPI_STATUS +AslDoOnePathname ( + char *Pathname) +{ + ACPI_STATUS Status; + char **FileList; + char *Filename; + char *FullPathname; + + + /* Split incoming path into a directory/filename combo */ + + Status = FlSplitInputPathname (Pathname, &Gbl_DirectoryPath, &Filename); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Expand possible wildcard into a file list (Windows/DOS only) */ + + FileList = AsDoWildcard (Gbl_DirectoryPath, Filename); + while (*FileList) + { + FullPathname = ACPI_ALLOCATE ( + strlen (Gbl_DirectoryPath) + strlen (*FileList) + 1); + + /* Construct a full path to the file */ + + strcpy (FullPathname, Gbl_DirectoryPath); + strcat (FullPathname, *FileList); + + /* + * If -p not specified, we will use the input filename as the + * output filename prefix + */ + if (Gbl_UseDefaultAmlFilename) + { + Gbl_OutputFilenamePrefix = FullPathname; + } + + Status = AslDoOneFile (FullPathname); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ACPI_FREE (FullPathname); + ACPI_FREE (*FileList); + *FileList = NULL; + FileList++; + } + + ACPI_FREE (Gbl_DirectoryPath); + ACPI_FREE (Filename); + return (AE_OK); +} + diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslstubs.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslstubs.c index 3ec4ab736b..b01bc5f2ce 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslstubs.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslstubs.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslstubs - Stubs used to link to Aml interpreter - * $Revision: 1.19 $ + * $Revision: 1.23 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -119,6 +119,8 @@ #include "aslcompiler.h" #include "acdispat.h" #include "actables.h" +#include "acevents.h" +#include "acinterp.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslstubs") @@ -197,14 +199,14 @@ AcpiEvIsNotifyObject ( } ACPI_STATUS -AcpiEvAcquireGlobalLock( - UINT32 Timeout) +AcpiEvAcquireGlobalLock ( + UINT16 Timeout) { return (AE_OK); } ACPI_STATUS -AcpiEvReleaseGlobalLock( +AcpiEvReleaseGlobalLock ( void) { return (AE_OK); diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asltransform.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asltransform.c index 4976c9dbba..2063cbd3b8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asltransform.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/asltransform.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: asltransform - Parse tree transforms - * $Revision: 1.41 $ + * $Revision: 1.44 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -468,6 +468,7 @@ TrDoSwitch ( ACPI_PARSE_OBJECT *Peer; ACPI_PARSE_OBJECT *NewOp; ACPI_PARSE_OBJECT *NewOp2; + ACPI_PARSE_OBJECT *MethodOp; char *PredicateValueName; UINT16 Index; UINT32 Btype; @@ -729,18 +730,32 @@ TrDoSwitch ( { Next = Next->Asl.Parent; } + MethodOp = Next; NewOp->Asl.CompileFlags |= NODE_COMPILER_EMITTED; NewOp->Asl.Parent = Next; /* Insert name after the method name and arguments */ - Next = Next->Asl.Child; - Next = Next->Asl.Next; - Next = Next->Asl.Next; - Next = Next->Asl.Next; - Next = Next->Asl.Next; - Next = Next->Asl.Next; + Next = Next->Asl.Child; /* Name */ + Next = Next->Asl.Next; /* NumArgs */ + Next = Next->Asl.Next; /* SerializeRule */ + + /* + * If method is not Serialized, we must make is so, because of the way + * that Switch() must be implemented -- we cannot allow multiple threads + * to execute this method concurrently since we need to create local + * temporary name(s). + */ + if (Next->Asl.ParseOpcode != PARSEOP_SERIALIZERULE_SERIAL) + { + AslError (ASL_REMARK, ASL_MSG_SERIALIZED, MethodOp, "Due to use of Switch operator"); + Next->Asl.ParseOpcode = PARSEOP_SERIALIZERULE_SERIAL; + } + + Next = Next->Asl.Next; /* SyncLevel */ + Next = Next->Asl.Next; /* ReturnType */ + Next = Next->Asl.Next; /* ParameterTypes */ TrAmlInsertPeer (Next, NewOp); TrAmlInitLineNumbers (NewOp, Next); diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asltree.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asltree.c index f4b0049b36..6eb2e78ef2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asltree.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/asltree.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: asltree - parse tree management - * $Revision: 1.62 $ + * $Revision: 1.65 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -914,6 +914,7 @@ TrLinkPeerNodes ( This->Asl.Next = Next; This = Next; } + va_end (ap); DbgPrint (ASL_PARSE_OUTPUT,"\n\n"); return (Start); diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asltypes.h b/src/add-ons/kernel/bus_managers/acpi/compiler/asltypes.h index 44f68c8f4e..f02fe2abfc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asltypes.h +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/asltypes.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: asltypes.h - compiler data types and struct definitions - * $Revision: 1.88 $ + * $Revision: 1.91 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -422,7 +422,8 @@ typedef enum ASL_MSG_RESULT_NOT_USED, ASL_MSG_NOT_REFERENCED, ASL_MSG_NON_ZERO, - ASL_MSG_STRING_LENGTH + ASL_MSG_STRING_LENGTH, + ASL_MSG_SERIALIZED } ASL_MESSAGE_IDS; @@ -536,7 +537,8 @@ char *AslMessages [] = { /* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect", /* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced", /* ASL_MSG_NON_ZERO */ "Operand evaluates to zero", -/* ASL_MSG_STRING_LENGTH */ "String literal too long" +/* ASL_MSG_STRING_LENGTH */ "String literal too long", +/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized" }; diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslutils.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslutils.c index 4a0fc08f7d..e203da49bf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/compiler/aslutils.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslutils -- compiler utilities - * $Revision: 1.71 $ + * $Revision: 1.74 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -131,6 +131,12 @@ static const char * const *yytname = &AslCompilername[254]; extern const char * const yytname[]; #endif +char HexLookup[] = +{ + '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' +}; + + /* Local prototypes */ static ACPI_STATUS @@ -333,8 +339,8 @@ UtConvertByteToHex ( Buffer[0] = '0'; Buffer[1] = 'x'; - Buffer[2] = (UINT8) hex[(RawByte >> 4) & 0xF]; - Buffer[3] = (UINT8) hex[RawByte & 0xF]; + Buffer[2] = (UINT8) HexLookup[(RawByte >> 4) & 0xF]; + Buffer[3] = (UINT8) HexLookup[RawByte & 0xF]; } @@ -359,8 +365,8 @@ UtConvertByteToAsmHex ( { Buffer[0] = '0'; - Buffer[1] = (UINT8) hex[(RawByte >> 4) & 0xF]; - Buffer[2] = (UINT8) hex[RawByte & 0xF]; + Buffer[1] = (UINT8) HexLookup[(RawByte >> 4) & 0xF]; + Buffer[2] = (UINT8) HexLookup[RawByte & 0xF]; Buffer[3] = 'h'; } diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbcmds.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbcmds.c index 6c23876d99..1f06141a9d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbcmds.c +++ b/src/add-ons/kernel/bus_managers/acpi/debugger/dbcmds.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbcmds - debug commands and output routines - * $Revision: 1.148 $ + * $Revision: 1.157 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -285,9 +285,6 @@ ACPI_STATUS AcpiDbSleep ( char *ObjectArg) { -#if ACPI_MACHINE_WIDTH == 16 - return (AE_OK); -#else ACPI_STATUS Status; UINT8 SleepState; @@ -312,7 +309,6 @@ AcpiDbSleep ( Status = AcpiLeaveSleepState (SleepState); return (Status); -#endif } @@ -447,13 +443,13 @@ AcpiDbDisplayTableInfo ( for (i = 0; i < AcpiGbl_RootTableList.Count; i++) { TableDesc = &AcpiGbl_RootTableList.Tables[i]; - AcpiOsPrintf ( "%4.4s at %p length %.5X", + AcpiOsPrintf ( "%.4s at %p length %.5X", TableDesc->Signature.Ascii, TableDesc->Pointer, (UINT32) TableDesc->Length); if (TableDesc->Pointer && (i != ACPI_TABLE_INDEX_FACS)) { - AcpiOsPrintf (" OemId=\"%6s\" OemTableId=\"%8s\" OemRevision=%8.8X", + AcpiOsPrintf (" OemId=\"%.6s\" OemTableId=\"%.8s\" OemRevision=%8.8X", TableDesc->Pointer->OemId, TableDesc->Pointer->OemTableId, TableDesc->Pointer->OemRevision); @@ -1415,8 +1411,8 @@ AcpiDmTestResourceConversion ( OriginalAml = ReturnObj.Pointer; AcpiDmCompareAmlResources ( - OriginalAml->Buffer.Pointer, OriginalAml->Buffer.Length, - NewAml.Pointer, NewAml.Length); + OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length, + NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length); /* Cleanup and exit */ @@ -1445,8 +1441,6 @@ void AcpiDbDisplayResources ( char *ObjectArg) { -#if ACPI_MACHINE_WIDTH != 16 - ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_BUFFER ReturnObj; @@ -1584,7 +1578,6 @@ Cleanup: AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); return; -#endif } @@ -1610,24 +1603,45 @@ AcpiDbIntegrityWalk ( ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context; ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_OPERAND_OBJECT *Object; + BOOLEAN Alias = TRUE; Info->Nodes++; - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) + + /* Verify the NS node, and dereference aliases */ + + while (Alias) { - AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s]\n", - Node, AcpiUtGetDescriptorName (Node)); + if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) + { + AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n", + Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node), + ACPI_DESC_TYPE_NAMED); + return (AE_OK); + } + + if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) || + (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) + { + Node = (ACPI_NAMESPACE_NODE *) Node->Object; + } + else + { + Alias = FALSE; + } } if (Node->Type > ACPI_TYPE_LOCAL_MAX) { AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n", Node, Node->Type); + return (AE_OK); } if (!AcpiUtValidAcpiName (Node->Name.Integer)) { AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node); + return (AE_OK); } Object = AcpiNsGetAttachedObject (Node); diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbdisply.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbdisply.c index 49b6d196e0..70f16643df 100644 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbdisply.c +++ b/src/add-ons/kernel/bus_managers/acpi/debugger/dbdisply.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbdisply - debug display commands - * $Revision: 1.117 $ + * $Revision: 1.121 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -160,24 +160,7 @@ AcpiDbGetPointer ( void *ObjPtr; -#if ACPI_MACHINE_WIDTH == 16 -#include - - /* Have to handle 16-bit pointers of the form segment:offset */ - - if (!sscanf (Target, "%p", &ObjPtr)) - { - AcpiOsPrintf ("Invalid pointer: %s\n", Target); - return (NULL); - } - -#else - - /* Simple flat pointer */ - ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16)); -#endif - return (ObjPtr); } @@ -597,8 +580,10 @@ AcpiDbDisplayResults ( UINT32 i; ACPI_WALK_STATE *WalkState; ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 NumResults = 0; + UINT32 ResultCount = 0; ACPI_NAMESPACE_NODE *Node; + ACPI_GENERIC_STATE *Frame; + UINT32 Index; /* Index onto current frame */ WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); @@ -613,17 +598,28 @@ AcpiDbDisplayResults ( if (WalkState->Results) { - NumResults = WalkState->Results->Results.NumResults; + ResultCount = WalkState->ResultCount; } AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", - AcpiUtGetNodeName (Node), NumResults); + AcpiUtGetNodeName (Node), ResultCount); - for (i = 0; i < NumResults; i++) + /* From the top element of result stack */ + + Frame = WalkState->Results; + Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM; + + for (i = 0; i < ResultCount; i++) { - ObjDesc = WalkState->Results->Results.ObjDesc[i]; + ObjDesc = Frame->Results.ObjDesc[Index]; AcpiOsPrintf ("Result%d: ", i); AcpiDmDisplayInternalObject (ObjDesc, WalkState); + if (Index == 0) + { + Frame = Frame->Results.Next; + Index = ACPI_RESULTS_FRAME_OBJ_NUM; + } + Index--; } } @@ -853,8 +849,8 @@ AcpiDbDisplayGpes ( AcpiOsPrintf ( " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", GpeBlock->RegisterInfo, - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->StatusAddress.Address)), - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->EnableAddress.Address))); + ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address), + ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address)); AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); @@ -868,8 +864,8 @@ AcpiDbDisplayGpes ( " Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n", i, GpeRegisterInfo->EnableForWake, GpeRegisterInfo->EnableForRun, - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)), - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address))); + ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address), + ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address)); /* Now look at the individual GPEs in this byte register */ diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbexec.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbexec.c index 4547f0e5b4..b16db212ae 100644 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbexec.c +++ b/src/add-ons/kernel/bus_managers/acpi/debugger/dbexec.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbexec - debugger control method execution - * $Revision: 1.77 $ + * $Revision: 1.83 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -153,12 +153,6 @@ AcpiDbExecutionWalk ( void *Context, void **ReturnValue); -#ifdef ACPI_DBG_TRACK_ALLOCATIONS -static UINT32 -AcpiDbGetCacheInfo ( - ACPI_MEMORY_LIST *Cache); -#endif - /******************************************************************************* * @@ -283,7 +277,7 @@ AcpiDbExecuteSetup ( #ifdef ACPI_DBG_TRACK_ALLOCATIONS -static UINT32 +UINT32 AcpiDbGetCacheInfo ( ACPI_MEMORY_LIST *Cache) { @@ -426,6 +420,8 @@ AcpiDbExecute ( return; } + ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); + ACPI_STRCPY (NameString, Name); AcpiUtStrupr (NameString); AcpiGbl_DbMethodInfo.Name = NameString; @@ -509,9 +505,21 @@ AcpiDbMethodThread ( ACPI_STATUS Status; ACPI_DB_METHOD_INFO *Info = Context; UINT32 i; + UINT8 Allow; ACPI_BUFFER ReturnObj; + if (Info->InitArgs) + { + AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr); + AcpiDbUInt32ToHexString (AcpiOsGetThreadId (), Info->IdOfThreadStr); + } + + if (Info->Threads && (Info->NumCreated < Info->NumThreads)) + { + Info->Threads[Info->NumCreated++] = AcpiOsGetThreadId(); + } + for (i = 0; i < Info->NumLoops; i++) { Status = AcpiDbExecuteMethod (Info, &ReturnObj); @@ -525,12 +533,12 @@ AcpiDbMethodThread ( } } +#if 0 if ((i % 100) == 0) { - AcpiOsPrintf ("%d executions\n", i); + AcpiOsPrintf ("%d executions, Thread 0x%x\n", i, AcpiOsGetThreadId ()); } -#if 0 if (ReturnObj.Length) { AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n", @@ -542,11 +550,26 @@ AcpiDbMethodThread ( /* Signal our completion */ - Status = AcpiOsSignalSemaphore (Info->ThreadGate, 1); - if (ACPI_FAILURE (Status)) + Allow = 0; + (void) AcpiOsWaitSemaphore (Info->ThreadCompleteGate, 1, ACPI_WAIT_FOREVER); + Info->NumCompleted++; + + if (Info->NumCompleted == Info->NumThreads) { - AcpiOsPrintf ("Could not signal debugger thread sync semaphore, %s\n", - AcpiFormatException (Status)); + /* Do signal for main thread once only */ + Allow = 1; + } + + (void) AcpiOsSignalSemaphore (Info->ThreadCompleteGate, 1); + + if (Allow) + { + Status = AcpiOsSignalSemaphore (Info->MainThreadGate, 1); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not signal debugger thread sync semaphore, %s\n", + AcpiFormatException (Status)); + } } } @@ -575,8 +598,9 @@ AcpiDbCreateExecutionThreads ( UINT32 NumThreads; UINT32 NumLoops; UINT32 i; - ACPI_MUTEX ThreadGate; - + UINT32 Size; + ACPI_MUTEX MainThreadGate; + ACPI_MUTEX ThreadCompleteGate; /* Get the arguments */ @@ -590,23 +614,64 @@ AcpiDbCreateExecutionThreads ( return; } - /* Create the synchronization semaphore */ - - Status = AcpiOsCreateSemaphore (1, 0, &ThreadGate); + /* + * Create the semaphore for synchronization of + * the created threads with the main thread. + */ + Status = AcpiOsCreateSemaphore (1, 0, &MainThreadGate); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not create semaphore, %s\n", + AcpiOsPrintf ("Could not create semaphore for synchronization with the main thread, %s\n", AcpiFormatException (Status)); return; } + /* + * Create the semaphore for synchronization + * between the created threads. + */ + Status = AcpiOsCreateSemaphore (1, 1, &ThreadCompleteGate); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not create semaphore for synchronization between the created threads, %s\n", + AcpiFormatException (Status)); + (void) AcpiOsDeleteSemaphore (MainThreadGate); + return; + } + + ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); + + /* Array to store IDs of threads */ + + AcpiGbl_DbMethodInfo.NumThreads = NumThreads; + Size = 4 * AcpiGbl_DbMethodInfo.NumThreads; + AcpiGbl_DbMethodInfo.Threads = (UINT32 *) AcpiOsAllocate (Size); + if (AcpiGbl_DbMethodInfo.Threads == NULL) + { + AcpiOsPrintf ("No memory for thread IDs array\n"); + (void) AcpiOsDeleteSemaphore (MainThreadGate); + (void) AcpiOsDeleteSemaphore (ThreadCompleteGate); + return; + } + ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size); + /* Setup the context to be passed to each thread */ AcpiGbl_DbMethodInfo.Name = MethodNameArg; - AcpiGbl_DbMethodInfo.Args = NULL; AcpiGbl_DbMethodInfo.Flags = 0; AcpiGbl_DbMethodInfo.NumLoops = NumLoops; - AcpiGbl_DbMethodInfo.ThreadGate = ThreadGate; + AcpiGbl_DbMethodInfo.MainThreadGate = MainThreadGate; + AcpiGbl_DbMethodInfo.ThreadCompleteGate = ThreadCompleteGate; + + /* Init arguments to be passed to method */ + + AcpiGbl_DbMethodInfo.InitArgs = 1; + AcpiGbl_DbMethodInfo.Args = AcpiGbl_DbMethodInfo.Arguments; + AcpiGbl_DbMethodInfo.Arguments[0] = AcpiGbl_DbMethodInfo.NumThreadsStr; + AcpiGbl_DbMethodInfo.Arguments[1] = AcpiGbl_DbMethodInfo.IdOfThreadStr; + AcpiGbl_DbMethodInfo.Arguments[2] = AcpiGbl_DbMethodInfo.IndexOfThreadStr; + AcpiGbl_DbMethodInfo.Arguments[3] = NULL; + AcpiDbUInt32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr); AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); @@ -627,20 +692,19 @@ AcpiDbCreateExecutionThreads ( /* Wait for all threads to complete */ - i = NumThreads; - while (i) /* Brain damage for host OSs that only support wait of 1 unit */ - { - Status = AcpiOsWaitSemaphore (ThreadGate, 1, ACPI_WAIT_FOREVER); - i--; - } - - /* Cleanup and exit */ - - (void) AcpiOsDeleteSemaphore (ThreadGate); + (void) AcpiOsWaitSemaphore (MainThreadGate, 1, ACPI_WAIT_FOREVER); AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); + + /* Cleanup and exit */ + + (void) AcpiOsDeleteSemaphore (MainThreadGate); + (void) AcpiOsDeleteSemaphore (ThreadCompleteGate); + + AcpiOsFree (AcpiGbl_DbMethodInfo.Threads); + AcpiGbl_DbMethodInfo.Threads = NULL; } #endif /* ACPI_DEBUGGER */ diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbfileio.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbfileio.c index 2a060429f0..5d4bd9082f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbfileio.c +++ b/src/add-ons/kernel/bus_managers/acpi/debugger/dbfileio.c @@ -2,7 +2,7 @@ * * Module Name: dbfileio - Debugger file I/O commands. These can't usually * be used when running the debugger in Ring 0 (Kernel mode) - * $Revision: 1.93 $ + * $Revision: 1.96 $ * ******************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -118,9 +118,7 @@ #include "acpi.h" #include "acdebug.h" -#include "acnamesp.h" #include "actables.h" -#include "acdisasm.h" #if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER) diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbhistry.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbhistry.c index afc12ba0d6..160f6eccbd 100644 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbhistry.c +++ b/src/add-ons/kernel/bus_managers/acpi/debugger/dbhistry.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dbhistry - debugger HISTORY command - * $Revision: 1.33 $ + * $Revision: 1.35 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbinput.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbinput.c index cf0162f737..f1f6ddd89e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbinput.c +++ b/src/add-ons/kernel/bus_managers/acpi/debugger/dbinput.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbinput - user front-end to the AML debugger - * $Revision: 1.113 $ + * $Revision: 1.116 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -866,7 +866,7 @@ AcpiDbCommandDispatch ( break; case CMD_TRACE: - AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); + (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); break; case CMD_TREE: diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbstats.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbstats.c index 094900d017..aec1833161 100644 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbstats.c +++ b/src/add-ons/kernel/bus_managers/acpi/debugger/dbstats.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbstats - Generation and display of ACPI table statistics - * $Revision: 1.84 $ + * $Revision: 1.90 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -141,9 +141,11 @@ AcpiDbClassifyOneObject ( void *Context, void **ReturnValue); +#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE static void AcpiDbListInfo ( ACPI_MEMORY_LIST *List); +#endif /* @@ -171,7 +173,6 @@ static ARGUMENT_INFO AcpiDbStatTypes [] = #if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE - /******************************************************************************* * * FUNCTION: AcpiDbListInfo @@ -190,7 +191,6 @@ AcpiDbListInfo ( { #ifdef ACPI_DBG_TRACK_ALLOCATIONS UINT32 Outstanding; - UINT32 Temp; #endif AcpiOsPrintf ("\n%s\n", List->ListName); @@ -200,7 +200,7 @@ AcpiDbListInfo ( if (List->MaxDepth > 0) { AcpiOsPrintf ( - " Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n", + " Cache: [Depth MaxD Avail Size] %8.2X %8.2X %8.2X %8.2X\n", List->CurrentDepth, List->MaxDepth, List->MaxDepth - List->CurrentDepth, @@ -211,31 +211,36 @@ AcpiDbListInfo ( if (List->MaxDepth > 0) { AcpiOsPrintf ( - " Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n", + " Cache: [Requests Hits Misses ObjSize] %8.2X %8.2X %8.2X %8.2X\n", List->Requests, List->Hits, List->Requests - List->Hits, List->ObjectSize); } - Outstanding = List->TotalAllocated - - List->TotalFreed - - List->CurrentDepth; + Outstanding = AcpiDbGetCacheInfo (List); if (List->ObjectSize) { - Temp = ACPI_ROUND_UP_TO_1K (Outstanding * List->ObjectSize); + AcpiOsPrintf ( + " Mem: [Alloc Free Max CurSize Outstanding] %8.2X %8.2X %8.2X %8.2X %8.2X\n", + List->TotalAllocated, + List->TotalFreed, + List->MaxOccupied, + Outstanding * List->ObjectSize, + Outstanding); } else { - Temp = ACPI_ROUND_UP_TO_1K (List->CurrentTotalSize); + AcpiOsPrintf ( + " Mem: [Alloc Free Max CurSize Outstanding Total] %8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n", + List->TotalAllocated, + List->TotalFreed, + List->MaxOccupied, + List->CurrentTotalSize, + Outstanding, + List->TotalSize); } - - AcpiOsPrintf ( - " Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n", - List->TotalAllocated, - List->TotalFreed, - Outstanding, Temp); #endif } #endif @@ -518,17 +523,18 @@ AcpiDbDisplayStatistics ( case CMD_STAT_MEMORY: #ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n"); + AcpiOsPrintf ("\n----Object Statistics (all in hex)---------\n"); AcpiDbListInfo (AcpiGbl_GlobalList); AcpiDbListInfo (AcpiGbl_NsNodeList); +#endif #ifdef ACPI_USE_LOCAL_CACHE + AcpiOsPrintf ("\n----Cache Statistics (all in hex)---------\n"); AcpiDbListInfo (AcpiGbl_OperandCache); AcpiDbListInfo (AcpiGbl_PsNodeCache); AcpiDbListInfo (AcpiGbl_PsNodeExtCache); AcpiDbListInfo (AcpiGbl_StateCache); -#endif #endif break; @@ -586,6 +592,7 @@ AcpiDbDisplayStatistics ( AcpiOsPrintf ("ParseObjectAsl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL)); AcpiOsPrintf ("OperandObject %3d\n", sizeof (ACPI_OPERAND_OBJECT)); AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE)); + AcpiOsPrintf ("AcpiObject %3d\n", sizeof (ACPI_OBJECT)); break; @@ -593,13 +600,13 @@ AcpiDbDisplayStatistics ( case CMD_STAT_STACK: #if defined(ACPI_DEBUG_OUTPUT) - Temp = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer); + Temp = (UINT32) ACPI_PTR_DIFF (AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer); AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n"); - AcpiOsPrintf ("Entry Stack Pointer %X\n", AcpiGbl_EntryStackPointer); - AcpiOsPrintf ("Lowest Stack Pointer %X\n", AcpiGbl_LowestStackPointer); - AcpiOsPrintf ("Stack Use %X (%d)\n", Temp, Temp); - AcpiOsPrintf ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting); + AcpiOsPrintf ("Entry Stack Pointer %p\n", AcpiGbl_EntryStackPointer); + AcpiOsPrintf ("Lowest Stack Pointer %p\n", AcpiGbl_LowestStackPointer); + AcpiOsPrintf ("Stack Use %X (%u)\n", Temp, Temp); + AcpiOsPrintf ("Deepest Procedure Nesting %u\n", AcpiGbl_DeepestNesting); #endif break; diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbutils.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbutils.c index 5a1b1b017f..5e69a833d5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/debugger/dbutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbutils - AML debugger utilities - * $Revision: 1.81 $ + * $Revision: 1.87 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -138,6 +138,8 @@ AcpiDbDumpBuffer ( UINT32 Address); #endif +static char *Converter = "0123456789ABCDEF"; + /******************************************************************************* * @@ -246,8 +248,7 @@ AcpiDbDumpExternalObject ( { case ACPI_TYPE_ANY: - AcpiOsPrintf ("[Object Reference] = %p", ObjDesc->Reference.Handle); - AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL); + AcpiOsPrintf ("[Null Object] (Type=0)\n"); break; @@ -298,7 +299,7 @@ AcpiDbDumpExternalObject ( case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf ("[Object Reference] = %p", ObjDesc->Reference.Handle); + AcpiOsPrintf ("[Object Reference] = ", ObjDesc->Reference.Handle); AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL); break; @@ -428,6 +429,47 @@ AcpiDbLocalNsLookup ( } +/******************************************************************************* + * + * FUNCTION: AcpiDbUInt32ToHexString + * + * PARAMETERS: Value - The value to be converted to string + * Buffer - Buffer for result (not less than 11 bytes) + * + * RETURN: None + * + * DESCRIPTION: Convert the unsigned 32-bit value to the hexadecimal image + * + * NOTE: It is the caller's responsibility to ensure that the length of buffer + * is sufficient. + * + ******************************************************************************/ + +void +AcpiDbUInt32ToHexString ( + UINT32 Value, + char *Buffer) +{ + UINT8 i; + + + if (Value == 0) + { + ACPI_STRCPY (Buffer, "0"); + return; + } + + ACPI_STRCPY (Buffer, "0x"); + Buffer[10] = '\0'; + + for (i = 9; i > 1; i--) + { + Buffer[i] = Converter [Value & 0x0F]; + Value = Value >> 4; + } +} + + #ifdef ACPI_OBSOLETE_FUNCTIONS /******************************************************************************* * diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbxface.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbxface.c index fdc2ef797c..e82292630d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/debugger/dbxface.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbxface - AML Debugger external interfaces - * $Revision: 1.77 $ + * $Revision: 1.79 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmbuffer.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmbuffer.c index 05d4e1ac0c..b8614d3502 100644 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmbuffer.c +++ b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmbuffer.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmbuffer - AML disassembler, buffer and string support - * $Revision: 1.24 $ + * $Revision: 1.26 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmnames.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmnames.c index d868cf7041..dcee6ca2e5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmnames.c +++ b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmnames.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmnames - AML disassembler, names, namestrings, pathnames - * $Revision: 1.16 $ + * $Revision: 1.18 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmobject.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmobject.c index d29796dbc6..ec585f005c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmobject.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmobject - ACPI object decode and display - * $Revision: 1.21 $ + * $Revision: 1.24 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -352,7 +352,22 @@ AcpiDmDecodeNode ( AcpiOsPrintf (" [Method Local]"); } - AcpiDmDecodeInternalObject (AcpiNsGetAttachedObject (Node)); + switch (Node->Type) + { + /* These types have no attached object */ + + case ACPI_TYPE_DEVICE: + AcpiOsPrintf (" Device"); + break; + + case ACPI_TYPE_THERMAL: + AcpiOsPrintf (" Thermal Zone"); + break; + + default: + AcpiDmDecodeInternalObject (AcpiNsGetAttachedObject (Node)); + break; + } } diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmopcode.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmopcode.c index 495182eca0..277caf1c80 100644 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmopcode.c +++ b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmopcode.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmopcode - AML disassembler, specific AML opcodes - * $Revision: 1.99 $ + * $Revision: 1.105 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -202,8 +202,6 @@ AcpiDmFieldFlags ( UINT32 Flags; - /* The next peer Op (not child op) contains the flags */ - Op = Op->Common.Next; Flags = (UINT8) Op->Common.Value.Integer; @@ -406,6 +404,9 @@ AcpiDmDisassembleOneOp ( case AML_LLESS_OP: AcpiOsPrintf ("LGreaterEqual"); break; + + default: + break; } Op->Common.DisasmOpcode = 0; Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; @@ -615,13 +616,15 @@ AcpiDmDisassembleOneOp ( if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) && (WalkState) && (WalkState->Results) && - (WalkState->Results->Results.NumResults)) + (WalkState->ResultCount)) { AcpiDmDecodeInternalObject ( WalkState->Results->Results.ObjDesc [ - WalkState->Results->Results.NumResults-1]); + (WalkState->ResultCount - 1) % + ACPI_RESULTS_FRAME_OBJ_NUM]); } #endif + break; } } diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrc.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrc.c index e428512e1d..3fd3d83504 100644 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrc.c +++ b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmresrc.c - Resource Descriptor disassembly - * $Revision: 1.33 $ + * $Revision: 1.36 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -248,8 +248,7 @@ AcpiDmDumpInteger64 ( UINT64 Value, char *Name) { - AcpiOsPrintf ("0x%8.8X%8.8X, // %s\n", - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Value)), Name); + AcpiOsPrintf ("0x%8.8X%8.8X, // %s\n", ACPI_FORMAT_UINT64 (Value), Name); } diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcl.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcl.c index 514e139184..24b894ad7a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcl.c +++ b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcl.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly - * $Revision: 1.36 $ + * $Revision: 1.38 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcs.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcs.c index 86c9d9f8e5..c3c0c8a78e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcs.c +++ b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcs.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly - * $Revision: 1.15 $ + * $Revision: 1.17 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmutils.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmutils.c index ffcce5ca31..0b1313c2a0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmutils - AML disassembler utilities - * $Revision: 1.24 $ + * $Revision: 1.26 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmwalk.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmwalk.c index 69e38ff69d..ff0ccf6504 100644 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmwalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmwalk.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmwalk - AML disassembly tree walk - * $Revision: 1.32 $ + * $Revision: 1.34 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evevent.c b/src/add-ons/kernel/bus_managers/acpi/events/evevent.c index 7f5afd5f17..172a0e2c25 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evevent.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evevent.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evevent - Fixed Event handling and dispatch - * $Revision: 1.124 $ + * $Revision: 1.127 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -369,6 +369,7 @@ AcpiEvFixedEventDetect ( { /* Found an active (signalled) event */ + AcpiFixedEventCount[i]++; IntStatus |= AcpiEvFixedEventDispatch ((UINT32) i); } } @@ -395,7 +396,6 @@ AcpiEvFixedEventDispatch ( UINT32 Event) { - ACPI_FUNCTION_ENTRY (); diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c index 2c9e61e590..816be9a5e4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpe - General Purpose Event handling and dispatch - * $Revision: 1.67 $ + * $Revision: 1.72 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -127,6 +127,10 @@ static void ACPI_SYSTEM_XFACE AcpiEvAsynchExecuteGpeMethod ( void *Context); +static void ACPI_SYSTEM_XFACE +AcpiEvAsynchEnableGpe ( + void *Context); + /******************************************************************************* * @@ -345,7 +349,14 @@ AcpiEvDisableGpe ( ACPI_FUNCTION_TRACE (EvDisableGpe); - if (!(GpeEventInfo->Flags & ACPI_GPE_ENABLE_MASK)) + /* + * Ignore this if the GPE is valid and not enabled. + * + * Flags is only zero if GPE is neither enabled or disabled -- it may + * be a spurious or stray GPE -- disable it in the default case below. + */ + if (GpeEventInfo->Flags && + (!(GpeEventInfo->Flags & ACPI_GPE_ENABLE_MASK))) { return_ACPI_STATUS (AE_OK); } @@ -376,11 +387,18 @@ AcpiEvDisableGpe ( /* Disable the requested runtime GPE */ ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED); - Status = AcpiHwWriteGpeEnableReg (GpeEventInfo); - break; + + /*lint -fallthrough */ default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + /* + * Even if we don't know the GPE type, make sure that we always + * disable it. This can prevent a certain type of GPE flood, where + * the GPE has no _Lxx/_Exx method, and it cannot be determined + * whether the GPE is wake, run, or wake/run. + */ + Status = AcpiHwWriteGpeEnableReg (GpeEventInfo); + break; } return_ACPI_STATUS (AE_OK); @@ -607,15 +625,25 @@ static void ACPI_SYSTEM_XFACE AcpiEvAsynchExecuteGpeMethod ( void *Context) { - ACPI_GPE_EVENT_INFO *GpeEventInfo = (void *) Context; + ACPI_GPE_EVENT_INFO *GpeEventInfo = Context; ACPI_STATUS Status; - ACPI_GPE_EVENT_INFO LocalGpeEventInfo; + ACPI_GPE_EVENT_INFO *LocalGpeEventInfo; ACPI_EVALUATE_INFO *Info; ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod); + /* Allocate a local GPE block */ + + LocalGpeEventInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_EVENT_INFO)); + if (!LocalGpeEventInfo) + { + ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, + "while handling a GPE")); + return_VOID; + } + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { @@ -638,7 +666,7 @@ AcpiEvAsynchExecuteGpeMethod ( * Take a snapshot of the GPE info for this level - we copy the * info to prevent a race condition with RemoveHandler/RemoveBlock. */ - ACPI_MEMCPY (&LocalGpeEventInfo, GpeEventInfo, + ACPI_MEMCPY (LocalGpeEventInfo, GpeEventInfo, sizeof (ACPI_GPE_EVENT_INFO)); Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); @@ -651,7 +679,7 @@ AcpiEvAsynchExecuteGpeMethod ( * Must check for control method type dispatch one more * time to avoid race with EvGpeInstallHandler */ - if ((LocalGpeEventInfo.Flags & ACPI_GPE_DISPATCH_MASK) == + if ((LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) { /* Allocate the evaluation information block */ @@ -667,8 +695,8 @@ AcpiEvAsynchExecuteGpeMethod ( * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx * control method that corresponds to this GPE */ - Info->PrefixNode = LocalGpeEventInfo.Dispatch.MethodNode; - Info->Parameters = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT *, GpeEventInfo); + Info->PrefixNode = LocalGpeEventInfo->Dispatch.MethodNode; + Info->Parameters = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT *, LocalGpeEventInfo); Info->ParameterType = ACPI_PARAM_GPE; Info->Flags = ACPI_IGNORE_RETURN_VALUE; @@ -680,28 +708,64 @@ AcpiEvAsynchExecuteGpeMethod ( { ACPI_EXCEPTION ((AE_INFO, Status, "while evaluating GPE method [%4.4s]", - AcpiUtGetNodeName (LocalGpeEventInfo.Dispatch.MethodNode))); + AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode))); } } - if ((LocalGpeEventInfo.Flags & ACPI_GPE_XRUPT_TYPE_MASK) == + /* Defer enabling of GPE until all notify handlers are done */ + + Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, + AcpiEvAsynchEnableGpe, LocalGpeEventInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (LocalGpeEventInfo); + } + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvAsynchEnableGpe + * + * PARAMETERS: Context (GpeEventInfo) - Info for this GPE + * + * RETURN: None + * + * DESCRIPTION: Asynchronous clear/enable for GPE. This allows the GPE to + * complete (i.e., finish execution of Notify) + * + ******************************************************************************/ + +static void ACPI_SYSTEM_XFACE +AcpiEvAsynchEnableGpe ( + void *Context) +{ + ACPI_GPE_EVENT_INFO *GpeEventInfo = Context; + ACPI_STATUS Status; + + + if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { /* * GPE is level-triggered, we clear the GPE status bit after * handling the event. */ - Status = AcpiHwClearGpe (&LocalGpeEventInfo); + Status = AcpiHwClearGpe (GpeEventInfo); if (ACPI_FAILURE (Status)) { - return_VOID; + goto Exit; } } /* Enable this GPE */ - (void) AcpiHwWriteGpeEnableReg (&LocalGpeEventInfo); - return_VOID; + (void) AcpiHwWriteGpeEnableReg (GpeEventInfo); + +Exit: + ACPI_FREE (GpeEventInfo); + return; } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c index 29ff4de8ac..7cefe6470e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpeblk - GPE block creation and initialization. - * $Revision: 1.58 $ + * $Revision: 1.62 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -709,6 +709,12 @@ AcpiEvDeleteGpeXrupt ( { GpeXrupt->Previous->Next = GpeXrupt->Next; } + else + { + /* No previous, update list head */ + + AcpiGbl_GpeXruptListHead = GpeXrupt->Next; + } if (GpeXrupt->Next) { @@ -945,14 +951,11 @@ AcpiEvCreateGpeInfoBlocks ( ThisRegister->BaseGpeNumber = (UINT8) (GpeBlock->BlockBaseNumber + (i * ACPI_GPE_REGISTER_WIDTH)); - ACPI_STORE_ADDRESS (ThisRegister->StatusAddress.Address, - (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address) - + i)); + ThisRegister->StatusAddress.Address = + GpeBlock->BlockAddress.Address + i; - ACPI_STORE_ADDRESS (ThisRegister->EnableAddress.Address, - (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address) - + i - + GpeBlock->RegisterCount)); + ThisRegister->EnableAddress.Address = + GpeBlock->BlockAddress.Address + i + GpeBlock->RegisterCount; ThisRegister->StatusAddress.SpaceId = GpeBlock->BlockAddress.SpaceId; ThisRegister->EnableAddress.SpaceId = GpeBlock->BlockAddress.SpaceId; @@ -1277,7 +1280,7 @@ AcpiEvGpeInitialize ( * particular block is not supported. */ if (AcpiGbl_FADT.Gpe0BlockLength && - ACPI_GET_ADDRESS (AcpiGbl_FADT.XGpe0Block.Address)) + AcpiGbl_FADT.XGpe0Block.Address) { /* GPE block 0 exists (has both length and address > 0) */ @@ -1299,7 +1302,7 @@ AcpiEvGpeInitialize ( } if (AcpiGbl_FADT.Gpe1BlockLength && - ACPI_GET_ADDRESS (AcpiGbl_FADT.XGpe1Block.Address)) + AcpiGbl_FADT.XGpe1Block.Address) { /* GPE block 1 exists (has both length and address > 0) */ diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c b/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c index fd85640939..210a934543 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evmisc - Miscellaneous event manager support functions - * $Revision: 1.99 $ + * $Revision: 1.109 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -123,22 +123,6 @@ ACPI_MODULE_NAME ("evmisc") -/* Names for Notify() values, used for debug output */ - -#ifdef ACPI_DEBUG_OUTPUT -static const char *AcpiNotifyValueNames[] = -{ - "Bus Check", - "Device Check", - "Device Wake", - "Eject Request", - "Device Check Light", - "Frequency Mismatch", - "Bus Mode Mismatch", - "Power Fault" -}; -#endif - /* Pointer to FACS needed for the Global Lock */ static ACPI_TABLE_FACS *Facs = NULL; @@ -153,6 +137,10 @@ static UINT32 AcpiEvGlobalLockHandler ( void *Context); +static ACPI_STATUS +AcpiEvRemoveGlobalLockHandler ( + void); + /******************************************************************************* * @@ -176,7 +164,6 @@ AcpiEvIsNotifyObject ( { case ACPI_TYPE_DEVICE: case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_POWER: case ACPI_TYPE_THERMAL: /* * These are the ONLY objects that can receive ACPI notifications @@ -225,19 +212,9 @@ AcpiEvQueueNotifyRequest ( * initiate soft-off or sleep operation? */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Dispatching Notify(%X) on node %p\n", NotifyValue, Node)); - - if (NotifyValue <= 7) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n", - AcpiNotifyValueNames[NotifyValue])); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Notify value: 0x%2.2X **Device Specific**\n", - NotifyValue)); - } + "Dispatching Notify on [%4.4s] Node %p Value 0x%2.2X (%s)\n", + AcpiUtGetNodeName (Node), Node, NotifyValue, + AcpiUtGetNotifyName (NotifyValue))); /* Get the notify object attached to the NS Node */ @@ -248,10 +225,11 @@ AcpiEvQueueNotifyRequest ( switch (Node->Type) { + /* Notify allowed only on these types */ + case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_POWER: if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) { @@ -269,8 +247,13 @@ AcpiEvQueueNotifyRequest ( } } - /* If there is any handler to run, schedule the dispatcher */ - + /* + * If there is any handler to run, schedule the dispatcher. + * Check for: + * 1) Global system notify handler + * 2) Global device notify handler + * 3) Per-device notify handler + */ if ((AcpiGbl_SystemNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) || (AcpiGbl_DeviceNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY)) || HandlerObj) @@ -281,6 +264,13 @@ AcpiEvQueueNotifyRequest ( return (AE_NO_MEMORY); } + if (!HandlerObj) + { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Executing system notify handler for Notify (%4.4s, %X) node %p\n", + AcpiUtGetNodeName (Node), NotifyValue, Node)); + } + NotifyInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY; NotifyInfo->Notify.Node = Node; NotifyInfo->Notify.Value = (UINT16) NotifyValue; @@ -293,15 +283,13 @@ AcpiEvQueueNotifyRequest ( AcpiUtDeleteGenericState (NotifyInfo); } } - - if (!HandlerObj) + else { /* - * There is no per-device notify handler for this device. - * This may or may not be a problem. + * There is no notify handler (per-device or system) for this device. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "No notify handler for Notify(%4.4s, %X) node %p\n", + "No notify handler for Notify (%4.4s, %X) node %p\n", AcpiUtGetNodeName (Node), NotifyValue, Node)); } @@ -459,7 +447,8 @@ AcpiEvInitGlobalLockHandler ( ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); - Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, (ACPI_TABLE_HEADER **) &Facs); + Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -489,6 +478,35 @@ AcpiEvInitGlobalLockHandler ( } +/******************************************************************************* + * + * FUNCTION: AcpiEvRemoveGlobalLockHandler + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Remove the handler for the Global Lock + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiEvRemoveGlobalLockHandler ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler); + + AcpiGbl_GlobalLockPresent = FALSE; + Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL, + AcpiEvGlobalLockHandler); + + return_ACPI_STATUS (Status); +} + + /****************************************************************************** * * FUNCTION: AcpiEvAcquireGlobalLock @@ -526,12 +544,27 @@ AcpiEvAcquireGlobalLock ( * Only one thread can acquire the GL at a time, the GlobalLockMutex * enforces this. This interface releases the interpreter if we must wait. */ - Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex, Timeout); + Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex, + Timeout); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } + /* + * Update the global lock handle and check for wraparound. The handle is + * only used for the external global lock interfaces, but it is updated + * here to properly handle the case where a single thread may acquire the + * lock via both the AML and the AcpiAcquireGlobalLock interfaces. The + * handle is therefore updated on the first acquire from a given thread + * regardless of where the acquisition request originated. + */ + AcpiGbl_GlobalLockHandle++; + if (AcpiGbl_GlobalLockHandle == 0) + { + AcpiGbl_GlobalLockHandle = 1; + } + /* * Make sure that a global lock actually exists. If not, just treat * the lock as a standard mutex. @@ -627,7 +660,7 @@ AcpiEvReleaseGlobalLock ( /* Release the local GL mutex */ - AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex); + AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); return_ACPI_STATUS (Status); } @@ -686,6 +719,13 @@ AcpiEvTerminate ( ACPI_ERROR ((AE_INFO, "Could not remove SCI handler")); } + + Status = AcpiEvRemoveGlobalLockHandler (); + if (ACPI_FAILURE(Status)) + { + ACPI_ERROR ((AE_INFO, + "Could not remove Global Lock handler")); + } } /* Deallocate all handler objects installed within GPE info structs */ diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evregion.c b/src/add-ons/kernel/bus_managers/acpi/events/evregion.c index bd77fde796..9802b04b4d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evregion.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evregion.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch - * $Revision: 1.167 $ + * $Revision: 1.171 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -454,14 +454,14 @@ AcpiEvAddressSpaceDispatch ( * setup will potentially execute control methods * (e.g., _REG method for this region) */ - AcpiExRelinquishInterpreter (); + AcpiExExitInterpreter (); Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE, HandlerDesc->AddressSpace.Context, &RegionContext); /* Re-enter the interpreter */ - AcpiExReacquireInterpreter (); + AcpiExEnterInterpreter (); /* Check for failure of the Region Setup */ @@ -504,7 +504,7 @@ AcpiEvAddressSpaceDispatch ( ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", &RegionObj->Region.Handler->AddressSpace, Handler, - ACPI_FORMAT_UINT64 (Address), + ACPI_FORMAT_NATIVE_UINT (Address), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); if (!(HandlerDesc->AddressSpace.HandlerFlags & @@ -515,7 +515,7 @@ AcpiEvAddressSpaceDispatch ( * exit the interpreter because the handler *might* block -- we don't * know what it will do, so we can't hold the lock on the intepreter. */ - AcpiExRelinquishInterpreter(); + AcpiExExitInterpreter(); } /* Call the handler */ @@ -536,7 +536,7 @@ AcpiEvAddressSpaceDispatch ( * We just returned from a non-default handler, we must re-enter the * interpreter */ - AcpiExReacquireInterpreter (); + AcpiExEnterInterpreter (); } return_ACPI_STATUS (Status); diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c b/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c index 81395f9145..1764f1a121 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init - * $Revision: 1.87 $ + * $Revision: 1.89 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evsci.c b/src/add-ons/kernel/bus_managers/acpi/events/evsci.c index bf05a9a1e5..1746d84b6f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evsci.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evsci.c @@ -2,7 +2,7 @@ * * Module Name: evsci - System Control Interrupt configuration and * legacy to ACPI mode state transition functions - * $Revision: 1.101 $ + * $Revision: 1.104 $ * ******************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -171,6 +171,7 @@ AcpiEvSciXruptHandler ( */ InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); + AcpiSciCount++; return_UINT32 (InterruptHandled); } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxface.c b/src/add-ons/kernel/bus_managers/acpi/events/evxface.c index cc9bba1173..64fcd8a5e1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evxface - External interfaces for ACPI events - * $Revision: 1.162 $ + * $Revision: 1.167 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -891,6 +891,12 @@ ACPI_EXPORT_SYMBOL (AcpiRemoveGpeHandler) * * DESCRIPTION: Acquire the ACPI Global Lock * + * Note: Allows callers with the same thread ID to acquire the global lock + * multiple times. In other words, externally, the behavior of the global lock + * is identical to an AML mutex. On the first acquire, a new handle is + * returned. On any subsequent calls to acquire by the same thread, the same + * handle is returned. + * ******************************************************************************/ ACPI_STATUS @@ -909,15 +915,18 @@ AcpiAcquireGlobalLock ( /* Must lock interpreter to prevent race conditions */ AcpiExEnterInterpreter (); - Status = AcpiEvAcquireGlobalLock (Timeout); - AcpiExExitInterpreter (); + + Status = AcpiExAcquireMutexObject (Timeout, + AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ()); if (ACPI_SUCCESS (Status)) { - AcpiGbl_GlobalLockHandle++; + /* Return the global lock handle (updated in AcpiEvAcquireGlobalLock) */ + *Handle = AcpiGbl_GlobalLockHandle; } + AcpiExExitInterpreter (); return (Status); } @@ -943,12 +952,12 @@ AcpiReleaseGlobalLock ( ACPI_STATUS Status; - if (Handle != AcpiGbl_GlobalLockHandle) + if (!Handle || (Handle != AcpiGbl_GlobalLockHandle)) { return (AE_NOT_ACQUIRED); } - Status = AcpiEvReleaseGlobalLock (); + Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex); return (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c b/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c index fd52ccbb0a..1318fa1d50 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable - * $Revision: 1.92 $ + * $Revision: 1.94 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c b/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c index 834d65a65d..8cfeca5725 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c @@ -2,7 +2,7 @@ * * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Address Spaces. - * $Revision: 1.69 $ + * $Revision: 1.71 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c index cd8461c832..9bb15ea2e2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface - * $Revision: 1.77 $ + * $Revision: 1.79 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c index 25259f531c..2db02b305a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwgpe - Low level GPE enable/disable/clear functions - * $Revision: 1.74 $ + * $Revision: 1.76 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c index 09c0f1b3bc..2e2550180b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c @@ -3,7 +3,7 @@ * * Module Name: hwregs - Read/write access functions for the various ACPI * control and status registers. - * $Revision: 1.185 $ + * $Revision: 1.188 $ * ******************************************************************************/ @@ -11,7 +11,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -152,7 +152,7 @@ AcpiHwClearAcpiStatus ( ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n", ACPI_BITMASK_ALL_FIXED_STATUS, - (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT.XPm1aEventBlock.Address))); + (UINT16) AcpiGbl_FADT.XPm1aEventBlock.Address)); LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock); @@ -166,7 +166,7 @@ AcpiHwClearAcpiStatus ( /* Clear the fixed events */ - if (ACPI_VALID_ADDRESS (AcpiGbl_FADT.XPm1bEventBlock.Address)) + if (AcpiGbl_FADT.XPm1bEventBlock.Address) { Status = AcpiHwLowLevelWrite (16, ACPI_BITMASK_ALL_FIXED_STATUS, &AcpiGbl_FADT.XPm1bEventBlock); @@ -519,16 +519,14 @@ AcpiSetRegister ( ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", RegisterValue, - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS ( - AcpiGbl_FADT.XPm2ControlBlock.Address)))); + ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address))); ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask, Value); ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", RegisterValue, - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS ( - AcpiGbl_FADT.XPm2ControlBlock.Address)))); + ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address))); Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue)); @@ -883,7 +881,7 @@ AcpiHwLowLevelRead ( /* Get a local copy of the address. Handles possible alignment issues */ ACPI_MOVE_64_TO_64 (&Address, &Reg->Address); - if (!ACPI_VALID_ADDRESS (Address)) + if (!Address) { return (AE_OK); } @@ -898,15 +896,13 @@ AcpiHwLowLevelRead ( case ACPI_ADR_SPACE_SYSTEM_MEMORY: Status = AcpiOsReadMemory ( - (ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Address), - Value, Width); + (ACPI_PHYSICAL_ADDRESS) Address, Value, Width); break; case ACPI_ADR_SPACE_SYSTEM_IO: - Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Address), - Value, Width); + Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, Value, Width); break; @@ -918,8 +914,7 @@ AcpiHwLowLevelRead ( ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", - *Value, Width, - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)), + *Value, Width, ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status); @@ -966,7 +961,7 @@ AcpiHwLowLevelWrite ( /* Get a local copy of the address. Handles possible alignment issues */ ACPI_MOVE_64_TO_64 (&Address, &Reg->Address); - if (!ACPI_VALID_ADDRESS (Address)) + if (!Address) { return (AE_OK); } @@ -980,15 +975,14 @@ AcpiHwLowLevelWrite ( case ACPI_ADR_SPACE_SYSTEM_MEMORY: Status = AcpiOsWriteMemory ( - (ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Address), - Value, Width); + (ACPI_PHYSICAL_ADDRESS) Address, Value, Width); break; case ACPI_ADR_SPACE_SYSTEM_IO: - Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Address), - Value, Width); + Status = AcpiOsWritePort ( + (ACPI_IO_ADDRESS) Address, Value, Width); break; @@ -1000,8 +994,7 @@ AcpiHwLowLevelWrite ( ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", - Value, Width, - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)), + Value, Width, ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status); diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c index ecf8d54cf7..2f638f9dd7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface - * $Revision: 1.85 $ + * $Revision: 1.89 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -116,7 +116,6 @@ *****************************************************************************/ #include "acpi.h" -#include "actables.h" #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME ("hwsleep") @@ -147,7 +146,8 @@ AcpiSetFirmwareWakingVector ( /* Get the FACS */ - Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, (ACPI_TABLE_HEADER **) &Facs); + Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -156,7 +156,7 @@ AcpiSetFirmwareWakingVector ( /* Set the vector */ if ((Facs->Length < 32) || - (!(ACPI_GET_ADDRESS (Facs->XFirmwareWakingVector)))) + (!(Facs->XFirmwareWakingVector))) { /* * ACPI 1.0 FACS or short table or optional X_ field is zero @@ -209,7 +209,8 @@ AcpiGetFirmwareWakingVector ( /* Get the FACS */ - Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, (ACPI_TABLE_HEADER **) &Facs); + Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -218,7 +219,7 @@ AcpiGetFirmwareWakingVector ( /* Get the vector */ if ((Facs->Length < 32) || - (!(ACPI_GET_ADDRESS (Facs->XFirmwareWakingVector)))) + (!(Facs->XFirmwareWakingVector))) { /* * ACPI 1.0 FACS or short table or optional X_ field is zero diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c index 87e6218d13..41b1e9bcfc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwtimer.c - ACPI Power Management Timer Interface - * $Revision: 1.36 $ + * $Revision: 1.38 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acapps.h b/src/add-ons/kernel/bus_managers/acpi/include/acapps.h index 15503375b1..87dcc2a43a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acapps.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acapps.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -168,7 +168,8 @@ AdGetLocalTables ( ACPI_STATUS AdParseTable ( - ACPI_TABLE_HEADER *Table); + ACPI_TABLE_HEADER *Table, + BOOLEAN LoadTable); ACPI_STATUS AdDisplayTables ( diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h b/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h index d11a2f57c5..9bce32cac7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 1.229 $ + * $Revision: 1.243 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -137,7 +137,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20061109 +#define ACPI_CA_VERSION 0x20080321 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -226,6 +226,17 @@ #define ACPI_OBJ_NUM_OPERANDS 8 #define ACPI_OBJ_MAX_OPERAND 7 +/* Number of elements in the Result Stack frame, can be an arbitrary value */ + +#define ACPI_RESULTS_FRAME_OBJ_NUM 8 + +/* + * Maximal number of elements the Result Stack can contain, + * it may be an arbitray value not exceeding the types of + * ResultSize and ResultCount (now UINT8). + */ +#define ACPI_RESULTS_OBJ_NUM_MAX 255 + /* Names within the namespace are 4 bytes long */ #define ACPI_NAME_SIZE 4 diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h b/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h index a56bde7cca..da91fddbc2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdebug.h - ACPI/AML debugger - * $Revision: 1.81 $ + * $Revision: 1.85 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -323,6 +323,12 @@ AcpiDbCreateExecutionThreads ( char *NumLoopsArg, char *MethodNameArg); +#ifdef ACPI_DBG_TRACK_ALLOCATIONS +UINT32 +AcpiDbGetCacheInfo ( + ACPI_MEMORY_LIST *Cache); +#endif + /* * dbfileio - Debugger file I/O commands @@ -423,4 +429,9 @@ ACPI_NAMESPACE_NODE * AcpiDbLocalNsLookup ( char *Name); +void +AcpiDbUInt32ToHexString ( + UINT32 Value, + char *Buffer); + #endif /* __ACDEBUG_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h b/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h index 51c5e88eaa..7c2d6ef3a9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdisasm.h - AML disassembler - * $Revision: 1.38 $ + * $Revision: 1.44 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -174,21 +174,25 @@ typedef const struct acpi_dmtable_info #define ACPI_DMT_CHKSUM 20 #define ACPI_DMT_SPACEID 21 #define ACPI_DMT_GAS 22 -#define ACPI_DMT_DMAR 23 -#define ACPI_DMT_MADT 24 -#define ACPI_DMT_SRAT 25 -#define ACPI_DMT_EXIT 26 -#define ACPI_DMT_SIG 27 +#define ACPI_DMT_ASF 23 +#define ACPI_DMT_DMAR 24 +#define ACPI_DMT_HEST 25 +#define ACPI_DMT_HESTNTFY 26 +#define ACPI_DMT_HESTNTYP 27 +#define ACPI_DMT_MADT 28 +#define ACPI_DMT_SRAT 29 +#define ACPI_DMT_EXIT 30 +#define ACPI_DMT_SIG 31 typedef -void (*ACPI_TABLE_HANDLER) ( +void (*ACPI_DMTABLE_HANDLER) ( ACPI_TABLE_HEADER *Table); typedef struct acpi_dmtable_data { char *Signature; - ACPI_DMTABLE_INFO *TableInfo; - ACPI_TABLE_HANDLER TableHandler; + ACPI_DMTABLE_INFO *TableInfo; + ACPI_DMTABLE_HANDLER TableHandler; char *Name; } ACPI_DMTABLE_DATA; @@ -236,6 +240,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoBert[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[]; @@ -245,11 +250,17 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoErst[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoGas[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[]; @@ -267,6 +278,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[]; @@ -284,7 +296,7 @@ void AcpiDmDumpDataTable ( ACPI_TABLE_HEADER *Table); -void +ACPI_STATUS AcpiDmDumpTable ( UINT32 TableLength, UINT32 TableOffset, @@ -321,12 +333,20 @@ void AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpEinj ( + ACPI_TABLE_HEADER *Table); + +void +AcpiDmDumpErst ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpFadt ( ACPI_TABLE_HEADER *Table); void -AcpiDmDumpSrat ( +AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table); void @@ -349,6 +369,10 @@ void AcpiDmDumpSlit ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpSrat ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpXsdt ( ACPI_TABLE_HEADER *Table); diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h b/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h index c1c66fae00..036056ab7a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdispat.h - dispatcher (parser to interpreter interface) - * $Revision: 1.73 $ + * $Revision: 1.79 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -130,6 +130,10 @@ ACPI_STATUS AcpiDsGetBufferFieldArguments ( ACPI_OPERAND_OBJECT *ObjDesc); +ACPI_STATUS +AcpiDsGetBankFieldArguments ( + ACPI_OPERAND_OBJECT *ObjDesc); + ACPI_STATUS AcpiDsGetRegionArguments ( ACPI_OPERAND_OBJECT *RgnDesc); @@ -152,12 +156,22 @@ AcpiDsEvalRegionOperands ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op); +ACPI_STATUS +AcpiDsEvalTableRegionOperands ( + 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 +AcpiDsEvalBankFieldOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + ACPI_STATUS AcpiDsInitializeRegion ( ACPI_HANDLE ObjHandle); @@ -421,6 +435,10 @@ void AcpiDsClearOperands ( ACPI_WALK_STATE *WalkState); +ACPI_STATUS +AcpiDsEvaluateNamePath ( + ACPI_WALK_STATE *WalkState); + /* * dswscope - Scope Stack manipulation @@ -471,7 +489,7 @@ AcpiDsInitAmlWalk ( ACPI_EVALUATE_INFO *Info, UINT8 PassNumber); -ACPI_STATUS +void AcpiDsObjStackPopAndDelete ( UINT32 PopCount, ACPI_WALK_STATE *WalkState); @@ -489,14 +507,6 @@ 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); @@ -505,12 +515,6 @@ ACPI_WALK_STATE * AcpiDsGetCurrentWalkState ( ACPI_THREAD_STATE *Thread); -ACPI_STATUS -AcpiDsResultRemove ( - ACPI_OPERAND_OBJECT **Object, - UINT32 Index, - ACPI_WALK_STATE *WalkState); - ACPI_STATUS AcpiDsResultPop ( ACPI_OPERAND_OBJECT **Object, @@ -521,9 +525,4 @@ 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/src/add-ons/kernel/bus_managers/acpi/include/acevents.h b/src/add-ons/kernel/bus_managers/acpi/include/acevents.h index 1b685c7201..5884d378fe 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acevents.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acevents.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acevents.h - Event subcomponent prototypes and defines - * $Revision: 1.106 $ + * $Revision: 1.110 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h b/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h index 3899a26021..36a50aca00 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem - * $Revision: 1.78 $ + * $Revision: 1.80 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h b/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h index caf493f624..a05e2dedc3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acglobal.h - Declarations for global variables - * $Revision: 1.190 $ + * $Revision: 1.199 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -178,35 +178,6 @@ ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CreateOsiMethod, TRUE); ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE); -/***************************************************************************** - * - * Debug support - * - ****************************************************************************/ - -/* Runtime configuration of debug print levels */ - -extern UINT32 AcpiDbgLevel; -extern UINT32 AcpiDbgLayer; - -/* Procedure nesting level for debug output */ - -extern UINT32 AcpiGbl_NestingLevel; - -/* Event counters */ - -ACPI_EXTERN UINT32 AcpiGpeCount; - -/* Support for dynamic control method tracing mechanism */ - -ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel; -ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer; -ACPI_EXTERN ACPI_NAME AcpiGbl_TraceMethodName; -ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel; -ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; -ACPI_EXTERN UINT32 AcpiGbl_TraceFlags; - - /***************************************************************************** * * ACPI Table globals @@ -251,10 +222,14 @@ ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth; ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]; /* - * Global lock semaphore works in conjunction with the actual HW global lock + * Global lock mutex is an actual AML mutex object + * Global lock semaphore works in conjunction with the HW global lock */ -ACPI_EXTERN ACPI_MUTEX AcpiGbl_GlobalLockMutex; +ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_GlobalLockMutex; ACPI_EXTERN ACPI_SEMAPHORE AcpiGbl_GlobalLockSemaphore; +ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle; +ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired; +ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; /* * Spinlocks are used for interfaces that can be possibly called at @@ -270,14 +245,6 @@ ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_HardwareLock; /* For ACPI H/W ex * ****************************************************************************/ -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - -/* Lists for tracking memory allocations */ - -ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList; -ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList; -#endif - /* Object caches */ ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_NamespaceCache; @@ -292,41 +259,60 @@ ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DeviceNotify; ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SystemNotify; ACPI_EXTERN ACPI_EXCEPTION_HANDLER AcpiGbl_ExceptionHandler; ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler; +ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler; +ACPI_EXTERN void *AcpiGbl_TableHandlerContext; ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk; + +/* Owner ID support */ + +ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]; +ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex; +ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset; + /* Misc */ ACPI_EXTERN UINT32 AcpiGbl_OriginalMode; ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation; ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount; ACPI_EXTERN UINT32 AcpiGbl_PsFindCount; -ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]; ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave; -ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle; -ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex; -ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset; 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; ACPI_EXTERN BOOLEAN AcpiGbl_SystemAwakeAndRunning; + +#ifndef DEFINE_ACPI_GLOBALS + +/* Exception codes */ + +extern char const *AcpiGbl_ExceptionNames_Env[]; +extern char const *AcpiGbl_ExceptionNames_Pgm[]; +extern char const *AcpiGbl_ExceptionNames_Tbl[]; +extern char const *AcpiGbl_ExceptionNames_Aml[]; +extern char const *AcpiGbl_ExceptionNames_Ctrl[]; + +/* Other miscellaneous */ + extern BOOLEAN AcpiGbl_Shutdown; extern UINT32 AcpiGbl_StartupFlags; extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT]; extern const char *AcpiGbl_HighestDstateNames[4]; extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS]; +#endif -/* Exception codes */ -extern char const *AcpiGbl_ExceptionNames_Env[]; -extern char const *AcpiGbl_ExceptionNames_Pgm[]; -extern char const *AcpiGbl_ExceptionNames_Tbl[]; -extern char const *AcpiGbl_ExceptionNames_Aml[]; -extern char const *AcpiGbl_ExceptionNames_Ctrl[]; +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + +/* Lists for tracking memory allocations */ + +ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList; +ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList; +ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats; +#endif /***************************************************************************** @@ -335,8 +321,6 @@ extern char const *AcpiGbl_ExceptionNames_Ctrl[]; * ****************************************************************************/ -#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 @@ -347,15 +331,15 @@ ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct; ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode; ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_FadtGpeDevice; -extern const UINT8 AcpiGbl_NsProperties[NUM_NS_TYPES]; +extern const UINT8 AcpiGbl_NsProperties [ACPI_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 ACPI_SIZE *AcpiGbl_EntryStackPointer; +ACPI_EXTERN ACPI_SIZE *AcpiGbl_LowestStackPointer; ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting; #endif @@ -397,6 +381,38 @@ ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead; ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]; +/***************************************************************************** + * + * Debug support + * + ****************************************************************************/ + +/* Runtime configuration of debug print levels */ + +extern UINT32 AcpiDbgLevel; +extern UINT32 AcpiDbgLayer; + +/* Procedure nesting level for debug output */ + +extern UINT32 AcpiGbl_NestingLevel; + +/* Event counters */ + +ACPI_EXTERN UINT32 AcpiMethodCount; +ACPI_EXTERN UINT32 AcpiGpeCount; +ACPI_EXTERN UINT32 AcpiSciCount; +ACPI_EXTERN UINT32 AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]; + +/* Support for dynamic control method tracing mechanism */ + +ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel; +ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer; +ACPI_EXTERN ACPI_NAME AcpiGbl_TraceMethodName; +ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel; +ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; +ACPI_EXTERN UINT32 AcpiGbl_TraceFlags; + + /***************************************************************************** * * Debugger globals diff --git a/src/add-ons/kernel/bus_managers/acpi/include/achware.h b/src/add-ons/kernel/bus_managers/acpi/include/achware.h index 9c0f58e4de..5677e374c1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/achware.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/achware.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: achware.h -- hardware specific interfaces - * $Revision: 1.82 $ + * $Revision: 1.84 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h b/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h index 72dabc774b..9a96868bf7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * $Revision: 1.168 $ + * $Revision: 1.173 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -333,10 +333,6 @@ AcpiExCreateRegion ( UINT8 RegionSpace, ACPI_WALK_STATE *WalkState); -ACPI_STATUS -AcpiExCreateTableRegion ( - ACPI_WALK_STATE *WalkState); - ACPI_STATUS AcpiExCreateEvent ( ACPI_WALK_STATE *WalkState); @@ -380,11 +376,21 @@ AcpiExAcquireMutex ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState); +ACPI_STATUS +AcpiExAcquireMutexObject ( + UINT16 Timeout, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_THREAD_ID ThreadId); + ACPI_STATUS AcpiExReleaseMutex ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState); +ACPI_STATUS +AcpiExReleaseMutexObject ( + ACPI_OPERAND_OBJECT *ObjDesc); + void AcpiExReleaseAllMutexes ( ACPI_THREAD_STATE *Thread); @@ -685,13 +691,13 @@ void AcpiExTruncateFor32bitTable ( ACPI_OPERAND_OBJECT *ObjDesc); -BOOLEAN +void AcpiExAcquireGlobalLock ( UINT32 Rule); void AcpiExReleaseGlobalLock ( - BOOLEAN Locked); + UINT32 Rule); void AcpiExEisaIdToString ( diff --git a/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h b/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h index 454fa0971a..0409709c83 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: aclocal.h - Internal data types used across the ACPI subsystem - * $Revision: 1.242 $ + * $Revision: 1.250 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -693,9 +693,7 @@ typedef struct acpi_thread_state typedef struct acpi_result_values { ACPI_STATE_COMMON - UINT8 NumResults; - UINT8 LastInsert; - union acpi_operand_object *ObjDesc [ACPI_OBJ_NUM_OPERANDS]; + union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM]; } ACPI_RESULT_VALUES; @@ -795,6 +793,7 @@ typedef union acpi_parse_value union acpi_parse_object *Next; /* Next op */\ ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\ ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ + UINT8 ArgListLength; /* Number of elements in the arg list */\ ACPI_DISASM_ONLY_MEMBERS (\ UINT8 DisasmFlags; /* Used during AML disassembly */\ UINT8 DisasmOpcode; /* Subtype used for disassembly */\ @@ -904,6 +903,8 @@ typedef struct acpi_parse_state #define ACPI_PARSEOP_NAMED 0x02 #define ACPI_PARSEOP_DEFERRED 0x04 #define ACPI_PARSEOP_BYTELIST 0x08 +#define ACPI_PARSEOP_IN_STACK 0x10 +#define ACPI_PARSEOP_TARGET 0x20 #define ACPI_PARSEOP_IN_CACHE 0x80 /* Parse object DisasmFlags */ @@ -1092,12 +1093,30 @@ typedef struct acpi_bit_register_info typedef struct acpi_db_method_info { - ACPI_HANDLE ThreadGate; + ACPI_HANDLE MainThreadGate; + ACPI_HANDLE ThreadCompleteGate; + UINT32 *Threads; + UINT32 NumThreads; + UINT32 NumCreated; + UINT32 NumCompleted; + char *Name; - char **Args; UINT32 Flags; UINT32 NumLoops; char Pathname[128]; + char **Args; + + /* + * Arguments to be passed to method for the command + * Threads - + * the Number of threads, ID of current thread and + * Index of current thread inside all them created. + */ + char InitArgs; + char *Arguments[4]; + char NumThreadsStr[11]; + char IdOfThreadStr[11]; + char IndexOfThreadStr[11]; } ACPI_DB_METHOD_INFO; @@ -1170,6 +1189,8 @@ typedef struct acpi_memory_list UINT32 TotalAllocated; UINT32 TotalFreed; + UINT32 MaxOccupied; + UINT32 TotalSize; UINT32 CurrentTotalSize; UINT32 Requests; UINT32 Hits; diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h b/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h index 4725a2ab4f..df2fba2259 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 1.192 $ + * $Revision: 1.199 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -136,53 +136,6 @@ #define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) -#if ACPI_MACHINE_WIDTH == 16 - -/* - * For 16-bit addresses, we have to assume that the upper 32 bits - * (out of 64) 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 - -/* - * printf() format helpers - */ - -/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ - -#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) - /* * Extract data using a pointer. Any more than a byte and we * get into potential aligment issues -- see the STORE macros below. @@ -210,15 +163,8 @@ #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (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) - -#if ACPI_MACHINE_WIDTH == 16 -#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) -#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) -#define ACPI_PTR_TO_PHYSADDR(i) (UINT32) ACPI_CAST_PTR (UINT8,(i)) -#else #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) -#endif #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED #define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (UINT32,(a)) == *ACPI_CAST_PTR (UINT32,(b))) @@ -226,6 +172,34 @@ #define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE)) #endif +/* + * Full 64-bit integer must be available on both 32-bit and 64-bit platforms + */ +typedef struct acpi_integer_overlay +{ + UINT32 LoDword; + UINT32 HiDword; + +} ACPI_INTEGER_OVERLAY; + +#define ACPI_LODWORD(Integer) (ACPI_CAST_PTR (ACPI_INTEGER_OVERLAY, &Integer)->LoDword) +#define ACPI_HIDWORD(Integer) (ACPI_CAST_PTR (ACPI_INTEGER_OVERLAY, &Integer)->HiDword) + +/* + * printf() format helpers + */ + +/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ + +#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) + +#if ACPI_MACHINE_WIDTH == 64 +#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) +#else +#define ACPI_FORMAT_NATIVE_UINT(i) 0, (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. @@ -299,28 +273,6 @@ /* The hardware supports unaligned transfers, just do the little-endian move */ -#if ACPI_MACHINE_WIDTH == 16 - -/* No 64-bit integers */ -/* 16-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) -#define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) -#define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s) - -/* 32-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) -#define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) - -/* 64-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ -#define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) - -#else /* 16-bit source, 16/32/64 destination */ #define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) @@ -338,7 +290,6 @@ #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ #define ACPI_MOVE_64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s) -#endif #else /* @@ -383,10 +334,7 @@ /* Macros based on machine integer width */ -#if ACPI_MACHINE_WIDTH == 16 -#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) - -#elif ACPI_MACHINE_WIDTH == 32 +#if ACPI_MACHINE_WIDTH == 32 #define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s) #elif ACPI_MACHINE_WIDTH == 64 @@ -780,17 +728,6 @@ #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 diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acnames.h b/src/add-ons/kernel/bus_managers/acpi/include/acnames.h index 72ad9484ce..b054106c2c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acnames.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acnames.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acnames.h - Global names and strings - * $Revision: 1.6 $ + * $Revision: 1.8 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h b/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h index 289534866b..27c26ec62b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acnamesp.h - Namespace subcomponent prototypes and defines - * $Revision: 1.151 $ + * $Revision: 1.154 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -204,7 +204,8 @@ AcpiNsParseTable ( ACPI_STATUS AcpiNsOneCompleteParse ( ACPI_NATIVE_UINT PassNumber, - ACPI_NATIVE_UINT TableIndex); + ACPI_NATIVE_UINT TableIndex, + ACPI_NAMESPACE_NODE *StartNode); /* diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acobject.h b/src/add-ons/kernel/bus_managers/acpi/include/acobject.h index 29c0764509..02d6323750 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acobject.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acobject.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) - * $Revision: 1.141 $ + * $Revision: 1.144 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -257,8 +257,9 @@ typedef struct acpi_object_mutex ACPI_OBJECT_COMMON_HEADER UINT8 SyncLevel; /* 0-15, specified in Mutex() call */ UINT16 AcquisitionDepth; /* Allow multiple Acquires, same thread */ - struct acpi_thread_state *OwnerThread; /* Current owner of the mutex */ ACPI_MUTEX OsMutex; /* Actual OS synchronization object */ + ACPI_THREAD_ID ThreadId; /* Current owner of the mutex */ + struct acpi_thread_state *OwnerThread; /* Current owner of the mutex */ 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 namespace node */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h b/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h index c102c32b6d..ed543b442d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acopcode.h - AML opcode information for the AML parser and interpreter - * $Revision: 1.6 $ + * $Revision: 1.9 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -308,7 +308,7 @@ #define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) #define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) #define ARGI_DEBUG_OP ARG_NONE -#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) +#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_TARGETREF) #define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING) #define ARGI_DEVICE_OP ARGI_INVALID_OPCODE #define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF) @@ -321,7 +321,7 @@ #define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) #define ARGI_IF_OP ARGI_INVALID_OPCODE -#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) +#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_TARGETREF) #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h b/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h index 590d05299a..5133cd0fba 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acoutput.h -- debug output - * $Revision: 1.100 $ + * $Revision: 1.102 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acparser.h b/src/add-ons/kernel/bus_managers/acpi/include/acparser.h index 91cc58cef0..c45bd63764 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acparser.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acparser.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: acparser.h - AML Parser subcomponent prototypes and defines - * $Revision: 1.81 $ + * $Revision: 1.84 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -211,6 +211,10 @@ char * AcpiPsGetOpcodeName ( UINT16 Opcode); +UINT8 +AcpiPsGetArgumentCount ( + UINT32 OpType); + /* * psparse - top level parsing routines diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpi.h b/src/add-ons/kernel/bus_managers/acpi/include/acpi.h index ddaeec42d0..dcdf2ebaa5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpi.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpi.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acpi.h - Master include file, Publics and external data. - * $Revision: 1.60 $ + * $Revision: 1.62 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h b/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h index fafce3cd9e..5aea1d3379 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h @@ -12,7 +12,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h b/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h index f29fbfb960..5577c6df79 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -163,6 +163,10 @@ ACPI_STATUS AcpiGetSystemInfo ( ACPI_BUFFER *RetBuffer); +ACPI_STATUS +AcpiGetStatistics ( + ACPI_STATISTICS *Stats); + const char * AcpiFormatException ( ACPI_STATUS Exception); @@ -224,6 +228,15 @@ AcpiGetTableByIndex ( ACPI_NATIVE_UINT TableIndex, ACPI_TABLE_HEADER **OutTable); +ACPI_STATUS +AcpiInstallTableHandler ( + ACPI_TABLE_HANDLER Handler, + void *Context); + +ACPI_STATUS +AcpiRemoveTableHandler ( + ACPI_TABLE_HANDLER Handler); + /* * Namespace and name interfaces diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h b/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h index 9c0cd3c080..5714f3acb2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acresrc.h - Resource Manager function prototypes - * $Revision: 1.59 $ + * $Revision: 1.62 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -170,6 +170,7 @@ typedef const struct acpi_rsconvert_info #define ACPI_RSC_BITMASK16 18 #define ACPI_RSC_EXIT_NE 19 #define ACPI_RSC_EXIT_LE 20 +#define ACPI_RSC_EXIT_EQ 21 /* Resource Conversion sub-opcodes */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h b/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h index f6ed79a1ac..8af7456ff2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acstruct.h - Internal structs - * $Revision: 1.45 $ + * $Revision: 1.50 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -156,12 +156,15 @@ typedef struct acpi_walk_state UINT16 Opcode; /* Current AML opcode */ UINT8 NextOpInfo; /* Info about NextOp */ UINT8 NumOperands; /* Stack pointer for Operands[] array */ + UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */ ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */ BOOLEAN LastPredicate; /* Result of last predicate */ UINT8 CurrentResult; UINT8 ReturnUsed; UINT8 ScopeDepth; UINT8 PassNumber; /* Parse pass during table load */ + UINT8 ResultSize; /* Total elements for the result stack */ + UINT8 ResultCount; /* Current number of occupied elements of result stack */ UINT32 AmlOffset; UINT32 ArgTypes; UINT32 MethodBreakpoint; /* For single stepping */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actables.h b/src/add-ons/kernel/bus_managers/acpi/include/actables.h index bfb418aa55..07390241a8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actables.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actables.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actables.h - ACPI table management - * $Revision: 1.63 $ + * $Revision: 1.65 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actbl.h b/src/add-ons/kernel/bus_managers/acpi/include/actbl.h index 9590f29489..1ad1e6bfea 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl.h - Basic ACPI Table Definitions - * $Revision: 1.83 $ + * $Revision: 1.85 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h b/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h index 2ccef8fe78..34c20997bd 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl1.h - Additional ACPI table definitions - * $Revision: 1.46 $ + * $Revision: 1.51 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -133,20 +133,28 @@ * it more difficult to inadvertently type in the wrong signature. */ #define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ +#define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */ #define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ #define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ #define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ #define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ #define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ +#define ACPI_SIG_EINJ "EINJ" /* Error Injection table */ +#define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */ +#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ +#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ +#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ #define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ #define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ +#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ +#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ @@ -163,7 +171,7 @@ */ -/* Common Sub-table header (used in MADT, SRAT, etc.) */ +/* Common Subtable header (used in MADT, SRAT, etc.) */ typedef struct acpi_subtable_header { @@ -173,6 +181,21 @@ typedef struct acpi_subtable_header } ACPI_SUBTABLE_HEADER; +/* Common Subtable header for WHEA tables (EINJ, ERST, WDAT) */ + +typedef struct acpi_whea_header +{ + UINT8 Action; + UINT8 Instruction; + UINT8 Flags; + UINT8 Reserved; + ACPI_GENERIC_ADDRESS RegisterRegion; + UINT64 Value; /* Value used with Read/Write register */ + UINT64 Mask; /* Bitmask required for this register instruction */ + +} ACPI_WHEA_HEADER; + + /******************************************************************************* * * ASF - Alert Standard Format table (Signature "ASF!") @@ -304,6 +327,41 @@ typedef struct acpi_asf_address } ACPI_ASF_ADDRESS; +/******************************************************************************* + * + * BERT - Boot Error Record Table + * + ******************************************************************************/ + +typedef struct acpi_table_bert +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 RegionLength; /* Length of the boot error region */ + UINT64 Address; /* Physical addresss of the error region */ + +} ACPI_TABLE_BERT; + + +/* Boot Error Region */ + +typedef struct acpi_bert_region +{ + UINT32 BlockStatus; + UINT32 RawDataOffset; + UINT32 RawDataLength; + UINT32 DataLength; + UINT32 ErrorSeverity; + +} ACPI_BERT_REGION; + +/* BlockStatus Flags */ + +#define ACPI_BERT_UNCORRECTABLE (1) +#define ACPI_BERT_CORRECTABLE (2) +#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (4) +#define ACPI_BERT_MULTIPLE_CORRECTABLE (8) + + /******************************************************************************* * * BOOT - Simple Boot Flag Table @@ -466,6 +524,419 @@ typedef struct acpi_table_ecdt } ACPI_TABLE_ECDT; +/******************************************************************************* + * + * EINJ - Error Injection Table + * + ******************************************************************************/ + +typedef struct acpi_table_einj +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 HeaderLength; + UINT32 Reserved; + UINT32 Entries; + +} ACPI_TABLE_EINJ; + +/* EINJ Injection Instruction Entries (actions) */ + +typedef struct acpi_einj_entry +{ + ACPI_WHEA_HEADER WheaHeader; /* Common header for WHEA tables */ + +} ACPI_EINJ_ENTRY; + +/* Values for Action field above */ + +enum AcpiEinjActions +{ + ACPI_EINJ_BEGIN_OPERATION = 0, + ACPI_EINJ_GET_TRIGGER_TABLE = 1, + ACPI_EINJ_SET_ERROR_TYPE = 2, + ACPI_EINJ_GET_ERROR_TYPE = 3, + ACPI_EINJ_END_OPERATION = 4, + ACPI_EINJ_EXECUTE_OPERATION = 5, + ACPI_EINJ_CHECK_BUSY_STATUS = 6, + ACPI_EINJ_GET_COMMAND_STATUS = 7, + ACPI_EINJ_ACTION_RESERVED = 8, /* 8 and greater are reserved */ + ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ +}; + +/* Values for Instruction field above */ + +enum AcpiEinjInstructions +{ + ACPI_EINJ_READ_REGISTER = 0, + ACPI_EINJ_READ_REGISTER_VALUE = 1, + ACPI_EINJ_WRITE_REGISTER = 2, + ACPI_EINJ_WRITE_REGISTER_VALUE = 3, + ACPI_EINJ_NOOP = 4, + ACPI_EINJ_INSTRUCTION_RESERVED = 5 /* 5 and greater are reserved */ +}; + +/* EINJ Trigger Error Action Table */ + +typedef struct acpi_einj_trigger +{ + UINT32 HeaderSize; + UINT32 Revision; + UINT32 TableSize; + UINT32 EntryCount; + +} ACPI_EINJ_TRIGGER; + + +/******************************************************************************* + * + * ERST - Error Record Serialization Table + * + ******************************************************************************/ + +typedef struct acpi_table_erst +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 HeaderLength; + UINT32 Reserved; + UINT32 Entries; + +} ACPI_TABLE_ERST; + +/* ERST Serialization Entries (actions) */ + +typedef struct acpi_erst_entry +{ + ACPI_WHEA_HEADER WheaHeader; /* Common header for WHEA tables */ + +} ACPI_ERST_ENTRY; + +/* Values for Action field above */ + +enum AcpiErstActions +{ + ACPI_ERST_BEGIN_WRITE_OPERATION = 0, + ACPI_ERST_BEGIN_READ_OPERATION = 1, + ACPI_ERST_BETGIN_CLEAR_OPERATION= 2, + ACPI_ERST_END_OPERATION = 3, + ACPI_ERST_SET_RECORD_OFFSET = 4, + ACPI_ERST_EXECUTE_OPERATION = 5, + ACPI_ERST_CHECK_BUSY_STATUS = 6, + ACPI_ERST_GET_COMMAND_STATUS = 7, + ACPI_ERST_GET_RECORD_IDENTIFIER = 8, + ACPI_ERST_SET_RECORD_IDENTIFIER = 9, + ACPI_ERST_GET_RECORD_COUNT = 10, + ACPI_ERST_BEGIN_DUMMY_WRIITE = 11, + ACPI_ERST_NOT_USED = 12, + ACPI_ERST_GET_ERROR_RANGE = 13, + ACPI_ERST_GET_ERROR_LENGTH = 14, + ACPI_ERST_GET_ERROR_ATTRIBUTES = 15, + ACPI_ERST_ACTION_RESERVED = 16 /* 16 and greater are reserved */ +}; + +/* Values for Instruction field above */ + +enum AcpiErstInstructions +{ + ACPI_ERST_READ_REGISTER = 0, + ACPI_ERST_READ_REGISTER_VALUE = 1, + ACPI_ERST_WRITE_REGISTER = 2, + ACPI_ERST_WRITE_REGISTER_VALUE = 3, + ACPI_ERST_NOOP = 4, + ACPI_ERST_LOAD_VAR1 = 5, + ACPI_ERST_LOAD_VAR2 = 6, + ACPI_ERST_STORE_VAR1 = 7, + ACPI_ERST_ADD = 8, + ACPI_ERST_SUBTRACT = 9, + ACPI_ERST_ADD_VALUE = 10, + ACPI_ERST_SUBTRACT_VALUE = 11, + ACPI_ERST_STALL = 12, + ACPI_ERST_STALL_WHILE_TRUE = 13, + ACPI_ERST_SKIP_NEXT_IF_TRUE = 14, + ACPI_ERST_GOTO = 15, + ACPI_ERST_SET_SRC_ADDRESS_BASE = 16, + ACPI_ERST_SET_DST_ADDRESS_BASE = 17, + ACPI_ERST_MOVE_DATA = 18, + ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */ +}; + + +/******************************************************************************* + * + * HEST - Hardware Error Source Table + * + ******************************************************************************/ + +typedef struct acpi_table_hest +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 ErrorSourceCount; + +} ACPI_TABLE_HEST; + + +/* HEST subtable header */ + +typedef struct acpi_hest_header +{ + UINT16 Type; + +} ACPI_HEST_HEADER; + + +/* Values for Type field above for subtables */ + +enum AcpiHestTypes +{ + ACPI_HEST_TYPE_XPF_MACHINE_CHECK = 0, + ACPI_HEST_TYPE_XPF_CORRECTED_MACHINE_CHECK = 1, + ACPI_HEST_TYPE_XPF_UNUSED = 2, + ACPI_HEST_TYPE_XPF_NON_MASKABLE_INTERRUPT = 3, + ACPI_HEST_TYPE_IPF_CORRECTED_MACHINE_CHECK = 4, + ACPI_HEST_TYPE_IPF_CORRECTED_PLATFORM_ERROR = 5, + ACPI_HEST_TYPE_AER_ROOT_PORT = 6, + ACPI_HEST_TYPE_AER_ENDPOINT = 7, + ACPI_HEST_TYPE_AER_BRIDGE = 8, + ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE = 9, + ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ +}; + + +/* + * HEST Sub-subtables + */ + +/* XPF Machine Check Error Bank */ + +typedef struct acpi_hest_xpf_error_bank +{ + UINT8 BankNumber; + UINT8 ClearStatusOnInit; + UINT8 StatusFormat; + UINT8 ConfigWriteEnable; + UINT32 ControlRegister; + UINT64 ControlInitData; + UINT32 StatusRegister; + UINT32 AddressRegister; + UINT32 MiscRegister; + +} ACPI_HEST_XPF_ERROR_BANK; + + +/* Generic Error Status */ + +typedef struct acpi_hest_generic_status +{ + UINT32 BlockStatus; + UINT32 RawDataOffset; + UINT32 RawDataLength; + UINT32 DataLength; + UINT32 ErrorSeverity; + +} ACPI_HEST_GENERIC_STATUS; + + +/* Generic Error Data */ + +typedef struct acpi_hest_generic_data +{ + UINT8 SectionType[16]; + UINT32 ErrorSeverity; + UINT16 Revision; + UINT8 ValidationBits; + UINT8 Flags; + UINT32 ErrorDataLength; + UINT8 FruId[16]; + UINT8 FruText[20]; + +} ACPI_HEST_GENERIC_DATA; + + +/* Common HEST structure for PCI/AER types below (6,7,8) */ + +typedef struct acpi_hest_aer_common +{ + UINT16 SourceId; + UINT16 ConfigWriteEnable; + UINT8 Flags; + UINT8 Enabled; + UINT32 RecordsToPreAllocate; + UINT32 MaxSectionsPerRecord; + UINT32 Bus; + UINT16 Device; + UINT16 Function; + UINT16 DeviceControl; + UINT16 Reserved; + UINT32 UncorrectableErrorMask; + UINT32 UncorrectableErrorSeverity; + UINT32 CorrectableErrorMask; + UINT32 AdvancedErrorCababilities; + +} ACPI_HEST_AER_COMMON; + + +/* Hardware Error Notification */ + +typedef struct acpi_hest_notify +{ + UINT8 Type; + UINT8 Length; + UINT16 ConfigWriteEnable; + UINT32 PollInterval; + UINT32 Vector; + UINT32 PollingThresholdValue; + UINT32 PollingThresholdWindow; + UINT32 ErrorThresholdValue; + UINT32 ErrorThresholdWindow; + +} ACPI_HEST_NOTIFY; + +/* Values for Notify Type field above */ + +enum AcpiHestNotifyTypes +{ + ACPI_HEST_NOTIFY_POLLED = 0, + ACPI_HEST_NOTIFY_EXTERNAL = 1, + ACPI_HEST_NOTIFY_LOCAL = 2, + ACPI_HEST_NOTIFY_SCI = 3, + ACPI_HEST_NOTIFY_NMI = 4, + ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ +}; + + +/* + * HEST subtables + * + * From WHEA Design Document, 16 May 2007. + * Note: There is no subtable type 2 in this version of the document, + * and there are two different subtable type 3s. + */ + + /* 0: XPF Machine Check Exception */ + +typedef struct acpi_hest_xpf_machine_check +{ + ACPI_HEST_HEADER Header; + UINT16 SourceId; + UINT16 ConfigWriteEnable; + UINT8 Flags; + UINT8 Reserved1; + UINT32 RecordsToPreAllocate; + UINT32 MaxSectionsPerRecord; + UINT64 GlobalCapabilityData; + UINT64 GlobalControlData; + UINT8 NumHardwareBanks; + UINT8 Reserved2[7]; + +} ACPI_HEST_XPF_MACHINE_CHECK; + + +/* 1: XPF Corrected Machine Check */ + +typedef struct acpi_table_hest_xpf_corrected +{ + ACPI_HEST_HEADER Header; + UINT16 SourceId; + UINT16 ConfigWriteEnable; + UINT8 Flags; + UINT8 Enabled; + UINT32 RecordsToPreAllocate; + UINT32 MaxSectionsPerRecord; + ACPI_HEST_NOTIFY Notify; + UINT8 NumHardwareBanks; + UINT8 Reserved[3]; + +} ACPI_HEST_XPF_CORRECTED; + + +/* 3: XPF Non-Maskable Interrupt */ + +typedef struct acpi_hest_xpf_nmi +{ + ACPI_HEST_HEADER Header; + UINT16 SourceId; + UINT32 Reserved; + UINT32 RecordsToPreAllocate; + UINT32 MaxSectionsPerRecord; + UINT32 MaxRawDataLength; + +} ACPI_HEST_XPF_NMI; + + +/* 4: IPF Corrected Machine Check */ + +typedef struct acpi_hest_ipf_corrected +{ + ACPI_HEST_HEADER Header; + UINT8 Enabled; + UINT8 Reserved; + +} ACPI_HEST_IPF_CORRECTED; + + +/* 5: IPF Corrected Platform Error */ + +typedef struct acpi_hest_ipf_corrected_platform +{ + ACPI_HEST_HEADER Header; + UINT8 Enabled; + UINT8 Reserved; + +} ACPI_HEST_IPF_CORRECTED_PLATFORM; + + +/* 6: PCI Express Root Port AER */ + +typedef struct acpi_hest_aer_root +{ + ACPI_HEST_HEADER Header; + ACPI_HEST_AER_COMMON Aer; + UINT32 RootErrorCommand; + +} ACPI_HEST_AER_ROOT; + + +/* 7: PCI Express AER (AER Endpoint) */ + +typedef struct acpi_hest_aer +{ + ACPI_HEST_HEADER Header; + ACPI_HEST_AER_COMMON Aer; + +} ACPI_HEST_AER; + + +/* 8: PCI Express/PCI-X Bridge AER */ + +typedef struct acpi_hest_aer_bridge +{ + ACPI_HEST_HEADER Header; + ACPI_HEST_AER_COMMON Aer; + UINT32 SecondaryUncorrectableErrorMask; + UINT32 SecondaryUncorrectableErrorSeverity; + UINT32 SecondaryAdvancedCapabilities; + +} ACPI_HEST_AER_BRIDGE; + + +/* 9: Generic Hardware Error Source */ + +typedef struct acpi_hest_generic +{ + ACPI_HEST_HEADER Header; + UINT16 SourceId; + UINT16 RelatedSourceId; + UINT8 ConfigWriteEnable; + UINT8 Enabled; + UINT32 RecordsToPreAllocate; + UINT32 MaxSectionsPerRecord; + UINT32 MaxRawDataLength; + ACPI_GENERIC_ADDRESS ErrorStatusAddress; + ACPI_HEST_NOTIFY Notify; + UINT32 ErrorStatusBlockLength; + +} ACPI_HEST_GENERIC; + + /******************************************************************************* * * HPET - High Precision Event Timer table @@ -492,6 +963,113 @@ typedef struct acpi_table_hpet /*! [End] no source code translation !*/ +/******************************************************************************* + * + * IBFT - Boot Firmware Table + * + ******************************************************************************/ + +typedef struct acpi_table_ibft +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 Reserved[12]; + +} ACPI_TABLE_IBFT; + + +/* IBFT common subtable header */ + +typedef struct acpi_ibft_header +{ + UINT8 Type; + UINT8 Version; + UINT16 Length; + UINT8 Index; + UINT8 Flags; + +} ACPI_IBFT_HEADER; + + +/* Values for Type field above */ + +enum AcpiIbftType +{ + ACPI_IBFT_TYPE_NOT_USED = 0, + ACPI_IBFT_TYPE_CONTROL = 1, + ACPI_IBFT_TYPE_INITIATOR = 2, + ACPI_IBFT_TYPE_NIC = 3, + ACPI_IBFT_TYPE_TARGET = 4, + ACPI_IBFT_TYPE_EXTENSIONS = 5, + ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */ +}; + + +/* IBFT subtables */ + +typedef struct acpi_ibft_control +{ + ACPI_IBFT_HEADER Header; + UINT16 Extensions; + UINT16 InitiatorOffset; + UINT16 Nic0Offset; + UINT16 Target0Offset; + UINT16 Nic1Offset; + UINT16 Target1Offset; + +} ACPI_IBFT_CONTROL; + +typedef struct acpi_ibft_initiator +{ + ACPI_IBFT_HEADER Header; + UINT8 SnsServer[16]; + UINT8 SlpServer[16]; + UINT8 PrimaryServer[16]; + UINT8 SecondaryServer[16]; + UINT16 NameLength; + UINT16 NameOffset; + +} ACPI_IBFT_INITIATOR; + +typedef struct acpi_ibft_nic +{ + ACPI_IBFT_HEADER Header; + UINT8 IpAddress[16]; + UINT8 SubnetMaskPrefix; + UINT8 Origin; + UINT8 Gateway[16]; + UINT8 PrimaryDns[16]; + UINT8 SecondaryDns[16]; + UINT8 Dhcp[16]; + UINT16 Vlan; + UINT8 MacAddress[6]; + UINT16 PciAddress; + UINT16 NameLength; + UINT16 NameOffset; + +} ACPI_IBFT_NIC; + +typedef struct acpi_ibft_target +{ + ACPI_IBFT_HEADER Header; + UINT8 TargetIpAddress[16]; + UINT16 TargetIpSocket; + UINT8 TargetBootLun[8]; + UINT8 ChapType; + UINT8 NicAssociation; + UINT16 TargetNameLength; + UINT16 TargetNameOffset; + UINT16 ChapNameLength; + UINT16 ChapNameOffset; + UINT16 ChapSecretLength; + UINT16 ChapSecretOffset; + UINT16 ReverseChapNameLength; + UINT16 ReverseChapNameOffset; + UINT16 ReverseChapSecretLength; + UINT16 ReverseChapSecretOffset; + +} ACPI_IBFT_TARGET; + + /******************************************************************************* * * MADT - Multiple APIC Description Table @@ -882,6 +1460,88 @@ typedef struct acpi_table_tcpa } ACPI_TABLE_TCPA; +/******************************************************************************* + * + * UEFI - UEFI Boot optimization Table + * + ******************************************************************************/ + +typedef struct acpi_table_uefi +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 Identifier[16]; /* UUID identifier */ + UINT16 DataOffset; /* Offset of remaining data in table */ + UINT8 Data; + +} ACPI_TABLE_UEFI; + + +/******************************************************************************* + * + * WDAT - Watchdog Action Table + * + ******************************************************************************/ + +typedef struct acpi_table_wdat +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 HeaderLength; /* Watchdog Header Length */ + UINT16 PciSegment; /* PCI Segment number */ + UINT8 PciBus; /* PCI Bus number */ + UINT8 PciDevice; /* PCI Device number */ + UINT8 PciFunction; /* PCI Function number */ + UINT8 Reserved[3]; + UINT32 TimerPeriod; /* Period of one timer count (msec) */ + UINT32 MaxCount; /* Maximum counter value supported */ + UINT32 MinCount; /* Minimum counter value */ + UINT8 Flags; + UINT8 Reserved2[3]; + UINT32 Entries; /* Number of watchdog entries that follow */ + +} ACPI_TABLE_WDAT; + +/* WDAT Instruction Entries (actions) */ + +typedef struct acpi_wdat_entry +{ + ACPI_WHEA_HEADER WheaHeader; /* Common header for WHEA tables */ + +} ACPI_WDAT_ENTRY; + +/* Values for Action field above */ + +enum AcpiWdatActions +{ + ACPI_WDAT_RESET = 1, + ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4, + ACPI_WDAT_GET_COUNTDOWN = 5, + ACPI_WDAT_SET_COUNTDOWN = 6, + ACPI_WDAT_GET_RUNNING_STATE = 8, + ACPI_WDAT_SET_RUNNING_STATE = 9, + ACPI_WDAT_GET_STOPPED_STATE = 10, + ACPI_WDAT_SET_STOPPED_STATE = 11, + ACPI_WDAT_GET_REBOOT = 16, + ACPI_WDAT_SET_REBOOT = 17, + ACPI_WDAT_GET_SHUTDOWN = 18, + ACPI_WDAT_SET_SHUTDOWN = 19, + ACPI_WDAT_GET_STATUS = 32, + ACPI_WDAT_SET_STATUS = 33, + ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */ +}; + +/* Values for Instruction field above */ + +enum AcpiWdatInstructions +{ + ACPI_WDAT_READ_VALUE = 0, + ACPI_WDAT_READ_COUNTDOWN = 1, + ACPI_WDAT_WRITE_VALUE = 2, + ACPI_WDAT_WRITE_COUNTDOWN = 3, + ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */ + ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */ +}; + + /******************************************************************************* * * WDRT - Watchdog Resource Table diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h b/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h index e1d6b3cbc1..0b6c47e9fa 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl2.h - ACPI Specification Revision 2.0 Tables - * $Revision: 1.50 $ + * $Revision: 1.52 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actypes.h b/src/add-ons/kernel/bus_managers/acpi/include/actypes.h index b9f8444efd..e142534fea 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actypes.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actypes.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actypes.h - Common data types for the entire ACPI subsystem - * $Revision: 1.312 $ + * $Revision: 1.323 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -121,7 +121,8 @@ /* * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header - * and must be either 16, 32, or 64 + * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of + * 12/2006. */ #ifndef ACPI_MACHINE_WIDTH #error ACPI_MACHINE_WIDTH not defined @@ -225,14 +226,12 @@ typedef int INT32; typedef UINT64 ACPI_NATIVE_UINT; typedef INT64 ACPI_NATIVE_INT; -typedef UINT64 ACPI_TABLE_PTR; typedef UINT64 ACPI_IO_ADDRESS; typedef UINT64 ACPI_PHYSICAL_ADDRESS; #define ACPI_MAX_PTR ACPI_UINT64_MAX #define ACPI_SIZE_MAX ACPI_UINT64_MAX -#define ACPI_NATIVE_BOUNDARY 8 #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ /* @@ -268,54 +267,15 @@ typedef int INT32; typedef UINT32 ACPI_NATIVE_UINT; typedef INT32 ACPI_NATIVE_INT; -typedef UINT64 ACPI_TABLE_PTR; typedef UINT32 ACPI_IO_ADDRESS; typedef UINT32 ACPI_PHYSICAL_ADDRESS; #define ACPI_MAX_PTR ACPI_UINT32_MAX #define ACPI_SIZE_MAX ACPI_UINT32_MAX -#define ACPI_NATIVE_BOUNDARY 4 - - -/******************************************************************************* - * - * Types specific to 16-bit targets - * - ******************************************************************************/ - -#elif ACPI_MACHINE_WIDTH == 16 - -/*! [Begin] no source code translation (keep the typedefs as-is) */ - -typedef unsigned long UINT32; -typedef short INT16; -typedef long INT32; - -/*! [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; - -#define ACPI_MAX_PTR ACPI_UINT16_MAX -#define ACPI_SIZE_MAX ACPI_UINT16_MAX - -#define ACPI_NATIVE_BOUNDARY 2 -#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ - -/* 64-bit integers cannot be supported */ - -#define ACPI_NO_INTEGER64_SUPPORT - - #else -/* ACPI_MACHINE_WIDTH must be either 64, 32, or 16 */ +/* ACPI_MACHINE_WIDTH must be either 64 or 32 */ #error unknown ACPI_MACHINE_WIDTH #endif @@ -454,28 +414,11 @@ typedef struct 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 + * 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_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ - -#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 @@ -485,7 +428,6 @@ typedef UINT64 ACPI_INTEGER; #if ACPI_MACHINE_WIDTH == 64 #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ #endif -#endif #define ACPI_MAX64_DECIMAL_DIGITS 20 #define ACPI_MAX32_DECIMAL_DIGITS 10 @@ -553,14 +495,20 @@ typedef UINT64 ACPI_INTEGER; /* * 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 +#define ACPI_NOTIFY_BUS_CHECK (UINT8) 0x00 +#define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 0x01 +#define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 0x02 +#define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 0x03 +#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 0x04 +#define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 0x05 +#define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 0x06 +#define ACPI_NOTIFY_POWER_FAULT (UINT8) 0x07 +#define ACPI_NOTIFY_CAPABILITIES_CHECK (UINT8) 0x08 +#define ACPI_NOTIFY_DEVICE_PLD_CHECK (UINT8) 0x09 +#define ACPI_NOTIFY_RESERVED (UINT8) 0x0A +#define ACPI_NOTIFY_LOCALITY_UPDATE (UINT8) 0x0B + +#define ACPI_NOTIFY_MAX 0x0B /* * Types associated with ACPI names and objects. The first group of @@ -628,6 +576,9 @@ typedef UINT32 ACPI_OBJECT_TYPE; #define ACPI_TYPE_INVALID 0x1E #define ACPI_TYPE_NOT_FOUND 0xFF +#define ACPI_NUM_NS_TYPES (ACPI_TYPE_INVALID + 1) + + /* * All I/O */ @@ -735,7 +686,7 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_SYSTEM_NOTIFY 0x1 #define ACPI_DEVICE_NOTIFY 0x2 -#define ACPI_ALL_NOTIFY 0x3 +#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 #define ACPI_MAX_SYS_NOTIFY 0x7f @@ -793,46 +744,51 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; /* * External ACPI object definition */ + +/* + * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element + * or an unresolved named reference. + */ typedef union acpi_object { ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */ struct { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_INTEGER */ ACPI_INTEGER Value; /* The actual number */ } Integer; struct { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_STRING */ UINT32 Length; /* # of bytes in string, excluding trailing null */ char *Pointer; /* points to the string value */ } String; struct { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_BUFFER */ 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; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_PACKAGE */ UINT32 Count; /* # of elements in package */ union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */ } Package; struct { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_LOCAL_REFERENCE */ + ACPI_OBJECT_TYPE ActualType; /* Type associated with the Handle */ + ACPI_HANDLE Handle; /* object reference */ + } Reference; + + struct + { + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_PROCESSOR */ UINT32 ProcId; ACPI_IO_ADDRESS PblkAddress; UINT32 PblkLength; @@ -840,7 +796,7 @@ typedef union acpi_object struct { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_POWER */ UINT32 SystemLevel; UINT32 ResourceOrder; } PowerResource; @@ -907,6 +863,26 @@ typedef struct acpi_system_info } ACPI_SYSTEM_INFO; +/* + * System statistecs returned by AcpiGetStatistics() + */ +typedef struct acpi_statistics +{ + UINT32 SciCount; + UINT32 GpeCount; + UINT32 FixedEventCount[ACPI_NUM_FIXED_EVENTS]; + UINT32 MethodCount; + +} ACPI_STATISTICS; + + +/* Table Event Types */ + +#define ACPI_TABLE_EVENT_LOAD 0x0 +#define ACPI_TABLE_EVENT_UNLOAD 0x1 +#define ACPI_NUM_TABLE_EVENTS 2 + + /* * Types specific to the OS service interfaces */ @@ -952,6 +928,18 @@ ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) ( UINT32 AmlOffset, void *Context); +/* Table Event handler (Load, LoadTable etc) and types */ + +typedef +ACPI_STATUS (*ACPI_TABLE_HANDLER) ( + UINT32 Event, + void *Table, + void *Context); + +#define ACPI_TABLE_LOAD 0x0 +#define ACPI_TABLE_UNLOAD 0x1 +#define ACPI_NUM_TABLE_EVENTS 2 + /* Address Spaces (For Operation Regions) */ @@ -1200,6 +1188,7 @@ typedef struct acpi_vendor_uuid */ typedef struct acpi_resource_irq { + UINT8 DescriptorLength; UINT8 Triggering; UINT8 Polarity; UINT8 Sharable; @@ -1208,7 +1197,6 @@ typedef struct acpi_resource_irq } ACPI_RESOURCE_IRQ; - typedef struct ACPI_RESOURCE_DMA { UINT8 Type; @@ -1219,9 +1207,9 @@ typedef struct ACPI_RESOURCE_DMA } ACPI_RESOURCE_DMA; - typedef struct acpi_resource_start_dependent { + UINT8 DescriptorLength; UINT8 CompatibilityPriority; UINT8 PerformanceRobustness; diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acutils.h b/src/add-ons/kernel/bus_managers/acpi/include/acutils.h index 6a0b9d4984..8c5c1f19b2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acutils.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acutils.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures - * $Revision: 1.199 $ + * $Revision: 1.203 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -200,6 +200,10 @@ char * AcpiUtGetMutexName ( UINT32 MutexId); +const char * +AcpiUtGetNotifyName ( + UINT32 NotifyValue); + #endif char * @@ -648,6 +652,10 @@ BOOLEAN AcpiUtValidInternalObject ( void *Object); +ACPI_OPERAND_OBJECT * +AcpiUtCreatePackageObject ( + UINT32 Count); + ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject ( ACPI_SIZE BufferSize); diff --git a/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h b/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h index 81a2c8aa73..9de6e51430 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h @@ -3,7 +3,7 @@ * 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.85 $ + * $Revision: 1.87 $ * *****************************************************************************/ @@ -11,7 +11,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h b/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h index 22838f2ce8..ae6e3bf9ff 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: amlresrc.h - AML resource descriptors - * $Revision: 1.39 $ + * $Revision: 1.41 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acdos16.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acdos16.h index 98f6c430a7..f3aead6084 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acdos16.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acdos16.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdos16.h - DOS specific defines, etc. - * $Revision: 1.15 $ + * $Revision: 1.18 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -117,6 +117,9 @@ #ifndef __ACDOS16_H__ #define __ACDOS16_H__ + +/* NOTE: 16-bit ACPICA is no longer supported, December 2006 */ + #define ACPI_USE_STANDARD_HEADERS #define ACPI_MACHINE_WIDTH 16 diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h index 8410b06e5d..cb86bc70ee 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acefi.h - OS specific defines, etc. - * $Revision: 1.17 $ + * $Revision: 1.19 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h index 6250a875c7..78e472abd6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acenv.h - Generation environment specific items - * $Revision: 1.130 $ + * $Revision: 1.133 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -211,7 +211,7 @@ /*! [Begin] no source code translation */ -#if defined(__linux__) +#if defined(_LINUX) || defined(__linux__) #include "aclinux.h" #elif defined(_AED_EFI) diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acfreebsd.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acfreebsd.h index 3e255e6ae0..3ea2331215 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acfreebsd.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acfreebsd.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acfreebsd.h - OS specific defines, etc. - * $Revision: 1.23 $ + * $Revision: 1.27 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -124,7 +124,7 @@ #include #include -#define ACPI_THREAD_ID pid_t +#define ACPI_THREAD_ID uintptr_t #define ACPI_UINTPTR_T uintptr_t #define ACPI_USE_LOCAL_CACHE #define __cdecl @@ -176,25 +176,25 @@ /* Always use FreeBSD code over our local versions */ #define ACPI_USE_SYSTEM_CLIBRARY -#ifdef _KERNEL ++#if defined(_KERNEL) && (__FreeBSD_version < 700020) /* Or strstr (used in debugging mode, also move to libkern) */ static __inline char * -strstr(char *s, char *find) +strstr (char *s, char *find) { char c, sc; size_t len; if ((c = *find++) != 0) { - len = strlen(find); - do { + len = strlen (find); do { - if ((sc = *s++) == 0) - return (NULL); - } while (sc != c); - } while (strncmp(s, find, len) != 0); - s--; + do { + if ((sc = *s++) == 0) + return (NULL); + } while (sc != c); + } while (strncmp (s, find, len) != 0); + s--; } - return ((char *)s); + return ((char *) s); } #endif /* _KERNEL */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h index 199f142c9b..0f19883bd3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acgcc.h - GCC specific defines, etc. - * $Revision: 1.31 $ + * $Revision: 1.33 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h index 3764fe266a..92cd70b3e3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acintel.h - VC specific defines, etc. - * $Revision: 1.17 $ + * $Revision: 1.19 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/aclinux.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/aclinux.h index fc84c72b9b..1322424704 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/aclinux.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/aclinux.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: aclinux.h - OS specific defines, etc. - * $Revision: 1.41 $ + * $Revision: 1.44 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -158,7 +158,10 @@ #define ACPI_USE_NATIVE_DIVIDE #endif +#ifndef __cdecl #define __cdecl +#endif + #define ACPI_FLUSH_CPU_CACHE() #endif /* __KERNEL__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h index 0eb6177ac7..3b065a8905 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmsvc.h - VC specific defines, etc. - * $Revision: 1.26 $ + * $Revision: 1.28 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acnetbsd.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acnetbsd.h index 591cd49f36..d120b54a10 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acnetbsd.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acnetbsd.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acnetbsd.h - OS specific defines, etc. - * $Revision: 1.8 $ + * $Revision: 1.10 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin.h index 622ea7bd85..4845d7364c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acwin.h - OS specific defines, etc. - * $Revision: 1.28 $ + * $Revision: 1.30 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin64.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin64.h index bf4a5e0ab3..6b289a439f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin64.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin64.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acwin.h - OS specific defines, etc. - * $Revision: 1.15 $ + * $Revision: 1.17 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsfield.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsfield.c index 7f17d5ed4d..895c3ae427 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsfield.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsfield - Dispatcher field routines - * $Revision: 1.83 $ + * $Revision: 1.87 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -171,15 +171,18 @@ AcpiDsCreateBufferField ( ACPI_FUNCTION_TRACE (DsCreateBufferField); - /* Get the NameString argument */ - + /* + * Get the NameString argument (name of the new BufferField) + */ if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) { + /* For CreateField, name is the 4th argument */ + Arg = AcpiPsGetArg (Op, 3); } else { - /* Create Bit/Byte/Word/Dword field */ + /* For all other CreateXXXField operators, name is the 3rd argument */ Arg = AcpiPsGetArg (Op, 2); } @@ -196,27 +199,30 @@ AcpiDsCreateBufferField ( } else { - /* - * During the load phase, we want to enter the name of the field into - * the namespace. During the execute phase (when we evaluate the size - * operand), we want to lookup the name - */ - if (WalkState->ParseFlags & ACPI_PARSE_EXECUTE) + /* Execute flag should always be set when this function is entered */ + + if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) { - Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; - } - else - { - Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND; + return_ACPI_STATUS (AE_AML_INTERNAL); } - /* - * Enter the NameString into the namespace - */ + /* Creating new namespace node, should not already exist */ + + Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | + ACPI_NS_ERROR_IF_FOUND; + + /* Mark node temporary if we are executing a method */ + + if (WalkState->MethodNode) + { + Flags |= ACPI_NS_TEMPORARY; + } + + /* Enter the NameString into the namespace */ + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, - Flags, WalkState, &(Node)); + ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, + Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); @@ -227,13 +233,13 @@ AcpiDsCreateBufferField ( /* * We could put the returned object (Node) on the object stack for later, * but for now, we will put it in the "op" object that the parser uses, - * so we can get it again at the end of this scope + * so we can get it again at the end of this scope. */ Op->Common.Node = Node; /* * If there is no object attached to the node, this node was just created - * and we need to create the field object. Otherwise, this was a lookup + * and we need to create the field object. Otherwise, this was a lookup * of an existing node and we don't want to create the field object again. */ ObjDesc = AcpiNsGetAttachedObject (Node); @@ -257,9 +263,8 @@ AcpiDsCreateBufferField ( } /* - * Remember location in AML stream of the field unit - * opcode and operands -- since the buffer and index - * operands must be evaluated. + * Remember location in AML stream of the field unit opcode and operands -- + * since the buffer and index operands must be evaluated. */ SecondDesc = ObjDesc->Common.NextObject; SecondDesc->Extra.AmlStart = Op->Named.Data; @@ -364,34 +369,35 @@ AcpiDsGetFieldNames ( case AML_INT_NAMEDFIELD_OP: - /* Lookup the name */ + /* Lookup the name, it should already exist */ Status = AcpiNsLookup (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, - Info->FieldType, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Info->FieldNode); + (char *) &Arg->Named.Name, Info->FieldType, + ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Info->FieldNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); - if (Status != AE_ALREADY_EXISTS) - { - return_ACPI_STATUS (Status); - } - - /* Already exists, ignore error */ + return_ACPI_STATUS (Status); } else { Arg->Common.Node = Info->FieldNode; Info->FieldBitLength = Arg->Common.Value.Size; - /* Create and initialize an object for the new Field Node */ - - Status = AcpiExPrepFieldValue (Info); - if (ACPI_FAILURE (Status)) + /* + * If there is no object attached to the node, this node was + * just created and we need to create the field object. + * Otherwise, this was a lookup of an existing node and we + * don't want to create the field object again. + */ + if (!AcpiNsGetAttachedObject (Info->FieldNode)) { - return_ACPI_STATUS (Status); + Status = AcpiExPrepFieldValue (Info); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } } @@ -415,8 +421,7 @@ AcpiDsGetFieldNames ( default: ACPI_ERROR ((AE_INFO, - "Invalid opcode in field list: %X", - Arg->Common.AmlOpcode)); + "Invalid opcode in field list: %X", Arg->Common.AmlOpcode)); return_ACPI_STATUS (AE_AML_BAD_OPCODE); } @@ -511,11 +516,30 @@ AcpiDsInitFieldObjects ( ACPI_PARSE_OBJECT *Arg = NULL; ACPI_NAMESPACE_NODE *Node; UINT8 Type = 0; + UINT32 Flags; ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op); + /* Execute flag should always be set when this function is entered */ + + if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) + { + if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP) + { + /* BankField Op is deferred, just return OK */ + + return_ACPI_STATUS (AE_OK); + } + + return_ACPI_STATUS (AE_AML_INTERNAL); + } + + /* + * Get the FieldList argument for this opcode. This is the start of the + * list of field elements. + */ switch (WalkState->Opcode) { case AML_FIELD_OP: @@ -537,21 +561,37 @@ AcpiDsInitFieldObjects ( return_ACPI_STATUS (AE_BAD_PARAMETER); } + if (!Arg) + { + return_ACPI_STATUS (AE_AML_NO_OPERAND); + } + + /* Creating new namespace node(s), should not already exist */ + + Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | + ACPI_NS_ERROR_IF_FOUND; + + /* Mark node(s) temporary if we are executing a method */ + + if (WalkState->MethodNode) + { + Flags |= ACPI_NS_TEMPORARY; + } + /* * Walk the list of entries in the FieldList */ while (Arg) { - /* Ignore OFFSET and ACCESSAS terms here */ - + /* + * Ignore OFFSET and ACCESSAS terms here; we are only interested in the + * field names in order to enter them into the namespace. + */ if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) { Status = AcpiNsLookup (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, - Type, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND, - WalkState, &Node); + (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, + Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); @@ -568,7 +608,7 @@ AcpiDsInitFieldObjects ( Arg->Common.Node = Node; } - /* Move to next field in the list */ + /* Get the next field element in the list */ Arg = Arg->Common.Next; } @@ -583,7 +623,7 @@ AcpiDsInitFieldObjects ( * * PARAMETERS: Op - Op containing the Field definition and args * RegionNode - Object for the containing Operation Region - * ` WalkState - Current method state + * WalkState - Current method state * * RETURN: Status * @@ -632,36 +672,13 @@ AcpiDsCreateBankField ( return_ACPI_STATUS (Status); } - /* Third arg is the BankValue */ - - /* TBD: This arg is a TermArg, not a constant, and must be evaluated */ - + /* + * Third arg is the BankValue + * This arg is a TermArg, not a constant + * It will be evaluated later, by AcpiDsEvalBankFieldOperands + */ Arg = Arg->Common.Next; - /* Currently, only the following constants are supported */ - - switch (Arg->Common.AmlOpcode) - { - case AML_ZERO_OP: - Info.BankValue = 0; - break; - - case AML_ONE_OP: - Info.BankValue = 1; - break; - - case AML_BYTE_OP: - case AML_WORD_OP: - case AML_DWORD_OP: - case AML_QWORD_OP: - Info.BankValue = (UINT32) Arg->Common.Value.Integer; - break; - - default: - Info.BankValue = 0; - ACPI_ERROR ((AE_INFO, "Non-constant BankValue for BankField is not implemented")); - } - /* Fourth arg is the field flags */ Arg = Arg->Common.Next; @@ -672,8 +689,17 @@ AcpiDsCreateBankField ( Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD; Info.RegionNode = RegionNode; - Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); + /* + * Use Info.DataRegisterNode to store BankField Op + * It's safe because DataRegisterNode will never be used when create bank field + * We store AmlStart and AmlLength in the BankField Op for late evaluation + * Used in AcpiExPrepFieldValue(Info) + * + * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"? + */ + Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op; + Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsinit.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsinit.c index e078f1ac01..113eb87b29 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsinit - Object initialization namespace walk - * $Revision: 1.27 $ + * $Revision: 1.29 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsmethod.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsmethod.c index 1bb279d058..9ea0ea3a78 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsmethod.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsmethod.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsmethod - Parser/Interpreter interface - control method parsing - * $Revision: 1.133 $ + * $Revision: 1.140 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +117,6 @@ #define __DSMETHOD_C__ #include "acpi.h" -#include "acparser.h" #include "amlcode.h" #include "acdispat.h" #include "acinterp.h" @@ -183,9 +182,11 @@ AcpiDsMethodError ( WalkState->MethodNode ? WalkState->MethodNode->Name.Integer : 0, WalkState->Opcode, WalkState->AmlOffset, NULL); - (void) AcpiExEnterInterpreter (); + AcpiExEnterInterpreter (); } + AcpiDsClearImplicitReturn (WalkState); + #ifdef ACPI_DISASSEMBLER if (ACPI_FAILURE (Status)) { @@ -329,8 +330,8 @@ AcpiDsBeginMethodExecution ( * recursive call. */ if (!WalkState || - !ObjDesc->Method.Mutex->Mutex.OwnerThread || - (WalkState->Thread != ObjDesc->Method.Mutex->Mutex.OwnerThread)) + !ObjDesc->Method.Mutex->Mutex.ThreadId || + (WalkState->Thread->ThreadId != ObjDesc->Method.Mutex->Mutex.ThreadId)) { /* * Acquire the method mutex. This releases the interpreter if we @@ -350,7 +351,7 @@ AcpiDsBeginMethodExecution ( ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel; - ObjDesc->Method.Mutex->Mutex.OwnerThread = WalkState->Thread; + ObjDesc->Method.Mutex->Mutex.ThreadId = WalkState->Thread->ThreadId; WalkState->Thread->CurrentSyncLevel = ObjDesc->Method.SyncLevel; } else @@ -384,6 +385,7 @@ AcpiDsBeginMethodExecution ( * reentered one more time (even if it is the same thread) */ ObjDesc->Method.ThreadCount++; + AcpiMethodCount++; return_ACPI_STATUS (Status); @@ -651,9 +653,6 @@ AcpiDsTerminateControlMethod ( ACPI_OPERAND_OBJECT *MethodDesc, ACPI_WALK_STATE *WalkState) { - ACPI_NAMESPACE_NODE *MethodNode; - ACPI_STATUS Status; - ACPI_FUNCTION_TRACE_PTR (DsTerminateControlMethod, WalkState); @@ -670,34 +669,25 @@ AcpiDsTerminateControlMethod ( /* Delete all arguments and locals */ AcpiDsMethodDataDeleteAll (WalkState); - } - /* - * If method is serialized, release the mutex and restore the - * current sync level for this thread - */ - if (MethodDesc->Method.Mutex) - { - /* Acquisition Depth handles recursive calls */ - - MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--; - if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth) - { - WalkState->Thread->CurrentSyncLevel = - MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel; - - AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex); - MethodDesc->Method.Mutex->Mutex.OwnerThread = NULL; - } - } - - if (WalkState) - { /* - * Delete any objects created by this method during execution. - * The method Node is stored in the walk state + * If method is serialized, release the mutex and restore the + * current sync level for this thread */ - MethodNode = WalkState->MethodNode; + if (MethodDesc->Method.Mutex) + { + /* Acquisition Depth handles recursive calls */ + + MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--; + if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth) + { + WalkState->Thread->CurrentSyncLevel = + MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel; + + AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex); + MethodDesc->Method.Mutex->Mutex.ThreadId = 0; + } + } /* * Delete any namespace objects created anywhere within @@ -747,7 +737,7 @@ AcpiDsTerminateControlMethod ( if ((MethodDesc->Method.MethodFlags & AML_METHOD_SERIALIZED) && (!MethodDesc->Method.Mutex)) { - Status = AcpiDsCreateMethodMutex (MethodDesc); + (void) AcpiDsCreateMethodMutex (MethodDesc); } /* No more threads, we can free the OwnerId */ diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsmthdat.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsmthdat.c index c649f10fd9..18079b1260 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsmthdat.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsmthdat.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables - * $Revision: 1.91 $ + * $Revision: 1.94 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -263,6 +263,8 @@ AcpiDsMethodDataDeleteAll ( } } + AcpiDsClearImplicitReturn (WalkState); + return_VOID; } diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsobject.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsobject.c index 6ad096ba84..2c100bc44c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines - * $Revision: 1.133 $ + * $Revision: 1.140 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -211,6 +211,72 @@ AcpiDsBuildInternalObject ( return_ACPI_STATUS (Status); } } + + /* Special object resolution for elements of a package */ + + if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) + { + /* + * Attempt to resolve the node to a value before we insert it into + * the package. If this is a reference to a common data type, + * resolve it immediately. According to the ACPI spec, package + * elements can only be "data objects" or method references. + * Attempt to resolve to an Integer, Buffer, String or Package. + * If cannot, return the named reference (for things like Devices, + * Methods, etc.) Buffer Fields and Fields will resolve to simple + * objects (int/buf/str/pkg). + * + * NOTE: References to things like Devices, Methods, Mutexes, etc. + * will remain as named references. This behavior is not described + * in the ACPI spec, but it appears to be an oversight. + */ + ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Op->Common.Node); + + Status = AcpiExResolveNodeToValue ( + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc), + WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + switch (Op->Common.Node->Type) + { + /* + * For these types, we need the actual node, not the subobject. + * However, the subobject did not get an extra reference count above. + * + * TBD: should ExResolveNodeToValue be changed to fix this? + */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: + + AcpiUtAddReference (Op->Common.Node->Object); + + /*lint -fallthrough */ + /* + * For these types, we need the actual node, not the subobject. + * The subobject got an extra reference count in ExResolveNodeToValue. + */ + case ACPI_TYPE_MUTEX: + case ACPI_TYPE_METHOD: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_EVENT: + case ACPI_TYPE_REGION: + + /* We will create a reference object for these types below */ + break; + + default: + /* + * All other types - the node was resolved to an actual + * object, we are done. + */ + goto Exit; + } + } } /* Create and init a new internal ACPI object */ @@ -230,8 +296,9 @@ AcpiDsBuildInternalObject ( return_ACPI_STATUS (Status); } +Exit: *ObjDescPtr = ObjDesc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (Status); } @@ -393,6 +460,8 @@ AcpiDsBuildInternalPackageObj ( ACPI_OPERAND_OBJECT *ObjDesc = NULL; ACPI_STATUS Status = AE_OK; ACPI_NATIVE_UINT i; + UINT16 Index; + UINT16 ReferenceCount; ACPI_FUNCTION_TRACE (DsBuildInternalPackageObj); @@ -452,24 +521,83 @@ AcpiDsBuildInternalPackageObj ( { if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) { - /* This package element is already built, just get it */ + if (Arg->Common.Node->Type == ACPI_TYPE_METHOD) + { + /* + * A method reference "looks" to the parser to be a method + * invocation, so we special case it here + */ + Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP; + Status = AcpiDsBuildInternalObject (WalkState, Arg, + &ObjDesc->Package.Elements[i]); + } + else + { + /* This package element is already built, just get it */ - ObjDesc->Package.Elements[i] = - ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node); + ObjDesc->Package.Elements[i] = + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node); + } } else { Status = AcpiDsBuildInternalObject (WalkState, Arg, &ObjDesc->Package.Elements[i]); } + + if (*ObjDescPtr) + { + /* Existing package, get existing reference count */ + + ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount; + if (ReferenceCount > 1) + { + /* Make new element ref count match original ref count */ + + for (Index = 0; Index < (ReferenceCount - 1); Index++) + { + AcpiUtAddReference ((ObjDesc->Package.Elements[i])); + } + } + } + Arg = Arg->Common.Next; } - if (!Arg) + /* Check for match between NumElements and actual length of PackageList */ + + if (Arg) { + /* + * NumElements was exhausted, but there are remaining elements in the + * PackageList. + * + * Note: technically, this is an error, from ACPI spec: "It is an error + * for NumElements to be less than the number of elements in the + * PackageList". However, for now, we just print an error message and + * no exception is returned. + */ + while (Arg) + { + /* Find out how many elements there really are */ + + i++; + Arg = Arg->Common.Next; + } + + ACPI_ERROR ((AE_INFO, + "Package List length (%X) larger than NumElements count (%X), truncated\n", + i, ElementCount)); + } + else if (i < ElementCount) + { + /* + * Arg list (elements) was exhausted, but we did not reach NumElements count. + * Note: this is not an error, the package is padded out with NULLs. + */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Package List length larger than NumElements count (%X), truncated\n", - ElementCount)); + "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", + i, ElementCount)); } ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; @@ -747,6 +875,7 @@ AcpiDsInitObjectFromOp ( /* Node was saved in Op */ ObjDesc->Reference.Node = Op->Common.Node; + ObjDesc->Reference.Object = Op->Common.Node->Object; } ObjDesc->Reference.Opcode = Opcode; diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsopcode.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsopcode.c index 06f725b7ba..85b648f90c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsopcode.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsopcode.c @@ -2,7 +2,7 @@ * * Module Name: dsopcode - Dispatcher Op Region support and handling of * "control" opcodes - * $Revision: 1.109 $ + * $Revision: 1.115 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -124,6 +124,7 @@ #include "acinterp.h" #include "acnamesp.h" #include "acevents.h" +#include "actables.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsopcode") @@ -312,6 +313,53 @@ AcpiDsGetBufferFieldArguments ( } +/******************************************************************************* + * + * FUNCTION: AcpiDsGetBankFieldArguments + * + * PARAMETERS: ObjDesc - A valid BankField object + * + * RETURN: Status. + * + * DESCRIPTION: Get BankField BankValue. This implements the late + * evaluation of these field attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetBankFieldArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_OPERAND_OBJECT *ExtraDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc); + + + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the AML pointer (method object) and BankField node */ + + ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); + Node = ObjDesc->BankField.Node; + + ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", + AcpiUtGetNodeName (Node))); + + /* Execute the AML code for the TermArg arguments */ + + Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node), + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + return_ACPI_STATUS (Status); +} + + /******************************************************************************* * * FUNCTION: AcpiDsGetBufferArguments @@ -905,7 +953,117 @@ AcpiDsEvalRegionOperands ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", ObjDesc, - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), + ObjDesc->Region.Length)); + + /* Now the address and length are valid for this opregion */ + + ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID; + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsEvalTableRegionOperands + * + * PARAMETERS: WalkState - Current walk + * Op - A valid region Op object + * + * RETURN: Status + * + * DESCRIPTION: Get region address and length + * Called from AcpiDsExecEndOp during DataTableRegion parse tree walk + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsEvalTableRegionOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT **Operand; + ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *NextOp; + ACPI_NATIVE_UINT TableIndex; + ACPI_TABLE_HEADER *Table; + + + ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op); + + + /* + * This is where we evaluate the SignatureString and OemIDString + * and OemTableIDString of the DataTableRegion declaration + */ + Node = Op->Common.Node; + + /* NextOp points to SignatureString op */ + + NextOp = Op->Common.Value.Arg; + + /* + * Evaluate/create the SignatureString and OemIDString + * and OemTableIDString operands + */ + Status = AcpiDsCreateOperands (WalkState, NextOp); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * Resolve the SignatureString and OemIDString + * and OemTableIDString operands + */ + Status = AcpiExResolveOperands (Op->Common.AmlOpcode, + ACPI_WALK_OPERANDS, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), + 1, "after AcpiExResolveOperands"); + + Operand = &WalkState->Operands[0]; + + /* Find the ACPI table */ + + Status = AcpiTbFindTable (Operand[0]->String.Pointer, + Operand[1]->String.Pointer, Operand[2]->String.Pointer, + &TableIndex); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + AcpiUtRemoveReference (Operand[0]); + AcpiUtRemoveReference (Operand[1]); + AcpiUtRemoveReference (Operand[2]); + + Status = AcpiGetTableByIndex (TableIndex, &Table); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table); + ObjDesc->Region.Length = Table->Length; + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", + ObjDesc, + ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ @@ -947,6 +1105,12 @@ AcpiDsEvalDataObjectOperands ( /* The first operand (for all of these data objects) is the length */ + /* + * Set proper index into operand stack for AcpiDsObjStackPush + * invoked inside AcpiDsCreateOperand. + */ + WalkState->OperandIndex = WalkState->NumOperands; + Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1); if (ACPI_FAILURE (Status)) { @@ -1016,6 +1180,113 @@ AcpiDsEvalDataObjectOperands ( } +/******************************************************************************* + * + * FUNCTION: AcpiDsEvalBankFieldOperands + * + * PARAMETERS: WalkState - Current walk + * Op - A valid BankField Op object + * + * RETURN: Status + * + * DESCRIPTION: Get BankField BankValue + * Called from AcpiDsExecEndOp during BankField parse tree walk + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsEvalBankFieldOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *OperandDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *NextOp; + ACPI_PARSE_OBJECT *Arg; + + + ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op); + + + /* + * This is where we evaluate the BankValue field of the + * BankField declaration + */ + + /* NextOp points to the op that holds the Region */ + + NextOp = Op->Common.Value.Arg; + + /* NextOp points to the op that holds the Bank Register */ + + NextOp = NextOp->Common.Next; + + /* NextOp points to the op that holds the Bank Value */ + + NextOp = NextOp->Common.Next; + + /* + * Set proper index into operand stack for AcpiDsObjStackPush + * invoked inside AcpiDsCreateOperand. + * + * We use WalkState->Operands[0] to store the evaluated BankValue + */ + WalkState->OperandIndex = 0; + + Status = AcpiDsCreateOperand (WalkState, NextOp, 0); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), + 1, "after AcpiExResolveOperands"); + + /* + * Get the BankValue operand and save it + * (at Top of stack) + */ + OperandDesc = WalkState->Operands[0]; + + /* Arg points to the start Bank Field */ + + Arg = AcpiPsGetArg (Op, 4); + while (Arg) + { + /* Ignore OFFSET and ACCESSAS terms here */ + + if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) + { + Node = Arg->Common.Node; + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value; + } + + /* Move to next field in the list */ + + Arg = Arg->Common.Next; + } + + AcpiUtRemoveReference (OperandDesc); + return_ACPI_STATUS (Status); +} + + /******************************************************************************* * * FUNCTION: AcpiDsExecBeginControlOp @@ -1217,8 +1488,7 @@ AcpiDsExecEndControlOp ( */ WalkState->ReturnDesc = WalkState->Operands[0]; } - else if ((WalkState->Results) && - (WalkState->Results->Results.NumResults > 0)) + else if (WalkState->ResultCount) { /* Since we have a real Return(), delete any implicit return */ diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsutils.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsutils.c index 496df6767b..78a2eb97f5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsutils - Dispatcher utilities - * $Revision: 1.121 $ + * $Revision: 1.127 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -374,7 +374,8 @@ AcpiDsIsResultUsed ( (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP)) + (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP)) { /* * These opcodes allow TermArg(s) as operands and therefore @@ -593,7 +594,8 @@ AcpiDsCreateOperand ( /* A valid name must be looked up in the namespace */ if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && - (Arg->Common.Value.String)) + (Arg->Common.Value.String) && + !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg)); @@ -715,7 +717,8 @@ AcpiDsCreateOperand ( { /* Check for null name case */ - if (Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) + if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && + !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) { /* * If the name is null, this means that this is an @@ -741,7 +744,7 @@ AcpiDsCreateOperand ( return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } - if (OpInfo->Flags & AML_HAS_RETVAL) + if ((OpInfo->Flags & AML_HAS_RETVAL) || (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Argument previously created, already stacked\n")); @@ -753,7 +756,7 @@ AcpiDsCreateOperand ( * Use value that was already previously returned * by the evaluation of this argument */ - Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState); + Status = AcpiDsResultPop (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { /* @@ -823,30 +826,57 @@ AcpiDsCreateOperands ( { ACPI_STATUS Status = AE_OK; ACPI_PARSE_OBJECT *Arg; + ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS]; UINT32 ArgCount = 0; + UINT32 Index = WalkState->NumOperands; + UINT32 i; ACPI_FUNCTION_TRACE_PTR (DsCreateOperands, FirstArg); - /* For all arguments in the list... */ + /* Get all arguments in the list */ Arg = FirstArg; while (Arg) { - Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount); - if (ACPI_FAILURE (Status)) + if (Index >= ACPI_OBJ_NUM_OPERANDS) { - goto Cleanup; + return_ACPI_STATUS (AE_BAD_DATA); } - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n", - ArgCount, Arg, FirstArg)); + Arguments[Index] = Arg; + WalkState->Operands [Index] = NULL; /* Move on to next argument, if any */ Arg = Arg->Common.Next; ArgCount++; + Index++; + } + + Index--; + + /* It is the appropriate order to get objects from the Result stack */ + + for (i = 0; i < ArgCount; i++) + { + Arg = Arguments[Index]; + + /* Force the filling of the operand stack in inverse order */ + + WalkState->OperandIndex = (UINT8) Index; + + Status = AcpiDsCreateOperand (WalkState, Arg, Index); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + Index--; + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n", + Index, Arg, FirstArg)); } return_ACPI_STATUS (Status); @@ -858,11 +888,122 @@ Cleanup: * pop everything off of the operand stack and delete those * objects */ - (void) AcpiDsObjStackPopAndDelete (ArgCount, WalkState); + AcpiDsObjStackPopAndDelete (ArgCount, WalkState); - ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", - (ArgCount + 1))); + ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", Index)); return_ACPI_STATUS (Status); } +/***************************************************************************** + * + * FUNCTION: AcpiDsEvaluateNamePath + * + * PARAMETERS: WalkState - Current state of the parse tree walk, + * the opcode of current operation should be + * AML_INT_NAMEPATH_OP + * + * RETURN: Status + * + * DESCRIPTION: Translate the -NamePath- parse tree object to the equivalent + * interpreter object, convert it to value, if needed, duplicate + * it, if needed, and push it onto the current result stack. + * + ****************************************************************************/ + +ACPI_STATUS +AcpiDsEvaluateNamePath ( + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status = AE_OK; + ACPI_PARSE_OBJECT *Op = WalkState->Op; + ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; + ACPI_OPERAND_OBJECT *NewObjDesc; + UINT8 Type; + + + ACPI_FUNCTION_TRACE_PTR (DsEvaluateNamePath, WalkState); + + + if (!Op->Common.Parent) + { + /* This happens after certain exception processing */ + + goto Exit; + } + + if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_REF_OF_OP)) + { + /* TBD: Should we specify this feature as a bit of OpInfo->Flags of these opcodes? */ + + goto Exit; + } + + Status = AcpiDsCreateOperand (WalkState, Op, 0); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + if (Op->Common.Flags & ACPI_PARSEOP_TARGET) + { + NewObjDesc = *Operand; + goto PushResult; + } + + Type = ACPI_GET_OBJECT_TYPE (*Operand); + + Status = AcpiExResolveToValue (Operand, WalkState); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + if (Type == ACPI_TYPE_INTEGER) + { + /* It was incremented by AcpiExResolveToValue */ + + AcpiUtRemoveReference (*Operand); + + Status = AcpiUtCopyIobjectToIobject (*Operand, &NewObjDesc, WalkState); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + } + else + { + /* + * The object either was anew created or is + * a Namespace node - don't decrement it. + */ + NewObjDesc = *Operand; + } + + /* Cleanup for name-path operand */ + + Status = AcpiDsObjStackPop (1, WalkState); + if (ACPI_FAILURE (Status)) + { + WalkState->ResultObj = NewObjDesc; + goto Exit; + } + +PushResult: + + WalkState->ResultObj = NewObjDesc; + + Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); + if (ACPI_SUCCESS (Status)) + { + /* Force to take it from stack */ + + Op->Common.Flags |= ACPI_PARSEOP_IN_STACK; + } + +Exit: + + return_ACPI_STATUS (Status); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswexec.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswexec.c index 7f87d6edfe..ba7f944e34 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswexec.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswexec.c @@ -2,7 +2,7 @@ * * Module Name: dswexec - Dispatcher method execution callbacks; * dispatch to interpreter. - * $Revision: 1.131 $ + * $Revision: 1.138 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -383,12 +383,6 @@ AcpiDsExecBeginOp ( { case AML_CLASS_CONTROL: - Status = AcpiDsResultStackPush (WalkState); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - Status = AcpiDsExecBeginControlOp (WalkState, Op); break; @@ -406,23 +400,12 @@ AcpiDsExecBeginOp ( Status = AcpiDsLoad2BeginOp (WalkState, NULL); } - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - Status = AcpiDsResultStackPush (WalkState); - } break; case AML_CLASS_EXECUTE: case AML_CLASS_CREATE: - /* - * Most operators with arguments (except CreateXxxField operators) - * Start a new result/operand state - */ - if (WalkState->OpInfo->ObjectType != ACPI_TYPE_BUFFER_FIELD) - { - Status = AcpiDsResultStackPush (WalkState); - } + break; @@ -485,6 +468,7 @@ AcpiDsExecEndOp ( /* Init the walk state */ WalkState->NumOperands = 0; + WalkState->OperandIndex = 0; WalkState->ReturnDesc = NULL; WalkState->ResultObj = NULL; @@ -497,11 +481,20 @@ AcpiDsExecEndOp ( switch (OpClass) { - case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ + case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */ + + if (WalkState->Opcode == AML_INT_NAMEPATH_OP) + { + Status = AcpiDsEvaluateNamePath (WalkState); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + } break; - case AML_CLASS_EXECUTE: /* most operators with arguments */ + case AML_CLASS_EXECUTE: /* Most operators with arguments */ /* Build resolved operand stack */ @@ -511,14 +504,6 @@ AcpiDsExecEndOp ( goto Cleanup; } - /* Done with this result state (Now that operand stack is built) */ - - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - /* * All opcodes require operand resolution, with the only exceptions * being the ObjectType and SizeOf operators. @@ -598,20 +583,6 @@ AcpiDsExecEndOp ( Status = AcpiDsExecEndControlOp (WalkState, Op); - /* Make sure to properly pop the result stack */ - - if (ACPI_SUCCESS (Status)) - { - Status = AcpiDsResultStackPop (WalkState); - } - else if (Status == AE_CTRL_PENDING) - { - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_PENDING; - } - } break; @@ -629,7 +600,7 @@ AcpiDsExecEndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", Op)); - Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node->Object; + Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node; AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object); return_ACPI_STATUS (AE_OK); } @@ -738,14 +709,6 @@ AcpiDsExecEndOp ( break; } - /* Done with result state (Now that operand stack is built) */ - - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - /* * If a result object was returned from above, push it on the * current result stack @@ -778,8 +741,28 @@ AcpiDsExecEndOp ( { break; } + } + else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Executing DataTableRegion Strings Op=%p\n", Op)); - Status = AcpiDsResultStackPop (WalkState); + Status = AcpiDsEvalTableRegionOperands (WalkState, Op); + if (ACPI_FAILURE (Status)) + { + break; + } + } + else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Executing BankField Op=%p\n", Op)); + + Status = AcpiDsEvalBankFieldOperands (WalkState, Op); + if (ACPI_FAILURE (Status)) + { + break; + } } break; diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswload.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswload.c index c6a6d52472..21d56dbd52 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswload.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 1.116 $ + * $Revision: 1.120 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -534,6 +534,15 @@ AcpiDsLoad1EndOp ( return_ACPI_STATUS (Status); } } + else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) + { + Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, + REGION_DATA_TABLE, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } } #endif @@ -860,6 +869,13 @@ AcpiDsLoad2BeginOp ( Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); + + if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "***New Node [%4.4s] %p is temporary\n", + AcpiUtGetNodeName (Node), Node)); + } break; } @@ -922,6 +938,7 @@ AcpiDsLoad2EndOp ( ACPI_NAMESPACE_NODE *NewNode; #ifndef ACPI_NO_METHOD_EXECUTION UINT32 i; + UINT8 RegionSpace; #endif @@ -1105,10 +1122,6 @@ AcpiDsLoad2EndOp ( Status = AcpiExCreateEvent (WalkState); break; - case AML_DATA_REGION_OP: - - Status = AcpiExCreateTableRegion (WalkState); - break; case AML_ALIAS_OP: @@ -1139,6 +1152,17 @@ AcpiDsLoad2EndOp ( { #ifndef ACPI_NO_METHOD_EXECUTION case AML_REGION_OP: + case AML_DATA_REGION_OP: + + if (Op->Common.AmlOpcode == AML_REGION_OP) + { + RegionSpace = (ACPI_ADR_SPACE_TYPE) + ((Op->Common.Value.Arg)->Common.Value.Integer); + } + else + { + RegionSpace = REGION_DATA_TABLE; + } /* * If we are executing a method, initialize the region @@ -1146,9 +1170,7 @@ AcpiDsLoad2EndOp ( if (WalkState->MethodNode) { Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - (ACPI_ADR_SPACE_TYPE) - ((Op->Common.Value.Arg)->Common.Value.Integer), - WalkState); + RegionSpace, WalkState); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswscope.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswscope.c index f5d05a7496..f8143e6281 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswscope.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswscope.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswscope - Scope stack manipulation - * $Revision: 1.68 $ + * $Revision: 1.70 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswstate.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswstate.c index 204acfc559..01619a7a04 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswstate.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswstate.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswstate - Dispatcher parse tree walk management routines - * $Revision: 1.98 $ + * $Revision: 1.105 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -127,96 +127,14 @@ /* Local prototypes */ -#ifdef ACPI_OBSOLETE_FUNCTIONS -ACPI_STATUS -AcpiDsResultInsert ( - void *Object, - UINT32 Index, +static ACPI_STATUS +AcpiDsResultStackPush ( ACPI_WALK_STATE *WalkState); -ACPI_STATUS -AcpiDsObjStackDeleteAll ( +static ACPI_STATUS +AcpiDsResultStackPop ( ACPI_WALK_STATE *WalkState); -ACPI_STATUS -AcpiDsObjStackPopObject ( - ACPI_OPERAND_OBJECT **Object, - ACPI_WALK_STATE *WalkState); - -void * -AcpiDsObjStackGetValue ( - UINT32 Index, - ACPI_WALK_STATE *WalkState); -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDsResultRemove - * - * PARAMETERS: Object - Where to return the popped object - * Index - Where to extract the object - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In - * other words, this is a FIFO. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsResultRemove ( - ACPI_OPERAND_OBJECT **Object, - UINT32 Index, - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_NAME (DsResultRemove); - - - State = WalkState->Results; - if (!State) - { - ACPI_ERROR ((AE_INFO, "No result object pushed! State=%p", - WalkState)); - return (AE_NOT_EXIST); - } - - if (Index >= ACPI_OBJ_MAX_OPERAND) - { - ACPI_ERROR ((AE_INFO, - "Index out of range: %X State=%p Num=%X", - Index, WalkState, State->Results.NumResults)); - } - - /* Check for a valid result object */ - - if (!State->Results.ObjDesc [Index]) - { - ACPI_ERROR ((AE_INFO, - "Null operand! State=%p #Ops=%X, Index=%X", - WalkState, State->Results.NumResults, Index)); - return (AE_AML_NO_RETURN_VALUE); - } - - /* Remove the object */ - - State->Results.NumResults--; - - *Object = State->Results.ObjDesc [Index]; - State->Results.ObjDesc [Index] = NULL; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj=%p [%s] Index=%X State=%p Num=%X\n", - *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL", - Index, WalkState, State->Results.NumResults)); - - return (AE_OK); -} - /******************************************************************************* * @@ -227,8 +145,7 @@ AcpiDsResultRemove ( * * RETURN: Status * - * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In - * other words, this is a FIFO. + * DESCRIPTION: Pop an object off the top of this walk's result stack * ******************************************************************************/ @@ -239,120 +156,63 @@ AcpiDsResultPop ( { ACPI_NATIVE_UINT Index; ACPI_GENERIC_STATE *State; + ACPI_STATUS Status; ACPI_FUNCTION_NAME (DsResultPop); State = WalkState->Results; - if (!State) + + /* Incorrect state of result stack */ + + if (State && !WalkState->ResultCount) { - return (AE_OK); + ACPI_ERROR ((AE_INFO, "No results on result stack")); + return (AE_AML_INTERNAL); } - if (!State->Results.NumResults) + if (!State && WalkState->ResultCount) { - ACPI_ERROR ((AE_INFO, "Result stack is empty! State=%p", + ACPI_ERROR ((AE_INFO, "No result state for result stack")); + return (AE_AML_INTERNAL); + } + + /* Empty result stack */ + + if (!State) + { + ACPI_ERROR ((AE_INFO, "Result stack is empty! State=%p", WalkState)); + return (AE_AML_NO_RETURN_VALUE); + } + + /* Return object of the top element and clean that top element result stack */ + + WalkState->ResultCount--; + Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM; + + *Object = State->Results.ObjDesc [Index]; + if (!*Object) + { + ACPI_ERROR ((AE_INFO, "No result objects on result stack, State=%p", WalkState)); return (AE_AML_NO_RETURN_VALUE); } - /* Remove top element */ - - State->Results.NumResults--; - - for (Index = ACPI_OBJ_NUM_OPERANDS; Index; Index--) + State->Results.ObjDesc [Index] = NULL; + if (Index == 0) { - /* Check for a valid result object */ - - if (State->Results.ObjDesc [Index -1]) + Status = AcpiDsResultStackPop (WalkState); + if (ACPI_FAILURE (Status)) { - *Object = State->Results.ObjDesc [Index -1]; - State->Results.ObjDesc [Index -1] = NULL; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj=%p [%s] Index=%X State=%p Num=%X\n", - *Object, - (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL", - (UINT32) Index -1, WalkState, State->Results.NumResults)); - - return (AE_OK); + return (Status); } } - ACPI_ERROR ((AE_INFO, - "No result objects! State=%p", WalkState)); - return (AE_AML_NO_RETURN_VALUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsResultPopFromBottom - * - * PARAMETERS: Object - Where to return the popped object - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In - * other words, this is a FIFO. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsResultPopFromBottom ( - ACPI_OPERAND_OBJECT **Object, - ACPI_WALK_STATE *WalkState) -{ - ACPI_NATIVE_UINT Index; - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_NAME (DsResultPopFromBottom); - - - State = WalkState->Results; - if (!State) - { - ACPI_ERROR ((AE_INFO, - "No result object pushed! State=%p", WalkState)); - return (AE_NOT_EXIST); - } - - if (!State->Results.NumResults) - { - ACPI_ERROR ((AE_INFO, "No result objects! State=%p", - WalkState)); - return (AE_AML_NO_RETURN_VALUE); - } - - /* Remove Bottom element */ - - *Object = State->Results.ObjDesc [0]; - - /* Push entire stack down one element */ - - for (Index = 0; Index < State->Results.NumResults; Index++) - { - State->Results.ObjDesc [Index] = State->Results.ObjDesc [Index + 1]; - } - - State->Results.NumResults--; - - /* Check for a valid result object */ - - if (!*Object) - { - ACPI_ERROR ((AE_INFO, - "Null operand! State=%p #Ops=%X Index=%X", - WalkState, State->Results.NumResults, (UINT32) Index)); - return (AE_AML_NO_RETURN_VALUE); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n", - *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL", - State, WalkState)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Obj=%p [%s] Index=%X State=%p Num=%X\n", *Object, + AcpiUtGetObjectTypeName (*Object), + (UINT32) Index, WalkState, WalkState->ResultCount)); return (AE_OK); } @@ -377,11 +237,36 @@ AcpiDsResultPush ( ACPI_WALK_STATE *WalkState) { ACPI_GENERIC_STATE *State; + ACPI_STATUS Status; + ACPI_NATIVE_UINT Index; ACPI_FUNCTION_NAME (DsResultPush); + if (WalkState->ResultCount > WalkState->ResultSize) + { + ACPI_ERROR ((AE_INFO, "Result stack is full")); + return (AE_AML_INTERNAL); + } + else if (WalkState->ResultCount == WalkState->ResultSize) + { + /* Extend the result stack */ + + Status = AcpiDsResultStackPush (WalkState); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, "Failed to extend the result stack")); + return (Status); + } + } + + if (!(WalkState->ResultCount < WalkState->ResultSize)) + { + ACPI_ERROR ((AE_INFO, "No free elements in result stack")); + return (AE_AML_INTERNAL); + } + State = WalkState->Results; if (!State) { @@ -389,28 +274,23 @@ AcpiDsResultPush ( return (AE_AML_INTERNAL); } - if (State->Results.NumResults == ACPI_OBJ_NUM_OPERANDS) - { - ACPI_ERROR ((AE_INFO, - "Result stack overflow: Obj=%p State=%p Num=%X", - Object, WalkState, State->Results.NumResults)); - return (AE_STACK_OVERFLOW); - } - if (!Object) { ACPI_ERROR ((AE_INFO, "Null Object! Obj=%p State=%p Num=%X", - Object, WalkState, State->Results.NumResults)); + Object, WalkState, WalkState->ResultCount)); return (AE_BAD_PARAMETER); } - State->Results.ObjDesc [State->Results.NumResults] = Object; - State->Results.NumResults++; + /* Assign the address of object to the top free element of result stack */ + + Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM; + State->Results.ObjDesc [Index] = Object; + WalkState->ResultCount++; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", - Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL", - WalkState, State->Results.NumResults, WalkState->CurrentResult)); + Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object), + WalkState, WalkState->ResultCount, WalkState->CurrentResult)); return (AE_OK); } @@ -424,19 +304,30 @@ AcpiDsResultPush ( * * RETURN: Status * - * DESCRIPTION: Push an object onto the WalkState result stack. + * DESCRIPTION: Push an object onto the WalkState result stack * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDsResultStackPush ( ACPI_WALK_STATE *WalkState) { ACPI_GENERIC_STATE *State; + ACPI_FUNCTION_NAME (DsResultStackPush); + /* Check for stack overflow */ + + if (((UINT32) WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) > + ACPI_RESULTS_OBJ_NUM_MAX) + { + ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%X", + WalkState, WalkState->ResultSize)); + return (AE_STACK_OVERFLOW); + } + State = AcpiUtCreateGenericState (); if (!State) { @@ -446,6 +337,10 @@ AcpiDsResultStackPush ( State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_RESULT; AcpiUtPushGenericState (&WalkState->Results, State); + /* Increase the length of the result stack by the length of frame */ + + WalkState->ResultSize += ACPI_RESULTS_FRAME_OBJ_NUM; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n", State, WalkState)); @@ -461,16 +356,17 @@ AcpiDsResultStackPush ( * * RETURN: Status * - * DESCRIPTION: Pop an object off of the WalkState result stack. + * DESCRIPTION: Pop an object off of the WalkState result stack * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDsResultStackPop ( ACPI_WALK_STATE *WalkState) { ACPI_GENERIC_STATE *State; + ACPI_FUNCTION_NAME (DsResultStackPop); @@ -478,18 +374,27 @@ AcpiDsResultStackPop ( if (WalkState->Results == NULL) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Result stack underflow - State=%p\n", WalkState)); return (AE_AML_NO_OPERAND); } + if (WalkState->ResultSize < ACPI_RESULTS_FRAME_OBJ_NUM) + { + ACPI_ERROR ((AE_INFO, "Insufficient result stack size")); + return (AE_AML_INTERNAL); + } + State = AcpiUtPopGenericState (&WalkState->Results); + AcpiUtDeleteGenericState (State); + + /* Decrease the length of result stack by the length of frame */ + + WalkState->ResultSize -= ACPI_RESULTS_FRAME_OBJ_NUM; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Result=%p RemainingResults=%X State=%p\n", - State, State->Results.NumResults, WalkState)); - - AcpiUtDeleteGenericState (State); + State, WalkState->ResultCount, WalkState)); return (AE_OK); } @@ -528,12 +433,16 @@ AcpiDsObjStackPush ( /* Put the object onto the stack */ - WalkState->Operands [WalkState->NumOperands] = Object; + WalkState->Operands [WalkState->OperandIndex] = Object; WalkState->NumOperands++; + /* For the usual order of filling the operand stack */ + + WalkState->OperandIndex++; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", - Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object), - WalkState, WalkState->NumOperands)); + Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object), + WalkState, WalkState->NumOperands)); return (AE_OK); } @@ -560,6 +469,7 @@ AcpiDsObjStackPop ( { UINT32 i; + ACPI_FUNCTION_NAME (DsObjStackPop); @@ -582,7 +492,7 @@ AcpiDsObjStackPop ( } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", - PopCount, WalkState, WalkState->NumOperands)); + PopCount, WalkState, WalkState->NumOperands)); return (AE_OK); } @@ -602,45 +512,43 @@ AcpiDsObjStackPop ( * ******************************************************************************/ -ACPI_STATUS +void AcpiDsObjStackPopAndDelete ( UINT32 PopCount, ACPI_WALK_STATE *WalkState) { - UINT32 i; + ACPI_NATIVE_INT i; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_FUNCTION_NAME (DsObjStackPopAndDelete); - for (i = 0; i < PopCount; i++) + if (PopCount == 0) { - /* Check for stack underflow */ + return; + } + for (i = (ACPI_NATIVE_INT)(PopCount - 1); i >= 0; i--) + { if (WalkState->NumOperands == 0) { - ACPI_ERROR ((AE_INFO, - "Object stack underflow! Count=%X State=%p #Ops=%X", - PopCount, WalkState, WalkState->NumOperands)); - return (AE_STACK_UNDERFLOW); + return; } /* Pop the stack and delete an object if present in this stack entry */ WalkState->NumOperands--; - ObjDesc = WalkState->Operands [WalkState->NumOperands]; + ObjDesc = WalkState->Operands [i]; if (ObjDesc) { - AcpiUtRemoveReference (WalkState->Operands [WalkState->NumOperands]); - WalkState->Operands [WalkState->NumOperands] = NULL; + AcpiUtRemoveReference (WalkState->Operands [i]); + WalkState->Operands [i] = NULL; } } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", - PopCount, WalkState, WalkState->NumOperands)); - - return (AE_OK); + PopCount, WalkState, WalkState->NumOperands)); } @@ -660,7 +568,6 @@ AcpiDsObjStackPopAndDelete ( ACPI_WALK_STATE * AcpiDsGetCurrentWalkState ( ACPI_THREAD_STATE *Thread) - { ACPI_FUNCTION_NAME (DsGetCurrentWalkState); @@ -686,7 +593,7 @@ AcpiDsGetCurrentWalkState ( * * RETURN: None * - * DESCRIPTION: Place the Thread state at the head of the state list. + * DESCRIPTION: Place the Thread state at the head of the state list * ******************************************************************************/ @@ -698,7 +605,7 @@ AcpiDsPushWalkState ( ACPI_FUNCTION_TRACE (DsPushWalkState); - WalkState->Next = Thread->WalkStateList; + WalkState->Next = Thread->WalkStateList; Thread->WalkStateList = WalkState; return_VOID; @@ -772,7 +679,6 @@ AcpiDsCreateWalkState ( ACPI_THREAD_STATE *Thread) { ACPI_WALK_STATE *WalkState; - ACPI_STATUS Status; ACPI_FUNCTION_TRACE (DsCreateWalkState); @@ -798,15 +704,6 @@ AcpiDsCreateWalkState ( AcpiDsMethodDataInit (WalkState); #endif - /* Create an initial result stack entry */ - - Status = AcpiDsResultStackPush (WalkState); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (WalkState); - return_PTR (NULL); - } - /* Put the new state at the head of the walk list */ if (Thread) @@ -1027,209 +924,3 @@ AcpiDsDeleteWalkState ( } -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AcpiDsResultInsert - * - * PARAMETERS: Object - Object to push - * Index - Where to insert the object - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Insert an object onto this walk's result stack - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsResultInsert ( - void *Object, - UINT32 Index, - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_NAME (DsResultInsert); - - - State = WalkState->Results; - if (!State) - { - ACPI_ERROR ((AE_INFO, "No result object pushed! State=%p", - WalkState)); - return (AE_NOT_EXIST); - } - - if (Index >= ACPI_OBJ_NUM_OPERANDS) - { - ACPI_ERROR ((AE_INFO, - "Index out of range: %X Obj=%p State=%p Num=%X", - Index, Object, WalkState, State->Results.NumResults)); - return (AE_BAD_PARAMETER); - } - - if (!Object) - { - ACPI_ERROR ((AE_INFO, - "Null Object! Index=%X Obj=%p State=%p Num=%X", - Index, Object, WalkState, State->Results.NumResults)); - return (AE_BAD_PARAMETER); - } - - State->Results.ObjDesc [Index] = Object; - State->Results.NumResults++; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj=%p [%s] State=%p Num=%X Cur=%X\n", - Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL", - WalkState, State->Results.NumResults, WalkState->CurrentResult)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsObjStackDeleteAll - * - * PARAMETERS: WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Clear the object stack by deleting all objects that are on it. - * Should be used with great care, if at all! - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsObjStackDeleteAll ( - ACPI_WALK_STATE *WalkState) -{ - UINT32 i; - - - ACPI_FUNCTION_TRACE_PTR (DsObjStackDeleteAll, WalkState); - - - /* The stack size is configurable, but fixed */ - - for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) - { - if (WalkState->Operands[i]) - { - AcpiUtRemoveReference (WalkState->Operands[i]); - WalkState->Operands[i] = NULL; - } - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsObjStackPopObject - * - * PARAMETERS: Object - Where to return the popped object - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT - * deleted by this routine. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsObjStackPopObject ( - ACPI_OPERAND_OBJECT **Object, - ACPI_WALK_STATE *WalkState) -{ - ACPI_FUNCTION_NAME (DsObjStackPopObject); - - - /* Check for stack underflow */ - - if (WalkState->NumOperands == 0) - { - ACPI_ERROR ((AE_INFO, - "Missing operand/stack empty! State=%p #Ops=%X", - WalkState, WalkState->NumOperands)); - *Object = NULL; - return (AE_AML_NO_OPERAND); - } - - /* Pop the stack */ - - WalkState->NumOperands--; - - /* Check for a valid operand */ - - if (!WalkState->Operands [WalkState->NumOperands]) - { - ACPI_ERROR ((AE_INFO, - "Null operand! State=%p #Ops=%X", - WalkState, WalkState->NumOperands)); - *Object = NULL; - return (AE_AML_NO_OPERAND); - } - - /* Get operand and set stack entry to null */ - - *Object = WalkState->Operands [WalkState->NumOperands]; - WalkState->Operands [WalkState->NumOperands] = NULL; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", - *Object, AcpiUtGetObjectTypeName (*Object), - WalkState, WalkState->NumOperands)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsObjStackGetValue - * - * PARAMETERS: Index - Stack index whose value is desired. Based - * on the top of the stack (index=0 == top) - * WalkState - Current Walk state - * - * RETURN: Pointer to the requested operand - * - * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must - * be within the range of the current stack pointer. - * - ******************************************************************************/ - -void * -AcpiDsObjStackGetValue ( - UINT32 Index, - ACPI_WALK_STATE *WalkState) -{ - - ACPI_FUNCTION_TRACE_PTR (DsObjStackGetValue, WalkState); - - - /* Can't do it if the stack is empty */ - - if (WalkState->NumOperands == 0) - { - return_PTR (NULL); - } - - /* or if the index is past the top of the stack */ - - if (Index > (WalkState->NumOperands - (UINT32) 1)) - { - return_PTR (NULL); - } - - return_PTR (WalkState->Operands[(ACPI_NATIVE_UINT)(WalkState->NumOperands - 1) - - Index]); -} -#endif - - diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exconfig.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exconfig.c index f7a46deeef..7ca3aa84d4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exconfig.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exconfig.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) - * $Revision: 1.102 $ + * $Revision: 1.113 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -121,7 +121,6 @@ #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" -#include "acevents.h" #include "actables.h" #include "acdispat.h" @@ -227,6 +226,15 @@ AcpiExLoadTableOp ( ACPI_FUNCTION_TRACE (ExLoadTableOp); + /* Validate lengths for the SignatureString, OEMIDString, OEMTableID */ + + if ((Operand[0]->String.Length > ACPI_NAME_SIZE) || + (Operand[1]->String.Length > ACPI_OEM_ID_SIZE) || + (Operand[2]->String.Length > ACPI_OEM_TABLE_ID_SIZE)) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + /* Find the ACPI table in the RSDT/XSDT */ Status = AcpiTbFindTable (Operand[0]->String.Pointer, @@ -326,10 +334,18 @@ AcpiExLoadTableOp ( if (ACPI_SUCCESS (Status)) { ACPI_INFO ((AE_INFO, - "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]", + "Dynamic OEM Table Load - [%.4s] OemId [%.6s] OemTableId [%.8s]", Table->Signature, Table->OemId, Table->OemTableId)); } + /* Invoke table handler if present */ + + if (AcpiGbl_TableHandler) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, + AcpiGbl_TableHandlerContext); + } + *ReturnDesc = DdbHandle; return_ACPI_STATUS (Status); } @@ -366,13 +382,13 @@ AcpiExLoadOp ( ACPI_TABLE_DESC TableDesc; ACPI_NATIVE_UINT TableIndex; ACPI_STATUS Status; + UINT32 Length; ACPI_FUNCTION_TRACE (ExLoadOp); ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC)); - TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED; /* Source Object can be either an OpRegion or a Buffer/Field */ @@ -380,6 +396,9 @@ AcpiExLoadOp ( { case ACPI_TYPE_REGION: + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n", + ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); + /* Region must be SystemMemory (from ACPI spec) */ if (ObjDesc->Region.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) @@ -387,9 +406,6 @@ AcpiExLoadOp ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n", - ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); - /* * If the Region Address and Length have not been previously evaluated, * evaluate them now and save the results. @@ -403,6 +419,11 @@ AcpiExLoadOp ( } } + /* + * We will simply map the memory region for the table. However, the + * memory region is technically not guaranteed to remain stable and + * we may eventually have to copy the table to a local buffer. + */ TableDesc.Address = ObjDesc->Region.Address; TableDesc.Length = ObjDesc->Region.Length; TableDesc.Flags = ACPI_TABLE_ORIGIN_MAPPED; @@ -410,17 +431,40 @@ AcpiExLoadOp ( case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */ - /* Simply extract the buffer from the buffer object */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Buffer or Field %p %s\n", ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); - TableDesc.Pointer = ACPI_CAST_PTR (ACPI_TABLE_HEADER, - ObjDesc->Buffer.Pointer); - TableDesc.Length = TableDesc.Pointer->Length; - TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED; + Length = ObjDesc->Buffer.Length; - ObjDesc->Buffer.Pointer = NULL; + /* Must have at least an ACPI table header */ + + if (Length < sizeof (ACPI_TABLE_HEADER)) + { + return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + } + + /* Validate checksum here. It won't get validated in TbAddTable */ + + Status = AcpiTbVerifyChecksum ( + ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer), Length); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * We need to copy the buffer since the original buffer could be + * changed or deleted in the future + */ + TableDesc.Pointer = ACPI_ALLOCATE (Length); + if (!TableDesc.Pointer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + ACPI_MEMCPY (TableDesc.Pointer, ObjDesc->Buffer.Pointer, Length); + TableDesc.Length = Length; + TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED; break; default: @@ -436,7 +480,7 @@ AcpiExLoadOp ( goto Cleanup; } - Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle); + Status = AcpiExAddTable (TableIndex, WalkState->ScopeInfo->Scope.Node, &DdbHandle); if (ACPI_FAILURE (Status)) { /* On error, TablePtr was deallocated above */ @@ -453,12 +497,23 @@ AcpiExLoadOp ( /* TablePtr was deallocated above */ + AcpiUtRemoveReference (DdbHandle); return_ACPI_STATUS (Status); } + /* Invoke table handler if present */ + + if (AcpiGbl_TableHandler) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, TableDesc.Pointer, + AcpiGbl_TableHandlerContext); + } + Cleanup: if (ACPI_FAILURE (Status)) { + /* Delete allocated buffer or mapping */ + AcpiTbDeleteTable (&TableDesc); } return_ACPI_STATUS (Status); @@ -484,6 +539,7 @@ AcpiExUnloadTable ( ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *TableDesc = DdbHandle; ACPI_NATIVE_UINT TableIndex; + ACPI_TABLE_HEADER *Table; ACPI_FUNCTION_TRACE (ExUnloadTable); @@ -506,18 +562,27 @@ AcpiExUnloadTable ( TableIndex = (ACPI_NATIVE_UINT) TableDesc->Reference.Object; + /* Invoke table handler if present */ + + if (AcpiGbl_TableHandler) + { + Status = AcpiGetTableByIndex (TableIndex, &Table); + if (ACPI_SUCCESS (Status)) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD, Table, + AcpiGbl_TableHandlerContext); + } + } + /* * Delete the entire namespace under this table Node * (Offset contains the TableId) */ AcpiTbDeleteNamespaceByOwner (TableIndex); - AcpiTbReleaseOwnerId (TableIndex); + (void) AcpiTbReleaseOwnerId (TableIndex); AcpiTbSetTableLoadedFlag (TableIndex, FALSE); - /* Delete the table descriptor (DdbHandle) */ - - AcpiUtRemoveReference (TableDesc); - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exconvrt.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exconvrt.c index a5882b183a..8d40933bdc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exconvrt.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exconvrt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconvrt - Object conversion routines - * $Revision: 1.73 $ + * $Revision: 1.75 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/excreate.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/excreate.c index b1dbd4877e..00eddcfc12 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/excreate.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/excreate.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: excreate - Named object creation - * $Revision: 1.113 $ + * $Revision: 1.117 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -180,16 +180,28 @@ AcpiExCreateAlias ( */ switch (TargetNode->Type) { + + /* For these types, the sub-object can change dynamically via a Store */ + case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: case ACPI_TYPE_PACKAGE: case ACPI_TYPE_BUFFER_FIELD: + /* + * These types open a new scope, so we need the NS node in order to access + * any children. + */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: + case ACPI_TYPE_LOCAL_SCOPE: + /* * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. This is because for these - * types, the object can change dynamically via a Store. + * NS node, not the object itself. */ AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS; AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); @@ -198,9 +210,7 @@ AcpiExCreateAlias ( case ACPI_TYPE_METHOD: /* - * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. This is because for these - * types, the object can change dynamically via a Store. + * Control method aliases need to be differentiated */ AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS; AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); @@ -439,115 +449,6 @@ Cleanup: } -/******************************************************************************* - * - * FUNCTION: AcpiExCreateTableRegion - * - * PARAMETERS: WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Create a new DataTableRegion object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCreateTableRegion ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *RegionObj2; - ACPI_NATIVE_UINT TableIndex; - ACPI_TABLE_HEADER *Table; - - - ACPI_FUNCTION_TRACE (ExCreateTableRegion); - - - /* Get the Node from the object stack */ - - Node = WalkState->Op->Common.Node; - - /* - * If the region object is already attached to this node, - * just return - */ - if (AcpiNsGetAttachedObject (Node)) - { - return_ACPI_STATUS (AE_OK); - } - - /* Find the ACPI table */ - - Status = AcpiTbFindTable (Operand[1]->String.Pointer, - Operand[2]->String.Pointer, Operand[3]->String.Pointer, - &TableIndex); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Create the region descriptor */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - RegionObj2 = ObjDesc->Common.NextObject; - RegionObj2->Extra.RegionContext = NULL; - - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Init the region from the operands */ - - ObjDesc->Region.SpaceId = REGION_DATA_TABLE; - ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table); - ObjDesc->Region.Length = Table->Length; - ObjDesc->Region.Node = Node; - ObjDesc->Region.Flags = AOPOBJ_DATA_VALID; - - /* Install the new region object in the parent Node */ - - Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Status = AcpiEvInitializeRegion (ObjDesc, FALSE); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_EXIST) - { - Status = AE_OK; - } - else - { - goto Cleanup; - } - } - - ObjDesc->Region.Flags |= AOPOBJ_SETUP_COMPLETE; - - -Cleanup: - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - /******************************************************************************* * * FUNCTION: AcpiExCreateProcessor diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exdump.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exdump.c index f60c6723fe..5b52e5b435 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exdump - Interpreter debug output routines - * $Revision: 1.200 $ + * $Revision: 1.206 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -601,14 +601,6 @@ AcpiExDumpOperand ( break; - case AML_NAME_OP: - - ACPI_DUMP_PATHNAME (ObjDesc->Reference.Object, - "Reference: Name: ", ACPI_LV_INFO, _COMPONENT); - ACPI_DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO); - break; - - case AML_INDEX_OP: AcpiOsPrintf ("Reference: Index %p\n", @@ -616,10 +608,18 @@ AcpiExDumpOperand ( break; + case AML_LOAD_OP: + + AcpiOsPrintf ("Reference: [DdbHandle] TableIndex %p\n", + ObjDesc->Reference.Object); + break; + + case AML_REF_OF_OP: - AcpiOsPrintf ("Reference: (RefOf) %p\n", - ObjDesc->Reference.Object); + AcpiOsPrintf ("Reference: (RefOf) %p [%s]\n", + ObjDesc->Reference.Object, + AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) ObjDesc->Reference.Object)->Common.Type)); break; @@ -660,8 +660,9 @@ AcpiExDumpOperand ( case AML_INT_NAMEPATH_OP: - AcpiOsPrintf ("Reference.Node->Name %X\n", - ObjDesc->Reference.Node->Name.Integer); + AcpiOsPrintf ("Reference: Namepath %X [%4.4s]\n", + ObjDesc->Reference.Node->Name.Integer, + ObjDesc->Reference.Node->Name.Ascii); break; @@ -748,7 +749,7 @@ AcpiExDumpOperand ( else { AcpiOsPrintf (" base %8.8X%8.8X Length %X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), ObjDesc->Region.Length); } break; @@ -1027,12 +1028,12 @@ AcpiExDumpReferenceObj ( if (ObjDesc->Reference.Opcode == AML_INT_NAMEPATH_OP) { - AcpiOsPrintf ("Named Object %p ", ObjDesc->Reference.Node); + AcpiOsPrintf (" Named Object %p ", ObjDesc->Reference.Node); Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not convert name to pathname\n"); + AcpiOsPrintf (" Could not convert name to pathname\n"); } else { @@ -1042,7 +1043,29 @@ AcpiExDumpReferenceObj ( } else if (ObjDesc->Reference.Object) { - AcpiOsPrintf ("\nReferenced Object: %p\n", ObjDesc->Reference.Object); + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) + { + AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object); + if (ObjDesc->Reference.Opcode == AML_LOAD_OP) + { + /* + * For DDBHandle reference, + * ObjDesc->Reference.Object is the table index + */ + AcpiOsPrintf (" [DDBHandle]\n"); + } + else + { + AcpiOsPrintf (" [%s]\n", + AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) + ObjDesc->Reference.Object)->Common.Type)); + } + } + else + { + AcpiOsPrintf (" Target: %p\n", + ObjDesc->Reference.Object); + } } } @@ -1141,7 +1164,8 @@ AcpiExDumpPackageObj ( case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf ("[Object Reference] "); + AcpiOsPrintf ("[Object Reference] %s", + (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name); AcpiExDumpReferenceObj (ObjDesc); break; diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exfield.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exfield.c index b134302c8d..3f28224c39 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exfield.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfield - ACPI AML (p-code) execution - field manipulation - * $Revision: 1.128 $ + * $Revision: 1.133 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -151,7 +151,6 @@ AcpiExReadDataFromField ( ACPI_OPERAND_OBJECT *BufferDesc; ACPI_SIZE Length; void *Buffer; - BOOLEAN Locked; ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); @@ -198,7 +197,7 @@ AcpiExReadDataFromField ( /* Lock entire transaction if requested */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); /* * Perform the read. @@ -207,7 +206,7 @@ AcpiExReadDataFromField ( Status = AcpiExAccessRegion (ObjDesc, 0, ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer), ACPI_READ | (ObjDesc->Field.Attribute << 16)); - AcpiExReleaseGlobalLock (Locked); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); goto Exit; } @@ -259,12 +258,12 @@ AcpiExReadDataFromField ( /* Lock entire transaction if requested */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); /* Read from the field */ Status = AcpiExExtractFromField (ObjDesc, Buffer, (UINT32) Length); - AcpiExReleaseGlobalLock (Locked); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); Exit: @@ -303,10 +302,7 @@ AcpiExWriteDataToField ( { ACPI_STATUS Status; UINT32 Length; - UINT32 RequiredLength; void *Buffer; - void *NewBuffer; - BOOLEAN Locked; ACPI_OPERAND_OBJECT *BufferDesc; @@ -373,7 +369,7 @@ AcpiExWriteDataToField ( /* Lock entire transaction if requested */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); /* * Perform the write (returns status and perhaps data in the @@ -383,7 +379,7 @@ AcpiExWriteDataToField ( Status = AcpiExAccessRegion (ObjDesc, 0, (ACPI_INTEGER *) Buffer, ACPI_WRITE | (ObjDesc->Field.Attribute << 16)); - AcpiExReleaseGlobalLock (Locked); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); *ResultDesc = BufferDesc; return_ACPI_STATUS (Status); @@ -412,36 +408,6 @@ AcpiExWriteDataToField ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - /* - * We must have a buffer that is at least as long as the field - * we are writing to. This is because individual fields are - * indivisible and partial writes are not supported -- as per - * the ACPI specification. - */ - NewBuffer = NULL; - RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->CommonField.BitLength); - - if (Length < RequiredLength) - { - /* We need to create a new buffer */ - - NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength); - if (!NewBuffer) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Copy the original data to the new buffer, starting - * at Byte zero. All unused (upper) bytes of the - * buffer will be 0. - */ - ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, Length); - Buffer = NewBuffer; - Length = RequiredLength; - } - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", SourceDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (SourceDesc)), @@ -457,19 +423,12 @@ AcpiExWriteDataToField ( /* Lock entire transaction if requested */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); /* Write to the field */ Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length); - AcpiExReleaseGlobalLock (Locked); - - /* Free temporary buffer if we used one */ - - if (NewBuffer) - { - ACPI_FREE (NewBuffer); - } + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exfldio.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exfldio.c index 91bd3ac5fa..dc41eba1f9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exfldio.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exfldio.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfldio - Aml Field I/O - * $Revision: 1.127 $ + * $Revision: 1.131 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -365,7 +365,7 @@ AcpiExAccessRegion ( ObjDesc->CommonField.AccessByteWidth, ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, - (void *) Address)); + ACPI_CAST_PTR (void, Address))); /* Invoke the appropriate AddressSpace/OpRegion handler */ @@ -930,6 +930,8 @@ AcpiExInsertIntoField ( UINT32 DatumCount; UINT32 FieldDatumCount; UINT32 i; + UINT32 RequiredLength; + void *NewBuffer; ACPI_FUNCTION_TRACE (ExInsertIntoField); @@ -937,14 +939,33 @@ AcpiExInsertIntoField ( /* Validate input buffer */ - if (BufferLength < - ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength)) + NewBuffer = NULL; + RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->CommonField.BitLength); + /* + * We must have a buffer that is at least as long as the field + * we are writing to. This is because individual fields are + * indivisible and partial writes are not supported -- as per + * the ACPI specification. + */ + if (BufferLength < RequiredLength) { - ACPI_ERROR ((AE_INFO, - "Field size %X (bits) is too large for buffer (%X)", - ObjDesc->CommonField.BitLength, BufferLength)); + /* We need to create a new buffer */ - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength); + if (!NewBuffer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* + * Copy the original data to the new buffer, starting + * at Byte zero. All unused (upper) bytes of the + * buffer will be 0. + */ + ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, BufferLength); + Buffer = NewBuffer; + BufferLength = RequiredLength; } /* @@ -992,7 +1013,7 @@ AcpiExInsertIntoField ( MergedDatum, FieldOffset); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto Exit; } FieldOffset += ObjDesc->CommonField.AccessByteWidth; @@ -1050,6 +1071,13 @@ AcpiExInsertIntoField ( Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum, FieldOffset); +Exit: + /* Free temporary buffer if we used one */ + + if (NewBuffer) + { + ACPI_FREE (NewBuffer); + } return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exmisc.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exmisc.c index 21f065ba89..165e997727 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exmisc.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes - * $Revision: 1.143 $ + * $Revision: 1.145 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exmutex.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exmutex.c index db1601ca1a..8e6e8d5899 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exmutex.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmutex - ASL Mutex Acquire/Release functions - * $Revision: 1.35 $ + * $Revision: 1.43 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -215,6 +215,88 @@ AcpiExLinkMutex ( } +/******************************************************************************* + * + * FUNCTION: AcpiExAcquireMutexObject + * + * PARAMETERS: TimeDesc - Timeout in milliseconds + * ObjDesc - Mutex object + * Thread - Current thread state + * + * RETURN: Status + * + * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common + * path that supports multiple acquires by the same thread. + * + * MUTEX: Interpreter must be locked + * + * NOTE: This interface is called from three places: + * 1) From AcpiExAcquireMutex, via an AML Acquire() operator + * 2) From AcpiExAcquireGlobalLock when an AML Field access requires the + * global lock + * 3) From the external interface, AcpiAcquireGlobalLock + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExAcquireMutexObject ( + UINT16 Timeout, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_THREAD_ID ThreadId) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (ExAcquireMutexObject, ObjDesc); + + + if (!ObjDesc) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* Support for multiple acquires by the owning thread */ + + if (ObjDesc->Mutex.ThreadId == ThreadId) + { + /* + * The mutex is already owned by this thread, just increment the + * acquisition depth + */ + ObjDesc->Mutex.AcquisitionDepth++; + return_ACPI_STATUS (AE_OK); + } + + /* Acquire the mutex, wait if necessary. Special case for Global Lock */ + + if (ObjDesc == AcpiGbl_GlobalLockMutex) + { + Status = AcpiEvAcquireGlobalLock (Timeout); + } + else + { + Status = AcpiExSystemWaitMutex (ObjDesc->Mutex.OsMutex, + Timeout); + } + + if (ACPI_FAILURE (Status)) + { + /* Includes failure from a timeout on TimeDesc */ + + return_ACPI_STATUS (Status); + } + + /* Acquired the mutex: update mutex object */ + + ObjDesc->Mutex.ThreadId = ThreadId; + ObjDesc->Mutex.AcquisitionDepth = 1; + ObjDesc->Mutex.OriginalSyncLevel = 0; + ObjDesc->Mutex.OwnerThread = NULL; /* Used only for AML Acquire() */ + + return_ACPI_STATUS (AE_OK); +} + + /******************************************************************************* * * FUNCTION: AcpiExAcquireMutex @@ -246,7 +328,7 @@ AcpiExAcquireMutex ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Sanity check: we must have a valid thread ID */ + /* Must have a valid thread ID */ if (!WalkState->Thread) { @@ -256,7 +338,7 @@ AcpiExAcquireMutex ( } /* - * Current Sync must be less than or equal to the sync level of the + * Current sync level must be less than or equal to the sync level of the * mutex. This mechanism provides some deadlock prevention */ if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel) @@ -268,53 +350,95 @@ AcpiExAcquireMutex ( return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } - /* Support for multiple acquires by the owning thread */ + Status = AcpiExAcquireMutexObject ((UINT16) TimeDesc->Integer.Value, + ObjDesc, WalkState->Thread->ThreadId); + if (ACPI_SUCCESS (Status) && ObjDesc->Mutex.AcquisitionDepth == 1) + { + /* Save Thread object, original/current sync levels */ + + ObjDesc->Mutex.OwnerThread = WalkState->Thread; + ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel; + WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; + + /* Link the mutex to the current thread for force-unlock at method exit */ + + AcpiExLinkMutex (ObjDesc, WalkState->Thread); + } + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExReleaseMutexObject + * + * PARAMETERS: ObjDesc - The object descriptor for this op + * + * RETURN: Status + * + * DESCRIPTION: Release a previously acquired Mutex, low level interface. + * Provides a common path that supports multiple releases (after + * previous multiple acquires) by the same thread. + * + * MUTEX: Interpreter must be locked + * + * NOTE: This interface is called from three places: + * 1) From AcpiExReleaseMutex, via an AML Acquire() operator + * 2) From AcpiExReleaseGlobalLock when an AML Field access requires the + * global lock + * 3) From the external interface, AcpiReleaseGlobalLock + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExReleaseMutexObject ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (ExReleaseMutexObject); + + + if (ObjDesc->Mutex.AcquisitionDepth == 0) + { + return (AE_NOT_ACQUIRED); + } + + /* Match multiple Acquires with multiple Releases */ + + ObjDesc->Mutex.AcquisitionDepth--; + if (ObjDesc->Mutex.AcquisitionDepth != 0) + { + /* Just decrement the depth and return */ + + return_ACPI_STATUS (AE_OK); + } if (ObjDesc->Mutex.OwnerThread) { - if (ObjDesc->Mutex.OwnerThread->ThreadId == - WalkState->Thread->ThreadId) - { - /* - * The mutex is already owned by this thread, just increment the - * acquisition depth - */ - ObjDesc->Mutex.AcquisitionDepth++; - return_ACPI_STATUS (AE_OK); - } + /* Unlink the mutex from the owner's list */ + + AcpiExUnlinkMutex (ObjDesc); + ObjDesc->Mutex.OwnerThread = NULL; } - /* Acquire the mutex, wait if necessary. Special case for Global Lock */ + /* Release the mutex, special case for Global Lock */ - if (ObjDesc->Mutex.OsMutex == AcpiGbl_GlobalLockMutex) + if (ObjDesc == AcpiGbl_GlobalLockMutex) { - Status = AcpiEvAcquireGlobalLock ((UINT16) TimeDesc->Integer.Value); + Status = AcpiEvReleaseGlobalLock (); } else { - Status = AcpiExSystemWaitMutex (ObjDesc->Mutex.OsMutex, - (UINT16) TimeDesc->Integer.Value); + AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex); } - if (ACPI_FAILURE (Status)) - { - /* Includes failure from a timeout on TimeDesc */ + /* Clear mutex info */ - return_ACPI_STATUS (Status); - } - - /* Have the mutex: update mutex and walk info and save the SyncLevel */ - - ObjDesc->Mutex.OwnerThread = WalkState->Thread; - ObjDesc->Mutex.AcquisitionDepth = 1; - ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel; - - WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; - - /* Link the mutex to the current thread for force-unlock at method exit */ - - AcpiExLinkMutex (ObjDesc, WalkState->Thread); - return_ACPI_STATUS (AE_OK); + ObjDesc->Mutex.ThreadId = 0; + return_ACPI_STATUS (Status); } @@ -356,21 +480,12 @@ AcpiExReleaseMutex ( return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); } - /* Sanity check: we must have a valid thread ID */ - - if (!WalkState->Thread) - { - ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info", - AcpiUtGetNodeName (ObjDesc->Mutex.Node))); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - /* * The Mutex is owned, but this thread must be the owner. * Special case for Global Lock, any thread can release */ if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) && - (ObjDesc->Mutex.OsMutex != AcpiGbl_GlobalLockMutex)) + (ObjDesc != AcpiGbl_GlobalLockMutex)) { ACPI_ERROR ((AE_INFO, "Thread %X cannot release Mutex [%4.4s] acquired by thread %X", @@ -380,6 +495,15 @@ AcpiExReleaseMutex ( return_ACPI_STATUS (AE_AML_NOT_OWNER); } + /* Must have a valid thread ID */ + + if (!WalkState->Thread) + { + ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info", + AcpiUtGetNodeName (ObjDesc->Mutex.Node))); + return_ACPI_STATUS (AE_AML_INTERNAL); + } + /* * The sync level of the mutex must be less than or equal to the current * sync level @@ -387,41 +511,20 @@ AcpiExReleaseMutex ( if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel) { ACPI_ERROR ((AE_INFO, - "Cannot release Mutex [%4.4s], incorrect SyncLevel", - AcpiUtGetNodeName (ObjDesc->Mutex.Node))); + "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", + AcpiUtGetNodeName (ObjDesc->Mutex.Node), + ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel)); return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } - /* Match multiple Acquires with multiple Releases */ + Status = AcpiExReleaseMutexObject (ObjDesc); - ObjDesc->Mutex.AcquisitionDepth--; - if (ObjDesc->Mutex.AcquisitionDepth != 0) + if (ObjDesc->Mutex.AcquisitionDepth == 0) { - /* Just decrement the depth and return */ + /* Restore the original SyncLevel */ - return_ACPI_STATUS (AE_OK); + WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; } - - /* Unlink the mutex from the owner's list */ - - AcpiExUnlinkMutex (ObjDesc); - - /* Release the mutex, special case for Global Lock */ - - if (ObjDesc->Mutex.OsMutex == AcpiGbl_GlobalLockMutex) - { - Status = AcpiEvReleaseGlobalLock (); - } - else - { - AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex); - } - - /* Update the mutex and restore SyncLevel */ - - ObjDesc->Mutex.OwnerThread = NULL; - WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; - return_ACPI_STATUS (Status); } @@ -468,7 +571,7 @@ AcpiExReleaseAllMutexes ( /* Release the mutex, special case for Global Lock */ - if (ObjDesc->Mutex.OsMutex == AcpiGbl_GlobalLockMutex) + if (ObjDesc == AcpiGbl_GlobalLockMutex) { /* Ignore errors */ @@ -482,6 +585,7 @@ AcpiExReleaseAllMutexes ( /* Mark mutex unowned */ ObjDesc->Mutex.OwnerThread = NULL; + ObjDesc->Mutex.ThreadId = 0; /* Update Thread SyncLevel (Last mutex is the important one) */ diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exnames.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exnames.c index 1fd5d260db..65dff5e24f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exnames.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exnames.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exnames - interpreter/scanner name load/execute - * $Revision: 1.110 $ + * $Revision: 1.112 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg1.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg1.c index 70157e591d..8aeeff591a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg1.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg1.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg1 - AML execution - opcodes with 1 argument - * $Revision: 1.181 $ + * $Revision: 1.186 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -189,9 +189,7 @@ AcpiExOpcode_0A_0T_1R ( Status = AE_NO_MEMORY; goto Cleanup; } -#if ACPI_MACHINE_WIDTH != 16 ReturnDesc->Integer.Value = AcpiOsGetTimer (); -#endif break; default: /* Unknown opcode */ @@ -209,6 +207,7 @@ Cleanup: if ((ACPI_FAILURE (Status)) || WalkState->ResultObj) { AcpiUtRemoveReference (ReturnDesc); + WalkState->ResultObj = NULL; } else { @@ -881,26 +880,39 @@ AcpiExOpcode_1A_0T_1R ( Value = AcpiGbl_IntegerByteWidth; break; - case ACPI_TYPE_BUFFER: - Value = TempDesc->Buffer.Length; - break; - case ACPI_TYPE_STRING: Value = TempDesc->String.Length; break; + case ACPI_TYPE_BUFFER: + + /* Buffer arguments may not be evaluated at this point */ + + Status = AcpiDsGetBufferArguments (TempDesc); + Value = TempDesc->Buffer.Length; + break; + case ACPI_TYPE_PACKAGE: + + /* Package arguments may not be evaluated at this point */ + + Status = AcpiDsGetPackageArguments (TempDesc); Value = TempDesc->Package.Count; break; default: ACPI_ERROR ((AE_INFO, - "Operand is not Buf/Int/Str/Pkg - found type %s", + "Operand must be Buffer/Integer/String/Package - found type %s", AcpiUtGetTypeName (Type))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + /* * Now that we have the size of the object, create a result * object to hold the value diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg2.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg2.c index 53ee147640..2e0b4c915c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg2.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg2.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exoparg2 - AML execution - opcodes with 2 arguments - * $Revision: 1.141 $ + * $Revision: 1.146 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -339,11 +339,6 @@ AcpiExOpcode_2A_2T_1R ( goto Cleanup; } - /* Return the remainder */ - - WalkState->ResultObj = ReturnDesc1; - - Cleanup: /* * Since the remainder is not returned indirectly, remove a reference to @@ -358,6 +353,13 @@ Cleanup: AcpiUtRemoveReference (ReturnDesc1); } + /* Save return object (the remainder) on success */ + + else + { + WalkState->ResultObj = ReturnDesc1; + } + return_ACPI_STATUS (Status); } @@ -612,6 +614,7 @@ Cleanup: if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ReturnDesc); + WalkState->ResultObj = NULL; } return_ACPI_STATUS (Status); @@ -716,9 +719,6 @@ StoreLogicalResult: ReturnDesc->Integer.Value = ACPI_INTEGER_MAX; } - WalkState->ResultObj = ReturnDesc; - - Cleanup: /* Delete return object on error */ @@ -728,6 +728,13 @@ Cleanup: AcpiUtRemoveReference (ReturnDesc); } + /* Save return object on success */ + + else + { + WalkState->ResultObj = ReturnDesc; + } + return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg3.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg3.c index 77a4e915b6..fad6272b2f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg3.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg3.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg3 - AML execution - opcodes with 3 arguments - * $Revision: 1.33 $ + * $Revision: 1.36 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -362,6 +362,7 @@ Cleanup: if (ACPI_FAILURE (Status) || WalkState->ResultObj) { AcpiUtRemoveReference (ReturnDesc); + WalkState->ResultObj = NULL; } /* Set the return object and exit */ diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg6.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg6.c index f65c313f93..2b3bc3cf4c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg6.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg6.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg6 - AML execution - opcodes with 6 arguments - * $Revision: 1.27 $ + * $Revision: 1.30 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -420,8 +420,6 @@ AcpiExOpcode_6A_0T_1R ( goto Cleanup; } - WalkState->ResultObj = ReturnDesc; - Cleanup: @@ -432,5 +430,12 @@ Cleanup: AcpiUtRemoveReference (ReturnDesc); } + /* Save return object on success */ + + else + { + WalkState->ResultObj = ReturnDesc; + } + return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exprep.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exprep.c index 7c024ec11d..27906a309b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exprep.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exprep.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities - * $Revision: 1.141 $ + * $Revision: 1.144 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -511,6 +511,7 @@ AcpiExPrepFieldValue ( ACPI_CREATE_FIELD_INFO *Info) { ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *SecondDesc = NULL; UINT32 Type; ACPI_STATUS Status; @@ -597,6 +598,16 @@ AcpiExPrepFieldValue ( ObjDesc->Field.AccessByteWidth, ObjDesc->BankField.RegionObj, ObjDesc->BankField.BankObj)); + + /* + * Remember location in AML stream of the field unit + * opcode and operands -- since the BankValue + * operands must be evaluated. + */ + SecondDesc = ObjDesc->Common.NextObject; + SecondDesc->Extra.AmlStart = ((ACPI_PARSE_OBJECT*) (Info->DataRegisterNode))->Named.Data; + SecondDesc->Extra.AmlLength = ((ACPI_PARSE_OBJECT*) (Info->DataRegisterNode))->Named.Length; + break; diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exregion.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exregion.c index 306ea5a8e4..8075e064f1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exregion.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exregion.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exregion - ACPI default OpRegion (address space) handlers - * $Revision: 1.99 $ + * $Revision: 1.103 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -245,7 +245,7 @@ AcpiExSystemMemorySpaceHandler ( { ACPI_ERROR ((AE_INFO, "Could not map memory at %8.8X%8.8X, size %X", - ACPI_FORMAT_UINT64 (Address), (UINT32) WindowSize)); + ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) WindowSize)); MemInfo->MappedLength = 0; return_ACPI_STATUS (AE_NO_MEMORY); } @@ -265,7 +265,7 @@ AcpiExSystemMemorySpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", - BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); + BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); /* * Perform the memory read or write @@ -294,11 +294,10 @@ AcpiExSystemMemorySpaceHandler ( *Value = (ACPI_INTEGER) ACPI_GET32 (LogicalAddrPtr); break; -#if ACPI_MACHINE_WIDTH != 16 case 64: *Value = (ACPI_INTEGER) ACPI_GET64 (LogicalAddrPtr); break; -#endif + default: /* BitWidth was already validated */ break; @@ -321,11 +320,9 @@ AcpiExSystemMemorySpaceHandler ( ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value; break; -#if ACPI_MACHINE_WIDTH != 16 case 64: ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value; break; -#endif default: /* BitWidth was already validated */ @@ -378,7 +375,7 @@ AcpiExSystemIoSpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", - BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); + BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); /* Decode the function parameter */ diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresnte.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresnte.c index c7b5a460c5..278858d248 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresnte.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresnte.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresnte - AML Interpreter object resolution - * $Revision: 1.74 $ + * $Revision: 1.78 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -197,9 +197,11 @@ AcpiExResolveNodeToValue ( * Several object types require no further processing: * 1) Device/Thermal objects don't have a "real" subobject, return the Node * 2) Method locals and arguments have a pseudo-Node + * 3) 10/2007: Added method type to assist with Package construction. */ if ((EntryType == ACPI_TYPE_DEVICE) || (EntryType == ACPI_TYPE_THERMAL) || + (EntryType == ACPI_TYPE_METHOD) || (Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { return_ACPI_STATUS (AE_OK); @@ -305,7 +307,6 @@ AcpiExResolveNodeToValue ( /* For these objects, just return the object attached to the Node */ case ACPI_TYPE_MUTEX: - case ACPI_TYPE_METHOD: case ACPI_TYPE_POWER: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_EVENT: @@ -331,12 +332,11 @@ AcpiExResolveNodeToValue ( switch (SourceDesc->Reference.Opcode) { - case AML_LOAD_OP: - - /* This is a DdbHandle */ - /* Return an additional reference to the object */ - + case AML_LOAD_OP: /* This is a DdbHandle */ case AML_REF_OF_OP: + case AML_INDEX_OP: + + /* Return an additional reference to the object */ ObjDesc = SourceDesc; AcpiUtAddReference (ObjDesc); diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresolv.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresolv.c index 61442afda0..6f1c956c58 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresolv.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresolv.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresolv - AML Interpreter object resolution - * $Revision: 1.140 $ + * $Revision: 1.146 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -229,7 +229,6 @@ AcpiExResolveObjectToValue ( { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *StackDesc; - void *TempNode; ACPI_OPERAND_OBJECT *ObjDesc = NULL; UINT16 Opcode; @@ -249,24 +248,6 @@ AcpiExResolveObjectToValue ( switch (Opcode) { - case AML_NAME_OP: - - /* - * Convert name reference to a namespace node - * Then, AcpiExResolveNodeToValue can be used to get the value - */ - TempNode = StackDesc->Reference.Object; - - /* Delete the Reference Object */ - - AcpiUtRemoveReference (StackDesc); - - /* Return the namespace node */ - - (*StackPtr) = TempNode; - break; - - case AML_LOCAL_OP: case AML_ARG_OP: @@ -299,17 +280,27 @@ AcpiExResolveObjectToValue ( { case ACPI_TYPE_BUFFER_FIELD: - /* Just return - leave the Reference on the stack */ + /* Just return - do not dereference */ break; case ACPI_TYPE_PACKAGE: + /* If method call or CopyObject - do not dereference */ + + if ((WalkState->Opcode == AML_INT_METHODCALL_OP) || + (WalkState->Opcode == AML_COPY_OP)) + { + break; + } + + /* Otherwise, dereference the PackageIndex to a package element */ + ObjDesc = *StackDesc->Reference.Where; if (ObjDesc) { /* - * Valid obj descriptor, copy pointer to return value + * Valid object descriptor, copy pointer to return value * (i.e., dereference the package index) * Delete the ref object, increment the returned object */ @@ -320,11 +311,11 @@ AcpiExResolveObjectToValue ( else { /* - * A NULL object descriptor means an unitialized element of + * A NULL object descriptor means an uninitialized element of * the package, can't dereference it */ ACPI_ERROR ((AE_INFO, - "Attempt to deref an Index to NULL pkg element Idx=%p", + "Attempt to dereference an Index to NULL package element Idx=%p", StackDesc)); Status = AE_AML_UNINITIALIZED_ELEMENT; } @@ -336,7 +327,7 @@ AcpiExResolveObjectToValue ( /* Invalid reference object */ ACPI_ERROR ((AE_INFO, - "Unknown TargetType %X in Index/Reference obj %p", + "Unknown TargetType %X in Index/Reference object %p", StackDesc->Reference.TargetType, StackDesc)); Status = AE_AML_INTERNAL; break; @@ -348,7 +339,7 @@ AcpiExResolveObjectToValue ( case AML_DEBUG_OP: case AML_LOAD_OP: - /* Just leave the object as-is */ + /* Just leave the object as-is, do not dereference */ break; @@ -486,10 +477,10 @@ AcpiExResolveMultiple ( } /* - * For reference objects created via the RefOf or Index operators, - * we need to get to the base object (as per the ACPI specification - * of the ObjectType and SizeOf operators). This means traversing - * the list of possibly many nested references. + * For reference objects created via the RefOf, Index, or Load/LoadTable + * operators, we need to get to the base object (as per the ACPI + * specification of the ObjectType and SizeOf operators). This means + * traversing the list of possibly many nested references. */ while (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REFERENCE) { @@ -567,6 +558,12 @@ AcpiExResolveMultiple ( break; + case AML_LOAD_OP: + + Type = ACPI_TYPE_DDB_HANDLE; + goto Exit; + + case AML_LOCAL_OP: case AML_ARG_OP: diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresop.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresop.c index c087c9b258..f06742cbc7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresop.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresop.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresop - AML Interpreter operand/object resolution - * $Revision: 1.93 $ + * $Revision: 1.96 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -224,7 +224,6 @@ AcpiExResolveOperands ( ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status = AE_OK; UINT8 ObjectType; - void *TempNode; UINT32 ArgTypes; const ACPI_OPCODE_INFO *OpInfo; UINT32 ThisArgType; @@ -333,7 +332,6 @@ AcpiExResolveOperands ( /*lint -fallthrough */ - case AML_NAME_OP: case AML_INDEX_OP: case AML_REF_OF_OP: case AML_ARG_OP: @@ -420,15 +418,6 @@ AcpiExResolveOperands ( { return_ACPI_STATUS (Status); } - - if (ObjDesc->Reference.Opcode == AML_NAME_OP) - { - /* Convert a named reference to the actual named object */ - - TempNode = ObjDesc->Reference.Object; - AcpiUtRemoveReference (ObjDesc); - (*StackPtr) = TempNode; - } goto NextOperand; diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstore.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstore.c index bc3ee25f39..6c16fcff0c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstore.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstore.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exstore - AML Interpreter object store support - * $Revision: 1.200 $ + * $Revision: 1.210 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -169,8 +169,13 @@ AcpiExDoDebugObject ( ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", - Level, " ")); + /* Print line header as long as we are not in the middle of an object display */ + + if (!((Level > 0) && Index == 0)) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", + Level, " ")); + } /* Display index for package output only */ @@ -182,13 +187,13 @@ AcpiExDoDebugObject ( if (!SourceDesc) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "\n")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n")); return_VOID; } if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s ", AcpiUtGetObjectTypeName (SourceDesc))); if (!AcpiUtValidInternalObject (SourceDesc)) @@ -210,6 +215,8 @@ AcpiExDoDebugObject ( return_VOID; } + /* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */ + switch (ACPI_GET_OBJECT_TYPE (SourceDesc)) { case ACPI_TYPE_INTEGER: @@ -233,7 +240,7 @@ AcpiExDoDebugObject ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n", (UINT32) SourceDesc->Buffer.Length)); ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer, - (SourceDesc->Buffer.Length < 32) ? SourceDesc->Buffer.Length : 32); + (SourceDesc->Buffer.Length < 256) ? SourceDesc->Buffer.Length : 256); break; case ACPI_TYPE_STRING: @@ -244,7 +251,7 @@ AcpiExDoDebugObject ( case ACPI_TYPE_PACKAGE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Contains 0x%.2X Elements]\n", SourceDesc->Package.Count)); /* Output the entire contents of the package */ @@ -266,12 +273,55 @@ AcpiExDoDebugObject ( } else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]", AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode))); } + if (SourceDesc->Reference.Opcode == AML_LOAD_OP) /* Load and LoadTable */ + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, + " Table OwnerId %p\n", SourceDesc->Reference.Object)); + break; + } - if (SourceDesc->Reference.Object) + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, " ")); + + /* Check for valid node first, then valid object */ + + if (SourceDesc->Reference.Node) + { + if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) != + ACPI_DESC_TYPE_NAMED) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, + " %p - Not a valid namespace node\n", + SourceDesc->Reference.Node)); + } + else + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Node %p [%4.4s] ", + SourceDesc->Reference.Node, (SourceDesc->Reference.Node)->Name.Ascii)); + + switch ((SourceDesc->Reference.Node)->Type) + { + /* These types have no attached object */ + + case ACPI_TYPE_DEVICE: + AcpiOsPrintf ("Device\n"); + break; + + case ACPI_TYPE_THERMAL: + AcpiOsPrintf ("Thermal Zone\n"); + break; + + default: + AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object, + Level+4, 0); + break; + } + } + } + else if (SourceDesc->Reference.Object) { if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) == ACPI_DESC_TYPE_NAMED) @@ -285,17 +335,12 @@ AcpiExDoDebugObject ( AcpiExDoDebugObject (SourceDesc->Reference.Object, Level+4, 0); } } - else if (SourceDesc->Reference.Node) - { - AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object, - Level+4, 0); - } break; default: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n", - SourceDesc, AcpiUtGetObjectTypeName (SourceDesc))); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n", + SourceDesc)); break; } @@ -404,7 +449,6 @@ AcpiExStore ( */ switch (RefDesc->Reference.Opcode) { - case AML_NAME_OP: case AML_REF_OF_OP: /* Storing an object into a Name "container" */ @@ -509,10 +553,23 @@ AcpiExStoreObjectToIndex ( */ ObjDesc = *(IndexDesc->Reference.Where); - Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); - if (ACPI_FAILURE (Status)) + if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE && + SourceDesc->Reference.Opcode == AML_LOAD_OP) { - return_ACPI_STATUS (Status); + /* This is a DDBHandle, just add a reference to it */ + + AcpiUtAddReference (SourceDesc); + NewDesc = SourceDesc; + } + else + { + /* Normal object, copy it */ + + Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } if (ObjDesc) @@ -677,10 +734,18 @@ AcpiExStoreObjectToNode ( /* If no implicit conversion, drop into the default case below */ - if ((!ImplicitConversion) || (WalkState->Opcode == AML_COPY_OP)) + if ((!ImplicitConversion) || + ((WalkState->Opcode == AML_COPY_OP) && + (TargetType != ACPI_TYPE_LOCAL_REGION_FIELD) && + (TargetType != ACPI_TYPE_LOCAL_BANK_FIELD) && + (TargetType != ACPI_TYPE_LOCAL_INDEX_FIELD))) { - /* Force execution of default (no implicit conversion) */ - + /* + * Force execution of default (no implicit conversion). Note: + * CopyObject does not perform an implicit conversion, as per the ACPI + * spec -- except in case of region/bank/index fields -- because these + * objects must retain their original type permanently. + */ TargetType = ACPI_TYPE_ANY; } diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstoren.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstoren.c index 452563ff44..b93bd1527d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstoren.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstoren.c @@ -3,7 +3,7 @@ * * Module Name: exstoren - AML Interpreter object store support, * Store to Node (namespace object) - * $Revision: 1.70 $ + * $Revision: 1.72 $ * *****************************************************************************/ @@ -11,7 +11,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstorob.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstorob.c index 4810c0b860..3057ea6e65 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstorob.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstorob.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exstorob - AML Interpreter object store support, store to object - * $Revision: 1.61 $ + * $Revision: 1.63 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exsystem.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exsystem.c index 3f6852cd3d..a3c6424c76 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exsystem.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exsystem.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exsystem - Interface to OS services - * $Revision: 1.92 $ + * $Revision: 1.95 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -119,7 +119,6 @@ #include "acpi.h" #include "acinterp.h" -#include "acevents.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exsystem") diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exutils.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exutils.c index 7b15fb1431..3314fa71be 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exutils.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exutils - interpreter/scanner utilities - * $Revision: 1.125 $ + * $Revision: 1.131 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -136,7 +136,6 @@ #include "acpi.h" #include "acinterp.h" #include "amlcode.h" -#include "acevents.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exutils") @@ -320,9 +319,10 @@ AcpiExTruncateFor32bitTable ( /* * Object must be a valid number and we must be executing - * a control method + * a control method. NS node could be there for AML_INT_NAMEPATH_OP. */ if ((!ObjDesc) || + (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) || (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)) { return; @@ -346,44 +346,42 @@ AcpiExTruncateFor32bitTable ( * PARAMETERS: FieldFlags - Flags with Lock rule: * AlwaysLock or NeverLock * - * RETURN: TRUE/FALSE indicating whether the lock was actually acquired + * RETURN: None * - * DESCRIPTION: Obtain the global lock and keep track of this fact via two - * methods. A global variable keeps the state of the lock, and - * the state is returned to the caller. + * DESCRIPTION: Obtain the ACPI hardware Global Lock, only if the field + * flags specifiy that it is to be obtained before field access. * ******************************************************************************/ -BOOLEAN +void AcpiExAcquireGlobalLock ( UINT32 FieldFlags) { - BOOLEAN Locked = FALSE; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (ExAcquireGlobalLock); - /* Only attempt lock if the AlwaysLock bit is set */ + /* Only use the lock if the AlwaysLock bit is set */ - if (FieldFlags & AML_FIELD_LOCK_RULE_MASK) + if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK)) { - /* We should attempt to get the lock, wait forever */ - - Status = AcpiEvAcquireGlobalLock (ACPI_WAIT_FOREVER); - if (ACPI_SUCCESS (Status)) - { - Locked = TRUE; - } - else - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not acquire Global Lock")); - } + return_VOID; } - return_UINT8 (Locked); + /* Attempt to get the global lock, wait forever */ + + Status = AcpiExAcquireMutexObject (ACPI_WAIT_FOREVER, + AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ()); + + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not acquire Global Lock")); + } + + return_VOID; } @@ -391,18 +389,18 @@ AcpiExAcquireGlobalLock ( * * FUNCTION: AcpiExReleaseGlobalLock * - * PARAMETERS: LockedByMe - Return value from corresponding call to - * AcquireGlobalLock. + * PARAMETERS: FieldFlags - Flags with Lock rule: + * AlwaysLock or NeverLock * * RETURN: None * - * DESCRIPTION: Release the global lock if it is locked. + * DESCRIPTION: Release the ACPI hardware Global Lock * ******************************************************************************/ void AcpiExReleaseGlobalLock ( - BOOLEAN LockedByMe) + UINT32 FieldFlags) { ACPI_STATUS Status; @@ -410,20 +408,22 @@ AcpiExReleaseGlobalLock ( ACPI_FUNCTION_TRACE (ExReleaseGlobalLock); - /* Only attempt unlock if the caller locked it */ + /* Only use the lock if the AlwaysLock bit is set */ - if (LockedByMe) + if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK)) { - /* OK, now release the lock */ + return_VOID; + } - Status = AcpiEvReleaseGlobalLock (); - if (ACPI_FAILURE (Status)) - { - /* Report the error, but there isn't much else we can do */ + /* Release the global lock */ - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not release ACPI Global Lock")); - } + Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex); + if (ACPI_FAILURE (Status)) + { + /* Report the error, but there isn't much else we can do */ + + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not release Global Lock")); } return_VOID; diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psargs.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psargs.c index a5aca6460a..6e9bf9d6ca 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psargs.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psargs.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psargs - Parse AML opcode arguments - * $Revision: 1.91 $ + * $Revision: 1.95 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -329,12 +329,12 @@ AcpiPsGetNextNamepath ( ACPI_PARSE_OBJECT *Arg, BOOLEAN PossibleMethodCall) { + ACPI_STATUS Status; char *Path; ACPI_PARSE_OBJECT *NameOp; - ACPI_STATUS Status; ACPI_OPERAND_OBJECT *MethodDesc; ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE ScopeInfo; + UINT8 *Start = ParserState->Aml; ACPI_FUNCTION_TRACE (PsGetNextNamepath); @@ -351,23 +351,16 @@ AcpiPsGetNextNamepath ( return_ACPI_STATUS (AE_OK); } - /* Setup search scope info */ - - ScopeInfo.Scope.Node = NULL; - Node = ParserState->StartNode; - if (Node) - { - ScopeInfo.Scope.Node = Node; - } - /* - * Lookup the name in the internal namespace. We don't want to add - * anything new to the namespace here, however, so we use MODE_EXECUTE. + * Lookup the name in the internal namespace, starting with the current + * scope. We don't want to add anything new to the namespace here, + * however, so we use MODE_EXECUTE. * Allow searching of the parent tree, but don't open a new scope - * we just want to lookup the object (must be mode EXECUTE to perform * the upsearch) */ - Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); /* @@ -378,6 +371,18 @@ AcpiPsGetNextNamepath ( PossibleMethodCall && (Node->Type == ACPI_TYPE_METHOD)) { + if (WalkState->Op->Common.AmlOpcode == AML_UNLOAD_OP) + { + /* + * AcpiPsGetNextNamestring has increased the AML pointer, + * so we need to restore the saved AML pointer for method call. + */ + WalkState->ParserState.Aml = Start; + WalkState->ArgCount = 1; + AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); + return_ACPI_STATUS (AE_OK); + } + /* This name is actually a control method invocation */ MethodDesc = AcpiNsGetAttachedObject (Node); @@ -824,7 +829,26 @@ AcpiPsGetNextArg ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 0); + /* To support SuperName arg of Unload */ + + if (WalkState->Op->Common.AmlOpcode == AML_UNLOAD_OP) + { + Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 1); + + /* + * If the SuperName arg of Unload is a method call, + * we have restored the AML pointer, just free this Arg + */ + if (Arg->Common.AmlOpcode == AML_INT_METHODCALL_OP) + { + AcpiPsFreeOp (Arg); + Arg = NULL; + } + } + else + { + Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 0); + } } else { diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psloop.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psloop.c index 2f27961f86..6760d5c125 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psloop.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psloop.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psloop - Main AML parse loop - * $Revision: 1.13 $ + * $Revision: 1.19 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -274,6 +274,7 @@ AcpiPsBuildNamedOp ( UnnamedOp->Common.Value.Arg = NULL; + UnnamedOp->Common.ArgListLength = 0; UnnamedOp->Common.AmlOpcode = WalkState->Opcode; /* @@ -337,7 +338,8 @@ AcpiPsBuildNamedOp ( AcpiPsAppendArg (*Op, UnnamedOp->Common.Value.Arg); AcpiGbl_Depth++; - if ((*Op)->Common.AmlOpcode == AML_REGION_OP) + if ((*Op)->Common.AmlOpcode == AML_REGION_OP || + (*Op)->Common.AmlOpcode == AML_DATA_REGION_OP) { /* * Defer final parsing of an OperationRegion body, because we don't @@ -380,6 +382,9 @@ AcpiPsCreateOp ( ACPI_STATUS Status = AE_OK; ACPI_PARSE_OBJECT *Op; ACPI_PARSE_OBJECT *NamedOp = NULL; + ACPI_PARSE_OBJECT *ParentScope; + UINT8 ArgumentCount; + const ACPI_OPCODE_INFO *OpInfo; ACPI_FUNCTION_TRACE_PTR (PsCreateOp, WalkState); @@ -425,7 +430,35 @@ AcpiPsCreateOp ( Op->Named.Length = 0; } - AcpiPsAppendArg (AcpiPsGetParentScope (&(WalkState->ParserState)), Op); + if (WalkState->Opcode == AML_BANK_FIELD_OP) + { + /* + * Backup to beginning of BankField declaration + * BodyLength is unknown until we parse the body + */ + Op->Named.Data = AmlOpStart; + Op->Named.Length = 0; + } + + ParentScope = AcpiPsGetParentScope (&(WalkState->ParserState)); + AcpiPsAppendArg (ParentScope, Op); + + if (ParentScope) + { + OpInfo = AcpiPsGetOpcodeInfo (ParentScope->Common.AmlOpcode); + if (OpInfo->Flags & AML_HAS_TARGET) + { + ArgumentCount = AcpiPsGetArgumentCount (OpInfo->Type); + if (ParentScope->Common.ArgListLength > ArgumentCount) + { + Op->Common.Flags |= ACPI_PARSEOP_TARGET; + } + } + else if (ParentScope->Common.AmlOpcode == AML_INCREMENT_OP) + { + Op->Common.Flags |= ACPI_PARSEOP_TARGET; + } + } if (WalkState->DescendingCallback != NULL) { @@ -716,15 +749,6 @@ AcpiPsCompleteOp ( { AcpiPsPopScope (&(WalkState->ParserState), Op, &WalkState->ArgTypes, &WalkState->ArgCount); - - if ((*Op)->Common.AmlOpcode != AML_WHILE_OP) - { - Status2 = AcpiDsResultStackPop (WalkState); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } - } } /* Close this iteration of the While loop */ @@ -758,11 +782,6 @@ AcpiPsCompleteOp ( { return_ACPI_STATUS (Status2); } - Status2 = AcpiDsResultStackPop (WalkState); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } AcpiUtDeleteGenericState ( AcpiUtPopGenericState (&WalkState->ControlState)); @@ -1124,7 +1143,8 @@ AcpiPsParseLoop ( AcpiGbl_Depth--; } - if (Op->Common.AmlOpcode == AML_REGION_OP) + if (Op->Common.AmlOpcode == AML_REGION_OP || + Op->Common.AmlOpcode == AML_DATA_REGION_OP) { /* * Skip parsing of control method or opregion body, @@ -1149,6 +1169,16 @@ AcpiPsParseLoop ( Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); } + if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP) + { + /* + * Backup to beginning of BankField declaration + * + * BodyLength is unknown until we parse the body + */ + Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); + } + /* This op complete, notify the dispatcher */ if (WalkState->AscendingCallback != NULL) diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psopcode.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psopcode.c index 833073f612..0f5086e0f2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psopcode.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psopcode.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psopcode - Parser/Interpreter opcode information table - * $Revision: 1.97 $ + * $Revision: 1.103 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -125,6 +125,9 @@ ACPI_MODULE_NAME ("psopcode") +static const UINT8 AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6}; + + /******************************************************************************* * * NAME: AcpiGbl_AmlOpInfo @@ -362,7 +365,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] = /* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), -/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), +/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, ACPI_TYPE_LOCAL_BANK_FIELD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD | AML_DEFER), /* Internal opcodes that map to invalid AML opcodes */ @@ -397,7 +400,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] = /* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), /* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), /* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), -/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), /* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE), /* ACPI 3.0 opcodes */ @@ -559,3 +562,28 @@ AcpiPsGetOpcodeName ( #endif } + +/******************************************************************************* + * + * FUNCTION: AcpiPsGetArgumentCount + * + * PARAMETERS: OpType - Type associated with the AML opcode + * + * RETURN: Argument count + * + * DESCRIPTION: Obtain the number of expected arguments for an AML opcode + * + ******************************************************************************/ + +UINT8 +AcpiPsGetArgumentCount ( + UINT32 OpType) +{ + + if (OpType <= AML_TYPE_EXEC_6A_0T_1R) + { + return (AcpiGbl_ArgumentCount[OpType]); + } + + return (0); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psparse.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psparse.c index 7da4aa90a2..135111966d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psparse.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psparse.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines - * $Revision: 1.169 $ + * $Revision: 1.176 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -288,6 +288,7 @@ AcpiPsCompleteThisOp ( (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) { ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); @@ -434,22 +435,14 @@ AcpiPsNextParseState ( ParserState->Aml = WalkState->AmlLastWhile; WalkState->ControlState->Common.Value = FALSE; - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_BREAK; - } + Status = AE_CTRL_BREAK; break; case AE_CTRL_CONTINUE: ParserState->Aml = WalkState->AmlLastWhile; - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_CONTINUE; - } + Status = AE_CTRL_CONTINUE; break; @@ -472,11 +465,7 @@ AcpiPsNextParseState ( * Just close out this package */ ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState); - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_PENDING; - } + Status = AE_CTRL_PENDING; break; @@ -642,7 +631,8 @@ AcpiPsParseAml ( if ((Status == AE_ALREADY_EXISTS) && (!WalkState->MethodDesc->Method.Mutex)) { - ACPI_INFO ((AE_INFO, "Marking method %4.4s as Serialized", + ACPI_INFO ((AE_INFO, + "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", WalkState->MethodNode->Name.Ascii)); /* @@ -701,6 +691,25 @@ AcpiPsParseAml ( */ if (!PreviousWalkState->ReturnDesc) { + /* + * In slack mode execution, if there is no return value + * we should implicitly return zero (0) as a default value. + */ + if (AcpiGbl_EnableInterpreterSlack && + !PreviousWalkState->ImplicitReturnObj) + { + PreviousWalkState->ImplicitReturnObj = + AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!PreviousWalkState->ImplicitReturnObj) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + PreviousWalkState->ImplicitReturnObj->Integer.Value = 0; + } + + /* Restart the calling control method */ + Status = AcpiDsRestartControlMethod (WalkState, PreviousWalkState->ImplicitReturnObj); } diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psscope.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psscope.c index aa57aa3bc5..25ac459e33 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psscope.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psscope.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psscope - Parser scope stack management routines - * $Revision: 1.46 $ + * $Revision: 1.48 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/pstree.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/pstree.c index d7f62ebecc..22a12cb74d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/pstree.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/pstree.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: pstree - Parser op tree manipulation/traversal/search - * $Revision: 1.49 $ + * $Revision: 1.52 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -267,6 +267,8 @@ AcpiPsAppendArg ( { Arg->Common.Parent = Op; Arg = Arg->Common.Next; + + Op->Common.ArgListLength++; } } diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psutils.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psutils.c index 63105b4615..5c329a2d56 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psutils.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psutils - Parser miscellaneous utilities (Parser only) - * $Revision: 1.69 $ + * $Revision: 1.71 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/pswalk.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/pswalk.c index 439f842b53..5944635293 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/pswalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/pswalk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: pswalk - Parser routines to walk parsed op tree(s) - * $Revision: 1.77 $ + * $Revision: 1.79 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psxface.c b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psxface.c index a5dfa183b1..d1b5e8c67a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psxface - Parser external interfaces - * $Revision: 1.92 $ + * $Revision: 1.94 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c index 81cc250ce5..810819d145 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 1.204 $ + * $Revision: 1.209 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -294,7 +294,7 @@ AcpiNsRootInitialize ( if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0) { - AcpiGbl_GlobalLockMutex = ObjDesc->Mutex.OsMutex; + AcpiGbl_GlobalLockMutex = ObjDesc; /* Create additional counting semaphore for global lock */ @@ -679,44 +679,67 @@ AcpiNsLookup ( return_ACPI_STATUS (Status); } - /* - * Sanity typecheck of the target object: - * - * If 1) This is the last segment (NumSegments == 0) - * 2) And we are looking for a specific type - * (Not checking for TYPE_ANY) - * 3) Which is not an alias - * 4) Which is not a local type (TYPE_SCOPE) - * 5) And the type of target object is known (not TYPE_ANY) - * 6) And target object does not match what we are looking for - * - * Then we have a type mismatch. Just warn and ignore it. - */ - if ((NumSegments == 0) && - (TypeToCheckFor != ACPI_TYPE_ANY) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && - (ThisNode->Type != ACPI_TYPE_ANY) && - (ThisNode->Type != TypeToCheckFor)) - { - /* Complain about a type mismatch */ + /* More segments to follow? */ - ACPI_WARNING ((AE_INFO, - "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", - ACPI_CAST_PTR (char, &SimpleName), - AcpiUtGetTypeName (ThisNode->Type), - AcpiUtGetTypeName (TypeToCheckFor))); + if (NumSegments > 0) + { + /* + * If we have an alias to an object that opens a scope (such as a + * device or processor), we need to dereference the alias here so that + * we can access any children of the original node (via the remaining + * segments). + */ + if (ThisNode->Type == ACPI_TYPE_LOCAL_ALIAS) + { + if (AcpiNsOpensScope (((ACPI_NAMESPACE_NODE *) ThisNode->Object)->Type)) + { + ThisNode = (ACPI_NAMESPACE_NODE *) ThisNode->Object; + } + } } - /* - * If this is the last name segment and we are not looking for a - * specific type, but the type of found object is known, use that type - * to see if it opens a scope. - */ - if ((NumSegments == 0) && (Type == ACPI_TYPE_ANY)) + /* Special handling for the last segment (NumSegments == 0) */ + + else { - Type = ThisNode->Type; + /* + * Sanity typecheck of the target object: + * + * If 1) This is the last segment (NumSegments == 0) + * 2) And we are looking for a specific type + * (Not checking for TYPE_ANY) + * 3) Which is not an alias + * 4) Which is not a local type (TYPE_SCOPE) + * 5) And the type of target object is known (not TYPE_ANY) + * 6) And target object does not match what we are looking for + * + * Then we have a type mismatch. Just warn and ignore it. + */ + if ((TypeToCheckFor != ACPI_TYPE_ANY) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && + (ThisNode->Type != ACPI_TYPE_ANY) && + (ThisNode->Type != TypeToCheckFor)) + { + /* Complain about a type mismatch */ + + ACPI_WARNING ((AE_INFO, + "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", + ACPI_CAST_PTR (char, &SimpleName), + AcpiUtGetTypeName (ThisNode->Type), + AcpiUtGetTypeName (TypeToCheckFor))); + } + + /* + * If this is the last name segment and we are not looking for a + * specific type, but the type of found object is known, use that type + * to (later) see if it opens a scope. + */ + if (Type == ACPI_TYPE_ANY) + { + Type = ThisNode->Type; + } } /* Point to next name segment and make this node current */ diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c index 322e0b8117..4fef3c1426 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities - * $Revision: 1.106 $ + * $Revision: 1.109 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -142,6 +142,9 @@ AcpiNsCreateNode ( UINT32 Name) { ACPI_NAMESPACE_NODE *Node; +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + UINT32 Temp; +#endif ACPI_FUNCTION_TRACE (NsCreateNode); @@ -155,6 +158,14 @@ AcpiNsCreateNode ( ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalAllocated++); +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + Temp = AcpiGbl_NsNodeList->TotalAllocated - AcpiGbl_NsNodeList->TotalFreed; + if (Temp > AcpiGbl_NsNodeList->MaxOccupied) + { + AcpiGbl_NsNodeList->MaxOccupied = Temp; + } +#endif + Node->Name.Integer = Name; ACPI_SET_DESCRIPTOR_TYPE (Node, ACPI_DESC_TYPE_NAMED); return_PTR (Node); diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c index 862fae997c..1b536c0509 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 1.181 $ + * $Revision: 1.184 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -358,7 +358,7 @@ AcpiNsDumpOneObject ( AcpiOsPrintf ("ID %X Len %.4X Addr %p\n", ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, - (char *) ObjDesc->Processor.Address); + ACPI_CAST_PTR (void, ObjDesc->Processor.Address)); break; @@ -438,7 +438,7 @@ AcpiNsDumpOneObject ( if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), ObjDesc->Region.Length); } else diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c index c74b4c386f..a5584cab95 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 1.19 $ + * $Revision: 1.21 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c index 37fac9ed84..9eb0e75925 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nseval - Object evaluation, includes control method execution - * $Revision: 1.143 $ + * $Revision: 1.145 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c index 12e1ac5d32..0c4e20082a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsinit - namespace initialization - * $Revision: 1.85 $ + * $Revision: 1.88 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -346,6 +346,10 @@ AcpiNsInitOneObject ( Info->FieldCount++; break; + case ACPI_TYPE_LOCAL_BANK_FIELD: + Info->FieldCount++; + break; + case ACPI_TYPE_BUFFER: Info->BufferCount++; break; @@ -391,6 +395,12 @@ AcpiNsInitOneObject ( Status = AcpiDsGetBufferFieldArguments (ObjDesc); break; + case ACPI_TYPE_LOCAL_BANK_FIELD: + + Info->FieldInit++; + Status = AcpiDsGetBankFieldArguments (ObjDesc); + break; + case ACPI_TYPE_BUFFER: Info->BufferInit++; diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c index 28acb7ee31..c1f879d578 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsload - namespace loading/expanding/contracting procedures - * $Revision: 1.79 $ + * $Revision: 1.83 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -195,14 +195,14 @@ AcpiNsLoadTable ( goto Unlock; } - Status = AcpiNsParseTable (TableIndex, Node->Child); + Status = AcpiNsParseTable (TableIndex, Node); if (ACPI_SUCCESS (Status)) { AcpiTbSetTableLoadedFlag (TableIndex, TRUE); } else { - AcpiTbReleaseOwnerId (TableIndex); + (void) AcpiTbReleaseOwnerId (TableIndex); } Unlock: diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c index 236776c994..1d220bebaa 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsnames - Name manipulation and search - * $Revision: 1.97 $ + * $Revision: 1.101 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -277,6 +277,12 @@ AcpiNsGetPathnameLength ( while (NextNode && (NextNode != AcpiGbl_RootNode)) { + if (ACPI_GET_DESCRIPTOR_TYPE (NextNode) != ACPI_DESC_TYPE_NAMED) + { + ACPI_ERROR ((AE_INFO, "Invalid NS Node (%p) while traversing path", + NextNode)); + return 0; + } Size += ACPI_PATH_SEGMENT_LENGTH; NextNode = AcpiNsGetParentNode (NextNode); } diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c index a59f0c0748..d86a4fa34d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c @@ -2,7 +2,7 @@ * * Module Name: nsobject - Utilities for objects attached to namespace * table entries - * $Revision: 1.97 $ + * $Revision: 1.99 $ * ******************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c index ce44593376..4faab91773 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsparse - namespace interface to AML parser - * $Revision: 1.15 $ + * $Revision: 1.19 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -143,7 +143,8 @@ ACPI_STATUS AcpiNsOneCompleteParse ( ACPI_NATIVE_UINT PassNumber, - ACPI_NATIVE_UINT TableIndex) + ACPI_NATIVE_UINT TableIndex, + ACPI_NAMESPACE_NODE *StartNode) { ACPI_PARSE_OBJECT *ParseRoot; ACPI_STATUS Status; @@ -199,14 +200,25 @@ AcpiNsOneCompleteParse ( AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, - AmlStart, AmlLength, NULL, (UINT8) PassNumber); + AmlStart, (UINT32) AmlLength, NULL, (UINT8) PassNumber); } if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); - AcpiPsDeleteParseTree (ParseRoot); - return_ACPI_STATUS (Status); + goto Cleanup; + } + + /* StartNode is the default location to load the table */ + + if (StartNode && StartNode != AcpiGbl_RootNode) + { + Status = AcpiDsScopeStackPush (StartNode, ACPI_TYPE_METHOD, WalkState); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + goto Cleanup; + } } /* Parse the AML */ @@ -214,6 +226,7 @@ AcpiNsOneCompleteParse ( ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber)); Status = AcpiPsParseAml (WalkState); +Cleanup: AcpiPsDeleteParseTree (ParseRoot); return_ACPI_STATUS (Status); } @@ -254,7 +267,7 @@ AcpiNsParseTable ( * performs another complete parse of the AML. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, TableIndex); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, TableIndex, StartNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -270,7 +283,7 @@ AcpiNsParseTable ( * parse objects are all cached. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, StartNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c index 3701671354..2b94b61c88 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nssearch - Namespace search - * $Revision: 1.120 $ + * $Revision: 1.122 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c index 6fc524cbef..0eab329643 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c @@ -2,7 +2,7 @@ * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * parents and siblings and Scope manipulation - * $Revision: 1.154 $ + * $Revision: 1.157 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -120,7 +120,6 @@ #include "acpi.h" #include "acnamesp.h" #include "amlcode.h" -#include "actables.h" #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsutils") diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c index fd083ca062..c946835d06 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nswalk - Functions for walking the ACPI namespace - * $Revision: 1.44 $ + * $Revision: 1.47 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -160,10 +160,7 @@ AcpiNsGetNextNode ( { /* It's really the parent's _scope_ that we want */ - if (ParentNode->Child) - { - NextNode = ParentNode->Child; - } + NextNode = ParentNode->Child; } else diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c index b061c91d5d..d5e086386b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c @@ -2,7 +2,7 @@ * * Module Name: nsxfeval - Public interfaces to the ACPI subsystem * ACPI Object evaluation interfaces - * $Revision: 1.29 $ + * $Revision: 1.33 $ * ******************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -557,6 +557,7 @@ AcpiNsGetDeviceCallback ( ACPI_DEVICE_ID Hid; ACPI_COMPATIBLE_ID_LIST *Cid; ACPI_NATIVE_UINT i; + BOOLEAN Found; Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); @@ -585,10 +586,14 @@ AcpiNsGetDeviceCallback ( return (AE_CTRL_DEPTH); } - if (!(Flags & ACPI_STA_DEVICE_PRESENT)) + if (!(Flags & ACPI_STA_DEVICE_PRESENT) && + !(Flags & ACPI_STA_DEVICE_FUNCTIONING)) { - /* Don't examine children of the device if not present */ - + /* + * Don't examine the children of the device only when the + * device is neither present nor functional. See ACPI spec, + * description of _STA for more information. + */ return (AE_CTRL_DEPTH); } #endif @@ -608,8 +613,10 @@ AcpiNsGetDeviceCallback ( if (ACPI_STRNCMP (Hid.Value, Info->Hid, sizeof (Hid.Value)) != 0) { - /* Get the list of Compatible IDs */ - + /* + * HID does not match, attempt match within the + * list of Compatible IDs (CIDs) + */ Status = AcpiUtExecute_CID (Node, &Cid); if (Status == AE_NOT_FOUND) { @@ -622,19 +629,29 @@ AcpiNsGetDeviceCallback ( /* Walk the CID list */ + Found = FALSE; for (i = 0; i < Cid->Count; i++) { if (ACPI_STRNCMP (Cid->Id[i].Value, Info->Hid, - sizeof (ACPI_COMPATIBLE_ID)) != 0) + sizeof (ACPI_COMPATIBLE_ID)) == 0) { - ACPI_FREE (Cid); - return (AE_OK); + /* Found a matching CID */ + + Found = TRUE; + break; } } + ACPI_FREE (Cid); + if (!Found) + { + return (AE_OK); + } } } + /* We have a valid device, invoke the user function */ + Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue); return (Status); @@ -662,7 +679,7 @@ AcpiNsGetDeviceCallback ( * value is returned to the caller. * * This is a wrapper for WalkNamespace, but the callback performs - * additional filtering. Please see AcpiGetDeviceCallback. + * additional filtering. Please see AcpiNsGetDeviceCallback. * ******************************************************************************/ diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c index 79e6f2da45..09db481592 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c @@ -2,7 +2,7 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces - * $Revision: 1.111 $ + * $Revision: 1.113 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c index 799729b1a4..3f03426064 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c @@ -2,7 +2,7 @@ * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces - * $Revision: 1.121 $ + * $Revision: 1.123 $ * ******************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c index 5172e77f1b..a51156e608 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsaddr - Address resource descriptors (16/32/64) - * $Revision: 1.49 $ + * $Revision: 1.51 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c b/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c index 97fd5a3e71..97dabe8287 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscalc - Calculate stream and list lengths - * $Revision: 1.79 $ + * $Revision: 1.84 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -158,7 +158,7 @@ static UINT8 AcpiRsCountSetBits ( UINT16 BitField) { - UINT8 BitsSet; + ACPI_NATIVE_UINT BitsSet; ACPI_FUNCTION_ENTRY (); @@ -168,10 +168,10 @@ AcpiRsCountSetBits ( { /* Zero the least significant bit that is set */ - BitField &= (BitField - 1); + BitField &= (UINT16) (BitField - 1); } - return (BitsSet); + return ((UINT8) BitsSet); } @@ -312,6 +312,28 @@ AcpiRsGetAmlLength ( */ switch (Resource->Type) { + case ACPI_RESOURCE_TYPE_IRQ: + + /* Length can be 3 or 2 */ + + if (Resource->Data.Irq.DescriptorLength == 2) + { + TotalSize--; + } + break; + + + case ACPI_RESOURCE_TYPE_START_DEPENDENT: + + /* Length can be 1 or 0 */ + + if (Resource->Data.Irq.DescriptorLength == 0) + { + TotalSize--; + } + break; + + case ACPI_RESOURCE_TYPE_VENDOR: /* * Vendor Defined Resource: diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c b/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c index 1cb836adc7..b7c2b8196d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscreate - Create resource lists/tables - * $Revision: 1.77 $ + * $Revision: 1.79 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c index 1f90cf7b42..a6784d2a8d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsdump - Functions to display the resource structures. - * $Revision: 1.61 $ + * $Revision: 1.64 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -200,9 +200,10 @@ AcpiRsDumpDescriptor ( * ******************************************************************************/ -ACPI_RSDUMP_INFO AcpiRsDumpIrq[6] = +ACPI_RSDUMP_INFO AcpiRsDumpIrq[7] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq), "IRQ", NULL}, + {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.DescriptorLength), "Descriptor Length", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HeDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode}, @@ -220,9 +221,10 @@ ACPI_RSDUMP_INFO AcpiRsDumpDma[6] = {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL} }; -ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[3] = +ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[4] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpStartDpf), "Start-Dependent-Functions",NULL}, + {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (StartDpf.DescriptorLength), "Descriptor Length", NULL}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.CompatibilityPriority), "Compatibility Priority", AcpiGbl_ConfigDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.PerformanceRobustness), "Performance/Robustness", AcpiGbl_ConfigDecode} }; diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c index e731c5413c..4bab1cde3c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsinfo - Dispatch and Info tables - * $Revision: 1.7 $ + * $Revision: 1.9 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c index 8cbc3c06c1..7c5deea1ef 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsio - IO and DMA resource descriptors - * $Revision: 1.34 $ + * $Revision: 1.38 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -272,7 +272,7 @@ ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[2] = * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[5] = +ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[6] = { {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT), @@ -284,6 +284,12 @@ ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[5] = ACPI_ACCEPTABLE_CONFIGURATION, 2}, + /* Get the descriptor length (0 or 1 for Start Dpf descriptor) */ + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.DescriptorLength), + AML_OFFSET (StartDpf.DescriptorType), + 0}, + /* All done if there is no flag byte present in the descriptor */ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, @@ -306,8 +312,10 @@ ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[5] = * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[6] = +ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[10] = { + /* Start with a default descriptor of length 1 */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, sizeof (AML_RESOURCE_START_DEPENDENT), ACPI_RSC_TABLE_SIZE (AcpiRsSetStartDpf)}, @@ -321,6 +329,33 @@ ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[6] = {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness), AML_OFFSET (StartDpf.Flags), 2}, + /* + * All done if the output descriptor length is required to be 1 + * (i.e., optimization to 0 bytes cannot be attempted) + */ + {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(Data.StartDpf.DescriptorLength), + 1}, + + /* Set length to 0 bytes (no flags byte) */ + + {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)}, + + /* + * All done if the output descriptor length is required to be 0. + * + * TBD: Perhaps we should check for error if input flags are not + * compatible with a 0-byte descriptor. + */ + {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(Data.StartDpf.DescriptorLength), + 0}, + + /* Reset length to 1 byte (descriptor with flags byte) */ + + {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT)}, + + /* * All done if flags byte is necessary -- if either priority value * is not ACPI_ACCEPTABLE_CONFIGURATION diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c index bfd15936bd..d4afc91e56 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsirq - IRQ resource descriptors - * $Revision: 1.49 $ + * $Revision: 1.52 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -129,7 +129,7 @@ * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsGetIrq[7] = +ACPI_RSCONVERT_INFO AcpiRsGetIrq[8] = { {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, ACPI_RS_SIZE (ACPI_RESOURCE_IRQ), @@ -147,6 +147,12 @@ ACPI_RSCONVERT_INFO AcpiRsGetIrq[7] = ACPI_EDGE_SENSITIVE, 1}, + /* Get the descriptor length (2 or 3 for IRQ descriptor) */ + + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Irq.DescriptorLength), + AML_OFFSET (Irq.DescriptorType), + 0}, + /* All done if no flag byte present in descriptor */ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, @@ -173,8 +179,10 @@ ACPI_RSCONVERT_INFO AcpiRsGetIrq[7] = * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsSetIrq[9] = +ACPI_RSCONVERT_INFO AcpiRsSetIrq[13] = { + /* Start with a default descriptor of length 3 */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, sizeof (AML_RESOURCE_IRQ), ACPI_RSC_TABLE_SIZE (AcpiRsSetIrq)}, @@ -185,7 +193,7 @@ ACPI_RSCONVERT_INFO AcpiRsSetIrq[9] = AML_OFFSET (Irq.IrqMask), ACPI_RS_OFFSET (Data.Irq.InterruptCount)}, - /* Set the flags byte by default */ + /* Set the flags byte */ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering), AML_OFFSET (Irq.Flags), @@ -198,6 +206,33 @@ ACPI_RSCONVERT_INFO AcpiRsSetIrq[9] = {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Sharable), AML_OFFSET (Irq.Flags), 4}, + + /* + * All done if the output descriptor length is required to be 3 + * (i.e., optimization to 2 bytes cannot be attempted) + */ + {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(Data.Irq.DescriptorLength), + 3}, + + /* Set length to 2 bytes (no flags byte) */ + + {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)}, + + /* + * All done if the output descriptor length is required to be 2. + * + * TBD: Perhaps we should check for error if input flags are not + * compatible with a 2-byte descriptor. + */ + {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(Data.Irq.DescriptorLength), + 2}, + + /* Reset length to 3 bytes (descriptor with flags byte) */ + + {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ)}, + /* * Check if the flags byte is necessary. Not needed if the flags are: * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE @@ -214,7 +249,7 @@ ACPI_RSCONVERT_INFO AcpiRsSetIrq[9] = ACPI_RS_OFFSET (Data.Irq.Sharable), ACPI_EXCLUSIVE}, - /* IrqNoFlags() descriptor can be used */ + /* We can optimize to a 2-byte IrqNoFlags() descriptor */ {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)} }; diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c b/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c index d1d60e4630..278c38a152 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rslist - Linked list utilities - * $Revision: 1.61 $ + * $Revision: 1.63 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c index 0e0e3a8dae..08cd4aab10 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmem24 - Memory resource descriptors - * $Revision: 1.33 $ + * $Revision: 1.35 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c index e7da574321..bd44cd6bd6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmisc - Miscellaneous resource descriptors - * $Revision: 1.45 $ + * $Revision: 1.48 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -610,6 +610,18 @@ AcpiRsConvertResourceToAml ( break; + case ACPI_RSC_EXIT_EQ: + /* + * Control - Exit conversion if equal + */ + if (*ACPI_ADD_PTR (UINT8, Resource, + COMPARE_TARGET (Info)) == COMPARE_VALUE (Info)) + { + goto Exit; + } + break; + + default: ACPI_ERROR ((AE_INFO, "Invalid conversion opcode")); diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c index f17c68b64f..807042b8c8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsutils - Utilities for the resource manager - * $Revision: 1.66 $ + * $Revision: 1.69 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -187,7 +187,7 @@ AcpiRsEncodeBitmask ( UINT8 Count) { ACPI_NATIVE_UINT i; - UINT16 Mask; + ACPI_NATIVE_UINT Mask; ACPI_FUNCTION_ENTRY (); @@ -197,10 +197,10 @@ AcpiRsEncodeBitmask ( for (i = 0, Mask = 0; i < Count; i++) { - Mask |= (0x0001 << List[i]); + Mask |= (0x1 << List[i]); } - return (Mask); + return ((UINT16) Mask); } diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c index 1ff12f34b2..c98a3b0925 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsxface - Public interfaces to the resource manager - * $Revision: 1.47 $ + * $Revision: 1.49 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c index a1afd6db20..522f0f4a7e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbfadt - FADT table utilities - * $Revision: 1.4 $ + * $Revision: 1.8 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -305,6 +305,8 @@ AcpiTbParseFadt ( * DESCRIPTION: Get a local copy of the FADT and convert it to a common format. * Performs validation on some important FADT fields. * + * NOTE: We create a local copy of the FADT regardless of the version. + * ******************************************************************************/ void @@ -314,8 +316,9 @@ AcpiTbCreateLocalFadt ( { /* - * Check if the FADT is larger than what we know about (ACPI 2.0 version). - * Truncate the table, but make some noise. + * Check if the FADT is larger than the largest table that we expect + * (the ACPI 2.0/3.0 version). If so, truncate the table, and issue + * a warning. */ if (Length > sizeof (ACPI_TABLE_FADT)) { @@ -324,10 +327,12 @@ AcpiTbCreateLocalFadt ( Table->Revision, Length, sizeof (ACPI_TABLE_FADT))); } - /* Copy the entire FADT locally. Zero first for TbConvertFadt */ + /* Clear the entire local FADT */ ACPI_MEMSET (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT)); + /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */ + ACPI_MEMCPY (&AcpiGbl_FADT, Table, ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT))); @@ -349,7 +354,7 @@ AcpiTbCreateLocalFadt ( * RETURN: None * * DESCRIPTION: Converts all versions of the FADT to a common internal format. - * -> Expand all 32-bit addresses to 64-bit. + * Expand all 32-bit addresses to 64-bit. * * NOTE: AcpiGbl_FADT must be of size (ACPI_TABLE_FADT), * and must contain a copy of the actual FADT. @@ -395,8 +400,24 @@ AcpiTbConvertFadt ( } /* - * Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address - * structures as necessary. + * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which + * should be zero are indeed zero. This will workaround BIOSs that + * inadvertently place values in these fields. + * + * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at + * offset 45, 55, 95, and the word located at offset 109, 110. + */ + if (AcpiGbl_FADT.Header.Revision < 3) + { + AcpiGbl_FADT.PreferredProfile = 0; + AcpiGbl_FADT.PstateControl = 0; + AcpiGbl_FADT.CstControl = 0; + AcpiGbl_FADT.BootFlags = 0; + } + + /* + * Expand the ACPI 1.0 32-bit V1.0 addresses to the ACPI 2.0 64-bit "X" + * generic address structures as necessary. */ for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c index 412eea9073..4615505084 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbfind - find table - * $Revision: 1.2 $ + * $Revision: 1.5 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -149,15 +149,25 @@ AcpiTbFindTable ( { ACPI_NATIVE_UINT i; ACPI_STATUS Status; + ACPI_TABLE_HEADER Header; ACPI_FUNCTION_TRACE (TbFindTable); + /* Normalize the input strings */ + + ACPI_MEMSET (&Header, 0, sizeof (ACPI_TABLE_HEADER)); + ACPI_STRNCPY (Header.Signature, Signature, ACPI_NAME_SIZE); + ACPI_STRNCPY (Header.OemId, OemId, ACPI_OEM_ID_SIZE); + ACPI_STRNCPY (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE); + + /* Search for the table */ + for (i = 0; i < AcpiGbl_RootTableList.Count; ++i) { if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature), - Signature, ACPI_NAME_SIZE)) + Header.Signature, ACPI_NAME_SIZE)) { /* Not the requested table */ @@ -185,18 +195,18 @@ AcpiTbFindTable ( /* Check for table match on all IDs */ if (!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->Signature, - Signature, ACPI_NAME_SIZE) && + Header.Signature, ACPI_NAME_SIZE) && (!OemId[0] || !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemId, - OemId, ACPI_OEM_ID_SIZE)) && + Header.OemId, ACPI_OEM_ID_SIZE)) && (!OemTableId[0] || !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId, - OemTableId, ACPI_OEM_TABLE_ID_SIZE))) + Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE))) { *TableIndex = i; ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", - Signature)); + Header.Signature)); return_ACPI_STATUS (AE_OK); } } diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c index d663e8d11d..24f4afb0ed 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal - * $Revision: 1.90 $ + * $Revision: 1.94 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -217,9 +217,20 @@ AcpiTbAddTable ( if ((!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_PSDT)) && (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT))) { - ACPI_ERROR ((AE_INFO, - "Table has invalid signature [%4.4s], must be SSDT or PSDT", - TableDesc->Pointer->Signature)); + /* Check for a printable name */ + + if (AcpiUtValidAcpiName (*(UINT32 *) TableDesc->Pointer->Signature)) + { + ACPI_ERROR ((AE_INFO, + "Table has invalid signature [%4.4s], must be SSDT or PSDT", + TableDesc->Pointer->Signature)); + } + else + { + ACPI_ERROR ((AE_INFO, + "Table has invalid signature (0x%8.8X), must be SSDT or PSDT", + *(UINT32 *) TableDesc->Pointer->Signature)); + } return_ACPI_STATUS (AE_BAD_SIGNATURE); } @@ -250,6 +261,7 @@ AcpiTbAddTable ( AcpiTbDeleteTable (TableDesc); *TableIndex = i; + Status = AE_ALREADY_EXISTS; goto Release; } diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c index 45dc323256..d4c283ad2a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbutils - table utilities - * $Revision: 1.87 $ + * $Revision: 1.91 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -181,7 +181,7 @@ AcpiTbPrintTableHeader ( /* FACS only has signature and length fields of common table header */ ACPI_INFO ((AE_INFO, "%4.4s @ 0x%p/0x%04X", - Header->Signature, ACPI_CAST_PTR (void, Address), Header->Length)); + Header->Signature, ACPI_CAST_PTR (UINT64, Address), Header->Length)); } else if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_RSDP)) { @@ -239,7 +239,7 @@ AcpiTbVerifyChecksum ( if (Checksum) { ACPI_WARNING ((AE_INFO, - "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", + "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", Table->Signature, Table->Checksum, (UINT8) (Table->Checksum - Checksum))); #if (ACPI_CHECKSUM_ABORT) diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c index 4694529e43..3aa89dfc35 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c @@ -2,7 +2,7 @@ * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces - * $Revision: 1.84 $ + * $Revision: 1.88 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -565,7 +565,7 @@ AcpiTbLoadNamespace ( /* * DSDT table has been found */ - AcpiTbDeleteTable (ACPI_TABLE_INDEX_DSDT); + AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]); AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer = Table; AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Length = Table->Length; AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags = ACPI_TABLE_ORIGIN_UNKNOWN; @@ -660,3 +660,109 @@ AcpiLoadTables ( ACPI_EXPORT_SYMBOL (AcpiLoadTables) + +/******************************************************************************* + * + * FUNCTION: AcpiInstallTableHandler + * + * PARAMETERS: Handler - Table event handler + * Context - Value passed to the handler on each event + * + * RETURN: Status + * + * DESCRIPTION: Install table event handler + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallTableHandler ( + ACPI_TABLE_HANDLER Handler, + void *Context) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiInstallTableHandler); + + + if (!Handler) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Don't allow more than one handler */ + + if (AcpiGbl_TableHandler) + { + Status = AE_ALREADY_EXISTS; + goto Cleanup; + } + + /* Install the handler */ + + AcpiGbl_TableHandler = Handler; + AcpiGbl_TableHandlerContext = Context; + +Cleanup: + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInstallTableHandler) + + +/******************************************************************************* + * + * FUNCTION: AcpiRemoveTableHandler + * + * PARAMETERS: Handler - Table event handler that was installed + * previously. + * + * RETURN: Status + * + * DESCRIPTION: Remove table event handler + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRemoveTableHandler ( + ACPI_TABLE_HANDLER Handler) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiRemoveTableHandler); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Make sure that the installed handler is the same */ + + if (!Handler || + Handler != AcpiGbl_TableHandler) + { + Status = AE_BAD_PARAMETER; + goto Cleanup; + } + + /* Remove the handler */ + + AcpiGbl_TableHandler = NULL; + +Cleanup: + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiRemoveTableHandler) + diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c index b656d3d7a3..3740fcee93 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * $Revision: 1.103 $ + * $Revision: 1.106 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -186,8 +186,6 @@ AcpiTbValidateRsdp ( } -#if ACPI_MACHINE_WIDTH != 16 - /******************************************************************************* * * FUNCTION: AcpiTbFindRsdp @@ -370,5 +368,3 @@ AcpiTbScanMemoryForRsdp ( return_PTR (NULL); } -#endif - diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c index 91dcfcfcec..6026f62ba7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utalloc - local memory allocation routines - * $Revision: 1.162 $ + * $Revision: 1.166 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -117,6 +117,7 @@ #define __UTALLOC_C__ #include "acpi.h" +#include "acdebug.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utalloc") @@ -218,6 +219,15 @@ ACPI_STATUS AcpiUtDeleteCaches ( void) { +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + char Buffer[7]; + + if (AcpiGbl_DisplayFinalMemStats) + { + ACPI_STRCPY (Buffer, "MEMORY"); + (void) AcpiDbDisplayStatistics (Buffer); + } +#endif (void) AcpiOsDeleteCache (AcpiGbl_NamespaceCache); AcpiGbl_NamespaceCache = NULL; diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c index 7b6ff37126..fe7fa4ddfe 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utcache - local cache allocation routines - * $Revision: 1.6 $ + * $Revision: 1.9 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -396,6 +396,13 @@ AcpiOsAcquireObject ( ACPI_MEM_TRACKING (Cache->TotalAllocated++); +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache->MaxOccupied) + { + Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed; + } +#endif + /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES); diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c index 2fbebcb804..5ccdf5c237 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: cmclib - Local implementation of C library functions - * $Revision: 1.59 $ + * $Revision: 1.61 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c index 111af3085f..811d6f362f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utcopy - Internal to external object translation utilities - * $Revision: 1.129 $ + * $Revision: 1.137 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +118,7 @@ #include "acpi.h" #include "amlcode.h" +#include "acnamesp.h" #define _COMPONENT ACPI_UTILITIES @@ -150,6 +151,11 @@ AcpiUtCopyEsimpleToIsimple( ACPI_OBJECT *UserObj, ACPI_OPERAND_OBJECT **ReturnObj); +static ACPI_STATUS +AcpiUtCopyEpackageToIpackage ( + ACPI_OBJECT *ExternalObject, + ACPI_OPERAND_OBJECT **InternalObject); + static ACPI_STATUS AcpiUtCopySimpleObject ( ACPI_OPERAND_OBJECT *SourceDesc, @@ -261,9 +267,8 @@ AcpiUtCopyIsimpleToEsimple ( case ACPI_TYPE_LOCAL_REFERENCE: - /* - * This is an object reference. Attempt to dereference it. - */ + /* This is an object reference. */ + switch (InternalObject->Reference.Opcode) { case AML_INT_NAMEPATH_OP: @@ -271,12 +276,13 @@ AcpiUtCopyIsimpleToEsimple ( /* For namepath, return the object handle ("reference") */ default: - /* - * Use the object type of "Any" to indicate a reference - * to object containing a handle to an ACPI named object. - */ - ExternalObject->Type = ACPI_TYPE_ANY; - ExternalObject->Reference.Handle = InternalObject->Reference.Node; + + /* We are referring to the namespace node */ + + ExternalObject->Reference.Handle = + InternalObject->Reference.Node; + ExternalObject->Reference.ActualType = + AcpiNsGetType (InternalObject->Reference.Node); break; } break; @@ -304,6 +310,9 @@ AcpiUtCopyIsimpleToEsimple ( /* * There is no corresponding external object type */ + ACPI_ERROR ((AE_INFO, "Unsupported object type, cannot convert to external object: %s", + AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (InternalObject)))); + return_ACPI_STATUS (AE_SUPPORT); } @@ -554,6 +563,7 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: case ACPI_TYPE_INTEGER: + case ACPI_TYPE_LOCAL_REFERENCE: InternalObject = AcpiUtCreateInternalObject ( (UINT8) ExternalObject->Type); @@ -563,9 +573,17 @@ AcpiUtCopyEsimpleToIsimple ( } break; + case ACPI_TYPE_ANY: /* This is the case for a NULL object */ + + *RetInternalObject = NULL; + return_ACPI_STATUS (AE_OK); + default: /* All other types are not supported */ + ACPI_ERROR ((AE_INFO, "Unsupported object type, cannot convert to internal object: %s", + AcpiUtGetTypeName (ExternalObject->Type))); + return_ACPI_STATUS (AE_SUPPORT); } @@ -605,6 +623,10 @@ AcpiUtCopyEsimpleToIsimple ( ExternalObject->Buffer.Length); InternalObject->Buffer.Length = ExternalObject->Buffer.Length; + + /* Mark buffer data valid */ + + InternalObject->Buffer.Flags |= AOPOBJ_DATA_VALID; break; @@ -613,6 +635,14 @@ AcpiUtCopyEsimpleToIsimple ( InternalObject->Integer.Value = ExternalObject->Integer.Value; break; + case ACPI_TYPE_LOCAL_REFERENCE: + + /* TBD: should validate incoming handle */ + + InternalObject->Reference.Opcode = AML_INT_NAMEPATH_OP; + InternalObject->Reference.Node = ExternalObject->Reference.Handle; + break; + default: /* Other types can't get here */ break; @@ -628,83 +658,81 @@ ErrorExit: } -#ifdef ACPI_FUTURE_IMPLEMENTATION -/* Code to convert packages that are parameters to control methods */ - /******************************************************************************* * * 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 + * PARAMETERS: ExternalObject - The external object to be converted + * InternalObject - Where the internal object is returned * * RETURN: Status * - * DESCRIPTION: This function is called to place a package object in a user - * buffer. A package object by definition contains other objects. - * - * The buffer is assumed to have sufficient space for the object. - * The caller must have verified the buffer length needed using the - * AcpiUtGetObjectSize function before calling this function. + * DESCRIPTION: Copy an external package object to an internal package. + * Handles nested packages. * ******************************************************************************/ static ACPI_STATUS AcpiUtCopyEpackageToIpackage ( - ACPI_OPERAND_OBJECT *InternalObject, - UINT8 *Buffer, - UINT32 *SpaceUsed) + ACPI_OBJECT *ExternalObject, + ACPI_OPERAND_OBJECT **InternalObject) { - UINT8 *FreeSpace; - ACPI_OBJECT *ExternalObject; - UINT32 Length = 0; - UINT32 ThisIndex; - UINT32 ObjectSpace = 0; - ACPI_OPERAND_OBJECT *ThisInternalObj; - ACPI_OBJECT *ThisExternalObj; + ACPI_STATUS Status = AE_OK; + ACPI_OPERAND_OBJECT *PackageObject; + ACPI_OPERAND_OBJECT **PackageElements; + ACPI_NATIVE_UINT i; ACPI_FUNCTION_TRACE (UtCopyEpackageToIpackage); - /* - * First package at head of the buffer - */ - ExternalObject = (ACPI_OBJECT *)Buffer; + /* Create the package object */ + + PackageObject = AcpiUtCreatePackageObject (ExternalObject->Package.Count); + if (!PackageObject) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + PackageElements = PackageObject->Package.Elements; /* - * Free space begins right after the first package + * Recursive implementation. Probably ok, since nested external packages + * as parameters should be very rare. */ - FreeSpace = Buffer + sizeof(ACPI_OBJECT); + for (i = 0; i < ExternalObject->Package.Count; i++) + { + Status = AcpiUtCopyEobjectToIobject ( + &ExternalObject->Package.Elements[i], + &PackageElements[i]); + if (ACPI_FAILURE (Status)) + { + /* Truncate package and delete it */ + PackageObject->Package.Count = (UINT32) i; + PackageElements[i] = NULL; + AcpiUtRemoveReference (PackageObject); + return_ACPI_STATUS (Status); + } + } - ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject); - ExternalObject->Package.Count = InternalObject->Package.Count; - ExternalObject->Package.Elements = (ACPI_OBJECT *)FreeSpace; + /* Mark package data valid */ - /* - * Build an array of ACPI_OBJECTS in the buffer - * and move the free space past it - */ - FreeSpace += ExternalObject->Package.Count * sizeof(ACPI_OBJECT); - - - /* Call WalkPackage */ + PackageObject->Package.Flags |= AOPOBJ_DATA_VALID; + *InternalObject = PackageObject; + return_ACPI_STATUS (Status); } -#endif /* Future implementation */ - /******************************************************************************* * * FUNCTION: AcpiUtCopyEobjectToIobject * - * PARAMETERS: *InternalObject - The external object to be converted - * *BufferPtr - Where the internal object is returned + * PARAMETERS: ExternalObject - The external object to be converted + * InternalObject - Where the internal object is returned * - * RETURN: Status - the status of the call + * RETURN: Status - the status of the call * * DESCRIPTION: Converts an external object to an internal object. * @@ -723,15 +751,8 @@ AcpiUtCopyEobjectToIobject ( if (ExternalObject->Type == ACPI_TYPE_PACKAGE) { - /* - * Packages as external input to control methods are not supported, - */ - ACPI_ERROR ((AE_INFO, - "Packages as parameters not implemented!")); - - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); + Status = AcpiUtCopyEpackageToIpackage (ExternalObject, InternalObject); } - else { /* @@ -840,7 +861,16 @@ AcpiUtCopySimpleObject ( /* * We copied the reference object, so we now must add a reference * to the object pointed to by the reference + * + * DDBHandle reference (from Load/LoadTable is a special reference, + * it's Reference.Object is the table index, so does not need to + * increase the reference count */ + if (SourceDesc->Reference.Opcode == AML_LOAD_OP) + { + break; + } + AcpiUtAddReference (SourceDesc->Reference.Object); break; @@ -936,34 +966,20 @@ AcpiUtCopyIelementToIelement ( * This object is a package - go down another nesting level * Create and build the package object */ - TargetObject = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); + TargetObject = AcpiUtCreatePackageObject (SourceObject->Package.Count); if (!TargetObject) { return (AE_NO_MEMORY); } - TargetObject->Package.Count = SourceObject->Package.Count; - TargetObject->Common.Flags = SourceObject->Common.Flags; + TargetObject->Common.Flags = SourceObject->Common.Flags; - /* - * Create the object array - */ - TargetObject->Package.Elements = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) SourceObject->Package.Count + 1) * sizeof (void *)); - if (!TargetObject->Package.Elements) - { - Status = AE_NO_MEMORY; - goto ErrorExit; - } + /* Pass the new package object back to the package walk routine */ - /* - * Pass the new package object back to the package walk routine - */ State->Pkg.ThisTargetObj = TargetObject; - /* - * Store the object pointer in the parent package object - */ + /* Store the object pointer in the parent package object */ + *ThisTargetPtr = TargetObject; break; diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c index 4cb018aed2..8e19a52902 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utdebug - Debug print routines - * $Revision: 1.132 $ + * $Revision: 1.137 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -124,9 +124,9 @@ #ifdef ACPI_DEBUG_OUTPUT -static UINT32 AcpiGbl_PrevThreadId = 0xFFFFFFFF; -static char *AcpiGbl_FnEntryStr = "----Entry"; -static char *AcpiGbl_FnExitStr = "----Exit-"; +static ACPI_THREAD_ID AcpiGbl_PrevThreadId = 0xFFFFFFFF; +static char *AcpiGbl_FnEntryStr = "----Entry"; +static char *AcpiGbl_FnExitStr = "----Exit-"; /* Local prototypes */ @@ -151,10 +151,10 @@ void AcpiUtInitStackPtrTrace ( void) { - UINT32 CurrentSp; + ACPI_SIZE CurrentSp; - AcpiGbl_EntryStackPointer = ACPI_PTR_DIFF (&CurrentSp, NULL); + AcpiGbl_EntryStackPointer = &CurrentSp; } @@ -177,11 +177,9 @@ AcpiUtTrackStackPtr ( ACPI_SIZE CurrentSp; - CurrentSp = ACPI_PTR_DIFF (&CurrentSp, NULL); - - if (CurrentSp < AcpiGbl_LowestStackPointer) + if (&CurrentSp < AcpiGbl_LowestStackPointer) { - AcpiGbl_LowestStackPointer = CurrentSp; + AcpiGbl_LowestStackPointer = &CurrentSp; } if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting) @@ -304,6 +302,7 @@ AcpiUtDebugPrint ( va_start (args, Format); AcpiOsVprintf (Format, args); + va_end (args); } ACPI_EXPORT_SYMBOL (AcpiUtDebugPrint) @@ -349,6 +348,7 @@ AcpiUtDebugPrintRaw ( va_start (args, Format); AcpiOsVprintf (Format, args); + va_end (args); } ACPI_EXPORT_SYMBOL (AcpiUtDebugPrintRaw) @@ -674,6 +674,12 @@ AcpiUtDumpBuffer2 ( UINT8 BufChar; + if (!Buffer) + { + AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n"); + return; + } + if ((Count < 4) || (Count & 0x01)) { Display = DB_BYTE_DISPLAY; diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c index c85ea669be..4679709045 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utdelete - object deletion and reference count utilities - * $Revision: 1.121 $ + * $Revision: 1.126 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -247,7 +247,7 @@ AcpiUtDeleteInternalObj ( "***** Mutex %p, OS Mutex %p\n", Object, Object->Mutex.OsMutex)); - if (Object->Mutex.OsMutex == AcpiGbl_GlobalLockMutex) + if (Object == AcpiGbl_GlobalLockMutex) { /* Global Lock has extra semaphore */ @@ -345,6 +345,19 @@ AcpiUtDeleteInternalObj ( break; + case ACPI_TYPE_LOCAL_BANK_FIELD: + + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, + "***** Bank Field %p\n", Object)); + + SecondDesc = AcpiNsGetSecondaryObject (Object); + if (SecondDesc) + { + AcpiUtDeleteObjectDesc (SecondDesc); + } + break; + + default: break; } @@ -633,10 +646,12 @@ AcpiUtUpdateObjectReference ( case ACPI_TYPE_LOCAL_REFERENCE: /* - * The target of an Index (a package, string, or buffer) must track - * changes to the ref count of the index. + * The target of an Index (a package, string, or buffer) or a named + * reference must track changes to the ref count of the index or + * target object. */ - if (Object->Reference.Opcode == AML_INDEX_OP) + if ((Object->Reference.Opcode == AML_INDEX_OP) || + (Object->Reference.Opcode == AML_INT_NAMEPATH_OP)) { NextObject = Object->Reference.Object; } diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c b/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c index ab747d452f..27a2a00724 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: uteval - Object evaluation - * $Revision: 1.70 $ + * $Revision: 1.73 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -146,16 +146,13 @@ static const char *AcpiInterfacesSupported[] = /* Operating System Vendor Strings */ "Linux", - "Windows 2000", - "Windows 2001", - "Windows 2001 SP0", - "Windows 2001 SP1", - "Windows 2001 SP2", - "Windows 2001 SP3", - "Windows 2001 SP4", - "Windows 2001.1", - "Windows 2001.1 SP1", /* Added 03/2006 */ - "Windows 2006", /* Added 03/2006 */ + "Windows 2000", /* Windows 2000 */ + "Windows 2001", /* Windows XP */ + "Windows 2001 SP1", /* Windows XP SP1 */ + "Windows 2001 SP2", /* Windows XP SP2 */ + "Windows 2001.1", /* Windows Server 2003 */ + "Windows 2001.1 SP1", /* Windows Server 2003 SP1 - Added 03/2006 */ + "Windows 2006", /* Windows Vista - Added 03/2006 */ /* Feature Group Strings */ diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c index d93d8a2067..8b7d0494c6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utglobal - Global variables for the ACPI subsystem - * $Revision: 1.247 $ + * $Revision: 1.255 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -263,7 +263,7 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = * Properties of the ACPI Object Types, both internal and external. * The table is indexed by values of ACPI_OBJECT_TYPE */ -const UINT8 AcpiGbl_NsProperties[] = +const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = { ACPI_NS_NORMAL, /* 00 Any */ ACPI_NS_NORMAL, /* 01 Number */ @@ -690,6 +690,56 @@ AcpiUtGetMutexName ( return (AcpiGbl_MutexNames[MutexId]); } + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetNotifyName + * + * PARAMETERS: NotifyValue - Value from the Notify() request + * + * RETURN: String corresponding to the Notify Value. + * + * DESCRIPTION: Translate a Notify Value to a notify namestring. + * + ******************************************************************************/ + +/* Names for Notify() values, used for debug output */ + +static const char *AcpiGbl_NotifyValueNames[] = +{ + "Bus Check", + "Device Check", + "Device Wake", + "Eject Request", + "Device Check Light", + "Frequency Mismatch", + "Bus Mode Mismatch", + "Power Fault", + "Capabilities Check", + "Device PLD Check", + "Reserved", + "System Locality Update" +}; + +const char * +AcpiUtGetNotifyName ( + UINT32 NotifyValue) +{ + + if (NotifyValue <= ACPI_NOTIFY_MAX) + { + return (AcpiGbl_NotifyValueNames[NotifyValue]); + } + else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) + { + return ("Reserved"); + } + else /* Greater or equal to 0x80 */ + { + return ("**Device Specific**"); + } +} #endif @@ -768,19 +818,30 @@ AcpiUtInitGlobals ( } AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */ + /* Event counters */ + + AcpiMethodCount = 0; + AcpiSciCount = 0; + AcpiGpeCount = 0; + + for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) + { + AcpiFixedEventCount[i] = 0; + } + /* GPE support */ - AcpiGpeCount = 0; AcpiGbl_GpeXruptListHead = NULL; AcpiGbl_GpeFadtBlocks[0] = NULL; AcpiGbl_GpeFadtBlocks[1] = NULL; - /* Global notify handlers */ + /* Global handlers */ AcpiGbl_SystemNotify.Handler = NULL; AcpiGbl_DeviceNotify.Handler = NULL; AcpiGbl_ExceptionHandler = NULL; AcpiGbl_InitHandler = NULL; + AcpiGbl_TableHandler = NULL; /* Global Lock support */ @@ -823,7 +884,11 @@ AcpiUtInitGlobals ( #ifdef ACPI_DEBUG_OUTPUT - AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX; + AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX); +#endif + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + AcpiGbl_DisplayFinalMemStats = FALSE; #endif return_VOID; diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c index b30f240eda..1fcc5bcaab 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utinit - Common ACPI subsystem initialization - * $Revision: 1.134 $ + * $Revision: 1.137 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -216,9 +216,12 @@ AcpiUtSubsystemShutdown ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); +#ifndef ACPI_ASL_COMPILER + /* Close the AcpiEvent Handling */ AcpiEvTerminate (); +#endif /* Close the Namespace */ diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c index 0cb9e0782e..c0b37228eb 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmath - Integer math support routines - * $Revision: 1.21 $ + * $Revision: 1.24 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -387,7 +387,7 @@ AcpiUtShortDivide ( } if (OutRemainder) { - *OutRemainder = (UINT32) InDividend % Divisor; + *OutRemainder = (UINT32) (InDividend % Divisor); } return_ACPI_STATUS (AE_OK); diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c index 11e9d4f615..8c7bcec45b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmisc - common utility procedures - * $Revision: 1.150 $ + * $Revision: 1.153 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -1248,6 +1248,7 @@ AcpiUtError ( va_start (args, Format); AcpiOsVprintf (Format, args); AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION); + va_end (args); } void ACPI_INTERNAL_VAR_XFACE @@ -1267,6 +1268,7 @@ AcpiUtException ( va_start (args, Format); AcpiOsVprintf (Format, args); AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION); + va_end (args); } void ACPI_INTERNAL_VAR_XFACE @@ -1284,6 +1286,7 @@ AcpiUtWarning ( va_start (args, Format); AcpiOsVprintf (Format, args); AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION); + va_end (args); } void ACPI_INTERNAL_VAR_XFACE @@ -1305,5 +1308,6 @@ AcpiUtInfo ( va_start (args, Format); AcpiOsVprintf (Format, args); AcpiOsPrintf ("\n"); + va_end (args); } diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c index 53186ec8c5..ecaa9ecf2a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmutex - local mutex support - * $Revision: 1.11 $ + * $Revision: 1.13 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c index 6d7a058e5a..44c0253f13 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 1.103 $ + * $Revision: 1.108 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -192,6 +192,7 @@ AcpiUtCreateInternalObjectDbg ( { case ACPI_TYPE_REGION: case ACPI_TYPE_BUFFER_FIELD: + case ACPI_TYPE_LOCAL_BANK_FIELD: /* These types require a secondary object */ @@ -230,6 +231,55 @@ AcpiUtCreateInternalObjectDbg ( } +/******************************************************************************* + * + * FUNCTION: AcpiUtCreatePackageObject + * + * PARAMETERS: Count - Number of package elements + * + * RETURN: Pointer to a new Package object, null on failure + * + * DESCRIPTION: Create a fully initialized package object + * + ******************************************************************************/ + +ACPI_OPERAND_OBJECT * +AcpiUtCreatePackageObject ( + UINT32 Count) +{ + ACPI_OPERAND_OBJECT *PackageDesc; + ACPI_OPERAND_OBJECT **PackageElements; + + + ACPI_FUNCTION_TRACE_U32 (UtCreatePackageObject, Count); + + + /* Create a new Package object */ + + PackageDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); + if (!PackageDesc) + { + return_PTR (NULL); + } + + /* + * Create the element array. Count+1 allows the array to be null + * terminated. + */ + PackageElements = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) + (Count + 1) * sizeof (void *)); + if (!PackageElements) + { + ACPI_FREE (PackageDesc); + return_PTR (NULL); + } + + PackageDesc->Package.Count = Count; + PackageDesc->Package.Elements = PackageElements; + return_PTR (PackageDesc); +} + + /******************************************************************************* * * FUNCTION: AcpiUtCreateBufferObject @@ -505,26 +555,29 @@ AcpiUtGetSimpleObjectSize ( ACPI_FUNCTION_TRACE_PTR (UtGetSimpleObjectSize, InternalObject); - /* - * Handle a null object (Could be a uninitialized package - * element -- which is legal) - */ - if (!InternalObject) - { - *ObjLength = 0; - return_ACPI_STATUS (AE_OK); - } - - /* Start with the length of the Acpi object */ + /* Start with the length of the (external) Acpi object */ Length = sizeof (ACPI_OBJECT); + /* A NULL object is allowed, can be a legal uninitialized package element */ + + if (!InternalObject) + { + /* + * Object is NULL, just return the length of ACPI_OBJECT + * (A NULL ACPI_OBJECT is an object of all zeroes.) + */ + *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length); + return_ACPI_STATUS (AE_OK); + } + + /* A Namespace Node should never appear here */ + if (ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_NAMED) { - /* Object is a named object (reference), just return the length */ + /* A namespace node should never get here */ - *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length); - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_AML_INTERNAL); } /* @@ -551,9 +604,8 @@ AcpiUtGetSimpleObjectSize ( case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_POWER: - /* - * No extra data for these types - */ + /* No extra data for these types */ + break; diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c index 87f0c15e8e..d62e8ba89a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utresrc - Resource managment utilities - * $Revision: 1.13 $ + * $Revision: 1.15 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c index 7c9d72f125..1da17203d0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utstate - state object support procedures - * $Revision: 1.7 $ + * $Revision: 1.9 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c b/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c index 4dbf0bf755..76ab1d7f1e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: uttrack - Memory allocation tracking routines (debug only) - * $Revision: 1.3 $ + * $Revision: 1.6 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -238,7 +238,12 @@ AcpiUtAllocateAndTrack ( } AcpiGbl_GlobalList->TotalAllocated++; + AcpiGbl_GlobalList->TotalSize += (UINT32) Size; AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size; + if (AcpiGbl_GlobalList->CurrentTotalSize > AcpiGbl_GlobalList->MaxOccupied) + { + AcpiGbl_GlobalList->MaxOccupied = AcpiGbl_GlobalList->CurrentTotalSize; + } return ((void *) &Allocation->UserSpace); } @@ -290,7 +295,12 @@ AcpiUtAllocateZeroedAndTrack ( } AcpiGbl_GlobalList->TotalAllocated++; + AcpiGbl_GlobalList->TotalSize += (UINT32) Size; AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size; + if (AcpiGbl_GlobalList->CurrentTotalSize > AcpiGbl_GlobalList->MaxOccupied) + { + AcpiGbl_GlobalList->MaxOccupied = AcpiGbl_GlobalList->CurrentTotalSize; + } return ((void *) &Allocation->UserSpace); } diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c index 591d986b7a..039c65207e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utxface - External interfaces for "global" ACPI functions - * $Revision: 1.124 $ + * $Revision: 1.128 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -126,6 +126,8 @@ ACPI_MODULE_NAME ("utxface") +#ifndef ACPI_ASL_COMPILER + /******************************************************************************* * * FUNCTION: AcpiInitializeSubsystem @@ -405,6 +407,8 @@ AcpiInitializeObjects ( ACPI_EXPORT_SYMBOL (AcpiInitializeObjects) +#endif + /******************************************************************************* * * FUNCTION: AcpiTerminate @@ -456,6 +460,7 @@ AcpiTerminate ( ACPI_EXPORT_SYMBOL (AcpiTerminate) +#ifndef ACPI_ASL_COMPILER /******************************************************************************* * @@ -572,6 +577,51 @@ AcpiGetSystemInfo ( ACPI_EXPORT_SYMBOL (AcpiGetSystemInfo) +/******************************************************************************* + * + * FUNCTION: AcpiGetStatistics + * + * PARAMETERS: Stats - Where the statistics are returned + * + * RETURN: Status - the status of the call + * + * DESCRIPTION: Get the contents of the various system counters + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetStatistics ( + ACPI_STATISTICS *Stats) +{ + ACPI_FUNCTION_TRACE (AcpiGetStatistics); + + + /* Parameter validation */ + + if (!Stats) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* Various interrupt-based event counters */ + + Stats->SciCount = AcpiSciCount; + Stats->GpeCount = AcpiGpeCount; + + ACPI_MEMCPY (Stats->FixedEventCount, AcpiFixedEventCount, + sizeof (AcpiFixedEventCount)); + + + /* Other counters */ + + Stats->MethodCount = AcpiMethodCount; + + return_ACPI_STATUS (AE_OK); +} + +ACPI_EXPORT_SYMBOL (AcpiGetStatistics) + + /***************************************************************************** * * FUNCTION: AcpiInstallInitializationHandler @@ -636,3 +686,5 @@ AcpiPurgeCachedObjects ( } ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects) + +#endif