diff options
Diffstat (limited to 'source')
54 files changed, 2307 insertions, 1983 deletions
diff --git a/source/common/adisasm.c b/source/common/adisasm.c index cc58376..fab3617 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -60,9 +60,13 @@ #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("adisasm") - +/* + * Older versions of Bison won't emit this external in the generated header. + * Newer versions do emit the external, so we don't need to do it. + */ +#ifndef ASLCOMPILER_ASLCOMPILERPARSE_H extern int AslCompilerdebug; - +#endif ACPI_STATUS LsDisplayNamespace ( diff --git a/source/common/ahpredef.c b/source/common/ahpredef.c index b3f1496..38a7f9d 100644 --- a/source/common/ahpredef.c +++ b/source/common/ahpredef.c @@ -198,7 +198,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_PIC", "Interrupt Model", "Inform AML of the interrupt model in use"), AH_PREDEF ("_PIF", "Power Source Information", "Returns a Power Source information block"), AH_PREDEF ("_PIN", "Pin List", "Pin list, Resource Descriptor field"), - AH_PREDEF ("_PLD", "Physical Device Location", "Returns a device's physical location information"), + AH_PREDEF ("_PLD", "Physical Location of Device", "Returns a device's physical location information"), AH_PREDEF ("_PMC", "Power Meter Capabilities", "Returns a list of Power Meter capabilities info"), AH_PREDEF ("_PMD", "Power Metered Devices", "Returns a list of devices that are measured by the power meter device"), AH_PREDEF ("_PMM", "Power Meter Measurement", "Returns the current value of the Power Meter"), diff --git a/source/common/dmtable.c b/source/common/dmtable.c index eceef4f5..cb97b54 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -277,22 +277,24 @@ static const char *AcpiDmGasAccessWidth[] = ACPI_DMTABLE_DATA AcpiDmTableData[] = { {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_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"}, + {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"}, {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"}, + {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, NULL, NULL, "Core System Resource Table"}, + {ACPI_SIG_DBG2, NULL, AcpiDmDumpDbg2, NULL, NULL, "Debug Port table type 2"}, {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_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table (FADT)"}, {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"}, {ACPI_SIG_GTDT, AcpiDmTableInfoGtdt, NULL, NULL, TemplateGtdt, "Generic Timer 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_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table (MADT)"}, {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_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"}, diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c index 5ea0ea3..102f1fe 100644 --- a/source/common/dmtbdump.c +++ b/source/common/dmtbdump.c @@ -52,11 +52,79 @@ ACPI_MODULE_NAME ("dmtbdump") +/* Local prototypes */ + static void AcpiDmValidateFadtLength ( UINT32 Revision, UINT32 Length); +static void +AcpiDmDumpBuffer ( + void *Table, + UINT32 BufferOffset, + UINT32 Length, + UINT32 AbsoluteOffset, + char *Header); + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpBuffer + * + * PARAMETERS: Table - ACPI Table or subtable + * BufferOffset - Offset of buffer from Table above + * Length - Length of the buffer + * AbsoluteOffset - Offset of buffer in the main ACPI table + * Header - Name of the buffer field (printed on the + * first line only.) + * + * RETURN: None + * + * DESCRIPTION: Format the contents of an arbitrary length data buffer (in the + * disassembler output format.) + * + ******************************************************************************/ + +static void +AcpiDmDumpBuffer ( + void *Table, + UINT32 BufferOffset, + UINT32 Length, + UINT32 AbsoluteOffset, + char *Header) +{ + UINT8 *Buffer; + UINT32 i; + + + if (!Length) + { + return; + } + + Buffer = ACPI_CAST_PTR (UINT8, Table) + BufferOffset; + i = 0; + + while (i < Length) + { + if (!(i % 16)) + { + AcpiOsPrintf ("\n"); + AcpiDmLineHeader (AbsoluteOffset, + ((Length - i) > 16) ? 16 : (Length - i), Header); + Header = NULL; + } + + AcpiOsPrintf ("%.02X ", *Buffer); + i++; + Buffer++; + AbsoluteOffset++; + } + + AcpiOsPrintf ("\n"); +} + /******************************************************************************* * @@ -529,6 +597,208 @@ AcpiDmDumpCpep ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpCsrt + * + * PARAMETERS: Table - A CSRT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a CSRT. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpCsrt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_CSRT_GROUP *SubTable; + ACPI_CSRT_DESCRIPTOR *SubSubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_CSRT); + UINT32 SubOffset; + UINT32 SubSubOffset; + UINT32 InfoLength; + + + /* The main table only contains the ACPI header, thus already handled */ + + /* Sub-tables (Resource Groups) */ + + SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoCsrt0); + if (ACPI_FAILURE (Status)) + { + return; + } + + SubOffset = sizeof (ACPI_CSRT_GROUP); + + /* Shared resource group info buffer */ + + AcpiDmDumpBuffer (SubTable, SubOffset, SubTable->InfoLength, + Offset+SubOffset, "Shared Data"); + SubOffset += SubTable->InfoLength; + + /* Sub-Sub-tables (Resource Descriptors) */ + + SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table, + Offset + SubOffset); + + while ((SubOffset < SubTable->Length) && + ((Offset + SubOffset) < Table->Length)) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable, + SubSubTable->Length, AcpiDmTableInfoCsrt1); + if (ACPI_FAILURE (Status)) + { + return; + } + + SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR); + + /* Resource-specific info buffer */ + + InfoLength = SubSubTable->Length - SubSubOffset; + + AcpiDmDumpBuffer (SubSubTable, SubSubOffset, InfoLength, + Offset + SubOffset + SubSubOffset, "ResourceInfo"); + SubSubOffset += InfoLength; + + /* Point to next sub-sub-table */ + + SubOffset += SubSubTable->Length; + SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable, + SubSubTable->Length); + } + + /* Point to next sub-table */ + + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable, + SubTable->Length); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpDbg2 + * + * PARAMETERS: Table - A DBG2 table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a DBG2. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpDbg2 ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_DBG2_DEVICE *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_DBG2); + UINT32 i; + UINT32 ArrayOffset; + UINT32 AbsoluteOffset; + UINT8 *Array; + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoDbg2Device); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Dump the BaseAddress array */ + + for (i = 0; i < SubTable->RegisterCount; i++) + { + ArrayOffset = SubTable->BaseAddressOffset + + (sizeof (ACPI_GENERIC_ADDRESS) * i); + AbsoluteOffset = Offset + ArrayOffset; + Array = (UINT8 *) SubTable + ArrayOffset; + + Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, + SubTable->Length, AcpiDmTableInfoDbg2Addr); + if (ACPI_FAILURE (Status)) + { + return; + } + } + + /* Dump the AddressSize array */ + + for (i = 0; i < SubTable->RegisterCount; i++) + { + ArrayOffset = SubTable->AddressSizeOffset + + (sizeof (UINT32) * i); + AbsoluteOffset = Offset + ArrayOffset; + Array = (UINT8 *) SubTable + ArrayOffset; + + Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, + SubTable->Length, AcpiDmTableInfoDbg2Size); + if (ACPI_FAILURE (Status)) + { + return; + } + } + + /* Dump the Namestring (required) */ + + AcpiOsPrintf ("\n"); + ArrayOffset = SubTable->NamepathOffset; + AbsoluteOffset = Offset + ArrayOffset; + Array = (UINT8 *) SubTable + ArrayOffset; + + Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, + SubTable->Length, AcpiDmTableInfoDbg2Name); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Dump the OemData (optional) */ + + AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength, + Offset + SubTable->OemDataOffset, "OEM Data"); + + /* Point to next sub-table */ + + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable, + SubTable->Length); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpDmar * * PARAMETERS: Table - A DMAR table @@ -540,6 +810,7 @@ AcpiDmDumpCpep ( * ******************************************************************************/ + void AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table) diff --git a/source/common/dmtbinfo.c b/source/common/dmtbinfo.c index 4600a0a..1cd856a 100644 --- a/source/common/dmtbinfo.c +++ b/source/common/dmtbinfo.c @@ -86,6 +86,7 @@ #define ACPI_BGRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BGRT,f) #define ACPI_BOOT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BOOT,f) #define ACPI_CPEP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_CPEP,f) +#define ACPI_DBG2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DBG2,f) #define ACPI_DBGP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DBGP,f) #define ACPI_DMAR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DMAR,f) #define ACPI_DRTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DRTM,f) @@ -126,6 +127,9 @@ #define ACPI_ASF3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_RMCP,f) #define ACPI_ASF4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ADDRESS,f) #define ACPI_CPEP0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CPEP_POLLING,f) +#define ACPI_CSRT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_GROUP,f) +#define ACPI_CSRT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_DESCRIPTOR,f) +#define ACPI_DBG20_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DBG2_DEVICE,f) #define ACPI_DMARS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f) #define ACPI_DMAR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f) #define ACPI_DMAR1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f) @@ -641,6 +645,94 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] = /******************************************************************************* * + * CSRT - Core System Resource Table + * + ******************************************************************************/ + +/* Main table consists only of the standard ACPI table header */ + +/* Resource Group subtable */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[] = +{ + {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (Length), "Length", 0}, + {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (VendorId), "Vendor ID", 0}, + {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (SubvendorId), "Subvendor ID", 0}, + {ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (DeviceId), "Device ID", 0}, + {ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (SubdeviceId), "Subdevice ID", 0}, + {ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (Revision), "Revision", 0}, + {ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (InfoLength), "InfoLength", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Resource Descriptor subtable */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[] = +{ + {ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (Length), "Length", 0}, + {ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (Type), "Type", 0}, + {ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (Subtype), "Subtype", 0}, + {ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (Uid), "UID", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * + * DBG2 - Debug Port Table 2 + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2[] = +{ + {ACPI_DMT_UINT32, ACPI_DBG2_OFFSET (InfoOffset), "Info Offset", 0}, + {ACPI_DMT_UINT32, ACPI_DBG2_OFFSET (InfoCount), "Info Count", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Debug Device Information Subtable */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Device[] = +{ + {ACPI_DMT_UINT8, ACPI_DBG20_OFFSET (Revision), "Revision", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (Length), "Length", 0}, + {ACPI_DMT_UINT8, ACPI_DBG20_OFFSET (RegisterCount), "Register Count", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (NamepathLength), "Namepath Length", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (NamepathOffset), "Namepath Offset", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (OemDataLength), "OEM Data Length", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (OemDataOffset), "OEM Data Offset", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (PortType), "Port Type", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (PortSubtype), "Port Subtype", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (BaseAddressOffset), "Base Address Offset", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (AddressSizeOffset), "Address Size Offset", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Variable-length data for the subtable */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Addr[] = +{ + {ACPI_DMT_GAS, 0, "Base Address Register", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Size[] = +{ + {ACPI_DMT_UINT32, 0, "Address Size", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Name[] = +{ + {ACPI_DMT_STRING, 0, "Namepath", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * * DBGP - Debug Port * ******************************************************************************/ diff --git a/source/compiler/Makefile b/source/compiler/Makefile deleted file mode 100644 index 86e0753..0000000 --- a/source/compiler/Makefile +++ /dev/null @@ -1,360 +0,0 @@ -# -# iASL compiler/disassembler -# -# NOTE: This makefile is intended to be used within the native -# ACPICA source tree. -# - -# -# Configuration -# Notes: -# gcc should be version 4 or greater, otherwise some of the options -# used will not be recognized. -# Global optimization flags (such as -O2, -Os) are not used, since -# they cause issues on some compilers. -# The _GNU_SOURCE symbol is required for many hosts. -# -PROG = iasl - -HOST = _LINUX -NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< - -ACPICA_SRC = ../../source -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -ACPICA_CORE = $(ACPICA_SRC)/components -ACPICA_INCLUDE = $(ACPICA_SRC)/include -ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger -ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler -ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher -ACPICA_EVENTS = $(ACPICA_CORE)/events -ACPICA_EXECUTER = $(ACPICA_CORE)/executer -ACPICA_HARDWARE = $(ACPICA_CORE)/hardware -ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace -ACPICA_PARSER = $(ACPICA_CORE)/parser -ACPICA_RESOURCES = $(ACPICA_CORE)/resources -ACPICA_TABLES = $(ACPICA_CORE)/tables -ACPICA_UTILITIES = $(ACPICA_CORE)/utilities -ASL_COMPILER = $(ACPICA_SRC)/compiler -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) - -ACPICA_HEADERS = \ - $(wildcard $(ACPICA_INCLUDE)/*.h) \ - $(wildcard $(ACPICA_INCLUDE)/platform/*.h) - -# -# Search paths for source files -# -vpath %.c \ - $(ASL_COMPILER) \ - $(ACPICA_DEBUGGER) \ - $(ACPICA_DISASSEMBLER) \ - $(ACPICA_DISPATCHER) \ - $(ACPICA_EXECUTER) \ - $(ACPICA_NAMESPACE) \ - $(ACPICA_PARSER) \ - $(ACPICA_TABLES) \ - $(ACPICA_UTILITIES) \ - $(ACPICA_COMMON) \ - $(ACPICA_OSL) - -HEADERS = \ - $(wildcard $(ASL_COMPILER)/*.h) \ - aslcompiler.y.h \ - dtparser.y.h \ - prparser.y.h - -OBJECTS = \ - aslcompilerlex.o \ - aslcompilerparse.o \ - dtparserlex.o \ - dtparserparse.o \ - prparserlex.o \ - prparserparse.o \ - adfile.o \ - adisasm.o \ - adwalk.o \ - ahpredef.o \ - aslanalyze.o \ - aslbtypes.o \ - aslcodegen.o \ - aslcompile.o \ - aslerror.o \ - aslfiles.o \ - aslfold.o \ - asllength.o \ - asllisting.o \ - aslload.o \ - asllookup.o \ - aslmain.o \ - aslmap.o \ - aslopcodes.o \ - asloperands.o \ - aslopt.o \ - aslpredef.o \ - aslresource.o \ - aslrestype1.o \ - aslrestype1i.o \ - aslrestype2.o \ - aslrestype2d.o \ - aslrestype2e.o \ - aslrestype2s.o \ - aslrestype2q.o \ - aslrestype2w.o \ - aslstartup.o \ - aslstubs.o \ - asltransform.o \ - asltree.o \ - aslutils.o \ - asluuid.o \ - aslwalks.o \ - dtcompile.o \ - dtexpress.o \ - dtfield.o \ - dtio.o \ - dtsubtable.o \ - dttable.o \ - dttemplate.o \ - dtutils.o \ - dbfileio.o \ - dmbuffer.o \ - dmextern.o \ - dmnames.o \ - dmobject.o \ - dmopcode.o \ - dmresrc.o \ - dmresrcl.o \ - dmresrcl2.o \ - dmresrcs.o \ - dmrestag.o \ - dmtable.o \ - dmtbdump.o \ - dmtbinfo.o \ - dmutils.o \ - dmwalk.o \ - dsargs.o \ - dscontrol.o \ - dsfield.o \ - dsobject.o \ - dsopcode.o \ - dsutils.o \ - dswexec.o \ - dswload.o \ - dswload2.o \ - dswscope.o \ - dswstate.o \ - exconvrt.o \ - excreate.o \ - exdump.o \ - exmisc.o \ - exmutex.o \ - exnames.o \ - exoparg1.o \ - exoparg2.o \ - exoparg3.o \ - exoparg6.o \ - exprep.o \ - exregion.o \ - exresnte.o \ - exresolv.o \ - exresop.o \ - exstore.o \ - exstoren.o \ - exstorob.o \ - exsystem.o \ - exutils.o \ - getopt.o \ - nsaccess.o \ - nsalloc.o \ - nsdump.o \ - nsnames.o \ - nsobject.o \ - nsparse.o \ - nssearch.o \ - nsutils.o \ - nswalk.o \ - nsxfobj.o \ - osunixxf.o \ - prexpress.o \ - prmacros.o \ - prscan.o \ - prutils.o \ - psargs.o \ - psloop.o \ - psopcode.o \ - psparse.o \ - psscope.o \ - pstree.o \ - psutils.o \ - pswalk.o \ - tbfadt.o \ - tbinstal.o \ - tbutils.o \ - tbxface.o \ - utaddress.o \ - utalloc.o \ - utcache.o \ - utcopy.o \ - utdebug.o \ - utdecode.o \ - utdelete.o \ - utexcep.o \ - utglobal.o \ - utinit.o \ - utlock.o \ - utmath.o \ - utmisc.o \ - utmutex.o \ - utobject.o \ - utresrc.o \ - utstate.o \ - utxferror.o \ - utxface.o - -INTERMEDIATES = \ - aslcompilerlex.c \ - aslcompilerparse.c \ - dtparserlex.c \ - dtparserparse.c \ - prparserlex.c \ - prparserparse.c - -MISC = \ - aslcompilerparse.h \ - aslcompiler.y.h \ - aslcompilerparse.output \ - dtparserparse.h \ - dtparser.y.h \ - dtparserparse.output \ - prparserparse.h \ - prparser.y.h \ - prparserparse.output - -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_ASL_COMPILER \ - -I$(ACPICA_INCLUDE) \ - -I$(ASL_COMPILER) - -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef - -# -# gcc 4+ flags -# -CWARNINGFLAGS += \ - -Waddress \ - -Waggregate-return \ - -Wchar-subscripts \ - -Wempty-body \ - -Wlogical-op \ - -Wmissing-declarations \ - -Wmissing-field-initializers \ - -Wmissing-parameter-type \ - -Wnested-externs \ - -Wold-style-declaration \ - -Wold-style-definition \ - -Wredundant-decls \ - -Wtype-limits - -# -# Bison/Flex configuration -# -YACC= bison -YFLAGS+= -v -d -y - -LEX= flex -LFLAGS+= -i -s - -# -# Root rule -# -$(PROG) : $(INTERMEDIATES) $(MISC) $(OBJECTS) - $(CC) $(OBJECTS) $(LDFLAGS) -o $(PROG) - -# -# Parser and Lexer - intermediate C files -# -aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l $(ASL_COMPILER)/aslsupport.l - ${LEX} ${LFLAGS} -PAslCompiler -o$@ $(ASL_COMPILER)/aslcompiler.l - -aslcompilerparse.c aslcompilerparse.h : $(ASL_COMPILER)/aslcompiler.y - ${YACC} ${YFLAGS} -pAslCompiler -o$@ $? - -dtparserlex.c : $(ASL_COMPILER)/dtparser.l - ${LEX} ${LFLAGS} -PDtParser -o$@ $? - -dtparserparse.c dtparserparse.h : $(ASL_COMPILER)/dtparser.y - ${YACC} ${YFLAGS} -pDtParser -o$@ $? - -prparserlex.c : $(ASL_COMPILER)/prparser.l - ${LEX} ${LFLAGS} -PPrParser -o$@ $? - -prparserparse.c prparserparse.h : $(ASL_COMPILER)/prparser.y - ${YACC} ${YFLAGS} -pPrParser -o$@ $? - - -# Rename headers produced by bison/yacc - -aslcompiler.y.h : aslcompilerparse.h - @echo Copy intermediate file: - @cp -f -v aslcompilerparse.h aslcompiler.y.h - -dtparser.y.h: dtparserparse.h - @echo Copy intermediate file: - @cp -f -v dtparserparse.h dtparser.y.h - -prparser.y.h: prparserparse.h - @echo Copy intermediate file: - @cp -f -v prparserparse.h prparser.y.h - - -# -# Parsers and Lexers - final object files -# -# Cannot use the common compile warning flags since the C files are created -# by the utilities above and they are not necessarily ANSI C, etc. -# -aslcompilerlex.o : aslcompilerlex.c - $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? - -aslcompilerparse.o : aslcompilerparse.c - $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? - -dtparserlex.o : dtparserlex.c - $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? - -dtparserparse.o : dtparserparse.c - $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? - -prparserlex.o : prparserlex.c - $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? - -prparserparse.o : prparserparse.c - $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? - - -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) - $(COMPILE) - -clean : - rm -f $(PROG) $(PROG).exe $(OBJECTS) $(INTERMEDIATES) $(MISC) - -install : - $(INSTALLPROG) diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 937530d..09b3f6c 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -594,6 +594,11 @@ TrSetNodeFlags ( UINT32 Flags); ACPI_PARSE_OBJECT * +TrSetNodeAmlLength ( + ACPI_PARSE_OBJECT *Op, + UINT32 Length); + +ACPI_PARSE_OBJECT * TrLinkPeerNodes ( UINT32 NumPeers, ...); diff --git a/source/compiler/aslcompiler.y b/source/compiler/aslcompiler.y index 7df36a8..92ae940 100644 --- a/source/compiler/aslcompiler.y +++ b/source/compiler/aslcompiler.y @@ -560,7 +560,7 @@ void * AslLocalAllocate (unsigned int Size); %type <n> SwitchTerm %type <n> UnloadTerm %type <n> WhileTerm -//%type <n> CaseTermList +/* %type <n> CaseTermList */ /* Type 2 opcodes */ @@ -2507,30 +2507,38 @@ ConstExprTerm | PARSEOP___PATH__ {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);} ; +/* + * The NODE_COMPILE_TIME_CONST flag in the following constant expressions + * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes + * to simple integers. It is an error if these types of expressions cannot be + * reduced, since the AML grammar for ****ConstExpr requires a simple constant. + * Note: The required byte length of the constant is passed through to the + * constant folding code in the node AmlLength field. + */ ByteConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);} | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} | ByteConst {} ; WordConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);} | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} | WordConst {} ; DWordConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);} | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} | DWordConst {} ; QWordConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);} | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} | QWordConst {} ; @@ -2839,10 +2847,10 @@ ExtendedSpaceTerm FixedDmaTerm : PARSEOP_FIXEDDMA '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDDMA);} - WordConstExpr // 04: DMA RequestLines - ',' WordConstExpr // 06: DMA Channels - OptionalXferSize // 07: DMA TransferSize - OptionalNameString // 08: DescriptorName + WordConstExpr /* 04: DMA RequestLines */ + ',' WordConstExpr /* 06: DMA Channels */ + OptionalXferSize /* 07: DMA TransferSize */ + OptionalNameString /* 08: DescriptorName */ ')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$7,$8);} | PARSEOP_FIXEDDMA '(' error ')' {$$ = AslDoError(); yyclearin;} @@ -2860,16 +2868,16 @@ FixedIOTerm GpioIntTerm : PARSEOP_GPIO_INT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_INT);} - InterruptTypeKeyword // 04: InterruptType - ',' InterruptLevel // 06: InterruptLevel - OptionalShareType // 07: SharedType - ',' PinConfigByte // 09: PinConfig - OptionalWordConstExpr // 10: DebounceTimeout - ',' StringData // 12: ResourceSource - OptionalByteConstExpr // 13: ResourceSourceIndex - OptionalResourceType // 14: ResourceType - OptionalNameString // 15: DescriptorName - OptionalBuffer_Last // 16: VendorData + InterruptTypeKeyword /* 04: InterruptType */ + ',' InterruptLevel /* 06: InterruptLevel */ + OptionalShareType /* 07: SharedType */ + ',' PinConfigByte /* 09: PinConfig */ + OptionalWordConstExpr /* 10: DebounceTimeout */ + ',' StringData /* 12: ResourceSource */ + OptionalByteConstExpr /* 13: ResourceSourceIndex */ + OptionalResourceType /* 14: ResourceType */ + OptionalNameString /* 15: DescriptorName */ + OptionalBuffer_Last /* 16: VendorData */ ')' '{' DWordConstExpr '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);} | PARSEOP_GPIO_INT '(' @@ -2878,16 +2886,16 @@ GpioIntTerm GpioIoTerm : PARSEOP_GPIO_IO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_IO);} - OptionalShareType_First // 04: SharedType - ',' PinConfigByte // 06: PinConfig - OptionalWordConstExpr // 07: DebounceTimeout - OptionalWordConstExpr // 08: DriveStrength - OptionalIoRestriction // 09: IoRestriction - ',' StringData // 11: ResourceSource - OptionalByteConstExpr // 12: ResourceSourceIndex - OptionalResourceType // 13: ResourceType - OptionalNameString // 14: DescriptorName - OptionalBuffer_Last // 15: VendorData + OptionalShareType_First /* 04: SharedType */ + ',' PinConfigByte /* 06: PinConfig */ + OptionalWordConstExpr /* 07: DebounceTimeout */ + OptionalWordConstExpr /* 08: DriveStrength */ + OptionalIoRestriction /* 09: IoRestriction */ + ',' StringData /* 11: ResourceSource */ + OptionalByteConstExpr /* 12: ResourceSourceIndex */ + OptionalResourceType /* 13: ResourceType */ + OptionalNameString /* 14: DescriptorName */ + OptionalBuffer_Last /* 15: VendorData */ ')' '{' DWordList '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);} | PARSEOP_GPIO_IO '(' @@ -2896,15 +2904,15 @@ GpioIoTerm I2cSerialBusTerm : PARSEOP_I2C_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_I2C_SERIALBUS);} - WordConstExpr // 04: SlaveAddress - OptionalSlaveMode // 05: SlaveMode - ',' DWordConstExpr // 07: ConnectionSpeed - OptionalAddressingMode // 08: AddressingMode - ',' StringData // 10: ResourceSource - OptionalByteConstExpr // 11: ResourceSourceIndex - OptionalResourceType // 12: ResourceType - OptionalNameString // 13: DescriptorName - OptionalBuffer_Last // 14: VendorData + WordConstExpr /* 04: SlaveAddress */ + OptionalSlaveMode /* 05: SlaveMode */ + ',' DWordConstExpr /* 07: ConnectionSpeed */ + OptionalAddressingMode /* 08: AddressingMode */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ ')' {$$ = TrLinkChildren ($<n>3,9,$4,$5,$7,$8,$10,$11,$12,$13,$14);} | PARSEOP_I2C_SERIALBUS '(' error ')' {$$ = AslDoError(); yyclearin;} @@ -3077,19 +3085,19 @@ RegisterTerm SpiSerialBusTerm : PARSEOP_SPI_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SPI_SERIALBUS);} - WordConstExpr // 04: DeviceSelection - OptionalDevicePolarity // 05: DevicePolarity - OptionalWireMode // 06: WireMode - ',' ByteConstExpr // 08: DataBitLength - OptionalSlaveMode // 09: SlaveMode - ',' DWordConstExpr // 11: ConnectionSpeed - ',' ClockPolarityKeyword // 13: ClockPolarity - ',' ClockPhaseKeyword // 15: ClockPhase - ',' StringData // 17: ResourceSource - OptionalByteConstExpr // 18: ResourceSourceIndex - OptionalResourceType // 19: ResourceType - OptionalNameString // 20: DescriptorName - OptionalBuffer_Last // 21: VendorData + WordConstExpr /* 04: DeviceSelection */ + OptionalDevicePolarity /* 05: DevicePolarity */ + OptionalWireMode /* 06: WireMode */ + ',' ByteConstExpr /* 08: DataBitLength */ + OptionalSlaveMode /* 09: SlaveMode */ + ',' DWordConstExpr /* 11: ConnectionSpeed */ + ',' ClockPolarityKeyword /* 13: ClockPolarity */ + ',' ClockPhaseKeyword /* 15: ClockPhase */ + ',' StringData /* 17: ResourceSource */ + OptionalByteConstExpr /* 18: ResourceSourceIndex */ + OptionalResourceType /* 19: ResourceType */ + OptionalNameString /* 20: DescriptorName */ + OptionalBuffer_Last /* 21: VendorData */ ')' {$$ = TrLinkChildren ($<n>3,13,$4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20,$21);} | PARSEOP_SPI_SERIALBUS '(' error ')' {$$ = AslDoError(); yyclearin;} @@ -3115,20 +3123,20 @@ StartDependentFnTerm UartSerialBusTerm : PARSEOP_UART_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UART_SERIALBUS);} - DWordConstExpr // 04: ConnectionSpeed - OptionalBitsPerByte // 05: BitsPerByte - OptionalStopBits // 06: StopBits - ',' ByteConstExpr // 08: LinesInUse - OptionalEndian // 09: Endianess - OptionalParityType // 10: Parity - OptionalFlowControl // 11: FlowControl - ',' WordConstExpr // 13: Rx BufferSize - ',' WordConstExpr // 15: Tx BufferSize - ',' StringData // 17: ResourceSource - OptionalByteConstExpr // 18: ResourceSourceIndex - OptionalResourceType // 19: ResourceType - OptionalNameString // 20: DescriptorName - OptionalBuffer_Last // 21: VendorData + DWordConstExpr /* 04: ConnectionSpeed */ + OptionalBitsPerByte /* 05: BitsPerByte */ + OptionalStopBits /* 06: StopBits */ + ',' ByteConstExpr /* 08: LinesInUse */ + OptionalEndian /* 09: Endianess */ + OptionalParityType /* 10: Parity */ + OptionalFlowControl /* 11: FlowControl */ + ',' WordConstExpr /* 13: Rx BufferSize */ + ',' WordConstExpr /* 15: Tx BufferSize */ + ',' StringData /* 17: ResourceSource */ + OptionalByteConstExpr /* 18: ResourceSourceIndex */ + OptionalResourceType /* 19: ResourceType */ + OptionalNameString /* 20: DescriptorName */ + OptionalBuffer_Last /* 21: VendorData */ ')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20,$21);} | PARSEOP_UART_SERIALBUS '(' error ')' {$$ = AslDoError(); yyclearin;} diff --git a/source/compiler/aslfold.c b/source/compiler/aslfold.c index c1fd271..6c8cb37 100644 --- a/source/compiler/aslfold.c +++ b/source/compiler/aslfold.c @@ -73,6 +73,11 @@ OpcAmlCheckForConstant ( UINT32 Level, void *Context); +static void +OpcUpdateIntegerNode ( + ACPI_PARSE_OBJECT *Op, + UINT64 Value); + /******************************************************************************* * @@ -214,14 +219,14 @@ OpcAmlCheckForConstant ( { /* * We are looking at at normal expression to see if it can be - * reduced. It can't. No error + * 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 + * can't be reduced. This is an error */ if (Op->Asl.CompileFlags & NODE_IS_TARGET) { @@ -319,17 +324,17 @@ OpcAmlConstantWalk ( return AE_NO_MEMORY; } - WalkState->NextOp = NULL; - WalkState->Params = NULL; - WalkState->CallerReturnDesc = &ObjDesc; - WalkState->WalkType = WalkType; + WalkState->NextOp = NULL; + WalkState->Params = NULL; + WalkState->WalkType = WalkType; + WalkState->CallerReturnDesc = &ObjDesc; /* * 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); + OpcAmlCheckForConstant, NULL, WalkState); /* * Did we find an entire subtree that contains all constants and type 3/4/5 @@ -369,7 +374,7 @@ OpcAmlConstantWalk ( /* Hand off the subtree to the AML interpreter */ Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, - OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState); + OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState); Op->Common.Parent = OriginalParentOp; /* TBD: we really *should* release the RootOp node */ @@ -382,22 +387,26 @@ OpcAmlConstantWalk ( Status = AcpiDsResultPop (&ObjDesc, WalkState); } + + /* Check for error from the ACPICA core */ + + if (ACPI_FAILURE (Status)) + { + AslCoreSubsystemError (Op, Status, + "Failure during constant evaluation", FALSE); + } } 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 */ + /* Set the subtree value to ZERO anyway. Eliminates further errors */ - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Common.Value.Integer = 0; - OpcSetOptimalIntegerSize (Op); + OpcUpdateIntegerNode (Op, 0); } else { @@ -412,21 +421,20 @@ OpcAmlConstantWalk ( { case ACPI_TYPE_INTEGER: - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Common.Value.Integer = ObjDesc->Integer.Value; - OpcSetOptimalIntegerSize (Op); + OpcUpdateIntegerNode (Op, ObjDesc->Integer.Value); DbgPrint (ASL_PARSE_OUTPUT, - "Constant expression reduced to (INTEGER) %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); + "Constant expression reduced to (%s) %8.8X%8.8X\n", + Op->Asl.ParseOpName, + ACPI_FORMAT_UINT64 (Op->Common.Value.Integer)); 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->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, @@ -438,18 +446,18 @@ OpcAmlConstantWalk ( case ACPI_TYPE_BUFFER: - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Common.AmlOpcode = AML_BUFFER_OP; - Op->Asl.CompileFlags = NODE_AML_PACKAGE; + 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.AmlOpcode = AML_DWORD_OP; RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length; - RootOp->Asl.Parent = Op; + RootOp->Asl.Parent = Op; (void) OpcSetOptimalIntegerSize (RootOp); @@ -460,10 +468,10 @@ OpcAmlConstantWalk ( /* 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; + 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; @@ -476,7 +484,7 @@ OpcAmlConstantWalk ( default: printf ("Unsupported return type: %s\n", - AcpiUtGetObjectTypeName (ObjDesc)); + AcpiUtGetObjectTypeName (ObjDesc)); break; } } @@ -485,7 +493,62 @@ OpcAmlConstantWalk ( Op->Asl.Child = NULL; AcpiDsDeleteWalkState (WalkState); - return (AE_CTRL_DEPTH); } + +/******************************************************************************* + * + * FUNCTION: OpcUpdateIntegerNode + * + * PARAMETERS: Op - Current parse object + * + * RETURN: None + * + * DESCRIPTION: Update node to the correct integer type. + * + ******************************************************************************/ + +static void +OpcUpdateIntegerNode ( + ACPI_PARSE_OBJECT *Op, + UINT64 Value) +{ + + Op->Common.Value.Integer = Value; + + /* + * The AmlLength is used by the parser to indicate a constant, + * (if non-zero). Length is either (1/2/4/8) + */ + switch (Op->Asl.AmlLength) + { + case 1: + TrUpdateNode (PARSEOP_BYTECONST, Op); + Op->Asl.AmlOpcode = AML_RAW_DATA_BYTE; + break; + + case 2: + TrUpdateNode (PARSEOP_WORDCONST, Op); + Op->Asl.AmlOpcode = AML_RAW_DATA_WORD; + break; + + case 4: + TrUpdateNode (PARSEOP_DWORDCONST, Op); + Op->Asl.AmlOpcode = AML_RAW_DATA_DWORD; + break; + + case 8: + TrUpdateNode (PARSEOP_QWORDCONST, Op); + Op->Asl.AmlOpcode = AML_RAW_DATA_QWORD; + break; + + case 0: + default: + OpcSetOptimalIntegerSize (Op); + TrUpdateNode (PARSEOP_INTEGER, Op); + break; + } + + Op->Asl.AmlLength = 0; +} diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index 595e5f4..4c4e79a 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -197,6 +197,7 @@ typedef enum ASL_MSG_UPPER_CASE, ASL_MSG_VENDOR_LIST, ASL_MSG_WRITE, + ASL_MSG_RANGE, /* These messages are used by the Preprocessor only */ @@ -371,6 +372,7 @@ char *AslMessages [] = { /* ASL_MSG_UPPER_CASE */ "Non-hex letters must be upper case", /* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)", /* ASL_MSG_WRITE */ "Could not write file", +/* ASL_MSG_RANGE */ "Constant out of range", /* Preprocessor */ diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index dc6cb44..12223b6 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -68,9 +68,9 @@ TrGetNodeFlagName ( * * PARAMETERS: None * - * RETURN: New parse node. Aborts on allocation failure + * RETURN: New parse node. Aborts on allocation failure * - * DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local + * 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.) * @@ -98,7 +98,7 @@ TrGetNextNode ( * * PARAMETERS: ParseOpcode - Opcode to be assigned to the node * - * RETURN: New parse node. Aborts on allocation failure + * RETURN: New parse node. Aborts on allocation failure * * DESCRIPTION: Allocate and initialize a new parse node for the parse tree * @@ -133,7 +133,7 @@ TrAllocateNode ( * * RETURN: None * - * DESCRIPTION: "release" a node. In truth, nothing is done since the node + * DESCRIPTION: "release" a node. In truth, nothing is done since the node * is part of a larger buffer * ******************************************************************************/ @@ -156,9 +156,9 @@ TrReleaseNode ( * * RETURN: The updated node * - * DESCRIPTION: Change the parse opcode assigned to a node. Usually used to + * 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 + * during the code generation. Also used to set generic integers * to a specific size (8, 16, 32, or 64 bits) * ******************************************************************************/ @@ -186,19 +186,21 @@ TrUpdateNode ( switch (ParseOpcode) { case PARSEOP_BYTECONST: - Op->Asl.Value.Integer = 0xFF; + Op->Asl.Value.Integer = ACPI_UINT8_MAX; break; case PARSEOP_WORDCONST: - Op->Asl.Value.Integer = 0xFFFF; + Op->Asl.Value.Integer = ACPI_UINT16_MAX; break; case PARSEOP_DWORDCONST: - Op->Asl.Value.Integer = 0xFFFFFFFF; + Op->Asl.Value.Integer = ACPI_UINT32_MAX; break; + /* Don't need to do the QWORD case */ + default: - /* Don't care about others, don't need to check QWORD */ + /* Don't care about others */ break; } } @@ -213,15 +215,18 @@ TrUpdateNode ( switch (ParseOpcode) { case PARSEOP_BYTECONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX); + UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX); + Op->Asl.Value.Integer &= ACPI_UINT8_MAX; break; case PARSEOP_WORDCONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX); + UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX); + Op->Asl.Value.Integer &= ACPI_UINT16_MAX; break; case PARSEOP_DWORDCONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX); + UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX); + Op->Asl.Value.Integer &= ACPI_UINT32_MAX; break; default: @@ -315,7 +320,7 @@ TrGetNodeFlagName ( * * RETURN: The updated parser op * - * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set + * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set * ******************************************************************************/ @@ -335,8 +340,41 @@ TrSetNodeFlags ( } Op->Asl.CompileFlags |= Flags; + return (Op); +} - return Op; + +/******************************************************************************* + * + * FUNCTION: TrSetNodeAmlLength + * + * PARAMETERS: Op - An existing parse node + * Length - AML Length + * + * RETURN: The updated parser op + * + * DESCRIPTION: Set the AML Length in a node. Used by the parser to indicate + * the presence of a node that must be reduced to a fixed length + * constant. + * + ******************************************************************************/ + +ACPI_PARSE_OBJECT * +TrSetNodeAmlLength ( + ACPI_PARSE_OBJECT *Op, + UINT32 Length) +{ + + DbgPrint (ASL_PARSE_OUTPUT, + "\nSetNodeAmlLength: Op %p, %8.8X\n", Op, Length); + + if (!Op) + { + return NULL; + } + + Op->Asl.AmlLength = Length; + return (Op); } @@ -376,7 +414,7 @@ TrSetEndLineNumber ( * * PARAMETERS: ParseOpcode - New opcode to be assigned to the node * - * RETURN: Pointer to the new node. Aborts on allocation failure + * 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) @@ -406,7 +444,7 @@ TrCreateLeafNode ( * * PARAMETERS: ParseOpcode - The constant opcode * - * RETURN: Pointer to the new node. Aborts on allocation failure + * RETURN: Pointer to the new node. Aborts on allocation failure * * DESCRIPTION: Create a leaf node (no children or peers) for one of the * special constants - __LINE__, __FILE__, and __DATE__. @@ -488,7 +526,7 @@ TrCreateConstantLeafNode ( * 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 + * 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 @@ -553,9 +591,9 @@ TrCreateValuedLeafNode ( * 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. + * node. NumChildren long. * - * RETURN: Pointer to the new node. Aborts on allocation failure + * 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. @@ -621,7 +659,7 @@ TrCreateNode ( /* * If child is NULL, this means that an optional argument - * was omitted. We must create a placeholder with a special + * 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 */ @@ -675,7 +713,7 @@ TrCreateNode ( * 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. + * node. NumChildren long. * * RETURN: The updated (linked) node * @@ -745,7 +783,7 @@ TrLinkChildren ( /* * If child is NULL, this means that an optional argument - * was omitted. We must create a placeholder with a special + * 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 */ @@ -800,7 +838,7 @@ TrLinkChildren ( * * RETURN: Op1 or the non-null node. * - * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null. + * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null. * ******************************************************************************/ diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 9cc109b..771ba09 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -105,34 +105,34 @@ UtAttachNameseg ( * ******************************************************************************/ +#define ACPI_TABLE_HELP_FORMAT "%8u) %s %s\n" + void UtDisplaySupportedTables ( void) { ACPI_DMTABLE_DATA *TableData; - UINT32 i = 6; + UINT32 i; - printf ("\nACPI tables supported by iASL subsystems in " - "version %8.8X:\n" - " ASL and Data Table compilers\n" - " AML and Data Table disassemblers\n" - " ACPI table template generator\n\n", ACPI_CA_VERSION); + printf ("\nACPI tables supported by iASL version %8.8X:\n" + " (Compiler, Disassembler, Template Generator)\n\n", + ACPI_CA_VERSION); /* Special tables */ - printf ("%8u) %s %s\n", 1, ACPI_SIG_DSDT, "Differentiated System Description Table"); - printf ("%8u) %s %s\n", 2, ACPI_SIG_SSDT, "Secondary System Description Table"); - printf ("%8u) %s %s\n", 3, ACPI_SIG_FADT, "Fixed ACPI Description Table (FADT)"); - printf ("%8u) %s %s\n", 4, ACPI_SIG_FACS, "Firmware ACPI Control Structure"); - printf ("%8u) %s %s\n", 5, ACPI_RSDP_NAME, "Root System Description Pointer"); + printf (" Special tables and AML tables:\n"); + printf (ACPI_TABLE_HELP_FORMAT, 1, ACPI_RSDP_NAME, "Root System Description Pointer"); + printf (ACPI_TABLE_HELP_FORMAT, 2, ACPI_SIG_FACS, "Firmware ACPI Control Structure"); + printf (ACPI_TABLE_HELP_FORMAT, 3, ACPI_SIG_DSDT, "Differentiated System Description Table"); + printf (ACPI_TABLE_HELP_FORMAT, 4, ACPI_SIG_SSDT, "Secondary System Description Table"); /* All data tables with common table header */ - for (TableData = AcpiDmTableData; TableData->Signature; TableData++) + printf ("\n Standard ACPI data tables:\n"); + for (TableData = AcpiDmTableData, i = 5; TableData->Signature; TableData++, i++) { - printf ("%8u) %s %s\n", i, TableData->Signature, TableData->Name); - i++; + printf (ACPI_TABLE_HELP_FORMAT, i, TableData->Signature, TableData->Name); } } @@ -591,36 +591,23 @@ UtCheckIntegerRange ( 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) + if ((Op->Asl.Value.Integer < LowValue) || + (Op->Asl.Value.Integer > HighValue)) { - ParseError = "Value above valid range"; - Op->Asl.Value.Integer = HighValue; - } + sprintf (MsgBuffer, "0x%X, allowable: 0x%X-0x%X", + (UINT32) Op->Asl.Value.Integer, LowValue, HighValue); - if (ParseError) - { - sprintf (Buffer, "%s 0x%X-0x%X", ParseError, LowValue, HighValue); - AslCompilererror (Buffer); - - return NULL; + AslError (ASL_ERROR, ASL_MSG_RANGE, Op, MsgBuffer); + return (NULL); } - return Op; + return (Op); } diff --git a/source/compiler/new_table.txt b/source/compiler/new_table.txt new file mode 100755 index 0000000..1e48d38 --- /dev/null +++ b/source/compiler/new_table.txt @@ -0,0 +1,88 @@ +How to add a new ACPI table to ACPICA and the iASL compiler. +------------------------------------------------------------ + +There are four main tasks that are needed to provide support for a +new ACPI table: + 1) Create a full definition of the table and any subtables + in the ACPICA headers. + 2) Add disassembler support for the new table + 3) Add iASL table compiler support for the new table + 4) Create a default template for the new table for iASL -T + option. + +Notes for each of these tasks provided below. + + +1) Header Support +----------------- + +New tables should be added to the appropriate header: + actbl2.h: Used for new tables that are not defined in the ACPI spec. + actbl3.h: Used for new tables that are defined in the ACPI spec. + +Use ACPI_TABLE_HEADER for the common ACPI table header. +Subtables should be defined separately from the main table. +Don't add placeholder fields for subtables and other multiple data items. + (Don't use xxxxx[1] for a field that can have multiple items.) + The disassembler and data table compiler depends on this. +For tables not defined in the ACPI spec, add a comment to indicate where + the table came from. +Use other table definitions for additional guidance. + + +2) iASL Disassembler Support +---------------------------- + +Add definition of the table (and subtables) in common/dmtbinfo.c +Add table access macro(s) of the form ACPI_xxxx_OFFSET +Add ACPI_DMT_TERMINATOR at the end of every table/subtable definition + +Add externals for the table/subtable definitions in acdisasm.h +Add an entry for the new table in the AcpiDmTableData in common/dmtable.c + +If there are no subtables, add the AcpiDmTableInfoXXXX name to the + AcpiDmTableData and it will automatically be disassembled. + +If there are subtables, a dump routine must be written: +Add an AcpiDmDumpXXXX function to dmtbdump.c -- note, code for another + similar table can often be ported for the new table. +Add an external for this function to acdisasm.h +Add this function to the AcpiDmTableData entry for the new ACPI table + +Debug/Test: Either find an existing example of the new ACPI table, or + create one using the "generic ACPI table support" included in the + iASL data table compiler. Use the -G option to force a + generic compile. It is often best to create the table from scratch, + since this clearly exposes the dependencies (lengths, offsets, etc.) + that the Table Compiler support will need to generate. + + +3) iASL Table Compiler Support +------------------------------ + +Simple tables do not require a compile routine. The definition of the + table in common/dmtbinfo.c (created in step 2 above) will suffice. + +Complex tables with subtables will require a compile routine with a name + of the form DtCompileXXXX. +Add a DtCompileXXXX function to the dttable.c module. +Add an external for this function in dtcompiler.h +Add this function to the AcpiDmTableData entry for the new ACPI table + in common/dmtable.c + + +4) Template Support (-T iASL option) +------------------------------------ + +Create an example of the new ACPI table. This example should create + multiple subtables (if supported), and multiple instances of any + variable length data. + +Compile the example file with the -sc option. This will create a C + array that contains the table contents. + +Add this array to the dttemplate.h file. Name the array TemplateXXXX. +Add this array name to the AcpiDmTableData entry for the new ACPI table + +Debug/Test: Create the template file. Compile the file. Disassemble the file. + Compile the disassembly file. diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index 93d4f29..0e9d78d 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -174,14 +174,14 @@ AcpiDbSleep ( } AcpiOsPrintf ("**** Going to sleep ****\n"); - Status = AcpiEnterSleepState (SleepState, ACPI_NO_OPTIONAL_METHODS); + Status = AcpiEnterSleepState (SleepState); if (ACPI_FAILURE (Status)) { goto ErrorExit; } AcpiOsPrintf ("**** Prepare to return from sleep ****\n"); - Status = AcpiLeaveSleepStatePrep (SleepState, ACPI_NO_OPTIONAL_METHODS); + Status = AcpiLeaveSleepStatePrep (SleepState); if (ACPI_FAILURE (Status)) { goto ErrorExit; diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index 4b59f22..86c6579 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -104,6 +104,15 @@ AcpiDbDeleteObjects ( ACPI_OBJECT *Objects); +static UINT8 * +AcpiDbEncodePldBuffer ( + ACPI_PLD_INFO *PldInfo); + +static void +AcpiDbDumpPldBuffer ( + ACPI_OBJECT *ObjDesc); + + /******************************************************************************* * * FUNCTION: AcpiDbHexCharToValue @@ -446,7 +455,6 @@ AcpiDbExecuteMethod ( ACPI_STATUS Status; ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; - ACPI_HANDLE Handle; ACPI_DEVICE_INFO *ObjInfo; UINT32 i; @@ -459,17 +467,9 @@ AcpiDbExecuteMethod ( 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_ACPI_STATUS (Status); - } - /* Get the object info for number of method parameters */ - Status = AcpiGetObjectInfo (Handle, &ObjInfo); + Status = AcpiGetObjectInfo (Info->Method, &ObjInfo); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -720,6 +720,202 @@ AcpiDbExecutionWalk ( /******************************************************************************* * + * FUNCTION: AcpiDbEncodePldBuffer + * + * PARAMETERS: PldInfo - _PLD buffer struct (Using local struct) + * + * RETURN: Encode _PLD buffer suitable for return value from _PLD + * + * DESCRIPTION: Bit-packs a _PLD buffer struct. Used to test the _PLD macros + * + ******************************************************************************/ + +static UINT8 * +AcpiDbEncodePldBuffer ( + ACPI_PLD_INFO *PldInfo) +{ + UINT32 *Buffer; + UINT32 Dword; + + + Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE); + if (!Buffer) + { + return (NULL); + } + + /* First 32 bits */ + + Dword = 0; + ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision); + ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor); + ACPI_PLD_SET_COLOR (&Dword, PldInfo->Color); + ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword); + + /* Second 32 bits */ + + Dword = 0; + ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width); + ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height); + ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword); + + /* Third 32 bits */ + + Dword = 0; + ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible); + ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock); + ACPI_PLD_SET_LID (&Dword, PldInfo->Lid); + ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel); + ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition); + ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition); + ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape); + ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation); + ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken); + ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition); + ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay); + ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword); + + /* Fourth 32 bits */ + + Dword = 0; + ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable); + ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired); + ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber); + ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber); + ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference); + ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation); + ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order); + ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword); + + if (PldInfo->Revision >= 2) + { + /* Fifth 32 bits */ + + Dword = 0; + ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset); + ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset); + ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword); + } + + return (ACPI_CAST_PTR (UINT8, Buffer)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDumpPldBuffer + * + * PARAMETERS: ObjDesc - Object returned from _PLD method + * + * RETURN: None. + * + * DESCRIPTION: Dumps formatted contents of a _PLD return buffer. + * + ******************************************************************************/ + +#define ACPI_PLD_OUTPUT "%20s : %-6X\n" + +static void +AcpiDbDumpPldBuffer ( + ACPI_OBJECT *ObjDesc) +{ + ACPI_OBJECT *BufferDesc; + ACPI_PLD_INFO *PldInfo; + UINT8 *NewBuffer; + ACPI_STATUS Status; + + + /* Object must be of type Package with at least one Buffer element */ + + if (ObjDesc->Type != ACPI_TYPE_PACKAGE) + { + return; + } + + BufferDesc = &ObjDesc->Package.Elements[0]; + if (BufferDesc->Type != ACPI_TYPE_BUFFER) + { + return; + } + + /* Convert _PLD buffer to local _PLD struct */ + + Status = AcpiDecodePldBuffer (BufferDesc->Buffer.Pointer, + BufferDesc->Buffer.Length, &PldInfo); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Encode local _PLD struct back to a _PLD buffer */ + + NewBuffer = AcpiDbEncodePldBuffer (PldInfo); + if (!NewBuffer) + { + return; + } + + /* The two bit-packed buffers should match */ + + if (ACPI_MEMCMP (NewBuffer, BufferDesc->Buffer.Pointer, + BufferDesc->Buffer.Length)) + { + AcpiOsPrintf ("Converted _PLD buffer does not compare. New:\n"); + + AcpiUtDumpBuffer2 (NewBuffer, + BufferDesc->Buffer.Length, DB_BYTE_DISPLAY); + } + + /* First 32-bit dword */ + + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Revision", PldInfo->Revision); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "IgnoreColor", PldInfo->IgnoreColor); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Color", PldInfo->Color); + + /* Second 32-bit dword */ + + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Width", PldInfo->Width); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Height", PldInfo->Height); + + /* Third 32-bit dword */ + + AcpiOsPrintf (ACPI_PLD_OUTPUT, "UserVisible", PldInfo->UserVisible); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Dock", PldInfo->Dock); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Lid", PldInfo->Lid); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Panel", PldInfo->Panel); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalPosition", PldInfo->VerticalPosition); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalPosition", PldInfo->HorizontalPosition); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Shape", PldInfo->Shape); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupOrientation", PldInfo->GroupOrientation); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupToken", PldInfo->GroupToken); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupPosition", PldInfo->GroupPosition); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Bay", PldInfo->Bay); + + /* Fourth 32-bit dword */ + + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Ejectable", PldInfo->Ejectable); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "OspmEjectRequired", PldInfo->OspmEjectRequired); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "CabinetNumber", PldInfo->CabinetNumber); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "CardCageNumber", PldInfo->CardCageNumber); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Reference", PldInfo->Reference); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Rotation", PldInfo->Rotation); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Order", PldInfo->Order); + + /* Fifth 32-bit dword */ + + if (BufferDesc->Buffer.Length > 16) + { + AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalOffset", PldInfo->VerticalOffset); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalOffset", PldInfo->HorizontalOffset); + } + + ACPI_FREE (PldInfo); + ACPI_FREE (NewBuffer); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbExecute * * PARAMETERS: Name - Name of method to execute @@ -782,6 +978,16 @@ AcpiDbExecute ( ReturnObj.Length = ACPI_ALLOCATE_BUFFER; AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); + + /* Get the NS node, determines existence also */ + + Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, + &AcpiGbl_DbMethodInfo.Method); + if (ACPI_FAILURE (Status)) + { + return; + } + Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj); ACPI_FREE (NameString); } @@ -823,6 +1029,14 @@ AcpiDbExecute ( AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); + + /* Dump a _PLD buffer if present */ + + if (ACPI_COMPARE_NAME ((ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, + AcpiGbl_DbMethodInfo.Method)->Name.Ascii), METHOD_NAME__PLD)) + { + AcpiDbDumpPldBuffer (ReturnObj.Pointer); + } } else { @@ -1067,6 +1281,17 @@ AcpiDbCreateExecutionThreads ( AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); + /* Get the NS node, determines existence also */ + + Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, + &AcpiGbl_DbMethodInfo.Method); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("%s Could not get handle for %s\n", + AcpiFormatException (Status), AcpiGbl_DbMethodInfo.Pathname); + goto CleanupAndExit; + } + /* Create the threads */ AcpiOsPrintf ("Creating %X threads to execute %X times each\n", @@ -1090,6 +1315,8 @@ AcpiDbCreateExecutionThreads ( AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); +CleanupAndExit: + /* Cleanup and exit */ (void) AcpiOsDeleteSemaphore (MainThreadGate); diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 9f49f92..d0a66ef 100644 --- a/source/components/disassembler/dmbuffer.c +++ b/source/components/disassembler/dmbuffer.c @@ -64,6 +64,12 @@ static void AcpiDmIsEisaIdElement ( ACPI_PARSE_OBJECT *Op); +static void +AcpiDmPldBuffer ( + UINT32 Level, + UINT8 *ByteData, + UINT32 ByteCount); + /******************************************************************************* * @@ -180,6 +186,12 @@ AcpiDmByteList ( AcpiDmUnicode (Op); break; + case ACPI_DASM_PLD_METHOD: + + AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount); + AcpiDmPldBuffer (Info->Level, ByteData, ByteCount); + break; + case ACPI_DASM_BUFFER: default: @@ -332,6 +344,161 @@ AcpiDmIsStringBuffer ( /******************************************************************************* * + * FUNCTION: AcpiDmIsPldBuffer + * + * 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 _PLD structure + * + ******************************************************************************/ + +BOOLEAN +AcpiDmIsPldBuffer ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *ParentOp; + + + ParentOp = Op->Common.Parent; + if (!ParentOp) + { + return (FALSE); + } + + /* Check for form: Name(_PLD, Buffer() {}). Not legal, however */ + + if (ParentOp->Common.AmlOpcode == AML_NAME_OP) + { + Node = ParentOp->Common.Node; + + if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD)) + { + return (TRUE); + } + + return (FALSE); + } + + /* Check for proper form: Name(_PLD, Package() {Buffer() {}}) */ + + if (ParentOp->Common.AmlOpcode == AML_PACKAGE_OP) + { + ParentOp = ParentOp->Common.Parent; + if (!ParentOp) + { + return (FALSE); + } + + if (ParentOp->Common.AmlOpcode == AML_NAME_OP) + { + Node = ParentOp->Common.Node; + + if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD)) + { + return (TRUE); + } + } + } + + return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmPldBuffer + * + * PARAMETERS: Level - Current source code indentation level + * ByteData - Pointer to the byte list + * ByteCount - Length of the byte list + * + * RETURN: None + * + * DESCRIPTION: Dump and format the contents of a _PLD buffer object + * + ******************************************************************************/ + +#define ACPI_PLD_OUTPUT "%*.s/* %18s : %-6.2X */\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT16 "%*.s/* %18s : %-6.4X */\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT24 "%*.s/* %18s : %-6.6X */\n", ACPI_MUL_4 (Level), " " + +static void +AcpiDmPldBuffer ( + UINT32 Level, + UINT8 *ByteData, + UINT32 ByteCount) +{ + ACPI_PLD_INFO *PldInfo; + ACPI_STATUS Status; + + + /* Check for valid byte count */ + + if (ByteCount < ACPI_PLD_REV1_BUFFER_SIZE) + { + return; + } + + /* Convert _PLD buffer to local _PLD struct */ + + Status = AcpiDecodePldBuffer (ByteData, ByteCount, &PldInfo); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* First 32-bit dword */ + + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Revision", PldInfo->Revision); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "IgnoreColor", PldInfo->IgnoreColor); + AcpiOsPrintf (ACPI_PLD_OUTPUT24,"Color", PldInfo->Color); + + /* Second 32-bit dword */ + + AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Width", PldInfo->Width); + AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Height", PldInfo->Height); + + /* Third 32-bit dword */ + + AcpiOsPrintf (ACPI_PLD_OUTPUT, "UserVisible", PldInfo->UserVisible); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Dock", PldInfo->Dock); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Lid", PldInfo->Lid); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Panel", PldInfo->Panel); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalPosition", PldInfo->VerticalPosition); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalPosition", PldInfo->HorizontalPosition); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Shape", PldInfo->Shape); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupOrientation", PldInfo->GroupOrientation); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupToken", PldInfo->GroupToken); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupPosition", PldInfo->GroupPosition); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Bay", PldInfo->Bay); + + /* Fourth 32-bit dword */ + + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Ejectable", PldInfo->Ejectable); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "OspmEjectRequired", PldInfo->OspmEjectRequired); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "CabinetNumber", PldInfo->CabinetNumber); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "CardCageNumber", PldInfo->CardCageNumber); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Reference", PldInfo->Reference); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Rotation", PldInfo->Rotation); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "Order", PldInfo->Order); + + /* Fifth 32-bit dword */ + + if (ByteCount >= ACPI_PLD_REV1_BUFFER_SIZE) + { + AcpiOsPrintf (ACPI_PLD_OUTPUT16,"VerticalOffset", PldInfo->VerticalOffset); + AcpiOsPrintf (ACPI_PLD_OUTPUT16,"HorizontalOffset", PldInfo->HorizontalOffset); + } + + ACPI_FREE (PldInfo); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmUnicode * * PARAMETERS: Op - Byte List op containing Unicode string diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index b52bdb2..2ce08a3 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -665,6 +665,11 @@ AcpiDmDisassembleOneOp ( Op->Common.DisasmOpcode = ACPI_DASM_STRING; AcpiOsPrintf ("Buffer"); } + else if (AcpiDmIsPldBuffer (Op)) + { + Op->Common.DisasmOpcode = ACPI_DASM_PLD_METHOD; + AcpiOsPrintf ("Buffer"); + } else { Op->Common.DisasmOpcode = ACPI_DASM_BUFFER; diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index d40f911..c243115 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -241,6 +241,20 @@ AcpiDsLoad1BeginOp ( WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; break; + case ACPI_TYPE_METHOD: + + /* + * Allow scope change to root during execution of module-level + * code. Root is typed METHOD during this time. + */ + if ((Node == AcpiGbl_RootNode) && + (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) + { + break; + } + + /*lint -fallthrough */ + default: /* All other types are an error */ diff --git a/source/components/dispatcher/dswload2.c b/source/components/dispatcher/dswload2.c index 27e3176..90d85d6 100644 --- a/source/components/dispatcher/dswload2.c +++ b/source/components/dispatcher/dswload2.c @@ -243,6 +243,20 @@ AcpiDsLoad2BeginOp ( WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; break; + case ACPI_TYPE_METHOD: + + /* + * Allow scope change to root during execution of module-level + * code. Root is typed METHOD during this time. + */ + if ((Node == AcpiGbl_RootNode) && + (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) + { + break; + } + + /*lint -fallthrough */ + default: /* All other types are an error */ diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c index 623795a..7c572b7 100644 --- a/source/components/events/evgpe.c +++ b/source/components/events/evgpe.c @@ -92,7 +92,7 @@ AcpiEvUpdateGpeEnableMask ( return_ACPI_STATUS (AE_NOT_EXIST); } - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); /* Clear the run bit up front */ @@ -431,6 +431,13 @@ AcpiEvGpeDetect ( if (!(GpeRegisterInfo->EnableForRun | GpeRegisterInfo->EnableForWake)) { + ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, + "Ignore disabled registers for GPE%02X-GPE%02X: " + "RunEnable=%02X, WakeEnable=%02X\n", + GpeRegisterInfo->BaseGpeNumber, + GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), + GpeRegisterInfo->EnableForRun, + GpeRegisterInfo->EnableForWake)); continue; } @@ -451,8 +458,13 @@ AcpiEvGpeDetect ( } ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Read GPE Register at GPE%02X: Status=%02X, Enable=%02X\n", - GpeRegisterInfo->BaseGpeNumber, StatusReg, EnableReg)); + "Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, " + "RunEnable=%02X, WakeEnable=%02X\n", + GpeRegisterInfo->BaseGpeNumber, + GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), + StatusReg, EnableReg, + GpeRegisterInfo->EnableForRun, + GpeRegisterInfo->EnableForWake)); /* Check if there is anything active at all in this register */ diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c index 4194651..1e83d1d 100644 --- a/source/components/events/evxfgpe.c +++ b/source/components/events/evxfgpe.c @@ -480,7 +480,7 @@ AcpiSetGpeWakeMask ( goto UnlockAndExit; } - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); /* Perform the action */ diff --git a/source/components/hardware/hwesleep.c b/source/components/hardware/hwesleep.c index 1587af0..353d5a9 100644 --- a/source/components/hardware/hwesleep.c +++ b/source/components/hardware/hwesleep.c @@ -99,7 +99,6 @@ AcpiHwExecuteSleepMethod ( * FUNCTION: AcpiHwExtendedSleep * * PARAMETERS: SleepState - Which sleep state to enter - * Flags - ACPI_EXECUTE_GTS to run optional method * * RETURN: Status * @@ -111,8 +110,7 @@ AcpiHwExecuteSleepMethod ( ACPI_STATUS AcpiHwExtendedSleep ( - UINT8 SleepState, - UINT8 Flags) + UINT8 SleepState) { ACPI_STATUS Status; UINT8 SleepTypeValue; @@ -140,13 +138,6 @@ AcpiHwExtendedSleep ( AcpiGbl_SystemAwakeAndRunning = FALSE; - /* Optionally execute _GTS (Going To Sleep) */ - - if (Flags & ACPI_EXECUTE_GTS) - { - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__GTS, SleepState); - } - /* Flush caches, as per ACPI specification */ ACPI_FLUSH_CPU_CACHE (); @@ -191,7 +182,6 @@ AcpiHwExtendedSleep ( * FUNCTION: AcpiHwExtendedWakePrep * * PARAMETERS: SleepState - Which sleep state we just exited - * Flags - ACPI_EXECUTE_BFS to run optional method * * RETURN: Status * @@ -202,8 +192,7 @@ AcpiHwExtendedSleep ( ACPI_STATUS AcpiHwExtendedWakePrep ( - UINT8 SleepState, - UINT8 Flags) + UINT8 SleepState) { ACPI_STATUS Status; UINT8 SleepTypeValue; @@ -223,12 +212,6 @@ AcpiHwExtendedWakePrep ( &AcpiGbl_FADT.SleepControl); } - /* Optionally execute _BFS (Back From Sleep) */ - - if (Flags & ACPI_EXECUTE_BFS) - { - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__BFS, SleepState); - } return_ACPI_STATUS (AE_OK); } @@ -238,7 +221,6 @@ AcpiHwExtendedWakePrep ( * FUNCTION: AcpiHwExtendedWake * * PARAMETERS: SleepState - Which sleep state we just exited - * Flags - Reserved, set to zero * * RETURN: Status * @@ -249,8 +231,7 @@ AcpiHwExtendedWakePrep ( ACPI_STATUS AcpiHwExtendedWake ( - UINT8 SleepState, - UINT8 Flags) + UINT8 SleepState) { ACPI_FUNCTION_TRACE (HwExtendedWake); diff --git a/source/components/hardware/hwgpe.c b/source/components/hardware/hwgpe.c index c94f17b..11cb36e 100644 --- a/source/components/hardware/hwgpe.c +++ b/source/components/hardware/hwgpe.c @@ -65,7 +65,6 @@ AcpiHwEnableWakeupGpeBlock ( * 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 * @@ -76,12 +75,11 @@ AcpiHwEnableWakeupGpeBlock ( UINT32 AcpiHwGetGpeRegisterBit ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo) + ACPI_GPE_EVENT_INFO *GpeEventInfo) { return ((UINT32) 1 << - (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)); + (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber)); } @@ -130,7 +128,7 @@ AcpiHwLowSetGpe ( /* Set or clear just the bit that corresponds to this GPE */ - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); switch (Action) { case ACPI_GPE_CONDITIONAL_ENABLE: @@ -199,7 +197,7 @@ AcpiHwClearGpe ( * Write a one to the appropriate bit in the status register to * clear this GPE. */ - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); Status = AcpiHwWrite (RegisterBit, &GpeRegisterInfo->StatusAddress); @@ -247,7 +245,7 @@ AcpiHwGetGpeStatus ( /* Get the register bitmask for this GPE */ - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); /* GPE currently enabled? (enabled for runtime?) */ diff --git a/source/components/hardware/hwsleep.c b/source/components/hardware/hwsleep.c index 1957fbd..d381755 100644 --- a/source/components/hardware/hwsleep.c +++ b/source/components/hardware/hwsleep.c @@ -55,7 +55,6 @@ * FUNCTION: AcpiHwLegacySleep * * PARAMETERS: SleepState - Which sleep state to enter - * Flags - ACPI_EXECUTE_GTS to run optional method * * RETURN: Status * @@ -66,8 +65,7 @@ ACPI_STATUS AcpiHwLegacySleep ( - UINT8 SleepState, - UINT8 Flags) + UINT8 SleepState) { ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo; @@ -116,13 +114,6 @@ AcpiHwLegacySleep ( return_ACPI_STATUS (Status); } - /* Optionally execute _GTS (Going To Sleep) */ - - if (Flags & ACPI_EXECUTE_GTS) - { - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__GTS, SleepState); - } - /* Get current value of PM1A control */ Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, @@ -219,7 +210,6 @@ AcpiHwLegacySleep ( * FUNCTION: AcpiHwLegacyWakePrep * * PARAMETERS: SleepState - Which sleep state we just exited - * Flags - ACPI_EXECUTE_BFS to run optional method * * RETURN: Status * @@ -231,8 +221,7 @@ AcpiHwLegacySleep ( ACPI_STATUS AcpiHwLegacyWakePrep ( - UINT8 SleepState, - UINT8 Flags) + UINT8 SleepState) { ACPI_STATUS Status; ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; @@ -282,12 +271,6 @@ AcpiHwLegacyWakePrep ( } } - /* Optionally execute _BFS (Back From Sleep) */ - - if (Flags & ACPI_EXECUTE_BFS) - { - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__BFS, SleepState); - } return_ACPI_STATUS (Status); } @@ -297,7 +280,6 @@ AcpiHwLegacyWakePrep ( * FUNCTION: AcpiHwLegacyWake * * PARAMETERS: SleepState - Which sleep state we just exited - * Flags - Reserved, set to zero * * RETURN: Status * @@ -308,8 +290,7 @@ AcpiHwLegacyWakePrep ( ACPI_STATUS AcpiHwLegacyWake ( - UINT8 SleepState, - UINT8 Flags) + UINT8 SleepState) { ACPI_STATUS Status; diff --git a/source/components/hardware/hwxfsleep.c b/source/components/hardware/hwxfsleep.c index caa51a8..c753084 100644 --- a/source/components/hardware/hwxfsleep.c +++ b/source/components/hardware/hwxfsleep.c @@ -52,7 +52,6 @@ static ACPI_STATUS AcpiHwSleepDispatch ( UINT8 SleepState, - UINT8 Flags, UINT32 FunctionId); /* @@ -261,7 +260,6 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepStateS4bios) static ACPI_STATUS AcpiHwSleepDispatch ( UINT8 SleepState, - UINT8 Flags, UINT32 FunctionId) { ACPI_STATUS Status; @@ -277,13 +275,13 @@ AcpiHwSleepDispatch ( if (AcpiGbl_ReducedHardware || AcpiGbl_FADT.SleepControl.Address) { - Status = SleepFunctions->ExtendedFunction (SleepState, Flags); + Status = SleepFunctions->ExtendedFunction (SleepState); } else { /* Legacy sleep */ - Status = SleepFunctions->LegacyFunction (SleepState, Flags); + Status = SleepFunctions->LegacyFunction (SleepState); } return (Status); @@ -293,7 +291,7 @@ AcpiHwSleepDispatch ( * For the case where reduced-hardware-only code is being generated, * we know that only the extended sleep registers are available */ - Status = SleepFunctions->ExtendedFunction (SleepState, Flags); + Status = SleepFunctions->ExtendedFunction (SleepState); return (Status); #endif /* !ACPI_REDUCED_HARDWARE */ @@ -387,7 +385,6 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep) * FUNCTION: AcpiEnterSleepState * * PARAMETERS: SleepState - Which sleep state to enter - * Flags - ACPI_EXECUTE_GTS to run optional method * * RETURN: Status * @@ -398,8 +395,7 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep) ACPI_STATUS AcpiEnterSleepState ( - UINT8 SleepState, - UINT8 Flags) + UINT8 SleepState) { ACPI_STATUS Status; @@ -415,7 +411,7 @@ AcpiEnterSleepState ( return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } - Status = AcpiHwSleepDispatch (SleepState, Flags, ACPI_SLEEP_FUNCTION_ID); + Status = AcpiHwSleepDispatch (SleepState, ACPI_SLEEP_FUNCTION_ID); return_ACPI_STATUS (Status); } @@ -427,7 +423,6 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepState) * FUNCTION: AcpiLeaveSleepStatePrep * * PARAMETERS: SleepState - Which sleep state we are exiting - * Flags - ACPI_EXECUTE_BFS to run optional method * * RETURN: Status * @@ -440,8 +435,7 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepState) ACPI_STATUS AcpiLeaveSleepStatePrep ( - UINT8 SleepState, - UINT8 Flags) + UINT8 SleepState) { ACPI_STATUS Status; @@ -449,7 +443,7 @@ AcpiLeaveSleepStatePrep ( ACPI_FUNCTION_TRACE (AcpiLeaveSleepStatePrep); - Status = AcpiHwSleepDispatch (SleepState, Flags, ACPI_WAKE_PREP_FUNCTION_ID); + Status = AcpiHwSleepDispatch (SleepState, ACPI_WAKE_PREP_FUNCTION_ID); return_ACPI_STATUS (Status); } @@ -479,7 +473,7 @@ AcpiLeaveSleepState ( ACPI_FUNCTION_TRACE (AcpiLeaveSleepState); - Status = AcpiHwSleepDispatch (SleepState, 0, ACPI_WAKE_FUNCTION_ID); + Status = AcpiHwSleepDispatch (SleepState, ACPI_WAKE_FUNCTION_ID); return_ACPI_STATUS (Status); } diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c index 6b7c505..e0635dc 100644 --- a/source/components/namespace/nsdump.c +++ b/source/components/namespace/nsdump.c @@ -294,7 +294,7 @@ AcpiNsDumpOneObject ( { case ACPI_TYPE_PROCESSOR: - AcpiOsPrintf ("ID %X Len %.4X Addr %p\n", + AcpiOsPrintf ("ID %02X Len %02X Addr %p\n", ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, ACPI_CAST_PTR (void, ObjDesc->Processor.Address)); break; diff --git a/source/components/utilities/utosi.c b/source/components/utilities/utosi.c index dcce8a9..a1ff845 100644 --- a/source/components/utilities/utosi.c +++ b/source/components/utilities/utosi.c @@ -77,6 +77,7 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] = {"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 */ + {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ /* Feature Group Strings */ diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index 3e858c9..38f7195 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: utxface - External interfaces for "global" ACPI functions + * Module Name: utxface - External interfaces, miscellaneous utility functions * *****************************************************************************/ @@ -46,321 +46,12 @@ #include "acpi.h" #include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" #include "acdebug.h" -#include "actables.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utxface") -#ifndef ACPI_ASL_COMPILER -/******************************************************************************* - * - * FUNCTION: AcpiInitializeSubsystem - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initializes all global variables. This is the first function - * called, so any early initialization belongs here. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInitializeSubsystem ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem); - - - AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE; - ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ()); - - /* Initialize the OS-Dependent layer */ - - Status = AcpiOsInitialize (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization")); - return_ACPI_STATUS (Status); - } - - /* Initialize all globals used by the subsystem */ - - Status = AcpiUtInitGlobals (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals")); - return_ACPI_STATUS (Status); - } - - /* Create the default mutex objects */ - - Status = AcpiUtMutexInitialize (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation")); - return_ACPI_STATUS (Status); - } - - /* - * Initialize the namespace manager and - * the root of the namespace tree - */ - Status = AcpiNsRootInitialize (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization")); - 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 ()); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem) - - -/******************************************************************************* - * - * FUNCTION: AcpiEnableSubsystem - * - * PARAMETERS: Flags - Init/enable Options - * - * RETURN: Status - * - * DESCRIPTION: Completes the subsystem initialization including hardware. - * Puts system into ACPI mode if it isn't already. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnableSubsystem ( - UINT32 Flags) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (AcpiEnableSubsystem); - - -#if (!ACPI_REDUCED_HARDWARE) - - /* Enable ACPI mode */ - - if (!(Flags & ACPI_NO_ACPI_ENABLE)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); - - AcpiGbl_OriginalMode = AcpiHwGetMode(); - - Status = AcpiEnable (); - if (ACPI_FAILURE (Status)) - { - ACPI_WARNING ((AE_INFO, "AcpiEnable failed")); - return_ACPI_STATUS (Status); - } - } - - /* - * Obtain a permanent mapping for the FACS. This is required for the - * Global Lock and the Firmware Waking Vector - */ - Status = AcpiTbInitializeFacs (); - if (ACPI_FAILURE (Status)) - { - ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); - return_ACPI_STATUS (Status); - } - -#endif /* !ACPI_REDUCED_HARDWARE */ - - /* - * Install the default OpRegion handlers. These are installed unless - * other handlers have already been installed via the - * InstallAddressSpaceHandler interface. - */ - if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Installing default address space handlers\n")); - - Status = AcpiEvInstallRegionHandlers (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - -#if (!ACPI_REDUCED_HARDWARE) - /* - * Initialize ACPI Event handling (Fixed and General Purpose) - * - * Note1: We must have the hardware and events initialized before we can - * execute any control methods safely. Any control method can require - * ACPI hardware support, so the hardware must be fully initialized before - * any method execution! - * - * Note2: Fixed events are initialized and enabled here. GPEs are - * initialized, but cannot be enabled until after the hardware is - * completely initialized (SCI and GlobalLock activated) and the various - * initialization control methods are run (_REG, _STA, _INI) on the - * entire namespace. - */ - if (!(Flags & ACPI_NO_EVENT_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Initializing ACPI events\n")); - - Status = AcpiEvInitializeEvents (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * Install the SCI handler and Global Lock handler. This completes the - * hardware initialization. - */ - if (!(Flags & ACPI_NO_HANDLER_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Installing SCI/GL handlers\n")); - - Status = AcpiEvInstallXruptHandlers (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - -#endif /* !ACPI_REDUCED_HARDWARE */ - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem) - - -/******************************************************************************* - * - * FUNCTION: AcpiInitializeObjects - * - * PARAMETERS: Flags - Init/enable Options - * - * RETURN: Status - * - * DESCRIPTION: Completes namespace initialization by initializing device - * objects and executing AML code for Regions, buffers, etc. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInitializeObjects ( - UINT32 Flags) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (AcpiInitializeObjects); - - - /* - * Run all _REG methods - * - * Note: Any objects accessed by the _REG methods will be automatically - * initialized, even if they contain executable AML (see the call to - * AcpiNsInitializeObjects below). - */ - if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Executing _REG OpRegion methods\n")); - - Status = AcpiEvInitializeOpRegions (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * Execute any module-level code that was detected during the table load - * phase. Although illegal since ACPI 2.0, there are many machines that - * contain this type of code. Each block of detected executable AML code - * outside of any control method is wrapped with a temporary control - * method object and placed on a global list. The methods on this list - * are executed below. - */ - AcpiNsExecModuleCodeList (); - - /* - * Initialize the objects that remain uninitialized. This runs the - * executable AML that may be part of the declaration of these objects: - * OperationRegions, BufferFields, Buffers, and Packages. - */ - if (!(Flags & ACPI_NO_OBJECT_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Completing Initialization of ACPI Objects\n")); - - Status = AcpiNsInitializeObjects (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * Initialize all device objects in the namespace. This runs the device - * _STA and _INI methods. - */ - if (!(Flags & ACPI_NO_DEVICE_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Initializing ACPI Devices\n")); - - Status = AcpiNsInitializeDevices (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * Empty the caches (delete the cached objects) on the assumption that - * the table load filled them up more than they will be at runtime -- - * thus wasting non-paged memory. - */ - Status = AcpiPurgeCachedObjects (); - - AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK; - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInitializeObjects) - - -#endif - /******************************************************************************* * * FUNCTION: AcpiTerminate @@ -835,3 +526,98 @@ AcpiCheckAddressRange ( ACPI_EXPORT_SYMBOL (AcpiCheckAddressRange) #endif /* !ACPI_ASL_COMPILER */ + + +/******************************************************************************* + * + * FUNCTION: AcpiDecodePldBuffer + * + * PARAMETERS: InBuffer - Buffer returned by _PLD method + * Length - Length of the InBuffer + * ReturnBuffer - Where the decode buffer is returned + * + * RETURN: Status and the decoded _PLD buffer. User must deallocate + * the buffer via ACPI_FREE. + * + * DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into + * a local struct that is much more useful to an ACPI driver. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDecodePldBuffer ( + UINT8 *InBuffer, + ACPI_SIZE Length, + ACPI_PLD_INFO **ReturnBuffer) +{ + ACPI_PLD_INFO *PldInfo; + UINT32 *Buffer = ACPI_CAST_PTR (UINT32, InBuffer); + UINT32 Dword; + + + /* Parameter validation */ + + if (!InBuffer || !ReturnBuffer || (Length < 16)) + { + return (AE_BAD_PARAMETER); + } + + PldInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PLD_INFO)); + if (!PldInfo) + { + return (AE_NO_MEMORY); + } + + /* First 32-bit DWord */ + + ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]); + PldInfo->Revision = ACPI_PLD_GET_REVISION (&Dword); + PldInfo->IgnoreColor = ACPI_PLD_GET_IGNORE_COLOR (&Dword); + PldInfo->Color = ACPI_PLD_GET_COLOR (&Dword); + + /* Second 32-bit DWord */ + + ACPI_MOVE_32_TO_32 (&Dword, &Buffer[1]); + PldInfo->Width = ACPI_PLD_GET_WIDTH (&Dword); + PldInfo->Height = ACPI_PLD_GET_HEIGHT(&Dword); + + /* Third 32-bit DWord */ + + ACPI_MOVE_32_TO_32 (&Dword, &Buffer[2]); + PldInfo->UserVisible = ACPI_PLD_GET_USER_VISIBLE (&Dword); + PldInfo->Dock = ACPI_PLD_GET_DOCK (&Dword); + PldInfo->Lid = ACPI_PLD_GET_LID (&Dword); + PldInfo->Panel = ACPI_PLD_GET_PANEL (&Dword); + PldInfo->VerticalPosition = ACPI_PLD_GET_VERTICAL (&Dword); + PldInfo->HorizontalPosition = ACPI_PLD_GET_HORIZONTAL (&Dword); + PldInfo->Shape = ACPI_PLD_GET_SHAPE (&Dword); + PldInfo->GroupOrientation = ACPI_PLD_GET_ORIENTATION (&Dword); + PldInfo->GroupToken = ACPI_PLD_GET_TOKEN (&Dword); + PldInfo->GroupPosition = ACPI_PLD_GET_POSITION (&Dword); + PldInfo->Bay = ACPI_PLD_GET_BAY (&Dword); + + /* Fourth 32-bit DWord */ + + ACPI_MOVE_32_TO_32 (&Dword, &Buffer[3]); + PldInfo->Ejectable = ACPI_PLD_GET_EJECTABLE (&Dword); + PldInfo->OspmEjectRequired = ACPI_PLD_GET_OSPM_EJECT (&Dword); + PldInfo->CabinetNumber = ACPI_PLD_GET_CABINET (&Dword); + PldInfo->CardCageNumber = ACPI_PLD_GET_CARD_CAGE (&Dword); + PldInfo->Reference = ACPI_PLD_GET_REFERENCE (&Dword); + PldInfo->Rotation = ACPI_PLD_GET_ROTATION (&Dword); + PldInfo->Order = ACPI_PLD_GET_ORDER (&Dword); + + if (Length >= ACPI_PLD_BUFFER_SIZE) + { + /* Fifth 32-bit DWord (Revision 2 of _PLD) */ + + ACPI_MOVE_32_TO_32 (&Dword, &Buffer[4]); + PldInfo->VerticalOffset = ACPI_PLD_GET_VERT_OFFSET (&Dword); + PldInfo->HorizontalOffset = ACPI_PLD_GET_HORIZ_OFFSET (&Dword); + } + + *ReturnBuffer = PldInfo; + return (AE_OK); +} + +ACPI_EXPORT_SYMBOL (AcpiDecodePldBuffer) diff --git a/source/components/utilities/utxferror.c b/source/components/utilities/utxferror.c index 715c0f4..beeb7c7 100644 --- a/source/components/utilities/utxferror.c +++ b/source/components/utilities/utxferror.c @@ -87,8 +87,8 @@ extern FILE *AcpiGbl_OutputFile; #define ACPI_MSG_WARNING "ACPI Warning: " #define ACPI_MSG_INFO "ACPI: " -#define ACPI_MSG_BIOS_ERROR "ACPI Firmware Error: " -#define ACPI_MSG_BIOS_WARNING "ACPI Firmware Warning: " +#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Bug: Error: " +#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Bug: Warning: " /* * Common message suffix diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c new file mode 100644 index 0000000..733aa3b --- /dev/null +++ b/source/components/utilities/utxfinit.c @@ -0,0 +1,358 @@ +/****************************************************************************** + * + * Module Name: utxfinit - External interfaces for ACPICA initialization + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2012, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + + +#define __UTXFINIT_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acdebug.h" +#include "actables.h" + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utxfinit") + + +/******************************************************************************* + * + * FUNCTION: AcpiInitializeSubsystem + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Initializes all global variables. This is the first function + * called, so any early initialization belongs here. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInitializeSubsystem ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem); + + + AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE; + ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ()); + + /* Initialize the OS-Dependent layer */ + + Status = AcpiOsInitialize (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization")); + return_ACPI_STATUS (Status); + } + + /* Initialize all globals used by the subsystem */ + + Status = AcpiUtInitGlobals (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals")); + return_ACPI_STATUS (Status); + } + + /* Create the default mutex objects */ + + Status = AcpiUtMutexInitialize (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation")); + return_ACPI_STATUS (Status); + } + + /* + * Initialize the namespace manager and + * the root of the namespace tree + */ + Status = AcpiNsRootInitialize (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization")); + 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 ()); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem) + + +/******************************************************************************* + * + * FUNCTION: AcpiEnableSubsystem + * + * PARAMETERS: Flags - Init/enable Options + * + * RETURN: Status + * + * DESCRIPTION: Completes the subsystem initialization including hardware. + * Puts system into ACPI mode if it isn't already. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEnableSubsystem ( + UINT32 Flags) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (AcpiEnableSubsystem); + + +#if (!ACPI_REDUCED_HARDWARE) + + /* Enable ACPI mode */ + + if (!(Flags & ACPI_NO_ACPI_ENABLE)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); + + AcpiGbl_OriginalMode = AcpiHwGetMode(); + + Status = AcpiEnable (); + if (ACPI_FAILURE (Status)) + { + ACPI_WARNING ((AE_INFO, "AcpiEnable failed")); + return_ACPI_STATUS (Status); + } + } + + /* + * Obtain a permanent mapping for the FACS. This is required for the + * Global Lock and the Firmware Waking Vector + */ + Status = AcpiTbInitializeFacs (); + if (ACPI_FAILURE (Status)) + { + ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); + return_ACPI_STATUS (Status); + } + +#endif /* !ACPI_REDUCED_HARDWARE */ + + /* + * Install the default OpRegion handlers. These are installed unless + * other handlers have already been installed via the + * InstallAddressSpaceHandler interface. + */ + if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[Init] Installing default address space handlers\n")); + + Status = AcpiEvInstallRegionHandlers (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + +#if (!ACPI_REDUCED_HARDWARE) + /* + * Initialize ACPI Event handling (Fixed and General Purpose) + * + * Note1: We must have the hardware and events initialized before we can + * execute any control methods safely. Any control method can require + * ACPI hardware support, so the hardware must be fully initialized before + * any method execution! + * + * Note2: Fixed events are initialized and enabled here. GPEs are + * initialized, but cannot be enabled until after the hardware is + * completely initialized (SCI and GlobalLock activated) and the various + * initialization control methods are run (_REG, _STA, _INI) on the + * entire namespace. + */ + if (!(Flags & ACPI_NO_EVENT_INIT)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[Init] Initializing ACPI events\n")); + + Status = AcpiEvInitializeEvents (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + /* + * Install the SCI handler and Global Lock handler. This completes the + * hardware initialization. + */ + if (!(Flags & ACPI_NO_HANDLER_INIT)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[Init] Installing SCI/GL handlers\n")); + + Status = AcpiEvInstallXruptHandlers (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + +#endif /* !ACPI_REDUCED_HARDWARE */ + + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem) + + +/******************************************************************************* + * + * FUNCTION: AcpiInitializeObjects + * + * PARAMETERS: Flags - Init/enable Options + * + * RETURN: Status + * + * DESCRIPTION: Completes namespace initialization by initializing device + * objects and executing AML code for Regions, buffers, etc. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInitializeObjects ( + UINT32 Flags) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (AcpiInitializeObjects); + + + /* + * Run all _REG methods + * + * Note: Any objects accessed by the _REG methods will be automatically + * initialized, even if they contain executable AML (see the call to + * AcpiNsInitializeObjects below). + */ + if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[Init] Executing _REG OpRegion methods\n")); + + Status = AcpiEvInitializeOpRegions (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + /* + * Execute any module-level code that was detected during the table load + * phase. Although illegal since ACPI 2.0, there are many machines that + * contain this type of code. Each block of detected executable AML code + * outside of any control method is wrapped with a temporary control + * method object and placed on a global list. The methods on this list + * are executed below. + */ + AcpiNsExecModuleCodeList (); + + /* + * Initialize the objects that remain uninitialized. This runs the + * executable AML that may be part of the declaration of these objects: + * OperationRegions, BufferFields, Buffers, and Packages. + */ + if (!(Flags & ACPI_NO_OBJECT_INIT)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[Init] Completing Initialization of ACPI Objects\n")); + + Status = AcpiNsInitializeObjects (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + /* + * Initialize all device objects in the namespace. This runs the device + * _STA and _INI methods. + */ + if (!(Flags & ACPI_NO_DEVICE_INIT)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[Init] Initializing ACPI Devices\n")); + + Status = AcpiNsInitializeDevices (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + /* + * Empty the caches (delete the cached objects) on the assumption that + * the table load filled them up more than they will be at runtime -- + * thus wasting non-paged memory. + */ + Status = AcpiPurgeCachedObjects (); + + AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK; + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInitializeObjects) diff --git a/source/include/acbuffer.h b/source/include/acbuffer.h new file mode 100644 index 0000000..4b34ccd --- /dev/null +++ b/source/include/acbuffer.h @@ -0,0 +1,246 @@ +/****************************************************************************** + * + * Name: acbuffer.h - Support for buffers returned by ACPI predefined names + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2012, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef __ACBUFFER_H__ +#define __ACBUFFER_H__ + +/* + * Contains buffer structures for these predefined names: + * _FDE, _GRT, _GTM, _PLD, _SRT + */ + +/* + * Note: C bitfields are not used for this reason: + * + * "Bitfields are great and easy to read, but unfortunately the C language + * does not specify the layout of bitfields in memory, which means they are + * essentially useless for dealing with packed data in on-disk formats or + * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, + * this decision was a design error in C. Ritchie could have picked an order + * and stuck with it." Norman Ramsey. + * See http://stackoverflow.com/a/1053662/41661 + */ + + +/* _FDE return value */ + +typedef struct acpi_fde_info +{ + UINT32 Floppy0; + UINT32 Floppy1; + UINT32 Floppy2; + UINT32 Floppy3; + UINT32 Tape; + +} ACPI_FDE_INFO; + +/* + * _GRT return value + * _SRT input value + */ +typedef struct acpi_grt_info +{ + UINT16 Year; + UINT8 Month; + UINT8 Day; + UINT8 Hour; + UINT8 Minute; + UINT8 Second; + UINT8 Valid; + UINT16 Milliseconds; + UINT16 Timezone; + UINT8 Daylight; + UINT8 Reserved[3]; + +} ACPI_GRT_INFO; + +/* _GTM return value */ + +typedef struct acpi_gtm_info +{ + UINT32 PioSpeed0; + UINT32 DmaSpeed0; + UINT32 PioSpeed1; + UINT32 DmaSpeed1; + UINT32 Flags; + +} ACPI_GTM_INFO; + +/* + * Formatted _PLD return value. The minimum size is a package containing + * one buffer. + * Revision 1: Buffer is 16 bytes (128 bits) + * Revision 2: Buffer is 20 bytes (160 bits) + * + * Note: This structure is returned from the AcpiDecodePldBuffer + * interface. + */ +typedef struct acpi_pld_info +{ + UINT8 Revision; + UINT8 IgnoreColor; + UINT32 Color; + UINT16 Width; + UINT16 Height; + UINT8 UserVisible; + UINT8 Dock; + UINT8 Lid; + UINT8 Panel; + UINT8 VerticalPosition; + UINT8 HorizontalPosition; + UINT8 Shape; + UINT8 GroupOrientation; + UINT8 GroupToken; + UINT8 GroupPosition; + UINT8 Bay; + UINT8 Ejectable; + UINT8 OspmEjectRequired; + UINT8 CabinetNumber; + UINT8 CardCageNumber; + UINT8 Reference; + UINT8 Rotation; + UINT8 Order; + UINT8 Reserved; + UINT16 VerticalOffset; + UINT16 HorizontalOffset; + +} ACPI_PLD_INFO; + + +/* + * Macros to: + * 1) Convert a _PLD buffer to internal ACPI_PLD_INFO format - ACPI_PLD_GET* + * (Used by AcpiDecodePldBuffer) + * 2) Construct a _PLD buffer - ACPI_PLD_SET* + * (Intended for BIOS use only) + */ +#define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */ +#define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ + +/* First 32-bit dword, bits 0:32 */ + +#define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK) +#define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */ + +#define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ + +#define ACPI_PLD_GET_COLOR(dword) ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK) +#define ACPI_PLD_SET_COLOR(dword,value) ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value) /* Offset 8, Len 24 */ + +/* Second 32-bit dword, bits 33:63 */ + +#define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) +#define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */ + +#define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) +#define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */ + +/* Third 32-bit dword, bits 64:95 */ + +#define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */ + +#define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */ + +#define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */ + +#define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK) +#define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */ + +#define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK) +#define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */ + +#define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK) +#define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */ + +#define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK) +#define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */ + +#define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */ + +#define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */ + +#define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */ + +#define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */ + +/* Fourth 32-bit dword, bits 96:127 */ + +#define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */ + +#define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */ + +#define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */ + +#define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */ + +#define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */ + +#define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK) +#define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */ + +#define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK) +#define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */ + +/* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */ + +#define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) +#define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */ + +#define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) +#define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */ + + +#endif /* ACBUFFER_H */ diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index e5c5c11..bb66fbb 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -235,6 +235,13 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoBert[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoBgrt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Device[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Addr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Size[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Name[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[]; @@ -396,6 +403,14 @@ AcpiDmDumpCpep ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpCsrt ( + ACPI_TABLE_HEADER *Table); + +void +AcpiDmDumpDbg2 ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table); @@ -613,6 +628,10 @@ BOOLEAN AcpiDmIsStringBuffer ( ACPI_PARSE_OBJECT *Op); +BOOLEAN +AcpiDmIsPldBuffer ( + ACPI_PARSE_OBJECT *Op); + /* * dmextern diff --git a/source/include/achware.h b/source/include/achware.h index f607d17..6dc1191 100644 --- a/source/include/achware.h +++ b/source/include/achware.h @@ -114,18 +114,15 @@ AcpiHwClearAcpiStatus ( */ ACPI_STATUS AcpiHwLegacySleep ( - UINT8 SleepState, - UINT8 Flags); + UINT8 SleepState); ACPI_STATUS AcpiHwLegacyWakePrep ( - UINT8 SleepState, - UINT8 Flags); + UINT8 SleepState); ACPI_STATUS AcpiHwLegacyWake ( - UINT8 SleepState, - UINT8 Flags); + UINT8 SleepState); /* @@ -138,18 +135,15 @@ AcpiHwExecuteSleepMethod ( ACPI_STATUS AcpiHwExtendedSleep ( - UINT8 SleepState, - UINT8 Flags); + UINT8 SleepState); ACPI_STATUS AcpiHwExtendedWakePrep ( - UINT8 SleepState, - UINT8 Flags); + UINT8 SleepState); ACPI_STATUS AcpiHwExtendedWake ( - UINT8 SleepState, - UINT8 Flags); + UINT8 SleepState); /* @@ -173,8 +167,7 @@ AcpiHwWritePort ( */ UINT32 AcpiHwGetGpeRegisterBit ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo); + ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_STATUS AcpiHwLowSetGpe ( diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 0f79fa2..8a35147 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -857,15 +857,18 @@ typedef union acpi_parse_value char AmlOpName[16]) /* Op name (debug only) */ -#define ACPI_DASM_BUFFER 0x00 -#define ACPI_DASM_RESOURCE 0x01 -#define ACPI_DASM_STRING 0x02 -#define ACPI_DASM_UNICODE 0x03 -#define ACPI_DASM_EISAID 0x04 -#define ACPI_DASM_MATCHOP 0x05 -#define ACPI_DASM_LNOT_PREFIX 0x06 -#define ACPI_DASM_LNOT_SUFFIX 0x07 -#define ACPI_DASM_IGNORE 0x08 +/* Flags for DisasmFlags field above */ + +#define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */ +#define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */ +#define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */ +#define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */ +#define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */ +#define ACPI_DASM_EISAID 0x05 /* Integer is an EISAID */ +#define ACPI_DASM_MATCHOP 0x06 /* Parent opcode is a Match() operator */ +#define ACPI_DASM_LNOT_PREFIX 0x07 /* Start of a LNotEqual (etc.) pair of opcodes */ +#define ACPI_DASM_LNOT_SUFFIX 0x08 /* End of a LNotEqual (etc.) pair of opcodes */ +#define ACPI_DASM_IGNORE 0x09 /* Not used at this time */ /* * Generic operation (for example: If, While, Store) @@ -1105,6 +1108,7 @@ typedef struct acpi_bit_register_info #define ACPI_OSI_WIN_VISTA_SP1 0x09 #define ACPI_OSI_WIN_VISTA_SP2 0x0A #define ACPI_OSI_WIN_7 0x0B +#define ACPI_OSI_WIN_8 0x0C #define ACPI_ALWAYS_ILLEGAL 0x00 @@ -1237,6 +1241,7 @@ typedef struct acpi_external_file typedef struct acpi_db_method_info { + ACPI_HANDLE Method; ACPI_HANDLE MainThreadGate; ACPI_HANDLE ThreadCompleteGate; ACPI_HANDLE InfoGate; diff --git a/source/include/acmacros.h b/source/include/acmacros.h index 591bb6b..92cd7a2 100644 --- a/source/include/acmacros.h +++ b/source/include/acmacros.h @@ -268,10 +268,33 @@ /* Bitfields within ACPI registers */ -#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) ((Val << Pos) & Mask) -#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) +#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) \ + ((Val << Pos) & Mask) -#define ACPI_INSERT_BITS(Target, Mask, Source) Target = ((Target & (~(Mask))) | (Source & Mask)) +#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) \ + Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) + +#define ACPI_INSERT_BITS(Target, Mask, Source) \ + Target = ((Target & (~(Mask))) | (Source & Mask)) + +/* Generic bitfield macros and masks */ + +#define ACPI_GET_BITS(SourcePtr, Position, Mask) \ + ((*SourcePtr >> Position) & Mask) + +#define ACPI_SET_BITS(TargetPtr, Position, Mask, Value) \ + (*TargetPtr |= ((Value & Mask) << Position)) + +#define ACPI_1BIT_MASK 0x00000001 +#define ACPI_2BIT_MASK 0x00000003 +#define ACPI_3BIT_MASK 0x00000007 +#define ACPI_4BIT_MASK 0x0000000F +#define ACPI_5BIT_MASK 0x0000001F +#define ACPI_6BIT_MASK 0x0000003F +#define ACPI_7BIT_MASK 0x0000007F +#define ACPI_8BIT_MASK 0x000000FF +#define ACPI_16BIT_MASK 0x0000FFFF +#define ACPI_24BIT_MASK 0x00FFFFFF /* * An object of type ACPI_NAMESPACE_NODE can appear in some contexts diff --git a/source/include/acnames.h b/source/include/acnames.h index 4c5fab6..e56f3cd 100644 --- a/source/include/acnames.h +++ b/source/include/acnames.h @@ -62,11 +62,10 @@ #define METHOD_NAME__AEI "_AEI" #define METHOD_NAME__PRW "_PRW" #define METHOD_NAME__SRS "_SRS" +#define METHOD_NAME__PLD "_PLD" /* Method names - these methods must appear at the namespace root */ -#define METHOD_PATHNAME__BFS "\\_BFS" -#define METHOD_PATHNAME__GTS "\\_GTS" #define METHOD_PATHNAME__PTS "\\_PTS" #define METHOD_PATHNAME__SST "\\_SI._SST" #define METHOD_PATHNAME__WAK "\\_WAK" diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 9c5aa4f..cdec63a 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -48,11 +48,12 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20120711 +#define ACPI_CA_VERSION 0x20120816 #include "acconfig.h" #include "actypes.h" #include "actbl.h" +#include "acbuffer.h" /* * Globals that are publically available @@ -183,6 +184,11 @@ AcpiCheckAddressRange ( ACPI_SIZE Length, BOOLEAN Warn); +ACPI_STATUS +AcpiDecodePldBuffer ( + UINT8 *InBuffer, + ACPI_SIZE Length, + ACPI_PLD_INFO **ReturnBuffer); /* * ACPI Memory management @@ -686,8 +692,7 @@ AcpiEnterSleepStatePrep ( ACPI_STATUS AcpiEnterSleepState ( - UINT8 SleepState, - UINT8 Flags); + UINT8 SleepState); ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS @@ -696,8 +701,7 @@ AcpiEnterSleepStateS4bios ( ACPI_STATUS AcpiLeaveSleepStatePrep ( - UINT8 SleepState, - UINT8 Flags); + UINT8 SleepState); ACPI_STATUS AcpiLeaveSleepState ( diff --git a/source/include/actbl.h b/source/include/actbl.h index 7da7378..4389d30 100644 --- a/source/include/actbl.h +++ b/source/include/actbl.h @@ -82,9 +82,15 @@ #pragma pack(1) /* - * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. + * Note: C bitfields are not used for this reason: + * + * "Bitfields are great and easy to read, but unfortunately the C language + * does not specify the layout of bitfields in memory, which means they are + * essentially useless for dealing with packed data in on-disk formats or + * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, + * this decision was a design error in C. Ritchie could have picked an order + * and stuck with it." Norman Ramsey. + * See http://stackoverflow.com/a/1053662/41661 */ @@ -99,7 +105,7 @@ typedef struct acpi_table_header { char Signature[ACPI_NAME_SIZE]; /* ASCII table signature */ UINT32 Length; /* Length of table in bytes, including this header */ - UINT8 Revision; /* ACPI Specification minor version # */ + UINT8 Revision; /* ACPI Specification minor version number */ UINT8 Checksum; /* To make sum of entire table == 0 */ char OemId[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */ char OemTableId[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */ @@ -115,7 +121,7 @@ typedef struct acpi_table_header * GAS - Generic Address Structure (ACPI 2.0+) * * Note: Since this structure is used in the ACPI tables, it is byte aligned. - * If misaliged access is not supported by the hardware, accesses to the + * If misaligned access is not supported by the hardware, accesses to the * 64-bit Address field must be performed with care. * ******************************************************************************/ @@ -253,18 +259,18 @@ typedef struct acpi_table_fadt UINT8 PreferredProfile; /* Conveys preferred power management profile to OSPM. */ UINT16 SciInterrupt; /* System vector of SCI interrupt */ UINT32 SmiCommand; /* 32-bit Port address of SMI command port */ - UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */ - UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */ - UINT8 S4BiosRequest; /* Value to write to SMI CMD to enter S4BIOS state */ + UINT8 AcpiEnable; /* Value to write to SMI_CMD to enable ACPI */ + UINT8 AcpiDisable; /* Value to write to SMI_CMD to disable ACPI */ + UINT8 S4BiosRequest; /* Value to write to SMI_CMD to enter S4BIOS state */ UINT8 PstateControl; /* Processor performance state control*/ - UINT32 Pm1aEventBlock; /* 32-bit Port address of Power Mgt 1a Event Reg Blk */ - UINT32 Pm1bEventBlock; /* 32-bit Port address of Power Mgt 1b Event Reg Blk */ - UINT32 Pm1aControlBlock; /* 32-bit Port address of Power Mgt 1a Control Reg Blk */ - UINT32 Pm1bControlBlock; /* 32-bit Port address of Power Mgt 1b Control Reg Blk */ - UINT32 Pm2ControlBlock; /* 32-bit Port address of Power Mgt 2 Control Reg Blk */ - UINT32 PmTimerBlock; /* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */ - UINT32 Gpe0Block; /* 32-bit Port address of General Purpose Event 0 Reg Blk */ - UINT32 Gpe1Block; /* 32-bit Port address of General Purpose Event 1 Reg Blk */ + UINT32 Pm1aEventBlock; /* 32-bit port address of Power Mgt 1a Event Reg Blk */ + UINT32 Pm1bEventBlock; /* 32-bit port address of Power Mgt 1b Event Reg Blk */ + UINT32 Pm1aControlBlock; /* 32-bit port address of Power Mgt 1a Control Reg Blk */ + UINT32 Pm1bControlBlock; /* 32-bit port address of Power Mgt 1b Control Reg Blk */ + UINT32 Pm2ControlBlock; /* 32-bit port address of Power Mgt 2 Control Reg Blk */ + UINT32 PmTimerBlock; /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */ + UINT32 Gpe0Block; /* 32-bit port address of General Purpose Event 0 Reg Blk */ + UINT32 Gpe1Block; /* 32-bit port address of General Purpose Event 1 Reg Blk */ UINT8 Pm1EventLength; /* Byte Length of ports at Pm1xEventBlock */ UINT8 Pm1ControlLength; /* Byte Length of ports at Pm1xControlBlock */ UINT8 Pm2ControlLength; /* Byte Length of ports at Pm2ControlBlock */ @@ -272,12 +278,12 @@ typedef struct acpi_table_fadt UINT8 Gpe0BlockLength; /* Byte Length of ports at Gpe0Block */ UINT8 Gpe1BlockLength; /* Byte Length of ports at Gpe1Block */ UINT8 Gpe1Base; /* Offset in GPE number space where GPE1 events start */ - UINT8 CstControl; /* Support for the _CST object and C States change notification */ + UINT8 CstControl; /* Support for the _CST object and C-States change notification */ UINT16 C2Latency; /* Worst case HW latency to enter/exit C2 state */ UINT16 C3Latency; /* Worst case HW latency to enter/exit C3 state */ - UINT16 FlushSize; /* Processor's memory cache line width, in bytes */ + UINT16 FlushSize; /* Processor memory cache line width, in bytes */ UINT16 FlushStride; /* Number of flush strides that need to be read */ - UINT8 DutyOffset; /* Processor duty cycle index in processor's P_CNT reg */ + UINT8 DutyOffset; /* Processor duty cycle index in processor P_CNT reg */ UINT8 DutyWidth; /* Processor duty cycle value bit width in P_CNT register */ UINT8 DayAlarm; /* Index to day-of-month alarm in RTC CMOS RAM */ UINT8 MonthAlarm; /* Index to month-of-year alarm in RTC CMOS RAM */ @@ -298,13 +304,13 @@ typedef struct acpi_table_fadt ACPI_GENERIC_ADDRESS XPmTimerBlock; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ ACPI_GENERIC_ADDRESS XGpe0Block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ ACPI_GENERIC_ADDRESS XGpe1Block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ - ACPI_GENERIC_ADDRESS SleepControl; /* 64-bit Sleep Control register */ - ACPI_GENERIC_ADDRESS SleepStatus; /* 64-bit Sleep Status register */ + ACPI_GENERIC_ADDRESS SleepControl; /* 64-bit Sleep Control register (ACPI 5.0) */ + ACPI_GENERIC_ADDRESS SleepStatus; /* 64-bit Sleep Status register (ACPI 5.0) */ } ACPI_TABLE_FADT; -/* Masks for FADT Boot Architecture Flags (BootFlags) */ +/* Masks for FADT Boot Architecture Flags (BootFlags) [Vx]=Introduced in this FADT revision */ #define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ #define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ @@ -315,13 +321,13 @@ typedef struct acpi_table_fadt /* Masks for FADT flags */ -#define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */ -#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */ +#define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */ +#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] WBINVD flushes but does not invalidate caches */ #define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */ #define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */ #define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */ #define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */ -#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status not in fixed register space */ +#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status is not in fixed register space */ #define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */ #define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */ #define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */ @@ -339,9 +345,9 @@ typedef struct acpi_table_fadt #define ACPI_FADT_LOW_POWER_S0 (1<<21) /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */ -/* Values for PreferredProfile (Prefered Power Management Profiles) */ +/* Values for PreferredProfile (Preferred Power Management Profiles) */ -enum AcpiPreferedPmProfiles +enum AcpiPreferredPmProfiles { PM_UNSPECIFIED = 0, PM_DESKTOP = 1, @@ -384,7 +390,7 @@ typedef struct acpi_table_desc { ACPI_PHYSICAL_ADDRESS Address; ACPI_TABLE_HEADER *Pointer; - UINT32 Length; /* Length fixed at 32 bits */ + UINT32 Length; /* Length fixed at 32 bits (fixed in table header) */ ACPI_NAME_UNION Signature; ACPI_OWNER_ID OwnerId; UINT8 Flags; diff --git a/source/include/actbl1.h b/source/include/actbl1.h index c24178f..c95d0c9 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -82,9 +82,15 @@ #pragma pack(1) /* - * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. + * Note: C bitfields are not used for this reason: + * + * "Bitfields are great and easy to read, but unfortunately the C language + * does not specify the layout of bitfields in memory, which means they are + * essentially useless for dealing with packed data in on-disk formats or + * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, + * this decision was a design error in C. Ritchie could have picked an order + * and stuck with it." Norman Ramsey. + * See http://stackoverflow.com/a/1053662/41661 */ diff --git a/source/include/actbl2.h b/source/include/actbl2.h index 70c6a09..44f7de3 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -65,6 +65,8 @@ */ #define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ #define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ +#define ACPI_SIG_CSRT "CSRT" /* Core System Resource Table */ +#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table type 2 */ #define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ #define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ @@ -98,9 +100,15 @@ #pragma pack(1) /* - * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. + * Note: C bitfields are not used for this reason: + * + * "Bitfields are great and easy to read, but unfortunately the C language + * does not specify the layout of bitfields in memory, which means they are + * essentially useless for dealing with packed data in on-disk formats or + * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, + * this decision was a design error in C. Ritchie could have picked an order + * and stuck with it." Norman Ramsey. + * See http://stackoverflow.com/a/1053662/41661 */ @@ -264,6 +272,128 @@ typedef struct acpi_table_boot /******************************************************************************* * + * CSRT - Core System Resource Table + * Version 0 + * + * Conforms to the "Core System Resource Table (CSRT)", November 14, 2011 + * + ******************************************************************************/ + +typedef struct acpi_table_csrt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_CSRT; + +/* Resource Group subtable */ + +typedef struct acpi_csrt_group +{ + UINT32 Length; + UINT32 VendorId; + UINT32 SubvendorId; + UINT16 DeviceId; + UINT16 SubdeviceId; + UINT16 Revision; + UINT16 Reserved; + UINT32 InfoLength; + + /* Shared data (length = InfoLength) immediately follows */ + +} ACPI_CSRT_GROUP; + +/* Resource Descriptor subtable */ + +typedef struct acpi_csrt_descriptor +{ + UINT32 Length; + UINT16 Type; + UINT16 Subtype; + UINT32 Uid; + + /* Resource-specific information immediately follows */ + +} ACPI_CSRT_DESCRIPTOR; + + +/* Resource Types */ + +#define ACPI_CSRT_TYPE_INTERRUPT 0x0001 +#define ACPI_CSRT_TYPE_TIMER 0x0002 +#define ACPI_CSRT_TYPE_DMA 0x0003 + +/* Resource Subtypes */ + +#define ACPI_CSRT_XRUPT_LINE 0x0000 +#define ACPI_CSRT_XRUPT_CONTROLLER 0x0001 +#define ACPI_CSRT_TIMER 0x0000 +#define ACPI_CSRT_DMA_CHANNEL 0x0000 +#define ACPI_CSRT_DMA_CONTROLLER 0x0001 + + +/******************************************************************************* + * + * DBG2 - Debug Port Table 2 + * Version 0 (Both main table and subtables) + * + * Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012. + * + ******************************************************************************/ + +typedef struct acpi_table_dbg2 +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 InfoOffset; + UINT32 InfoCount; + +} ACPI_TABLE_DBG2; + + +/* Debug Device Information Subtable */ + +typedef struct acpi_dbg2_device +{ + UINT8 Revision; + UINT16 Length; + UINT8 RegisterCount; /* Number of BaseAddress registers */ + UINT16 NamepathLength; + UINT16 NamepathOffset; + UINT16 OemDataLength; + UINT16 OemDataOffset; + UINT16 PortType; + UINT16 PortSubtype; + UINT16 Reserved; + UINT16 BaseAddressOffset; + UINT16 AddressSizeOffset; + /* + * Data that follows: + * BaseAddress (required) - Each in 12-byte Generic Address Structure format. + * AddressSize (required) - Array of UINT32 sizes corresponding to each BaseAddress register. + * Namepath (required) - Null terminated string. Single dot if not supported. + * OemData (optional) - Length is OemDataLength. + */ +} ACPI_DBG2_DEVICE; + +/* Types for PortType field above */ + +#define ACPI_DBG2_SERIAL_PORT 0x8000 +#define ACPI_DBG2_1394_PORT 0x8001 +#define ACPI_DBG2_USB_PORT 0x8002 +#define ACPI_DBG2_NET_PORT 0x8003 + +/* Subtypes for PortSubtype field above */ + +#define ACPI_DBG2_16550_COMPATIBLE 0x0000 +#define ACPI_DBG2_16550_SUBSET 0x0001 + +#define ACPI_DBG2_1394_STANDARD 0x0000 + +#define ACPI_DBG2_USB_XHCI 0x0000 +#define ACPI_DBG2_USB_EHCI 0x0001 + + +/******************************************************************************* + * * DBGP - Debug Port table * Version 1 * diff --git a/source/include/actbl3.h b/source/include/actbl3.h index c5dd418..ce0b158 100644 --- a/source/include/actbl3.h +++ b/source/include/actbl3.h @@ -77,7 +77,6 @@ /* Reserved table signatures */ #define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */ -#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table 2 */ #define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */ #define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ #define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ @@ -89,9 +88,15 @@ #pragma pack(1) /* - * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. + * Note: C bitfields are not used for this reason: + * + * "Bitfields are great and easy to read, but unfortunately the C language + * does not specify the layout of bitfields in memory, which means they are + * essentially useless for dealing with packed data in on-disk formats or + * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, + * this decision was a design error in C. Ritchie could have picked an order + * and stuck with it." Norman Ramsey. + * See http://stackoverflow.com/a/1053662/41661 */ diff --git a/source/include/actypes.h b/source/include/actypes.h index 53ebc91..eef510a 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -520,13 +520,6 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_SLEEP_TYPE_INVALID 0xFF /* - * Sleep/Wake flags - */ -#define ACPI_NO_OPTIONAL_METHODS 0x00 /* Do not execute any optional methods */ -#define ACPI_EXECUTE_GTS 0x01 /* For enter sleep interface */ -#define ACPI_EXECUTE_BFS 0x02 /* For leave sleep prep interface */ - -/* * Standard notify values */ #define ACPI_NOTIFY_BUS_CHECK (UINT8) 0x00 @@ -809,8 +802,7 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; /* Sleep function dispatch */ typedef ACPI_STATUS (*ACPI_SLEEP_FUNCTION) ( - UINT8 SleepState, - UINT8 Flags); + UINT8 SleepState); typedef struct acpi_sleep_functions { diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index db27062..8dfc143 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -180,6 +180,9 @@ #elif defined(_AED_EFI) #include "acefi.h" +#elif defined(__HAIKU__) +#include "achaiku.h" + #else /* Unknown environment */ diff --git a/source/include/platform/achaiku.h b/source/include/platform/achaiku.h new file mode 100644 index 0000000..754723d --- /dev/null +++ b/source/include/platform/achaiku.h @@ -0,0 +1,105 @@ +/****************************************************************************** + * + * Name: achaiku.h - OS specific defines, etc. for Haiku (www.haiku-os.org) + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2012, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef __ACHAIKU_H__ +#define __ACHAIKU_H__ + +#include "acgcc.h" +#include <KernelExport.h> + +struct mutex; + + +/* Host-dependent types and defines for user- and kernel-space ACPICA */ + +#define ACPI_USE_SYSTEM_CLIBRARY +#define ACPI_USE_STANDARD_HEADERS + +#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX +#define ACPI_MUTEX struct mutex * + +#define ACPI_USE_NATIVE_DIVIDE + +// #define ACPI_THREAD_ID thread_id +#define ACPI_SEMAPHORE sem_id +#define ACPI_SPINLOCK spinlock * +#define ACPI_CPU_FLAGS cpu_status + +#define COMPILER_DEPENDENT_INT64 int64 +#define COMPILER_DEPENDENT_UINT64 uint64 + + +#ifdef B_HAIKU_64_BIT +#define ACPI_MACHINE_WIDTH 64 +#else +#define ACPI_MACHINE_WIDTH 32 +#endif + + +#ifdef _KERNEL_MODE +/* Host-dependent types and defines for in-kernel ACPICA */ + +/* ACPICA cache implementation is adequate. */ +#define ACPI_USE_LOCAL_CACHE + +#define ACPI_FLUSH_CPU_CACHE() __asm __volatile("wbinvd"); + +/* Based on FreeBSD's due to lack of documentation */ +extern int AcpiOsAcquireGlobalLock(uint32 *lock); +extern int AcpiOsReleaseGlobalLock(uint32 *lock); + +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) do { \ + (Acq) = AcpiOsAcquireGlobalLock(&((GLptr)->GlobalLock)); \ +} while (0) + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) do { \ + (Acq) = AcpiOsReleaseGlobalLock(&((GLptr)->GlobalLock)); \ +} while (0) + +#else /* _KERNEL_MODE */ +/* Host-dependent types and defines for user-space ACPICA */ + +#error "We only support kernel mode ACPI atm." + +#endif /* _KERNEL_MODE */ +#endif /* __ACHAIKU_H__ */ diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c index 4f9d1d0..9a92c14 100644 --- a/source/os_specific/service_layers/osunixxf.c +++ b/source/os_specific/service_layers/osunixxf.c @@ -353,7 +353,7 @@ AcpiOsGetLine ( UINT32 BufferLength, UINT32 *BytesRead) { - UINT8 Temp; + int Temp; UINT32 i; @@ -364,13 +364,17 @@ AcpiOsGetLine ( return (AE_BUFFER_OVERFLOW); } - scanf ("%1c", &Temp); + if ((Temp = getchar ()) == EOF) + { + return (AE_ERROR); + } + if (!Temp || Temp == '\n') { break; } - Buffer [i] = Temp; + Buffer [i] = (char) Temp; } /* Null terminate the buffer */ diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c index 91a37e0..68629a2 100644 --- a/source/os_specific/service_layers/oswinxf.c +++ b/source/os_specific/service_layers/oswinxf.c @@ -520,7 +520,7 @@ AcpiOsGetLine ( UINT32 BufferLength, UINT32 *BytesRead) { - char Temp; + int Temp; UINT32 i; @@ -531,13 +531,17 @@ AcpiOsGetLine ( return (AE_BUFFER_OVERFLOW); } - scanf ("%1c", &Temp); + if ((Temp = getchar ()) == EOF) + { + return (AE_ERROR); + } + if (!Temp || Temp == '\n') { break; } - Buffer [i] = Temp; + Buffer [i] = (char) Temp; } /* Null terminate the buffer */ diff --git a/source/tools/acpibin/Makefile b/source/tools/acpibin/Makefile deleted file mode 100644 index 7d95f61..0000000 --- a/source/tools/acpibin/Makefile +++ /dev/null @@ -1,130 +0,0 @@ -# -# acpibin - Binary ACPI table utility -# -# NOTE: This makefile is intended to be used within the native -# ACPICA source tree. -# - -# -# Configuration -# Notes: -# gcc should be version 4 or greater, otherwise some of the options -# used will not be recognized. -# Global optimization flags (such as -O2, -Os) are not used, since -# they cause issues on some compilers. -# The _GNU_SOURCE symbol is required for many hosts. -# -PROG = acpibin - -HOST = _LINUX -NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< - -ACPICA_SRC = ../../../source -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -ACPICA_CORE = $(ACPICA_SRC)/components -ACPICA_INCLUDE = $(ACPICA_SRC)/include -ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger -ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler -ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher -ACPICA_EVENTS = $(ACPICA_CORE)/events -ACPICA_EXECUTER = $(ACPICA_CORE)/executer -ACPICA_HARDWARE = $(ACPICA_CORE)/hardware -ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace -ACPICA_PARSER = $(ACPICA_CORE)/parser -ACPICA_RESOURCES = $(ACPICA_CORE)/resources -ACPICA_TABLES = $(ACPICA_CORE)/tables -ACPICA_UTILITIES = $(ACPICA_CORE)/utilities -ACPIBIN = $(ACPICA_TOOLS)/acpibin -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) - -ACPICA_HEADERS = \ - $(wildcard $(ACPICA_INCLUDE)/*.h) \ - $(wildcard $(ACPICA_INCLUDE)/platform/*.h) - -# -# Search paths for source files -# -vpath %.c \ - $(ACPIBIN) \ - $(ACPICA_UTILITIES) \ - $(ACPICA_COMMON) \ - $(ACPICA_OSL) - -HEADERS = \ - $(wildcard $(ACPIBIN)/*.h) - -OBJECTS = \ - abcompare.o \ - abmain.o \ - utalloc.o \ - utcache.o \ - utdebug.o \ - utdecode.o \ - utexcep.o \ - utglobal.o \ - utlock.o \ - utmath.o \ - utmisc.o \ - utmutex.o \ - utstate.o \ - utxferror.o \ - osunixxf.o \ - getopt.o - -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_BIN_APP \ - -I$(ACPICA_INCLUDE) - -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef - -# -# gcc 4+ flags -# -CWARNINGFLAGS += \ - -Waddress \ - -Waggregate-return \ - -Wchar-subscripts \ - -Wempty-body \ - -Wlogical-op \ - -Wmissing-declarations \ - -Wmissing-field-initializers \ - -Wmissing-parameter-type \ - -Wnested-externs \ - -Wold-style-declaration \ - -Wold-style-definition \ - -Wredundant-decls \ - -Wtype-limits - -# -# Rules -# -$(PROG) : $(OBJECTS) - $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) - -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) - $(COMPILE) - -clean : - rm -f $(PROG) $(PROG).exe $(OBJECTS) - -install : - $(INSTALLPROG) diff --git a/source/tools/acpiexec/Makefile b/source/tools/acpiexec/Makefile deleted file mode 100644 index 4d379f5..0000000 --- a/source/tools/acpiexec/Makefile +++ /dev/null @@ -1,288 +0,0 @@ -# -# acpiexec: ACPI execution simulator. Runs ACPICA code in user -# space. Loads ACPI tables, displays the namespace, and allows -# execution of control methods. -# -# NOTE: This makefile is intended to be used within the native -# ACPICA source tree. -# - -# -# Configuration -# Notes: -# gcc should be version 4 or greater, otherwise some of the options -# used will not be recognized. -# Global optimization flags (such as -O2, -Os) are not used, since -# they cause issues on some compilers. -# The _GNU_SOURCE symbol is required for many hosts. -# -PROG = acpiexec - -HOST = _LINUX -NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< -LDFLAGS += -lpthread -lrt - -ACPICA_SRC = ../../../source -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -ACPICA_CORE = $(ACPICA_SRC)/components -ACPICA_INCLUDE = $(ACPICA_SRC)/include -ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger -ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler -ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher -ACPICA_EVENTS = $(ACPICA_CORE)/events -ACPICA_EXECUTER = $(ACPICA_CORE)/executer -ACPICA_HARDWARE = $(ACPICA_CORE)/hardware -ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace -ACPICA_PARSER = $(ACPICA_CORE)/parser -ACPICA_RESOURCES = $(ACPICA_CORE)/resources -ACPICA_TABLES = $(ACPICA_CORE)/tables -ACPICA_UTILITIES = $(ACPICA_CORE)/utilities -ACPIEXEC = $(ACPICA_TOOLS)/acpiexec -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) - -ACPICA_HEADERS = \ - $(wildcard $(ACPICA_INCLUDE)/*.h) \ - $(wildcard $(ACPICA_INCLUDE)/platform/*.h) - -# -# Search paths for source files -# -vpath %.c \ - $(ACPIEXEC) \ - $(ACPICA_DEBUGGER) \ - $(ACPICA_DISASSEMBLER) \ - $(ACPICA_DISPATCHER) \ - $(ACPICA_EVENTS) \ - $(ACPICA_EXECUTER) \ - $(ACPICA_HARDWARE) \ - $(ACPICA_NAMESPACE) \ - $(ACPICA_PARSER) \ - $(ACPICA_RESOURCES) \ - $(ACPICA_TABLES) \ - $(ACPICA_UTILITIES) \ - $(ACPICA_COMMON) \ - $(ACPICA_OSL) - -HEADERS = \ - $(wildcard $(ACPIEXEC)/*.h) - -OBJECTS = \ - aeexec.o \ - aehandlers.o \ - aemain.o \ - aetables.o \ - dbcmds.o \ - dbdisply.o \ - dbexec.o \ - dbfileio.o \ - dbhistry.o \ - dbinput.o \ - dbmethod.o \ - dbnames.o \ - dbstats.o \ - dbutils.o \ - dbxface.o \ - dmbuffer.o \ - dmnames.o \ - dmobject.o \ - dmopcode.o \ - dmresrc.o \ - dmresrcl.o \ - dmresrcl2.o \ - dmresrcs.o \ - dmutils.o \ - dmwalk.o \ - dsargs.o \ - dscontrol.o \ - dsfield.o \ - dsinit.o \ - dsmethod.o \ - dsmthdat.o \ - dsobject.o \ - dsopcode.o \ - dsutils.o \ - dswexec.o \ - dswload.o \ - dswload2.o \ - dswscope.o \ - dswstate.o \ - evevent.o \ - evglock.o \ - evgpe.o \ - evgpeblk.o \ - evgpeinit.o \ - evgpeutil.o \ - evmisc.o \ - evregion.o \ - evrgnini.o \ - evsci.o \ - evxface.o \ - evxfevnt.o \ - evxfgpe.o \ - evxfregn.o \ - exconfig.o \ - exconvrt.o \ - excreate.o \ - exdebug.o \ - exdump.o \ - exfield.o \ - exfldio.o \ - exmisc.o \ - exmutex.o \ - exnames.o \ - exoparg1.o \ - exoparg2.o \ - exoparg3.o \ - exoparg6.o \ - exprep.o \ - exregion.o \ - exresnte.o \ - exresolv.o \ - exresop.o \ - exstore.o \ - exstoren.o \ - exstorob.o \ - exsystem.o \ - exutils.o \ - getopt.o \ - hwacpi.o \ - hwesleep.o \ - hwgpe.o \ - hwpci.o \ - hwregs.o \ - hwsleep.o \ - hwvalid.o \ - hwxface.o \ - hwxfsleep.o \ - nsaccess.o \ - nsalloc.o \ - nsdump.o \ - nsdumpdv.o \ - nseval.o \ - nsinit.o \ - nsload.o \ - nsnames.o \ - nsobject.o \ - nsparse.o \ - nspredef.o \ - nsrepair.o \ - nsrepair2.o \ - nssearch.o \ - nsutils.o \ - nswalk.o \ - nsxfeval.o \ - nsxfname.o \ - nsxfobj.o \ - osunixxf.o \ - psargs.o \ - psloop.o \ - psopcode.o \ - psparse.o \ - psscope.o \ - pstree.o \ - psutils.o \ - pswalk.o \ - psxface.o \ - rsaddr.o \ - rscalc.o \ - rscreate.o \ - rsdump.o \ - rsinfo.o \ - rsio.o \ - rsirq.o \ - rslist.o \ - rsmemory.o \ - rsserial.o \ - rsmisc.o \ - rsutils.o \ - rsxface.o \ - tbfadt.o \ - tbfind.o \ - tbinstal.o \ - tbutils.o \ - tbxface.o \ - tbxfload.o \ - tbxfroot.o \ - utaddress.o \ - utalloc.o \ - utcache.o \ - utcopy.o \ - utdebug.o \ - utdecode.o \ - utdelete.o \ - uteval.o \ - utexcep.o \ - utglobal.o \ - utids.o \ - utinit.o \ - utlock.o \ - utmath.o \ - utmisc.o \ - utmutex.o \ - utobject.o \ - utresrc.o \ - utstate.o \ - uttrack.o \ - utosi.o \ - utxferror.o \ - utxface.o \ - utxfmutex.o - -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_EXEC_APP \ - -I$(ACPICA_INCLUDE) - -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef - -# -# gcc 4+ flags -# -CWARNINGFLAGS += \ - -Waddress \ - -Waggregate-return \ - -Wchar-subscripts \ - -Wempty-body \ - -Wlogical-op \ - -Wmissing-declarations \ - -Wmissing-field-initializers \ - -Wmissing-parameter-type \ - -Wnested-externs \ - -Wold-style-declaration \ - -Wold-style-definition \ - -Wredundant-decls \ - -Wtype-limits - -# -# Rules -# -$(PROG) : $(OBJECTS) - $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) - $(COPYPROG) - -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) - $(COMPILE) - -clean : - rm -f $(PROG) $(PROG).exe $(OBJECTS) - -install : - $(INSTALLPROG) diff --git a/source/tools/acpihelp/Makefile b/source/tools/acpihelp/Makefile deleted file mode 100644 index d0bcb3e..0000000 --- a/source/tools/acpihelp/Makefile +++ /dev/null @@ -1,123 +0,0 @@ -# -# acpihelp - ACPI Help utility. Displays ASL operator syntax and -# information about ACPI predefined names. -# -# NOTE: This makefile is intended to be used within the native -# ACPICA source tree. -# - -# -# Configuration -# Notes: -# gcc should be version 4 or greater, otherwise some of the options -# used will not be recognized. -# Global optimization flags (such as -O2, -Os) are not used, since -# they cause issues on some compilers. -# The _GNU_SOURCE symbol is required for many hosts. -# -PROG = acpihelp - -HOST = _LINUX -NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< - -ACPICA_SRC = ../../../source -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -ACPICA_CORE = $(ACPICA_SRC)/components -ACPICA_INCLUDE = $(ACPICA_SRC)/include -ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger -ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler -ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher -ACPICA_EVENTS = $(ACPICA_CORE)/events -ACPICA_EXECUTER = $(ACPICA_CORE)/executer -ACPICA_HARDWARE = $(ACPICA_CORE)/hardware -ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace -ACPICA_PARSER = $(ACPICA_CORE)/parser -ACPICA_RESOURCES = $(ACPICA_CORE)/resources -ACPICA_TABLES = $(ACPICA_CORE)/tables -ACPICA_UTILITIES = $(ACPICA_CORE)/utilities -ACPIHELP = $(ACPICA_TOOLS)/acpihelp -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) - -ACPICA_HEADERS = \ - $(wildcard $(ACPICA_INCLUDE)/*.h) \ - $(wildcard $(ACPICA_INCLUDE)/platform/*.h) - -# -# Search paths for source files -# -vpath %.c \ - $(ACPIHELP) \ - $(ACPICA_COMMON) \ - $(ACPICA_UTILITIES) - -HEADERS = \ - $(wildcard $(ACPIHELP)/*.h) - -OBJECTS = \ - ahamlops.o \ - ahaslkey.o \ - ahaslops.o \ - ahdecode.o \ - ahpredef.o \ - ahmain.o \ - getopt.o \ - utexcep.o - -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_HELP_APP \ - -I$(ACPICA_INCLUDE) - -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef - -# -# gcc 4+ flags -# -CWARNINGFLAGS += \ - -Waddress \ - -Waggregate-return \ - -Wchar-subscripts \ - -Wempty-body \ - -Wlogical-op \ - -Wmissing-declarations \ - -Wmissing-field-initializers \ - -Wmissing-parameter-type \ - -Wnested-externs \ - -Wold-style-declaration \ - -Wold-style-definition \ - -Wredundant-decls \ - -Wtype-limits - -# -# Rules -# -$(PROG) : $(OBJECTS) - $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) - $(COPYPROG) - -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) - $(COMPILE) - -clean : - rm -f $(PROG) $(PROG).exe $(OBJECTS) - -install : - $(INSTALLPROG) diff --git a/source/tools/acpinames/Makefile b/source/tools/acpinames/Makefile deleted file mode 100644 index 3a8c42d..0000000 --- a/source/tools/acpinames/Makefile +++ /dev/null @@ -1,191 +0,0 @@ -# -# acpinames - Load ACPI table and dump namespace. This is a subset -# of the AcpiExec functionality, it is intended to demonstrate -# the configurability of ACPICA. -# -# NOTE: This makefile is intended to be used in the Linux environment, -# with the Linux directory structure. It will not work directly -# on the native ACPICA source tree. -# - -# -# Configuration -# Notes: -# gcc should be version 4 or greater, otherwise some of the options -# used will not be recognized. -# Global optimization flags (such as -O2, -Os) are not used, since -# they cause issues on some compilers. -# The _GNU_SOURCE symbol is required for many hosts. -# -PROG = acpinames - -HOST = _LINUX -NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< - -ACPICA_SRC = ../../../source -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -ACPICA_CORE = $(ACPICA_SRC)/components -ACPICA_INCLUDE = $(ACPICA_SRC)/include -ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger -ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler -ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher -ACPICA_EVENTS = $(ACPICA_CORE)/events -ACPICA_EXECUTER = $(ACPICA_CORE)/executer -ACPICA_HARDWARE = $(ACPICA_CORE)/hardware -ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace -ACPICA_PARSER = $(ACPICA_CORE)/parser -ACPICA_RESOURCES = $(ACPICA_CORE)/resources -ACPICA_TABLES = $(ACPICA_CORE)/tables -ACPICA_UTILITIES = $(ACPICA_CORE)/utilities -ACPINAMES = $(ACPICA_TOOLS)/acpinames -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) - -ACPICA_HEADERS = \ - $(wildcard $(ACPICA_INCLUDE)/*.h) \ - $(wildcard $(ACPICA_INCLUDE)/platform/*.h) - -# -# Search paths for source files -# -vpath %.c \ - $(ACPINAMES) \ - $(ACPICA_DEBUGGER) \ - $(ACPICA_DISPATCHER) \ - $(ACPICA_EXECUTER) \ - $(ACPICA_NAMESPACE) \ - $(ACPICA_PARSER) \ - $(ACPICA_TABLES) \ - $(ACPICA_UTILITIES) \ - $(ACPICA_COMMON) \ - $(ACPICA_OSL) - -HEADERS = \ - $(wildcard $(ACPINAMES)/*.h) - -OBJECTS = \ - anmain.o \ - anstubs.o \ - antables.o \ - dbfileio.o \ - dsfield.o \ - dsmthdat.o \ - dsobject.o \ - dsutils.o \ - dswload.o \ - dswload2.o \ - dswscope.o \ - dswstate.o \ - excreate.o \ - exnames.o \ - exresnte.o \ - exresolv.o \ - exutils.o \ - getopt.o \ - nsaccess.o \ - nsalloc.o \ - nsdump.o \ - nsinit.o \ - nsload.o \ - nsnames.o \ - nsobject.o \ - nsparse.o \ - nssearch.o \ - nsutils.o \ - nswalk.o \ - nsxfeval.o \ - nsxfname.o \ - nsxfobj.o \ - osunixxf.o \ - psargs.o \ - psloop.o \ - psopcode.o \ - psparse.o \ - psscope.o \ - pstree.o \ - psutils.o \ - pswalk.o \ - psxface.o \ - tbfadt.o \ - tbfind.o \ - tbinstal.o \ - tbutils.o \ - tbxface.o \ - tbxfload.o \ - tbxfroot.o \ - utaddress.o \ - utalloc.o \ - utcache.o \ - utdebug.o \ - utdecode.o \ - utdelete.o \ - utexcep.o \ - utglobal.o \ - utlock.o \ - utmath.o \ - utmisc.o \ - utmutex.o \ - utobject.o \ - utstate.o \ - utosi.o \ - utxferror.o \ - utxface.o - -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_NAMES_APP \ - -I$(ACPICA_INCLUDE) \ - -I$(ACPINAMES) - -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef - -# -# gcc 4+ flags -# -CWARNINGFLAGS += \ - -Waddress \ - -Waggregate-return \ - -Wchar-subscripts \ - -Wempty-body \ - -Wlogical-op \ - -Wmissing-declarations \ - -Wmissing-field-initializers \ - -Wmissing-parameter-type \ - -Wnested-externs \ - -Wold-style-declaration \ - -Wold-style-definition \ - -Wredundant-decls \ - -Wtype-limits - -# -# Rules -# -$(PROG) : $(OBJECTS) - $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) - $(COPYPROG) - -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) - $(COMPILE) - -clean : - rm -f $(PROG) $(PROG).exe $(OBJECTS) - -install : - $(INSTALLPROG) diff --git a/source/tools/acpisrc/Makefile b/source/tools/acpisrc/Makefile deleted file mode 100644 index 58a8654..0000000 --- a/source/tools/acpisrc/Makefile +++ /dev/null @@ -1,124 +0,0 @@ -# -# acpisrc - ACPICA source code conversion utility -# -# NOTE: This makefile is intended to be used in the Linux environment, -# with the Linux directory structure. It will not work directly -# on the native ACPICA source tree. -# - -# -# Configuration -# Notes: -# gcc should be version 4 or greater, otherwise some of the options -# used will not be recognized. -# Global optimization flags (such as -O2, -Os) are not used, since -# they cause issues on some compilers. -# The _GNU_SOURCE symbol is required for many hosts. -# -PROG = acpisrc - -HOST = _LINUX -NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< - -ACPICA_SRC = ../../../source -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -ACPICA_CORE = $(ACPICA_SRC)/components -ACPICA_INCLUDE = $(ACPICA_SRC)/include -ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger -ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler -ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher -ACPICA_EVENTS = $(ACPICA_CORE)/events -ACPICA_EXECUTER = $(ACPICA_CORE)/executer -ACPICA_HARDWARE = $(ACPICA_CORE)/hardware -ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace -ACPICA_PARSER = $(ACPICA_CORE)/parser -ACPICA_RESOURCES = $(ACPICA_CORE)/resources -ACPICA_TABLES = $(ACPICA_CORE)/tables -ACPICA_UTILITIES = $(ACPICA_CORE)/utilities -ACPISRC = $(ACPICA_TOOLS)/acpisrc -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) - -ACPICA_HEADERS = \ - $(wildcard $(ACPICA_INCLUDE)/*.h) \ - $(wildcard $(ACPICA_INCLUDE)/platform/*.h) - -# -# Search path for source files and individual source files -# -vpath %.c \ - $(ACPISRC) \ - $(ACPICA_COMMON) \ - $(ACPICA_OSL) - -HEADERS = \ - $(wildcard $(ACPISRC)/*.h) - -OBJECTS = \ - ascase.o \ - asconvrt.o \ - asfile.o \ - asmain.o \ - asremove.o \ - astable.o \ - asutils.o \ - osunixdir.o \ - getopt.o - -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_SRC_APP \ - -I$(ACPISRC) \ - -I$(ACPICA_INCLUDE) - -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef - -# -# gcc 4+ flags -# -CWARNINGFLAGS += \ - -Waddress \ - -Waggregate-return \ - -Wchar-subscripts \ - -Wempty-body \ - -Wlogical-op \ - -Wmissing-declarations \ - -Wmissing-field-initializers \ - -Wmissing-parameter-type \ - -Wnested-externs \ - -Wold-style-declaration \ - -Wold-style-definition \ - -Wredundant-decls \ - -Wtype-limits - -# -# Rules -# -$(PROG) : $(OBJECTS) - $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) - -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) - $(COMPILE) - -clean : - rm -f $(PROG) $(PROG).exe $(OBJECTS) - -install : - $(INSTALLPROG) diff --git a/source/tools/acpisrc/asmain.c b/source/tools/acpisrc/asmain.c index b1f3402..e36855b 100644 --- a/source/tools/acpisrc/asmain.c +++ b/source/tools/acpisrc/asmain.c @@ -147,7 +147,7 @@ AsExaminePaths ( UINT32 *SourceFileType) { int Status; - char Response; + int Response; Status = stat (Source, &Gbl_StatBuf); @@ -177,11 +177,11 @@ AsExaminePaths ( if (!AsStricmp (Source, Target)) { printf ("Target path is the same as the source path, overwrite?\n"); - scanf ("%c", &Response); + Response = getchar (); /* Check response */ - if ((char) Response != 'y') + if (Response != 'y') { return -1; } @@ -194,11 +194,11 @@ AsExaminePaths ( if (!Status) { printf ("Target path already exists, overwrite?\n"); - scanf ("%c", &Response); + Response = getchar (); /* Check response */ - if ((char) Response != 'y') + if (Response != 'y') { return -1; } diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index b7defe7..1d782f4 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -411,6 +411,15 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_WALK_STATE", SRC_TYPE_STRUCT}, {"ACPI_WHEA_HEADER", SRC_TYPE_STRUCT}, + /* Buffers related to predefined ACPI names (_PLD, etc.) */ + + {"ACPI_FDE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GRT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GTM_INFO", SRC_TYPE_STRUCT}, + {"ACPI_PLD_INFO", SRC_TYPE_STRUCT}, + + /* Resources */ + {"ACPI_RS_LENGTH", SRC_TYPE_SIMPLE}, {"ACPI_RSDESC_SIZE", SRC_TYPE_SIMPLE}, @@ -474,6 +483,8 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_TABLE_BGRT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_BOOT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_CPEP", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_CSRT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_DBG2", SRC_TYPE_STRUCT}, {"ACPI_TABLE_DBGP", SRC_TYPE_STRUCT}, {"ACPI_TABLE_DMAR", SRC_TYPE_STRUCT}, {"ACPI_TABLE_DRTM", SRC_TYPE_STRUCT}, @@ -521,6 +532,9 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_ASF_RMCP", SRC_TYPE_STRUCT}, {"ACPI_BERT_REGION", SRC_TYPE_STRUCT}, {"ACPI_CPEP_POLLING", SRC_TYPE_STRUCT}, + {"ACPI_CSRT_GROUP", SRC_TYPE_STRUCT}, + {"ACPI_CSRT_DESCRIPTOR", SRC_TYPE_STRUCT}, + {"ACPI_DBG2_DEVICE", SRC_TYPE_STRUCT}, {"ACPI_DMAR_HEADER", SRC_TYPE_STRUCT}, {"ACPI_DMAR_DEVICE_SCOPE", SRC_TYPE_STRUCT}, {"ACPI_DMAR_ATSR", SRC_TYPE_STRUCT}, diff --git a/source/tools/acpixtract/Makefile b/source/tools/acpixtract/Makefile deleted file mode 100644 index d5db832..0000000 --- a/source/tools/acpixtract/Makefile +++ /dev/null @@ -1,116 +0,0 @@ -# -# acpixtract - extract binary ACPI tables from acpidump text output -# -# NOTE: This makefile is intended to be used within the native -# ACPICA source tree. -# - -# -# Configuration -# Notes: -# gcc should be version 4 or greater, otherwise some of the options -# used will not be recognized. -# Global optimization flags (such as -O2, -Os) are not used, since -# they cause issues on some compilers. -# The _GNU_SOURCE symbol is required for many hosts. -# -PROG = acpixtract - -HOST = _LINUX -NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< - -ACPICA_SRC = ../../../source -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -ACPICA_CORE = $(ACPICA_SRC)/components -ACPICA_INCLUDE = $(ACPICA_SRC)/include -ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger -ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler -ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher -ACPICA_EVENTS = $(ACPICA_CORE)/events -ACPICA_EXECUTER = $(ACPICA_CORE)/executer -ACPICA_HARDWARE = $(ACPICA_CORE)/hardware -ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace -ACPICA_PARSER = $(ACPICA_CORE)/parser -ACPICA_RESOURCES = $(ACPICA_CORE)/resources -ACPICA_TABLES = $(ACPICA_CORE)/tables -ACPICA_UTILITIES = $(ACPICA_CORE)/utilities -ACPIXTRACT = $(ACPICA_TOOLS)/acpixtract -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) - -ACPICA_HEADERS = \ - $(wildcard $(ACPICA_INCLUDE)/*.h) \ - $(wildcard $(ACPICA_INCLUDE)/platform/*.h) - -# -# Search paths for source files -# -vpath %.c \ - $(ACPIXTRACT) \ - $(ACPICA_COMMON) - -HEADERS = \ - $(wildcard $(ACPIXTRACT)/*.h) - -OBJECTS = \ - acpixtract.o \ - axmain.o \ - getopt.o - -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_XTRACT_APP \ - -I$(ACPICA_INCLUDE) - -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef - -# -# gcc 4+ flags -# -CWARNINGFLAGS += \ - -Waddress \ - -Waggregate-return \ - -Wchar-subscripts \ - -Wempty-body \ - -Wlogical-op \ - -Wmissing-declarations \ - -Wmissing-field-initializers \ - -Wmissing-parameter-type \ - -Wnested-externs \ - -Wold-style-declaration \ - -Wold-style-definition \ - -Wredundant-decls \ - -Wtype-limits - -# -# Rules -# -$(PROG) : $(OBJECTS) - $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) - $(COPYPROG) - -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) - $(COMPILE) - -clean : - rm -f $(PROG) $(PROG).exe $(OBJECTS) - -install : - $(INSTALLPROG) |