From 12474ac0a5ef9e83d404c8b756ae6f51d7cfa7e2 Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Sun, 21 Nov 2010 21:58:06 +0000 Subject: [PATCH] Updated ACPICA to 20101013 from 20100428. See http://www.acpica.org/download/changes.txt for changes. Embedded Controller still needs some looking into, and I had to remove the WIP code for dumping MADT. Both are on my TODO. Also removed a lot of unneeded parts of ACPICA from trunk and did some cleanup in Jamfile. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39565 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/drivers/ACPI.h | 3 +- src/add-ons/kernel/bus_managers/acpi/Jamfile | 109 +- .../kernel/bus_managers/acpi/acpi_busman.c | 8 +- .../acpi/acpi_embedded_controller.cpp | 3 +- .../kernel/bus_managers/acpi/acpi_priv.h | 5 +- .../kernel/bus_managers/acpi/common/adfile.c | 6 +- .../kernel/bus_managers/acpi/common/adisasm.c | 105 +- .../kernel/bus_managers/acpi/common/adwalk.c | 18 +- .../bus_managers/acpi/common/dmextern.c | 93 +- .../bus_managers/acpi/common/dmrestag.c | 11 +- .../kernel/bus_managers/acpi/common/dmtable.c | 305 +- .../bus_managers/acpi/common/dmtbdump.c | 53 +- .../bus_managers/acpi/common/dmtbinfo.c | 1263 ++++--- .../kernel/bus_managers/acpi/common/getopt.c | 5 +- .../bus_managers/acpi/compiler/Makefile | 155 - .../bus_managers/acpi/compiler/aslanalyze.c | 2020 ----------- .../bus_managers/acpi/compiler/aslcodegen.c | 660 ---- .../bus_managers/acpi/compiler/aslcompile.c | 937 ----- .../bus_managers/acpi/compiler/aslcompiler.h | 1007 ------ .../bus_managers/acpi/compiler/aslcompiler.l | 1183 ------ .../bus_managers/acpi/compiler/aslcompiler.y | 3189 ----------------- .../bus_managers/acpi/compiler/asldefine.h | 210 -- .../bus_managers/acpi/compiler/aslerror.c | 670 ---- .../bus_managers/acpi/compiler/aslfiles.c | 1031 ------ .../bus_managers/acpi/compiler/aslfold.c | 563 --- .../bus_managers/acpi/compiler/aslglobal.h | 290 -- .../bus_managers/acpi/compiler/asllength.c | 530 --- .../bus_managers/acpi/compiler/asllisting.c | 1614 --------- .../bus_managers/acpi/compiler/aslload.c | 974 ----- .../bus_managers/acpi/compiler/asllookup.c | 1440 -------- .../bus_managers/acpi/compiler/aslmain.c | 964 ----- .../bus_managers/acpi/compiler/aslmap.c | 467 --- .../bus_managers/acpi/compiler/aslopcodes.c | 811 ----- .../bus_managers/acpi/compiler/asloperands.c | 1252 ------- .../bus_managers/acpi/compiler/aslopt.c | 868 ----- .../bus_managers/acpi/compiler/aslpredef.c | 831 ----- .../bus_managers/acpi/compiler/aslresource.c | 1051 ------ .../bus_managers/acpi/compiler/aslrestype1.c | 719 ---- .../bus_managers/acpi/compiler/aslrestype1i.c | 668 ---- .../bus_managers/acpi/compiler/aslrestype2.c | 534 --- .../bus_managers/acpi/compiler/aslrestype2d.c | 814 ----- .../bus_managers/acpi/compiler/aslrestype2e.c | 646 ---- .../bus_managers/acpi/compiler/aslrestype2q.c | 793 ---- .../bus_managers/acpi/compiler/aslrestype2w.c | 774 ---- .../bus_managers/acpi/compiler/aslstartup.c | 446 --- .../bus_managers/acpi/compiler/aslstubs.c | 306 -- .../bus_managers/acpi/compiler/asltransform.c | 841 ----- .../bus_managers/acpi/compiler/asltree.c | 1194 ------ .../bus_managers/acpi/compiler/asltypes.h | 579 --- .../bus_managers/acpi/compiler/aslutils.c | 1060 ------ .../bus_managers/acpi/compiler/readme.txt | 85 - .../bus_managers/acpi/debugger/dbcmds.c | 2129 ----------- .../bus_managers/acpi/debugger/dbdisply.c | 960 ----- .../bus_managers/acpi/debugger/dbexec.c | 793 ---- .../bus_managers/acpi/debugger/dbfileio.c | 649 ---- .../bus_managers/acpi/debugger/dbhistry.c | 292 -- .../bus_managers/acpi/debugger/dbinput.c | 1085 ------ .../bus_managers/acpi/debugger/dbstats.c | 621 ---- .../bus_managers/acpi/debugger/dbutils.c | 599 ---- .../bus_managers/acpi/debugger/dbxface.c | 602 ---- .../bus_managers/acpi/disassembler/dmbuffer.c | 614 ---- .../bus_managers/acpi/disassembler/dmnames.c | 525 --- .../bus_managers/acpi/disassembler/dmobject.c | 661 ---- .../bus_managers/acpi/disassembler/dmopcode.c | 632 ---- .../bus_managers/acpi/disassembler/dmresrc.c | 509 --- .../bus_managers/acpi/disassembler/dmresrcl.c | 1125 ------ .../bus_managers/acpi/disassembler/dmresrcs.c | 387 -- .../bus_managers/acpi/disassembler/dmutils.c | 375 -- .../bus_managers/acpi/disassembler/dmwalk.c | 1006 ------ .../bus_managers/acpi/dispatcher/dsinit.c | 16 +- .../bus_managers/acpi/dispatcher/dsmethod.c | 15 +- .../bus_managers/acpi/dispatcher/dsmthdat.c | 16 +- .../bus_managers/acpi/dispatcher/dsobject.c | 16 +- .../bus_managers/acpi/dispatcher/dsopcode.c | 6 +- .../bus_managers/acpi/dispatcher/dsutils.c | 4 +- .../kernel/bus_managers/acpi/events/evgpe.c | 112 +- .../bus_managers/acpi/events/evgpeblk.c | 17 +- .../bus_managers/acpi/events/evgpeinit.c | 3 +- .../bus_managers/acpi/events/evgpeutil.c | 1 - .../bus_managers/acpi/events/evrgnini.c | 23 +- .../kernel/bus_managers/acpi/events/evxface.c | 16 - .../bus_managers/acpi/events/evxfevnt.c | 197 +- .../bus_managers/acpi/events/evxfregn.c | 6 + .../bus_managers/acpi/executer/exdump.c | 6 +- .../bus_managers/acpi/executer/exfldio.c | 94 +- .../bus_managers/acpi/executer/exmutex.c | 6 +- .../bus_managers/acpi/executer/exprep.c | 105 +- .../bus_managers/acpi/executer/exregion.c | 6 +- .../bus_managers/acpi/executer/exsystem.c | 9 + .../kernel/bus_managers/acpi/hardware/hwgpe.c | 132 +- .../kernel/bus_managers/acpi/hardware/hwpci.c | 531 +++ .../bus_managers/acpi/hardware/hwsleep.c | 2 +- .../bus_managers/acpi/hardware/hwvalid.c | 14 + .../kernel/bus_managers/acpi/include/acapps.h | 32 + .../bus_managers/acpi/include/acconfig.h | 4 + .../bus_managers/acpi/include/acdebug.h | 5 + .../bus_managers/acpi/include/acdisasm.h | 61 + .../bus_managers/acpi/include/acevents.h | 6 +- .../bus_managers/acpi/include/acexcep.h | 2 +- .../bus_managers/acpi/include/acglobal.h | 19 +- .../bus_managers/acpi/include/achware.h | 22 +- .../bus_managers/acpi/include/aclocal.h | 29 +- .../bus_managers/acpi/include/acmacros.h | 4 +- .../bus_managers/acpi/include/acnamesp.h | 25 - .../bus_managers/acpi/include/acobject.h | 16 +- .../bus_managers/acpi/include/acoutput.h | 3 +- .../bus_managers/acpi/include/acpiosxf.h | 16 +- .../kernel/bus_managers/acpi/include/acpixf.h | 29 +- .../bus_managers/acpi/include/acpredef.h | 9 +- .../bus_managers/acpi/include/acstruct.h | 32 +- .../kernel/bus_managers/acpi/include/actbl.h | 23 +- .../kernel/bus_managers/acpi/include/actbl2.h | 50 + .../bus_managers/acpi/include/actypes.h | 46 +- .../bus_managers/acpi/include/acutils.h | 93 +- .../acpi/include/platform/accygwin.h | 166 - .../acpi/include/platform/acenv.h | 14 +- .../acpi/include/platform/acfreebsd.h | 178 - .../acpi/include/platform/acgcc.h | 2 + .../acpi/include/platform/achaiku.h | 2 +- .../acpi/include/platform/acintel.h | 22 +- .../acpi/include/platform/aclinux.h | 233 -- .../acpi/include/platform/acmsvc.h | 6 +- .../acpi/include/platform/acnetbsd.h | 188 - .../acpi/include/platform/acos2.h | 172 - .../acpi/include/platform/acwin.h | 220 -- .../acpi/include/platform/acwin64.h | 155 - .../bus_managers/acpi/namespace/nsaccess.c | 8 +- .../bus_managers/acpi/namespace/nsalloc.c | 98 +- .../bus_managers/acpi/namespace/nsdump.c | 2 +- .../bus_managers/acpi/namespace/nsinit.c | 30 +- .../bus_managers/acpi/namespace/nsnames.c | 4 +- .../bus_managers/acpi/namespace/nsparse.c | 2 +- .../bus_managers/acpi/namespace/nsrepair.c | 2 +- .../bus_managers/acpi/namespace/nsrepair2.c | 187 + .../bus_managers/acpi/namespace/nssearch.c | 15 +- .../bus_managers/acpi/namespace/nsutils.c | 237 -- .../bus_managers/acpi/namespace/nswalk.c | 16 +- .../bus_managers/acpi/namespace/nsxfobj.c | 2 +- .../kernel/bus_managers/acpi/oshaiku.cpp | 34 +- .../kernel/bus_managers/acpi/tables/tbfadt.c | 4 +- .../bus_managers/acpi/utilities/utdebug.c | 7 +- .../bus_managers/acpi/utilities/uteval.c | 133 - .../bus_managers/acpi/utilities/utglobal.c | 11 +- .../bus_managers/acpi/utilities/utids.c | 51 +- .../bus_managers/acpi/utilities/utinit.c | 4 + .../bus_managers/acpi/utilities/utmath.c | 28 +- .../bus_managers/acpi/utilities/utmisc.c | 236 +- .../bus_managers/acpi/utilities/utmutex.c | 33 +- .../bus_managers/acpi/utilities/utosi.c | 494 +++ .../bus_managers/acpi/utilities/uttrack.c | 21 +- .../bus_managers/acpi/utilities/utxface.c | 150 +- .../bus_managers/acpi/utilities/utxferror.c | 550 +++ 152 files changed, 4106 insertions(+), 49217 deletions(-) delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/Makefile delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslanalyze.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslcodegen.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslcompile.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.h delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.l delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.y delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/asldefine.h delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslerror.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslfiles.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslfold.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslglobal.h delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/asllength.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/asllisting.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslload.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/asllookup.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslmain.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslmap.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslopcodes.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/asloperands.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslopt.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslpredef.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslresource.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1i.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2d.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2e.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2q.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2w.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslstartup.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslstubs.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/asltransform.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/asltree.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/asltypes.h delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/aslutils.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/compiler/readme.txt delete mode 100644 src/add-ons/kernel/bus_managers/acpi/debugger/dbcmds.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/debugger/dbdisply.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/debugger/dbexec.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/debugger/dbfileio.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/debugger/dbhistry.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/debugger/dbinput.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/debugger/dbstats.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/debugger/dbutils.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/debugger/dbxface.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/disassembler/dmbuffer.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/disassembler/dmnames.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/disassembler/dmobject.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/disassembler/dmopcode.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrc.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcl.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcs.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/disassembler/dmutils.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/disassembler/dmwalk.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c delete mode 100644 src/add-ons/kernel/bus_managers/acpi/include/platform/accygwin.h delete mode 100644 src/add-ons/kernel/bus_managers/acpi/include/platform/acfreebsd.h delete mode 100644 src/add-ons/kernel/bus_managers/acpi/include/platform/aclinux.h delete mode 100644 src/add-ons/kernel/bus_managers/acpi/include/platform/acnetbsd.h delete mode 100644 src/add-ons/kernel/bus_managers/acpi/include/platform/acos2.h delete mode 100644 src/add-ons/kernel/bus_managers/acpi/include/platform/acwin.h delete mode 100644 src/add-ons/kernel/bus_managers/acpi/include/platform/acwin64.h create mode 100644 src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c diff --git a/headers/os/drivers/ACPI.h b/headers/os/drivers/ACPI.h index 374f683f00..eb4edbe76f 100644 --- a/headers/os/drivers/ACPI.h +++ b/headers/os/drivers/ACPI.h @@ -168,8 +168,7 @@ struct acpi_module_info { /* GPE Handler */ - status_t (*enable_gpe)(acpi_handle handle, uint32 gpeNumber, - uint32 flags); + status_t (*enable_gpe)(acpi_handle handle, uint32 gpeNumber); status_t (*set_gpe)(acpi_handle handle, uint32 gpeNumber, uint8 action); status_t (*install_gpe_handler)(acpi_handle handle, uint32 gpeNumber, diff --git a/src/add-ons/kernel/bus_managers/acpi/Jamfile b/src/add-ons/kernel/bus_managers/acpi/Jamfile index e11efc96eb..fdc8a4aa76 100644 --- a/src/add-ons/kernel/bus_managers/acpi/Jamfile +++ b/src/add-ons/kernel/bus_managers/acpi/Jamfile @@ -6,45 +6,11 @@ SubDirHdrs [ FDirName $(SUBDIR) include platform ] ; SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) pci ] ; SubDirCcFlags -fno-pic -D_KERNEL_MODE ; -local events_src = - evevent.c - evgpe.c - evgpeblk.c - evgpeinit.c - evgpeutil.c - evmisc.c - evregion.c - evrgnini.c - evsci.c - evxface.c - evxfevnt.c - evxfregn.c - ; - -local hardware_src = - hwacpi.c - hwgpe.c - hwregs.c - hwsleep.c - hwtimer.c - hwvalid.c - hwxface.c -; local common_src = - dmtable.c dmtbdump.c dmtbinfo.c -; - -local debugger_src = - dbdisply.c - dbxface.c -; - -local disassembler_src = - dmobject.c -; + ; local dispatcher_src = dsfield.c @@ -60,6 +26,21 @@ local dispatcher_src = dswstate.c ; +local events_src = + evevent.c + evgpe.c + evgpeblk.c + evgpeinit.c + evgpeutil.c + evmisc.c + evregion.c + evrgnini.c + evsci.c + evxface.c + evxfevnt.c + evxfregn.c + ; + local executer_src = exconfig.c exconvrt.c @@ -87,17 +68,16 @@ local executer_src = exutils.c ; -local parser_src = - psargs.c - psloop.c - psopcode.c - psparse.c - psscope.c - pstree.c - psutils.c - pswalk.c - psxface.c - ; +local hardware_src = + hwacpi.c + hwgpe.c + hwpci.c + hwregs.c + hwsleep.c + hwtimer.c + hwvalid.c + hwxface.c +; local namespace_src = nsaccess.c @@ -121,6 +101,18 @@ local namespace_src = nsxfobj.c ; +local parser_src = + psargs.c + psloop.c + psopcode.c + psparse.c + psscope.c + pstree.c + psutils.c + pswalk.c + psxface.c + ; + local resources_src = rsaddr.c rscalc.c @@ -161,35 +153,38 @@ local utilities_src = utmisc.c utmutex.c utobject.c + utosi.c utresrc.c utstate.c uttrack.c utxface.c + utxferror.c ; StaticLibrary libacpi_ca.a : - $(events_src) - $(hardware_src) + $(common_src) + $(compiler_src) $(dispatcher_src) + $(events_src) $(executer_src) - $(parser_src) + $(hardware_src) $(namespace_src) + $(parser_src) $(resources_src) $(tables_src) $(utilities_src) - $(common_src) - ; + ; +SEARCH on [ FGristFiles $(common_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi common ] ; +SEARCH on [ FGristFiles $(dispatcher_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi dispatcher ] ; SEARCH on [ FGristFiles $(events_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi events ] ; +SEARCH on [ FGristFiles $(executer_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi executer ] ; SEARCH on [ FGristFiles $(hardware_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi hardware ] ; SEARCH on [ FGristFiles $(namespace_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi namespace ] ; -SEARCH on [ FGristFiles $(resources_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi resources ] ; -SEARCH on [ FGristFiles $(tables_src) tbutils.c ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi tables ] ; -SEARCH on [ FGristFiles $(utilities_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi utilities ] ; -SEARCH on [ FGristFiles $(dispatcher_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi dispatcher ] ; -SEARCH on [ FGristFiles $(executer_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi executer ] ; SEARCH on [ FGristFiles $(parser_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi parser ] ; -SEARCH on [ FGristFiles $(common_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi common ] ; +SEARCH on [ FGristFiles $(resources_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi resources ] ; +SEARCH on [ FGristFiles $(tables_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi tables ] ; +SEARCH on [ FGristFiles $(utilities_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi utilities ] ; KernelAddon acpi : oshaiku.cpp diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c index 113d122bea..ca1cd46476 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c @@ -84,10 +84,10 @@ static void dump_madt() { while (true) { status = AcpiGetTable (ACPI_SIG_MADT, ++madtCount, &madt); if (status != AE_OK) break; - +/* dprintf("acpi: MADT TABLE:\n"); AcpiDmDumpDataTable( madt ); -/* entry = madt + 44; + entry = madt + 44; end = madt + madt->Header.Length; while (entry < end) { dprintf("\t\tType: %d\n", entry->Type); @@ -303,9 +303,9 @@ remove_notify_handler(acpi_handle device, uint32 handlerType, status_t -enable_gpe(acpi_handle handle, uint32 gpeNumber, uint32 flags) +enable_gpe(acpi_handle handle, uint32 gpeNumber) { - return AcpiEnableGpe(handle, gpeNumber, flags) == AE_OK ? B_OK : B_ERROR; + return AcpiEnableGpe(handle, gpeNumber) == AE_OK ? B_OK : B_ERROR; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp b/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp index 01e1135feb..a9ae6b44a9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp @@ -374,8 +374,7 @@ embedded_controller_init_driver(device_node* dev, void** _driverCookie) } // Enable runtime GPEs for the handler. - status = sc->ec_acpi_module->enable_gpe(sc->ec_gpehandle, sc->ec_gpebit, - ACPI_GPE_TYPE_RUNTIME); + status = sc->ec_acpi_module->enable_gpe(sc->ec_gpehandle, sc->ec_gpebit); if (status != B_OK) { TRACE("AcpiEnableGpe failed.\n"); goto error; diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h b/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h index 1c7f53f7a4..ce5d6db2a8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h @@ -61,8 +61,7 @@ typedef struct acpi_root_info { /* GPE Handler */ - status_t (*enable_gpe)(acpi_handle handle, uint32 gpeNumber, - uint32 flags); + status_t (*enable_gpe)(acpi_handle handle, uint32 gpeNumber); status_t (*set_gpe)(acpi_handle handle, uint32 gpeNumber, uint8 action); status_t (*install_gpe_handler)(acpi_handle handle, uint32 gpeNumber, @@ -154,7 +153,7 @@ status_t install_notify_handler(acpi_handle device, uint32 handlerType, status_t remove_notify_handler(acpi_handle device, uint32 handlerType, acpi_notify_handler handler); -status_t enable_gpe(acpi_handle handle, uint32 gpeNumber, uint32 flags); +status_t enable_gpe(acpi_handle handle, uint32 gpeNumber); status_t set_gpe(acpi_handle handle, uint32 gpeNumber, uint8 action); status_t install_gpe_handler(acpi_handle handle, uint32 gpeNumber, uint32 type, acpi_event_handler handler, void* data); diff --git a/src/add-ons/kernel/bus_managers/acpi/common/adfile.c b/src/add-ons/kernel/bus_managers/acpi/common/adfile.c index c7f3dfb476..629bd535c4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/adfile.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/adfile.c @@ -126,13 +126,13 @@ /* Local prototypes */ -INT32 +static INT32 AdWriteBuffer ( char *Filename, char *Buffer, UINT32 Length); -char FilenameBuf[20]; +static char FilenameBuf[20]; /****************************************************************************** @@ -190,7 +190,7 @@ AdGenerateFilename ( * ******************************************************************************/ -INT32 +static INT32 AdWriteBuffer ( char *Filename, char *Buffer, diff --git a/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c b/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c index eced93d536..99f91ba050 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c @@ -134,7 +134,6 @@ extern int AslCompilerdebug; -extern char *Gbl_ExternalFilename; ACPI_STATUS @@ -148,22 +147,18 @@ LsSetupNsList ( /* Local prototypes */ -void +static void AdCreateTableHeader ( char *Filename, ACPI_TABLE_HEADER *Table); -void -AdDisassemblerHeader ( - char *Filename); - -ACPI_STATUS +static ACPI_STATUS AdDeferredParse ( ACPI_PARSE_OBJECT *Op, UINT8 *Aml, UINT32 AmlLength); -ACPI_STATUS +static ACPI_STATUS AdParseDeferredOps ( ACPI_PARSE_OBJECT *Root); @@ -317,6 +312,7 @@ AdAmlDisassemble ( ACPI_STATUS Status; char *DisasmFilename = NULL; char *ExternalFilename; + ACPI_EXTERNAL_FILE *ExternalFileList = AcpiGbl_ExternalFileList; FILE *File = NULL; ACPI_TABLE_HEADER *Table = NULL; ACPI_TABLE_HEADER *ExternalTable; @@ -339,46 +335,54 @@ AdAmlDisassemble ( * External filenames separated by commas * Example: iasl -e file1,file2,file3 -d xxx.aml */ - if (Gbl_ExternalFilename) + while (ExternalFileList) { - ExternalFilename = strtok (Gbl_ExternalFilename, ","); - - while (ExternalFilename) + ExternalFilename = ExternalFileList->Path; + if (!ACPI_STRCMP (ExternalFilename, Filename)) { - Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable); + /* Next external file */ + + ExternalFileList = ExternalFileList->Next; + + continue; + } + + Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable); + if (ACPI_FAILURE (Status)) + { + return Status; + } + + /* Load external table for symbol resolution */ + + if (ExternalTable) + { + Status = AdParseTable (ExternalTable, &OwnerId, TRUE, TRUE); if (ACPI_FAILURE (Status)) { + AcpiOsPrintf ("Could not parse external ACPI tables, %s\n", + AcpiFormatException (Status)); return Status; } - /* Load external table for symbol resolution */ - - if (ExternalTable) - { - Status = AdParseTable (ExternalTable, &OwnerId, TRUE, TRUE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not parse external ACPI tables, %s\n", - AcpiFormatException (Status)); - return Status; - } - - /* - * Load namespace from names created within control methods - * Set owner id of nodes in external table - */ - AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, - AcpiGbl_RootNode, OwnerId); - AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); - } - - /* Next external file name */ - - ExternalFilename = strtok (NULL, ","); + /* + * Load namespace from names created within control methods + * Set owner id of nodes in external table + */ + AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); + AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); } - /* Clear external list generated by Scope in external tables */ + /* Next external file */ + ExternalFileList = ExternalFileList->Next; + } + + /* Clear external list generated by Scope in external tables */ + + if (AcpiGbl_ExternalFileList) + { AcpiDmClearExternalList (); } } @@ -502,7 +506,7 @@ AdAmlDisassemble ( if (AcpiDmGetExternalMethodCount ()) { fprintf (stderr, - "\nFound %d external control methods, reparsing with new information\n", + "\nFound %u external control methods, reparsing with new information\n", AcpiDmGetExternalMethodCount ()); /* @@ -515,10 +519,11 @@ AdAmlDisassemble ( AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; + AcpiGbl_RootNodeStruct.Parent = NULL; AcpiGbl_RootNodeStruct.Child = NULL; AcpiGbl_RootNodeStruct.Peer = NULL; AcpiGbl_RootNodeStruct.Object = NULL; - AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; + AcpiGbl_RootNodeStruct.Flags = 0; Status = AcpiNsRootInitialize (); AcpiDmAddExternalsToNamespace (); @@ -607,10 +612,10 @@ AdDisassemblerHeader ( /* Header and input table info */ - AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n"); - AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION); + AcpiOsPrintf ("/*\n"); + AcpiOsPrintf (ACPI_COMMON_HEADER ("AML Disassembler", " * ")); - AcpiOsPrintf (" *\n * Disassembly of %s, %s", Filename, ctime (&Timer)); + AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer)); AcpiOsPrintf (" *\n"); } @@ -629,7 +634,7 @@ AdDisassemblerHeader ( * *****************************************************************************/ -void +static void AdCreateTableHeader ( char *Filename, ACPI_TABLE_HEADER *Table) @@ -643,7 +648,7 @@ AdCreateTableHeader ( */ AdDisassemblerHeader (Filename); - AcpiOsPrintf (" *\n * Original Table Header:\n"); + AcpiOsPrintf (" * Original Table Header:\n"); AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature); AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length); @@ -688,7 +693,7 @@ AdCreateTableHeader ( AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision); AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId); AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); - AcpiOsPrintf (" */\n"); + AcpiOsPrintf (" */\n\n"); /* Create AML output filename based on input filename */ @@ -706,7 +711,7 @@ AdCreateTableHeader ( /* Open the ASL definition block */ AcpiOsPrintf ( - "DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n", + "DefinitionBlock (\"%s\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n", NewFilename, Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); @@ -776,7 +781,7 @@ AdDisplayTables ( * *****************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AdDeferredParse ( ACPI_PARSE_OBJECT *Op, UINT8 *Aml, @@ -899,7 +904,7 @@ AdDeferredParse ( * *****************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AdParseDeferredOps ( ACPI_PARSE_OBJECT *Root) { @@ -1018,7 +1023,7 @@ AdGetLocalTables ( * is architecture-dependent. */ NumTables = (NewTable->Length - sizeof (ACPI_TABLE_HEADER)) / PointerSize; - AcpiOsPrintf ("There are %d tables defined in the %4.4s\n\n", + AcpiOsPrintf ("There are %u tables defined in the %4.4s\n\n", NumTables, NewTable->Signature); /* Get the FADT */ 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 09411faeec..e8f580c1c1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c @@ -537,7 +537,7 @@ AcpiDmFindOrphanDescending ( } ArgCount = AcpiDmInspectPossibleArgs (3, 1, NextOp); - AcpiOsPrintf ("/* A-CHILDREN: %d Actual %d */\n", ArgCount, AcpiDmCountChildren (Op)); + AcpiOsPrintf ("/* A-CHILDREN: %u Actual %u */\n", ArgCount, AcpiDmCountChildren (Op)); if (ArgCount < 1) { @@ -792,6 +792,7 @@ AcpiDmXrefDescendingOp ( ACPI_PARSE_OBJECT *NextOp; ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *Object; + UINT32 ParamCount = 0; WalkState = Info->WalkState; @@ -880,18 +881,13 @@ AcpiDmXrefDescendingOp ( if (Object) { ObjectType2 = Object->Common.Type; + if (ObjectType2 == ACPI_TYPE_METHOD) + { + ParamCount = Object->Method.ParamCount; + } } - if (ObjectType2 == ACPI_TYPE_METHOD) - { - AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_METHOD, - Object->Method.ParamCount); - } - else - { - AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, 0); - } - + AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount); Op->Common.Node = Node; } else diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c b/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c index ab46b69793..393de1d53b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c @@ -252,7 +252,7 @@ AcpiDmNormalizeParentPrefix ( Node = Op->Common.Node; while (Node && (*Path == (UINT8) AML_PARENT_PREFIX)) { - Node = AcpiNsGetParentNode (Node); + Node = Node->Parent; Path++; } @@ -310,6 +310,95 @@ Cleanup: } +/******************************************************************************* + * + * FUNCTION: AcpiDmAddToExternalFileList + * + * PARAMETERS: PathList - Single path or list separated by comma + * + * RETURN: None + * + * DESCRIPTION: Add external files to global list + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDmAddToExternalFileList ( + char *PathList) +{ + ACPI_EXTERNAL_FILE *ExternalFile; + char *Path; + char *TmpPath; + + + if (!PathList) + { + return (AE_OK); + } + + Path = strtok (PathList, ","); + + while (Path) + { + TmpPath = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (Path) + 1); + if (!TmpPath) + { + return (AE_NO_MEMORY); + } + + ACPI_STRCPY (TmpPath, Path); + + ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE)); + if (!ExternalFile) + { + ACPI_FREE (TmpPath); + return (AE_NO_MEMORY); + } + + ExternalFile->Path = TmpPath; + + if (AcpiGbl_ExternalFileList) + { + ExternalFile->Next = AcpiGbl_ExternalFileList; + } + + AcpiGbl_ExternalFileList = ExternalFile; + Path = strtok (NULL, ","); + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmClearExternalFileList + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Clear the external file list + * + ******************************************************************************/ + +void +AcpiDmClearExternalFileList ( + void) +{ + ACPI_EXTERNAL_FILE *NextExternal; + + + while (AcpiGbl_ExternalFileList) + { + NextExternal = AcpiGbl_ExternalFileList->Next; + ACPI_FREE (AcpiGbl_ExternalFileList->Path); + ACPI_FREE (AcpiGbl_ExternalFileList); + AcpiGbl_ExternalFileList = NextExternal; + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmAddToExternalList @@ -629,7 +718,7 @@ AcpiDmEmitExternals ( if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD) { - AcpiOsPrintf (") // %d Arguments\n", + AcpiOsPrintf (") // %u Arguments\n", AcpiGbl_ExternalList->Value); } else 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 97f6c476e5..184a856ed6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c @@ -549,13 +549,6 @@ AcpiDmGetResourceNode ( return (Node); } - /* List is circular, this flag marks the end */ - - if (Node->Flags & ANOBJ_END_OF_PEER_LIST) - { - return (NULL); - } - Node = Node->Peer; } @@ -711,8 +704,8 @@ AcpiDmUpdateResourceName ( Name[0] = '_'; Name[1] = AcpiGbl_Prefix[AcpiGbl_NextPrefix]; - Name[2] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 4); - Name[3] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 0); + Name[2] = AcpiUtHexToAsciiChar ((UINT64) AcpiGbl_NextResourceId, 4); + Name[3] = AcpiUtHexToAsciiChar ((UINT64) AcpiGbl_NextResourceId, 0); /* Update globals for next name */ 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 057194d551..05bd5e4945 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c @@ -117,6 +117,8 @@ #include "accommon.h" #include "acdisasm.h" #include "actables.h" +#include "aslcompiler.h" +#include "dtcompiler.h" /* This module used for application-level code only */ @@ -125,20 +127,12 @@ /* Local Prototypes */ -static ACPI_DMTABLE_DATA * -AcpiDmGetTableData ( - char *Signature); - static void AcpiDmCheckAscii ( UINT8 *Target, char *RepairedName, UINT32 Count); -UINT8 -AcpiTbGenerateChecksum ( - ACPI_TABLE_HEADER *Table); - /* These tables map a subtable type to a description string */ @@ -161,6 +155,74 @@ static const char *AcpiDmDmarSubnames[] = "Unknown SubTable Type" /* Reserved */ }; +static const char *AcpiDmEinjActions[] = +{ + "Begin Operation", + "Get Trigger Table", + "Set Error Type", + "Get Error Type", + "End Operation", + "Execute Operation", + "Check Busy Status", + "Get Command Status", + "Unknown Action" +}; + +static const char *AcpiDmEinjInstructions[] = +{ + "Read Register", + "Read Register Value", + "Write Register", + "Write Register Value", + "Noop", + "Unknown Instruction" +}; + +static const char *AcpiDmErstActions[] = +{ + "Begin Write Operation", + "Begin Read Operation", + "Begin Clear Operation", + "End Operation", + "Set Record Offset", + "Execute Operation", + "Check Busy Status", + "Get Command Status", + "Get Record Identifier", + "Set Record Identifier", + "Get Record Count", + "Begin Dummy Write", + "Unused/Unknown Action", + "Get Error Address Range", + "Get Error Address Length", + "Get Error Attributes", + "Unknown Action" +}; + +static const char *AcpiDmErstInstructions[] = +{ + "Read Register", + "Read Register Value", + "Write Register", + "Write Register Value", + "Noop", + "Load Var1", + "Load Var2", + "Store Var1", + "Add", + "Subtract", + "Add Value", + "Subtract Value", + "Stall", + "Stall While True", + "Skip Next If True", + "GoTo", + "Set Source Address", + "Set Destination Address", + "Move Data", + "Unknown Instruction" +}; + static const char *AcpiDmHestSubnames[] = { "IA-32 Machine Check Exception", @@ -237,56 +299,59 @@ static const char *AcpiDmFadtProfiles[] = * * ACPI Table Data, indexed by signature. * - * Each entry contains: Signature, Table Info, Handler, Description + * Each entry contains: Signature, Table Info, Handler, DtHandler, + * Template, Description * - * Simple tables have only a TableInfo structure, complex tables have a handler. - * This table must be NULL terminated. RSDP and FACS are special-cased - * elsewhere. + * Simple tables have only a TableInfo structure, complex tables have a + * handler. This table must be NULL terminated. RSDP and FACS are + * special-cased elsewhere. * ******************************************************************************/ -static ACPI_DMTABLE_DATA AcpiDmTableData[] = +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_IVRS, NULL, AcpiDmDumpIvrs, "I/O Virtualization Reporting Structure"}, - {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"}, - {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"}, - {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, "Management Controller Host Interface table"}, - {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, "Maximum System Characteristics 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"}, - {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, "System Resource Affinity Table"}, - {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, "Trusted Computing Platform Alliance table"}, - {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, "UEFI Boot Optimization Table"}, - {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, "Windows ACPI Emulated Devices Table"}, - {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, "Watchdog Action Table"}, - {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, "Watchdog Resource Table"}, - {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, "Extended System Description Table"}, - {NULL, NULL, NULL, NULL} + {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"}, + {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"}, + {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"}, + {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"}, + {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"}, + {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"}, + {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"}, + {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"}, + {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"}, + {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table"}, + {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"}, + {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"}, + {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"}, + {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table"}, + {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"}, + {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"}, + {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"}, + {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"}, + {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"}, + {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, NULL, NULL, "Software Licensing Description Table"}, + {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"}, + {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"}, + {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"}, + {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"}, + {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"}, + {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, NULL, TemplateUefi, "UEFI Boot Optimization Table"}, + {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"}, + {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"}, + {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"}, + {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt, "Watchdog Resource Table"}, + {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt, "Extended System Description Table"}, + {NULL, NULL, NULL, NULL, NULL, NULL} }; /******************************************************************************* * - * FUNCTION: AcpiTbGenerateChecksum + * FUNCTION: AcpiDmGenerateChecksum * - * PARAMETERS: Table - Pointer to a valid ACPI table (with a - * standard ACPI header) + * PARAMETERS: Table - Pointer to table to be checksummed + * Length - Length of the table + * OriginalChecksum - Value of the checksum field * * RETURN: 8 bit checksum of buffer * @@ -295,19 +360,21 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] = ******************************************************************************/ UINT8 -AcpiTbGenerateChecksum ( - ACPI_TABLE_HEADER *Table) +AcpiDmGenerateChecksum ( + void *Table, + UINT32 Length, + UINT8 OriginalChecksum) { UINT8 Checksum; /* Sum the entire table as-is */ - Checksum = AcpiTbChecksum ((UINT8 *) Table, Table->Length); + Checksum = AcpiTbChecksum ((UINT8 *) Table, Length); /* Subtract off the existing checksum value in the table */ - Checksum = (UINT8) (Checksum - Table->Checksum); + Checksum = (UINT8) (Checksum - OriginalChecksum); /* Compute the final checksum */ @@ -328,7 +395,7 @@ AcpiTbGenerateChecksum ( * ******************************************************************************/ -static ACPI_DMTABLE_DATA * +ACPI_DMTABLE_DATA * AcpiDmGetTableData ( char *Signature) { @@ -432,10 +499,13 @@ AcpiDmDumpDataTable ( } } - /* Always dump the raw table data */ + if (!Gbl_DoTemplates || Gbl_VerboseTemplates) + { + /* Dump the raw table data */ - AcpiOsPrintf ("\nRaw Table Data\n\n"); - AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY); + AcpiOsPrintf ("\nRaw Table Data\n\n"); + AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY); + } } @@ -463,15 +533,31 @@ AcpiDmLineHeader ( char *Name) { - if (ByteLength) + if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */ { - AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ", - Offset, Offset, ByteLength, Name); + if (ByteLength) + { + AcpiOsPrintf ("[%.3d] %34s : ", + ByteLength, Name); + } + else + { + AcpiOsPrintf ("%40s : ", + Name); + } } - else + else /* Normal disassembler or verbose template */ { - AcpiOsPrintf ("%43s : ", - Name); + if (ByteLength) + { + AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ", + Offset, Offset, ByteLength, Name); + } + else + { + AcpiOsPrintf ("%43s : ", + Name); + } } } @@ -483,15 +569,31 @@ AcpiDmLineHeader2 ( UINT32 Value) { - if (ByteLength) + if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */ { - AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ", - Offset, Offset, ByteLength, Name, Value); + if (ByteLength) + { + AcpiOsPrintf ("[%.3d] %30s % 3d : ", + ByteLength, Name, Value); + } + else + { + AcpiOsPrintf ("%36s % 3d : ", + Name, Value); + } } - else + else /* Normal disassembler or verbose template */ { - AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ", - Offset, Offset, Name, Value); + if (ByteLength) + { + AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ", + Offset, Offset, ByteLength, Name, Value); + } + else + { + AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ", + Offset, Offset, Name, Value); + } } } @@ -511,6 +613,8 @@ AcpiDmLineHeader2 ( * * DESCRIPTION: Display ACPI table contents by walking the Info table. * + * Note: This function must remain in sync with DtGetFieldLength. + * ******************************************************************************/ ACPI_STATUS @@ -571,6 +675,10 @@ AcpiDmDumpTable ( case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: case ACPI_DMT_FADTPM: + case ACPI_DMT_EINJACT: + case ACPI_DMT_EINJINST: + case ACPI_DMT_ERSTACT: + case ACPI_DMT_ERSTINST: ByteLength = 1; break; case ACPI_DMT_UINT16: @@ -705,7 +813,11 @@ AcpiDmDumpTable ( for (Temp8 = 0; Temp8 < 16; Temp8++) { - AcpiOsPrintf ("%2.2X,", Target[Temp8]); + AcpiOsPrintf ("%2.2X", Target[Temp8]); + if ((Temp8 + 1) < 16) + { + AcpiOsPrintf (","); + } } AcpiOsPrintf ("\n"); break; @@ -754,7 +866,9 @@ AcpiDmDumpTable ( /* Checksum, display and validate */ AcpiOsPrintf ("%2.2X", *Target); - Temp8 = AcpiTbGenerateChecksum (Table); + Temp8 = AcpiDmGenerateChecksum (Table, + ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, + ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum); if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum) { AcpiOsPrintf ( @@ -807,6 +921,58 @@ AcpiDmDumpTable ( AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); break; + case ACPI_DMT_EINJACT: + + /* EINJ Action types */ + + Temp8 = *Target; + if (Temp8 > ACPI_EINJ_ACTION_RESERVED) + { + Temp8 = ACPI_EINJ_ACTION_RESERVED; + } + + AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjActions[Temp8]); + break; + + case ACPI_DMT_EINJINST: + + /* EINJ Instruction types */ + + Temp8 = *Target; + if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED) + { + Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED; + } + + AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjInstructions[Temp8]); + break; + + case ACPI_DMT_ERSTACT: + + /* ERST Action types */ + + Temp8 = *Target; + if (Temp8 > ACPI_ERST_ACTION_RESERVED) + { + Temp8 = ACPI_ERST_ACTION_RESERVED; + } + + AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstActions[Temp8]); + break; + + case ACPI_DMT_ERSTINST: + + /* ERST Instruction types */ + + Temp8 = *Target; + if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED) + { + Temp8 = ACPI_ERST_INSTRUCTION_RESERVED; + } + + AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstInstructions[Temp8]); + break; + case ACPI_DMT_HEST: /* HEST subtable types */ @@ -842,7 +1008,6 @@ AcpiDmDumpTable ( AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]); break; - case ACPI_DMT_MADT: /* MADT subtable types */ 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 af7ee6712a..8bbaf663fb 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c @@ -130,7 +130,8 @@ * * PARAMETERS: Table - A RSDP * - * RETURN: Length of the table (there is no length field, use revision) + * RETURN: Length of the table (there is not always a length field, + * use revision or length if available (ACPI 2.0+)) * * DESCRIPTION: Format the contents of a RSDP * @@ -140,19 +141,42 @@ UINT32 AcpiDmDumpRsdp ( ACPI_TABLE_HEADER *Table) { - UINT32 Length = ACPI_RSDP_REV0_SIZE; + ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table); + UINT32 Length = sizeof (ACPI_RSDP_COMMON); + UINT8 Checksum; /* Dump the common ACPI 1.0 portion */ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1); - /* ACPI 2.0+ contains more data and has a Length field */ + /* Validate the first checksum */ - if (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Revision > 0) + Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON), + Rsdp->Checksum); + if (Checksum != Rsdp->Checksum) { - Length = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Length; + AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n", + Checksum); + } + + /* The RSDP for ACPI 2.0+ contains more data and has a Length field */ + + if (Rsdp->Revision > 0) + { + Length = Rsdp->Length; AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2); + + /* Validate the extended checksum over entire RSDP */ + + Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP), + Rsdp->ExtendedChecksum); + if (Checksum != Rsdp->ExtendedChecksum) + { + AcpiOsPrintf ( + "/* Incorrect Extended Checksum above, should be 0x%2.2X */\n", + Checksum); + } } return (Length); @@ -595,7 +619,7 @@ AcpiDmDumpDmar ( while (PathOffset < ScopeTable->Length) { AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path"); - AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]); + AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]); /* Point to next PCI Path entry */ @@ -709,7 +733,7 @@ AcpiDmDumpErst ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); + sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0); if (ACPI_FAILURE (Status)) { return; @@ -1174,7 +1198,7 @@ AcpiDmDumpMcfg ( { if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length) { - AcpiOsPrintf ("Warning: there are %d invalid trailing bytes\n", + AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n", sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length)); return; } @@ -1301,15 +1325,20 @@ AcpiDmDumpSlit ( return; } - AcpiOsPrintf ("%2.2X ", Row[j]); + AcpiOsPrintf ("%2.2X", Row[j]); Offset++; /* Display up to 16 bytes per output row */ - if (j && (((j+1) % 16) == 0) && ((j+1) < Localities)) + if ((j+1) < Localities) { - AcpiOsPrintf ("\n"); - AcpiDmLineHeader (Offset, 0, ""); + AcpiOsPrintf (","); + + if (j && (((j+1) % 16) == 0)) + { + AcpiOsPrintf ("\n"); + AcpiDmLineHeader (Offset, 0, ""); + } } } 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 5c7ecb8e26..9abf586b3f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c @@ -153,6 +153,7 @@ #define ACPI_UEFI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_UEFI,f) #define ACPI_WAET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WAET,f) #define ACPI_WDAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDAT,f) +#define ACPI_WDDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDDT,f) #define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f) /* Subtables */ @@ -171,6 +172,7 @@ #define ACPI_DMAR2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_ATSR,f) #define ACPI_DMAR3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RHSA,f) #define ACPI_EINJ0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) +#define ACPI_ERST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) #define ACPI_HEST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f) #define ACPI_HEST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_CORRECTED,f) #define ACPI_HEST2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_NMI,f) @@ -229,6 +231,17 @@ #define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f,o) #define ACPI_MADT9_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC,f,o) #define ACPI_MADT10_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f,o) +#define ACPI_WDDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WDDT,f,o) +#define ACPI_EINJ0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) +#define ACPI_ERST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) +#define ACPI_HEST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f,o) +#define ACPI_HEST1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_IA_CORRECTED,f,o) +#define ACPI_HEST6_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_AER_ROOT,f,o) + +/* + * Required terminator for all tables below + */ +#define ACPI_DMT_TERMINATOR {ACPI_DMT_EXIT, 0, NULL, 0} /* @@ -245,16 +258,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[] = { - {ACPI_DMT_SIG, ACPI_HDR_OFFSET (Signature[0]), "Signature"}, - {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (Length), "Table Length"}, - {ACPI_DMT_UINT8, ACPI_HDR_OFFSET (Revision), "Revision"}, - {ACPI_DMT_CHKSUM, ACPI_HDR_OFFSET (Checksum), "Checksum"}, - {ACPI_DMT_NAME6, ACPI_HDR_OFFSET (OemId[0]), "Oem ID"}, - {ACPI_DMT_NAME8, ACPI_HDR_OFFSET (OemTableId[0]), "Oem Table ID"}, - {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (OemRevision), "Oem Revision"}, - {ACPI_DMT_NAME4, ACPI_HDR_OFFSET (AslCompilerId[0]), "Asl Compiler ID"}, - {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (AslCompilerRevision), "Asl Compiler Revision"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_SIG, ACPI_HDR_OFFSET (Signature[0]), "Signature", 0}, + {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (Length), "Table Length", DT_LENGTH}, + {ACPI_DMT_UINT8, ACPI_HDR_OFFSET (Revision), "Revision", 0}, + {ACPI_DMT_CHKSUM, ACPI_HDR_OFFSET (Checksum), "Checksum", 0}, + {ACPI_DMT_NAME6, ACPI_HDR_OFFSET (OemId[0]), "Oem ID", 0}, + {ACPI_DMT_NAME8, ACPI_HDR_OFFSET (OemTableId[0]), "Oem Table ID", 0}, + {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (OemRevision), "Oem Revision", 0}, + {ACPI_DMT_NAME4, ACPI_HDR_OFFSET (AslCompilerId[0]), "Asl Compiler ID", 0}, + {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (AslCompilerRevision), "Asl Compiler Revision", 0}, + ACPI_DMT_TERMINATOR }; @@ -266,12 +279,12 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[] = ACPI_DMTABLE_INFO AcpiDmTableInfoGas[] = { - {ACPI_DMT_SPACEID, ACPI_GAS_OFFSET (SpaceId), "Space ID"}, - {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitWidth), "Bit Width"}, - {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitOffset), "Bit Offset"}, - {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (AccessWidth), "Access Width"}, - {ACPI_DMT_UINT64, ACPI_GAS_OFFSET (Address), "Address"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_SPACEID, ACPI_GAS_OFFSET (SpaceId), "Space ID", 0}, + {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitWidth), "Bit Width", 0}, + {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitOffset), "Bit Offset", 0}, + {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (AccessWidth), "Access Width", 0}, + {ACPI_DMT_UINT64, ACPI_GAS_OFFSET (Address), "Address", 0}, + ACPI_DMT_TERMINATOR }; @@ -283,23 +296,23 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoGas[] = ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[] = { - {ACPI_DMT_NAME8, ACPI_RSDP_OFFSET (Signature[0]), "Signature"}, - {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Checksum), "Checksum"}, - {ACPI_DMT_NAME6, ACPI_RSDP_OFFSET (OemId[0]), "Oem ID"}, - {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Revision), "Revision"}, - {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (RsdtPhysicalAddress), "RSDT Address"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_NAME8, ACPI_RSDP_OFFSET (Signature[0]), "Signature", 0}, + {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Checksum), "Checksum", 0}, + {ACPI_DMT_NAME6, ACPI_RSDP_OFFSET (OemId[0]), "Oem ID", 0}, + {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Revision), "Revision", 0}, + {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (RsdtPhysicalAddress), "RSDT Address", 0}, + ACPI_DMT_TERMINATOR }; /* ACPI 2.0+ Extensions */ ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[] = { - {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (Length), "Length"}, - {ACPI_DMT_UINT64, ACPI_RSDP_OFFSET (XsdtPhysicalAddress), "XSDT Address"}, - {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (ExtendedChecksum), "Extended Checksum"}, - {ACPI_DMT_UINT24, ACPI_RSDP_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT64, ACPI_RSDP_OFFSET (XsdtPhysicalAddress), "XSDT Address", 0}, + {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (ExtendedChecksum), "Extended Checksum", 0}, + {ACPI_DMT_UINT24, ACPI_RSDP_OFFSET (Reserved[0]), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; @@ -311,20 +324,20 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[] = ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] = { - {ACPI_DMT_NAME4, ACPI_FACS_OFFSET (Signature[0]), "Signature"}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Length), "Length"}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (HardwareSignature), "Hardware Signature"}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "32 Firmware Waking Vector"}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (GlobalLock), "Global Lock"}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (Flags,0), "S4BIOS Support Present"}, - {ACPI_DMT_FLAG1, ACPI_FACS_FLAG_OFFSET (Flags,0), "64-bit Wake Supported (V2)"}, - {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "64 Firmware Waking Vector"}, - {ACPI_DMT_UINT8, ACPI_FACS_OFFSET (Version), "Version"}, - {ACPI_DMT_UINT24, ACPI_FACS_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (OspmFlags), "OspmFlags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (OspmFlags,0), "64-bit Wake Env Required (V2)"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_NAME4, ACPI_FACS_OFFSET (Signature[0]), "Signature", 0}, + {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (HardwareSignature), "Hardware Signature", 0}, + {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "32 Firmware Waking Vector", 0}, + {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (GlobalLock), "Global Lock", 0}, + {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (Flags,0), "S4BIOS Support Present", 0}, + {ACPI_DMT_FLAG1, ACPI_FACS_FLAG_OFFSET (Flags,0), "64-bit Wake Supported (V2)", 0}, + {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "64 Firmware Waking Vector", 0}, + {ACPI_DMT_UINT8, ACPI_FACS_OFFSET (Version), "Version", 0}, + {ACPI_DMT_UINT24, ACPI_FACS_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (OspmFlags), "OspmFlags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (OspmFlags,0), "64-bit Wake Env Required (V2)", 0}, + ACPI_DMT_TERMINATOR }; @@ -338,113 +351,113 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] = ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] = { - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Facs), "FACS Address"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Dsdt), "DSDT Address"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Model), "Model"}, - {ACPI_DMT_FADTPM, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile"}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (SciInterrupt), "SCI Interrupt"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (SmiCommand), "SMI Command Port"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiEnable), "ACPI Enable Value"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiDisable), "ACPI Disable Value"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (S4BiosRequest), "S4BIOS Command"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PstateControl), "P-State Control"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aEventBlock), "PM1A Event Block Address"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bEventBlock), "PM1B Event Block Address"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aControlBlock), "PM1A Control Block Address"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bControlBlock), "PM1B Control Block Address"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm2ControlBlock), "PM2 Control Block Address"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (PmTimerBlock), "PM Timer Block Address"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe0Block), "GPE0 Block Address"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe1Block), "GPE1 Block Address"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1EventLength), "PM1 Event Block Length"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1ControlLength), "PM1 Control Block Length"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm2ControlLength), "PM2 Control Block Length"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PmTimerLength), "PM Timer Block Length"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe0BlockLength), "GPE0 Block Length"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1BlockLength), "GPE1 Block Length"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1Base), "GPE1 Base Offset"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (CstControl), "_CST Support"}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C2Latency), "C2 Latency"}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C3Latency), "C3 Latency"}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushSize), "CPU Cache Size"}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushStride), "Cache Flush Stride"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyOffset), "Duty Cycle Offset"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyWidth), "Duty Cycle Width"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DayAlarm), "RTC Day Alarm Index"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MonthAlarm), "RTC Month Alarm Index"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Century), "RTC Century Index"}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Flags (decoded below)"}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Facs), "FACS Address", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Dsdt), "DSDT Address", DT_NON_ZERO}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Model), "Model", 0}, + {ACPI_DMT_FADTPM, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile", 0}, + {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (SciInterrupt), "SCI Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (SmiCommand), "SMI Command Port", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiEnable), "ACPI Enable Value", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiDisable), "ACPI Disable Value", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (S4BiosRequest), "S4BIOS Command", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PstateControl), "P-State Control", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aEventBlock), "PM1A Event Block Address", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bEventBlock), "PM1B Event Block Address", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aControlBlock), "PM1A Control Block Address", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bControlBlock), "PM1B Control Block Address", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm2ControlBlock), "PM2 Control Block Address", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (PmTimerBlock), "PM Timer Block Address", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe0Block), "GPE0 Block Address", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe1Block), "GPE1 Block Address", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1EventLength), "PM1 Event Block Length", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1ControlLength), "PM1 Control Block Length", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm2ControlLength), "PM2 Control Block Length", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PmTimerLength), "PM Timer Block Length", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe0BlockLength), "GPE0 Block Length", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1BlockLength), "GPE1 Block Length", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1Base), "GPE1 Base Offset", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (CstControl), "_CST Support", 0}, + {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C2Latency), "C2 Latency", 0}, + {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C3Latency), "C3 Latency", 0}, + {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushSize), "CPU Cache Size", 0}, + {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushStride), "Cache Flush Stride", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyOffset), "Duty Cycle Offset", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyWidth), "Duty Cycle Width", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DayAlarm), "RTC Day Alarm Index", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MonthAlarm), "RTC Month Alarm Index", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Century), "RTC Century Index", 0}, + {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Flags (decoded below)", DT_FLAG}, /* Boot Architecture Flags byte 0 */ - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "Legacy Devices Supported (V2)"}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "8042 Present on ports 60/64 (V2)"}, - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "VGA Not Present (V4)"}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "MSI Not Supported (V4)"}, - {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "PCIe ASPM Not Supported (V4)"}, + {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "Legacy Devices Supported (V2)", 0}, + {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "8042 Present on ports 60/64 (V2)", 0}, + {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "VGA Not Present (V4)", 0}, + {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "MSI Not Supported (V4)", 0}, + {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "PCIe ASPM Not Supported (V4)", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Flags), "Flags (decoded below)"}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, /* Flags byte 0 */ - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD instruction is operational (V1)"}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD flushes all caches (V1)"}, - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1 (V1)"}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system (V1)"}, - {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Power Button (V1)"}, - {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Sleep Button (V1)"}, - {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wake not in fixed reg space (V1)"}, - {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC can wake system from S4 (V1)"}, + {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD instruction is operational (V1)", 0}, + {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD flushes all caches (V1)", 0}, + {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1 (V1)", 0}, + {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system (V1)", 0}, + {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Power Button (V1)", 0}, + {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Sleep Button (V1)", 0}, + {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wake not in fixed reg space (V1)", 0}, + {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC can wake system from S4 (V1)", 0}, /* Flags byte 1 */ - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer (V1)"}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported (V1)"}, - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported (V2)"}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case (V3)"}, - {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video (V3)"}, - {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use native instr after SLP_TYPx (V3)"}, - {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Bits Supported (V4)"}, - {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer (V4)"}, + {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer (V1)", 0}, + {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported (V1)", 0}, + {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported (V2)", 0}, + {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case (V3)", 0}, + {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video (V3)", 0}, + {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use native instr after SLP_TYPx (V3)", 0}, + {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Bits Supported (V4)", 0}, + {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer (V4)", 0}, /* Flags byte 2 */ - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid on S4 wake (V4)"}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable (V4)"}, - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Cluster Model (V4)"}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Physical Destination Mode (V4)"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid on S4 wake (V4)", 0}, + {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable (V4)", 0}, + {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Cluster Model (V4)", 0}, + {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Physical Destination Mode (V4)", 0}, + ACPI_DMT_TERMINATOR }; /* ACPI 1.0 MS Extensions (FADT version 2) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] = { - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset"}, - {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset", 0}, + {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; /* ACPI 2.0+ Extensions (FADT version 3+) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] = { - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset"}, - {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved"}, - {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XFacs), "FACS Address"}, - {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XDsdt), "DSDT Address"}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aEventBlock), "PM1A Event Block"}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bEventBlock), "PM1B Event Block"}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aControlBlock), "PM1A Control Block"}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bControlBlock), "PM1B Control Block"}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm2ControlBlock), "PM2 Control Block"}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPmTimerBlock), "PM Timer Block"}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe0Block), "GPE0 Block"}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe1Block), "GPE1 Block"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset", 0}, + {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XFacs), "FACS Address", 0}, + {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XDsdt), "DSDT Address", 0}, + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aEventBlock), "PM1A Event Block", 0}, + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bEventBlock), "PM1B Event Block", 0}, + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aControlBlock), "PM1A Control Block", 0}, + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bControlBlock), "PM1B Control Block", 0}, + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm2ControlBlock), "PM2 Control Block", 0}, + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPmTimerBlock), "PM Timer Block", 0}, + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe0Block), "GPE0 Block", 0}, + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe1Block), "GPE1 Block", 0}, + ACPI_DMT_TERMINATOR }; @@ -462,97 +475,97 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] = ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] = { - {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} + {ACPI_DMT_ASF, ACPI_ASF0_OFFSET (Header.Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Reserved), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (Header.Length), "Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR }; /* 0: ASF Information */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[] = { - {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Reset Value"}, - {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinPollInterval), "Minimum Polling Interval"}, - {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (SystemId), "System ID"}, - {ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (MfgId), "Manufacturer ID"}, - {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Flags), "Flags"}, - {ACPI_DMT_UINT24, ACPI_ASF0_OFFSET (Reserved2[0]), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Reset Value", 0}, + {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinPollInterval), "Minimum Polling Interval", 0}, + {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (SystemId), "System ID", 0}, + {ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (MfgId), "Manufacturer ID", 0}, + {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_UINT24, ACPI_ASF0_OFFSET (Reserved2[0]), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; /* 1: ASF Alerts */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1[] = { - {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (AssertMask), "AssertMask"}, - {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DeassertMask), "DeassertMask"}, - {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (Alerts), "Alert Count"}, - {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DataLength), "Alert Data Length"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (AssertMask), "AssertMask", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DeassertMask), "DeassertMask", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (Alerts), "Alert Count", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DataLength), "Alert Data Length", 0}, + ACPI_DMT_TERMINATOR }; /* 1a: ASF Alert data */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1a[] = { - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Address), "Address"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Command), "Command"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Mask), "Mask"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Value), "Value"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorType), "SensorType"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Type), "Type"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Offset), "Offset"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SourceType), "SourceType"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Severity), "Severity"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorNumber), "SensorNumber"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Entity), "Entity"}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Instance), "Instance"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Address), "Address", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Command), "Command", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Mask), "Mask", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Value), "Value", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorType), "SensorType", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Type), "Type", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Offset), "Offset", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SourceType), "SourceType", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Severity), "Severity", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorNumber), "SensorNumber", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Entity), "Entity", 0}, + {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Instance), "Instance", 0}, + ACPI_DMT_TERMINATOR }; /* 2: ASF Remote Control */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2[] = { - {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (Controls), "Control Count"}, - {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (DataLength), "Control Data Length"}, - {ACPI_DMT_UINT16, ACPI_ASF2_OFFSET (Reserved2), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (Controls), "Control Count", 0}, + {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (DataLength), "Control Data Length", 0}, + {ACPI_DMT_UINT16, ACPI_ASF2_OFFSET (Reserved2), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; /* 2a: ASF Control data */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[] = { - {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Function), "Function"}, - {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Address), "Address"}, - {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Command), "Command"}, - {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Value), "Value"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Function), "Function", 0}, + {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Address), "Address", 0}, + {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Command), "Command", 0}, + {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Value), "Value", 0}, + ACPI_DMT_TERMINATOR }; /* 3: ASF RMCP Boot Options */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[] = { - {ACPI_DMT_UINT56, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilites"}, - {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code"}, - {ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID"}, - {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command"}, - {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (Parameter), "Parameter"}, - {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (BootOptions), "Boot Options"}, - {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (OemParameters), "Oem Parameters"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT56, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0}, + {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code", 0}, + {ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID", 0}, + {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command", 0}, + {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (Parameter), "Parameter", 0}, + {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (BootOptions), "Boot Options", 0}, + {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (OemParameters), "Oem Parameters", 0}, + ACPI_DMT_TERMINATOR }; /* 4: ASF Address */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] = { - {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (EpromAddress), "Eprom Address"}, - {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (Devices), "Device Count"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (EpromAddress), "Eprom Address", 0}, + {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (Devices), "Device Count", DT_COUNT}, + ACPI_DMT_TERMINATOR }; @@ -564,9 +577,9 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] = 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} + {ACPI_DMT_UINT32, ACPI_BERT_OFFSET (RegionLength), "Boot Error Region Length", 0}, + {ACPI_DMT_UINT64, ACPI_BERT_OFFSET (Address), "Boot Error Region Address", 0}, + ACPI_DMT_TERMINATOR }; @@ -578,9 +591,9 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoBert[] = ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[] = { - {ACPI_DMT_UINT8, ACPI_BOOT_OFFSET (CmosIndex), "Boot Register Index"}, - {ACPI_DMT_UINT24, ACPI_BOOT_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_BOOT_OFFSET (CmosIndex), "Boot Register Index", 0}, + {ACPI_DMT_UINT24, ACPI_BOOT_OFFSET (Reserved[0]), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; @@ -592,18 +605,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[] = ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] = { - {ACPI_DMT_UINT64, ACPI_CPEP_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT64, ACPI_CPEP_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] = { - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Length), "Length"}, - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID"}, - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID"}, - {ACPI_DMT_UINT32, ACPI_CPEP0_OFFSET (Interval), "Polling Interval"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID", 0}, + {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID", 0}, + {ACPI_DMT_UINT32, ACPI_CPEP0_OFFSET (Interval), "Polling Interval", 0}, + ACPI_DMT_TERMINATOR }; @@ -615,10 +628,10 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] = ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[] = { - {ACPI_DMT_UINT8, ACPI_DBGP_OFFSET (Type), "Interface Type"}, - {ACPI_DMT_UINT24, ACPI_DBGP_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_GAS, ACPI_DBGP_OFFSET (DebugPort), "Debug Port Register"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_DBGP_OFFSET (Type), "Interface Type", 0}, + {ACPI_DMT_UINT24, ACPI_DBGP_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_GAS, ACPI_DBGP_OFFSET (DebugPort), "Debug Port Register", 0}, + ACPI_DMT_TERMINATOR }; @@ -630,30 +643,30 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[] = ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] = { - {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width"}, - {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Flags), "Flags"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width", 0}, + {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Flags), "Flags", 0}, + ACPI_DMT_TERMINATOR }; /* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[] = { - {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Header.Length), "Length"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Subtable Type", 0}, + {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Header.Length), "Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR }; /* Common device scope entry */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[] = { - {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EntryType), "Device Scope Entry Type"}, - {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Length), "Entry Length"}, - {ACPI_DMT_UINT16, ACPI_DMARS_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EnumerationId), "Enumeration ID"}, - {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Bus), "PCI Bus Number"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EntryType), "Device Scope Entry Type", 0}, + {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Length), "Entry Length", DT_LENGTH}, + {ACPI_DMT_UINT16, ACPI_DMARS_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EnumerationId), "Enumeration ID", 0}, + {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Bus), "PCI Bus Number", 0}, + ACPI_DMT_TERMINATOR }; /* DMAR Subtables */ @@ -662,42 +675,42 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[] = ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[] = { - {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Flags), "Flags"}, - {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Segment), "PCI Segment Number"}, - {ACPI_DMT_UINT64, ACPI_DMAR0_OFFSET (Address), "Register Base Address"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Segment), "PCI Segment Number", 0}, + {ACPI_DMT_UINT64, ACPI_DMAR0_OFFSET (Address), "Register Base Address", 0}, + ACPI_DMT_TERMINATOR }; /* 1: Reserved Memory Definition */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[] = { - {ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Segment), "PCI Segment Number"}, - {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (BaseAddress), "Base Address"}, - {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (EndAddress), "End Address (limit)"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Segment), "PCI Segment Number", 0}, + {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (EndAddress), "End Address (limit)", 0}, + ACPI_DMT_TERMINATOR }; /* 2: Root Port ATS Capability Definition */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[] = { - {ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Flags), "Flags"}, - {ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT16, ACPI_DMAR2_OFFSET (Segment), "PCI Segment Number"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_DMAR2_OFFSET (Segment), "PCI Segment Number", 0}, + ACPI_DMT_TERMINATOR }; /* 3: Remapping Hardware Static Affinity Structure */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[] = { - {ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT64, ACPI_DMAR3_OFFSET (BaseAddress), "Base Address"}, - {ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (ProximityDomain), "Proximity Domain"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_DMAR3_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (ProximityDomain), "Proximity Domain", 0}, + ACPI_DMT_TERMINATOR }; @@ -709,12 +722,12 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[] = ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] = { - {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Control), "Command/Status Register"}, - {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Data), "Data Register"}, - {ACPI_DMT_UINT32, ACPI_ECDT_OFFSET (Uid), "UID"}, - {ACPI_DMT_UINT8, ACPI_ECDT_OFFSET (Gpe), "GPE Number"}, - {ACPI_DMT_STRING, ACPI_ECDT_OFFSET (Id[0]), "Namepath"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Control), "Command/Status Register", 0}, + {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Data), "Data Register", 0}, + {ACPI_DMT_UINT32, ACPI_ECDT_OFFSET (Uid), "UID", 0}, + {ACPI_DMT_UINT8, ACPI_ECDT_OFFSET (Gpe), "GPE Number", 0}, + {ACPI_DMT_STRING, ACPI_ECDT_OFFSET (Id[0]), "Namepath", 0}, + ACPI_DMT_TERMINATOR }; @@ -726,23 +739,25 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] = ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[] = { - {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (HeaderLength), "Injection Header Length"}, - {ACPI_DMT_UINT8, ACPI_EINJ_OFFSET (Flags), "Flags"}, - {ACPI_DMT_UINT24, ACPI_EINJ_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Entries), "Injection Entry Count"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (HeaderLength), "Injection Header Length", 0}, + {ACPI_DMT_UINT8, ACPI_EINJ_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_UINT24, ACPI_EINJ_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Entries), "Injection Entry Count", 0}, + ACPI_DMT_TERMINATOR }; 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} + {ACPI_DMT_EINJACT, ACPI_EINJ0_OFFSET (Action), "Action", 0}, + {ACPI_DMT_EINJINST, ACPI_EINJ0_OFFSET (Instruction), "Instruction", 0}, + {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_EINJ0_FLAG_OFFSET (Flags,0), "Preserve Register Bits", 0}, + + {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_GAS, ACPI_EINJ0_OFFSET (RegisterRegion), "Register Region", 0}, + {ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Value), "Value", 0}, + {ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Mask), "Mask", 0}, + ACPI_DMT_TERMINATOR }; @@ -754,10 +769,24 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[] = 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} + {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (HeaderLength), "Serialization Header Length", 0}, + {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Entries), "Instruction Entry Count", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoErst0[] = +{ + {ACPI_DMT_ERSTACT, ACPI_ERST0_OFFSET (Action), "Action", 0}, + {ACPI_DMT_ERSTINST, ACPI_ERST0_OFFSET (Instruction), "Instruction", 0}, + {ACPI_DMT_UINT8, ACPI_ERST0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_ERST0_FLAG_OFFSET (Flags,0), "Preserve Register Bits", 0}, + + {ACPI_DMT_UINT8, ACPI_ERST0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_GAS, ACPI_ERST0_OFFSET (RegisterRegion), "Register Region", 0}, + {ACPI_DMT_UINT64, ACPI_ERST0_OFFSET (Value), "Value", 0}, + {ACPI_DMT_UINT64, ACPI_ERST0_OFFSET (Mask), "Mask", 0}, + ACPI_DMT_TERMINATOR }; @@ -769,31 +798,32 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoErst[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] = { - {ACPI_DMT_UINT32, ACPI_HEST_OFFSET (ErrorSourceCount), "Error Source Count"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_HEST_OFFSET (ErrorSourceCount), "Error Source Count", 0}, + ACPI_DMT_TERMINATOR }; /* Common HEST structures for subtables */ #define ACPI_DM_HEST_HEADER \ - {ACPI_DMT_HEST, ACPI_HEST0_OFFSET (Header.Type), "Subtable Type"}, \ - {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Header.SourceId), "Source Id"} + {ACPI_DMT_HEST, ACPI_HEST0_OFFSET (Header.Type), "Subtable Type", 0}, \ + {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Header.SourceId), "Source Id", 0} #define ACPI_DM_HEST_AER \ - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved1), "Reserved"}, \ - {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags"}, \ - {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled"}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreallocate), "Records To Preallocate"}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record"}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus"}, \ - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device"}, \ - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function"}, \ - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl"}, \ - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved2), "Reserved"}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableMask), "Uncorrectable Mask"}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableSeverity), "Uncorrectable Severity"}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableMask), "Correctable Mask"}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedCapabilities), "Advanced Capabilities"} + {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved1), "Reserved", 0}, \ + {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags (decoded below)", DT_FLAG}, \ + {ACPI_DMT_FLAG0, ACPI_HEST6_FLAG_OFFSET (Aer.Flags,0), "Firmware First", 0}, \ + {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled", 0}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreallocate), "Records To Preallocate", 0}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record", 0}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus", 0}, \ + {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device", 0}, \ + {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function", 0}, \ + {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl", 0}, \ + {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved2), "Reserved", 0}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableMask), "Uncorrectable Mask", 0}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableSeverity), "Uncorrectable Severity", 0}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableMask), "Correctable Mask", 0}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedCapabilities), "Advanced Capabilities", 0} /* HEST Subtables */ @@ -803,16 +833,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] = { ACPI_DM_HEST_HEADER, - {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Reserved1), "Reserved"}, - {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Flags), "Flags"}, - {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Enabled), "Enabled"}, - {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (RecordsToPreallocate), "Records To Preallocate"}, - {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"}, - {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalCapabilityData), "Global Capability Data"}, - {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalControlData), "Global Control Data"}, - {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (NumHardwareBanks), "Num Hardware Banks"}, - {ACPI_DMT_UINT56, ACPI_HEST0_OFFSET (Reserved3[0]), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Reserved1), "Reserved1", 0}, + {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_HEST0_FLAG_OFFSET (Flags,0), "Firmware First", 0}, + + {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Enabled), "Enabled", 0}, + {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, + {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, + {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalCapabilityData), "Global Capability Data", 0}, + {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalControlData), "Global Control Data", 0}, + {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (NumHardwareBanks), "Num Hardware Banks", 0}, + {ACPI_DMT_UINT56, ACPI_HEST0_OFFSET (Reserved3[0]), "Reserved2", 0}, + ACPI_DMT_TERMINATOR }; /* 1: IA32 Corrected Machine Check */ @@ -820,15 +852,17 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[] = { ACPI_DM_HEST_HEADER, - {ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (Reserved1), "Reserved"}, - {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Flags), "Flags"}, - {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Enabled), "Enabled"}, - {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (RecordsToPreallocate), "Records To Preallocate"}, - {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"}, - {ACPI_DMT_HESTNTFY, ACPI_HEST1_OFFSET (Notify), "Notify"}, - {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (NumHardwareBanks), "Num Hardware Banks"}, - {ACPI_DMT_UINT24, ACPI_HEST1_OFFSET (Reserved2[0]), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (Reserved1), "Reserved1", 0}, + {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_HEST1_FLAG_OFFSET (Flags,0), "Firmware First", 0}, + + {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Enabled), "Enabled", 0}, + {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, + {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, + {ACPI_DMT_HESTNTFY, ACPI_HEST1_OFFSET (Notify), "Notify", 0}, + {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (NumHardwareBanks), "Num Hardware Banks", 0}, + {ACPI_DMT_UINT24, ACPI_HEST1_OFFSET (Reserved2[0]), "Reserved2", 0}, + ACPI_DMT_TERMINATOR }; /* 2: IA32 Non-Maskable Interrupt */ @@ -836,22 +870,21 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHest2[] = { ACPI_DM_HEST_HEADER, - {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (RecordsToPreallocate), "Records To Preallocate"}, - {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"}, - {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxRawDataLength), "Max Raw Data Length"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, + {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, + {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxRawDataLength), "Max Raw Data Length", 0}, + ACPI_DMT_TERMINATOR }; - /* 6: PCI Express Root Port AER */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest6[] = { ACPI_DM_HEST_HEADER, ACPI_DM_HEST_AER, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (RootErrorCommand), "Root Error Command"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (RootErrorCommand), "Root Error Command", 0}, + ACPI_DMT_TERMINATOR }; /* 7: PCI Express AER (AER Endpoint) */ @@ -860,7 +893,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[] = { ACPI_DM_HEST_HEADER, ACPI_DM_HEST_AER, - {ACPI_DMT_EXIT, 0, NULL} + ACPI_DMT_TERMINATOR }; /* 8: PCI Express/PCI-X Bridge AER */ @@ -869,10 +902,10 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[] = { ACPI_DM_HEST_HEADER, ACPI_DM_HEST_AER, - {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableMask2), "2nd Uncorrectable Mask"}, - {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableSeverity2), "2nd Uncorrectable Severity"}, - {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (AdvancedCapabilities2), "2nd Advanced Capabilities"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableMask2), "2nd Uncorrectable Mask", 0}, + {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableSeverity2), "2nd Uncorrectable Severity", 0}, + {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (AdvancedCapabilities2), "2nd Advanced Capabilities", 0}, + ACPI_DMT_TERMINATOR }; /* 9: Generic Hardware Error Source */ @@ -880,30 +913,30 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[] = { ACPI_DM_HEST_HEADER, - {ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (RelatedSourceId), "Related Source Id"}, - {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Reserved), "Reserved"}, - {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 (ErrorBlockLength), "Error Status Block Length"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (RelatedSourceId), "Related Source Id", 0}, + {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Enabled), "Enabled", 0}, + {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, + {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, + {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxRawDataLength), "Max Raw Data Length", 0}, + {ACPI_DMT_GAS, ACPI_HEST9_OFFSET (ErrorStatusAddress), "Error Status Address", 0}, + {ACPI_DMT_HESTNTFY, ACPI_HEST9_OFFSET (Notify), "Notify", 0}, + {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (ErrorBlockLength), "Error Status Block Length", 0}, + ACPI_DMT_TERMINATOR }; ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[] = { - {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} + {ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type", 0}, + {ACPI_DMT_UINT8, ACPI_HESTN_OFFSET (Length), "Notify Length", DT_LENGTH}, + {ACPI_DMT_UINT16, ACPI_HESTN_OFFSET (ConfigWriteEnable), "Configuration Write Enable", 0}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollInterval), "PollInterval", 0}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (Vector), "Vector", 0}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdValue), "Polling Threshold Value", 0}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdWindow), "Polling Threshold Window", 0}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdValue), "Error Threshold Value", 0}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdWindow), "Error Threshold Window", 0}, + ACPI_DMT_TERMINATOR }; @@ -913,16 +946,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[] = */ ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[] = { - {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (BankNumber), "Bank Number"}, - {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (ClearStatusOnInit), "Clear Status On Init"}, - {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (StatusFormat), "Status Format"}, - {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (ControlRegister), "Control Register"}, - {ACPI_DMT_UINT64, ACPI_HESTB_OFFSET (ControlData), "Control Data"}, - {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (StatusRegister), "Status Register"}, - {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (AddressRegister), "Address Register"}, - {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (MiscRegister), "Misc Register"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (BankNumber), "Bank Number", 0}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (ClearStatusOnInit), "Clear Status On Init", 0}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (StatusFormat), "Status Format", 0}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (ControlRegister), "Control Register", 0}, + {ACPI_DMT_UINT64, ACPI_HESTB_OFFSET (ControlData), "Control Data", 0}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (StatusRegister), "Status Register", 0}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (AddressRegister), "Address Register", 0}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (MiscRegister), "Misc Register", 0}, + ACPI_DMT_TERMINATOR }; @@ -934,14 +967,14 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] = { - {ACPI_DMT_UINT32, ACPI_HPET_OFFSET (Id), "Hardware Block ID"}, - {ACPI_DMT_GAS, ACPI_HPET_OFFSET (Address), "Timer Block Register"}, - {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Sequence), "Sequence Number"}, - {ACPI_DMT_UINT16, ACPI_HPET_OFFSET (MinimumTick), "Minimum Clock Ticks"}, - {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect"}, - {ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_HPET_OFFSET (Id), "Hardware Block ID", 0}, + {ACPI_DMT_GAS, ACPI_HPET_OFFSET (Address), "Timer Block Register", 0}, + {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Sequence), "Sequence Number", 0}, + {ACPI_DMT_UINT16, ACPI_HPET_OFFSET (MinimumTick), "Minimum Clock Ticks", 0}, + {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect", 0}, + {ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect", 0}, + ACPI_DMT_TERMINATOR }; @@ -953,20 +986,20 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] = ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[] = { - {ACPI_DMT_UINT32, ACPI_IVRS_OFFSET (Info), "Virtualization Info"}, - {ACPI_DMT_UINT64, ACPI_IVRS_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_IVRS_OFFSET (Info), "Virtualization Info", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; /* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHdr[] = { - {ACPI_DMT_IVRS, ACPI_IVRSH_OFFSET (Type), "Subtable Type"}, - {ACPI_DMT_UINT8, ACPI_IVRSH_OFFSET (Flags), "Flags"}, - {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (Length), "Length"}, - {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (DeviceId), "DeviceId"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_IVRS, ACPI_IVRSH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_IVRSH_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (DeviceId), "DeviceId", 0}, + ACPI_DMT_TERMINATOR }; /* IVRS subtables */ @@ -975,38 +1008,38 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHdr[] = ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[] = { - {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (CapabilityOffset), "Capability Offset"}, - {ACPI_DMT_UINT64, ACPI_IVRS0_OFFSET (BaseAddress), "Base Address"}, - {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (PciSegmentGroup), "PCI Segment Group"}, - {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (Info), "Virtualization Info"}, - {ACPI_DMT_UINT32, ACPI_IVRS0_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (CapabilityOffset), "Capability Offset", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS0_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (PciSegmentGroup), "PCI Segment Group", 0}, + {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (Info), "Virtualization Info", 0}, + {ACPI_DMT_UINT32, ACPI_IVRS0_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; /* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition (IVMD) Block */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[] = { - {ACPI_DMT_UINT16, ACPI_IVRS1_OFFSET (AuxData), "Auxiliary Data"}, - {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (StartAddress), "Start Address"}, - {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (MemoryLength), "Memory Length"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_IVRS1_OFFSET (AuxData), "Auxiliary Data", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (StartAddress), "Start Address", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (MemoryLength), "Memory Length", 0}, + ACPI_DMT_TERMINATOR }; /* Device entry header for IVHD block */ #define ACPI_DMT_IVRS_DE_HEADER \ - {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (Type), "Entry Type"}, \ - {ACPI_DMT_UINT16, ACPI_IVRSD_OFFSET (Id), "Device ID"}, \ - {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (DataSetting), "Data Setting"} + {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (Type), "Entry Type", 0}, \ + {ACPI_DMT_UINT16, ACPI_IVRSD_OFFSET (Id), "Device ID", 0}, \ + {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (DataSetting), "Data Setting", 0} /* 4-byte device entry */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs4[] = { ACPI_DMT_IVRS_DE_HEADER, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_EXIT, 0, NULL, 0}, }; /* 8-byte device entry */ @@ -1014,10 +1047,10 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs4[] = ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8a[] = { ACPI_DMT_IVRS_DE_HEADER, - {ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved1), "Reserved"}, - {ACPI_DMT_UINT16, ACPI_IVRS8A_OFFSET (UsedId), "Source Used Device ID"}, - {ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved2), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_IVRS8A_OFFSET (UsedId), "Source Used Device ID", 0}, + {ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved2), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; /* 8-byte device entry */ @@ -1025,8 +1058,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8a[] = ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8b[] = { ACPI_DMT_IVRS_DE_HEADER, - {ACPI_DMT_UINT32, ACPI_IVRS8B_OFFSET (ExtendedData), "Extended Data"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_IVRS8B_OFFSET (ExtendedData), "Extended Data", 0}, + ACPI_DMT_TERMINATOR }; /* 8-byte device entry */ @@ -1034,10 +1067,10 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8b[] = ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8c[] = { ACPI_DMT_IVRS_DE_HEADER, - {ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Handle), "Handle"}, - {ACPI_DMT_UINT16, ACPI_IVRS8C_OFFSET (UsedId), "Source Used Device ID"}, - {ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Variety), "Variety"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Handle), "Handle", 0}, + {ACPI_DMT_UINT16, ACPI_IVRS8C_OFFSET (UsedId), "Source Used Device ID", 0}, + {ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Variety), "Variety", 0}, + ACPI_DMT_TERMINATOR }; @@ -1049,19 +1082,19 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8c[] = ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[] = { - {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Address), "Local Apic Address"}, - {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_MADT_FLAG_OFFSET (Flags,0), "PC-AT Compatibility"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Address), "Local Apic Address", 0}, + {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_MADT_FLAG_OFFSET (Flags,0), "PC-AT Compatibility", 0}, + ACPI_DMT_TERMINATOR }; /* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[] = { - {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Subtable Type"}, - {ACPI_DMT_UINT8, ACPI_MADTH_OFFSET (Length), "Length"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_MADTH_OFFSET (Length), "Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR }; /* MADT Subtables */ @@ -1070,135 +1103,135 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[] = ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[] = { - {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (ProcessorId), "Processor ID"}, - {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (Id), "Local Apic ID"}, - {ACPI_DMT_UINT32, ACPI_MADT0_OFFSET (LapicFlags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_MADT0_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (ProcessorId), "Processor ID", 0}, + {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (Id), "Local Apic ID", 0}, + {ACPI_DMT_UINT32, ACPI_MADT0_OFFSET (LapicFlags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_MADT0_FLAG_OFFSET (LapicFlags,0), "Processor Enabled", 0}, + ACPI_DMT_TERMINATOR }; /* 1: IO APIC */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt1[] = { - {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Id), "I/O Apic ID"}, - {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (Address), "Address"}, - {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (GlobalIrqBase), "Interrupt"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Id), "I/O Apic ID", 0}, + {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (Address), "Address", 0}, + {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (GlobalIrqBase), "Interrupt", 0}, + ACPI_DMT_TERMINATOR }; /* 2: Interrupt Override */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt2[] = { - {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (Bus), "Bus"}, - {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (SourceIrq), "Source"}, - {ACPI_DMT_UINT32, ACPI_MADT2_OFFSET (GlobalIrq), "Interrupt"}, - {ACPI_DMT_UINT16, ACPI_MADT2_OFFSET (IntiFlags), "Flags (decoded below)"}, - {ACPI_DMT_FLAGS0, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Polarity"}, - {ACPI_DMT_FLAGS2, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (Bus), "Bus", 0}, + {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (SourceIrq), "Source", 0}, + {ACPI_DMT_UINT32, ACPI_MADT2_OFFSET (GlobalIrq), "Interrupt", 0}, + {ACPI_DMT_UINT16, ACPI_MADT2_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAGS0, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, + {ACPI_DMT_FLAGS2, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, + ACPI_DMT_TERMINATOR }; /* 3: NMI Sources */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt3[] = { - {ACPI_DMT_UINT16, ACPI_MADT3_OFFSET (IntiFlags), "Flags (decoded below)"}, - {ACPI_DMT_FLAGS0, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Polarity"}, - {ACPI_DMT_FLAGS2, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"}, - {ACPI_DMT_UINT32, ACPI_MADT3_OFFSET (GlobalIrq), "Interrupt"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_MADT3_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAGS0, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, + {ACPI_DMT_FLAGS2, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, + {ACPI_DMT_UINT32, ACPI_MADT3_OFFSET (GlobalIrq), "Interrupt", 0}, + ACPI_DMT_TERMINATOR }; /* 4: Local APIC NMI */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt4[] = { - {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (ProcessorId), "Processor ID"}, - {ACPI_DMT_UINT16, ACPI_MADT4_OFFSET (IntiFlags), "Flags (decoded below)"}, - {ACPI_DMT_FLAGS0, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Polarity"}, - {ACPI_DMT_FLAGS2, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"}, - {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (Lint), "Interrupt Input LINT"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (ProcessorId), "Processor ID", 0}, + {ACPI_DMT_UINT16, ACPI_MADT4_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAGS0, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, + {ACPI_DMT_FLAGS2, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, + {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (Lint), "Interrupt Input LINT", 0}, + ACPI_DMT_TERMINATOR }; /* 5: Address Override */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt5[] = { - {ACPI_DMT_UINT16, ACPI_MADT5_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT64, ACPI_MADT5_OFFSET (Address), "APIC Address"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_MADT5_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_MADT5_OFFSET (Address), "APIC Address", 0}, + ACPI_DMT_TERMINATOR }; /* 6: I/O Sapic */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt6[] = { - {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Id), "I/O Sapic ID"}, - {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_MADT6_OFFSET (GlobalIrqBase), "Interrupt Base"}, - {ACPI_DMT_UINT64, ACPI_MADT6_OFFSET (Address), "Address"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Id), "I/O Sapic ID", 0}, + {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_MADT6_OFFSET (GlobalIrqBase), "Interrupt Base", 0}, + {ACPI_DMT_UINT64, ACPI_MADT6_OFFSET (Address), "Address", 0}, + ACPI_DMT_TERMINATOR }; /* 7: Local Sapic */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[] = { - {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (ProcessorId), "Processor ID"}, - {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Id), "Local Sapic ID"}, - {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Eid), "Local Sapic EID"}, - {ACPI_DMT_UINT24, ACPI_MADT7_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (LapicFlags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_MADT7_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"}, - {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (Uid), "Processor UID"}, - {ACPI_DMT_STRING, ACPI_MADT7_OFFSET (UidString[0]), "Processor UID String"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (ProcessorId), "Processor ID", 0}, + {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Id), "Local Sapic ID", 0}, + {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Eid), "Local Sapic EID", 0}, + {ACPI_DMT_UINT24, ACPI_MADT7_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (LapicFlags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_MADT7_FLAG_OFFSET (LapicFlags,0), "Processor Enabled", 0}, + {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (Uid), "Processor UID", 0}, + {ACPI_DMT_STRING, ACPI_MADT7_OFFSET (UidString[0]), "Processor UID String", 0}, + ACPI_DMT_TERMINATOR }; /* 8: Platform Interrupt Source */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] = { - {ACPI_DMT_UINT16, ACPI_MADT8_OFFSET (IntiFlags), "Flags (decoded below)"}, - {ACPI_DMT_FLAGS0, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Polarity"}, - {ACPI_DMT_FLAGS2, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"}, - {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Type), "InterruptType"}, - {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Id), "Processor ID"}, - {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Eid), "Processor EID"}, - {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (IoSapicVector), "I/O Sapic Vector"}, - {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (GlobalIrq), "Interrupt"}, - {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_MADT8_OFFSET (Flags), "CPEI Override"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_MADT8_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAGS0, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, + {ACPI_DMT_FLAGS2, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, + {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Type), "InterruptType", 0}, + {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Id), "Processor ID", 0}, + {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Eid), "Processor EID", 0}, + {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (IoSapicVector), "I/O Sapic Vector", 0}, + {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (GlobalIrq), "Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_MADT8_OFFSET (Flags), "CPEI Override", 0}, + ACPI_DMT_TERMINATOR }; /* 9: Processor Local X2_APIC (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[] = { - {ACPI_DMT_UINT16, ACPI_MADT9_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LocalApicId), "Processor x2Apic ID"}, - {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LapicFlags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_MADT9_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"}, - {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (Uid), "Processor UID"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_MADT9_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LocalApicId), "Processor x2Apic ID", 0}, + {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LapicFlags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_MADT9_FLAG_OFFSET (LapicFlags,0), "Processor Enabled", 0}, + {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (Uid), "Processor UID", 0}, + ACPI_DMT_TERMINATOR }; /* 10: Local X2_APIC NMI (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] = { - {ACPI_DMT_UINT16, ACPI_MADT10_OFFSET (IntiFlags), "Flags (decoded below)"}, - {ACPI_DMT_FLAGS0, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Polarity"}, - {ACPI_DMT_FLAGS2, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"}, - {ACPI_DMT_UINT32, ACPI_MADT10_OFFSET (Uid), "Processor UID"}, - {ACPI_DMT_UINT8, ACPI_MADT10_OFFSET (Lint), "Interrupt Input LINT"}, - {ACPI_DMT_UINT24, ACPI_MADT10_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_MADT10_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAGS0, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, + {ACPI_DMT_FLAGS2, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, + {ACPI_DMT_UINT32, ACPI_MADT10_OFFSET (Uid), "Processor UID", 0}, + {ACPI_DMT_UINT8, ACPI_MADT10_OFFSET (Lint), "Interrupt Input LINT", 0}, + {ACPI_DMT_UINT24, ACPI_MADT10_OFFSET (Reserved[0]), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; @@ -1210,18 +1243,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] = ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[] = { - {ACPI_DMT_UINT64, ACPI_MCFG_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT64, ACPI_MCFG_OFFSET (Reserved[0]), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] = { - {ACPI_DMT_UINT64, ACPI_MCFG0_OFFSET (Address), "Base Address"}, - {ACPI_DMT_UINT16, ACPI_MCFG0_OFFSET (PciSegment), "Segment Group Number"}, - {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (StartBusNumber), "Start Bus Number"}, - {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (EndBusNumber), "End Bus Number"}, - {ACPI_DMT_UINT32, ACPI_MCFG0_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT64, ACPI_MCFG0_OFFSET (Address), "Base Address", 0}, + {ACPI_DMT_UINT16, ACPI_MCFG0_OFFSET (PciSegment), "Segment Group Number", 0}, + {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (StartBusNumber), "Start Bus Number", 0}, + {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (EndBusNumber), "End Bus Number", 0}, + {ACPI_DMT_UINT32, ACPI_MCFG0_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; @@ -1233,19 +1266,19 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] = ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[] = { - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterfaceType), "Interface Type"}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Protocol), "Protocol"}, - {ACPI_DMT_UINT64, ACPI_MCHI_OFFSET (ProtocolData), "Protocol Data"}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterruptType), "Interrupt Type"}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Gpe), "Gpe"}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDeviceFlag), "Pci Device Flag"}, - {ACPI_DMT_UINT32, ACPI_MCHI_OFFSET (GlobalInterrupt), "Global Interrupt"}, - {ACPI_DMT_GAS, ACPI_MCHI_OFFSET (ControlRegister), "Control Register"}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciSegment), "Pci Segment"}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciBus), "Pci Bus"}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDevice), "Pci Device"}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciFunction), "Pci Function"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterfaceType), "Interface Type", 0}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Protocol), "Protocol", 0}, + {ACPI_DMT_UINT64, ACPI_MCHI_OFFSET (ProtocolData), "Protocol Data", 0}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterruptType), "Interrupt Type", 0}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Gpe), "Gpe", 0}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDeviceFlag), "Pci Device Flag", 0}, + {ACPI_DMT_UINT32, ACPI_MCHI_OFFSET (GlobalInterrupt), "Global Interrupt", 0}, + {ACPI_DMT_GAS, ACPI_MCHI_OFFSET (ControlRegister), "Control Register", 0}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciSegment), "Pci Segment", 0}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciBus), "Pci Bus", 0}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDevice), "Pci Device", 0}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciFunction), "Pci Function", 0}, + ACPI_DMT_TERMINATOR }; @@ -1257,24 +1290,24 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[] = ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[] = { - {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (ProximityOffset), "Proximity Offset"}, - {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxProximityDomains), "Max Proximity Domains"}, - {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxClockDomains), "Max Clock Domains"}, - {ACPI_DMT_UINT64, ACPI_MSCT_OFFSET (MaxAddress), "Max Physical Address"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (ProximityOffset), "Proximity Offset", 0}, + {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxProximityDomains), "Max Proximity Domains", 0}, + {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxClockDomains), "Max Clock Domains", 0}, + {ACPI_DMT_UINT64, ACPI_MSCT_OFFSET (MaxAddress), "Max Physical Address", 0}, + ACPI_DMT_TERMINATOR }; /* Subtable - Maximum Proximity Domain Information. Version 1 */ ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[] = { - {ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Revision), "Revision"}, - {ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Length), "Length"}, - {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeStart), "Domain Range Start"}, - {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeEnd), "Domain Range End"}, - {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (ProcessorCapacity), "Processor Capacity"}, - {ACPI_DMT_UINT64, ACPI_MSCT0_OFFSET (MemoryCapacity), "Memory Capacity"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Revision), "Revision", 0}, + {ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeStart), "Domain Range Start", 0}, + {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeEnd), "Domain Range End", 0}, + {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (ProcessorCapacity), "Processor Capacity", 0}, + {ACPI_DMT_UINT64, ACPI_MSCT0_OFFSET (MemoryCapacity), "Memory Capacity", 0}, + ACPI_DMT_TERMINATOR }; @@ -1286,22 +1319,23 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] = { - {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (WarningLevel), "Warning Level"}, - {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (LowLevel), "Low Level"}, - {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (CriticalLevel), "Critical Level"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (WarningLevel), "Warning Level", 0}, + {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (LowLevel), "Low Level", 0}, + {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (CriticalLevel), "Critical Level", 0}, + ACPI_DMT_TERMINATOR }; /******************************************************************************* * - * SLIC - Software Licensing Description Table. NOT FULLY IMPLEMENTED + * SLIC - Software Licensing Description Table. NOT FULLY IMPLEMENTED, do not + * have the table definition. * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[] = { - {ACPI_DMT_EXIT, 0, NULL} + ACPI_DMT_TERMINATOR }; @@ -1313,8 +1347,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[] = { - {ACPI_DMT_UINT64, ACPI_SLIT_OFFSET (LocalityCount), "Localities"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT64, ACPI_SLIT_OFFSET (LocalityCount), "Localities", 0}, + ACPI_DMT_TERMINATOR }; @@ -1326,27 +1360,27 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] = { - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterfaceType), "Interface Type"}, - {ACPI_DMT_UINT24, ACPI_SPCR_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_GAS, ACPI_SPCR_OFFSET (SerialPort), "Serial Port Register"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterruptType), "Interrupt Type"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PcInterrupt), "PCAT-compatible IRQ"}, - {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Interrupt), "Interrupt"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (BaudRate), "Baud Rate"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Parity), "Parity"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (StopBits), "Stop Bits"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (FlowControl), "Flow Control"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (TerminalType), "Terminal Type"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Reserved2), "Reserved"}, - {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciDeviceId), "PCI Device ID"}, - {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciVendorId), "PCI Vendor ID"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciBus), "PCI Bus"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciDevice), "PCI Device"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciFunction), "PCI Function"}, - {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (PciFlags), "PCI Flags"}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciSegment), "PCI Segment"}, - {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Reserved2), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterfaceType), "Interface Type", 0}, + {ACPI_DMT_UINT24, ACPI_SPCR_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_GAS, ACPI_SPCR_OFFSET (SerialPort), "Serial Port Register", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterruptType), "Interrupt Type", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PcInterrupt), "PCAT-compatible IRQ", 0}, + {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Interrupt), "Interrupt", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (BaudRate), "Baud Rate", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Parity), "Parity", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (StopBits), "Stop Bits", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (FlowControl), "Flow Control", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (TerminalType), "Terminal Type", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Reserved2), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciDeviceId), "PCI Device ID", 0}, + {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciVendorId), "PCI Vendor ID", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciBus), "PCI Bus", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciDevice), "PCI Device", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciFunction), "PCI Function", 0}, + {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (PciFlags), "PCI Flags", 0}, + {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciSegment), "PCI Segment", 0}, + {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Reserved2), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; @@ -1358,21 +1392,21 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] = { - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type"}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version"}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type"}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number"}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved1), "Reserved"}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDeviceFlag), "PCI Device Flag"}, - {ACPI_DMT_UINT32, ACPI_SPMI_OFFSET (Interrupt), "Interrupt"}, - {ACPI_DMT_GAS, ACPI_SPMI_OFFSET (IpmiRegister), "IPMI Register"}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciSegment), "PCI Segment"}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciBus), "PCI Bus"}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDevice), "PCI Device"}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciFunction), "PCI Function"}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved2), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDeviceFlag), "PCI Device Flag", 0}, + {ACPI_DMT_UINT32, ACPI_SPMI_OFFSET (Interrupt), "Interrupt", 0}, + {ACPI_DMT_GAS, ACPI_SPMI_OFFSET (IpmiRegister), "IPMI Register", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciSegment), "PCI Segment", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciBus), "PCI Bus", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDevice), "PCI Device", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciFunction), "PCI Function", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved2), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; @@ -1384,18 +1418,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[] = { - {ACPI_DMT_UINT32, ACPI_SRAT_OFFSET (TableRevision), "Table Revision"}, - {ACPI_DMT_UINT64, ACPI_SRAT_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_SRAT_OFFSET (TableRevision), "Table Revision", 0}, + {ACPI_DMT_UINT64, ACPI_SRAT_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; /* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoSratHdr[] = { - {ACPI_DMT_SRAT, ACPI_SRATH_OFFSET (Type), "Subtable Type"}, - {ACPI_DMT_UINT8, ACPI_SRATH_OFFSET (Length), "Length"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_SRAT, ACPI_SRATH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_SRATH_OFFSET (Length), "Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR }; /* SRAT Subtables */ @@ -1404,45 +1438,45 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSratHdr[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] = { - {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ProximityDomainLo), "Proximity Domain Low(8)"}, - {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ApicId), "Apic ID"}, - {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_SRAT0_FLAG_OFFSET (Flags,0), "Enabled"}, - {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (LocalSapicEid), "Local Sapic EID"}, - {ACPI_DMT_UINT24, ACPI_SRAT0_OFFSET (ProximityDomainHi[0]), "Proximity Domain High(24)"}, - {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ProximityDomainLo), "Proximity Domain Low(8)", 0}, + {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ApicId), "Apic ID", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_SRAT0_FLAG_OFFSET (Flags,0), "Enabled", 0}, + {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (LocalSapicEid), "Local Sapic EID", 0}, + {ACPI_DMT_UINT24, ACPI_SRAT0_OFFSET (ProximityDomainHi[0]), "Proximity Domain High(24)", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR }; /* 1: Memory Affinity */ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] = { - {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain"}, - {ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (BaseAddress), "Base Address"}, - {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Length), "Address Length"}, - {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Reserved1), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Enabled"}, - {ACPI_DMT_FLAG1, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Hot Pluggable"}, - {ACPI_DMT_FLAG2, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Non-Volatile"}, - {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved2), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain", 0}, + {ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved1", 0}, + {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Length), "Address Length", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Reserved1), "Reserved2", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Enabled", 0}, + {ACPI_DMT_FLAG1, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Hot Pluggable", 0}, + {ACPI_DMT_FLAG2, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Non-Volatile", 0}, + {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved2), "Reserved3", 0}, + ACPI_DMT_TERMINATOR }; /* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = { - {ACPI_DMT_UINT16, ACPI_SRAT2_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ProximityDomain), "Proximity Domain"}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ApicId), "Apic ID"}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_SRAT2_FLAG_OFFSET (Flags,0), "Enabled"}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ClockDomain), "Clock Domain"}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Reserved2), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_SRAT2_OFFSET (Reserved), "Reserved1", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ProximityDomain), "Proximity Domain", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ApicId), "Apic ID", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_SRAT2_FLAG_OFFSET (Flags,0), "Enabled", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ClockDomain), "Clock Domain", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Reserved2), "Reserved2", 0}, + ACPI_DMT_TERMINATOR }; @@ -1454,10 +1488,10 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] = { - {ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_TCPA_OFFSET (MaxLogLength), "Max Event Log Length"}, - {ACPI_DMT_UINT64, ACPI_TCPA_OFFSET (LogAddress), "Event Log Address"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_TCPA_OFFSET (MaxLogLength), "Max Event Log Length", 0}, + {ACPI_DMT_UINT64, ACPI_TCPA_OFFSET (LogAddress), "Event Log Address", 0}, + ACPI_DMT_TERMINATOR }; @@ -1469,9 +1503,9 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] = ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] = { - {ACPI_DMT_BUF16, ACPI_UEFI_OFFSET (Identifier[0]), "UUID Identifier"}, - {ACPI_DMT_UINT16, ACPI_UEFI_OFFSET (DataOffset), "Data Offset"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_BUF16, ACPI_UEFI_OFFSET (Identifier[0]), "UUID Identifier", 0}, + {ACPI_DMT_UINT16, ACPI_UEFI_OFFSET (DataOffset), "Data Offset", 0}, + ACPI_DMT_TERMINATOR }; @@ -1483,10 +1517,10 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] = ACPI_DMTABLE_INFO AcpiDmTableInfoWaet[] = { - {ACPI_DMT_UINT32, ACPI_WAET_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_WAET_OFFSET (Flags), "RTC needs no INT ack"}, - {ACPI_DMT_FLAG1, ACPI_WAET_OFFSET (Flags), "PM timer, one read only"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_WAET_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_WAET_OFFSET (Flags), "RTC needs no INT ack", 0}, + {ACPI_DMT_FLAG1, ACPI_WAET_OFFSET (Flags), "PM timer, one read only", 0}, + ACPI_DMT_TERMINATOR }; @@ -1498,34 +1532,74 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWaet[] = ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[] = { - {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (HeaderLength), "Header Length"}, - {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciSegment), "PCI Segment"}, - {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciBus), "PCI Bus"}, - {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciDevice), "PCI Device"}, - {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciFunction), "PCI Function"}, - {ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (TimerPeriod), "Timer Period"}, - {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MaxCount), "Max Count"}, - {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MinCount), "Min Count"}, - {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_WDAT_OFFSET (Flags), "Enabled"}, - {ACPI_DMT_FLAG7, ACPI_WDAT_OFFSET (Flags), "Stopped When Asleep"}, - {ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved2[0]), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (Entries), "Watchdog Entry Count"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (HeaderLength), "Header Length", DT_LENGTH}, + {ACPI_DMT_UINT16, ACPI_WDAT_OFFSET (PciSegment), "PCI Segment", 0}, + {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciBus), "PCI Bus", 0}, + {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciDevice), "PCI Device", 0}, + {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciFunction), "PCI Function", 0}, + {ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (TimerPeriod), "Timer Period", 0}, + {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MaxCount), "Max Count", 0}, + {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MinCount), "Min Count", 0}, + {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_WDAT_OFFSET (Flags), "Enabled", 0}, + {ACPI_DMT_FLAG7, ACPI_WDAT_OFFSET (Flags), "Stopped When Asleep", 0}, + {ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved2[0]), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (Entries), "Watchdog Entry Count", 0}, + ACPI_DMT_TERMINATOR }; /* WDAT Subtables - Watchdog Instruction Entries */ ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[] = { - {ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Action), "Watchdog Action"}, - {ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Instruction), "Instruction"}, - {ACPI_DMT_UINT16, ACPI_WDAT0_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_GAS, ACPI_WDAT0_OFFSET (RegisterRegion), "Register Region"}, - {ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Value), "Value"}, - {ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Mask), "Register Mask"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Action), "Watchdog Action", 0}, + {ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Instruction), "Instruction", 0}, + {ACPI_DMT_UINT16, ACPI_WDAT0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_GAS, ACPI_WDAT0_OFFSET (RegisterRegion), "Register Region", 0}, + {ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Value), "Value", 0}, + {ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Mask), "Register Mask", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * + * WDDT - Watchdog Description Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoWddt[] = +{ + {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (SpecVersion), "Specification Version", 0}, + {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (TableVersion), "Table Version", 0}, + {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (PciVendorId), "PCI Vendor ID", 0}, + {ACPI_DMT_GAS, ACPI_WDDT_OFFSET (Address), "Timer Register", 0}, + {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (MaxCount), "Max Count", 0}, + {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (MinCount), "Min Count", 0}, + {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (Period), "Period", 0}, + {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (Status), "Status (decoded below)", 0}, + + /* Status Flags byte 0 */ + + {ACPI_DMT_FLAG0, ACPI_WDDT_FLAG_OFFSET (Status,0), "Available", 0}, + {ACPI_DMT_FLAG1, ACPI_WDDT_FLAG_OFFSET (Status,0), "Active", 0}, + {ACPI_DMT_FLAG2, ACPI_WDDT_FLAG_OFFSET (Status,0), "OS Owns", 0}, + + /* Status Flags byte 1 */ + + {ACPI_DMT_FLAG3, ACPI_WDDT_FLAG_OFFSET (Status,1), "User Reset", 0}, + {ACPI_DMT_FLAG4, ACPI_WDDT_FLAG_OFFSET (Status,1), "Timeout Reset", 0}, + {ACPI_DMT_FLAG5, ACPI_WDDT_FLAG_OFFSET (Status,1), "Power Fail Reset", 0}, + {ACPI_DMT_FLAG6, ACPI_WDDT_FLAG_OFFSET (Status,1), "Unknown Reset", 0}, + + {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (Capability), "Capability (decoded below)", 0}, + + /* Capability Flags byte 0 */ + + {ACPI_DMT_FLAG0, ACPI_WDDT_FLAG_OFFSET (Capability,0), "Auto Reset", 0}, + {ACPI_DMT_FLAG1, ACPI_WDDT_FLAG_OFFSET (Capability,0), "Timeout Alert", 0}, + ACPI_DMT_TERMINATOR }; @@ -1537,16 +1611,15 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[] = ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] = { - {ACPI_DMT_GAS, ACPI_WDRT_OFFSET (ControlRegister), "Control Register"}, - {ACPI_DMT_GAS, ACPI_WDRT_OFFSET (CountRegister), "Count Register"}, - {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciDeviceId), "PCI Device ID"}, - {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciVendorId), "PCI Vendor ID"}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciBus), "PCI Bus"}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciDevice), "PCI Device"}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciFunction), "PCI Function"}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment"}, - {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (MaxCount), "Max Count"}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Units), "Counter Units"}, - {ACPI_DMT_EXIT, 0, NULL} + {ACPI_DMT_GAS, ACPI_WDRT_OFFSET (ControlRegister), "Control Register", 0}, + {ACPI_DMT_GAS, ACPI_WDRT_OFFSET (CountRegister), "Count Register", 0}, + {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciDeviceId), "PCI Device ID", 0}, + {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciVendorId), "PCI Vendor ID", 0}, + {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciBus), "PCI Bus", 0}, + {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciDevice), "PCI Device", 0}, + {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciFunction), "PCI Function", 0}, + {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment", 0}, + {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (MaxCount), "Max Count", 0}, + {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Units), "Counter Units", 0}, + ACPI_DMT_TERMINATOR }; - 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 db1eb167d1..9a8589c995 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/getopt.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/getopt.c @@ -126,7 +126,6 @@ int AcpiGbl_Opterr = 1; int AcpiGbl_Optind = 1; -int AcpiGbl_Optopt; char *AcpiGbl_Optarg; @@ -171,9 +170,7 @@ AcpiGetopt( /* Get the option */ - CurrentChar = - AcpiGbl_Optopt = - argv[AcpiGbl_Optind][CurrentCharPtr]; + CurrentChar = argv[AcpiGbl_Optind][CurrentCharPtr]; /* Make sure that the option is legal */ diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/Makefile b/src/add-ons/kernel/bus_managers/acpi/compiler/Makefile deleted file mode 100644 index 2bdd0d31d2..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/Makefile +++ /dev/null @@ -1,155 +0,0 @@ - -PROG= iasl -SRCS= \ - aslcompilerparse.c \ - aslcompilerlex.c \ - aslanalyze.c \ - aslcodegen.c \ - aslcompile.c \ - aslerror.c \ - aslfiles.c \ - aslfold.c \ - asllength.c \ - asllisting.c \ - aslload.c \ - asllookup.c \ - aslmain.c \ - aslmap.c \ - aslopcodes.c \ - asloperands.c \ - aslopt.c \ - aslpredef.c \ - aslresource.c \ - aslrestype1.c \ - aslrestype1i.c \ - aslrestype2.c \ - aslrestype2d.c \ - aslrestype2e.c \ - aslrestype2q.c \ - aslrestype2w.c \ - aslstartup.c \ - aslstubs.c \ - asltransform.c \ - asltree.c \ - aslutils.c \ - ../common/getopt.c \ - ../utilities/utalloc.c \ - ../utilities/utcache.c \ - ../utilities/utcopy.c \ - ../utilities/utdebug.c \ - ../utilities/utdelete.c \ - ../utilities/utglobal.c \ - ../utilities/utinit.c \ - ../utilities/utlock.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 \ - ../namespace/nsnames.c \ - ../namespace/nsobject.c \ - ../namespace/nsparse.c \ - ../namespace/nssearch.c \ - ../namespace/nsutils.c \ - ../namespace/nswalk.c \ - ../namespace/nsxfobj.c \ - ../parser/psargs.c \ - ../parser/psloop.c \ - ../parser/psopcode.c \ - ../parser/psparse.c \ - ../parser/psscope.c \ - ../parser/pstree.c \ - ../parser/psutils.c \ - ../parser/pswalk.c \ - ../dispatcher/dswscope.c \ - ../dispatcher/dswstate.c \ - ../dispatcher/dsfield.c \ - ../dispatcher/dsobject.c \ - ../dispatcher/dsopcode.c \ - ../dispatcher/dsutils.c \ - ../dispatcher/dswexec.c \ - ../dispatcher/dswload.c \ - ../executer/exconvrt.c \ - ../executer/excreate.c \ - ../executer/exdump.c \ - ../executer/exmisc.c \ - ../executer/exmutex.c \ - ../executer/exnames.c \ - ../executer/exoparg1.c \ - ../executer/exoparg2.c \ - ../executer/exoparg3.c \ - ../executer/exoparg6.c \ - ../executer/exprep.c \ - ../executer/exregion.c \ - ../executer/exresnte.c \ - ../executer/exresolv.c \ - ../executer/exresop.c \ - ../executer/exstore.c \ - ../executer/exstoren.c \ - ../executer/exstorob.c \ - ../executer/exsystem.c \ - ../executer/exutils.c \ - ../common/adfile.c \ - ../common/adisasm.c \ - ../common/adwalk.c \ - ../common/dmextern.c \ - ../common/dmrestag.c \ - ../common/dmtable.c \ - ../common/dmtbinfo.c \ - ../common/dmtbdump.c \ - ../debugger/dbfileio.c \ - ../disassembler/dmbuffer.c \ - ../disassembler/dmnames.c \ - ../disassembler/dmopcode.c \ - ../disassembler/dmobject.c \ - ../disassembler/dmresrc.c \ - ../disassembler/dmresrcl.c \ - ../disassembler/dmresrcs.c \ - ../disassembler/dmutils.c \ - ../disassembler/dmwalk.c \ - ../tables/tbfadt.c \ - ../tables/tbinstal.c \ - ../tables/tbutils.c \ - ../tables/tbxface.c \ - ../osunixxf.c - -NOMAN= YES -CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include - -#YACC= yacc -YACC= bison -YFLAGS+= -v -d -LEX= flex -LFLAGS+= -i - -#.if $(YACC) == "bison" -YFLAGS+= -y -pAslCompiler -#.else -#CFLAGS+= -D_USE_BERKELEY_YACC -#.endif - -LDLIBS = -lpthread -lrt - -aslmain : $(patsubst %.c,%.o, $(SRCS)) - $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) \ - $(LOADLIBES) $(LDLIBS) -o iasl - -CLEANFILES= y.output y.tab.c y.tab.h aslcompiler.y.h \ - aslcompilerparse.c aslcompilerlex.c iasl - -aslcompilerparse.c: aslcompiler.y - ${YACC} ${YFLAGS} aslcompiler.y - cp y.tab.c aslcompilerparse.c - cp y.tab.h aslcompiler.y.h - -aslcompilerlex.c: aslcompiler.l - ${LEX} ${LFLAGS} -PAslCompiler -oaslcompilerlex.c aslcompiler.l - -clean : - rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS)) - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslanalyze.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslanalyze.c deleted file mode 100644 index 19440c875c..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslanalyze.c +++ /dev/null @@ -1,2020 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslanalyze.c - check for semantic errors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" -#include "acparser.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslanalyze") - -/* Local prototypes */ - -static UINT32 -AnMapArgTypeToBtype ( - UINT32 ArgType); - -static UINT32 -AnMapEtypeToBtype ( - UINT32 Etype); - -static void -AnFormatBtype ( - char *Buffer, - UINT32 Btype); - -static UINT32 -AnGetBtype ( - ACPI_PARSE_OBJECT *Op); - -static UINT32 -AnMapObjTypeToBtype ( - ACPI_PARSE_OBJECT *Op); - -static BOOLEAN -AnLastStatementIsReturn ( - ACPI_PARSE_OBJECT *Op); - -static void -AnCheckMethodReturnValue ( - ACPI_PARSE_OBJECT *Op, - const ACPI_OPCODE_INFO *OpInfo, - ACPI_PARSE_OBJECT *ArgOp, - UINT32 RequiredBtypes, - UINT32 ThisNodeBtype); - -static BOOLEAN -AnIsInternalMethod ( - ACPI_PARSE_OBJECT *Op); - -static UINT32 -AnGetInternalMethodReturnType ( - ACPI_PARSE_OBJECT *Op); - -BOOLEAN -AnIsResultUsed ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: AnIsInternalMethod - * - * PARAMETERS: Op - Current op - * - * RETURN: Boolean - * - * DESCRIPTION: Check for an internal control method. - * - ******************************************************************************/ - -static BOOLEAN -AnIsInternalMethod ( - ACPI_PARSE_OBJECT *Op) -{ - - if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) || - (!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI"))) - { - return (TRUE); - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: AnGetInternalMethodReturnType - * - * PARAMETERS: Op - Current op - * - * RETURN: Btype - * - * DESCRIPTION: Get the return type of an internal method - * - ******************************************************************************/ - -static UINT32 -AnGetInternalMethodReturnType ( - ACPI_PARSE_OBJECT *Op) -{ - - if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) || - (!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI"))) - { - return (ACPI_BTYPE_STRING); - } - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: AnMapArgTypeToBtype - * - * PARAMETERS: ArgType - The ARGI required type(s) for this argument, - * from the opcode info table - * - * RETURN: The corresponding Bit-encoded types - * - * DESCRIPTION: Convert an encoded ARGI required argument type code into a - * bitfield type code. Implements the implicit source conversion - * rules. - * - ******************************************************************************/ - -static UINT32 -AnMapArgTypeToBtype ( - UINT32 ArgType) -{ - - switch (ArgType) - { - - /* Simple types */ - - case ARGI_ANYTYPE: - return (ACPI_BTYPE_OBJECTS_AND_REFS); - - case ARGI_PACKAGE: - return (ACPI_BTYPE_PACKAGE); - - case ARGI_EVENT: - return (ACPI_BTYPE_EVENT); - - case ARGI_MUTEX: - return (ACPI_BTYPE_MUTEX); - - case ARGI_DDBHANDLE: - /* - * DDBHandleObject := SuperName - * ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload - */ - return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE); - - /* Interchangeable types */ - /* - * Source conversion rules: - * Integer, String, and Buffer are all interchangeable - */ - case ARGI_INTEGER: - case ARGI_STRING: - case ARGI_BUFFER: - case ARGI_BUFFER_OR_STRING: - case ARGI_COMPUTEDATA: - return (ACPI_BTYPE_COMPUTE_DATA); - - /* References */ - - case ARGI_INTEGER_REF: - return (ACPI_BTYPE_INTEGER); - - case ARGI_OBJECT_REF: - return (ACPI_BTYPE_ALL_OBJECTS); - - case ARGI_DEVICE_REF: - return (ACPI_BTYPE_DEVICE_OBJECTS); - - case ARGI_REFERENCE: - return (ACPI_BTYPE_REFERENCE); - - case ARGI_TARGETREF: - case ARGI_FIXED_TARGET: - case ARGI_SIMPLE_TARGET: - return (ACPI_BTYPE_OBJECTS_AND_REFS); - - /* Complex types */ - - case ARGI_DATAOBJECT: - - /* - * Buffer, string, package or reference to a Op - - * Used only by SizeOf operator - */ - return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | - ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE); - - case ARGI_COMPLEXOBJ: - - /* Buffer, String, or package */ - - return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE); - - case ARGI_REF_OR_STRING: - return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE); - - case ARGI_REGION_OR_BUFFER: - - /* Used by Load() only. Allow buffers in addition to regions/fields */ - - return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | ACPI_BTYPE_FIELD_UNIT); - - case ARGI_DATAREFOBJ: - return (ACPI_BTYPE_INTEGER |ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | - ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE); - - default: - break; - } - - return (ACPI_BTYPE_OBJECTS_AND_REFS); -} - - -/******************************************************************************* - * - * FUNCTION: AnMapEtypeToBtype - * - * PARAMETERS: Etype - Encoded ACPI Type - * - * RETURN: Btype corresponding to the Etype - * - * DESCRIPTION: Convert an encoded ACPI type to a bitfield type applying the - * operand conversion rules. In other words, returns the type(s) - * this Etype is implicitly converted to during interpretation. - * - ******************************************************************************/ - -static UINT32 -AnMapEtypeToBtype ( - UINT32 Etype) -{ - - - if (Etype == ACPI_TYPE_ANY) - { - return ACPI_BTYPE_OBJECTS_AND_REFS; - } - - /* Try the standard ACPI data types */ - - if (Etype <= ACPI_TYPE_EXTERNAL_MAX) - { - /* - * This switch statement implements the allowed operand conversion - * rules as per the "ASL Data Types" section of the ACPI - * specification. - */ - switch (Etype) - { - case ACPI_TYPE_INTEGER: - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE); - - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - return (ACPI_BTYPE_COMPUTE_DATA); - - case ACPI_TYPE_PACKAGE: - return (ACPI_BTYPE_PACKAGE); - - case ACPI_TYPE_FIELD_UNIT: - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT); - - case ACPI_TYPE_BUFFER_FIELD: - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD); - - case ACPI_TYPE_DDB_HANDLE: - return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE); - - case ACPI_BTYPE_DEBUG_OBJECT: - - /* Cannot be used as a source operand */ - - return (0); - - default: - return (1 << (Etype - 1)); - } - } - - /* Try the internal data types */ - - switch (Etype) - { - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - /* Named fields can be either Integer/Buffer/String */ - - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT); - - case ACPI_TYPE_LOCAL_ALIAS: - - return (ACPI_BTYPE_INTEGER); - - - case ACPI_TYPE_LOCAL_RESOURCE: - case ACPI_TYPE_LOCAL_RESOURCE_FIELD: - - return (ACPI_BTYPE_REFERENCE); - - default: - printf ("Unhandled encoded type: %X\n", Etype); - return (0); - } -} - - -/******************************************************************************* - * - * FUNCTION: AnFormatBtype - * - * PARAMETERS: Btype - Bitfield of ACPI types - * Buffer - Where to put the ascii string - * - * RETURN: None. - * - * DESCRIPTION: Convert a Btype to a string of ACPI types - * - ******************************************************************************/ - -static void -AnFormatBtype ( - char *Buffer, - UINT32 Btype) -{ - UINT32 Type; - BOOLEAN First = TRUE; - - - *Buffer = 0; - - if (Btype == 0) - { - strcat (Buffer, "NoReturnValue"); - return; - } - - for (Type = 1; Type <= ACPI_TYPE_EXTERNAL_MAX; Type++) - { - if (Btype & 0x00000001) - { - if (!First) - { - strcat (Buffer, "|"); - } - First = FALSE; - strcat (Buffer, AcpiUtGetTypeName (Type)); - } - Btype >>= 1; - } - - if (Btype & 0x00000001) - { - if (!First) - { - strcat (Buffer, "|"); - } - First = FALSE; - strcat (Buffer, "Reference"); - } - - Btype >>= 1; - if (Btype & 0x00000001) - { - if (!First) - { - strcat (Buffer, "|"); - } - First = FALSE; - strcat (Buffer, "Resource"); - } -} - - -/******************************************************************************* - * - * FUNCTION: AnGetBtype - * - * PARAMETERS: Op - Parse node whose type will be returned. - * - * RETURN: The Btype associated with the Op. - * - * DESCRIPTION: Get the (bitfield) ACPI type associated with the parse node. - * Handles the case where the node is a name or method call and - * the actual type must be obtained from the namespace node. - * - ******************************************************************************/ - -static UINT32 -AnGetBtype ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *ReferencedNode; - UINT32 ThisNodeBtype = 0; - - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - Node = Op->Asl.Node; - if (!Node) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "No attached Nsnode: [%s] at line %d name [%s], ignoring typecheck\n", - Op->Asl.ParseOpName, Op->Asl.LineNumber, - Op->Asl.ExternalName); - return ACPI_UINT32_MAX; - } - - ThisNodeBtype = AnMapEtypeToBtype (Node->Type); - if (!ThisNodeBtype) - { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, - "could not map type"); - } - - /* - * Since it was a named reference, enable the - * reference bit also - */ - ThisNodeBtype |= ACPI_BTYPE_REFERENCE; - - if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - ReferencedNode = Node->Op; - if (!ReferencedNode) - { - /* Check for an internal method */ - - if (AnIsInternalMethod (Op)) - { - return (AnGetInternalMethodReturnType (Op)); - } - - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, - "null Op pointer"); - return ACPI_UINT32_MAX; - } - - if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED) - { - ThisNodeBtype = ReferencedNode->Asl.AcpiBtype; - } - else - { - return (ACPI_UINT32_MAX -1); - } - } - } - else - { - ThisNodeBtype = Op->Asl.AcpiBtype; - } - - return (ThisNodeBtype); -} - - -/******************************************************************************* - * - * FUNCTION: AnMapObjTypeToBtype - * - * PARAMETERS: Op - A parse node - * - * RETURN: A Btype - * - * DESCRIPTION: Map object to the associated "Btype" - * - ******************************************************************************/ - -static UINT32 -AnMapObjTypeToBtype ( - ACPI_PARSE_OBJECT *Op) -{ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_OBJECTTYPE_BFF: /* "BuffFieldObj" */ - return (ACPI_BTYPE_BUFFER_FIELD); - - case PARSEOP_OBJECTTYPE_BUF: /* "BuffObj" */ - return (ACPI_BTYPE_BUFFER); - - case PARSEOP_OBJECTTYPE_DDB: /* "DDBHandleObj" */ - return (ACPI_BTYPE_DDB_HANDLE); - - case PARSEOP_OBJECTTYPE_DEV: /* "DeviceObj" */ - return (ACPI_BTYPE_DEVICE); - - case PARSEOP_OBJECTTYPE_EVT: /* "EventObj" */ - return (ACPI_BTYPE_EVENT); - - case PARSEOP_OBJECTTYPE_FLD: /* "FieldUnitObj" */ - return (ACPI_BTYPE_FIELD_UNIT); - - case PARSEOP_OBJECTTYPE_INT: /* "IntObj" */ - return (ACPI_BTYPE_INTEGER); - - case PARSEOP_OBJECTTYPE_MTH: /* "MethodObj" */ - return (ACPI_BTYPE_METHOD); - - case PARSEOP_OBJECTTYPE_MTX: /* "MutexObj" */ - return (ACPI_BTYPE_MUTEX); - - case PARSEOP_OBJECTTYPE_OPR: /* "OpRegionObj" */ - return (ACPI_BTYPE_REGION); - - case PARSEOP_OBJECTTYPE_PKG: /* "PkgObj" */ - return (ACPI_BTYPE_PACKAGE); - - case PARSEOP_OBJECTTYPE_POW: /* "PowerResObj" */ - return (ACPI_BTYPE_POWER); - - case PARSEOP_OBJECTTYPE_STR: /* "StrObj" */ - return (ACPI_BTYPE_STRING); - - case PARSEOP_OBJECTTYPE_THZ: /* "ThermalZoneObj" */ - return (ACPI_BTYPE_THERMAL); - - case PARSEOP_OBJECTTYPE_UNK: /* "UnknownObj" */ - return (ACPI_BTYPE_OBJECTS_AND_REFS); - - default: - return (0); - } -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodAnalysisWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the analysis walk. Check methods for: - * 1) Initialized local variables - * 2) Valid arguments - * 3) Return types - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context; - ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack; - ACPI_PARSE_OBJECT *Next; - UINT32 RegisterNumber; - UINT32 i; - char LocalName[] = "Local0"; - char ArgName[] = "Arg0"; - ACPI_PARSE_OBJECT *ArgNode; - ACPI_PARSE_OBJECT *NextType; - ACPI_PARSE_OBJECT *NextParamType; - UINT8 ActualArgs = 0; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - - TotalMethods++; - - /* Create and init method info */ - - MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO)); - MethodInfo->Next = WalkInfo->MethodStack; - MethodInfo->Op = Op; - - WalkInfo->MethodStack = MethodInfo; - - /* Get the name node, ignored here */ - - Next = Op->Asl.Child; - - /* Get the NumArguments node */ - - Next = Next->Asl.Next; - MethodInfo->NumArguments = (UINT8) - (((UINT8) Next->Asl.Value.Integer) & 0x07); - - /* Get the SerializeRule and SyncLevel nodes, ignored here */ - - Next = Next->Asl.Next; - Next = Next->Asl.Next; - ArgNode = Next; - - /* Get the ReturnType node */ - - Next = Next->Asl.Next; - - NextType = Next->Asl.Child; - while (NextType) - { - /* Get and map each of the ReturnTypes */ - - MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType); - NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - NextType = NextType->Asl.Next; - } - - /* Get the ParameterType node */ - - Next = Next->Asl.Next; - - NextType = Next->Asl.Child; - while (NextType) - { - if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - NextParamType = NextType->Asl.Child; - while (NextParamType) - { - MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType); - NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - NextParamType = NextParamType->Asl.Next; - } - } - else - { - MethodInfo->ValidArgTypes[ActualArgs] = - AnMapObjTypeToBtype (NextType); - NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - ActualArgs++; - } - - NextType = NextType->Asl.Next; - } - - if ((MethodInfo->NumArguments) && - (MethodInfo->NumArguments != ActualArgs)) - { - /* error: Param list did not match number of args */ - } - - /* Allow numarguments == 0 for Function() */ - - if ((!MethodInfo->NumArguments) && (ActualArgs)) - { - MethodInfo->NumArguments = ActualArgs; - ArgNode->Asl.Value.Integer |= ActualArgs; - } - - /* - * Actual arguments are initialized at method entry. - * All other ArgX "registers" can be used as locals, so we - * track their initialization. - */ - for (i = 0; i < MethodInfo->NumArguments; i++) - { - MethodInfo->ArgInitialized[i] = TRUE; - } - break; - - - case PARSEOP_METHODCALL: - - if (MethodInfo && - (Op->Asl.Node == MethodInfo->Op->Asl.Node)) - { - AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName); - } - break; - - - case PARSEOP_LOCAL0: - case PARSEOP_LOCAL1: - case PARSEOP_LOCAL2: - case PARSEOP_LOCAL3: - case PARSEOP_LOCAL4: - case PARSEOP_LOCAL5: - case PARSEOP_LOCAL6: - case PARSEOP_LOCAL7: - - if (!MethodInfo) - { - /* - * Local was used outside a control method, or there was an error - * in the method declaration. - */ - AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName); - return (AE_ERROR); - } - - RegisterNumber = (Op->Asl.AmlOpcode & 0x000F); - - /* - * If the local is being used as a target, mark the local - * initialized - */ - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - MethodInfo->LocalInitialized[RegisterNumber] = TRUE; - } - - /* - * Otherwise, this is a reference, check if the local - * has been previously initialized. - * - * The only operator that accepts an uninitialized value is ObjectType() - */ - else if ((!MethodInfo->LocalInitialized[RegisterNumber]) && - (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE)) - { - LocalName[strlen (LocalName) -1] = (char) (RegisterNumber + 0x30); - AslError (ASL_ERROR, ASL_MSG_LOCAL_INIT, Op, LocalName); - } - break; - - - case PARSEOP_ARG0: - case PARSEOP_ARG1: - case PARSEOP_ARG2: - case PARSEOP_ARG3: - case PARSEOP_ARG4: - case PARSEOP_ARG5: - case PARSEOP_ARG6: - - if (!MethodInfo) - { - /* - * Arg was used outside a control method, or there was an error - * in the method declaration. - */ - AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName); - return (AE_ERROR); - } - - RegisterNumber = (Op->Asl.AmlOpcode & 0x000F) - 8; - ArgName[strlen (ArgName) -1] = (char) (RegisterNumber + 0x30); - - /* - * If the Arg is being used as a target, mark the local - * initialized - */ - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - MethodInfo->ArgInitialized[RegisterNumber] = TRUE; - } - - /* - * Otherwise, this is a reference, check if the Arg - * has been previously initialized. - * - * The only operator that accepts an uninitialized value is ObjectType() - */ - else if ((!MethodInfo->ArgInitialized[RegisterNumber]) && - (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE)) - { - AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName); - } - - /* Flag this arg if it is not a "real" argument to the method */ - - if (RegisterNumber >= MethodInfo->NumArguments) - { - AslError (ASL_REMARK, ASL_MSG_NOT_PARAMETER, Op, ArgName); - } - break; - - - case PARSEOP_RETURN: - - if (!MethodInfo) - { - /* - * Probably was an error in the method declaration, - * no additional error here - */ - ACPI_WARNING ((AE_INFO, "%p, No parent method", Op)); - return (AE_ERROR); - } - - /* Child indicates a return value */ - - if ((Op->Asl.Child) && - (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - MethodInfo->NumReturnWithValue++; - } - else - { - MethodInfo->NumReturnNoValue++; - } - break; - - - case PARSEOP_BREAK: - case PARSEOP_CONTINUE: - - Next = Op->Asl.Parent; - while (Next) - { - if (Next->Asl.ParseOpcode == PARSEOP_WHILE) - { - break; - } - Next = Next->Asl.Parent; - } - - if (!Next) - { - AslError (ASL_ERROR, ASL_MSG_NO_WHILE, Op, NULL); - } - break; - - - case PARSEOP_STALL: - - /* We can range check if the argument is an integer */ - - if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) && - (Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, Op, NULL); - } - break; - - - case PARSEOP_DEVICE: - case PARSEOP_EVENT: - case PARSEOP_MUTEX: - case PARSEOP_OPERATIONREGION: - case PARSEOP_POWERRESOURCE: - case PARSEOP_PROCESSOR: - case PARSEOP_THERMALZONE: - - /* - * The first operand is a name to be created in the namespace. - * Check against the reserved list. - */ - i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg); - if (i < ACPI_VALID_RESERVED_NAME_MAX) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName); - } - break; - - - case PARSEOP_NAME: - - /* Typecheck any predefined names statically defined with Name() */ - - ApCheckForPredefinedObject (Op, Op->Asl.NameSeg); - - /* Special typechecking for _HID */ - - if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg)) - { - Next = Op->Asl.Child->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) - { - /* - * _HID is a string, all characters must be alphanumeric. - * One of the things we want to catch here is the use of - * a leading asterisk in the string. - */ - for (i = 0; Next->Asl.Value.String[i]; i++) - { - if (!isalnum ((int) Next->Asl.Value.String[i])) - { - AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, - Next, Next->Asl.Value.String); - break; - } - } - } - } - break; - - - default: - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnLastStatementIsReturn - * - * PARAMETERS: Op - A method parse node - * - * RETURN: TRUE if last statement is an ASL RETURN. False otherwise - * - * DESCRIPTION: Walk down the list of top level statements within a method - * to find the last one. Check if that last statement is in - * fact a RETURN statement. - * - ******************************************************************************/ - -static BOOLEAN -AnLastStatementIsReturn ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* - * Check if last statement is a return - */ - Next = ASL_GET_CHILD_NODE (Op); - while (Next) - { - if ((!Next->Asl.Next) && - (Next->Asl.ParseOpcode == PARSEOP_RETURN)) - { - return TRUE; - } - - Next = ASL_GET_PEER_NODE (Next); - } - - return FALSE; -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodAnalysisWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for analysis walk. Complete method - * return analysis. - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context; - ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - case PARSEOP_RETURN: - if (!MethodInfo) - { - printf ("No method info for method! [%s]\n", Op->Asl.Namepath); - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, - "No method info for this method"); - CmCleanupAndExit (); - return (AE_AML_INTERNAL); - } - break; - - default: - break; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - - WalkInfo->MethodStack = MethodInfo->Next; - - /* - * Check if there is no return statement at the end of the - * method AND we can actually get there -- i.e., the execution - * of the method can possibly terminate without a return statement. - */ - if ((!AnLastStatementIsReturn (Op)) && - (!(Op->Asl.CompileFlags & NODE_HAS_NO_EXIT))) - { - /* - * No return statement, and execution can possibly exit - * via this path. This is equivalent to Return () - */ - MethodInfo->NumReturnNoValue++; - } - - /* - * Check for case where some return statements have a return value - * and some do not. Exit without a return statement is a return with - * no value - */ - if (MethodInfo->NumReturnNoValue && - MethodInfo->NumReturnWithValue) - { - AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op, - Op->Asl.ExternalName); - } - - /* - * If there are any RETURN() statements with no value, or there is a - * control path that allows the method to exit without a return value, - * we mark the method as a method that does not return a value. This - * knowledge can be used to check method invocations that expect a - * returned value. - */ - if (MethodInfo->NumReturnNoValue) - { - if (MethodInfo->NumReturnWithValue) - { - Op->Asl.CompileFlags |= NODE_METHOD_SOME_NO_RETVAL; - } - else - { - Op->Asl.CompileFlags |= NODE_METHOD_NO_RETVAL; - } - } - - /* - * Check predefined method names for correct return behavior - * and correct number of arguments - */ - ApCheckForPredefinedMethod (Op, MethodInfo); - ACPI_FREE (MethodInfo); - break; - - - case PARSEOP_RETURN: - - /* - * If the parent is a predefined method name, attempt to typecheck - * the return value. Only static types can be validated. - */ - ApCheckPredefinedReturnValue (Op, MethodInfo); - - /* - * The parent block does not "exit" and continue execution -- the - * method is terminated here with the Return() statement. - */ - Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT; - - /* Used in the "typing" pass later */ - - Op->Asl.ParentMethod = MethodInfo->Op; - - /* - * If there is a peer node after the return statement, then this - * node is unreachable code -- i.e., it won't be executed because of - * the preceeding Return() statement. - */ - if (Op->Asl.Next) - { - AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL); - } - break; - - - case PARSEOP_IF: - - if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) && - (Op->Asl.Next) && - (Op->Asl.Next->Asl.ParseOpcode == PARSEOP_ELSE)) - { - /* - * This IF has a corresponding ELSE. The IF block has no exit, - * (it contains an unconditional Return) - * mark the ELSE block to remember this fact. - */ - Op->Asl.Next->Asl.CompileFlags |= NODE_IF_HAS_NO_EXIT; - } - break; - - - case PARSEOP_ELSE: - - if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) && - (Op->Asl.CompileFlags & NODE_IF_HAS_NO_EXIT)) - { - /* - * This ELSE block has no exit and the corresponding IF block - * has no exit either. Therefore, the parent node has no exit. - */ - Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT; - } - break; - - - default: - - if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) && - (Op->Asl.Parent)) - { - /* If this node has no exit, then the parent has no exit either */ - - Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT; - } - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodTypingWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the typing walk. - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodTypingWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodTypingWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for typing walk. Complete the method - * return analysis. Check methods for: - * 1) Initialized local variables - * 2) Valid arguments - * 3) Return types - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodTypingWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - UINT32 ThisNodeBtype; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - - Op->Asl.CompileFlags |= NODE_METHOD_TYPED; - break; - - case PARSEOP_RETURN: - - if ((Op->Asl.Child) && - (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - ThisNodeBtype = AnGetBtype (Op->Asl.Child); - - if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_METHODCALL) && - (ThisNodeBtype == (ACPI_UINT32_MAX -1))) - { - /* - * The called method is untyped at this time (typically a - * forward reference). - * - * Check for a recursive method call first. - */ - if (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op) - { - /* We must type the method here */ - - TrWalkParseTree (Op->Asl.Child->Asl.Node->Op, - ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin, - AnMethodTypingWalkEnd, NULL); - - ThisNodeBtype = AnGetBtype (Op->Asl.Child); - } - } - - /* Returns a value, save the value type */ - - if (Op->Asl.ParentMethod) - { - Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisNodeBtype; - } - } - break; - - default: - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnCheckMethodReturnValue - * - * PARAMETERS: Op - Parent - * OpInfo - Parent info - * ArgOp - Method invocation op - * RequiredBtypes - What caller requires - * ThisNodeBtype - What this node returns (if anything) - * - * RETURN: None - * - * DESCRIPTION: Check a method invocation for 1) A return value and if it does - * in fact return a value, 2) check the type of the return value. - * - ******************************************************************************/ - -static void -AnCheckMethodReturnValue ( - ACPI_PARSE_OBJECT *Op, - const ACPI_OPCODE_INFO *OpInfo, - ACPI_PARSE_OBJECT *ArgOp, - UINT32 RequiredBtypes, - UINT32 ThisNodeBtype) -{ - ACPI_PARSE_OBJECT *OwningOp; - ACPI_NAMESPACE_NODE *Node; - - - Node = ArgOp->Asl.Node; - - - /* Examine the parent op of this method */ - - OwningOp = Node->Op; - if (OwningOp->Asl.CompileFlags & NODE_METHOD_NO_RETVAL) - { - /* Method NEVER returns a value */ - - AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, Op->Asl.ExternalName); - } - else if (OwningOp->Asl.CompileFlags & NODE_METHOD_SOME_NO_RETVAL) - { - /* Method SOMETIMES returns a value, SOMETIMES not */ - - AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, Op->Asl.ExternalName); - } - else if (!(ThisNodeBtype & RequiredBtypes)) - { - /* Method returns a value, but the type is wrong */ - - AnFormatBtype (StringBuffer, ThisNodeBtype); - AnFormatBtype (StringBuffer2, RequiredBtypes); - - - /* - * The case where the method does not return any value at all - * was already handled in the namespace cross reference - * -- Only issue an error if the method in fact returns a value, - * but it is of the wrong type - */ - if (ThisNodeBtype != 0) - { - sprintf (MsgBuffer, - "Method returns [%s], %s operator requires [%s]", - StringBuffer, OpInfo->Name, StringBuffer2); - - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AnOperandTypecheckWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the analysis walk. Check methods for: - * 1) Initialized local variables - * 2) Valid arguments - * 3) Return types - * - ******************************************************************************/ - -ACPI_STATUS -AnOperandTypecheckWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnOperandTypecheckWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for analysis walk. Complete method - * return analysis. - * - ******************************************************************************/ - -ACPI_STATUS -AnOperandTypecheckWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - const ACPI_OPCODE_INFO *OpInfo; - UINT32 RuntimeArgTypes; - UINT32 RuntimeArgTypes2; - UINT32 RequiredBtypes; - UINT32 ThisNodeBtype; - UINT32 CommonBtypes; - UINT32 OpcodeClass; - ACPI_PARSE_OBJECT *ArgOp; - UINT32 ArgType; - - - switch (Op->Asl.AmlOpcode) - { - case AML_RAW_DATA_BYTE: - case AML_RAW_DATA_WORD: - case AML_RAW_DATA_DWORD: - case AML_RAW_DATA_QWORD: - case AML_RAW_DATA_BUFFER: - case AML_RAW_DATA_CHAIN: - case AML_PACKAGE_LENGTH: - case AML_UNASSIGNED_OPCODE: - case AML_DEFAULT_ARG_OP: - - /* Ignore the internal (compiler-only) AML opcodes */ - - return (AE_OK); - - default: - break; - } - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - if (!OpInfo) - { - return (AE_OK); - } - - ArgOp = Op->Asl.Child; - RuntimeArgTypes = OpInfo->RuntimeArgs; - OpcodeClass = OpInfo->Class; - -#ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE - /* - * Update 11/2008: In practice, we can't perform this check. A simple - * analysis is not sufficient. Also, it can cause errors when compiling - * disassembled code because of the way Switch operators are implemented - * (a While(One) loop with a named temp variable created within.) - */ - - /* - * If we are creating a named object, check if we are within a while loop - * by checking if the parent is a WHILE op. This is a simple analysis, but - * probably sufficient for many cases. - * - * Allow Scope(), Buffer(), and Package(). - */ - if (((OpcodeClass == AML_CLASS_NAMED_OBJECT) && (Op->Asl.AmlOpcode != AML_SCOPE_OP)) || - ((OpcodeClass == AML_CLASS_CREATE) && (OpInfo->Flags & AML_NSNODE))) - { - if (Op->Asl.Parent->Asl.AmlOpcode == AML_WHILE_OP) - { - AslError (ASL_ERROR, ASL_MSG_NAMED_OBJECT_IN_WHILE, Op, NULL); - } - } -#endif - - /* - * Special case for control opcodes IF/RETURN/WHILE since they - * have no runtime arg list (at this time) - */ - switch (Op->Asl.AmlOpcode) - { - case AML_IF_OP: - case AML_WHILE_OP: - case AML_RETURN_OP: - - if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - /* Check for an internal method */ - - if (AnIsInternalMethod (ArgOp)) - { - return (AE_OK); - } - - /* The lone arg is a method call, check it */ - - RequiredBtypes = AnMapArgTypeToBtype (ARGI_INTEGER); - if (Op->Asl.AmlOpcode == AML_RETURN_OP) - { - RequiredBtypes = 0xFFFFFFFF; - } - - ThisNodeBtype = AnGetBtype (ArgOp); - if (ThisNodeBtype == ACPI_UINT32_MAX) - { - return (AE_OK); - } - AnCheckMethodReturnValue (Op, OpInfo, ArgOp, - RequiredBtypes, ThisNodeBtype); - } - return (AE_OK); - - default: - break; - } - - /* Ignore the non-executable opcodes */ - - if (RuntimeArgTypes == ARGI_INVALID_OPCODE) - { - return (AE_OK); - } - - switch (OpcodeClass) - { - case AML_CLASS_EXECUTE: - case AML_CLASS_CREATE: - case AML_CLASS_CONTROL: - case AML_CLASS_RETURN_VALUE: - - /* TBD: Change class or fix typechecking for these */ - - if ((Op->Asl.AmlOpcode == AML_BUFFER_OP) || - (Op->Asl.AmlOpcode == AML_PACKAGE_OP) || - (Op->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)) - { - break; - } - - /* Reverse the runtime argument list */ - - RuntimeArgTypes2 = 0; - while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes))) - { - RuntimeArgTypes2 <<= ARG_TYPE_WIDTH; - RuntimeArgTypes2 |= ArgType; - INCREMENT_ARG_LIST (RuntimeArgTypes); - } - - while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes2))) - { - RequiredBtypes = AnMapArgTypeToBtype (ArgType); - - ThisNodeBtype = AnGetBtype (ArgOp); - if (ThisNodeBtype == ACPI_UINT32_MAX) - { - goto NextArgument; - } - - /* Examine the arg based on the required type of the arg */ - - switch (ArgType) - { - case ARGI_TARGETREF: - - if (ArgOp->Asl.ParseOpcode == PARSEOP_ZERO) - { - /* ZERO is the placeholder for "don't store result" */ - - ThisNodeBtype = RequiredBtypes; - break; - } - - if (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER) - { - /* - * This is the case where an original reference to a resource - * descriptor field has been replaced by an (Integer) offset. - * These named fields are supported at compile-time only; - * the names are not passed to the interpreter (via the AML). - */ - if ((ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || - (ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD, ArgOp, NULL); - } - else - { - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, NULL); - } - break; - } - - if ((ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) || - (ArgOp->Asl.ParseOpcode == PARSEOP_DEREFOF)) - { - break; - } - - ThisNodeBtype = RequiredBtypes; - break; - - - case ARGI_REFERENCE: /* References */ - case ARGI_INTEGER_REF: - case ARGI_OBJECT_REF: - case ARGI_DEVICE_REF: - - switch (ArgOp->Asl.ParseOpcode) - { - case PARSEOP_LOCAL0: - case PARSEOP_LOCAL1: - case PARSEOP_LOCAL2: - case PARSEOP_LOCAL3: - case PARSEOP_LOCAL4: - case PARSEOP_LOCAL5: - case PARSEOP_LOCAL6: - case PARSEOP_LOCAL7: - - /* TBD: implement analysis of current value (type) of the local */ - /* For now, just treat any local as a typematch */ - - /*ThisNodeBtype = RequiredBtypes;*/ - break; - - case PARSEOP_ARG0: - case PARSEOP_ARG1: - case PARSEOP_ARG2: - case PARSEOP_ARG3: - case PARSEOP_ARG4: - case PARSEOP_ARG5: - case PARSEOP_ARG6: - - /* Hard to analyze argument types, sow we won't */ - /* For now, just treat any arg as a typematch */ - - /* ThisNodeBtype = RequiredBtypes; */ - break; - - case PARSEOP_DEBUG: - break; - - case PARSEOP_REFOF: - case PARSEOP_INDEX: - default: - break; - - } - break; - - case ARGI_INTEGER: - default: - break; - } - - - CommonBtypes = ThisNodeBtype & RequiredBtypes; - - if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - if (AnIsInternalMethod (ArgOp)) - { - return (AE_OK); - } - - /* Check a method call for a valid return value */ - - AnCheckMethodReturnValue (Op, OpInfo, ArgOp, - RequiredBtypes, ThisNodeBtype); - } - - /* - * Now check if the actual type(s) match at least one - * bit to the required type - */ - else if (!CommonBtypes) - { - /* No match -- this is a type mismatch error */ - - AnFormatBtype (StringBuffer, ThisNodeBtype); - AnFormatBtype (StringBuffer2, RequiredBtypes); - - sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]", - StringBuffer, OpInfo->Name, StringBuffer2); - - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer); - } - - NextArgument: - ArgOp = ArgOp->Asl.Next; - INCREMENT_ARG_LIST (RuntimeArgTypes2); - } - break; - - default: - break; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AnIsResultUsed - * - * PARAMETERS: Op - Parent op for the operator - * - * RETURN: TRUE if result from this operation is actually consumed - * - * DESCRIPTION: Determine if the function result value from an operator is - * used. - * - ******************************************************************************/ - -BOOLEAN -AnIsResultUsed ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Parent; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_INCREMENT: - case PARSEOP_DECREMENT: - - /* These are standalone operators, no return value */ - - return (TRUE); - - default: - break; - } - - /* Examine parent to determine if the return value is used */ - - Parent = Op->Asl.Parent; - switch (Parent->Asl.ParseOpcode) - { - /* If/While - check if the operator is the predicate */ - - case PARSEOP_IF: - case PARSEOP_WHILE: - - /* First child is the predicate */ - - if (Parent->Asl.Child == Op) - { - return (TRUE); - } - return (FALSE); - - /* Not used if one of these is the parent */ - - case PARSEOP_METHOD: - case PARSEOP_DEFINITIONBLOCK: - case PARSEOP_ELSE: - - return (FALSE); - - default: - /* Any other type of parent means that the result is used */ - - return (TRUE); - } -} - - -/******************************************************************************* - * - * FUNCTION: AnOtherSemanticAnalysisWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the analysis walk. Checks for - * miscellaneous issues in the code. - * - ******************************************************************************/ - -ACPI_STATUS -AnOtherSemanticAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_PARSE_OBJECT *ArgNode; - ACPI_PARSE_OBJECT *PrevArgNode = NULL; - const ACPI_OPCODE_INFO *OpInfo; - - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - - /* - * Determine if an execution class operator actually does something by - * checking if it has a target and/or the function return value is used. - * (Target is optional, so a standalone statement can actually do nothing.) - */ - if ((OpInfo->Class == AML_CLASS_EXECUTE) && - (OpInfo->Flags & AML_HAS_RETVAL) && - (!AnIsResultUsed (Op))) - { - if (OpInfo->Flags & AML_HAS_TARGET) - { - /* - * Find the target node, it is always the last child. If the traget - * is not specified in the ASL, a default node of type Zero was - * created by the parser. - */ - ArgNode = Op->Asl.Child; - while (ArgNode->Asl.Next) - { - PrevArgNode = ArgNode; - ArgNode = ArgNode->Asl.Next; - } - - /* Divide() is the only weird case, it has two targets */ - - if (Op->Asl.AmlOpcode == AML_DIVIDE_OP) - { - if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) && - (PrevArgNode->Asl.ParseOpcode == PARSEOP_ZERO)) - { - AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); - } - } - else if (ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) - { - AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); - } - } - else - { - /* - * Has no target and the result is not used. Only a couple opcodes - * can have this combination. - */ - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_ACQUIRE: - case PARSEOP_WAIT: - case PARSEOP_LOADTABLE: - break; - - default: - AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); - break; - } - } - } - - - /* - * Semantic checks for individual ASL operators - */ - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_ACQUIRE: - case PARSEOP_WAIT: - /* - * Emit a warning if the timeout parameter for these operators is not - * ACPI_WAIT_FOREVER, and the result value from the operator is not - * checked, meaning that a timeout could happen, but the code - * would not know about it. - */ - - /* First child is the namepath, 2nd child is timeout */ - - ArgNode = Op->Asl.Child; - ArgNode = ArgNode->Asl.Next; - - /* - * Check for the WAIT_FOREVER case - defined by the ACPI spec to be - * 0xFFFF or greater - */ - if (((ArgNode->Asl.ParseOpcode == PARSEOP_WORDCONST) || - (ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER)) && - (ArgNode->Asl.Value.Integer >= (UINT64) ACPI_WAIT_FOREVER)) - { - break; - } - - /* - * The operation could timeout. If the return value is not used - * (indicates timeout occurred), issue a warning - */ - if (!AnIsResultUsed (Op)) - { - AslError (ASL_WARNING, ASL_MSG_TIMEOUT, ArgNode, Op->Asl.ExternalName); - } - break; - - case PARSEOP_CREATEFIELD: - /* - * Check for a zero Length (NumBits) operand. NumBits is the 3rd operand - */ - ArgNode = Op->Asl.Child; - ArgNode = ArgNode->Asl.Next; - ArgNode = ArgNode->Asl.Next; - - if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) || - ((ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER) && - (ArgNode->Asl.Value.Integer == 0))) - { - AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgNode, NULL); - } - break; - - default: - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnOtherSemanticAnalysisWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for analysis walk. Complete method - * return analysis. - * - ******************************************************************************/ - -ACPI_STATUS -AnOtherSemanticAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - return AE_OK; - -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AnMapBtypeToEtype - * - * PARAMETERS: Btype - Bitfield of ACPI types - * - * RETURN: The Etype corresponding the the Btype - * - * DESCRIPTION: Convert a bitfield type to an encoded type - * - ******************************************************************************/ - -UINT32 -AnMapBtypeToEtype ( - UINT32 Btype) -{ - UINT32 i; - UINT32 Etype; - - - if (Btype == 0) - { - return 0; - } - - Etype = 1; - for (i = 1; i < Btype; i *= 2) - { - Etype++; - } - - return (Etype); -} -#endif - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcodegen.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcodegen.c deleted file mode 100644 index dcd6997003..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcodegen.c +++ /dev/null @@ -1,660 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslcodegen - AML code generation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslcodegen") - -/* Local prototypes */ - -static ACPI_STATUS -CgAmlWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static void -CgLocalWriteAmlData ( - ACPI_PARSE_OBJECT *Op, - void *Buffer, - UINT32 Length); - -static void -CgWriteAmlOpcode ( - ACPI_PARSE_OBJECT *Op); - -static void -CgWriteTableHeader ( - ACPI_PARSE_OBJECT *Op); - -static void -CgCloseTable ( - void); - -static void -CgWriteNode ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: CgGenerateAmlOutput - * - * PARAMETERS: None. - * - * RETURN: None - * - * DESCRIPTION: Generate AML code. Currently generates the listing file - * simultaneously. - * - ******************************************************************************/ - -void -CgGenerateAmlOutput ( - void) -{ - - DbgPrint (ASL_DEBUG_OUTPUT, "\nWriting AML\n\n"); - - /* Generate the AML output file */ - - FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); - Gbl_SourceLine = 0; - Gbl_NextError = Gbl_ErrorLog; - - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - CgAmlWriteWalk, NULL, NULL); - CgCloseTable (); -} - - -/******************************************************************************* - * - * FUNCTION: CgAmlWriteWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Parse tree walk to generate the AML code. - * - ******************************************************************************/ - -static ACPI_STATUS -CgAmlWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* - * Print header at level 0. Alignment assumes 32-bit pointers - */ - if (!Level) - { - DbgPrint (ASL_TREE_OUTPUT, - "Final parse tree used for AML output:\n"); - DbgPrint (ASL_TREE_OUTPUT, - "%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr Child Parent Flags AcTyp Final Col L\n", - 76, " "); - } - - /* Debug output */ - - DbgPrint (ASL_TREE_OUTPUT, - "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); - UtPrintFormattedName (Op->Asl.ParseOpcode, Level); - - if (Op->Asl.ParseOpcode == PARSEOP_NAMESEG || - Op->Asl.ParseOpcode == PARSEOP_NAMESTRING || - Op->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - DbgPrint (ASL_TREE_OUTPUT, - "%10.32s ", Op->Asl.ExternalName); - } - else - { - DbgPrint (ASL_TREE_OUTPUT, " "); - } - - DbgPrint (ASL_TREE_OUTPUT, - "%08X %04X %04X %01X %04X %04X %04X %04X %08X %08X %08X %08X %08X %04X %02d %02d\n", - /* 1 */ (UINT32) Op->Asl.Value.Integer, - /* 2 */ Op->Asl.ParseOpcode, - /* 3 */ Op->Asl.AmlOpcode, - /* 4 */ Op->Asl.AmlOpcodeLength, - /* 5 */ Op->Asl.AmlPkgLenBytes, - /* 6 */ Op->Asl.AmlLength, - /* 7 */ Op->Asl.AmlSubtreeLength, - /* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0, - /* 9 */ Op, - /* 10 */ Op->Asl.Child, - /* 11 */ Op->Asl.Parent, - /* 12 */ Op->Asl.CompileFlags, - /* 13 */ Op->Asl.AcpiBtype, - /* 14 */ Op->Asl.FinalAmlLength, - /* 15 */ Op->Asl.Column, - /* 16 */ Op->Asl.LineNumber); - - /* Generate the AML for this node */ - - CgWriteNode (Op); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: CgLocalWriteAmlData - * - * PARAMETERS: Op - Current parse op - * Buffer - Buffer to write - * Length - Size of data in buffer - * - * RETURN: None - * - * DESCRIPTION: Write a buffer of AML data to the AML output file. - * - ******************************************************************************/ - -static void -CgLocalWriteAmlData ( - ACPI_PARSE_OBJECT *Op, - void *Buffer, - UINT32 Length) -{ - - /* Write the raw data to the AML file */ - - FlWriteFile (ASL_FILE_AML_OUTPUT, Buffer, Length); - - /* Update the final AML length for this node (used for listings) */ - - if (Op) - { - Op->Asl.FinalAmlLength += Length; - } -} - - -/******************************************************************************* - * - * FUNCTION: CgWriteAmlOpcode - * - * PARAMETERS: Op - Parse node with an AML opcode - * - * RETURN: None. - * - * DESCRIPTION: Write the AML opcode corresponding to a parse node. - * - ******************************************************************************/ - -static void -CgWriteAmlOpcode ( - ACPI_PARSE_OBJECT *Op) -{ - UINT8 PkgLenFirstByte; - UINT32 i; - union { - UINT16 Opcode; - UINT8 OpcodeBytes[2]; - } Aml; - union { - UINT32 Len; - UINT8 LenBytes[4]; - } PkgLen; - - - /* We expect some DEFAULT_ARGs, just ignore them */ - - if (Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - return; - } - - switch (Op->Asl.AmlOpcode) - { - case AML_UNASSIGNED_OPCODE: - - /* These opcodes should not get here */ - - printf ("Found a node with an unassigned AML opcode\n"); - fprintf (stderr, "Found a node with an unassigned AML opcode\n"); - return; - - case AML_INT_RESERVEDFIELD_OP: - - /* Special opcodes for within a field definition */ - - Aml.Opcode = 0x00; - break; - - case AML_INT_ACCESSFIELD_OP: - - Aml.Opcode = 0x01; - break; - - default: - Aml.Opcode = Op->Asl.AmlOpcode; - break; - } - - - switch (Aml.Opcode) - { - case AML_PACKAGE_LENGTH: - - /* Value is the length to be encoded (Used in field definitions) */ - - PkgLen.Len = (UINT32) Op->Asl.Value.Integer; - break; - - default: - - /* Check for two-byte opcode */ - - if (Aml.Opcode > 0x00FF) - { - /* Write the high byte first */ - - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1); - } - - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1); - - /* Subtreelength doesn't include length of package length bytes */ - - PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes; - break; - } - - /* Does this opcode have an associated "PackageLength" field? */ - - if (Op->Asl.CompileFlags & NODE_AML_PACKAGE) - { - if (Op->Asl.AmlPkgLenBytes == 1) - { - /* Simplest case -- no bytes to follow, just write the count */ - - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1); - } - else if (Op->Asl.AmlPkgLenBytes != 0) - { - /* - * Encode the "bytes to follow" in the first byte, top two bits. - * The low-order nybble of the length is in the bottom 4 bits - */ - PkgLenFirstByte = (UINT8) - (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) | - (PkgLen.LenBytes[0] & 0x0F)); - - CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1); - - /* - * Shift the length over by the 4 bits we just stuffed - * in the first byte - */ - PkgLen.Len >>= 4; - - /* Now we can write the remaining bytes - either 1, 2, or 3 bytes */ - - for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++) - { - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1); - } - } - } - - switch (Aml.Opcode) - { - case AML_BYTE_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1); - break; - - case AML_WORD_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2); - break; - - case AML_DWORD_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4); - break; - - case AML_QWORD_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8); - break; - - case AML_STRING_OP: - - CgLocalWriteAmlData (Op, Op->Asl.Value.String, Op->Asl.AmlLength); - break; - - default: - /* All data opcodes must appear above */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: CgWriteTableHeader - * - * PARAMETERS: Op - The DEFINITIONBLOCK node - * - * RETURN: None - * - * DESCRIPTION: Write a table header corresponding to the DEFINITIONBLOCK - * - ******************************************************************************/ - -static void -CgWriteTableHeader ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child; - - - /* AML filename */ - - Child = Op->Asl.Child; - - /* Signature */ - - Child = Child->Asl.Next; - strncpy (TableHeader.Signature, Child->Asl.Value.String, 4); - - /* Revision */ - - Child = Child->Asl.Next; - TableHeader.Revision = (UINT8) Child->Asl.Value.Integer; - - /* Command-line Revision override */ - - if (Gbl_RevisionOverride) - { - TableHeader.Revision = Gbl_RevisionOverride; - } - - /* OEMID */ - - Child = Child->Asl.Next; - strncpy (TableHeader.OemId, Child->Asl.Value.String, 6); - - /* OEM TableID */ - - Child = Child->Asl.Next; - strncpy (TableHeader.OemTableId, Child->Asl.Value.String, 8); - - /* OEM Revision */ - - Child = Child->Asl.Next; - TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer; - - /* Compiler ID */ - - strncpy (TableHeader.AslCompilerId, CompilerCreatorId, 4); - - /* Compiler version */ - - TableHeader.AslCompilerRevision = CompilerCreatorRevision; - - /* Table length. Checksum zero for now, will rewrite later */ - - TableHeader.Length = Gbl_TableLength; - TableHeader.Checksum = 0; - - CgLocalWriteAmlData (Op, &TableHeader, sizeof (ACPI_TABLE_HEADER)); -} - - -/******************************************************************************* - * - * FUNCTION: CgCloseTable - * - * PARAMETERS: None. - * - * RETURN: None. - * - * DESCRIPTION: Complete the ACPI table by calculating the checksum and - * re-writing the header. - * - ******************************************************************************/ - -static void -CgCloseTable ( - void) -{ - signed char Sum; - UINT8 FileByte; - - - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - Sum = 0; - - /* Calculate the checksum over the entire file */ - - while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) == AE_OK) - { - Sum = (signed char) (Sum + FileByte); - } - - /* Re-write the table header with the checksum */ - - TableHeader.Checksum = (UINT8) (0 - Sum); - - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - CgLocalWriteAmlData (NULL, &TableHeader, sizeof (ACPI_TABLE_HEADER)); -} - - -/******************************************************************************* - * - * FUNCTION: CgWriteNode - * - * PARAMETERS: Op - Parse node to write. - * - * RETURN: None. - * - * DESCRIPTION: Write the AML that corresponds to a parse node. - * - ******************************************************************************/ - -static void -CgWriteNode ( - ACPI_PARSE_OBJECT *Op) -{ - ASL_RESOURCE_NODE *Rnode; - - - /* Always check for DEFAULT_ARG and other "Noop" nodes */ - /* TBD: this may not be the best place for this check */ - - if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) || - (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) || - (Op->Asl.ParseOpcode == PARSEOP_INCLUDE) || - (Op->Asl.ParseOpcode == PARSEOP_INCLUDE_END)) - { - return; - } - - Op->Asl.FinalAmlLength = 0; - - switch (Op->Asl.AmlOpcode) - { - case AML_RAW_DATA_BYTE: - case AML_RAW_DATA_WORD: - case AML_RAW_DATA_DWORD: - case AML_RAW_DATA_QWORD: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength); - return; - - - case AML_RAW_DATA_BUFFER: - - CgLocalWriteAmlData (Op, Op->Asl.Value.Buffer, Op->Asl.AmlLength); - return; - - - case AML_RAW_DATA_CHAIN: - - Rnode = ACPI_CAST_PTR (ASL_RESOURCE_NODE, Op->Asl.Value.Buffer); - while (Rnode) - { - CgLocalWriteAmlData (Op, Rnode->Buffer, Rnode->BufferLength); - Rnode = Rnode->Next; - } - return; - - default: - /* Internal data opcodes must all appear above */ - break; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFAULT_ARG: - - break; - - case PARSEOP_DEFINITIONBLOCK: - - CgWriteTableHeader (Op); - break; - - case PARSEOP_NAMESEG: - case PARSEOP_NAMESTRING: - case PARSEOP_METHODCALL: - - CgLocalWriteAmlData (Op, Op->Asl.Value.String, Op->Asl.AmlLength); - break; - - default: - - CgWriteAmlOpcode (Op); - break; - } -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompile.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompile.c deleted file mode 100644 index d6cb8adc73..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompile.c +++ /dev/null @@ -1,937 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslcompile - top level compile module - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 -#include -#include "aslcompiler.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslcompile") - -/* Local prototypes */ - -static void -CmFlushSourceCode ( - void); - -static ACPI_STATUS -FlCheckForAscii ( - ASL_FILE_INFO *FileInfo); - -void -FlConsumeAnsiComment ( - ASL_FILE_INFO *FileInfo, - ASL_FILE_STATUS *Status); - -void -FlConsumeNewComment ( - ASL_FILE_INFO *FileInfo, - ASL_FILE_STATUS *Status); - - -/******************************************************************************* - * - * FUNCTION: AslCompilerSignon - * - * PARAMETERS: FileId - ID of the output file - * - * RETURN: None - * - * DESCRIPTION: Display compiler signon - * - ******************************************************************************/ - -void -AslCompilerSignon ( - UINT32 FileId) -{ - char *Prefix = ""; - - - /* Set line prefix depending on the destination file type */ - - switch (FileId) - { - case ASL_FILE_ASM_SOURCE_OUTPUT: - case ASL_FILE_ASM_INCLUDE_OUTPUT: - - Prefix = "; "; - break; - - case ASL_FILE_HEX_OUTPUT: - - if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM) - { - Prefix = "; "; - } - else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || - (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n"); - Prefix = " * "; - } - break; - - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - - Prefix = " * "; - break; - - default: - /* No other output types supported */ - break; - } - - /* - * Compiler signon with copyright - */ - FlPrintFile (FileId, - "%s\n%s%s\n%s", - Prefix, - Prefix, IntelAcpiCA, - Prefix); - - /* Running compiler or disassembler? */ - - if (Gbl_DisasmFlag) - { - FlPrintFile (FileId, - "%s", DisassemblerId); - } - else - { - FlPrintFile (FileId, - "%s", CompilerId); - } - - /* Version, build date, copyright, compliance */ - - FlPrintFile (FileId, - " version %X [%s]\n%s%s\n%s%s\n%s\n", - (UINT32) ACPI_CA_VERSION, __DATE__, - Prefix, CompilerCopyright, - Prefix, CompilerCompliance, - Prefix); -} - - -/******************************************************************************* - * - * FUNCTION: AslCompilerFileHeader - * - * PARAMETERS: FileId - ID of the output file - * - * RETURN: None - * - * DESCRIPTION: Header used at the beginning of output files - * - ******************************************************************************/ - -void -AslCompilerFileHeader ( - UINT32 FileId) -{ - struct tm *NewTime; - time_t Aclock; - char *Prefix = ""; - - - /* Set line prefix depending on the destination file type */ - - switch (FileId) - { - case ASL_FILE_ASM_SOURCE_OUTPUT: - case ASL_FILE_ASM_INCLUDE_OUTPUT: - - Prefix = "; "; - break; - - case ASL_FILE_HEX_OUTPUT: - - if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM) - { - Prefix = "; "; - } - else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || - (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) - { - Prefix = " * "; - } - break; - - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - - Prefix = " * "; - break; - - default: - /* No other output types supported */ - break; - } - - /* Compilation header with timestamp */ - - (void) time (&Aclock); - NewTime = localtime (&Aclock); - - FlPrintFile (FileId, - "%sCompilation of \"%s\" - %s%s\n", - Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime), - Prefix); - - switch (FileId) - { - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - FlPrintFile (FileId, " */\n"); - break; - - default: - /* Nothing to do for other output types */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: CmFlushSourceCode - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Read in any remaining source code after the parse tree - * has been constructed. - * - ******************************************************************************/ - -static void -CmFlushSourceCode ( - void) -{ - char Buffer; - - - while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR) - { - InsertLineBuffer ((int) Buffer); - } - - ResetCurrentLineBuffer (); -} - - -/******************************************************************************* - * - * FUNCTION: FlConsume* - * - * PARAMETERS: FileInfo - Points to an open input file - * - * RETURN: Number of lines consumed - * - * DESCRIPTION: Step over both types of comment during check for ascii chars - * - ******************************************************************************/ - -void -FlConsumeAnsiComment ( - ASL_FILE_INFO *FileInfo, - ASL_FILE_STATUS *Status) -{ - UINT8 Byte; - BOOLEAN ClosingComment = FALSE; - - - while (fread (&Byte, 1, 1, FileInfo->Handle)) - { - /* Scan until comment close is found */ - - if (ClosingComment) - { - if (Byte == '/') - { - return; - } - - if (Byte != '*') - { - /* Reset */ - - ClosingComment = FALSE; - } - } - else if (Byte == '*') - { - ClosingComment = TRUE; - } - - /* Maintain line count */ - - if (Byte == 0x0A) - { - Status->Line++; - } - - Status->Offset++; - } -} - - -void -FlConsumeNewComment ( - ASL_FILE_INFO *FileInfo, - ASL_FILE_STATUS *Status) -{ - UINT8 Byte; - - - while (fread (&Byte, 1, 1, FileInfo->Handle)) - { - Status->Offset++; - - /* Comment ends at newline */ - - if (Byte == 0x0A) - { - Status->Line++; - return; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: FlCheckForAscii - * - * PARAMETERS: FileInfo - Points to an open input file - * - * RETURN: Status - * - * DESCRIPTION: Verify that the input file is entirely ASCII. Ignores characters - * within comments. Note: does not handle nested comments and does - * not handle comment delimiters within string literals. However, - * on the rare chance this happens and an invalid character is - * missed, the parser will catch the error by failing in some - * spectactular manner. - * - ******************************************************************************/ - -static ACPI_STATUS -FlCheckForAscii ( - ASL_FILE_INFO *FileInfo) -{ - UINT8 Byte; - ACPI_SIZE BadBytes = 0; - BOOLEAN OpeningComment = FALSE; - ASL_FILE_STATUS Status; - - - Status.Line = 1; - Status.Offset = 0; - - /* Read the entire file */ - - while (fread (&Byte, 1, 1, FileInfo->Handle)) - { - /* Ignore comment fields (allow non-ascii within) */ - - if (OpeningComment) - { - /* Check for second comment open delimiter */ - - if (Byte == '*') - { - FlConsumeAnsiComment (FileInfo, &Status); - } - - if (Byte == '/') - { - FlConsumeNewComment (FileInfo, &Status); - } - - /* Reset */ - - OpeningComment = FALSE; - } - else if (Byte == '/') - { - OpeningComment = TRUE; - } - - /* Check for an ASCII character */ - - if (!ACPI_IS_ASCII (Byte)) - { - if (BadBytes < 10) - { - AcpiOsPrintf ( - "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n", - Byte, Status.Line, Status.Offset); - } - - BadBytes++; - } - - /* Update line counter */ - - else if (Byte == 0x0A) - { - Status.Line++; - } - - Status.Offset++; - } - - /* Seek back to the beginning of the source file */ - - fseek (FileInfo->Handle, 0, SEEK_SET); - - /* Were there any non-ASCII characters in the file? */ - - if (BadBytes) - { - AcpiOsPrintf ( - "%u non-ASCII characters found in input source text, could be a binary file\n", - BadBytes); - AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename); - return (AE_BAD_CHARACTER); - } - - /* File is OK */ - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: CmDoCompile - * - * PARAMETERS: None - * - * RETURN: Status (0 = OK) - * - * DESCRIPTION: This procedure performs the entire compile - * - ******************************************************************************/ - -int -CmDoCompile ( - void) -{ - ACPI_STATUS Status; - UINT8 FullCompile; - UINT8 Event; - - - FullCompile = UtBeginEvent ("*** Total Compile time ***"); - Event = UtBeginEvent ("Open input and output files"); - - /* Open the required input and output files */ - - Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return -1; - } - - /* Check for 100% ASCII source file (comments are ignored) */ - - Status = FlCheckForAscii (&Gbl_Files[ASL_FILE_INPUT]); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return -1; - } - - Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return -1; - } - UtEndEvent (Event); - - /* Build the parse tree */ - - Event = UtBeginEvent ("Parse source code and build parse tree"); - AslCompilerparse(); - UtEndEvent (Event); - - /* Flush out any remaining source after parse tree is complete */ - - Event = UtBeginEvent ("Flush source input"); - CmFlushSourceCode (); - - /* Did the parse tree get successfully constructed? */ - - if (!RootNode) - { - CmCleanupAndExit (); - return -1; - } - - /* Optional parse tree dump, compiler debug output only */ - - LsDumpParseTree (); - - OpcGetIntegerWidth (RootNode); - UtEndEvent (Event); - - /* Pre-process parse tree for any operator transforms */ - - Event = UtBeginEvent ("Parse tree transforms"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - TrAmlTransformWalk, NULL, NULL); - UtEndEvent (Event); - - /* Generate AML opcodes corresponding to the parse tokens */ - - Event = UtBeginEvent ("Generate AML opcodes"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, - OpcAmlOpcodeWalk, NULL); - UtEndEvent (Event); - - /* - * Now that the input is parsed, we can open the AML output file. - * Note: by default, the name of this file comes from the table descriptor - * within the input file. - */ - Event = UtBeginEvent ("Open AML output file"); - Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return -1; - } - UtEndEvent (Event); - - /* Interpret and generate all compile-time constants */ - - Event = UtBeginEvent ("Constant folding via AML interpreter"); - DbgPrint (ASL_DEBUG_OUTPUT, - "\nInterpreting compile-time constant expressions\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - OpcAmlConstantWalk, NULL, NULL); - UtEndEvent (Event); - - /* Update AML opcodes if necessary, after constant folding */ - - Event = UtBeginEvent ("Updating AML opcodes after constant folding"); - DbgPrint (ASL_DEBUG_OUTPUT, - "\nUpdating AML opcodes after constant folding\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, - NULL, OpcAmlOpcodeUpdateWalk, NULL); - UtEndEvent (Event); - - /* Calculate all AML package lengths */ - - Event = UtBeginEvent ("Generate AML package lengths"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, - LnPackageLengthWalk, NULL); - UtEndEvent (Event); - - if (Gbl_ParseOnlyFlag) - { - AePrintErrorLog (ASL_FILE_STDOUT); - UtDisplaySummary (ASL_FILE_STDOUT); - if (Gbl_DebugFlag) - { - /* Print error summary to the debug file */ - - AePrintErrorLog (ASL_FILE_STDERR); - UtDisplaySummary (ASL_FILE_STDERR); - } - return 0; - } - - /* - * Create an internal namespace and use it as a symbol table - */ - - /* Namespace loading */ - - Event = UtBeginEvent ("Create ACPI Namespace"); - Status = LdLoadNamespace (RootNode); - UtEndEvent (Event); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - /* Namespace cross-reference */ - - AslGbl_NamespaceEvent = UtBeginEvent ("Cross reference parse tree and Namespace"); - Status = LkCrossReferenceNamespace (); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - /* Namespace - Check for non-referenced objects */ - - LkFindUnreferencedObjects (); - UtEndEvent (AslGbl_NamespaceEvent); - - /* - * Semantic analysis. This can happen only after the - * namespace has been loaded and cross-referenced. - * - * part one - check control methods - */ - Event = UtBeginEvent ("Analyze control method return types"); - AnalysisWalkInfo.MethodStack = NULL; - - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, - AnMethodAnalysisWalkBegin, - AnMethodAnalysisWalkEnd, &AnalysisWalkInfo); - UtEndEvent (Event); - - /* Semantic error checking part two - typing of method returns */ - - Event = UtBeginEvent ("Determine object types returned by methods"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, - AnMethodTypingWalkBegin, - AnMethodTypingWalkEnd, NULL); - UtEndEvent (Event); - - /* Semantic error checking part three - operand type checking */ - - Event = UtBeginEvent ("Analyze AML operand types"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, - AnOperandTypecheckWalkBegin, - AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); - UtEndEvent (Event); - - /* Semantic error checking part four - other miscellaneous checks */ - - Event = UtBeginEvent ("Miscellaneous analysis"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, - AnOtherSemanticAnalysisWalkBegin, - AnOtherSemanticAnalysisWalkEnd, &AnalysisWalkInfo); - UtEndEvent (Event); - - /* Calculate all AML package lengths */ - - Event = UtBeginEvent ("Finish AML package length generation"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, - LnInitLengthsWalk, NULL); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, - LnPackageLengthWalk, NULL); - UtEndEvent (Event); - - /* Code generation - emit the AML */ - - Event = UtBeginEvent ("Generate AML code and write output files"); - CgGenerateAmlOutput (); - UtEndEvent (Event); - - Event = UtBeginEvent ("Write optional output files"); - CmDoOutputFiles (); - UtEndEvent (Event); - - UtEndEvent (FullCompile); - CmCleanupAndExit (); - return 0; -} - - -/******************************************************************************* - * - * FUNCTION: CmDoOutputFiles - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create all "listing" type files - * - ******************************************************************************/ - -void -CmDoOutputFiles ( - void) -{ - - /* Create listings and hex files */ - - LsDoListings (); - LsDoHexOutput (); - - /* Dump the namespace to the .nsp file if requested */ - - (void) LsDisplayNamespace (); -} - - -/******************************************************************************* - * - * FUNCTION: CmDumpEvent - * - * PARAMETERS: Event - A compiler event struct - * - * RETURN: None. - * - * DESCRIPTION: Dump a compiler event struct - * - ******************************************************************************/ - -static void -CmDumpEvent ( - ASL_EVENT_INFO *Event) -{ - UINT32 Delta; - UINT32 USec; - UINT32 MSec; - - if (!Event->Valid) - { - return; - } - - /* Delta will be in 100-nanosecond units */ - - Delta = (UINT32) (Event->EndTime - Event->StartTime); - - USec = Delta / 10; - MSec = Delta / 10000; - - /* Round milliseconds up */ - - if ((USec - (MSec * 1000)) >= 500) - { - MSec++; - } - - DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", - USec, MSec, Event->EventName); -} - - -/******************************************************************************* - * - * FUNCTION: CmCleanupAndExit - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Close all open files and exit the compiler - * - ******************************************************************************/ - -void -CmCleanupAndExit ( - void) -{ - UINT32 i; - - - AePrintErrorLog (ASL_FILE_STDOUT); - if (Gbl_DebugFlag) - { - /* Print error summary to the debug file */ - - AePrintErrorLog (ASL_FILE_STDERR); - } - - DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); - for (i = 0; i < AslGbl_NextEvent; i++) - { - CmDumpEvent (&AslGbl_Events[i]); - } - - if (Gbl_CompileTimesFlag) - { - printf ("\nElapsed time for major events\n\n"); - for (i = 0; i < AslGbl_NextEvent; i++) - { - CmDumpEvent (&AslGbl_Events[i]); - } - - printf ("\nMiscellaneous compile statistics\n\n"); - printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); - printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); - printf ("%11u : %s\n", TotalNamedObjects, "Named objects"); - printf ("%11u : %s\n", TotalMethods, "Control methods"); - printf ("%11u : %s\n", TotalAllocations, "Memory Allocations"); - printf ("%11u : %s\n", TotalAllocated, "Total allocated memory"); - printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded"); - printf ("\n"); - } - - if (Gbl_NsLookupCount) - { - DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n"); - DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Total Namespace searches", - Gbl_NsLookupCount); - DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d usec\n", "Time per search", - ((UINT32) (AslGbl_Events[AslGbl_NamespaceEvent].EndTime - - AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / - 10) / Gbl_NsLookupCount); - } - - - if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) - { - printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT); - } - - UtDisplaySummary (ASL_FILE_STDOUT); - - /* Close all open files */ - - for (i = 2; i < ASL_MAX_FILE_TYPE; i++) - { - FlCloseFile (i); - } - - /* Delete AML file if there are errors */ - - if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors)) - { - remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename); - } - - /* - * Delete intermediate ("combined") source file (if -ls flag not set) - * - * TBD: SourceOutput should be .TMP, then rename if we want to keep it? - */ - if (!Gbl_SourceOutputFlag) - { - if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)) - { - printf ("Could not remove SRC file, %s\n", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - } -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.h b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.h deleted file mode 100644 index 804713b00d..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.h +++ /dev/null @@ -1,1007 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslcompiler.h - common include file for iASL - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#ifndef __ASLCOMPILER_H -#define __ASLCOMPILER_H - - -/* Microsoft-specific */ - -#if (defined WIN32 || defined WIN64) - -/* warn : used #pragma pack */ -#pragma warning(disable:4103) - -/* warn : named type definition in parentheses */ -#pragma warning(disable:4115) -#endif - -#include -#include -#include -#include -#include -#include - - -#include "acpi.h" -#include "accommon.h" -#include "amlresrc.h" -#include "acdebug.h" - -/* Compiler headers */ - -#include "asldefine.h" -#include "asltypes.h" -#include "aslglobal.h" - - -/******************************************************************************* - * - * Compiler prototypes - * - ******************************************************************************/ - -/* - * parser - generated from flex/bison, lex/yacc, etc. - */ -int -AslCompilerparse( - void); - -ACPI_PARSE_OBJECT * -AslDoError ( - void); - -int -AslCompilerlex( - void); - -void -ResetCurrentLineBuffer ( - void); - -void -InsertLineBuffer ( - int SourceChar); - -int -AslPopInputFileStack ( - void); - -void -AslPushInputFileStack ( - FILE *InputFile, - char *Filename); - -/* - * aslstartup - called from main - */ -ACPI_STATUS -AslDoOnePathname ( - char *Pathname); - -ACPI_STATUS -AslDoOneFile ( - char *Filename); - -/* - * aslcompile - compile mainline - */ -void -AslCompilerSignon ( - UINT32 FileId); - -void -AslCompilerFileHeader ( - UINT32 FileId); - -int -CmDoCompile ( - void); - -void -CmDoOutputFiles ( - void); - -void -CmCleanupAndExit ( - void); - - -/* - * aslanalyze - semantic analysis - */ -ACPI_STATUS -AnOtherSemanticAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnOtherSemanticAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnOperandTypecheckWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnOperandTypecheckWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodTypingWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodTypingWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/* - * aslerror - error handling/reporting - */ -void -AslError ( - UINT8 Level, - UINT8 MessageId, - ACPI_PARSE_OBJECT *Op, - char *ExtraMessage); - -void -AslCoreSubsystemError ( - ACPI_PARSE_OBJECT *Op, - ACPI_STATUS Status, - char *ExtraMessage, - BOOLEAN Abort); - -int -AslCompilererror( - char *s); - -void -AslCommonError ( - UINT8 Level, - UINT8 MessageId, - UINT32 CurrentLineNumber, - UINT32 LogicalLineNumber, - UINT32 LogicalByteOffset, - UINT32 Column, - char *Filename, - char *ExtraMessage); - -void -AePrintException ( - UINT32 FileId, - ASL_ERROR_MSG *Enode, - char *Header); - -void -AePrintErrorLog ( - UINT32 FileId); - -void -AeClearErrorLog ( - void); - -ACPI_PHYSICAL_ADDRESS -AeLocalGetRootPointer ( - void); - - -/* - * asllisting - generate all "listing" type files - */ -void -LsDoListings ( - void); - -void -LsWriteNodeToAsmListing ( - ACPI_PARSE_OBJECT *Op); - -void -LsWriteNode ( - ACPI_PARSE_OBJECT *Op, - UINT32 FileId); - -void -LsDoHexOutput ( - void); - -void -LsDumpParseTree ( - void); - -/* - * aslfold - constant folding - */ -ACPI_STATUS -OpcAmlConstantWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/* - * aslopcodes - generate AML opcodes - */ -ACPI_STATUS -OpcAmlOpcodeWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -OpcAmlOpcodeUpdateWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -void -OpcGenerateAmlOpcode ( - ACPI_PARSE_OBJECT *Op); - -UINT32 -OpcSetOptimalIntegerSize ( - ACPI_PARSE_OBJECT *Op); - -void -OpcGetIntegerWidth ( - ACPI_PARSE_OBJECT *Op); - - -/* - * asloperands - generate AML operands for the AML opcodes - */ -ACPI_PARSE_OBJECT * -UtGetArg ( - ACPI_PARSE_OBJECT *Op, - UINT32 Argn); - -void -OpnGenerateAmlOperands ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoPackage ( - ACPI_PARSE_OBJECT *Op); - - -/* - * aslopt - optmization - */ -void -OptOptimizeNamePath ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags, - ACPI_WALK_STATE *WalkState, - char *AmlNameString, - ACPI_NAMESPACE_NODE *TargetNode); - - -/* - * aslcodegen - code generation - */ -void -CgGenerateAmlOutput ( - void); - - -/* - * asllength - calculate/adjust AML package lengths - */ -ACPI_STATUS -LnPackageLengthWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -LnInitLengthsWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -void -CgGenerateAmlLengths ( - ACPI_PARSE_OBJECT *Op); - - -/* - * aslmap - opcode mappings and reserved method names - */ -ACPI_OBJECT_TYPE -AslMapNamedOpcodeToDataType ( - UINT16 Opcode); - - -/* - * aslpredef - ACPI predefined names support - */ -void -ApCheckForPredefinedMethod ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo); - -void -ApCheckPredefinedReturnValue ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo); - -UINT32 -ApCheckForPredefinedName ( - ACPI_PARSE_OBJECT *Op, - char *Name); - -void -ApCheckForPredefinedObject ( - ACPI_PARSE_OBJECT *Op, - char *Name); - -void -ApDisplayReservedNames ( - void); - - -/* - * asltransform - parse tree transformations - */ -ACPI_STATUS -TrAmlTransformWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/* - * asltree - parse tree support - */ -ACPI_STATUS -TrWalkParseTree ( - ACPI_PARSE_OBJECT *Op, - UINT32 Visitation, - ASL_WALK_CALLBACK DescendingCallback, - ASL_WALK_CALLBACK AscendingCallback, - void *Context); - -/* Values for "Visitation" parameter above */ - -#define ASL_WALK_VISIT_DOWNWARD 0x01 -#define ASL_WALK_VISIT_UPWARD 0x02 -#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD) - - -ACPI_PARSE_OBJECT * -TrAllocateNode ( - UINT32 ParseOpcode); - -void -TrReleaseNode ( - ACPI_PARSE_OBJECT *Op); - -ACPI_PARSE_OBJECT * -TrUpdateNode ( - UINT32 ParseOpcode, - ACPI_PARSE_OBJECT *Op); - -ACPI_PARSE_OBJECT * -TrCreateNode ( - UINT32 ParseOpcode, - UINT32 NumChildren, - ...); - -ACPI_PARSE_OBJECT * -TrCreateLeafNode ( - UINT32 ParseOpcode); - -ACPI_PARSE_OBJECT * -TrCreateValuedLeafNode ( - UINT32 ParseOpcode, - UINT64 Value); - -ACPI_PARSE_OBJECT * -TrLinkChildren ( - ACPI_PARSE_OBJECT *Op, - UINT32 NumChildren, - ...); - -void -TrSetEndLineNumber ( - ACPI_PARSE_OBJECT *Op); - -void -TrWalkTree ( - void); - -ACPI_PARSE_OBJECT * -TrLinkPeerNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2); - -ACPI_PARSE_OBJECT * -TrLinkChildNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2); - -ACPI_PARSE_OBJECT * -TrSetNodeFlags ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags); - -ACPI_PARSE_OBJECT * -TrLinkPeerNodes ( - UINT32 NumPeers, - ...); - - -/* - * aslfiles - File I/O support - */ -void -AslAbort ( - void); - -void -FlAddIncludeDirectory ( - char *Dir); - -void -FlOpenIncludeFile ( - ACPI_PARSE_OBJECT *Op); - -void -FlFileError ( - UINT32 FileId, - UINT8 ErrorId); - -UINT32 -FlGetFileSize ( - UINT32 FileId); - -ACPI_STATUS -FlReadFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length); - -void -FlWriteFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length); - -void -FlSeekFile ( - UINT32 FileId, - long Offset); - -void -FlCloseFile ( - UINT32 FileId); - -void -FlPrintFile ( - UINT32 FileId, - char *Format, - ...); - -void -FlSetLineNumber ( - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -FlOpenInputFile ( - char *InputFilename); - -ACPI_STATUS -FlOpenAmlOutputFile ( - char *InputFilename); - -ACPI_STATUS -FlOpenMiscOutputFiles ( - char *InputFilename); - - -/* - * asload - load namespace in prep for cross reference - */ -ACPI_STATUS -LdLoadNamespace ( - ACPI_PARSE_OBJECT *RootOp); - - -/* - * asllookup - namespace cross reference - */ -ACPI_STATUS -LkCrossReferenceNamespace ( - void); - -void -LkFindUnreferencedObjects ( - void); - -ACPI_STATUS -LsDisplayNamespace ( - void); - - -/* - * aslutils - common compiler utilites - */ -void -DbgPrint ( - UINT32 Type, - char *Format, - ...); - -/* Type values for above */ - -#define ASL_DEBUG_OUTPUT 0 -#define ASL_PARSE_OUTPUT 1 -#define ASL_TREE_OUTPUT 2 - -void -UtDisplayConstantOpcodes ( - void); - -UINT8 -UtBeginEvent ( - char *Name); - -void -UtEndEvent ( - UINT8 Event); - -void * -UtLocalCalloc ( - UINT32 Size); - -void -UtPrintFormattedName ( - UINT16 ParseOpcode, - UINT32 Level); - -void -UtDisplaySummary ( - UINT32 FileId); - -UINT8 -UtHexCharToValue ( - int HexChar); - -void -UtConvertByteToHex ( - UINT8 RawByte, - UINT8 *Buffer); - -void -UtConvertByteToAsmHex ( - UINT8 RawByte, - UINT8 *Buffer); - -char * -UtGetOpName ( - UINT32 ParseOpcode); - -void -UtSetParseOpName ( - ACPI_PARSE_OBJECT *Op); - -char * -UtGetStringBuffer ( - UINT32 Length); - -ACPI_STATUS -UtInternalizeName ( - char *ExternalName, - char **ConvertedName); - -void -UtAttachNamepathToOwner ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NameNode); - -ACPI_PARSE_OBJECT * -UtCheckIntegerRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 LowValue, - UINT32 HighValue); - -UINT64 -UtDoConstant ( - char *String); - - -/* - * aslresource - Resource template generation utilities - */ -void -RsSmallAddressCheck ( - UINT8 Type, - UINT32 Minimum, - UINT32 Maximum, - UINT32 Length, - UINT32 Alignment, - ACPI_PARSE_OBJECT *MinOp, - ACPI_PARSE_OBJECT *MaxOp, - ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *AlignOp); - -void -RsLargeAddressCheck ( - UINT64 Minimum, - UINT64 Maximum, - UINT64 Length, - UINT64 Granularity, - UINT8 Flags, - ACPI_PARSE_OBJECT *MinOp, - ACPI_PARSE_OBJECT *MaxOp, - ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *GranOp); - -UINT16 -RsGetStringDataLength ( - ACPI_PARSE_OBJECT *InitializerOp); - -ASL_RESOURCE_NODE * -RsAllocateResourceNode ( - UINT32 Size); - -void -RsCreateBitField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset, - UINT32 BitOffset); - -void -RsCreateByteField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset); - -void -RsSetFlagBits ( - UINT8 *Flags, - ACPI_PARSE_OBJECT *Op, - UINT8 Position, - UINT8 DefaultBit); - -ACPI_PARSE_OBJECT * -RsCompleteNodeAndGetNext ( - ACPI_PARSE_OBJECT *Op); - -void -RsCheckListForDuplicates ( - ACPI_PARSE_OBJECT *Op); - -ASL_RESOURCE_NODE * -RsDoOneResourceDescriptor ( - ACPI_PARSE_OBJECT *DescriptorTypeOp, - UINT32 CurrentByteOffset, - UINT8 *State); - -/* Values for State above */ - -#define ACPI_RSTATE_NORMAL 0 -#define ACPI_RSTATE_START_DEPENDENT 1 -#define ACPI_RSTATE_DEPENDENT_LIST 2 - -UINT32 -RsLinkDescriptorChain ( - ASL_RESOURCE_NODE **PreviousRnode, - ASL_RESOURCE_NODE *Rnode); - -void -RsDoResourceTemplate ( - ACPI_PARSE_OBJECT *Op); - - -/* - * aslrestype1 - Miscellaneous Small descriptors - */ -ASL_RESOURCE_NODE * -RsDoEndTagDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoEndDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory24Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory32Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory32FixedDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoStartDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoStartDependentNoPriDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoVendorSmallDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype1i - I/O-related Small descriptors - */ -ASL_RESOURCE_NODE * -RsDoDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoFixedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIrqDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIrqNoFlagsDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype2 - Large resource descriptors - */ -ASL_RESOURCE_NODE * -RsDoInterruptDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoVendorLargeDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoGeneralRegisterDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype2d - DWord address descriptors - */ -ASL_RESOURCE_NODE * -RsDoDwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoDwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoDwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype2e - Extended address descriptors - */ -ASL_RESOURCE_NODE * -RsDoExtendedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoExtendedMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoExtendedSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype2q - QWord address descriptors - */ -ASL_RESOURCE_NODE * -RsDoQwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoQwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoQwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype2w - Word address descriptors - */ -ASL_RESOURCE_NODE * -RsDoWordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoWordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoWordBusNumberDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -#endif /* __ASLCOMPILER_H */ - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.l b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.l deleted file mode 100644 index dd0473c757..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.l +++ /dev/null @@ -1,1183 +0,0 @@ - -%{ -/****************************************************************************** - * - * Module Name: aslcompiler.l - Flex input file - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 -#include -#include "aslcompiler.h" -#include "aslcompiler.y.h" -YYSTYPE AslCompilerlval; - -/* - * Generation: Use the following command line: - * - * flex.exe -PAslCompiler -i -o$(InputPath).c $(InputPath) - * - * -i: Scanner must be case-insensitive - */ - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslscan") -char -comment (void); -char -comment2 (void); -void -count (int type); -char -literal (void); -void -copy (void); - -/*! [Begin] no source code translation */ - -%} - - -LeadNameChar [A-Za-z_] -DigitChar [0-9] -HexDigitChar [A-Fa-f0-9] -RootChar [\\] -Nothing [] - -NameChar [A-Za-z_0-9] -NameSeg1 {LeadNameChar}{NameChar} -NameSeg2 {LeadNameChar}{NameChar}{NameChar} -NameSeg3 {LeadNameChar}{NameChar}{NameChar}{NameChar} -NameSeg {LeadNameChar}|{NameSeg1}|{NameSeg2}|{NameSeg3} - -NameString {RootChar}|{RootChar}{NamePath}|[\^]+{NamePath}|{NonEmptyNamePath} -NamePath {NonEmptyNamePath}? -NonEmptyNamePath {NameSeg}{NamePathTail}* -NamePathTail [.]{NameSeg} - -%% - -[ ] { count (0); } -[\n] { count (0); } /* Handle files with both LF and CR/LF */ -[\r] { count (0); } /* termination on both Unix and Windows */ -[ \t] { count (0); } - - -"/*" { if (!comment ()) yyterminate (); } -"//" { if (!comment2 ()) yyterminate (); } - -"\"" { if (literal ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); } - - -0[xX]{HexDigitChar}+ | -{DigitChar}+ { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext); - count (1); return (PARSEOP_INTEGER); } - -"Include" { count (1); return (PARSEOP_INCLUDE); } -"#include" { count (1); return (PARSEOP_INCLUDE_CSTYLE); } -"#line" { count (1); return (PARSEOP_LINE_CSTYLE); } -"External" { count (1); return (PARSEOP_EXTERNAL); } - - -"Ones" { count (1); return (PARSEOP_ONES); } -"One" { count (1); return (PARSEOP_ONE); } -"Zero" { count (1); return (PARSEOP_ZERO); } -"Revision" { count (1); return (PARSEOP_REVISION); } - -"Offset" { count (1); return (PARSEOP_OFFSET); } -"AccessAs" { count (1); return (PARSEOP_ACCESSAS); } -"BankField" { count (2); return (PARSEOP_BANKFIELD); } -"CreateBitField" { count (2); return (PARSEOP_CREATEBITFIELD); } -"CreateByteField" { count (2); return (PARSEOP_CREATEBYTEFIELD); } -"CreateDWordField" { count (2); return (PARSEOP_CREATEDWORDFIELD); } -"CreateField" { count (2); return (PARSEOP_CREATEFIELD); } -"CreateQWordField" { count (2); return (PARSEOP_CREATEQWORDFIELD); } -"CreateWordField" { count (2); return (PARSEOP_CREATEWORDFIELD); } -"DataTableRegion" { count (2); return (PARSEOP_DATATABLEREGION); } -"Device" { count (2); return (PARSEOP_DEVICE); } -"Event" { count (2); return (PARSEOP_EVENT); } -"Field" { count (2); return (PARSEOP_FIELD); } -"Function" { count (2); return (PARSEOP_FUNCTION); } -"IndexField" { count (2); return (PARSEOP_INDEXFIELD); } -"Method" { count (2); return (PARSEOP_METHOD); } -"Mutex" { count (2); return (PARSEOP_MUTEX); } -"OperationRegion" { count (2); return (PARSEOP_OPERATIONREGION); } -"PowerResource" { count (2); return (PARSEOP_POWERRESOURCE); } -"Processor" { count (2); return (PARSEOP_PROCESSOR); } -"ThermalZone" { count (2); return (PARSEOP_THERMALZONE); } -"Alias" { count (2); return (PARSEOP_ALIAS); } -"Name" { count (2); return (PARSEOP_NAME); } -"Scope" { count (2); return (PARSEOP_SCOPE); } -"Break" { count (3); return (PARSEOP_BREAK); } -"BreakPoint" { count (3); return (PARSEOP_BREAKPOINT); } -"Continue" { count (3); return (PARSEOP_CONTINUE); } -"Fatal" { count (3); return (PARSEOP_FATAL); } -"If" { count (3); return (PARSEOP_IF); } -"Else" { count (3); return (PARSEOP_ELSE); } -"ElseIf" { count (3); return (PARSEOP_ELSEIF); } -"Load" { count (3); return (PARSEOP_LOAD); } -"Noop" { count (3); return (PARSEOP_NOOP); } -"Notify" { count (3); return (PARSEOP_NOTIFY); } -"Release" { count (3); return (PARSEOP_RELEASE); } -"Reset" { count (3); return (PARSEOP_RESET); } -"Return" { count (3); return (PARSEOP_RETURN); } -"Signal" { count (3); return (PARSEOP_SIGNAL); } -"Sleep" { count (3); return (PARSEOP_SLEEP); } -"Stall" { count (3); return (PARSEOP_STALL); } -"Switch" { count (3); return (PARSEOP_SWITCH); } -"Case" { count (3); return (PARSEOP_CASE); } -"Default" { count (3); return (PARSEOP_DEFAULT); } -"Unload" { count (3); return (PARSEOP_UNLOAD); } -"While" { count (3); return (PARSEOP_WHILE); } - -"Acquire" { count (3); return (PARSEOP_ACQUIRE); } -"Add" { count (3); return (PARSEOP_ADD); } -"And" { count (3); return (PARSEOP_AND); } -"Concatenate" { count (3); return (PARSEOP_CONCATENATE); } -"ConcatenateResTemplate" { count (3); return (PARSEOP_CONCATENATERESTEMPLATE); } -"CondRefOf" { count (3); return (PARSEOP_CONDREFOF); } -"CopyObject" { count (3); return (PARSEOP_COPYOBJECT); } -"Decrement" { count (3); return (PARSEOP_DECREMENT); } -"DeRefOf" { count (3); return (PARSEOP_DEREFOF); } -"Divide" { count (3); return (PARSEOP_DIVIDE); } -"FindSetLeftBit" { count (3); return (PARSEOP_FINDSETLEFTBIT); } -"FindSetRightBit" { count (3); return (PARSEOP_FINDSETRIGHTBIT); } -"FromBCD" { count (3); return (PARSEOP_FROMBCD); } -"Increment" { count (3); return (PARSEOP_INCREMENT); } -"Index" { count (3); return (PARSEOP_INDEX); } -"LAnd" { count (3); return (PARSEOP_LAND); } -"LEqual" { count (3); return (PARSEOP_LEQUAL); } -"LGreater" { count (3); return (PARSEOP_LGREATER); } -"LGreaterEqual" { count (3); return (PARSEOP_LGREATEREQUAL); } -"LLess" { count (3); return (PARSEOP_LLESS); } -"LLessEqual" { count (3); return (PARSEOP_LLESSEQUAL); } -"LNot" { count (3); return (PARSEOP_LNOT); } -"LNotEqual" { count (3); return (PARSEOP_LNOTEQUAL); } -"LoadTable" { count (3); return (PARSEOP_LOADTABLE); } -"LOr" { count (3); return (PARSEOP_LOR); } -"Match" { count (3); return (PARSEOP_MATCH); } -"Mid" { count (3); return (PARSEOP_MID); } -"Mod" { count (3); return (PARSEOP_MOD); } -"Multiply" { count (3); return (PARSEOP_MULTIPLY); } -"NAnd" { count (3); return (PARSEOP_NAND); } -"NOr" { count (3); return (PARSEOP_NOR); } -"Not" { count (3); return (PARSEOP_NOT); } -"ObjectType" { count (3); return (PARSEOP_OBJECTTYPE); } -"Or" { count (3); return (PARSEOP_OR); } -"RefOf" { count (3); return (PARSEOP_REFOF); } -"ShiftLeft" { count (3); return (PARSEOP_SHIFTLEFT); } -"ShiftRight" { count (3); return (PARSEOP_SHIFTRIGHT); } -"SizeOf" { count (3); return (PARSEOP_SIZEOF); } -"Store" { count (3); return (PARSEOP_STORE); } -"Subtract" { count (3); return (PARSEOP_SUBTRACT); } -"Timer" { count (3); return (PARSEOP_TIMER); } -"ToBCD" { count (3); return (PARSEOP_TOBCD); } -"ToBuffer" { count (3); return (PARSEOP_TOBUFFER); } -"ToDecimalString" { count (3); return (PARSEOP_TODECIMALSTRING); } -"ToHexString" { count (3); return (PARSEOP_TOHEXSTRING); } -"ToInteger" { count (3); return (PARSEOP_TOINTEGER); } -"ToString" { count (3); return (PARSEOP_TOSTRING); } -"Wait" { count (3); return (PARSEOP_WAIT); } -"XOr" { count (3); return (PARSEOP_XOR); } - -"Arg0" { count (1); return (PARSEOP_ARG0); } -"Arg1" { count (1); return (PARSEOP_ARG1); } -"Arg2" { count (1); return (PARSEOP_ARG2); } -"Arg3" { count (1); return (PARSEOP_ARG3); } -"Arg4" { count (1); return (PARSEOP_ARG4); } -"Arg5" { count (1); return (PARSEOP_ARG5); } -"Arg6" { count (1); return (PARSEOP_ARG6); } - -"Local0" { count (1); return (PARSEOP_LOCAL0); } -"Local1" { count (1); return (PARSEOP_LOCAL1); } -"Local2" { count (1); return (PARSEOP_LOCAL2); } -"Local3" { count (1); return (PARSEOP_LOCAL3); } -"Local4" { count (1); return (PARSEOP_LOCAL4); } -"Local5" { count (1); return (PARSEOP_LOCAL5); } -"Local6" { count (1); return (PARSEOP_LOCAL6); } -"Local7" { count (1); return (PARSEOP_LOCAL7); } - -"Debug" { count (1); return (PARSEOP_DEBUG); } - -"DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); } -"Buffer" { count (1); return (PARSEOP_BUFFER); } -"Package" { count (1); return (PARSEOP_PACKAGE); } - -"EISAID" { count (1); return (PARSEOP_EISAID); } -"ResourceTemplate" { count (1); return (PARSEOP_RESOURCETEMPLATE); } -"ToUUID" { count (1); return (PARSEOP_TOUUID); } -"Unicode" { count (1); return (PARSEOP_UNICODE); } -"DMA" { count (1); return (PARSEOP_DMA); } -"DWordIO" { count (1); return (PARSEOP_DWORDIO); } -"DWordMemory" { count (1); return (PARSEOP_DWORDMEMORY); } -"DWordSpace" { count (1); return (PARSEOP_DWORDSPACE); } -"EndDependentFn" { count (1); return (PARSEOP_ENDDEPENDENTFN); } -"ExtendedIO" { count (1); return (PARSEOP_EXTENDEDIO); } -"ExtendedMemory" { count (1); return (PARSEOP_EXTENDEDMEMORY); } -"ExtendedSpace" { count (1); return (PARSEOP_EXTENDEDSPACE); } -"FixedIO" { count (1); return (PARSEOP_FIXEDIO); } -"Interrupt" { count (1); return (PARSEOP_INTERRUPT); } -"IO" { count (1); return (PARSEOP_IO); } -"IRQNoFlags" { count (1); return (PARSEOP_IRQNOFLAGS); } -"IRQ" { count (1); return (PARSEOP_IRQ); } -"Memory24" { count (1); return (PARSEOP_MEMORY24); } -"Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); } -"Memory32" { count (1); return (PARSEOP_MEMORY32); } -"QWordIO" { count (1); return (PARSEOP_QWORDIO); } -"QWordMemory" { count (1); return (PARSEOP_QWORDMEMORY); } -"QWordSpace" { count (1); return (PARSEOP_QWORDSPACE); } -"Register" { count (1); return (PARSEOP_REGISTER); } -"StartDependentFn" { count (1); return (PARSEOP_STARTDEPENDENTFN); } -"StartDependentFnNoPri" { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); } -"VendorLong" { count (1); return (PARSEOP_VENDORLONG); } -"VendorShort" { count (1); return (PARSEOP_VENDORSHORT); } -"WordBusNumber" { count (1); return (PARSEOP_WORDBUSNUMBER); } -"WordIO" { count (1); return (PARSEOP_WORDIO); } -"WordSpace" { count (1); return (PARSEOP_WORDSPACE); } - -"UnknownObj" { count (0); return (PARSEOP_OBJECTTYPE_UNK); } -"IntObj" { count (0); return (PARSEOP_OBJECTTYPE_INT); } -"StrObj" { count (0); return (PARSEOP_OBJECTTYPE_STR); } -"BuffObj" { count (0); return (PARSEOP_OBJECTTYPE_BUF); } -"PkgObj" { count (0); return (PARSEOP_OBJECTTYPE_PKG); } -"FieldUnitObj" { count (0); return (PARSEOP_OBJECTTYPE_FLD); } -"DeviceObj" { count (0); return (PARSEOP_OBJECTTYPE_DEV); } -"EventObj" { count (0); return (PARSEOP_OBJECTTYPE_EVT); } -"MethodObj" { count (0); return (PARSEOP_OBJECTTYPE_MTH); } -"MutexObj" { count (0); return (PARSEOP_OBJECTTYPE_MTX); } -"OpRegionObj" { count (0); return (PARSEOP_OBJECTTYPE_OPR); } -"PowerResObj" { count (0); return (PARSEOP_OBJECTTYPE_POW); } -"ProcessorObj" { count (0); return (PARSEOP_OBJECTTYPE_PRO); } -"ThermalZoneObj" { count (0); return (PARSEOP_OBJECTTYPE_THZ); } -"BuffFieldObj" { count (0); return (PARSEOP_OBJECTTYPE_BFF); } -"DDBHandleObj" { count (0); return (PARSEOP_OBJECTTYPE_DDB); } - -"AnyAcc" { count (0); return (PARSEOP_ACCESSTYPE_ANY); } -"ByteAcc" { count (0); return (PARSEOP_ACCESSTYPE_BYTE); } -"WordAcc" { count (0); return (PARSEOP_ACCESSTYPE_WORD); } -"DWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_DWORD); } -"QWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_QWORD); } -"BufferAcc" { count (0); return (PARSEOP_ACCESSTYPE_BUF); } - -"Lock" { count (0); return (PARSEOP_LOCKRULE_LOCK); } -"NoLock" { count (0); return (PARSEOP_LOCKRULE_NOLOCK); } - -"Preserve" { count (0); return (PARSEOP_UPDATERULE_PRESERVE); } -"WriteAsOnes" { count (0); return (PARSEOP_UPDATERULE_ONES); } -"WriteAsZeros" { count (0); return (PARSEOP_UPDATERULE_ZEROS); } - -"Serialized" { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); } -"NotSerialized" { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); } - -"SystemIO" { count (0); return (PARSEOP_REGIONSPACE_IO); } -"SystemMemory" { count (0); return (PARSEOP_REGIONSPACE_MEM); } -"PCI_Config" { count (0); return (PARSEOP_REGIONSPACE_PCI); } -"EmbeddedControl" { count (0); return (PARSEOP_REGIONSPACE_EC); } -"SMBus" { count (0); return (PARSEOP_REGIONSPACE_SMBUS); } -"SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); } -"PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); } -"IPMI" { count (0); return (PARSEOP_REGIONSPACE_IPMI); } - -"FFixedHW" { count (0); return (PARSEOP_ADDRESSSPACE_FFIXEDHW); } - -"SMBQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); } -"SMBSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); } -"SMBByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); } -"SMBWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); } -"SMBBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); } -"SMBProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); } -"SMBBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); } - -"MTR" { count (0); return (PARSEOP_MATCHTYPE_MTR); } -"MEQ" { count (0); return (PARSEOP_MATCHTYPE_MEQ); } -"MLE" { count (0); return (PARSEOP_MATCHTYPE_MLE); } -"MLT" { count (0); return (PARSEOP_MATCHTYPE_MLT); } -"MGE" { count (0); return (PARSEOP_MATCHTYPE_MGE); } -"MGT" { count (0); return (PARSEOP_MATCHTYPE_MGT); } - -"Compatibility" { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); } -"TypeA" { count (0); return (PARSEOP_DMATYPE_A); } -"TypeB" { count (0); return (PARSEOP_DMATYPE_B); } -"TypeF" { count (0); return (PARSEOP_DMATYPE_F); } - -"BusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); } -"NotBusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); } - -"Transfer8" { count (0); return (PARSEOP_XFERTYPE_8); } -"Transfer8_16" { count (0); return (PARSEOP_XFERTYPE_8_16); } -"Transfer16" { count (0); return (PARSEOP_XFERTYPE_16); } - -"ResourceConsumer" { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); } -"ResourceProducer" { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); } - -"MinFixed" { count (0); return (PARSEOP_MINTYPE_FIXED); } -"MinNotFixed" { count (0); return (PARSEOP_MINTYPE_NOTFIXED); } - -"MaxFixed" { count (0); return (PARSEOP_MAXTYPE_FIXED); } -"MaxNotFixed" { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); } - -"PosDecode" { count (0); return (PARSEOP_DECODETYPE_POS); } -"SubDecode" { count (0); return (PARSEOP_DECODETYPE_SUB); } - -"ISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_ISAONLY); } -"NonISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); } -"EntireRange" { count (0); return (PARSEOP_RANGETYPE_ENTIRE); } - -"Cacheable" { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); } -"WriteCombining" { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); } -"Prefetchable" { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); } -"NonCacheable" { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); } - -"ReadWrite" { count (0); return (PARSEOP_READWRITETYPE_BOTH); } -"ReadOnly" { count (0); return (PARSEOP_READWRITETYPE_READONLY); } - -"Edge" { count (0); return (PARSEOP_INTTYPE_EDGE); } -"Level" { count (0); return (PARSEOP_INTTYPE_LEVEL); } - -"ActiveHigh" { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); } -"ActiveLow" { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); } - -"Shared" { count (0); return (PARSEOP_SHARETYPE_SHARED); } -"Exclusive" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); } - -"Decode10" { count (0); return (PARSEOP_IODECODETYPE_10); } -"Decode16" { count (0); return (PARSEOP_IODECODETYPE_16); } - -"TypeTranslation" { count (0); return (PARSEOP_TYPE_TRANSLATION); } -"TypeStatic" { count (0); return (PARSEOP_TYPE_STATIC); } - -"SparseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); } -"DenseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); } - -"AddressRangeMemory" { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); } -"AddressRangeReserved" { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); } -"AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); } -"AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); } - - -"{" { count (0); return('{'); } -"}" { count (0); return('}'); } -"," { count (0); return(','); } -"(" { count (0); return('('); } -")" { count (0); return(')'); } - - -{NameSeg} { char *s; - count (0); - s=malloc (ACPI_NAME_SIZE + 1); - if (strcmp (AslCompilertext, "\\")) - { - strcpy (s, "____"); - AcpiUtStrupr (AslCompilertext); - } - memcpy (s, AslCompilertext, strlen (AslCompilertext)); - AslCompilerlval.s = s; - DbgPrint (ASL_PARSE_OUTPUT, "NameSeg: %s\n", s); - return (PARSEOP_NAMESEG); } - -{NameString} { char *s; - count (0); - s=malloc (strlen (AslCompilertext)+1); - AcpiUtStrupr (AslCompilertext); - strcpy (s, AslCompilertext); - s[strlen (AslCompilertext)] = 0; - AslCompilerlval.s = s; - DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s); - return (PARSEOP_NAMESTRING); } - -"*" | -"/" { count (1); - AslCompilererror ("Parse error, expecting ASL keyword or name");} - -. { count (1); - sprintf (MsgBuffer, - "Invalid character (0x%2.2X), expecting ASL keyword or name", - *AslCompilertext); - AslCompilererror (MsgBuffer);} - -<> { if (AslPopInputFileStack ()) - yyterminate(); - else - return (PARSEOP_INCLUDE_END);}; - -%% - -/*! [End] no source code translation !*/ - -typedef struct asl_file_node -{ - FILE *File; - UINT32 CurrentLineNumber; - YY_BUFFER_STATE State; - char *Filename; - struct asl_file_node *Next; - -} ASL_FILE_NODE; - -ASL_FILE_NODE *InputStack = NULL; - - -/******************************************************************************* - * - * FUNCTION: AslPopInputFileStack - * - * PARAMETERS: None - * - * RETURN: 0 if a node was popped, -1 otherwise - * - * DESCRIPTION: Pop the top of the input file stack and point the parser to - * the saved parse buffer contained in the fnode. Also, set the - * global line counters to the saved values. This function is - * called when an include file reaches EOF. - * - ******************************************************************************/ - -int -AslPopInputFileStack ( - void) -{ - ASL_FILE_NODE *Fnode; - FILE *InputFile = NULL; - - - Fnode = InputStack; - DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode); - - - if (!Fnode) - { - return -1; - } - - /* Close the current include file */ - - fclose (yyin); - - /* Update the top-of-stack */ - - InputStack = Fnode->Next; - InputFile = Fnode->File; - - /* Reset global line counter and filename */ - - Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename; - Gbl_CurrentLineNumber = Fnode->CurrentLineNumber; - - /* Point the parser to the popped file */ - - yy_delete_buffer (YY_CURRENT_BUFFER); - yy_switch_to_buffer (Fnode->State); - - /* All done with this node */ - - ACPI_FREE (Fnode); - return 0; -} - - -/******************************************************************************* - * - * FUNCTION: AslPushInputFileStack - * - * PARAMETERS: InputFile - Open file pointer - * Filename - Name of the file - * - * RETURN: None - * - * DESCRIPTION: Push the InputFile onto the file stack, and point the parser - * to this file. Called when an include file is successfully - * opened. - * - ******************************************************************************/ - -void -AslPushInputFileStack ( - FILE *InputFile, - char *Filename) -{ - ASL_FILE_NODE *Fnode; - YY_BUFFER_STATE State; - - - /* Save the current state in an Fnode */ - - Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE)); - - Fnode->File = yyin; - Fnode->Next = InputStack; - Fnode->State = YY_CURRENT_BUFFER; - Fnode->CurrentLineNumber = Gbl_CurrentLineNumber; - Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename; - - /* Push it on the stack */ - - InputStack = Fnode; - - /* Point the parser to this file */ - - State = yy_create_buffer (InputFile, YY_BUF_SIZE); - yy_switch_to_buffer (State); - - DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile); - - /* Reset the global line count and filename */ - - Gbl_Files[ASL_FILE_INPUT].Filename = Filename; - Gbl_CurrentLineNumber = 1; - yyin = InputFile; -} - - -/******************************************************************************* - * - * FUNCTION: ResetCurrentLineBuffer - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers. - * - ******************************************************************************/ - -void -ResetCurrentLineBuffer ( - void) -{ - - if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle) - { - FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer, - Gbl_LineBufPtr - Gbl_CurrentLineBuffer); - } - - Gbl_CurrentLineOffset += Gbl_CurrentColumn; - Gbl_CurrentColumn = 0; - - Gbl_CurrentLineNumber++; - Gbl_LogicalLineNumber++; - Gbl_LineBufPtr = Gbl_CurrentLineBuffer; -} - - -/******************************************************************************* - * - * FUNCTION: InsertLineBuffer - * - * PARAMETERS: SourceChar - One char from the input ASL source file - * - * RETURN: None - * - * DESCRIPTION: Put one character of the source file into the temp line buffer - * - ******************************************************************************/ - -#define ASL_SPACES_PER_TAB 4 - -void -InsertLineBuffer ( - int SourceChar) -{ - UINT32 i; - UINT32 Count = 1; - - - if (SourceChar == EOF) - { - return; - } - - Gbl_InputByteCount++; - - /* Handle tabs. Convert to spaces */ - - if (SourceChar == '\t') - { - SourceChar = ' '; - Count = ASL_SPACES_PER_TAB - - (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1)); - } - - - for (i = 0; i < Count; i++) - { - Gbl_CurrentColumn++; - - /* Insert the character into the line buffer */ - - *Gbl_LineBufPtr = (UINT8) SourceChar; - Gbl_LineBufPtr++; - - if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1))) - { -#if 0 - /* - * Warning if we have split a long source line. - * - */ - sprintf (MsgBuffer, "Max %d", ASL_LINE_BUFFER_SIZE); - AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer); -#endif - - ResetCurrentLineBuffer (); - } - else if (SourceChar == '\n') - { - /* End of line */ - - ResetCurrentLineBuffer (); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: count - * - * PARAMETERS: yytext - Contains the matched keyword. - * Type - Keyword/Character type: - * 0 = anything except a keyword - * 1 = pseudo-keywords - * 2 = non-executable ASL keywords - * 3 = executable ASL keywords - * - * RETURN: None - * - * DESCRIPTION: Count keywords and put them into the line buffer - * - ******************************************************************************/ - -void -count ( - int Type) -{ - int i; - - - switch (Type) - { - case 2: - TotalKeywords++; - TotalNamedObjects++; - break; - - case 3: - TotalKeywords++; - TotalExecutableOpcodes++; - break; - } - - for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++) - { - InsertLineBuffer (yytext[i]); - *Gbl_LineBufPtr = 0; - } -} - - -/******************************************************************************* - * - * FUNCTION: comment - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Process a standard comment. - * - ******************************************************************************/ - -char -comment (void) -{ - char c; - char c1 = 0; - - - InsertLineBuffer ('/'); - InsertLineBuffer ('*'); - -loop: - - /* Eat chars until end-of-comment */ - - while ((c = (char) input()) != '*' && c != EOF) - { - InsertLineBuffer (c); - c1 = c; - } - - if (c == EOF) - { - goto EarlyEOF; - } - - /* - * Check for nested comment -- can help catch cases where a previous - * comment was accidently left unterminated - */ - if ((c1 == '/') && (c == '*')) - { - AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - } - - /* Comment is closed only if the NEXT character is a slash */ - - InsertLineBuffer (c); - - if ((c1 = (char) input()) != '/' && c1 != EOF) - { - unput(c1); - goto loop; - } - - if (c1 == EOF) - { - goto EarlyEOF; - } - - InsertLineBuffer (c1); - return TRUE; - - -EarlyEOF: - /* - * Premature End-Of-File - */ - AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: comment - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Process a new "//" comment. - * - ******************************************************************************/ - -char -comment2 (void) -{ - char c; - - - InsertLineBuffer ('/'); - InsertLineBuffer ('/'); - - while ((c = (char) input()) != '\n' && c != EOF) - { - InsertLineBuffer (c); - } - - if (c == EOF) - { - /* End of file is OK, change to newline. Let parser detect EOF later */ - - c = '\n'; - } - - InsertLineBuffer (c); - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: literal - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Process a string literal (surrounded by quotes) - * - ******************************************************************************/ - -#define ASL_NORMAL_CHAR 0 -#define ASL_ESCAPE_SEQUENCE 1 -#define ASL_OCTAL_CONSTANT 2 -#define ASL_HEX_CONSTANT 3 - -char -literal (void) -{ - char *StringBuffer = MsgBuffer; - char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE; - char *CleanString; - char StringChar; - UINT32 State = ASL_NORMAL_CHAR; - UINT32 i = 0; - UINT8 Digit; - char ConvertBuffer[4]; - - - /* - * Eat chars until end-of-literal. - * NOTE: Put back the original surrounding quotes into the - * source line buffer. - */ - InsertLineBuffer ('\"'); - while ((StringChar = (char) input()) != EOF) - { - InsertLineBuffer (StringChar); - -DoCharacter: - - switch (State) - { - case ASL_NORMAL_CHAR: - - switch (StringChar) - { - case '\\': - /* - * Special handling for backslash-escape sequence. We will - * toss the backslash and translate the escape char(s). - */ - State = ASL_ESCAPE_SEQUENCE; - continue; - - case '\"': - - /* String terminator */ - - goto CompletedString; - } - break; - - - case ASL_ESCAPE_SEQUENCE: - - State = ASL_NORMAL_CHAR; - switch (StringChar) - { - case 'a': - StringChar = 0x07; /* BELL */ - break; - - case 'b': - StringChar = 0x08; /* BACKSPACE */ - break; - - case 'f': - StringChar = 0x0C; /* FORMFEED */ - break; - - case 'n': - StringChar = 0x0A; /* LINEFEED */ - break; - - case 'r': - StringChar = 0x0D; /* CARRIAGE RETURN*/ - break; - - case 't': - StringChar = 0x09; /* HORIZONTAL TAB */ - break; - - case 'v': - StringChar = 0x0B; /* VERTICAL TAB */ - break; - - case 'x': - State = ASL_HEX_CONSTANT; - i = 0; - continue; - - case '\'': /* Single Quote */ - case '\"': /* Double Quote */ - case '\\': /* Backslash */ - break; - - default: - - /* Check for an octal digit (0-7) */ - - if (ACPI_IS_OCTAL_DIGIT (StringChar)) - { - State = ASL_OCTAL_CONSTANT; - ConvertBuffer[0] = StringChar; - i = 1; - continue; - } - - /* Unknown escape sequence issue warning, but use the character */ - - AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - break; - } - break; - - - case ASL_OCTAL_CONSTANT: - - /* Up to three octal digits allowed */ - - if (!ACPI_IS_OCTAL_DIGIT (StringChar) || - (i > 2)) - { - /* - * Reached end of the constant. Convert the assembled ASCII - * string and resume processing of the next character - */ - ConvertBuffer[i] = 0; - Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8); - - /* Check for NULL or non-ascii character (ignore if so) */ - - if ((Digit == 0) || (Digit > ACPI_ASCII_MAX)) - { - AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - } - else - { - *StringBuffer = (char) Digit; - StringBuffer++; - if (StringBuffer >= EndBuffer) - { - goto BufferOverflow; - } - } - - State = ASL_NORMAL_CHAR; - goto DoCharacter; - break; - } - - /* Append another digit of the constant */ - - ConvertBuffer[i] = StringChar; - i++; - continue; - - - case ASL_HEX_CONSTANT: - - /* Up to two hex digits allowed */ - - if (!ACPI_IS_XDIGIT (StringChar) || - (i > 1)) - { - /* - * Reached end of the constant. Convert the assembled ASCII - * string and resume processing of the next character - */ - ConvertBuffer[i] = 0; - Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16); - - /* Check for NULL or non-ascii character (ignore if so) */ - - if ((Digit == 0) || (Digit > ACPI_ASCII_MAX)) - { - AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - } - else - { - *StringBuffer = (char) Digit; - StringBuffer++; - if (StringBuffer >= EndBuffer) - { - goto BufferOverflow; - } - } - - State = ASL_NORMAL_CHAR; - goto DoCharacter; - break; - } - - /* Append another digit of the constant */ - - ConvertBuffer[i] = StringChar; - i++; - continue; - } - - /* Save the finished character */ - - *StringBuffer = StringChar; - StringBuffer++; - if (StringBuffer >= EndBuffer) - { - goto BufferOverflow; - } - } - - /* - * Premature End-Of-File - */ - AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - return (FALSE); - - -CompletedString: - /* - * Null terminate the input string and copy string to a new buffer - */ - *StringBuffer = 0; - - CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1); - if (!CleanString) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - return (FALSE); - } - - ACPI_STRCPY (CleanString, MsgBuffer); - AslCompilerlval.s = CleanString; - return (TRUE); - - -BufferOverflow: - - /* Literal was too long */ - - AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); - return (FALSE); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.y b/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.y deleted file mode 100644 index 3c12a3dfc3..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.y +++ /dev/null @@ -1,3189 +0,0 @@ - -%{ -/****************************************************************************** - * - * Module Name: aslcompiler.y - Bison input file (ASL grammar and actions) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define YYDEBUG 1 -#define YYERROR_VERBOSE 1 - -/* - * State stack - compiler will fault if it overflows. (Default was 200) - */ -#define YYINITDEPTH 600 - -#include "aslcompiler.h" -#include -#include -#include -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslparse") - -/* - * Global Notes: - * - * October 2005: The following list terms have been optimized (from the - * original ASL grammar in the ACPI specification) to force the immediate - * reduction of each list item so that the parse stack use doesn't increase on - * each list element and possibly overflow on very large lists (>4000 items). - * This dramatically reduces use of the parse stack overall. - * - * ArgList, TermList, Objectlist, ByteList, DWordList, PackageList, - * ResourceMacroList, and FieldUnitList - */ - - -/* - * Next statement is important - this makes everything public so that - * we can access some of the parser tables from other modules - */ -#define static -#undef alloca -#define alloca AslLocalAllocate -#define YYERROR_VERBOSE 1 - -void * -AslLocalAllocate (unsigned int Size); - -/* - * The windows version of bison defines this incorrectly as "32768" (Not negative). - * Using a custom (edited binary) version of bison that defines YYFLAG as YYFBAD - * instead (#define YYFBAD 32768), so we can define it correctly here. - * - * The problem is that if YYFLAG is positive, the extended syntax error messages - * are disabled. - */ - -#define YYFLAG -32768 - - -%} - - -/* - * Declare the type of values in the grammar - */ - -%union { - UINT64 i; - char *s; - ACPI_PARSE_OBJECT *n; -} - - -/*! [Begin] no source code translation */ - -/* - * These shift/reduce conflicts are expected. There should be zero - * reduce/reduce conflicts. - */ -%expect 60 - - -/* - * Token types: These are returned by the lexer - * - * NOTE: This list MUST match the AslKeywordMapping table found - * in aslmap.c EXACTLY! Double check any changes! - */ - -%token PARSEOP_ACCESSAS -%token PARSEOP_ACCESSATTRIB_BLOCK -%token PARSEOP_ACCESSATTRIB_BLOCK_CALL -%token PARSEOP_ACCESSATTRIB_BYTE -%token PARSEOP_ACCESSATTRIB_WORD_CALL -%token PARSEOP_ACCESSATTRIB_QUICK -%token PARSEOP_ACCESSATTRIB_SND_RCV -%token PARSEOP_ACCESSATTRIB_WORD -%token PARSEOP_ACCESSTYPE_ANY -%token PARSEOP_ACCESSTYPE_BUF -%token PARSEOP_ACCESSTYPE_BYTE -%token PARSEOP_ACCESSTYPE_DWORD -%token PARSEOP_ACCESSTYPE_QWORD -%token PARSEOP_ACCESSTYPE_WORD -%token PARSEOP_ACQUIRE -%token PARSEOP_ADD -%token PARSEOP_ADDRESSSPACE_FFIXEDHW -%token PARSEOP_ADDRESSTYPE_ACPI -%token PARSEOP_ADDRESSTYPE_MEMORY -%token PARSEOP_ADDRESSTYPE_NVS -%token PARSEOP_ADDRESSTYPE_RESERVED -%token PARSEOP_ALIAS -%token PARSEOP_AND -%token PARSEOP_ARG0 -%token PARSEOP_ARG1 -%token PARSEOP_ARG2 -%token PARSEOP_ARG3 -%token PARSEOP_ARG4 -%token PARSEOP_ARG5 -%token PARSEOP_ARG6 -%token PARSEOP_BANKFIELD -%token PARSEOP_BREAK -%token PARSEOP_BREAKPOINT -%token PARSEOP_BUFFER -%token PARSEOP_BUSMASTERTYPE_MASTER -%token PARSEOP_BUSMASTERTYPE_NOTMASTER -%token PARSEOP_BYTECONST -%token PARSEOP_CASE -%token PARSEOP_CONCATENATE -%token PARSEOP_CONCATENATERESTEMPLATE -%token PARSEOP_CONDREFOF -%token PARSEOP_CONTINUE -%token PARSEOP_COPYOBJECT -%token PARSEOP_CREATEBITFIELD -%token PARSEOP_CREATEBYTEFIELD -%token PARSEOP_CREATEDWORDFIELD -%token PARSEOP_CREATEFIELD -%token PARSEOP_CREATEQWORDFIELD -%token PARSEOP_CREATEWORDFIELD -%token PARSEOP_DATATABLEREGION -%token PARSEOP_DEBUG -%token PARSEOP_DECODETYPE_POS -%token PARSEOP_DECODETYPE_SUB -%token PARSEOP_DECREMENT -%token PARSEOP_DEFAULT -%token PARSEOP_DEFAULT_ARG -%token PARSEOP_DEFINITIONBLOCK -%token PARSEOP_DEREFOF -%token PARSEOP_DEVICE -%token PARSEOP_DIVIDE -%token PARSEOP_DMA -%token PARSEOP_DMATYPE_A -%token PARSEOP_DMATYPE_COMPATIBILITY -%token PARSEOP_DMATYPE_B -%token PARSEOP_DMATYPE_F -%token PARSEOP_DWORDCONST -%token PARSEOP_DWORDIO -%token PARSEOP_DWORDMEMORY -%token PARSEOP_DWORDSPACE -%token PARSEOP_EISAID -%token PARSEOP_ELSE -%token PARSEOP_ELSEIF -%token PARSEOP_ENDDEPENDENTFN -%token PARSEOP_ENDTAG -%token PARSEOP_ERRORNODE -%token PARSEOP_EVENT -%token PARSEOP_EXTENDEDIO -%token PARSEOP_EXTENDEDMEMORY -%token PARSEOP_EXTENDEDSPACE -%token PARSEOP_EXTERNAL -%token PARSEOP_FATAL -%token PARSEOP_FIELD -%token PARSEOP_FINDSETLEFTBIT -%token PARSEOP_FINDSETRIGHTBIT -%token PARSEOP_FIXEDIO -%token PARSEOP_FROMBCD -%token PARSEOP_FUNCTION -%token PARSEOP_IF -%token PARSEOP_INCLUDE -%token PARSEOP_INCLUDE_CSTYLE -%token PARSEOP_INCLUDE_END -%token PARSEOP_INCREMENT -%token PARSEOP_INDEX -%token PARSEOP_INDEXFIELD -%token PARSEOP_INTEGER -%token PARSEOP_INTERRUPT -%token PARSEOP_INTLEVEL_ACTIVEHIGH -%token PARSEOP_INTLEVEL_ACTIVELOW -%token PARSEOP_INTTYPE_EDGE -%token PARSEOP_INTTYPE_LEVEL -%token PARSEOP_IO -%token PARSEOP_IODECODETYPE_10 -%token PARSEOP_IODECODETYPE_16 -%token PARSEOP_IRQ -%token PARSEOP_IRQNOFLAGS -%token PARSEOP_LAND -%token PARSEOP_LEQUAL -%token PARSEOP_LGREATER -%token PARSEOP_LGREATEREQUAL -%token PARSEOP_LINE_CSTYLE -%token PARSEOP_LLESS -%token PARSEOP_LLESSEQUAL -%token PARSEOP_LNOT -%token PARSEOP_LNOTEQUAL -%token PARSEOP_LOAD -%token PARSEOP_LOADTABLE -%token PARSEOP_LOCAL0 -%token PARSEOP_LOCAL1 -%token PARSEOP_LOCAL2 -%token PARSEOP_LOCAL3 -%token PARSEOP_LOCAL4 -%token PARSEOP_LOCAL5 -%token PARSEOP_LOCAL6 -%token PARSEOP_LOCAL7 -%token PARSEOP_LOCKRULE_LOCK -%token PARSEOP_LOCKRULE_NOLOCK -%token PARSEOP_LOR -%token PARSEOP_MATCH -%token PARSEOP_MATCHTYPE_MEQ -%token PARSEOP_MATCHTYPE_MGE -%token PARSEOP_MATCHTYPE_MGT -%token PARSEOP_MATCHTYPE_MLE -%token PARSEOP_MATCHTYPE_MLT -%token PARSEOP_MATCHTYPE_MTR -%token PARSEOP_MAXTYPE_FIXED -%token PARSEOP_MAXTYPE_NOTFIXED -%token PARSEOP_MEMORY24 -%token PARSEOP_MEMORY32 -%token PARSEOP_MEMORY32FIXED -%token PARSEOP_MEMTYPE_CACHEABLE -%token PARSEOP_MEMTYPE_NONCACHEABLE -%token PARSEOP_MEMTYPE_PREFETCHABLE -%token PARSEOP_MEMTYPE_WRITECOMBINING -%token PARSEOP_METHOD -%token PARSEOP_METHODCALL -%token PARSEOP_MID -%token PARSEOP_MINTYPE_FIXED -%token PARSEOP_MINTYPE_NOTFIXED -%token PARSEOP_MOD -%token PARSEOP_MULTIPLY -%token PARSEOP_MUTEX -%token PARSEOP_NAME -%token PARSEOP_NAMESEG -%token PARSEOP_NAMESTRING -%token PARSEOP_NAND -%token PARSEOP_NOOP -%token PARSEOP_NOR -%token PARSEOP_NOT -%token PARSEOP_NOTIFY -%token PARSEOP_OBJECTTYPE -%token PARSEOP_OBJECTTYPE_BFF -%token PARSEOP_OBJECTTYPE_BUF -%token PARSEOP_OBJECTTYPE_DDB -%token PARSEOP_OBJECTTYPE_DEV -%token PARSEOP_OBJECTTYPE_EVT -%token PARSEOP_OBJECTTYPE_FLD -%token PARSEOP_OBJECTTYPE_INT -%token PARSEOP_OBJECTTYPE_MTH -%token PARSEOP_OBJECTTYPE_MTX -%token PARSEOP_OBJECTTYPE_OPR -%token PARSEOP_OBJECTTYPE_PKG -%token PARSEOP_OBJECTTYPE_POW -%token PARSEOP_OBJECTTYPE_PRO -%token PARSEOP_OBJECTTYPE_STR -%token PARSEOP_OBJECTTYPE_THZ -%token PARSEOP_OBJECTTYPE_UNK -%token PARSEOP_OFFSET -%token PARSEOP_ONE -%token PARSEOP_ONES -%token PARSEOP_OPERATIONREGION -%token PARSEOP_OR -%token PARSEOP_PACKAGE -%token PARSEOP_PACKAGE_LENGTH -%token PARSEOP_POWERRESOURCE -%token PARSEOP_PROCESSOR -%token PARSEOP_QWORDCONST -%token PARSEOP_QWORDIO -%token PARSEOP_QWORDMEMORY -%token PARSEOP_QWORDSPACE -%token PARSEOP_RANGETYPE_ENTIRE -%token PARSEOP_RANGETYPE_ISAONLY -%token PARSEOP_RANGETYPE_NONISAONLY -%token PARSEOP_RAW_DATA -%token PARSEOP_READWRITETYPE_BOTH -%token PARSEOP_READWRITETYPE_READONLY -%token PARSEOP_REFOF -%token PARSEOP_REGIONSPACE_CMOS -%token PARSEOP_REGIONSPACE_EC -%token PARSEOP_REGIONSPACE_IO -%token PARSEOP_REGIONSPACE_IPMI -%token PARSEOP_REGIONSPACE_MEM -%token PARSEOP_REGIONSPACE_PCI -%token PARSEOP_REGIONSPACE_PCIBAR -%token PARSEOP_REGIONSPACE_SMBUS -%token PARSEOP_REGISTER -%token PARSEOP_RELEASE -%token PARSEOP_RESERVED_BYTES -%token PARSEOP_RESET -%token PARSEOP_RESOURCETEMPLATE -%token PARSEOP_RESOURCETYPE_CONSUMER -%token PARSEOP_RESOURCETYPE_PRODUCER -%token PARSEOP_RETURN -%token PARSEOP_REVISION -%token PARSEOP_SCOPE -%token PARSEOP_SERIALIZERULE_NOTSERIAL -%token PARSEOP_SERIALIZERULE_SERIAL -%token PARSEOP_SHARETYPE_EXCLUSIVE -%token PARSEOP_SHARETYPE_SHARED -%token PARSEOP_SHIFTLEFT -%token PARSEOP_SHIFTRIGHT -%token PARSEOP_SIGNAL -%token PARSEOP_SIZEOF -%token PARSEOP_SLEEP -%token PARSEOP_STALL -%token PARSEOP_STARTDEPENDENTFN -%token PARSEOP_STARTDEPENDENTFN_NOPRI -%token PARSEOP_STORE -%token PARSEOP_STRING_LITERAL -%token PARSEOP_SUBTRACT -%token PARSEOP_SWITCH -%token PARSEOP_THERMALZONE -%token PARSEOP_TIMER -%token PARSEOP_TOBCD -%token PARSEOP_TOBUFFER -%token PARSEOP_TODECIMALSTRING -%token PARSEOP_TOHEXSTRING -%token PARSEOP_TOINTEGER -%token PARSEOP_TOSTRING -%token PARSEOP_TOUUID -%token PARSEOP_TRANSLATIONTYPE_DENSE -%token PARSEOP_TRANSLATIONTYPE_SPARSE -%token PARSEOP_TYPE_STATIC -%token PARSEOP_TYPE_TRANSLATION -%token PARSEOP_UNICODE -%token PARSEOP_UNLOAD -%token PARSEOP_UPDATERULE_ONES -%token PARSEOP_UPDATERULE_PRESERVE -%token PARSEOP_UPDATERULE_ZEROS -%token PARSEOP_VAR_PACKAGE -%token PARSEOP_VENDORLONG -%token PARSEOP_VENDORSHORT -%token PARSEOP_WAIT -%token PARSEOP_WHILE -%token PARSEOP_WORDBUSNUMBER -%token PARSEOP_WORDCONST -%token PARSEOP_WORDIO -%token PARSEOP_WORDSPACE -%token PARSEOP_XFERTYPE_8 -%token PARSEOP_XFERTYPE_8_16 -%token PARSEOP_XFERTYPE_16 -%token PARSEOP_XOR -%token PARSEOP_ZERO - - -/* - * Production names - */ - -%type ASLCode -%type DefinitionBlockTerm -%type TermList -%type Term -%type CompilerDirective -%type ObjectList -%type Object -%type DataObject -%type BufferData -%type PackageData -%type IntegerData -%type StringData -%type NamedObject -%type NameSpaceModifier -%type UserTerm -%type ArgList -%type TermArg -%type Target -%type RequiredTarget -%type SimpleTarget -%type BufferTermData -%type ParameterTypePackage -%type ParameterTypePackageList -%type ParameterTypesPackage -%type ParameterTypesPackageList - -%type Type1Opcode -%type Type2Opcode -%type Type2IntegerOpcode -%type Type2StringOpcode -%type Type2BufferOpcode -%type Type2BufferOrStringOpcode -%type Type3Opcode - -/* Obsolete %type Type4Opcode */ - -%type Type5Opcode -%type Type6Opcode - -%type LineTerm -%type IncludeTerm -%type IncludeCStyleTerm -%type ExternalTerm - -%type FieldUnitList -%type FieldUnit -%type FieldUnitEntry - -%type OffsetTerm -%type AccessAsTerm -%type OptionalAccessAttribTerm - - -/* Named Objects */ - -%type BankFieldTerm -%type CreateBitFieldTerm -%type CreateByteFieldTerm -%type CreateDWordFieldTerm -%type CreateFieldTerm -%type CreateQWordFieldTerm -%type CreateWordFieldTerm -%type DataRegionTerm -%type DeviceTerm -%type EventTerm -%type FieldTerm -%type FunctionTerm -%type IndexFieldTerm -%type MethodTerm -%type MutexTerm -%type OpRegionTerm -%type OpRegionSpaceIdTerm -%type PowerResTerm -%type ProcessorTerm -%type ThermalZoneTerm - - -/* Namespace modifiers */ - -%type AliasTerm -%type NameTerm -%type ScopeTerm - -/* Type 1 opcodes */ - -%type BreakTerm -%type BreakPointTerm -%type ContinueTerm -%type FatalTerm -%type IfElseTerm -%type IfTerm -%type ElseTerm -%type LoadTerm -%type NoOpTerm -%type NotifyTerm -%type ReleaseTerm -%type ResetTerm -%type ReturnTerm -%type SignalTerm -%type SleepTerm -%type StallTerm -%type SwitchTerm -%type CaseDefaultTermList -//%type CaseTermList -%type CaseTerm -%type DefaultTerm -%type UnloadTerm -%type WhileTerm - -/* Type 2 opcodes */ - -%type AcquireTerm -%type AddTerm -%type AndTerm -%type ConcatTerm -%type ConcatResTerm -%type CondRefOfTerm -%type CopyObjectTerm -%type DecTerm -%type DerefOfTerm -%type DivideTerm -%type FindSetLeftBitTerm -%type FindSetRightBitTerm -%type FromBCDTerm -%type IncTerm -%type IndexTerm -%type LAndTerm -%type LEqualTerm -%type LGreaterTerm -%type LGreaterEqualTerm -%type LLessTerm -%type LLessEqualTerm -%type LNotTerm -%type LNotEqualTerm -%type LoadTableTerm -%type LOrTerm -%type MatchTerm -%type MidTerm -%type ModTerm -%type MultiplyTerm -%type NAndTerm -%type NOrTerm -%type NotTerm -%type ObjectTypeTerm -%type OrTerm -%type RefOfTerm -%type ShiftLeftTerm -%type ShiftRightTerm -%type SizeOfTerm -%type StoreTerm -%type SubtractTerm -%type TimerTerm -%type ToBCDTerm -%type ToBufferTerm -%type ToDecimalStringTerm -%type ToHexStringTerm -%type ToIntegerTerm -%type ToStringTerm -%type WaitTerm -%type XOrTerm - -%type OptionalTermArg -%type OptionalReturnArg -%type OptionalListString - - -/* Keywords */ - -%type ObjectTypeKeyword -%type AccessTypeKeyword -%type AccessAttribKeyword -%type LockRuleKeyword -%type UpdateRuleKeyword -%type RegionSpaceKeyword -%type AddressSpaceKeyword -%type MatchOpKeyword -%type SerializeRuleKeyword -%type DMATypeKeyword -%type OptionalBusMasterKeyword -%type XferTypeKeyword -%type ResourceTypeKeyword -%type MinKeyword -%type MaxKeyword -%type DecodeKeyword -%type RangeTypeKeyword -%type MemTypeKeyword -%type OptionalReadWriteKeyword -%type InterruptTypeKeyword -%type InterruptLevel -%type ShareTypeKeyword -%type IODecodeKeyword -%type TypeKeyword -%type TranslationKeyword -%type AddressKeyword - -/* Types */ - -%type SuperName -%type ArgTerm -%type LocalTerm -%type DebugTerm - -%type Integer -%type ByteConst -%type WordConst -%type DWordConst -%type QWordConst -%type String - -%type ConstTerm -%type ByteConstExpr -%type WordConstExpr -%type DWordConstExpr -%type QWordConstExpr -%type ConstExprTerm - -%type BufferTerm -%type ByteList -%type DWordList - -%type PackageTerm -%type PackageList -%type PackageElement - -%type VarPackageLengthTerm - -/* Macros */ - -%type EISAIDTerm -%type ResourceTemplateTerm -%type ToUUIDTerm -%type UnicodeTerm -%type ResourceMacroList -%type ResourceMacroTerm - -%type DMATerm -%type DWordIOTerm -%type DWordMemoryTerm -%type DWordSpaceTerm -%type EndDependentFnTerm -%type ExtendedIOTerm -%type ExtendedMemoryTerm -%type ExtendedSpaceTerm -%type FixedIOTerm -%type InterruptTerm -%type IOTerm -%type IRQNoFlagsTerm -%type IRQTerm -%type Memory24Term -%type Memory32FixedTerm -%type Memory32Term -%type QWordIOTerm -%type QWordMemoryTerm -%type QWordSpaceTerm -%type RegisterTerm -%type StartDependentFnTerm -%type StartDependentFnNoPriTerm -%type VendorLongTerm -%type VendorShortTerm -%type WordBusNumberTerm -%type WordIOTerm -%type WordSpaceTerm - -%type NameString -%type NameSeg - - -/* Local types that help construct the AML, not in ACPI spec */ - -%type IncludeEndTerm -%type AmlPackageLengthTerm -%type OptionalByteConstExpr -%type OptionalDWordConstExpr -%type OptionalQWordConstExpr -%type OptionalSerializeRuleKeyword -%type OptionalResourceType_First -%type OptionalResourceType -%type OptionalMinType -%type OptionalMaxType -%type OptionalMemType -%type OptionalCount -%type OptionalDecodeType -%type OptionalRangeType -%type OptionalShareType -%type OptionalType -%type OptionalType_Last -%type OptionalTranslationType_Last -%type OptionalStringData -%type OptionalNameString -%type OptionalNameString_First -%type OptionalNameString_Last -%type OptionalAddressRange -%type OptionalObjectTypeKeyword -%type OptionalParameterTypePackage -%type OptionalParameterTypesPackage -%type OptionalReference -%type OptionalAccessSize - - -%type TermArgItem -%type NameStringItem - -%% - - -/******************************************************************************* - * - * Production rules start here - * - ******************************************************************************/ - -/* - * ASL Names - */ - - -/* - * Blocks, Data, and Opcodes - */ - -ASLCode - : DefinitionBlockTerm - | error {YYABORT; $$ = NULL;} - ; - -DefinitionBlockTerm - : PARSEOP_DEFINITIONBLOCK '(' {$$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);} - String ',' - String ',' - ByteConst ',' - String ',' - String ',' - DWordConst - ')' {TrSetEndLineNumber ($3);} - '{' TermList '}' {$$ = TrLinkChildren ($3,7,$4,$6,$8,$10,$12,$14,$18);} - ; - -/* ACPI 3.0 -- allow semicolons between terms */ - -TermList - : {$$ = NULL;} - | TermList Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);} - | TermList ';' Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);} - ; - -Term - : Object {} - | Type1Opcode {} - | Type2Opcode {} - | Type2IntegerOpcode {} - | Type2StringOpcode {} - | Type2BufferOpcode {} - | Type2BufferOrStringOpcode {} - | error {$$ = AslDoError(); yyclearin;} - ; - -CompilerDirective - : IncludeTerm {} - | IncludeCStyleTerm {$$ = NULL;} - | LineTerm {$$ = NULL;} - | ExternalTerm {} - ; - -ObjectList - : {$$ = NULL;} - | ObjectList Object {$$ = TrLinkPeerNode ($1,$2);} - | error {$$ = AslDoError(); yyclearin;} - ; - -Object - : CompilerDirective {} - | NamedObject {} - | NameSpaceModifier {} - ; - -DataObject - : BufferData {} - | PackageData {} - | IntegerData {} - | StringData {} - ; - -BufferData - : Type5Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | BufferTerm {} - ; - -PackageData - : PackageTerm {} - ; - -IntegerData - : Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | Integer {} - | ConstTerm {} - ; - -StringData - : Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | String {} - ; - -NamedObject - : BankFieldTerm {} - | CreateBitFieldTerm {} - | CreateByteFieldTerm {} - | CreateDWordFieldTerm {} - | CreateFieldTerm {} - | CreateQWordFieldTerm {} - | CreateWordFieldTerm {} - | DataRegionTerm {} - | DeviceTerm {} - | EventTerm {} - | FieldTerm {} - | FunctionTerm {} - | IndexFieldTerm {} - | MethodTerm {} - | MutexTerm {} - | OpRegionTerm {} - | PowerResTerm {} - | ProcessorTerm {} - | ThermalZoneTerm {} - ; - -NameSpaceModifier - : AliasTerm {} - | NameTerm {} - | ScopeTerm {} - ; - -UserTerm - : NameString '(' {TrUpdateNode (PARSEOP_METHODCALL, $1);} - ArgList ')' {$$ = TrLinkChildNode ($1,$4);} - ; - -ArgList - : {$$ = NULL;} - | TermArg - | ArgList ',' /* Allows a trailing comma at list end */ - | ArgList ',' - TermArg {$$ = TrLinkPeerNode ($1,$3);} - ; - -/* -Removed from TermArg due to reduce/reduce conflicts - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - -*/ - -TermArg - : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | NameString {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | ArgTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | LocalTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - ; - -Target - : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_TARGET | NODE_COMPILE_TIME_CONST);} /* Placeholder is a ZeroOp object */ - | ',' {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_TARGET | NODE_COMPILE_TIME_CONST);} /* Placeholder is a ZeroOp object */ - | ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);} - ; - -RequiredTarget - : ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);} - ; - -SimpleTarget - : NameString {} - | LocalTerm {} - | ArgTerm {} - ; - -/* Rules for specifying the type of one method argument or return value */ - -ParameterTypePackage - : {$$ = NULL;} - | ObjectTypeKeyword {$$ = $1;} - | ParameterTypePackage ',' - ObjectTypeKeyword {$$ = TrLinkPeerNodes (2,$1,$3);} - ; - -ParameterTypePackageList - : {$$ = NULL;} - | ObjectTypeKeyword {$$ = $1;} - | '{' ParameterTypePackage '}' {$$ = $2;} - ; - -OptionalParameterTypePackage - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | ',' ParameterTypePackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} - ; - -/* Rules for specifying the types for method arguments */ - -ParameterTypesPackage - : ParameterTypePackageList {$$ = $1;} - | ParameterTypesPackage ',' - ParameterTypePackageList {$$ = TrLinkPeerNodes (2,$1,$3);} - ; - -ParameterTypesPackageList - : {$$ = NULL;} - | ObjectTypeKeyword {$$ = $1;} - | '{' ParameterTypesPackage '}' {$$ = $2;} - ; - -OptionalParameterTypesPackage - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | ',' ParameterTypesPackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} - ; - - -/* Opcode types */ - -Type1Opcode - : BreakTerm {} - | BreakPointTerm {} - | ContinueTerm {} - | FatalTerm {} - | IfElseTerm {} - | LoadTerm {} - | NoOpTerm {} - | NotifyTerm {} - | ReleaseTerm {} - | ResetTerm {} - | ReturnTerm {} - | SignalTerm {} - | SleepTerm {} - | StallTerm {} - | SwitchTerm {} - | UnloadTerm {} - | WhileTerm {} - ; - -Type2Opcode - : AcquireTerm {} - | CondRefOfTerm {} - | CopyObjectTerm {} - | DerefOfTerm {} - | ObjectTypeTerm {} - | RefOfTerm {} - | SizeOfTerm {} - | StoreTerm {} - | TimerTerm {} - | WaitTerm {} - | UserTerm {} - ; - -/* - * Type 3/4/5 opcodes - */ - -Type2IntegerOpcode /* "Type3" opcodes */ - : AddTerm {} - | AndTerm {} - | DecTerm {} - | DivideTerm {} - | FindSetLeftBitTerm {} - | FindSetRightBitTerm {} - | FromBCDTerm {} - | IncTerm {} - | IndexTerm {} - | LAndTerm {} - | LEqualTerm {} - | LGreaterTerm {} - | LGreaterEqualTerm {} - | LLessTerm {} - | LLessEqualTerm {} - | LNotTerm {} - | LNotEqualTerm {} - | LoadTableTerm {} - | LOrTerm {} - | MatchTerm {} - | ModTerm {} - | MultiplyTerm {} - | NAndTerm {} - | NOrTerm {} - | NotTerm {} - | OrTerm {} - | ShiftLeftTerm {} - | ShiftRightTerm {} - | SubtractTerm {} - | ToBCDTerm {} - | ToIntegerTerm {} - | XOrTerm {} - ; - -Type2StringOpcode /* "Type4" Opcodes */ - : ToDecimalStringTerm {} - | ToHexStringTerm {} - | ToStringTerm {} - ; - -Type2BufferOpcode /* "Type5" Opcodes */ - : ToBufferTerm {} - | ConcatResTerm {} - ; - -Type2BufferOrStringOpcode - : ConcatTerm {} - | MidTerm {} - ; - -/* - * A type 3 opcode evaluates to an Integer and cannot have a destination operand - */ - -Type3Opcode - : EISAIDTerm {} - ; - -/* Obsolete -Type4Opcode - : ConcatTerm {} - | ToDecimalStringTerm {} - | ToHexStringTerm {} - | MidTerm {} - | ToStringTerm {} - ; -*/ - - -Type5Opcode - : ResourceTemplateTerm {} - | UnicodeTerm {} - | ToUUIDTerm {} - ; - -Type6Opcode - : RefOfTerm {} - | DerefOfTerm {} - | IndexTerm {} - | UserTerm {} - ; - -IncludeTerm - : PARSEOP_INCLUDE '(' {$$ = TrCreateLeafNode (PARSEOP_INCLUDE);} - String ')' {TrLinkChildren ($3,1,$4);FlOpenIncludeFile ($4);} - TermList - IncludeEndTerm {$$ = TrLinkPeerNodes (3,$3,$7,$8);} - ; - -IncludeEndTerm - : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);} - ; - -IncludeCStyleTerm - : PARSEOP_INCLUDE_CSTYLE - String {FlOpenIncludeFile ($2);} - ; - -LineTerm - : PARSEOP_LINE_CSTYLE - Integer {FlSetLineNumber ($2);} - ; - -ExternalTerm - : PARSEOP_EXTERNAL '(' - NameString - OptionalObjectTypeKeyword - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' {$$ = TrCreateNode (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);} - | PARSEOP_EXTERNAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Named Objects *******************************************************/ - - -BankFieldTerm - : PARSEOP_BANKFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_BANKFIELD);} - NameString - NameStringItem - TermArgItem - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($3,7,$4,$5,$6,$8,$10,$12,$15);} - | PARSEOP_BANKFIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -FieldUnitList - : {$$ = NULL;} - | FieldUnit - | FieldUnitList ',' /* Allows a trailing comma at list end */ - | FieldUnitList ',' - FieldUnit {$$ = TrLinkPeerNode ($1,$3);} - ; - -FieldUnit - : FieldUnitEntry {} - | OffsetTerm {} - | AccessAsTerm {} - ; - -FieldUnitEntry - : ',' AmlPackageLengthTerm {$$ = TrCreateNode (PARSEOP_RESERVED_BYTES,1,$2);} - | NameSeg ',' - AmlPackageLengthTerm {$$ = TrLinkChildNode ($1,$3);} - ; - -OffsetTerm - : PARSEOP_OFFSET '(' - AmlPackageLengthTerm - ')' {$$ = TrCreateNode (PARSEOP_OFFSET,1,$3);} - | PARSEOP_OFFSET '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -AccessAsTerm - : PARSEOP_ACCESSAS '(' - AccessTypeKeyword - OptionalAccessAttribTerm - ')' {$$ = TrCreateNode (PARSEOP_ACCESSAS,2,$3,$4);} - | PARSEOP_ACCESSAS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateBitFieldTerm - : PARSEOP_CREATEBITFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEBITFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateByteFieldTerm - : PARSEOP_CREATEBYTEFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEBYTEFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateDWordFieldTerm - : PARSEOP_CREATEDWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEDWORDFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateFieldTerm - : PARSEOP_CREATEFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);} - TermArg - TermArgItem - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,4,$4,$5,$6,TrSetNodeFlags ($7, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateQWordFieldTerm - : PARSEOP_CREATEQWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEQWORDFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateWordFieldTerm - : PARSEOP_CREATEWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEWORDFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DataRegionTerm - : PARSEOP_DATATABLEREGION '(' {$$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);} - NameString - TermArgItem - TermArgItem - TermArgItem - ')' {$$ = TrLinkChildren ($3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$6,$7);} - | PARSEOP_DATATABLEREGION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DeviceTerm - : PARSEOP_DEVICE '(' {$$ = TrCreateLeafNode (PARSEOP_DEVICE);} - NameString - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_DEVICE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -EventTerm - : PARSEOP_EVENT '(' {$$ = TrCreateLeafNode (PARSEOP_EVENT);} - NameString - ')' {$$ = TrLinkChildren ($3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));} - | PARSEOP_EVENT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FieldTerm - : PARSEOP_FIELD '(' {$$ = TrCreateLeafNode (PARSEOP_FIELD);} - NameString - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($3,5,$4,$6,$8,$10,$13);} - | PARSEOP_FIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -FunctionTerm - : PARSEOP_FUNCTION '(' {$$ = TrCreateLeafNode (PARSEOP_METHOD);} - NameString - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' '{' - TermList '}' {$$ = TrLinkChildren ($3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION), - TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0), - TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL), - TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);} - | PARSEOP_FUNCTION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IndexFieldTerm - : PARSEOP_INDEXFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);} - NameString - NameStringItem - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($3,6,$4,$5,$7,$9,$11,$14);} - | PARSEOP_INDEXFIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -MethodTerm - : PARSEOP_METHOD '(' {$$ = TrCreateLeafNode (PARSEOP_METHOD);} - NameString - OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);} - OptionalSerializeRuleKeyword - OptionalByteConstExpr - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' '{' - TermList '}' {$$ = TrLinkChildren ($3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$7,$8,$9,$10,$13);} - | PARSEOP_METHOD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MutexTerm - : PARSEOP_MUTEX '(' {$$ = TrCreateLeafNode (PARSEOP_MUTEX);} - NameString - ',' ByteConstExpr - ')' {$$ = TrLinkChildren ($3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} - | PARSEOP_MUTEX '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -OpRegionTerm - : PARSEOP_OPERATIONREGION '(' {$$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);} - NameString - ',' OpRegionSpaceIdTerm - TermArgItem - TermArgItem - ')' {$$ = TrLinkChildren ($3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8);} - | PARSEOP_OPERATIONREGION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -OpRegionSpaceIdTerm - : RegionSpaceKeyword {} - | ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} - ; - -PowerResTerm - : PARSEOP_POWERRESOURCE '(' {$$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);} - NameString - ',' ByteConstExpr - ',' WordConstExpr - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$8,$11);} - | PARSEOP_POWERRESOURCE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ProcessorTerm - : PARSEOP_PROCESSOR '(' {$$ = TrCreateLeafNode (PARSEOP_PROCESSOR);} - NameString - ',' ByteConstExpr - OptionalDWordConstExpr - OptionalByteConstExpr - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($3,5,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8,$11);} - | PARSEOP_PROCESSOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ThermalZoneTerm - : PARSEOP_THERMALZONE '(' {$$ = TrCreateLeafNode (PARSEOP_THERMALZONE);} - NameString - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_THERMALZONE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Namespace modifiers *************************************************/ - - -AliasTerm - : PARSEOP_ALIAS '(' {$$ = TrCreateLeafNode (PARSEOP_ALIAS);} - NameString - NameStringItem - ')' {$$ = TrLinkChildren ($3,2,$4,TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));} - | PARSEOP_ALIAS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NameTerm - : PARSEOP_NAME '(' {$$ = TrCreateLeafNode (PARSEOP_NAME);} - NameString - ',' DataObject - ')' {$$ = TrLinkChildren ($3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} - | PARSEOP_NAME '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ScopeTerm - : PARSEOP_SCOPE '(' {$$ = TrCreateLeafNode (PARSEOP_SCOPE);} - NameString - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_SCOPE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Type 1 opcodes *******************************************************/ - - -BreakTerm - : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);} - ; - -BreakPointTerm - : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);} - ; - -ContinueTerm - : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);} - ; - -FatalTerm - : PARSEOP_FATAL '(' {$$ = TrCreateLeafNode (PARSEOP_FATAL);} - ByteConstExpr - ',' DWordConstExpr - TermArgItem - ')' {$$ = TrLinkChildren ($3,3,$4,$6,$7);} - | PARSEOP_FATAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IfElseTerm - : IfTerm ElseTerm {$$ = TrLinkPeerNode ($1,$2);} - ; - -IfTerm - : PARSEOP_IF '(' {$$ = TrCreateLeafNode (PARSEOP_IF);} - TermArg - ')' '{' - TermList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - - | PARSEOP_IF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ElseTerm - : {$$ = NULL;} - | PARSEOP_ELSE '{' {$$ = TrCreateLeafNode (PARSEOP_ELSE);} - TermList '}' {$$ = TrLinkChildren ($3,1,$4);} - - | PARSEOP_ELSE '{' - error '}' {$$ = AslDoError(); yyclearin;} - - | PARSEOP_ELSE - error {$$ = AslDoError(); yyclearin;} - - | PARSEOP_ELSEIF '(' {$$ = TrCreateLeafNode (PARSEOP_ELSE);} - TermArg {$$ = TrCreateLeafNode (PARSEOP_IF);} - ')' '{' - TermList '}' {TrLinkChildren ($5,2,$4,$8);} - ElseTerm {TrLinkPeerNode ($5,$11);} - {$$ = TrLinkChildren ($3,1,$5);} - - | PARSEOP_ELSEIF '(' - error ')' {$$ = AslDoError(); yyclearin;} - - | PARSEOP_ELSEIF - error {$$ = AslDoError(); yyclearin;} - ; - -LoadTerm - : PARSEOP_LOAD '(' {$$ = TrCreateLeafNode (PARSEOP_LOAD);} - NameString - RequiredTarget - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LOAD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NoOpTerm - : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);} - ; - -NotifyTerm - : PARSEOP_NOTIFY '(' {$$ = TrCreateLeafNode (PARSEOP_NOTIFY);} - SuperName - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_NOTIFY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ReleaseTerm - : PARSEOP_RELEASE '(' {$$ = TrCreateLeafNode (PARSEOP_RELEASE);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_RELEASE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ResetTerm - : PARSEOP_RESET '(' {$$ = TrCreateLeafNode (PARSEOP_RESET);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_RESET '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ReturnTerm - : PARSEOP_RETURN '(' {$$ = TrCreateLeafNode (PARSEOP_RETURN);} - OptionalReturnArg - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrCreateLeafNode (PARSEOP_ZERO));} - | PARSEOP_RETURN '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SignalTerm - : PARSEOP_SIGNAL '(' {$$ = TrCreateLeafNode (PARSEOP_SIGNAL);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_SIGNAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SleepTerm - : PARSEOP_SLEEP '(' {$$ = TrCreateLeafNode (PARSEOP_SLEEP);} - TermArg - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_SLEEP '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StallTerm - : PARSEOP_STALL '(' {$$ = TrCreateLeafNode (PARSEOP_STALL);} - TermArg - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_STALL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SwitchTerm - : PARSEOP_SWITCH '(' {$$ = TrCreateLeafNode (PARSEOP_SWITCH);} - TermArg - ')' '{' - CaseDefaultTermList '}' - {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_SWITCH '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -/* - * Case-Default list; allow only one Default term and unlimited Case terms - */ - -CaseDefaultTermList - : {$$ = NULL;} - | CaseTerm {} - | DefaultTerm {} - | CaseDefaultTermList - CaseTerm {$$ = TrLinkPeerNode ($1,$2);} - | CaseDefaultTermList - DefaultTerm {$$ = TrLinkPeerNode ($1,$2);} - -/* Original - attempts to force zero or one default term within the switch */ - -/* -CaseDefaultTermList - : {$$ = NULL;} - | CaseTermList - DefaultTerm - CaseTermList {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));} - | CaseTermList - CaseTerm {$$ = TrLinkPeerNode ($1,$2);} - ; - -CaseTermList - : {$$ = NULL;} - | CaseTerm {} - | CaseTermList - CaseTerm {$$ = TrLinkPeerNode ($1,$2);} - ; -*/ - -CaseTerm - : PARSEOP_CASE '(' {$$ = TrCreateLeafNode (PARSEOP_CASE);} - DataObject - ')' '{' - TermList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_CASE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DefaultTerm - : PARSEOP_DEFAULT '{' {$$ = TrCreateLeafNode (PARSEOP_DEFAULT);} - TermList '}' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_DEFAULT '{' - error '}' {$$ = AslDoError(); yyclearin;} - ; - -UnloadTerm - : PARSEOP_UNLOAD '(' {$$ = TrCreateLeafNode (PARSEOP_UNLOAD);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_UNLOAD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WhileTerm - : PARSEOP_WHILE '(' {$$ = TrCreateLeafNode (PARSEOP_WHILE);} - TermArg - ')' '{' TermList '}' - {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_WHILE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Type 2 opcodes *******************************************************/ - -AcquireTerm - : PARSEOP_ACQUIRE '(' {$$ = TrCreateLeafNode (PARSEOP_ACQUIRE);} - SuperName - ',' WordConstExpr - ')' {$$ = TrLinkChildren ($3,2,$4,$6);} - | PARSEOP_ACQUIRE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -AddTerm - : PARSEOP_ADD '(' {$$ = TrCreateLeafNode (PARSEOP_ADD);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_ADD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -AndTerm - : PARSEOP_AND '(' {$$ = TrCreateLeafNode (PARSEOP_AND);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_AND '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ConcatTerm - : PARSEOP_CONCATENATE '(' {$$ = TrCreateLeafNode (PARSEOP_CONCATENATE);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_CONCATENATE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ConcatResTerm - : PARSEOP_CONCATENATERESTEMPLATE '(' {$$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_CONCATENATERESTEMPLATE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CondRefOfTerm - : PARSEOP_CONDREFOF '(' {$$ = TrCreateLeafNode (PARSEOP_CONDREFOF);} - SuperName - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_CONDREFOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CopyObjectTerm - : PARSEOP_COPYOBJECT '(' {$$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);} - TermArg - ',' SimpleTarget - ')' {$$ = TrLinkChildren ($3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));} - | PARSEOP_COPYOBJECT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DecTerm - : PARSEOP_DECREMENT '(' {$$ = TrCreateLeafNode (PARSEOP_DECREMENT);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_DECREMENT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DerefOfTerm - : PARSEOP_DEREFOF '(' {$$ = TrCreateLeafNode (PARSEOP_DEREFOF);} - TermArg - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_DEREFOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DivideTerm - : PARSEOP_DIVIDE '(' {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} - TermArg - TermArgItem - Target - Target - ')' {$$ = TrLinkChildren ($3,4,$4,$5,$6,$7);} - | PARSEOP_DIVIDE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FindSetLeftBitTerm - : PARSEOP_FINDSETLEFTBIT '(' {$$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_FINDSETLEFTBIT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FindSetRightBitTerm - : PARSEOP_FINDSETRIGHTBIT '(' {$$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_FINDSETRIGHTBIT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FromBCDTerm - : PARSEOP_FROMBCD '(' {$$ = TrCreateLeafNode (PARSEOP_FROMBCD);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_FROMBCD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IncTerm - : PARSEOP_INCREMENT '(' {$$ = TrCreateLeafNode (PARSEOP_INCREMENT);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_INCREMENT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IndexTerm - : PARSEOP_INDEX '(' {$$ = TrCreateLeafNode (PARSEOP_INDEX);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_INDEX '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LAndTerm - : PARSEOP_LAND '(' {$$ = TrCreateLeafNode (PARSEOP_LAND);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LAND '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LEqualTerm - : PARSEOP_LEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LEQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LGreaterTerm - : PARSEOP_LGREATER '(' {$$ = TrCreateLeafNode (PARSEOP_LGREATER);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LGREATER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LGreaterEqualTerm - : PARSEOP_LGREATEREQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LLESS);} - TermArg - TermArgItem - ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($3,2,$4,$5));} - | PARSEOP_LGREATEREQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LLessTerm - : PARSEOP_LLESS '(' {$$ = TrCreateLeafNode (PARSEOP_LLESS);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LLESS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LLessEqualTerm - : PARSEOP_LLESSEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LGREATER);} - TermArg - TermArgItem - ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($3,2,$4,$5));} - | PARSEOP_LLESSEQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LNotTerm - : PARSEOP_LNOT '(' {$$ = TrCreateLeafNode (PARSEOP_LNOT);} - TermArg - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_LNOT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LNotEqualTerm - : PARSEOP_LNOTEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);} - TermArg - TermArgItem - ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($3,2,$4,$5));} - | PARSEOP_LNOTEQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LoadTableTerm - : PARSEOP_LOADTABLE '(' {$$ = TrCreateLeafNode (PARSEOP_LOADTABLE);} - TermArg - TermArgItem - TermArgItem - OptionalListString - OptionalListString - OptionalReference - ')' {$$ = TrLinkChildren ($3,6,$4,$5,$6,$7,$8,$9);} - | PARSEOP_LOADTABLE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LOrTerm - : PARSEOP_LOR '(' {$$ = TrCreateLeafNode (PARSEOP_LOR);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MatchTerm - : PARSEOP_MATCH '(' {$$ = TrCreateLeafNode (PARSEOP_MATCH);} - TermArg - ',' MatchOpKeyword - TermArgItem - ',' MatchOpKeyword - TermArgItem - TermArgItem - ')' {$$ = TrLinkChildren ($3,6,$4,$6,$7,$9,$10,$11);} - | PARSEOP_MATCH '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MidTerm - : PARSEOP_MID '(' {$$ = TrCreateLeafNode (PARSEOP_MID);} - TermArg - TermArgItem - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,4,$4,$5,$6,$7);} - | PARSEOP_MID '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ModTerm - : PARSEOP_MOD '(' {$$ = TrCreateLeafNode (PARSEOP_MOD);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_MOD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MultiplyTerm - : PARSEOP_MULTIPLY '(' {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_MULTIPLY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NAndTerm - : PARSEOP_NAND '(' {$$ = TrCreateLeafNode (PARSEOP_NAND);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_NAND '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NOrTerm - : PARSEOP_NOR '(' {$$ = TrCreateLeafNode (PARSEOP_NOR);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_NOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NotTerm - : PARSEOP_NOT '(' {$$ = TrCreateLeafNode (PARSEOP_NOT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_NOT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ObjectTypeTerm - : PARSEOP_OBJECTTYPE '(' {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_OBJECTTYPE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -OrTerm - : PARSEOP_OR '(' {$$ = TrCreateLeafNode (PARSEOP_OR);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_OR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -/* - * In RefOf, the node isn't really a target, but we can't keep track of it after - * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.) - */ -RefOfTerm - : PARSEOP_REFOF '(' {$$ = TrCreateLeafNode (PARSEOP_REFOF);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,TrSetNodeFlags ($4, NODE_IS_TARGET));} - | PARSEOP_REFOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ShiftLeftTerm - : PARSEOP_SHIFTLEFT '(' {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_SHIFTLEFT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ShiftRightTerm - : PARSEOP_SHIFTRIGHT '(' {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_SHIFTRIGHT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SizeOfTerm - : PARSEOP_SIZEOF '(' {$$ = TrCreateLeafNode (PARSEOP_SIZEOF);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_SIZEOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StoreTerm - : PARSEOP_STORE '(' {$$ = TrCreateLeafNode (PARSEOP_STORE);} - TermArg - ',' SuperName - ')' {$$ = TrLinkChildren ($3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));} - | PARSEOP_STORE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SubtractTerm - : PARSEOP_SUBTRACT '(' {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_SUBTRACT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -TimerTerm - : PARSEOP_TIMER '(' {$$ = TrCreateLeafNode (PARSEOP_TIMER);} - ')' {$$ = TrLinkChildren ($3,0);} - | PARSEOP_TIMER {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);} - | PARSEOP_TIMER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToBCDTerm - : PARSEOP_TOBCD '(' {$$ = TrCreateLeafNode (PARSEOP_TOBCD);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_TOBCD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToBufferTerm - : PARSEOP_TOBUFFER '(' {$$ = TrCreateLeafNode (PARSEOP_TOBUFFER);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_TOBUFFER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToDecimalStringTerm - : PARSEOP_TODECIMALSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_TODECIMALSTRING '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToHexStringTerm - : PARSEOP_TOHEXSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_TOHEXSTRING '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToIntegerTerm - : PARSEOP_TOINTEGER '(' {$$ = TrCreateLeafNode (PARSEOP_TOINTEGER);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_TOINTEGER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToStringTerm - : PARSEOP_TOSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TOSTRING);} - TermArg - OptionalCount - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_TOSTRING '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToUUIDTerm - : PARSEOP_TOUUID '(' - StringData ')' {$$ = TrUpdateNode (PARSEOP_TOUUID, $3);} - | PARSEOP_TOUUID '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WaitTerm - : PARSEOP_WAIT '(' {$$ = TrCreateLeafNode (PARSEOP_WAIT);} - SuperName - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_WAIT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -XOrTerm - : PARSEOP_XOR '(' {$$ = TrCreateLeafNode (PARSEOP_XOR);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_XOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Keywords *************************************************************/ - - -ObjectTypeKeyword - : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} - | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);} - | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);} - | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);} - | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);} - | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);} - | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);} - | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);} - | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);} - | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);} - | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);} - | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);} - | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);} - | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);} - | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);} - | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);} - ; - -AccessTypeKeyword - : PARSEOP_ACCESSTYPE_ANY {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_ANY);} - | PARSEOP_ACCESSTYPE_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BYTE);} - | PARSEOP_ACCESSTYPE_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_WORD);} - | PARSEOP_ACCESSTYPE_DWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_DWORD);} - | PARSEOP_ACCESSTYPE_QWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_QWORD);} - | PARSEOP_ACCESSTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);} - ; - -AccessAttribKeyword - : PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );} - | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);} - | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);} - | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);} - | PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);} - | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);} - | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);} - ; - -LockRuleKeyword - : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);} - | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);} - ; - -UpdateRuleKeyword - : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);} - | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);} - | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);} - ; - - -RegionSpaceKeyword - : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);} - | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);} - | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);} - | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);} - | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} - | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} - | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} - | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} - ; - -AddressSpaceKeyword - : ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} - | RegionSpaceKeyword {} - | PARSEOP_ADDRESSSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_ADDRESSSPACE_FFIXEDHW);} - ; - - -SerializeRuleKeyword - : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);} - | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);} - ; - -MatchOpKeyword - : PARSEOP_MATCHTYPE_MTR {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR);} - | PARSEOP_MATCHTYPE_MEQ {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);} - | PARSEOP_MATCHTYPE_MLE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLE);} - | PARSEOP_MATCHTYPE_MLT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLT);} - | PARSEOP_MATCHTYPE_MGE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGE);} - | PARSEOP_MATCHTYPE_MGT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);} - ; - -DMATypeKeyword - : PARSEOP_DMATYPE_A {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);} - | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);} - | PARSEOP_DMATYPE_B {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);} - | PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);} - ; - -XferTypeKeyword - : PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);} - | PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);} - | PARSEOP_XFERTYPE_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_16);} - ; - -ResourceTypeKeyword - : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);} - ; - -MinKeyword - : PARSEOP_MINTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_FIXED);} - | PARSEOP_MINTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);} - ; - -MaxKeyword - : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);} - | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);} - ; - -DecodeKeyword - : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);} - | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);} - ; - -RangeTypeKeyword - : PARSEOP_RANGETYPE_ISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ISAONLY);} - | PARSEOP_RANGETYPE_NONISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_NONISAONLY);} - | PARSEOP_RANGETYPE_ENTIRE {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);} - ; - -MemTypeKeyword - : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);} - | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);} - | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);} - | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);} - ; - -OptionalReadWriteKeyword - : {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} - | PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} - | PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);} - ; - -InterruptTypeKeyword - : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);} - | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);} - ; - -InterruptLevel - : PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);} - | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);} - ; - -ShareTypeKeyword - : PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);} - | PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);} - ; - -IODecodeKeyword - : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);} - | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);} - ; - -TypeKeyword - : PARSEOP_TYPE_TRANSLATION {$$ = TrCreateLeafNode (PARSEOP_TYPE_TRANSLATION);} - | PARSEOP_TYPE_STATIC {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);} - ; - -TranslationKeyword - : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);} - | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);} - ; - -AddressKeyword - : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);} - | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);} - | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);} - | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);} - ; - - -/******* Miscellaneous Types **************************************************/ - - -SuperName - : NameString {} - | ArgTerm {} - | LocalTerm {} - | DebugTerm {} - | Type6Opcode {} -/* | UserTerm {} */ /* Caused reduce/reduce with Type6Opcode->UserTerm */ - ; - -ArgTerm - : PARSEOP_ARG0 {$$ = TrCreateLeafNode (PARSEOP_ARG0);} - | PARSEOP_ARG1 {$$ = TrCreateLeafNode (PARSEOP_ARG1);} - | PARSEOP_ARG2 {$$ = TrCreateLeafNode (PARSEOP_ARG2);} - | PARSEOP_ARG3 {$$ = TrCreateLeafNode (PARSEOP_ARG3);} - | PARSEOP_ARG4 {$$ = TrCreateLeafNode (PARSEOP_ARG4);} - | PARSEOP_ARG5 {$$ = TrCreateLeafNode (PARSEOP_ARG5);} - | PARSEOP_ARG6 {$$ = TrCreateLeafNode (PARSEOP_ARG6);} - ; - -LocalTerm - : PARSEOP_LOCAL0 {$$ = TrCreateLeafNode (PARSEOP_LOCAL0);} - | PARSEOP_LOCAL1 {$$ = TrCreateLeafNode (PARSEOP_LOCAL1);} - | PARSEOP_LOCAL2 {$$ = TrCreateLeafNode (PARSEOP_LOCAL2);} - | PARSEOP_LOCAL3 {$$ = TrCreateLeafNode (PARSEOP_LOCAL3);} - | PARSEOP_LOCAL4 {$$ = TrCreateLeafNode (PARSEOP_LOCAL4);} - | PARSEOP_LOCAL5 {$$ = TrCreateLeafNode (PARSEOP_LOCAL5);} - | PARSEOP_LOCAL6 {$$ = TrCreateLeafNode (PARSEOP_LOCAL6);} - | PARSEOP_LOCAL7 {$$ = TrCreateLeafNode (PARSEOP_LOCAL7);} - ; - -DebugTerm - : PARSEOP_DEBUG {$$ = TrCreateLeafNode (PARSEOP_DEBUG);} - ; - - -ByteConst - : Integer {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - ; - -WordConst - : Integer {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - ; - -DWordConst - : Integer {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - ; - -QWordConst - : Integer {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - ; - -Integer - : PARSEOP_INTEGER {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, AslCompilerlval.i);} - ; - -String - : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (ACPI_NATIVE_INT) AslCompilerlval.s);} - ; - -ConstTerm - : ConstExprTerm {} - | PARSEOP_REVISION {$$ = TrCreateLeafNode (PARSEOP_REVISION);} - ; - -ByteConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - | ByteConst {} - ; - -WordConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - | WordConst {} - ; - -DWordConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - | DWordConst {} - ; - -QWordConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - | QWordConst {} - ; - -ConstExprTerm - : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);} - | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);} - | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);} - ; - -/* OptionalCount must appear before ByteList or an incorrect reduction will result */ - -OptionalCount - : {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */ - | ',' {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */ - | ',' TermArg {$$ = $2;} - ; - - -BufferTerm - : PARSEOP_BUFFER '(' {$$ = TrCreateLeafNode (PARSEOP_BUFFER);} - OptionalTermArg - ')' '{' - BufferTermData '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_BUFFER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -BufferTermData - : ByteList {} - | StringData {} - ; - -ByteList - : {$$ = NULL;} - | ByteConstExpr - | ByteList ',' /* Allows a trailing comma at list end */ - | ByteList ',' - ByteConstExpr {$$ = TrLinkPeerNode ($1,$3);} - ; - -DWordList - : {$$ = NULL;} - | DWordConstExpr - | DWordList ',' /* Allows a trailing comma at list end */ - | DWordList ',' - DWordConstExpr {$$ = TrLinkPeerNode ($1,$3);} - ; - -PackageTerm - : PARSEOP_PACKAGE '(' {$$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);} - VarPackageLengthTerm - ')' '{' - PackageList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_PACKAGE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -VarPackageLengthTerm - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | TermArg {$$ = $1;} - ; - -PackageList - : {$$ = NULL;} - | PackageElement - | PackageList ',' /* Allows a trailing comma at list end */ - | PackageList ',' - PackageElement {$$ = TrLinkPeerNode ($1,$3);} - ; - -PackageElement - : DataObject {} - | NameString {} - ; - -EISAIDTerm - : PARSEOP_EISAID '(' - StringData ')' {$$ = TrUpdateNode (PARSEOP_EISAID, $3);} - | PARSEOP_EISAID '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Resources and Memory ***********************************************/ - - -/* - * Note: Create two default nodes to allow conversion to a Buffer AML opcode - * Also, insert the EndTag at the end of the template. - */ -ResourceTemplateTerm - : PARSEOP_RESOURCETEMPLATE '(' ')' - '{' - ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,4, - TrCreateLeafNode (PARSEOP_DEFAULT_ARG), - TrCreateLeafNode (PARSEOP_DEFAULT_ARG), - $5, - TrCreateLeafNode (PARSEOP_ENDTAG));} - ; - -UnicodeTerm - : PARSEOP_UNICODE '(' {$$ = TrCreateLeafNode (PARSEOP_UNICODE);} - StringData - ')' {$$ = TrLinkChildren ($3,2,0,$4);} - | PARSEOP_UNICODE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ResourceMacroList - : {$$ = NULL;} - | ResourceMacroList - ResourceMacroTerm {$$ = TrLinkPeerNode ($1,$2);} - ; - -ResourceMacroTerm - : DMATerm {} - | DWordIOTerm {} - | DWordMemoryTerm {} - | DWordSpaceTerm {} - | EndDependentFnTerm {} - | ExtendedIOTerm {} - | ExtendedMemoryTerm {} - | ExtendedSpaceTerm {} - | FixedIOTerm {} - | InterruptTerm {} - | IOTerm {} - | IRQNoFlagsTerm {} - | IRQTerm {} - | Memory24Term {} - | Memory32FixedTerm {} - | Memory32Term {} - | QWordIOTerm {} - | QWordMemoryTerm {} - | QWordSpaceTerm {} - | RegisterTerm {} - | StartDependentFnTerm {} - | StartDependentFnNoPriTerm {} - | VendorLongTerm {} - | VendorShortTerm {} - | WordBusNumberTerm {} - | WordIOTerm {} - | WordSpaceTerm {} - ; - -DMATerm - : PARSEOP_DMA '(' {$$ = TrCreateLeafNode (PARSEOP_DMA);} - DMATypeKeyword - OptionalBusMasterKeyword - ',' XferTypeKeyword - OptionalNameString_Last - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($3,5,$4,$5,$7,$8,$11);} - | PARSEOP_DMA '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DWordIOTerm - : PARSEOP_DWORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} - | PARSEOP_DWORDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DWordMemoryTerm - : PARSEOP_DWORDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDMEMORY);} - OptionalResourceType_First - OptionalDecodeType - OptionalMinType - OptionalMaxType - OptionalMemType - ',' OptionalReadWriteKeyword - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalAddressRange - OptionalType_Last - ')' {$$ = TrLinkChildren ($3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} - | PARSEOP_DWORDMEMORY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DWordSpaceTerm - : PARSEOP_DWORDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} - | PARSEOP_DWORDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -EndDependentFnTerm - : PARSEOP_ENDDEPENDENTFN '(' - ')' {$$ = TrCreateLeafNode (PARSEOP_ENDDEPENDENTFN);} - | PARSEOP_ENDDEPENDENTFN '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ExtendedIOTerm - : PARSEOP_EXTENDEDIO '(' {$$ = TrCreateLeafNode (PARSEOP_EXTENDEDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalQWordConstExpr - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($3,14,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22);} - | PARSEOP_EXTENDEDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ExtendedMemoryTerm - : PARSEOP_EXTENDEDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_EXTENDEDMEMORY);} - OptionalResourceType_First - OptionalDecodeType - OptionalMinType - OptionalMaxType - OptionalMemType - ',' OptionalReadWriteKeyword - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalQWordConstExpr - OptionalNameString - OptionalAddressRange - OptionalType_Last - ')' {$$ = TrLinkChildren ($3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24);} - | PARSEOP_EXTENDEDMEMORY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ExtendedSpaceTerm - : PARSEOP_EXTENDEDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_EXTENDEDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalQWordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,13,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23);} - | PARSEOP_EXTENDEDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FixedIOTerm - : PARSEOP_FIXEDIO '(' {$$ = TrCreateLeafNode (PARSEOP_FIXEDIO);} - WordConstExpr - ',' ByteConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,3,$4,$6,$7);} - | PARSEOP_FIXEDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -InterruptTerm - : PARSEOP_INTERRUPT '(' {$$ = TrCreateLeafNode (PARSEOP_INTERRUPT);} - OptionalResourceType_First - ',' InterruptTypeKeyword - ',' InterruptLevel - OptionalShareType - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' '{' - DWordList '}' {$$ = TrLinkChildren ($3,8,$4,$6,$8,$9,$10,$11,$12,$15);} - | PARSEOP_INTERRUPT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IOTerm - : PARSEOP_IO '(' {$$ = TrCreateLeafNode (PARSEOP_IO);} - IODecodeKeyword - ',' WordConstExpr - ',' WordConstExpr - ',' ByteConstExpr - ',' ByteConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,6,$4,$6,$8,$10,$12,$13);} - | PARSEOP_IO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IRQNoFlagsTerm - : PARSEOP_IRQNOFLAGS '(' {$$ = TrCreateLeafNode (PARSEOP_IRQNOFLAGS);} - OptionalNameString_First - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_IRQNOFLAGS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IRQTerm - : PARSEOP_IRQ '(' {$$ = TrCreateLeafNode (PARSEOP_IRQ);} - InterruptTypeKeyword - ',' InterruptLevel - OptionalShareType - OptionalNameString_Last - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($3,5,$4,$6,$7,$8,$11);} - | PARSEOP_IRQ '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -Memory24Term - : PARSEOP_MEMORY24 '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY24);} - OptionalReadWriteKeyword - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,6,$4,$6,$8,$10,$12,$13);} - | PARSEOP_MEMORY24 '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -Memory32FixedTerm - : PARSEOP_MEMORY32FIXED '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY32FIXED);} - OptionalReadWriteKeyword - ',' DWordConstExpr - ',' DWordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,4,$4,$6,$8,$9);} - | PARSEOP_MEMORY32FIXED '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -Memory32Term - : PARSEOP_MEMORY32 '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY32);} - OptionalReadWriteKeyword - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,6,$4,$6,$8,$10,$12,$13);} - | PARSEOP_MEMORY32 '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -QWordIOTerm - : PARSEOP_QWORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} - | PARSEOP_QWORDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -QWordMemoryTerm - : PARSEOP_QWORDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDMEMORY);} - OptionalResourceType_First - OptionalDecodeType - OptionalMinType - OptionalMaxType - OptionalMemType - ',' OptionalReadWriteKeyword - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalAddressRange - OptionalType_Last - ')' {$$ = TrLinkChildren ($3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} - | PARSEOP_QWORDMEMORY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -QWordSpaceTerm - : PARSEOP_QWORDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} - | PARSEOP_QWORDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -RegisterTerm - : PARSEOP_REGISTER '(' {$$ = TrCreateLeafNode (PARSEOP_REGISTER);} - AddressSpaceKeyword - ',' ByteConstExpr - ',' ByteConstExpr - ',' QWordConstExpr - OptionalAccessSize - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,6,$4,$6,$8,$10,$11,$12);} - | PARSEOP_REGISTER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StartDependentFnTerm - : PARSEOP_STARTDEPENDENTFN '(' {$$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN);} - ByteConstExpr - ',' ByteConstExpr - ')' '{' - ResourceMacroList '}' {$$ = TrLinkChildren ($3,3,$4,$6,$9);} - | PARSEOP_STARTDEPENDENTFN '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StartDependentFnNoPriTerm - : PARSEOP_STARTDEPENDENTFN_NOPRI '(' {$$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);} - ')' '{' - ResourceMacroList '}' {$$ = TrLinkChildren ($3,1,$6);} - | PARSEOP_STARTDEPENDENTFN_NOPRI '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -VendorLongTerm - : PARSEOP_VENDORLONG '(' {$$ = TrCreateLeafNode (PARSEOP_VENDORLONG);} - OptionalNameString_First - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_VENDORLONG '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -VendorShortTerm - : PARSEOP_VENDORSHORT '(' {$$ = TrCreateLeafNode (PARSEOP_VENDORSHORT);} - OptionalNameString_First - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_VENDORSHORT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WordBusNumberTerm - : PARSEOP_WORDBUSNUMBER '(' {$$ = TrCreateLeafNode (PARSEOP_WORDBUSNUMBER);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,12,$4,$5,$6,$7,$9,$11,$13,$15,$17,$18,$19,$20);} - | PARSEOP_WORDBUSNUMBER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WordIOTerm - : PARSEOP_WORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_WORDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} - | PARSEOP_WORDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WordSpaceTerm - : PARSEOP_WORDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_WORDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} - | PARSEOP_WORDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Object References ***********************************************/ - -/* Allow IO, DMA, IRQ Resource macro names to also be used as identifiers */ - -NameString - : NameSeg {} - | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);} - | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");} - | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");} - | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");} - ; - -NameSeg - : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) AslCompilerlval.s);} - ; - - -/******* Helper rules ****************************************************/ - - -AmlPackageLengthTerm - : Integer {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,(ACPI_PARSE_OBJECT *) $1);} - ; - -OptionalBusMasterKeyword - : ',' {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} - | ',' PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} - | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_NOTMASTER);} - ; - -OptionalAccessAttribTerm - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ByteConstExpr {$$ = $2;} - | ',' AccessAttribKeyword {$$ = $2;} - ; - -OptionalAccessSize - : {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);} - | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);} - | ',' ByteConstExpr {$$ = $2;} - ; - -OptionalAddressRange - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' AddressKeyword {$$ = $2;} - ; - -OptionalByteConstExpr - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ByteConstExpr {$$ = $2;} - ; - -OptionalDecodeType - : ',' {$$ = NULL;} - | ',' DecodeKeyword {$$ = $2;} - ; - -OptionalDWordConstExpr - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' DWordConstExpr {$$ = $2;} - ; - -OptionalListString - : {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ - | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ - | ',' TermArg {$$ = $2;} - ; - -OptionalMaxType - : ',' {$$ = NULL;} - | ',' MaxKeyword {$$ = $2;} - ; - -OptionalMemType - : ',' {$$ = NULL;} - | ',' MemTypeKeyword {$$ = $2;} - ; - -OptionalMinType - : ',' {$$ = NULL;} - | ',' MinKeyword {$$ = $2;} - ; - -OptionalNameString - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' NameString {$$ = $2;} - ; - -OptionalNameString_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' NameString {$$ = $2;} - ; - -OptionalNameString_First - : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} - | NameString {$$ = $1;} - ; - -OptionalObjectTypeKeyword - : {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} - | ',' ObjectTypeKeyword {$$ = $2;} - ; - -OptionalQWordConstExpr - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' QWordConstExpr {$$ = $2;} - ; - -OptionalRangeType - : ',' {$$ = NULL;} - | ',' RangeTypeKeyword {$$ = $2;} - ; - -OptionalReference - : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ - | ',' {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ - | ',' TermArg {$$ = $2;} - ; - -OptionalResourceType_First - : {$$ = NULL;} - | ResourceTypeKeyword {$$ = $1;} - ; - -OptionalResourceType - : ',' {$$ = NULL;} - | ',' ResourceTypeKeyword {$$ = $2;} - ; - -OptionalSerializeRuleKeyword - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' SerializeRuleKeyword {$$ = $2;} - ; - -OptionalShareType - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ShareTypeKeyword {$$ = $2;} - ; - -OptionalStringData - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' StringData {$$ = $2;} - ; - -OptionalTermArg - : {$$ = NULL;} - | TermArg {$$ = $1;} - ; - -OptionalReturnArg - : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ - | TermArg {$$ = $1;} - ; - -OptionalType - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TypeKeyword {$$ = $2;} - ; - -OptionalType_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TypeKeyword {$$ = $2;} - ; - -OptionalTranslationType_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TranslationKeyword {$$ = $2;} - ; - - -TermArgItem - : ',' TermArg {$$ = $2;} - | ',' error {$$ = AslDoError (); yyclearin;} - ; - -NameStringItem - : ',' NameString {$$ = $2;} - | ',' error {$$ = AslDoError (); yyclearin;} - ; - - -%% - - -/* - * Local support functions - */ - -int -AslCompilerwrap(void) -{ - return 1; -} - -/*! [End] no source code translation !*/ - -void * -AslLocalAllocate (unsigned int Size) -{ - void *Mem; - - - DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %d\n\n", Size); - - Mem = ACPI_ALLOCATE_ZEROED (Size); - if (!Mem) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - exit (1); - } - - return (Mem); -} - -ACPI_PARSE_OBJECT * -AslDoError (void) -{ - - - return (TrCreateLeafNode (PARSEOP_ERRORNODE)); - -} diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asldefine.h b/src/add-ons/kernel/bus_managers/acpi/compiler/asldefine.h deleted file mode 100644 index cff4ecf410..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asldefine.h +++ /dev/null @@ -1,210 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asldefine.h - Common defines for the iASL compiler - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#ifndef __ASLDEFINE_H -#define __ASLDEFINE_H - - -/* - * Compiler versions and names - */ -#define CompilerCreatorRevision ACPI_CA_VERSION - -#define IntelAcpiCA "Intel ACPI Component Architecture" -#define CompilerId "ASL Optimizing Compiler" -#define DisassemblerId "AML Disassembler" -#define CompilerCopyright "Copyright (c) 2000 - 2010 Intel Corporation" -#define CompilerCompliance "Supports ACPI Specification Revision 4.0a" -#define CompilerName "iasl" -#define CompilerCreatorId "INTL" - - -/* Configuration constants */ - -#define ASL_MAX_ERROR_COUNT 200 -#define ASL_NODE_CACHE_SIZE 1024 -#define ASL_STRING_CACHE_SIZE 32768 - -#define ASL_FIRST_PARSE_OPCODE PARSEOP_ACCESSAS -#define ASL_YYTNAME_START 3 - -#define ASL_PARSE_OPCODE_BASE PARSEOP_ACCESSAS /* First Lex type */ - - -/* - * Macros - */ -#define ASL_RESDESC_OFFSET(m) ACPI_OFFSET (AML_RESOURCE, m) -#define ASL_PTR_DIFF(a,b) ((UINT8 *)(b) - (UINT8 *)(a)) -#define ASL_PTR_ADD(a,b) ((UINT8 *)(a) = ((UINT8 *)(a) + (b))) -#define ASL_GET_CHILD_NODE(a) (a)->Asl.Child -#define ASL_GET_PEER_NODE(a) (a)->Asl.Next -#define OP_TABLE_ENTRY(a,b,c,d) {b,d,a,c} - - -/* Internal AML opcodes */ - -#define AML_RAW_DATA_BYTE (UINT16) 0xAA01 /* write one raw byte */ -#define AML_RAW_DATA_WORD (UINT16) 0xAA02 /* write 2 raw bytes */ -#define AML_RAW_DATA_DWORD (UINT16) 0xAA04 /* write 4 raw bytes */ -#define AML_RAW_DATA_QWORD (UINT16) 0xAA08 /* write 8 raw bytes */ -#define AML_RAW_DATA_BUFFER (UINT16) 0xAA0B /* raw buffer with length */ -#define AML_RAW_DATA_CHAIN (UINT16) 0xAA0C /* chain of raw buffers */ -#define AML_PACKAGE_LENGTH (UINT16) 0xAA10 -#define AML_UNASSIGNED_OPCODE (UINT16) 0xEEEE -#define AML_DEFAULT_ARG_OP (UINT16) 0xDDDD - - -/* filename suffixes for output files */ - -#define FILE_SUFFIX_AML_CODE "aml" -#define FILE_SUFFIX_LISTING "lst" -#define FILE_SUFFIX_HEX_DUMP "hex" -#define FILE_SUFFIX_DEBUG "txt" -#define FILE_SUFFIX_SOURCE "src" -#define FILE_SUFFIX_NAMESPACE "nsp" -#define FILE_SUFFIX_ASM_SOURCE "asm" -#define FILE_SUFFIX_C_SOURCE "c" -#define FILE_SUFFIX_DISASSEMBLY "dsl" -#define FILE_SUFFIX_ASM_INCLUDE "inc" -#define FILE_SUFFIX_C_INCLUDE "h" - - -/* Misc */ - -#define ASL_EXTERNAL_METHOD 255 -#define ASL_ABORT TRUE -#define ASL_NO_ABORT FALSE - - -/* Support for reserved method names */ - -#define ACPI_VALID_RESERVED_NAME_MAX 0x80000000 -#define ACPI_NOT_RESERVED_NAME ACPI_UINT32_MAX -#define ACPI_PREDEFINED_NAME (ACPI_UINT32_MAX - 1) -#define ACPI_EVENT_RESERVED_NAME (ACPI_UINT32_MAX - 2) -#define ACPI_COMPILER_RESERVED_NAME (ACPI_UINT32_MAX - 3) - - -/* String to Integer conversion */ - -#define NEGATIVE 1 -#define POSITIVE 0 - - -#endif /* ASLDEFINE.H */ - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslerror.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslerror.c deleted file mode 100644 index f90df3807f..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslerror.c +++ /dev/null @@ -1,670 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslerror - Error handling and statistics - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define ASL_EXCEPTIONS -#include "aslcompiler.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslerror") - -/* Local prototypes */ - -static void -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 - * - * PARAMETERS: Enode - An error node to add to the log - * - * RETURN: None - * - * DESCRIPTION: Add a new error node to the error log. The error log is - * ordered by the "logical" line number (cumulative line number - * including all include files.) - * - ******************************************************************************/ - -static void -AeAddToErrorLog ( - ASL_ERROR_MSG *Enode) -{ - ASL_ERROR_MSG *Next; - ASL_ERROR_MSG *Prev; - - - /* If Gbl_ErrorLog is null, this is the first error node */ - - if (!Gbl_ErrorLog) - { - Gbl_ErrorLog = Enode; - return; - } - - /* - * Walk error list until we find a line number greater than ours. - * List is sorted according to line number. - */ - Prev = NULL; - Next = Gbl_ErrorLog; - - while ((Next) && - (Next->LogicalLineNumber <= Enode->LogicalLineNumber)) - { - Prev = Next; - Next = Next->Next; - } - - /* Found our place in the list */ - - Enode->Next = Next; - - if (Prev) - { - Prev->Next = Enode; - } - else - { - Gbl_ErrorLog = Enode; - } -} - - -/******************************************************************************* - * - * FUNCTION: AePrintException - * - * PARAMETERS: FileId - ID of output file - * Enode - Error node to print - * Header - Additional text before each message - * - * RETURN: None - * - * DESCRIPTION: Print the contents of an error node. - * - * NOTE: We don't use the FlxxxFile I/O functions here because on error - * they abort the compiler and call this function! Since we - * are reporting errors here, we ignore most output errors and - * just try to get out as much as we can. - * - ******************************************************************************/ - -void -AePrintException ( - UINT32 FileId, - ASL_ERROR_MSG *Enode, - char *Header) -{ - UINT8 SourceByte; - int Actual; - size_t RActual; - UINT32 MsgLength; - char *MainMessage; - char *ExtraMessage; - UINT32 SourceColumn; - UINT32 ErrorColumn; - FILE *OutputFile; - FILE *SourceFile; - - - if (Gbl_NoErrors) - { - return; - } - - /* - * Only listing files have a header, and remarks/optimizations - * are always output - */ - if (!Header) - { - /* Ignore remarks if requested */ - - switch (Enode->Level) - { - case ASL_REMARK: - if (!Gbl_DisplayRemarks) - { - return; - } - break; - - case ASL_OPTIMIZATION: - if (!Gbl_DisplayOptimizations) - { - return; - } - break; - - default: - break; - } - } - - /* Get the file handles */ - - OutputFile = Gbl_Files[FileId].Handle; - SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; - - if (Header) - { - fprintf (OutputFile, "%s", Header); - } - - /* Print filename and line number if present and valid */ - - if (Enode->Filename) - { - if (Gbl_VerboseErrors) - { - fprintf (OutputFile, "%6s", Enode->Filename); - - if (Enode->LineNumber) - { - fprintf (OutputFile, "%6u: ", Enode->LineNumber); - - /* - * Seek to the offset in the combined source file, read the source - * line, and write it to the output. - */ - Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, - (int) SEEK_SET); - if (Actual) - { - fprintf (OutputFile, - "[*** iASL: Seek error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - else - { - RActual = fread (&SourceByte, 1, 1, SourceFile); - if (!RActual) - { - fprintf (OutputFile, - "[*** iASL: Read error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - - else while (RActual && SourceByte && (SourceByte != '\n')) - { - fwrite (&SourceByte, 1, 1, OutputFile); - RActual = fread (&SourceByte, 1, 1, SourceFile); - } - } - fprintf (OutputFile, "\n"); - } - } - else - { - fprintf (OutputFile, "%s", Enode->Filename); - - if (Enode->LineNumber) - { - fprintf (OutputFile, "(%u) : ", Enode->LineNumber); - } - } - } - - /* NULL message ID, just print the raw message */ - - if (Enode->MessageId == 0) - { - fprintf (OutputFile, "%s\n", Enode->Message); - } - else - { - /* Decode the message ID */ - - fprintf (OutputFile, "%s %4.4d -", - AslErrorLevel[Enode->Level], - Enode->MessageId + ((Enode->Level+1) * 1000)); - - MainMessage = AslMessages[Enode->MessageId]; - ExtraMessage = Enode->Message; - - if (Enode->LineNumber) - { - MsgLength = strlen (MainMessage); - if (MsgLength == 0) - { - MainMessage = Enode->Message; - - MsgLength = strlen (MainMessage); - ExtraMessage = NULL; - } - - if (Gbl_VerboseErrors) - { - SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; - ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; - - if ((MsgLength + ErrorColumn) < (SourceColumn - 1)) - { - fprintf (OutputFile, "%*s%s", - (int) ((SourceColumn - 1) - ErrorColumn), - MainMessage, " ^ "); - } - else - { - fprintf (OutputFile, "%*s %s", - (int) ((SourceColumn - ErrorColumn) + 1), "^", - MainMessage); - } - } - else - { - fprintf (OutputFile, " %s", MainMessage); - } - - /* Print the extra info message if present */ - - if (ExtraMessage) - { - fprintf (OutputFile, " (%s)", ExtraMessage); - } - - fprintf (OutputFile, "\n"); - if (Gbl_VerboseErrors) - { - fprintf (OutputFile, "\n"); - } - } - else - { - fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AePrintErrorLog - * - * PARAMETERS: FileId - Where to output the error log - * - * RETURN: None - * - * DESCRIPTION: Print the entire contents of the error log - * - ******************************************************************************/ - -void -AePrintErrorLog ( - UINT32 FileId) -{ - ASL_ERROR_MSG *Enode = Gbl_ErrorLog; - - - /* Walk the error node list */ - - while (Enode) - { - AePrintException (FileId, Enode, NULL); - Enode = Enode->Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: AslCommonError - * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) - * MessageId - Index into global message buffer - * CurrentLineNumber - Actual file line number - * LogicalLineNumber - Cumulative line number - * LogicalByteOffset - Byte offset in source file - * Column - Column in current line - * Filename - source filename - * ExtraMessage - additional error message - * - * RETURN: None - * - * DESCRIPTION: Create a new error node and add it to the error log - * - ******************************************************************************/ - -void -AslCommonError ( - UINT8 Level, - UINT8 MessageId, - UINT32 CurrentLineNumber, - UINT32 LogicalLineNumber, - UINT32 LogicalByteOffset, - UINT32 Column, - char *Filename, - char *ExtraMessage) -{ - UINT32 MessageSize; - char *MessageBuffer = NULL; - ASL_ERROR_MSG *Enode; - - - Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); - - if (ExtraMessage) - { - /* Allocate a buffer for the message and a new error node */ - - MessageSize = strlen (ExtraMessage) + 1; - MessageBuffer = UtLocalCalloc (MessageSize); - - /* Keep a copy of the extra message */ - - ACPI_STRCPY (MessageBuffer, ExtraMessage); - } - - /* Initialize the error node */ - - if (Filename) - { - Enode->Filename = Filename; - Enode->FilenameLength = strlen (Filename); - if (Enode->FilenameLength < 6) - { - Enode->FilenameLength = 6; - } - } - - Enode->MessageId = MessageId; - Enode->Level = Level; - Enode->LineNumber = CurrentLineNumber; - Enode->LogicalLineNumber = LogicalLineNumber; - Enode->LogicalByteOffset = LogicalByteOffset; - Enode->Column = Column; - Enode->Message = MessageBuffer; - - /* Add the new node to the error node list */ - - AeAddToErrorLog (Enode); - - if (Gbl_DebugFlag) - { - /* stderr is a file, send error to it immediately */ - - AePrintException (ASL_FILE_STDERR, Enode, NULL); - } - - Gbl_ExceptionCount[Level]++; - if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) - { - printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT); - - Gbl_SourceLine = 0; - Gbl_NextError = Gbl_ErrorLog; - CmDoOutputFiles (); - CmCleanupAndExit (); - exit(1); - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AslError - * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) - * MessageId - Index into global message buffer - * Op - Parse node where error happened - * ExtraMessage - additional error message - * - * RETURN: None - * - * DESCRIPTION: Main error reporting routine for the ASL compiler (all code - * except the parser.) - * - ******************************************************************************/ - -void -AslError ( - UINT8 Level, - UINT8 MessageId, - ACPI_PARSE_OBJECT *Op, - char *ExtraMessage) -{ - - switch (Level) - { - case ASL_WARNING2: - case ASL_WARNING3: - if (Gbl_WarningLevel < Level) - { - return; - } - break; - - default: - break; - } - - - if (Op) - { - AslCommonError (Level, MessageId, Op->Asl.LineNumber, - Op->Asl.LogicalLineNumber, - Op->Asl.LogicalByteOffset, - Op->Asl.Column, - Op->Asl.Filename, ExtraMessage); - } - else - { - AslCommonError (Level, MessageId, 0, - 0, 0, 0, NULL, ExtraMessage); - } -} - - -/******************************************************************************* - * - * FUNCTION: AslCoreSubsystemError - * - * PARAMETERS: Op - Parse node where error happened - * Status - The ACPI CA Exception - * ExtraMessage - additional error message - * Abort - TRUE -> Abort compilation - * - * RETURN: None - * - * DESCRIPTION: Error reporting routine for exceptions returned by the ACPI - * CA core subsystem. - * - ******************************************************************************/ - -void -AslCoreSubsystemError ( - ACPI_PARSE_OBJECT *Op, - ACPI_STATUS Status, - char *ExtraMessage, - BOOLEAN Abort) -{ - - sprintf (MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage); - - if (Op) - { - AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Op->Asl.LineNumber, - Op->Asl.LogicalLineNumber, - Op->Asl.LogicalByteOffset, - Op->Asl.Column, - Op->Asl.Filename, MsgBuffer); - } - else - { - AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, 0, - 0, 0, 0, NULL, MsgBuffer); - } - - if (Abort) - { - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: AslCompilererror - * - * PARAMETERS: CompilerMessage - Error message from the parser - * - * RETURN: Status (0 for now) - * - * DESCRIPTION: Report an error situation discovered in a production - * NOTE: don't change the name of this function, it is called - * from the auto-generated parser. - * - ******************************************************************************/ - -int -AslCompilererror ( - char *CompilerMessage) -{ - - AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber, - Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, - Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename, - CompilerMessage); - - return 0; -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslfiles.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslfiles.c deleted file mode 100644 index 8f498a1b9d..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslfiles.c +++ /dev/null @@ -1,1031 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslfiles - file I/O suppoert - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acapps.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslfiles") - -/* Local prototypes */ - -static void -FlOpenFile ( - UINT32 FileId, - char *Filename, - char *Mode); - -FILE * -FlOpenIncludeWithPrefix ( - char *PrefixDir, - char *Filename); - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -ACPI_STATUS -FlParseInputPathname ( - char *InputFilename); -#endif - - -/******************************************************************************* - * - * FUNCTION: AslAbort - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Dump the error log and abort the compiler. Used for serious - * I/O errors - * - ******************************************************************************/ - -void -AslAbort ( - void) -{ - - AePrintErrorLog (ASL_FILE_STDOUT); - if (Gbl_DebugFlag) - { - /* Print error summary to the debug file */ - - AePrintErrorLog (ASL_FILE_STDERR); - } - - exit (1); -} - - -/******************************************************************************* - * - * FUNCTION: FlFileError - * - * PARAMETERS: FileId - Index into file info array - * ErrorId - Index into error message array - * - * RETURN: None - * - * DESCRIPTION: Decode errno to an error message and add the entire error - * to the error log. - * - ******************************************************************************/ - -void -FlFileError ( - UINT32 FileId, - UINT8 ErrorId) -{ - - sprintf (MsgBuffer, "\"%s\" (%s)", Gbl_Files[FileId].Filename, - strerror (errno)); - AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenFile - * - * PARAMETERS: FileId - Index into file info array - * Filename - file pathname to open - * Mode - Open mode for fopen - * - * RETURN: None - * - * DESCRIPTION: Open a file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -static void -FlOpenFile ( - UINT32 FileId, - char *Filename, - char *Mode) -{ - FILE *File; - - - File = fopen (Filename, Mode); - - Gbl_Files[FileId].Filename = Filename; - Gbl_Files[FileId].Handle = File; - - if (!File) - { - FlFileError (FileId, ASL_MSG_OPEN); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlGetFileSize - * - * PARAMETERS: FileId - Index into file info array - * - * RETURN: File Size - * - * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. - * - ******************************************************************************/ - -UINT32 -FlGetFileSize ( - UINT32 FileId) -{ - FILE *fp; - UINT32 FileSize; - - - fp = Gbl_Files[FileId].Handle; - - fseek (fp, 0, SEEK_END); - FileSize = (UINT32) ftell (fp); - fseek (fp, 0, SEEK_SET); - - return (FileSize); -} - - -/******************************************************************************* - * - * FUNCTION: FlReadFile - * - * PARAMETERS: FileId - Index into file info array - * Buffer - Where to place the data - * Length - Amount to read - * - * RETURN: Status. AE_ERROR indicates EOF. - * - * DESCRIPTION: Read data from an open file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -ACPI_STATUS -FlReadFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length) -{ - UINT32 Actual; - - - /* Read and check for error */ - - Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle); - if (Actual != Length) - { - if (feof (Gbl_Files[FileId].Handle)) - { - /* End-of-file, just return error */ - - return (AE_ERROR); - } - - FlFileError (FileId, ASL_MSG_READ); - AslAbort (); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlWriteFile - * - * PARAMETERS: FileId - Index into file info array - * Buffer - Data to write - * Length - Amount of data to write - * - * RETURN: None - * - * DESCRIPTION: Write data to an open file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlWriteFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length) -{ - UINT32 Actual; - - - /* Write and check for error */ - - Actual = fwrite ((char *) Buffer, 1, Length, Gbl_Files[FileId].Handle); - if (Actual != Length) - { - FlFileError (FileId, ASL_MSG_WRITE); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlPrintFile - * - * PARAMETERS: FileId - Index into file info array - * Format - Printf format string - * ... - Printf arguments - * - * RETURN: None - * - * DESCRIPTION: Formatted write to an open file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlPrintFile ( - UINT32 FileId, - char *Format, - ...) -{ - INT32 Actual; - va_list Args; - - - va_start (Args, Format); - - Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args); - va_end (Args); - - if (Actual == -1) - { - FlFileError (FileId, ASL_MSG_WRITE); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlSeekFile - * - * PARAMETERS: FileId - Index into file info array - * Offset - Absolute byte offset in file - * - * RETURN: None - * - * DESCRIPTION: Seek to absolute offset - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlSeekFile ( - UINT32 FileId, - long Offset) -{ - int Error; - - - Error = fseek (Gbl_Files[FileId].Handle, Offset, SEEK_SET); - if (Error) - { - FlFileError (FileId, ASL_MSG_SEEK); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlCloseFile - * - * PARAMETERS: FileId - Index into file info array - * - * RETURN: None - * - * DESCRIPTION: Close an open file. Aborts compiler on error - * - ******************************************************************************/ - -void -FlCloseFile ( - UINT32 FileId) -{ - int Error; - - - if (!Gbl_Files[FileId].Handle) - { - return; - } - - Error = fclose (Gbl_Files[FileId].Handle); - Gbl_Files[FileId].Handle = NULL; - - if (Error) - { - FlFileError (FileId, ASL_MSG_CLOSE); - AslAbort (); - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: FlSetLineNumber - * - * PARAMETERS: Op - Parse node for the LINE asl statement - * - * RETURN: None. - * - * DESCRIPTION: Set the current line number - * - ******************************************************************************/ - -void -FlSetLineNumber ( - ACPI_PARSE_OBJECT *Op) -{ - - Gbl_CurrentLineNumber = (UINT32) Op->Asl.Value.Integer; - Gbl_LogicalLineNumber = (UINT32) Op->Asl.Value.Integer; -} - - -/******************************************************************************* - * - * FUNCTION: FlAddIncludeDirectory - * - * PARAMETERS: Dir - Directory pathname string - * - * RETURN: None - * - * DESCRIPTION: Add a directory the list of include prefix directories. - * - ******************************************************************************/ - -void -FlAddIncludeDirectory ( - char *Dir) -{ - ASL_INCLUDE_DIR *NewDir; - ASL_INCLUDE_DIR *NextDir; - ASL_INCLUDE_DIR *PrevDir = NULL; - UINT32 NeedsSeparator = 0; - size_t DirLength; - - - DirLength = strlen (Dir); - if (!DirLength) - { - return; - } - - /* Make sure that the pathname ends with a path separator */ - - if ((Dir[DirLength-1] != '/') && - (Dir[DirLength-1] != '\\')) - { - NeedsSeparator = 1; - } - - NewDir = ACPI_ALLOCATE_ZEROED (sizeof (ASL_INCLUDE_DIR)); - NewDir->Dir = ACPI_ALLOCATE (DirLength + 1 + NeedsSeparator); - strcpy (NewDir->Dir, Dir); - if (NeedsSeparator) - { - strcat (NewDir->Dir, "/"); - } - - /* - * Preserve command line ordering of -I options by adding new elements - * at the end of the list - */ - NextDir = Gbl_IncludeDirList; - while (NextDir) - { - PrevDir = NextDir; - NextDir = NextDir->Next; - } - - if (PrevDir) - { - PrevDir->Next = NewDir; - } - else - { - Gbl_IncludeDirList = NewDir; - } -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenIncludeWithPrefix - * - * PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero - * length string. - * Filename - The include filename from the source ASL. - * - * RETURN: Valid file descriptor if successful. Null otherwise. - * - * DESCRIPTION: Open an include file and push it on the input file stack. - * - ******************************************************************************/ - -FILE * -FlOpenIncludeWithPrefix ( - char *PrefixDir, - char *Filename) -{ - FILE *IncludeFile; - char *Pathname; - - - /* Build the full pathname to the file */ - - Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1); - - strcpy (Pathname, PrefixDir); - strcat (Pathname, Filename); - - DbgPrint (ASL_PARSE_OUTPUT, "\nAttempt to open include file: path %s\n\n", - Pathname); - - /* Attempt to open the file, push if successful */ - - IncludeFile = fopen (Pathname, "r"); - if (IncludeFile) - { - /* Push the include file on the open input file stack */ - - AslPushInputFileStack (IncludeFile, Pathname); - return (IncludeFile); - } - - ACPI_FREE (Pathname); - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenIncludeFile - * - * PARAMETERS: Op - Parse node for the INCLUDE ASL statement - * - * RETURN: None. - * - * DESCRIPTION: Open an include file and push it on the input file stack. - * - ******************************************************************************/ - -void -FlOpenIncludeFile ( - ACPI_PARSE_OBJECT *Op) -{ - FILE *IncludeFile; - ASL_INCLUDE_DIR *NextDir; - - - /* Op must be valid */ - - if (!Op) - { - AslCommonError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, " - Null parse node"); - - return; - } - - /* - * Flush out the "include ()" statement on this line, start - * the actual include file on the next line - */ - ResetCurrentLineBuffer (); - FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n"); - Gbl_CurrentLineOffset++; - - - /* Attempt to open the include file */ - - /* If the file specifies an absolute path, just open it */ - - if ((Op->Asl.Value.String[0] == '/') || - (Op->Asl.Value.String[0] == '\\') || - (Op->Asl.Value.String[1] == ':')) - { - IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String); - if (!IncludeFile) - { - goto ErrorExit; - } - return; - } - - /* - * The include filename is not an absolute path. - * - * First, search for the file within the "local" directory -- meaning - * the same directory that contains the source file. - * - * Construct the file pathname from the global directory name. - */ - IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String); - if (IncludeFile) - { - return; - } - - /* - * Second, search for the file within the (possibly multiple) directories - * specified by the -I option on the command line. - */ - NextDir = Gbl_IncludeDirList; - while (NextDir) - { - IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String); - if (IncludeFile) - { - return; - } - - NextDir = NextDir->Next; - } - - /* We could not open the include file after trying very hard */ - -ErrorExit: - sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno)); - AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenInputFile - * - * PARAMETERS: InputFilename - The user-specified ASL source file to be - * compiled - * - * RETURN: Status - * - * DESCRIPTION: Open the specified input file, and save the directory path to - * the file so that include files can be opened in - * the same directory. - * - ******************************************************************************/ - -ACPI_STATUS -FlOpenInputFile ( - char *InputFilename) -{ - - /* Open the input ASL file, text mode */ - - FlOpenFile (ASL_FILE_INPUT, InputFilename, "r"); - AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenAmlOutputFile - * - * PARAMETERS: FilenamePrefix - The user-specified ASL source file - * - * RETURN: Status - * - * DESCRIPTION: Create the output filename (*.AML) and open the file. The file - * is created in the same directory as the parent input file. - * - ******************************************************************************/ - -ACPI_STATUS -FlOpenAmlOutputFile ( - char *FilenamePrefix) -{ - char *Filename; - - - /* Output filename usually comes from the ASL itself */ - - Filename = Gbl_Files[ASL_FILE_AML_OUTPUT].Filename; - if (!Filename) - { - /* Create the output AML filename */ - - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_OUTPUT_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - } - - /* Open the output AML file in binary mode */ - - FlOpenFile (ASL_FILE_AML_OUTPUT, Filename, "w+b"); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenMiscOutputFiles - * - * PARAMETERS: FilenamePrefix - The user-specified ASL source file - * - * RETURN: Status - * - * DESCRIPTION: Create and open the various output files needed, depending on - * the command line options - * - ******************************************************************************/ - -ACPI_STATUS -FlOpenMiscOutputFiles ( - char *FilenamePrefix) -{ - char *Filename; - - - /* Create/Open a combined source output file */ - - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* - * Open the source output file, binary mode (so that LF does not get - * expanded to CR/LF on some systems, messing up our seek - * calculations.) - */ - FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b"); - - /* Create/Open a listing output file if asked */ - - if (Gbl_ListingFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_LISTING); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the listing file, text mode */ - - FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_LISTING_OUTPUT); - AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); - } - - /* Create/Open a assembly code source output file if asked */ - - if (Gbl_AsmOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_SOURCE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the assembly code source file, text mode */ - - FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_ASM_SOURCE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_ASM_SOURCE_OUTPUT); - } - - /* Create/Open a C code source output file if asked */ - - if (Gbl_C_OutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_SOURCE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the C code source file, text mode */ - - FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+"); - - FlPrintFile (ASL_FILE_C_SOURCE_OUTPUT, "/*\n"); - AslCompilerSignon (ASL_FILE_C_SOURCE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_C_SOURCE_OUTPUT); - } - - /* Create/Open a assembly include output file if asked */ - - if (Gbl_AsmIncludeOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_INCLUDE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the assembly include file, text mode */ - - FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_ASM_INCLUDE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_ASM_INCLUDE_OUTPUT); - } - - /* Create/Open a C include output file if asked */ - - if (Gbl_C_IncludeOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_INCLUDE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the C include file, text mode */ - - FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+"); - - FlPrintFile (ASL_FILE_C_INCLUDE_OUTPUT, "/*\n"); - AslCompilerSignon (ASL_FILE_C_INCLUDE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_C_INCLUDE_OUTPUT); - } - - /* Create/Open a hex output file if asked */ - - if (Gbl_HexOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the hex file, text mode */ - - FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_HEX_OUTPUT); - AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT); - } - - /* Create a namespace output file if asked */ - - if (Gbl_NsOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_NAMESPACE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the namespace file, text mode */ - - FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_NAMESPACE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT); - } - - /* Create/Open a debug output file if asked */ - - if (Gbl_DebugFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the debug file as STDERR, text mode */ - - /* TBD: hide this behind a FlReopenFile function */ - - Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename; - Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = - freopen (Filename, "w+t", stderr); - - AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT); - AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT); - } - - return (AE_OK); -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: FlParseInputPathname - * - * PARAMETERS: InputFilename - The user-specified ASL source file to be - * compiled - * - * RETURN: Status - * - * DESCRIPTION: Split the input path into a directory and filename part - * 1) Directory part used to open include files - * 2) Filename part used to generate output filenames - * - ******************************************************************************/ - -ACPI_STATUS -FlParseInputPathname ( - char *InputFilename) -{ - char *Substring; - - - if (!InputFilename) - { - return (AE_OK); - } - - /* Get the path to the input filename's directory */ - - Gbl_DirectoryPath = strdup (InputFilename); - if (!Gbl_DirectoryPath) - { - return (AE_NO_MEMORY); - } - - Substring = strrchr (Gbl_DirectoryPath, '\\'); - if (!Substring) - { - Substring = strrchr (Gbl_DirectoryPath, '/'); - if (!Substring) - { - Substring = strrchr (Gbl_DirectoryPath, ':'); - } - } - - if (!Substring) - { - Gbl_DirectoryPath[0] = 0; - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = strdup (InputFilename); - } - } - else - { - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = strdup (Substring + 1); - } - *(Substring+1) = 0; - } - - return (AE_OK); -} -#endif - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslfold.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslfold.c deleted file mode 100644 index c0644aa2a9..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslfold.c +++ /dev/null @@ -1,563 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslfold - Constant folding - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" -#include "amlcode.h" - -#include "acdispat.h" -#include "acparser.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslfold") - -/* Local prototypes */ - -static ACPI_STATUS -OpcAmlEvaluationWalk1 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -OpcAmlEvaluationWalk2 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -OpcAmlCheckForConstant ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/******************************************************************************* - * - * FUNCTION: OpcAmlEvaluationWalk1 - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for AML execution of constant subtrees - * - ******************************************************************************/ - -static ACPI_STATUS -OpcAmlEvaluationWalk1 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = Context; - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *OutOp; - - - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* Copy child pointer to Arg for compatibility with Interpreter */ - - if (Op->Asl.Child) - { - Op->Common.Value.Arg = Op->Asl.Child; - } - - /* Call AML dispatcher */ - - Status = AcpiDsExecBeginOp (WalkState, &OutOp); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Constant interpretation failed - %s\n", - AcpiFormatException (Status)); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlEvaluationWalk2 - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for AML execution of constant subtrees - * - ******************************************************************************/ - -static ACPI_STATUS -OpcAmlEvaluationWalk2 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = Context; - ACPI_STATUS Status; - - - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* Copy child pointer to Arg for compatibility with Interpreter */ - - if (Op->Asl.Child) - { - Op->Common.Value.Arg = Op->Asl.Child; - } - - /* Call AML dispatcher */ - - Status = AcpiDsExecEndOp (WalkState); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Constant interpretation failed - %s\n", - AcpiFormatException (Status)); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlCheckForConstant - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Check one Op for a type 3/4/5 AML opcode - * - ******************************************************************************/ - -static ACPI_STATUS -OpcAmlCheckForConstant ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = Context; - - - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, "[%.4d] Opcode: %12.12s ", - Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName); - - if (!(WalkState->OpInfo->Flags & AML_CONSTANT)) - { - /* The opcode is not a Type 3/4/5 opcode */ - - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - DbgPrint (ASL_PARSE_OUTPUT, - "**** Valid Target, cannot reduce ****\n"); - } - else - { - DbgPrint (ASL_PARSE_OUTPUT, - "**** Not a Type 3/4/5 opcode ****\n"); - } - - if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL) - { - /* - * We are looking at at normal expression to see if it can be - * reduced. It can't. No error - */ - return (AE_TYPE); - } - - /* - * This is an expression that MUST reduce to a constant, and it - * can't be reduced. This is an error - */ - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op, - Op->Asl.ParseOpName); - } - else - { - AslError (ASL_ERROR, ASL_MSG_INVALID_CONSTANT_OP, Op, - Op->Asl.ParseOpName); - } - - return (AE_TYPE); - } - - /* Debug output */ - - DbgPrint (ASL_PARSE_OUTPUT, "TYPE_345"); - - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - DbgPrint (ASL_PARSE_OUTPUT, " TARGET"); - } - if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG) - { - DbgPrint (ASL_PARSE_OUTPUT, " TERMARG"); - } - DbgPrint (ASL_PARSE_OUTPUT, "\n"); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlConstantWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Reduce an Op and its subtree to a constant if possible - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlConstantWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState; - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PARSE_OBJECT *RootOp; - ACPI_PARSE_OBJECT *OriginalParentOp; - UINT8 WalkType; - - - /* - * Only interested in subtrees that could possibly contain - * expressions that can be evaluated at this time - */ - if ((!(Op->Asl.CompileFlags & NODE_COMPILE_TIME_CONST)) || - (Op->Asl.CompileFlags & NODE_IS_TARGET)) - { - return (AE_OK); - } - - /* Set the walk type based on the reduction used for this op */ - - if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG) - { - /* Op is a TermArg, constant folding is merely optional */ - - if (!Gbl_FoldConstants) - { - return (AE_CTRL_DEPTH); - } - - WalkType = ACPI_WALK_CONST_OPTIONAL; - } - else - { - /* Op is a DataObject, the expression MUST reduced to a constant */ - - WalkType = ACPI_WALK_CONST_REQUIRED; - } - - /* Create a new walk state */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - return AE_NO_MEMORY; - } - - WalkState->NextOp = NULL; - WalkState->Params = NULL; - WalkState->CallerReturnDesc = &ObjDesc; - WalkState->WalkType = WalkType; - - /* - * Examine the entire subtree -- all nodes must be constants - * or type 3/4/5 opcodes - */ - Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD, - OpcAmlCheckForConstant, NULL, WalkState); - - /* - * Did we find an entire subtree that contains all constants and type 3/4/5 - * opcodes? (Only AE_OK or AE_TYPE returned from above) - */ - if (Status == AE_TYPE) - { - /* Subtree cannot be reduced to a constant */ - - if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL) - { - AcpiDsDeleteWalkState (WalkState); - return (AE_OK); - } - - /* Don't descend any further, and use a default "constant" value */ - - Status = AE_CTRL_DEPTH; - } - else - { - /* Subtree can be reduced */ - - /* Allocate a new temporary root for this subtree */ - - RootOp = TrAllocateNode (PARSEOP_INTEGER); - if (!RootOp) - { - return (AE_NO_MEMORY); - } - - RootOp->Common.AmlOpcode = AML_INT_EVAL_SUBTREE_OP; - - OriginalParentOp = Op->Common.Parent; - Op->Common.Parent = RootOp; - - /* Hand off the subtree to the AML interpreter */ - - Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, - OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState); - Op->Common.Parent = OriginalParentOp; - - /* TBD: we really *should* release the RootOp node */ - - if (ACPI_SUCCESS (Status)) - { - TotalFolds++; - - /* Get the final result */ - - Status = AcpiDsResultPop (&ObjDesc, WalkState); - } - } - - if (ACPI_FAILURE (Status)) - { - /* We could not resolve the subtree for some reason */ - - AslCoreSubsystemError (Op, Status, - "Failure during constant evaluation", FALSE); - AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op, - Op->Asl.ParseOpName); - - /* Set the subtree value to ZERO anyway. Eliminates further errors */ - - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Common.Value.Integer = 0; - OpcSetOptimalIntegerSize (Op); - } - else - { - AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op, - Op->Asl.ParseOpName); - - /* - * Because we know we executed type 3/4/5 opcodes above, we know that - * the result must be either an Integer, String, or Buffer. - */ - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Common.Value.Integer = ObjDesc->Integer.Value; - OpcSetOptimalIntegerSize (Op); - - DbgPrint (ASL_PARSE_OUTPUT, - "Constant expression reduced to (INTEGER) %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - - case ACPI_TYPE_STRING: - - Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; - Op->Common.AmlOpcode = AML_STRING_OP; - Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1; - Op->Common.Value.String = ObjDesc->String.Pointer; - - DbgPrint (ASL_PARSE_OUTPUT, - "Constant expression reduced to (STRING) %s\n", - Op->Common.Value.String); - - break; - - - case ACPI_TYPE_BUFFER: - - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Common.AmlOpcode = AML_BUFFER_OP; - Op->Asl.CompileFlags = NODE_AML_PACKAGE; - UtSetParseOpName (Op); - - /* Child node is the buffer length */ - - RootOp = TrAllocateNode (PARSEOP_INTEGER); - - RootOp->Asl.AmlOpcode = AML_DWORD_OP; - RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length; - RootOp->Asl.Parent = Op; - - (void) OpcSetOptimalIntegerSize (RootOp); - - Op->Asl.Child = RootOp; - Op = RootOp; - UtSetParseOpName (Op); - - /* Peer to the child is the raw buffer data */ - - RootOp = TrAllocateNode (PARSEOP_RAW_DATA); - RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - RootOp->Asl.AmlLength = ObjDesc->Buffer.Length; - RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer; - RootOp->Asl.Parent = Op->Asl.Parent; - - Op->Asl.Next = RootOp; - Op = RootOp; - - DbgPrint (ASL_PARSE_OUTPUT, - "Constant expression reduced to (BUFFER) length %X\n", - ObjDesc->Buffer.Length); - break; - - - default: - printf ("Unsupported return type: %s\n", - AcpiUtGetObjectTypeName (ObjDesc)); - break; - } - } - - UtSetParseOpName (Op); - Op->Asl.Child = NULL; - - AcpiDsDeleteWalkState (WalkState); - - return (AE_CTRL_DEPTH); -} - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslglobal.h b/src/add-ons/kernel/bus_managers/acpi/compiler/aslglobal.h deleted file mode 100644 index 85bb3e2d9e..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslglobal.h +++ /dev/null @@ -1,290 +0,0 @@ - - -/****************************************************************************** - * - * Module Name: aslglobal.h - Global variable definitions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#ifndef __ASLGLOBAL_H -#define __ASLGLOBAL_H - - -/* - * Global variables. Defined in aslmain.c only, externed in all other files - */ - -#undef ASL_EXTERN - -#ifdef _DECLARE_GLOBALS -#define ASL_EXTERN -#define ASL_INIT_GLOBAL(a,b) (a)=(b) -#else -#define ASL_EXTERN extern -#define ASL_INIT_GLOBAL(a,b) (a) -#endif - - -/* - * Parser and other externals - */ -extern int yydebug; -extern FILE *AslCompilerin; -extern int AslCompilerdebug; -extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; -extern char *AslCompilertext; -extern char HexLookup[]; - -#define ASL_LINE_BUFFER_SIZE 512 -#define ASL_MSG_BUFFER_SIZE 4096 -#define HEX_TABLE_LINE_SIZE 8 -#define HEX_LISTING_LINE_SIZE 8 - - -/* Source code buffers and pointers for error reporting */ - -ASL_EXTERN char Gbl_CurrentLineBuffer[ASL_LINE_BUFFER_SIZE]; -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, Gbl_CurrentLineBuffer); - - -/* Exception reporting */ - -ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_ErrorLog,NULL); -ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL); - - -/* 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); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING); - - -#define HEX_OUTPUT_NONE 0 -#define HEX_OUTPUT_C 1 -#define HEX_OUTPUT_ASM 2 -#define HEX_OUTPUT_ASL 3 - -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE); - - -/* Files */ - -ASL_EXTERN ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES]; - -ASL_EXTERN char *Gbl_DirectoryPath; -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalFilename, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); -ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); -ASL_EXTERN char *Gbl_CurrentInputFilename; - -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); - - -/* Statistics */ - -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputByteCount, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NsLookupCount, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalKeywords, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalNamedObjects, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalExecutableOpcodes, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalParseNodes, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalMethods, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocations, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocated, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalFolds, 0); - - -/* Misc */ - -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_TempCount, 0); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*RootNode, NULL); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TableLength, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_SourceLine, 0); -ASL_EXTERN ASL_LISTING_NODE ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheNext, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode; - - -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLine, 0); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_HexBytesWereWritten, FALSE); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG"); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID"); -ASL_EXTERN FILE *AcpiGbl_DebugFile; /* Placeholder for oswinxf only */ - - -/* Static structures */ - -ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo; -ASL_EXTERN ACPI_TABLE_HEADER TableHeader; - -/* Event timing */ - -#define ASL_NUM_EVENTS 19 -ASL_EXTERN ASL_EVENT_INFO AslGbl_Events[ASL_NUM_EVENTS]; -ASL_EXTERN UINT8 AslGbl_NextEvent; -ASL_EXTERN UINT8 AslGbl_NamespaceEvent; - -/* Scratch buffers */ - -ASL_EXTERN UINT8 Gbl_AmlBuffer[HEX_LISTING_LINE_SIZE]; -ASL_EXTERN char MsgBuffer[ASL_MSG_BUFFER_SIZE]; -ASL_EXTERN char StringBuffer[ASL_MSG_BUFFER_SIZE]; -ASL_EXTERN char StringBuffer2[ASL_MSG_BUFFER_SIZE]; - - -#ifdef _DECLARE_GLOBALS -UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; -#else -extern UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; -#endif - -#endif /* __ASLGLOBAL_H */ - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asllength.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asllength.c deleted file mode 100644 index 5a9d1ce603..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asllength.c +++ /dev/null @@ -1,530 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asllength - Tree walk to determine package and opcode lengths - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asllength") - -/* Local prototypes */ - -static UINT8 -CgGetPackageLenByteCount ( - ACPI_PARSE_OBJECT *Op, - UINT32 PackageLength); - -static void -CgGenerateAmlOpcodeLength ( - ACPI_PARSE_OBJECT *Op); - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -void -LnAdjustLengthToRoot ( - ACPI_PARSE_OBJECT *Op, - UINT32 LengthDelta); -#endif - - -/******************************************************************************* - * - * FUNCTION: LnInitLengthsWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Walk callback to initialize (and re-initialize) the node - * subtree length(s) to zero. The Subtree lengths are bubbled - * up to the root node in order to get a total AML length. - * - ******************************************************************************/ - -ACPI_STATUS -LnInitLengthsWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - Op->Asl.AmlSubtreeLength = 0; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LnPackageLengthWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Walk callback to calculate the total AML length. - * 1) Calculate the AML lengths (opcode, package length, etc.) for - * THIS node. - * 2) Bubbble up all of these lengths to the parent node by summing - * them all into the parent subtree length. - * - * Note: The SubtreeLength represents the total AML length of all child nodes - * in all subtrees under a given node. Therefore, once this walk is - * complete, the Root Node subtree length is the AML length of the entire - * tree (and thus, the entire ACPI table) - * - ******************************************************************************/ - -ACPI_STATUS -LnPackageLengthWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* Generate the AML lengths for this node */ - - CgGenerateAmlLengths (Op); - - /* Bubble up all lengths (this node and all below it) to the parent */ - - if ((Op->Asl.Parent) && - (Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - Op->Asl.Parent->Asl.AmlSubtreeLength += (Op->Asl.AmlLength + - Op->Asl.AmlOpcodeLength + - Op->Asl.AmlPkgLenBytes + - Op->Asl.AmlSubtreeLength); - } - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: CgGetPackageLenByteCount - * - * PARAMETERS: Op - Parse node - * PackageLength - Length to be encoded - * - * RETURN: Required length of the package length encoding - * - * DESCRIPTION: Calculate the number of bytes required to encode the given - * package length. - * - ******************************************************************************/ - -static UINT8 -CgGetPackageLenByteCount ( - ACPI_PARSE_OBJECT *Op, - UINT32 PackageLength) -{ - - /* - * Determine the number of bytes required to encode the package length - * Note: the package length includes the number of bytes used to encode - * the package length, so we must account for this also. - */ - if (PackageLength <= (0x0000003F - 1)) - { - return (1); - } - else if (PackageLength <= (0x00000FFF - 2)) - { - return (2); - } - else if (PackageLength <= (0x000FFFFF - 3)) - { - return (3); - } - else if (PackageLength <= (0x0FFFFFFF - 4)) - { - return (4); - } - else - { - /* Fatal error - the package length is too large to encode */ - - AslError (ASL_ERROR, ASL_MSG_ENCODING_LENGTH, Op, NULL); - } - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: CgGenerateAmlOpcodeLength - * - * PARAMETERS: Op - Parse node whose AML opcode lengths will be - * calculated - * - * RETURN: None. - * - * DESCRIPTION: Calculate the AmlOpcodeLength, AmlPkgLenBytes, and AmlLength - * fields for this node. - * - ******************************************************************************/ - -static void -CgGenerateAmlOpcodeLength ( - ACPI_PARSE_OBJECT *Op) -{ - - /* Check for two-byte opcode */ - - if (Op->Asl.AmlOpcode > 0x00FF) - { - Op->Asl.AmlOpcodeLength = 2; - } - else - { - Op->Asl.AmlOpcodeLength = 1; - } - - /* Does this opcode have an associated "PackageLength" field? */ - - Op->Asl.AmlPkgLenBytes = 0; - if (Op->Asl.CompileFlags & NODE_AML_PACKAGE) - { - Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount ( - Op, Op->Asl.AmlSubtreeLength); - } - - /* Data opcode lengths are easy */ - - switch (Op->Asl.AmlOpcode) - { - case AML_BYTE_OP: - - Op->Asl.AmlLength = 1; - break; - - case AML_WORD_OP: - - Op->Asl.AmlLength = 2; - break; - - case AML_DWORD_OP: - - Op->Asl.AmlLength = 4; - break; - - case AML_QWORD_OP: - - Op->Asl.AmlLength = 8; - break; - - default: - /* All data opcodes must be above */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: CgGenerateAmlLengths - * - * PARAMETERS: Op - Parse node - * - * RETURN: None. - * - * DESCRIPTION: Generate internal length fields based on the AML opcode or - * parse opcode. - * - ******************************************************************************/ - -void -CgGenerateAmlLengths ( - ACPI_PARSE_OBJECT *Op) -{ - char *Buffer; - ACPI_STATUS Status; - - - switch (Op->Asl.AmlOpcode) - { - case AML_RAW_DATA_BYTE: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 1; - return; - - case AML_RAW_DATA_WORD: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 2; - return; - - case AML_RAW_DATA_DWORD: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 4; - return; - - case AML_RAW_DATA_QWORD: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 8; - return; - - case AML_RAW_DATA_BUFFER: - - /* Aml length is/was set by creator */ - - Op->Asl.AmlOpcodeLength = 0; - return; - - case AML_RAW_DATA_CHAIN: - - /* Aml length is/was set by creator */ - - Op->Asl.AmlOpcodeLength = 0; - return; - - default: - break; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - - Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + - Op->Asl.AmlSubtreeLength; - break; - - case PARSEOP_NAMESEG: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 4; - Op->Asl.ExternalName = Op->Asl.Value.String; - break; - - case PARSEOP_NAMESTRING: - case PARSEOP_METHODCALL: - - if (Op->Asl.CompileFlags & NODE_NAME_INTERNALIZED) - { - break; - } - - Op->Asl.AmlOpcodeLength = 0; - Status = UtInternalizeName (Op->Asl.Value.String, &Buffer); - if (ACPI_FAILURE (Status)) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "Failure from internalize name %X\n", Status); - break; - } - - Op->Asl.ExternalName = Op->Asl.Value.String; - Op->Asl.Value.String = Buffer; - Op->Asl.CompileFlags |= NODE_NAME_INTERNALIZED; - - Op->Asl.AmlLength = strlen (Buffer); - - /* - * Check for single backslash reference to root, - * make it a null terminated string in the AML - */ - if (Op->Asl.AmlLength == 1) - { - Op->Asl.AmlLength = 2; - } - break; - - case PARSEOP_STRING_LITERAL: - - Op->Asl.AmlOpcodeLength = 1; - - /* Get null terminator */ - - Op->Asl.AmlLength = strlen (Op->Asl.Value.String) + 1; - break; - - case PARSEOP_PACKAGE_LENGTH: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op, - (UINT32) Op->Asl.Value.Integer); - break; - - case PARSEOP_RAW_DATA: - - Op->Asl.AmlOpcodeLength = 0; - break; - - case PARSEOP_DEFAULT_ARG: - case PARSEOP_EXTERNAL: - case PARSEOP_INCLUDE: - case PARSEOP_INCLUDE_END: - - /* Ignore the "default arg" nodes, they are extraneous at this point */ - - break; - - default: - - CgGenerateAmlOpcodeLength (Op); - break; - } -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: LnAdjustLengthToRoot - * - * PARAMETERS: Op - Node whose Length was changed - * - * RETURN: None. - * - * DESCRIPTION: Change the Subtree length of the given node, and bubble the - * change all the way up to the root node. This allows for - * last second changes to a package length (for example, if the - * package length encoding gets shorter or longer.) - * - ******************************************************************************/ - -void -LnAdjustLengthToRoot ( - ACPI_PARSE_OBJECT *SubtreeOp, - UINT32 LengthDelta) -{ - ACPI_PARSE_OBJECT *Op; - - - /* Adjust all subtree lengths up to the root */ - - Op = SubtreeOp->Asl.Parent; - while (Op) - { - Op->Asl.AmlSubtreeLength -= LengthDelta; - Op = Op->Asl.Parent; - } - - /* Adjust the global table length */ - - Gbl_TableLength -= LengthDelta; -} -#endif - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asllisting.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asllisting.c deleted file mode 100644 index 93f83ad842..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asllisting.c +++ /dev/null @@ -1,1614 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asllisting - Listing file generation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" -#include "amlcode.h" -#include "acparser.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslisting") - -/* Local prototypes */ - -static void -LsDumpAscii ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer); - -static void -LsDumpAsciiInComment ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer); - -static ACPI_STATUS -LsAmlListingWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static void -LsGenerateListing ( - UINT32 FileId); - -static void -LsPushNode ( - char *Filename); - -static ASL_LISTING_NODE * -LsPopNode ( - void); - -static void -LsCheckException ( - UINT32 LineNumber, - UINT32 FileId); - -static void -LsFlushListingBuffer ( - UINT32 FileId); - -static void -LsWriteListingHexBytes ( - UINT8 *Buffer, - UINT32 Length, - UINT32 FileId); - -static UINT32 -LsWriteOneSourceLine ( - UINT32 FileId); - -static void -LsFinishSourceListing ( - UINT32 FileId); - -static void -LsWriteSourceLines ( - UINT32 ToLineNumber, - UINT32 ToLogicalLineNumber, - UINT32 FileId); - -static void -LsWriteNodeToListing ( - ACPI_PARSE_OBJECT *Op, - UINT32 FileId); - -static void -LsDoHexOutputC ( - void); - -static void -LsDoHexOutputAsm ( - void); - -static void -LsDoHexOutputAsl ( - void); - -ACPI_STATUS -LsTreeWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/******************************************************************************* - * - * FUNCTION: LsTreeWriteWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * - * RETURN: None. - * - * DESCRIPTION: Dump entire parse tree, for compiler debug only - * - ******************************************************************************/ - -ACPI_STATUS -LsTreeWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* Debug output */ - - DbgPrint (ASL_TREE_OUTPUT, - "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); - UtPrintFormattedName (Op->Asl.ParseOpcode, Level); - - - DbgPrint (ASL_TREE_OUTPUT, "\n"); - return (AE_OK); -} - - -void -LsDumpParseTree ( - void) -{ - - if (!Gbl_DebugFlag) - { - return; - } - - DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - LsTreeWriteWalk, NULL, NULL); -} - - -/******************************************************************************* - * - * FUNCTION: LsDumpAscii - * - * PARAMETERS: FileId - ID of current listing file - * Count - Number of bytes to convert - * Buffer - Buffer of bytes to convert - * - * RETURN: None. - * - * DESCRIPTION: Convert hex bytes to ascii - * - ******************************************************************************/ - -static void -LsDumpAscii ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer) -{ - UINT8 BufChar; - UINT32 i; - - - FlPrintFile (FileId, " \""); - for (i = 0; i < Count; i++) - { - BufChar = Buffer[i]; - if (isprint (BufChar)) - { - FlPrintFile (FileId, "%c", BufChar); - } - else - { - /* Not a printable character, just put out a dot */ - - FlPrintFile (FileId, "."); - } - } - FlPrintFile (FileId, "\""); -} - - -/******************************************************************************* - * - * FUNCTION: LsDumpAsciiInComment - * - * PARAMETERS: FileId - ID of current listing file - * Count - Number of bytes to convert - * Buffer - Buffer of bytes to convert - * - * RETURN: None. - * - * DESCRIPTION: Convert hex bytes to ascii - * - ******************************************************************************/ - -static void -LsDumpAsciiInComment ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer) -{ - UINT8 BufChar = 0; - UINT8 LastChar; - UINT32 i; - - - FlPrintFile (FileId, " \""); - for (i = 0; i < Count; i++) - { - LastChar = BufChar; - BufChar = Buffer[i]; - - if (isprint (BufChar)) - { - /* Handle embedded C comment sequences */ - - if (((LastChar == '*') && (BufChar == '/')) || - ((LastChar == '/') && (BufChar == '*'))) - { - /* Insert a space to break the sequence */ - - FlPrintFile (FileId, ".", BufChar); - } - - FlPrintFile (FileId, "%c", BufChar); - } - else - { - /* Not a printable character, just put out a dot */ - - FlPrintFile (FileId, "."); - } - } - FlPrintFile (FileId, "\""); -} - - -/******************************************************************************* - * - * FUNCTION: LsAmlListingWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Process one node during a listing file generation. - * - ******************************************************************************/ - -static ACPI_STATUS -LsAmlListingWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - UINT8 FileByte; - UINT32 i; - UINT32 FileId = (UINT32) ACPI_TO_INTEGER (Context); - - - LsWriteNodeToListing (Op, FileId); - - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DATA) - { - /* Buffer is a resource template, don't dump the data all at once */ - - return (AE_OK); - } - - /* Write the hex bytes to the listing file(s) (if requested) */ - - for (i = 0; i < Op->Asl.FinalAmlLength; i++) - { - if (ACPI_FAILURE (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1))) - { - FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ); - AslAbort (); - } - LsWriteListingHexBytes (&FileByte, 1, FileId); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LsGenerateListing - * - * PARAMETERS: FileId - ID of listing file - * - * RETURN: None - * - * DESCRIPTION: Generate a listing file. This can be one of the several types - * of "listings" supported. - * - ******************************************************************************/ - -static void -LsGenerateListing ( - UINT32 FileId) -{ - - /* Start at the beginning of both the source and AML files */ - - FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - Gbl_SourceLine = 0; - Gbl_CurrentHexColumn = 0; - LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename); - - /* Process all parse nodes */ - - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk, - NULL, (void *) ACPI_TO_POINTER (FileId)); - - /* Final processing */ - - LsFinishSourceListing (FileId); -} - - -/******************************************************************************* - * - * FUNCTION: LsDoListings - * - * PARAMETERS: None. - * - * RETURN: None - * - * DESCRIPTION: Generate all requested listing files. - * - ******************************************************************************/ - -void -LsDoListings ( - void) -{ - - if (Gbl_C_OutputFlag) - { - LsGenerateListing (ASL_FILE_C_SOURCE_OUTPUT); - } - - if (Gbl_ListingFlag) - { - LsGenerateListing (ASL_FILE_LISTING_OUTPUT); - } - - if (Gbl_AsmOutputFlag) - { - LsGenerateListing (ASL_FILE_ASM_SOURCE_OUTPUT); - } - - if (Gbl_C_IncludeOutputFlag) - { - LsGenerateListing (ASL_FILE_C_INCLUDE_OUTPUT); - } - - if (Gbl_AsmIncludeOutputFlag) - { - LsGenerateListing (ASL_FILE_ASM_INCLUDE_OUTPUT); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsPushNode - * - * PARAMETERS: Filename - Pointer to the include filename - * - * RETURN: None - * - * DESCRIPTION: Push a listing node on the listing/include file stack. This - * stack enables tracking of include files (infinitely nested) - * and resumption of the listing of the parent file when the - * include file is finished. - * - ******************************************************************************/ - -static void -LsPushNode ( - char *Filename) -{ - ASL_LISTING_NODE *Lnode; - - - /* Create a new node */ - - Lnode = UtLocalCalloc (sizeof (ASL_LISTING_NODE)); - - /* Initialize */ - - Lnode->Filename = Filename; - Lnode->LineNumber = 0; - - /* Link (push) */ - - Lnode->Next = Gbl_ListingNode; - Gbl_ListingNode = Lnode; -} - - -/******************************************************************************* - * - * FUNCTION: LsPopNode - * - * PARAMETERS: None - * - * RETURN: List head after current head is popped off - * - * DESCRIPTION: Pop the current head of the list, free it, and return the - * next node on the stack (the new current node). - * - ******************************************************************************/ - -static ASL_LISTING_NODE * -LsPopNode ( - void) -{ - ASL_LISTING_NODE *Lnode; - - - /* Just grab the node at the head of the list */ - - Lnode = Gbl_ListingNode; - if ((!Lnode) || - (!Lnode->Next)) - { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, - "Could not pop empty listing stack"); - return Gbl_ListingNode; - } - - Gbl_ListingNode = Lnode->Next; - ACPI_FREE (Lnode); - - /* New "Current" node is the new head */ - - return (Gbl_ListingNode); -} - - -/******************************************************************************* - * - * FUNCTION: LsCheckException - * - * PARAMETERS: LineNumber - Current logical (cumulative) line # - * FileId - ID of output listing file - * - * RETURN: None - * - * DESCRIPTION: Check if there is an exception for this line, and if there is, - * put it in the listing immediately. Handles multiple errors - * per line. Gbl_NextError points to the next error in the - * sorted (by line #) list of compile errors/warnings. - * - ******************************************************************************/ - -static void -LsCheckException ( - UINT32 LineNumber, - UINT32 FileId) -{ - - if ((!Gbl_NextError) || - (LineNumber < Gbl_NextError->LogicalLineNumber )) - { - return; - } - - /* Handle multiple errors per line */ - - if (FileId == ASL_FILE_LISTING_OUTPUT) - { - while (Gbl_NextError && - (LineNumber >= Gbl_NextError->LogicalLineNumber)) - { - AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n"); - - Gbl_NextError = Gbl_NextError->Next; - } - - FlPrintFile (FileId, "\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsFlushListingBuffer - * - * PARAMETERS: FileId - ID of the listing file - * - * RETURN: None - * - * DESCRIPTION: Flush out the current contents of the 16-byte hex AML code - * buffer. Usually called at the termination of a single line - * of source code or when the buffer is full. - * - ******************************************************************************/ - -static void -LsFlushListingBuffer ( - UINT32 FileId) -{ - UINT32 i; - - - if (Gbl_CurrentHexColumn == 0) - { - return; - } - - /* Write the hex bytes */ - - switch (FileId) - { - case ASL_FILE_LISTING_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - FlPrintFile (FileId, "%2.2X ", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 3); i++) - { - FlWriteFile (FileId, ".", 1); - } - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); - break; - - - case ASL_FILE_ASM_SOURCE_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - if (i > 0) - { - FlPrintFile (FileId, ","); - } - FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++) - { - FlWriteFile (FileId, " ", 1); - } - - FlPrintFile (FileId, " ;%8.8X", - Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE); - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); - break; - - - case ASL_FILE_C_SOURCE_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - FlPrintFile (FileId, "0x%2.2X,", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++) - { - FlWriteFile (FileId, " ", 1); - } - - FlPrintFile (FileId, " /* %8.8X", - Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE); - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAsciiInComment (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); - FlPrintFile (FileId, " */"); - break; - - default: - /* No other types supported */ - return; - } - - FlPrintFile (FileId, "\n"); - - Gbl_CurrentHexColumn = 0; - Gbl_HexBytesWereWritten = TRUE; -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteListingHexBytes - * - * PARAMETERS: Buffer - AML code buffer - * Length - Number of AML bytes to write - * FileId - ID of current listing file. - * - * RETURN: None - * - * DESCRIPTION: Write the contents of the AML buffer to the listing file via - * the listing buffer. The listing buffer is flushed every 16 - * AML bytes. - * - ******************************************************************************/ - -static void -LsWriteListingHexBytes ( - UINT8 *Buffer, - UINT32 Length, - UINT32 FileId) -{ - UINT32 i; - - - /* Transfer all requested bytes */ - - for (i = 0; i < Length; i++) - { - /* Print line header when buffer is empty */ - - if (Gbl_CurrentHexColumn == 0) - { - if (Gbl_HasIncludeFiles) - { - FlPrintFile (FileId, "%*s", 10, " "); - } - - switch (FileId) - { - case ASL_FILE_LISTING_OUTPUT: - - FlPrintFile (FileId, "%8.8X....", Gbl_CurrentAmlOffset); - break; - - case ASL_FILE_ASM_SOURCE_OUTPUT: - - FlPrintFile (FileId, " db "); - break; - - case ASL_FILE_C_SOURCE_OUTPUT: - - FlPrintFile (FileId, " "); - break; - - default: - /* No other types supported */ - return; - } - } - - /* Transfer AML byte and update counts */ - - Gbl_AmlBuffer[Gbl_CurrentHexColumn] = Buffer[i]; - - Gbl_CurrentHexColumn++; - Gbl_CurrentAmlOffset++; - - /* Flush buffer when it is full */ - - if (Gbl_CurrentHexColumn >= HEX_LISTING_LINE_SIZE) - { - LsFlushListingBuffer (FileId); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteOneSourceLine - * - * PARAMETERS: FileID - ID of current listing file - * - * RETURN: FALSE on EOF (input source file), TRUE otherwise - * - * DESCRIPTION: Read one line from the input source file and echo it to the - * listing file, prefixed with the line number, and if the source - * file contains include files, prefixed with the current filename - * - ******************************************************************************/ - -static UINT32 -LsWriteOneSourceLine ( - UINT32 FileId) -{ - UINT8 FileByte; - - - Gbl_SourceLine++; - Gbl_ListingNode->LineNumber++; - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " *"); - } - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) - { - FlPrintFile (FileId, "; "); - } - - if (Gbl_HasIncludeFiles) - { - /* - * This file contains "include" statements, print the current - * filename and line number within the current file - */ - FlPrintFile (FileId, "%12s %5d....", - Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber); - } - else - { - /* No include files, just print the line number */ - - FlPrintFile (FileId, "%8d....", Gbl_SourceLine); - } - - /* Read one line (up to a newline or EOF) */ - - while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK) - { - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - if (FileByte == '/') - { - FileByte = '*'; - } - } - - FlWriteFile (FileId, &FileByte, 1); - if (FileByte == '\n') - { - /* - * Check if an error occurred on this source line during the compile. - * If so, we print the error message after the source line. - */ - LsCheckException (Gbl_SourceLine, FileId); - return (1); - } - } - - /* EOF on the input file was reached */ - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: LsFinishSourceListing - * - * PARAMETERS: FileId - ID of current listing file. - * - * RETURN: None - * - * DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML - * listing buffer, and flush out any remaining lines in the - * source input file. - * - ******************************************************************************/ - -static void -LsFinishSourceListing ( - UINT32 FileId) -{ - - if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || - (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) - { - return; - } - - LsFlushListingBuffer (FileId); - Gbl_CurrentAmlOffset = 0; - - /* Flush any remaining text in the source file */ - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " /*\n"); - } - - while (LsWriteOneSourceLine (FileId)) - { ; } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, "\n */\n };\n"); - } - - FlPrintFile (FileId, "\n"); - - if (FileId == ASL_FILE_LISTING_OUTPUT) - { - /* Print a summary of the compile exceptions */ - - FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n"); - AePrintErrorLog (FileId); - FlPrintFile (FileId, "\n\n"); - UtDisplaySummary (FileId); - FlPrintFile (FileId, "\n\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteSourceLines - * - * PARAMETERS: ToLineNumber - - * ToLogicalLineNumber - Write up to this source line number - * FileId - ID of current listing file - * - * RETURN: None - * - * DESCRIPTION: Read then write source lines to the listing file until we have - * reached the specified logical (cumulative) line number. This - * automatically echos out comment blocks and other non-AML - * generating text until we get to the actual AML-generating line - * of ASL code specified by the logical line number. - * - ******************************************************************************/ - -static void -LsWriteSourceLines ( - UINT32 ToLineNumber, - UINT32 ToLogicalLineNumber, - UINT32 FileId) -{ - - if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || - (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) - { - return; - } - - Gbl_CurrentLine = ToLogicalLineNumber; - - /* Flush any hex bytes remaining from the last opcode */ - - LsFlushListingBuffer (FileId); - - /* Read lines and write them as long as we are not caught up */ - - if (Gbl_SourceLine < Gbl_CurrentLine) - { - /* - * If we just completed writing some AML hex bytes, output a linefeed - * to add some whitespace for readability. - */ - if (Gbl_HexBytesWereWritten) - { - FlPrintFile (FileId, "\n"); - Gbl_HexBytesWereWritten = FALSE; - } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " /*\n"); - } - - /* Write one line at a time until we have reached the target line # */ - - while ((Gbl_SourceLine < Gbl_CurrentLine) && - LsWriteOneSourceLine (FileId)) - { ; } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " */"); - } - FlPrintFile (FileId, "\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteNodeToListing - * - * PARAMETERS: Op - Parse node to write to the listing file. - * FileId - ID of current listing file - * - * RETURN: None. - * - * DESCRIPTION: Write "a node" to the listing file. This means to - * 1) Write out all of the source text associated with the node - * 2) Write out all of the AML bytes associated with the node - * 3) Write any compiler exceptions associated with the node - * - ******************************************************************************/ - -static void -LsWriteNodeToListing ( - ACPI_PARSE_OBJECT *Op, - UINT32 FileId) -{ - const ACPI_OPCODE_INFO *OpInfo; - UINT32 OpClass; - char *Pathname; - UINT32 Length; - UINT32 i; - - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - OpClass = OpInfo->Class; - - /* TBD: clean this up with a single flag that says: - * I start a named output block - */ - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - case PARSEOP_METHODCALL: - case PARSEOP_INCLUDE: - case PARSEOP_INCLUDE_END: - case PARSEOP_DEFAULT_ARG: - - break; - - default: - switch (OpClass) - { - case AML_CLASS_NAMED_OBJECT: - switch (Op->Asl.AmlOpcode) - { - case AML_SCOPE_OP: - case AML_ALIAS_OP: - break; - - default: - if (Op->Asl.ExternalName) - { - LsFlushListingBuffer (FileId); - FlPrintFile (FileId, " };\n"); - } - break; - } - break; - - default: - /* Don't care about other objects */ - break; - } - break; - } - } - - /* These cases do not have a corresponding AML opcode */ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - - LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId); - - /* Use the table Signature and TableId to build a unique name */ - - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) - { - FlPrintFile (FileId, - "%s_%s_Header \\\n", - Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, - " unsigned char %s_%s_Header [] =\n {\n", - Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, - "extrn %s_%s_Header : byte\n", - Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, - "extern unsigned char %s_%s_Header [];\n", - Gbl_TableSignature, Gbl_TableId); - } - return; - - - case PARSEOP_METHODCALL: - - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - return; - - - case PARSEOP_INCLUDE: - - /* Flush everything up to and including the include source line */ - - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - - /* Create a new listing node and push it */ - - LsPushNode (Op->Asl.Child->Asl.Value.String); - return; - - - case PARSEOP_INCLUDE_END: - - /* Flush out the rest of the include file */ - - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - - /* Pop off this listing node and go back to the parent file */ - - (void) LsPopNode (); - return; - - - case PARSEOP_DEFAULT_ARG: - - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) - { - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.EndLogicalLine, - FileId); - } - return; - - - default: - /* All other opcodes have an AML opcode */ - break; - } - - /* - * Otherwise, we look at the AML opcode because we can - * switch on the opcode type, getting an entire class - * at once - */ - switch (OpClass) - { - case AML_CLASS_ARGUMENT: /* argument type only */ - case AML_CLASS_INTERNAL: - - break; - - - case AML_CLASS_NAMED_OBJECT: - - switch (Op->Asl.AmlOpcode) - { - case AML_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_BANK_FIELD_OP: - - /* - * For fields, we want to dump all the AML after the - * entire definition - */ - LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, - FileId); - break; - - case AML_NAME_OP: - - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) - { - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - } - else - { - /* - * For fields, we want to dump all the AML after the - * entire definition - */ - LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, - FileId); - } - break; - - default: - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - break; - } - - switch (Op->Asl.AmlOpcode) - { - case AML_SCOPE_OP: - case AML_ALIAS_OP: - - /* These opcodes do not declare a new object, ignore them */ - - break; - - default: - - /* All other named object opcodes come here */ - - switch (FileId) - { - case ASL_FILE_ASM_SOURCE_OUTPUT: - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_ASM_INCLUDE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - - /* - * For named objects, we will create a valid symbol so that the - * AML code can be referenced from C or ASM - */ - if (Op->Asl.ExternalName) - { - /* Get the full pathname associated with this node */ - - Pathname = AcpiNsGetExternalPathname (Op->Asl.Node); - Length = strlen (Pathname); - if (Length >= 4) - { - /* Convert all dots in the path to underscores */ - - for (i = 0; i < Length; i++) - { - if (Pathname[i] == '.') - { - Pathname[i] = '_'; - } - } - - /* Create the appropriate symbol in the output file */ - - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) - { - FlPrintFile (FileId, - "%s_%s_%s \\\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, - " unsigned char %s_%s_%s [] =\n {\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, - "extrn %s_%s_%s : byte\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, - "extern unsigned char %s_%s_%s [];\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - } - ACPI_FREE (Pathname); - } - break; - - default: - /* Nothing to do for listing file */ - break; - } - } - break; - - case AML_CLASS_EXECUTE: - case AML_CLASS_CREATE: - default: - - if ((Op->Asl.ParseOpcode == PARSEOP_BUFFER) && - (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)) - { - return; - } - - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - break; - - case AML_CLASS_UNKNOWN: - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutput - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. - * - ******************************************************************************/ - -void -LsDoHexOutput ( - void) -{ - - switch (Gbl_HexOutputFlag) - { - case HEX_OUTPUT_C: - - LsDoHexOutputC (); - break; - - case HEX_OUTPUT_ASM: - - LsDoHexOutputAsm (); - break; - - case HEX_OUTPUT_ASL: - - LsDoHexOutputAsl (); - break; - - default: - /* No other output types supported */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutputC - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. This is the same data as the AML - * output file, but formatted into hex/ascii bytes suitable for - * inclusion into a C source file. - * - ******************************************************************************/ - -static void -LsDoHexOutputC ( - void) -{ - UINT8 FileData[HEX_TABLE_LINE_SIZE]; - UINT32 LineLength; - UINT32 Offset = 0; - UINT32 AmlFileSize; - UINT32 i; - - - /* Get AML size, seek back to start */ - - AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n"); - FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n", - AmlFileSize); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n"); - - while (Offset < AmlFileSize) - { - /* Read enough bytes needed for one output line */ - - LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); - if (!LineLength) - { - break; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - - for (i = 0; i < LineLength; i++) - { - /* - * Print each hex byte. - * Add a comma until the very last byte of the AML file - * (Some C compilers complain about a trailing comma) - */ - FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]); - if ((Offset + i + 1) < AmlFileSize) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); - } - else - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - } - } - - /* Add fill spaces if needed for last line */ - - if (LineLength < HEX_TABLE_LINE_SIZE) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s", - 5 * (HEX_TABLE_LINE_SIZE - LineLength), " "); - } - - /* Emit the offset and ascii dump for the entire line */ - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset); - LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n", - HEX_TABLE_LINE_SIZE - LineLength + 1, " "); - - Offset += LineLength; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutputAsl - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. This is the same data as the AML - * output file, but formatted into hex/ascii bytes suitable for - * inclusion into a C source file. - * - ******************************************************************************/ - -static void -LsDoHexOutputAsl ( - void) -{ - UINT8 FileData[HEX_TABLE_LINE_SIZE]; - UINT32 LineLength; - UINT32 Offset = 0; - UINT32 AmlFileSize; - UINT32 i; - - - /* Get AML size, seek back to start */ - - AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n"); - FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n", - AmlFileSize); - FlPrintFile (ASL_FILE_HEX_OUTPUT, " Name (BUF1, Buffer()\n {\n"); - - while (Offset < AmlFileSize) - { - /* Read enough bytes needed for one output line */ - - LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); - if (!LineLength) - { - break; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - - for (i = 0; i < LineLength; i++) - { - /* - * Print each hex byte. - * Add a comma until the very last byte of the AML file - * (Some C compilers complain about a trailing comma) - */ - FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]); - if ((Offset + i + 1) < AmlFileSize) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); - } - else - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - } - } - - /* Add fill spaces if needed for last line */ - - if (LineLength < HEX_TABLE_LINE_SIZE) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s", - 5 * (HEX_TABLE_LINE_SIZE - LineLength), " "); - } - - /* Emit the offset and ascii dump for the entire line */ - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset); - LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n", - HEX_TABLE_LINE_SIZE - LineLength + 1, " "); - - Offset += LineLength; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutputAsm - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. This is the same data as the AML - * output file, but formatted into hex/ascii bytes suitable for - * inclusion into a ASM source file. - * - ******************************************************************************/ - -static void -LsDoHexOutputAsm ( - void) -{ - UINT8 FileData[HEX_TABLE_LINE_SIZE]; - UINT32 LineLength; - UINT32 Offset = 0; - UINT32 AmlFileSize; - UINT32 i; - - - /* Get AML size, seek back to start */ - - AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); - - FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n"); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "; AML code block contains 0x%X bytes\n;\n", - AmlFileSize); - - while (Offset < AmlFileSize) - { - /* Read enough bytes needed for one output line */ - - LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); - if (!LineLength) - { - break; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " db "); - - for (i = 0; i < LineLength; i++) - { - /* - * Print each hex byte. - * Add a comma until the last byte of the line - */ - FlPrintFile (ASL_FILE_HEX_OUTPUT, "0%2.2Xh", FileData[i]); - if ((i + 1) < LineLength) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); - } - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - - /* Add fill spaces if needed for last line */ - - if (LineLength < HEX_TABLE_LINE_SIZE) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s", - 5 * (HEX_TABLE_LINE_SIZE - LineLength), " "); - } - - /* Emit the offset and ascii dump for the entire line */ - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset); - LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); - - Offset += LineLength; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslload.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslload.c deleted file mode 100644 index 5e9fa1ba15..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslload.c +++ /dev/null @@ -1,974 +0,0 @@ -/****************************************************************************** - * - * Module Name: dswload - Dispatcher namespace load callbacks - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __ASLLOAD_C__ - -#include "aslcompiler.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acnamesp.h" - -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslload") - -/* Local prototypes */ - -static ACPI_STATUS -LdLoadFieldElements ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState); - -static ACPI_STATUS -LdLoadResourceElements ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState); - -static ACPI_STATUS -LdNamespace1Begin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -LdNamespace2Begin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -LdCommonNamespaceEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/******************************************************************************* - * - * FUNCTION: LdLoadNamespace - * - * PARAMETERS: RootOp - Root of the parse tree - * - * RETURN: Status - * - * DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the - * named ASL/AML objects into the namespace. The namespace is - * constructed in order to resolve named references and references - * to named fields within resource templates/descriptors. - * - ******************************************************************************/ - -ACPI_STATUS -LdLoadNamespace ( - ACPI_PARSE_OBJECT *RootOp) -{ - ACPI_WALK_STATE *WalkState; - - - DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n"); - - /* Create a new walk state */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - return AE_NO_MEMORY; - } - - /* Walk the entire parse tree, first pass */ - - TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace1Begin, - LdCommonNamespaceEnd, WalkState); - - /* Second pass to handle forward references */ - - TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace2Begin, - LdCommonNamespaceEnd, WalkState); - - /* Dump the namespace if debug is enabled */ - - AcpiNsDumpTables (ACPI_NS_ALL, ACPI_UINT32_MAX); - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: LdLoadFieldElements - * - * PARAMETERS: Op - Parent node (Field) - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Enter the named elements of the field (children of the parent) - * into the namespace. - * - ******************************************************************************/ - -static ACPI_STATUS -LdLoadFieldElements ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *Child = NULL; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Get the first named field element */ - - switch (Op->Asl.AmlOpcode) - { - case AML_BANK_FIELD_OP: - - Child = UtGetArg (Op, 6); - break; - - case AML_INDEX_FIELD_OP: - - Child = UtGetArg (Op, 5); - break; - - case AML_FIELD_OP: - - Child = UtGetArg (Op, 4); - break; - - default: - /* No other opcodes should arrive here */ - return (AE_BAD_PARAMETER); - } - - /* Enter all elements into the namespace */ - - while (Child) - { - switch (Child->Asl.AmlOpcode) - { - case AML_INT_RESERVEDFIELD_OP: - case AML_INT_ACCESSFIELD_OP: - - break; - - default: - - Status = AcpiNsLookup (WalkState->ScopeInfo, - Child->Asl.Value.String, - ACPI_TYPE_LOCAL_REGION_FIELD, - ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND, - NULL, &Node); - if (ACPI_FAILURE (Status)) - { - if (Status != AE_ALREADY_EXISTS) - { - AslError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Child, - Child->Asl.Value.String); - return (Status); - } - - /* - * The name already exists in this scope - * But continue processing the elements - */ - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, - Child->Asl.Value.String); - } - else - { - Child->Asl.Node = Node; - Node->Op = Child; - } - break; - } - Child = Child->Asl.Next; - } - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LdLoadResourceElements - * - * PARAMETERS: Op - Parent node (Resource Descriptor) - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Enter the named elements of the resource descriptor (children - * of the parent) into the namespace. - * - * NOTE: In the real AML namespace, these named elements never exist. But - * we simply use the namespace here as a symbol table so we can look - * them up as they are referenced. - * - ******************************************************************************/ - -static ACPI_STATUS -LdLoadResourceElements ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *InitializerOp = NULL; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* - * Enter the resource name into the namespace. Name must not already exist. - * This opens a scope, so later field names are guaranteed to be new/unique. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath, - ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND, - WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_ALREADY_EXISTS) - { - /* Actual node causing the error was saved in ParentMethod */ - - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, - (ACPI_PARSE_OBJECT *) Op->Asl.ParentMethod, Op->Asl.Namepath); - return (AE_OK); - } - return (Status); - } - - Node->Value = (UINT32) Op->Asl.Value.Integer; - Node->Op = Op; - Op->Asl.Node = Node; - - /* - * Now enter the predefined fields, for easy lookup when referenced - * by the source ASL - */ - InitializerOp = ASL_GET_CHILD_NODE (Op); - while (InitializerOp) - { - - if (InitializerOp->Asl.ExternalName) - { - Status = AcpiNsLookup (WalkState->ScopeInfo, - InitializerOp->Asl.ExternalName, - ACPI_TYPE_LOCAL_RESOURCE_FIELD, - ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &Node); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Store the field offset in the namespace node so it - * can be used when the field is referenced - */ - Node->Value = (UINT32) InitializerOp->Asl.Value.Integer; - InitializerOp->Asl.Node = Node; - Node->Op = InitializerOp; - - /* Pass thru the field type (Bitfield or Bytefield) */ - - if (InitializerOp->Asl.CompileFlags & NODE_IS_BIT_OFFSET) - { - Node->Flags |= ANOBJ_IS_BIT_OFFSET; - } - } - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LdNamespace1Begin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the parse tree walk. If this - * is a named AML opcode, enter into the namespace - * - ******************************************************************************/ - -static ACPI_STATUS -LdNamespace1Begin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY; - char *Path; - UINT32 Flags = ACPI_NS_NO_UPSEARCH; - ACPI_PARSE_OBJECT *Arg; - UINT32 i; - BOOLEAN ForceNewScope = FALSE; - - - ACPI_FUNCTION_NAME (LdNamespace1Begin); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", - Op, Op->Asl.ParseOpName)); - - - /* - * We are only interested in opcodes that have an associated name - * (or multiple names) - */ - switch (Op->Asl.AmlOpcode) - { - case AML_BANK_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_FIELD_OP: - - Status = LdLoadFieldElements (Op, WalkState); - return (Status); - - default: - - /* All other opcodes go below */ - break; - } - - /* Check if this object has already been installed in the namespace */ - - if (Op->Asl.Node) - { - return (AE_OK); - } - - Path = Op->Asl.Namepath; - if (!Path) - { - return (AE_OK); - } - - /* Map the raw opcode into an internal object type */ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_NAME: - - Arg = Op->Asl.Child; /* Get the NameSeg/NameString node */ - Arg = Arg->Asl.Next; /* First peer is the object to be associated with the name */ - - /* - * If this name refers to a ResourceTemplate, we will need to open - * a new scope so that the resource subfield names can be entered into - * the namespace underneath this name - */ - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) - { - ForceNewScope = TRUE; - } - - /* Get the data type associated with the named object, not the name itself */ - - /* Log2 loop to convert from Btype (binary) to Etype (encoded) */ - - ObjectType = 1; - for (i = 1; i < Arg->Asl.AcpiBtype; i *= 2) - { - ObjectType++; - } - break; - - - case PARSEOP_EXTERNAL: - - /* - * "External" simply enters a name and type into the namespace. - * We must be careful to not open a new scope, however, no matter - * what type the external name refers to (e.g., a method) - * - * first child is name, next child is ObjectType - */ - ActualObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer; - ObjectType = ACPI_TYPE_ANY; - - /* - * We will mark every new node along the path as "External". This - * allows some or all of the nodes to be created later in the ASL - * code. Handles cases like this: - * - * External (\_SB_.PCI0.ABCD, IntObj) - * Scope (_SB_) - * { - * Device (PCI0) - * { - * } - * } - * Method (X) - * { - * Store (\_SB_.PCI0.ABCD, Local0) - * } - */ - Flags |= ACPI_NS_EXTERNAL; - break; - - case PARSEOP_DEFAULT_ARG: - - if (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC) - { - Status = LdLoadResourceElements (Op, WalkState); - return_ACPI_STATUS (Status); - } - - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - break; - - - case PARSEOP_SCOPE: - - /* - * The name referenced by Scope(Name) must already exist at this point. - * In other words, forward references for Scope() are not supported. - * The only real reason for this is that the MS interpreter cannot - * handle this case. Perhaps someday this case can go away. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - /* The name was not found, go ahead and create it */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, - ACPI_TYPE_LOCAL_SCOPE, - ACPI_IMODE_LOAD_PASS1, Flags, - WalkState, &(Node)); - - /* - * However, this is an error -- primarily because the MS - * interpreter can't handle a forward reference from the - * Scope() operator. - */ - AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, - Op->Asl.ExternalName); - AslError (ASL_ERROR, ASL_MSG_SCOPE_FWD_REF, Op, - Op->Asl.ExternalName); - goto FinishNode; - } - - AslCoreSubsystemError (Op, Status, - "Failure from namespace lookup", FALSE); - - return_ACPI_STATUS (Status); - } - - /* We found a node with this name, now check the type */ - - switch (Node->Type) - { - case ACPI_TYPE_LOCAL_SCOPE: - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - /* These are acceptable types - they all open a new scope */ - break; - - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - /* - * These types we will allow, but we will change the type. - * This enables some existing code of the form: - * - * Name (DEB, 0) - * Scope (DEB) { ... } - * - * Which is used to workaround the fact that the MS interpreter - * does not allow Scope() forward references. - */ - sprintf (MsgBuffer, "%s [%s], changing type to [Scope]", - Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); - - /* Switch the type to scope, open the new scope */ - - Node->Type = ACPI_TYPE_LOCAL_SCOPE; - Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, - WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - break; - - default: - - /* All other types are an error */ - - sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName, - AcpiUtGetTypeName (Node->Type)); - AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); - - /* - * However, switch the type to be an actual scope so - * that compilation can continue without generating a whole - * cascade of additional errors. Open the new scope. - */ - Node->Type = ACPI_TYPE_LOCAL_SCOPE; - Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, - WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - break; - } - - Status = AE_OK; - goto FinishNode; - - - default: - - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - break; - } - - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n", - Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType))); - - /* The name must not already exist */ - - Flags |= ACPI_NS_ERROR_IF_FOUND; - - /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that - * involve arguments to the opcode must be created as we go back up the - * parse tree later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_ALREADY_EXISTS) - { - /* The name already exists in this scope */ - - if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) - { - /* Allow multiple references to the same scope */ - - Node->Type = (UINT8) ObjectType; - Status = AE_OK; - } - else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && - (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)) - { - /* - * Allow one create on an object or segment that was - * previously declared External - */ - Node->Flags &= ~ANOBJ_IS_EXTERNAL; - Node->Type = (UINT8) ObjectType; - - /* Just retyped a node, probably will need to open a scope */ - - if (AcpiNsOpensScope (ObjectType)) - { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - Status = AE_OK; - } - else - { - /* Valid error, object already exists */ - - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, - Op->Asl.ExternalName); - return_ACPI_STATUS (AE_OK); - } - } - else - { - AslCoreSubsystemError (Op, Status, - "Failure from namespace lookup", FALSE); - return_ACPI_STATUS (Status); - } - } - - if (ForceNewScope) - { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - -FinishNode: - /* - * Point the parse node to the new namespace node, and point - * the Node back to the original Parse node - */ - Op->Asl.Node = Node; - Node->Op = Op; - - /* Set the actual data type if appropriate (EXTERNAL term only) */ - - if (ActualObjectType != ACPI_TYPE_ANY) - { - Node->Type = (UINT8) ActualObjectType; - Node->Value = ASL_EXTERNAL_METHOD; - } - - if (Op->Asl.ParseOpcode == PARSEOP_METHOD) - { - /* - * Get the method argument count from "Extra" and save - * it in the namespace node - */ - Node->Value = (UINT32) Op->Asl.Extra; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: LdNamespace2Begin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the pass 2 parse tree walk. - * Second pass resolves some forward references. - * - * Notes: - * Currently only needs to handle the Alias operator. - * Could be used to allow forward references from the Scope() operator, but - * the MS interpreter does not allow this, so this compiler does not either. - * - ******************************************************************************/ - -static ACPI_STATUS -LdNamespace2Begin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_OBJECT_TYPE ObjectType; - BOOLEAN ForceNewScope = FALSE; - ACPI_PARSE_OBJECT *Arg; - char *Path; - ACPI_NAMESPACE_NODE *TargetNode; - - - ACPI_FUNCTION_NAME (LdNamespace2Begin); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", - Op, Op->Asl.ParseOpName)); - - - /* Ignore Ops with no namespace node */ - - Node = Op->Asl.Node; - if (!Node) - { - return (AE_OK); - } - - /* Get the type to determine if we should push the scope */ - - if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) && - (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)) - { - ObjectType = ACPI_TYPE_LOCAL_RESOURCE; - } - else - { - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - } - - /* Push scope for Resource Templates */ - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) - { - ForceNewScope = TRUE; - } - } - - /* Push the scope stack */ - - if (ForceNewScope || AcpiNsOpensScope (ObjectType)) - { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - if (Op->Asl.ParseOpcode == PARSEOP_ALIAS) - { - /* Complete the alias node by getting and saving the target node */ - - /* First child is the alias target */ - - Arg = Op->Asl.Child; - - /* Get the target pathname */ - - Path = Arg->Asl.Namepath; - if (!Path) - { - Status = UtInternalizeName (Arg->Asl.ExternalName, &Path); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - /* Get the NS node associated with the target. It must exist. */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &TargetNode); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, - Op->Asl.ExternalName); - - /* - * The name was not found, go ahead and create it. - * This prevents more errors later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, - ACPI_TYPE_ANY, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH, - WalkState, &(Node)); - return (AE_OK); - } - - AslCoreSubsystemError (Op, Status, - "Failure from namespace lookup", FALSE); - return (AE_OK); - } - - /* Save the target node within the alias node */ - - Node->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LdCommonNamespaceEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during the loading of the namespace, - * We only need to worry about managing the scope stack here. - * - ******************************************************************************/ - -static ACPI_STATUS -LdCommonNamespaceEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_OBJECT_TYPE ObjectType; - BOOLEAN ForceNewScope = FALSE; - - - ACPI_FUNCTION_NAME (LdCommonNamespaceEnd); - - - /* We are only interested in opcodes that have an associated name */ - - if (!Op->Asl.Namepath) - { - return (AE_OK); - } - - /* Get the type to determine if we should pop the scope */ - - if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) && - (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)) - { - /* TBD: Merge into AcpiDsMapNamedOpcodeToDataType */ - - ObjectType = ACPI_TYPE_LOCAL_RESOURCE; - } - else - { - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - } - - /* Pop scope that was pushed for Resource Templates */ - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) - { - ForceNewScope = TRUE; - } - } - - /* Pop the scope stack */ - - if (ForceNewScope || AcpiNsOpensScope (ObjectType)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "(%s): Popping scope for Op [%s] %p\n", - AcpiUtGetTypeName (ObjectType), Op->Asl.ParseOpName, Op)); - - (void) AcpiDsScopeStackPop (WalkState); - } - - return (AE_OK); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asllookup.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asllookup.c deleted file mode 100644 index 2c1253d2d4..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asllookup.c +++ /dev/null @@ -1,1440 +0,0 @@ -/****************************************************************************** - * - * Module Name: asllookup- Namespace lookup - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" - -#include "acparser.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdispat.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asllookup") - -/* Local prototypes */ - -static ACPI_STATUS -LsCompareOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -LsDoOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -static BOOLEAN -LkObjectExists ( - char *Name); - -static void -LkCheckFieldRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 RegionBitLength, - UINT32 FieldBitOffset, - UINT32 FieldBitLength, - UINT32 AccessBitWidth); - -static ACPI_STATUS -LkNamespaceLocateBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -LkNamespaceLocateEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -LkIsObjectUsed ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -LsDoOnePathname ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -void -LsSetupNsList ( - void *Handle); - -ACPI_PARSE_OBJECT * -LkGetNameOp ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: LsDoOneNamespaceObject - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Dump a namespace object to the namespace output file. - * Called during the walk of the namespace to dump all objects. - * - ******************************************************************************/ - -static ACPI_STATUS -LsDoOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PARSE_OBJECT *Op; - - - Gbl_NumNamespaceObjects++; - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5d [%d] %*s %4.4s - %s", - Gbl_NumNamespaceObjects, Level, (Level * 3), " ", - &Node->Name, - AcpiUtGetTypeName (Node->Type)); - - Op = Node->Op; - ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object); - - if (!Op) - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n"); - return (AE_OK); - } - - - if ((ObjDesc) && - (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)) - { - switch (Node->Type) - { - case ACPI_TYPE_INTEGER: - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Value 0x%8.8X%8.8X]", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - - case ACPI_TYPE_STRING: - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Value \"%s\"]", - ObjDesc->String.Pointer); - break; - - default: - /* Nothing to do for other types */ - break; - } - - } - else - { - switch (Node->Type) - { - case ACPI_TYPE_INTEGER: - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - Op = Op->Asl.Child; - } - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Next; - } - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Value 0x%8.8X%8.8X]", - ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); - break; - - - case ACPI_TYPE_STRING: - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - Op = Op->Asl.Child; - } - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Next; - } - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Value \"%s\"]", - Op->Asl.Value.String); - break; - - - case ACPI_TYPE_LOCAL_REGION_FIELD: - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Child; - } - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Offset 0x%04X Length 0x%04X bits]", - Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer); - break; - - - case ACPI_TYPE_BUFFER_FIELD: - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_CREATEBYTEFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BYTE ( 8 bit)]"); - break; - - case PARSEOP_CREATEDWORDFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [DWORD (32 bit)]"); - break; - - case PARSEOP_CREATEQWORDFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [QWORD (64 bit)]"); - break; - - case PARSEOP_CREATEWORDFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [WORD (16 bit)]"); - break; - - case PARSEOP_CREATEBITFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BIT ( 1 bit)]"); - break; - - case PARSEOP_CREATEFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Arbitrary Bit Field]"); - break; - - default: - break; - - } - break; - - - case ACPI_TYPE_PACKAGE: - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - Op = Op->Asl.Child; - } - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Next; - } - Op = Op->Asl.Child; - - if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) || - (Op->Asl.ParseOpcode == PARSEOP_RAW_DATA)) - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Length 0x%.2X elements]", - Op->Asl.Value.Integer); - } - break; - - - case ACPI_TYPE_BUFFER: - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - Op = Op->Asl.Child; - } - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Next; - } - Op = Op->Asl.Child; - - if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER)) - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Length 0x%.2X bytes]", - Op->Asl.Value.Integer); - } - break; - - - case ACPI_TYPE_METHOD: - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Code Length 0x%.4X bytes]", - Op->Asl.AmlSubtreeLength); - break; - - - case ACPI_TYPE_LOCAL_RESOURCE: - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Desc Offset 0x%.4X Bytes]", Node->Value); - break; - - - case ACPI_TYPE_LOCAL_RESOURCE_FIELD: - - if (Node->Flags & 0x80) - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Field Offset 0x%.4X Bits 0x%.4X Bytes]", - Node->Value, Node->Value / 8); - } - else - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Field Offset 0x%.4X Bytes]", Node->Value); - } - break; - - - default: - /* Nothing to do for other types */ - break; - } - } - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n"); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LsSetupNsList - * - * PARAMETERS: Handle - local file handle - * - * RETURN: None - * - * DESCRIPTION: Set the namespace output file to the input handle - * - ******************************************************************************/ - -void -LsSetupNsList ( - void *Handle) -{ - - Gbl_NsOutputFlag = TRUE; - Gbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = 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 - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Walk the namespace an display information about each node - * in the tree. Information is written to the optional - * namespace output file. - * - ******************************************************************************/ - -ACPI_STATUS -LsDisplayNamespace ( - void) -{ - ACPI_STATUS Status; - - - if (!Gbl_NsOutputFlag) - { - return (AE_OK); - } - - Gbl_NumNamespaceObjects = 0; - - /* File header */ - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n"); - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n"); - - /* Walk entire namespace from the root */ - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, NULL, - 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, NULL); - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: LsCompareOneNamespaceObject - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Compare name of one object. - * - ******************************************************************************/ - -static ACPI_STATUS -LsCompareOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - - - /* Simply check the name */ - - if (*((UINT32 *) (Context)) == Node->Name.Integer) - { - /* Abort walk if we found one instance */ - - return (AE_CTRL_TRUE); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LkObjectExists - * - * PARAMETERS: Name - 4 char ACPI name - * - * RETURN: TRUE if name exists in namespace - * - * DESCRIPTION: Walk the namespace to find an object - * - ******************************************************************************/ - -static BOOLEAN -LkObjectExists ( - char *Name) -{ - ACPI_STATUS Status; - - - /* Walk entire namespace from the supplied root */ - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject, NULL, - Name, NULL); - if (Status == AE_CTRL_TRUE) - { - /* At least one instance of the name was found */ - - return (TRUE); - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: LkGetNameOp - * - * PARAMETERS: Op - Current Op - * - * RETURN: NameOp associated with the input op - * - * DESCRIPTION: Find the name declaration op associated with the operator - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -LkGetNameOp ( - ACPI_PARSE_OBJECT *Op) -{ - const ACPI_OPCODE_INFO *OpInfo; - ACPI_PARSE_OBJECT *NameOp = Op; - - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - - - /* Get the NamePath from the appropriate place */ - - if (OpInfo->Flags & AML_NAMED) - { - /* For nearly all NAMED operators, the name reference is the first child */ - - NameOp = Op->Asl.Child; - if (Op->Asl.AmlOpcode == AML_ALIAS_OP) - { - /* - * ALIAS is the only oddball opcode, the name declaration - * (alias name) is the second operand - */ - NameOp = Op->Asl.Child->Asl.Next; - } - } - else if (OpInfo->Flags & AML_CREATE) - { - /* Name must appear as the last parameter */ - - NameOp = Op->Asl.Child; - while (!(NameOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) - { - NameOp = NameOp->Asl.Next; - } - } - - return (NameOp); -} - - -/******************************************************************************* - * - * FUNCTION: LkIsObjectUsed - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Check for an unreferenced namespace object and emit a warning. - * We have to be careful, because some types and names are - * typically or always unreferenced, we don't want to issue - * excessive warnings. - * - ******************************************************************************/ - -static ACPI_STATUS -LkIsObjectUsed ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); - - - /* Referenced flag is set during the namespace xref */ - - if (Node->Flags & ANOBJ_IS_REFERENCED) - { - return (AE_OK); - } - - /* - * Ignore names that start with an underscore, - * these are the reserved ACPI names and are typically not referenced, - * they are called by the host OS. - */ - if (Node->Name.Ascii[0] == '_') - { - return (AE_OK); - } - - /* There are some types that are typically not referenced, ignore them */ - - switch (Node->Type) - { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_POWER: - case ACPI_TYPE_LOCAL_RESOURCE: - return (AE_OK); - - default: - break; - } - - /* All others are valid unreferenced namespace objects */ - - if (Node->Op) - { - AslError (ASL_WARNING2, ASL_MSG_NOT_REFERENCED, LkGetNameOp (Node->Op), NULL); - } - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LkFindUnreferencedObjects - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Namespace walk to find objects that are not referenced in any - * way. Must be called after the namespace has been cross - * referenced. - * - ******************************************************************************/ - -void -LkFindUnreferencedObjects ( - void) -{ - - /* Walk entire namespace from the supplied root */ - - (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LkIsObjectUsed, NULL, - NULL, NULL); -} - - -/******************************************************************************* - * - * FUNCTION: LkCrossReferenceNamespace - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Perform a cross reference check of the parse tree against the - * namespace. Every named referenced within the parse tree - * should be get resolved with a namespace lookup. If not, the - * original reference in the ASL code is invalid -- i.e., refers - * to a non-existent object. - * - * NOTE: The ASL "External" operator causes the name to be inserted into the - * namespace so that references to the external name will be resolved - * correctly here. - * - ******************************************************************************/ - -ACPI_STATUS -LkCrossReferenceNamespace ( - void) -{ - ACPI_WALK_STATE *WalkState; - - - DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n"); - - /* - * Create a new walk state for use when looking up names - * within the namespace (Passed as context to the callbacks) - */ - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - return AE_NO_MEMORY; - } - - /* Walk the entire parse tree */ - - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin, - LkNamespaceLocateEnd, WalkState); - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: LkCheckFieldRange - * - * PARAMETERS: RegionBitLength - Length of entire parent region - * FieldBitOffset - Start of the field unit (within region) - * FieldBitLength - Entire length of field unit - * AccessBitWidth - Access width of the field unit - * - * RETURN: None - * - * DESCRIPTION: Check one field unit to make sure it fits in the parent - * op region. - * - * Note: AccessBitWidth must be either 8,16,32, or 64 - * - ******************************************************************************/ - -static void -LkCheckFieldRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 RegionBitLength, - UINT32 FieldBitOffset, - UINT32 FieldBitLength, - UINT32 AccessBitWidth) -{ - UINT32 FieldEndBitOffset; - - - /* - * Check each field unit against the region size. The entire - * field unit (start offset plus length) must fit within the - * region. - */ - FieldEndBitOffset = FieldBitOffset + FieldBitLength; - - if (FieldEndBitOffset > RegionBitLength) - { - /* Field definition itself is beyond the end-of-region */ - - AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL); - return; - } - - /* - * Now check that the field plus AccessWidth doesn't go beyond - * the end-of-region. Assumes AccessBitWidth is a power of 2 - */ - FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth); - - if (FieldEndBitOffset > RegionBitLength) - { - /* Field definition combined with the access is beyond EOR */ - - AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL); - } -} - -/******************************************************************************* - * - * FUNCTION: LkNamespaceLocateBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during cross-reference. For named - * object references, attempt to locate the name in the - * namespace. - * - * NOTE: ASL references to named fields within resource descriptors are - * resolved to integer values here. Therefore, this step is an - * important part of the code generation. We don't know that the - * name refers to a resource descriptor until now. - * - ******************************************************************************/ - -static ACPI_STATUS -LkNamespaceLocateBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - char *Path; - UINT8 PassedArgs; - ACPI_PARSE_OBJECT *NextOp; - ACPI_PARSE_OBJECT *OwningOp; - ACPI_PARSE_OBJECT *SpaceIdOp; - UINT32 MinimumLength; - UINT32 Temp; - const ACPI_OPCODE_INFO *OpInfo; - UINT32 Flags; - - - ACPI_FUNCTION_TRACE_PTR (LkNamespaceLocateBegin, Op); - - /* - * If this node is the actual declaration of a name - * [such as the XXXX name in "Method (XXXX)"], - * we are not interested in it here. We only care about names that are - * references to other objects within the namespace and the parent objects - * of name declarations - */ - if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) - { - return (AE_OK); - } - - /* We are only interested in opcodes that have an associated name */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - - if ((!(OpInfo->Flags & AML_NAMED)) && - (!(OpInfo->Flags & AML_CREATE)) && - (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && - (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && - (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) - { - return (AE_OK); - } - - /* - * One special case: CondRefOf operator - we don't care if the name exists - * or not at this point, just ignore it, the point of the operator is to - * determine if the name exists at runtime. - */ - if ((Op->Asl.Parent) && - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) - { - return (AE_OK); - } - - /* - * We must enable the "search-to-root" for single NameSegs, but - * we have to be very careful about opening up scopes - */ - Flags = ACPI_NS_SEARCH_PARENT; - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - /* - * These are name references, do not push the scope stack - * for them. - */ - Flags |= ACPI_NS_DONT_OPEN_SCOPE; - } - - /* Get the NamePath from the appropriate place */ - - if (OpInfo->Flags & AML_NAMED) - { - /* For nearly all NAMED operators, the name reference is the first child */ - - Path = Op->Asl.Child->Asl.Value.String; - if (Op->Asl.AmlOpcode == AML_ALIAS_OP) - { - /* - * ALIAS is the only oddball opcode, the name declaration - * (alias name) is the second operand - */ - Path = Op->Asl.Child->Asl.Next->Asl.Value.String; - } - } - else if (OpInfo->Flags & AML_CREATE) - { - /* Name must appear as the last parameter */ - - NextOp = Op->Asl.Child; - while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) - { - NextOp = NextOp->Asl.Next; - } - Path = NextOp->Asl.Value.String; - } - else - { - Path = Op->Asl.Value.String; - } - - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Type=%s\n", AcpiUtGetTypeName (ObjectType))); - - /* - * Lookup the name in the namespace. Name must exist at this point, or it - * is an invalid reference. - * - * The namespace is also used as a lookup table for references to resource - * descriptors and the fields within them. - */ - Gbl_NsLookupCount++; - - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - /* - * We didn't find the name reference by path -- we can qualify this - * a little better before we print an error message - */ - if (strlen (Path) == ACPI_NAME_SIZE) - { - /* A simple, one-segment ACPI name */ - - if (LkObjectExists (Path)) - { - /* - * There exists such a name, but we couldn't get to it - * from this scope - */ - AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, - Op->Asl.ExternalName); - } - else - { - /* The name doesn't exist, period */ - - AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, - Op, Op->Asl.ExternalName); - } - } - else - { - /* Check for a fully qualified path */ - - if (Path[0] == AML_ROOT_PREFIX) - { - /* Gave full path, the object does not exist */ - - AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, - Op->Asl.ExternalName); - } - else - { - /* - * We can't tell whether it doesn't exist or just - * can't be reached. - */ - AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, - Op->Asl.ExternalName); - } - } - - Status = AE_OK; - } - return (Status); - } - - /* Check for a reference vs. name declaration */ - - if (!(OpInfo->Flags & AML_NAMED) && - !(OpInfo->Flags & AML_CREATE)) - { - /* This node has been referenced, mark it for reference check */ - - Node->Flags |= ANOBJ_IS_REFERENCED; - } - - /* Attempt to optimize the NamePath */ - - OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node); - - /* - * 1) Dereference an alias (A name reference that is an alias) - * Aliases are not nested, the alias always points to the final object - */ - if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) && - (Node->Type == ACPI_TYPE_LOCAL_ALIAS)) - { - /* This node points back to the original PARSEOP_ALIAS */ - - NextOp = Node->Op; - - /* The first child is the alias target op */ - - NextOp = NextOp->Asl.Child; - - /* That in turn points back to original target alias node */ - - if (NextOp->Asl.Node) - { - Node = NextOp->Asl.Node; - } - - /* Else - forward reference to alias, will be resolved later */ - } - - /* 2) Check for a reference to a resource descriptor */ - - if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || - (Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) - { - /* - * This was a reference to a field within a resource descriptor. Extract - * the associated field offset (either a bit or byte offset depending on - * the field type) and change the named reference into an integer for - * AML code generation - */ - Temp = Node->Value; - if (Node->Flags & ANOBJ_IS_BIT_OFFSET) - { - Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET; - } - - /* Perform BitOffset <--> ByteOffset conversion if necessary */ - - switch (Op->Asl.Parent->Asl.AmlOpcode) - { - case AML_CREATE_FIELD_OP: - - /* We allow a Byte offset to Bit Offset conversion for this op */ - - if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) - { - /* Simply multiply byte offset times 8 to get bit offset */ - - Temp = ACPI_MUL_8 (Temp); - } - break; - - - case AML_CREATE_BIT_FIELD_OP: - - /* This op requires a Bit Offset */ - - if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) - { - AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL); - } - break; - - - case AML_CREATE_BYTE_FIELD_OP: - case AML_CREATE_WORD_FIELD_OP: - case AML_CREATE_DWORD_FIELD_OP: - case AML_CREATE_QWORD_FIELD_OP: - case AML_INDEX_OP: - - /* These Ops require Byte offsets */ - - if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET) - { - AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL); - } - break; - - - default: - /* Nothing to do for other opcodes */ - break; - } - - /* Now convert this node to an integer whose value is the field offset */ - - Op->Asl.AmlLength = 0; - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Asl.Value.Integer = (UINT64) Temp; - Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; - - OpcGenerateAmlOpcode (Op); - } - - /* 3) Check for a method invocation */ - - else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) && - (Node->Type == ACPI_TYPE_METHOD) && - (Op->Asl.Parent) && - (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD)) || - - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - - /* - * A reference to a method within one of these opcodes is not an - * invocation of the method, it is simply a reference to the method. - */ - if ((Op->Asl.Parent) && - ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) || - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) || - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE))) - { - return (AE_OK); - } - /* - * There are two types of method invocation: - * 1) Invocation with arguments -- the parser recognizes this - * as a METHODCALL. - * 2) Invocation with no arguments --the parser cannot determine that - * this is a method invocation, therefore we have to figure it out - * here. - */ - if (Node->Type != ACPI_TYPE_METHOD) - { - sprintf (MsgBuffer, "%s is a %s", - Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - - AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer); - return (AE_OK); - } - - /* Save the method node in the caller's op */ - - Op->Asl.Node = Node; - if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF) - { - return (AE_OK); - } - - /* - * This is a method invocation, with or without arguments. - * Count the number of arguments, each appears as a child - * under the parent node - */ - Op->Asl.ParseOpcode = PARSEOP_METHODCALL; - UtSetParseOpName (Op); - - PassedArgs = 0; - NextOp = Op->Asl.Child; - - while (NextOp) - { - PassedArgs++; - NextOp = NextOp->Asl.Next; - } - - if (Node->Value != ASL_EXTERNAL_METHOD) - { - /* - * Check the parsed arguments with the number expected by the - * method declaration itself - */ - if (PassedArgs != Node->Value) - { - sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName, - Node->Value); - - if (PassedArgs < Node->Value) - { - AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer); - } - else - { - AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer); - } - } - } - } - - /* 4) Check for an ASL Field definition */ - - else if ((Op->Asl.Parent) && - ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) || - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD))) - { - /* - * Offset checking for fields. If the parent operation region has a - * constant length (known at compile time), we can check fields - * defined in that region against the region length. This will catch - * fields and field units that cannot possibly fit within the region. - * - * Note: Index fields do not directly reference an operation region, - * thus they are not included in this check. - */ - if (Op == Op->Asl.Parent->Asl.Child) - { - /* - * This is the first child of the field node, which is - * the name of the region. Get the parse node for the - * region -- which contains the length of the region. - */ - OwningOp = Node->Op; - Op->Asl.Parent->Asl.ExtraValue = - ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer); - - /* Examine the field access width */ - - switch ((UINT8) Op->Asl.Parent->Asl.Value.Integer) - { - case AML_FIELD_ACCESS_ANY: - case AML_FIELD_ACCESS_BYTE: - case AML_FIELD_ACCESS_BUFFER: - default: - MinimumLength = 1; - break; - - case AML_FIELD_ACCESS_WORD: - MinimumLength = 2; - break; - - case AML_FIELD_ACCESS_DWORD: - MinimumLength = 4; - break; - - case AML_FIELD_ACCESS_QWORD: - MinimumLength = 8; - break; - } - - /* - * Is the region at least as big as the access width? - * Note: DataTableRegions have 0 length - */ - if (((UINT32) OwningOp->Asl.Value.Integer) && - ((UINT32) OwningOp->Asl.Value.Integer < MinimumLength)) - { - AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL); - } - - /* - * Check EC/CMOS/SMBUS fields to make sure that the correct - * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS) - */ - SpaceIdOp = OwningOp->Asl.Child->Asl.Next; - switch ((UINT32) SpaceIdOp->Asl.Value.Integer) - { - case REGION_EC: - case REGION_CMOS: - - if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE) - { - AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL); - } - break; - - case REGION_SMBUS: - case REGION_IPMI: - - if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER) - { - AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL); - } - break; - - default: - - /* Nothing to do for other address spaces */ - break; - } - } - else - { - /* - * This is one element of the field list. Check to make sure - * that it does not go beyond the end of the parent operation region. - * - * In the code below: - * Op->Asl.Parent->Asl.ExtraValue - Region Length (bits) - * Op->Asl.ExtraValue - Field start offset (bits) - * Op->Asl.Child->Asl.Value.Integer32 - Field length (bits) - * Op->Asl.Child->Asl.ExtraValue - Field access width (bits) - */ - if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child) - { - LkCheckFieldRange (Op, - Op->Asl.Parent->Asl.ExtraValue, - Op->Asl.ExtraValue, - (UINT32) Op->Asl.Child->Asl.Value.Integer, - Op->Asl.Child->Asl.ExtraValue); - } - } - } - - Op->Asl.Node = Node; - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: LkNamespaceLocateEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during cross reference. We only - * need to worry about scope management here. - * - ******************************************************************************/ - -static ACPI_STATUS -LkNamespaceLocateEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - const ACPI_OPCODE_INFO *OpInfo; - - - ACPI_FUNCTION_TRACE (LkNamespaceLocateEnd); - - - /* We are only interested in opcodes that have an associated name */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - if (!(OpInfo->Flags & AML_NAMED)) - { - return (AE_OK); - } - - /* Not interested in name references, we did not open a scope for them */ - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - return (AE_OK); - } - - /* Pop the scope stack if necessary */ - - if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode))) - { - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%s: Popping scope for Op %p\n", - AcpiUtGetTypeName (OpInfo->ObjectType), Op)); - - (void) AcpiDsScopeStackPop (WalkState); - } - - return (AE_OK); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslmain.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslmain.c deleted file mode 100644 index 42127c0961..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslmain.c +++ /dev/null @@ -1,964 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslmain - compiler main and utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#define _DECLARE_GLOBALS - -#include "aslcompiler.h" -#include "acapps.h" - -#ifdef _DEBUG -#include -#endif - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslmain") - -/* Local prototypes */ - -static void -Options ( - void); - -static void -HelpMessage ( - void); - -static void -Usage ( - void); - -static void -AslInitialize ( - void); - -static int -AslCommandLine ( - int argc, - char **argv); - -static int -AslDoOptions ( - int argc, - char **argv, - BOOLEAN IsResponseFile); - -static void -AslMergeOptionTokens ( - char *InBuffer, - char *OutBuffer); - -static int -AslDoResponseFile ( - char *Filename); - - -#define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:" - - -/******************************************************************************* - * - * FUNCTION: Options - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display option help message - * - ******************************************************************************/ - -static void -Options ( - void) -{ - - printf ("Global:\n"); - printf (" -@ Specify command file\n"); - printf (" -I Specify additional include directory\n"); - - printf ("\nGeneral Output:\n"); - printf (" -p Specify path/filename prefix for all output files\n"); - printf (" -va Disable all errors and warnings (summary only)\n"); - printf (" -vi Less verbose errors and warnings for use with IDEs\n"); - printf (" -vo Enable optimization comments\n"); - printf (" -vr Disable remarks\n"); - printf (" -vs Disable signon\n"); - printf (" -w<1|2|3> Set warning reporting level\n"); - - printf ("\nAML Output Files:\n"); - printf (" -s Create AML in assembler or C source file (*.asm or *.c)\n"); - printf (" -i Create assembler or C include file (*.inc or *.h)\n"); - printf (" -t Create AML in assembler, C, or ASL hex table (*.hex)\n"); - - printf ("\nAML Code Generation:\n"); - printf (" -oa Disable all optimizations (compatibility mode)\n"); - printf (" -of Disable constant folding\n"); - printf (" -oi Disable integer optimization to Zero/One/Ones\n"); - printf (" -on Disable named reference string optimization\n"); - printf (" -cr Disable Resource Descriptor error checking\n"); - printf (" -r Override table header Revision (1-255)\n"); - - printf ("\nListings:\n"); - printf (" -l Create mixed listing file (ASL source and AML) (*.lst)\n"); - printf (" -ln Create namespace file (*.nsp)\n"); - printf (" -ls Create combined source file (expanded includes) (*.src)\n"); - - printf ("\nAML Disassembler:\n"); - printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n"); - printf (" -dc [file] Disassemble AML and immediately compile it\n"); - printf (" (Obtain DSDT from current system if no input file)\n"); - printf (" -e [f1,f2] Include ACPI table(s) for external symbol resolution\n"); - printf (" -2 Emit ACPI 2.0 compatible ASL code\n"); - printf (" -g Get ACPI tables and write to files (*.dat)\n"); - - printf ("\nHelp:\n"); - printf (" -h Additional help and compiler debug options\n"); - printf (" -hc Display operators allowed in constant expressions\n"); - printf (" -hr Display ACPI reserved method names\n"); -} - - -/******************************************************************************* - * - * FUNCTION: HelpMessage - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display help message - * - ******************************************************************************/ - -static void -HelpMessage ( - void) -{ - - printf ("AML output filename generation:\n"); - printf (" Output filenames are generated by appending an extension to a common\n"); - printf (" filename prefix. The filename prefix is obtained via one of the\n"); - printf (" following methods (in priority order):\n"); - printf (" 1) The -p option specifies the prefix\n"); - printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n"); - printf (" 3) The prefix of the input filename\n"); - printf ("\n"); - - Options (); - - printf ("\nCompiler/Disassembler Debug Options:\n"); - printf (" -b Create compiler debug/trace file (*.txt)\n"); - printf (" Types: Parse/Tree/Both\n"); - printf (" -f Ignore errors, force creation of AML output file(s)\n"); - printf (" -n Parse only, no output generation\n"); - printf (" -ot Display compile times\n"); - printf (" -x Set debug level for trace output\n"); -} - - -/******************************************************************************* - * - * FUNCTION: Usage - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display usage and option message - * - ******************************************************************************/ - -static void -Usage ( - void) -{ - - printf ("Usage: %s [Options] [Files]\n\n", CompilerName); - Options (); -} - - -/******************************************************************************* - * - * FUNCTION: AslInitialize - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Initialize compiler globals - * - ******************************************************************************/ - -static void -AslInitialize ( - void) -{ - UINT32 i; - - -#ifdef _DEBUG - _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(0)); -#endif - - AcpiDbgLevel = 0; - - for (i = 0; i < ASL_NUM_FILES; i++) - { - Gbl_Files[i].Handle = NULL; - Gbl_Files[i].Filename = NULL; - } - - Gbl_Files[ASL_FILE_STDOUT].Handle = stdout; - Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT"; - - Gbl_Files[ASL_FILE_STDERR].Handle = stderr; - Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; -} - - -/******************************************************************************* - * - * FUNCTION: AslMergeOptionTokens - * - * PARAMETERS: InBuffer - Input containing an option string - * OutBuffer - Merged output buffer - * - * RETURN: None - * - * DESCRIPTION: Remove all whitespace from an option string. - * - ******************************************************************************/ - -static void -AslMergeOptionTokens ( - char *InBuffer, - char *OutBuffer) -{ - char *Token; - - - *OutBuffer = 0; - - Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS); - while (Token) - { - strcat (OutBuffer, Token); - Token = strtok (NULL, ASL_TOKEN_SEPARATORS); - } -} - - -/******************************************************************************* - * - * FUNCTION: AslDoResponseFile - * - * PARAMETERS: Filename - Name of the response file - * - * RETURN: Status - * - * DESCRIPTION: Open a response file and process all options within. - * - ******************************************************************************/ - -static int -AslDoResponseFile ( - char *Filename) -{ - char *argv = StringBuffer2; - FILE *ResponseFile; - int OptStatus = 0; - int Opterr; - int Optind; - - - ResponseFile = fopen (Filename, "r"); - if (!ResponseFile) - { - printf ("Could not open command file %s, %s\n", - Filename, strerror (errno)); - return -1; - } - - /* Must save the current GetOpt globals */ - - Opterr = AcpiGbl_Opterr; - Optind = AcpiGbl_Optind; - - /* - * Process all lines in the response file. There must be one complete - * option per line - */ - while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ResponseFile)) - { - /* Compress all tokens, allowing us to use a single argv entry */ - - AslMergeOptionTokens (StringBuffer, StringBuffer2); - - /* Process the option */ - - AcpiGbl_Opterr = 0; - AcpiGbl_Optind = 0; - - OptStatus = AslDoOptions (1, &argv, TRUE); - if (OptStatus) - { - printf ("Invalid option in command file %s: %s\n", - Filename, StringBuffer); - break; - } - } - - /* Restore the GetOpt globals */ - - AcpiGbl_Opterr = Opterr; - AcpiGbl_Optind = Optind; - - fclose (ResponseFile); - return (OptStatus); -} - - -/******************************************************************************* - * - * FUNCTION: AslDoOptions - * - * PARAMETERS: argc/argv - Standard argc/argv - * IsResponseFile - TRUE if executing a response file. - * - * RETURN: Status - * - * DESCRIPTION: Command line option processing - * - ******************************************************************************/ - -static int -AslDoOptions ( - int argc, - char **argv, - BOOLEAN IsResponseFile) -{ - int j; - - - /* Get the command line options */ - - while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != EOF) switch (j) - { - case '@': /* Begin a response file */ - - if (IsResponseFile) - { - printf ("Nested command files are not supported\n"); - return -1; - } - - if (AslDoResponseFile (AcpiGbl_Optarg)) - { - return -1; - } - break; - - - case '2': - - Gbl_Acpi2 = TRUE; - break; - - - case 'b': - - switch (AcpiGbl_Optarg[0]) - { - case 'b': - AslCompilerdebug = 1; /* same as yydebug */ - break; - - case 'p': - AslCompilerdebug = 1; /* same as yydebug */ - break; - - case 't': - break; - - default: - printf ("Unknown option: -b%s\n", AcpiGbl_Optarg); - return (-1); - } - - /* Produce debug output file */ - - Gbl_DebugFlag = TRUE; - break; - - - case 'c': - switch (AcpiGbl_Optarg[0]) - { - case 'r': - Gbl_NoResourceChecking = TRUE; - break; - - default: - printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'd': - switch (AcpiGbl_Optarg[0]) - { - case '^': - Gbl_DoCompile = FALSE; - break; - - case 'c': - break; - - default: - printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); - return (-1); - } - - Gbl_DisasmFlag = TRUE; - break; - - - case 'e': - Gbl_ExternalFilename = AcpiGbl_Optarg; - break; - - - case 'f': - - /* Ignore errors and force creation of aml file */ - - Gbl_IgnoreErrors = TRUE; - break; - - - case 'g': - - /* Get all ACPI tables */ - - Gbl_GetAllTables = TRUE; - Gbl_DoCompile = FALSE; - break; - - - case 'h': - - switch (AcpiGbl_Optarg[0]) - { - case '^': - HelpMessage (); - exit (0); - - case 'c': - UtDisplayConstantOpcodes (); - exit (0); - - case 'r': - /* reserved names */ - - ApDisplayReservedNames (); - exit (0); - - default: - printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'I': /* Add an include file search directory */ - - FlAddIncludeDirectory (AcpiGbl_Optarg); - break; - - - case 'i': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - - /* Produce assembly code include file */ - - Gbl_AsmIncludeOutputFlag = TRUE; - break; - - case 'c': - - /* Produce C include file */ - - Gbl_C_IncludeOutputFlag = TRUE; - break; - - default: - printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'l': - - switch (AcpiGbl_Optarg[0]) - { - case '^': - /* Produce listing file (Mixed source/aml) */ - - Gbl_ListingFlag = TRUE; - break; - - case 'n': - /* Produce namespace file */ - - Gbl_NsOutputFlag = TRUE; - break; - - case 's': - /* Produce combined source file */ - - Gbl_SourceOutputFlag = TRUE; - break; - - default: - printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'o': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - - /* Disable all optimizations */ - - Gbl_FoldConstants = FALSE; - Gbl_IntegerOptimizationFlag = FALSE; - Gbl_ReferenceOptimizationFlag = FALSE; - break; - - case 'f': - - /* Disable folding on "normal" expressions */ - - Gbl_FoldConstants = FALSE; - break; - - case 'i': - - /* Disable integer optimization to constants */ - - Gbl_IntegerOptimizationFlag = FALSE; - break; - - case 'n': - - /* Disable named reference optimization */ - - Gbl_ReferenceOptimizationFlag = FALSE; - break; - - case 't': - - /* Display compile time(s) */ - - Gbl_CompileTimesFlag = TRUE; - break; - - default: - printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'n': - - /* Parse only */ - - Gbl_ParseOnlyFlag = TRUE; - break; - - - case 'p': - - /* Override default AML output filename */ - - Gbl_OutputFilenamePrefix = AcpiGbl_Optarg; - Gbl_UseDefaultAmlFilename = FALSE; - break; - - - case 'r': - Gbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); - break; - - - case 's': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - - /* Produce assembly code output file */ - - Gbl_AsmOutputFlag = TRUE; - break; - - case 'c': - - /* Produce C hex output file */ - - Gbl_C_OutputFlag = TRUE; - break; - - default: - printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 't': - - /* Produce hex table output file */ - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - Gbl_HexOutputFlag = HEX_OUTPUT_ASM; - break; - - case 'c': - Gbl_HexOutputFlag = HEX_OUTPUT_C; - break; - - case 's': - Gbl_HexOutputFlag = HEX_OUTPUT_ASL; - break; - - default: - printf ("Unknown option: -t%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'v': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - /* Disable All error/warning messages */ - - Gbl_NoErrors = TRUE; - break; - - case 'i': - /* Less verbose error messages */ - - Gbl_VerboseErrors = FALSE; - break; - - case 'o': - Gbl_DisplayOptimizations = TRUE; - break; - - case 'r': - Gbl_DisplayRemarks = FALSE; - break; - - case 's': - Gbl_DoSignon = FALSE; - break; - - default: - printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'w': /* Set warning levels */ - - switch (AcpiGbl_Optarg[0]) - { - case '1': - Gbl_WarningLevel = ASL_WARNING; - break; - - case '2': - Gbl_WarningLevel = ASL_WARNING2; - break; - - case '3': - Gbl_WarningLevel = ASL_WARNING3; - break; - - default: - printf ("Unknown option: -w%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'x': - - AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16); - break; - - - default: - - return (-1); - } - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: AslCommandLine - * - * PARAMETERS: argc/argv - * - * RETURN: Last argv index - * - * DESCRIPTION: Command line processing - * - ******************************************************************************/ - -static int -AslCommandLine ( - int argc, - char **argv) -{ - int BadCommandLine = 0; - - - /* Minimum command line contains at least the command and an input file */ - - if (argc < 2) - { - AslCompilerSignon (ASL_FILE_STDOUT); - Usage (); - exit (1); - } - - /* Process all command line options */ - - BadCommandLine = AslDoOptions (argc, argv, FALSE); - - /* Next parameter must be the input filename */ - - if (!argv[AcpiGbl_Optind] && - !Gbl_DisasmFlag && - !Gbl_GetAllTables) - { - printf ("Missing input filename\n"); - BadCommandLine = TRUE; - } - - if (Gbl_DoSignon) - { - AslCompilerSignon (ASL_FILE_STDOUT); - } - - /* Abort if anything went wrong on the command line */ - - if (BadCommandLine) - { - printf ("\n"); - Usage (); - exit (1); - } - - return (AcpiGbl_Optind); -} - - -/******************************************************************************* - * - * FUNCTION: main - * - * PARAMETERS: Standard argc/argv - * - * RETURN: Program termination code - * - * DESCRIPTION: C main routine for the Asl Compiler. Handle command line - * options and begin the compile for each file on the command line - * - ******************************************************************************/ - -int ACPI_SYSTEM_XFACE -main ( - int argc, - char **argv) -{ - ACPI_STATUS Status; - int Index; - - -#ifdef _DEBUG - _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | - _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); -#endif - - /* Init and command line */ - - AslInitialize (); - Index = AslCommandLine (argc, argv); - - /* Options that have no additional parameters or pathnames */ - - if (Gbl_GetAllTables) - { - Status = AslDoOneFile (NULL); - if (ACPI_FAILURE (Status)) - { - return (-1); - } - return (0); - } - - /* Process each pathname/filename in the list, with possible wildcards */ - - while (argv[Index]) - { - Status = AslDoOnePathname (argv[Index]); - if (ACPI_FAILURE (Status)) - { - return (-1); - } - - 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 deleted file mode 100644 index 9eb3843529..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslmap.c +++ /dev/null @@ -1,467 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslmap - parser to AML opcode mapping table - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "amlcode.h" -#include "acparser.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslmap") - - -/******************************************************************************* - * - * FUNCTION: AslMapNamedOpcodeToDataType - * - * PARAMETERS: Opcode - The Named AML opcode to map - * - * RETURN: The ACPI type associated with the named opcode - * - * DESCRIPTION: Convert a raw Named AML opcode to the associated data type. - * Named opcodes are a subset of the AML opcodes. - * - ******************************************************************************/ - -ACPI_OBJECT_TYPE -AslMapNamedOpcodeToDataType ( - UINT16 Opcode) -{ - const ACPI_OPCODE_INFO *OpInfo; - - - /* - * There are some differences from the opcode table types, we - * catch them here. - */ - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - - if (Opcode == AML_INT_NAMEPATH_OP) - { - return (ACPI_TYPE_ANY); - } - - if (Opcode == AML_INT_METHODCALL_OP) - { - return (ACPI_TYPE_ANY); - } - - if (OpInfo->Flags & AML_NSOBJECT) - { - return (OpInfo->ObjectType); - } - - return (ACPI_TYPE_ANY); -} - - -/******************************************************************************* - * - * DATA STRUCTURE: AslKeywordMapping - * - * DESCRIPTION: Maps the ParseOpcode to the actual AML opcode. The parse - * opcodes are generated from Bison, and this table must - * track any additions to them. - * - * Each entry in the table contains the following items: - * - * AML opcode - Opcode that is written to the AML file - * Value - Value of the object to be written (if applicable) - * Flags - 1) Whether this opcode opens an AML "package". - * - ******************************************************************************/ -/* - * TBD: - * AccessAttrib - * AccessType - * AMlop for DMA? - * ObjectType keywords - * Register - */ - -const ASL_MAPPING_ENTRY AslKeywordMapping [] = -{ -/*! [Begin] no source code translation (keep the table structure) */ - - -/* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0), -/* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BLOCK, 0, 0), -/* ACCESSATTRIB_BLOCK_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BLOCK_CALL,0, 0), -/* ACCESSATTRIB_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BYTE, 0, 0), -/* ACCESSATTRIB_WORD_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_WORD_CALL, 0, 0), -/* ACCESSATTRIB_QUICK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_QUICK, 0, 0), -/* ACCESSATTRIB_SND_RCV */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_SEND_RCV, 0, 0), -/* ACCESSATTRIB_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_WORD, 0, 0), -/* ACCESSTYPE_ANY */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_ANY, 0, 0), -/* ACCESSTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BUFFER, 0, 0), -/* ACCESSTYPE_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BYTE, 0, 0), -/* ACCESSTYPE_DWORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_DWORD, 0, 0), -/* ACCESSTYPE_QWORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_QWORD, 0, 0), -/* ACCESSTYPE_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_WORD, 0, 0), -/* ACQUIRE */ OP_TABLE_ENTRY (AML_ACQUIRE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ADD */ OP_TABLE_ENTRY (AML_ADD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ADDRESSSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_BYTE_OP, REGION_FIXED_HW, 0, 0), -/* ADDRESSTYPE_ACPI */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* ADDRESSTYPE_MEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* ADDRESSTYPE_NVS */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* ADDRESSTYPE_RESERVED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* ALIAS */ OP_TABLE_ENTRY (AML_ALIAS_OP, 0, 0, 0), -/* AND */ OP_TABLE_ENTRY (AML_BIT_AND_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ARG0 */ OP_TABLE_ENTRY (AML_ARG0, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG1 */ OP_TABLE_ENTRY (AML_ARG1, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG2 */ OP_TABLE_ENTRY (AML_ARG2, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG3 */ OP_TABLE_ENTRY (AML_ARG3, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG4 */ OP_TABLE_ENTRY (AML_ARG4, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG5 */ OP_TABLE_ENTRY (AML_ARG5, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG6 */ OP_TABLE_ENTRY (AML_ARG6, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* BANKFIELD */ OP_TABLE_ENTRY (AML_BANK_FIELD_OP, 0, NODE_AML_PACKAGE, 0), -/* BREAK */ OP_TABLE_ENTRY (AML_BREAK_OP, 0, 0, 0), -/* BREAKPOINT */ OP_TABLE_ENTRY (AML_BREAK_POINT_OP, 0, 0, 0), -/* BUFFER */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_BUFFER), -/* BUSMASTERTYPE_MASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* BUSMASTERTYPE_NOTMASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* BYTECONST */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, 0, 0, ACPI_BTYPE_INTEGER), -/* CASE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* CONCATENATE */ OP_TABLE_ENTRY (AML_CONCAT_OP, 0, 0, ACPI_BTYPE_COMPUTE_DATA), -/* CONCATENATERESTEMPLATE */ OP_TABLE_ENTRY (AML_CONCAT_RES_OP, 0, 0, ACPI_BTYPE_BUFFER), -/* CONDREFOF */ OP_TABLE_ENTRY (AML_COND_REF_OF_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* CONTINUE */ OP_TABLE_ENTRY (AML_CONTINUE_OP, 0, 0, 0), -/* COPY */ OP_TABLE_ENTRY (AML_COPY_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), -/* CREATEBITFIELD */ OP_TABLE_ENTRY (AML_CREATE_BIT_FIELD_OP, 0, 0, 0), -/* CREATEBYTEFIELD */ OP_TABLE_ENTRY (AML_CREATE_BYTE_FIELD_OP, 0, 0, 0), -/* CREATEDWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_DWORD_FIELD_OP, 0, 0, 0), -/* CREATEFIELD */ OP_TABLE_ENTRY (AML_CREATE_FIELD_OP, 0, 0, 0), -/* CREATEQWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_QWORD_FIELD_OP, 0, 0, 0), -/* CREATEWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_WORD_FIELD_OP, 0, 0, 0), -/* DATATABLEREGION */ OP_TABLE_ENTRY (AML_DATA_REGION_OP, 0, 0, 0), -/* DEBUG */ OP_TABLE_ENTRY (AML_DEBUG_OP, 0, 0, ACPI_BTYPE_DEBUG_OBJECT), -/* DECODETYPE_POS */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* DECODETYPE_SUB */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* DECREMENT */ OP_TABLE_ENTRY (AML_DECREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* DEFAULT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DEFAULT_ARG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DEFINITIONBLOCK */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DEREFOF */ OP_TABLE_ENTRY (AML_DEREF_OF_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE | ACPI_BTYPE_STRING), -/* DEVICE */ OP_TABLE_ENTRY (AML_DEVICE_OP, 0, NODE_AML_PACKAGE, 0), -/* DIVIDE */ OP_TABLE_ENTRY (AML_DIVIDE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* DMA */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DMATYPE_A */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* DMATYPE_COMPATIBILITY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* DMATYPE_B */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* DMATYPE_F */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* DWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_DWORD, 0, 0, ACPI_BTYPE_INTEGER), -/* DWORDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DWORDMEMORY */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DWORDSPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* EISAID */ OP_TABLE_ENTRY (AML_DWORD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ELSE */ OP_TABLE_ENTRY (AML_ELSE_OP, 0, NODE_AML_PACKAGE, 0), -/* ELSEIF */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, NODE_AML_PACKAGE, 0), -/* ENDDEPENDENTFN */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* ENDTAG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* ERRORNODE */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0), -/* EVENT */ OP_TABLE_ENTRY (AML_EVENT_OP, 0, 0, 0), -/* EXTENDEDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* EXTENDEDMEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* EXTENDEDSPACE */ OP_TABLE_ENTRY (AML_RAW_DATA_QWORD, 0, 0, ACPI_BTYPE_INTEGER), -/* EXTERNAL */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* FATAL */ OP_TABLE_ENTRY (AML_FATAL_OP, 0, 0, 0), -/* FIELD */ OP_TABLE_ENTRY (AML_FIELD_OP, 0, NODE_AML_PACKAGE, 0), -/* FINDSETLEFTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_LEFT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* FINDSETRIGHTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_RIGHT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* FIXEDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* FROMBCD */ OP_TABLE_ENTRY (AML_FROM_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* FUNCTION */ OP_TABLE_ENTRY (AML_METHOD_OP, 0, NODE_AML_PACKAGE, 0), -/* IF */ OP_TABLE_ENTRY (AML_IF_OP, 0, NODE_AML_PACKAGE, 0), -/* INCLUDE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INCLUDE_CSTYLE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INCLUDE_END */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INCREMENT */ OP_TABLE_ENTRY (AML_INCREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE), -/* INDEXFIELD */ OP_TABLE_ENTRY (AML_INDEX_FIELD_OP, 0, NODE_AML_PACKAGE, 0), -/* INTEGER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* INTERRUPT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INTLEVEL_ACTIVEHIGH */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* INTLEVEL_ACTIVELOW */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* INTTYPE_EDGE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* INTTYPE_LEVEL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* IO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* IODECODETYPE_10 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* IODECODETYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* IRQ */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* IRQNOFLAGS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* LAND */ OP_TABLE_ENTRY (AML_LAND_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LEQUAL */ OP_TABLE_ENTRY (AML_LEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LGREATER */ OP_TABLE_ENTRY (AML_LGREATER_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LGREATEREQUAL */ OP_TABLE_ENTRY (AML_LGREATEREQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LINE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* LLESS */ OP_TABLE_ENTRY (AML_LLESS_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LLESSEQUAL */ OP_TABLE_ENTRY (AML_LLESSEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LNOT */ OP_TABLE_ENTRY (AML_LNOT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LNOTEQUAL */ OP_TABLE_ENTRY (AML_LNOTEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LOAD */ OP_TABLE_ENTRY (AML_LOAD_OP, 0, 0, 0), -/* LOADTABLE */ OP_TABLE_ENTRY (AML_LOAD_TABLE_OP, 0, 0, ACPI_BTYPE_DDB_HANDLE), -/* LOCAL0 */ OP_TABLE_ENTRY (AML_LOCAL0, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL1 */ OP_TABLE_ENTRY (AML_LOCAL1, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL2 */ OP_TABLE_ENTRY (AML_LOCAL2, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL3 */ OP_TABLE_ENTRY (AML_LOCAL3, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL4 */ OP_TABLE_ENTRY (AML_LOCAL4, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL5 */ OP_TABLE_ENTRY (AML_LOCAL5, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL6 */ OP_TABLE_ENTRY (AML_LOCAL6, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL7 */ OP_TABLE_ENTRY (AML_LOCAL7, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCKRULE_LOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_LOCK_ALWAYS, 0, 0), -/* LOCKRULE_NOLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_LOCK_NEVER, 0, 0), -/* LOR */ OP_TABLE_ENTRY (AML_LOR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MATCH */ OP_TABLE_ENTRY (AML_MATCH_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MEQ */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MEQ, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MGE */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MGE, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MGT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MGT, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MLE */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MLE, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MLT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MLT, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MTR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MTR, 0, ACPI_BTYPE_INTEGER), -/* MAXTYPE_FIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* MAXTYPE_NOTFIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* MEMORY24 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* MEMORY32 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* MEMORY32FIXED */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* MEMTYPE_CACHEABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* MEMTYPE_NONCACHEABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* MEMTYPE_PREFETCHABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* MEMTYPE_WRITECOMBINING */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* METHOD */ OP_TABLE_ENTRY (AML_METHOD_OP, 0, NODE_AML_PACKAGE, 0), -/* METHODCALL */ OP_TABLE_ENTRY (AML_INT_METHODCALL_OP, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* MID */ OP_TABLE_ENTRY (AML_MID_OP, 0, 0, ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER), -/* MINTYPE_FIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* MINTYPE_NOTFIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* MOD */ OP_TABLE_ENTRY (AML_MOD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MULTIPLY */ OP_TABLE_ENTRY (AML_MULTIPLY_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MUTEX */ OP_TABLE_ENTRY (AML_MUTEX_OP, 0, 0, 0), -/* NAME */ OP_TABLE_ENTRY (AML_NAME_OP, 0, 0, 0), -/* NAMESEG */ OP_TABLE_ENTRY (AML_INT_NAMEPATH_OP, 0, 0, 0), -/* NAMESTRING */ OP_TABLE_ENTRY (AML_INT_NAMEPATH_OP, 0, 0, 0), -/* NAND */ OP_TABLE_ENTRY (AML_BIT_NAND_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* NOOP */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0), -/* NOR */ OP_TABLE_ENTRY (AML_BIT_NOR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* NOT */ OP_TABLE_ENTRY (AML_BIT_NOT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* NOTIFY */ OP_TABLE_ENTRY (AML_NOTIFY_OP, 0, 0, 0), -/* OBJECTTYPE */ OP_TABLE_ENTRY (AML_TYPE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* OBJECTTYPE_BFF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER_FIELD, 0, 0), -/* OBJECTTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER, 0, 0), -/* OBJECTTYPE_DDB */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DDB_HANDLE, 0, 0), -/* OBJECTTYPE_DEV */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DEVICE, 0, 0), -/* OBJECTTYPE_EVT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_EVENT, 0, 0), -/* OBJECTTYPE_FLD */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_FIELD_UNIT, 0, 0), -/* OBJECTTYPE_INT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_INTEGER, 0, 0), -/* OBJECTTYPE_MTH */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_METHOD, 0, 0), -/* OBJECTTYPE_MTX */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_MUTEX, 0, 0), -/* OBJECTTYPE_OPR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_REGION, 0, 0), -/* OBJECTTYPE_PKG */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PACKAGE, 0, 0), -/* OBJECTTYPE_POW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_POWER, 0, 0), -/* OBJECTTYPE_PRO */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PROCESSOR, 0, 0), -/* OBJECTTYPE_STR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_STRING, 0, 0), -/* OBJECTTYPE_THZ */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_THERMAL, 0, 0), -/* OBJECTTYPE_UNK */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_ANY, 0, 0), -/* OFFSET */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0), -/* ONE */ OP_TABLE_ENTRY (AML_ONE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ONES */ OP_TABLE_ENTRY (AML_ONES_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* OPERATIONREGION */ OP_TABLE_ENTRY (AML_REGION_OP, 0, 0, 0), -/* OR */ OP_TABLE_ENTRY (AML_BIT_OR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* PACKAGE */ OP_TABLE_ENTRY (AML_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE), -/* PACKAGEP_LENGTH */ OP_TABLE_ENTRY (AML_PACKAGE_LENGTH, 0, NODE_AML_PACKAGE, 0), -/* POWERRESOURCE */ OP_TABLE_ENTRY (AML_POWER_RES_OP, 0, NODE_AML_PACKAGE, 0), -/* PROCESSOR */ OP_TABLE_ENTRY (AML_PROCESSOR_OP, 0, NODE_AML_PACKAGE, 0), -/* QWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_QWORD, 0, 0, ACPI_BTYPE_INTEGER), -/* QWORDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* QWORDMEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* QWORDSPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* RANGE_TYPE_ENTIRE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* RANGE_TYPE_ISAONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* RANGE_TYPE_NONISAONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* RAW_DATA */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* READWRITETYPE_BOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* READWRITETYPE_READONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE), -/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_CMOS, 0, 0), -/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_EC, 0, 0), -/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IO, 0, 0), -/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IPMI, 0, 0), -/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_MEMORY, 0, 0), -/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_CONFIG, 0, 0), -/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_BAR, 0, 0), -/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_SMBUS, 0, 0), -/* REGISTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* RELEASE */ OP_TABLE_ENTRY (AML_RELEASE_OP, 0, 0, 0), -/* RESERVED_BYTES */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0), -/* RESET */ OP_TABLE_ENTRY (AML_RESET_OP, 0, 0, 0), -/* RESOURCETEMPLATE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, 0, ACPI_BTYPE_BUFFER), -/* RESOURCETYPE_CONSUMER */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* RESOURCETYPE_PRODUCER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* RETURN */ OP_TABLE_ENTRY (AML_RETURN_OP, 0, 0, 0), -/* REVISION */ OP_TABLE_ENTRY (AML_REVISION_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SCOPE */ OP_TABLE_ENTRY (AML_SCOPE_OP, 0, NODE_AML_PACKAGE, 0), -/* SERIALIZERULE_NOTSERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* SERIALIZERULE_SERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* SHARETYPE_EXCLUSIVE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* SHARETYPE_SHARED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* SHIFTLEFT */ OP_TABLE_ENTRY (AML_SHIFT_LEFT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SHIFTRIGHT */ OP_TABLE_ENTRY (AML_SHIFT_RIGHT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SIGNAL */ OP_TABLE_ENTRY (AML_SIGNAL_OP, 0, 0, 0), -/* SIZEOF */ OP_TABLE_ENTRY (AML_SIZE_OF_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SLEEP */ OP_TABLE_ENTRY (AML_SLEEP_OP, 0, 0, 0), -/* STALL */ OP_TABLE_ENTRY (AML_STALL_OP, 0, 0, 0), -/* STARTDEPENDENTFN */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* STARTDEPENDENTFN_NOPRI */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* STORE */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), -/* STRING_LITERAL */ OP_TABLE_ENTRY (AML_STRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* SUBTRACT */ OP_TABLE_ENTRY (AML_SUBTRACT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SWITCH */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* THERMALZONE */ OP_TABLE_ENTRY (AML_THERMAL_ZONE_OP, 0, NODE_AML_PACKAGE, 0), -/* TIMER */ OP_TABLE_ENTRY (AML_TIMER_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* TOBCD */ OP_TABLE_ENTRY (AML_TO_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* TOBUFFER */ OP_TABLE_ENTRY (AML_TO_BUFFER_OP, 0, 0, ACPI_BTYPE_BUFFER), -/* TODECIMALSTRING */ OP_TABLE_ENTRY (AML_TO_DECSTRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* TOHEXSTRING */ OP_TABLE_ENTRY (AML_TO_HEXSTRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* TOINTEGER */ OP_TABLE_ENTRY (AML_TO_INTEGER_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* TOSTRING */ OP_TABLE_ENTRY (AML_TO_STRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* TOUUID */ OP_TABLE_ENTRY (AML_DWORD_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_INTEGER), -/* TRANSLATIONTYPE_DENSE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* TRANSLATIONTYPE_SPARSE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* TYPE_STATIC */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* TYPE_TRANSLATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, 0), -/* UNLOAD */ OP_TABLE_ENTRY (AML_UNLOAD_OP, 0, 0, 0), -/* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0), -/* UPDATERULE_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_PRESERVE, 0, 0), -/* UPDATERULE_ZEROS */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ZEROS,0, 0), -/* VAR_PACKAGE */ OP_TABLE_ENTRY (AML_VAR_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE), -/* VENDORLONG */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* VENDORSHORT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* WAIT */ OP_TABLE_ENTRY (AML_WAIT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* WHILE */ OP_TABLE_ENTRY (AML_WHILE_OP, 0, NODE_AML_PACKAGE, 0), -/* WORDBUSNUMBER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* WORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_WORD, 0, 0, ACPI_BTYPE_INTEGER), -/* WORDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* WORDSPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* XFERTYPE_8 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* XFERTYPE_8_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* XFERTYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* XOR */ OP_TABLE_ENTRY (AML_BIT_XOR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ZERO */ OP_TABLE_ENTRY (AML_ZERO_OP, 0, 0, ACPI_BTYPE_INTEGER), - -/*! [End] no source code translation !*/ - -}; - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslopcodes.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslopcodes.c deleted file mode 100644 index 1c6eef7248..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslopcodes.c +++ /dev/null @@ -1,811 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslopcode - AML opcode generation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslopcodes") - - -/* UUID support */ - -static UINT8 OpcMapToUUID[16] = -{ - 6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34 -}; - -/* Local prototypes */ - -static void -OpcDoAccessAs ( - ACPI_PARSE_OBJECT *Op); - -static void -OpcDoUnicode ( - ACPI_PARSE_OBJECT *Op); - -static void -OpcDoEisaId ( - ACPI_PARSE_OBJECT *Op); - -static void -OpcDoUuId ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: OpcAmlOpcodeUpdateWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Opcode update walk, ascending callback - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlOpcodeUpdateWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* - * Handle the Package() case where the actual opcode cannot be determined - * until the PackageLength operand has been folded and minimized. - * (PackageOp versus VarPackageOp) - * - * This is (as of ACPI 3.0) the only case where the AML opcode can change - * based upon the value of a parameter. - * - * The parser always inserts a VarPackage opcode, which can possibly be - * optimized to a Package opcode. - */ - if (Op->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE) - { - OpnDoPackage (Op); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlOpcodeWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML - * operands. - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlOpcodeWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - TotalParseNodes++; - - OpcGenerateAmlOpcode (Op); - OpnGenerateAmlOperands (Op); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OpcGetIntegerWidth - * - * PARAMETERS: Op - DEFINITION BLOCK op - * - * RETURN: none - * - * DESCRIPTION: Extract integer width from the table revision - * - ******************************************************************************/ - -void -OpcGetIntegerWidth ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child; - - - if (!Op) - { - return; - } - - if (Gbl_RevisionOverride) - { - AcpiUtSetIntegerWidth (Gbl_RevisionOverride); - } - else - { - Child = Op->Asl.Child; - Child = Child->Asl.Next; - Child = Child->Asl.Next; - - /* Use the revision to set the integer width */ - - AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer); - } -} - - -/******************************************************************************* - * - * FUNCTION: OpcSetOptimalIntegerSize - * - * PARAMETERS: Op - A parse tree node - * - * RETURN: Integer width, in bytes. Also sets the node AML opcode to the - * optimal integer AML prefix opcode. - * - * DESCRIPTION: Determine the optimal AML encoding of an integer. All leading - * zeros can be truncated to squeeze the integer into the - * minimal number of AML bytes. - * - ******************************************************************************/ - -UINT32 -OpcSetOptimalIntegerSize ( - ACPI_PARSE_OBJECT *Op) -{ - -#if 0 - /* - * TBD: - we don't want to optimize integers in the block header, but the - * code below does not work correctly. - */ - if (Op->Asl.Parent && - Op->Asl.Parent->Asl.Parent && - (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) - { - return 0; - } -#endif - - /* - * Check for the special AML integers first - Zero, One, Ones. - * These are single-byte opcodes that are the smallest possible - * representation of an integer. - * - * This optimization is optional. - */ - if (Gbl_IntegerOptimizationFlag) - { - switch (Op->Asl.Value.Integer) - { - case 0: - - Op->Asl.AmlOpcode = AML_ZERO_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, - Op, "Zero"); - return 1; - - case 1: - - Op->Asl.AmlOpcode = AML_ONE_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, - Op, "One"); - return 1; - - case ACPI_UINT32_MAX: - - /* Check for table integer width (32 or 64) */ - - if (AcpiGbl_IntegerByteWidth == 4) - { - Op->Asl.AmlOpcode = AML_ONES_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, - Op, "Ones"); - return 1; - } - break; - - case ACPI_UINT64_MAX: - - /* Check for table integer width (32 or 64) */ - - if (AcpiGbl_IntegerByteWidth == 8) - { - Op->Asl.AmlOpcode = AML_ONES_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, - Op, "Ones"); - return 1; - } - break; - - default: - break; - } - } - - /* Find the best fit using the various AML integer prefixes */ - - if (Op->Asl.Value.Integer <= ACPI_UINT8_MAX) - { - Op->Asl.AmlOpcode = AML_BYTE_OP; - return 1; - } - if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX) - { - Op->Asl.AmlOpcode = AML_WORD_OP; - return 2; - } - if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX) - { - Op->Asl.AmlOpcode = AML_DWORD_OP; - return 4; - } - else - { - if (AcpiGbl_IntegerByteWidth == 4) - { - AslError (ASL_WARNING, ASL_MSG_INTEGER_LENGTH, - Op, NULL); - - if (!Gbl_IgnoreErrors) - { - /* Truncate the integer to 32-bit */ - Op->Asl.AmlOpcode = AML_DWORD_OP; - return 4; - } - } - - Op->Asl.AmlOpcode = AML_QWORD_OP; - return 8; - } -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoAccessAs - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Implement the ACCESS_AS ASL keyword. - * - ******************************************************************************/ - -static void -OpcDoAccessAs ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - Op->Asl.AmlOpcodeLength = 1; - Next = Op->Asl.Child; - - /* First child is the access type */ - - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - /* Second child is the optional access attribute */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - Next->Asl.Value.Integer = 0; - } - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoUnicode - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Implement the UNICODE ASL "macro". Convert the input string - * to a unicode buffer. There is no Unicode AML opcode. - * - * Note: The Unicode string is 16 bits per character, no leading signature, - * with a 16-bit terminating NULL. - * - ******************************************************************************/ - -static void -OpcDoUnicode ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *InitializerOp; - UINT32 Length; - UINT32 Count; - UINT32 i; - UINT8 *AsciiString; - UINT16 *UnicodeString; - ACPI_PARSE_OBJECT *BufferLengthOp; - - - /* Change op into a buffer object */ - - Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - UtSetParseOpName (Op); - - /* Buffer Length is first, followed by the string */ - - BufferLengthOp = Op->Asl.Child; - InitializerOp = BufferLengthOp->Asl.Next; - - AsciiString = (UINT8 *) InitializerOp->Asl.Value.String; - - /* Create a new buffer for the Unicode string */ - - Count = strlen (InitializerOp->Asl.Value.String) + 1; - Length = Count * sizeof (UINT16); - UnicodeString = UtLocalCalloc (Length); - - /* Convert to Unicode string (including null terminator) */ - - for (i = 0; i < Count; i++) - { - UnicodeString[i] = (UINT16) AsciiString[i]; - } - - /* - * Just set the buffer size node to be the buffer length, regardless - * of whether it was previously an integer or a default_arg placeholder - */ - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; - BufferLengthOp->Asl.Value.Integer = Length; - UtSetParseOpName (BufferLengthOp); - - (void) OpcSetOptimalIntegerSize (BufferLengthOp); - - /* The Unicode string is a raw data buffer */ - - InitializerOp->Asl.Value.Buffer = (UINT8 *) UnicodeString; - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - InitializerOp->Asl.AmlLength = Length; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - InitializerOp->Asl.Child = NULL; - UtSetParseOpName (InitializerOp); -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoEisaId - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Convert a string EISA ID to numeric representation. See the - * Pnp BIOS Specification for details. Here is an excerpt: - * - * A seven character ASCII representation of the product - * identifier compressed into a 32-bit identifier. The seven - * character ID consists of a three character manufacturer code, - * a three character hexadecimal product identifier, and a one - * character hexadecimal revision number. The manufacturer code - * is a 3 uppercase character code that is compressed into 3 5-bit - * values as follows: - * 1) Find hex ASCII value for each letter - * 2) Subtract 40h from each ASCII value - * 3) Retain 5 least signficant bits for each letter by - * discarding upper 3 bits because they are always 0. - * 4) Compressed code = concatenate 0 and the 3 5-bit values - * - * The format of the compressed product identifier is as follows: - * Byte 0: Bit 7 - Reserved (0) - * Bits 6-2: - 1st character of compressed mfg code - * Bits 1-0 - Upper 2 bits of 2nd character of mfg code - * Byte 1: Bits 7-5 - Lower 3 bits of 2nd character of mfg code - * Bits 4-0 - 3rd character of mfg code - * Byte 2: Bits 7-4 - 1st hex digit of product number - * Bits 3-0 - 2nd hex digit of product number - * Byte 3: Bits 7-4 - 3st hex digit of product number - * Bits 3-0 - Hex digit of the revision number - * - ******************************************************************************/ - -static void -OpcDoEisaId ( - ACPI_PARSE_OBJECT *Op) -{ - UINT32 EisaId = 0; - UINT32 BigEndianId; - char *InString; - ACPI_STATUS Status = AE_OK; - UINT32 i; - - - InString = (char *) Op->Asl.Value.String; - - /* - * The EISAID string must be exactly 7 characters and of the form - * "UUUXXXX" -- 3 uppercase letters and 4 hex digits (e.g., "PNP0001") - */ - if (ACPI_STRLEN (InString) != 7) - { - Status = AE_BAD_PARAMETER; - } - else - { - /* Check all 7 characters for correct format */ - - for (i = 0; i < 7; i++) - { - /* First 3 characters must be uppercase letters */ - - if (i < 3) - { - if (!isupper ((int) InString[i])) - { - Status = AE_BAD_PARAMETER; - } - } - - /* Last 4 characters must be hex digits */ - - else if (!isxdigit ((int) InString[i])) - { - Status = AE_BAD_PARAMETER; - } - } - } - - if (ACPI_FAILURE (Status)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_EISAID, Op, Op->Asl.Value.String); - } - else - { - /* Create ID big-endian first (bits are contiguous) */ - - BigEndianId = - (UINT32) (InString[0] - 0x40) << 26 | - (UINT32) (InString[1] - 0x40) << 21 | - (UINT32) (InString[2] - 0x40) << 16 | - - (UtHexCharToValue (InString[3])) << 12 | - (UtHexCharToValue (InString[4])) << 8 | - (UtHexCharToValue (InString[5])) << 4 | - UtHexCharToValue (InString[6]); - - /* Swap to little-endian to get final ID (see function header) */ - - EisaId = AcpiUtDwordByteSwap (BigEndianId); - } - - /* - * Morph the Op into an integer, regardless of whether there - * was an error in the EISAID string - */ - Op->Asl.Value.Integer = EisaId; - - Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - (void) OpcSetOptimalIntegerSize (Op); - - /* Op is now an integer */ - - UtSetParseOpName (Op); -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoUiId - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Convert UUID string to 16-byte buffer - * - ******************************************************************************/ - -static void -OpcDoUuId ( - ACPI_PARSE_OBJECT *Op) -{ - char *InString; - char *Buffer; - ACPI_STATUS Status = AE_OK; - UINT32 i; - ACPI_PARSE_OBJECT *NewOp; - - - InString = (char *) Op->Asl.Value.String; - - if (ACPI_STRLEN (InString) != 36) - { - Status = AE_BAD_PARAMETER; - } - else - { - /* Check all 36 characters for correct format */ - - for (i = 0; i < 36; i++) - { - if ((i == 8) || (i == 13) || (i == 18) || (i == 23)) - { - if (InString[i] != '-') - { - Status = AE_BAD_PARAMETER; - } - } - else - { - if (!isxdigit ((int) InString[i])) - { - Status = AE_BAD_PARAMETER; - } - } - } - } - - Buffer = UtLocalCalloc (16); - - if (ACPI_FAILURE (Status)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_UUID, Op, Op->Asl.Value.String); - } - else for (i = 0; i < 16; i++) - { - Buffer[i] = (char) (UtHexCharToValue (InString[OpcMapToUUID[i]]) << 4); - Buffer[i] |= (char) UtHexCharToValue (InString[OpcMapToUUID[i] + 1]); - } - - /* Change Op to a Buffer */ - - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Common.AmlOpcode = AML_BUFFER_OP; - - /* Disable further optimization */ - - Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; - UtSetParseOpName (Op); - - /* Child node is the buffer length */ - - NewOp = TrAllocateNode (PARSEOP_INTEGER); - - NewOp->Asl.AmlOpcode = AML_BYTE_OP; - NewOp->Asl.Value.Integer = 16; - NewOp->Asl.Parent = Op; - - Op->Asl.Child = NewOp; - Op = NewOp; - - /* Peer to the child is the raw buffer data */ - - NewOp = TrAllocateNode (PARSEOP_RAW_DATA); - NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - NewOp->Asl.AmlLength = 16; - NewOp->Asl.Value.String = (char *) Buffer; - NewOp->Asl.Parent = Op->Asl.Parent; - - Op->Asl.Next = NewOp; -} - - -/******************************************************************************* - * - * FUNCTION: OpcGenerateAmlOpcode - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Generate the AML opcode associated with the node and its - * parse (lex/flex) keyword opcode. Essentially implements - * a mapping between the parse opcodes and the actual AML opcodes. - * - ******************************************************************************/ - -void -OpcGenerateAmlOpcode ( - ACPI_PARSE_OBJECT *Op) -{ - - UINT16 Index; - - - Index = (UINT16) (Op->Asl.ParseOpcode - ASL_PARSE_OPCODE_BASE); - - Op->Asl.AmlOpcode = AslKeywordMapping[Index].AmlOpcode; - Op->Asl.AcpiBtype = AslKeywordMapping[Index].AcpiBtype; - Op->Asl.CompileFlags |= AslKeywordMapping[Index].Flags; - - if (!Op->Asl.Value.Integer) - { - Op->Asl.Value.Integer = AslKeywordMapping[Index].Value; - } - - /* Special handling for some opcodes */ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_INTEGER: - /* - * Set the opcode based on the size of the integer - */ - (void) OpcSetOptimalIntegerSize (Op); - break; - - case PARSEOP_OFFSET: - - Op->Asl.AmlOpcodeLength = 1; - break; - - case PARSEOP_ACCESSAS: - - OpcDoAccessAs (Op); - break; - - case PARSEOP_EISAID: - - OpcDoEisaId (Op); - break; - - case PARSEOP_TOUUID: - - OpcDoUuId (Op); - break; - - case PARSEOP_UNICODE: - - OpcDoUnicode (Op); - break; - - case PARSEOP_INCLUDE: - - Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - Gbl_HasIncludeFiles = TRUE; - break; - - case PARSEOP_EXTERNAL: - - Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - break; - - default: - /* Nothing to do for other opcodes */ - break; - } - - return; -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asloperands.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asloperands.c deleted file mode 100644 index bf6dcf2cba..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asloperands.c +++ /dev/null @@ -1,1252 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asloperands - AML operand processing - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asloperands") - -/* Local prototypes */ - -static void -OpnDoField ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoBankField ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoBuffer ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoFieldCommon ( - ACPI_PARSE_OBJECT *FieldOp, - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoIndexField ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoLoadTable ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoMethod ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoMutex ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoRegion ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnAttachNameToNode ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: OpnDoMutex - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the operands for the MUTEX ASL keyword. - * - ******************************************************************************/ - -static void -OpnDoMutex ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - Next = Op->Asl.Child; - Next = Next->Asl.Next; - - if (Next->Asl.Value.Integer > 15) - { - AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL); - } - return; -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoMethod - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the operands for the METHOD ASL keyword. - * - ******************************************************************************/ - -static void -OpnDoMethod ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - /* Optional arguments for this opcode with defaults */ - - UINT8 NumArgs = 0; - UINT8 Serialized = 0; - UINT8 Concurrency = 0; - UINT8 MethodFlags; - - - /* Opcode and package length first */ - /* Method name */ - - Next = Op->Asl.Child; - - /* Num args */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - NumArgs = (UINT8) Next->Asl.Value.Integer; - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - - /* Serialized Flag */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - Serialized = (UINT8) Next->Asl.Value.Integer; - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - - /* Concurrency value (valid values are 0-15) */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - if (Next->Asl.Value.Integer > 15) - { - AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL); - } - Concurrency = (UINT8) Next->Asl.Value.Integer; - } - - /* Put the bits in their proper places */ - - MethodFlags = (UINT8) ((NumArgs & 0x7) | - ((Serialized & 0x1) << 3) | - ((Concurrency & 0xF) << 4)); - - /* Use the last node for the combined flags byte */ - - Next->Asl.Value.Integer = MethodFlags; - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - /* Save the arg count in the first node */ - - Op->Asl.Extra = NumArgs; -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoFieldCommon - * - * PARAMETERS: FieldOp - Node for an ASL field - * Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the various field keywords, - * FIELD, BANKFIELD, INDEXFIELD - * - ******************************************************************************/ - -static void -OpnDoFieldCommon ( - ACPI_PARSE_OBJECT *FieldOp, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - ACPI_PARSE_OBJECT *PkgLengthNode; - UINT32 CurrentBitOffset; - UINT32 NewBitOffset; - UINT8 AccessType; - UINT8 LockRule; - UINT8 UpdateRule; - UINT8 FieldFlags; - UINT32 MinimumLength; - - - /* AccessType -- not optional, so no need to check for DEFAULT_ARG */ - - AccessType = (UINT8) Op->Asl.Value.Integer; - Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* Set the access type in the parent (field) node for use later */ - - FieldOp->Asl.Value.Integer = AccessType; - - /* LockRule -- not optional, so no need to check for DEFAULT_ARG */ - - Next = Op->Asl.Next; - LockRule = (UINT8) Next->Asl.Value.Integer; - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* UpdateRule -- not optional, so no need to check for DEFAULT_ARG */ - - Next = Next->Asl.Next; - UpdateRule = (UINT8) Next->Asl.Value.Integer; - - /* - * Generate the flags byte. The various fields are already - * in the right bit position via translation from the - * keywords by the parser. - */ - FieldFlags = (UINT8) (AccessType | LockRule | UpdateRule); - - /* Use the previous node to be the FieldFlags node */ - - /* Set the node to RAW_DATA */ - - Next->Asl.Value.Integer = FieldFlags; - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - /* Process the FieldUnitList */ - - Next = Next->Asl.Next; - CurrentBitOffset = 0; - - while (Next) - { - /* Save the offset of this field unit */ - - Next->Asl.ExtraValue = CurrentBitOffset; - - switch (Next->Asl.ParseOpcode) - { - case PARSEOP_ACCESSAS: - - PkgLengthNode = Next->Asl.Child; - AccessType = (UINT8) PkgLengthNode->Asl.Value.Integer; - - /* Nothing additional to do */ - break; - - - case PARSEOP_OFFSET: - - /* New offset into the field */ - - PkgLengthNode = Next->Asl.Child; - NewBitOffset = ((UINT32) PkgLengthNode->Asl.Value.Integer) * 8; - - /* - * Examine the specified offset in relation to the - * current offset counter. - */ - if (NewBitOffset < CurrentBitOffset) - { - /* - * Not allowed to specify a backwards offset! - * Issue error and ignore this node. - */ - AslError (ASL_ERROR, ASL_MSG_BACKWARDS_OFFSET, PkgLengthNode, - NULL); - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - else if (NewBitOffset == CurrentBitOffset) - { - /* - * Offset is redundant; we don't need to output an - * offset opcode. Just set these nodes to default - */ - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - else - { - /* - * Valid new offset - set the value to be inserted into the AML - * and update the offset counter. - */ - PkgLengthNode->Asl.Value.Integer = - NewBitOffset - CurrentBitOffset; - CurrentBitOffset = NewBitOffset; - } - break; - - - case PARSEOP_NAMESEG: - case PARSEOP_RESERVED_BYTES: - - /* Named or reserved field entry */ - - PkgLengthNode = Next->Asl.Child; - NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer; - CurrentBitOffset += NewBitOffset; - - /* Save the current AccessAs value for error checking later */ - - switch (AccessType) - { - case AML_FIELD_ACCESS_ANY: - case AML_FIELD_ACCESS_BYTE: - case AML_FIELD_ACCESS_BUFFER: - default: - MinimumLength = 8; - break; - - case AML_FIELD_ACCESS_WORD: - MinimumLength = 16; - break; - - case AML_FIELD_ACCESS_DWORD: - MinimumLength = 32; - break; - - case AML_FIELD_ACCESS_QWORD: - MinimumLength = 64; - break; - } - - PkgLengthNode->Asl.ExtraValue = MinimumLength; - break; - - default: - /* All supported field opcodes must appear above */ - break; - } - - /* Move on to next entry in the field list */ - - Next = Next->Asl.Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoField - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the FIELD ASL keyword - * - ******************************************************************************/ - -static void -OpnDoField ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is field name */ - - Next = Op->Asl.Child; - - /* Second child is the AccessType */ - - OpnDoFieldCommon (Op, Next->Asl.Next); -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoIndexField - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the INDEXFIELD ASL keyword - * - ******************************************************************************/ - -static void -OpnDoIndexField ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the index name */ - - Next = Op->Asl.Child; - - /* Second child is the data name */ - - Next = Next->Asl.Next; - - /* Third child is the AccessType */ - - OpnDoFieldCommon (Op, Next->Asl.Next); -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoBankField - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the BANKFIELD ASL keyword - * - ******************************************************************************/ - -static void -OpnDoBankField ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the region name */ - - Next = Op->Asl.Child; - - /* Second child is the bank name */ - - Next = Next->Asl.Next; - - /* Third child is the bank value */ - - Next = Next->Asl.Next; - - /* Fourth child is the AccessType */ - - OpnDoFieldCommon (Op, Next->Asl.Next); -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoRegion - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Tries to get the length of the region. Can only do this at - * compile time if the length is a constant. - * - ******************************************************************************/ - -static void -OpnDoRegion ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the region name */ - - Next = Op->Asl.Child; - - /* Second child is the space ID*/ - - Next = Next->Asl.Next; - - /* Third child is the region offset */ - - Next = Next->Asl.Next; - - /* Fourth child is the region length */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_INTEGER) - { - Op->Asl.Value.Integer = Next->Asl.Value.Integer; - } - else - { - Op->Asl.Value.Integer = ACPI_UINT64_MAX; - } -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoBuffer - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the BUFFER ASL keyword. We - * build a single raw byte buffer from the initialization nodes, - * each parse node contains a buffer byte. - * - ******************************************************************************/ - -static void -OpnDoBuffer ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *BufferLengthOp; - - /* Optional arguments for this opcode with defaults */ - - UINT32 BufferLength = 0; - - - /* Opcode and package length first */ - /* Buffer Length is next, followed by the initializer list */ - - BufferLengthOp = Op->Asl.Child; - InitializerOp = BufferLengthOp->Asl.Next; - - /* - * If the BufferLength is not an INTEGER or was not specified in the ASL - * (DEFAULT_ARG), it is a TermArg that is - * evaluated at run-time, and we are therefore finished. - */ - if ((BufferLengthOp->Asl.ParseOpcode != PARSEOP_INTEGER) && - (BufferLengthOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - return; - } - - /* - * We want to count the number of items in the initializer list, because if - * it is larger than the buffer length, we will define the buffer size - * to be the size of the initializer list (as per the ACPI Specification) - */ - switch (InitializerOp->Asl.ParseOpcode) - { - case PARSEOP_INTEGER: - case PARSEOP_BYTECONST: - case PARSEOP_WORDCONST: - case PARSEOP_DWORDCONST: - - /* The peer list contains the byte list (if any...) */ - - while (InitializerOp) - { - /* For buffers, this is a list of raw bytes */ - - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - InitializerOp->Asl.AmlLength = 1; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - BufferLength++; - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - } - break; - - - case PARSEOP_STRING_LITERAL: - - /* - * Only one initializer, the string. Buffer must be big enough to hold - * the string plus the null termination byte - */ - BufferLength = strlen (InitializerOp->Asl.Value.String) + 1; - - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - InitializerOp->Asl.AmlLength = BufferLength; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - break; - - - case PARSEOP_RAW_DATA: - - /* Buffer nodes are already initialized (e.g. Unicode operator) */ - return; - - - case PARSEOP_DEFAULT_ARG: - break; - - - default: - AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, InitializerOp, - "Unknown buffer initializer opcode"); - printf ("Unknown buffer initializer opcode [%s]\n", - UtGetOpName (InitializerOp->Asl.ParseOpcode)); - return; - } - - /* Check if initializer list is longer than the buffer length */ - - if (BufferLengthOp->Asl.Value.Integer > BufferLength) - { - BufferLength = (UINT32) BufferLengthOp->Asl.Value.Integer; - } - - if (!BufferLength) - { - /* No length AND no items -- issue notice */ - - AslError (ASL_REMARK, ASL_MSG_BUFFER_LENGTH, BufferLengthOp, NULL); - - /* But go ahead and put the buffer length of zero into the AML */ - } - - /* - * Just set the buffer size node to be the buffer length, regardless - * of whether it was previously an integer or a default_arg placeholder - */ - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; - BufferLengthOp->Asl.Value.Integer = BufferLength; - - (void) OpcSetOptimalIntegerSize (BufferLengthOp); - - /* Remaining nodes are handled via the tree walk */ -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoPackage - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword. NOTE: - * can only be called after constants have been folded, to ensure - * that the PackageLength operand has been fully reduced. - * - ******************************************************************************/ - -void -OpnDoPackage ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *PackageLengthOp; - UINT32 PackageLength = 0; - - - /* Opcode and package length first, followed by the initializer list */ - - PackageLengthOp = Op->Asl.Child; - InitializerOp = PackageLengthOp->Asl.Next; - - /* Count the number of items in the initializer list */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* The peer list contains the byte list (if any...) */ - - while (InitializerOp) - { - PackageLength++; - InitializerOp = InitializerOp->Asl.Next; - } - } - - /* If package length is a constant, compare to the initializer list */ - - if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) || - (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST)) - { - if (PackageLengthOp->Asl.Value.Integer > PackageLength) - { - /* - * Allow package length to be longer than the initializer - * list -- but if the length of initializer list is nonzero, - * issue a message since this is probably a coding error, - * even though technically legal. - */ - if (PackageLength > 0) - { - AslError (ASL_REMARK, ASL_MSG_LIST_LENGTH_SHORT, - PackageLengthOp, NULL); - } - - PackageLength = (UINT32) PackageLengthOp->Asl.Value.Integer; - } - else if (PackageLengthOp->Asl.Value.Integer < PackageLength) - { - /* - * The package length is smaller than the length of the - * initializer list. This is an error as per the ACPI spec. - */ - AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH_LONG, - PackageLengthOp, NULL); - } - } - - if (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - /* - * This is the case if the PackageLength was left empty - Package() - * The package length becomes the length of the initializer list - */ - Op->Asl.Child->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Asl.Child->Asl.Value.Integer = PackageLength; - - /* Set the AML opcode */ - - (void) OpcSetOptimalIntegerSize (Op->Asl.Child); - } - - /* If not a variable-length package, check for a zero package length */ - - if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) || - (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST) || - (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)) - { - if (!PackageLength) - { - /* No length AND no initializer list -- issue a remark */ - - AslError (ASL_REMARK, ASL_MSG_PACKAGE_LENGTH, - PackageLengthOp, NULL); - - /* But go ahead and put the buffer length of zero into the AML */ - } - } - - /* - * If the PackageLength is a constant <= 255, we can change the - * AML opcode from VarPackage to a simple (ACPI 1.0) Package opcode. - */ - if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) && - (Op->Asl.Child->Asl.Value.Integer <= 255)) - { - Op->Asl.AmlOpcode = AML_PACKAGE_OP; - Op->Asl.ParseOpcode = PARSEOP_PACKAGE; - - /* - * Just set the package size node to be the package length, regardless - * of whether it was previously an integer or a default_arg placeholder - */ - PackageLengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - PackageLengthOp->Asl.AmlLength = 1; - PackageLengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - PackageLengthOp->Asl.Value.Integer = PackageLength; - } - - /* Remaining nodes are handled via the tree walk */ -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoLoadTable - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the LOADTABLE ASL keyword. - * - ******************************************************************************/ - -static void -OpnDoLoadTable ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the table signature */ - - Next = Op->Asl.Child; - - /* Second child is the OEM ID*/ - - Next = Next->Asl.Next; - - /* Third child is the OEM table ID */ - - Next = Next->Asl.Next; - - /* Fourth child is the RootPath string */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_ZERO) - { - Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; - Next->Asl.Value.String = "\\"; - Next->Asl.AmlLength = 2; - OpcGenerateAmlOpcode (Next); - } - -#ifdef ASL_FUTURE_IMPLEMENTATION - - /* TBD: NOT IMPLEMENTED */ - /* Fifth child is the [optional] ParameterPathString */ - /* Sixth child is the [optional] ParameterData */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == DEFAULT_ARG) - { - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = ZERO; - OpcGenerateAmlOpcode (Next); - } - - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == DEFAULT_ARG) - { - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = ZERO; - OpcGenerateAmlOpcode (Next); - } -#endif -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoDefinitionBlock - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the DEFINITIONBLOCK ASL keyword - * - ******************************************************************************/ - -static void -OpnDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child; - ACPI_SIZE Length; - UINT32 i; - char *Filename; - - - /* - * These nodes get stuffed into the table header. They are special - * cased when the table is written to the output file. - * - * Mark all of these nodes as non-usable so they won't get output - * as AML opcodes! - */ - - /* Get AML filename. Use it if non-null */ - - Child = Op->Asl.Child; - if (Child->Asl.Value.Buffer && - *Child->Asl.Value.Buffer && - (Gbl_UseDefaultAmlFilename)) - { - /* - * 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; - - /* Signature */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - if (Child->Asl.Value.String) - { - Gbl_TableSignature = Child->Asl.Value.String; - if (ACPI_STRLEN (Gbl_TableSignature) != 4) - { - AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, - "Length not exactly 4"); - } - - for (i = 0; i < 4; i++) - { - if (!isalnum ((int) Gbl_TableSignature[i])) - { - AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, - "Contains non-alphanumeric characters"); - } - } - } - - /* Revision */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - /* - * We used the revision to set the integer width earlier - */ - - /* OEMID */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* OEM TableID */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - if (Child->Asl.Value.String) - { - Length = ACPI_STRLEN (Child->Asl.Value.String); - Gbl_TableId = AcpiOsAllocate (Length + 1); - ACPI_STRCPY (Gbl_TableId, Child->Asl.Value.String); - - for (i = 0; i < Length; i++) - { - if (Gbl_TableId[i] == ' ') - { - Gbl_TableId[i] = 0; - break; - } - } - } - - /* OEM Revision */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; -} - - -/******************************************************************************* - * - * FUNCTION: UtGetArg - * - * PARAMETERS: Op - Get an argument for this op - * Argn - Nth argument to get - * - * RETURN: The argument (as an Op object). NULL if argument does not exist - * - * DESCRIPTION: Get the specified op's argument (peer) - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -UtGetArg ( - ACPI_PARSE_OBJECT *Op, - UINT32 Argn) -{ - ACPI_PARSE_OBJECT *Arg = NULL; - - - /* Get the requested argument object */ - - Arg = Op->Asl.Child; - while (Arg && Argn) - { - Argn--; - Arg = Arg->Asl.Next; - } - - return (Arg); -} - - -/******************************************************************************* - * - * FUNCTION: OpnAttachNameToNode - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: For the named ASL/AML operators, get the actual name from the - * argument list and attach it to the parent node so that we - * can get to it quickly later. - * - ******************************************************************************/ - -static void -OpnAttachNameToNode ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child = NULL; - - - if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) - { - Child = UtGetArg (Op, 0); - } - else switch (Op->Asl.AmlOpcode) - { - case AML_DATA_REGION_OP: - case AML_DEVICE_OP: - case AML_EVENT_OP: - case AML_METHOD_OP: - case AML_MUTEX_OP: - case AML_REGION_OP: - case AML_POWER_RES_OP: - case AML_PROCESSOR_OP: - case AML_THERMAL_ZONE_OP: - case AML_NAME_OP: - case AML_SCOPE_OP: - - Child = UtGetArg (Op, 0); - break; - - case AML_ALIAS_OP: - - Child = UtGetArg (Op, 1); - break; - - case AML_CREATE_BIT_FIELD_OP: - case AML_CREATE_BYTE_FIELD_OP: - case AML_CREATE_WORD_FIELD_OP: - case AML_CREATE_DWORD_FIELD_OP: - case AML_CREATE_QWORD_FIELD_OP: - - Child = UtGetArg (Op, 2); - break; - - case AML_CREATE_FIELD_OP: - - Child = UtGetArg (Op, 3); - break; - - case AML_BANK_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_FIELD_OP: - - return; - - default: - return; - } - - if (Child) - { - UtAttachNamepathToOwner (Op, Child); - } -} - - -/******************************************************************************* - * - * FUNCTION: OpnGenerateAmlOperands - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more - * complex AML opcodes require processing of the child nodes - * (arguments/operands). - * - ******************************************************************************/ - -void -OpnGenerateAmlOperands ( - ACPI_PARSE_OBJECT *Op) -{ - - - if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE) - { - return; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - OpnDoDefinitionBlock (Op); - break; - - case PARSEOP_METHOD: - OpnDoMethod (Op); - break; - - case PARSEOP_MUTEX: - OpnDoMutex (Op); - break; - - case PARSEOP_FIELD: - OpnDoField (Op); - break; - - case PARSEOP_INDEXFIELD: - OpnDoIndexField (Op); - break; - - case PARSEOP_BANKFIELD: - OpnDoBankField (Op); - break; - - case PARSEOP_BUFFER: - OpnDoBuffer (Op); - break; - - case PARSEOP_LOADTABLE: - OpnDoLoadTable (Op); - break; - - case PARSEOP_OPERATIONREGION: - OpnDoRegion (Op); - break; - - case PARSEOP_RESOURCETEMPLATE: - RsDoResourceTemplate (Op); - break; - - case PARSEOP_NAMESEG: - case PARSEOP_NAMESTRING: - case PARSEOP_METHODCALL: - case PARSEOP_STRING_LITERAL: - break; - - default: - break; - } - - /* TBD: move */ - - OpnAttachNameToNode (Op); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslopt.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslopt.c deleted file mode 100644 index 6f0b756c0f..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslopt.c +++ /dev/null @@ -1,868 +0,0 @@ -/****************************************************************************** - * - * Module Name: aslopt- Compiler optimizations - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" - -#include "acparser.h" -#include "amlcode.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslopt") - - -static UINT32 OptTotal = 0; - -/* Local prototypes */ - -static ACPI_STATUS -OptSearchToRoot ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - ACPI_BUFFER *TargetPath, - char **NewPath); - -static ACPI_STATUS -OptBuildShortestPath ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - ACPI_BUFFER *CurrentPath, - ACPI_BUFFER *TargetPath, - ACPI_SIZE AmlNameStringLength, - UINT8 IsDeclaration, - char **ReturnNewPath); - -static ACPI_STATUS -OptOptimizeNameDeclaration ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - char *AmlNameString, - char **NewPath); - - -/******************************************************************************* - * - * FUNCTION: OptSearchToRoot - * - * PARAMETERS: Op - Current parser op - * WalkState - Current state - * CurrentNode - Where we are in the namespace - * TargetNode - Node to which we are referring - * TargetPath - External full path to the target node - * NewPath - Where the optimized path is returned - * - * RETURN: Status - * - * DESCRIPTION: Attempt to optimize a reference to a single 4-character ACPI - * name utilizing the search-to-root name resolution algorithm - * that is used by AML interpreters. - * - ******************************************************************************/ - -static ACPI_STATUS -OptSearchToRoot ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - ACPI_BUFFER *TargetPath, - char **NewPath) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_STATUS Status; - char *Path; - - - ACPI_FUNCTION_NAME (OptSearchToRoot); - - - /* - * Check if search-to-root can be utilized. Use the last NameSeg of - * the NamePath and 1) See if can be found and 2) If found, make - * sure that it is the same node that we want. If there is another - * name in the search path before the one we want, the nodes will - * not match, and we cannot use this optimization. - */ - Path = &(((char *) TargetPath->Pointer)[TargetPath->Length - - ACPI_NAME_SIZE]), - ScopeInfo.Scope.Node = CurrentNode; - - /* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */ - - Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * We found the name, but we must check to make sure that the node - * matches. Otherwise, there is another identical name in the search - * path that precludes the use of this optimization. - */ - if (Node != TargetNode) - { - /* - * This means that another object with the same name was found first, - * and we cannot use this optimization. - */ - return (AE_NOT_FOUND); - } - - /* Found the node, we can use this optimization */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "NAMESEG: %-24s", Path)); - - /* We must allocate a new string for the name (TargetPath gets deleted) */ - - *NewPath = ACPI_ALLOCATE_ZEROED (ACPI_NAME_SIZE + 1); - ACPI_STRCPY (*NewPath, Path); - - if (ACPI_STRNCMP (*NewPath, "_T_", 3)) - { - AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op, - *NewPath); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OptBuildShortestPath - * - * PARAMETERS: Op - Current parser op - * WalkState - Current state - * CurrentNode - Where we are in the namespace - * TargetNode - Node to which we are referring - * CurrentPath - External full path to the current node - * TargetPath - External full path to the target node - * AmlNameStringLength - Length of the original namepath - * IsDeclaration - TRUE for declaration, FALSE for reference - * ReturnNewPath - Where the optimized path is returned - * - * RETURN: Status - * - * DESCRIPTION: Build an optimal NamePath using carats - * - ******************************************************************************/ - -static ACPI_STATUS -OptBuildShortestPath ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - ACPI_BUFFER *CurrentPath, - ACPI_BUFFER *TargetPath, - ACPI_SIZE AmlNameStringLength, - UINT8 IsDeclaration, - char **ReturnNewPath) -{ - UINT32 NumCommonSegments; - UINT32 MaxCommonSegments; - UINT32 Index; - UINT32 NumCarats; - UINT32 i; - char *NewPath; - char *NewPathExternal; - ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_STATUS Status; - BOOLEAN SubPath = FALSE; - - - ACPI_FUNCTION_NAME (OptBuildShortestPath); - - - ScopeInfo.Scope.Node = CurrentNode; - - /* - * Determine the maximum number of NameSegs that the Target and Current paths - * can possibly have in common. (To optimize, we have to have at least 1) - * - * Note: The external NamePath string lengths are always a multiple of 5 - * (ACPI_NAME_SIZE + separator) - */ - MaxCommonSegments = TargetPath->Length / ACPI_PATH_SEGMENT_LENGTH; - if (CurrentPath->Length < TargetPath->Length) - { - MaxCommonSegments = CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH; - } - - /* - * Determine how many NameSegs the two paths have in common. - * (Starting from the root) - */ - for (NumCommonSegments = 0; - NumCommonSegments < MaxCommonSegments; - NumCommonSegments++) - { - /* Compare two single NameSegs */ - - if (ACPI_STRNCMP ( - &((char *) TargetPath->Pointer)[(NumCommonSegments * - ACPI_PATH_SEGMENT_LENGTH) + 1], - &((char *) CurrentPath->Pointer)[(NumCommonSegments * - ACPI_PATH_SEGMENT_LENGTH) + 1], - ACPI_NAME_SIZE)) - { - /* Mismatch */ - - break; - } - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %d", - NumCommonSegments)); - - /* There must be at least 1 common NameSeg in order to optimize */ - - if (NumCommonSegments == 0) - { - return (AE_NOT_FOUND); - } - - if (NumCommonSegments == MaxCommonSegments) - { - if (CurrentPath->Length == TargetPath->Length) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SAME PATH")); - return (AE_NOT_FOUND); - } - else - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SUBPATH")); - SubPath = TRUE; - } - } - - /* Determine how many prefix Carats are required */ - - NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) - - NumCommonSegments; - - /* - * Construct a new target string - */ - NewPathExternal = ACPI_ALLOCATE_ZEROED ( - TargetPath->Length + NumCarats + 1); - - /* Insert the Carats into the Target string */ - - for (i = 0; i < NumCarats; i++) - { - NewPathExternal[i] = '^'; - } - - /* - * Copy only the necessary (optimal) segments from the original - * target string - */ - Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1; - - /* Special handling for exact subpath in a name declaration */ - - if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length)) - { - /* - * The current path is longer than the target, and the target is a - * subpath of the current path. We must include one more NameSeg of - * the target path - */ - Index -= ACPI_PATH_SEGMENT_LENGTH; - - /* Special handling for Scope() operator */ - - if (Op->Asl.AmlOpcode == AML_SCOPE_OP) - { - NewPathExternal[i] = '^'; - i++; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "(EXTRA ^)")); - } - } - - /* Make sure we haven't gone off the end of the target path */ - - if (Index > TargetPath->Length) - { - Index = TargetPath->Length; - } - - ACPI_STRCPY (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal)); - - /* - * Internalize the new target string and check it against the original - * string to make sure that this is in fact an optimization. If the - * original string is already optimal, there is no point in continuing. - */ - Status = AcpiNsInternalizeName (NewPathExternal, &NewPath); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Internalizing new NamePath", - ASL_NO_ABORT); - ACPI_FREE (NewPathExternal); - return (Status); - } - - if (ACPI_STRLEN (NewPath) >= AmlNameStringLength) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - " NOT SHORTER (New %u old %u)", - (UINT32) ACPI_STRLEN (NewPath), (UINT32) AmlNameStringLength)); - ACPI_FREE (NewPathExternal); - return (AE_NOT_FOUND); - } - - /* - * Check to make sure that the optimization finds the node we are - * looking for. This is simply a sanity check on the new - * path that has been created. - */ - Status = AcpiNsLookup (&ScopeInfo, NewPath, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); - if (ACPI_SUCCESS (Status)) - { - /* Found the namepath, but make sure the node is correct */ - - if (Node == TargetNode) - { - /* The lookup matched the node, accept this optimization */ - - AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, - Op, NewPathExternal); - *ReturnNewPath = NewPath; - } - else - { - /* Node is not correct, do not use this optimization */ - - Status = AE_NOT_FOUND; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - found wrong node"); - } - } - else - { - /* The lookup failed, we obviously cannot use this optimization */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - did not find node"); - } - - ACPI_FREE (NewPathExternal); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: OptOptimizeNameDeclaration - * - * PARAMETERS: Op - Current parser op - * WalkState - Current state - * CurrentNode - Where we are in the namespace - * AmlNameString - Unoptimized namepath - * NewPath - Where the optimized path is returned - * - * RETURN: Status. AE_OK If path is optimized - * - * DESCRIPTION: Perform a simple optimization of removing an extraneous - * backslash prefix if we are already at the root scope. - * - ******************************************************************************/ - -static ACPI_STATUS -OptOptimizeNameDeclaration ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - char *AmlNameString, - char **NewPath) -{ - ACPI_STATUS Status; - char *NewPathExternal; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (OptOptimizeNameDeclaration); - - - if (((CurrentNode == AcpiGbl_RootNode) || - (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) && - (AmlNameString[0] == '\\')) - { - /* - * The current scope is the root, and the namepath has a root prefix - * that is therefore extraneous. Remove it. - */ - *NewPath = &AmlNameString[1]; - - /* Debug output */ - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath, - NULL, &NewPathExternal); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Externalizing NamePath", - ASL_NO_ABORT); - return (Status); - } - - /* - * Check to make sure that the optimization finds the node we are - * looking for. This is simply a sanity check on the new - * path that has been created. - */ - ScopeInfo.Scope.Node = CurrentNode; - Status = AcpiNsLookup (&ScopeInfo, *NewPath, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); - if (ACPI_SUCCESS (Status)) - { - /* Found the namepath, but make sure the node is correct */ - - if (Node == TargetNode) - { - /* The lookup matched the node, accept this optimization */ - - AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, - Op, NewPathExternal); - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "AT ROOT: %-24s", NewPathExternal)); - } - else - { - /* Node is not correct, do not use this optimization */ - - Status = AE_NOT_FOUND; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - " ***** WRONG NODE")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - found wrong node"); - } - } - else - { - /* The lookup failed, we obviously cannot use this optimization */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - " ***** NOT FOUND")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - did not find node"); - } - - ACPI_FREE (NewPathExternal); - return (Status); - } - - /* Could not optimize */ - - return (AE_NOT_FOUND); -} - - -/******************************************************************************* - * - * FUNCTION: OptOptimizeNamePath - * - * PARAMETERS: Op - Current parser op - * Flags - Opcode info flags - * WalkState - Current state - * AmlNameString - Unoptimized namepath - * TargetNode - Node to which AmlNameString refers - * - * RETURN: None. If path is optimized, the Op is updated with new path - * - * DESCRIPTION: Optimize a Named Declaration or Reference to the minimal length. - * Must take into account both the current location in the - * namespace and the actual reference path. - * - ******************************************************************************/ - -void -OptOptimizeNamePath ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags, - ACPI_WALK_STATE *WalkState, - char *AmlNameString, - ACPI_NAMESPACE_NODE *TargetNode) -{ - ACPI_STATUS Status; - ACPI_BUFFER TargetPath; - ACPI_BUFFER CurrentPath; - ACPI_SIZE AmlNameStringLength; - ACPI_NAMESPACE_NODE *CurrentNode; - char *ExternalNameString; - char *NewPath = NULL; - ACPI_SIZE HowMuchShorter; - ACPI_PARSE_OBJECT *NextOp; - - - ACPI_FUNCTION_TRACE (OptOptimizeNamePath); - - - /* This is an optional optimization */ - - if (!Gbl_ReferenceOptimizationFlag) - { - return_VOID; - } - - /* Various required items */ - - if (!TargetNode || !WalkState || !AmlNameString || !Op->Common.Parent) - { - return_VOID; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "%5d [%12.12s] [%12.12s] ", - Op->Asl.LogicalLineNumber, - AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), - AcpiPsGetOpcodeName (Op->Common.AmlOpcode))); - - if (!(Flags & (AML_NAMED | AML_CREATE))) - { - if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) - { - /* We don't want to fuss with actual name declaration nodes here */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "******* NAME DECLARATION\n")); - return_VOID; - } - } - - /* - * The original path must be longer than one NameSeg (4 chars) for there - * to be any possibility that it can be optimized to a shorter string - */ - AmlNameStringLength = ACPI_STRLEN (AmlNameString); - if (AmlNameStringLength <= ACPI_NAME_SIZE) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "NAMESEG %4.4s\n", AmlNameString)); - return_VOID; - } - - /* - * We need to obtain the node that represents the current scope -- where - * we are right now in the namespace. We will compare this path - * against the Namepath, looking for commonality. - */ - CurrentNode = AcpiGbl_RootNode; - if (WalkState->ScopeInfo) - { - CurrentNode = WalkState->ScopeInfo->Scope.Node; - } - - if (Flags & (AML_NAMED | AML_CREATE)) - { - /* This is the declaration of a new name */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "NAME")); - - /* - * The node of interest is the parent of this node - * (the containing scope) - */ - CurrentNode = Op->Asl.Parent->Asl.Node; - if (!CurrentNode) - { - CurrentNode = AcpiGbl_RootNode; - } - } - else - { - /* This is a reference to an existing named object */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "REF ")); - } - - /* - * Obtain the full paths to the two nodes that we are interested in - * (Target and current namespace location) in external - * format -- something we can easily manipulate - */ - TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (TargetNode, &TargetPath); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Getting Target NamePath", - ASL_NO_ABORT); - return_VOID; - } - TargetPath.Length--; /* Subtract one for null terminator */ - - /* CurrentPath is the path to this scope (where we are in the namespace) */ - - CurrentPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Getting Current NamePath", - ASL_NO_ABORT); - return_VOID; - } - CurrentPath.Length--; /* Subtract one for null terminator */ - - /* Debug output only */ - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, AmlNameString, - NULL, &ExternalNameString); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Externalizing NamePath", - ASL_NO_ABORT); - return_VOID; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "%37s (%2u) ==> %-32s(%2u) %-32s", - (char *) CurrentPath.Pointer, (UINT32) CurrentPath.Length, - (char *) TargetPath.Pointer, (UINT32) TargetPath.Length, ExternalNameString)); - - ACPI_FREE (ExternalNameString); - - /* - * Attempt an optmization depending on the type of namepath - */ - if (Flags & (AML_NAMED | AML_CREATE)) - { - /* - * This is a named opcode and the namepath is a name declaration, not - * a reference. - */ - Status = OptOptimizeNameDeclaration (Op, WalkState, CurrentNode, - TargetNode, AmlNameString, &NewPath); - if (ACPI_FAILURE (Status)) - { - /* - * 2) now attempt to - * optimize the namestring with carats (up-arrow) - */ - Status = OptBuildShortestPath (Op, WalkState, CurrentNode, - TargetNode, &CurrentPath, &TargetPath, - AmlNameStringLength, 1, &NewPath); - } - } - else - { - /* - * This is a reference to an existing named object - * - * 1) Check if search-to-root can be utilized using the last - * NameSeg of the NamePath - */ - Status = OptSearchToRoot (Op, WalkState, CurrentNode, - TargetNode, &TargetPath, &NewPath); - if (ACPI_FAILURE (Status)) - { - /* - * 2) Search-to-root could not be used, now attempt to - * optimize the namestring with carats (up-arrow) - */ - Status = OptBuildShortestPath (Op, WalkState, CurrentNode, - TargetNode, &CurrentPath, &TargetPath, - AmlNameStringLength, 0, &NewPath); - } - } - - /* - * Success from above indicates that the NamePath was successfully - * optimized. We need to update the parse op with the new name - */ - if (ACPI_SUCCESS (Status)) - { - HowMuchShorter = (AmlNameStringLength - ACPI_STRLEN (NewPath)); - OptTotal += HowMuchShorter; - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2u (%u)", - (UINT32) HowMuchShorter, OptTotal)); - - if (Flags & AML_NAMED) - { - if (Op->Asl.AmlOpcode == AML_ALIAS_OP) - { - /* - * ALIAS is the only oddball opcode, the name declaration - * (alias name) is the second operand - */ - Op->Asl.Child->Asl.Next->Asl.Value.String = NewPath; - Op->Asl.Child->Asl.Next->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - else - { - Op->Asl.Child->Asl.Value.String = NewPath; - Op->Asl.Child->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - } - else if (Flags & AML_CREATE) - { - /* Name must appear as the last parameter */ - - NextOp = Op->Asl.Child; - while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) - { - NextOp = NextOp->Asl.Next; - } - /* Update the parse node with the new NamePath */ - - NextOp->Asl.Value.String = NewPath; - NextOp->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - else - { - /* Update the parse node with the new NamePath */ - - Op->Asl.Value.String = NewPath; - Op->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - } - else - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ALREADY OPTIMAL")); - } - - /* Cleanup path buffers */ - - ACPI_FREE (TargetPath.Pointer); - ACPI_FREE (CurrentPath.Pointer); - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "\n")); - return_VOID; -} - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslpredef.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslpredef.c deleted file mode 100644 index ae1b773814..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslpredef.c +++ /dev/null @@ -1,831 +0,0 @@ -/****************************************************************************** - * - * Module Name: aslpredef - support for ACPI predefined names - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define ACPI_CREATE_PREDEFINED_TABLE - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" -#include "acparser.h" -#include "acpredef.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslpredef") - - -/* Local prototypes */ - -static UINT32 -ApCheckForSpecialName ( - ACPI_PARSE_OBJECT *Op, - char *Name); - -static void -ApCheckObjectType ( - ACPI_PARSE_OBJECT *Op, - UINT32 ExpectedBtypes); - -static void -ApGetExpectedTypes ( - char *Buffer, - UINT32 ExpectedBtypes); - - -/* - * Names for the types that can be returned by the predefined objects. - * Used for warning messages. Must be in the same order as the ACPI_RTYPEs - */ -static const char *AcpiRtypeNames[] = -{ - "/Integer", - "/String", - "/Buffer", - "/Package", - "/Reference", -}; - -/* - * Predefined names for use in Resource Descriptors. These names do not - * appear in the global Predefined Name table (since these names never - * appear in actual AML byte code, only in the original ASL) - */ -static const ACPI_PREDEFINED_INFO ResourceNames[] = { - {{"_ALN", 0, 0}}, - {{"_ASI", 0, 0}}, - {{"_ASZ", 0, 0}}, - {{"_ATT", 0, 0}}, - {{"_BAS", 0, 0}}, - {{"_BM_", 0, 0}}, - {{"_DEC", 0, 0}}, - {{"_GRA", 0, 0}}, - {{"_HE_", 0, 0}}, - {{"_INT", 0, 0}}, - {{"_LEN", 0, 0}}, - {{"_LL_", 0, 0}}, - {{"_MAF", 0, 0}}, - {{"_MAX", 0, 0}}, - {{"_MEM", 0, 0}}, - {{"_MIF", 0, 0}}, - {{"_MIN", 0, 0}}, - {{"_MTP", 0, 0}}, - {{"_RBO", 0, 0}}, - {{"_RBW", 0, 0}}, - {{"_RNG", 0, 0}}, - {{"_RT_", 0, 0}}, /* Acpi 3.0 */ - {{"_RW_", 0, 0}}, - {{"_SHR", 0, 0}}, - {{"_SIZ", 0, 0}}, - {{"_TRA", 0, 0}}, - {{"_TRS", 0, 0}}, - {{"_TSF", 0, 0}}, /* Acpi 3.0 */ - {{"_TTP", 0, 0}}, - {{"_TYP", 0, 0}}, - {{{0,0,0,0}, 0, 0}} /* Table terminator */ -}; - -static const ACPI_PREDEFINED_INFO ScopeNames[] = { - {{"_SB_", 0, 0}}, - {{"_SI_", 0, 0}}, - {{"_TZ_", 0, 0}}, - {{{0,0,0,0}, 0, 0}} /* Table terminator */ -}; - - -/******************************************************************************* - * - * FUNCTION: ApCheckForPredefinedMethod - * - * PARAMETERS: Op - A parse node of type "METHOD". - * MethodInfo - Saved info about this method - * - * RETURN: None - * - * DESCRIPTION: If method is a predefined name, check that the number of - * arguments and the return type (returns a value or not) - * is correct. - * - ******************************************************************************/ - -void -ApCheckForPredefinedMethod ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo) -{ - UINT32 Index; - UINT32 RequiredArgsCurrent; - UINT32 RequiredArgsOld; - - - /* Check for a match against the predefined name list */ - - Index = ApCheckForPredefinedName (Op, Op->Asl.NameSeg); - - switch (Index) - { - case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ - case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ - case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ - - /* Just return, nothing to do */ - break; - - - case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ - - Gbl_ReservedMethods++; - - /* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */ - - if (MethodInfo->NumArguments != 0) - { - sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName, 0); - - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, - MsgBuffer); - } - break; - - - default: - /* - * Matched a predefined method name - * - * Validate the ASL-defined argument count. Allow two different legal - * arg counts. - */ - Gbl_ReservedMethods++; - - RequiredArgsCurrent = PredefinedNames[Index].Info.ParamCount & 0x0F; - RequiredArgsOld = PredefinedNames[Index].Info.ParamCount >> 4; - - if ((MethodInfo->NumArguments != RequiredArgsCurrent) && - (MethodInfo->NumArguments != RequiredArgsOld)) - { - sprintf (MsgBuffer, "%4.4s requires %d", - PredefinedNames[Index].Info.Name, RequiredArgsCurrent); - - if (MethodInfo->NumArguments > RequiredArgsCurrent) - { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, - MsgBuffer); - } - else - { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, - MsgBuffer); - } - } - - /* - * Check if method returns no value, but the predefined name is - * required to return a value - */ - if (MethodInfo->NumReturnNoValue && - PredefinedNames[Index].Info.ExpectedBtypes) - { - ApGetExpectedTypes (StringBuffer, - PredefinedNames[Index].Info.ExpectedBtypes); - - sprintf (MsgBuffer, "%s required for %4.4s", - StringBuffer, PredefinedNames[Index].Info.Name); - - AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, - MsgBuffer); - } - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: ApCheckPredefinedReturnValue - * - * PARAMETERS: Op - A parse node of type "RETURN". - * MethodInfo - Saved info about this method - * - * RETURN: None - * - * DESCRIPTION: If method is a predefined name, attempt to validate the return - * value. Only "static" types can be validated - a simple return - * of an integer/string/buffer/package or a named reference to - * a static object. Values such as a Localx or Argx or a control - * method invocation are not checked. - * - ******************************************************************************/ - -void -ApCheckPredefinedReturnValue ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo) -{ - UINT32 Index; - ACPI_PARSE_OBJECT *ReturnValueOp; - - - /* Check parent method for a match against the predefined name list */ - - Index = ApCheckForPredefinedName (MethodInfo->Op, - MethodInfo->Op->Asl.NameSeg); - - switch (Index) - { - case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ - case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ - case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ - case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ - - /* Just return, nothing to do */ - return; - - default: /* A standard predefined ACPI name */ - - /* Exit if no return value expected */ - - if (!PredefinedNames[Index].Info.ExpectedBtypes) - { - return; - } - - /* Get the object returned, it is the next argument */ - - ReturnValueOp = Op->Asl.Child; - switch (ReturnValueOp->Asl.ParseOpcode) - { - case PARSEOP_ZERO: - case PARSEOP_ONE: - case PARSEOP_ONES: - case PARSEOP_INTEGER: - case PARSEOP_STRING_LITERAL: - case PARSEOP_BUFFER: - case PARSEOP_PACKAGE: - - /* Static data return object - check against expected type */ - - ApCheckObjectType (ReturnValueOp, - PredefinedNames[Index].Info.ExpectedBtypes); - break; - - default: - - /* - * All other ops are very difficult or impossible to typecheck at - * compile time. These include all Localx, Argx, and method - * invocations. Also, NAMESEG and NAMESTRING because the type of - * any named object can be changed at runtime (for example, - * CopyObject will change the type of the target object.) - */ - break; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: ApCheckForPredefinedObject - * - * PARAMETERS: Op - A parse node - * Name - The ACPI name to be checked - * - * RETURN: None - * - * DESCRIPTION: Check for a predefined name for a static object (created via - * the ASL Name operator). If it is a predefined ACPI name, ensure - * that the name does not require any arguments (which would - * require a control method implemenation of the name), and that - * the type of the object is one of the expected types for the - * predefined name. - * - ******************************************************************************/ - -void -ApCheckForPredefinedObject ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - UINT32 Index; - - - /* - * Check for a real predefined name -- not a resource descriptor name - * or a predefined scope name - */ - Index = ApCheckForPredefinedName (Op, Name); - - switch (Index) - { - case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ - case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ - case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ - - /* Nothing to do */ - return; - - case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ - - /* - * These names must be control methods, by definition in ACPI spec. - * Also because they are defined to return no value. None of them - * require any arguments. - */ - AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, - "with zero arguments"); - return; - - default: /* A standard predefined ACPI name */ - - /* - * If this predefined name requires input arguments, then - * it must be implemented as a control method - */ - if (PredefinedNames[Index].Info.ParamCount > 0) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, - "with arguments"); - return; - } - - /* - * If no return value is expected from this predefined name, then - * it follows that it must be implemented as a control method - * (with zero args, because the args > 0 case was handled above) - * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx - */ - if (!PredefinedNames[Index].Info.ExpectedBtypes) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, - "with zero arguments"); - return; - } - - /* Typecheck the actual object, it is the next argument */ - - ApCheckObjectType (Op->Asl.Child->Asl.Next, - PredefinedNames[Index].Info.ExpectedBtypes); - return; - } -} - - -/******************************************************************************* - * - * FUNCTION: ApCheckForPredefinedName - * - * PARAMETERS: Op - A parse node - * Name - NameSeg to check - * - * RETURN: None - * - * DESCRIPTION: Check a NameSeg against the reserved list. - * - ******************************************************************************/ - -UINT32 -ApCheckForPredefinedName ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - UINT32 i; - - - if (Name[0] == 0) - { - AcpiOsPrintf ("Found a null name, external = %s\n", - Op->Asl.ExternalName); - } - - /* All reserved names are prefixed with a single underscore */ - - if (Name[0] != '_') - { - return (ACPI_NOT_RESERVED_NAME); - } - - /* Check for a standard predefined method name */ - - for (i = 0; PredefinedNames[i].Info.Name[0]; i++) - { - if (ACPI_COMPARE_NAME (Name, PredefinedNames[i].Info.Name)) - { - /* Return index into predefined array */ - return (i); - } - } - - /* Check for resource names and predefined scope names */ - - for (i = 0; ResourceNames[i].Info.Name[0]; i++) - { - if (ACPI_COMPARE_NAME (Name, ResourceNames[i].Info.Name)) - { - return (ACPI_PREDEFINED_NAME); - } - } - - for (i = 0; ScopeNames[i].Info.Name[0]; i++) - { - if (ACPI_COMPARE_NAME (Name, ScopeNames[i].Info.Name)) - { - return (ACPI_PREDEFINED_NAME); - } - } - - /* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */ - - return (ApCheckForSpecialName (Op, Name)); -} - - -/******************************************************************************* - * - * FUNCTION: ApCheckForSpecialName - * - * PARAMETERS: Op - A parse node - * Name - NameSeg to check - * - * RETURN: None - * - * DESCRIPTION: Check for the "special" predefined names - - * _Lxx, _Exx, _Qxx, _Wxx, and _T_x - * - ******************************************************************************/ - -static UINT32 -ApCheckForSpecialName ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - - /* - * Check for the "special" predefined names. We already know that the - * first character is an underscore. - * GPE: _Lxx - * GPE: _Exx - * GPE: _Wxx - * EC: _Qxx - */ - if ((Name[1] == 'L') || - (Name[1] == 'E') || - (Name[1] == 'W') || - (Name[1] == 'Q')) - { - /* The next two characters must be hex digits */ - - if ((isxdigit ((int) Name[2])) && - (isxdigit ((int) Name[3]))) - { - return (ACPI_EVENT_RESERVED_NAME); - } - } - - /* Check for the names reserved for the compiler itself: _T_x */ - - else if ((Op->Asl.ExternalName[1] == 'T') && - (Op->Asl.ExternalName[2] == '_')) - { - /* Ignore if actually emitted by the compiler */ - - if (Op->Asl.CompileFlags & NODE_COMPILER_EMITTED) - { - return (ACPI_NOT_RESERVED_NAME); - } - - /* - * Was not actually emitted by the compiler. This is a special case, - * however. If the ASL code being compiled was the result of a - * dissasembly, it may possibly contain valid compiler-emitted names - * of the form "_T_x". We don't want to issue an error or even a - * warning and force the user to manually change the names. So, we - * will issue a remark instead. - */ - AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName); - return (ACPI_COMPILER_RESERVED_NAME); - } - - /* - * The name didn't match any of the known predefined names. Flag it as a - * warning, since the entire namespace starting with an underscore is - * reserved by the ACPI spec. - */ - AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op, - Op->Asl.ExternalName); - - return (ACPI_NOT_RESERVED_NAME); -} - - -/******************************************************************************* - * - * FUNCTION: ApCheckObjectType - * - * PARAMETERS: Op - Current parse node - * ExpectedBtypes - Bitmap of expected return type(s) - * - * RETURN: None - * - * DESCRIPTION: Check if the object type is one of the types that is expected - * by the predefined name. Only a limited number of object types - * can be returned by the predefined names. - * - ******************************************************************************/ - -static void -ApCheckObjectType ( - ACPI_PARSE_OBJECT *Op, - UINT32 ExpectedBtypes) -{ - UINT32 ReturnBtype; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_ZERO: - case PARSEOP_ONE: - case PARSEOP_ONES: - case PARSEOP_INTEGER: - ReturnBtype = ACPI_RTYPE_INTEGER; - break; - - case PARSEOP_BUFFER: - ReturnBtype = ACPI_RTYPE_BUFFER; - break; - - case PARSEOP_STRING_LITERAL: - ReturnBtype = ACPI_RTYPE_STRING; - break; - - case PARSEOP_PACKAGE: - ReturnBtype = ACPI_RTYPE_PACKAGE; - break; - - default: - /* Not one of the supported object types */ - - goto TypeErrorExit; - } - - /* Exit if the object is one of the expected types */ - - if (ReturnBtype & ExpectedBtypes) - { - return; - } - - -TypeErrorExit: - - /* Format the expected types and emit an error message */ - - ApGetExpectedTypes (StringBuffer, ExpectedBtypes); - - sprintf (MsgBuffer, "found %s, requires %s", - UtGetOpName (Op->Asl.ParseOpcode), StringBuffer); - - AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, - MsgBuffer); -} - - -/******************************************************************************* - * - * FUNCTION: ApDisplayReservedNames - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Dump information about the ACPI predefined names and predefined - * resource descriptor names. - * - ******************************************************************************/ - -void -ApDisplayReservedNames ( - void) -{ - const ACPI_PREDEFINED_INFO *ThisName; - char TypeBuffer[48]; /* Room for 5 types */ - UINT32 Count; - - - /* - * Predefined names/methods - */ - printf ("\nPredefined Name Information\n\n"); - - Count = 0; - ThisName = PredefinedNames; - while (ThisName->Info.Name[0]) - { - printf ("%4.4s Requires %d arguments, ", - ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F); - - if (ThisName->Info.ExpectedBtypes) - { - ApGetExpectedTypes (TypeBuffer, ThisName->Info.ExpectedBtypes); - printf ("Must return: %s\n", TypeBuffer); - } - else - { - printf ("No return value\n"); - } - - /* - * Skip next entry in the table if this name returns a Package - * (next entry contains the package info) - */ - if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) - { - ThisName++; - } - - Count++; - ThisName++; - } - - printf ("%u Predefined Names are recognized\n", Count); - - /* - * Resource Descriptor names - */ - printf ("\nResource Descriptor Predefined Names\n\n"); - - Count = 0; - ThisName = ResourceNames; - while (ThisName->Info.Name[0]) - { - printf ("%4.4s Resource Descriptor\n", ThisName->Info.Name); - Count++; - ThisName++; - } - - printf ("%u Resource Descriptor Names are recognized\n", Count); - - /* - * Predefined scope names - */ - printf ("\nPredefined Scope Names\n\n"); - - ThisName = ScopeNames; - while (ThisName->Info.Name[0]) - { - printf ("%4.4s Scope\n", ThisName->Info.Name); - ThisName++; - } -} - - -/******************************************************************************* - * - * FUNCTION: ApGetExpectedTypes - * - * PARAMETERS: Buffer - Where the formatted string is returned - * ExpectedBTypes - Bitfield of expected data types - * - * RETURN: None, formatted string - * - * DESCRIPTION: Format the expected object types into a printable string. - * - ******************************************************************************/ - -static void -ApGetExpectedTypes ( - char *Buffer, - UINT32 ExpectedBtypes) -{ - UINT32 ThisRtype; - UINT32 i; - UINT32 j; - - - j = 1; - Buffer[0] = 0; - ThisRtype = ACPI_RTYPE_INTEGER; - - for (i = 0; i < ACPI_NUM_RTYPES; i++) - { - /* If one of the expected types, concatenate the name of this type */ - - if (ExpectedBtypes & ThisRtype) - { - ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]); - j = 0; /* Use name separator from now on */ - } - ThisRtype <<= 1; /* Next Rtype */ - } -} - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslresource.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslresource.c deleted file mode 100644 index 67aabcadae..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslresource.c +++ /dev/null @@ -1,1051 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslresource - Resource template/descriptor utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslresource") - - -/******************************************************************************* - * - * FUNCTION: RsSmallAddressCheck - * - * PARAMETERS: Minimum - Address Min value - * Maximum - Address Max value - * Length - Address range value - * Alignment - Address alignment value - * MinOp - Original Op for Address Min - * MaxOp - Original Op for Address Max - * LengthOp - Original Op for address range - * AlignOp - Original Op for address alignment. If - * NULL, means "zero value for alignment is - * OK, and means 64K alignment" (for - * Memory24 descriptor) - * - * RETURN: None. Adds error messages to error log if necessary - * - * DESCRIPTION: Perform common value checks for "small" address descriptors. - * Currently: - * Io, Memory24, Memory32 - * - ******************************************************************************/ - -void -RsSmallAddressCheck ( - UINT8 Type, - UINT32 Minimum, - UINT32 Maximum, - UINT32 Length, - UINT32 Alignment, - ACPI_PARSE_OBJECT *MinOp, - ACPI_PARSE_OBJECT *MaxOp, - ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *AlignOp) -{ - - if (Gbl_NoResourceChecking) - { - return; - } - - /* Special case for Memory24, values are compressed */ - - if (Type == ACPI_RESOURCE_NAME_MEMORY24) - { - if (!Alignment) /* Alignment==0 means 64K - no invalid alignment */ - { - Alignment = ACPI_UINT16_MAX + 1; - } - - Minimum <<= 8; - Maximum <<= 8; - Length *= 256; - } - - /* IO descriptor has different definition of min/max, don't check */ - - if (Type != ACPI_RESOURCE_NAME_IO) - { - /* Basic checks on Min/Max/Length */ - - if (Minimum > Maximum) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_MIN_MAX, MinOp, NULL); - } - else if (Length > (Maximum - Minimum + 1)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL); - } - } - - /* Alignment of zero is not in ACPI spec, but is used to mean byte acc */ - - if (!Alignment) - { - Alignment = 1; - } - - /* Addresses must be an exact multiple of the alignment value */ - - if (Minimum % Alignment) - { - AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MinOp, NULL); - } - if (Maximum % Alignment) - { - AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MaxOp, NULL); - } -} - - -/******************************************************************************* - * - * FUNCTION: RsLargeAddressCheck - * - * PARAMETERS: Minimum - Address Min value - * Maximum - Address Max value - * Length - Address range value - * Granularity - Address granularity value - * Flags - General flags for address descriptors: - * _MIF, _MAF, _DEC - * MinOp - Original Op for Address Min - * MaxOp - Original Op for Address Max - * LengthOp - Original Op for address range - * GranOp - Original Op for address granularity - * - * RETURN: None. Adds error messages to error log if necessary - * - * DESCRIPTION: Perform common value checks for "large" address descriptors. - * Currently: - * WordIo, WordBusNumber, WordSpace - * DWordIo, DWordMemory, DWordSpace - * QWordIo, QWordMemory, QWordSpace - * ExtendedIo, ExtendedMemory, ExtendedSpace - * - * _MIF flag set means that the minimum address is fixed and is not relocatable - * _MAF flag set means that the maximum address is fixed and is not relocatable - * Length of zero means that the record size is variable - * - * This function implements the LEN/MIF/MAF/MIN/MAX/GRA rules within Table 6-40 - * of the ACPI 4.0a specification. Added 04/2010. - * - ******************************************************************************/ - -void -RsLargeAddressCheck ( - UINT64 Minimum, - UINT64 Maximum, - UINT64 Length, - UINT64 Granularity, - UINT8 Flags, - ACPI_PARSE_OBJECT *MinOp, - ACPI_PARSE_OBJECT *MaxOp, - ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *GranOp) -{ - - if (Gbl_NoResourceChecking) - { - return; - } - - /* Basic checks on Min/Max/Length */ - - if (Minimum > Maximum) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_MIN_MAX, MinOp, NULL); - return; - } - else if (Length > (Maximum - Minimum + 1)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL); - return; - } - - /* If specified (non-zero), ensure granularity is a power-of-two minus one */ - - if (Granularity) - { - if ((Granularity + 1) & - Granularity) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_GRANULARITY, GranOp, NULL); - return; - } - } - - /* - * Check the various combinations of Length, MinFixed, and MaxFixed - */ - if (Length) - { - /* Fixed non-zero length */ - - switch (Flags & (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF)) - { - case 0: - /* - * Fixed length, variable locations (both _MIN and _MAX). - * Length must be a multiple of granularity - */ - if (Granularity & Length) - { - AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, LengthOp, NULL); - } - break; - - case (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF): - - /* Fixed length, fixed location. Granularity must be zero */ - - if (Granularity != 0) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_GRAN_FIXED, GranOp, NULL); - } - - /* Length must be exactly the size of the min/max window */ - - if (Length != (Maximum - Minimum + 1)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH_FIXED, LengthOp, NULL); - } - break; - - /* All other combinations are invalid */ - - case ACPI_RESOURCE_FLAG_MIF: - case ACPI_RESOURCE_FLAG_MAF: - default: - AslError (ASL_ERROR, ASL_MSG_INVALID_ADDR_FLAGS, LengthOp, NULL); - } - } - else - { - /* Variable length (length==0) */ - - switch (Flags & (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF)) - { - case 0: - /* - * Both _MIN and _MAX are variable. - * No additional requirements, just exit - */ - break; - - case ACPI_RESOURCE_FLAG_MIF: - - /* _MIN is fixed. _MIN must be multiple of _GRA */ - - /* - * The granularity is defined by the ACPI specification to be a - * power-of-two minus one, therefore the granularity is a - * bitmask which can be used to easily validate the addresses. - */ - if (Granularity & Minimum) - { - AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MinOp, NULL); - } - break; - - case ACPI_RESOURCE_FLAG_MAF: - - /* _MAX is fixed. (_MAX + 1) must be multiple of _GRA */ - - if (Granularity & (Maximum + 1)) - { - AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MaxOp, "-1"); - } - break; - - /* Both MIF/MAF set is invalid if length is zero */ - - case (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF): - default: - AslError (ASL_ERROR, ASL_MSG_INVALID_ADDR_FLAGS, LengthOp, NULL); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: RsGetStringDataLength - * - * PARAMETERS: InitializerOp - Start of a subtree of init nodes - * - * RETURN: Valid string length if a string node is found (otherwise 0) - * - * DESCRIPTION: In a list of peer nodes, find the first one that contains a - * string and return the length of the string. - * - ******************************************************************************/ - -UINT16 -RsGetStringDataLength ( - ACPI_PARSE_OBJECT *InitializerOp) -{ - - while (InitializerOp) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) - { - return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1)); - } - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - } - - return 0; -} - - -/******************************************************************************* - * - * FUNCTION: RsAllocateResourceNode - * - * PARAMETERS: Size - Size of node in bytes - * - * RETURN: The allocated node - aborts on allocation failure - * - * DESCRIPTION: Allocate a resource description node and the resource - * descriptor itself (the nodes are used to link descriptors). - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsAllocateResourceNode ( - UINT32 Size) -{ - ASL_RESOURCE_NODE *Rnode; - - - /* Allocate the node */ - - Rnode = UtLocalCalloc (sizeof (ASL_RESOURCE_NODE)); - - /* Allocate the resource descriptor itself */ - - Rnode->Buffer = UtLocalCalloc (Size); - Rnode->BufferLength = Size; - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsCreateBitField - * - * PARAMETERS: Op - Resource field node - * Name - Name of the field (Used only to reference - * the field in the ASL, not in the AML) - * ByteOffset - Offset from the field start - * BitOffset - Additional bit offset - * - * RETURN: None, sets fields within the input node - * - * DESCRIPTION: Utility function to generate a named bit field within a - * resource descriptor. Mark a node as 1) a field in a resource - * descriptor, and 2) set the value to be a BIT offset - * - ******************************************************************************/ - -void -RsCreateBitField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset, - UINT32 BitOffset) -{ - - Op->Asl.ExternalName = Name; - Op->Asl.Value.Integer = ((UINT64) ByteOffset * 8) + BitOffset; - Op->Asl.CompileFlags |= (NODE_IS_RESOURCE_FIELD | NODE_IS_BIT_OFFSET); -} - - -/******************************************************************************* - * - * FUNCTION: RsCreateByteField - * - * PARAMETERS: Op - Resource field node - * Name - Name of the field (Used only to reference - * the field in the ASL, not in the AML) - * ByteOffset - Offset from the field start - * - * RETURN: None, sets fields within the input node - * - * DESCRIPTION: Utility function to generate a named byte field within a - * resource descriptor. Mark a node as 1) a field in a resource - * descriptor, and 2) set the value to be a BYTE offset - * - ******************************************************************************/ - -void -RsCreateByteField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset) -{ - - Op->Asl.ExternalName = Name; - Op->Asl.Value.Integer = ByteOffset; - Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; -} - - -/******************************************************************************* - * - * FUNCTION: RsSetFlagBits - * - * PARAMETERS: *Flags - Pointer to the flag byte - * Op - Flag initialization node - * Position - Bit position within the flag byte - * Default - Used if the node is DEFAULT. - * - * RETURN: Sets bits within the *Flags output byte. - * - * DESCRIPTION: Set a bit in a cumulative flags word from an initialization - * node. Will use a default value if the node is DEFAULT, meaning - * that no value was specified in the ASL. Used to merge multiple - * keywords into a single flags byte. - * - ******************************************************************************/ - -void -RsSetFlagBits ( - UINT8 *Flags, - ACPI_PARSE_OBJECT *Op, - UINT8 Position, - UINT8 DefaultBit) -{ - - if (Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - /* Use the default bit */ - - *Flags |= (DefaultBit << Position); - } - else - { - /* Use the bit specified in the initialization node */ - - *Flags |= (((UINT8) Op->Asl.Value.Integer) << Position); - } -} - - -/******************************************************************************* - * - * FUNCTION: RsCompleteNodeAndGetNext - * - * PARAMETERS: Op - Resource node to be completed - * - * RETURN: The next peer to the input node. - * - * DESCRIPTION: Mark the current node completed and return the next peer. - * The node ParseOpcode is set to DEFAULT_ARG, meaning that - * this node is to be ignored from now on. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -RsCompleteNodeAndGetNext ( - ACPI_PARSE_OBJECT *Op) -{ - - /* Mark this node unused */ - - Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* Move on to the next peer node in the initializer list */ - - return (ASL_GET_PEER_NODE (Op)); -} - - -/******************************************************************************* - * - * FUNCTION: RsCheckListForDuplicates - * - * PARAMETERS: Op - First op in the initializer list - * - * RETURN: None - * - * DESCRIPTION: Check an initializer list for duplicate values. Emits an error - * if any duplicates are found. - * - ******************************************************************************/ - -void -RsCheckListForDuplicates ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *NextValueOp = Op; - ACPI_PARSE_OBJECT *NextOp; - UINT32 Value; - - - if (!Op) - { - return; - } - - /* Search list once for each value in the list */ - - while (NextValueOp) - { - Value = (UINT32) NextValueOp->Asl.Value.Integer; - - /* Compare this value to all remaining values in the list */ - - NextOp = ASL_GET_PEER_NODE (NextValueOp); - while (NextOp) - { - if (NextOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* Compare values */ - - if (Value == (UINT32) NextOp->Asl.Value.Integer) - { - /* Emit error only once per duplicate node */ - - if (!(NextOp->Asl.CompileFlags & NODE_IS_DUPLICATE)) - { - NextOp->Asl.CompileFlags |= NODE_IS_DUPLICATE; - AslError (ASL_ERROR, ASL_MSG_DUPLICATE_ITEM, - NextOp, NULL); - } - } - } - - NextOp = ASL_GET_PEER_NODE (NextOp); - } - - NextValueOp = ASL_GET_PEER_NODE (NextValueOp); - } -} - - -/******************************************************************************* - * - * FUNCTION: RsDoOneResourceDescriptor - * - * PARAMETERS: DescriptorTypeOp - Parent parse node of the descriptor - * CurrentByteOffset - Offset in the resource descriptor - * buffer. - * - * RETURN: A valid resource node for the descriptor - * - * DESCRIPTION: Dispatches the processing of one resource descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoOneResourceDescriptor ( - ACPI_PARSE_OBJECT *DescriptorTypeOp, - UINT32 CurrentByteOffset, - UINT8 *State) -{ - ASL_RESOURCE_NODE *Rnode = NULL; - - - /* Construct the resource */ - - switch (DescriptorTypeOp->Asl.ParseOpcode) - { - case PARSEOP_DMA: - Rnode = RsDoDmaDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_DWORDIO: - Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_DWORDMEMORY: - Rnode = RsDoDwordMemoryDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_DWORDSPACE: - Rnode = RsDoDwordSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_ENDDEPENDENTFN: - switch (*State) - { - case ACPI_RSTATE_NORMAL: - AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT, - DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_START_DEPENDENT: - AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, - DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_DEPENDENT_LIST: - default: - break; - } - - *State = ACPI_RSTATE_NORMAL; - Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_ENDTAG: - Rnode = RsDoEndTagDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_EXTENDEDIO: - Rnode = RsDoExtendedIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_EXTENDEDMEMORY: - Rnode = RsDoExtendedMemoryDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_EXTENDEDSPACE: - Rnode = RsDoExtendedSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_FIXEDIO: - Rnode = RsDoFixedIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_INTERRUPT: - Rnode = RsDoInterruptDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_IO: - Rnode = RsDoIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_IRQ: - Rnode = RsDoIrqDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_IRQNOFLAGS: - Rnode = RsDoIrqNoFlagsDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_MEMORY24: - Rnode = RsDoMemory24Descriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_MEMORY32: - Rnode = RsDoMemory32Descriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_MEMORY32FIXED: - Rnode = RsDoMemory32FixedDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_QWORDIO: - Rnode = RsDoQwordIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_QWORDMEMORY: - Rnode = RsDoQwordMemoryDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_QWORDSPACE: - Rnode = RsDoQwordSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_REGISTER: - Rnode = RsDoGeneralRegisterDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_STARTDEPENDENTFN: - switch (*State) - { - case ACPI_RSTATE_START_DEPENDENT: - AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, - DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_NORMAL: - case ACPI_RSTATE_DEPENDENT_LIST: - default: - break; - } - - *State = ACPI_RSTATE_START_DEPENDENT; - Rnode = RsDoStartDependentDescriptor (DescriptorTypeOp, - CurrentByteOffset); - *State = ACPI_RSTATE_DEPENDENT_LIST; - break; - - case PARSEOP_STARTDEPENDENTFN_NOPRI: - switch (*State) - { - case ACPI_RSTATE_START_DEPENDENT: - AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, - DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_NORMAL: - case ACPI_RSTATE_DEPENDENT_LIST: - default: - break; - } - - *State = ACPI_RSTATE_START_DEPENDENT; - Rnode = RsDoStartDependentNoPriDescriptor (DescriptorTypeOp, - CurrentByteOffset); - *State = ACPI_RSTATE_DEPENDENT_LIST; - break; - - case PARSEOP_VENDORLONG: - Rnode = RsDoVendorLargeDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_VENDORSHORT: - Rnode = RsDoVendorSmallDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_WORDBUSNUMBER: - Rnode = RsDoWordBusNumberDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_WORDIO: - Rnode = RsDoWordIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_WORDSPACE: - Rnode = RsDoWordSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_DEFAULT_ARG: - /* Just ignore any of these, they are used as fillers/placeholders */ - break; - - default: - printf ("Unknown resource descriptor type [%s]\n", - DescriptorTypeOp->Asl.ParseOpName); - break; - } - - /* - * Mark original node as unused, but head of a resource descriptor. - * This allows the resource to be installed in the namespace so that - * references to the descriptor can be resolved. - */ - DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC; - DescriptorTypeOp->Asl.Value.Integer = CurrentByteOffset; - - if (Rnode) - { - DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength; - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsLinkDescriptorChain - * - * PARAMETERS: PreviousRnode - Pointer to the node that will be previous - * to the linked node, At exit, set to the - * last node in the new chain. - * Rnode - Resource node to link into the list - * - * RETURN: Cumulative buffer byte offset of the new segment of chain - * - * DESCRIPTION: Link a descriptor chain at the end of an existing chain. - * - ******************************************************************************/ - -UINT32 -RsLinkDescriptorChain ( - ASL_RESOURCE_NODE **PreviousRnode, - ASL_RESOURCE_NODE *Rnode) -{ - ASL_RESOURCE_NODE *LastRnode; - UINT32 CurrentByteOffset; - - - /* Anything to do? */ - - if (!Rnode) - { - return 0; - } - - /* Point the previous node to the new node */ - - (*PreviousRnode)->Next = Rnode; - CurrentByteOffset = Rnode->BufferLength; - - /* Walk to the end of the chain headed by Rnode */ - - LastRnode = Rnode; - while (LastRnode->Next) - { - LastRnode = LastRnode->Next; - CurrentByteOffset += LastRnode->BufferLength; - } - - /* Previous node becomes the last node in the chain */ - - *PreviousRnode = LastRnode; - return CurrentByteOffset; -} - - -/******************************************************************************* - * - * FUNCTION: RsDoResourceTemplate - * - * PARAMETERS: Op - Parent of a resource template list - * - * RETURN: None. Sets input node to point to a list of AML code - * - * DESCRIPTION: Merge a list of resource descriptors into a single AML buffer, - * in preparation for output to the AML output file. - * - ******************************************************************************/ - -void -RsDoResourceTemplate ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *BufferLengthOp; - ACPI_PARSE_OBJECT *BufferOp; - ACPI_PARSE_OBJECT *DescriptorTypeOp; - ACPI_PARSE_OBJECT *LastOp = NULL; - UINT32 CurrentByteOffset = 0; - ASL_RESOURCE_NODE HeadRnode; - ASL_RESOURCE_NODE *PreviousRnode; - ASL_RESOURCE_NODE *Rnode; - UINT8 State; - - - /* Mark parent as containing a resource template */ - - if (Op->Asl.Parent) - { - Op->Asl.Parent->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC; - } - - /* ResourceTemplate Opcode is first (Op) */ - /* Buffer Length node is first child */ - - BufferLengthOp = ASL_GET_CHILD_NODE (Op); - - /* Buffer Op is first peer */ - - BufferOp = ASL_GET_PEER_NODE (BufferLengthOp); - - /* First Descriptor type is next */ - - DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp); - - /* - * Process all resource descriptors in the list - * Note: It is assumed that the EndTag node has been automatically - * inserted at the end of the template by the parser. - */ - State = ACPI_RSTATE_NORMAL; - PreviousRnode = &HeadRnode; - while (DescriptorTypeOp) - { - DescriptorTypeOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC; - Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset, - &State); - - /* - * Update current byte offset to indicate the number of bytes from the - * start of the buffer. Buffer can include multiple descriptors, we - * must keep track of the offset of not only each descriptor, but each - * element (field) within each descriptor as well. - */ - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode); - - /* Get the next descriptor in the list */ - - LastOp = DescriptorTypeOp; - DescriptorTypeOp = ASL_GET_PEER_NODE (DescriptorTypeOp); - } - - if (State == ACPI_RSTATE_DEPENDENT_LIST) - { - if (LastOp) - { - LastOp = LastOp->Asl.Parent; - } - AslError (ASL_ERROR, ASL_MSG_MISSING_ENDDEPENDENT, LastOp, NULL); - } - - /* - * Transform the nodes into the following - * - * Op -> AML_BUFFER_OP - * First Child -> BufferLength - * Second Child -> Descriptor Buffer (raw byte data) - */ - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Asl.AmlOpcode = AML_BUFFER_OP; - Op->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC; - - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.Value.Integer = CurrentByteOffset; - (void) OpcSetOptimalIntegerSize (BufferLengthOp); - - BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; - BufferOp->Asl.AmlOpcodeLength = 0; - BufferOp->Asl.AmlLength = CurrentByteOffset; - BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next; - BufferOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DATA; - - return; -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1.c deleted file mode 100644 index 381fb53cc2..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1.c +++ /dev/null @@ -1,719 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype1 - Miscellaneous small resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype1") - -/* - * This module contains miscellaneous small resource descriptors: - * - * EndTag - * EndDependentFn - * Memory24 - * Memory32 - * Memory32Fixed - * StartDependentFn - * StartDependentFnNoPri - * VendorShort - */ - -/******************************************************************************* - * - * FUNCTION: RsDoEndTagDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "EndDependentFn" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoEndTagDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ASL_RESOURCE_NODE *Rnode; - - - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG)); - - Descriptor = Rnode->Buffer; - Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG | - ASL_RDESC_END_TAG_SIZE; - Descriptor->EndTag.Checksum = 0; - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoEndDependentDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "EndDependentFn" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoEndDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ASL_RESOURCE_NODE *Rnode; - - - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT)); - - Descriptor = Rnode->Buffer; - Descriptor->EndDpf.DescriptorType = ACPI_RESOURCE_NAME_END_DEPENDENT | - ASL_RDESC_END_DEPEND_SIZE; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoMemory24Descriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "Memory24" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoMemory24Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *AlignOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24)); - - Descriptor = Rnode->Buffer; - Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24; - Descriptor->Memory24.ResourceLength = 9; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Read/Write type */ - - RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0); - break; - - case 1: /* Min Address */ - - Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum)); - MinOp = InitializerOp; - break; - - case 2: /* Max Address */ - - Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum)); - MaxOp = InitializerOp; - break; - - case 3: /* Alignment */ - - Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment)); - AlignOp = InitializerOp; - break; - - case 4: /* Length */ - - Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength)); - LengthOp = InitializerOp; - break; - - case 5: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */ - - RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24, - Descriptor->Memory24.Minimum, - Descriptor->Memory24.Maximum, - Descriptor->Memory24.AddressLength, - Descriptor->Memory24.Alignment, - MinOp, MaxOp, LengthOp, NULL); - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoMemory32Descriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "Memory32" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoMemory32Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *AlignOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32)); - - Descriptor = Rnode->Buffer; - Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32; - Descriptor->Memory32.ResourceLength = 17; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Read/Write type */ - - RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0); - break; - - case 1: /* Min Address */ - - Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum)); - MinOp = InitializerOp; - break; - - case 2: /* Max Address */ - - Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum)); - MaxOp = InitializerOp; - break; - - case 3: /* Alignment */ - - Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment)); - AlignOp = InitializerOp; - break; - - case 4: /* Length */ - - Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength)); - LengthOp = InitializerOp; - break; - - case 5: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Align values */ - - RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32, - Descriptor->Memory32.Minimum, - Descriptor->Memory32.Maximum, - Descriptor->Memory32.AddressLength, - Descriptor->Memory32.Alignment, - MinOp, MaxOp, LengthOp, AlignOp); - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoMemory32FixedDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "Memory32Fixed" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoMemory32FixedDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32)); - - Descriptor = Rnode->Buffer; - Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32; - Descriptor->FixedMemory32.ResourceLength = 9; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Read/Write type */ - - RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0); - break; - - case 1: /* Address */ - - Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address)); - break; - - case 2: /* Length */ - - Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength)); - break; - - case 3: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoStartDependentDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "StartDependentFn" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoStartDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - ASL_RESOURCE_NODE *PreviousRnode; - ASL_RESOURCE_NODE *NextRnode; - UINT32 i; - UINT8 State; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT)); - - PreviousRnode = Rnode; - Descriptor = Rnode->Buffer; - - /* Descriptor has priority byte */ - - Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | - (ASL_RDESC_ST_DEPEND_SIZE + 0x01); - - /* Process all child initialization nodes */ - - State = ACPI_RSTATE_START_DEPENDENT; - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Compatibility Priority */ - - if ((UINT8) InitializerOp->Asl.Value.Integer > 2) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY, - InitializerOp, NULL); - } - - RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0); - break; - - case 1: /* Performance/Robustness Priority */ - - if ((UINT8) InitializerOp->Asl.Value.Integer > 2) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE, - InitializerOp, NULL); - } - - RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0); - break; - - default: - - NextRnode = RsDoOneResourceDescriptor (InitializerOp, - CurrentByteOffset, &State); - - /* - * Update current byte offset to indicate the number of bytes from the - * start of the buffer. Buffer can include multiple descriptors, we - * must keep track of the offset of not only each descriptor, but each - * element (field) within each descriptor as well. - */ - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, - NextRnode); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoStartDependentNoPriDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoStartDependentNoPriDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - ASL_RESOURCE_NODE *PreviousRnode; - ASL_RESOURCE_NODE *NextRnode; - UINT8 State; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)); - - Descriptor = Rnode->Buffer; - Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | - ASL_RDESC_ST_DEPEND_SIZE; - PreviousRnode = Rnode; - - /* Process all child initialization nodes */ - - State = ACPI_RSTATE_START_DEPENDENT; - while (InitializerOp) - { - NextRnode = RsDoOneResourceDescriptor (InitializerOp, - CurrentByteOffset, &State); - - /* - * Update current byte offset to indicate the number of bytes from the - * start of the buffer. Buffer can include multiple descriptors, we - * must keep track of the offset of not only each descriptor, but each - * element (field) within each descriptor as well. - */ - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode); - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoVendorSmallDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "VendorShort" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoVendorSmallDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT8 *VendorData; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - - /* Allocate worst case - 7 vendor bytes */ - - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7); - - Descriptor = Rnode->Buffer; - Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL; - VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER); - - /* Process all child initialization nodes */ - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - for (i = 0; InitializerOp; i++) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - break; - } - - /* Maximum 7 vendor data bytes allowed (0-6) */ - - if (i >= 7) - { - AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL); - - /* Eat the excess initializers */ - - while (InitializerOp) - { - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - break; - } - - VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Adjust the Rnode buffer size, so correct number of bytes are emitted */ - - Rnode->BufferLength -= (7 - i); - - /* Set the length in the Type Tag */ - - Descriptor->VendorSmall.DescriptorType |= (UINT8) i; - return (Rnode); -} - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1i.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1i.c deleted file mode 100644 index 239c500cb6..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1i.c +++ /dev/null @@ -1,668 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype1i - Small I/O-related resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype1i") - -/* - * This module contains the I/O-related small resource descriptors: - * - * DMA - * FixedIO - * IO - * IRQ - * IRQNoFlags - */ - -/******************************************************************************* - * - * FUNCTION: RsDoDmaDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "DMA" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - UINT8 DmaChannelMask = 0; - UINT8 DmaChannels = 0; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA)); - - Descriptor = Rnode->Buffer; - Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA | - ASL_RDESC_DMA_SIZE; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* DMA type */ - - RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5); - break; - - case 1: /* Bus Master */ - - RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2); - break; - - case 2: /* Xfer Type (transfer width) */ - - RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0); - break; - - case 3: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - /* All DMA channel bytes are handled here, after flags and name */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* Up to 8 channels can be specified in the list */ - - DmaChannels++; - if (DmaChannels > 8) - { - AslError (ASL_ERROR, ASL_MSG_DMA_LIST, - InitializerOp, NULL); - return (Rnode); - } - - /* Only DMA channels 0-7 are allowed (mask is 8 bits) */ - - if (InitializerOp->Asl.Value.Integer > 7) - { - AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL, - InitializerOp, NULL); - } - - /* Build the mask */ - - DmaChannelMask |= - (1 << ((UINT8) InitializerOp->Asl.Value.Integer)); - } - - if (i == 4) /* case 4: First DMA byte */ - { - /* Check now for duplicates in list */ - - RsCheckListForDuplicates (InitializerOp); - - /* Create a named field at the start of the list */ - - RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA, - CurrentByteOffset + - ASL_RESDESC_OFFSET (Dma.DmaChannelMask)); - } - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Now we can set the channel mask */ - - Descriptor->Dma.DmaChannelMask = DmaChannelMask; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoFixedIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "FixedIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoFixedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *AddressOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO)); - - Descriptor = Rnode->Buffer; - Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO | - ASL_RDESC_FIXED_IO_SIZE; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Base Address */ - - Descriptor->FixedIo.Address = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address)); - AddressOp = InitializerOp; - break; - - case 1: /* Length */ - - Descriptor->FixedIo.AddressLength = - (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength)); - break; - - case 2: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Error checks */ - - if (Descriptor->FixedIo.Address > 0x03FF) - { - AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "IO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *AlignOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO)); - - Descriptor = Rnode->Buffer; - Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO | - ASL_RDESC_IO_SIZE; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Decode size */ - - RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0); - break; - - case 1: /* Min Address */ - - Descriptor->Io.Minimum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum)); - MinOp = InitializerOp; - break; - - case 2: /* Max Address */ - - Descriptor->Io.Maximum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum)); - MaxOp = InitializerOp; - break; - - case 3: /* Alignment */ - - Descriptor->Io.Alignment = - (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment)); - AlignOp = InitializerOp; - break; - - case 4: /* Length */ - - Descriptor->Io.AddressLength = - (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength)); - LengthOp = InitializerOp; - break; - - case 5: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Align values */ - - RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO, - Descriptor->Io.Minimum, - Descriptor->Io.Maximum, - Descriptor->Io.AddressLength, - Descriptor->Io.Alignment, - MinOp, MaxOp, LengthOp, AlignOp); - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoIrqDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "IRQ" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoIrqDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 Interrupts = 0; - UINT16 IrqMask = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ)); - - /* Length = 3 (with flag byte) */ - - Descriptor = Rnode->Buffer; - Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ | - (ASL_RDESC_IRQ_SIZE + 0x01); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Interrupt Type (or Mode - edge/level) */ - - RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0); - break; - - case 1: /* Interrupt Level (or Polarity - Active high/low) */ - - RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3); - break; - - case 2: /* Share Type - Default: exclusive (0) */ - - RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4); - break; - - case 3: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - /* All IRQ bytes are handled here, after the flags and name */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* Up to 16 interrupts can be specified in the list */ - - Interrupts++; - if (Interrupts > 16) - { - AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST, - InitializerOp, NULL); - return (Rnode); - } - - /* Only interrupts 0-15 are allowed (mask is 16 bits) */ - - if (InitializerOp->Asl.Value.Integer > 15) - { - AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER, - InitializerOp, NULL); - } - else - { - IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer); - } - } - - /* Case 4: First IRQ value in list */ - - if (i == 4) - { - /* Check now for duplicates in list */ - - RsCheckListForDuplicates (InitializerOp); - - /* Create a named field at the start of the list */ - - RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask)); - } - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Now we can set the channel mask */ - - Descriptor->Irq.IrqMask = IrqMask; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoIrqNoFlagsDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "IRQNoFlags" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoIrqNoFlagsDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT16 IrqMask = 0; - UINT32 Interrupts = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS)); - - Descriptor = Rnode->Buffer; - Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ | - ASL_RDESC_IRQ_SIZE; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - /* IRQ bytes are handled here, after the flags and name */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* Up to 16 interrupts can be specified in the list */ - - Interrupts++; - if (Interrupts > 16) - { - AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST, - InitializerOp, NULL); - return (Rnode); - } - - /* Only interrupts 0-15 are allowed (mask is 16 bits) */ - - if (InitializerOp->Asl.Value.Integer > 15) - { - AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER, - InitializerOp, NULL); - } - else - { - IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer)); - } - } - - /* Case 1: First IRQ value in list */ - - if (i == 1) - { - /* Check now for duplicates in list */ - - RsCheckListForDuplicates (InitializerOp); - - /* Create a named field at the start of the list */ - - RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask)); - } - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Now we can set the interrupt mask */ - - Descriptor->Irq.IrqMask = IrqMask; - return (Rnode); -} diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2.c deleted file mode 100644 index a9aeda73ad..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2.c +++ /dev/null @@ -1,534 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2 - Miscellaneous Large resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2") - -/* - * This module contains miscellaneous large resource descriptors: - * - * Register - * Interrupt - * VendorLong - */ - -/******************************************************************************* - * - * FUNCTION: RsDoGeneralRegisterDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "Register" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoGeneralRegisterDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_GENERIC_REGISTER)); - - Descriptor = Rnode->Buffer; - Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER; - Descriptor->GenericReg.ResourceLength = 12; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Address space */ - - Descriptor->GenericReg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESSSPACE, - CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AddressSpaceId)); - break; - - case 1: /* Register Bit Width */ - - Descriptor->GenericReg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITWIDTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitWidth)); - break; - - case 2: /* Register Bit Offset */ - - Descriptor->GenericReg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITOFFSET, - CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitOffset)); - break; - - case 3: /* Register Address */ - - Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address)); - break; - - case 4: /* Access Size (ACPI 3.0) */ - - Descriptor->GenericReg.AccessSize = (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ACCESSSIZE, - CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AccessSize)); - - if (Descriptor->GenericReg.AccessSize > AML_FIELD_ACCESS_QWORD) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_ACCESS_SIZE, - InitializerOp, NULL); - } - break; - - case 5: /* ResourceTag (ACPI 3.0b) */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoInterruptDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "Interrupt" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoInterruptDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - AML_RESOURCE *Rover = NULL; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN HasResSourceIndex = FALSE; - UINT8 ResSourceIndex = 0; - UINT8 *ResSourceString = NULL; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - /* Count the interrupt numbers */ - - for (i = 0; InitializerOp; i++) - { - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - - if (i <= 6) - { - if (i == 3 && - InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* - * ResourceSourceIndex was specified, always make room for - * it, even if the ResourceSource was omitted. - */ - OptionIndex++; - } - - continue; - } - - OptionIndex += 4; - } - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_EXTENDED_IRQ) + - 1 + OptionIndex + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->ExtendedIrq.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_IRQ; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - Descriptor->ExtendedIrq.ResourceLength = 2; /* Flags and table length byte */ - Descriptor->ExtendedIrq.InterruptCount = 0; - - Rover = ACPI_CAST_PTR (AML_RESOURCE, - (&(Descriptor->ExtendedIrq.Interrupts[0]))); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage (Default: consumer (1) */ - - RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 0, 1); - break; - - case 1: /* Interrupt Type (or Mode - edge/level) */ - - RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 1); - break; - - case 2: /* Interrupt Level (or Polarity - Active high/low) */ - - RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 2); - break; - - case 3: /* Share Type - Default: exclusive (0) */ - - RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 3); - break; - - case 4: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - HasResSourceIndex = TRUE; - ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; - } - break; - - case 5: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String; - } - - /* ResourceSourceIndex must also be valid */ - - if (!HasResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (HasResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 6: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - /* - * Interrupt Numbers come through here, repeatedly - */ - - /* Maximum 255 interrupts allowed for this descriptor */ - - if (Descriptor->ExtendedIrq.InterruptCount == 255) - { - AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST, - InitializerOp, NULL); - return (Rnode); - } - - /* Each interrupt number must be a 32-bit value */ - - if (InitializerOp->Asl.Value.Integer > ACPI_UINT32_MAX) - { - AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_NUMBER, - InitializerOp, NULL); - } - - /* Save the integer and move pointer to the next one */ - - Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer; - Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4); - Descriptor->ExtendedIrq.InterruptCount++; - Descriptor->ExtendedIrq.ResourceLength += 4; - - /* Case 7: First interrupt number in list */ - - if (i == 7) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - /* Must be at least one interrupt */ - - AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, - InitializerOp, NULL); - } - - /* Check now for duplicates in list */ - - RsCheckListForDuplicates (InitializerOp); - - /* Create a named field at the start of the list */ - - RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT, - CurrentByteOffset + - ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0])); - } - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - - /* Add optional ResSourceIndex if present */ - - if (HasResSourceIndex) - { - Rover->ByteItem = ResSourceIndex; - Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->ByteItem), 1); - Descriptor->ExtendedIrq.ResourceLength += 1; - } - - /* Add optional ResSource string if present */ - - if (StringLength && ResSourceString) - { - - strcpy ((char *) Rover, (char *) ResSourceString); - Rover = ACPI_ADD_PTR ( - AML_RESOURCE, &(Rover->ByteItem), StringLength); - - Descriptor->ExtendedIrq.ResourceLength = (UINT16) - (Descriptor->ExtendedIrq.ResourceLength + StringLength); - } - - Rnode->BufferLength = (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) - - ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType)) - + OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoVendorLargeDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "VendorLong" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoVendorLargeDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT8 *VendorData; - UINT32 i; - - - /* Count the number of data bytes */ - - InitializerOp = Op->Asl.Child; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - - for (i = 0; InitializerOp; i++) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - break; - } - InitializerOp = InitializerOp->Asl.Next; - } - - InitializerOp = Op->Asl.Child; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_LARGE) + i); - - Descriptor = Rnode->Buffer; - Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE; - Descriptor->VendorLarge.ResourceLength = (UINT16) i; - - /* Point to end-of-descriptor for vendor data */ - - VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_LARGE_HEADER); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - break; - } - - VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2d.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2d.c deleted file mode 100644 index 7725bf9a8d..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2d.c +++ /dev/null @@ -1,814 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2d - Large DWord address resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2d") - -/* - * This module contains the Dword (32-bit) address space descriptors: - * - * DwordIO - * DwordMemory - * DwordSpace - */ - -/******************************************************************************* - * - * FUNCTION: RsDoDwordIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "DwordIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT8 *OptionalFields; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32; - Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32); - Descriptor->Address32.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS32) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->Address32.Granularity = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); - GranOp = InitializerOp; - break; - - case 6: /* Address Min */ - - Descriptor->Address32.Minimum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); - MinOp = InitializerOp; - break; - - case 7: /* Address Max */ - - Descriptor->Address32.Maximum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); - MaxOp = InitializerOp; - break; - - case 8: /* Translation Offset */ - - Descriptor->Address32.TranslationOffset = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->Address32.AddressLength = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); - LengthOp = InitializerOp; - break; - - case 10: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* Found a valid ResourceSourceIndex */ - - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address32.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 11: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - /* Found a valid ResourceSource */ - - Descriptor->Address32.ResourceLength = (UINT16) - (Descriptor->Address32.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 13: /* Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 4); - break; - - case 14: /* Translation Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address32.Minimum, - Descriptor->Address32.Maximum, - Descriptor->Address32.AddressLength, - Descriptor->Address32.Granularity, - Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoDwordMemoryDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "DwordMemory" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32; - Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32); - Descriptor->Address32.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS32) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1); - break; - - case 1: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1); - break; - - case 2: /* MinType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2); - break; - - case 3: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3); - break; - - case 4: /* Memory Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1); - break; - - case 5: /* Read/Write Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0); - break; - - case 6: /* Address Granularity */ - - Descriptor->Address32.Granularity = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->Address32.Minimum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->Address32.Maximum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->Address32.TranslationOffset = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Address32.AddressLength = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address32.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address32.ResourceLength = (UINT16) - (Descriptor->Address32.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - - case 14: /* Address Range */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3); - break; - - case 15: /* Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address32.Minimum, - Descriptor->Address32.Maximum, - Descriptor->Address32.AddressLength, - Descriptor->Address32.Granularity, - Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoDwordSpaceDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "DwordSpace" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32); - Descriptor->Address32.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS32) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - Descriptor->Address32.ResourceType = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 1: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1); - break; - - case 2: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1); - break; - - case 3: /* MinType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2); - break; - - case 4: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3); - break; - - case 5: /* Type-Specific flags */ - - Descriptor->Address32.SpecificFlags = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 6: /* Address Granularity */ - - Descriptor->Address32.Granularity = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->Address32.Minimum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->Address32.Maximum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->Address32.TranslationOffset = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Address32.AddressLength = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address32.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address32.ResourceLength = (UINT16) - (Descriptor->Address32.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, - InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address32.Minimum, - Descriptor->Address32.Maximum, - Descriptor->Address32.AddressLength, - Descriptor->Address32.Granularity, - Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + - OptionIndex + StringLength; - return (Rnode); -} diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2e.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2e.c deleted file mode 100644 index 46f56cec13..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2e.c +++ /dev/null @@ -1,646 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2e - Large Extended address resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2e") - -/* - * This module contains the Extended (64-bit) address space descriptors: - * - * ExtendedIO - * ExtendedMemory - * ExtendedSpace - */ - -/******************************************************************************* - * - * FUNCTION: RsDoExtendedIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "ExtendedIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoExtendedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT16 StringLength = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; - Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; - Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - - Descriptor->ExtAddress64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); - GranOp = InitializerOp; - break; - - case 6: /* Address Min */ - - Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); - MinOp = InitializerOp; - break; - - case 7: /* Address Max */ - - Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); - MaxOp = InitializerOp; - break; - - case 8: /* Translation Offset */ - - Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 10: /* Type-Specific Attributes */ - - Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); - break; - - case 11: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 12: /* Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 4); - break; - - case 13: /* Translation Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->ExtAddress64.Minimum, - Descriptor->ExtAddress64.Maximum, - Descriptor->ExtAddress64.AddressLength, - Descriptor->ExtAddress64.Granularity, - Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoExtendedMemoryDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "ExtendedMemory" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoExtendedMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT16 StringLength = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; - Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; - Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - - Descriptor->ExtAddress64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1); - break; - - case 1: /* DecodeType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1); - break; - - case 2: /* MinType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2); - break; - - case 3: /* MaxType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3); - break; - - case 4: /* Memory Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 1); - break; - - case 5: /* Read/Write Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0); - break; - - case 6: /* Address Granularity */ - - Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* Type-Specific Attributes */ - - Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - - case 13: /* Address Range */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 3); - break; - - case 14: /* Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->ExtAddress64.Minimum, - Descriptor->ExtAddress64.Maximum, - Descriptor->ExtAddress64.AddressLength, - Descriptor->ExtAddress64.Granularity, - Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoExtendedSpaceDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "ExtendedSpace" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoExtendedSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT16 StringLength = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; - Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - - Descriptor->ExtAddress64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - Descriptor->ExtAddress64.ResourceType = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 1: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1); - break; - - case 2: /* DecodeType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1); - break; - - case 3: /* MinType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2); - break; - - case 4: /* MaxType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3); - break; - - case 5: /* Type-Specific flags */ - - Descriptor->ExtAddress64.SpecificFlags = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 6: /* Address Granularity */ - - Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* Type-Specific Attributes */ - - Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->ExtAddress64.Minimum, - Descriptor->ExtAddress64.Maximum, - Descriptor->ExtAddress64.AddressLength, - Descriptor->ExtAddress64.Granularity, - Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; - return (Rnode); -} diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2q.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2q.c deleted file mode 100644 index 591ac25c42..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2q.c +++ /dev/null @@ -1,793 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2q - Large QWord address resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2q") - -/* - * This module contains the QWord (64-bit) address space descriptors: - * - * QWordIO - * QWordMemory - * QWordSpace - */ - -/******************************************************************************* - * - * FUNCTION: RsDoQwordIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "QwordIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoQwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; - Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64); - Descriptor->Address64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); - GranOp = InitializerOp; - break; - - case 6: /* Address Min */ - - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); - MinOp = InitializerOp; - break; - - case 7: /* Address Max */ - - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); - MaxOp = InitializerOp; - break; - - case 8: /* Translation Offset */ - - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 10: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address64.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 11: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address64.ResourceLength = (UINT16) - (Descriptor->Address64.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 13: /* Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 4); - break; - - case 14: /* Translation Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address64.Minimum, - Descriptor->Address64.Maximum, - Descriptor->Address64.AddressLength, - Descriptor->Address64.Granularity, - Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoQwordMemoryDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "QwordMemory" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoQwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; - Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64); - Descriptor->Address64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1); - break; - - case 1: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1); - break; - - case 2: /* MinType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2); - break; - - case 3: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3); - break; - - case 4: /* Memory Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 1); - break; - - case 5: /* Read/Write Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0); - break; - - case 6: /* Address Granularity */ - - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address64.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address64.ResourceLength = (UINT16) - (Descriptor->Address64.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - - case 14: /* Address Range */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 3); - break; - - case 15: /* Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address64.Minimum, - Descriptor->Address64.Maximum, - Descriptor->Address64.AddressLength, - Descriptor->Address64.Granularity, - Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoQwordSpaceDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "QwordSpace" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoQwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64); - Descriptor->Address64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - Descriptor->Address64.ResourceType = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 1: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1); - break; - - case 2: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1); - break; - - case 3: /* MinType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2); - break; - - case 4: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3); - break; - - case 5: /* Type-Specific flags */ - - Descriptor->Address64.SpecificFlags = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 6: /* Address Granularity */ - - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address64.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address64.ResourceLength = (UINT16) - (Descriptor->Address64.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address64.Minimum, - Descriptor->Address64.Maximum, - Descriptor->Address64.AddressLength, - Descriptor->Address64.Granularity, - Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + - OptionIndex + StringLength; - return (Rnode); -} diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2w.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2w.c deleted file mode 100644 index 45f1858fcc..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2w.c +++ /dev/null @@ -1,774 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2w - Large Word address resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2w") - -/* - * This module contains the Word (16-bit) address space descriptors: - * - * WordIO - * WordMemory - * WordSpace - */ - -/******************************************************************************* - * - * FUNCTION: RsDoWordIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "WordIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoWordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; - Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16); - Descriptor->Address16.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS16) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); - GranOp = InitializerOp; - break; - - case 6: /* Address Min */ - - Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); - MinOp = InitializerOp; - break; - - case 7: /* Address Max */ - - Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); - MaxOp = InitializerOp; - break; - - case 8: /* Translation Offset */ - - Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); - LengthOp = InitializerOp; - break; - - case 10: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address16.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 11: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address16.ResourceLength = (UINT16) - (Descriptor->Address16.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 13: /* Type */ - - RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 4); - break; - - case 14: /* Translation Type */ - - RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address16.Minimum, - Descriptor->Address16.Maximum, - Descriptor->Address16.AddressLength, - Descriptor->Address16.Granularity, - Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoWordBusNumberDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "WordBusNumber" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoWordBusNumberDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; - Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16); - Descriptor->Address16.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS16) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1); - break; - - case 4: /* Address Granularity */ - - Descriptor->Address16.Granularity = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); - GranOp = InitializerOp; - break; - - case 5: /* Min Address */ - - Descriptor->Address16.Minimum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); - MinOp = InitializerOp; - break; - - case 6: /* Max Address */ - - Descriptor->Address16.Maximum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); - MaxOp = InitializerOp; - break; - - case 7: /* Translation Offset */ - - Descriptor->Address16.TranslationOffset = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); - break; - - case 8: /* Address Length */ - - Descriptor->Address16.AddressLength = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); - LengthOp = InitializerOp; - break; - - case 9: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address16.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 10: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address16.ResourceLength = (UINT16) - (Descriptor->Address16.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 11: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address16.Minimum, - Descriptor->Address16.Maximum, - Descriptor->Address16.AddressLength, - Descriptor->Address16.Granularity, - Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoWordSpaceDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "WordSpace" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoWordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16); - Descriptor->Address16.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS16) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - Descriptor->Address16.ResourceType = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 1: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1); - break; - - case 2: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1); - break; - - case 3: /* MinType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2); - break; - - case 4: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3); - break; - - case 5: /* Type-Specific flags */ - - Descriptor->Address16.SpecificFlags = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 6: /* Address Granularity */ - - Descriptor->Address16.Granularity = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->Address16.Minimum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->Address16.Maximum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->Address16.TranslationOffset = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Address16.AddressLength = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address16.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address16.ResourceLength = (UINT16) - (Descriptor->Address16.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address16.Minimum, - Descriptor->Address16.Maximum, - Descriptor->Address16.AddressLength, - Descriptor->Address16.Granularity, - Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + - OptionIndex + StringLength; - return (Rnode); -} diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslstartup.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslstartup.c deleted file mode 100644 index ea61c9e392..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslstartup.c +++ /dev/null @@ -1,446 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslstartup - Compiler startup routines, called from main - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "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); - - -/******************************************************************************* - * - * 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 - * - ******************************************************************************/ - -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 deleted file mode 100644 index 4555873189..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslstubs.c +++ /dev/null @@ -1,306 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslstubs - Stubs used to link to Aml interpreter - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acdispat.h" -#include "actables.h" -#include "acevents.h" -#include "acinterp.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslstubs") - - -/* - * Stubs to simplify linkage to the ACPI CA core subsystem. - * Things like Events, Global Lock, etc. are not used - * by the compiler, so they are stubbed out here. - */ -ACPI_PHYSICAL_ADDRESS -AeLocalGetRootPointer ( - void) -{ - return 0; -} - -void -AcpiNsExecModuleCodeList ( - void) -{ -} - -ACPI_STATUS -AcpiHwReadPort ( - ACPI_IO_ADDRESS Address, - UINT32 *Value, - UINT32 Width) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiHwWritePort ( - ACPI_IO_ADDRESS Address, - UINT32 Value, - UINT32 Width) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsMethodError ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState) -{ - return (Status); -} - -ACPI_STATUS -AcpiDsMethodDataGetValue ( - UINT8 Type, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **DestDesc) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsMethodDataGetNode ( - UINT8 Type, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE **Node) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsStoreObjectToLocal ( - UINT8 Type, - UINT32 Index, - ACPI_OPERAND_OBJECT *SrcDesc, - ACPI_WALK_STATE *WalkState) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvDeleteGpeBlock ( - ACPI_GPE_BLOCK_INFO *GpeBlock) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvQueueNotifyRequest ( - ACPI_NAMESPACE_NODE *Node, - UINT32 NotifyValue) -{ - return (AE_OK); -} - -BOOLEAN -AcpiEvIsNotifyObject ( - ACPI_NAMESPACE_NODE *Node) -{ - return (FALSE); -} - -ACPI_STATUS -AcpiEvAcquireGlobalLock ( - UINT16 Timeout) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvReleaseGlobalLock ( - void) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvInitializeRegion ( - ACPI_OPERAND_OBJECT *RegionObj, - BOOLEAN AcpiNsLocked) -{ - return (AE_OK); -} - -void -AcpiExDoDebugObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - UINT32 Level, - UINT32 Index) -{ - return; -} - -ACPI_STATUS -AcpiExReadDataFromField ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **RetBufferDesc) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExWriteDataToField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExLoadTableOp ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExUnloadTable ( - ACPI_OPERAND_OBJECT *DdbHandle) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExLoadOp ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *Target, - ACPI_WALK_STATE *WalkState) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiTbFindTable ( - char *Signature, - char *OemId, - char *OemTableId, - UINT32 *TableIndex) -{ - return (AE_SUPPORT); -} - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asltransform.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asltransform.c deleted file mode 100644 index 5327a90723..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asltransform.c +++ /dev/null @@ -1,841 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asltransform - Parse tree transforms - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asltransform") - -/* Local prototypes */ - -static void -TrTransformSubtree ( - ACPI_PARSE_OBJECT *Op); - -static char * -TrAmlGetNextTempName ( - ACPI_PARSE_OBJECT *Op, - UINT8 *TempCount); - -static void -TrAmlInitLineNumbers ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Neighbor); - -static void -TrAmlInitNode ( - ACPI_PARSE_OBJECT *Op, - UINT16 ParseOpcode); - -static void -TrAmlSetSubtreeParent ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Parent); - -static void -TrAmlInsertPeer ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NewPeer); - -static void -TrDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op); - -static void -TrDoSwitch ( - ACPI_PARSE_OBJECT *StartNode); - - -/******************************************************************************* - * - * FUNCTION: TrAmlGetNextTempName - * - * PARAMETERS: Op - Current parse op - * TempCount - Current temporary counter. Was originally - * per-module; Currently per method, could be - * expanded to per-scope. - * - * RETURN: A pointer to name (allocated here). - * - * DESCRIPTION: Generate an ACPI name of the form _T_x. These names are - * reserved for use by the ASL compiler. (_T_0 through _T_Z) - * - ******************************************************************************/ - -static char * -TrAmlGetNextTempName ( - ACPI_PARSE_OBJECT *Op, - UINT8 *TempCount) -{ - char *TempName; - - - if (*TempCount >= (10+26)) /* 0-35 valid: 0-9 and A-Z for TempName[3] */ - { - /* Too many temps */ - - AslError (ASL_ERROR, ASL_MSG_TOO_MANY_TEMPS, Op, NULL); - return (NULL); - } - - TempName = UtLocalCalloc (5); - - if (*TempCount < 10) /* 0-9 */ - { - TempName[3] = (char) (*TempCount + '0'); - } - else /* 10-35: A-Z */ - { - TempName[3] = (char) (*TempCount + ('A' - 10)); - } - (*TempCount)++; - - /* First three characters are always "_T_" */ - - TempName[0] = '_'; - TempName[1] = 'T'; - TempName[2] = '_'; - - return (TempName); -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlInitLineNumbers - * - * PARAMETERS: Op - Op to be initialized - * Neighbor - Op used for initialization values - * - * RETURN: None - * - * DESCRIPTION: Initialized the various line numbers for a parse node. - * - ******************************************************************************/ - -static void -TrAmlInitLineNumbers ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Neighbor) -{ - - Op->Asl.EndLine = Neighbor->Asl.EndLine; - Op->Asl.EndLogicalLine = Neighbor->Asl.EndLogicalLine; - Op->Asl.LineNumber = Neighbor->Asl.LineNumber; - Op->Asl.LogicalByteOffset = Neighbor->Asl.LogicalByteOffset; - Op->Asl.LogicalLineNumber = Neighbor->Asl.LogicalLineNumber; -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlInitNode - * - * PARAMETERS: Op - Op to be initialized - * ParseOpcode - Opcode for this node - * - * RETURN: None - * - * DESCRIPTION: Initialize a node with the parse opcode and opcode name. - * - ******************************************************************************/ - -static void -TrAmlInitNode ( - ACPI_PARSE_OBJECT *Op, - UINT16 ParseOpcode) -{ - - Op->Asl.ParseOpcode = ParseOpcode; - UtSetParseOpName (Op); -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlSetSubtreeParent - * - * PARAMETERS: Op - First node in a list of peer nodes - * Parent - Parent of the subtree - * - * RETURN: None - * - * DESCRIPTION: Set the parent for all peer nodes in a subtree - * - ******************************************************************************/ - -static void -TrAmlSetSubtreeParent ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Parent) -{ - ACPI_PARSE_OBJECT *Next; - - - Next = Op; - while (Next) - { - Next->Asl.Parent = Parent; - Next = Next->Asl.Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlInsertPeer - * - * PARAMETERS: Op - First node in a list of peer nodes - * NewPeer - Peer node to insert - * - * RETURN: None - * - * DESCRIPTION: Insert a new peer node into a list of peers. - * - ******************************************************************************/ - -static void -TrAmlInsertPeer ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NewPeer) -{ - - NewPeer->Asl.Next = Op->Asl.Next; - Op->Asl.Next = NewPeer; -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlTransformWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: None - * - * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML - * operands. - * - ******************************************************************************/ - -ACPI_STATUS -TrAmlTransformWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - TrTransformSubtree (Op); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: TrTransformSubtree - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more - * complex AML opcodes require processing of the child nodes - * (arguments/operands). - * - ******************************************************************************/ - -static void -TrTransformSubtree ( - ACPI_PARSE_OBJECT *Op) -{ - - if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE) - { - return; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - TrDoDefinitionBlock (Op); - break; - - case PARSEOP_SWITCH: - TrDoSwitch (Op); - break; - - case PARSEOP_METHOD: - - /* - * TBD: Zero the tempname (_T_x) count. Probably shouldn't be a global, - * however - */ - Gbl_TempCount = 0; - break; - - default: - /* Nothing to do here for other opcodes */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: TrDoDefinitionBlock - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Find the end of the definition block and set a global to this - * node. It is used by the compiler to insert compiler-generated - * names at the root level of the namespace. - * - ******************************************************************************/ - -static void -TrDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - UINT32 i; - - - Next = Op->Asl.Child; - for (i = 0; i < 5; i++) - { - Next = Next->Asl.Next; - if (i == 0) - { - /* - * This is the table signature. Only the DSDT can be assumed - * to be at the root of the namespace; Therefore, namepath - * optimization can only be performed on the DSDT. - */ - if (!ACPI_COMPARE_NAME (Next->Asl.Value.String, ACPI_SIG_DSDT)) - { - Gbl_ReferenceOptimizationFlag = FALSE; - } - } - } - - Gbl_FirstLevelInsertionNode = Next; -} - - -/******************************************************************************* - * - * FUNCTION: TrDoSwitch - * - * PARAMETERS: StartNode - Parse node for SWITCH - * - * RETURN: None - * - * - * DESCRIPTION: Translate ASL SWITCH statement to if/else pairs. There is - * no actual AML opcode for SWITCH -- it must be simulated. - * - ******************************************************************************/ - -static void -TrDoSwitch ( - ACPI_PARSE_OBJECT *StartNode) -{ - ACPI_PARSE_OBJECT *Next; - ACPI_PARSE_OBJECT *CaseOp = NULL; - ACPI_PARSE_OBJECT *CaseBlock = NULL; - ACPI_PARSE_OBJECT *DefaultOp = NULL; - ACPI_PARSE_OBJECT *CurrentParentNode; - ACPI_PARSE_OBJECT *Conditional = NULL; - ACPI_PARSE_OBJECT *Predicate; - ACPI_PARSE_OBJECT *Peer; - ACPI_PARSE_OBJECT *NewOp; - ACPI_PARSE_OBJECT *NewOp2; - ACPI_PARSE_OBJECT *MethodOp; - ACPI_PARSE_OBJECT *StoreOp; - ACPI_PARSE_OBJECT *BreakOp; - char *PredicateValueName; - UINT16 Index; - UINT32 Btype; - - - /* Start node is the Switch() node */ - - CurrentParentNode = StartNode; - - /* Create a new temp name of the form _T_x */ - - PredicateValueName = TrAmlGetNextTempName (StartNode, &Gbl_TempCount); - if (!PredicateValueName) - { - return; - } - - /* First child is the Switch() predicate */ - - Next = StartNode->Asl.Child; - - /* - * Examine the return type of the Switch Value - - * must be Integer/Buffer/String - */ - Index = (UINT16) (Next->Asl.ParseOpcode - ASL_PARSE_OPCODE_BASE); - Btype = AslKeywordMapping[Index].AcpiBtype; - if ((Btype != ACPI_BTYPE_INTEGER) && - (Btype != ACPI_BTYPE_STRING) && - (Btype != ACPI_BTYPE_BUFFER)) - { - AslError (ASL_WARNING, ASL_MSG_SWITCH_TYPE, Next, NULL); - Btype = ACPI_BTYPE_INTEGER; - } - - /* CASE statements start at next child */ - - Peer = Next->Asl.Next; - while (Peer) - { - Next = Peer; - Peer = Next->Asl.Next; - - if (Next->Asl.ParseOpcode == PARSEOP_CASE) - { - if (CaseOp) - { - /* Add an ELSE to complete the previous CASE */ - - if (!Conditional) - { - return; - } - NewOp = TrCreateLeafNode (PARSEOP_ELSE); - NewOp->Asl.Parent = Conditional->Asl.Parent; - TrAmlInitLineNumbers (NewOp, NewOp->Asl.Parent); - - /* Link ELSE node as a peer to the previous IF */ - - TrAmlInsertPeer (Conditional, NewOp); - CurrentParentNode = NewOp; - } - - CaseOp = Next; - Conditional = CaseOp; - CaseBlock = CaseOp->Asl.Child->Asl.Next; - Conditional->Asl.Child->Asl.Next = NULL; - Predicate = CaseOp->Asl.Child; - - if ((Predicate->Asl.ParseOpcode == PARSEOP_PACKAGE) || - (Predicate->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)) - { - /* - * Convert the package declaration to this form: - * - * If (LNotEqual (Match (Package(){}, - * MEQ, _T_x, MTR, Zero, Zero), Ones)) - */ - NewOp2 = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ); - Predicate->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Conditional); - - NewOp = NewOp2; - NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); - NewOp->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Predicate); - - NewOp = NewOp2; - NewOp2 = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR); - NewOp->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Predicate); - - NewOp = NewOp2; - NewOp2 = TrCreateLeafNode (PARSEOP_ZERO); - NewOp->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Predicate); - - NewOp = NewOp2; - NewOp2 = TrCreateLeafNode (PARSEOP_ZERO); - NewOp->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Predicate); - - NewOp2 = TrCreateLeafNode (PARSEOP_MATCH); - NewOp2->Asl.Child = Predicate; /* PARSEOP_PACKAGE */ - TrAmlInitLineNumbers (NewOp2, Conditional); - TrAmlSetSubtreeParent (Predicate, NewOp2); - - NewOp = NewOp2; - NewOp2 = TrCreateLeafNode (PARSEOP_ONES); - NewOp->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Conditional); - - NewOp2 = TrCreateLeafNode (PARSEOP_LEQUAL); - NewOp2->Asl.Child = NewOp; - NewOp->Asl.Parent = NewOp2; - TrAmlInitLineNumbers (NewOp2, Conditional); - TrAmlSetSubtreeParent (NewOp, NewOp2); - - NewOp = NewOp2; - NewOp2 = TrCreateLeafNode (PARSEOP_LNOT); - NewOp2->Asl.Child = NewOp; - NewOp2->Asl.Parent = Conditional; - NewOp->Asl.Parent = NewOp2; - TrAmlInitLineNumbers (NewOp2, Conditional); - - Conditional->Asl.Child = NewOp2; - NewOp2->Asl.Next = CaseBlock; - } - else - { - /* - * Integer and Buffer case. - * - * Change CaseOp() to: If (LEqual (SwitchValue, CaseValue)) {...} - * Note: SwitchValue is first to allow the CaseValue to be implicitly - * converted to the type of SwitchValue if necessary. - * - * CaseOp->Child is the case value - * CaseOp->Child->Peer is the beginning of the case block - */ - NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); - NewOp->Asl.Next = Predicate; - TrAmlInitLineNumbers (NewOp, Predicate); - - NewOp2 = TrCreateLeafNode (PARSEOP_LEQUAL); - NewOp2->Asl.Parent = Conditional; - NewOp2->Asl.Child = NewOp; - TrAmlInitLineNumbers (NewOp2, Conditional); - - TrAmlSetSubtreeParent (NewOp, NewOp2); - - Predicate = NewOp2; - Predicate->Asl.Next = CaseBlock; - - TrAmlSetSubtreeParent (Predicate, Conditional); - Conditional->Asl.Child = Predicate; - } - - /* Reinitialize the CASE node to an IF node */ - - TrAmlInitNode (Conditional, PARSEOP_IF); - - /* - * The first CASE(IF) is not nested under an ELSE. - * All other CASEs are children of a parent ELSE. - */ - if (CurrentParentNode == StartNode) - { - Conditional->Asl.Next = NULL; - } - else - { - /* - * The IF is a child of previous IF/ELSE. It - * is therefore without peer. - */ - CurrentParentNode->Asl.Child = Conditional; - Conditional->Asl.Parent = CurrentParentNode; - Conditional->Asl.Next = NULL; - } - } - else if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT) - { - if (DefaultOp) - { - /* - * More than one Default - * (Parser does not catch this, must check here) - */ - AslError (ASL_ERROR, ASL_MSG_MULTIPLE_DEFAULT, Next, NULL); - } - else - { - /* Save the DEFAULT node for later, after CASEs */ - - DefaultOp = Next; - } - } - else - { - /* Unknown peer opcode */ - - AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%d)\n", - Next->Asl.ParseOpName, Next->Asl.ParseOpcode); - } - } - - /* Add the default case at the end of the if/else construct */ - - if (DefaultOp) - { - /* If no CASE statements, this is an error - see below */ - - if (CaseOp) - { - /* Convert the DEFAULT node to an ELSE */ - - if (!Conditional) - { - return; - } - - TrAmlInitNode (DefaultOp, PARSEOP_ELSE); - DefaultOp->Asl.Parent = Conditional->Asl.Parent; - - /* Link ELSE node as a peer to the previous IF */ - - TrAmlInsertPeer (Conditional, DefaultOp); - } - } - - if (!CaseOp) - { - AslError (ASL_ERROR, ASL_MSG_NO_CASES, StartNode, NULL); - } - - - /* - * Create a Name(_T_x, ...) statement. This statement must appear at the - * method level, in case a loop surrounds the switch statement and could - * cause the name to be created twice (error). - */ - - /* Create the Name node */ - - Predicate = StartNode->Asl.Child; - NewOp = TrCreateLeafNode (PARSEOP_NAME); - - /* Find the parent method */ - - Next = StartNode; - while ((Next->Asl.ParseOpcode != PARSEOP_METHOD) && - (Next->Asl.ParseOpcode != PARSEOP_DEFINITIONBLOCK)) - { - 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; /* 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); - - /* Create the NameSeg child for the Name node */ - - NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESEG, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); - NewOp2->Asl.CompileFlags |= NODE_IS_NAME_DECLARATION; - NewOp->Asl.Child = NewOp2; - - /* Create the initial value for the Name. Btype was already validated above */ - - switch (Btype) - { - case ACPI_BTYPE_INTEGER: - NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO, - (UINT64) 0); - break; - - case ACPI_BTYPE_STRING: - NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, - (UINT64) ACPI_TO_INTEGER ("")); - break; - - case ACPI_BTYPE_BUFFER: - (void) TrLinkPeerNode (NewOp2, TrCreateValuedLeafNode (PARSEOP_BUFFER, - (UINT64) 0)); - Next = NewOp2->Asl.Next; - (void) TrLinkChildren (Next, 1, TrCreateValuedLeafNode (PARSEOP_ZERO, - (UINT64) 1)); - (void) TrLinkPeerNode (Next->Asl.Child, - TrCreateValuedLeafNode (PARSEOP_DEFAULT_ARG, (UINT64) 0)); - - TrAmlSetSubtreeParent (Next->Asl.Child, Next); - break; - - default: - break; - } - - TrAmlSetSubtreeParent (NewOp2, NewOp); - - /* - * Transform the Switch() into a While(One)-Break node. - * And create a Store() node which will be used to save the - * Switch() value. The store is of the form: Store (Value, _T_x) - * where _T_x is the temp variable. - */ - TrAmlInitNode (StartNode, PARSEOP_WHILE); - NewOp = TrCreateLeafNode (PARSEOP_ONE); - NewOp->Asl.Next = Predicate->Asl.Next; - NewOp->Asl.Parent = StartNode; - StartNode->Asl.Child = NewOp; - - /* Create a Store() node */ - - StoreOp = TrCreateLeafNode (PARSEOP_STORE); - StoreOp->Asl.Parent = StartNode; - TrAmlInsertPeer (NewOp, StoreOp); - - /* Complete the Store subtree */ - - StoreOp->Asl.Child = Predicate; - Predicate->Asl.Parent = StoreOp; - - NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); - NewOp->Asl.Parent = StoreOp; - Predicate->Asl.Next = NewOp; - - /* Create a Break() node and insert it into the end of While() */ - - Conditional = StartNode->Asl.Child; - while (Conditional->Asl.Next) - { - Conditional = Conditional->Asl.Next; - } - - BreakOp = TrCreateLeafNode (PARSEOP_BREAK); - BreakOp->Asl.Parent = StartNode; - TrAmlInsertPeer (Conditional, BreakOp); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asltree.c b/src/add-ons/kernel/bus_managers/acpi/compiler/asltree.c deleted file mode 100644 index 1167f51bec..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asltree.c +++ /dev/null @@ -1,1194 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asltree - parse tree management - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asltree") - -/* Local prototypes */ - -static ACPI_PARSE_OBJECT * -TrGetNextNode ( - void); - -static char * -TrGetNodeFlagName ( - UINT32 Flags); - - -/******************************************************************************* - * - * FUNCTION: TrGetNextNode - * - * PARAMETERS: None - * - * RETURN: New parse node. Aborts on allocation failure - * - * DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local - * dynamic memory manager for performance reasons (This has a - * major impact on the speed of the compiler.) - * - ******************************************************************************/ - -static ACPI_PARSE_OBJECT * -TrGetNextNode ( - void) -{ - - if (Gbl_NodeCacheNext >= Gbl_NodeCacheLast) - { - Gbl_NodeCacheNext = UtLocalCalloc (sizeof (ACPI_PARSE_OBJECT) * - ASL_NODE_CACHE_SIZE); - Gbl_NodeCacheLast = Gbl_NodeCacheNext + ASL_NODE_CACHE_SIZE; - } - - return (Gbl_NodeCacheNext++); -} - - -/******************************************************************************* - * - * FUNCTION: TrAllocateNode - * - * PARAMETERS: ParseOpcode - Opcode to be assigned to the node - * - * RETURN: New parse node. Aborts on allocation failure - * - * DESCRIPTION: Allocate and initialize a new parse node for the parse tree - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrAllocateNode ( - UINT32 ParseOpcode) -{ - ACPI_PARSE_OBJECT *Op; - - - Op = TrGetNextNode (); - - Op->Asl.ParseOpcode = (UINT16) ParseOpcode; - Op->Asl.Filename = Gbl_Files[ASL_FILE_INPUT].Filename; - Op->Asl.LineNumber = Gbl_CurrentLineNumber; - Op->Asl.LogicalLineNumber = Gbl_LogicalLineNumber; - Op->Asl.LogicalByteOffset = Gbl_CurrentLineOffset; - Op->Asl.Column = Gbl_CurrentColumn; - - UtSetParseOpName (Op); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrReleaseNode - * - * PARAMETERS: Op - Op to be released - * - * RETURN: None - * - * DESCRIPTION: "release" a node. In truth, nothing is done since the node - * is part of a larger buffer - * - ******************************************************************************/ - -void -TrReleaseNode ( - ACPI_PARSE_OBJECT *Op) -{ - - return; -} - - -/******************************************************************************* - * - * FUNCTION: TrUpdateNode - * - * PARAMETERS: ParseOpcode - New opcode to be assigned to the node - * Op - An existing parse node - * - * RETURN: The updated node - * - * DESCRIPTION: Change the parse opcode assigned to a node. Usually used to - * change an opcode to DEFAULT_ARG so that the node is ignored - * during the code generation. Also used to set generic integers - * to a specific size (8, 16, 32, or 64 bits) - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrUpdateNode ( - UINT32 ParseOpcode, - ACPI_PARSE_OBJECT *Op) -{ - - if (!Op) - { - return NULL; - } - - DbgPrint (ASL_PARSE_OUTPUT, - "\nUpdateNode: Old - %s, New - %s\n\n", - UtGetOpName (Op->Asl.ParseOpcode), - UtGetOpName (ParseOpcode)); - - /* Assign new opcode and name */ - - if (Op->Asl.ParseOpcode == PARSEOP_ONES) - { - switch (ParseOpcode) - { - case PARSEOP_BYTECONST: - Op->Asl.Value.Integer = 0xFF; - break; - - case PARSEOP_WORDCONST: - Op->Asl.Value.Integer = 0xFFFF; - break; - - case PARSEOP_DWORDCONST: - Op->Asl.Value.Integer = 0xFFFFFFFF; - break; - - default: - /* Don't care about others, don't need to check QWORD */ - break; - } - } - - Op->Asl.ParseOpcode = (UINT16) ParseOpcode; - UtSetParseOpName (Op); - - /* - * For the BYTE, WORD, and DWORD constants, make sure that the integer - * that was passed in will actually fit into the data type - */ - switch (ParseOpcode) - { - case PARSEOP_BYTECONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX); - break; - - case PARSEOP_WORDCONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX); - break; - - case PARSEOP_DWORDCONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX); - break; - - default: - /* Don't care about others, don't need to check QWORD */ - break; - } - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrGetNodeFlagName - * - * PARAMETERS: Flags - Flags word to be decoded - * - * RETURN: Name string. Always returns a valid string pointer. - * - * DESCRIPTION: Decode a flags word - * - ******************************************************************************/ - -static char * -TrGetNodeFlagName ( - UINT32 Flags) -{ - - switch (Flags) - { - case NODE_VISITED: - return ("NODE_VISITED"); - - case NODE_AML_PACKAGE: - return ("NODE_AML_PACKAGE"); - - case NODE_IS_TARGET: - return ("NODE_IS_TARGET"); - - case NODE_IS_RESOURCE_DESC: - return ("NODE_IS_RESOURCE_DESC"); - - case NODE_IS_RESOURCE_FIELD: - return ("NODE_IS_RESOURCE_FIELD"); - - case NODE_HAS_NO_EXIT: - return ("NODE_HAS_NO_EXIT"); - - case NODE_IF_HAS_NO_EXIT: - return ("NODE_IF_HAS_NO_EXIT"); - - case NODE_NAME_INTERNALIZED: - return ("NODE_NAME_INTERNALIZED"); - - case NODE_METHOD_NO_RETVAL: - return ("NODE_METHOD_NO_RETVAL"); - - case NODE_METHOD_SOME_NO_RETVAL: - return ("NODE_METHOD_SOME_NO_RETVAL"); - - case NODE_RESULT_NOT_USED: - return ("NODE_RESULT_NOT_USED"); - - case NODE_METHOD_TYPED: - return ("NODE_METHOD_TYPED"); - - case NODE_IS_BIT_OFFSET: - return ("NODE_IS_BIT_OFFSET"); - - case NODE_COMPILE_TIME_CONST: - return ("NODE_COMPILE_TIME_CONST"); - - case NODE_IS_TERM_ARG: - return ("NODE_IS_TERM_ARG"); - - case NODE_WAS_ONES_OP: - return ("NODE_WAS_ONES_OP"); - - case NODE_IS_NAME_DECLARATION: - return ("NODE_IS_NAME_DECLARATION"); - - default: - return ("Multiple Flags (or unknown flag) set"); - } -} - - -/******************************************************************************* - * - * FUNCTION: TrSetNodeFlags - * - * PARAMETERS: Op - An existing parse node - * Flags - New flags word - * - * RETURN: The updated parser op - * - * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrSetNodeFlags ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags) -{ - - DbgPrint (ASL_PARSE_OUTPUT, - "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags, - TrGetNodeFlagName (Flags)); - - if (!Op) - { - return NULL; - } - - Op->Asl.CompileFlags |= Flags; - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrSetEndLineNumber - * - * PARAMETERS: Op - An existing parse node - * - * RETURN: None. - * - * DESCRIPTION: Set the ending line numbers (file line and logical line) of a - * parse node to the current line numbers. - * - ******************************************************************************/ - -void -TrSetEndLineNumber ( - ACPI_PARSE_OBJECT *Op) -{ - - /* If the end line # is already set, just return */ - - if (Op->Asl.EndLine) - { - return; - } - - Op->Asl.EndLine = Gbl_CurrentLineNumber; - Op->Asl.EndLogicalLine = Gbl_LogicalLineNumber; -} - - -/******************************************************************************* - * - * FUNCTION: TrCreateLeafNode - * - * PARAMETERS: ParseOpcode - New opcode to be assigned to the node - * - * RETURN: Pointer to the new node. Aborts on allocation failure - * - * DESCRIPTION: Create a simple leaf node (no children or peers, and no value - * assigned to the node) - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrCreateLeafNode ( - UINT32 ParseOpcode) -{ - ACPI_PARSE_OBJECT *Op; - - - Op = TrAllocateNode (ParseOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateLeafNode Ln/Col %d/%d NewNode %p Op %s\n\n", - Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode)); - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrCreateValuedLeafNode - * - * PARAMETERS: ParseOpcode - New opcode to be assigned to the node - * Value - Value to be assigned to the node - * - * RETURN: Pointer to the new node. Aborts on allocation failure - * - * DESCRIPTION: Create a leaf node (no children or peers) with a value - * assigned to it - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrCreateValuedLeafNode ( - UINT32 ParseOpcode, - UINT64 Value) -{ - ACPI_PARSE_OBJECT *Op; - - - Op = TrAllocateNode (ParseOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateValuedLeafNode Ln/Col %d/%d NewNode %p Op %s Value %8.8X%8.8X ", - Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode), - ACPI_FORMAT_UINT64 (Value)); - Op->Asl.Value.Integer = Value; - - switch (ParseOpcode) - { - case PARSEOP_STRING_LITERAL: - DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Value); - break; - - case PARSEOP_NAMESEG: - DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Value); - break; - - case PARSEOP_NAMESTRING: - DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Value); - break; - - case PARSEOP_EISAID: - DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Value); - break; - - case PARSEOP_METHOD: - DbgPrint (ASL_PARSE_OUTPUT, "METHOD"); - break; - - case PARSEOP_INTEGER: - DbgPrint (ASL_PARSE_OUTPUT, "INTEGER"); - break; - - default: - break; - } - - DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrCreateNode - * - * PARAMETERS: ParseOpcode - Opcode to be assigned to the node - * NumChildren - Number of children to follow - * ... - A list of child nodes to link to the new - * node. NumChildren long. - * - * RETURN: Pointer to the new node. Aborts on allocation failure - * - * DESCRIPTION: Create a new parse node and link together a list of child - * nodes underneath the new node. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrCreateNode ( - UINT32 ParseOpcode, - UINT32 NumChildren, - ...) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_PARSE_OBJECT *Child; - ACPI_PARSE_OBJECT *PrevChild; - va_list ap; - UINT32 i; - BOOLEAN FirstChild; - - - va_start (ap, NumChildren); - - /* Allocate one new node */ - - Op = TrAllocateNode (ParseOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateNode Ln/Col %d/%d NewParent %p Child %d Op %s ", - Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode)); - - /* Some extra debug output based on the parse opcode */ - - switch (ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - RootNode = Op; - DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->"); - break; - - case PARSEOP_OPERATIONREGION: - DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->"); - break; - - case PARSEOP_OR: - DbgPrint (ASL_PARSE_OUTPUT, "OR->"); - break; - - default: - /* Nothing to do for other opcodes */ - break; - } - - /* Link the new node to its children */ - - PrevChild = NULL; - FirstChild = TRUE; - for (i = 0; i < NumChildren; i++) - { - /* Get the next child */ - - Child = va_arg (ap, ACPI_PARSE_OBJECT *); - DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); - - /* - * If child is NULL, this means that an optional argument - * was omitted. We must create a placeholder with a special - * opcode (DEFAULT_ARG) so that the code generator will know - * that it must emit the correct default for this argument - */ - if (!Child) - { - Child = TrAllocateNode (PARSEOP_DEFAULT_ARG); - } - - /* Link first child to parent */ - - if (FirstChild) - { - FirstChild = FALSE; - Op->Asl.Child = Child; - } - - /* Point all children to parent */ - - Child->Asl.Parent = Op; - - /* Link children in a peer list */ - - if (PrevChild) - { - PrevChild->Asl.Next = Child; - }; - - /* - * This child might be a list, point all nodes in the list - * to the same parent - */ - while (Child->Asl.Next) - { - Child = Child->Asl.Next; - Child->Asl.Parent = Op; - } - - PrevChild = Child; - } - va_end(ap); - - DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkChildren - * - * PARAMETERS: Op - An existing parse node - * NumChildren - Number of children to follow - * ... - A list of child nodes to link to the new - * node. NumChildren long. - * - * RETURN: The updated (linked) node - * - * DESCRIPTION: Link a group of nodes to an existing parse node - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkChildren ( - ACPI_PARSE_OBJECT *Op, - UINT32 NumChildren, - ...) -{ - ACPI_PARSE_OBJECT *Child; - ACPI_PARSE_OBJECT *PrevChild; - va_list ap; - UINT32 i; - BOOLEAN FirstChild; - - - va_start (ap, NumChildren); - - - TrSetEndLineNumber (Op); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkChildren Line [%d to %d] NewParent %p Child %d Op %s ", - Op->Asl.LineNumber, Op->Asl.EndLine, - Op, NumChildren, UtGetOpName(Op->Asl.ParseOpcode)); - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - RootNode = Op; - DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->"); - break; - - case PARSEOP_OPERATIONREGION: - DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->"); - break; - - case PARSEOP_OR: - DbgPrint (ASL_PARSE_OUTPUT, "OR->"); - break; - - default: - /* Nothing to do for other opcodes */ - break; - } - - /* Link the new node to it's children */ - - PrevChild = NULL; - FirstChild = TRUE; - for (i = 0; i < NumChildren; i++) - { - Child = va_arg (ap, ACPI_PARSE_OBJECT *); - - if ((Child == PrevChild) && (Child != NULL)) - { - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child, - "Child node list invalid"); - return Op; - } - - DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); - - /* - * If child is NULL, this means that an optional argument - * was omitted. We must create a placeholder with a special - * opcode (DEFAULT_ARG) so that the code generator will know - * that it must emit the correct default for this argument - */ - if (!Child) - { - Child = TrAllocateNode (PARSEOP_DEFAULT_ARG); - } - - /* Link first child to parent */ - - if (FirstChild) - { - FirstChild = FALSE; - Op->Asl.Child = Child; - } - - /* Point all children to parent */ - - Child->Asl.Parent = Op; - - /* Link children in a peer list */ - - if (PrevChild) - { - PrevChild->Asl.Next = Child; - }; - - /* - * This child might be a list, point all nodes in the list - * to the same parent - */ - while (Child->Asl.Next) - { - Child = Child->Asl.Next; - Child->Asl.Parent = Op; - } - PrevChild = Child; - } - va_end(ap); - - DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkPeerNode - * - * PARAMETERS: Op1 - First peer - * Op2 - Second peer - * - * RETURN: Op1 or the non-null node. - * - * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkPeerNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2) -{ - ACPI_PARSE_OBJECT *Next; - - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkPeerNode: 1=%p (%s), 2=%p (%s)\n\n", - Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode) : NULL, - Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode) : NULL); - - - if ((!Op1) && (!Op2)) - { - DbgPrint (ASL_PARSE_OUTPUT, "\nTwo Null nodes!\n"); - return Op1; - } - - /* If one of the nodes is null, just return the non-null node */ - - if (!Op2) - { - return Op1; - } - - if (!Op1) - { - return Op2; - } - - if (Op1 == Op2) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "\n\n************* Internal error, linking node to itself %p\n\n\n", - Op1); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op1, - "Linking node to itself"); - return Op1; - } - - Op1->Asl.Parent = Op2->Asl.Parent; - - /* - * Op 1 may already have a peer list (such as an IF/ELSE pair), - * so we must walk to the end of the list and attach the new - * peer at the end - */ - Next = Op1; - while (Next->Asl.Next) - { - Next = Next->Asl.Next; - } - - Next->Asl.Next = Op2; - return Op1; -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkPeerNodes - * - * PARAMETERS: NumPeers - The number of nodes in the list to follow - * ... - A list of nodes to link together as peers - * - * RETURN: The first node in the list (head of the peer list) - * - * DESCRIPTION: Link together an arbitrary number of peer nodes. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkPeerNodes ( - UINT32 NumPeers, - ...) -{ - ACPI_PARSE_OBJECT *This; - ACPI_PARSE_OBJECT *Next; - va_list ap; - UINT32 i; - ACPI_PARSE_OBJECT *Start; - - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkPeerNodes: (%d) ", NumPeers); - - va_start (ap, NumPeers); - This = va_arg (ap, ACPI_PARSE_OBJECT *); - Start = This; - - /* - * Link all peers - */ - for (i = 0; i < (NumPeers -1); i++) - { - DbgPrint (ASL_PARSE_OUTPUT, "%d=%p ", (i+1), This); - - while (This->Asl.Next) - { - This = This->Asl.Next; - } - - /* Get another peer node */ - - Next = va_arg (ap, ACPI_PARSE_OBJECT *); - if (!Next) - { - Next = TrAllocateNode (PARSEOP_DEFAULT_ARG); - } - - /* link new node to the current node */ - - This->Asl.Next = Next; - This = Next; - } - va_end (ap); - - DbgPrint (ASL_PARSE_OUTPUT,"\n\n"); - return (Start); -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkChildNode - * - * PARAMETERS: Op1 - Parent node - * Op2 - Op to become a child - * - * RETURN: The parent node - * - * DESCRIPTION: Link two nodes together as a parent and child - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkChildNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2) -{ - ACPI_PARSE_OBJECT *Next; - - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkChildNode: Parent=%p (%s), Child=%p (%s)\n\n", - Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode): NULL, - Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode): NULL); - - if (!Op1 || !Op2) - { - return Op1; - } - - Op1->Asl.Child = Op2; - - /* Set the child and all peers of the child to point to the parent */ - - Next = Op2; - while (Next) - { - Next->Asl.Parent = Op1; - Next = Next->Asl.Next; - } - - return Op1; -} - - -/******************************************************************************* - * - * FUNCTION: TrWalkParseTree - * - * PARAMETERS: Visitation - Type of walk - * DescendingCallback - Called during tree descent - * AscendingCallback - Called during tree ascent - * Context - To be passed to the callbacks - * - * RETURN: Status from callback(s) - * - * DESCRIPTION: Walk the entire parse tree. - * - ******************************************************************************/ - -ACPI_STATUS -TrWalkParseTree ( - ACPI_PARSE_OBJECT *Op, - UINT32 Visitation, - ASL_WALK_CALLBACK DescendingCallback, - ASL_WALK_CALLBACK AscendingCallback, - void *Context) -{ - UINT32 Level; - BOOLEAN NodePreviouslyVisited; - ACPI_PARSE_OBJECT *StartOp = Op; - ACPI_STATUS Status; - - - if (!RootNode) - { - return (AE_OK); - } - - Level = 0; - NodePreviouslyVisited = FALSE; - - switch (Visitation) - { - case ASL_WALK_VISIT_DOWNWARD: - - while (Op) - { - if (!NodePreviouslyVisited) - { - /* Let the callback process the node. */ - - Status = DescendingCallback (Op, Level, Context); - if (ACPI_SUCCESS (Status)) - { - /* Visit children first, once */ - - if (Op->Asl.Child) - { - Level++; - Op = Op->Asl.Child; - continue; - } - } - else if (Status != AE_CTRL_DEPTH) - { - /* Exit immediately on any error */ - - return (Status); - } - } - - /* Terminate walk at start op */ - - if (Op == StartOp) - { - break; - } - - /* No more children, visit peers */ - - if (Op->Asl.Next) - { - Op = Op->Asl.Next; - NodePreviouslyVisited = FALSE; - } - else - { - /* No children or peers, re-visit parent */ - - if (Level != 0 ) - { - Level--; - } - Op = Op->Asl.Parent; - NodePreviouslyVisited = TRUE; - } - } - break; - - - case ASL_WALK_VISIT_UPWARD: - - while (Op) - { - /* Visit leaf node (no children) or parent node on return trip */ - - if ((!Op->Asl.Child) || - (NodePreviouslyVisited)) - { - /* Let the callback process the node. */ - - Status = AscendingCallback (Op, Level, Context); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else - { - /* Visit children first, once */ - - Level++; - Op = Op->Asl.Child; - continue; - } - - /* Terminate walk at start op */ - - if (Op == StartOp) - { - break; - } - - /* No more children, visit peers */ - - if (Op->Asl.Next) - { - Op = Op->Asl.Next; - NodePreviouslyVisited = FALSE; - } - else - { - /* No children or peers, re-visit parent */ - - if (Level != 0 ) - { - Level--; - } - Op = Op->Asl.Parent; - NodePreviouslyVisited = TRUE; - } - } - break; - - - case ASL_WALK_VISIT_TWICE: - - while (Op) - { - if (NodePreviouslyVisited) - { - Status = AscendingCallback (Op, Level, Context); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else - { - /* Let the callback process the node. */ - - Status = DescendingCallback (Op, Level, Context); - if (ACPI_SUCCESS (Status)) - { - /* Visit children first, once */ - - if (Op->Asl.Child) - { - Level++; - Op = Op->Asl.Child; - continue; - } - } - else if (Status != AE_CTRL_DEPTH) - { - /* Exit immediately on any error */ - - return (Status); - } - } - - /* Terminate walk at start op */ - - if (Op == StartOp) - { - break; - } - - /* No more children, visit peers */ - - if (Op->Asl.Next) - { - Op = Op->Asl.Next; - NodePreviouslyVisited = FALSE; - } - else - { - /* No children or peers, re-visit parent */ - - if (Level != 0 ) - { - Level--; - } - Op = Op->Asl.Parent; - NodePreviouslyVisited = TRUE; - } - } - break; - - default: - /* No other types supported */ - break; - } - - /* If we get here, the walk completed with no errors */ - - return (AE_OK); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/asltypes.h b/src/add-ons/kernel/bus_managers/acpi/compiler/asltypes.h deleted file mode 100644 index 815763499d..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/asltypes.h +++ /dev/null @@ -1,579 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asltypes.h - compiler data types and struct definitions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#ifndef __ASLTYPES_H -#define __ASLTYPES_H - - -/******************************************************************************* - * - * Structure definitions - * - ******************************************************************************/ - - -/* Op flags for the ACPI_PARSE_OBJECT */ - -#define NODE_VISITED 0x00000001 -#define NODE_AML_PACKAGE 0x00000002 -#define NODE_IS_TARGET 0x00000004 -#define NODE_IS_RESOURCE_DESC 0x00000008 -#define NODE_IS_RESOURCE_FIELD 0x00000010 -#define NODE_HAS_NO_EXIT 0x00000020 -#define NODE_IF_HAS_NO_EXIT 0x00000040 -#define NODE_NAME_INTERNALIZED 0x00000080 -#define NODE_METHOD_NO_RETVAL 0x00000100 -#define NODE_METHOD_SOME_NO_RETVAL 0x00000200 -#define NODE_RESULT_NOT_USED 0x00000400 -#define NODE_METHOD_TYPED 0x00000800 -#define NODE_IS_BIT_OFFSET 0x00001000 -#define NODE_COMPILE_TIME_CONST 0x00002000 -#define NODE_IS_TERM_ARG 0x00004000 -#define NODE_WAS_ONES_OP 0x00008000 -#define NODE_IS_NAME_DECLARATION 0x00010000 -#define NODE_COMPILER_EMITTED 0x00020000 -#define NODE_IS_DUPLICATE 0x00040000 -#define NODE_IS_RESOURCE_DATA 0x00080000 - -/* Keeps information about individual control methods */ - -typedef struct asl_method_info -{ - UINT8 NumArguments; - UINT8 LocalInitialized[ACPI_METHOD_NUM_LOCALS]; - UINT8 ArgInitialized[ACPI_METHOD_NUM_ARGS]; - UINT32 ValidArgTypes[ACPI_METHOD_NUM_ARGS]; - UINT32 ValidReturnTypes; - UINT32 NumReturnNoValue; - UINT32 NumReturnWithValue; - ACPI_PARSE_OBJECT *Op; - struct asl_method_info *Next; - UINT8 HasBeenTyped; - -} ASL_METHOD_INFO; - - -/* Parse tree walk info for control method analysis */ - -typedef struct asl_analysis_walk_info -{ - ASL_METHOD_INFO *MethodStack; - -} ASL_ANALYSIS_WALK_INFO; - - -/* An entry in the ParseOpcode to AmlOpcode mapping table */ - -typedef struct asl_mapping_entry -{ - UINT32 Value; - UINT32 AcpiBtype; /* Object type or return type */ - UINT16 AmlOpcode; - UINT8 Flags; - -} ASL_MAPPING_ENTRY; - - -/* Parse tree walk info structure */ - -typedef struct asl_walk_info -{ - ACPI_PARSE_OBJECT **NodePtr; - UINT32 *LevelPtr; - -} ASL_WALK_INFO; - - -/* File info */ - -typedef struct asl_file_info -{ - FILE *Handle; - char *Filename; - -} ASL_FILE_INFO; - -typedef struct asl_file_status -{ - UINT32 Line; - UINT32 Offset; - -} ASL_FILE_STATUS; - - -/* File types */ - -typedef enum -{ - ASL_FILE_STDOUT = 0, - ASL_FILE_STDERR, - ASL_FILE_INPUT, - ASL_FILE_AML_OUTPUT, - ASL_FILE_SOURCE_OUTPUT, - ASL_FILE_LISTING_OUTPUT, - ASL_FILE_HEX_OUTPUT, - ASL_FILE_NAMESPACE_OUTPUT, - ASL_FILE_DEBUG_OUTPUT, - ASL_FILE_ASM_SOURCE_OUTPUT, - ASL_FILE_C_SOURCE_OUTPUT, - ASL_FILE_ASM_INCLUDE_OUTPUT, - ASL_FILE_C_INCLUDE_OUTPUT - -} ASL_FILE_TYPES; - - -#define ASL_MAX_FILE_TYPE 12 -#define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) - - -typedef struct asl_include_dir -{ - char *Dir; - struct asl_include_dir *Next; - -} ASL_INCLUDE_DIR; - - -/* An entry in the exception list, one for each error/warning */ - -typedef struct asl_error_msg -{ - UINT32 LineNumber; - UINT32 LogicalLineNumber; - UINT32 LogicalByteOffset; - UINT32 Column; - char *Message; - struct asl_error_msg *Next; - char *Filename; - UINT32 FilenameLength; - UINT8 MessageId; - UINT8 Level; - -} ASL_ERROR_MSG; - - -/* An entry in the listing file stack (for include files) */ - -typedef struct asl_listing_node -{ - char *Filename; - UINT32 LineNumber; - struct asl_listing_node *Next; - -} ASL_LISTING_NODE; - - -/* Callback interface for a parse tree walk */ - -typedef -ACPI_STATUS (*ASL_WALK_CALLBACK) ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -typedef struct asl_event_info -{ - UINT64 StartTime; - UINT64 EndTime; - char *EventName; - BOOLEAN Valid; - -} ASL_EVENT_INFO; - - -#define ASL_WARNING 0 -#define ASL_WARNING2 1 -#define ASL_WARNING3 2 -#define ASL_ERROR 3 -#define ASL_REMARK 4 -#define ASL_OPTIMIZATION 5 -#define ASL_NUM_REPORT_LEVELS 6 - - -typedef enum -{ - ASL_MSG_RESERVED = 0, - ASL_MSG_ALPHANUMERIC_STRING, - ASL_MSG_AML_NOT_IMPLEMENTED, - ASL_MSG_ARG_COUNT_HI, - ASL_MSG_ARG_COUNT_LO, - ASL_MSG_ARG_INIT, - ASL_MSG_BACKWARDS_OFFSET, - ASL_MSG_BITS_TO_BYTES, - ASL_MSG_BUFFER_LENGTH, - ASL_MSG_BYTES_TO_BITS, - ASL_MSG_CLOSE, - ASL_MSG_COMPILER_INTERNAL, - ASL_MSG_CONSTANT_EVALUATION, - ASL_MSG_CONSTANT_FOLDED, - ASL_MSG_CORE_EXCEPTION, - ASL_MSG_DEBUG_FILE_OPEN, - ASL_MSG_DEBUG_FILENAME, - ASL_MSG_DEPENDENT_NESTING, - ASL_MSG_DMA_CHANNEL, - ASL_MSG_DMA_LIST, - ASL_MSG_DUPLICATE_CASE, - ASL_MSG_DUPLICATE_ITEM, - ASL_MSG_EARLY_EOF, - ASL_MSG_ENCODING_LENGTH, - ASL_MSG_EX_INTERRUPT_LIST, - ASL_MSG_EX_INTERRUPT_LIST_MIN, - ASL_MSG_EX_INTERRUPT_NUMBER, - ASL_MSG_FIELD_ACCESS_WIDTH, - ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, - ASL_MSG_FIELD_UNIT_OFFSET, - ASL_MSG_INCLUDE_FILE_OPEN, - ASL_MSG_INPUT_FILE_OPEN, - ASL_MSG_INTEGER_LENGTH, - ASL_MSG_INTEGER_OPTIMIZATION, - ASL_MSG_INTERRUPT_LIST, - ASL_MSG_INTERRUPT_NUMBER, - ASL_MSG_INVALID_CONSTANT_OP, - ASL_MSG_INVALID_EISAID, - ASL_MSG_INVALID_ESCAPE, - ASL_MSG_INVALID_OPERAND, - ASL_MSG_INVALID_PERFORMANCE, - ASL_MSG_INVALID_PRIORITY, - ASL_MSG_INVALID_STRING, - ASL_MSG_INVALID_TARGET, - ASL_MSG_INVALID_TIME, - ASL_MSG_INVALID_TYPE, - ASL_MSG_INVALID_UUID, - ASL_MSG_LIST_LENGTH_LONG, - ASL_MSG_LIST_LENGTH_SHORT, - ASL_MSG_LISTING_FILE_OPEN, - ASL_MSG_LISTING_FILENAME, - ASL_MSG_LOCAL_INIT, - ASL_MSG_LONG_LINE, - ASL_MSG_MEMORY_ALLOCATION, - ASL_MSG_MISSING_ENDDEPENDENT, - ASL_MSG_MISSING_STARTDEPENDENT, - ASL_MSG_MULTIPLE_TYPES, - ASL_MSG_NAME_EXISTS, - ASL_MSG_NAME_OPTIMIZATION, - ASL_MSG_NESTED_COMMENT, - ASL_MSG_NO_CASES, - ASL_MSG_NO_RETVAL, - ASL_MSG_NO_WHILE, - ASL_MSG_NON_ASCII, - ASL_MSG_NOT_EXIST, - ASL_MSG_NOT_FOUND, - ASL_MSG_NOT_METHOD, - ASL_MSG_NOT_PARAMETER, - ASL_MSG_NOT_REACHABLE, - ASL_MSG_OPEN, - ASL_MSG_OUTPUT_FILE_OPEN, - ASL_MSG_OUTPUT_FILENAME, - ASL_MSG_PACKAGE_LENGTH, - ASL_MSG_READ, - ASL_MSG_RECURSION, - ASL_MSG_REGION_BUFFER_ACCESS, - ASL_MSG_REGION_BYTE_ACCESS, - ASL_MSG_RESERVED_ARG_COUNT_HI, - ASL_MSG_RESERVED_ARG_COUNT_LO, - ASL_MSG_RESERVED_METHOD, - ASL_MSG_RESERVED_OPERAND_TYPE, - ASL_MSG_RESERVED_RETURN_VALUE, - ASL_MSG_RESERVED_USE, - ASL_MSG_RESERVED_WORD, - ASL_MSG_RESOURCE_FIELD, - ASL_MSG_RESOURCE_INDEX, - ASL_MSG_RESOURCE_LIST, - ASL_MSG_RESOURCE_SOURCE, - ASL_MSG_RETURN_TYPES, - ASL_MSG_SCOPE_FWD_REF, - ASL_MSG_SCOPE_TYPE, - ASL_MSG_SEEK, - ASL_MSG_SINGLE_NAME_OPTIMIZATION, - ASL_MSG_SOME_NO_RETVAL, - ASL_MSG_SWITCH_TYPE, - ASL_MSG_SYNC_LEVEL, - ASL_MSG_SYNTAX, - ASL_MSG_TABLE_SIGNATURE, - ASL_MSG_TOO_MANY_TEMPS, - ASL_MSG_UNKNOWN_RESERVED_NAME, - ASL_MSG_UNREACHABLE_CODE, - ASL_MSG_UNSUPPORTED, - ASL_MSG_VENDOR_LIST, - ASL_MSG_WRITE, - ASL_MSG_MULTIPLE_DEFAULT, - ASL_MSG_TIMEOUT, - ASL_MSG_RESULT_NOT_USED, - ASL_MSG_NOT_REFERENCED, - ASL_MSG_NON_ZERO, - ASL_MSG_STRING_LENGTH, - ASL_MSG_SERIALIZED, - ASL_MSG_COMPILER_RESERVED, - ASL_MSG_NAMED_OBJECT_IN_WHILE, - ASL_MSG_LOCAL_OUTSIDE_METHOD, - ASL_MSG_ALIGNMENT, - ASL_MSG_ISA_ADDRESS, - ASL_MSG_INVALID_MIN_MAX, - ASL_MSG_INVALID_LENGTH, - ASL_MSG_INVALID_LENGTH_FIXED, - ASL_MSG_INVALID_GRANULARITY, - ASL_MSG_INVALID_GRAN_FIXED, - ASL_MSG_INVALID_ACCESS_SIZE, - ASL_MSG_INVALID_ADDR_FLAGS - -} ASL_MESSAGE_IDS; - -#ifdef ASL_EXCEPTIONS - -char *AslMessages [] = { -/* The zeroth message is resesrved */ "", -/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric", -/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator", -/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments", -/* ASL_MSG_ARG_COUNT_LO */ "Too few arguments", -/* ASL_MSG_ARG_INIT */ "Method argument is not initialized", -/* ASL_MSG_BACKWARDS_OFFSET */ "Invalid backwards offset", -/* ASL_MSG_BITS_TO_BYTES */ "Field offset is in bits, but a byte offset is required", -/* ASL_MSG_BUFFER_LENGTH */ "Effective AML buffer length is zero", -/* ASL_MSG_BYTES_TO_BITS */ "Field offset is in bytes, but a bit offset is required", -/* ASL_MSG_CLOSE */ "Could not close file", -/* ASL_MSG_COMPILER_INTERNAL */ "Internal compiler error", -/* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression", -/* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced", -/* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem", -/* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file", -/* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename", -/* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",\ -/* ASL_MSG_DMA_CHANNEL */ "Invalid DMA channel (must be 0-7)", -/* ASL_MSG_DMA_LIST */ "Too many DMA channels (8 max)", -/* ASL_MSG_DUPLICATE_CASE */ "Case value already specified", -/* ASL_MSG_DUPLICATE_ITEM */ "Duplicate value in list", -/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached", -/* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode", -/* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)", -/* ASL_MSG_EX_INTERRUPT_LIST_MIN */ "Too few interrupts (1 minimum required)", -/* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)", -/* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size", -/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit", -/* ASL_MSG_FIELD_UNIT_OFFSET */ "Field Unit extends beyond region limit", -/* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file", -/* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file", -/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating", -/* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode", -/* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)", -/* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)", -/* ASL_MSG_INVALID_CONSTANT_OP */ "Invalid operator in constant expression (not type 3/4/5)", -/* ASL_MSG_INVALID_EISAID */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)", -/* ASL_MSG_INVALID_ESCAPE */ "Invalid or unknown escape sequence", -/* ASL_MSG_INVALID_OPERAND */ "Invalid operand", -/* ASL_MSG_INVALID_PERFORMANCE */ "Invalid performance/robustness value", -/* ASL_MSG_INVALID_PRIORITY */ "Invalid priority value", -/* ASL_MSG_INVALID_STRING */ "Invalid Hex/Octal Escape - Non-ASCII or NULL", -/* ASL_MSG_INVALID_TARGET */ "Target operand not allowed in constant expression", -/* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)", -/* ASL_MSG_INVALID_TYPE */ "Invalid type", -/* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"", -/* ASL_MSG_LIST_LENGTH_LONG */ "Initializer list longer than declared package length", -/* ASL_MSG_LIST_LENGTH_SHORT */ "Initializer list shorter than declared package length", -/* ASL_MSG_LISTING_FILE_OPEN */ "Could not open listing file", -/* ASL_MSG_LISTING_FILENAME */ "Could not create listing filename", -/* ASL_MSG_LOCAL_INIT */ "Method local variable is not initialized", -/* ASL_MSG_LONG_LINE */ "Splitting long input line", -/* ASL_MSG_MEMORY_ALLOCATION */ "Memory allocation failure", -/* ASL_MSG_MISSING_ENDDEPENDENT */ "Missing EndDependentFn() macro in dependent resource list", -/* ASL_MSG_MISSING_STARTDEPENDENT */ "Missing StartDependentFn() macro in dependent resource list", -/* ASL_MSG_MULTIPLE_TYPES */ "Multiple types", -/* ASL_MSG_NAME_EXISTS */ "Name already exists in scope", -/* ASL_MSG_NAME_OPTIMIZATION */ "NamePath optimized", -/* ASL_MSG_NESTED_COMMENT */ "Nested comment found", -/* ASL_MSG_NO_CASES */ "No Case statements under Switch", -/* ASL_MSG_NO_RETVAL */ "Called method returns no value", -/* ASL_MSG_NO_WHILE */ "No enclosing While statement", -/* ASL_MSG_NON_ASCII */ "Invalid characters found in file", -/* ASL_MSG_NOT_EXIST */ "Object does not exist", -/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from scope", -/* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke", -/* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only", -/* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope", -/* ASL_MSG_OPEN */ "Could not open file", -/* ASL_MSG_OUTPUT_FILE_OPEN */ "Could not open output AML file", -/* ASL_MSG_OUTPUT_FILENAME */ "Could not create output filename", -/* ASL_MSG_PACKAGE_LENGTH */ "Effective AML package length is zero", -/* ASL_MSG_READ */ "Could not read file", -/* ASL_MSG_RECURSION */ "Recursive method call", -/* ASL_MSG_REGION_BUFFER_ACCESS */ "Host Operation Region requires BufferAcc access", -/* ASL_MSG_REGION_BYTE_ACCESS */ "Host Operation Region requires ByteAcc access", -/* ASL_MSG_RESERVED_ARG_COUNT_HI */ "Reserved method has too many arguments", -/* ASL_MSG_RESERVED_ARG_COUNT_LO */ "Reserved method has too few arguments", -/* ASL_MSG_RESERVED_METHOD */ "Reserved name must be a control method", -/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name", -/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value", -/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name", -/* ASL_MSG_RESERVED_WORD */ "Use of reserved name", -/* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target", -/* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)", -/* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)", -/* ASL_MSG_RESOURCE_SOURCE */ "Missing ResourceSource string (required)", -/* ASL_MSG_RETURN_TYPES */ "Not all control paths return a value", -/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope operator not allowed", -/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator", -/* ASL_MSG_SEEK */ "Could not seek file", -/* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)", -/* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value", -/* ASL_MSG_SWITCH_TYPE */ "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer", -/* ASL_MSG_SYNC_LEVEL */ "SyncLevel must be in the range 0-15", -/* ASL_MSG_SYNTAX */ "", -/* ASL_MSG_TABLE_SIGNATURE */ "Invalid Table Signature", -/* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)", -/* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name", -/* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable", -/* ASL_MSG_UNSUPPORTED */ "Unsupported feature", -/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)", -/* ASL_MSG_WRITE */ "Could not write file", -/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct", -/* ASL_MSG_TIMEOUT */ "Possible operator timeout is ignored", -/* 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_SERIALIZED */ "Control Method marked Serialized", -/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name", -/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop", -/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method", -/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value", -/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)", -/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max", -/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window", -/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window", -/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one", -/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max", -/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)", -/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags" - -}; - - -char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = { - "Warning ", - "Warning ", - "Warning ", - "Error ", - "Remark ", - "Optimize" -}; - -#define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */ - -#endif /* ASL_EXCEPTIONS */ - -#endif /* __ASLTYPES_H */ diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/aslutils.c b/src/add-ons/kernel/bus_managers/acpi/compiler/aslutils.c deleted file mode 100644 index 01db90a306..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/aslutils.c +++ /dev/null @@ -1,1060 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslutils -- compiler utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.y.h" -#include "acnamesp.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslutils") - -#ifdef _USE_BERKELEY_YACC -extern const char * const AslCompilername[]; -static const char * const *yytname = &AslCompilername[254]; -#else -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 -UtStrtoul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger); - -static void -UtPadNameWithUnderscores ( - char *NameSeg, - char *PaddedNameSeg); - -static void -UtAttachNameseg ( - ACPI_PARSE_OBJECT *Op, - char *Name); - - -/******************************************************************************* - * - * FUNCTION: AcpiPsDisplayConstantOpcodes - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Print AML opcodes that can be used in constant expressions. - * - ******************************************************************************/ - -void -UtDisplayConstantOpcodes ( - void) -{ - UINT32 i; - - - printf ("Constant expression opcode information\n\n"); - - for (i = 0; i < sizeof (AcpiGbl_AmlOpInfo) / sizeof (ACPI_OPCODE_INFO); i++) - { - if (AcpiGbl_AmlOpInfo[i].Flags & AML_CONSTANT) - { - printf ("%s\n", AcpiGbl_AmlOpInfo[i].Name); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: UtLocalCalloc - * - * PARAMETERS: Size - Bytes to be allocated - * - * RETURN: Pointer to the allocated memory. Guaranteed to be valid. - * - * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an - * allocation failure, on the assumption that nothing more can be - * accomplished. - * - ******************************************************************************/ - -void * -UtLocalCalloc ( - UINT32 Size) -{ - void *Allocated; - - - Allocated = ACPI_ALLOCATE_ZEROED (Size); - if (!Allocated) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - exit (1); - } - - TotalAllocations++; - TotalAllocated += Size; - return (Allocated); -} - - -/******************************************************************************* - * - * FUNCTION: UtBeginEvent - * - * PARAMETERS: Name - Ascii name of this event - * - * RETURN: Event - Event number (integer index) - * - * DESCRIPTION: Saves the current time with this event - * - ******************************************************************************/ - -UINT8 -UtBeginEvent ( - char *Name) -{ - - if (AslGbl_NextEvent >= ASL_NUM_EVENTS) - { - AcpiOsPrintf ("Ran out of compiler event structs!\n"); - return (AslGbl_NextEvent); - } - - /* Init event with current (start) time */ - - AslGbl_Events[AslGbl_NextEvent].StartTime = AcpiOsGetTimer (); - AslGbl_Events[AslGbl_NextEvent].EventName = Name; - AslGbl_Events[AslGbl_NextEvent].Valid = TRUE; - - return (AslGbl_NextEvent++); -} - - -/******************************************************************************* - * - * FUNCTION: UtEndEvent - * - * PARAMETERS: Event - Event number (integer index) - * - * RETURN: None - * - * DESCRIPTION: Saves the current time (end time) with this event - * - ******************************************************************************/ - -void -UtEndEvent ( - UINT8 Event) -{ - - if (Event >= ASL_NUM_EVENTS) - { - return; - } - - /* Insert end time for event */ - - AslGbl_Events[Event].EndTime = AcpiOsGetTimer (); -} - - -/******************************************************************************* - * - * FUNCTION: UtHexCharToValue - * - * PARAMETERS: HexChar - Hex character in Ascii - * - * RETURN: The binary value of the hex character - * - * DESCRIPTION: Perform ascii-to-hex translation - * - ******************************************************************************/ - -UINT8 -UtHexCharToValue ( - int HexChar) -{ - - if (HexChar <= 0x39) - { - return ((UINT8) (HexChar - 0x30)); - } - - if (HexChar <= 0x46) - { - return ((UINT8) (HexChar - 0x37)); - } - - return ((UINT8) (HexChar - 0x57)); -} - - -/******************************************************************************* - * - * FUNCTION: UtConvertByteToHex - * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be stored - * - * RETURN: Ascii hex byte is stored in Buffer. - * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed - * with "0x" - * - ******************************************************************************/ - -void -UtConvertByteToHex ( - UINT8 RawByte, - UINT8 *Buffer) -{ - - Buffer[0] = '0'; - Buffer[1] = 'x'; - - Buffer[2] = (UINT8) HexLookup[(RawByte >> 4) & 0xF]; - Buffer[3] = (UINT8) HexLookup[RawByte & 0xF]; -} - - -/******************************************************************************* - * - * FUNCTION: UtConvertByteToAsmHex - * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be stored - * - * RETURN: Ascii hex byte is stored in Buffer. - * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed - * with "0x" - * - ******************************************************************************/ - -void -UtConvertByteToAsmHex ( - UINT8 RawByte, - UINT8 *Buffer) -{ - - Buffer[0] = '0'; - Buffer[1] = (UINT8) HexLookup[(RawByte >> 4) & 0xF]; - Buffer[2] = (UINT8) HexLookup[RawByte & 0xF]; - Buffer[3] = 'h'; -} - - -/******************************************************************************* - * - * FUNCTION: DbgPrint - * - * PARAMETERS: Type - Type of output - * Fmt - Printf format string - * ... - variable printf list - * - * RETURN: None - * - * DESCRIPTION: Conditional print statement. Prints to stderr only if the - * debug flag is set. - * - ******************************************************************************/ - -void -DbgPrint ( - UINT32 Type, - char *Fmt, - ...) -{ - va_list Args; - - - va_start (Args, Fmt); - - if (!Gbl_DebugFlag) - { - return; - } - - if ((Type == ASL_PARSE_OUTPUT) && - (!(AslCompilerdebug))) - { - return; - } - - (void) vfprintf (stderr, Fmt, Args); - va_end (Args); - return; -} - - -/******************************************************************************* - * - * FUNCTION: UtPrintFormattedName - * - * PARAMETERS: ParseOpcode - Parser keyword ID - * Level - Indentation level - * - * RETURN: None - * - * DESCRIPTION: Print the ascii name of the parse opcode. - * - ******************************************************************************/ - -#define TEXT_OFFSET 10 - -void -UtPrintFormattedName ( - UINT16 ParseOpcode, - UINT32 Level) -{ - - if (Level) - { - DbgPrint (ASL_TREE_OUTPUT, - "%*s", (3 * Level), " "); - } - DbgPrint (ASL_TREE_OUTPUT, - " %-20.20s", UtGetOpName (ParseOpcode)); - - if (Level < TEXT_OFFSET) - { - DbgPrint (ASL_TREE_OUTPUT, - "%*s", (TEXT_OFFSET - Level) * 3, " "); - } -} - - -/******************************************************************************* - * - * FUNCTION: UtSetParseOpName - * - * PARAMETERS: Op - * - * RETURN: None - * - * DESCRIPTION: Insert the ascii name of the parse opcode - * - ******************************************************************************/ - -void -UtSetParseOpName ( - ACPI_PARSE_OBJECT *Op) -{ - - strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), - ACPI_MAX_PARSEOP_NAME); -} - - -/******************************************************************************* - * - * FUNCTION: UtGetOpName - * - * PARAMETERS: ParseOpcode - Parser keyword ID - * - * RETURN: Pointer to the opcode name - * - * DESCRIPTION: Get the ascii name of the parse opcode - * - ******************************************************************************/ - -char * -UtGetOpName ( - UINT32 ParseOpcode) -{ - - /* - * First entries (ASL_YYTNAME_START) in yytname are special reserved names. - * Ignore first 8 characters of the name - */ - return ((char *) yytname - [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8); -} - - -/******************************************************************************* - * - * FUNCTION: UtDisplaySummary - * - * PARAMETERS: FileID - ID of outpout file - * - * RETURN: None - * - * DESCRIPTION: Display compilation statistics - * - ******************************************************************************/ - -void -UtDisplaySummary ( - UINT32 FileId) -{ - - if (FileId != ASL_FILE_STDOUT) - { - /* Compiler name and version number */ - - FlPrintFile (FileId, "%s version %X [%s]\n", - CompilerId, (UINT32) ACPI_CA_VERSION, __DATE__); - } - - /* Input/Output summary */ - - FlPrintFile (FileId, - "ASL Input: %s - %d lines, %d bytes, %d keywords\n", - Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber, - Gbl_InputByteCount, TotalKeywords); - - /* AML summary */ - - if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors)) - { - FlPrintFile (FileId, - "AML Output: %s - %d bytes, %d named objects, %d executable opcodes\n\n", - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength, - TotalNamedObjects, TotalExecutableOpcodes); - } - - /* Error summary */ - - FlPrintFile (FileId, - "Compilation complete. %d Errors, %d Warnings, %d Remarks, %d Optimizations\n", - Gbl_ExceptionCount[ASL_ERROR], - Gbl_ExceptionCount[ASL_WARNING] + - Gbl_ExceptionCount[ASL_WARNING2] + - Gbl_ExceptionCount[ASL_WARNING3], - Gbl_ExceptionCount[ASL_REMARK], - Gbl_ExceptionCount[ASL_OPTIMIZATION]); -} - - -/******************************************************************************* - * - * FUNCTION: UtDisplaySummary - * - * PARAMETERS: Op - Integer parse node - * LowValue - Smallest allowed value - * HighValue - Largest allowed value - * - * RETURN: Op if OK, otherwise NULL - * - * DESCRIPTION: Check integer for an allowable range - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -UtCheckIntegerRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 LowValue, - UINT32 HighValue) -{ - char *ParseError = NULL; - char Buffer[64]; - - - if (!Op) - { - return NULL; - } - - if (Op->Asl.Value.Integer < LowValue) - { - ParseError = "Value below valid range"; - Op->Asl.Value.Integer = LowValue; - } - - if (Op->Asl.Value.Integer > HighValue) - { - ParseError = "Value above valid range"; - Op->Asl.Value.Integer = HighValue; - } - - if (ParseError) - { - sprintf (Buffer, "%s 0x%X-0x%X", ParseError, LowValue, HighValue); - AslCompilererror (Buffer); - - return NULL; - } - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: UtGetStringBuffer - * - * PARAMETERS: Length - Size of buffer requested - * - * RETURN: Pointer to the buffer. Aborts on allocation failure - * - * DESCRIPTION: Allocate a string buffer. Bypass the local - * dynamic memory manager for performance reasons (This has a - * major impact on the speed of the compiler.) - * - ******************************************************************************/ - -char * -UtGetStringBuffer ( - UINT32 Length) -{ - char *Buffer; - - - if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast) - { - Gbl_StringCacheNext = UtLocalCalloc (ASL_STRING_CACHE_SIZE + Length); - Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE + - Length; - } - - Buffer = Gbl_StringCacheNext; - Gbl_StringCacheNext += Length; - - return (Buffer); -} - - -/******************************************************************************* - * - * FUNCTION: UtInternalizeName - * - * PARAMETERS: ExternalName - Name to convert - * ConvertedName - Where the converted name is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an external (ASL) name to an internal (AML) name - * - ******************************************************************************/ - -ACPI_STATUS -UtInternalizeName ( - char *ExternalName, - char **ConvertedName) -{ - ACPI_NAMESTRING_INFO Info; - ACPI_STATUS Status; - - - if (!ExternalName) - { - return (AE_OK); - } - - /* Get the length of the new internal name */ - - Info.ExternalName = ExternalName; - AcpiNsGetInternalNameLength (&Info); - - /* We need a segment to store the internal name */ - - Info.InternalName = UtGetStringBuffer (Info.Length); - if (!Info.InternalName) - { - return (AE_NO_MEMORY); - } - - /* Build the name */ - - Status = AcpiNsBuildInternalName (&Info); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - *ConvertedName = Info.InternalName; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: UtPadNameWithUnderscores - * - * PARAMETERS: NameSeg - Input nameseg - * PaddedNameSeg - Output padded nameseg - * - * RETURN: Padded nameseg. - * - * DESCRIPTION: Pads a NameSeg with underscores if necessary to form a full - * ACPI_NAME. - * - ******************************************************************************/ - -static void -UtPadNameWithUnderscores ( - char *NameSeg, - char *PaddedNameSeg) -{ - UINT32 i; - - - for (i = 0; (i < ACPI_NAME_SIZE); i++) - { - if (*NameSeg) - { - *PaddedNameSeg = *NameSeg; - NameSeg++; - } - else - { - *PaddedNameSeg = '_'; - } - PaddedNameSeg++; - } -} - - -/******************************************************************************* - * - * FUNCTION: UtAttachNameseg - * - * PARAMETERS: Op - Parent parse node - * Name - Full ExternalName - * - * RETURN: None; Sets the NameSeg field in parent node - * - * DESCRIPTION: Extract the last nameseg of the ExternalName and store it - * in the NameSeg field of the Op. - * - ******************************************************************************/ - -static void -UtAttachNameseg ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - char *NameSeg; - char PaddedNameSeg[4]; - - - if (!Name) - { - return; - } - - /* Look for the last dot in the namepath */ - - NameSeg = strrchr (Name, '.'); - if (NameSeg) - { - /* Found last dot, we have also found the final nameseg */ - - NameSeg++; - UtPadNameWithUnderscores (NameSeg, PaddedNameSeg); - } - else - { - /* No dots in the namepath, there is only a single nameseg. */ - /* Handle prefixes */ - - while ((*Name == '\\') || (*Name == '^')) - { - Name++; - } - - /* Remaing string should be one single nameseg */ - - UtPadNameWithUnderscores (Name, PaddedNameSeg); - } - - strncpy (Op->Asl.NameSeg, PaddedNameSeg, 4); -} - - -/******************************************************************************* - * - * FUNCTION: UtAttachNamepathToOwner - * - * PARAMETERS: Op - Parent parse node - * NameOp - Node that contains the name - * - * RETURN: Sets the ExternalName and Namepath in the parent node - * - * DESCRIPTION: Store the name in two forms in the parent node: The original - * (external) name, and the internalized name that is used within - * the ACPI namespace manager. - * - ******************************************************************************/ - -void -UtAttachNamepathToOwner ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NameOp) -{ - ACPI_STATUS Status; - - - /* Full external path */ - - Op->Asl.ExternalName = NameOp->Asl.Value.String; - - /* Save the NameOp for possible error reporting later */ - - Op->Asl.ParentMethod = (void *) NameOp; - - /* Last nameseg of the path */ - - UtAttachNameseg (Op, Op->Asl.ExternalName); - - /* Create internalized path */ - - Status = UtInternalizeName (NameOp->Asl.Value.String, &Op->Asl.Namepath); - if (ACPI_FAILURE (Status)) - { - /* TBD: abort on no memory */ - } -} - - -/******************************************************************************* - * - * FUNCTION: UtDoConstant - * - * PARAMETERS: String - Hex, Octal, or Decimal string - * - * RETURN: Converted Integer - * - * DESCRIPTION: Convert a string to an integer. With error checking. - * - ******************************************************************************/ - -UINT64 -UtDoConstant ( - char *String) -{ - ACPI_STATUS Status; - UINT64 Converted; - char ErrBuf[64]; - - - Status = UtStrtoul64 (String, 0, &Converted); - if (ACPI_FAILURE (Status)) - { - sprintf (ErrBuf, "%s %s\n", "Conversion error:", - AcpiFormatException (Status)); - AslCompilererror (ErrBuf); - } - - return (Converted); -} - - -/* TBD: use version in ACPI CA main code base? */ - -/******************************************************************************* - * - * FUNCTION: UtStrtoul64 - * - * PARAMETERS: String - Null terminated string - * Terminater - Where a pointer to the terminating byte is - * returned - * Base - Radix of the string - * - * RETURN: Converted value - * - * DESCRIPTION: Convert a string into an unsigned value. - * - ******************************************************************************/ - -static ACPI_STATUS -UtStrtoul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger) -{ - UINT32 Index; - UINT32 Sign; - UINT64 ReturnValue = 0; - ACPI_STATUS Status = AE_OK; - - - *RetInteger = 0; - - switch (Base) - { - case 0: - case 8: - case 10: - case 16: - break; - - default: - /* - * The specified Base parameter is not in the domain of - * this function: - */ - return (AE_BAD_PARAMETER); - } - - /* Skip over any white space in the buffer: */ - - while (isspace ((int) *String) || *String == '\t') - { - ++String; - } - - /* - * The buffer may contain an optional plus or minus sign. - * If it does, then skip over it but remember what is was: - */ - if (*String == '-') - { - Sign = NEGATIVE; - ++String; - } - else if (*String == '+') - { - ++String; - Sign = POSITIVE; - } - else - { - Sign = POSITIVE; - } - - /* - * If the input parameter Base is zero, then we need to - * determine if it is octal, decimal, or hexadecimal: - */ - if (Base == 0) - { - if (*String == '0') - { - if (tolower ((int) *(++String)) == 'x') - { - Base = 16; - ++String; - } - else - { - Base = 8; - } - } - else - { - Base = 10; - } - } - - /* - * For octal and hexadecimal bases, skip over the leading - * 0 or 0x, if they are present. - */ - if (Base == 8 && *String == '0') - { - String++; - } - - if (Base == 16 && - *String == '0' && - tolower ((int) *(++String)) == 'x') - { - String++; - } - - /* Main loop: convert the string to an unsigned long */ - - while (*String) - { - if (isdigit ((int) *String)) - { - Index = ((UINT8) *String) - '0'; - } - else - { - Index = (UINT8) toupper ((int) *String); - if (isupper ((int) Index)) - { - Index = Index - 'A' + 10; - } - else - { - goto ErrorExit; - } - } - - if (Index >= Base) - { - goto ErrorExit; - } - - /* Check to see if value is out of range: */ - - if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) / - (UINT64) Base)) - { - goto ErrorExit; - } - else - { - ReturnValue *= Base; - ReturnValue += Index; - } - - ++String; - } - - - /* If a minus sign was present, then "the conversion is negated": */ - - if (Sign == NEGATIVE) - { - ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; - } - - *RetInteger = ReturnValue; - return (Status); - - -ErrorExit: - switch (Base) - { - case 8: - Status = AE_BAD_OCTAL_CONSTANT; - break; - - case 10: - Status = AE_BAD_DECIMAL_CONSTANT; - break; - - case 16: - Status = AE_BAD_HEX_CONSTANT; - break; - - default: - /* Base validated above */ - break; - } - - return (Status); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/compiler/readme.txt b/src/add-ons/kernel/bus_managers/acpi/compiler/readme.txt deleted file mode 100644 index fceea472e5..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/compiler/readme.txt +++ /dev/null @@ -1,85 +0,0 @@ - -Instructions for integrating iASL compiler into MS VC++ 6.0 environment. - -Part 1. Integration as a custom tool - -This procedure adds the iASL compiler as a custom tool that can be used -to compile ASL source files. The output is sent to the VC output -window. - -a) Select Tools->Customize. - -b) Select the "Tools" tab. - -c) Scroll down to the bottom of the "Menu Contents" window. There you - will see an empty rectangle. Click in the rectangle to enter a - name for this tool. - -d) Type "iASL Compiler" in the box and hit enter. You can now edit - the other fields for this new custom tool. - -e) Enter the following into the fields: - - Command: C:\Acpi\iasl.exe - Arguments: -e "$(FilePath)" - Initial Directory "$(FileDir)" - Use Output Window - - "Command" must be the path to wherever you copied the compiler. - "-e" instructs the compiler to produce messages appropriate for VC. - Quotes around FilePath and FileDir enable spaces in filenames. - -f) Select "Close". - -These steps will add the compiler to the tools menu as a custom tool. -By enabling "Use Output Window", you can click on error messages in -the output window and the source file and source line will be -automatically displayed by VC. Also, you can use F4 to step through -the messages and the corresponding source line(s). - - -Part 2. Integration into a project build - -This procedure creates a project that compiles ASL files to AML. - -a) Create a new, empty project and add your .ASL files to the project - -b) For all ASL files in the project, specify a custom build (under -Project/Settings/CustomBuild with the following settings (or similar): - -Commands: -c:\acpi\libraries\iasl.exe -vs -vi "$(InputPath)" - -Output: -$(InputDir)\$(InputPath).aml - - - -Compiler Generation From Source - -Generation of the ASL compiler from source code requires these items: - - -Required Tools -1) The Flex (or Lex) lexical analyzer generator. -2) The Bison (or Yacc) parser generator. -3) An ANSI C compiler. - - -Required Source Code. - -There are three major source code components that are required to -generate the compiler: - -1) The ASL compiler source. -2) The ACPI CA Core Subsystem source. In particular, the Namespace Manager - component is used to create an internal ACPI namespace and symbol table, - and the AML Interpreter is used to evaluate constant expressions. -3) The Common source for all ACPI components. - - - - - - - diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbcmds.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbcmds.c deleted file mode 100644 index f8c6496a7d..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbcmds.c +++ /dev/null @@ -1,2129 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbcmds - debug commands and output routines - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acevents.h" -#include "acdebug.h" -#include "acresrc.h" -#include "acdisasm.h" -#include "actables.h" -#include "acparser.h" - -#ifdef ACPI_DEBUGGER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbcmds") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDbIntegrityWalk ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiDbWalkAndMatchName ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiDbWalkForReferences ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiDbWalkForSpecificObjects ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_NAMESPACE_NODE * -AcpiDbConvertToNode ( - char *InString); - -static void -AcpiDmCompareAmlResources ( - UINT8 *Aml1Buffer, - ACPI_RSDESC_SIZE Aml1BufferLength, - UINT8 *Aml2Buffer, - ACPI_RSDESC_SIZE Aml2BufferLength); - -static ACPI_STATUS -AcpiDmTestResourceConversion ( - ACPI_NAMESPACE_NODE *Node, - char *Name); - - -/* - * Arguments for the Objects command - * These object types map directly to the ACPI_TYPES - */ -static ARGUMENT_INFO AcpiDbObjectTypes [] = -{ - {"ANY"}, - {"INTEGERS"}, - {"STRINGS"}, - {"BUFFERS"}, - {"PACKAGES"}, - {"FIELDS"}, - {"DEVICES"}, - {"EVENTS"}, - {"METHODS"}, - {"MUTEXES"}, - {"REGIONS"}, - {"POWERRESOURCES"}, - {"PROCESSORS"}, - {"THERMALZONES"}, - {"BUFFERFIELDS"}, - {"DDBHANDLES"}, - {"DEBUG"}, - {"REGIONFIELDS"}, - {"BANKFIELDS"}, - {"INDEXFIELDS"}, - {"REFERENCES"}, - {"ALIAS"}, - {NULL} /* Must be null terminated */ -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiDbConvertToNode - * - * PARAMETERS: InString - String to convert - * - * RETURN: Pointer to a NS node - * - * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or - * alpha strings. - * - ******************************************************************************/ - -static ACPI_NAMESPACE_NODE * -AcpiDbConvertToNode ( - char *InString) -{ - ACPI_NAMESPACE_NODE *Node; - - - if ((*InString >= 0x30) && (*InString <= 0x39)) - { - /* Numeric argument, convert */ - - Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16)); - if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) - { - AcpiOsPrintf ("Address %p is invalid in this address space\n", - Node); - return (NULL); - } - - /* Make sure pointer is valid NS node */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) - { - AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n", - Node, AcpiUtGetDescriptorName (Node)); - return (NULL); - } - } - else - { - /* Alpha argument */ - /* The parameter is a name string that must be resolved to a - * Named obj - */ - Node = AcpiDbLocalNsLookup (InString); - if (!Node) - { - Node = AcpiGbl_RootNode; - } - } - - return (Node); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSleep - * - * PARAMETERS: ObjectArg - Desired sleep state (0-5) - * - * RETURN: Status - * - * DESCRIPTION: Simulate a sleep/wake sequence - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbSleep ( - char *ObjectArg) -{ - ACPI_STATUS Status; - UINT8 SleepState; - - - SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0); - - AcpiOsPrintf ("**** Prepare to sleep ****\n"); - Status = AcpiEnterSleepStatePrep (SleepState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - AcpiOsPrintf ("**** Going to sleep ****\n"); - Status = AcpiEnterSleepState (SleepState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - AcpiOsPrintf ("**** returning from sleep ****\n"); - Status = AcpiLeaveSleepState (SleepState); - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbWalkForReferences - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Check if this namespace object refers to the target object - * that is passed in as the context value. - * - * Note: Currently doesn't check subobjects within the Node's object - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWalkForReferences ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context; - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - - - /* Check for match against the namespace node itself */ - - if (Node == (void *) ObjDesc) - { - AcpiOsPrintf ("Object is a Node [%4.4s]\n", - AcpiUtGetNodeName (Node)); - } - - /* Check for match against the object attached to the node */ - - if (AcpiNsGetAttachedObject (Node) == ObjDesc) - { - AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n", - Node, AcpiUtGetNodeName (Node)); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbFindReferences - * - * PARAMETERS: ObjectArg - String with hex value of the object - * - * RETURN: None - * - * DESCRIPTION: Search namespace for all references to the input object - * - ******************************************************************************/ - -void -AcpiDbFindReferences ( - char *ObjectArg) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - - - /* Convert string to object pointer */ - - ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); - - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbWalkForPredefinedNames - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Detect and display predefined ACPI names (names that start with - * an underscore) - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWalkForPredefinedNames ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - UINT32 *Count = (UINT32 *) Context; - const ACPI_PREDEFINED_INFO *Predefined; - const ACPI_PREDEFINED_INFO *Package = NULL; - char *Pathname; - - - Predefined = AcpiNsCheckForPredefinedName (Node); - if (!Predefined) - { - return (AE_OK); - } - - Pathname = AcpiNsGetExternalPathname (Node); - if (!Pathname) - { - return (AE_OK); - } - - /* If method returns a package, the info is in the next table entry */ - - if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE) - { - Package = Predefined + 1; - } - - AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname, - Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes); - - if (Package) - { - AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X", - Package->RetInfo.Type, Package->RetInfo.ObjectType1, - Package->RetInfo.Count1); - } - - AcpiOsPrintf("\n"); - - AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined); - ACPI_FREE (Pathname); - (*Count)++; - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbCheckPredefinedNames - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Validate all predefined names in the namespace - * - ******************************************************************************/ - -void -AcpiDbCheckPredefinedNames ( - void) -{ - UINT32 Count = 0; - - - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL); - - AcpiOsPrintf ("Found %d predefined names in the namespace\n", Count); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbWalkForExecute - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Batch execution module. Currently only executes predefined - * ACPI names. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWalkForExecute ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_EXECUTE_WALK *Info = (ACPI_EXECUTE_WALK *) Context; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; - char *Pathname; - UINT32 i; - ACPI_DEVICE_INFO *ObjInfo; - ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; - const ACPI_PREDEFINED_INFO *Predefined; - - - Predefined = AcpiNsCheckForPredefinedName (Node); - if (!Predefined) - { - return (AE_OK); - } - - if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) - { - return (AE_OK); - } - - Pathname = AcpiNsGetExternalPathname (Node); - if (!Pathname) - { - return (AE_OK); - } - - /* Get the object info for number of method parameters */ - - Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParamObjects.Pointer = NULL; - ParamObjects.Count = 0; - - if (ObjInfo->Type == ACPI_TYPE_METHOD) - { - /* Setup default parameters */ - - for (i = 0; i < ObjInfo->ParamCount; i++) - { - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = 1; - } - - ParamObjects.Pointer = Params; - ParamObjects.Count = ObjInfo->ParamCount; - } - - ACPI_FREE (ObjInfo); - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - - /* Do the actual method execution */ - - AcpiGbl_MethodExecuting = TRUE; - - Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj); - - AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status)); - AcpiGbl_MethodExecuting = FALSE; - ACPI_FREE (Pathname); - - /* Ignore status from method execution */ - - Status = AE_OK; - - /* Update count, check if we have executed enough methods */ - - Info->Count++; - if (Info->Count >= Info->MaxCount) - { - Status = AE_CTRL_TERMINATE; - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbBatchExecute - * - * PARAMETERS: CountArg - Max number of methods to execute - * - * RETURN: None - * - * DESCRIPTION: Namespace batch execution. Execute predefined names in the - * namespace, up to the max count, if specified. - * - ******************************************************************************/ - -void -AcpiDbBatchExecute ( - char *CountArg) -{ - ACPI_EXECUTE_WALK Info; - - - Info.Count = 0; - Info.MaxCount = ACPI_UINT32_MAX; - - if (CountArg) - { - Info.MaxCount = ACPI_STRTOUL (CountArg, NULL, 0); - } - - - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForExecute, NULL, (void *) &Info, NULL); - - AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Info.Count); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayLocks - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display information about internal mutexes. - * - ******************************************************************************/ - -void -AcpiDbDisplayLocks ( - void) -{ - UINT32 i; - - - for (i = 0; i < ACPI_MAX_MUTEX; i++) - { - AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i), - AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED - ? "Locked" : "Unlocked"); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayTableInfo - * - * PARAMETERS: TableArg - String with name of table to be displayed - * - * RETURN: None - * - * DESCRIPTION: Display information about loaded tables. Current - * implementation displays all loaded tables. - * - ******************************************************************************/ - -void -AcpiDbDisplayTableInfo ( - char *TableArg) -{ - UINT32 i; - ACPI_TABLE_DESC *TableDesc; - ACPI_STATUS Status; - - - /* Walk the entire root table list */ - - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) - { - TableDesc = &AcpiGbl_RootTableList.Tables[i]; - AcpiOsPrintf ("%d ", i); - - /* Make sure that the table is mapped */ - - Status = AcpiTbVerifyTable (TableDesc); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Dump the table header */ - - if (TableDesc->Pointer) - { - AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer); - } - else - { - /* If the pointer is null, the table has been unloaded */ - - ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded", - TableDesc->Signature.Ascii)); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbUnloadAcpiTable - * - * PARAMETERS: TableArg - Name of the table to be unloaded - * InstanceArg - Which instance of the table to unload (if - * there are multiple tables of the same type) - * - * RETURN: Nonde - * - * DESCRIPTION: Unload an ACPI table. - * Instance is not implemented - * - ******************************************************************************/ - -void -AcpiDbUnloadAcpiTable ( - char *TableArg, - char *InstanceArg) -{ -/* TBD: Need to reimplement for new data structures */ - -#if 0 - UINT32 i; - ACPI_STATUS Status; - - - /* Search all tables for the target type */ - - for (i = 0; i < (ACPI_TABLE_ID_MAX+1); i++) - { - if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature, - AcpiGbl_TableData[i].SigLength)) - { - /* Found the table, unload it */ - - Status = AcpiUnloadTable (i); - if (ACPI_SUCCESS (Status)) - { - AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg); - } - else - { - AcpiOsPrintf ("%s, while unloading [%s]\n", - AcpiFormatException (Status), TableArg); - } - - return; - } - } - - AcpiOsPrintf ("Unknown table type [%s]\n", TableArg); -#endif -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSetMethodBreakpoint - * - * PARAMETERS: Location - AML offset of breakpoint - * WalkState - Current walk info - * Op - Current Op (from parse walk) - * - * RETURN: None - * - * DESCRIPTION: Set a breakpoint in a control method at the specified - * AML offset - * - ******************************************************************************/ - -void -AcpiDbSetMethodBreakpoint ( - char *Location, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - UINT32 Address; - - - if (!Op) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - /* Get and verify the breakpoint address */ - - Address = ACPI_STRTOUL (Location, NULL, 16); - if (Address <= Op->Common.AmlOffset) - { - AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", - Address, Op->Common.AmlOffset); - } - - /* Save breakpoint in current walk */ - - WalkState->UserBreakpoint = Address; - AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSetMethodCallBreakpoint - * - * PARAMETERS: Op - Current Op (from parse walk) - * - * RETURN: None - * - * DESCRIPTION: Set a breakpoint in a control method at the specified - * AML offset - * - ******************************************************************************/ - -void -AcpiDbSetMethodCallBreakpoint ( - ACPI_PARSE_OBJECT *Op) -{ - - - if (!Op) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - AcpiGbl_StepToNextCall = TRUE; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisassembleAml - * - * PARAMETERS: Statements - Number of statements to disassemble - * Op - Current Op (from parse walk) - * - * RETURN: None - * - * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number - * of statements specified. - * - ******************************************************************************/ - -void -AcpiDbDisassembleAml ( - char *Statements, - ACPI_PARSE_OBJECT *Op) -{ - UINT32 NumStatements = 8; - - - if (!Op) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - if (Statements) - { - NumStatements = ACPI_STRTOUL (Statements, NULL, 0); - } - - AcpiDmDisassemble (NULL, Op, NumStatements); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisassembleMethod - * - * PARAMETERS: Name - Name of control method - * - * RETURN: None - * - * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number - * of statements specified. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbDisassembleMethod ( - char *Name) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Op; - ACPI_WALK_STATE *WalkState; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Method; - - - Method = AcpiDbConvertToNode (Name); - if (!Method) - { - return (AE_BAD_PARAMETER); - } - - ObjDesc = Method->Object; - - Op = AcpiPsCreateScopeOp (); - if (!Op) - { - return (AE_NO_MEMORY); - } - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL); - if (!WalkState) - { - return (AE_NO_MEMORY); - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, - ObjDesc->Method.AmlStart, - ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Parse the AML */ - - WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; - WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; - Status = AcpiPsParseAml (WalkState); - - AcpiDmDisassemble (NULL, Op, 0); - AcpiPsDeleteParseTree (Op); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDumpNamespace - * - * PARAMETERS: StartArg - Node to begin namespace dump - * DepthArg - Maximum tree depth to be dumped - * - * RETURN: None - * - * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed - * with type and other information. - * - ******************************************************************************/ - -void -AcpiDbDumpNamespace ( - char *StartArg, - char *DepthArg) -{ - ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode; - UINT32 MaxDepth = ACPI_UINT32_MAX; - - - /* No argument given, just start at the root and dump entire namespace */ - - if (StartArg) - { - SubtreeEntry = AcpiDbConvertToNode (StartArg); - if (!SubtreeEntry) - { - return; - } - - /* Now we can check for the depth argument */ - - if (DepthArg) - { - MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0); - } - } - - AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n", - ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry); - - /* Display the subtree */ - - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, - ACPI_OWNER_ID_MAX, SubtreeEntry); - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDumpNamespaceByOwner - * - * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed - * DepthArg - Maximum tree depth to be dumped - * - * RETURN: None - * - * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId. - * - ******************************************************************************/ - -void -AcpiDbDumpNamespaceByOwner ( - char *OwnerArg, - char *DepthArg) -{ - ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode; - UINT32 MaxDepth = ACPI_UINT32_MAX; - ACPI_OWNER_ID OwnerId; - - - OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0); - - /* Now we can check for the depth argument */ - - if (DepthArg) - { - MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0); - } - - AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId); - - /* Display the subtree */ - - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId, - SubtreeEntry); - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSendNotify - * - * PARAMETERS: Name - Name of ACPI object to send the notify to - * Value - Value of the notify to send. - * - * RETURN: None - * - * DESCRIPTION: Send an ACPI notification. The value specified is sent to the - * named object as an ACPI notify. - * - ******************************************************************************/ - -void -AcpiDbSendNotify ( - char *Name, - UINT32 Value) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Translate name to an Named object */ - - Node = AcpiDbConvertToNode (Name); - if (!Node) - { - return; - } - - /* Decode Named object type */ - - switch (Node->Type) - { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_THERMAL: - - /* Send the notify */ - - Status = AcpiEvQueueNotifyRequest (Node, Value); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not queue notify\n"); - } - break; - - default: - AcpiOsPrintf ("Named object is not a device or a thermal object\n"); - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSetMethodData - * - * PARAMETERS: TypeArg - L for local, A for argument - * IndexArg - which one - * ValueArg - Value to set. - * - * RETURN: None - * - * DESCRIPTION: Set a local or argument for the running control method. - * NOTE: only object supported is Number. - * - ******************************************************************************/ - -void -AcpiDbSetMethodData ( - char *TypeArg, - char *IndexArg, - char *ValueArg) -{ - char Type; - UINT32 Index; - UINT32 Value; - ACPI_WALK_STATE *WalkState; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - /* Validate TypeArg */ - - AcpiUtStrupr (TypeArg); - Type = TypeArg[0]; - if ((Type != 'L') && - (Type != 'A') && - (Type != 'N')) - { - AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg); - return; - } - - Value = ACPI_STRTOUL (ValueArg, NULL, 16); - - if (Type == 'N') - { - Node = AcpiDbConvertToNode (IndexArg); - if (Node->Type != ACPI_TYPE_INTEGER) - { - AcpiOsPrintf ("Can only set Integer nodes\n"); - return; - } - ObjDesc = Node->Object; - ObjDesc->Integer.Value = Value; - return; - } - - /* Get the index and value */ - - Index = ACPI_STRTOUL (IndexArg, NULL, 16); - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - /* Create and initialize the new object */ - - ObjDesc = AcpiUtCreateIntegerObject ((UINT64) Value); - if (!ObjDesc) - { - AcpiOsPrintf ("Could not create an internal object\n"); - return; - } - - /* Store the new object into the target */ - - switch (Type) - { - case 'A': - - /* Set a method argument */ - - if (Index > ACPI_METHOD_MAX_ARG) - { - AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index); - goto Cleanup; - } - - Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc, - WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - ObjDesc = WalkState->Arguments[Index].Object; - - AcpiOsPrintf ("Arg%d: ", Index); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); - break; - - case 'L': - - /* Set a method local */ - - if (Index > ACPI_METHOD_MAX_LOCAL) - { - AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index); - goto Cleanup; - } - - Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc, - WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - ObjDesc = WalkState->LocalVariables[Index].Object; - - AcpiOsPrintf ("Local%d: ", Index); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); - break; - - default: - break; - } - -Cleanup: - AcpiUtRemoveReference (ObjDesc); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbWalkForSpecificObjects - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Display short info about objects in the namespace - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWalkForSpecificObjects ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; - ACPI_BUFFER Buffer; - ACPI_STATUS Status; - - - Info->Count++; - - /* Get and display the full pathname to this object */ - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); - return (AE_OK); - } - - AcpiOsPrintf ("%32s", (char *) Buffer.Pointer); - ACPI_FREE (Buffer.Pointer); - - /* Dump short info about the object */ - - (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayObjects - * - * PARAMETERS: ObjTypeArg - Type of object to display - * DisplayCountArg - Max depth to display - * - * RETURN: None - * - * DESCRIPTION: Display objects in the namespace of the requested type - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbDisplayObjects ( - char *ObjTypeArg, - char *DisplayCountArg) -{ - ACPI_WALK_INFO Info; - ACPI_OBJECT_TYPE Type; - - - /* Get the object type */ - - Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes); - if (Type == ACPI_TYPE_NOT_FOUND) - { - AcpiOsPrintf ("Invalid or unsupported argument\n"); - return (AE_OK); - } - - AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ( - "Objects of type [%s] defined in the current ACPI Namespace:\n", - AcpiUtGetTypeName (Type)); - - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - - Info.Count = 0; - Info.OwnerId = ACPI_OWNER_ID_MAX; - Info.DebugLevel = ACPI_UINT32_MAX; - Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT; - - /* Walk the namespace from the root */ - - (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL); - - AcpiOsPrintf ( - "\nFound %u objects of type [%s] in the current ACPI Namespace\n", - Info.Count, AcpiUtGetTypeName (Type)); - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbWalkAndMatchName - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Find a particular name/names within the namespace. Wildcards - * are supported -- '?' matches any character. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWalkAndMatchName ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_STATUS Status; - char *RequestedName = (char *) Context; - UINT32 i; - ACPI_BUFFER Buffer; - ACPI_WALK_INFO Info; - - - /* Check for a name match */ - - for (i = 0; i < 4; i++) - { - /* Wildcard support */ - - if ((RequestedName[i] != '?') && - (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i])) - { - /* No match, just exit */ - - return (AE_OK); - } - } - - /* Get the full pathname to this object */ - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); - } - else - { - Info.OwnerId = ACPI_OWNER_ID_MAX; - Info.DebugLevel = ACPI_UINT32_MAX; - Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT; - - AcpiOsPrintf ("%32s", (char *) Buffer.Pointer); - (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL); - ACPI_FREE (Buffer.Pointer); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbFindNameInNamespace - * - * PARAMETERS: NameArg - The 4-character ACPI name to find. - * wildcards are supported. - * - * RETURN: None - * - * DESCRIPTION: Search the namespace for a given name (with wildcards) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbFindNameInNamespace ( - char *NameArg) -{ - char AcpiName[5] = "____"; - char *AcpiNamePtr = AcpiName; - - - if (ACPI_STRLEN (NameArg) > 4) - { - AcpiOsPrintf ("Name must be no longer than 4 characters\n"); - return (AE_OK); - } - - /* Pad out name with underscores as necessary to create a 4-char name */ - - AcpiUtStrupr (NameArg); - while (*NameArg) - { - *AcpiNamePtr = *NameArg; - AcpiNamePtr++; - NameArg++; - } - - /* Walk the namespace from the root */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkAndMatchName, NULL, AcpiName, NULL); - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSetScope - * - * PARAMETERS: Name - New scope path - * - * RETURN: Status - * - * DESCRIPTION: Set the "current scope" as maintained by this utility. - * The scope is used as a prefix to ACPI paths. - * - ******************************************************************************/ - -void -AcpiDbSetScope ( - char *Name) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - if (!Name || Name[0] == 0) - { - AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf); - return; - } - - AcpiDbPrepNamestring (Name); - - if (Name[0] == '\\') - { - /* Validate new scope from the root */ - - Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH, - &Node); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name); - ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\"); - } - else - { - /* Validate new scope relative to old scope */ - - Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH, - &Node); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name); - ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\"); - } - - AcpiGbl_DbScopeNode = Node; - AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf); - return; - -ErrorExit: - - AcpiOsPrintf ("Could not attach scope: %s, %s\n", - Name, AcpiFormatException (Status)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmCompareAmlResources - * - * PARAMETERS: Aml1Buffer - Contains first resource list - * Aml1BufferLength - Length of first resource list - * Aml2Buffer - Contains second resource list - * Aml2BufferLength - Length of second resource list - * - * RETURN: None - * - * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in - * order to isolate a miscompare to an individual resource) - * - ******************************************************************************/ - -static void -AcpiDmCompareAmlResources ( - UINT8 *Aml1Buffer, - ACPI_RSDESC_SIZE Aml1BufferLength, - UINT8 *Aml2Buffer, - ACPI_RSDESC_SIZE Aml2BufferLength) -{ - UINT8 *Aml1; - UINT8 *Aml2; - ACPI_RSDESC_SIZE Aml1Length; - ACPI_RSDESC_SIZE Aml2Length; - ACPI_RSDESC_SIZE Offset = 0; - UINT8 ResourceType; - UINT32 Count = 0; - - - /* Compare overall buffer sizes (may be different due to size rounding) */ - - if (Aml1BufferLength != Aml2BufferLength) - { - AcpiOsPrintf ( - "**** Buffer length mismatch in converted AML: original %X new %X ****\n", - Aml1BufferLength, Aml2BufferLength); - } - - Aml1 = Aml1Buffer; - Aml2 = Aml2Buffer; - - /* Walk the descriptor lists, comparing each descriptor */ - - while (Aml1 < (Aml1Buffer + Aml1BufferLength)) - { - /* Get the lengths of each descriptor */ - - Aml1Length = AcpiUtGetDescriptorLength (Aml1); - Aml2Length = AcpiUtGetDescriptorLength (Aml2); - ResourceType = AcpiUtGetResourceType (Aml1); - - /* Check for descriptor length match */ - - if (Aml1Length != Aml2Length) - { - AcpiOsPrintf ( - "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X L1 %X L2 %X ****\n", - Count, ResourceType, Offset, Aml1Length, Aml2Length); - } - - /* Check for descriptor byte match */ - - else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length)) - { - AcpiOsPrintf ( - "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n", - Count, ResourceType, Offset); - } - - /* Exit on EndTag descriptor */ - - if (ResourceType == ACPI_RESOURCE_NAME_END_TAG) - { - return; - } - - /* Point to next descriptor in each buffer */ - - Count++; - Offset += Aml1Length; - Aml1 += Aml1Length; - Aml2 += Aml2Length; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmTestResourceConversion - * - * PARAMETERS: Node - Parent device node - * Name - resource method name (_CRS) - * - * RETURN: Status - * - * DESCRIPTION: Compare the original AML with a conversion of the AML to - * internal resource list, then back to AML. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDmTestResourceConversion ( - ACPI_NAMESPACE_NODE *Node, - char *Name) -{ - ACPI_STATUS Status; - ACPI_BUFFER ReturnObj; - ACPI_BUFFER ResourceObj; - ACPI_BUFFER NewAml; - ACPI_OBJECT *OriginalAml; - - - AcpiOsPrintf ("Resource Conversion Comparison:\n"); - - NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - ReturnObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - ResourceObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - - /* Get the original _CRS AML resource template */ - - Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not obtain %s: %s\n", - Name, AcpiFormatException (Status)); - return (Status); - } - - /* Get the AML resource template, converted to internal resource structs */ - - Status = AcpiGetCurrentResources (Node, &ResourceObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", - AcpiFormatException (Status)); - goto Exit1; - } - - /* Convert internal resource list to external AML resource template */ - - Status = AcpiRsCreateAmlResources (ResourceObj.Pointer, &NewAml); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n", - AcpiFormatException (Status)); - goto Exit2; - } - - /* Compare original AML to the newly created AML resource list */ - - OriginalAml = ReturnObj.Pointer; - - AcpiDmCompareAmlResources ( - OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length, - NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length); - - /* Cleanup and exit */ - - ACPI_FREE (NewAml.Pointer); -Exit2: - ACPI_FREE (ResourceObj.Pointer); -Exit1: - ACPI_FREE (ReturnObj.Pointer); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayResources - * - * PARAMETERS: ObjectArg - String with hex value of the object - * - * RETURN: None - * - * DESCRIPTION: Display the resource objects associated with a device. - * - ******************************************************************************/ - -void -AcpiDbDisplayResources ( - char *ObjectArg) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_BUFFER ReturnObj; - - - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiDbgLevel |= ACPI_LV_RESOURCES; - - /* Convert string to object pointer */ - - Node = AcpiDbConvertToNode (ObjectArg); - if (!Node) - { - return; - } - - /* Prepare for a return object of arbitrary size */ - - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - - /* _PRT */ - - AcpiOsPrintf ("Evaluating _PRT\n"); - - /* Check if _PRT exists */ - - Status = AcpiEvaluateObject (Node, METHOD_NAME__PRT, NULL, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not obtain _PRT: %s\n", - AcpiFormatException (Status)); - goto GetCrs; - } - - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - - Status = AcpiGetIrqRoutingTable (Node, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", - AcpiFormatException (Status)); - goto GetCrs; - } - - AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer)); - - - /* _CRS */ - -GetCrs: - AcpiOsPrintf ("Evaluating _CRS\n"); - - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - - /* Check if _CRS exists */ - - Status = AcpiEvaluateObject (Node, METHOD_NAME__CRS, NULL, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not obtain _CRS: %s\n", - AcpiFormatException (Status)); - goto GetPrs; - } - - /* Get the _CRS resource list */ - - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - - Status = AcpiGetCurrentResources (Node, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", - AcpiFormatException (Status)); - goto GetPrs; - } - - /* Dump the _CRS resource list */ - - AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, - ReturnObj.Pointer)); - - /* - * Perform comparison of original AML to newly created AML. This tests both - * the AML->Resource conversion and the Resource->Aml conversion. - */ - Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS); - - /* Execute _SRS with the resource list */ - - Status = AcpiSetCurrentResources (Node, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", - AcpiFormatException (Status)); - goto GetPrs; - } - - - /* _PRS */ - -GetPrs: - AcpiOsPrintf ("Evaluating _PRS\n"); - - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - - /* Check if _PRS exists */ - - Status = AcpiEvaluateObject (Node, METHOD_NAME__PRS, NULL, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not obtain _PRS: %s\n", - AcpiFormatException (Status)); - goto Cleanup; - } - - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - - Status = AcpiGetPossibleResources (Node, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", - AcpiFormatException (Status)); - goto Cleanup; - } - - AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); - -Cleanup: - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbIntegrityWalk - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Examine one NS node for valid values. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbIntegrityWalk ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - 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++; - - /* Verify the NS node, and dereference aliases */ - - while (Alias) - { - 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); - if (Object) - { - Info->Objects++; - if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) - { - AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n", - Object, AcpiUtGetDescriptorName (Object)); - } - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbCheckIntegrity - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Check entire namespace for data structure integrity - * - ******************************************************************************/ - -void -AcpiDbCheckIntegrity ( - void) -{ - ACPI_INTEGRITY_INFO Info = {0,0}; - - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL); - - AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n", - Info.Nodes, Info.Objects); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGenerateGpe - * - * PARAMETERS: GpeArg - Raw GPE number, ascii string - * BlockArg - GPE block number, ascii string - * 0 or 1 for FADT GPE blocks - * - * RETURN: None - * - * DESCRIPTION: Generate a GPE - * - ******************************************************************************/ - -void -AcpiDbGenerateGpe ( - char *GpeArg, - char *BlockArg) -{ - UINT32 BlockNumber; - UINT32 GpeNumber; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - - - GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0); - BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0); - - - GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber), - GpeNumber); - if (!GpeEventInfo) - { - AcpiOsPrintf ("Invalid GPE\n"); - return; - } - - (void) AcpiEvGpeDispatch (GpeEventInfo, GpeNumber); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbBusWalk - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Display info about device objects that have a corresponding - * _PRT method. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbBusWalk ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_STATUS Status; - ACPI_BUFFER Buffer; - ACPI_NAMESPACE_NODE *TempNode; - ACPI_DEVICE_INFO *Info; - UINT32 i; - - - if ((Node->Type != ACPI_TYPE_DEVICE) && - (Node->Type != ACPI_TYPE_PROCESSOR)) - { - return (AE_OK); - } - - /* Exit if there is no _PRT under this device */ - - Status = AcpiGetHandle (Node, METHOD_NAME__PRT, - ACPI_CAST_PTR (ACPI_HANDLE, &TempNode)); - if (ACPI_FAILURE (Status)) - { - return (AE_OK); - } - - /* Get the full path to this device object */ - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); - return (AE_OK); - } - - Status = AcpiGetObjectInfo (ObjHandle, &Info); - if (ACPI_FAILURE (Status)) - { - return (AE_OK); - } - - /* Display the full path */ - - AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type); - ACPI_FREE (Buffer.Pointer); - - if (Info->Flags & ACPI_PCI_ROOT_BRIDGE) - { - AcpiOsPrintf (" - Is PCI Root Bridge"); - } - AcpiOsPrintf ("\n"); - - /* _PRT info */ - - AcpiOsPrintf ("_PRT: %p\n", TempNode); - - /* Dump _ADR, _HID, _UID, _CID */ - - if (Info->Valid & ACPI_VALID_ADR) - { - AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address)); - } - else - { - AcpiOsPrintf ("_ADR: \n"); - } - - if (Info->Valid & ACPI_VALID_HID) - { - AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String); - } - else - { - AcpiOsPrintf ("_HID: \n"); - } - - if (Info->Valid & ACPI_VALID_UID) - { - AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String); - } - else - { - AcpiOsPrintf ("_UID: \n"); - } - - if (Info->Valid & ACPI_VALID_CID) - { - for (i = 0; i < Info->CompatibleIdList.Count; i++) - { - AcpiOsPrintf ("_CID: %s\n", - Info->CompatibleIdList.Ids[i].String); - } - } - else - { - AcpiOsPrintf ("_CID: \n"); - } - - ACPI_FREE (Info); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetBusInfo - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display info about system busses. - * - ******************************************************************************/ - -void -AcpiDbGetBusInfo ( - void) -{ - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbBusWalk, NULL, NULL, NULL); -} - -#endif /* ACPI_DEBUGGER */ diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbdisply.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbdisply.c deleted file mode 100644 index a610d802c8..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbdisply.c +++ /dev/null @@ -1,960 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbdisply - debug display commands - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acparser.h" -#include "acinterp.h" -#include "acdebug.h" -#include "acdisasm.h" - - -#ifdef ACPI_DEBUGGER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbdisply") - -/* Local prototypes */ - -static void -AcpiDbDumpParserDescriptor ( - ACPI_PARSE_OBJECT *Op); - -static void * -AcpiDbGetPointer ( - void *Target); - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetPointer - * - * PARAMETERS: Target - Pointer to string to be converted - * - * RETURN: Converted pointer - * - * DESCRIPTION: Convert an ascii pointer value to a real value - * - ******************************************************************************/ - -static void * -AcpiDbGetPointer ( - void *Target) -{ - void *ObjPtr; - - - ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16)); - return (ObjPtr); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDumpParserDescriptor - * - * PARAMETERS: Op - A parser Op descriptor - * - * RETURN: None - * - * DESCRIPTION: Display a formatted parser object - * - ******************************************************************************/ - -static void -AcpiDbDumpParserDescriptor ( - ACPI_PARSE_OBJECT *Op) -{ - const ACPI_OPCODE_INFO *Info; - - - Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - AcpiOsPrintf ("Parser Op Descriptor:\n"); - AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode); - - ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", - Info->Name)); - - AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg); - AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent); - AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDecodeAndDisplayObject - * - * PARAMETERS: Target - String with object to be displayed. Names - * and hex pointers are supported. - * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) - * - * RETURN: None - * - * DESCRIPTION: Display a formatted ACPI object - * - ******************************************************************************/ - -void -AcpiDbDecodeAndDisplayObject ( - char *Target, - char *OutputType) -{ - void *ObjPtr; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 Display = DB_BYTE_DISPLAY; - char Buffer[80]; - ACPI_BUFFER RetBuf; - ACPI_STATUS Status; - UINT32 Size; - - - if (!Target) - { - return; - } - - /* Decode the output type */ - - if (OutputType) - { - AcpiUtStrupr (OutputType); - if (OutputType[0] == 'W') - { - Display = DB_WORD_DISPLAY; - } - else if (OutputType[0] == 'D') - { - Display = DB_DWORD_DISPLAY; - } - else if (OutputType[0] == 'Q') - { - Display = DB_QWORD_DISPLAY; - } - } - - RetBuf.Length = sizeof (Buffer); - RetBuf.Pointer = Buffer; - - /* Differentiate between a number and a name */ - - if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) - { - ObjPtr = AcpiDbGetPointer (Target); - if (!AcpiOsReadable (ObjPtr, 16)) - { - AcpiOsPrintf ("Address %p is invalid in this address space\n", - ObjPtr); - return; - } - - /* Decode the object type */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)) - { - case ACPI_DESC_TYPE_NAMED: - - /* This is a namespace Node */ - - if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) - { - AcpiOsPrintf ( - "Cannot read entire Named object at address %p\n", ObjPtr); - return; - } - - Node = ObjPtr; - goto DumpNode; - - - case ACPI_DESC_TYPE_OPERAND: - - /* This is a ACPI OPERAND OBJECT */ - - if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) - { - AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", - ObjPtr); - return; - } - - AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, - ACPI_UINT32_MAX); - AcpiExDumpObjectDescriptor (ObjPtr, 1); - break; - - - case ACPI_DESC_TYPE_PARSER: - - /* This is a Parser Op object */ - - if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) - { - AcpiOsPrintf ( - "Cannot read entire Parser object at address %p\n", ObjPtr); - return; - } - - AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, - ACPI_UINT32_MAX); - AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); - break; - - - default: - - /* Is not a recognizeable object */ - - Size = 16; - if (AcpiOsReadable (ObjPtr, 64)) - { - Size = 64; - } - - /* Just dump some memory */ - - AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); - break; - } - - return; - } - - /* The parameter is a name string that must be resolved to a Named obj */ - - Node = AcpiDbLocalNsLookup (Target); - if (!Node) - { - return; - } - - -DumpNode: - /* Now dump the NS node */ - - Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not convert name to pathname\n"); - } - - else - { - AcpiOsPrintf ("Object (%p) Pathname: %s\n", - Node, (char *) RetBuf.Pointer); - } - - if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) - { - AcpiOsPrintf ("Invalid Named object at address %p\n", Node); - return; - } - - AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), - Display, ACPI_UINT32_MAX); - AcpiExDumpNamespaceNode (Node, 1); - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc) - { - AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); - if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) - { - AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", - ObjDesc); - return; - } - - AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), - Display, ACPI_UINT32_MAX); - AcpiExDumpObjectDescriptor (ObjDesc, 1); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayMethodInfo - * - * PARAMETERS: StartOp - Root of the control method parse tree - * - * RETURN: None - * - * DESCRIPTION: Display information about the current method - * - ******************************************************************************/ - -void -AcpiDbDisplayMethodInfo ( - ACPI_PARSE_OBJECT *StartOp) -{ - ACPI_WALK_STATE *WalkState; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *RootOp; - ACPI_PARSE_OBJECT *Op; - const ACPI_OPCODE_INFO *OpInfo; - UINT32 NumOps = 0; - UINT32 NumOperands = 0; - UINT32 NumOperators = 0; - UINT32 NumRemainingOps = 0; - UINT32 NumRemainingOperands = 0; - UINT32 NumRemainingOperators = 0; - BOOLEAN CountRemaining = FALSE; - - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; - - AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", - AcpiUtGetNodeName (Node)); - AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n", - (UINT32) ObjDesc->Method.ParamCount, - (UINT32) ObjDesc->Method.SyncLevel); - - - RootOp = StartOp; - while (RootOp->Common.Parent) - { - RootOp = RootOp->Common.Parent; - } - - Op = RootOp; - - while (Op) - { - if (Op == StartOp) - { - CountRemaining = TRUE; - } - - NumOps++; - if (CountRemaining) - { - NumRemainingOps++; - } - - /* Decode the opcode */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - switch (OpInfo->Class) - { - case AML_CLASS_ARGUMENT: - if (CountRemaining) - { - NumRemainingOperands++; - } - - NumOperands++; - break; - - case AML_CLASS_UNKNOWN: - /* Bad opcode or ASCII character */ - - continue; - - default: - if (CountRemaining) - { - NumRemainingOperators++; - } - - NumOperators++; - break; - } - - Op = AcpiPsGetDepthNext (StartOp, Op); - } - - AcpiOsPrintf ( - "Method contains: %X AML Opcodes - %X Operators, %X Operands\n", - NumOps, NumOperators, NumOperands); - - AcpiOsPrintf ( - "Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", - NumRemainingOps, NumRemainingOperators, NumRemainingOperands); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayLocals - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display all locals for the currently running control method - * - ******************************************************************************/ - -void -AcpiDbDisplayLocals ( - void) -{ - ACPI_WALK_STATE *WalkState; - - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - AcpiDmDisplayLocals (WalkState); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayArguments - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display all arguments for the currently running control method - * - ******************************************************************************/ - -void -AcpiDbDisplayArguments ( - void) -{ - ACPI_WALK_STATE *WalkState; - - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - AcpiDmDisplayArguments (WalkState); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayResults - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display current contents of a method result stack - * - ******************************************************************************/ - -void -AcpiDbDisplayResults ( - void) -{ - UINT32 i; - ACPI_WALK_STATE *WalkState; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 ResultCount = 0; - ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE *Frame; - UINT32 Index; /* Index onto current frame */ - - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; - - if (WalkState->Results) - { - ResultCount = WalkState->ResultCount; - } - - AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", - AcpiUtGetNodeName (Node), ResultCount); - - /* 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 = 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--; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayCallingTree - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display current calling tree of nested control methods - * - ******************************************************************************/ - -void -AcpiDbDisplayCallingTree ( - void) -{ - ACPI_WALK_STATE *WalkState; - ACPI_NAMESPACE_NODE *Node; - - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - Node = WalkState->MethodNode; - AcpiOsPrintf ("Current Control Method Call Tree\n"); - - while (WalkState) - { - Node = WalkState->MethodNode; - - AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node)); - - WalkState = WalkState->Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayObjectType - * - * PARAMETERS: ObjectArg - User entered NS node handle - * - * RETURN: None - * - * DESCRIPTION: Display type of an arbitrary NS node - * - ******************************************************************************/ - -void -AcpiDbDisplayObjectType ( - char *ObjectArg) -{ - ACPI_HANDLE Handle; - ACPI_DEVICE_INFO *Info; - ACPI_STATUS Status; - UINT32 i; - - - Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); - - Status = AcpiGetObjectInfo (Handle, &Info); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get object info, %s\n", - AcpiFormatException (Status)); - return; - } - - AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", - ACPI_FORMAT_UINT64 (Info->Address), - Info->CurrentStatus, Info->Flags); - - AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", - Info->HighestDstates[0], Info->HighestDstates[1], - Info->HighestDstates[2], Info->HighestDstates[3]); - - AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", - Info->LowestDstates[0], Info->LowestDstates[1], - Info->LowestDstates[2], Info->LowestDstates[3], - Info->LowestDstates[4]); - - if (Info->Valid & ACPI_VALID_HID) - { - AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String); - } - if (Info->Valid & ACPI_VALID_UID) - { - AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String); - } - if (Info->Valid & ACPI_VALID_CID) - { - for (i = 0; i < Info->CompatibleIdList.Count; i++) - { - AcpiOsPrintf ("CID %d: %s\n", i, - Info->CompatibleIdList.Ids[i].String); - } - } - - ACPI_FREE (Info); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayResultObject - * - * PARAMETERS: ObjDesc - Object to be displayed - * WalkState - Current walk state - * - * RETURN: None - * - * DESCRIPTION: Display the result of an AML opcode - * - * Note: Curently only displays the result object if we are single stepping. - * However, this output may be useful in other contexts and could be enabled - * to do so if needed. - * - ******************************************************************************/ - -void -AcpiDbDisplayResultObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - - /* Only display if single stepping */ - - if (!AcpiGbl_CmSingleStep) - { - return; - } - - AcpiOsPrintf ("ResultObj: "); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); - AcpiOsPrintf ("\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayArgumentObject - * - * PARAMETERS: ObjDesc - Object to be displayed - * WalkState - Current walk state - * - * RETURN: None - * - * DESCRIPTION: Display the result of an AML opcode - * - ******************************************************************************/ - -void -AcpiDbDisplayArgumentObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - - if (!AcpiGbl_CmSingleStep) - { - return; - } - - AcpiOsPrintf ("ArgObj: "); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayGpes - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display the current GPE structures - * - ******************************************************************************/ - -void -AcpiDbDisplayGpes ( - void) -{ - ACPI_GPE_BLOCK_INFO *GpeBlock; - ACPI_GPE_XRUPT_INFO *GpeXruptInfo; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - char *GpeType; - UINT32 GpeIndex; - UINT32 Block = 0; - UINT32 i; - UINT32 j; - char Buffer[80]; - ACPI_BUFFER RetBuf; - ACPI_STATUS Status; - - - RetBuf.Length = sizeof (Buffer); - RetBuf.Pointer = Buffer; - - Block = 0; - - /* Walk the GPE lists */ - - GpeXruptInfo = AcpiGbl_GpeXruptListHead; - while (GpeXruptInfo) - { - GpeBlock = GpeXruptInfo->GpeBlockListHead; - while (GpeBlock) - { - Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not convert name to pathname\n"); - } - - if (GpeBlock->Node == AcpiGbl_FadtGpeDevice) - { - GpeType = "FADT-defined GPE block"; - } - else - { - GpeType = "GPE Block Device"; - } - - AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s] - %s\n", - Block, GpeBlock, GpeBlock->Node, Buffer, GpeType); - - AcpiOsPrintf (" Registers: %u (%u GPEs)\n", - GpeBlock->RegisterCount, GpeBlock->GpeCount); - - AcpiOsPrintf (" GPE range: 0x%X to 0x%X on interrupt %u\n", - GpeBlock->BlockBaseNumber, - GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1), - GpeXruptInfo->InterruptNumber); - - AcpiOsPrintf ( - " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", - GpeBlock->RegisterInfo, - ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address), - ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address)); - - AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); - - /* Examine each GPE Register within the block */ - - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; - - AcpiOsPrintf ( - " Reg %u: (GPE %.2X-%.2X) RunEnable %2.2X WakeEnable %2.2X" - " Status %8.8X%8.8X Enable %8.8X%8.8X\n", - i, GpeRegisterInfo->BaseGpeNumber, - GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), - GpeRegisterInfo->EnableForRun, - GpeRegisterInfo->EnableForWake, - ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address), - ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address)); - - /* Now look at the individual GPEs in this byte register */ - - for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) - { - GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; - GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; - - if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)) - { - /* This GPE is not used (no method or handler), ignore it */ - - continue; - } - - AcpiOsPrintf ( - " GPE %.2X: %p RunRefs %2.2X WakeRefs %2.2X Flags %2.2X (", - GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo, - GpeEventInfo->RuntimeCount, GpeEventInfo->WakeupCount, - GpeEventInfo->Flags); - - /* Decode the flags byte */ - - if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED) - { - AcpiOsPrintf ("Level, "); - } - else - { - AcpiOsPrintf ("Edge, "); - } - - if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) - { - AcpiOsPrintf ("CanWake, "); - } - else - { - AcpiOsPrintf ("RunOnly, "); - } - - switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) - { - case ACPI_GPE_DISPATCH_NOT_USED: - AcpiOsPrintf ("NotUsed"); - break; - case ACPI_GPE_DISPATCH_HANDLER: - AcpiOsPrintf ("Handler"); - break; - case ACPI_GPE_DISPATCH_METHOD: - AcpiOsPrintf ("Method"); - break; - default: - AcpiOsPrintf ("UNKNOWN: %X", - GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK); - break; - } - - AcpiOsPrintf (")\n"); - } - } - Block++; - GpeBlock = GpeBlock->Next; - } - GpeXruptInfo = GpeXruptInfo->Next; - } -} - -#endif /* ACPI_DEBUGGER */ - diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbexec.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbexec.c deleted file mode 100644 index da21a12589..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbexec.c +++ /dev/null @@ -1,793 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbexec - debugger control method execution - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acdebug.h" -#include "acnamesp.h" - -#ifdef ACPI_DEBUGGER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbexec") - - -static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo; - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDbExecuteMethod ( - ACPI_DB_METHOD_INFO *Info, - ACPI_BUFFER *ReturnObj); - -static void -AcpiDbExecuteSetup ( - ACPI_DB_METHOD_INFO *Info); - -static UINT32 -AcpiDbGetOutstandingAllocations ( - void); - -static void ACPI_SYSTEM_XFACE -AcpiDbMethodThread ( - void *Context); - -static ACPI_STATUS -AcpiDbExecutionWalk ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecuteMethod - * - * PARAMETERS: Info - Valid info segment - * ReturnObj - Where to put return object - * - * RETURN: Status - * - * DESCRIPTION: Execute a control method. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbExecuteMethod ( - ACPI_DB_METHOD_INFO *Info, - ACPI_BUFFER *ReturnObj) -{ - ACPI_STATUS Status; - ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; - ACPI_HANDLE Handle; - UINT32 i; - ACPI_DEVICE_INFO *ObjInfo; - - - if (AcpiGbl_DbOutputToFile && !AcpiDbgLevel) - { - AcpiOsPrintf ("Warning: debug output is not enabled!\n"); - } - - /* Get the NS node, determines existence also */ - - Status = AcpiGetHandle (NULL, Info->Pathname, &Handle); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Get the object info for number of method parameters */ - - Status = AcpiGetObjectInfo (Handle, &ObjInfo); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParamObjects.Pointer = NULL; - ParamObjects.Count = 0; - - if (ObjInfo->Type == ACPI_TYPE_METHOD) - { - /* Are there arguments to the method? */ - - if (Info->Args && Info->Args[0]) - { - for (i = 0; Info->Args[i] && i < ACPI_METHOD_NUM_ARGS; i++) - { - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16); - } - - ParamObjects.Pointer = Params; - ParamObjects.Count = i; - } - else - { - /* Setup default parameters */ - - for (i = 0; i < ObjInfo->ParamCount; i++) - { - switch (i) - { - case 0: - - Params[0].Type = ACPI_TYPE_INTEGER; - Params[0].Integer.Value = 0x01020304; - break; - - case 1: - - Params[1].Type = ACPI_TYPE_STRING; - Params[1].String.Length = 12; - Params[1].String.Pointer = "AML Debugger"; - break; - - default: - - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = i * (UINT64) 0x1000; - break; - } - } - - ParamObjects.Pointer = Params; - ParamObjects.Count = ObjInfo->ParamCount; - } - } - - ACPI_FREE (ObjInfo); - - /* Prepare for a return object of arbitrary size */ - - ReturnObj->Pointer = AcpiGbl_DbBuffer; - ReturnObj->Length = ACPI_DEBUG_BUFFER_SIZE; - - /* Do the actual method execution */ - - AcpiGbl_MethodExecuting = TRUE; - Status = AcpiEvaluateObject (NULL, - Info->Pathname, &ParamObjects, ReturnObj); - - AcpiGbl_CmSingleStep = FALSE; - AcpiGbl_MethodExecuting = FALSE; - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecuteSetup - * - * PARAMETERS: Info - Valid method info - * - * RETURN: None - * - * DESCRIPTION: Setup info segment prior to method execution - * - ******************************************************************************/ - -static void -AcpiDbExecuteSetup ( - ACPI_DB_METHOD_INFO *Info) -{ - - /* Catenate the current scope to the supplied name */ - - Info->Pathname[0] = 0; - if ((Info->Name[0] != '\\') && - (Info->Name[0] != '/')) - { - ACPI_STRCAT (Info->Pathname, AcpiGbl_DbScopeBuf); - } - - ACPI_STRCAT (Info->Pathname, Info->Name); - AcpiDbPrepNamestring (Info->Pathname); - - AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("Executing %s\n", Info->Pathname); - - if (Info->Flags & EX_SINGLE_STEP) - { - AcpiGbl_CmSingleStep = TRUE; - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - } - - else - { - /* No single step, allow redirection to a file */ - - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - } -} - - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS -UINT32 -AcpiDbGetCacheInfo ( - ACPI_MEMORY_LIST *Cache) -{ - - return (Cache->TotalAllocated - Cache->TotalFreed - Cache->CurrentDepth); -} -#endif - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetOutstandingAllocations - * - * PARAMETERS: None - * - * RETURN: Current global allocation count minus cache entries - * - * DESCRIPTION: Determine the current number of "outstanding" allocations -- - * those allocations that have not been freed and also are not - * in one of the various object caches. - * - ******************************************************************************/ - -static UINT32 -AcpiDbGetOutstandingAllocations ( - void) -{ - UINT32 Outstanding = 0; - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - - Outstanding += AcpiDbGetCacheInfo (AcpiGbl_StateCache); - Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeCache); - Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeExtCache); - Outstanding += AcpiDbGetCacheInfo (AcpiGbl_OperandCache); -#endif - - return (Outstanding); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecutionWalk - * - * PARAMETERS: WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Execute a control method. Name is relative to the current - * scope. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbExecutionWalk ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; - - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc->Method.ParamCount) - { - return (AE_OK); - } - - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - - AcpiNsPrintNodePathname (Node, "Execute"); - - /* Do the actual method execution */ - - AcpiOsPrintf ("\n"); - AcpiGbl_MethodExecuting = TRUE; - - Status = AcpiEvaluateObject (Node, NULL, NULL, &ReturnObj); - - AcpiOsPrintf ("[%4.4s] returned %s\n", AcpiUtGetNodeName (Node), - AcpiFormatException (Status)); - AcpiGbl_MethodExecuting = FALSE; - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecute - * - * PARAMETERS: Name - Name of method to execute - * Args - Parameters to the method - * Flags - single step/no single step - * - * RETURN: None - * - * DESCRIPTION: Execute a control method. Name is relative to the current - * scope. - * - ******************************************************************************/ - -void -AcpiDbExecute ( - char *Name, - char **Args, - UINT32 Flags) -{ - ACPI_STATUS Status; - ACPI_BUFFER ReturnObj; - char *NameString; - - -#ifdef ACPI_DEBUG_OUTPUT - UINT32 PreviousAllocations; - UINT32 Allocations; - - - /* Memory allocation tracking */ - - PreviousAllocations = AcpiDbGetOutstandingAllocations (); -#endif - - if (*Name == '*') - { - (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL); - return; - } - else - { - NameString = ACPI_ALLOCATE (ACPI_STRLEN (Name) + 1); - if (!NameString) - { - return; - } - - ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); - - ACPI_STRCPY (NameString, Name); - AcpiUtStrupr (NameString); - AcpiGbl_DbMethodInfo.Name = NameString; - AcpiGbl_DbMethodInfo.Args = Args; - AcpiGbl_DbMethodInfo.Flags = Flags; - - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - - AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); - Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj); - ACPI_FREE (NameString); - } - - /* - * Allow any handlers in separate threads to complete. - * (Such as Notify handlers invoked from AML executed above). - */ - AcpiOsSleep ((UINT64) 10); - - -#ifdef ACPI_DEBUG_OUTPUT - - /* Memory allocation tracking */ - - Allocations = AcpiDbGetOutstandingAllocations () - PreviousAllocations; - - AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - - if (Allocations > 0) - { - AcpiOsPrintf ("Outstanding: 0x%X allocations after execution\n", - Allocations); - } -#endif - - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Execution of %s failed with status %s\n", - AcpiGbl_DbMethodInfo.Pathname, AcpiFormatException (Status)); - } - else - { - /* Display a return object, if any */ - - if (ReturnObj.Length) - { - AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n", - AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, - (UINT32) ReturnObj.Length); - AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); - } - else - { - AcpiOsPrintf ("No return object from execution of %s\n", - AcpiGbl_DbMethodInfo.Pathname); - } - } - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbMethodThread - * - * PARAMETERS: Context - Execution info segment - * - * RETURN: None - * - * DESCRIPTION: Debugger execute thread. Waits for a command line, then - * simply dispatches it. - * - ******************************************************************************/ - -static void ACPI_SYSTEM_XFACE -AcpiDbMethodThread ( - void *Context) -{ - ACPI_STATUS Status; - ACPI_DB_METHOD_INFO *Info = Context; - ACPI_DB_METHOD_INFO LocalInfo; - UINT32 i; - UINT8 Allow; - ACPI_BUFFER ReturnObj; - - - /* - * AcpiGbl_DbMethodInfo.Arguments will be passed as method arguments. - * Prevent AcpiGbl_DbMethodInfo from being modified by multiple threads - * concurrently. - * - * Note: The arguments we are passing are used by the ASL test suite - * (aslts). Do not change them without updating the tests. - */ - (void) AcpiOsWaitSemaphore (Info->InfoGate, 1, ACPI_WAIT_FOREVER); - - if (Info->InitArgs) - { - AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr); - AcpiDbUInt32ToHexString (ACPI_TO_INTEGER (AcpiOsGetThreadId ()), - Info->IdOfThreadStr); - } - - if (Info->Threads && (Info->NumCreated < Info->NumThreads)) - { - Info->Threads[Info->NumCreated++] = - ACPI_TO_INTEGER (AcpiOsGetThreadId()); - } - - LocalInfo = *Info; - LocalInfo.Args = LocalInfo.Arguments; - LocalInfo.Arguments[0] = LocalInfo.NumThreadsStr; - LocalInfo.Arguments[1] = LocalInfo.IdOfThreadStr; - LocalInfo.Arguments[2] = LocalInfo.IndexOfThreadStr; - LocalInfo.Arguments[3] = NULL; - - (void) AcpiOsSignalSemaphore (Info->InfoGate, 1); - - for (i = 0; i < Info->NumLoops; i++) - { - Status = AcpiDbExecuteMethod (&LocalInfo, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s During execution of %s at iteration %X\n", - AcpiFormatException (Status), Info->Pathname, i); - if (Status == AE_ABORT_METHOD) - { - break; - } - } - -#if 0 - if ((i % 100) == 0) - { - AcpiOsPrintf ("%d executions, Thread 0x%x\n", i, AcpiOsGetThreadId ()); - } - - if (ReturnObj.Length) - { - AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n", - Info->Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); - AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); - } -#endif - } - - /* Signal our completion */ - - Allow = 0; - (void) AcpiOsWaitSemaphore (Info->ThreadCompleteGate, 1, ACPI_WAIT_FOREVER); - Info->NumCompleted++; - - if (Info->NumCompleted == Info->NumThreads) - { - /* 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)); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbCreateExecutionThreads - * - * PARAMETERS: NumThreadsArg - Number of threads to create - * NumLoopsArg - Loop count for the thread(s) - * MethodNameArg - Control method to execute - * - * RETURN: None - * - * DESCRIPTION: Create threads to execute method(s) - * - ******************************************************************************/ - -void -AcpiDbCreateExecutionThreads ( - char *NumThreadsArg, - char *NumLoopsArg, - char *MethodNameArg) -{ - ACPI_STATUS Status; - UINT32 NumThreads; - UINT32 NumLoops; - UINT32 i; - UINT32 Size; - ACPI_MUTEX MainThreadGate; - ACPI_MUTEX ThreadCompleteGate; - ACPI_MUTEX InfoGate; - - - /* Get the arguments */ - - NumThreads = ACPI_STRTOUL (NumThreadsArg, NULL, 0); - NumLoops = ACPI_STRTOUL (NumLoopsArg, NULL, 0); - - if (!NumThreads || !NumLoops) - { - AcpiOsPrintf ("Bad argument: Threads %X, Loops %X\n", - NumThreads, NumLoops); - return; - } - - /* - * 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 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; - } - - Status = AcpiOsCreateSemaphore (1, 1, &InfoGate); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not create semaphore for synchronization of AcpiGbl_DbMethodInfo, %s\n", - AcpiFormatException (Status)); - (void) AcpiOsDeleteSemaphore (ThreadCompleteGate); - (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); - (void) AcpiOsDeleteSemaphore (InfoGate); - return; - } - ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size); - - /* Setup the context to be passed to each thread */ - - AcpiGbl_DbMethodInfo.Name = MethodNameArg; - AcpiGbl_DbMethodInfo.Flags = 0; - AcpiGbl_DbMethodInfo.NumLoops = NumLoops; - AcpiGbl_DbMethodInfo.MainThreadGate = MainThreadGate; - AcpiGbl_DbMethodInfo.ThreadCompleteGate = ThreadCompleteGate; - AcpiGbl_DbMethodInfo.InfoGate = InfoGate; - - /* 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); - - /* Create the threads */ - - AcpiOsPrintf ("Creating %X threads to execute %X times each\n", - NumThreads, NumLoops); - - for (i = 0; i < (NumThreads); i++) - { - Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, AcpiDbMethodThread, - &AcpiGbl_DbMethodInfo); - if (ACPI_FAILURE (Status)) - { - break; - } - } - - /* Wait for all threads to complete */ - - (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); - (void) AcpiOsDeleteSemaphore (InfoGate); - - 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 deleted file mode 100644 index c6f2e253ac..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbfileio.c +++ /dev/null @@ -1,649 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbfileio - Debugger file I/O commands. These can't usually - * be used when running the debugger in Ring 0 (Kernel mode) - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acdebug.h" - -#ifdef ACPI_APPLICATION -#include "actables.h" -#endif - -#if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER) - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbfileio") - -/* - * NOTE: this is here for lack of a better place. It is used in all - * flavors of the debugger, need LCD file - */ -#ifdef ACPI_APPLICATION -#include -FILE *AcpiGbl_DebugFile = NULL; -#endif - - -#ifdef ACPI_DEBUGGER - -/* Local prototypes */ - -#ifdef ACPI_APPLICATION - -static ACPI_STATUS -AcpiDbCheckTextModeCorruption ( - UINT8 *Table, - UINT32 TableLength, - UINT32 FileLength); - -#endif - -/******************************************************************************* - * - * FUNCTION: AcpiDbCloseDebugFile - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: If open, close the current debug output file - * - ******************************************************************************/ - -void -AcpiDbCloseDebugFile ( - void) -{ - -#ifdef ACPI_APPLICATION - - if (AcpiGbl_DebugFile) - { - fclose (AcpiGbl_DebugFile); - AcpiGbl_DebugFile = NULL; - AcpiGbl_DbOutputToFile = FALSE; - AcpiOsPrintf ("Debug output file %s closed\n", AcpiGbl_DbDebugFilename); - } -#endif -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbOpenDebugFile - * - * PARAMETERS: Name - Filename to open - * - * RETURN: None - * - * DESCRIPTION: Open a file where debug output will be directed. - * - ******************************************************************************/ - -void -AcpiDbOpenDebugFile ( - char *Name) -{ - -#ifdef ACPI_APPLICATION - - AcpiDbCloseDebugFile (); - AcpiGbl_DebugFile = fopen (Name, "w+"); - if (AcpiGbl_DebugFile) - { - AcpiOsPrintf ("Debug output file %s opened\n", Name); - ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name); - AcpiGbl_DbOutputToFile = TRUE; - } - else - { - AcpiOsPrintf ("Could not open debug file %s\n", Name); - } - -#endif -} -#endif - - -#ifdef ACPI_APPLICATION -/******************************************************************************* - * - * FUNCTION: AcpiDbCheckTextModeCorruption - * - * PARAMETERS: Table - Table buffer - * TableLength - Length of table from the table header - * FileLength - Length of the file that contains the table - * - * RETURN: Status - * - * DESCRIPTION: Check table for text mode file corruption where all linefeed - * characters (LF) have been replaced by carriage return linefeed - * pairs (CR/LF). - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbCheckTextModeCorruption ( - UINT8 *Table, - UINT32 TableLength, - UINT32 FileLength) -{ - UINT32 i; - UINT32 Pairs = 0; - - - if (TableLength != FileLength) - { - ACPI_WARNING ((AE_INFO, - "File length (0x%X) is not the same as the table length (0x%X)", - FileLength, TableLength)); - } - - /* Scan entire table to determine if each LF has been prefixed with a CR */ - - for (i = 1; i < FileLength; i++) - { - if (Table[i] == 0x0A) - { - if (Table[i - 1] != 0x0D) - { - /* The LF does not have a preceding CR, table not corrupted */ - - return (AE_OK); - } - else - { - /* Found a CR/LF pair */ - - Pairs++; - } - i++; - } - } - - if (!Pairs) - { - return (AE_OK); - } - - /* - * Entire table scanned, each CR is part of a CR/LF pair -- - * meaning that the table was treated as a text file somewhere. - * - * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the - * original table are left untouched by the text conversion process -- - * meaning that we cannot simply replace CR/LF pairs with LFs. - */ - AcpiOsPrintf ("Table has been corrupted by text mode conversion\n"); - AcpiOsPrintf ("All LFs (%d) were changed to CR/LF pairs\n", Pairs); - AcpiOsPrintf ("Table cannot be repaired!\n"); - return (AE_BAD_VALUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbReadTable - * - * PARAMETERS: fp - File that contains table - * Table - Return value, buffer with table - * TableLength - Return value, length of table - * - * RETURN: Status - * - * DESCRIPTION: Load the DSDT from the file pointer - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbReadTable ( - FILE *fp, - ACPI_TABLE_HEADER **Table, - UINT32 *TableLength) -{ - ACPI_TABLE_HEADER TableHeader; - UINT32 Actual; - ACPI_STATUS Status; - UINT32 FileSize; - BOOLEAN StandardHeader = TRUE; - - - /* Get the file size */ - - fseek (fp, 0, SEEK_END); - FileSize = (UINT32) ftell (fp); - fseek (fp, 0, SEEK_SET); - - if (FileSize < 4) - { - return (AE_BAD_HEADER); - } - - /* Read the signature */ - - if (fread (&TableHeader, 1, 4, fp) != 4) - { - AcpiOsPrintf ("Could not read the table signature\n"); - return (AE_BAD_HEADER); - } - - fseek (fp, 0, SEEK_SET); - - /* The RSDT and FACS tables do not have standard ACPI headers */ - - if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") || - ACPI_COMPARE_NAME (TableHeader.Signature, "FACS")) - { - *TableLength = FileSize; - StandardHeader = FALSE; - } - else - { - /* Read the table header */ - - if (fread (&TableHeader, 1, sizeof (TableHeader), fp) != - sizeof (ACPI_TABLE_HEADER)) - { - AcpiOsPrintf ("Could not read the table header\n"); - return (AE_BAD_HEADER); - } - -#if 0 - /* Validate the table header/length */ - - Status = AcpiTbValidateTableHeader (&TableHeader); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Table header is invalid!\n"); - return (Status); - } -#endif - - /* File size must be at least as long as the Header-specified length */ - - if (TableHeader.Length > FileSize) - { - AcpiOsPrintf ( - "TableHeader length [0x%X] greater than the input file size [0x%X]\n", - TableHeader.Length, FileSize); - return (AE_BAD_HEADER); - } - -#ifdef ACPI_OBSOLETE_CODE - /* We only support a limited number of table types */ - - if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) && - ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) && - ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4)) - { - AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n", - (char *) TableHeader.Signature); - ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER)); - return (AE_ERROR); - } -#endif - - *TableLength = TableHeader.Length; - } - - /* Allocate a buffer for the table */ - - *Table = AcpiOsAllocate ((size_t) FileSize); - if (!*Table) - { - AcpiOsPrintf ( - "Could not allocate memory for ACPI table %4.4s (size=0x%X)\n", - TableHeader.Signature, *TableLength); - return (AE_NO_MEMORY); - } - - /* Get the rest of the table */ - - fseek (fp, 0, SEEK_SET); - Actual = fread (*Table, 1, (size_t) FileSize, fp); - if (Actual == FileSize) - { - if (StandardHeader) - { - /* Now validate the checksum */ - - Status = AcpiTbVerifyChecksum ((void *) *Table, - ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length); - - if (Status == AE_BAD_CHECKSUM) - { - Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table, - FileSize, (*Table)->Length); - return (Status); - } - } - return (AE_OK); - } - - if (Actual > 0) - { - AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n", - FileSize, Actual); - return (AE_OK); - } - - AcpiOsPrintf ("Error - could not read the table file\n"); - AcpiOsFree (*Table); - *Table = NULL; - *TableLength = 0; - - return (AE_ERROR); -} - - -/******************************************************************************* - * - * FUNCTION: AeLocalLoadTable - * - * PARAMETERS: Table - pointer to a buffer containing the entire - * table to be loaded - * - * RETURN: Status - * - * DESCRIPTION: This function is called to load a table from the caller's - * buffer. The buffer must contain an entire ACPI Table including - * a valid header. The header fields will be verified, and if it - * is determined that the table is invalid, the call will fail. - * - ******************************************************************************/ - -static ACPI_STATUS -AeLocalLoadTable ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status = AE_OK; -/* ACPI_TABLE_DESC TableInfo; */ - - - ACPI_FUNCTION_TRACE (AeLocalLoadTable); -#if 0 - - - if (!Table) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - TableInfo.Pointer = Table; - Status = AcpiTbRecognizeTable (&TableInfo, ACPI_TABLE_ALL); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Install the new table into the local data structures */ - - Status = AcpiTbInstallTable (&TableInfo); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_ALREADY_EXISTS) - { - /* Table already exists, no error */ - - Status = AE_OK; - } - - /* Free table allocated by AcpiTbGetTable */ - - AcpiTbDeleteSingleTable (&TableInfo); - return_ACPI_STATUS (Status); - } - -#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) - - Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode); - if (ACPI_FAILURE (Status)) - { - /* Uninstall table and free the buffer */ - - AcpiTbDeleteTablesByType (ACPI_TABLE_ID_DSDT); - return_ACPI_STATUS (Status); - } -#endif -#endif - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbReadTableFromFile - * - * PARAMETERS: Filename - File where table is located - * Table - Where a pointer to the table is returned - * - * RETURN: Status - * - * DESCRIPTION: Get an ACPI table from a file - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbReadTableFromFile ( - char *Filename, - ACPI_TABLE_HEADER **Table) -{ - FILE *fp; - UINT32 TableLength; - ACPI_STATUS Status; - - - /* Open the file */ - - fp = fopen (Filename, "rb"); - if (!fp) - { - AcpiOsPrintf ("Could not open input file %s\n", Filename); - return (AE_ERROR); - } - - /* Get the entire file */ - - fprintf (stderr, "Loading Acpi table from file %s\n", Filename); - Status = AcpiDbReadTable (fp, Table, &TableLength); - fclose(fp); - - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get table from the file\n"); - return (Status); - } - - return (AE_OK); - } -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetTableFromFile - * - * PARAMETERS: Filename - File where table is located - * ReturnTable - Where a pointer to the table is returned - * - * RETURN: Status - * - * DESCRIPTION: Load an ACPI table from a file - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbGetTableFromFile ( - char *Filename, - ACPI_TABLE_HEADER **ReturnTable) -{ -#ifdef ACPI_APPLICATION - ACPI_STATUS Status; - ACPI_TABLE_HEADER *Table; - BOOLEAN IsAmlTable = TRUE; - - - Status = AcpiDbReadTableFromFile (Filename, &Table); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - -#ifdef ACPI_DATA_TABLE_DISASSEMBLY - IsAmlTable = AcpiUtIsAmlTable (Table); -#endif - - if (IsAmlTable) - { - /* Attempt to recognize and install the table */ - - Status = AeLocalLoadTable (Table); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_ALREADY_EXISTS) - { - AcpiOsPrintf ("Table %4.4s is already installed\n", - Table->Signature); - } - else - { - AcpiOsPrintf ("Could not install table, %s\n", - AcpiFormatException (Status)); - } - - return (Status); - } - - fprintf (stderr, - "Acpi table [%4.4s] successfully installed and loaded\n", - Table->Signature); - } - - AcpiGbl_AcpiHardwarePresent = FALSE; - if (ReturnTable) - { - *ReturnTable = Table; - } - - -#endif /* ACPI_APPLICATION */ - return (AE_OK); -} - -#endif /* ACPI_DEBUGGER */ - diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbhistry.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbhistry.c deleted file mode 100644 index 613711e0fd..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbhistry.c +++ /dev/null @@ -1,292 +0,0 @@ -/****************************************************************************** - * - * Module Name: dbhistry - debugger HISTORY command - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acdebug.h" - -#ifdef ACPI_DEBUGGER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbhistry") - - -#define HI_NO_HISTORY 0 -#define HI_RECORD_HISTORY 1 -#define HISTORY_SIZE 20 - - -typedef struct HistoryInfo -{ - char Command[80]; - UINT32 CmdNum; - -} HISTORY_INFO; - - -static HISTORY_INFO AcpiGbl_HistoryBuffer[HISTORY_SIZE]; -static UINT16 AcpiGbl_LoHistory = 0; -static UINT16 AcpiGbl_NumHistory = 0; -static UINT16 AcpiGbl_NextHistoryIndex = 0; -static UINT32 AcpiGbl_NextCmdNum = 1; - - -/******************************************************************************* - * - * FUNCTION: AcpiDbAddToHistory - * - * PARAMETERS: CommandLine - Command to add - * - * RETURN: None - * - * DESCRIPTION: Add a command line to the history buffer. - * - ******************************************************************************/ - -void -AcpiDbAddToHistory ( - char *CommandLine) -{ - - /* Put command into the next available slot */ - - ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, - CommandLine); - - AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum = AcpiGbl_NextCmdNum; - - /* Adjust indexes */ - - if ((AcpiGbl_NumHistory == HISTORY_SIZE) && - (AcpiGbl_NextHistoryIndex == AcpiGbl_LoHistory)) - { - AcpiGbl_LoHistory++; - if (AcpiGbl_LoHistory >= HISTORY_SIZE) - { - AcpiGbl_LoHistory = 0; - } - } - - AcpiGbl_NextHistoryIndex++; - if (AcpiGbl_NextHistoryIndex >= HISTORY_SIZE) - { - AcpiGbl_NextHistoryIndex = 0; - } - - AcpiGbl_NextCmdNum++; - if (AcpiGbl_NumHistory < HISTORY_SIZE) - { - AcpiGbl_NumHistory++; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayHistory - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display the contents of the history buffer - * - ******************************************************************************/ - -void -AcpiDbDisplayHistory ( - void) -{ - UINT32 i; - UINT16 HistoryIndex; - - - HistoryIndex = AcpiGbl_LoHistory; - - /* Dump entire history buffer */ - - for (i = 0; i < AcpiGbl_NumHistory; i++) - { - AcpiOsPrintf ("%ld %s\n", AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum, - AcpiGbl_HistoryBuffer[HistoryIndex].Command); - - HistoryIndex++; - if (HistoryIndex >= HISTORY_SIZE) - { - HistoryIndex = 0; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetFromHistory - * - * PARAMETERS: CommandNumArg - String containing the number of the - * command to be retrieved - * - * RETURN: Pointer to the retrieved command. Null on error. - * - * DESCRIPTION: Get a command from the history buffer - * - ******************************************************************************/ - -char * -AcpiDbGetFromHistory ( - char *CommandNumArg) -{ - UINT32 i; - UINT16 HistoryIndex; - UINT32 CmdNum; - - - if (CommandNumArg == NULL) - { - CmdNum = AcpiGbl_NextCmdNum - 1; - } - - else - { - CmdNum = ACPI_STRTOUL (CommandNumArg, NULL, 0); - } - - /* Search history buffer */ - - HistoryIndex = AcpiGbl_LoHistory; - for (i = 0; i < AcpiGbl_NumHistory; i++) - { - if (AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum == CmdNum) - { - /* Found the commnad, return it */ - - return (AcpiGbl_HistoryBuffer[HistoryIndex].Command); - } - - - HistoryIndex++; - if (HistoryIndex >= HISTORY_SIZE) - { - HistoryIndex = 0; - } - } - - AcpiOsPrintf ("Invalid history number: %d\n", HistoryIndex); - return (NULL); -} - -#endif /* ACPI_DEBUGGER */ - diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbinput.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbinput.c deleted file mode 100644 index 29b51b6d75..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbinput.c +++ /dev/null @@ -1,1085 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbinput - user front-end to the AML debugger - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acdebug.h" - - -#ifdef ACPI_DEBUGGER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbinput") - -/* Local prototypes */ - -static char * -AcpiDbGetNextToken ( - char *String, - char **Next); - -static UINT32 -AcpiDbGetLine ( - char *InputBuffer); - -static UINT32 -AcpiDbMatchCommand ( - char *UserCommand); - -static void -AcpiDbSingleThread ( - void); - -static void -AcpiDbDisplayHelp ( - char *HelpType); - - -/* - * Top-level debugger commands. - * - * This list of commands must match the string table below it - */ -enum AcpiExDebuggerCommands -{ - CMD_NOT_FOUND = 0, - CMD_NULL, - CMD_ALLOCATIONS, - CMD_ARGS, - CMD_ARGUMENTS, - CMD_BATCH, - CMD_BREAKPOINT, - CMD_BUSINFO, - CMD_CALL, - CMD_CLOSE, - CMD_DEBUG, - CMD_DISASSEMBLE, - CMD_DUMP, - CMD_ENABLEACPI, - CMD_EVENT, - CMD_EXECUTE, - CMD_EXIT, - CMD_FIND, - CMD_GO, - CMD_GPE, - CMD_GPES, - CMD_HELP, - CMD_HELP2, - CMD_HISTORY, - CMD_HISTORY_EXE, - CMD_HISTORY_LAST, - CMD_INFORMATION, - CMD_INTEGRITY, - CMD_INTO, - CMD_LEVEL, - CMD_LIST, - CMD_LOAD, - CMD_LOCALS, - CMD_LOCKS, - CMD_METHODS, - CMD_NAMESPACE, - CMD_NOTIFY, - CMD_OBJECT, - CMD_OPEN, - CMD_OWNER, - CMD_PREDEFINED, - CMD_PREFIX, - CMD_QUIT, - CMD_REFERENCES, - CMD_RESOURCES, - CMD_RESULTS, - CMD_SET, - CMD_SLEEP, - CMD_STATS, - CMD_STOP, - CMD_TABLES, - CMD_TERMINATE, - CMD_THREADS, - CMD_TRACE, - CMD_TREE, - CMD_TYPE, - CMD_UNLOAD -}; - -#define CMD_FIRST_VALID 2 - - -/* Second parameter is the required argument count */ - -static const COMMAND_INFO AcpiGbl_DbCommands[] = -{ - {"", 0}, - {"", 0}, - {"ALLOCATIONS", 0}, - {"ARGS", 0}, - {"ARGUMENTS", 0}, - {"BATCH", 0}, - {"BREAKPOINT", 1}, - {"BUSINFO", 0}, - {"CALL", 0}, - {"CLOSE", 0}, - {"DEBUG", 1}, - {"DISASSEMBLE", 1}, - {"DUMP", 1}, - {"ENABLEACPI", 0}, - {"EVENT", 1}, - {"EXECUTE", 1}, - {"EXIT", 0}, - {"FIND", 1}, - {"GO", 0}, - {"GPE", 2}, - {"GPES", 0}, - {"HELP", 0}, - {"?", 0}, - {"HISTORY", 0}, - {"!", 1}, - {"!!", 0}, - {"INFORMATION", 0}, - {"INTEGRITY", 0}, - {"INTO", 0}, - {"LEVEL", 0}, - {"LIST", 0}, - {"LOAD", 1}, - {"LOCALS", 0}, - {"LOCKS", 0}, - {"METHODS", 0}, - {"NAMESPACE", 0}, - {"NOTIFY", 2}, - {"OBJECT", 1}, - {"OPEN", 1}, - {"OWNER", 1}, - {"PREDEFINED", 0}, - {"PREFIX", 0}, - {"QUIT", 0}, - {"REFERENCES", 1}, - {"RESOURCES", 1}, - {"RESULTS", 0}, - {"SET", 3}, - {"SLEEP", 1}, - {"STATS", 0}, - {"STOP", 0}, - {"TABLES", 0}, - {"TERMINATE", 0}, - {"THREADS", 3}, - {"TRACE", 1}, - {"TREE", 0}, - {"TYPE", 1}, - {"UNLOAD", 1}, - {NULL, 0} -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayHelp - * - * PARAMETERS: HelpType - Subcommand (optional) - * - * RETURN: None - * - * DESCRIPTION: Print a usage message. - * - ******************************************************************************/ - -static void -AcpiDbDisplayHelp ( - char *HelpType) -{ - - AcpiUtStrupr (HelpType); - - /* No parameter, just give the overview */ - - if (!HelpType) - { - AcpiOsPrintf ("ACPI CA Debugger Commands\n\n"); - AcpiOsPrintf ("The following classes of commands are available. Help is available for\n"); - AcpiOsPrintf ("each class by entering \"Help \"\n\n"); - AcpiOsPrintf (" [GENERAL] General-Purpose Commands\n"); - AcpiOsPrintf (" [NAMESPACE] Namespace Access Commands\n"); - AcpiOsPrintf (" [METHOD] Control Method Execution Commands\n"); - AcpiOsPrintf (" [STATISTICS] Statistical Information\n"); - AcpiOsPrintf (" [FILE] File I/O Commands\n"); - return; - } - - /* - * Parameter is the command class - * - * The idea here is to keep each class of commands smaller than a screenful - */ - switch (HelpType[0]) - { - case 'G': - AcpiOsPrintf ("\nGeneral-Purpose Commands\n\n"); - AcpiOsPrintf ("Allocations Display list of current memory allocations\n"); - AcpiOsPrintf ("Dump
|\n"); - AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n"); - AcpiOsPrintf ("EnableAcpi Enable ACPI (hardware) mode\n"); - AcpiOsPrintf ("Help This help screen\n"); - AcpiOsPrintf ("History Display command history buffer\n"); - AcpiOsPrintf ("Level [] [console] Get/Set debug level for file or console\n"); - AcpiOsPrintf ("Locks Current status of internal mutexes\n"); - AcpiOsPrintf ("Quit or Exit Exit this command\n"); - AcpiOsPrintf ("Stats [Allocations|Memory|Misc\n"); - AcpiOsPrintf (" |Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n"); - AcpiOsPrintf ("Tables Display info about loaded ACPI tables\n"); - AcpiOsPrintf ("Unload [Instance] Unload an ACPI table\n"); - AcpiOsPrintf ("! Execute command from history buffer\n"); - AcpiOsPrintf ("!! Execute last command again\n"); - return; - - case 'S': - AcpiOsPrintf ("\nStats Subcommands\n\n"); - AcpiOsPrintf ("Allocations Display list of current memory allocations\n"); - AcpiOsPrintf ("Memory Dump internal memory lists\n"); - AcpiOsPrintf ("Misc Namespace search and mutex stats\n"); - AcpiOsPrintf ("Objects Summary of namespace objects\n"); - AcpiOsPrintf ("Sizes Sizes for each of the internal objects\n"); - AcpiOsPrintf ("Stack Display CPU stack usage\n"); - AcpiOsPrintf ("Tables Info about current ACPI table(s)\n"); - return; - - case 'N': - AcpiOsPrintf ("\nNamespace Access Commands\n\n"); - AcpiOsPrintf ("Businfo Display system bus info\n"); - AcpiOsPrintf ("Disassemble Disassemble a control method\n"); - AcpiOsPrintf ("Event Generate AcpiEvent (Fixed/GPE)\n"); - AcpiOsPrintf ("Find (? is wildcard) Find ACPI name(s) with wildcards\n"); - AcpiOsPrintf ("Gpe Simulate a GPE\n"); - AcpiOsPrintf ("Gpes Display info on all GPEs\n"); - AcpiOsPrintf ("Integrity Validate namespace integrity\n"); - AcpiOsPrintf ("Methods Display list of loaded control methods\n"); - AcpiOsPrintf ("Namespace [Object] [Depth] Display loaded namespace tree/subtree\n"); - AcpiOsPrintf ("Notify Send a notification on Object\n"); - AcpiOsPrintf ("Objects Display all objects of the given type\n"); - AcpiOsPrintf ("Owner [Depth] Display loaded namespace by object owner\n"); - AcpiOsPrintf ("Predefined Check all predefined names\n"); - AcpiOsPrintf ("Prefix [] Set or Get current execution prefix\n"); - AcpiOsPrintf ("References Find all references to object at addr\n"); - AcpiOsPrintf ("Resources Get and display Device resources\n"); - AcpiOsPrintf ("Set N Set value for named integer\n"); - AcpiOsPrintf ("Sleep Simulate sleep/wake sequence\n"); - AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n"); - AcpiOsPrintf ("Type Display object type\n"); - return; - - case 'M': - AcpiOsPrintf ("\nControl Method Execution Commands\n\n"); - AcpiOsPrintf ("Arguments (or Args) Display method arguments\n"); - AcpiOsPrintf ("Breakpoint Set an AML execution breakpoint\n"); - AcpiOsPrintf ("Call Run to next control method invocation\n"); - AcpiOsPrintf ("Debug [Arguments] Single Step a control method\n"); - AcpiOsPrintf ("Execute [Arguments] Execute control method\n"); - AcpiOsPrintf ("Go Allow method to run to completion\n"); - AcpiOsPrintf ("Information Display info about the current method\n"); - AcpiOsPrintf ("Into Step into (not over) a method call\n"); - AcpiOsPrintf ("List [# of Aml Opcodes] Display method ASL statements\n"); - AcpiOsPrintf ("Locals Display method local variables\n"); - AcpiOsPrintf ("Results Display method result stack\n"); - AcpiOsPrintf ("Set <#> Set method data (Arguments/Locals)\n"); - AcpiOsPrintf ("Stop Terminate control method\n"); - AcpiOsPrintf ("Thread Spawn threads to execute method(s)\n"); - AcpiOsPrintf ("Trace Trace method execution\n"); - AcpiOsPrintf ("Tree Display control method calling tree\n"); - AcpiOsPrintf (" Single step next AML opcode (over calls)\n"); - return; - - case 'F': - AcpiOsPrintf ("\nFile I/O Commands\n\n"); - AcpiOsPrintf ("Close Close debug output file\n"); - AcpiOsPrintf ("Open Open a file for debug output\n"); - AcpiOsPrintf ("Load Load ACPI table from a file\n"); - return; - - default: - AcpiOsPrintf ("Unrecognized Command Class: %s\n", HelpType); - return; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetNextToken - * - * PARAMETERS: String - Command buffer - * Next - Return value, end of next token - * - * RETURN: Pointer to the start of the next token. - * - * DESCRIPTION: Command line parsing. Get the next token on the command line - * - ******************************************************************************/ - -static char * -AcpiDbGetNextToken ( - char *String, - char **Next) -{ - char *Start; - - - /* At end of buffer? */ - - if (!String || !(*String)) - { - return (NULL); - } - - /* Get rid of any spaces at the beginning */ - - if (*String == ' ') - { - while (*String && (*String == ' ')) - { - String++; - } - - if (!(*String)) - { - return (NULL); - } - } - - Start = String; - - /* Find end of token */ - - while (*String && (*String != ' ')) - { - String++; - } - - if (!(*String)) - { - *Next = NULL; - } - else - { - *String = 0; - *Next = String + 1; - } - - return (Start); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetLine - * - * PARAMETERS: InputBuffer - Command line buffer - * - * RETURN: Count of arguments to the command - * - * DESCRIPTION: Get the next command line from the user. Gets entire line - * up to the next newline - * - ******************************************************************************/ - -static UINT32 -AcpiDbGetLine ( - char *InputBuffer) -{ - UINT32 i; - UINT32 Count; - char *Next; - char *This; - - - ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer); - - This = AcpiGbl_DbParsedBuf; - for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++) - { - AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next); - if (!AcpiGbl_DbArgs[i]) - { - break; - } - - This = Next; - } - - /* Uppercase the actual command */ - - if (AcpiGbl_DbArgs[0]) - { - AcpiUtStrupr (AcpiGbl_DbArgs[0]); - } - - Count = i; - if (Count) - { - Count--; /* Number of args only */ - } - - return (Count); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbMatchCommand - * - * PARAMETERS: UserCommand - User command line - * - * RETURN: Index into command array, -1 if not found - * - * DESCRIPTION: Search command array for a command match - * - ******************************************************************************/ - -static UINT32 -AcpiDbMatchCommand ( - char *UserCommand) -{ - UINT32 i; - - - if (!UserCommand || UserCommand[0] == 0) - { - return (CMD_NULL); - } - - for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++) - { - if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) == - AcpiGbl_DbCommands[i].Name) - { - return (i); - } - } - - /* Command not recognized */ - - return (CMD_NOT_FOUND); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbCommandDispatch - * - * PARAMETERS: InputBuffer - Command line buffer - * WalkState - Current walk - * Op - Current (executing) parse op - * - * RETURN: Status - * - * DESCRIPTION: Command dispatcher. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbCommandDispatch ( - char *InputBuffer, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - UINT32 Temp; - UINT32 CommandIndex; - UINT32 ParamCount; - char *CommandLine; - ACPI_STATUS Status = AE_CTRL_TRUE; - - - /* If AcpiTerminate has been called, terminate this thread */ - - if (AcpiGbl_DbTerminateThreads) - { - return (AE_CTRL_TERMINATE); - } - - ParamCount = AcpiDbGetLine (InputBuffer); - CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]); - Temp = 0; - - /* Verify that we have the minimum number of params */ - - if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs) - { - AcpiOsPrintf ("%d parameters entered, [%s] requires %d parameters\n", - ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, - AcpiGbl_DbCommands[CommandIndex].MinArgs); - - return (AE_CTRL_TRUE); - } - - /* Decode and dispatch the command */ - - switch (CommandIndex) - { - case CMD_NULL: - if (Op) - { - return (AE_OK); - } - break; - - case CMD_ALLOCATIONS: - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiUtDumpAllocations ((UINT32) -1, NULL); -#endif - break; - - case CMD_ARGS: - case CMD_ARGUMENTS: - AcpiDbDisplayArguments (); - break; - - case CMD_BATCH: - AcpiDbBatchExecute (AcpiGbl_DbArgs[1]); - break; - - case CMD_BREAKPOINT: - AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op); - break; - - case CMD_BUSINFO: - AcpiDbGetBusInfo (); - break; - - case CMD_CALL: - AcpiDbSetMethodCallBreakpoint (Op); - Status = AE_OK; - break; - - case CMD_CLOSE: - AcpiDbCloseDebugFile (); - break; - - case CMD_DEBUG: - AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_SINGLE_STEP); - break; - - case CMD_DISASSEMBLE: - (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); - break; - - case CMD_DUMP: - AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_ENABLEACPI: - Status = AcpiEnable(); - if (ACPI_FAILURE(Status)) - { - AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status); - return (Status); - } - break; - - case CMD_EVENT: - AcpiOsPrintf ("Event command not implemented\n"); - break; - - case CMD_EXECUTE: - AcpiDbExecute (AcpiGbl_DbArgs[1], - &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP); - break; - - case CMD_FIND: - Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]); - break; - - case CMD_GO: - AcpiGbl_CmSingleStep = FALSE; - return (AE_OK); - - case CMD_GPE: - AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_GPES: - AcpiDbDisplayGpes (); - break; - - case CMD_HELP: - case CMD_HELP2: - AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]); - break; - - case CMD_HISTORY: - AcpiDbDisplayHistory (); - break; - - case CMD_HISTORY_EXE: - CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]); - if (!CommandLine) - { - return (AE_CTRL_TRUE); - } - - Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); - return (Status); - - case CMD_HISTORY_LAST: - CommandLine = AcpiDbGetFromHistory (NULL); - if (!CommandLine) - { - return (AE_CTRL_TRUE); - } - - Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); - return (Status); - - case CMD_INFORMATION: - AcpiDbDisplayMethodInfo (Op); - break; - - case CMD_INTEGRITY: - AcpiDbCheckIntegrity (); - break; - - case CMD_INTO: - if (Op) - { - AcpiGbl_CmSingleStep = TRUE; - return (AE_OK); - } - break; - - case CMD_LEVEL: - if (ParamCount == 0) - { - AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", - AcpiGbl_DbDebugLevel); - AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", - AcpiGbl_DbConsoleDebugLevel); - } - else if (ParamCount == 2) - { - Temp = AcpiGbl_DbConsoleDebugLevel; - AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], - NULL, 16); - AcpiOsPrintf ( - "Debug Level for console output was %8.8lX, now %8.8lX\n", - Temp, AcpiGbl_DbConsoleDebugLevel); - } - else - { - Temp = AcpiGbl_DbDebugLevel; - AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16); - AcpiOsPrintf ( - "Debug Level for file output was %8.8lX, now %8.8lX\n", - Temp, AcpiGbl_DbDebugLevel); - } - break; - - case CMD_LIST: - AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op); - break; - - case CMD_LOAD: - Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL); - break; - - case CMD_LOCKS: - AcpiDbDisplayLocks (); - break; - - case CMD_LOCALS: - AcpiDbDisplayLocals (); - break; - - case CMD_METHODS: - Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]); - break; - - case CMD_NAMESPACE: - AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_NOTIFY: - Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0); - AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp); - break; - - case CMD_OBJECT: - AcpiUtStrupr (AcpiGbl_DbArgs[1]); - Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_OPEN: - AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]); - break; - - case CMD_OWNER: - AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_PREDEFINED: - AcpiDbCheckPredefinedNames (); - break; - - case CMD_PREFIX: - AcpiDbSetScope (AcpiGbl_DbArgs[1]); - break; - - case CMD_REFERENCES: - AcpiDbFindReferences (AcpiGbl_DbArgs[1]); - break; - - case CMD_RESOURCES: - AcpiDbDisplayResources (AcpiGbl_DbArgs[1]); - break; - - case CMD_RESULTS: - AcpiDbDisplayResults (); - break; - - case CMD_SET: - AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], - AcpiGbl_DbArgs[3]); - break; - - case CMD_SLEEP: - Status = AcpiDbSleep (AcpiGbl_DbArgs[1]); - break; - - case CMD_STATS: - Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); - break; - - case CMD_STOP: - return (AE_NOT_IMPLEMENTED); - - case CMD_TABLES: - AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]); - break; - - case CMD_TERMINATE: - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiUtSubsystemShutdown (); - - /* - * TBD: [Restructure] Need some way to re-initialize without - * re-creating the semaphores! - */ - - /* AcpiInitialize (NULL); */ - break; - - case CMD_THREADS: - AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], - AcpiGbl_DbArgs[3]); - break; - - case CMD_TRACE: - (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); - break; - - case CMD_TREE: - AcpiDbDisplayCallingTree (); - break; - - case CMD_TYPE: - AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]); - break; - - case CMD_UNLOAD: - AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_EXIT: - case CMD_QUIT: - if (Op) - { - AcpiOsPrintf ("Method execution terminated\n"); - return (AE_CTRL_TERMINATE); - } - - if (!AcpiGbl_DbOutputToFile) - { - AcpiDbgLevel = ACPI_DEBUG_DEFAULT; - } - - AcpiDbCloseDebugFile (); - AcpiGbl_DbTerminateThreads = TRUE; - return (AE_CTRL_TERMINATE); - - case CMD_NOT_FOUND: - default: - AcpiOsPrintf ("Unknown Command\n"); - return (AE_CTRL_TRUE); - } - - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_TRUE; - } - - /* Add all commands that come here to the history buffer */ - - AcpiDbAddToHistory (InputBuffer); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecuteThread - * - * PARAMETERS: Context - Not used - * - * RETURN: None - * - * DESCRIPTION: Debugger execute thread. Waits for a command line, then - * simply dispatches it. - * - ******************************************************************************/ - -void ACPI_SYSTEM_XFACE -AcpiDbExecuteThread ( - void *Context) -{ - ACPI_STATUS Status = AE_OK; - ACPI_STATUS MStatus; - - - while (Status != AE_CTRL_TERMINATE) - { - AcpiGbl_MethodExecuting = FALSE; - AcpiGbl_StepToNextCall = FALSE; - - MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); - if (ACPI_FAILURE (MStatus)) - { - return; - } - - Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); - - MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); - if (ACPI_FAILURE (MStatus)) - { - return; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSingleThread - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Debugger execute thread. Waits for a command line, then - * simply dispatches it. - * - ******************************************************************************/ - -static void -AcpiDbSingleThread ( - void) -{ - - AcpiGbl_MethodExecuting = FALSE; - AcpiGbl_StepToNextCall = FALSE; - - (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbUserCommands - * - * PARAMETERS: Prompt - User prompt (depends on mode) - * Op - Current executing parse op - * - * RETURN: None - * - * DESCRIPTION: Command line execution for the AML debugger. Commands are - * matched and dispatched here. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbUserCommands ( - char Prompt, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status = AE_OK; - - - /* TBD: [Restructure] Need a separate command line buffer for step mode */ - - while (!AcpiGbl_DbTerminateThreads) - { - /* Force output to console until a command is entered */ - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - - /* Different prompt if method is executing */ - - if (!AcpiGbl_MethodExecuting) - { - AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); - } - else - { - AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); - } - - /* Get the user input line */ - - (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); - - /* Check for single or multithreaded debug */ - - if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) - { - /* - * Signal the debug thread that we have a command to execute, - * and wait for the command to complete. - */ - Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else - { - /* Just call to the command line interpreter */ - - AcpiDbSingleThread (); - } - } - - /* - * Only this thread (the original thread) should actually terminate the - * subsystem, because all the semaphores are deleted during termination - */ - Status = AcpiTerminate (); - return (Status); -} - -#endif /* ACPI_DEBUGGER */ - diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbstats.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbstats.c deleted file mode 100644 index ace8263734..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbstats.c +++ /dev/null @@ -1,621 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbstats - Generation and display of ACPI table statistics - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acdebug.h" -#include "acnamesp.h" - -#ifdef ACPI_DEBUGGER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbstats") - -/* Local prototypes */ - -static void -AcpiDbCountNamespaceObjects ( - void); - -static void -AcpiDbEnumerateObject ( - ACPI_OPERAND_OBJECT *ObjDesc); - -static ACPI_STATUS -AcpiDbClassifyOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE -static void -AcpiDbListInfo ( - ACPI_MEMORY_LIST *List); -#endif - - -/* - * Statistics subcommands - */ -static ARGUMENT_INFO AcpiDbStatTypes [] = -{ - {"ALLOCATIONS"}, - {"OBJECTS"}, - {"MEMORY"}, - {"MISC"}, - {"TABLES"}, - {"SIZES"}, - {"STACK"}, - {NULL} /* Must be null terminated */ -}; - -#define CMD_STAT_ALLOCATIONS 0 -#define CMD_STAT_OBJECTS 1 -#define CMD_STAT_MEMORY 2 -#define CMD_STAT_MISC 3 -#define CMD_STAT_TABLES 4 -#define CMD_STAT_SIZES 5 -#define CMD_STAT_STACK 6 - - -#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE -/******************************************************************************* - * - * FUNCTION: AcpiDbListInfo - * - * PARAMETERS: List - Memory list/cache to be displayed - * - * RETURN: None - * - * DESCRIPTION: Display information about the input memory list or cache. - * - ******************************************************************************/ - -static void -AcpiDbListInfo ( - ACPI_MEMORY_LIST *List) -{ -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - UINT32 Outstanding; -#endif - - AcpiOsPrintf ("\n%s\n", List->ListName); - - /* MaxDepth > 0 indicates a cache object */ - - if (List->MaxDepth > 0) - { - AcpiOsPrintf ( - " Cache: [Depth MaxD Avail Size] %8.2X %8.2X %8.2X %8.2X\n", - List->CurrentDepth, - List->MaxDepth, - List->MaxDepth - List->CurrentDepth, - (List->CurrentDepth * List->ObjectSize)); - } - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - if (List->MaxDepth > 0) - { - AcpiOsPrintf ( - " 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 = AcpiDbGetCacheInfo (List); - - if (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 - { - 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); - } -#endif -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDbEnumerateObject - * - * PARAMETERS: ObjDesc - Object to be counted - * - * RETURN: None - * - * DESCRIPTION: Add this object to the global counts, by object type. - * Limited recursion handles subobjects and packages, and this - * is probably acceptable within the AML debugger only. - * - ******************************************************************************/ - -static void -AcpiDbEnumerateObject ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - UINT32 i; - - - if (!ObjDesc) - { - return; - } - - /* Enumerate this object first */ - - AcpiGbl_NumObjects++; - - if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX) - { - AcpiGbl_ObjTypeCountMisc++; - } - else - { - AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++; - } - - /* Count the sub-objects */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_PACKAGE: - - for (i = 0; i < ObjDesc->Package.Count; i++) - { - AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]); - } - break; - - case ACPI_TYPE_DEVICE: - - AcpiDbEnumerateObject (ObjDesc->Device.SystemNotify); - AcpiDbEnumerateObject (ObjDesc->Device.DeviceNotify); - AcpiDbEnumerateObject (ObjDesc->Device.Handler); - break; - - case ACPI_TYPE_BUFFER_FIELD: - - if (AcpiNsGetSecondaryObject (ObjDesc)) - { - AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++; - } - break; - - case ACPI_TYPE_REGION: - - AcpiGbl_ObjTypeCount [ACPI_TYPE_LOCAL_REGION_FIELD ]++; - AcpiDbEnumerateObject (ObjDesc->Region.Handler); - break; - - case ACPI_TYPE_POWER: - - AcpiDbEnumerateObject (ObjDesc->PowerResource.SystemNotify); - AcpiDbEnumerateObject (ObjDesc->PowerResource.DeviceNotify); - break; - - case ACPI_TYPE_PROCESSOR: - - AcpiDbEnumerateObject (ObjDesc->Processor.SystemNotify); - AcpiDbEnumerateObject (ObjDesc->Processor.DeviceNotify); - AcpiDbEnumerateObject (ObjDesc->Processor.Handler); - break; - - case ACPI_TYPE_THERMAL: - - AcpiDbEnumerateObject (ObjDesc->ThermalZone.SystemNotify); - AcpiDbEnumerateObject (ObjDesc->ThermalZone.DeviceNotify); - AcpiDbEnumerateObject (ObjDesc->ThermalZone.Handler); - break; - - default: - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbClassifyOneObject - * - * PARAMETERS: Callback for WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and - * the parent namespace node. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbClassifyOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 Type; - - - AcpiGbl_NumNodes++; - - Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ObjDesc = AcpiNsGetAttachedObject (Node); - - AcpiDbEnumerateObject (ObjDesc); - - Type = Node->Type; - if (Type > ACPI_TYPE_NS_NODE_MAX) - { - AcpiGbl_NodeTypeCountMisc++; - } - else - { - AcpiGbl_NodeTypeCount [Type]++; - } - - return AE_OK; - - -#ifdef ACPI_FUTURE_IMPLEMENTATION - - /* TBD: These need to be counted during the initial parsing phase */ - - if (AcpiPsIsNamedOp (Op->Opcode)) - { - NumNodes++; - } - - if (IsMethod) - { - NumMethodElements++; - } - - NumGrammarElements++; - Op = AcpiPsGetDepthNext (Root, Op); - - SizeOfParseTree = (NumGrammarElements - NumMethodElements) * - (UINT32) sizeof (ACPI_PARSE_OBJECT); - SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT); - SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE); - SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT); -#endif -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbCountNamespaceObjects - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Count and classify the entire namespace, including all - * namespace nodes and attached objects. - * - ******************************************************************************/ - -static void -AcpiDbCountNamespaceObjects ( - void) -{ - UINT32 i; - - - AcpiGbl_NumNodes = 0; - AcpiGbl_NumObjects = 0; - - AcpiGbl_ObjTypeCountMisc = 0; - for (i = 0; i < (ACPI_TYPE_NS_NODE_MAX -1); i++) - { - AcpiGbl_ObjTypeCount [i] = 0; - AcpiGbl_NodeTypeCount [i] = 0; - } - - (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL, NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayStatistics - * - * PARAMETERS: TypeArg - Subcommand - * - * RETURN: Status - * - * DESCRIPTION: Display various statistics - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbDisplayStatistics ( - char *TypeArg) -{ - UINT32 i; - UINT32 Temp; - - - if (!TypeArg) - { - AcpiOsPrintf ("The following subcommands are available:\n ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n"); - return (AE_OK); - } - - AcpiUtStrupr (TypeArg); - Temp = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes); - if (Temp == (UINT32) -1) - { - AcpiOsPrintf ("Invalid or unsupported argument\n"); - return (AE_OK); - } - - - switch (Temp) - { - case CMD_STAT_ALLOCATIONS: - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiUtDumpAllocationInfo (); -#endif - break; - - case CMD_STAT_TABLES: - - AcpiOsPrintf ("ACPI Table Information (not implemented):\n\n"); - break; - - case CMD_STAT_OBJECTS: - - AcpiDbCountNamespaceObjects (); - - AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n"); - - AcpiOsPrintf ("%16.16s %10.10s %10.10s\n", - "ACPI_TYPE", "NODES", "OBJECTS"); - - for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++) - { - AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i), - AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]); - } - AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown", - AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc); - - AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:", - AcpiGbl_NumNodes, AcpiGbl_NumObjects); - break; - - case CMD_STAT_MEMORY: - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - 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 - - break; - - case CMD_STAT_MISC: - - AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n"); - AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n", - AcpiGbl_PsFindCount); - AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n", - AcpiGbl_NsLookupCount); - - AcpiOsPrintf ("\n"); - - AcpiOsPrintf ("Mutex usage:\n\n"); - for (i = 0; i < ACPI_NUM_MUTEX; i++) - { - AcpiOsPrintf ("%-28s: % 7ld\n", - AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount); - } - break; - - - case CMD_STAT_SIZES: - - AcpiOsPrintf ("\nInternal object sizes:\n\n"); - - AcpiOsPrintf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON)); - AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER)); - AcpiOsPrintf ("String %3d\n", sizeof (ACPI_OBJECT_STRING)); - AcpiOsPrintf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER)); - AcpiOsPrintf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE)); - AcpiOsPrintf ("BufferField %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD)); - AcpiOsPrintf ("Device %3d\n", sizeof (ACPI_OBJECT_DEVICE)); - AcpiOsPrintf ("Event %3d\n", sizeof (ACPI_OBJECT_EVENT)); - AcpiOsPrintf ("Method %3d\n", sizeof (ACPI_OBJECT_METHOD)); - AcpiOsPrintf ("Mutex %3d\n", sizeof (ACPI_OBJECT_MUTEX)); - AcpiOsPrintf ("Region %3d\n", sizeof (ACPI_OBJECT_REGION)); - AcpiOsPrintf ("PowerResource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE)); - AcpiOsPrintf ("Processor %3d\n", sizeof (ACPI_OBJECT_PROCESSOR)); - AcpiOsPrintf ("ThermalZone %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE)); - AcpiOsPrintf ("RegionField %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD)); - AcpiOsPrintf ("BankField %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD)); - AcpiOsPrintf ("IndexField %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD)); - AcpiOsPrintf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE)); - AcpiOsPrintf ("Notify %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER)); - AcpiOsPrintf ("AddressSpace %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER)); - AcpiOsPrintf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA)); - AcpiOsPrintf ("Data %3d\n", sizeof (ACPI_OBJECT_DATA)); - - AcpiOsPrintf ("\n"); - - AcpiOsPrintf ("ParseObject %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON)); - AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED)); - 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; - - - case CMD_STAT_STACK: -#if defined(ACPI_DEBUG_OUTPUT) - - Temp = (UINT32) ACPI_PTR_DIFF (AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer); - - AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n"); - 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; - - default: - break; - } - - AcpiOsPrintf ("\n"); - return (AE_OK); -} - -#endif /* ACPI_DEBUGGER */ diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbutils.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbutils.c deleted file mode 100644 index 19ff3f02a2..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbutils.c +++ /dev/null @@ -1,599 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbutils - AML debugger utilities - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acdebug.h" -#include "acdisasm.h" - - -#ifdef ACPI_DEBUGGER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbutils") - -/* Local prototypes */ - -#ifdef ACPI_OBSOLETE_FUNCTIONS -ACPI_STATUS -AcpiDbSecondPassParse ( - ACPI_PARSE_OBJECT *Root); - -void -AcpiDbDumpBuffer ( - UINT32 Address); -#endif - -static char *Converter = "0123456789ABCDEF"; - - -/******************************************************************************* - * - * FUNCTION: AcpiDbMatchArgument - * - * PARAMETERS: UserArgument - User command line - * Arguments - Array of commands to match against - * - * RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found - * - * DESCRIPTION: Search command array for a command match - * - ******************************************************************************/ - -ACPI_OBJECT_TYPE -AcpiDbMatchArgument ( - char *UserArgument, - ARGUMENT_INFO *Arguments) -{ - UINT32 i; - - - if (!UserArgument || UserArgument[0] == 0) - { - return (ACPI_TYPE_NOT_FOUND); - } - - for (i = 0; Arguments[i].Name; i++) - { - if (ACPI_STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name) - { - return (i); - } - } - - /* Argument not recognized */ - - return (ACPI_TYPE_NOT_FOUND); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSetOutputDestination - * - * PARAMETERS: OutputFlags - Current flags word - * - * RETURN: None - * - * DESCRIPTION: Set the current destination for debugger output. Also sets - * the debug output level accordingly. - * - ******************************************************************************/ - -void -AcpiDbSetOutputDestination ( - UINT32 OutputFlags) -{ - - AcpiGbl_DbOutputFlags = (UINT8) OutputFlags; - - if ((OutputFlags & ACPI_DB_REDIRECTABLE_OUTPUT) && AcpiGbl_DbOutputToFile) - { - AcpiDbgLevel = AcpiGbl_DbDebugLevel; - } - else - { - AcpiDbgLevel = AcpiGbl_DbConsoleDebugLevel; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDumpExternalObject - * - * PARAMETERS: ObjDesc - External ACPI object to dump - * Level - Nesting level. - * - * RETURN: None - * - * DESCRIPTION: Dump the contents of an ACPI external object - * - ******************************************************************************/ - -void -AcpiDbDumpExternalObject ( - ACPI_OBJECT *ObjDesc, - UINT32 Level) -{ - UINT32 i; - - - if (!ObjDesc) - { - AcpiOsPrintf ("[Null Object]\n"); - return; - } - - for (i = 0; i < Level; i++) - { - AcpiOsPrintf (" "); - } - - switch (ObjDesc->Type) - { - case ACPI_TYPE_ANY: - - AcpiOsPrintf ("[Null Object] (Type=0)\n"); - break; - - - case ACPI_TYPE_INTEGER: - - AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - - case ACPI_TYPE_STRING: - - AcpiOsPrintf ("[String] Length %.2X = ", ObjDesc->String.Length); - for (i = 0; i < ObjDesc->String.Length; i++) - { - AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]); - } - AcpiOsPrintf ("\n"); - break; - - - case ACPI_TYPE_BUFFER: - - AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length); - if (ObjDesc->Buffer.Length) - { - if (ObjDesc->Buffer.Length > 16) - { - AcpiOsPrintf ("\n"); - } - AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), - ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); - } - else - { - AcpiOsPrintf ("\n"); - } - break; - - - case ACPI_TYPE_PACKAGE: - - AcpiOsPrintf ("[Package] Contains %d Elements:\n", - ObjDesc->Package.Count); - - for (i = 0; i < ObjDesc->Package.Count; i++) - { - AcpiDbDumpExternalObject (&ObjDesc->Package.Elements[i], Level+1); - } - break; - - - case ACPI_TYPE_LOCAL_REFERENCE: - - AcpiOsPrintf ("[Object Reference] = "); - AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL); - break; - - - case ACPI_TYPE_PROCESSOR: - - AcpiOsPrintf ("[Processor]\n"); - break; - - - case ACPI_TYPE_POWER: - - AcpiOsPrintf ("[Power Resource]\n"); - break; - - - default: - - AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Type); - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbPrepNamestring - * - * PARAMETERS: Name - String to prepare - * - * RETURN: None - * - * DESCRIPTION: Translate all forward slashes and dots to backslashes. - * - ******************************************************************************/ - -void -AcpiDbPrepNamestring ( - char *Name) -{ - - if (!Name) - { - return; - } - - AcpiUtStrupr (Name); - - /* Convert a leading forward slash to a backslash */ - - if (*Name == '/') - { - *Name = '\\'; - } - - /* Ignore a leading backslash, this is the root prefix */ - - if (*Name == '\\') - { - Name++; - } - - /* Convert all slash path separators to dots */ - - while (*Name) - { - if ((*Name == '/') || - (*Name == '\\')) - { - *Name = '.'; - } - - Name++; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbLocalNsLookup - * - * PARAMETERS: Name - Name to lookup - * - * RETURN: Pointer to a namespace node, null on failure - * - * DESCRIPTION: Lookup a name in the ACPI namespace - * - * Note: Currently begins search from the root. Could be enhanced to use - * the current prefix (scope) node as the search beginning point. - * - ******************************************************************************/ - -ACPI_NAMESPACE_NODE * -AcpiDbLocalNsLookup ( - char *Name) -{ - char *InternalPath; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node = NULL; - - - AcpiDbPrepNamestring (Name); - - /* Build an internal namestring */ - - Status = AcpiNsInternalizeName (Name, &InternalPath); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Invalid namestring: %s\n", Name); - return (NULL); - } - - /* - * Lookup the name. - * (Uses root node as the search starting point) - */ - Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not locate name: %s, %s\n", - Name, AcpiFormatException (Status)); - } - - ACPI_FREE (InternalPath); - return (Node); -} - - -/******************************************************************************* - * - * 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 -/******************************************************************************* - * - * FUNCTION: AcpiDbSecondPassParse - * - * PARAMETERS: Root - Root of the parse tree - * - * RETURN: Status - * - * DESCRIPTION: Second pass parse of the ACPI tables. We need to wait until - * second pass to parse the control methods - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbSecondPassParse ( - ACPI_PARSE_OBJECT *Root) -{ - ACPI_PARSE_OBJECT *Op = Root; - ACPI_PARSE_OBJECT *Method; - ACPI_PARSE_OBJECT *SearchOp; - ACPI_PARSE_OBJECT *StartOp; - ACPI_STATUS Status = AE_OK; - UINT32 BaseAmlOffset; - ACPI_WALK_STATE *WalkState; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("Pass two parse ....\n"); - - while (Op) - { - if (Op->Common.AmlOpcode == AML_METHOD_OP) - { - Method = Op; - - /* Create a new walk state for the parse */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - return (AE_NO_MEMORY); - } - - /* Init the Walk State */ - - WalkState->ParserState.Aml = - WalkState->ParserState.AmlStart = Method->Named.Data; - WalkState->ParserState.AmlEnd = - WalkState->ParserState.PkgEnd = Method->Named.Data + - Method->Named.Length; - WalkState->ParserState.StartScope = Op; - - WalkState->DescendingCallback = AcpiDsLoad1BeginOp; - WalkState->AscendingCallback = AcpiDsLoad1EndOp; - - /* Perform the AML parse */ - - Status = AcpiPsParseAml (WalkState); - - BaseAmlOffset = (Method->Common.Value.Arg)->Common.AmlOffset + 1; - StartOp = (Method->Common.Value.Arg)->Common.Next; - SearchOp = StartOp; - - while (SearchOp) - { - SearchOp->Common.AmlOffset += BaseAmlOffset; - SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); - } - } - - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - /* TBD: [Investigate] this isn't quite the right thing to do! */ - /* - * - * Method = (ACPI_DEFERRED_OP *) Op; - * Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength); - */ - } - - if (ACPI_FAILURE (Status)) - { - break; - } - - Op = AcpiPsGetDepthNext (Root, Op); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDumpBuffer - * - * PARAMETERS: Address - Pointer to the buffer - * - * RETURN: None - * - * DESCRIPTION: Print a portion of a buffer - * - ******************************************************************************/ - -void -AcpiDbDumpBuffer ( - UINT32 Address) -{ - - AcpiOsPrintf ("\nLocation %X:\n", Address); - - AcpiDbgLevel |= ACPI_LV_TABLES; - AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY, - ACPI_UINT32_MAX); -} -#endif - -#endif /* ACPI_DEBUGGER */ - - diff --git a/src/add-ons/kernel/bus_managers/acpi/debugger/dbxface.c b/src/add-ons/kernel/bus_managers/acpi/debugger/dbxface.c deleted file mode 100644 index 1c0557ac31..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/debugger/dbxface.c +++ /dev/null @@ -1,602 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbxface - AML Debugger external interfaces - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acdebug.h" -#include "acdisasm.h" - - -#ifdef ACPI_DEBUGGER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbxface") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDbStartCommand ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -#ifdef ACPI_OBSOLETE_FUNCTIONS -void -AcpiDbMethodEnd ( - ACPI_WALK_STATE *WalkState); -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDbStartCommand - * - * PARAMETERS: WalkState - Current walk - * Op - Current executing Op, from AML interpreter - * - * RETURN: Status - * - * DESCRIPTION: Enter debugger command loop - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbStartCommand ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - - - /* TBD: [Investigate] are there namespace locking issues here? */ - - /* AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); */ - - /* Go into the command loop and await next user command */ - - - AcpiGbl_MethodExecuting = TRUE; - Status = AE_CTRL_TRUE; - while (Status == AE_CTRL_TRUE) - { - if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED) - { - /* Handshake with the front-end that gets user command lines */ - - Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else - { - /* Single threaded, we must get a command line ourselves */ - - /* Force output to console until a command is entered */ - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - - /* Different prompt if method is executing */ - - if (!AcpiGbl_MethodExecuting) - { - AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); - } - else - { - AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); - } - - /* Get the user input line */ - - (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); - } - - Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op); - } - - /* AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); */ - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSingleStep - * - * PARAMETERS: WalkState - Current walk - * Op - Current executing op (from aml interpreter) - * OpcodeClass - Class of the current AML Opcode - * - * RETURN: Status - * - * DESCRIPTION: Called just before execution of an AML opcode. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbSingleStep ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - UINT32 OpcodeClass) -{ - ACPI_PARSE_OBJECT *Next; - ACPI_STATUS Status = AE_OK; - UINT32 OriginalDebugLevel; - ACPI_PARSE_OBJECT *DisplayOp; - ACPI_PARSE_OBJECT *ParentOp; - - - ACPI_FUNCTION_ENTRY (); - - - /* Check the abort flag */ - - if (AcpiGbl_AbortMethod) - { - AcpiGbl_AbortMethod = FALSE; - return (AE_ABORT_METHOD); - } - - /* Check for single-step breakpoint */ - - if (WalkState->MethodBreakpoint && - (WalkState->MethodBreakpoint <= Op->Common.AmlOffset)) - { - /* Check if the breakpoint has been reached or passed */ - /* Hit the breakpoint, resume single step, reset breakpoint */ - - AcpiOsPrintf ("***Break*** at AML offset %X\n", Op->Common.AmlOffset); - AcpiGbl_CmSingleStep = TRUE; - AcpiGbl_StepToNextCall = FALSE; - WalkState->MethodBreakpoint = 0; - } - - /* Check for user breakpoint (Must be on exact Aml offset) */ - - else if (WalkState->UserBreakpoint && - (WalkState->UserBreakpoint == Op->Common.AmlOffset)) - { - AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", - Op->Common.AmlOffset); - AcpiGbl_CmSingleStep = TRUE; - AcpiGbl_StepToNextCall = FALSE; - WalkState->MethodBreakpoint = 0; - } - - /* - * Check if this is an opcode that we are interested in -- - * namely, opcodes that have arguments - */ - if (Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) - { - return (AE_OK); - } - - switch (OpcodeClass) - { - case AML_CLASS_UNKNOWN: - case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */ - return (AE_OK); - - default: - /* All other opcodes -- continue */ - break; - } - - /* - * Under certain debug conditions, display this opcode and its operands - */ - if ((AcpiGbl_DbOutputToFile) || - (AcpiGbl_CmSingleStep) || - (AcpiDbgLevel & ACPI_LV_PARSE)) - { - if ((AcpiGbl_DbOutputToFile) || - (AcpiDbgLevel & ACPI_LV_PARSE)) - { - AcpiOsPrintf ("\n[AmlDebug] Next AML Opcode to execute:\n"); - } - - /* - * Display this op (and only this op - zero out the NEXT field - * temporarily, and disable parser trace output for the duration of - * the display because we don't want the extraneous debug output) - */ - OriginalDebugLevel = AcpiDbgLevel; - AcpiDbgLevel &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS); - Next = Op->Common.Next; - Op->Common.Next = NULL; - - - DisplayOp = Op; - ParentOp = Op->Common.Parent; - if (ParentOp) - { - if ((WalkState->ControlState) && - (WalkState->ControlState->Common.State == - ACPI_CONTROL_PREDICATE_EXECUTING)) - { - /* - * We are executing the predicate of an IF or WHILE statement - * Search upwards for the containing IF or WHILE so that the - * entire predicate can be displayed. - */ - while (ParentOp) - { - if ((ParentOp->Common.AmlOpcode == AML_IF_OP) || - (ParentOp->Common.AmlOpcode == AML_WHILE_OP)) - { - DisplayOp = ParentOp; - break; - } - ParentOp = ParentOp->Common.Parent; - } - } - else - { - while (ParentOp) - { - if ((ParentOp->Common.AmlOpcode == AML_IF_OP) || - (ParentOp->Common.AmlOpcode == AML_ELSE_OP) || - (ParentOp->Common.AmlOpcode == AML_SCOPE_OP) || - (ParentOp->Common.AmlOpcode == AML_METHOD_OP) || - (ParentOp->Common.AmlOpcode == AML_WHILE_OP)) - { - break; - } - DisplayOp = ParentOp; - ParentOp = ParentOp->Common.Parent; - } - } - } - - /* Now we can display it */ - - AcpiDmDisassemble (WalkState, DisplayOp, ACPI_UINT32_MAX); - - if ((Op->Common.AmlOpcode == AML_IF_OP) || - (Op->Common.AmlOpcode == AML_WHILE_OP)) - { - if (WalkState->ControlState->Common.Value) - { - AcpiOsPrintf ("Predicate = [True], IF block was executed\n"); - } - else - { - AcpiOsPrintf ("Predicate = [False], Skipping IF block\n"); - } - } - else if (Op->Common.AmlOpcode == AML_ELSE_OP) - { - AcpiOsPrintf ("Predicate = [False], ELSE block was executed\n"); - } - - /* Restore everything */ - - Op->Common.Next = Next; - AcpiOsPrintf ("\n"); - if ((AcpiGbl_DbOutputToFile) || - (AcpiDbgLevel & ACPI_LV_PARSE)) - { - AcpiOsPrintf ("\n"); - } - AcpiDbgLevel = OriginalDebugLevel; - } - - /* If we are not single stepping, just continue executing the method */ - - if (!AcpiGbl_CmSingleStep) - { - return (AE_OK); - } - - /* - * If we are executing a step-to-call command, - * Check if this is a method call. - */ - if (AcpiGbl_StepToNextCall) - { - if (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP) - { - /* Not a method call, just keep executing */ - - return (AE_OK); - } - - /* Found a method call, stop executing */ - - AcpiGbl_StepToNextCall = FALSE; - } - - /* - * If the next opcode is a method call, we will "step over" it - * by default. - */ - if (Op->Common.AmlOpcode == AML_INT_METHODCALL_OP) - { - /* Force no more single stepping while executing called method */ - - AcpiGbl_CmSingleStep = FALSE; - - /* - * Set the breakpoint on/before the call, it will stop execution - * as soon as we return - */ - WalkState->MethodBreakpoint = 1; /* Must be non-zero! */ - } - - - Status = AcpiDbStartCommand (WalkState, Op); - - /* User commands complete, continue execution of the interrupted method */ - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbInitialize - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Init and start debugger - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbInitialize ( - void) -{ - ACPI_STATUS Status; - - - /* Init globals */ - - AcpiGbl_DbBuffer = NULL; - AcpiGbl_DbFilename = NULL; - AcpiGbl_DbOutputToFile = FALSE; - - AcpiGbl_DbDebugLevel = ACPI_LV_VERBOSITY2; - AcpiGbl_DbConsoleDebugLevel = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES; - AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; - - AcpiGbl_DbOpt_tables = FALSE; - AcpiGbl_DbOpt_disasm = FALSE; - AcpiGbl_DbOpt_stats = FALSE; - AcpiGbl_DbOpt_verbose = TRUE; - AcpiGbl_DbOpt_ini_methods = TRUE; - - AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE); - if (!AcpiGbl_DbBuffer) - { - return (AE_NO_MEMORY); - } - ACPI_MEMSET (AcpiGbl_DbBuffer, 0, ACPI_DEBUG_BUFFER_SIZE); - - /* Initial scope is the root */ - - AcpiGbl_DbScopeBuf [0] = '\\'; - AcpiGbl_DbScopeBuf [1] = 0; - AcpiGbl_DbScopeNode = AcpiGbl_RootNode; - - /* - * If configured for multi-thread support, the debug executor runs in - * a separate thread so that the front end can be in another address - * space, environment, or even another machine. - */ - if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) - { - /* These were created with one unit, grab it */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get debugger mutex\n"); - return (Status); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get debugger mutex\n"); - return (Status); - } - - /* Create the debug execution thread to execute commands */ - - Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, AcpiDbExecuteThread, NULL); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not start debugger thread\n"); - return (Status); - } - } - - if (!AcpiGbl_DbOpt_verbose) - { - AcpiGbl_DbOpt_disasm = TRUE; - AcpiGbl_DbOpt_stats = FALSE; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbTerminate - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Stop debugger - * - ******************************************************************************/ - -void -AcpiDbTerminate ( - void) -{ - - if (AcpiGbl_DbBuffer) - { - AcpiOsFree (AcpiGbl_DbBuffer); - } -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AcpiDbMethodEnd - * - * PARAMETERS: WalkState - Current walk - * - * RETURN: Status - * - * DESCRIPTION: Called at method termination - * - ******************************************************************************/ - -void -AcpiDbMethodEnd ( - ACPI_WALK_STATE *WalkState) -{ - - if (!AcpiGbl_CmSingleStep) - { - return; - } - - AcpiOsPrintf ("\n"); - - AcpiDbStartCommand (WalkState, NULL); -} -#endif - -#endif /* ACPI_DEBUGGER */ diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmbuffer.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmbuffer.c deleted file mode 100644 index b9222f9533..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmbuffer.c +++ /dev/null @@ -1,614 +0,0 @@ -/******************************************************************************* - * - * Module Name: dmbuffer - AML disassembler, buffer and string support - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acdisasm.h" -#include "acparser.h" -#include "amlcode.h" - - -#ifdef ACPI_DISASSEMBLER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dmbuffer") - -/* Local prototypes */ - -static void -AcpiDmUnicode ( - ACPI_PARSE_OBJECT *Op); - -static void -AcpiDmIsEisaIdElement ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDisasmByteList - * - * PARAMETERS: Level - Current source code indentation level - * ByteData - Pointer to the byte list - * ByteCount - Length of the byte list - * - * RETURN: None - * - * DESCRIPTION: Dump an AML "ByteList" in Hex format. 8 bytes per line, prefixed - * with the hex buffer offset. - * - ******************************************************************************/ - -void -AcpiDmDisasmByteList ( - UINT32 Level, - UINT8 *ByteData, - UINT32 ByteCount) -{ - UINT32 i; - - - if (!ByteCount) - { - return; - } - - /* Dump the byte list */ - - for (i = 0; i < ByteCount; i++) - { - /* New line every 8 bytes */ - - if (((i % 8) == 0) && (i < ByteCount)) - { - if (i > 0) - { - AcpiOsPrintf ("\n"); - } - - AcpiDmIndent (Level); - if (ByteCount > 7) - { - AcpiOsPrintf ("/* %04X */ ", i); - } - } - - AcpiOsPrintf ("0x%2.2X", (UINT32) ByteData[i]); - - /* Add comma if there are more bytes to display */ - - if (i < (ByteCount -1)) - { - AcpiOsPrintf (", "); - } - } - - if (Level) - { - AcpiOsPrintf ("\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmByteList - * - * PARAMETERS: Info - Parse tree walk info - * Op - Byte list op - * - * RETURN: None - * - * DESCRIPTION: Dump a buffer byte list, handling the various types of buffers. - * Buffer type must be already set in the Op DisasmOpcode. - * - ******************************************************************************/ - -void -AcpiDmByteList ( - ACPI_OP_WALK_INFO *Info, - ACPI_PARSE_OBJECT *Op) -{ - UINT8 *ByteData; - UINT32 ByteCount; - - - ByteData = Op->Named.Data; - ByteCount = (UINT32) Op->Common.Value.Integer; - - /* - * The byte list belongs to a buffer, and can be produced by either - * a ResourceTemplate, Unicode, quoted string, or a plain byte list. - */ - switch (Op->Common.Parent->Common.DisasmOpcode) - { - case ACPI_DASM_RESOURCE: - - AcpiDmResourceTemplate (Info, Op->Common.Parent, ByteData, ByteCount); - break; - - case ACPI_DASM_STRING: - - AcpiDmIndent (Info->Level); - AcpiUtPrintString ((char *) ByteData, ACPI_UINT8_MAX); - AcpiOsPrintf ("\n"); - break; - - case ACPI_DASM_UNICODE: - - AcpiDmUnicode (Op); - break; - - case ACPI_DASM_BUFFER: - default: - - /* - * Not a resource, string, or unicode string. - * Just dump the buffer - */ - AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount); - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsUnicodeBuffer - * - * PARAMETERS: Op - Buffer Object to be examined - * - * RETURN: TRUE if buffer contains a UNICODE string - * - * DESCRIPTION: Determine if a buffer Op contains a Unicode string - * - ******************************************************************************/ - -BOOLEAN -AcpiDmIsUnicodeBuffer ( - ACPI_PARSE_OBJECT *Op) -{ - UINT8 *ByteData; - UINT32 ByteCount; - UINT32 WordCount; - ACPI_PARSE_OBJECT *SizeOp; - ACPI_PARSE_OBJECT *NextOp; - UINT32 i; - - - /* Buffer size is the buffer argument */ - - SizeOp = Op->Common.Value.Arg; - - /* Next, the initializer byte list to examine */ - - NextOp = SizeOp->Common.Next; - if (!NextOp) - { - return (FALSE); - } - - /* Extract the byte list info */ - - ByteData = NextOp->Named.Data; - ByteCount = (UINT32) NextOp->Common.Value.Integer; - WordCount = ACPI_DIV_2 (ByteCount); - - /* - * Unicode string must have an even number of bytes and last - * word must be zero - */ - if ((!ByteCount) || - (ByteCount < 4) || - (ByteCount & 1) || - ((UINT16 *) (void *) ByteData)[WordCount - 1] != 0) - { - return (FALSE); - } - - /* For each word, 1st byte must be ascii, 2nd byte must be zero */ - - for (i = 0; i < (ByteCount - 2); i += 2) - { - if ((!ACPI_IS_PRINT (ByteData[i])) || - (ByteData[(ACPI_SIZE) i + 1] != 0)) - { - return (FALSE); - } - } - - /* Ignore the Size argument in the disassembly of this buffer op */ - - SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsStringBuffer - * - * PARAMETERS: Op - Buffer Object to be examined - * - * RETURN: TRUE if buffer contains a ASCII string, FALSE otherwise - * - * DESCRIPTION: Determine if a buffer Op contains a ASCII string - * - ******************************************************************************/ - -BOOLEAN -AcpiDmIsStringBuffer ( - ACPI_PARSE_OBJECT *Op) -{ - UINT8 *ByteData; - UINT32 ByteCount; - ACPI_PARSE_OBJECT *SizeOp; - ACPI_PARSE_OBJECT *NextOp; - UINT32 i; - - - /* Buffer size is the buffer argument */ - - SizeOp = Op->Common.Value.Arg; - - /* Next, the initializer byte list to examine */ - - NextOp = SizeOp->Common.Next; - if (!NextOp) - { - return (FALSE); - } - - /* Extract the byte list info */ - - ByteData = NextOp->Named.Data; - ByteCount = (UINT32) NextOp->Common.Value.Integer; - - /* Last byte must be the null terminator */ - - if ((!ByteCount) || - (ByteCount < 2) || - (ByteData[ByteCount-1] != 0)) - { - return (FALSE); - } - - for (i = 0; i < (ByteCount - 1); i++) - { - /* TBD: allow some escapes (non-ascii chars). - * they will be handled in the string output routine - */ - - if (!ACPI_IS_PRINT (ByteData[i])) - { - return (FALSE); - } - } - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmUnicode - * - * PARAMETERS: Op - Byte List op containing Unicode string - * - * RETURN: None - * - * DESCRIPTION: Dump Unicode string as a standard ASCII string. (Remove - * the extra zero bytes). - * - ******************************************************************************/ - -static void -AcpiDmUnicode ( - ACPI_PARSE_OBJECT *Op) -{ - UINT16 *WordData; - UINT32 WordCount; - UINT32 i; - - - /* Extract the buffer info as a WORD buffer */ - - WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data); - WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer)); - - - AcpiOsPrintf ("\""); - - /* Write every other byte as an ASCII character */ - - for (i = 0; i < (WordCount - 1); i++) - { - AcpiOsPrintf ("%c", (int) WordData[i]); - } - - AcpiOsPrintf ("\")"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsEisaIdElement - * - * PARAMETERS: Op - Op to be examined - * - * RETURN: None - * - * DESCRIPTION: Determine if an Op (argument to _HID or _CID) can be converted - * to an EISA ID. - * - ******************************************************************************/ - -static void -AcpiDmIsEisaIdElement ( - ACPI_PARSE_OBJECT *Op) -{ - UINT32 BigEndianId; - UINT32 Prefix[3]; - UINT32 i; - - - /* The parameter must be either a word or a dword */ - - if ((Op->Common.AmlOpcode != AML_DWORD_OP) && - (Op->Common.AmlOpcode != AML_WORD_OP)) - { - return; - } - - /* Swap from little-endian to big-endian to simplify conversion */ - - BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer); - - /* Create the 3 leading ASCII letters */ - - Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40; - Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40; - Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40; - - /* Verify that all 3 are ascii and alpha */ - - for (i = 0; i < 3; i++) - { - if (!ACPI_IS_ASCII (Prefix[i]) || - !ACPI_IS_ALPHA (Prefix[i])) - { - return; - } - } - - /* OK - mark this node as convertable to an EISA ID */ - - Op->Common.DisasmOpcode = ACPI_DASM_EISAID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsEisaId - * - * PARAMETERS: Op - Op to be examined - * - * RETURN: None - * - * DESCRIPTION: Determine if a Name() Op can be converted to an EisaId. - * - ******************************************************************************/ - -void -AcpiDmIsEisaId ( - ACPI_PARSE_OBJECT *Op) -{ - UINT32 Name; - ACPI_PARSE_OBJECT *NextOp; - - - /* Get the NameSegment */ - - Name = AcpiPsGetName (Op); - if (!Name) - { - return; - } - - NextOp = AcpiPsGetDepthNext (NULL, Op); - if (!NextOp) - { - return; - } - - /* Check for _HID - has one argument */ - - if (ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID)) - { - AcpiDmIsEisaIdElement (NextOp); - return; - } - - /* Exit if not _CID */ - - if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__CID)) - { - return; - } - - /* _CID can contain a single argument or a package */ - - if (NextOp->Common.AmlOpcode != AML_PACKAGE_OP) - { - AcpiDmIsEisaIdElement (NextOp); - return; - } - - /* _CID with Package: get the package length */ - - NextOp = AcpiPsGetDepthNext (NULL, NextOp); - - /* Don't need to use the length, just walk the peer list */ - - NextOp = NextOp->Common.Next; - while (NextOp) - { - AcpiDmIsEisaIdElement (NextOp); - NextOp = NextOp->Common.Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmEisaId - * - * PARAMETERS: EncodedId - Raw encoded EISA ID. - * - * RETURN: None - * - * DESCRIPTION: Convert an encoded EISAID back to the original ASCII String. - * - ******************************************************************************/ - -void -AcpiDmEisaId ( - UINT32 EncodedId) -{ - UINT32 BigEndianId; - - - /* Swap from little-endian to big-endian to simplify conversion */ - - BigEndianId = AcpiUtDwordByteSwap (EncodedId); - - - /* Split to form "AAANNNN" string */ - - AcpiOsPrintf ("EisaId (\"%c%c%c%4.4X\")", - - /* Three Alpha characters (AAA), 5 bits each */ - - (int) ((BigEndianId >> 26) & 0x1F) + 0x40, - (int) ((BigEndianId >> 21) & 0x1F) + 0x40, - (int) ((BigEndianId >> 16) & 0x1F) + 0x40, - - /* Numeric part (NNNN) is simply the lower 16 bits */ - - (UINT32) (BigEndianId & 0xFFFF)); -} - -#endif diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmnames.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmnames.c deleted file mode 100644 index bdfa15ac9e..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmnames.c +++ /dev/null @@ -1,525 +0,0 @@ -/******************************************************************************* - * - * Module Name: dmnames - AML disassembler, names, namestrings, pathnames - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdisasm.h" - - -#ifdef ACPI_DISASSEMBLER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dmnames") - -/* Local prototypes */ - -#ifdef ACPI_OBSOLETE_FUNCTIONS -void -AcpiDmDisplayPath ( - ACPI_PARSE_OBJECT *Op); -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpName - * - * PARAMETERS: Name - 4 character ACPI name - * - * RETURN: Final length of name - * - * DESCRIPTION: Dump an ACPI name, minus any trailing underscores. - * - ******************************************************************************/ - -UINT32 -AcpiDmDumpName ( - UINT32 Name) -{ - UINT32 i; - UINT32 Length; - char NewName[4]; - - - /* Copy name locally in case the original name is not writeable */ - - *ACPI_CAST_PTR (UINT32, &NewName[0]) = Name; - - /* Ensure that the name is printable, even if we have to fix it */ - - AcpiUtRepairName (NewName); - - /* Remove all trailing underscores from the name */ - - Length = ACPI_NAME_SIZE; - for (i = (ACPI_NAME_SIZE - 1); i != 0; i--) - { - if (NewName[i] == '_') - { - Length--; - } - else - { - break; - } - } - - /* Dump the name, up to the start of the trailing underscores */ - - for (i = 0; i < Length; i++) - { - AcpiOsPrintf ("%c", NewName[i]); - } - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsDisplayObjectPathname - * - * PARAMETERS: WalkState - Current walk state - * Op - Object whose pathname is to be obtained - * - * RETURN: Status - * - * DESCRIPTION: Diplay the pathname associated with a named object. Two - * versions. One searches the parse tree (for parser-only - * applications suchas AcpiDump), and the other searches the - * ACPI namespace (the parse tree is probably deleted) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsDisplayObjectPathname ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_BUFFER Buffer; - UINT32 DebugLevel; - - - /* Save current debug level so we don't get extraneous debug output */ - - DebugLevel = AcpiDbgLevel; - AcpiDbgLevel = 0; - - /* Just get the Node out of the Op object */ - - Node = Op->Common.Node; - if (!Node) - { - /* Node not defined in this scope, look it up */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); - - if (ACPI_FAILURE (Status)) - { - /* - * We can't get the pathname since the object - * is not in the namespace. This can happen during single - * stepping where a dynamic named object is *about* to be created. - */ - AcpiOsPrintf (" [Path not found]"); - goto Exit; - } - - /* Save it for next time. */ - - Op->Common.Node = Node; - } - - /* Convert NamedDesc/handle to a full pathname */ - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (Node, &Buffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("****Could not get pathname****)"); - goto Exit; - } - - AcpiOsPrintf (" (Path %s)", (char *) Buffer.Pointer); - ACPI_FREE (Buffer.Pointer); - - -Exit: - /* Restore the debug level */ - - AcpiDbgLevel = DebugLevel; - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmNamestring - * - * PARAMETERS: Name - ACPI Name string to store - * - * RETURN: None - * - * DESCRIPTION: Decode and dump an ACPI namestring. Handles prefix characters - * - ******************************************************************************/ - -void -AcpiDmNamestring ( - char *Name) -{ - UINT32 SegCount; - - - if (!Name) - { - return; - } - - /* Handle all Scope Prefix operators */ - - while (AcpiPsIsPrefixChar (ACPI_GET8 (Name))) - { - /* Append prefix character */ - - AcpiOsPrintf ("%1c", ACPI_GET8 (Name)); - Name++; - } - - switch (ACPI_GET8 (Name)) - { - case 0: - SegCount = 0; - break; - - case AML_DUAL_NAME_PREFIX: - SegCount = 2; - Name++; - break; - - case AML_MULTI_NAME_PREFIX_OP: - SegCount = (UINT32) ACPI_GET8 (Name + 1); - Name += 2; - break; - - default: - SegCount = 1; - break; - } - - while (SegCount) - { - /* Append Name segment */ - - AcpiDmDumpName (*ACPI_CAST_PTR (UINT32, Name)); - - SegCount--; - if (SegCount) - { - /* Not last name, append dot separator */ - - AcpiOsPrintf ("."); - } - Name += ACPI_NAME_SIZE; - } -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AcpiDmDisplayPath - * - * PARAMETERS: Op - Named Op whose path is to be constructed - * - * RETURN: None - * - * DESCRIPTION: Walk backwards from current scope and display the name - * of each previous level of scope up to the root scope - * (like "pwd" does with file systems) - * - ******************************************************************************/ - -void -AcpiDmDisplayPath ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Prev; - ACPI_PARSE_OBJECT *Search; - UINT32 Name; - BOOLEAN DoDot = FALSE; - ACPI_PARSE_OBJECT *NamePath; - const ACPI_OPCODE_INFO *OpInfo; - - - /* We are only interested in named objects */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (!(OpInfo->Flags & AML_NSNODE)) - { - return; - } - - if (OpInfo->Flags & AML_CREATE) - { - /* Field creation - check for a fully qualified namepath */ - - if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) - { - NamePath = AcpiPsGetArg (Op, 3); - } - else - { - NamePath = AcpiPsGetArg (Op, 2); - } - - if ((NamePath) && - (NamePath->Common.Value.String) && - (NamePath->Common.Value.String[0] == '\\')) - { - AcpiDmNamestring (NamePath->Common.Value.String); - return; - } - } - - Prev = NULL; /* Start with Root Node */ - - while (Prev != Op) - { - /* Search upwards in the tree to find scope with "prev" as its parent */ - - Search = Op; - for (; ;) - { - if (Search->Common.Parent == Prev) - { - break; - } - - /* Go up one level */ - - Search = Search->Common.Parent; - } - - if (Prev) - { - OpInfo = AcpiPsGetOpcodeInfo (Search->Common.AmlOpcode); - if (!(OpInfo->Flags & AML_FIELD)) - { - /* Below root scope, append scope name */ - - if (DoDot) - { - /* Append dot */ - - AcpiOsPrintf ("."); - } - - if (OpInfo->Flags & AML_CREATE) - { - if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) - { - NamePath = AcpiPsGetArg (Op, 3); - } - else - { - NamePath = AcpiPsGetArg (Op, 2); - } - - if ((NamePath) && - (NamePath->Common.Value.String)) - { - AcpiDmDumpName (NamePath->Common.Value.String); - } - } - else - { - Name = AcpiPsGetName (Search); - AcpiDmDumpName ((char *) &Name); - } - - DoDot = TRUE; - } - } - Prev = Search; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmValidateName - * - * PARAMETERS: Name - 4 character ACPI name - * - * RETURN: None - * - * DESCRIPTION: Lookup the name - * - ******************************************************************************/ - -void -AcpiDmValidateName ( - char *Name, - ACPI_PARSE_OBJECT *Op) -{ - - if ((!Name) || - (!Op->Common.Parent)) - { - return; - } - - if (!Op->Common.Node) - { - AcpiOsPrintf ( - " /**** Name not found or not accessible from this scope ****/ "); - } - - ACPI_PARSE_OBJECT *TargetOp; - - - if ((!Name) || - (!Op->Common.Parent)) - { - return; - } - - TargetOp = AcpiPsFind (Op, Name, 0, 0); - if (!TargetOp) - { - /* - * Didn't find the name in the parse tree. This may be - * a problem, or it may simply be one of the predefined names - * (such as _OS_). Rather than worry about looking up all - * the predefined names, just display the name as given - */ - AcpiOsPrintf ( - " /**** Name not found or not accessible from this scope ****/ "); - } -} -#endif - -#endif - - diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmobject.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmobject.c deleted file mode 100644 index 6156caed59..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmobject.c +++ /dev/null @@ -1,661 +0,0 @@ -/******************************************************************************* - * - * Module Name: dmobject - ACPI object decode and display - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acdisasm.h" - - -#ifdef ACPI_DISASSEMBLER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dmnames") - -/* Local prototypes */ - -static void -AcpiDmDecodeNode ( - ACPI_NAMESPACE_NODE *Node); - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpMethodInfo - * - * PARAMETERS: Status - Method execution status - * WalkState - Current state of the parse tree walk - * Op - Executing parse op - * - * RETURN: None - * - * DESCRIPTION: Called when a method has been aborted because of an error. - * Dumps the method execution stack, and the method locals/args, - * and disassembles the AML opcode that failed. - * - ******************************************************************************/ - -void -AcpiDmDumpMethodInfo ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - ACPI_THREAD_STATE *Thread; - ACPI_WALK_STATE *NextWalkState; - ACPI_NAMESPACE_NODE *PreviousMethod = NULL; - - - /* Ignore control codes, they are not errors */ - - if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL) - { - return; - } - - /* We may be executing a deferred opcode */ - - if (WalkState->DeferredNode) - { - AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); - return; - } - - /* - * If there is no Thread, we are not actually executing a method. - * This can happen when the iASL compiler calls the interpreter - * to perform constant folding. - */ - Thread = WalkState->Thread; - if (!Thread) - { - return; - } - - /* Display exception and method name */ - - AcpiOsPrintf ("\n**** Exception %s during execution of method ", - AcpiFormatException (Status)); - AcpiNsPrintNodePathname (WalkState->MethodNode, NULL); - - /* Display stack of executing methods */ - - AcpiOsPrintf ("\n\nMethod Execution Stack:\n"); - NextWalkState = Thread->WalkStateList; - - /* Walk list of linked walk states */ - - while (NextWalkState) - { - AcpiOsPrintf (" Method [%4.4s] executing: ", - AcpiUtGetNodeName (NextWalkState->MethodNode)); - - /* First method is the currently executing method */ - - if (NextWalkState == WalkState) - { - if (Op) - { - /* Display currently executing ASL statement */ - - Next = Op->Common.Next; - Op->Common.Next = NULL; - - AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX); - Op->Common.Next = Next; - } - } - else - { - /* - * This method has called another method - * NOTE: the method call parse subtree is already deleted at this - * point, so we cannot disassemble the method invocation. - */ - AcpiOsPrintf ("Call to method "); - AcpiNsPrintNodePathname (PreviousMethod, NULL); - } - - PreviousMethod = NextWalkState->MethodNode; - NextWalkState = NextWalkState->Next; - AcpiOsPrintf ("\n"); - } - - /* Display the method locals and arguments */ - - AcpiOsPrintf ("\n"); - AcpiDmDisplayLocals (WalkState); - AcpiOsPrintf ("\n"); - AcpiDmDisplayArguments (WalkState); - AcpiOsPrintf ("\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDecodeInternalObject - * - * PARAMETERS: ObjDesc - Object to be displayed - * - * RETURN: None - * - * DESCRIPTION: Short display of an internal object. Numbers/Strings/Buffers. - * - ******************************************************************************/ - -void -AcpiDmDecodeInternalObject ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - UINT32 i; - - - if (!ObjDesc) - { - AcpiOsPrintf (" Uninitialized"); - return; - } - - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) - { - AcpiOsPrintf (" %p [%s]", ObjDesc, AcpiUtGetDescriptorName (ObjDesc)); - return; - } - - AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc)); - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - AcpiOsPrintf (" %8.8X%8.8X", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - - case ACPI_TYPE_STRING: - - AcpiOsPrintf ("(%d) \"%.24s", - ObjDesc->String.Length, ObjDesc->String.Pointer); - - if (ObjDesc->String.Length > 24) - { - AcpiOsPrintf ("..."); - } - else - { - AcpiOsPrintf ("\""); - } - break; - - - case ACPI_TYPE_BUFFER: - - AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length); - for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++) - { - AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); - } - break; - - - default: - - AcpiOsPrintf (" %p", ObjDesc); - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDecodeNode - * - * PARAMETERS: Node - Object to be displayed - * - * RETURN: None - * - * DESCRIPTION: Short display of a namespace node - * - ******************************************************************************/ - -static void -AcpiDmDecodeNode ( - ACPI_NAMESPACE_NODE *Node) -{ - - AcpiOsPrintf (" Name %4.4s", - AcpiUtGetNodeName (Node)); - - if (Node->Flags & ANOBJ_METHOD_ARG) - { - AcpiOsPrintf (" [Method Arg]"); - } - if (Node->Flags & ANOBJ_METHOD_LOCAL) - { - AcpiOsPrintf (" [Method Local]"); - } - - 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; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDisplayInternalObject - * - * PARAMETERS: ObjDesc - Object to be displayed - * WalkState - Current walk state - * - * RETURN: None - * - * DESCRIPTION: Short display of an internal object - * - ******************************************************************************/ - -void -AcpiDmDisplayInternalObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - UINT8 Type; - - - AcpiOsPrintf ("%p ", ObjDesc); - - if (!ObjDesc) - { - AcpiOsPrintf ("\n"); - return; - } - - /* Decode the object type */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) - { - case ACPI_DESC_TYPE_PARSER: - - AcpiOsPrintf (" "); - break; - - - case ACPI_DESC_TYPE_NAMED: - - AcpiDmDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc); - break; - - - case ACPI_DESC_TYPE_OPERAND: - - Type = ObjDesc->Common.Type; - if (Type > ACPI_TYPE_LOCAL_MAX) - { - AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type); - return; - } - - /* Decode the ACPI object type */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_LOCAL_REFERENCE: - - AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc)); - - /* Decode the refererence */ - - switch (ObjDesc->Reference.Class) - { - case ACPI_REFCLASS_LOCAL: - - AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); - if (WalkState) - { - ObjDesc = WalkState->LocalVariables - [ObjDesc->Reference.Value].Object; - AcpiOsPrintf ("%p", ObjDesc); - AcpiDmDecodeInternalObject (ObjDesc); - } - break; - - - case ACPI_REFCLASS_ARG: - - AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); - if (WalkState) - { - ObjDesc = WalkState->Arguments - [ObjDesc->Reference.Value].Object; - AcpiOsPrintf ("%p", ObjDesc); - AcpiDmDecodeInternalObject (ObjDesc); - } - break; - - - case ACPI_REFCLASS_INDEX: - - switch (ObjDesc->Reference.TargetType) - { - case ACPI_TYPE_BUFFER_FIELD: - - AcpiOsPrintf ("%p", ObjDesc->Reference.Object); - AcpiDmDecodeInternalObject (ObjDesc->Reference.Object); - break; - - case ACPI_TYPE_PACKAGE: - - AcpiOsPrintf ("%p", ObjDesc->Reference.Where); - if (!ObjDesc->Reference.Where) - { - AcpiOsPrintf (" Uninitialized WHERE pointer"); - } - else - { - AcpiDmDecodeInternalObject ( - *(ObjDesc->Reference.Where)); - } - break; - - default: - - AcpiOsPrintf ("Unknown index target type"); - break; - } - break; - - - case ACPI_REFCLASS_REFOF: - - if (!ObjDesc->Reference.Object) - { - AcpiOsPrintf ("Uninitialized reference subobject pointer"); - break; - } - - /* Reference can be to a Node or an Operand object */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object)) - { - case ACPI_DESC_TYPE_NAMED: - AcpiDmDecodeNode (ObjDesc->Reference.Object); - break; - - case ACPI_DESC_TYPE_OPERAND: - AcpiDmDecodeInternalObject (ObjDesc->Reference.Object); - break; - - default: - break; - } - break; - - - case ACPI_REFCLASS_NAME: - - AcpiDmDecodeNode (ObjDesc->Reference.Node); - break; - - - case ACPI_REFCLASS_DEBUG: - case ACPI_REFCLASS_TABLE: - - AcpiOsPrintf ("\n"); - break; - - - default: /* Unknown reference class */ - - AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class); - break; - } - break; - - - default: - - AcpiOsPrintf (" "); - AcpiDmDecodeInternalObject (ObjDesc); - break; - } - break; - - - default: - - AcpiOsPrintf (" [%s]", - AcpiUtGetDescriptorName (ObjDesc)); - break; - } - - AcpiOsPrintf ("\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDisplayLocals - * - * PARAMETERS: WalkState - State for current method - * - * RETURN: None - * - * DESCRIPTION: Display all locals for the currently running control method - * - ******************************************************************************/ - -void -AcpiDmDisplayLocals ( - ACPI_WALK_STATE *WalkState) -{ - UINT32 i; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - - - ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; - if (!Node) - { - AcpiOsPrintf ( - "No method node (Executing subtree for buffer or opregion)\n"); - return; - } - - if (Node->Type != ACPI_TYPE_METHOD) - { - AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); - return; - } - - AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", - AcpiUtGetNodeName (Node)); - - for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) - { - ObjDesc = WalkState->LocalVariables[i].Object; - AcpiOsPrintf (" Local%X: ", i); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDisplayArguments - * - * PARAMETERS: WalkState - State for current method - * - * RETURN: None - * - * DESCRIPTION: Display all arguments for the currently running control method - * - ******************************************************************************/ - -void -AcpiDmDisplayArguments ( - ACPI_WALK_STATE *WalkState) -{ - UINT32 i; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - - - ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; - if (!Node) - { - AcpiOsPrintf ( - "No method node (Executing subtree for buffer or opregion)\n"); - return; - } - - if (Node->Type != ACPI_TYPE_METHOD) - { - AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); - return; - } - - AcpiOsPrintf ( - "Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n", - AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount, ObjDesc->Method.SyncLevel); - - for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) - { - ObjDesc = WalkState->Arguments[i].Object; - AcpiOsPrintf (" Arg%d: ", i); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); - } -} - -#endif - - diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmopcode.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmopcode.c deleted file mode 100644 index bbc3a2d27f..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmopcode.c +++ /dev/null @@ -1,632 +0,0 @@ -/******************************************************************************* - * - * Module Name: dmopcode - AML disassembler, specific AML opcodes - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdisasm.h" - -#ifdef ACPI_DISASSEMBLER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dmopcode") - -/* Local prototypes */ - -static void -AcpiDmMatchKeyword ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: AcpiDmMethodFlags - * - * PARAMETERS: Op - Method Object to be examined - * - * RETURN: None - * - * DESCRIPTION: Decode control method flags - * - ******************************************************************************/ - -void -AcpiDmMethodFlags ( - ACPI_PARSE_OBJECT *Op) -{ - UINT32 Flags; - UINT32 Args; - - - /* The next Op contains the flags */ - - Op = AcpiPsGetDepthNext (NULL, Op); - Flags = (UINT8) Op->Common.Value.Integer; - Args = Flags & 0x07; - - /* Mark the Op as completed */ - - Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - - /* 1) Method argument count */ - - AcpiOsPrintf (", %d, ", Args); - - /* 2) Serialize rule */ - - if (!(Flags & 0x08)) - { - AcpiOsPrintf ("Not"); - } - - AcpiOsPrintf ("Serialized"); - - /* 3) SyncLevel */ - - if (Flags & 0xF0) - { - AcpiOsPrintf (", %d", Flags >> 4); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmFieldFlags - * - * PARAMETERS: Op - Field Object to be examined - * - * RETURN: None - * - * DESCRIPTION: Decode Field definition flags - * - ******************************************************************************/ - -void -AcpiDmFieldFlags ( - ACPI_PARSE_OBJECT *Op) -{ - UINT32 Flags; - - - Op = Op->Common.Next; - Flags = (UINT8) Op->Common.Value.Integer; - - /* Mark the Op as completed */ - - Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - - AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x07]); - AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]); - AcpiOsPrintf ("%s)", AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmAddressSpace - * - * PARAMETERS: SpaceId - ID to be translated - * - * RETURN: None - * - * DESCRIPTION: Decode a SpaceId to an AddressSpaceKeyword - * - ******************************************************************************/ - -void -AcpiDmAddressSpace ( - UINT8 SpaceId) -{ - - if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) - { - if (SpaceId == 0x7F) - { - AcpiOsPrintf ("FFixedHW, "); - } - else - { - AcpiOsPrintf ("0x%.2X, ", SpaceId); - } - } - else - { - AcpiOsPrintf ("%s, ", AcpiGbl_RegionTypes [SpaceId]); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmRegionFlags - * - * PARAMETERS: Op - Object to be examined - * - * RETURN: None - * - * DESCRIPTION: Decode OperationRegion flags - * - ******************************************************************************/ - -void -AcpiDmRegionFlags ( - ACPI_PARSE_OBJECT *Op) -{ - - - /* The next Op contains the SpaceId */ - - Op = AcpiPsGetDepthNext (NULL, Op); - - /* Mark the Op as completed */ - - Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - - AcpiOsPrintf (", "); - AcpiDmAddressSpace ((UINT8) Op->Common.Value.Integer); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmMatchOp - * - * PARAMETERS: Op - Match Object to be examined - * - * RETURN: None - * - * DESCRIPTION: Decode Match opcode operands - * - ******************************************************************************/ - -void -AcpiDmMatchOp ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *NextOp; - - - NextOp = AcpiPsGetDepthNext (NULL, Op); - NextOp = NextOp->Common.Next; - - if (!NextOp) - { - /* Handle partial tree during single-step */ - - return; - } - - /* Mark the two nodes that contain the encoding for the match keywords */ - - NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP; - - NextOp = NextOp->Common.Next; - NextOp = NextOp->Common.Next; - NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmMatchKeyword - * - * PARAMETERS: Op - Match Object to be examined - * - * RETURN: None - * - * DESCRIPTION: Decode Match opcode operands - * - ******************************************************************************/ - -static void -AcpiDmMatchKeyword ( - ACPI_PARSE_OBJECT *Op) -{ - - - if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE) - { - AcpiOsPrintf ("/* Unknown Match Keyword encoding */"); - } - else - { - AcpiOsPrintf ("%s", ACPI_CAST_PTR (char, - AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer])); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDisassembleOneOp - * - * PARAMETERS: WalkState - Current walk info - * Info - Parse tree walk info - * Op - Op that is to be printed - * - * RETURN: None - * - * DESCRIPTION: Disassemble a single AML opcode - * - ******************************************************************************/ - -void -AcpiDmDisassembleOneOp ( - ACPI_WALK_STATE *WalkState, - ACPI_OP_WALK_INFO *Info, - ACPI_PARSE_OBJECT *Op) -{ - const ACPI_OPCODE_INFO *OpInfo = NULL; - UINT32 Offset; - UINT32 Length; - ACPI_PARSE_OBJECT *Child; - ACPI_STATUS Status; - - - if (!Op) - { - AcpiOsPrintf (""); - return; - } - - switch (Op->Common.DisasmOpcode) - { - case ACPI_DASM_MATCHOP: - - AcpiDmMatchKeyword (Op); - return; - - case ACPI_DASM_LNOT_SUFFIX: - switch (Op->Common.AmlOpcode) - { - case AML_LEQUAL_OP: - AcpiOsPrintf ("LNotEqual"); - break; - - case AML_LGREATER_OP: - AcpiOsPrintf ("LLessEqual"); - break; - - case AML_LLESS_OP: - AcpiOsPrintf ("LGreaterEqual"); - break; - - default: - break; - } - Op->Common.DisasmOpcode = 0; - Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - return; - - default: - break; - } - - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* The op and arguments */ - - switch (Op->Common.AmlOpcode) - { - case AML_LNOT_OP: - - Child = Op->Common.Value.Arg; - if ((Child->Common.AmlOpcode == AML_LEQUAL_OP) || - (Child->Common.AmlOpcode == AML_LGREATER_OP) || - (Child->Common.AmlOpcode == AML_LLESS_OP)) - { - Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX; - Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX; - } - else - { - AcpiOsPrintf ("%s", OpInfo->Name); - } - break; - - case AML_BYTE_OP: - - AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer); - break; - - - case AML_WORD_OP: - - if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID) - { - AcpiDmEisaId ((UINT32) Op->Common.Value.Integer); - } - else - { - AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer); - } - break; - - - case AML_DWORD_OP: - - if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID) - { - AcpiDmEisaId ((UINT32) Op->Common.Value.Integer); - } - else - { - AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer); - } - break; - - - case AML_QWORD_OP: - - AcpiOsPrintf ("0x%8.8X%8.8X", - ACPI_FORMAT_UINT64 (Op->Common.Value.Integer)); - break; - - - case AML_STRING_OP: - - AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT8_MAX); - break; - - - case AML_BUFFER_OP: - - /* - * Determine the type of buffer. We can have one of the following: - * - * 1) ResourceTemplate containing Resource Descriptors. - * 2) Unicode String buffer - * 3) ASCII String buffer - * 4) Raw data buffer (if none of the above) - * - * Since there are no special AML opcodes to differentiate these - * types of buffers, we have to closely look at the data in the - * buffer to determine the type. - */ - Status = AcpiDmIsResourceTemplate (Op); - if (ACPI_SUCCESS (Status)) - { - Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; - AcpiOsPrintf ("ResourceTemplate"); - break; - } - else if (Status == AE_AML_NO_RESOURCE_END_TAG) - { - AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ "); - } - - if (AcpiDmIsUnicodeBuffer (Op)) - { - Op->Common.DisasmOpcode = ACPI_DASM_UNICODE; - AcpiOsPrintf ("Unicode ("); - } - else if (AcpiDmIsStringBuffer (Op)) - { - Op->Common.DisasmOpcode = ACPI_DASM_STRING; - AcpiOsPrintf ("Buffer"); - } - else - { - Op->Common.DisasmOpcode = ACPI_DASM_BUFFER; - AcpiOsPrintf ("Buffer"); - } - break; - - - case AML_INT_STATICSTRING_OP: - - if (Op->Common.Value.String) - { - AcpiOsPrintf ("%s", Op->Common.Value.String); - } - else - { - AcpiOsPrintf ("\"\""); - } - break; - - - case AML_INT_NAMEPATH_OP: - - AcpiDmNamestring (Op->Common.Value.Name); - break; - - - case AML_INT_NAMEDFIELD_OP: - - Length = AcpiDmDumpName (Op->Named.Name); - AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ", - (UINT32) Op->Common.Value.Integer); - AcpiDmCommaIfFieldMember (Op); - - Info->BitOffset += (UINT32) Op->Common.Value.Integer; - break; - - - case AML_INT_RESERVEDFIELD_OP: - - /* Offset() -- Must account for previous offsets */ - - Offset = (UINT32) Op->Common.Value.Integer; - Info->BitOffset += Offset; - - if (Info->BitOffset % 8 == 0) - { - AcpiOsPrintf (" Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset)); - } - else - { - AcpiOsPrintf (" , %d", Offset); - } - - AcpiDmCommaIfFieldMember (Op); - break; - - - case AML_INT_ACCESSFIELD_OP: - - AcpiOsPrintf (" AccessAs (%s, ", - AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer >> 8) & 0x7]); - - AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer); - AcpiOsPrintf (")"); - AcpiDmCommaIfFieldMember (Op); - break; - - - case AML_INT_BYTELIST_OP: - - AcpiDmByteList (Info, Op); - break; - - - case AML_INT_METHODCALL_OP: - - Op = AcpiPsGetDepthNext (NULL, Op); - Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - - AcpiDmNamestring (Op->Common.Value.Name); - break; - - - default: - - /* Just get the opcode name and print it */ - - AcpiOsPrintf ("%s", OpInfo->Name); - - -#ifdef ACPI_DEBUGGER - - if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) && - (WalkState) && - (WalkState->Results) && - (WalkState->ResultCount)) - { - AcpiDmDecodeInternalObject ( - WalkState->Results->Results.ObjDesc [ - (WalkState->ResultCount - 1) % - ACPI_RESULTS_FRAME_OBJ_NUM]); - } -#endif - - break; - } -} - -#endif /* ACPI_DISASSEMBLER */ diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrc.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrc.c deleted file mode 100644 index 12bde688d4..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrc.c +++ /dev/null @@ -1,509 +0,0 @@ -/******************************************************************************* - * - * Module Name: dmresrc.c - Resource Descriptor disassembly - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acdisasm.h" - -#ifdef ACPI_DISASSEMBLER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbresrc") - - -/* Dispatch tables for Resource disassembly functions */ - -typedef -void (*ACPI_RESOURCE_HANDLER) ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] = -{ - /* Small descriptors */ - - NULL, /* 0x00, Reserved */ - NULL, /* 0x01, Reserved */ - NULL, /* 0x02, Reserved */ - NULL, /* 0x03, Reserved */ - AcpiDmIrqDescriptor, /* 0x04, ACPI_RESOURCE_NAME_IRQ_FORMAT */ - AcpiDmDmaDescriptor, /* 0x05, ACPI_RESOURCE_NAME_DMA_FORMAT */ - AcpiDmStartDependentDescriptor, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ - AcpiDmEndDependentDescriptor, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ - AcpiDmIoDescriptor, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */ - AcpiDmFixedIoDescriptor, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */ - NULL, /* 0x0A, Reserved */ - NULL, /* 0x0B, Reserved */ - NULL, /* 0x0C, Reserved */ - NULL, /* 0x0D, Reserved */ - AcpiDmVendorSmallDescriptor, /* 0x0E, ACPI_RESOURCE_NAME_SMALL_VENDOR */ - NULL, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */ - - /* Large descriptors */ - - NULL, /* 0x00, Reserved */ - AcpiDmMemory24Descriptor, /* 0x01, ACPI_RESOURCE_NAME_MEMORY_24 */ - AcpiDmGenericRegisterDescriptor,/* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ - NULL, /* 0x03, Reserved */ - AcpiDmVendorLargeDescriptor, /* 0x04, ACPI_RESOURCE_NAME_LARGE_VENDOR */ - AcpiDmMemory32Descriptor, /* 0x05, ACPI_RESOURCE_NAME_MEMORY_32 */ - AcpiDmFixedMemory32Descriptor, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY_32 */ - AcpiDmDwordDescriptor, /* 0x07, ACPI_RESOURCE_NAME_DWORD_ADDRESS_SPACE */ - AcpiDmWordDescriptor, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */ - AcpiDmInterruptDescriptor, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */ - AcpiDmQwordDescriptor, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */ - AcpiDmExtendedDescriptor /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */ -}; - - -/* Only used for single-threaded applications */ -/* TBD: remove when name is passed as parameter to the dump functions */ - -static UINT32 ResourceName; - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDescriptorName - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Emit a name for the descriptor if one is present (indicated - * by the name being changed from the default name.) A name is only - * emitted if a reference to the descriptor has been made somewhere - * in the original ASL code. - * - ******************************************************************************/ - -void -AcpiDmDescriptorName ( - void) -{ - - if (ResourceName == ACPI_DEFAULT_RESNAME) - { - return; - } - - AcpiOsPrintf ("%4.4s", (char *) &ResourceName); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpInteger* - * - * PARAMETERS: Value - Value to emit - * Name - Associated name (emitted as a comment) - * - * RETURN: None - * - * DESCRIPTION: Integer output helper functions - * - ******************************************************************************/ - -void -AcpiDmDumpInteger8 ( - UINT8 Value, - char *Name) -{ - AcpiOsPrintf ("0x%2.2X, // %s\n", Value, Name); -} - -void -AcpiDmDumpInteger16 ( - UINT16 Value, - char *Name) -{ - AcpiOsPrintf ("0x%4.4X, // %s\n", Value, Name); -} - -void -AcpiDmDumpInteger32 ( - UINT32 Value, - char *Name) -{ - AcpiOsPrintf ("0x%8.8X, // %s\n", Value, Name); -} - -void -AcpiDmDumpInteger64 ( - UINT64 Value, - char *Name) -{ - AcpiOsPrintf ("0x%8.8X%8.8X, // %s\n", ACPI_FORMAT_UINT64 (Value), Name); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmBitList - * - * PARAMETERS: Mask - 16-bit value corresponding to 16 interrupt - * or DMA values - * - * RETURN: None - * - * DESCRIPTION: Dump a bit mask as a list of individual interrupt/DMA levels. - * - ******************************************************************************/ - -void -AcpiDmBitList ( - UINT16 Mask) -{ - UINT32 i; - BOOLEAN Previous = FALSE; - - - /* Open the initializer list */ - - AcpiOsPrintf ("{"); - - /* Examine each bit */ - - for (i = 0; i < 16; i++) - { - /* Only interested in bits that are set to 1 */ - - if (Mask & 1) - { - if (Previous) - { - AcpiOsPrintf (","); - } - Previous = TRUE; - AcpiOsPrintf ("%d", i); - } - - Mask >>= 1; - } - - /* Close list */ - - AcpiOsPrintf ("}\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmResourceTemplate - * - * PARAMETERS: Info - Curent parse tree walk info - * ByteData - Pointer to the byte list data - * ByteCount - Length of the byte list - * - * RETURN: None - * - * DESCRIPTION: Dump the contents of a Resource Template containing a set of - * Resource Descriptors. - * - ******************************************************************************/ - -void -AcpiDmResourceTemplate ( - ACPI_OP_WALK_INFO *Info, - ACPI_PARSE_OBJECT *Op, - UINT8 *ByteData, - UINT32 ByteCount) -{ - ACPI_STATUS Status; - UINT32 CurrentByteOffset; - UINT8 ResourceType; - UINT32 ResourceLength; - void *Aml; - UINT32 Level; - BOOLEAN DependentFns = FALSE; - UINT8 ResourceIndex; - ACPI_NAMESPACE_NODE *Node; - - - Level = Info->Level; - ResourceName = ACPI_DEFAULT_RESNAME; - Node = Op->Common.Node; - if (Node) - { - Node = Node->Child; - } - - for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount;) - { - Aml = &ByteData[CurrentByteOffset]; - - /* Get the descriptor type and length */ - - ResourceType = AcpiUtGetResourceType (Aml); - ResourceLength = AcpiUtGetResourceLength (Aml); - - /* Validate the Resource Type and Resource Length */ - - Status = AcpiUtValidateResource (Aml, &ResourceIndex); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n", - ResourceType, AcpiFormatException (Status)); - return; - } - - /* Point to next descriptor */ - - CurrentByteOffset += AcpiUtGetDescriptorLength (Aml); - - /* Descriptor pre-processing */ - - switch (ResourceType) - { - case ACPI_RESOURCE_NAME_START_DEPENDENT: - - /* Finish a previous StartDependentFns */ - - if (DependentFns) - { - Level--; - AcpiDmIndent (Level); - AcpiOsPrintf ("}\n"); - } - break; - - case ACPI_RESOURCE_NAME_END_DEPENDENT: - - Level--; - DependentFns = FALSE; - break; - - case ACPI_RESOURCE_NAME_END_TAG: - - /* Normal exit, the resource list is finished */ - - if (DependentFns) - { - /* - * Close an open StartDependentDescriptor. This indicates a - * missing EndDependentDescriptor. - */ - Level--; - DependentFns = FALSE; - - /* Go ahead and insert EndDependentFn() */ - - AcpiDmEndDependentDescriptor (Aml, ResourceLength, Level); - - AcpiDmIndent (Level); - AcpiOsPrintf ( - "/*** Disassembler: inserted missing EndDependentFn () ***/\n"); - } - return; - - default: - break; - } - - /* Disassemble the resource structure */ - - if (Node) - { - ResourceName = Node->Name.Integer; - Node = Node->Peer; - } - - AcpiGbl_DmResourceDispatch [ResourceIndex] ( - Aml, ResourceLength, Level); - - /* Descriptor post-processing */ - - if (ResourceType == ACPI_RESOURCE_NAME_START_DEPENDENT) - { - DependentFns = TRUE; - Level++; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsResourceTemplate - * - * PARAMETERS: Op - Buffer Op to be examined - * - * RETURN: Status. AE_OK if valid template - * - * DESCRIPTION: Walk a byte list to determine if it consists of a valid set - * of resource descriptors. Nothing is output. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDmIsResourceTemplate ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *NextOp; - UINT8 *Aml; - UINT8 *EndAml; - ACPI_SIZE Length; - - - /* This op must be a buffer */ - - if (Op->Common.AmlOpcode != AML_BUFFER_OP) - { - return (AE_TYPE); - } - - /* Get the ByteData list and length */ - - NextOp = Op->Common.Value.Arg; - NextOp = NextOp->Common.Next; - if (!NextOp) - { - return (AE_TYPE); - } - - Aml = NextOp->Named.Data; - Length = (ACPI_SIZE) NextOp->Common.Value.Integer; - - /* Walk the byte list, abort on any invalid descriptor type or length */ - - Status = AcpiUtWalkAmlResources (Aml, Length, NULL, &EndAml); - if (ACPI_FAILURE (Status)) - { - return (AE_TYPE); - } - - /* - * For the resource template to be valid, one EndTag must appear - * at the very end of the ByteList, not before. (For proper disassembly - * of a ResourceTemplate, the buffer must not have any extra data after - * the EndTag.) - */ - if ((Aml + Length - sizeof (AML_RESOURCE_END_TAG)) != EndAml) - { - return (AE_AML_NO_RESOURCE_END_TAG); - } - - /* - * All resource descriptors are valid, therefore this list appears - * to be a valid resource template - */ - return (AE_OK); -} - -#endif diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcl.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcl.c deleted file mode 100644 index d8a549b58c..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcl.c +++ /dev/null @@ -1,1125 +0,0 @@ -/******************************************************************************* - * - * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acdisasm.h" - - -#ifdef ACPI_DISASSEMBLER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbresrcl") - - -/* Common names for address and memory descriptors */ - -static char *AcpiDmAddressNames[] = -{ - "Granularity", - "Range Minimum", - "Range Maximum", - "Translation Offset", - "Length" -}; - -static char *AcpiDmMemoryNames[] = -{ - "Range Minimum", - "Range Maximum", - "Alignment", - "Length" -}; - - -/* Local prototypes */ - -static void -AcpiDmSpaceFlags ( - UINT8 Flags); - -static void -AcpiDmIoFlags ( - UINT8 Flags); - -static void -AcpiDmIoFlags2 ( - UINT8 SpecificFlags); - -static void -AcpiDmMemoryFlags ( - UINT8 Flags, - UINT8 SpecificFlags); - -static void -AcpiDmMemoryFlags2 ( - UINT8 SpecificFlags); - -static void -AcpiDmResourceSource ( - AML_RESOURCE *Resource, - ACPI_SIZE MinimumLength, - UINT32 Length); - -static void -AcpiDmAddressFields ( - void *Source, - UINT8 Type, - UINT32 Level); - -static void -AcpiDmAddressPrefix ( - UINT8 Type); - -static void -AcpiDmAddressCommon ( - AML_RESOURCE *Resource, - UINT8 Type, - UINT32 Level); - -static void -AcpiDmAddressFlags ( - AML_RESOURCE *Resource); - - -/******************************************************************************* - * - * FUNCTION: AcpiDmMemoryFields - * - * PARAMETERS: Source - Pointer to the contiguous data fields - * Type - 16 or 32 (bit) - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors - * - ******************************************************************************/ - -static void -AcpiDmMemoryFields ( - void *Source, - UINT8 Type, - UINT32 Level) -{ - UINT32 i; - - - for (i = 0; i < 4; i++) - { - AcpiDmIndent (Level + 1); - - switch (Type) - { - case 16: - AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i], - AcpiDmMemoryNames[i]); - break; - - case 32: - AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i], - AcpiDmMemoryNames[i]); - break; - - default: - return; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmAddressFields - * - * PARAMETERS: Source - Pointer to the contiguous data fields - * Type - 16, 32, or 64 (bit) - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode fields common to address descriptors - * - ******************************************************************************/ - -static void -AcpiDmAddressFields ( - void *Source, - UINT8 Type, - UINT32 Level) -{ - UINT32 i; - - - AcpiOsPrintf ("\n"); - - for (i = 0; i < 5; i++) - { - AcpiDmIndent (Level + 1); - - switch (Type) - { - case 16: - AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i], - AcpiDmAddressNames[i]); - break; - - case 32: - AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i], - AcpiDmAddressNames[i]); - break; - - case 64: - AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i], - AcpiDmAddressNames[i]); - break; - - default: - return; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmAddressPrefix - * - * PARAMETERS: Type - Descriptor type - * - * RETURN: None - * - * DESCRIPTION: Emit name prefix representing the address descriptor type - * - ******************************************************************************/ - -static void -AcpiDmAddressPrefix ( - UINT8 Type) -{ - - switch (Type) - { - case ACPI_RESOURCE_TYPE_ADDRESS16: - AcpiOsPrintf ("Word"); - break; - - case ACPI_RESOURCE_TYPE_ADDRESS32: - AcpiOsPrintf ("DWord"); - break; - - case ACPI_RESOURCE_TYPE_ADDRESS64: - AcpiOsPrintf ("QWord"); - break; - - case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: - AcpiOsPrintf ("Extended"); - break; - - default: - return; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmAddressCommon - * - * PARAMETERS: Resource - Raw AML descriptor - * Type - Descriptor type - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Emit common name and flag fields common to address descriptors - * - ******************************************************************************/ - -static void -AcpiDmAddressCommon ( - AML_RESOURCE *Resource, - UINT8 Type, - UINT32 Level) -{ - UINT8 ResourceType; - UINT8 SpecificFlags; - UINT8 Flags; - - - ResourceType = Resource->Address.ResourceType; - SpecificFlags = Resource->Address.SpecificFlags; - Flags = Resource->Address.Flags; - - AcpiDmIndent (Level); - - /* Validate ResourceType */ - - if ((ResourceType > 2) && (ResourceType < 0xC0)) - { - AcpiOsPrintf ("/**** Invalid Resource Type: 0x%X ****/", ResourceType); - return; - } - - /* Prefix is either Word, DWord, QWord, or Extended */ - - AcpiDmAddressPrefix (Type); - - /* Resource Types above 0xC0 are vendor-defined */ - - if (ResourceType > 2) - { - AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType); - AcpiDmSpaceFlags (Flags); - AcpiOsPrintf (" 0x%2.2X,", SpecificFlags); - return; - } - - /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */ - - AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType & 0x3]); - - /* Decode the general and type-specific flags */ - - if (ResourceType == ACPI_MEMORY_RANGE) - { - AcpiDmMemoryFlags (Flags, SpecificFlags); - } - else /* IO range or BusNumberRange */ - { - AcpiDmIoFlags (Flags); - if (ResourceType == ACPI_IO_RANGE) - { - AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [SpecificFlags & 0x3]); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmAddressFlags - * - * PARAMETERS: Resource - Raw AML descriptor - * - * RETURN: None - * - * DESCRIPTION: Emit flags common to address descriptors - * - ******************************************************************************/ - -static void -AcpiDmAddressFlags ( - AML_RESOURCE *Resource) -{ - - if (Resource->Address.ResourceType == ACPI_IO_RANGE) - { - AcpiDmIoFlags2 (Resource->Address.SpecificFlags); - } - else if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE) - { - AcpiDmMemoryFlags2 (Resource->Address.SpecificFlags); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmSpaceFlags - * - * PARAMETERS: Flags - Flag byte to be decoded - * - * RETURN: None - * - * DESCRIPTION: Decode the flags specific to Space Address space descriptors - * - ******************************************************************************/ - -static void -AcpiDmSpaceFlags ( - UINT8 Flags) -{ - - AcpiOsPrintf ("%s, %s, %s, %s,", - AcpiGbl_ConsumeDecode [(Flags & 1)], - AcpiGbl_DecDecode [(Flags & 0x2) >> 1], - AcpiGbl_MinDecode [(Flags & 0x4) >> 2], - AcpiGbl_MaxDecode [(Flags & 0x8) >> 3]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmIoFlags - * - * PARAMETERS: Flags - Flag byte to be decoded - * - * RETURN: None - * - * DESCRIPTION: Decode the flags specific to IO Address space descriptors - * - ******************************************************************************/ - -static void -AcpiDmIoFlags ( - UINT8 Flags) -{ - AcpiOsPrintf ("%s, %s, %s, %s,", - AcpiGbl_ConsumeDecode [(Flags & 1)], - AcpiGbl_MinDecode [(Flags & 0x4) >> 2], - AcpiGbl_MaxDecode [(Flags & 0x8) >> 3], - AcpiGbl_DecDecode [(Flags & 0x2) >> 1]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmIoFlags2 - * - * PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded - * - * RETURN: None - * - * DESCRIPTION: Decode the flags specific to IO Address space descriptors - * - ******************************************************************************/ - -static void -AcpiDmIoFlags2 ( - UINT8 SpecificFlags) -{ - - AcpiOsPrintf (", %s", - AcpiGbl_TtpDecode [(SpecificFlags & 0x10) >> 4]); - - /* TRS is only used if TTP is TypeTranslation */ - - if (SpecificFlags & 0x10) - { - AcpiOsPrintf (", %s", - AcpiGbl_TrsDecode [(SpecificFlags & 0x20) >> 5]); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmMemoryFlags - * - * PARAMETERS: Flags - Flag byte to be decoded - * SpecificFlags - "Specific" flag byte to be decoded - * - * RETURN: None - * - * DESCRIPTION: Decode flags specific to Memory Address Space descriptors - * - ******************************************************************************/ - -static void -AcpiDmMemoryFlags ( - UINT8 Flags, - UINT8 SpecificFlags) -{ - - AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,", - AcpiGbl_ConsumeDecode [(Flags & 1)], - AcpiGbl_DecDecode [(Flags & 0x2) >> 1], - AcpiGbl_MinDecode [(Flags & 0x4) >> 2], - AcpiGbl_MaxDecode [(Flags & 0x8) >> 3], - AcpiGbl_MemDecode [(SpecificFlags & 0x6) >> 1], - AcpiGbl_RwDecode [(SpecificFlags & 0x1)]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmMemoryFlags2 - * - * PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded - * - * RETURN: None - * - * DESCRIPTION: Decode flags specific to Memory Address Space descriptors - * - ******************************************************************************/ - -static void -AcpiDmMemoryFlags2 ( - UINT8 SpecificFlags) -{ - - AcpiOsPrintf (", %s, %s", - AcpiGbl_MtpDecode [(SpecificFlags & 0x18) >> 3], - AcpiGbl_TtpDecode [(SpecificFlags & 0x20) >> 5]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmResourceSource - * - * PARAMETERS: Resource - Raw AML descriptor - * MinimumLength - descriptor length without optional fields - * ResourceLength - * - * RETURN: None - * - * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor - * - ******************************************************************************/ - -static void -AcpiDmResourceSource ( - AML_RESOURCE *Resource, - ACPI_SIZE MinimumTotalLength, - UINT32 ResourceLength) -{ - UINT8 *AmlResourceSource; - UINT32 TotalLength; - - - TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER); - - /* Check if the optional ResourceSource fields are present */ - - if (TotalLength <= MinimumTotalLength) - { - /* The two optional fields are not used */ - - AcpiOsPrintf (",, "); - return; - } - - /* Get a pointer to the ResourceSource */ - - AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength); - - /* - * Always emit the ResourceSourceIndex (Byte) - * - * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the - * Index even if the String does not exist. Although this is in violation - * of the ACPI specification, it is very important to emit ASL code that - * can be compiled back to the identical AML. There may be fields and/or - * indexes into the resource template buffer that are compiled to absolute - * offsets, and these will be broken if the AML length is changed. - */ - AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]); - - /* Make sure that the ResourceSource string exists before dumping it */ - - if (TotalLength > (MinimumTotalLength + 1)) - { - AcpiOsPrintf (" "); - AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX); - } - - AcpiOsPrintf (", "); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmWordDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Word Address Space descriptor - * - ******************************************************************************/ - -void -AcpiDmWordDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - /* Dump resource name and flags */ - - AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS16, Level); - - /* Dump the 5 contiguous WORD values */ - - AcpiDmAddressFields (&Resource->Address16.Granularity, 16, Level); - - /* The ResourceSource fields are optional */ - - AcpiDmIndent (Level + 1); - AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length); - - /* Insert a descriptor name */ - - AcpiDmDescriptorName (); - - /* Type-specific flags */ - - AcpiDmAddressFlags (Resource); - AcpiOsPrintf (")\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDwordDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a DWord Address Space descriptor - * - ******************************************************************************/ - -void -AcpiDmDwordDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - /* Dump resource name and flags */ - - AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS32, Level); - - /* Dump the 5 contiguous DWORD values */ - - AcpiDmAddressFields (&Resource->Address32.Granularity, 32, Level); - - /* The ResourceSource fields are optional */ - - AcpiDmIndent (Level + 1); - AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length); - - /* Insert a descriptor name */ - - AcpiDmDescriptorName (); - - /* Type-specific flags */ - - AcpiDmAddressFlags (Resource); - AcpiOsPrintf (")\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmQwordDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a QWord Address Space descriptor - * - ******************************************************************************/ - -void -AcpiDmQwordDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - /* Dump resource name and flags */ - - AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS64, Level); - - /* Dump the 5 contiguous QWORD values */ - - AcpiDmAddressFields (&Resource->Address64.Granularity, 64, Level); - - /* The ResourceSource fields are optional */ - - AcpiDmIndent (Level + 1); - AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length); - - /* Insert a descriptor name */ - - AcpiDmDescriptorName (); - - /* Type-specific flags */ - - AcpiDmAddressFlags (Resource); - AcpiOsPrintf (")\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmExtendedDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Extended Address Space descriptor - * - ******************************************************************************/ - -void -AcpiDmExtendedDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - /* Dump resource name and flags */ - - AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level); - - /* Dump the 5 contiguous QWORD values */ - - AcpiDmAddressFields (&Resource->ExtAddress64.Granularity, 64, Level); - - /* Extra field for this descriptor only */ - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific, - "Type-Specific Attributes"); - - /* Insert a descriptor name */ - - AcpiDmIndent (Level + 1); - AcpiDmDescriptorName (); - - /* Type-specific flags */ - - AcpiDmAddressFlags (Resource); - AcpiOsPrintf (")\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmMemory24Descriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Memory24 descriptor - * - ******************************************************************************/ - -void -AcpiDmMemory24Descriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - /* Dump name and read/write flag */ - - AcpiDmIndent (Level); - AcpiOsPrintf ("Memory24 (%s,\n", - AcpiGbl_RwDecode [Resource->Memory24.Flags & 1]); - - /* Dump the 4 contiguous WORD values */ - - AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level); - - /* Insert a descriptor name */ - - AcpiDmIndent (Level + 1); - AcpiDmDescriptorName (); - AcpiOsPrintf (")\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmMemory32Descriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Memory32 descriptor - * - ******************************************************************************/ - -void -AcpiDmMemory32Descriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - /* Dump name and read/write flag */ - - AcpiDmIndent (Level); - AcpiOsPrintf ("Memory32 (%s,\n", - AcpiGbl_RwDecode [Resource->Memory32.Flags & 1]); - - /* Dump the 4 contiguous DWORD values */ - - AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level); - - /* Insert a descriptor name */ - - AcpiDmIndent (Level + 1); - AcpiDmDescriptorName (); - AcpiOsPrintf (")\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmFixedMemory32Descriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Fixed Memory32 descriptor - * - ******************************************************************************/ - -void -AcpiDmFixedMemory32Descriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - /* Dump name and read/write flag */ - - AcpiDmIndent (Level); - AcpiOsPrintf ("Memory32Fixed (%s,\n", - AcpiGbl_RwDecode [Resource->FixedMemory32.Flags & 1]); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base"); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length"); - - /* Insert a descriptor name */ - - AcpiDmIndent (Level + 1); - AcpiDmDescriptorName (); - AcpiOsPrintf (")\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmGenericRegisterDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Generic Register descriptor - * - ******************************************************************************/ - -void -AcpiDmGenericRegisterDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - AcpiDmIndent (Level); - AcpiOsPrintf ("Register ("); - AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId); - AcpiOsPrintf ("\n"); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width"); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset"); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address"); - - /* Optional field for ACPI 3.0 */ - - AcpiDmIndent (Level + 1); - if (Resource->GenericReg.AccessSize) - { - AcpiOsPrintf ("0x%2.2X, // %s\n", - Resource->GenericReg.AccessSize, "Access Size"); - AcpiDmIndent (Level + 1); - } - else - { - AcpiOsPrintf (","); - } - - /* DescriptorName was added for ACPI 3.0+ */ - - AcpiDmDescriptorName (); - AcpiOsPrintf (")\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmInterruptDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a extended Interrupt descriptor - * - ******************************************************************************/ - -void -AcpiDmInterruptDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - UINT32 i; - - - AcpiDmIndent (Level); - AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ", - AcpiGbl_ConsumeDecode [(Resource->ExtendedIrq.Flags & 1)], - AcpiGbl_HeDecode [(Resource->ExtendedIrq.Flags >> 1) & 1], - AcpiGbl_LlDecode [(Resource->ExtendedIrq.Flags >> 2) & 1], - AcpiGbl_ShrDecode [(Resource->ExtendedIrq.Flags >> 3) & 1]); - - /* - * The ResourceSource fields are optional and appear after the interrupt - * list. Must compute length based on length of the list. First xrupt - * is included in the struct (reason for -1 below) - */ - AcpiDmResourceSource (Resource, - sizeof (AML_RESOURCE_EXTENDED_IRQ) + - ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32), - Resource->ExtendedIrq.ResourceLength); - - /* Insert a descriptor name */ - - AcpiDmDescriptorName (); - AcpiOsPrintf (")\n"); - - /* Dump the interrupt list */ - - AcpiDmIndent (Level); - AcpiOsPrintf ("{\n"); - for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++) - { - AcpiDmIndent (Level + 1); - AcpiOsPrintf ("0x%8.8X,\n", - (UINT32) Resource->ExtendedIrq.Interrupts[i]); - } - - AcpiDmIndent (Level); - AcpiOsPrintf ("}\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmVendorCommon - * - * PARAMETERS: Name - Descriptor name suffix - * ByteData - Pointer to the vendor byte data - * Length - Length of the byte data - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Vendor descriptor, both Large and Small - * - ******************************************************************************/ - -void -AcpiDmVendorCommon ( - char *Name, - UINT8 *ByteData, - UINT32 Length, - UINT32 Level) -{ - - /* Dump macro name */ - - AcpiDmIndent (Level); - AcpiOsPrintf ("Vendor%s (", Name); - - /* Insert a descriptor name */ - - AcpiDmDescriptorName (); - AcpiOsPrintf (") // Length = 0x%.2X\n", Length); - - /* Dump the vendor bytes */ - - AcpiDmIndent (Level); - AcpiOsPrintf ("{\n"); - - AcpiDmDisasmByteList (Level + 1, ByteData, Length); - - AcpiDmIndent (Level); - AcpiOsPrintf ("}\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmVendorLargeDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Vendor Large descriptor - * - ******************************************************************************/ - -void -AcpiDmVendorLargeDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - AcpiDmVendorCommon ("Long ", - ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)), - Length, Level); -} - -#endif - diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcs.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcs.c deleted file mode 100644 index 6af288b1e8..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcs.c +++ /dev/null @@ -1,387 +0,0 @@ -/******************************************************************************* - * - * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acdisasm.h" - - -#ifdef ACPI_DISASSEMBLER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbresrcs") - - -/******************************************************************************* - * - * FUNCTION: AcpiDmIrqDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a IRQ descriptor, either Irq() or IrqNoFlags() - * - ******************************************************************************/ - -void -AcpiDmIrqDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - AcpiDmIndent (Level); - AcpiOsPrintf ("%s (", - AcpiGbl_IrqDecode [Length & 1]); - - /* Decode flags byte if present */ - - if (Length & 1) - { - AcpiOsPrintf ("%s, %s, %s, ", - AcpiGbl_HeDecode [Resource->Irq.Flags & 1], - AcpiGbl_LlDecode [(Resource->Irq.Flags >> 3) & 1], - AcpiGbl_ShrDecode [(Resource->Irq.Flags >> 4) & 1]); - } - - /* Insert a descriptor name */ - - AcpiDmDescriptorName (); - AcpiOsPrintf (")\n"); - - AcpiDmIndent (Level + 1); - AcpiDmBitList (Resource->Irq.IrqMask); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDmaDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a DMA descriptor - * - ******************************************************************************/ - -void -AcpiDmDmaDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - AcpiDmIndent (Level); - AcpiOsPrintf ("DMA (%s, %s, %s, ", - AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3], - AcpiGbl_BmDecode [(Resource->Dma.Flags >> 2) & 1], - AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]); - - /* Insert a descriptor name */ - - AcpiDmDescriptorName (); - AcpiOsPrintf (")\n"); - - AcpiDmIndent (Level + 1); - AcpiDmBitList (Resource->Dma.DmaChannelMask); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmIoDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode an IO descriptor - * - ******************************************************************************/ - -void -AcpiDmIoDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - AcpiDmIndent (Level); - AcpiOsPrintf ("IO (%s,\n", - AcpiGbl_IoDecode [(Resource->Io.Flags & 1)]); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum"); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum"); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment"); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Length"); - - /* Insert a descriptor name */ - - AcpiDmIndent (Level + 1); - AcpiDmDescriptorName (); - AcpiOsPrintf (")\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmFixedIoDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Fixed IO descriptor - * - ******************************************************************************/ - -void -AcpiDmFixedIoDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - AcpiDmIndent (Level); - AcpiOsPrintf ("FixedIO (\n"); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address"); - - AcpiDmIndent (Level + 1); - AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length"); - - /* Insert a descriptor name */ - - AcpiDmIndent (Level + 1); - AcpiDmDescriptorName (); - AcpiOsPrintf (")\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmStartDependentDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Start Dependendent functions descriptor - * - ******************************************************************************/ - -void -AcpiDmStartDependentDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - AcpiDmIndent (Level); - - if (Length & 1) - { - AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n", - (UINT32) Resource->StartDpf.Flags & 3, - (UINT32) (Resource->StartDpf.Flags >> 2) & 3); - } - else - { - AcpiOsPrintf ("StartDependentFnNoPri ()\n"); - } - - AcpiDmIndent (Level); - AcpiOsPrintf ("{\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmEndDependentDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode an End Dependent functions descriptor - * - ******************************************************************************/ - -void -AcpiDmEndDependentDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - AcpiDmIndent (Level); - AcpiOsPrintf ("}\n"); - AcpiDmIndent (Level); - AcpiOsPrintf ("EndDependentFn ()\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmVendorSmallDescriptor - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Length - Length of the descriptor in bytes - * Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Decode a Vendor Small Descriptor - * - ******************************************************************************/ - -void -AcpiDmVendorSmallDescriptor ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level) -{ - - AcpiDmVendorCommon ("Short", - ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)), - Length, Level); -} - -#endif - diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmutils.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmutils.c deleted file mode 100644 index 7eea82ed5f..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmutils.c +++ /dev/null @@ -1,375 +0,0 @@ -/******************************************************************************* - * - * Module Name: dmutils - AML disassembler utilities - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acdisasm.h" - -#ifdef ACPI_ASL_COMPILER -#include -#endif - -#ifdef ACPI_DISASSEMBLER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dmutils") - - -/* Data used in keeping track of fields */ -#if 0 -const char *AcpiGbl_FENames[] = -{ - "skip", - "?access?" -}; /* FE = Field Element */ -#endif - -/* Operators for Match() */ - -const char *AcpiGbl_MatchOps[] = -{ - "MTR", - "MEQ", - "MLE", - "MLT", - "MGE", - "MGT" -}; - -/* Access type decoding */ - -const char *AcpiGbl_AccessTypes[] = -{ - "AnyAcc", - "ByteAcc", - "WordAcc", - "DWordAcc", - "QWordAcc", - "BufferAcc", - "InvalidAccType", - "InvalidAccType" -}; - -/* Lock rule decoding */ - -const char *AcpiGbl_LockRule[] = -{ - "NoLock", - "Lock" -}; - -/* Update rule decoding */ - -const char *AcpiGbl_UpdateRules[] = -{ - "Preserve", - "WriteAsOnes", - "WriteAsZeros", - "InvalidUpdateRule" -}; - -/* Strings used to decode resource descriptors */ - -const char *AcpiGbl_WordDecode[] = -{ - "Memory", - "IO", - "BusNumber", - "UnknownResourceType" -}; - -const char *AcpiGbl_IrqDecode[] = -{ - "IRQNoFlags", - "IRQ" -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDecodeAttribute - * - * PARAMETERS: Attribute - Attribute field of AccessAs keyword - * - * RETURN: None - * - * DESCRIPTION: Decode the AccessAs attribute byte. (Mostly SMBus stuff) - * - ******************************************************************************/ - -void -AcpiDmDecodeAttribute ( - UINT8 Attribute) -{ - - switch (Attribute) - { - case AML_FIELD_ATTRIB_SMB_QUICK: - - AcpiOsPrintf ("SMBQuick"); - break; - - case AML_FIELD_ATTRIB_SMB_SEND_RCV: - - AcpiOsPrintf ("SMBSendReceive"); - break; - - case AML_FIELD_ATTRIB_SMB_BYTE: - - AcpiOsPrintf ("SMBByte"); - break; - - case AML_FIELD_ATTRIB_SMB_WORD: - - AcpiOsPrintf ("SMBWord"); - break; - - case AML_FIELD_ATTRIB_SMB_WORD_CALL: - - AcpiOsPrintf ("SMBProcessCall"); - break; - - case AML_FIELD_ATTRIB_SMB_BLOCK: - - AcpiOsPrintf ("SMBBlock"); - break; - - case AML_FIELD_ATTRIB_SMB_BLOCK_CALL: - - AcpiOsPrintf ("SMBBlockProcessCall"); - break; - - default: - - AcpiOsPrintf ("0x%.2X", Attribute); - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmIndent - * - * PARAMETERS: Level - Current source code indentation level - * - * RETURN: None - * - * DESCRIPTION: Indent 4 spaces per indentation level. - * - ******************************************************************************/ - -void -AcpiDmIndent ( - UINT32 Level) -{ - - if (!Level) - { - return; - } - - AcpiOsPrintf ("%*.s", ACPI_MUL_4 (Level), " "); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmCommaIfListMember - * - * PARAMETERS: Op - Current operator/operand - * - * RETURN: TRUE if a comma was inserted - * - * DESCRIPTION: Insert a comma if this Op is a member of an argument list. - * - ******************************************************************************/ - -BOOLEAN -AcpiDmCommaIfListMember ( - ACPI_PARSE_OBJECT *Op) -{ - - if (!Op->Common.Next) - { - return FALSE; - } - - if (AcpiDmListType (Op->Common.Parent) & BLOCK_COMMA_LIST) - { - /* Check for a NULL target operand */ - - if ((Op->Common.Next->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && - (!Op->Common.Next->Common.Value.String)) - { - /* - * To handle the Divide() case where there are two optional - * targets, look ahead one more op. If null, this null target - * is the one and only target -- no comma needed. Otherwise, - * we need a comma to prepare for the next target. - */ - if (!Op->Common.Next->Common.Next) - { - return FALSE; - } - } - - if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) && - (!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))) - { - return FALSE; - } - - AcpiOsPrintf (", "); - return (TRUE); - } - - else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) && - (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) - { - AcpiOsPrintf (", "); - return (TRUE); - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmCommaIfFieldMember - * - * PARAMETERS: Op - Current operator/operand - * - * RETURN: None - * - * DESCRIPTION: Insert a comma if this Op is a member of a Field argument list. - * - ******************************************************************************/ - -void -AcpiDmCommaIfFieldMember ( - ACPI_PARSE_OBJECT *Op) -{ - - if (Op->Common.Next) - { - AcpiOsPrintf (", "); - } -} - -#endif diff --git a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmwalk.c b/src/add-ons/kernel/bus_managers/acpi/disassembler/dmwalk.c deleted file mode 100644 index f460e6ac3f..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/disassembler/dmwalk.c +++ /dev/null @@ -1,1006 +0,0 @@ -/******************************************************************************* - * - * Module Name: dmwalk - AML disassembly tree walk - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdisasm.h" -#include "acdebug.h" - - -#ifdef ACPI_DISASSEMBLER - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dmwalk") - - -#define DB_FULL_OP_INFO "[%4.4s] @%5.5X #%4.4X: " - -/* Stub for non-compiler code */ - -#ifndef ACPI_ASL_COMPILER -void -AcpiDmEmitExternals ( - void) -{ - return; -} -#endif - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDmDescendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -AcpiDmAscendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static UINT32 -AcpiDmBlockType ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDisassemble - * - * PARAMETERS: WalkState - Current state - * Origin - Starting object - * NumOpcodes - Max number of opcodes to be displayed - * - * RETURN: None - * - * DESCRIPTION: Disassemble parser object and its children. This is the - * main entry point of the disassembler. - * - ******************************************************************************/ - -void -AcpiDmDisassemble ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Origin, - UINT32 NumOpcodes) -{ - ACPI_PARSE_OBJECT *Op = Origin; - ACPI_OP_WALK_INFO Info; - - - if (!Op) - { - return; - } - - Info.Flags = 0; - Info.Level = 0; - Info.Count = 0; - Info.WalkState = WalkState; - AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info); - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmWalkParseTree - * - * PARAMETERS: Op - Root Op object - * DescendingCallback - Called during tree descent - * AscendingCallback - Called during tree ascent - * Context - To be passed to the callbacks - * - * RETURN: Status from callback(s) - * - * DESCRIPTION: Walk the entire parse tree. - * - ******************************************************************************/ - -void -AcpiDmWalkParseTree ( - ACPI_PARSE_OBJECT *Op, - ASL_WALK_CALLBACK DescendingCallback, - ASL_WALK_CALLBACK AscendingCallback, - void *Context) -{ - BOOLEAN NodePreviouslyVisited; - ACPI_PARSE_OBJECT *StartOp = Op; - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Next; - ACPI_OP_WALK_INFO *Info = Context; - - - Info->Level = 0; - NodePreviouslyVisited = FALSE; - - while (Op) - { - if (NodePreviouslyVisited) - { - if (AscendingCallback) - { - Status = AscendingCallback (Op, Info->Level, Context); - if (ACPI_FAILURE (Status)) - { - return; - } - } - } - else - { - /* Let the callback process the node */ - - Status = DescendingCallback (Op, Info->Level, Context); - if (ACPI_SUCCESS (Status)) - { - /* Visit children first, once */ - - Next = AcpiPsGetArg (Op, 0); - if (Next) - { - Info->Level++; - Op = Next; - continue; - } - } - else if (Status != AE_CTRL_DEPTH) - { - /* Exit immediately on any error */ - - return; - } - } - - /* Terminate walk at start op */ - - if (Op == StartOp) - { - break; - } - - /* No more children, re-visit this node */ - - if (!NodePreviouslyVisited) - { - NodePreviouslyVisited = TRUE; - continue; - } - - /* No more children, visit peers */ - - if (Op->Common.Next) - { - Op = Op->Common.Next; - NodePreviouslyVisited = FALSE; - } - else - { - /* No peers, re-visit parent */ - - if (Info->Level != 0 ) - { - Info->Level--; - } - - Op = Op->Common.Parent; - NodePreviouslyVisited = TRUE; - } - } - - /* If we get here, the walk completed with no errors */ - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmBlockType - * - * PARAMETERS: Op - Object to be examined - * - * RETURN: BlockType - not a block, parens, braces, or even both. - * - * DESCRIPTION: Type of block for this op (parens or braces) - * - ******************************************************************************/ - -static UINT32 -AcpiDmBlockType ( - ACPI_PARSE_OBJECT *Op) -{ - const ACPI_OPCODE_INFO *OpInfo; - - - if (!Op) - { - return (BLOCK_NONE); - } - - switch (Op->Common.AmlOpcode) - { - case AML_ELSE_OP: - - return (BLOCK_BRACE); - - case AML_METHOD_OP: - case AML_DEVICE_OP: - case AML_SCOPE_OP: - case AML_PROCESSOR_OP: - case AML_POWER_RES_OP: - case AML_THERMAL_ZONE_OP: - case AML_IF_OP: - case AML_WHILE_OP: - case AML_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_BANK_FIELD_OP: - - return (BLOCK_PAREN | BLOCK_BRACE); - - case AML_BUFFER_OP: - - if (Op->Common.DisasmOpcode == ACPI_DASM_UNICODE) - { - return (BLOCK_NONE); - } - - /*lint -fallthrough */ - - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - return (BLOCK_PAREN | BLOCK_BRACE); - - case AML_EVENT_OP: - - return (BLOCK_PAREN); - - default: - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (OpInfo->Flags & AML_HAS_ARGS) - { - return (BLOCK_PAREN); - } - - return (BLOCK_NONE); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmListType - * - * PARAMETERS: Op - Object to be examined - * - * RETURN: ListType - has commas or not. - * - * DESCRIPTION: Type of block for this op (parens or braces) - * - ******************************************************************************/ - -UINT32 -AcpiDmListType ( - ACPI_PARSE_OBJECT *Op) -{ - const ACPI_OPCODE_INFO *OpInfo; - - - if (!Op) - { - return (BLOCK_NONE); - } - - switch (Op->Common.AmlOpcode) - { - - case AML_ELSE_OP: - case AML_METHOD_OP: - case AML_DEVICE_OP: - case AML_SCOPE_OP: - case AML_POWER_RES_OP: - case AML_PROCESSOR_OP: - case AML_THERMAL_ZONE_OP: - case AML_IF_OP: - case AML_WHILE_OP: - case AML_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_BANK_FIELD_OP: - - return (BLOCK_NONE); - - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - return (BLOCK_COMMA_LIST); - - default: - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (OpInfo->Flags & AML_HAS_ARGS) - { - return (BLOCK_COMMA_LIST); - } - - return (BLOCK_NONE); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDescendingOp - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: First visitation of a parse object during tree descent. - * Decode opcode name and begin parameter list(s), if any. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDmDescendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_OP_WALK_INFO *Info = Context; - const ACPI_OPCODE_INFO *OpInfo; - UINT32 Name; - ACPI_PARSE_OBJECT *NextOp; - - - if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) - { - /* Ignore this op -- it was handled elsewhere */ - - return (AE_CTRL_DEPTH); - } - - /* Level 0 is at the Definition Block level */ - - if (Level == 0) - { - /* In verbose mode, print the AML offset, opcode and depth count */ - - if (Info->WalkState) - { - VERBOSE_PRINT ((DB_FULL_OP_INFO, - (Info->WalkState->MethodNode ? - Info->WalkState->MethodNode->Name.Ascii : " "), - Op->Common.AmlOffset, (UINT32) Op->Common.AmlOpcode)); - } - - if (Op->Common.AmlOpcode == AML_SCOPE_OP) - { - /* This is the beginning of the Definition Block */ - - AcpiOsPrintf ("{\n"); - - /* Emit all External() declarations here */ - - AcpiDmEmitExternals (); - return (AE_OK); - } - } - else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && - (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && - (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) - { - /* - * This is a first-level element of a term list, - * indent a new line - */ - AcpiDmIndent (Level); - Info->LastLevel = Level; - Info->Count = 0; - } - - /* - * This is an inexpensive mechanism to try and keep lines from getting - * too long. When the limit is hit, start a new line at the previous - * indent plus one. A better but more expensive mechanism would be to - * keep track of the current column. - */ - Info->Count++; - if (Info->Count /*+Info->LastLevel*/ > 10) - { - Info->Count = 0; - AcpiOsPrintf ("\n"); - AcpiDmIndent (Info->LastLevel + 1); - } - - /* Print the opcode name */ - - AcpiDmDisassembleOneOp (NULL, Info, Op); - - if (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) - { - return (AE_OK); - } - - if ((Op->Common.AmlOpcode == AML_NAME_OP) || - (Op->Common.AmlOpcode == AML_RETURN_OP)) - { - Info->Level--; - } - - /* Start the opcode argument list if necessary */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - if ((OpInfo->Flags & AML_HAS_ARGS) || - (Op->Common.AmlOpcode == AML_EVENT_OP)) - { - /* This opcode has an argument list */ - - if (AcpiDmBlockType (Op) & BLOCK_PAREN) - { - AcpiOsPrintf (" ("); - } - - /* If this is a named opcode, print the associated name value */ - - if (OpInfo->Flags & AML_NAMED) - { - switch (Op->Common.AmlOpcode) - { - case AML_ALIAS_OP: - - NextOp = AcpiPsGetDepthNext (NULL, Op); - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - AcpiDmNamestring (NextOp->Common.Value.Name); - AcpiOsPrintf (", "); - - /*lint -fallthrough */ - - default: - - Name = AcpiPsGetName (Op); - if (Op->Named.Path) - { - AcpiDmNamestring ((char *) Op->Named.Path); - } - else - { - AcpiDmDumpName (Name); - } - - if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP) - { - if (AcpiGbl_DbOpt_verbose) - { - (void) AcpiPsDisplayObjectPathname (NULL, Op); - } - } - break; - } - - switch (Op->Common.AmlOpcode) - { - case AML_METHOD_OP: - - AcpiDmMethodFlags (Op); - AcpiOsPrintf (")"); - break; - - - case AML_NAME_OP: - - /* Check for _HID and related EISAID() */ - - AcpiDmIsEisaId (Op); - AcpiOsPrintf (", "); - break; - - - case AML_REGION_OP: - - AcpiDmRegionFlags (Op); - break; - - - case AML_POWER_RES_OP: - - /* Mark the next two Ops as part of the parameter list */ - - AcpiOsPrintf (", "); - NextOp = AcpiPsGetDepthNext (NULL, Op); - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; - - NextOp = NextOp->Common.Next; - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; - return (AE_OK); - - - case AML_PROCESSOR_OP: - - /* Mark the next three Ops as part of the parameter list */ - - AcpiOsPrintf (", "); - NextOp = AcpiPsGetDepthNext (NULL, Op); - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; - - NextOp = NextOp->Common.Next; - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; - - NextOp = NextOp->Common.Next; - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; - return (AE_OK); - - - case AML_MUTEX_OP: - case AML_DATA_REGION_OP: - - AcpiOsPrintf (", "); - return (AE_OK); - - - case AML_EVENT_OP: - case AML_ALIAS_OP: - - return (AE_OK); - - - case AML_SCOPE_OP: - case AML_DEVICE_OP: - case AML_THERMAL_ZONE_OP: - - AcpiOsPrintf (")"); - break; - - - default: - - AcpiOsPrintf ("*** Unhandled named opcode %X\n", Op->Common.AmlOpcode); - break; - } - } - - else switch (Op->Common.AmlOpcode) - { - case AML_FIELD_OP: - case AML_BANK_FIELD_OP: - case AML_INDEX_FIELD_OP: - - Info->BitOffset = 0; - - /* Name of the parent OperationRegion */ - - NextOp = AcpiPsGetDepthNext (NULL, Op); - AcpiDmNamestring (NextOp->Common.Value.Name); - AcpiOsPrintf (", "); - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - - switch (Op->Common.AmlOpcode) - { - case AML_BANK_FIELD_OP: - - /* Namestring - Bank Name */ - - NextOp = AcpiPsGetDepthNext (NULL, NextOp); - AcpiDmNamestring (NextOp->Common.Value.Name); - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - AcpiOsPrintf (", "); - - /* - * Bank Value. This is a TermArg in the middle of the parameter - * list, must handle it here. - * - * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMLIST - * eliminates newline in the output. - */ - NextOp = NextOp->Common.Next; - - Info->Flags = ACPI_PARSEOP_PARAMLIST; - AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, AcpiDmAscendingOp, Info); - Info->Flags = 0; - Info->Level = Level; - - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - AcpiOsPrintf (", "); - break; - - case AML_INDEX_FIELD_OP: - - /* Namestring - Data Name */ - - NextOp = AcpiPsGetDepthNext (NULL, NextOp); - AcpiDmNamestring (NextOp->Common.Value.Name); - AcpiOsPrintf (", "); - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - break; - - default: - - break; - } - - AcpiDmFieldFlags (NextOp); - break; - - - case AML_BUFFER_OP: - - /* The next op is the size parameter */ - - NextOp = AcpiPsGetDepthNext (NULL, Op); - if (!NextOp) - { - /* Single-step support */ - - return (AE_OK); - } - - if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE) - { - /* - * We have a resource list. Don't need to output - * the buffer size Op. Open up a new block - */ - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - NextOp = NextOp->Common.Next; - AcpiOsPrintf (")\n"); - AcpiDmIndent (Info->Level); - AcpiOsPrintf ("{\n"); - return (AE_OK); - } - - /* Normal Buffer, mark size as in the parameter list */ - - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; - return (AE_OK); - - - case AML_VAR_PACKAGE_OP: - case AML_IF_OP: - case AML_WHILE_OP: - - /* The next op is the size or predicate parameter */ - - NextOp = AcpiPsGetDepthNext (NULL, Op); - if (NextOp) - { - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; - } - return (AE_OK); - - - case AML_PACKAGE_OP: - - /* The next op is the size or predicate parameter */ - - NextOp = AcpiPsGetDepthNext (NULL, Op); - if (NextOp) - { - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; - } - return (AE_OK); - - - case AML_MATCH_OP: - - AcpiDmMatchOp (Op); - break; - - - default: - - break; - } - - if (AcpiDmBlockType (Op) & BLOCK_BRACE) - { - AcpiOsPrintf ("\n"); - AcpiDmIndent (Level); - AcpiOsPrintf ("{\n"); - } - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmAscendingOp - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Second visitation of a parse object, during ascent of parse - * tree. Close out any parameter lists and complete the opcode. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDmAscendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_OP_WALK_INFO *Info = Context; - - - if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) - { - /* Ignore this op -- it was handled elsewhere */ - - return (AE_OK); - } - - if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP)) - { - /* Indicates the end of the current descriptor block (table) */ - - AcpiOsPrintf ("}\n\n"); - return (AE_OK); - } - - switch (AcpiDmBlockType (Op)) - { - case BLOCK_PAREN: - - /* Completed an op that has arguments, add closing paren */ - - AcpiOsPrintf (")"); - - /* Could be a nested operator, check if comma required */ - - if (!AcpiDmCommaIfListMember (Op)) - { - if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && - (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && - (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) - { - /* - * This is a first-level element of a term list - * start a new line - */ - if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST)) - { - AcpiOsPrintf ("\n"); - } - } - } - break; - - - case BLOCK_BRACE: - case (BLOCK_BRACE | BLOCK_PAREN): - - /* Completed an op that has a term list, add closing brace */ - - if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST) - { - AcpiOsPrintf ("}"); - } - else - { - AcpiDmIndent (Level); - AcpiOsPrintf ("}"); - } - - AcpiDmCommaIfListMember (Op); - - if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN) - { - AcpiOsPrintf ("\n"); - if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)) - { - if ((Op->Common.AmlOpcode == AML_IF_OP) && - (Op->Common.Next) && - (Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP)) - { - break; - } - - if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && - (!Op->Common.Next)) - { - break; - } - AcpiOsPrintf ("\n"); - } - } - break; - - - case BLOCK_NONE: - default: - - /* Could be a nested operator, check if comma required */ - - if (!AcpiDmCommaIfListMember (Op)) - { - if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && - (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && - (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) - { - /* - * This is a first-level element of a term list - * start a new line - */ - AcpiOsPrintf ("\n"); - } - } - else if (Op->Common.Parent) - { - switch (Op->Common.Parent->Common.AmlOpcode) - { - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) - { - AcpiOsPrintf ("\n"); - } - break; - - default: - - break; - } - } - break; - } - - if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) - { - if ((Op->Common.Next) && - (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) - { - return (AE_OK); - } - - /* - * Just completed a parameter node for something like "Buffer (param)". - * Close the paren and open up the term list block with a brace - */ - if (Op->Common.Next) - { - AcpiOsPrintf (")\n"); - AcpiDmIndent (Level - 1); - AcpiOsPrintf ("{\n"); - } - else - { - Op->Common.Parent->Common.DisasmFlags |= - ACPI_PARSEOP_EMPTY_TERMLIST; - AcpiOsPrintf (") {"); - } - } - - if ((Op->Common.AmlOpcode == AML_NAME_OP) || - (Op->Common.AmlOpcode == AML_RETURN_OP)) - { - Info->Level++; - } - return (AE_OK); -} - - -#endif /* ACPI_DISASSEMBLER */ diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c index 4525a0bc4f..a75bf91dda 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c @@ -263,12 +263,12 @@ AcpiDsInitializeObjects ( "**** Starting initialization of namespace objects ****\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:")); - Info.MethodCount = 0; - Info.OpRegionCount = 0; - Info.ObjectCount = 0; - Info.DeviceCount = 0; - Info.TableIndex = TableIndex; - Info.OwnerId = OwnerId; + /* Set all init info to zero */ + + ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); + + Info.OwnerId = OwnerId; + Info.TableIndex = TableIndex; /* Walk entire namespace from the supplied root */ @@ -297,12 +297,12 @@ AcpiDsInitializeObjects ( } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", + "\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n", Table->Signature, OwnerId, Info.ObjectCount, Info.DeviceCount, Info.MethodCount, Info.OpRegionCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%hd Methods, %hd Regions\n", Info.MethodCount, Info.OpRegionCount)); + "%u Methods, %u Regions\n", Info.MethodCount, Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c index 969c9ca23e..37d5f206e6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c @@ -700,7 +700,18 @@ AcpiDsTerminateControlMethod ( */ if (!(MethodDesc->Method.Flags & AOPOBJ_MODULE_LEVEL)) { - AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId); + /* Delete any direct children of (created by) this method */ + + AcpiNsDeleteNamespaceSubtree (WalkState->MethodNode); + + /* + * Delete any objects that were created by this method + * elsewhere in the namespace (if any were created). + */ + if (MethodDesc->Method.Flags & AOPOBJ_MODIFIED_NAMESPACE) + { + AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId); + } } } @@ -725,7 +736,7 @@ AcpiDsTerminateControlMethod ( * we immediately reuse it for the next thread executing this method */ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "*** Completed execution of one thread, %d threads remaining\n", + "*** Completed execution of one thread, %u threads remaining\n", MethodDesc->Method.ThreadCount)); } else diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c index 54678921bc..3d17763cf1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c @@ -188,8 +188,7 @@ AcpiDsMethodDataInit ( WalkState->Arguments[i].Name.Integer |= (i << 24); WalkState->Arguments[i].DescriptorType = ACPI_DESC_TYPE_NAMED; WalkState->Arguments[i].Type = ACPI_TYPE_ANY; - WalkState->Arguments[i].Flags = - ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; + WalkState->Arguments[i].Flags = ANOBJ_METHOD_ARG; } /* Init the method locals */ @@ -201,8 +200,7 @@ AcpiDsMethodDataInit ( WalkState->LocalVariables[i].Name.Integer |= (i << 24); WalkState->LocalVariables[i].DescriptorType = ACPI_DESC_TYPE_NAMED; WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY; - WalkState->LocalVariables[i].Flags = - ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; + WalkState->LocalVariables[i].Flags = ANOBJ_METHOD_LOCAL; } return_VOID; @@ -238,7 +236,7 @@ AcpiDsMethodDataDeleteAll ( { if (WalkState->LocalVariables[Index].Object) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%u=%p\n", Index, WalkState->LocalVariables[Index].Object)); /* Detach object (if present) and remove a reference */ @@ -253,7 +251,7 @@ AcpiDsMethodDataDeleteAll ( { if (WalkState->Arguments[Index].Object) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%u=%p\n", Index, WalkState->Arguments[Index].Object)); /* Detach object (if present) and remove a reference */ @@ -322,7 +320,7 @@ AcpiDsMethodDataInitArgs ( Index++; } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", Index)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%u args passed to method\n", Index)); return_ACPI_STATUS (AE_OK); } @@ -429,7 +427,7 @@ AcpiDsMethodDataSetValue ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "NewObj %p Type %2.2X, Refs=%d [%s]\n", Object, + "NewObj %p Type %2.2X, Refs=%u [%s]\n", Object, Type, Object->Common.ReferenceCount, AcpiUtGetTypeName (Object->Common.Type))); @@ -667,7 +665,7 @@ AcpiDsStoreObjectToLocal ( ACPI_FUNCTION_TRACE (DsStoreObjectToLocal); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Type=%2.2X Index=%u Obj=%p\n", Type, Index, ObjDesc)); /* Parameter validation */ diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c index 3d8fce4039..9963bd3b80 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c @@ -159,6 +159,7 @@ AcpiDsBuildInternalObject ( { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; + ACPI_OBJECT_TYPE Type; ACPI_FUNCTION_TRACE (DsBuildInternalObject); @@ -241,7 +242,20 @@ AcpiDsBuildInternalObject ( return_ACPI_STATUS (Status); } - switch (Op->Common.Node->Type) + /* + * Special handling for Alias objects. We need to setup the type + * and the Op->Common.Node to point to the Alias target. Note, + * Alias has at most one level of indirection internally. + */ + Type = Op->Common.Node->Type; + if (Type == ACPI_TYPE_LOCAL_ALIAS) + { + Type = ObjDesc->Common.Type; + Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, + Op->Common.Node->Object); + } + + switch (Type) { /* * For these types, we need the actual node, not the subobject. diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c index e7ebc76530..9d0941d8d5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c @@ -307,7 +307,7 @@ AcpiDsGetBufferFieldArguments ( /* Execute the AML code for the TermArg arguments */ - Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node), + Status = AcpiDsExecuteArguments (Node, Node->Parent, ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); return_ACPI_STATUS (Status); } @@ -354,7 +354,7 @@ AcpiDsGetBankFieldArguments ( /* Execute the AML code for the TermArg arguments */ - Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node), + Status = AcpiDsExecuteArguments (Node, Node->Parent, ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); return_ACPI_STATUS (Status); } @@ -505,7 +505,7 @@ AcpiDsGetRegionArguments ( /* Execute the argument AML */ - Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node), + Status = AcpiDsExecuteArguments (Node, Node->Parent, ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c index 8eb8b3dbbd..7eb0637266 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c @@ -875,7 +875,7 @@ AcpiDsCreateOperands ( Index--; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%u (%p) done, Arg1=%p\n", Index, Arg, FirstArg)); } @@ -890,7 +890,7 @@ Cleanup: */ AcpiDsObjStackPopAndDelete (ArgCount, WalkState); - ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", Index)); + ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %u", Index)); return_ACPI_STATUS (Status); } 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 604f23d6c2..f7ab160084 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c @@ -134,26 +134,26 @@ AcpiEvAsynchEnableGpe ( /******************************************************************************* * - * FUNCTION: AcpiEvUpdateGpeEnableMasks + * FUNCTION: AcpiEvUpdateGpeEnableMask * * PARAMETERS: GpeEventInfo - GPE to update * * RETURN: Status * - * DESCRIPTION: Updates GPE register enable masks based upon whether there are - * references (either wake or run) to this GPE + * DESCRIPTION: Updates GPE register enable mask based upon whether there are + * runtime references to this GPE * ******************************************************************************/ ACPI_STATUS -AcpiEvUpdateGpeEnableMasks ( +AcpiEvUpdateGpeEnableMask ( ACPI_GPE_EVENT_INFO *GpeEventInfo) { ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - UINT8 RegisterBit; + UINT32 RegisterBit; - ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMasks); + ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMask); GpeRegisterInfo = GpeEventInfo->RegisterInfo; @@ -162,24 +162,17 @@ AcpiEvUpdateGpeEnableMasks ( return_ACPI_STATUS (AE_NOT_EXIST); } - RegisterBit = (UINT8) - (1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)); + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); - /* Clear the wake/run bits up front */ + /* Clear the run bit up front */ - ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); - /* Set the mask bits only if there are references to this GPE */ + /* Set the mask bit only if there are references to this GPE */ if (GpeEventInfo->RuntimeCount) { - ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); - } - - if (GpeEventInfo->WakeupCount) - { - ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); + ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, (UINT8) RegisterBit); } return_ACPI_STATUS (AE_OK); @@ -194,10 +187,7 @@ AcpiEvUpdateGpeEnableMasks ( * * RETURN: Status * - * DESCRIPTION: Hardware-enable a GPE. Always enables the GPE, regardless - * of type or number of references. - * - * Note: The GPE lock should be already acquired when this function is called. + * DESCRIPTION: Clear a GPE of stale events and enable it. * ******************************************************************************/ @@ -222,14 +212,6 @@ AcpiEvEnableGpe ( return_ACPI_STATUS (AE_NO_HANDLER); } - /* Ensure the HW enable masks are current */ - - Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Clear the GPE (of stale events) */ Status = AcpiHwClearGpe (GpeEventInfo); @@ -240,59 +222,7 @@ AcpiEvEnableGpe ( /* Enable the requested GPE */ - Status = AcpiHwWriteGpeEnableReg (GpeEventInfo); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvDisableGpe - * - * PARAMETERS: GpeEventInfo - GPE to disable - * - * RETURN: Status - * - * DESCRIPTION: Hardware-disable a GPE. Always disables the requested GPE, - * regardless of the type or number of references. - * - * Note: The GPE lock should be already acquired when this function is called. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvDisableGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvDisableGpe); - - - /* - * Note: Always disable the GPE, even if we think that that it is already - * disabled. It is possible that the AML or some other code has enabled - * the GPE behind our back. - */ - - /* Ensure the HW enable masks are current */ - - Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Always H/W disable this GPE, even if we don't know the GPE type. - * Simply clear the enable bit for this particular GPE, but do not - * write out the current GPE enable mask since this may inadvertently - * enable GPEs too early. An example is a rogue GPE that has arrived - * during ACPICA initialization - possibly because AML or other code - * has enabled the GPE. - */ - Status = AcpiHwLowDisableGpe (GpeEventInfo); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); return_ACPI_STATUS (Status); } @@ -578,10 +508,6 @@ AcpiEvAsynchExecuteGpeMethod ( return_VOID; } - /* Update the GPE register masks for return to enabled state */ - - (void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo); - /* * Take a snapshot of the GPE info for this level - we copy the info to * prevent a race condition with RemoveHandler/RemoveBlock. @@ -677,9 +603,11 @@ AcpiEvAsynchEnableGpe ( } } - /* Enable this GPE */ - - (void) AcpiHwWriteGpeEnableReg (GpeEventInfo); + /* + * Enable this GPE, conditionally. This means that the GPE will only be + * physically enabled if the EnableForRun bit is set in the EventInfo + */ + (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE); Exit: ACPI_FREE (GpeEventInfo); @@ -772,7 +700,7 @@ AcpiEvGpeDispatch ( * Disable the GPE, so it doesn't keep firing before the method has a * chance to run (it runs asynchronously with interrupts enabled). */ - Status = AcpiEvDisableGpe (GpeEventInfo); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -806,10 +734,10 @@ AcpiEvGpeDispatch ( GpeNumber)); /* - * Disable the GPE. The GPE will remain disabled a handler + * Disable the GPE. The GPE will remain disabled until a handler * is installed or ACPICA is restarted. */ - Status = AcpiEvDisableGpe (GpeEventInfo); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, 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 721411703e..7aaff53150 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c @@ -613,6 +613,18 @@ AcpiEvInitializeGpeBlock ( GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; + GpeNumber = GpeIndex + GpeBlock->BlockBaseNumber; + + /* + * If the GPE has already been enabled for runtime + * signalling, make sure that it remains enabled, but + * do not increment its reference count. + */ + if (GpeEventInfo->RuntimeCount) + { + Status = AcpiEvEnableGpe (GpeEventInfo); + goto Enabled; + } /* Ignore GPEs that can wake the system */ @@ -634,9 +646,8 @@ AcpiEvInitializeGpeBlock ( /* Enable this GPE */ - GpeNumber = GpeIndex + GpeBlock->BlockBaseNumber; - Status = AcpiEnableGpe (GpeDevice, GpeNumber, - ACPI_GPE_TYPE_RUNTIME); + Status = AcpiEnableGpe (GpeDevice, GpeNumber); +Enabled: if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c index 1720250cc8..be38f0cfcd 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c @@ -575,8 +575,7 @@ AcpiEvMatchGpeMethod ( GpeDevice = NULL; } - Status = AcpiEnableGpe (GpeDevice, GpeNumber, - ACPI_GPE_TYPE_RUNTIME); + Status = AcpiEnableGpe (GpeDevice, GpeNumber); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c index 2ac0ad4480..1bd42b2cac 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c @@ -114,7 +114,6 @@ *****************************************************************************/ - #include "acpi.h" #include "accommon.h" #include "acevents.h" 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 8a6cbfd941..9fdda23a58 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c @@ -294,7 +294,7 @@ AcpiEvPciConfigRegionSetup ( return_ACPI_STATUS (Status); } - ParentNode = AcpiNsGetParentNode (RegionObj->Region.Node); + ParentNode = RegionObj->Region.Node->Parent; /* * Get the _SEG and _BBN values from the device upon which the handler @@ -348,7 +348,7 @@ AcpiEvPciConfigRegionSetup ( break; } - PciRootNode = AcpiNsGetParentNode (PciRootNode); + PciRootNode = PciRootNode->Parent; } /* PCI root bridge not found, use namespace root node */ @@ -385,7 +385,7 @@ AcpiEvPciConfigRegionSetup ( PciDeviceNode = RegionObj->Region.Node; while (PciDeviceNode && (PciDeviceNode->Type != ACPI_TYPE_DEVICE)) { - PciDeviceNode = AcpiNsGetParentNode (PciDeviceNode); + PciDeviceNode = PciDeviceNode->Parent; } if (!PciDeviceNode) @@ -395,8 +395,8 @@ AcpiEvPciConfigRegionSetup ( } /* - * Get the PCI device and function numbers from the _ADR object contained - * in the parent's scope. + * Get the PCI device and function numbers from the _ADR object + * contained in the parent's scope. */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, PciDeviceNode, &PciValue); @@ -429,9 +429,14 @@ AcpiEvPciConfigRegionSetup ( PciId->Bus = ACPI_LOWORD (PciValue); } - /* Complete this device's PciId */ + /* Complete/update the PCI ID for this device */ - AcpiOsDerivePciId (PciRootNode, RegionObj->Region.Node, &PciId); + Status = AcpiHwDerivePciId (PciId, PciRootNode, RegionObj->Region.Node); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (PciId); + return_ACPI_STATUS (Status); + } *RegionContext = PciId; return_ACPI_STATUS (AE_OK); @@ -661,7 +666,7 @@ AcpiEvInitializeRegion ( return_ACPI_STATUS (AE_NOT_EXIST); } - Node = AcpiNsGetParentNode (RegionObj->Region.Node); + Node = RegionObj->Region.Node->Parent; SpaceId = RegionObj->Region.SpaceId; /* Setup defaults */ @@ -785,7 +790,7 @@ AcpiEvInitializeRegion ( /* This node does not have the handler we need; Pop up one level */ - Node = AcpiNsGetParentNode (Node); + Node = Node->Parent; } /* If we get here, there is no handler for this region */ 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 567eba4447..5019b66315 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxface.c @@ -747,14 +747,6 @@ AcpiInstallGpeHandler ( Handler->Context = Context; Handler->MethodNode = GpeEventInfo->Dispatch.MethodNode; - /* Disable the GPE before installing the handler */ - - Status = AcpiEvDisableGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - /* Install the handler */ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); @@ -845,14 +837,6 @@ AcpiRemoveGpeHandler ( goto UnlockAndExit; } - /* Disable the GPE before removing the handler */ - - Status = AcpiEvDisableGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - /* Remove the handler */ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); 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 9f2906311b..9c0e9b9ee3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c @@ -307,42 +307,34 @@ ACPI_EXPORT_SYMBOL (AcpiEnableEvent) /******************************************************************************* * - * FUNCTION: AcpiEnableGpe + * FUNCTION: AcpiGpeWakeup * * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 * GpeNumber - GPE level within the GPE block - * GpeType - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE - * or both + * Action - Enable or Disable * * RETURN: Status * - * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is - * hardware-enabled (for runtime GPEs), or the GPE register mask - * is updated (for wake GPEs). + * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit. * ******************************************************************************/ ACPI_STATUS -AcpiEnableGpe ( +AcpiGpeWakeup ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, - UINT8 GpeType) + UINT8 Action) { ACPI_STATUS Status = AE_OK; ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; ACPI_CPU_FLAGS Flags; + UINT32 RegisterBit; - ACPI_FUNCTION_TRACE (AcpiEnableGpe); + ACPI_FUNCTION_TRACE (AcpiGpeWakeup); - /* Parameter validation */ - - if (!GpeType || (GpeType & ~ACPI_GPE_TYPE_WAKE_RUN)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); /* Ensure that we have a valid GPE number */ @@ -354,50 +346,96 @@ AcpiEnableGpe ( goto UnlockAndExit; } - if (GpeType & ACPI_GPE_TYPE_RUNTIME) + GpeRegisterInfo = GpeEventInfo->RegisterInfo; + if (!GpeRegisterInfo) { - if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX) - { - Status = AE_LIMIT; /* Too many references */ - goto UnlockAndExit; - } - - GpeEventInfo->RuntimeCount++; - if (GpeEventInfo->RuntimeCount == 1) - { - Status = AcpiEvEnableGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - GpeEventInfo->RuntimeCount--; - goto UnlockAndExit; - } - } + Status = AE_NOT_EXIST; + goto UnlockAndExit; } - if (GpeType & ACPI_GPE_TYPE_WAKE) + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + + /* Perform the action */ + + switch (Action) { - /* The GPE must have the ability to wake the system */ + case ACPI_GPE_ENABLE: + ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); + break; - if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) + case ACPI_GPE_DISABLE: + ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); + break; + + default: + ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action)); + Status = AE_BAD_PARAMETER; + break; + } + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiGpeWakeup) + + +/******************************************************************************* + * + * FUNCTION: AcpiEnableGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is + * hardware-enabled. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEnableGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiEnableGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX) + { + Status = AE_LIMIT; /* Too many references */ + goto UnlockAndExit; + } + + GpeEventInfo->RuntimeCount++; + if (GpeEventInfo->RuntimeCount == 1) + { + Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); + if (ACPI_SUCCESS (Status)) { - Status = AE_TYPE; - goto UnlockAndExit; + Status = AcpiEvEnableGpe (GpeEventInfo); } - - if (GpeEventInfo->WakeupCount == ACPI_UINT8_MAX) + if (ACPI_FAILURE (Status)) { - Status = AE_LIMIT; /* Too many references */ - goto UnlockAndExit; - } - - /* - * Update the enable mask on the first wakeup reference. Wake GPEs - * are only hardware-enabled just before sleeping. - */ - GpeEventInfo->WakeupCount++; - if (GpeEventInfo->WakeupCount == 1) - { - (void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo); + GpeEventInfo->RuntimeCount--; } } @@ -415,8 +453,6 @@ ACPI_EXPORT_SYMBOL (AcpiEnableGpe) * * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 * GpeNumber - GPE level within the GPE block - * GpeType - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE - * or both * * RETURN: Status * @@ -429,8 +465,7 @@ ACPI_EXPORT_SYMBOL (AcpiEnableGpe) ACPI_STATUS AcpiDisableGpe ( ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 GpeType) + UINT32 GpeNumber) { ACPI_STATUS Status = AE_OK; ACPI_GPE_EVENT_INFO *GpeEventInfo; @@ -440,13 +475,6 @@ AcpiDisableGpe ( ACPI_FUNCTION_TRACE (AcpiDisableGpe); - /* Parameter validation */ - - if (!GpeType || (GpeType & ~ACPI_GPE_TYPE_WAKE_RUN)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); /* Ensure that we have a valid GPE number */ @@ -460,47 +488,26 @@ AcpiDisableGpe ( /* Hardware-disable a runtime GPE on removal of the last reference */ - if (GpeType & ACPI_GPE_TYPE_RUNTIME) + if (!GpeEventInfo->RuntimeCount) { - if (!GpeEventInfo->RuntimeCount) - { - Status = AE_LIMIT; /* There are no references to remove */ - goto UnlockAndExit; - } - - GpeEventInfo->RuntimeCount--; - if (!GpeEventInfo->RuntimeCount) - { - Status = AcpiEvDisableGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - GpeEventInfo->RuntimeCount++; - goto UnlockAndExit; - } - } + Status = AE_LIMIT; /* There are no references to remove */ + goto UnlockAndExit; } - /* - * Update masks for wake GPE on removal of the last reference. - * No need to hardware-disable wake GPEs here, they are not currently - * enabled. - */ - if (GpeType & ACPI_GPE_TYPE_WAKE) + GpeEventInfo->RuntimeCount--; + if (!GpeEventInfo->RuntimeCount) { - if (!GpeEventInfo->WakeupCount) + Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); + if (ACPI_SUCCESS (Status)) { - Status = AE_LIMIT; /* There are no references to remove */ - goto UnlockAndExit; + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); } - - GpeEventInfo->WakeupCount--; - if (!GpeEventInfo->WakeupCount) + if (ACPI_FAILURE (Status)) { - (void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo); + GpeEventInfo->RuntimeCount++; } } - UnlockAndExit: AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); return_ACPI_STATUS (Status); @@ -563,7 +570,7 @@ AcpiSetGpe ( break; case ACPI_GPE_DISABLE: - Status = AcpiEvDisableGpe (GpeEventInfo); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); break; default: 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 365174fb68..9803861cd1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c @@ -139,6 +139,12 @@ * * DESCRIPTION: Install a handler for all OpRegions of a given SpaceId. * + * NOTE: This function should only be called after AcpiEnableSubsystem has + * been called. This is because any _REG methods associated with the Space ID + * are executed here, and these methods can only be safely executed after + * the default handlers have been installed and the hardware has been + * initialized (via AcpiEnableSubsystem.) + * ******************************************************************************/ ACPI_STATUS diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c b/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c index 5ef9fe83c7..404a54351f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c @@ -864,7 +864,7 @@ AcpiExDumpOperands ( } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "**** Start operand dump for opcode [%s], %d operands\n", + "**** Start operand dump for opcode [%s], %u operands\n", OpcodeName, NumOperands)); if (NumOperands == 0) @@ -948,7 +948,7 @@ AcpiExDumpNamespaceNode ( AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node)); AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node)); - AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node)); + AcpiExOutPointer ("Parent", Node->Parent); AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node), AcpiExDumpNode); @@ -1096,7 +1096,7 @@ AcpiExDumpPackageObj ( case ACPI_TYPE_PACKAGE: - AcpiOsPrintf ("[Package] Contains %d Elements:\n", + AcpiOsPrintf ("[Package] Contains %u Elements:\n", ObjDesc->Package.Count); for (i = 0; i < ObjDesc->Package.Count; i++) diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c b/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c index 0cff9f94d9..5ba1b44c55 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c @@ -202,8 +202,8 @@ AcpiExSetupRegion ( } /* - * Exit now for SMBus or IPMI address space, it has a non-linear address space - * and the request cannot be directly validated + * Exit now for SMBus or IPMI address space, it has a non-linear + * address space and the request cannot be directly validated */ if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_IPMI) @@ -233,8 +233,7 @@ AcpiExSetupRegion ( * (Region length is specified in bytes) */ if (RgnDesc->Region.Length < - (ObjDesc->CommonField.BaseByteOffset + - FieldDatumByteOffset + + (ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset + ObjDesc->CommonField.AccessByteWidth)) { if (AcpiGbl_EnableInterpreterSlack) @@ -644,14 +643,14 @@ AcpiExFieldDatumIo ( if (ReadWrite == ACPI_READ) { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Value Read %8.8X%8.8X, Width %d\n", + "Value Read %8.8X%8.8X, Width %u\n", ACPI_FORMAT_UINT64 (*Value), ObjDesc->CommonField.AccessByteWidth)); } else { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Value Written %8.8X%8.8X, Width %d\n", + "Value Written %8.8X%8.8X, Width %u\n", ACPI_FORMAT_UINT64 (*Value), ObjDesc->CommonField.AccessByteWidth)); } @@ -794,6 +793,7 @@ AcpiExExtractFromField ( UINT32 BufferTailBits; UINT32 DatumCount; UINT32 FieldDatumCount; + UINT32 AccessBitWidth; UINT32 i; @@ -803,7 +803,7 @@ AcpiExExtractFromField ( /* Validate target buffer and clear it */ if (BufferLength < - ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength)) + ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength)) { ACPI_ERROR ((AE_INFO, "Field size %u (bits) is too large for buffer (%u)", @@ -811,17 +811,37 @@ AcpiExExtractFromField ( return_ACPI_STATUS (AE_BUFFER_OVERFLOW); } + ACPI_MEMSET (Buffer, 0, BufferLength); + AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth); + + /* Handle the simple case here */ + + if ((ObjDesc->CommonField.StartFieldBitOffset == 0) && + (ObjDesc->CommonField.BitLength == AccessBitWidth)) + { + Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ); + return_ACPI_STATUS (Status); + } + +/* TBD: Move to common setup code */ + + /* Field algorithm is limited to sizeof(UINT64), truncate if needed */ + + if (ObjDesc->CommonField.AccessByteWidth > sizeof (UINT64)) + { + ObjDesc->CommonField.AccessByteWidth = sizeof (UINT64); + AccessBitWidth = sizeof (UINT64) * 8; + } /* Compute the number of datums (access width data items) */ DatumCount = ACPI_ROUND_UP_TO ( - ObjDesc->CommonField.BitLength, - ObjDesc->CommonField.AccessBitWidth); + ObjDesc->CommonField.BitLength, AccessBitWidth); + FieldDatumCount = ACPI_ROUND_UP_TO ( - ObjDesc->CommonField.BitLength + - ObjDesc->CommonField.StartFieldBitOffset, - ObjDesc->CommonField.AccessBitWidth); + ObjDesc->CommonField.BitLength + + ObjDesc->CommonField.StartFieldBitOffset, AccessBitWidth); /* Priming read from the field */ @@ -854,12 +874,11 @@ AcpiExExtractFromField ( * This avoids the differences in behavior between different compilers * concerning shift values larger than the target data width. */ - if ((ObjDesc->CommonField.AccessBitWidth - - ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE) + if (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset < + ACPI_INTEGER_BIT_SIZE) { MergedDatum |= RawDatum << - (ObjDesc->CommonField.AccessBitWidth - - ObjDesc->CommonField.StartFieldBitOffset); + (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset); } if (i == DatumCount) @@ -879,8 +898,7 @@ AcpiExExtractFromField ( /* Mask off any extra bits in the last datum */ - BufferTailBits = ObjDesc->CommonField.BitLength % - ObjDesc->CommonField.AccessBitWidth; + BufferTailBits = ObjDesc->CommonField.BitLength % AccessBitWidth; if (BufferTailBits) { MergedDatum &= ACPI_MASK_BITS_ABOVE (BufferTailBits); @@ -916,6 +934,7 @@ AcpiExInsertIntoField ( void *Buffer, UINT32 BufferLength) { + void *NewBuffer; ACPI_STATUS Status; UINT64 Mask; UINT64 WidthMask; @@ -926,9 +945,9 @@ AcpiExInsertIntoField ( UINT32 BufferTailBits; UINT32 DatumCount; UINT32 FieldDatumCount; - UINT32 i; + UINT32 AccessBitWidth; UINT32 RequiredLength; - void *NewBuffer; + UINT32 i; ACPI_FUNCTION_TRACE (ExInsertIntoField); @@ -965,31 +984,41 @@ AcpiExInsertIntoField ( BufferLength = RequiredLength; } +/* TBD: Move to common setup code */ + + /* Algo is limited to sizeof(UINT64), so cut the AccessByteWidth */ + if (ObjDesc->CommonField.AccessByteWidth > sizeof (UINT64)) + { + ObjDesc->CommonField.AccessByteWidth = sizeof (UINT64); + } + + AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth); + /* * Create the bitmasks used for bit insertion. * Note: This if/else is used to bypass compiler differences with the * shift operator */ - if (ObjDesc->CommonField.AccessBitWidth == ACPI_INTEGER_BIT_SIZE) + if (AccessBitWidth == ACPI_INTEGER_BIT_SIZE) { WidthMask = ACPI_UINT64_MAX; } else { - WidthMask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.AccessBitWidth); + WidthMask = ACPI_MASK_BITS_ABOVE (AccessBitWidth); } Mask = WidthMask & - ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset); + ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset); /* Compute the number of datums (access width data items) */ DatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength, - ObjDesc->CommonField.AccessBitWidth); + AccessBitWidth); FieldDatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength + - ObjDesc->CommonField.StartFieldBitOffset, - ObjDesc->CommonField.AccessBitWidth); + ObjDesc->CommonField.StartFieldBitOffset, + AccessBitWidth); /* Get initial Datum from the input buffer */ @@ -1024,12 +1053,11 @@ AcpiExInsertIntoField ( * This avoids the differences in behavior between different compilers * concerning shift values larger than the target data width. */ - if ((ObjDesc->CommonField.AccessBitWidth - - ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE) + if ((AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset) < + ACPI_INTEGER_BIT_SIZE) { MergedDatum = RawDatum >> - (ObjDesc->CommonField.AccessBitWidth - - ObjDesc->CommonField.StartFieldBitOffset); + (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset); } else { @@ -1048,15 +1076,15 @@ AcpiExInsertIntoField ( BufferOffset += ObjDesc->CommonField.AccessByteWidth; ACPI_MEMCPY (&RawDatum, ((char *) Buffer) + BufferOffset, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, - BufferLength - BufferOffset)); + BufferLength - BufferOffset)); + MergedDatum |= RawDatum << ObjDesc->CommonField.StartFieldBitOffset; } /* Mask off any extra bits in the last datum */ BufferTailBits = (ObjDesc->CommonField.BitLength + - ObjDesc->CommonField.StartFieldBitOffset) % - ObjDesc->CommonField.AccessBitWidth; + ObjDesc->CommonField.StartFieldBitOffset) % AccessBitWidth; if (BufferTailBits) { Mask &= ACPI_MASK_BITS_ABOVE (BufferTailBits); diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c b/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c index e9646ca77d..4f7421d4a2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c @@ -513,10 +513,10 @@ AcpiExReleaseMutex ( (ObjDesc != AcpiGbl_GlobalLockMutex)) { ACPI_ERROR ((AE_INFO, - "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", - ACPI_CAST_PTR (void, WalkState->Thread->ThreadId), + "Thread %u cannot release Mutex [%4.4s] acquired by thread %u", + (UINT32) WalkState->Thread->ThreadId, AcpiUtGetNodeName (ObjDesc->Mutex.Node), - ACPI_CAST_PTR (void, OwnerThread->ThreadId))); + (UINT32) OwnerThread->ThreadId)); return_ACPI_STATUS (AE_AML_NOT_OWNER); } diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c b/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c index 6cc3719451..6241404973 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c @@ -193,12 +193,12 @@ AcpiExGenerateAccess ( FieldByteLength = FieldByteEndOffset - FieldByteOffset; ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Bit length %d, Bit offset %d\n", - FieldBitLength, FieldBitOffset)); + "Bit length %u, Bit offset %u\n", + FieldBitLength, FieldBitOffset)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Byte Length %d, Byte Offset %d, End Offset %d\n", - FieldByteLength, FieldByteOffset, FieldByteEndOffset)); + "Byte Length %u, Byte Offset %u, End Offset %u\n", + FieldByteLength, FieldByteOffset, FieldByteEndOffset)); /* * Iterative search for the maximum access width that is both aligned @@ -228,18 +228,18 @@ AcpiExGenerateAccess ( Accesses = FieldEndOffset - FieldStartOffset; ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "AccessWidth %d end is within region\n", AccessByteWidth)); + "AccessWidth %u end is within region\n", AccessByteWidth)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Field Start %d, Field End %d -- requires %d accesses\n", - FieldStartOffset, FieldEndOffset, Accesses)); + "Field Start %u, Field End %u -- requires %u accesses\n", + FieldStartOffset, FieldEndOffset, Accesses)); /* Single access is optimal */ if (Accesses <= 1) { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Entire field can be accessed with one operation of size %d\n", + "Entire field can be accessed with one operation of size %u\n", AccessByteWidth)); return_VALUE (AccessByteWidth); } @@ -257,11 +257,11 @@ AcpiExGenerateAccess ( else { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "AccessWidth %d end is NOT within region\n", AccessByteWidth)); + "AccessWidth %u end is NOT within region\n", AccessByteWidth)); if (AccessByteWidth == 1) { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Field goes beyond end-of-region!\n")); + "Field goes beyond end-of-region!\n")); /* Field does not fit in the region at all */ @@ -273,8 +273,8 @@ AcpiExGenerateAccess ( * previous access */ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Backing off to previous optimal access width of %d\n", - MinimumAccessWidth)); + "Backing off to previous optimal access width of %u\n", + MinimumAccessWidth)); return_VALUE (MinimumAccessWidth); } } @@ -284,7 +284,7 @@ AcpiExGenerateAccess ( * just use max access width */ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Cannot access field in one operation, using width 8\n")); + "Cannot access field in one operation, using width 8\n")); return_VALUE (8); } #endif /* ACPI_UNDER_DEVELOPMENT */ @@ -444,18 +444,16 @@ AcpiExPrepCommonFieldObject ( * the same (equivalent) as the ByteAlignment. */ AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags, - &ByteAlignment); + &ByteAlignment); if (!AccessBitWidth) { return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } - /* Setup width (access granularity) fields */ + /* Setup width (access granularity) fields (values are: 1, 2, 4, 8) */ ObjDesc->CommonField.AccessByteWidth = (UINT8) - ACPI_DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */ - - ObjDesc->CommonField.AccessBitWidth = (UINT8) AccessBitWidth; + ACPI_DIV_8 (AccessBitWidth); /* * BaseByteOffset is the address of the start of the field within the @@ -468,9 +466,9 @@ AcpiExPrepCommonFieldObject ( * region or buffer. */ NearestByteAddress = - ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition); + ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition); ObjDesc->CommonField.BaseByteOffset = (UINT32) - ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment); + ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment); /* * StartFieldBitOffset is the offset of the first bit of the field within @@ -479,16 +477,6 @@ AcpiExPrepCommonFieldObject ( ObjDesc->CommonField.StartFieldBitOffset = (UINT8) (FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset)); - /* - * Does the entire field fit within a single field access element? (datum) - * (i.e., without crossing a datum boundary) - */ - if ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) <= - (UINT16) AccessBitWidth) - { - ObjDesc->Common.Flags |= AOPOBJ_SINGLE_DATUM; - } - return_ACPI_STATUS (AE_OK); } @@ -512,8 +500,9 @@ AcpiExPrepFieldValue ( { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *SecondDesc = NULL; - UINT32 Type; ACPI_STATUS Status; + UINT32 AccessByteWidth; + UINT32 Type; ACPI_FUNCTION_TRACE (ExPrepFieldValue); @@ -532,8 +521,7 @@ AcpiExPrepFieldValue ( Type = AcpiNsGetType (Info->RegionNode); if (Type != ACPI_TYPE_REGION) { - ACPI_ERROR ((AE_INFO, - "Needed Region, found type 0x%X (%s)", + ACPI_ERROR ((AE_INFO, "Needed Region, found type 0x%X (%s)", Type, AcpiUtGetTypeName (Type))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -551,8 +539,9 @@ AcpiExPrepFieldValue ( /* Initialize areas of the object that are common to all fields */ ObjDesc->CommonField.Node = Info->FieldNode; - Status = AcpiExPrepCommonFieldObject (ObjDesc, Info->FieldFlags, - Info->Attribute, Info->FieldBitPosition, Info->FieldBitLength); + Status = AcpiExPrepCommonFieldObject (ObjDesc, + Info->FieldFlags, Info->Attribute, + Info->FieldBitPosition, Info->FieldBitLength); if (ACPI_FAILURE (Status)) { AcpiUtDeleteObjectDesc (ObjDesc); @@ -567,6 +556,22 @@ AcpiExPrepFieldValue ( ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode); + /* Allow full data read from EC address space */ + + if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) && + (ObjDesc->CommonField.BitLength > 8)) + { + AccessByteWidth = ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->CommonField.BitLength); + + /* Maximum byte width supported is 255 */ + + if (AccessByteWidth < 256) + { + ObjDesc->CommonField.AccessByteWidth = (UINT8) AccessByteWidth; + } + } + /* An additional reference for the container */ AcpiUtAddReference (ObjDesc->Field.RegionObj); @@ -580,11 +585,11 @@ AcpiExPrepFieldValue ( case ACPI_TYPE_LOCAL_BANK_FIELD: - ObjDesc->BankField.Value = Info->BankValue; - ObjDesc->BankField.RegionObj = AcpiNsGetAttachedObject ( - Info->RegionNode); - ObjDesc->BankField.BankObj = AcpiNsGetAttachedObject ( - Info->RegisterNode); + ObjDesc->BankField.Value = Info->BankValue; + ObjDesc->BankField.RegionObj = + AcpiNsGetAttachedObject (Info->RegionNode); + ObjDesc->BankField.BankObj = + AcpiNsGetAttachedObject (Info->RegisterNode); /* An additional reference for the attached objects */ @@ -604,9 +609,11 @@ AcpiExPrepFieldValue ( * opcode and operands -- since the BankValue * operands must be evaluated. */ - SecondDesc = ObjDesc->Common.NextObject; - SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Data; - SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Length; + SecondDesc = ObjDesc->Common.NextObject; + SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, + Info->DataRegisterNode)->Named.Data; + SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, + Info->DataRegisterNode)->Named.Length; break; @@ -615,10 +622,10 @@ AcpiExPrepFieldValue ( /* Get the Index and Data registers */ - ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject ( - Info->RegisterNode); - ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject ( - Info->DataRegisterNode); + ObjDesc->IndexField.IndexObj = + AcpiNsGetAttachedObject (Info->RegisterNode); + ObjDesc->IndexField.DataObj = + AcpiNsGetAttachedObject (Info->DataRegisterNode); if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj) { @@ -673,10 +680,10 @@ AcpiExPrepFieldValue ( * preserving the current type of that NamedObj. */ Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc, - AcpiNsGetType (Info->FieldNode)); + AcpiNsGetType (Info->FieldNode)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set NamedObj %p [%4.4s], ObjDesc %p\n", - Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc)); + Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc)); /* Remove local reference to the object */ diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c b/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c index 2ac8a0e93e..fb84d03000 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c @@ -285,7 +285,7 @@ AcpiExSystemMemorySpaceHandler ( ((UINT64) Address - (UINT64) MemInfo->MappedPhysicalAddress); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", + "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); /* @@ -395,7 +395,7 @@ AcpiExSystemIoSpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", + "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); /* Decode the function parameter */ @@ -475,7 +475,7 @@ AcpiExPciConfigSpaceHandler ( PciRegister = (UINT16) (UINT32) Address; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", + "Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device, PciId->Function, PciRegister)); diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c b/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c index 8f4ccfe371..0217ef53ff 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c @@ -302,6 +302,15 @@ AcpiExSystemDoSleep ( AcpiExRelinquishInterpreter (); + /* + * For compatibility with other ACPI implementations and to prevent + * accidental deep sleeps, limit the sleep time to something reasonable. + */ + if (HowLong > ACPI_MAX_SLEEP) + { + HowLong = ACPI_MAX_SLEEP; + } + AcpiOsSleep (HowLong); /* And now we must get the interpreter again */ 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 24e741e11a..c7391b408c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c @@ -132,23 +132,54 @@ AcpiHwEnableWakeupGpeBlock ( /****************************************************************************** * - * FUNCTION: AcpiHwLowDisableGpe + * FUNCTION: AcpiHwGetGpeRegisterBit + * + * PARAMETERS: GpeEventInfo - Info block for the GPE + * GpeRegisterInfo - Info block for the GPE register + * + * RETURN: Register mask with a one in the GPE bit position + * + * DESCRIPTION: Compute the register mask for this GPE. One bit is set in the + * correct position for the input GPE. + * + ******************************************************************************/ + +UINT32 +AcpiHwGetGpeRegisterBit ( + ACPI_GPE_EVENT_INFO *GpeEventInfo, + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo) +{ + + return ((UINT32) 1 << + (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwLowSetGpe * * PARAMETERS: GpeEventInfo - Info block for the GPE to be disabled + * Action - Enable or disable * * RETURN: Status * - * DESCRIPTION: Disable a single GPE in the enable register. + * DESCRIPTION: Enable or disable a single GPE in the parent enable register. * ******************************************************************************/ ACPI_STATUS -AcpiHwLowDisableGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) +AcpiHwLowSetGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo, + UINT32 Action) { ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; ACPI_STATUS Status; UINT32 EnableMask; + UINT32 RegisterBit; + + + ACPI_FUNCTION_ENTRY (); /* Get the info block for the entire GPE register */ @@ -167,11 +198,34 @@ AcpiHwLowDisableGpe ( return (Status); } - /* Clear just the bit that corresponds to this GPE */ + /* Set or clear just the bit that corresponds to this GPE */ - ACPI_CLEAR_BIT (EnableMask, ((UINT32) 1 << - (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber))); + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + switch (Action) + { + case ACPI_GPE_CONDITIONAL_ENABLE: + /* Only enable if the EnableForRun bit is set */ + + if (!(RegisterBit & GpeRegisterInfo->EnableForRun)) + { + return (AE_BAD_PARAMETER); + } + + /*lint -fallthrough */ + + case ACPI_GPE_ENABLE: + ACPI_SET_BIT (EnableMask, RegisterBit); + break; + + case ACPI_GPE_DISABLE: + ACPI_CLEAR_BIT (EnableMask, RegisterBit); + break; + + default: + ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u\n", Action)); + return (AE_BAD_PARAMETER); + } /* Write the updated enable mask */ @@ -180,48 +234,6 @@ AcpiHwLowDisableGpe ( } -/****************************************************************************** - * - * FUNCTION: AcpiHwWriteGpeEnableReg - * - * PARAMETERS: GpeEventInfo - Info block for the GPE to be enabled - * - * RETURN: Status - * - * DESCRIPTION: Write a GPE enable register. Note: The bit for this GPE must - * already be cleared or set in the parent register - * EnableForRun mask. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwWriteGpeEnableReg ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) -{ - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_STATUS Status; - - - ACPI_FUNCTION_ENTRY (); - - - /* Get the info block for the entire GPE register */ - - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - if (!GpeRegisterInfo) - { - return (AE_NOT_EXIST); - } - - /* Write the entire GPE (runtime) enable register */ - - Status = AcpiHwWrite (GpeRegisterInfo->EnableForRun, - &GpeRegisterInfo->EnableAddress); - - return (Status); -} - - /****************************************************************************** * * FUNCTION: AcpiHwClearGpe @@ -238,22 +250,29 @@ ACPI_STATUS AcpiHwClearGpe ( ACPI_GPE_EVENT_INFO *GpeEventInfo) { + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; ACPI_STATUS Status; - UINT8 RegisterBit; + UINT32 RegisterBit; ACPI_FUNCTION_ENTRY (); + /* Get the info block for the entire GPE register */ - RegisterBit = (UINT8) (1 << - (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber)); + GpeRegisterInfo = GpeEventInfo->RegisterInfo; + if (!GpeRegisterInfo) + { + return (AE_NOT_EXIST); + } /* * Write a one to the appropriate bit in the status register to * clear this GPE. */ + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + Status = AcpiHwWrite (RegisterBit, - &GpeEventInfo->RegisterInfo->StatusAddress); + &GpeRegisterInfo->StatusAddress); return (Status); } @@ -278,10 +297,10 @@ AcpiHwGetGpeStatus ( ACPI_EVENT_STATUS *EventStatus) { UINT32 InByte; - UINT8 RegisterBit; + UINT32 RegisterBit; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_STATUS Status; ACPI_EVENT_STATUS LocalEventStatus = 0; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); @@ -298,8 +317,7 @@ AcpiHwGetGpeStatus ( /* Get the register bitmask for this GPE */ - RegisterBit = (UINT8) (1 << - (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber)); + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); /* GPE currently enabled? (enabled for runtime?) */ diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c new file mode 100644 index 0000000000..74c5f87a96 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c @@ -0,0 +1,531 @@ +/******************************************************************************* + * + * Module Name: hwpci - Obtain PCI bus, device, and function numbers + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __HWPCI_C__ + +#include "acpi.h" +#include "accommon.h" + + +#define _COMPONENT ACPI_NAMESPACE + ACPI_MODULE_NAME ("hwpci") + + +/* PCI configuration space values */ + +#define PCI_CFG_HEADER_TYPE_REG 0x0E +#define PCI_CFG_PRIMARY_BUS_NUMBER_REG 0x18 +#define PCI_CFG_SECONDARY_BUS_NUMBER_REG 0x19 + +/* PCI header values */ + +#define PCI_HEADER_TYPE_MASK 0x7F +#define PCI_TYPE_BRIDGE 0x01 +#define PCI_TYPE_CARDBUS_BRIDGE 0x02 + +typedef struct acpi_pci_device +{ + ACPI_HANDLE Device; + struct acpi_pci_device *Next; + +} ACPI_PCI_DEVICE; + + +/* Local prototypes */ + +static ACPI_STATUS +AcpiHwBuildPciList ( + ACPI_HANDLE RootPciDevice, + ACPI_HANDLE PciRegion, + ACPI_PCI_DEVICE **ReturnListHead); + +static ACPI_STATUS +AcpiHwProcessPciList ( + ACPI_PCI_ID *PciId, + ACPI_PCI_DEVICE *ListHead); + +static void +AcpiHwDeletePciList ( + ACPI_PCI_DEVICE *ListHead); + +static ACPI_STATUS +AcpiHwGetPciDeviceInfo ( + ACPI_PCI_ID *PciId, + ACPI_HANDLE PciDevice, + UINT16 *BusNumber, + BOOLEAN *IsBridge); + + +/******************************************************************************* + * + * FUNCTION: AcpiHwDerivePciId + * + * PARAMETERS: PciId - Initial values for the PCI ID. May be + * modified by this function. + * RootPciDevice - A handle to a PCI device object. This + * object must be a PCI Root Bridge having a + * _HID value of either PNP0A03 or PNP0A08 + * PciRegion - A handle to a PCI configuration space + * Operation Region being initialized + * + * RETURN: Status + * + * DESCRIPTION: This function derives a full PCI ID for a PCI device, + * consisting of a Segment number, Bus number, Device number, + * and function code. + * + * The PCI hardware dynamically configures PCI bus numbers + * depending on the bus topology discovered during system + * initialization. This function is invoked during configuration + * of a PCI_Config Operation Region in order to (possibly) update + * the Bus/Device/Function numbers in the PciId with the actual + * values as determined by the hardware and operating system + * configuration. + * + * The PciId parameter is initially populated during the Operation + * Region initialization. This function is then called, and is + * will make any necessary modifications to the Bus, Device, or + * Function number PCI ID subfields as appropriate for the + * current hardware and OS configuration. + * + * NOTE: Created 08/2010. Replaces the previous OSL AcpiOsDerivePciId + * interface since this feature is OS-independent. This module + * specifically avoids any use of recursion by building a local + * temporary device list. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwDerivePciId ( + ACPI_PCI_ID *PciId, + ACPI_HANDLE RootPciDevice, + ACPI_HANDLE PciRegion) +{ + ACPI_STATUS Status; + ACPI_PCI_DEVICE *ListHead = NULL; + + + ACPI_FUNCTION_TRACE (HwDerivePciId); + + + if (!PciId) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* Build a list of PCI devices, from PciRegion up to RootPciDevice */ + + Status = AcpiHwBuildPciList (RootPciDevice, PciRegion, &ListHead); + if (ACPI_SUCCESS (Status)) + { + /* Walk the list, updating the PCI device/function/bus numbers */ + + Status = AcpiHwProcessPciList (PciId, ListHead); + } + + /* Always delete the list */ + + AcpiHwDeletePciList (ListHead); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiHwBuildPciList + * + * PARAMETERS: RootPciDevice - A handle to a PCI device object. This + * object is guaranteed to be a PCI Root + * Bridge having a _HID value of either + * PNP0A03 or PNP0A08 + * PciRegion - A handle to the PCI configuration space + * Operation Region + * ReturnListHead - Where the PCI device list is returned + * + * RETURN: Status + * + * DESCRIPTION: Builds a list of devices from the input PCI region up to the + * Root PCI device for this namespace subtree. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiHwBuildPciList ( + ACPI_HANDLE RootPciDevice, + ACPI_HANDLE PciRegion, + ACPI_PCI_DEVICE **ReturnListHead) +{ + ACPI_HANDLE CurrentDevice; + ACPI_HANDLE ParentDevice; + ACPI_STATUS Status; + ACPI_PCI_DEVICE *ListElement; + ACPI_PCI_DEVICE *ListHead = NULL; + + + /* + * Ascend namespace branch until the RootPciDevice is reached, building + * a list of device nodes. Loop will exit when either the PCI device is + * found, or the root of the namespace is reached. + */ + CurrentDevice = PciRegion; + while (1) + { + Status = AcpiGetParent (CurrentDevice, &ParentDevice); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Finished when we reach the PCI root device (PNP0A03 or PNP0A08) */ + + if (ParentDevice == RootPciDevice) + { + *ReturnListHead = ListHead; + return (AE_OK); + } + + ListElement = ACPI_ALLOCATE (sizeof (ACPI_PCI_DEVICE)); + if (!ListElement) + { + return (AE_NO_MEMORY); + } + + /* Put new element at the head of the list */ + + ListElement->Next = ListHead; + ListElement->Device = ParentDevice; + ListHead = ListElement; + + CurrentDevice = ParentDevice; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiHwProcessPciList + * + * PARAMETERS: PciId - Initial values for the PCI ID. May be + * modified by this function. + * ListHead - Device list created by + * AcpiHwBuildPciList + * + * RETURN: Status + * + * DESCRIPTION: Walk downward through the PCI device list, getting the device + * info for each, via the PCI configuration space and updating + * the PCI ID as necessary. Deletes the list during traversal. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiHwProcessPciList ( + ACPI_PCI_ID *PciId, + ACPI_PCI_DEVICE *ListHead) +{ + ACPI_STATUS Status = AE_OK; + ACPI_PCI_DEVICE *Info; + UINT16 BusNumber; + BOOLEAN IsBridge = TRUE; + + + ACPI_FUNCTION_NAME (HwProcessPciList); + + + ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, + "Input PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X\n", + PciId->Segment, PciId->Bus, PciId->Device, PciId->Function)); + + BusNumber = PciId->Bus; + + /* + * Descend down the namespace tree, collecting PCI device, function, + * and bus numbers. BusNumber is only important for PCI bridges. + * Algorithm: As we descend the tree, use the last valid PCI device, + * function, and bus numbers that are discovered, and assign them + * to the PCI ID for the target device. + */ + Info = ListHead; + while (Info) + { + Status = AcpiHwGetPciDeviceInfo (PciId, Info->Device, + &BusNumber, &IsBridge); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Info = Info->Next; + } + + ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, + "Output PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X " + "Status %X BusNumber %X IsBridge %X\n", + PciId->Segment, PciId->Bus, PciId->Device, PciId->Function, + Status, BusNumber, IsBridge)); + + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiHwDeletePciList + * + * PARAMETERS: ListHead - Device list created by + * AcpiHwBuildPciList + * + * RETURN: None + * + * DESCRIPTION: Free the entire PCI list. + * + ******************************************************************************/ + +static void +AcpiHwDeletePciList ( + ACPI_PCI_DEVICE *ListHead) +{ + ACPI_PCI_DEVICE *Next; + ACPI_PCI_DEVICE *Previous; + + + Next = ListHead; + while (Next) + { + Previous = Next; + Next = Previous->Next; + ACPI_FREE (Previous); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiHwGetPciDeviceInfo + * + * PARAMETERS: PciId - Initial values for the PCI ID. May be + * modified by this function. + * PciDevice - Handle for the PCI device object + * BusNumber - Where a PCI bridge bus number is returned + * IsBridge - Return value, indicates if this PCI + * device is a PCI bridge + * + * RETURN: Status + * + * DESCRIPTION: Get the device info for a single PCI device object. Get the + * _ADR (contains PCI device and function numbers), and for PCI + * bridge devices, get the bus number from PCI configuration + * space. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiHwGetPciDeviceInfo ( + ACPI_PCI_ID *PciId, + ACPI_HANDLE PciDevice, + UINT16 *BusNumber, + BOOLEAN *IsBridge) +{ + ACPI_STATUS Status; + ACPI_OBJECT_TYPE ObjectType; + UINT64 ReturnValue; + UINT64 PciValue; + + + /* We only care about objects of type Device */ + + Status = AcpiGetType (PciDevice, &ObjectType); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (ObjectType != ACPI_TYPE_DEVICE) + { + return (AE_OK); + } + + /* We need an _ADR. Ignore device if not present */ + + Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, + PciDevice, &ReturnValue); + if (ACPI_FAILURE (Status)) + { + return (AE_OK); + } + + /* + * From _ADR, get the PCI Device and Function and + * update the PCI ID. + */ + PciId->Device = ACPI_HIWORD (ACPI_LODWORD (ReturnValue)); + PciId->Function = ACPI_LOWORD (ACPI_LODWORD (ReturnValue)); + + /* + * If the previous device was a bridge, use the previous + * device bus number + */ + if (*IsBridge) + { + PciId->Bus = *BusNumber; + } + + /* + * Get the bus numbers from PCI Config space: + * + * First, get the PCI HeaderType + */ + *IsBridge = FALSE; + Status = AcpiOsReadPciConfiguration (PciId, + PCI_CFG_HEADER_TYPE_REG, &PciValue, 8); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* We only care about bridges (1=PciBridge, 2=CardBusBridge) */ + + PciValue &= PCI_HEADER_TYPE_MASK; + + if ((PciValue != PCI_TYPE_BRIDGE) && + (PciValue != PCI_TYPE_CARDBUS_BRIDGE)) + { + return (AE_OK); + } + + /* Bridge: Get the Primary BusNumber */ + + Status = AcpiOsReadPciConfiguration (PciId, + PCI_CFG_PRIMARY_BUS_NUMBER_REG, &PciValue, 8); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + *IsBridge = TRUE; + PciId->Bus = (UINT16) PciValue; + + /* Bridge: Get the Secondary BusNumber */ + + Status = AcpiOsReadPciConfiguration (PciId, + PCI_CFG_SECONDARY_BUS_NUMBER_REG, &PciValue, 8); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + *BusNumber = (UINT16) PciValue; + return (AE_OK); +} 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 d9e38061b7..b195512553 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c @@ -396,7 +396,7 @@ AcpiEnterSleepState ( return_ACPI_STATUS (Status); } ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "Entering sleep state [S%d]\n", SleepState)); + "Entering sleep state [S%u]\n", SleepState)); /* Clear the SLP_EN and SLP_TYP fields */ diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c index 23b508b0a2..7f2271bad0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c @@ -316,6 +316,13 @@ AcpiHwReadPort ( UINT32 i; + /* Truncate address to 16 bits if requested */ + + if (AcpiGbl_TruncateIoAddresses) + { + Address &= ACPI_UINT16_MAX; + } + /* Validate the entire request and perform the I/O */ Status = AcpiHwValidateIoRequest (Address, Width); @@ -383,6 +390,13 @@ AcpiHwWritePort ( UINT32 i; + /* Truncate address to 16 bits if requested */ + + if (AcpiGbl_TruncateIoAddresses) + { + Address &= ACPI_UINT16_MAX; + } + /* Validate the entire request and perform the I/O */ Status = AcpiHwValidateIoRequest (Address, Width); 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 418e20fb08..9670547fdc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acapps.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acapps.h @@ -121,6 +121,38 @@ #pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */ #endif +/* Common info for tool signons */ + +#define ACPICA_NAME "Intel ACPI Component Architecture" +#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2010 Intel Corporation" + +#if ACPI_MACHINE_WIDTH == 64 +#define ACPI_WIDTH "-64" + +#elif ACPI_MACHINE_WIDTH == 32 +#define ACPI_WIDTH "-32" + +#else +#error unknown ACPI_MACHINE_WIDTH +#define ACPI_WIDTH "-??" + +#endif + +/* Macros for signons and file headers */ + +#define ACPI_COMMON_SIGNON(UtilityName) \ + "\n%s\n%s version %8.8X%s [%s]\n%s\n\n", \ + ACPICA_NAME, \ + UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \ + ACPICA_COPYRIGHT + +#define ACPI_COMMON_HEADER(UtilityName, Prefix) \ + "%s%s\n%s%s version %8.8X%s [%s]\n%s%s\n%s\n", \ + Prefix, ACPICA_NAME, \ + Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \ + Prefix, ACPICA_COPYRIGHT, \ + Prefix + #define FILE_SUFFIX_DISASSEMBLY "dsl" #define ACPI_TABLE_FILE_SUFFIX ".dat" 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 9417b449dc..7aa4f47f09 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h @@ -193,6 +193,10 @@ #define ACPI_MAX_LOOP_ITERATIONS 0xFFFF +/* Maximum sleep allowed via Sleep() operator */ + +#define ACPI_MAX_SLEEP 20000 /* Two seconds */ + /****************************************************************************** * 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 2be2fd409b..7103e4fdab 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h @@ -228,6 +228,11 @@ AcpiDbDisplayObjects ( char *ObjTypeArg, char *DisplayCountArg); +void +AcpiDbDisplayInterfaces ( + char *ActionArg, + char *InterfaceNameArg); + ACPI_STATUS AcpiDbFindNameInNamespace ( char *NameArg); 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 ab32086e2f..7e7cea00aa 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h @@ -131,9 +131,19 @@ typedef const struct acpi_dmtable_info UINT8 Opcode; UINT8 Offset; char *Name; + UINT8 Flags; } ACPI_DMTABLE_INFO; +#define DT_LENGTH 0x01 /* Field is a subtable length */ +#define DT_FLAG 0x02 /* Field is a flag value */ +#define DT_NON_ZERO 0x04 /* Field must be non-zero */ + +/* TBD: Not used at this time */ + +#define DT_OPTIONAL 0x08 +#define DT_COUNT 0x10 + /* * Values for Opcode above. * Note: 0-7 must not change, used as a flag shift value @@ -173,17 +183,29 @@ typedef const struct acpi_dmtable_info #define ACPI_DMT_FADTPM 32 #define ACPI_DMT_BUF16 33 #define ACPI_DMT_IVRS 34 +#define ACPI_DMT_BUFFER 35 +#define ACPI_DMT_PCI_PATH 36 +#define ACPI_DMT_EINJACT 37 +#define ACPI_DMT_EINJINST 38 +#define ACPI_DMT_ERSTACT 39 +#define ACPI_DMT_ERSTINST 40 typedef void (*ACPI_DMTABLE_HANDLER) ( ACPI_TABLE_HEADER *Table); +typedef +ACPI_STATUS (*ACPI_CMTABLE_HANDLER) ( + void **PFieldList); + typedef struct acpi_dmtable_data { char *Signature; ACPI_DMTABLE_INFO *TableInfo; ACPI_DMTABLE_HANDLER TableHandler; + ACPI_CMTABLE_HANDLER CmTableHandler; + const unsigned char *Template; char *Name; } ACPI_DMTABLE_DATA; @@ -200,11 +222,18 @@ typedef struct acpi_op_walk_info } ACPI_OP_WALK_INFO; +/* + * TBD - another copy of this is in asltypes.h, fix + */ +#ifndef ASL_WALK_CALLBACK_DEFINED typedef ACPI_STATUS (*ASL_WALK_CALLBACK) ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context); +#define ASL_WALK_CALLBACK_DEFINED +#endif + typedef struct acpi_resource_tag { @@ -246,6 +275,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoErst[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoErst0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[]; @@ -306,12 +336,25 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWaet[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoWddt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[]; /* * dmtable */ +extern ACPI_DMTABLE_DATA AcpiDmTableData[]; + +UINT8 +AcpiDmGenerateChecksum ( + void *Table, + UINT32 Length, + UINT8 OriginalChecksum); + +ACPI_DMTABLE_DATA * +AcpiDmGetTableData ( + char *Signature); + void AcpiDmDumpDataTable ( ACPI_TABLE_HEADER *Table); @@ -539,6 +582,15 @@ AcpiDmIsStringBuffer ( /* * dmextern */ + +ACPI_STATUS +AcpiDmAddToExternalFileList ( + char *PathList); + +void +AcpiDmClearExternalFileList ( + void); + void AcpiDmAddToExternalList ( ACPI_PARSE_OBJECT *Op, @@ -755,4 +807,13 @@ AcpiDmCheckResourceReference ( ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState); + +/* + * acdisasm + */ +void +AdDisassemblerHeader ( + char *Filename); + + #endif /* __ACDISASM_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 40515579e5..c03e9e3657 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acevents.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acevents.h @@ -174,17 +174,13 @@ AcpiEvGpeDetect ( ACPI_GPE_XRUPT_INFO *GpeXruptList); ACPI_STATUS -AcpiEvUpdateGpeEnableMasks ( +AcpiEvUpdateGpeEnableMask ( ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_STATUS AcpiEvEnableGpe ( ACPI_GPE_EVENT_INFO *GpeEventInfo); -ACPI_STATUS -AcpiEvDisableGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); - ACPI_GPE_EVENT_INFO * AcpiEvGetGpeEventInfo ( ACPI_HANDLE GpeDevice, 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 a46de7d82f..693c61f18b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h @@ -293,7 +293,7 @@ char const *AcpiGbl_ExceptionNames_Env[] = "AE_NO_GLOBAL_LOCK", "AE_ABORT_METHOD", "AE_SAME_HANDLER", - "AE_WAKE_ONLY_GPE", + "AE_NO_HANDLER", "AE_OWNER_ID_LIMIT" }; 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 e0f8871fcd..2e158fbf79 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h @@ -199,6 +199,14 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableAmlDebugObject, FALSE); */ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE); +/* + * Optionally truncate I/O addresses to 16 bits. Provides compatibility + * with other ACPI implementations. NOTE: During ACPICA initialization, + * this value is set to TRUE if any Windows OSI strings have been + * requested by the BIOS. + */ +UINT8 ACPI_INIT_GLOBAL (AcpiGbl_TruncateIoAddresses, FALSE); + /* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ @@ -206,6 +214,7 @@ ACPI_TABLE_FADT AcpiGbl_FADT; UINT32 AcpiCurrentGpeCount; UINT32 AcpiGbl_TraceFlags; ACPI_NAME AcpiGbl_TraceMethodName; +BOOLEAN AcpiGbl_SystemAwakeAndRunning; #endif @@ -275,6 +284,10 @@ ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GpeLock; /* For GPE data structs and registers */ ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_HardwareLock; /* For ACPI H/W except GPE registers */ +/* Mutex for _OSI support */ + +ACPI_EXTERN ACPI_MUTEX AcpiGbl_OsiMutex; + /* Reader/Writer lock is used for namespace walk and dynamic table unload */ ACPI_EXTERN ACPI_RW_LOCK AcpiGbl_NamespaceRwLock; @@ -303,7 +316,7 @@ 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; - +ACPI_EXTERN ACPI_INTERFACE_HANDLER AcpiGbl_InterfaceHandler; /* Owner ID support */ @@ -322,8 +335,8 @@ ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration; ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall; ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent; ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized; -ACPI_EXTERN BOOLEAN AcpiGbl_SystemAwakeAndRunning; ACPI_EXTERN UINT8 AcpiGbl_OsiData; +ACPI_EXTERN ACPI_INTERFACE_INFO *AcpiGbl_SupportedInterfaces; #ifndef DEFINE_ACPI_GLOBALS @@ -355,6 +368,7 @@ extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_ ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList; ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList; ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats; +ACPI_EXTERN BOOLEAN AcpiGbl_DisableMemTracking; #endif @@ -464,6 +478,7 @@ ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose; ACPI_EXTERN ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList; +ACPI_EXTERN ACPI_EXTERNAL_FILE *AcpiGbl_ExternalFileList; #endif 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 be0b4df327..e63fe3f215 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/achware.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/achware.h @@ -200,13 +200,15 @@ AcpiHwWritePort ( /* * hwgpe - GPE support */ -ACPI_STATUS -AcpiHwLowDisableGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); +UINT32 +AcpiHwGetGpeRegisterBit ( + ACPI_GPE_EVENT_INFO *GpeEventInfo, + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo); ACPI_STATUS -AcpiHwWriteGpeEnableReg ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); +AcpiHwLowSetGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo, + UINT32 Action); ACPI_STATUS AcpiHwDisableGpeBlock ( @@ -248,6 +250,16 @@ AcpiHwEnableRuntimeGpeBlock ( void *Context); +/* + * hwpci - PCI configuration support + */ +ACPI_STATUS +AcpiHwDerivePciId ( + ACPI_PCI_ID *PciId, + ACPI_HANDLE RootPciDevice, + ACPI_HANDLE PciRegion); + + /* * hwtimer - ACPI Timer prototypes */ 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 1deced0113..062972f8e1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h @@ -275,8 +275,9 @@ typedef struct acpi_namespace_node UINT8 Flags; /* Miscellaneous flags */ ACPI_OWNER_ID OwnerId; /* Node creator */ ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */ + struct acpi_namespace_node *Parent; /* Parent node */ struct acpi_namespace_node *Child; /* First child */ - struct acpi_namespace_node *Peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */ + struct acpi_namespace_node *Peer; /* First peer */ /* * The following fields are used by the ASL compiler and disassembler only @@ -292,7 +293,7 @@ typedef struct acpi_namespace_node /* Namespace Node flags */ -#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */ +#define ANOBJ_RESERVED 0x01 /* Available for use */ #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */ #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ @@ -562,7 +563,6 @@ typedef struct acpi_gpe_event_info UINT8 Flags; /* Misc info about this GPE */ UINT8 GpeNumber; /* This GPE */ UINT8 RuntimeCount; /* References to a run GPE */ - UINT8 WakeupCount; /* References to a wake GPE */ } ACPI_GPE_EVENT_INFO; @@ -1080,6 +1080,7 @@ typedef struct acpi_bit_register_info ACPI_BITMASK_POWER_BUTTON_STATUS | \ ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ ACPI_BITMASK_RT_CLOCK_STATUS | \ + ACPI_BITMASK_PCIEXP_WAKE_STATUS | \ ACPI_BITMASK_WAKE_STATUS) #define ACPI_BITMASK_TIMER_ENABLE 0x0001 @@ -1136,17 +1137,23 @@ typedef struct acpi_bit_register_info #define ACPI_OSI_WIN_VISTA 0x07 #define ACPI_OSI_WINSRV_2008 0x08 #define ACPI_OSI_WIN_VISTA_SP1 0x09 -#define ACPI_OSI_WIN_7 0x0A +#define ACPI_OSI_WIN_VISTA_SP2 0x0A +#define ACPI_OSI_WIN_7 0x0B #define ACPI_ALWAYS_ILLEGAL 0x00 typedef struct acpi_interface_info { - char *Name; - UINT8 Value; + char *Name; + struct acpi_interface_info *Next; + UINT8 Flags; + UINT8 Value; } ACPI_INTERFACE_INFO; +#define ACPI_OSI_INVALID 0x01 +#define ACPI_OSI_DYNAMIC 0x02 + typedef struct acpi_port_info { char *Name; @@ -1246,6 +1253,14 @@ typedef struct acpi_external_list #define ACPI_IPATH_ALLOCATED 0x01 +typedef struct acpi_external_file +{ + char *Path; + struct acpi_external_file *Next; + +} ACPI_EXTERNAL_FILE; + + /***************************************************************************** * * Debugger @@ -1257,7 +1272,7 @@ typedef struct acpi_db_method_info ACPI_HANDLE MainThreadGate; ACPI_HANDLE ThreadCompleteGate; ACPI_HANDLE InfoGate; - UINT32 *Threads; + ACPI_THREAD_ID *Threads; UINT32 NumThreads; UINT32 NumCreated; UINT32 NumCompleted; 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 e9a6f42cbf..417cdc3b00 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h @@ -400,8 +400,8 @@ * the plist contains a set of parens to allow variable-length lists. * These macros are used for both the debug and non-debug versions of the code. */ -#define ACPI_ERROR_NAMESPACE(s, e) AcpiNsReportError (AE_INFO, s, e); -#define ACPI_ERROR_METHOD(s, n, p, e) AcpiNsReportMethodError (AE_INFO, s, n, p, e); +#define ACPI_ERROR_NAMESPACE(s, e) AcpiUtNamespaceError (AE_INFO, s, e); +#define ACPI_ERROR_METHOD(s, n, p, e) AcpiUtMethodError (AE_INFO, s, n, p, e); #define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist #define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist 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 9ddd12e210..5840bbc586 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h @@ -513,22 +513,6 @@ UINT32 AcpiNsLocal ( ACPI_OBJECT_TYPE Type); -void -AcpiNsReportError ( - const char *ModuleName, - UINT32 LineNumber, - const char *InternalName, - ACPI_STATUS LookupStatus); - -void -AcpiNsReportMethodError ( - const char *ModuleName, - UINT32 LineNumber, - const char *Message, - ACPI_NAMESPACE_NODE *Node, - const char *Path, - ACPI_STATUS LookupStatus); - void AcpiNsPrintNodePathname ( ACPI_NAMESPACE_NODE *Node, @@ -562,13 +546,4 @@ void AcpiNsTerminate ( void); -ACPI_NAMESPACE_NODE * -AcpiNsGetParentNode ( - ACPI_NAMESPACE_NODE *Node); - - -ACPI_NAMESPACE_NODE * -AcpiNsGetNextValidNode ( - ACPI_NAMESPACE_NODE *Node); - #endif /* __ACNAMESP_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acobject.h b/src/add-ons/kernel/bus_managers/acpi/include/acobject.h index f86f839267..ebb656a1b4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acobject.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acobject.h @@ -164,13 +164,14 @@ /* Values for Flag byte above */ -#define AOPOBJ_AML_CONSTANT 0x01 -#define AOPOBJ_STATIC_POINTER 0x02 -#define AOPOBJ_DATA_VALID 0x04 -#define AOPOBJ_OBJECT_INITIALIZED 0x08 -#define AOPOBJ_SETUP_COMPLETE 0x10 -#define AOPOBJ_SINGLE_DATUM 0x20 -#define AOPOBJ_MODULE_LEVEL 0x40 +#define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */ +#define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */ +#define AOPOBJ_DATA_VALID 0x04 /* Object is intialized and data is valid */ +#define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */ +#define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */ +#define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */ +#define AOPOBJ_MODULE_LEVEL 0x40 /* Method is actually module-level code */ +#define AOPOBJ_MODIFIED_NAMESPACE 0x80 /* Method modified the namespace */ /****************************************************************************** @@ -385,7 +386,6 @@ typedef struct acpi_object_thermal_zone UINT32 BaseByteOffset; /* Byte offset within containing object */\ UINT32 Value; /* Value to store into the Bank or Index register */\ UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\ - UINT8 AccessBitWidth; /* Read/Write size in bits (8-64) */ typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ 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 8fca0de339..61884f14d2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h @@ -143,8 +143,9 @@ #define ACPI_TOOLS 0x00002000 #define ACPI_EXAMPLE 0x00004000 #define ACPI_DRIVER 0x00008000 +#define DT_COMPILER 0x00010000 -#define ACPI_ALL_COMPONENTS 0x0000FFFF +#define ACPI_ALL_COMPONENTS 0x0001FFFF #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) /* Component IDs reserved for ACPI drivers */ 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 3a9da6c512..9187a4ab34 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h @@ -394,7 +394,7 @@ ACPI_STATUS AcpiOsReadPciConfiguration ( ACPI_PCI_ID *PciId, UINT32 Reg, - void *Value, + UINT64 *Value, UINT32 Width); ACPI_STATUS @@ -405,23 +405,9 @@ AcpiOsWritePciConfiguration ( UINT32 Width); -/* - * Interim function needed for PCI IRQ routing - */ -void -AcpiOsDerivePciId( - ACPI_HANDLE Device, - ACPI_HANDLE Region, - ACPI_PCI_ID **PciId); - - /* * Miscellaneous */ -ACPI_STATUS -AcpiOsValidateInterface ( - char *Interface); - BOOLEAN AcpiOsReadable ( void *Pointer, 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 0e68fabfeb..e2f310d3ee 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h @@ -120,7 +120,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20100428 +#define ACPI_CA_VERSION 0x20101013 #include "actypes.h" #include "actbl.h" @@ -130,6 +130,7 @@ */ extern UINT32 AcpiCurrentGpeCount; extern ACPI_TABLE_FADT AcpiGbl_FADT; +extern BOOLEAN AcpiGbl_SystemAwakeAndRunning; /* Runtime configuration of debug print levels */ @@ -147,6 +148,7 @@ extern ACPI_NAME AcpiGbl_TraceMethodName; extern UINT32 AcpiGbl_TraceFlags; extern UINT8 AcpiGbl_EnableAmlDebugObject; extern UINT8 AcpiGbl_CopyDsdtLocally; +extern UINT8 AcpiGbl_TruncateIoAddresses; /* @@ -202,9 +204,16 @@ ACPI_STATUS AcpiPurgeCachedObjects ( void); +ACPI_STATUS +AcpiInstallInterface ( + ACPI_STRING InterfaceName); + +ACPI_STATUS +AcpiRemoveInterface ( + ACPI_STRING InterfaceName); /* - * ACPI Memory managment + * ACPI Memory management */ void * AcpiAllocate ( @@ -427,6 +436,10 @@ ACPI_STATUS AcpiInstallExceptionHandler ( ACPI_EXCEPTION_HANDLER Handler); +ACPI_STATUS +AcpiInstallInterfaceHandler ( + ACPI_INTERFACE_HANDLER Handler); + /* * Event interfaces @@ -472,20 +485,24 @@ AcpiSetGpe ( ACPI_STATUS AcpiEnableGpe ( ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 GpeType); + UINT32 GpeNumber); ACPI_STATUS AcpiDisableGpe ( ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 GpeType); + UINT32 GpeNumber); ACPI_STATUS AcpiClearGpe ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber); +ACPI_STATUS +AcpiGpeWakeup ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT8 Action); + ACPI_STATUS AcpiGetGpeStatus ( ACPI_HANDLE GpeDevice, diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h b/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h index 9b881fb800..eb3b646e47 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h @@ -577,14 +577,15 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */ + /* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */ + + {{"_WDG", 0, ACPI_RTYPE_BUFFER}}, + {{"_WED", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER}}, + {{{0,0,0,0}, 0,0}} /* Table terminator */ }; #if 0 - /* Not implemented */ - - {{"_WDG", 0, ACPI_RTYPE_BUFFER}}, /* MS Extension */ - {{"_WED", 1, ACPI_RTYPE_PACKAGE}}, /* MS Extension */ /* This is an internally implemented control method, no need to check */ {{"_OSI", 1, ACPI_RTYPE_INTEGER}}, 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 d4696b8300..53cbea4216 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h @@ -204,23 +204,23 @@ typedef struct acpi_walk_state } ACPI_WALK_STATE; -/* Info used by AcpiPsInitObjects */ +/* Info used by AcpiNsInitializeObjects and AcpiDsInitializeObjects */ typedef struct acpi_init_walk_info { - UINT16 MethodCount; - UINT16 DeviceCount; - UINT16 OpRegionCount; - UINT16 FieldCount; - UINT16 BufferCount; - UINT16 PackageCount; - UINT16 OpRegionInit; - UINT16 FieldInit; - UINT16 BufferInit; - UINT16 PackageInit; - UINT16 ObjectCount; - ACPI_OWNER_ID OwnerId; UINT32 TableIndex; + UINT32 ObjectCount; + UINT32 MethodCount; + UINT32 DeviceCount; + UINT32 OpRegionCount; + UINT32 FieldCount; + UINT32 BufferCount; + UINT32 PackageCount; + UINT32 OpRegionInit; + UINT32 FieldInit; + UINT32 BufferInit; + UINT32 PackageInit; + ACPI_OWNER_ID OwnerId; } ACPI_INIT_WALK_INFO; @@ -294,11 +294,11 @@ typedef struct acpi_evaluate_info typedef struct acpi_device_walk_info { - UINT16 DeviceCount; - UINT16 Num_STA; - UINT16 Num_INI; ACPI_TABLE_DESC *TableDesc; ACPI_EVALUATE_INFO *EvaluateInfo; + UINT32 DeviceCount; + UINT32 Num_STA; + UINT32 Num_INI; } ACPI_DEVICE_WALK_INFO; 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 c25ad50a57..e45e2368fc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl.h @@ -224,7 +224,28 @@ typedef struct acpi_table_rsdp } ACPI_TABLE_RSDP; -#define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */ +/* Standalone struct for the ACPI 1.0 RSDP */ + +typedef struct acpi_rsdp_common +{ + char Signature[8]; + UINT8 Checksum; + char OemId[ACPI_OEM_ID_SIZE]; + UINT8 Revision; + UINT32 RsdtPhysicalAddress; + +} ACPI_RSDP_COMMON; + +/* Standalone struct for the extended part of the RSDP (ACPI 2.0+) */ + +typedef struct acpi_rsdp_extension +{ + UINT32 Length; + UINT64 XsdtPhysicalAddress; + UINT8 ExtendedChecksum; + UINT8 Reserved[3]; + +} ACPI_RSDP_EXTENSION; /******************************************************************************* 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 7f6ecf84a9..881d5ad758 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h @@ -151,8 +151,17 @@ #define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ #define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */ #define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ +#define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */ #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ +#ifdef ACPI_UNDEFINED_TABLES +/* + * These tables have been seen in the field, but no definition has been found + */ +#define ACPI_SIG_ATKG "ATKG" +#define ACPI_SIG_GSCI "GSCI" /* GMCH SCI table */ +#define ACPI_SIG_IEIT "IEIT" +#endif /* * All tables must be byte-packed to match the ACPI specification, since @@ -1119,6 +1128,47 @@ enum AcpiWdatInstructions }; +/******************************************************************************* + * + * WDDT - Watchdog Descriptor Table + * Version 1 + * + * Conforms to "Using the Intel ICH Family Watchdog Timer (WDT)", + * Version 001, September 2002 + * + ******************************************************************************/ + +typedef struct acpi_table_wddt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT16 SpecVersion; + UINT16 TableVersion; + UINT16 PciVendorId; + ACPI_GENERIC_ADDRESS Address; + UINT16 MaxCount; /* Maximum counter value supported */ + UINT16 MinCount; /* Minimum counter value supported */ + UINT16 Period; + UINT16 Status; + UINT16 Capability; + +} ACPI_TABLE_WDDT; + +/* Flags for Status field above */ + +#define ACPI_WDDT_AVAILABLE (1) +#define ACPI_WDDT_ACTIVE (1<<1) +#define ACPI_WDDT_TCO_OS_OWNED (1<<2) +#define ACPI_WDDT_USER_RESET (1<<11) +#define ACPI_WDDT_WDT_RESET (1<<12) +#define ACPI_WDDT_POWER_FAIL (1<<13) +#define ACPI_WDDT_UNKNOWN_RESET (1<<14) + +/* Flags for Capability field above */ + +#define ACPI_WDDT_AUTO_RESET (1) +#define ACPI_WDDT_ALERT_SUPPORT (1<<1) + + /******************************************************************************* * * WDRT - Watchdog Resource Table 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 601e87e908..e4290ae55d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actypes.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actypes.h @@ -188,7 +188,6 @@ * * ACPI_SIZE 16/32/64-bit unsigned value * ACPI_NATIVE_INT 16/32/64-bit signed value - * */ /******************************************************************************* @@ -205,6 +204,16 @@ typedef COMPILER_DEPENDENT_INT64 INT64; /*! [End] no source code translation !*/ +/* + * Value returned by AcpiOsGetThreadId. There is no standard "thread_id" + * across operating systems or even the various UNIX systems. Since ACPICA + * only needs the thread ID as a unique thread identifier, we use a UINT64 + * as the only common data type - it will accommodate any type of pointer or + * any type of integer. It is up to the host-dependent OSL to cast the + * native thread ID type to a UINT64 (in AcpiOsGetThreadId). + */ +#define ACPI_THREAD_ID UINT64 + /******************************************************************************* * @@ -286,12 +295,6 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS; * ******************************************************************************/ -/* Value returned by AcpiOsGetThreadId */ - -#ifndef ACPI_THREAD_ID -#define ACPI_THREAD_ID ACPI_SIZE -#endif - /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */ #ifndef ACPI_CPU_FLAGS @@ -456,21 +459,6 @@ typedef UINT8 ACPI_OWNER_ID; #define ACPI_OWNER_ID_MAX 0xFF -typedef struct uint64_struct -{ - UINT32 Lo; - UINT32 Hi; - -} UINT64_STRUCT; - -typedef union uint64_overlay -{ - UINT64 Full; - UINT64_STRUCT Part; - -} UINT64_OVERLAY; - - #define ACPI_INTEGER_BIT_SIZE 64 #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ #define ACPI_MAX64_DECIMAL_DIGITS 20 @@ -742,16 +730,11 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_GPE_MAX 0xFF #define ACPI_NUM_GPE 256 -/* Actions for AcpiSetGpe */ +/* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */ #define ACPI_GPE_ENABLE 0 #define ACPI_GPE_DISABLE 1 - -/* GpeTypes for AcpiEnableGpe and AcpiDisableGpe */ - -#define ACPI_GPE_TYPE_WAKE (UINT8) 0x01 -#define ACPI_GPE_TYPE_RUNTIME (UINT8) 0x02 -#define ACPI_GPE_TYPE_WAKE_RUN (UINT8) 0x03 +#define ACPI_GPE_CONDITIONAL_ENABLE 2 /* * GPE info flags - Per GPE @@ -1104,6 +1087,11 @@ ACPI_STATUS (*ACPI_WALK_CALLBACK) ( void *Context, void **ReturnValue); +typedef +UINT32 (*ACPI_INTERFACE_HANDLER) ( + ACPI_STRING InterfaceName, + UINT32 Supported); + /* Interrupt handler return values */ 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 ae406c3882..2d73da64fa 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acutils.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acutils.h @@ -536,10 +536,6 @@ AcpiUtDeleteInternalObjectList ( * uteval - object evaluation */ ACPI_STATUS -AcpiUtOsiImplementation ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS AcpiUtEvaluateObject ( ACPI_NAMESPACE_NODE *PrefixNode, char *Path, @@ -661,6 +657,34 @@ AcpiUtGetObjectSize( ACPI_SIZE *ObjLength); +/* + * utosi - Support for the _OSI predefined control method + */ +ACPI_STATUS +AcpiUtInitializeInterfaces ( + void); + +void +AcpiUtInterfaceTerminate ( + void); + +ACPI_STATUS +AcpiUtInstallInterface ( + ACPI_STRING InterfaceName); + +ACPI_STATUS +AcpiUtRemoveInterface ( + ACPI_STRING InterfaceName); + +ACPI_INTERFACE_INFO * +AcpiUtGetInterface ( + ACPI_STRING InterfaceName); + +ACPI_STATUS +AcpiUtOsiImplementation ( + ACPI_WALK_STATE *WalkState); + + /* * utstate - Generic state creation/cache routines */ @@ -766,6 +790,10 @@ void AcpiUtStrupr ( char *SrcString); +void +AcpiUtStrlwr ( + char *SrcString); + void AcpiUtPrintString ( char *String, @@ -790,24 +818,6 @@ AcpiUtStrtoul64 ( UINT32 Base, UINT64 *RetInteger); -void ACPI_INTERNAL_VAR_XFACE -AcpiUtPredefinedWarning ( - const char *ModuleName, - UINT32 LineNumber, - char *Pathname, - UINT8 NodeFlags, - const char *Format, - ...); - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtPredefinedInfo ( - const char *ModuleName, - UINT32 LineNumber, - char *Pathname, - UINT8 NodeFlags, - const char *Format, - ...); - /* Values for Base above (16=Hex, 10=Decimal) */ #define ACPI_ANY_BASE 0 @@ -957,7 +967,44 @@ AcpiUtCreateList ( UINT16 ObjectSize, ACPI_MEMORY_LIST **ReturnCache); +#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ -#endif + +/* + * utxferror - various error/warning output functions + */ +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedWarning ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...); + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedInfo ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...); + +void +AcpiUtNamespaceError ( + const char *ModuleName, + UINT32 LineNumber, + const char *InternalName, + ACPI_STATUS LookupStatus); + +void +AcpiUtMethodError ( + const char *ModuleName, + UINT32 LineNumber, + const char *Message, + ACPI_NAMESPACE_NODE *Node, + const char *Path, + ACPI_STATUS LookupStatus); #endif /* _ACUTILS_H */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/accygwin.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/accygwin.h deleted file mode 100644 index 6936024839..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/accygwin.h +++ /dev/null @@ -1,166 +0,0 @@ -/****************************************************************************** - * - * Name: accygwin.h - OS specific defines, etc. for cygwin environment - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#ifndef __ACCYGWIN_H__ -#define __ACCYGWIN_H__ - -/* - * ACPICA configuration - */ -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_USE_DO_WHILE_0 -#define ACPI_THREAD_ID pthread_t -#define ACPI_FLUSH_CPU_CACHE() -/* - * This is needed since sem_timedwait does not appear to work properly - * on cygwin (always hangs forever). - */ -#define ACPI_USE_ALTERNATE_TIMEOUT - - -#include -#include -#include -#include -#include - -#if defined(__ia64__) || defined(__x86_64__) -#define ACPI_MACHINE_WIDTH 64 -#define COMPILER_DEPENDENT_INT64 long -#define COMPILER_DEPENDENT_UINT64 unsigned long -#else -#define ACPI_MACHINE_WIDTH 32 -#define COMPILER_DEPENDENT_INT64 long long -#define COMPILER_DEPENDENT_UINT64 unsigned long long -#define ACPI_USE_NATIVE_DIVIDE -#endif - -#ifndef __cdecl -#define __cdecl -#endif - -#ifdef _ANSI -#define inline -#endif - -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) if (GLptr) Acq=1; else Acq=0; -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = 1 - - -/* Cygwin uses GCC */ - -#include "acgcc.h" - -#endif /* __ACCYGWIN_H__ */ 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 443f72d768..cd58839b60 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 @@ -148,9 +148,10 @@ #define ACPI_CONSTANT_EVAL_ONLY #define ACPI_LARGE_NAMESPACE_NODE #define ACPI_DATA_TABLE_DISASSEMBLY +#define ACPI_SINGLE_THREADED #endif -/* AcpiExec configuration */ +/* AcpiExec and AcpiBin configuration */ #ifdef ACPI_EXEC_APP #define ACPI_APPLICATION @@ -159,6 +160,11 @@ #define ACPI_DBG_TRACK_ALLOCATIONS #endif +#ifdef ACPI_BIN_APP +#define ACPI_APPLICATION +#define ACPI_SINGLE_THREADED +#endif + /* Linkable ACPICA library */ #ifdef ACPI_LIBRARY @@ -278,6 +284,12 @@ #define ACPI_FLUSH_CPU_CACHE() #endif +/* "inline" keywords - configurable since inline is not standardized */ + +#ifndef ACPI_INLINE +#define ACPI_INLINE +#endif + /* * Configurable calling conventions: * 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 deleted file mode 100644 index 145b7bb0de..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acfreebsd.h +++ /dev/null @@ -1,178 +0,0 @@ -/****************************************************************************** - * - * Name: acfreebsd.h - OS specific defines, etc. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#ifndef __ACFREEBSD_H__ -#define __ACFREEBSD_H__ - - -/* FreeBSD uses GCC */ - -#include "acgcc.h" -#include -#include - -#define ACPI_UINTPTR_T uintptr_t - -#define ACPI_USE_DO_WHILE_0 -#define ACPI_USE_LOCAL_CACHE -#define ACPI_USE_SYSTEM_CLIBRARY - -#ifdef _KERNEL - -#include -#include -#include -#include -#include - -#include "opt_acpi.h" - -#define ACPI_THREAD_ID lwpid_t -#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX - -#ifdef ACPI_DEBUG -#define ACPI_DEBUG_OUTPUT /* for backward compatibility */ -#define ACPI_DISASSEMBLER -#endif - -#ifdef ACPI_DEBUG_OUTPUT -#include "opt_ddb.h" -#ifdef DDB -#define ACPI_DEBUGGER -#endif /* DDB */ -#endif /* ACPI_DEBUG_OUTPUT */ - -#ifdef DEBUGGER_THREADING -#undef DEBUGGER_THREADING -#endif /* DEBUGGER_THREADING */ - -#define DEBUGGER_THREADING 0 /* integrated with DDB */ - -#else /* _KERNEL */ - -#if __STDC_HOSTED__ -#include -#endif - -#define ACPI_THREAD_ID pthread_t - -#define ACPI_USE_STANDARD_HEADERS - -#define ACPI_FLUSH_CPU_CACHE() -#define __cdecl - -#endif /* _KERNEL */ - -#endif /* __ACFREEBSD_H__ */ 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 d0098b1800..9c7c9b9444 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 @@ -116,6 +116,8 @@ #ifndef __ACGCC_H__ #define __ACGCC_H__ +#define ACPI_INLINE __inline__ + /* Function name is used for debug output. Non-ANSI, compiler-dependent */ #define ACPI_GET_FUNCTION_NAME __FUNCTION__ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/achaiku.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/achaiku.h index 82bbdc550d..0790f394a1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/achaiku.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/achaiku.h @@ -136,7 +136,7 @@ #define ACPI_USE_NATIVE_DIVIDE -#define ACPI_THREAD_ID thread_id +// #define ACPI_THREAD_ID thread_id #define ACPI_SEMAPHORE sem_id #define ACPI_SPINLOCK spinlock * #define ACPI_CPU_FLAGS cpu_status 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 a7e75ec603..415e9b00df 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 @@ -116,11 +116,11 @@ #ifndef __ACINTEL_H__ #define __ACINTEL_H__ +/* Configuration specific to Intel 64-bit C compiler */ -#define COMPILER_DEPENDENT_INT64 __int64 -#define COMPILER_DEPENDENT_UINT64 unsigned __int64 - -#define inline __inline +#define COMPILER_DEPENDENT_INT64 __int64 +#define COMPILER_DEPENDENT_UINT64 unsigned __int64 +#define ACPI_INLINE __inline /* * Calling conventions: @@ -135,20 +135,6 @@ #define ACPI_INTERNAL_XFACE #define ACPI_INTERNAL_VAR_XFACE -/* - * Math helper functions - */ -#define ACPI_DIV_64_BY_32(n, n_hi, n_lo, d32, q32, r32) \ -{ \ - q32 = n / d32; \ - r32 = n % d32; \ -} - -#define ACPI_SHIFT_RIGHT_64(n, n_hi, n_lo) \ -{ \ - n <<= 1; \ -} - /* remark 981 - operands evaluated in no particular order */ #pragma warning(disable:981) 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 deleted file mode 100644 index 9009689c93..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/aclinux.h +++ /dev/null @@ -1,233 +0,0 @@ -/****************************************************************************** - * - * Name: aclinux.h - OS specific defines, etc. for Linux - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#ifndef __ACLINUX_H__ -#define __ACLINUX_H__ - -/* Common (in-kernel/user-space) ACPICA configuration */ - -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_USE_DO_WHILE_0 -#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE - - -#ifdef __KERNEL__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Host-dependent types and defines for in-kernel ACPICA */ - -#define ACPI_MACHINE_WIDTH BITS_PER_LONG -#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); -#define strtoul simple_strtoul - -#define ACPI_CACHE_T struct kmem_cache -#define ACPI_SPINLOCK spinlock_t * -#define ACPI_CPU_FLAGS unsigned long -#define ACPI_THREAD_ID struct task_struct * - -#else /* !__KERNEL__ */ - -#include -#include -#include -#include -#include - -/* Host-dependent types and defines for user-space ACPICA */ - -#define ACPI_FLUSH_CPU_CACHE() -#define ACPI_THREAD_ID pthread_t - -#if defined(__ia64__) || defined(__x86_64__) -#define ACPI_MACHINE_WIDTH 64 -#define COMPILER_DEPENDENT_INT64 long -#define COMPILER_DEPENDENT_UINT64 unsigned long -#else -#define ACPI_MACHINE_WIDTH 32 -#define COMPILER_DEPENDENT_INT64 long long -#define COMPILER_DEPENDENT_UINT64 unsigned long long -#define ACPI_USE_NATIVE_DIVIDE -#endif - -#ifndef __cdecl -#define __cdecl -#endif - -#endif /* __KERNEL__ */ - -/* Linux uses GCC */ - -#include "acgcc.h" - - -#ifdef __KERNEL__ -/* - * Overrides for in-kernel ACPICA - */ -static inline acpi_thread_id acpi_os_get_thread_id(void) -{ - return current; -} - -/* - * The irqs_disabled() check is for resume from RAM. - * Interrupts are off during resume, just like they are for boot. - * However, boot has (system_state != SYSTEM_RUNNING) - * to quiet __might_sleep() in kmalloc() and resume does not. - */ -#include -static inline void *acpi_os_allocate(acpi_size size) -{ - return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); -} - -static inline void *acpi_os_allocate_zeroed(acpi_size size) -{ - return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); -} - -static inline void *acpi_os_acquire_object(acpi_cache_t * cache) -{ - return kmem_cache_zalloc(cache, - irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); -} - -#define ACPI_ALLOCATE(a) acpi_os_allocate(a) -#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) -#define ACPI_FREE(a) kfree(a) - -/* Used within ACPICA to show where it is safe to preempt execution */ - -#define ACPI_PREEMPTION_POINT() \ - do { \ - if (!irqs_disabled()) \ - cond_resched(); \ - } while (0) - -#endif /* __KERNEL__ */ - -#endif /* __ACLINUX_H__ */ 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 62e69d16dc..28a072780f 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 @@ -116,8 +116,9 @@ #ifndef __ACMSVC_H__ #define __ACMSVC_H__ -#define COMPILER_DEPENDENT_INT64 __int64 -#define COMPILER_DEPENDENT_UINT64 unsigned __int64 +#define COMPILER_DEPENDENT_INT64 __int64 +#define COMPILER_DEPENDENT_UINT64 unsigned __int64 +#define ACPI_INLINE __inline /* * Calling conventions: @@ -179,5 +180,4 @@ /* warn C4131: uses old-style declarator (iASL compiler only) */ #pragma warning(disable:4131) - #endif /* __ACMSVC_H__ */ 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 deleted file mode 100644 index 302d719f2a..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acnetbsd.h +++ /dev/null @@ -1,188 +0,0 @@ -/****************************************************************************** - * - * Name: acnetbsd.h - OS specific defines, etc. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#ifndef __ACNETBSD_H__ -#define __ACNETBSD_H__ - -/* NetBSD uses GCC */ - -#include "acgcc.h" - -#ifdef _LP64 -#define ACPI_MACHINE_WIDTH 64 -#else -#define ACPI_MACHINE_WIDTH 32 -#endif - -#define COMPILER_DEPENDENT_INT64 int64_t -#define COMPILER_DEPENDENT_UINT64 uint64_t - -#ifdef _KERNEL -#include "opt_acpi.h" /* collect build-time options here */ - -#include -#include -#include -#include - -#define asm __asm - -#define ACPI_USE_NATIVE_DIVIDE - -#define ACPI_SYSTEM_XFACE -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE - -#ifdef ACPI_DEBUG -#define ACPI_DEBUG_OUTPUT -#define ACPI_DBG_TRACK_ALLOCATIONS -#ifdef DEBUGGER_THREADING -#undef DEBUGGER_THREADING -#endif /* DEBUGGER_THREADING */ -#define DEBUGGER_THREADING 0 /* integrated with DDB */ -#include "opt_ddb.h" -#ifdef DDB -#define ACPI_DISASSEMBLER -#define ACPI_DEBUGGER -#endif /* DDB */ -#endif /* ACPI_DEBUG */ - -static __inline int -isprint(int ch) -{ - return(isspace(ch) || isascii(ch)); -} - -#else /* _KERNEL */ - -#include - -/* Not building kernel code, so use libc */ -#define ACPI_USE_STANDARD_HEADERS - -#define __cli() -#define __sti() - -/* XXX */ -#define __inline inline - -#endif /* _KERNEL */ - -/* Always use NetBSD code over our local versions */ -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_USE_NATIVE_DIVIDE - -#endif /* __ACNETBSD_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acos2.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acos2.h deleted file mode 100644 index 90e6b2e491..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acos2.h +++ /dev/null @@ -1,172 +0,0 @@ -/****************************************************************************** - * - * Name: acos2.h - OS/2 specific defines, etc. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#ifndef __ACOS2_H__ -#define __ACOS2_H__ -#define INCL_LONGLONG -#include - - -#define ACPI_MACHINE_WIDTH 32 - -#define COMPILER_DEPENDENT_INT64 long long -#define COMPILER_DEPENDENT_UINT64 unsigned long long -#define ACPI_USE_NATIVE_DIVIDE - -#define ACPI_SYSTEM_XFACE APIENTRY -#define ACPI_EXTERNAL_XFACE APIENTRY -#define ACPI_INTERNAL_XFACE APIENTRY -#define ACPI_INTERNAL_VAR_XFACE APIENTRY - -/* - * Some compilers complain about unused variables. Sometimes we don't want to - * use all the variables (most specifically for _THIS_MODULE). This allow us - * to to tell the compiler warning in a per-variable manner that a variable - * is unused. - */ -#define ACPI_UNUSED_VAR - -#define ACPI_USE_STANDARD_HEADERS -#include - -#define ACPI_FLUSH_CPU_CACHE() Wbinvd() -void Wbinvd(void); - -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) Acq = OSPMAcquireGlobalLock(GLptr) -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) Pnd = OSPMReleaseGlobalLock(GLptr) -unsigned short OSPMAcquireGlobalLock (void *); -unsigned short OSPMReleaseGlobalLock (void *); - -#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ -{ \ - unsigned long long val = 0LL; \ - val = n_lo | ( ((unsigned long long)h_hi) << 32 ); \ - __llrotr (val,1); \ - n_hi = (unsigned long)((val >> 32 ) & 0xffffffff ); \ - n_lo = (unsigned long)(val & 0xffffffff); \ -} - -/* IBM VAC does not have inline */ - -#if __IBMC__ || __IBMCPP__ -#define inline -#endif - -#ifndef ACPI_ASL_COMPILER -#define ACPI_USE_LOCAL_CACHE -#undef ACPI_DEBUGGER -#endif - -#endif /* __ACOS2_H__ */ 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 deleted file mode 100644 index 583f677b47..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin.h +++ /dev/null @@ -1,220 +0,0 @@ -/****************************************************************************** - * - * Name: acwin.h - OS specific defines, etc. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#ifndef __ACWIN_H__ -#define __ACWIN_H__ - -/*! [Begin] no source code translation (Keep the include) */ - -/* Windows uses VC */ -#ifdef _MSC_VER -#include "acmsvc.h" -#endif -/*! [End] no source code translation !*/ - -#define ACPI_MACHINE_WIDTH 32 - -#define inline __inline - -#define ACPI_USE_STANDARD_HEADERS - -#ifdef ACPI_DEFINE_ALTERNATE_TYPES -/* - * Types used only in (Linux) translated source, defined here to enable - * cross-platform compilation (i.e., generate the Linux code on Windows, - * for test purposes only) - */ -typedef int s32; -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef COMPILER_DEPENDENT_UINT64 u64; -#endif - - -/* - * Handle platform- and compiler-specific assembly language differences. - * - * Notes: - * 1) Interrupt 3 is used to break into a debugger - * 2) Interrupts are turned off during ACPI register setup - */ - -/*! [Begin] no source code translation */ - -#ifdef ACPI_APPLICATION -#define ACPI_FLUSH_CPU_CACHE() -#else -#define ACPI_FLUSH_CPU_CACHE() __asm {WBINVD} -#endif - -#ifdef _DEBUG -#define ACPI_SIMPLE_RETURN_MACROS -#endif - -/*! [End] no source code translation !*/ - -/* - * Global Lock acquire/release code - * - * Note: Handles case where the FACS pointer is null - */ -#define ACPI_ACQUIRE_GLOBAL_LOCK(FacsPtr, Acq) __asm \ -{ \ - __asm mov eax, 0xFF \ - __asm mov ecx, FacsPtr \ - __asm or ecx, ecx \ - __asm jz exit_acq \ - __asm lea ecx, [ecx].GlobalLock \ - \ - __asm acq10: \ - __asm mov eax, [ecx] \ - __asm mov edx, eax \ - __asm and edx, 0xFFFFFFFE \ - __asm bts edx, 1 \ - __asm adc edx, 0 \ - __asm lock cmpxchg dword ptr [ecx], edx \ - __asm jnz acq10 \ - \ - __asm cmp dl, 3 \ - __asm sbb eax, eax \ - \ - __asm exit_acq: \ - __asm mov Acq, al \ -} - -#define ACPI_RELEASE_GLOBAL_LOCK(FacsPtr, Pnd) __asm \ -{ \ - __asm xor eax, eax \ - __asm mov ecx, FacsPtr \ - __asm or ecx, ecx \ - __asm jz exit_rel \ - __asm lea ecx, [ecx].GlobalLock \ - \ - __asm Rel10: \ - __asm mov eax, [ecx] \ - __asm mov edx, eax \ - __asm and edx, 0xFFFFFFFC \ - __asm lock cmpxchg dword ptr [ecx], edx \ - __asm jnz Rel10 \ - \ - __asm cmp dl, 3 \ - __asm and eax, 1 \ - \ - __asm exit_rel: \ - __asm mov Pnd, al \ -} - -#endif /* __ACWIN_H__ */ 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 deleted file mode 100644 index 64c1f99702..0000000000 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin64.h +++ /dev/null @@ -1,155 +0,0 @@ -/****************************************************************************** - * - * Name: acwin.h - OS specific defines, etc. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#ifndef __ACWIN64_H__ -#define __ACWIN64_H__ - -/*! [Begin] no source code translation (Keep the include) */ - -#include "acintel.h" -/*! [End] no source code translation !*/ - -#define ACPI_MACHINE_WIDTH 64 - -#define ACPI_USE_STANDARD_HEADERS - -/* - * Handle platform- and compiler-specific assembly language differences. - * - * Notes: - * 1) Interrupt 3 is used to break into a debugger - * 2) Interrupts are turned off during ACPI register setup - */ - -/*! [Begin] no source code translation */ - -#define ACPI_FLUSH_CPU_CACHE() - -/* - * For Acpi applications, we don't want to try to access the global lock - */ -#ifdef ACPI_APPLICATION -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) if (AcpiGbl_GlobalLockPresent) {Acq = 0xFF;} else {Acq = 0;} -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) if (AcpiGbl_GlobalLockPresent) {Pnd = 0xFF;} else {Pnd = 0;} -#else - -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) - -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) - -#endif - - -#endif /* __ACWIN_H__ */ 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 7a8dc6d1a7..b2af47f215 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c @@ -435,7 +435,7 @@ AcpiNsLookup ( while (!AcpiNsOpensScope (PrefixNode->Type) && PrefixNode->Type != ACPI_TYPE_ANY) { - PrefixNode = AcpiNsGetParentNode (PrefixNode); + PrefixNode = PrefixNode->Parent; } } } @@ -516,7 +516,7 @@ AcpiNsLookup ( /* Backup to the parent node */ NumCarats++; - ThisNode = AcpiNsGetParentNode (ThisNode); + ThisNode = ThisNode->Parent; if (!ThisNode) { /* Current scope has no parent scope */ @@ -531,7 +531,7 @@ AcpiNsLookup ( if (SearchParentFlag == ACPI_NS_NO_UPSEARCH) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Search scope is [%4.4s], path has %d carat(s)\n", + "Search scope is [%4.4s], path has %u carat(s)\n", AcpiUtGetNodeName (ThisNode), NumCarats)); } } @@ -592,7 +592,7 @@ AcpiNsLookup ( Path++; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Multi Pathname (%d Segments, Flags=%X)\n", + "Multi Pathname (%u Segments, Flags=%X)\n", NumSegments, Flags)); break; 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 aadafbf781..a879fc1ea8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c @@ -255,7 +255,7 @@ AcpiNsRemoveNode ( ACPI_FUNCTION_TRACE_PTR (NsRemoveNode, Node); - ParentNode = AcpiNsGetParentNode (Node); + ParentNode = Node->Parent; PrevNode = NULL; NextNode = ParentNode->Child; @@ -265,34 +265,22 @@ AcpiNsRemoveNode ( while (NextNode != Node) { PrevNode = NextNode; - NextNode = PrevNode->Peer; + NextNode = NextNode->Peer; } if (PrevNode) { /* Node is not first child, unlink it */ - PrevNode->Peer = NextNode->Peer; - if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST) - { - PrevNode->Flags |= ANOBJ_END_OF_PEER_LIST; - } + PrevNode->Peer = Node->Peer; } else { - /* Node is first child (has no previous peer) */ - - if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST) - { - /* No peers at all */ - - ParentNode->Child = NULL; - } - else - { /* Link peer list to parent */ - - ParentNode->Child = NextNode->Peer; - } + /* + * Node is first child (has no previous peer). + * Link peer list to parent + */ + ParentNode->Child = Node->Peer; } /* Delete the node and any attached objects */ @@ -336,38 +324,47 @@ AcpiNsInstallNode ( ACPI_FUNCTION_TRACE (NsInstallNode); - /* - * Get the owner ID from the Walk state. The owner ID is used to track - * table deletion and deletion of objects created by methods. - */ if (WalkState) { + /* + * Get the owner ID from the Walk state. The owner ID is used to + * track table deletion and deletion of objects created by methods. + */ OwnerId = WalkState->OwnerId; + + if ((WalkState->MethodDesc) && + (ParentNode != WalkState->MethodNode)) + { + /* + * A method is creating a new node that is not a child of the + * method (it is non-local). Mark the executing method as having + * modified the namespace. This is used for cleanup when the + * method exits. + */ + WalkState->MethodDesc->Method.Flags |= AOPOBJ_MODIFIED_NAMESPACE; + } } /* Link the new entry into the parent and existing children */ + Node->Peer = NULL; + Node->Parent = ParentNode; ChildNode = ParentNode->Child; + if (!ChildNode) { ParentNode->Child = Node; - Node->Flags |= ANOBJ_END_OF_PEER_LIST; - Node->Peer = ParentNode; } else { - while (!(ChildNode->Flags & ANOBJ_END_OF_PEER_LIST)) + /* Add node to the end of the peer list */ + + while (ChildNode->Peer) { ChildNode = ChildNode->Peer; } ChildNode->Peer = Node; - - /* Clear end-of-list flag */ - - ChildNode->Flags &= ~ANOBJ_END_OF_PEER_LIST; - Node->Flags |= ANOBJ_END_OF_PEER_LIST; - Node->Peer = ParentNode; } /* Init the new entry */ @@ -402,9 +399,8 @@ void AcpiNsDeleteChildren ( ACPI_NAMESPACE_NODE *ParentNode) { - ACPI_NAMESPACE_NODE *ChildNode; ACPI_NAMESPACE_NODE *NextNode; - UINT8 Flags; + ACPI_NAMESPACE_NODE *NodeToDelete; ACPI_FUNCTION_TRACE_PTR (NsDeleteChildren, ParentNode); @@ -415,39 +411,27 @@ AcpiNsDeleteChildren ( return_VOID; } - /* If no children, all done! */ - - ChildNode = ParentNode->Child; - if (!ChildNode) - { - return_VOID; - } - /* Deallocate all children at this level */ - do + NextNode = ParentNode->Child; + while (NextNode) { - /* Get the things we need */ - - NextNode = ChildNode->Peer; - Flags = ChildNode->Flags; - /* Grandchildren should have all been deleted already */ - if (ChildNode->Child) + if (NextNode->Child) { ACPI_ERROR ((AE_INFO, "Found a grandchild! P=%p C=%p", - ParentNode, ChildNode)); + ParentNode, NextNode)); } /* * Delete this child node and move on to the next child in the list. * No need to unlink the node since we are deleting the entire branch. */ - AcpiNsDeleteNode (ChildNode); - ChildNode = NextNode; - - } while (!(Flags & ANOBJ_END_OF_PEER_LIST)); + NodeToDelete = NextNode; + NextNode = NextNode->Peer; + AcpiNsDeleteNode (NodeToDelete); + }; /* Clear the parent's child pointer */ @@ -533,7 +517,7 @@ AcpiNsDeleteNamespaceSubtree ( /* Move up the tree to the grandparent */ - ParentNode = AcpiNsGetParentNode (ParentNode); + ParentNode = ParentNode->Parent; } } @@ -655,7 +639,7 @@ AcpiNsDeleteNamespaceByOwner ( /* Move up the tree to the grandparent */ - ParentNode = AcpiNsGetParentNode (ParentNode); + ParentNode = ParentNode->Parent; } } 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 0b0af613f2..242033126f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c @@ -537,7 +537,7 @@ AcpiNsDumpOneObject ( return (AE_OK); } - AcpiOsPrintf ("(R%d)", ObjDesc->Common.ReferenceCount); + AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount); switch (Type) { 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 770235e8e3..39067bb440 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c @@ -185,25 +185,25 @@ AcpiNsInitializeObjects ( /* Walk entire namespace from the supplied root */ Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, - &Info, NULL); + ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, + &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd " - "Buffers %hd/%hd Packages (%hd nodes)\n", + "\nInitialized %u/%u Regions %u/%u Fields %u/%u " + "Buffers %u/%u Packages (%u nodes)\n", Info.OpRegionInit, Info.OpRegionCount, Info.FieldInit, Info.FieldCount, Info.BufferInit, Info.BufferCount, Info.PackageInit, Info.PackageCount, Info.ObjectCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%hd Control Methods found\n", Info.MethodCount)); + "%u Control Methods found\n", Info.MethodCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%hd Op Regions found\n", Info.OpRegionCount)); + "%u Op Regions found\n", Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } @@ -285,6 +285,16 @@ AcpiNsInitializeDevices ( Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); + /* + * Any _OSI requests should be completed by now. If the BIOS has + * requested any Windows OSI strings, we will always truncate + * I/O addresses to 16 bits -- for Windows compatibility. + */ + if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000) + { + AcpiGbl_TruncateIoAddresses = TRUE; + } + ACPI_FREE (Info.EvaluateInfo); if (ACPI_FAILURE (Status)) { @@ -292,8 +302,8 @@ AcpiNsInitializeDevices ( } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nExecuted %hd _INI methods requiring %hd _STA executions " - "(examined %hd objects)\n", + "\nExecuted %u _INI methods requiring %u _STA executions " + "(examined %u objects)\n", Info.Num_INI, Info.Num_STA, Info.DeviceCount)); return_ACPI_STATUS (Status); @@ -510,7 +520,7 @@ AcpiNsFindIniMethods ( * The only _INI methods that we care about are those that are * present under Device, Processor, and Thermal objects. */ - ParentNode = AcpiNsGetParentNode (Node); + ParentNode = Node->Parent; switch (ParentNode->Type) { case ACPI_TYPE_DEVICE: @@ -522,7 +532,7 @@ AcpiNsFindIniMethods ( while (ParentNode) { ParentNode->Flags |= ANOBJ_SUBTREE_HAS_INI; - ParentNode = AcpiNsGetParentNode (ParentNode); + ParentNode = ParentNode->Parent; } break; 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 7eb3e549bf..f05288e417 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c @@ -176,7 +176,7 @@ AcpiNsBuildExternalPath ( /* Put the name into the buffer */ ACPI_MOVE_32_TO_32 ((NameBuffer + Index), &ParentNode->Name); - ParentNode = AcpiNsGetParentNode (ParentNode); + ParentNode = ParentNode->Parent; /* Prefix name with the path separator */ @@ -298,7 +298,7 @@ AcpiNsGetPathnameLength ( return 0; } Size += ACPI_PATH_SEGMENT_LENGTH; - NextNode = AcpiNsGetParentNode (NextNode); + NextNode = NextNode->Parent; } if (!Size) 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 52cbc97599..d97c9af702 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c @@ -223,7 +223,7 @@ AcpiNsOneCompleteParse ( /* Parse the AML */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber)); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %u parse\n", PassNumber)); Status = AcpiPsParseAml (WalkState); Cleanup: diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c index 76d62bf7a0..3bc3660da0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c @@ -683,7 +683,7 @@ AcpiNsRepairNullElement ( { /* Need an Integer - create a zero-value integer */ - NewObject = AcpiUtCreateIntegerObject (0); + NewObject = AcpiUtCreateIntegerObject ((UINT64) 0); } else if (ExpectedBtypes & ACPI_RTYPE_STRING) { diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c index 220608e2db..1464a3b2b5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c @@ -152,11 +152,21 @@ AcpiNsRepair_ALR ( ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT **ReturnObjectPtr); +static ACPI_STATUS +AcpiNsRepair_CID ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + static ACPI_STATUS AcpiNsRepair_FDE ( ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT **ReturnObjectPtr); +static ACPI_STATUS +AcpiNsRepair_HID ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + static ACPI_STATUS AcpiNsRepair_PSS ( ACPI_PREDEFINED_DATA *Data, @@ -196,16 +206,27 @@ AcpiNsSortList ( * As necessary: * * _ALR: Sort the list ascending by AmbientIlluminance + * _CID: Strings: uppercase all, remove any leading asterisk * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs + * _HID: Strings: uppercase all, remove any leading asterisk * _PSS: Sort the list descending by Power * _TSS: Sort the list descending by Power + * + * Names that must be packages, but cannot be sorted: + * + * _BCL: Values are tied to the Package index where they appear, and cannot + * be moved or sorted. These index values are used for _BQC and _BCM. + * However, we can fix the case where a buffer is returned, by converting + * it to a Package of integers. */ static const ACPI_REPAIR_INFO AcpiNsRepairableNames[] = { {"_ALR", AcpiNsRepair_ALR}, + {"_CID", AcpiNsRepair_CID}, {"_FDE", AcpiNsRepair_FDE}, {"_GTM", AcpiNsRepair_FDE}, /* _GTM has same repair as _FDE */ + {"_HID", AcpiNsRepair_HID}, {"_PSS", AcpiNsRepair_PSS}, {"_TSS", AcpiNsRepair_TSS}, {{0,0,0,0}, NULL} /* Table terminator */ @@ -418,6 +439,172 @@ AcpiNsRepair_FDE ( } +/****************************************************************************** + * + * FUNCTION: AcpiNsRepair_CID + * + * PARAMETERS: Data - Pointer to validation data structure + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * + * RETURN: Status. AE_OK if object is OK or was repaired successfully + * + * DESCRIPTION: Repair for the _CID object. If a string, ensure that all + * letters are uppercase and that there is no leading asterisk. + * If a Package, ensure same for all string elements. + * + *****************************************************************************/ + +static ACPI_STATUS +AcpiNsRepair_CID ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; + ACPI_OPERAND_OBJECT **ElementPtr; + ACPI_OPERAND_OBJECT *OriginalElement; + UINT16 OriginalRefCount; + UINT32 i; + + + /* Check for _CID as a simple string */ + + if (ReturnObject->Common.Type == ACPI_TYPE_STRING) + { + Status = AcpiNsRepair_HID (Data, ReturnObjectPtr); + return (Status); + } + + /* Exit if not a Package */ + + if (ReturnObject->Common.Type != ACPI_TYPE_PACKAGE) + { + return (AE_OK); + } + + /* Examine each element of the _CID package */ + + ElementPtr = ReturnObject->Package.Elements; + for (i = 0; i < ReturnObject->Package.Count; i++) + { + OriginalElement = *ElementPtr; + OriginalRefCount = OriginalElement->Common.ReferenceCount; + + Status = AcpiNsRepair_HID (Data, ElementPtr); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Take care with reference counts */ + + if (OriginalElement != *ElementPtr) + { + /* Element was replaced */ + + (*ElementPtr)->Common.ReferenceCount = + OriginalRefCount; + + AcpiUtRemoveReference (OriginalElement); + } + + ElementPtr++; + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiNsRepair_HID + * + * PARAMETERS: Data - Pointer to validation data structure + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * + * RETURN: Status. AE_OK if object is OK or was repaired successfully + * + * DESCRIPTION: Repair for the _HID object. If a string, ensure that all + * letters are uppercase and that there is no leading asterisk. + * + *****************************************************************************/ + +static ACPI_STATUS +AcpiNsRepair_HID ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; + ACPI_OPERAND_OBJECT *NewString; + char *Source; + char *Dest; + + + ACPI_FUNCTION_NAME (NsRepair_HID); + + + /* We only care about string _HID objects (not integers) */ + + if (ReturnObject->Common.Type != ACPI_TYPE_STRING) + { + return (AE_OK); + } + + if (ReturnObject->String.Length == 0) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Invalid zero-length _HID or _CID string")); + + /* Return AE_OK anyway, let driver handle it */ + + Data->Flags |= ACPI_OBJECT_REPAIRED; + return (AE_OK); + } + + /* It is simplest to always create a new string object */ + + NewString = AcpiUtCreateStringObject (ReturnObject->String.Length); + if (!NewString) + { + return (AE_NO_MEMORY); + } + + /* + * Remove a leading asterisk if present. For some unknown reason, there + * are many machines in the field that contains IDs like this. + * + * Examples: "*PNP0C03", "*ACPI0003" + */ + Source = ReturnObject->String.Pointer; + if (*Source == '*') + { + Source++; + NewString->String.Length--; + + ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, + "%s: Removed invalid leading asterisk\n", Data->Pathname)); + } + + /* + * Copy and uppercase the string. From the ACPI specification: + * + * A valid PNP ID must be of the form "AAA####" where A is an uppercase + * letter and # is a hex digit. A valid ACPI ID must be of the form + * "ACPI####" where # is a hex digit. + */ + for (Dest = NewString->String.Pointer; *Source; Dest++, Source++) + { + *Dest = (char) ACPI_TOUPPER (*Source); + } + + AcpiUtRemoveReference (ReturnObject); + *ReturnObjectPtr = NewString; + return (AE_OK); +} + + /****************************************************************************** * * FUNCTION: AcpiNsRepair_TSS 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 fa15b9c5bb..3bee106f2d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c @@ -229,17 +229,6 @@ AcpiNsSearchOneScope ( return_ACPI_STATUS (AE_OK); } - /* - * The last entry in the list points back to the parent, - * so a flag is used to indicate the end-of-list - */ - if (Node->Flags & ANOBJ_END_OF_PEER_LIST) - { - /* Searched entire list, we are done */ - - break; - } - /* Didn't match name, move on to the next peer object */ Node = Node->Peer; @@ -296,7 +285,7 @@ AcpiNsSearchParentTree ( ACPI_FUNCTION_TRACE (NsSearchParentTree); - ParentNode = AcpiNsGetParentNode (Node); + ParentNode = Node->Parent; /* * If there is no parent (i.e., we are at the root) or type is "local", @@ -341,7 +330,7 @@ AcpiNsSearchParentTree ( /* Not found here, go up another level (until we reach the root) */ - ParentNode = AcpiNsGetParentNode (ParentNode); + ParentNode = ParentNode->Parent; } /* Not found in parent tree */ 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 98ec9ff3c4..aee9adcde9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c @@ -137,118 +137,6 @@ AcpiNsFindParentName ( #endif -/******************************************************************************* - * - * FUNCTION: AcpiNsReportError - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * InternalName - Name or path of the namespace node - * LookupStatus - Exception code from NS lookup - * - * RETURN: None - * - * DESCRIPTION: Print warning message with full pathname - * - ******************************************************************************/ - -void -AcpiNsReportError ( - const char *ModuleName, - UINT32 LineNumber, - const char *InternalName, - ACPI_STATUS LookupStatus) -{ - ACPI_STATUS Status; - UINT32 BadName; - char *Name = NULL; - - - AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber); - - if (LookupStatus == AE_BAD_CHARACTER) - { - /* There is a non-ascii character in the name */ - - ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName)); - AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName); - } - else - { - /* Convert path to external format */ - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, - InternalName, NULL, &Name); - - /* Print target name */ - - if (ACPI_SUCCESS (Status)) - { - AcpiOsPrintf ("[%s]", Name); - } - else - { - AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]"); - } - - if (Name) - { - ACPI_FREE (Name); - } - } - - AcpiOsPrintf (" Namespace lookup failure, %s\n", - AcpiFormatException (LookupStatus)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsReportMethodError - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Message - Error message to use on failure - * PrefixNode - Prefix relative to the path - * Path - Path to the node (optional) - * MethodStatus - Execution status - * - * RETURN: None - * - * DESCRIPTION: Print warning message with full pathname - * - ******************************************************************************/ - -void -AcpiNsReportMethodError ( - const char *ModuleName, - UINT32 LineNumber, - const char *Message, - ACPI_NAMESPACE_NODE *PrefixNode, - const char *Path, - ACPI_STATUS MethodStatus) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node = PrefixNode; - - - AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber); - - if (Path) - { - Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH, - &Node); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("[Could not get node by pathname]"); - } - } - - AcpiNsPrintNodePathname (Node, Message); - AcpiOsPrintf (", %s\n", AcpiFormatException (MethodStatus)); -} - - /******************************************************************************* * * FUNCTION: AcpiNsPrintNodePathname @@ -1057,128 +945,3 @@ Cleanup: ACPI_FREE (InternalPath); return_ACPI_STATUS (Status); } - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetParentNode - * - * PARAMETERS: Node - Current table entry - * - * RETURN: Parent entry of the given entry - * - * DESCRIPTION: Obtain the parent entry for a given entry in the namespace. - * - ******************************************************************************/ - -ACPI_NAMESPACE_NODE * -AcpiNsGetParentNode ( - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_FUNCTION_ENTRY (); - - - if (!Node) - { - return (NULL); - } - - /* - * Walk to the end of this peer list. The last entry is marked with a flag - * and the peer pointer is really a pointer back to the parent. This saves - * putting a parent back pointer in each and every named object! - */ - while (!(Node->Flags & ANOBJ_END_OF_PEER_LIST)) - { - Node = Node->Peer; - } - - return (Node->Peer); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetNextValidNode - * - * PARAMETERS: Node - Current table entry - * - * RETURN: Next valid Node in the linked node list. NULL if no more valid - * nodes. - * - * DESCRIPTION: Find the next valid node within a name table. - * Useful for implementing NULL-end-of-list loops. - * - ******************************************************************************/ - -ACPI_NAMESPACE_NODE * -AcpiNsGetNextValidNode ( - ACPI_NAMESPACE_NODE *Node) -{ - - /* If we are at the end of this peer list, return NULL */ - - if (Node->Flags & ANOBJ_END_OF_PEER_LIST) - { - return NULL; - } - - /* Otherwise just return the next peer */ - - return (Node->Peer); -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AcpiNsFindParentName - * - * PARAMETERS: *ChildNode - Named Obj whose name is to be found - * - * RETURN: The ACPI name - * - * DESCRIPTION: Search for the given obj in its parent scope and return the - * name segment, or "????" if the parent name can't be found - * (which "should not happen"). - * - ******************************************************************************/ - -ACPI_NAME -AcpiNsFindParentName ( - ACPI_NAMESPACE_NODE *ChildNode) -{ - ACPI_NAMESPACE_NODE *ParentNode; - - - ACPI_FUNCTION_TRACE (NsFindParentName); - - - if (ChildNode) - { - /* Valid entry. Get the parent Node */ - - ParentNode = AcpiNsGetParentNode (ChildNode); - if (ParentNode) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Parent of %p [%4.4s] is %p [%4.4s]\n", - ChildNode, AcpiUtGetNodeName (ChildNode), - ParentNode, AcpiUtGetNodeName (ParentNode))); - - if (ParentNode->Name.Integer) - { - return_VALUE ((ACPI_NAME) ParentNode->Name.Integer); - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Unable to find parent of %p (%4.4s)\n", - ChildNode, AcpiUtGetNodeName (ChildNode))); - } - - return_VALUE (ACPI_UNKNOWN_NAME); -} -#endif - - 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 b6c573bda7..2863926060 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c @@ -158,16 +158,6 @@ AcpiNsGetNextNode ( return (ParentNode->Child); } - /* - * Get the next node. - * - * If we are at the end of this peer list, return NULL - */ - if (ChildNode->Flags & ANOBJ_END_OF_PEER_LIST) - { - return NULL; - } - /* Otherwise just return the next peer */ return (ChildNode->Peer); @@ -227,9 +217,9 @@ AcpiNsGetNextNodeTyped ( return (NextNode); } - /* Otherwise, move on to the next node */ + /* Otherwise, move on to the next peer node */ - NextNode = AcpiNsGetNextValidNode (NextNode); + NextNode = NextNode->Peer; } /* Not found */ @@ -454,7 +444,7 @@ AcpiNsWalkNamespace ( */ Level--; ChildNode = ParentNode; - ParentNode = AcpiNsGetParentNode (ParentNode); + ParentNode = ParentNode->Parent; NodePreviouslyVisited = TRUE; } 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 aef106e80b..8e6ed643e7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c @@ -242,7 +242,7 @@ AcpiGetParent ( /* Get the parent entry */ - ParentNode = AcpiNsGetParentNode (Node); + ParentNode = Node->Parent; *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, ParentNode); /* Return exception if parent is null */ diff --git a/src/add-ons/kernel/bus_managers/acpi/oshaiku.cpp b/src/add-ons/kernel/bus_managers/acpi/oshaiku.cpp index 7affe9392b..ae4424847c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/oshaiku.cpp +++ b/src/add-ons/kernel/bus_managers/acpi/oshaiku.cpp @@ -852,27 +852,6 @@ AcpiOsGetTimer() } -/****************************************************************************** - * - * FUNCTION: AcpiOsValidateInterface - * - * PARAMETERS: interface - Requested interface to be validated - * - * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise - * - * DESCRIPTION: Match an interface string to the interfaces supported by the - * host. Strings originate from an AML call to the _OSI method. - * - *****************************************************************************/ -ACPI_STATUS -AcpiOsValidateInterface(char *interface) -{ - DEBUG_FUNCTION_F("interface: \"%s\"", interface); - // TODO: This looks unimplemented. - return AE_SUPPORT; -} - - /****************************************************************************** * * FUNCTION: AcpiOsReadPciConfiguration @@ -888,11 +867,9 @@ AcpiOsValidateInterface(char *interface) * *****************************************************************************/ ACPI_STATUS -AcpiOsReadPciConfiguration(ACPI_PCI_ID *pciId, UINT32 reg, void *value, +AcpiOsReadPciConfiguration(ACPI_PCI_ID *pciId, UINT32 reg, UINT64 *value, UINT32 width) { - uint32 *val; - val = (uint32*)value; #ifdef _KERNEL_MODE DEBUG_FUNCTION(); @@ -900,7 +877,7 @@ AcpiOsReadPciConfiguration(ACPI_PCI_ID *pciId, UINT32 reg, void *value, case 8: case 16: case 32: - *val = gPCIManager->read_pci_config( + *value = gPCIManager->read_pci_config( pciId->Bus, pciId->Device, pciId->Function, reg, width / 8); break; default: @@ -942,13 +919,6 @@ AcpiOsWritePciConfiguration(ACPI_PCI_ID *pciId, UINT32 reg, } -void -AcpiOsDerivePciId(ACPI_HANDLE rhandle, ACPI_HANDLE chandle, ACPI_PCI_ID **pciId) -{ -// TODO: Implement this! -} - - /****************************************************************************** * * FUNCTION: AcpiOsReadPort 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 9ae4669d94..a86a55cdaa 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c @@ -124,7 +124,7 @@ /* Local prototypes */ -static inline void +static ACPI_INLINE void AcpiTbInitGenericAddress ( ACPI_GENERIC_ADDRESS *GenericAddress, UINT8 SpaceId, @@ -273,7 +273,7 @@ static ACPI_FADT_PM_INFO FadtPmInfoTable[] = * ******************************************************************************/ -static inline void +static ACPI_INLINE void AcpiTbInitGenericAddress ( ACPI_GENERIC_ADDRESS *GenericAddress, UINT8 SpaceId, 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 0a91716f24..ad158465e0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c @@ -279,9 +279,8 @@ AcpiDebugPrint ( if (ACPI_LV_THREADS & AcpiDbgLevel) { AcpiOsPrintf ( - "\n**** Context Switch from TID %p to TID %p ****\n\n", - ACPI_CAST_PTR (void, AcpiGbl_PrevThreadId), - ACPI_CAST_PTR (void, ThreadId)); + "\n**** Context Switch from TID %u to TID %u ****\n\n", + (UINT32) AcpiGbl_PrevThreadId, (UINT32) ThreadId); } AcpiGbl_PrevThreadId = ThreadId; @@ -295,7 +294,7 @@ AcpiDebugPrint ( if (ACPI_LV_THREADS & AcpiDbgLevel) { - AcpiOsPrintf ("[%p] ", ACPI_CAST_PTR (void, ThreadId)); + AcpiOsPrintf ("[%u] ", (UINT32) ThreadId); } AcpiOsPrintf ("[%02ld] %-22.22s: ", 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 bb7110bf18..080bd4c820 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c @@ -124,139 +124,6 @@ ACPI_MODULE_NAME ("uteval") -/* - * Strings supported by the _OSI predefined (internal) method. - * - * March 2009: Removed "Linux" as this host no longer wants to respond true - * for this string. Basically, the only safe OS strings are windows-related - * and in many or most cases represent the only test path within the - * BIOS-provided ASL code. - * - * The second element of each entry is used to track the newest version of - * Windows that the BIOS has requested. - */ -static const ACPI_INTERFACE_INFO AcpiInterfacesSupported[] = -{ - /* Operating System Vendor Strings */ - - {"Windows 2000", ACPI_OSI_WIN_2000}, /* Windows 2000 */ - {"Windows 2001", ACPI_OSI_WIN_XP}, /* Windows XP */ - {"Windows 2001 SP1", ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ - {"Windows 2001.1", ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ - {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ - {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ - {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ - {"Windows 2006.1", ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ - {"Windows 2006 SP1", ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ - {"Windows 2009", ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ - - /* Feature Group Strings */ - - {"Extended Address Space Descriptor", 0} - - /* - * All "optional" feature group strings (features that are implemented - * by the host) should be implemented in the host version of - * AcpiOsValidateInterface and should not be added here. - */ -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtOsiImplementation - * - * PARAMETERS: WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Implementation of the _OSI predefined control method - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtOsiImplementation ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *StringDesc; - ACPI_OPERAND_OBJECT *ReturnDesc; - UINT32 ReturnValue; - UINT32 i; - - - ACPI_FUNCTION_TRACE (UtOsiImplementation); - - - /* Validate the string input argument */ - - StringDesc = WalkState->Arguments[0].Object; - if (!StringDesc || (StringDesc->Common.Type != ACPI_TYPE_STRING)) - { - return_ACPI_STATUS (AE_TYPE); - } - - /* Create a return object */ - - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ReturnDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Default return value is 0, NOT SUPPORTED */ - - ReturnValue = 0; - - /* Compare input string to static table of supported interfaces */ - - for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiInterfacesSupported); i++) - { - if (!ACPI_STRCMP (StringDesc->String.Pointer, - AcpiInterfacesSupported[i].Name)) - { - /* - * The interface is supported. - * Update the OsiData if necessary. We keep track of the latest - * version of Windows that has been requested by the BIOS. - */ - if (AcpiInterfacesSupported[i].Value > AcpiGbl_OsiData) - { - AcpiGbl_OsiData = AcpiInterfacesSupported[i].Value; - } - - ReturnValue = ACPI_UINT32_MAX; - goto Exit; - } - } - - /* - * Did not match the string in the static table, call the host OSL to - * check for a match with one of the optional strings (such as - * "Module Device", "3.0 Thermal Model", etc.) - */ - Status = AcpiOsValidateInterface (StringDesc->String.Pointer); - if (ACPI_SUCCESS (Status)) - { - /* The interface is supported */ - - ReturnValue = ACPI_UINT32_MAX; - } - - -Exit: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, - "ACPI: BIOS _OSI(%s) is %ssupported\n", - StringDesc->String.Pointer, ReturnValue == 0 ? "not " : "")); - - /* Complete the return value */ - - ReturnDesc->Integer.Value = ReturnValue; - WalkState->ReturnDesc = ReturnDesc; - return_ACPI_STATUS (AE_OK); -} - - /******************************************************************************* * * FUNCTION: AcpiUtEvaluateObject 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 34af1f5fc5..a7e1baa2e8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c @@ -244,7 +244,9 @@ ACPI_EXPORT_SYMBOL (AcpiFormatException) * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run * during the initialization sequence. * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to - * perform a Notify() operation on it. + * perform a Notify() operation on it. 09/2010: Changed to type Device. + * This still allows notifies, but does not confuse host code that + * searches for valid ThermalZone objects. */ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = { @@ -252,7 +254,7 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, {"_SB_", ACPI_TYPE_DEVICE, NULL}, {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_TZ_", ACPI_TYPE_THERMAL, NULL}, + {"_TZ_", ACPI_TYPE_DEVICE, NULL}, {"_REV", ACPI_TYPE_INTEGER, (char *) ACPI_CA_SUPPORT_LEVEL}, {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, {"_GL_", ACPI_TYPE_MUTEX, (char *) 1}, @@ -905,6 +907,7 @@ AcpiUtInitGlobals ( AcpiGbl_ExceptionHandler = NULL; AcpiGbl_InitHandler = NULL; AcpiGbl_TableHandler = NULL; + AcpiGbl_InterfaceHandler = NULL; /* Global Lock support */ @@ -931,6 +934,7 @@ AcpiUtInitGlobals ( AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; AcpiGbl_OsiData = 0; + AcpiGbl_OsiMutex = NULL; /* Hardware oriented */ @@ -944,10 +948,10 @@ AcpiUtInitGlobals ( AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; + AcpiGbl_RootNodeStruct.Parent = NULL; AcpiGbl_RootNodeStruct.Child = NULL; AcpiGbl_RootNodeStruct.Peer = NULL; AcpiGbl_RootNodeStruct.Object = NULL; - AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; #ifdef ACPI_DISASSEMBLER @@ -960,6 +964,7 @@ AcpiUtInitGlobals ( #ifdef ACPI_DBG_TRACK_ALLOCATIONS AcpiGbl_DisplayFinalMemStats = FALSE; + AcpiGbl_DisableMemTracking = FALSE; #endif return_ACPI_STATUS (AE_OK); diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c index ee7b19d885..4b52fe4341 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c @@ -123,51 +123,6 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utids") -/* Local prototypes */ - -static void -AcpiUtCopyIdString ( - char *Destination, - char *Source); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIdString - * - * PARAMETERS: Destination - Where to copy the string - * Source - Source string - * - * RETURN: None - * - * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. - * Performs removal of a leading asterisk if present -- workaround - * for a known issue on a bunch of machines. - * - ******************************************************************************/ - -static void -AcpiUtCopyIdString ( - char *Destination, - char *Source) -{ - - /* - * Workaround for ID strings that have a leading asterisk. This construct - * is not allowed by the ACPI specification (ID strings must be - * alphanumeric), but enough existing machines have this embedded in their - * ID strings that the following code is useful. - */ - if (*Source == '*') - { - Source++; - } - - /* Do the actual copy */ - - ACPI_STRCPY (Destination, Source); -} - /******************************************************************************* * @@ -240,7 +195,7 @@ AcpiUtExecute_HID ( } else { - AcpiUtCopyIdString (Hid->String, ObjDesc->String.Pointer); + ACPI_STRCPY (Hid->String, ObjDesc->String.Pointer); } Hid->Length = Length; @@ -327,7 +282,7 @@ AcpiUtExecute_UID ( } else { - AcpiUtCopyIdString (Uid->String, ObjDesc->String.Pointer); + ACPI_STRCPY (Uid->String, ObjDesc->String.Pointer); } Uid->Length = Length; @@ -471,7 +426,7 @@ AcpiUtExecute_CID ( { /* Copy the String CID from the returned object */ - AcpiUtCopyIdString (NextIdString, CidObjects[i]->String.Pointer); + ACPI_STRCPY (NextIdString, CidObjects[i]->String.Pointer); Length = CidObjects[i]->String.Length + 1; } 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 767c5623ef..4cb083bd7a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c @@ -205,6 +205,10 @@ AcpiUtSubsystemShutdown ( /* Close the AcpiEvent Handling */ AcpiEvTerminate (); + + /* Delete any dynamic _OSI interfaces */ + + AcpiUtInterfaceTerminate (); #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 54d492f234..90f3cd58cc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c @@ -124,12 +124,32 @@ ACPI_MODULE_NAME ("utmath") /* - * Support for double-precision integer divide. This code is included here - * in order to support kernel environments where the double-precision math - * library is not available. + * Optional support for 64-bit double-precision integer divide. This code + * is configurable and is implemented in order to support 32-bit kernel + * environments where a 64-bit double-precision math library is not available. + * + * Support for a more normal 64-bit divide/modulo (with check for a divide- + * by-zero) appears after this optional section of code. */ - #ifndef ACPI_USE_NATIVE_DIVIDE + +/* Structures used only for 64-bit divide */ + +typedef struct uint64_struct +{ + UINT32 Lo; + UINT32 Hi; + +} UINT64_STRUCT; + +typedef union uint64_overlay +{ + UINT64 Full; + UINT64_STRUCT Part; + +} UINT64_OVERLAY; + + /******************************************************************************* * * FUNCTION: AcpiUtShortDivide 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 8357aceb31..1867a31fa9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c @@ -124,12 +124,6 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utmisc") -/* - * Common suffix for messages - */ -#define ACPI_COMMON_MSG_SUFFIX \ - AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber) - /******************************************************************************* * @@ -505,6 +499,48 @@ AcpiUtStrupr ( } +#ifdef ACPI_ASL_COMPILER +/******************************************************************************* + * + * FUNCTION: AcpiUtStrlwr (strlwr) + * + * PARAMETERS: SrcString - The source string to convert + * + * RETURN: None + * + * DESCRIPTION: Convert string to lowercase + * + * NOTE: This is not a POSIX function, so it appears here, not in utclib.c + * + ******************************************************************************/ + +void +AcpiUtStrlwr ( + char *SrcString) +{ + char *String; + + + ACPI_FUNCTION_ENTRY (); + + + if (!SrcString) + { + return; + } + + /* Walk entire string, lowercasing the letters */ + + for (String = SrcString; *String; String++) + { + *String = (char) ACPI_TOLOWER (*String); + } + + return; +} +#endif + + /******************************************************************************* * * FUNCTION: AcpiUtPrintString @@ -1295,191 +1331,3 @@ AcpiUtWalkPackageTree ( } -/******************************************************************************* - * - * FUNCTION: AcpiError, AcpiException, AcpiWarning, AcpiInfo - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print message with module/line/version info - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiError ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...) -{ - va_list args; - - - AcpiOsPrintf ("ACPI Error: "); - - va_start (args, Format); - AcpiOsVprintf (Format, args); - ACPI_COMMON_MSG_SUFFIX; - va_end (args); -} - -void ACPI_INTERNAL_VAR_XFACE -AcpiException ( - const char *ModuleName, - UINT32 LineNumber, - ACPI_STATUS Status, - const char *Format, - ...) -{ - va_list args; - - - AcpiOsPrintf ("ACPI Exception: %s, ", AcpiFormatException (Status)); - - va_start (args, Format); - AcpiOsVprintf (Format, args); - ACPI_COMMON_MSG_SUFFIX; - va_end (args); -} - -void ACPI_INTERNAL_VAR_XFACE -AcpiWarning ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...) -{ - va_list args; - - - AcpiOsPrintf ("ACPI Warning: "); - - va_start (args, Format); - AcpiOsVprintf (Format, args); - ACPI_COMMON_MSG_SUFFIX; - va_end (args); -} - -void ACPI_INTERNAL_VAR_XFACE -AcpiInfo ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...) -{ - va_list args; - - - AcpiOsPrintf ("ACPI: "); - - va_start (args, Format); - AcpiOsVprintf (Format, args); - AcpiOsPrintf ("\n"); - va_end (args); -} - -ACPI_EXPORT_SYMBOL (AcpiError) -ACPI_EXPORT_SYMBOL (AcpiException) -ACPI_EXPORT_SYMBOL (AcpiWarning) -ACPI_EXPORT_SYMBOL (AcpiInfo) - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPredefinedWarning - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Pathname - Full pathname to the node - * NodeFlags - From Namespace node for the method/object - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Warnings for the predefined validation module. Messages are - * only emitted the first time a problem with a particular - * method/object is detected. This prevents a flood of error - * messages for methods that are repeatedly evaluated. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtPredefinedWarning ( - const char *ModuleName, - UINT32 LineNumber, - char *Pathname, - UINT8 NodeFlags, - const char *Format, - ...) -{ - va_list args; - - - /* - * Warning messages for this method/object will be disabled after the - * first time a validation fails or an object is successfully repaired. - */ - if (NodeFlags & ANOBJ_EVALUATED) - { - return; - } - - AcpiOsPrintf ("ACPI Warning for %s: ", Pathname); - - va_start (args, Format); - AcpiOsVprintf (Format, args); - ACPI_COMMON_MSG_SUFFIX; - va_end (args); -} - -/******************************************************************************* - * - * FUNCTION: AcpiUtPredefinedInfo - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Pathname - Full pathname to the node - * NodeFlags - From Namespace node for the method/object - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Info messages for the predefined validation module. Messages - * are only emitted the first time a problem with a particular - * method/object is detected. This prevents a flood of - * messages for methods that are repeatedly evaluated. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtPredefinedInfo ( - const char *ModuleName, - UINT32 LineNumber, - char *Pathname, - UINT8 NodeFlags, - const char *Format, - ...) -{ - va_list args; - - - /* - * Warning messages for this method/object will be disabled after the - * first time a validation fails or an object is successfully repaired. - */ - if (NodeFlags & ANOBJ_EVALUATED) - { - return; - } - - AcpiOsPrintf ("ACPI Info for %s: ", Pathname); - - va_start (args, Format); - AcpiOsVprintf (Format, args); - ACPI_COMMON_MSG_SUFFIX; - 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 ec29616eb2..92a95e15af 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c @@ -182,6 +182,13 @@ AcpiUtMutexInitialize ( return_ACPI_STATUS (Status); } + /* Mutex for _OSI support */ + Status = AcpiOsCreateMutex (&AcpiGbl_OsiMutex); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Create the reader/writer lock for namespace access */ Status = AcpiUtCreateRwLock (&AcpiGbl_NamespaceRwLock); @@ -219,6 +226,8 @@ AcpiUtMutexTerminate ( AcpiUtDeleteMutex (i); } + AcpiOsDeleteMutex (AcpiGbl_OsiMutex); + /* Delete the spinlocks */ AcpiOsDeleteLock (AcpiGbl_GpeLock); @@ -339,16 +348,16 @@ AcpiUtAcquireMutex ( if (i == MutexId) { ACPI_ERROR ((AE_INFO, - "Mutex [%s] already acquired by this thread [%p]", + "Mutex [%s] already acquired by this thread [%u]", AcpiUtGetMutexName (MutexId), - ACPI_CAST_PTR (void, ThisThreadId))); + (UINT32) ThisThreadId)); return (AE_ALREADY_ACQUIRED); } ACPI_ERROR ((AE_INFO, - "Invalid acquire order: Thread %p owns [%s], wants [%s]", - ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (i), + "Invalid acquire order: Thread %u owns [%s], wants [%s]", + (UINT32) ThisThreadId, AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId))); return (AE_ACQUIRE_DEADLOCK); @@ -358,15 +367,15 @@ AcpiUtAcquireMutex ( #endif ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, - "Thread %p attempting to acquire Mutex [%s]\n", - ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId))); + "Thread %u attempting to acquire Mutex [%s]\n", + (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); Status = AcpiOsAcquireMutex (AcpiGbl_MutexInfo[MutexId].Mutex, ACPI_WAIT_FOREVER); if (ACPI_SUCCESS (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %p acquired Mutex [%s]\n", - ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId))); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u acquired Mutex [%s]\n", + (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); AcpiGbl_MutexInfo[MutexId].UseCount++; AcpiGbl_MutexInfo[MutexId].ThreadId = ThisThreadId; @@ -374,8 +383,8 @@ AcpiUtAcquireMutex ( else { ACPI_EXCEPTION ((AE_INFO, Status, - "Thread %p could not acquire Mutex [0x%X]", - ACPI_CAST_PTR (void, ThisThreadId), MutexId)); + "Thread %u could not acquire Mutex [0x%X]", + (UINT32) ThisThreadId, MutexId)); } return (Status); @@ -405,8 +414,8 @@ AcpiUtReleaseMutex ( ThisThreadId = AcpiOsGetThreadId (); - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n", - ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId))); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n", + (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); if (MutexId > ACPI_MAX_MUTEX) { diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c new file mode 100644 index 0000000000..26d143260a --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c @@ -0,0 +1,494 @@ +/****************************************************************************** + * + * Module Name: utosi - Support for the _OSI predefined control method + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __UTOSI_C__ + +#include "acpi.h" +#include "accommon.h" + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utosi") + +/* + * Strings supported by the _OSI predefined control method (which is + * implemented internally within this module.) + * + * March 2009: Removed "Linux" as this host no longer wants to respond true + * for this string. Basically, the only safe OS strings are windows-related + * and in many or most cases represent the only test path within the + * BIOS-provided ASL code. + * + * The last element of each entry is used to track the newest version of + * Windows that the BIOS has requested. + */ +static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] = +{ + /* Operating System Vendor Strings */ + + {"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000}, /* Windows 2000 */ + {"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP}, /* Windows XP */ + {"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ + {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ + {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ + {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ + {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ + {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ + {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ + {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ + {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ + + /* Feature Group Strings */ + + {"Extended Address Space Descriptor", NULL, 0, 0} + + /* + * All "optional" feature group strings (features that are implemented + * by the host) should be dynamically added by the host via + * AcpiInstallInterface and should not be manually added here. + * + * Examples of optional feature group strings: + * + * "Module Device" + * "Processor Device" + * "3.0 Thermal Model" + * "3.0 _SCP Extensions" + * "Processor Aggregator Device" + */ +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtInitializeInterfaces + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Initialize the global _OSI supported interfaces list + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtInitializeInterfaces ( + void) +{ + UINT32 i; + + + (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + AcpiGbl_SupportedInterfaces = AcpiDefaultSupportedInterfaces; + + /* Link the static list of supported interfaces */ + + for (i = 0; i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); i++) + { + AcpiDefaultSupportedInterfaces[i].Next = + &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1]; + } + + AcpiOsReleaseMutex (AcpiGbl_OsiMutex); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtInterfaceTerminate + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Delete all interfaces in the global list. Sets + * AcpiGbl_SupportedInterfaces to NULL. + * + ******************************************************************************/ + +void +AcpiUtInterfaceTerminate ( + void) +{ + ACPI_INTERFACE_INFO *NextInterface; + + + (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + NextInterface = AcpiGbl_SupportedInterfaces; + + while (NextInterface) + { + AcpiGbl_SupportedInterfaces = NextInterface->Next; + + /* Only interfaces added at runtime can be freed */ + + if (NextInterface->Flags & ACPI_OSI_DYNAMIC) + { + ACPI_FREE (NextInterface->Name); + ACPI_FREE (NextInterface); + } + + NextInterface = AcpiGbl_SupportedInterfaces; + } + + AcpiOsReleaseMutex (AcpiGbl_OsiMutex); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtInstallInterface + * + * PARAMETERS: InterfaceName - The interface to install + * + * RETURN: Status + * + * DESCRIPTION: Install the interface into the global interface list. + * Caller MUST hold AcpiGbl_OsiMutex + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtInstallInterface ( + ACPI_STRING InterfaceName) +{ + ACPI_INTERFACE_INFO *InterfaceInfo; + + + /* Allocate info block and space for the name string */ + + InterfaceInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_INTERFACE_INFO)); + if (!InterfaceInfo) + { + return (AE_NO_MEMORY); + } + + InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (InterfaceName) + 1); + if (!InterfaceInfo->Name) + { + ACPI_FREE (InterfaceInfo); + return (AE_NO_MEMORY); + } + + /* Initialize new info and insert at the head of the global list */ + + ACPI_STRCPY (InterfaceInfo->Name, InterfaceName); + InterfaceInfo->Flags = ACPI_OSI_DYNAMIC; + InterfaceInfo->Next = AcpiGbl_SupportedInterfaces; + + AcpiGbl_SupportedInterfaces = InterfaceInfo; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtRemoveInterface + * + * PARAMETERS: InterfaceName - The interface to remove + * + * RETURN: Status + * + * DESCRIPTION: Remove the interface from the global interface list. + * Caller MUST hold AcpiGbl_OsiMutex + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtRemoveInterface ( + ACPI_STRING InterfaceName) +{ + ACPI_INTERFACE_INFO *PreviousInterface; + ACPI_INTERFACE_INFO *NextInterface; + + + PreviousInterface = NextInterface = AcpiGbl_SupportedInterfaces; + while (NextInterface) + { + if (!ACPI_STRCMP (InterfaceName, NextInterface->Name)) + { + /* Found: name is in either the static list or was added at runtime */ + + if (NextInterface->Flags & ACPI_OSI_DYNAMIC) + { + /* Interface was added dynamically, remove and free it */ + + if (PreviousInterface == NextInterface) + { + AcpiGbl_SupportedInterfaces = NextInterface->Next; + } + else + { + PreviousInterface->Next = NextInterface->Next; + } + + ACPI_FREE (NextInterface->Name); + ACPI_FREE (NextInterface); + } + else + { + /* + * Interface is in static list. If marked invalid, then it + * does not actually exist. Else, mark it invalid. + */ + if (NextInterface->Flags & ACPI_OSI_INVALID) + { + return (AE_NOT_EXIST); + } + + NextInterface->Flags |= ACPI_OSI_INVALID; + } + + return (AE_OK); + } + + PreviousInterface = NextInterface; + NextInterface = NextInterface->Next; + } + + /* Interface was not found */ + + return (AE_NOT_EXIST); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetInterface + * + * PARAMETERS: InterfaceName - The interface to find + * + * RETURN: ACPI_INTERFACE_INFO if found. NULL if not found. + * + * DESCRIPTION: Search for the specified interface name in the global list. + * Caller MUST hold AcpiGbl_OsiMutex + * + ******************************************************************************/ + +ACPI_INTERFACE_INFO * +AcpiUtGetInterface ( + ACPI_STRING InterfaceName) +{ + ACPI_INTERFACE_INFO *NextInterface; + + + NextInterface = AcpiGbl_SupportedInterfaces; + while (NextInterface) + { + if (!ACPI_STRCMP (InterfaceName, NextInterface->Name)) + { + return (NextInterface); + } + + NextInterface = NextInterface->Next; + } + + return (NULL); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtOsiImplementation + * + * PARAMETERS: WalkState - Current walk state + * + * RETURN: Status + * + * DESCRIPTION: Implementation of the _OSI predefined control method. When + * an invocation of _OSI is encountered in the system AML, + * control is transferred to this function. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtOsiImplementation ( + ACPI_WALK_STATE *WalkState) +{ + ACPI_OPERAND_OBJECT *StringDesc; + ACPI_OPERAND_OBJECT *ReturnDesc; + ACPI_INTERFACE_INFO *InterfaceInfo; + ACPI_INTERFACE_HANDLER InterfaceHandler; + UINT32 ReturnValue; + + + ACPI_FUNCTION_TRACE (UtOsiImplementation); + + + /* Validate the string input argument (from the AML caller) */ + + StringDesc = WalkState->Arguments[0].Object; + if (!StringDesc || + (StringDesc->Common.Type != ACPI_TYPE_STRING)) + { + return_ACPI_STATUS (AE_TYPE); + } + + /* Create a return object */ + + ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!ReturnDesc) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Default return value is 0, NOT SUPPORTED */ + + ReturnValue = 0; + (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + + /* Lookup the interface in the global _OSI list */ + + InterfaceInfo = AcpiUtGetInterface (StringDesc->String.Pointer); + if (InterfaceInfo && + !(InterfaceInfo->Flags & ACPI_OSI_INVALID)) + { + /* + * The interface is supported. + * Update the OsiData if necessary. We keep track of the latest + * version of Windows that has been requested by the BIOS. + */ + if (InterfaceInfo->Value > AcpiGbl_OsiData) + { + AcpiGbl_OsiData = InterfaceInfo->Value; + } + + ReturnValue = ACPI_UINT32_MAX; + } + + AcpiOsReleaseMutex (AcpiGbl_OsiMutex); + + /* + * Invoke an optional _OSI interface handler. The host OS may wish + * to do some interface-specific handling. For example, warn about + * certain interfaces or override the true/false support value. + */ + InterfaceHandler = AcpiGbl_InterfaceHandler; + if (InterfaceHandler) + { + ReturnValue = InterfaceHandler ( + StringDesc->String.Pointer, ReturnValue); + } + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, + "ACPI: BIOS _OSI(\"%s\") is %ssupported\n", + StringDesc->String.Pointer, ReturnValue == 0 ? "not " : "")); + + /* Complete the return object */ + + ReturnDesc->Integer.Value = ReturnValue; + WalkState->ReturnDesc = ReturnDesc; + return_ACPI_STATUS (AE_OK); +} 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 ac45e9a3d8..38dba03ad8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c @@ -436,6 +436,11 @@ AcpiUtTrackAllocation ( ACPI_FUNCTION_TRACE_PTR (UtTrackAllocation, Allocation); + if (AcpiGbl_DisableMemTracking) + { + return_ACPI_STATUS (AE_OK); + } + MemList = AcpiGbl_GlobalList; Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY); if (ACPI_FAILURE (Status)) @@ -518,6 +523,11 @@ AcpiUtRemoveAllocation ( ACPI_FUNCTION_TRACE (UtRemoveAllocation); + if (AcpiGbl_DisableMemTracking) + { + return_ACPI_STATUS (AE_OK); + } + MemList = AcpiGbl_GlobalList; if (NULL == MemList->ListHead) { @@ -650,6 +660,11 @@ AcpiUtDumpAllocations ( ACPI_FUNCTION_TRACE (UtDumpAllocations); + if (AcpiGbl_DisableMemTracking) + { + return; + } + /* * Walk the allocation list. */ @@ -668,7 +683,7 @@ AcpiUtDumpAllocations ( if (Element->Size < sizeof (ACPI_COMMON_DESCRIPTOR)) { - AcpiOsPrintf ("%p Length 0x%04X %9.9s-%d " + AcpiOsPrintf ("%p Length 0x%04X %9.9s-%u " "[Not a Descriptor - too small]\n", Descriptor, Element->Size, Element->Module, Element->Line); @@ -679,7 +694,7 @@ AcpiUtDumpAllocations ( if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != ACPI_DESC_TYPE_CACHED) { - AcpiOsPrintf ("%p Length 0x%04X %9.9s-%d [%s] ", + AcpiOsPrintf ("%p Length 0x%04X %9.9s-%u [%s] ", Descriptor, Element->Size, Element->Module, Element->Line, AcpiUtGetDescriptorName (Descriptor)); @@ -757,7 +772,7 @@ AcpiUtDumpAllocations ( } else { - ACPI_ERROR ((AE_INFO, "%d(0x%X) Outstanding allocations", + ACPI_ERROR ((AE_INFO, "%u(0x%X) Outstanding allocations", NumOutstanding, NumOutstanding)); } 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 f59a08dba4..9e520174f1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c @@ -193,6 +193,15 @@ AcpiInitializeSubsystem ( return_ACPI_STATUS (Status); } + /* Initialize the global OSI interfaces list with the static names */ + + Status = AcpiUtInitializeInterfaces (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During OSI interfaces initialization")); + return_ACPI_STATUS (Status); + } + /* If configured, initialize the AML debugger */ ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ()); @@ -730,5 +739,144 @@ AcpiPurgeCachedObjects ( ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects) -#endif /* ACPI_ASL_COMPILER */ + +/***************************************************************************** + * + * FUNCTION: AcpiInstallInterface + * + * PARAMETERS: InterfaceName - The interface to install + * + * RETURN: Status + * + * DESCRIPTION: Install an _OSI interface to the global list + * + ****************************************************************************/ + +ACPI_STATUS +AcpiInstallInterface ( + ACPI_STRING InterfaceName) +{ + ACPI_STATUS Status; + ACPI_INTERFACE_INFO *InterfaceInfo; + + + /* Parameter validation */ + + if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0)) + { + return (AE_BAD_PARAMETER); + } + + (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + + /* Check if the interface name is already in the global list */ + + InterfaceInfo = AcpiUtGetInterface (InterfaceName); + if (InterfaceInfo) + { + /* + * The interface already exists in the list. This is OK if the + * interface has been marked invalid -- just clear the bit. + */ + if (InterfaceInfo->Flags & ACPI_OSI_INVALID) + { + InterfaceInfo->Flags &= ~ACPI_OSI_INVALID; + Status = AE_OK; + } + else + { + Status = AE_ALREADY_EXISTS; + } + } + else + { + /* New interface name, install into the global list */ + + Status = AcpiUtInstallInterface (InterfaceName); + } + + AcpiOsReleaseMutex (AcpiGbl_OsiMutex); + return (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInstallInterface) + + +/***************************************************************************** + * + * FUNCTION: AcpiRemoveInterface + * + * PARAMETERS: InterfaceName - The interface to remove + * + * RETURN: Status + * + * DESCRIPTION: Remove an _OSI interface from the global list + * + ****************************************************************************/ + +ACPI_STATUS +AcpiRemoveInterface ( + ACPI_STRING InterfaceName) +{ + ACPI_STATUS Status; + + + /* Parameter validation */ + + if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0)) + { + return (AE_BAD_PARAMETER); + } + + (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + + Status = AcpiUtRemoveInterface (InterfaceName); + + AcpiOsReleaseMutex (AcpiGbl_OsiMutex); + return (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiRemoveInterface) + + +/***************************************************************************** + * + * FUNCTION: AcpiInstallInterfaceHandler + * + * PARAMETERS: Handler - The _OSI interface handler to install + * NULL means "remove existing handler" + * + * RETURN: Status + * + * DESCRIPTION: Install a handler for the predefined _OSI ACPI method. + * invoked during execution of the internal implementation of + * _OSI. A NULL handler simply removes any existing handler. + * + ****************************************************************************/ + +ACPI_STATUS +AcpiInstallInterfaceHandler ( + ACPI_INTERFACE_HANDLER Handler) +{ + ACPI_STATUS Status = AE_OK; + + + (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + + if (Handler && AcpiGbl_InterfaceHandler) + { + Status = AE_ALREADY_EXISTS; + } + else + { + AcpiGbl_InterfaceHandler = Handler; + } + + AcpiOsReleaseMutex (AcpiGbl_OsiMutex); + return (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInstallInterfaceHandler) + +#endif /* !ACPI_ASL_COMPILER */ diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c new file mode 100644 index 0000000000..b397a40c2a --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c @@ -0,0 +1,550 @@ +/******************************************************************************* + * + * Module Name: utxferror - Various error/warning output functions + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __UTXFERROR_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utxferror") + +/* + * This module is used for the in-kernel ACPICA as well as the ACPICA + * tools/applications. + * + * For the iASL compiler case, the output is redirected to stderr so that + * any of the various ACPI errors and warnings do not appear in the output + * files, for either the compiler or disassembler portions of the tool. + */ +#ifdef ACPI_ASL_COMPILER +#include + +extern FILE *AcpiGbl_OutputFile; + +#define ACPI_MSG_REDIRECT_BEGIN \ + FILE *OutputFile = AcpiGbl_OutputFile; \ + AcpiOsRedirectOutput (stderr); + +#define ACPI_MSG_REDIRECT_END \ + AcpiOsRedirectOutput (OutputFile); + +#else +/* + * non-iASL case - no redirection, nothing to do + */ +#define ACPI_MSG_REDIRECT_BEGIN +#define ACPI_MSG_REDIRECT_END +#endif + +/* + * Common message prefixes + */ +#define ACPI_MSG_ERROR "ACPI Error: " +#define ACPI_MSG_EXCEPTION "ACPI Exception: " +#define ACPI_MSG_WARNING "ACPI Warning: " +#define ACPI_MSG_INFO "ACPI: " + +/* + * Common message suffix + */ +#define ACPI_MSG_SUFFIX \ + AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber) + + +/******************************************************************************* + * + * FUNCTION: AcpiError + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Print "ACPI Error" message with module/line/version info + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiError ( + const char *ModuleName, + UINT32 LineNumber, + const char *Format, + ...) +{ + va_list ArgList; + + + ACPI_MSG_REDIRECT_BEGIN; + AcpiOsPrintf (ACPI_MSG_ERROR); + + va_start (ArgList, Format); + AcpiOsVprintf (Format, ArgList); + ACPI_MSG_SUFFIX; + va_end (ArgList); + + ACPI_MSG_REDIRECT_END; +} + +ACPI_EXPORT_SYMBOL (AcpiError) + + +/******************************************************************************* + * + * FUNCTION: AcpiException + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Status - Status to be formatted + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Print "ACPI Exception" message with module/line/version info + * and decoded ACPI_STATUS. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiException ( + const char *ModuleName, + UINT32 LineNumber, + ACPI_STATUS Status, + const char *Format, + ...) +{ + va_list ArgList; + + + ACPI_MSG_REDIRECT_BEGIN; + AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status)); + + va_start (ArgList, Format); + AcpiOsVprintf (Format, ArgList); + ACPI_MSG_SUFFIX; + va_end (ArgList); + + ACPI_MSG_REDIRECT_END; +} + +ACPI_EXPORT_SYMBOL (AcpiException) + + +/******************************************************************************* + * + * FUNCTION: AcpiWarning + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Print "ACPI Warning" message with module/line/version info + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiWarning ( + const char *ModuleName, + UINT32 LineNumber, + const char *Format, + ...) +{ + va_list ArgList; + + + ACPI_MSG_REDIRECT_BEGIN; + AcpiOsPrintf (ACPI_MSG_WARNING); + + va_start (ArgList, Format); + AcpiOsVprintf (Format, ArgList); + ACPI_MSG_SUFFIX; + va_end (ArgList); + + ACPI_MSG_REDIRECT_END; +} + +ACPI_EXPORT_SYMBOL (AcpiWarning) + + +/******************************************************************************* + * + * FUNCTION: AcpiInfo + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Print generic "ACPI:" information message. There is no + * module/line/version info in order to keep the message simple. + * + * TBD: ModuleName and LineNumber args are not needed, should be removed. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiInfo ( + const char *ModuleName, + UINT32 LineNumber, + const char *Format, + ...) +{ + va_list ArgList; + + + ACPI_MSG_REDIRECT_BEGIN; + AcpiOsPrintf (ACPI_MSG_INFO); + + va_start (ArgList, Format); + AcpiOsVprintf (Format, ArgList); + AcpiOsPrintf ("\n"); + va_end (ArgList); + + ACPI_MSG_REDIRECT_END; +} + +ACPI_EXPORT_SYMBOL (AcpiInfo) + + +/* + * The remainder of this module contains internal error functions that may + * be configured out. + */ +#if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP) + +/******************************************************************************* + * + * FUNCTION: AcpiUtPredefinedWarning + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Pathname - Full pathname to the node + * NodeFlags - From Namespace node for the method/object + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Warnings for the predefined validation module. Messages are + * only emitted the first time a problem with a particular + * method/object is detected. This prevents a flood of error + * messages for methods that are repeatedly evaluated. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedWarning ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...) +{ + va_list ArgList; + + + /* + * Warning messages for this method/object will be disabled after the + * first time a validation fails or an object is successfully repaired. + */ + if (NodeFlags & ANOBJ_EVALUATED) + { + return; + } + + AcpiOsPrintf (ACPI_MSG_WARNING "For %s: ", Pathname); + + va_start (ArgList, Format); + AcpiOsVprintf (Format, ArgList); + ACPI_MSG_SUFFIX; + va_end (ArgList); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtPredefinedInfo + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Pathname - Full pathname to the node + * NodeFlags - From Namespace node for the method/object + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Info messages for the predefined validation module. Messages + * are only emitted the first time a problem with a particular + * method/object is detected. This prevents a flood of + * messages for methods that are repeatedly evaluated. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedInfo ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...) +{ + va_list ArgList; + + + /* + * Warning messages for this method/object will be disabled after the + * first time a validation fails or an object is successfully repaired. + */ + if (NodeFlags & ANOBJ_EVALUATED) + { + return; + } + + AcpiOsPrintf (ACPI_MSG_INFO "For %s: ", Pathname); + + va_start (ArgList, Format); + AcpiOsVprintf (Format, ArgList); + ACPI_MSG_SUFFIX; + va_end (ArgList); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtNamespaceError + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * InternalName - Name or path of the namespace node + * LookupStatus - Exception code from NS lookup + * + * RETURN: None + * + * DESCRIPTION: Print error message with the full pathname for the NS node. + * + ******************************************************************************/ + +void +AcpiUtNamespaceError ( + const char *ModuleName, + UINT32 LineNumber, + const char *InternalName, + ACPI_STATUS LookupStatus) +{ + ACPI_STATUS Status; + UINT32 BadName; + char *Name = NULL; + + + ACPI_MSG_REDIRECT_BEGIN; + AcpiOsPrintf (ACPI_MSG_ERROR); + + if (LookupStatus == AE_BAD_CHARACTER) + { + /* There is a non-ascii character in the name */ + + ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName)); + AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName); + } + else + { + /* Convert path to external format */ + + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, + InternalName, NULL, &Name); + + /* Print target name */ + + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf ("[%s]", Name); + } + else + { + AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]"); + } + + if (Name) + { + ACPI_FREE (Name); + } + } + + AcpiOsPrintf (" Namespace lookup failure, %s", + AcpiFormatException (LookupStatus)); + + ACPI_MSG_SUFFIX; + ACPI_MSG_REDIRECT_END; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtMethodError + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Message - Error message to use on failure + * PrefixNode - Prefix relative to the path + * Path - Path to the node (optional) + * MethodStatus - Execution status + * + * RETURN: None + * + * DESCRIPTION: Print error message with the full pathname for the method. + * + ******************************************************************************/ + +void +AcpiUtMethodError ( + const char *ModuleName, + UINT32 LineNumber, + const char *Message, + ACPI_NAMESPACE_NODE *PrefixNode, + const char *Path, + ACPI_STATUS MethodStatus) +{ + ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node = PrefixNode; + + + ACPI_MSG_REDIRECT_BEGIN; + AcpiOsPrintf (ACPI_MSG_ERROR); + + if (Path) + { + Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH, + &Node); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("[Could not get node by pathname]"); + } + } + + AcpiNsPrintNodePathname (Node, Message); + AcpiOsPrintf (", %s", AcpiFormatException (MethodStatus)); + + ACPI_MSG_SUFFIX; + ACPI_MSG_REDIRECT_END; +} + +#endif /* ACPI_NO_ERROR_MESSAGES */