Message ID | 1437154282-23993-2-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 2015年07月18日 01:31, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Changes in this release of ACPICA are detailed at the following > link on the ACPICA developer mailing list: > > https://lists.acpica.org/pipermail/devel/2015-July/000788.html > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpica/Makefile.am | 3 + > src/acpica/fwts_acpica.c | 2 +- > src/acpica/source/common/adisasm.c | 7 +- > src/acpica/source/common/dmrestag.c | 10 +- > src/acpica/source/common/dmtable.c | 36 +- > src/acpica/source/common/dmtbdump.c | 162 +++++- > src/acpica/source/common/dmtbinfo.c | 45 +- > src/acpica/source/compiler/aslascii.c | 5 + > src/acpica/source/compiler/aslcompile.c | 4 + > src/acpica/source/compiler/asldefine.h | 7 +- > src/acpica/source/compiler/aslfiles.c | 40 +- > src/acpica/source/compiler/asllookup.c | 65 +++ > src/acpica/source/compiler/aslmessages.c | 6 +- > src/acpica/source/compiler/aslmessages.h | 3 + > src/acpica/source/compiler/aslmethod.c | 2 +- > src/acpica/source/compiler/aslnamesp.c | 2 +- > src/acpica/source/compiler/asloffset.c | 2 +- > src/acpica/source/compiler/aslopcodes.c | 46 +- > src/acpica/source/compiler/aslopt.c | 4 +- > src/acpica/source/compiler/aslstartup.c | 12 +- > src/acpica/source/compiler/aslstubs.c | 63 ++- > src/acpica/source/compiler/asltypes.h | 14 + > src/acpica/source/compiler/aslutils.c | 8 +- > src/acpica/source/compiler/aslxref.c | 481 +++++++++++------ > src/acpica/source/compiler/dtcompiler.h | 4 + > src/acpica/source/compiler/dttable.c | 71 +++ > src/acpica/source/compiler/dttemplate.h | 18 +- > src/acpica/source/compiler/prparser.l | 89 ++- > src/acpica/source/compiler/prparser.y | 5 +- > src/acpica/source/compiler/prscan.c | 92 +++- > src/acpica/source/components/debugger/dbcmds.c | 86 +++ > src/acpica/source/components/debugger/dbdisply.c | 11 +- > src/acpica/source/components/debugger/dbinput.c | 29 +- > src/acpica/source/components/debugger/dbmethod.c | 20 +- > src/acpica/source/components/debugger/dbnames.c | 6 +- > src/acpica/source/components/debugger/dbobject.c | 597 +++++++++++++++++++++ > src/acpica/source/components/debugger/dbutils.c | 3 +- > src/acpica/source/components/debugger/dbxface.c | 16 +- > .../source/components/disassembler/dmdeferred.c | 10 - > .../source/components/disassembler/dmnames.c | 2 +- > .../source/components/disassembler/dmopcode.c | 3 +- > src/acpica/source/components/disassembler/dmwalk.c | 22 +- > src/acpica/source/components/dispatcher/dsargs.c | 4 +- > src/acpica/source/components/dispatcher/dsdebug.c | 321 +++++++++++ > src/acpica/source/components/dispatcher/dsmethod.c | 34 +- > src/acpica/source/components/dispatcher/dswload.c | 2 +- > src/acpica/source/components/dispatcher/dswload2.c | 2 +- > src/acpica/source/components/executer/excreate.c | 1 + > src/acpica/source/components/executer/exdebug.c | 372 +++++++++++++ > src/acpica/source/components/executer/exdump.c | 3 +- > src/acpica/source/components/namespace/nsnames.c | 308 ++++++----- > src/acpica/source/components/namespace/nsparse.c | 44 +- > src/acpica/source/components/namespace/nsutils.c | 2 +- > src/acpica/source/components/namespace/nsxfname.c | 6 +- > src/acpica/source/components/parser/psargs.c | 23 +- > src/acpica/source/components/parser/psloop.c | 15 +- > src/acpica/source/components/parser/psobject.c | 16 +- > src/acpica/source/components/parser/psparse.c | 14 +- > src/acpica/source/components/parser/psutils.c | 9 +- > src/acpica/source/components/parser/psxface.c | 145 +---- > src/acpica/source/components/resources/rscreate.c | 3 +- > src/acpica/source/components/utilities/utdebug.c | 37 ++ > src/acpica/source/components/utilities/utdelete.c | 4 + > src/acpica/source/components/utilities/utinit.c | 2 - > src/acpica/source/components/utilities/utmisc.c | 2 +- > src/acpica/source/components/utilities/utnonansi.c | 525 ++++++++++++++++++ > src/acpica/source/components/utilities/utstring.c | 412 -------------- > src/acpica/source/include/acdebug.h | 32 ++ > src/acpica/source/include/acdisasm.h | 35 +- > src/acpica/source/include/acdispat.h | 10 + > src/acpica/source/include/acglobal.h | 3 +- > src/acpica/source/include/acinterp.h | 29 + > src/acpica/source/include/aclocal.h | 10 +- > src/acpica/source/include/acmacros.h | 10 + > src/acpica/source/include/acnamesp.h | 21 +- > src/acpica/source/include/acobject.h | 1 + > src/acpica/source/include/acoutput.h | 22 +- > src/acpica/source/include/acparser.h | 5 +- > src/acpica/source/include/acpiosxf.h | 9 + > src/acpica/source/include/acpixf.h | 16 +- > src/acpica/source/include/acstruct.h | 2 +- > src/acpica/source/include/actbl2.h | 20 +- > src/acpica/source/include/actypes.h | 14 +- > src/acpica/source/include/acutils.h | 55 +- > src/acpica/source/include/platform/acenvex.h | 3 + > 85 files changed, 3516 insertions(+), 1200 deletions(-) > create mode 100644 src/acpica/source/components/debugger/dbobject.c > create mode 100644 src/acpica/source/components/dispatcher/dsdebug.c > create mode 100644 src/acpica/source/components/utilities/utnonansi.c > > diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am > index 66bc1af..33d7444 100644 > --- a/src/acpica/Makefile.am > +++ b/src/acpica/Makefile.am > @@ -75,6 +75,7 @@ libfwtsacpica_la_SOURCES = \ > source/components/debugger/dbhistry.c \ > source/components/debugger/dbinput.c \ > source/components/debugger/dbstats.c \ > + source/components/debugger/dbobject.c \ > source/components/debugger/dbutils.c \ > source/components/debugger/dbxface.c \ > source/components/debugger/dbmethod.c \ > @@ -93,6 +94,7 @@ libfwtsacpica_la_SOURCES = \ > source/components/disassembler/dmwalk.c \ > source/components/disassembler/dmresrcl2.c \ > source/components/disassembler/dmdeferred.c \ > + source/components/dispatcher/dsdebug.c \ > source/components/dispatcher/dsfield.c \ > source/components/dispatcher/dsinit.c \ > source/components/dispatcher/dsmethod.c \ > @@ -226,6 +228,7 @@ libfwtsacpica_la_SOURCES = \ > source/components/utilities/utmath.c \ > source/components/utilities/utmisc.c \ > source/components/utilities/utmutex.c \ > + source/components/utilities/utnonansi.c \ > source/components/utilities/utobject.c \ > source/components/utilities/utresrc.c \ > source/components/utilities/utstate.c \ > diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c > index 9bfd0ae..3cf7676 100644 > --- a/src/acpica/fwts_acpica.c > +++ b/src/acpica/fwts_acpica.c > @@ -1168,7 +1168,7 @@ static ACPI_STATUS fwts_acpi_walk_for_object_names( > buffer.Pointer = tmpbuf; > buffer.Length = sizeof(tmpbuf); > > - if (!ACPI_FAILURE(AcpiNsHandleToPathname(objHandle, &buffer))) > + if (!ACPI_FAILURE(AcpiNsHandleToPathname(objHandle, &buffer, FALSE))) > fwts_list_append(list, strdup((char *)buffer.Pointer)); > > return AE_OK; > diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c > index d4f0fe6..b0d48d2 100644 > --- a/src/acpica/source/common/adisasm.c > +++ b/src/acpica/source/common/adisasm.c > @@ -259,6 +259,7 @@ AdInitialize ( > AcpiGbl_RootTableList.CurrentTableCount = 0; > AcpiGbl_RootTableList.Tables = LocalTables; > > + AcpiGbl_PreviousOp = NULL; > return (Status); > } > > @@ -868,8 +869,8 @@ AdStoreTable ( > > AcpiTbInitTableDescriptor (TableDesc, ACPI_PTR_TO_PHYSADDR (Table), > ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table); > - AcpiTbValidateTable (TableDesc); > - return (AE_OK); > + Status = AcpiTbValidateTable (TableDesc); > + return (Status); > } > > > @@ -964,7 +965,7 @@ AdParseTable ( > > /* Create the root object */ > > - AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (); > + AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart); > if (!AcpiGbl_ParseOpRoot) > { > return (AE_NO_MEMORY); > diff --git a/src/acpica/source/common/dmrestag.c b/src/acpica/source/common/dmrestag.c > index d91ede9..5041f88 100644 > --- a/src/acpica/source/common/dmrestag.c > +++ b/src/acpica/source/common/dmrestag.c > @@ -722,7 +722,7 @@ AcpiGetTagPathname ( > > /* Get the full pathname to the parent buffer */ > > - RequiredSize = AcpiNsGetPathnameLength (BufferNode); > + RequiredSize = AcpiNsBuildNormalizedPath (BufferNode, NULL, 0, FALSE); > if (!RequiredSize) > { > return (NULL); > @@ -734,12 +734,8 @@ AcpiGetTagPathname ( > return (NULL); > } > > - Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname); > - if (ACPI_FAILURE (Status)) > - { > - ACPI_FREE (Pathname); > - return (NULL); > - } > + (void) AcpiNsBuildNormalizedPath (BufferNode, Pathname, > + RequiredSize, FALSE); > > /* > * Create the full path to the resource and tag by: remove the buffer name, > diff --git a/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c > index e05e687..66dabde 100644 > --- a/src/acpica/source/common/dmtable.c > +++ b/src/acpica/source/common/dmtable.c > @@ -440,7 +440,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = > {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi}, > {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, > {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, > - {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa}, > + {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, > {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2}, > {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, > {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc}, > @@ -572,7 +572,11 @@ AcpiDmDumpDataTable ( > if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS)) > { > Length = Table->Length; > - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); > + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > } > else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature)) > { > @@ -633,7 +637,11 @@ AcpiDmDumpDataTable ( > { > /* Simple table, just walk the info table */ > > - AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo); > + Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > } > } > > @@ -792,6 +800,7 @@ AcpiDmDumpTable ( > const AH_TABLE *TableData; > const char *Name; > BOOLEAN LastOutputBlankLine = FALSE; > + ACPI_STATUS Status; > char RepairedName[8]; > > > @@ -1186,8 +1195,13 @@ AcpiDmDumpTable ( > /* Generic Address Structure */ > > AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure"); > - AcpiDmDumpTable (TableLength, CurrentOffset, Target, > + Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, > sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > AcpiOsPrintf ("\n"); > LastOutputBlankLine = TRUE; > break; > @@ -1322,8 +1336,13 @@ AcpiDmDumpTable ( > AcpiOsPrintf (STRING_FORMAT, > "Hardware Error Notification Structure"); > > - AcpiDmDumpTable (TableLength, CurrentOffset, Target, > + Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, > sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > AcpiOsPrintf ("\n"); > LastOutputBlankLine = TRUE; > break; > @@ -1347,8 +1366,13 @@ AcpiDmDumpTable ( > AcpiOsPrintf (STRING_FORMAT, > "IORT Memory Access Properties"); > > - AcpiDmDumpTable (TableLength, CurrentOffset, Target, > + Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, > sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > LastOutputBlankLine = TRUE; > break; > > diff --git a/src/acpica/source/common/dmtbdump.c b/src/acpica/source/common/dmtbdump.c > index 3b68637..f1b5512 100644 > --- a/src/acpica/source/common/dmtbdump.c > +++ b/src/acpica/source/common/dmtbdump.c > @@ -280,11 +280,16 @@ AcpiDmDumpRsdp ( > ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table); > UINT32 Length = sizeof (ACPI_RSDP_COMMON); > UINT8 Checksum; > + ACPI_STATUS Status; > > > /* Dump the common ACPI 1.0 portion */ > > - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1); > + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1); > + if (ACPI_FAILURE (Status)) > + { > + return (Length); > + } > > /* Validate the first checksum */ > > @@ -301,7 +306,11 @@ AcpiDmDumpRsdp ( > if (Rsdp->Revision > 0) > { > Length = Rsdp->Length; > - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2); > + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2); > + if (ACPI_FAILURE (Status)) > + { > + return (Length); > + } > > /* Validate the extended checksum over entire RSDP */ > > @@ -419,37 +428,59 @@ void > AcpiDmDumpFadt ( > ACPI_TABLE_HEADER *Table) > { > + ACPI_STATUS Status; > + > > /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */ > > - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1); > + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > > /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */ > > if ((Table->Length > ACPI_FADT_V1_SIZE) && > (Table->Length <= ACPI_FADT_V2_SIZE)) > { > - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); > + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > } > > /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */ > > else if (Table->Length > ACPI_FADT_V2_SIZE) > { > - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); > + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > > /* Check for FADT revision 5 fields and up (ACPI 5.0+) */ > > if (Table->Length > ACPI_FADT_V3_SIZE) > { > - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5); > + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > } > > /* Check for FADT revision 6 fields and up (ACPI 6.0+) */ > > if (Table->Length > ACPI_FADT_V3_SIZE) > { > - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6); > + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > } > } > > @@ -1208,7 +1239,7 @@ AcpiDmDumpDrtm ( > AcpiDmTableInfoDrtm1); > if (ACPI_FAILURE (Status)) > { > - return; > + return; > } > > Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources); > @@ -1236,13 +1267,9 @@ AcpiDmDumpDrtm ( > > DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset); > AcpiOsPrintf ("\n"); > - Status = AcpiDmDumpTable (Table->Length, Offset, > + (void) AcpiDmDumpTable (Table->Length, Offset, > DrtmDps, sizeof (ACPI_DRTM_DPS_ID), > AcpiDmTableInfoDrtm2); > - if (ACPI_FAILURE (Status)) > - { > - return; > - } > } > > > @@ -1866,6 +1893,10 @@ AcpiDmDumpIort ( > Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), > Length, AcpiDmTableInfoIort3a); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > > NodeOffset = IortSmmu->ContextInterruptOffset; > for (i = 0; i < IortSmmu->ContextInterruptCount; i++) > @@ -1873,6 +1904,10 @@ AcpiDmDumpIort ( > Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), > 8, AcpiDmTableInfoIort3b); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > NodeOffset += 8; > } > > @@ -1882,6 +1917,10 @@ AcpiDmDumpIort ( > Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), > 8, AcpiDmTableInfoIort3c); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > NodeOffset += 8; > } > } > @@ -1902,6 +1941,10 @@ AcpiDmDumpIort ( > Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), > Length, AcpiDmTableInfoIortMap); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > NodeOffset += Length; > } > > @@ -2076,6 +2119,10 @@ AcpiDmDumpIvrs ( > > Status = AcpiDmDumpTable (Table->Length, EntryOffset, > DeviceEntry, EntryLength, InfoTable); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > > EntryOffset += EntryLength; > DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, > @@ -2759,6 +2806,11 @@ AcpiDmDumpNfit ( > Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, > &Interleave->LineOffset[i], > sizeof (UINT32), AcpiDmTableInfoNfit2a); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > FieldOffset += sizeof (UINT32); > } > break; > @@ -2787,6 +2839,11 @@ AcpiDmDumpNfit ( > Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, > &Hint->HintAddress[i], > sizeof (UINT64), AcpiDmTableInfoNfit6a); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > FieldOffset += sizeof (UINT64); > } > break; > @@ -3198,7 +3255,7 @@ void > AcpiDmDumpSlic ( > ACPI_TABLE_HEADER *Table) > { > - AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table, > + (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table, > Table->Length - sizeof (*Table), AcpiDmTableInfoSlic); > } > > @@ -3430,6 +3487,77 @@ AcpiDmDumpStao ( > > /******************************************************************************* > * > + * FUNCTION: AcpiDmDumpTcpa > + * > + * PARAMETERS: Table - A TCPA table > + * > + * RETURN: None > + * > + * DESCRIPTION: Format the contents of a TCPA. > + * > + * NOTE: There are two versions of the table with the same signature: > + * the client version and the server version. The common > + * PlatformClass field is used to differentiate the two types of > + * tables. > + * > + ******************************************************************************/ > + > +void > +AcpiDmDumpTcpa ( > + ACPI_TABLE_HEADER *Table) > +{ > + UINT32 Offset = sizeof (ACPI_TABLE_TCPA_HDR); > + ACPI_TABLE_TCPA_HDR *CommonHeader = ACPI_CAST_PTR ( > + ACPI_TABLE_TCPA_HDR, Table); > + ACPI_TABLE_TCPA_HDR *SubTable = ACPI_ADD_PTR ( > + ACPI_TABLE_TCPA_HDR, Table, Offset); > + ACPI_STATUS Status; > + > + > + /* Main table */ > + > + Status = AcpiDmDumpTable (Table->Length, 0, Table, > + 0, AcpiDmTableInfoTcpaHdr); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + /* > + * Examine the PlatformClass field to determine the table type. > + * Either a client or server table. Only one. > + */ > + switch (CommonHeader->PlatformClass) > + { > + case ACPI_TCPA_CLIENT_TABLE: > + > + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, > + Table->Length - Offset, AcpiDmTableInfoTcpaClient); > + break; > + > + case ACPI_TCPA_SERVER_TABLE: > + > + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, > + Table->Length - Offset, AcpiDmTableInfoTcpaServer); > + break; > + > + default: > + > + AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n", > + CommonHeader->PlatformClass); > + Status = AE_ERROR; > + break; > + } > + > + if (ACPI_FAILURE (Status)) > + { > + AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n"); > + } > +} > + > + > +/******************************************************************************* > + * > * FUNCTION: AcpiDmDumpVrtc > * > * PARAMETERS: Table - A VRTC table > @@ -3569,10 +3697,6 @@ AcpiDmDumpWpbt ( > > /* Dump the arguments buffer */ > > - AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength, > + (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength, > AcpiDmTableInfoWpbt0); > - if (ACPI_FAILURE (Status)) > - { > - return; > - } > } > diff --git a/src/acpica/source/common/dmtbinfo.c b/src/acpica/source/common/dmtbinfo.c > index aab5d72..c10e089 100644 > --- a/src/acpica/source/common/dmtbinfo.c > +++ b/src/acpica/source/common/dmtbinfo.c > @@ -185,7 +185,7 @@ > #define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f) > #define ACPI_SRAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f) > #define ACPI_STAO_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_STAO,f) > -#define ACPI_TCPA_CLIENT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f) > +#define ACPI_TCPA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_HDR,f) > #define ACPI_TPM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM2,f) > #define ACPI_UEFI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f) > #define ACPI_WAET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WAET,f) > @@ -302,6 +302,8 @@ > #define ACPI_SRAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) > #define ACPI_SRAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f) > #define ACPI_SRAT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_GICC_AFFINITY,f) > +#define ACPI_TCPA_CLIENT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f) > +#define ACPI_TCPA_SERVER_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_SERVER,f) > #define ACPI_VRTC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VRTC_ENTRY,f) > #define ACPI_WDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f) > > @@ -2685,16 +2687,53 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[] = > * > * TCPA - Trusted Computing Platform Alliance table (Client) > * > + * NOTE: There are two versions of the table with the same signature -- > + * the client version and the server version. The common PlatformClass > + * field is used to differentiate the two types of tables. > + * > ******************************************************************************/ > > -ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] = > +ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaHdr[] = > +{ > + {ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (PlatformClass), "Platform Class", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaClient[] = > { > - {ACPI_DMT_UINT16, ACPI_TCPA_CLIENT_OFFSET (PlatformClass), "Platform Class", 0}, > {ACPI_DMT_UINT32, ACPI_TCPA_CLIENT_OFFSET (MinimumLogLength), "Min Event Log Length", 0}, > {ACPI_DMT_UINT64, ACPI_TCPA_CLIENT_OFFSET (LogAddress), "Event Log Address", 0}, > ACPI_DMT_TERMINATOR > }; > > +ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaServer[] = > +{ > + {ACPI_DMT_UINT16, ACPI_TCPA_SERVER_OFFSET (Reserved), "Reserved", 0}, > + {ACPI_DMT_UINT64, ACPI_TCPA_SERVER_OFFSET (MinimumLogLength), "Min Event Log Length", 0}, > + {ACPI_DMT_UINT64, ACPI_TCPA_SERVER_OFFSET (LogAddress), "Event Log Address", 0}, > + {ACPI_DMT_UINT16, ACPI_TCPA_SERVER_OFFSET (SpecRevision), "Specification Revision", 0}, > + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Device Flags (decoded below)", DT_FLAG}, > + {ACPI_DMT_FLAG0, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Pci Device", 0}, > + {ACPI_DMT_FLAG1, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Bus is Pnp", 0}, > + {ACPI_DMT_FLAG2, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Address Valid", 0}, > + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Interrupt Flags (decoded below)", DT_FLAG}, > + {ACPI_DMT_FLAG0, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Mode", 0}, > + {ACPI_DMT_FLAG1, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Polarity", 0}, > + {ACPI_DMT_FLAG2, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "GPE SCI Triggered", 0}, > + {ACPI_DMT_FLAG3, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Global System Interrupt", 0}, > + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (GpeNumber), "Gpe Number", 0}, > + {ACPI_DMT_UINT24, ACPI_TCPA_SERVER_OFFSET (Reserved2[0]), "Reserved", 0}, > + {ACPI_DMT_UINT32, ACPI_TCPA_SERVER_OFFSET (GlobalInterrupt), "Global Interrupt", 0}, > + {ACPI_DMT_GAS, ACPI_TCPA_SERVER_OFFSET (Address), "Address", 0}, > + {ACPI_DMT_UINT32, ACPI_TCPA_SERVER_OFFSET (Reserved3), "Reserved", 0}, > + {ACPI_DMT_GAS, ACPI_TCPA_SERVER_OFFSET (ConfigAddress), "Configuration Address", 0}, > + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Group), "Pci Group", 0}, > + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Bus), "Pci Bus", 0}, > + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Device), "Pci Device", 0}, > + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Function), "Pci Function", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > > /******************************************************************************* > * > diff --git a/src/acpica/source/compiler/aslascii.c b/src/acpica/source/compiler/aslascii.c > index 07f7af8..0037077 100644 > --- a/src/acpica/source/compiler/aslascii.c > +++ b/src/acpica/source/compiler/aslascii.c > @@ -249,6 +249,11 @@ FlCheckForAscii ( > /* Open file in text mode so file offset is always accurate */ > > Handle = fopen (Filename, "rb"); > + if (!Handle) > + { > + perror ("Could not open input file"); > + return (AE_ERROR); > + } > > Status.Line = 1; > Status.Offset = 0; > diff --git a/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c > index c172387..5a0379d 100644 > --- a/src/acpica/source/compiler/aslcompile.c > +++ b/src/acpica/source/compiler/aslcompile.c > @@ -172,6 +172,10 @@ CmDoCompile ( > Event = UtBeginEvent ("Preprocess input file"); > if (Gbl_PreprocessFlag) > { > + /* Enter compiler name as a #define */ > + > + PrAddDefine (ASL_DEFINE, "", FALSE); > + > /* Preprocessor */ > > PrDoPreprocess (); > diff --git a/src/acpica/source/compiler/asldefine.h b/src/acpica/source/compiler/asldefine.h > index 4b71af1..168a129 100644 > --- a/src/acpica/source/compiler/asldefine.h > +++ b/src/acpica/source/compiler/asldefine.h > @@ -124,6 +124,7 @@ > #define AML_DISASSEMBLER_NAME "AML/ASL+ Disassembler" > #define ASL_INVOCATION_NAME "iasl" > #define ASL_CREATOR_ID "INTL" > +#define ASL_DEFINE "__IASL__" > > #define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.0" > > @@ -227,12 +228,6 @@ > #define ACPI_COMPILER_RESERVED_NAME (ACPI_UINT32_MAX - 3) > > > -/* String to Integer conversion */ > - > -#define NEGATIVE 1 > -#define POSITIVE 0 > - > - > /* Helper macros for resource tag creation */ > > #define RsCreateMultiBitField \ > diff --git a/src/acpica/source/compiler/aslfiles.c b/src/acpica/source/compiler/aslfiles.c > index 8a99f76..234e9b4 100644 > --- a/src/acpica/source/compiler/aslfiles.c > +++ b/src/acpica/source/compiler/aslfiles.c > @@ -618,6 +618,26 @@ FlOpenMiscOutputFiles ( > char *Filename; > > > + /* Create/Open a map file if requested */ > + > + if (Gbl_MapfileFlag) > + { > + Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_MAP); > + if (!Filename) > + { > + AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, > + 0, 0, 0, 0, NULL, NULL); > + return (AE_ERROR); > + } > + > + /* Open the hex file, text mode (closed at compiler exit) */ > + > + FlOpenFile (ASL_FILE_MAP_OUTPUT, Filename, "w+t"); > + > + AslCompilerSignon (ASL_FILE_MAP_OUTPUT); > + AslCompilerFileHeader (ASL_FILE_MAP_OUTPUT); > + } > + > /* All done for disassembler */ > > if (Gbl_FileType == ASL_INPUT_TYPE_ACPI_TABLE) > @@ -884,26 +904,6 @@ FlOpenMiscOutputFiles ( > AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT); > } > > - /* Create/Open a map file if requested */ > - > - if (Gbl_MapfileFlag) > - { > - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_MAP); > - if (!Filename) > - { > - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, > - 0, 0, 0, 0, NULL, NULL); > - return (AE_ERROR); > - } > - > - /* Open the hex file, text mode (closed at compiler exit) */ > - > - FlOpenFile (ASL_FILE_MAP_OUTPUT, Filename, "w+t"); > - > - AslCompilerSignon (ASL_FILE_MAP_OUTPUT); > - AslCompilerFileHeader (ASL_FILE_MAP_OUTPUT); > - } > - > return (AE_OK); > } > > diff --git a/src/acpica/source/compiler/asllookup.c b/src/acpica/source/compiler/asllookup.c > index 4a7539a..35e628e 100644 > --- a/src/acpica/source/compiler/asllookup.c > +++ b/src/acpica/source/compiler/asllookup.c > @@ -191,8 +191,73 @@ LkIsObjectUsed ( > { > ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); > ACPI_NAMESPACE_NODE *Next; > + ASL_METHOD_LOCAL *MethodLocals; > + ASL_METHOD_LOCAL *MethodArgs; > + UINT32 i; > > > + if (Node->Type == ACPI_TYPE_METHOD) > + { > + if (!Node->Op || !Node->MethodLocals) > + { > + return (AE_OK); > + } > + > + MethodLocals = (ASL_METHOD_LOCAL *) Node->MethodLocals; > + MethodArgs = (ASL_METHOD_LOCAL *) Node->MethodArgs; > + > + /* > + * Analysis of LocalX variables > + */ > + for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) > + { > + /* Warn for Locals that are set but never referenced */ > + > + if ((MethodLocals[i].Flags & ASL_LOCAL_INITIALIZED) && > + (!(MethodLocals[i].Flags & ASL_LOCAL_REFERENCED))) > + { > + sprintf (MsgBuffer, "Local%u", i); > + AslError (ASL_WARNING, ASL_MSG_LOCAL_NOT_USED, > + MethodLocals[i].Op, MsgBuffer); > + } > + } > + > + /* > + * Analysis of ArgX variables (standard method arguments, > + * and remaining unused ArgX can also be used as locals) > + */ > + for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) > + { > + if (MethodArgs[i].Flags & ASL_ARG_IS_LOCAL) > + { > + /* Warn if ArgX is being used as a local, but not referenced */ > + > + if ((MethodArgs[i].Flags & ASL_ARG_INITIALIZED) && > + (!(MethodArgs[i].Flags & ASL_ARG_REFERENCED))) > + { > + sprintf (MsgBuffer, "Arg%u", i); > + AslError (ASL_WARNING, ASL_MSG_ARG_AS_LOCAL_NOT_USED, > + MethodArgs[i].Op, MsgBuffer); > + } > + } > + else > + { > + /* > + * Remark if a normal method ArgX is not referenced. > + * We ignore the predefined methods since often, not > + * all arguments are needed or used. > + */ > + if ((Node->Name.Ascii[0] != '_') && > + (!(MethodArgs[i].Flags & ASL_ARG_REFERENCED))) > + { > + sprintf (MsgBuffer, "Arg%u", i); > + AslError (ASL_REMARK, ASL_MSG_ARG_NOT_USED, > + MethodArgs[i].Op, MsgBuffer); > + } > + } > + } > + } > + > /* Referenced flag is set during the namespace xref */ > > if (Node->Flags & ANOBJ_IS_REFERENCED) > diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c > index 6e332f1..5373c2d 100644 > --- a/src/acpica/source/compiler/aslmessages.c > +++ b/src/acpica/source/compiler/aslmessages.c > @@ -307,7 +307,11 @@ const char *AslCompilerMsgs [] = > /* ASL_MSG_BUFFER_ALLOCATION */ "Could not allocate line buffer", > /* ASL_MSG_MISSING_DEPENDENCY */ "Missing dependency", > /* ASL_MSG_ILLEGAL_FORWARD_REF */ "Illegal forward reference within a method", > -/* ASL_MSG_ILLEGAL_METHOD_REF */ "Illegal reference across two methods" > +/* ASL_MSG_ILLEGAL_METHOD_REF */ "Illegal reference across two methods", > +/* ASL_MSG_LOCAL_NOT_USED */ "Method Local is set but never used", > +/* ASL_MSG_ARG_AS_LOCAL_NOT_USED */ "Method Argument (as a local) is set but never used", > +/* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used" > + > }; > > /* Table compiler */ > diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h > index 7501bbb..0e5469d 100644 > --- a/src/acpica/source/compiler/aslmessages.h > +++ b/src/acpica/source/compiler/aslmessages.h > @@ -310,6 +310,9 @@ typedef enum > ASL_MSG_MISSING_DEPENDENCY, > ASL_MSG_ILLEGAL_FORWARD_REF, > ASL_MSG_ILLEGAL_METHOD_REF, > + ASL_MSG_LOCAL_NOT_USED, > + ASL_MSG_ARG_AS_LOCAL_NOT_USED, > + ASL_MSG_ARG_NOT_USED, > > /* These messages are used by the Data Table compiler only */ > > diff --git a/src/acpica/source/compiler/aslmethod.c b/src/acpica/source/compiler/aslmethod.c > index c997c54..8ffb837 100644 > --- a/src/acpica/source/compiler/aslmethod.c > +++ b/src/acpica/source/compiler/aslmethod.c > @@ -327,7 +327,7 @@ MtMethodAnalysisWalkBegin ( > return (AE_ERROR); > } > > - RegisterNumber = (Op->Asl.AmlOpcode & 0x000F); > + RegisterNumber = (Op->Asl.AmlOpcode & 0x0007); > > /* > * If the local is being used as a target, mark the local > diff --git a/src/acpica/source/compiler/aslnamesp.c b/src/acpica/source/compiler/aslnamesp.c > index e6d2898..c5a6fbd 100644 > --- a/src/acpica/source/compiler/aslnamesp.c > +++ b/src/acpica/source/compiler/aslnamesp.c > @@ -481,7 +481,7 @@ NsDoOnePathname ( > > > TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > - Status = AcpiNsHandleToPathname (Node, &TargetPath); > + Status = AcpiNsHandleToPathname (Node, &TargetPath, FALSE); > if (ACPI_FAILURE (Status)) > { > return (Status); > diff --git a/src/acpica/source/compiler/asloffset.c b/src/acpica/source/compiler/asloffset.c > index 1dc432c..210a6f9 100644 > --- a/src/acpica/source/compiler/asloffset.c > +++ b/src/acpica/source/compiler/asloffset.c > @@ -435,7 +435,7 @@ LsEmitOffsetTableEntry ( > /* Get the full pathname to the namespace node */ > > TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > - Status = AcpiNsHandleToPathname (Node, &TargetPath); > + Status = AcpiNsHandleToPathname (Node, &TargetPath, FALSE); > if (ACPI_FAILURE (Status)) > { > return; > diff --git a/src/acpica/source/compiler/aslopcodes.c b/src/acpica/source/compiler/aslopcodes.c > index 809e5e7..4a00b74 100644 > --- a/src/acpica/source/compiler/aslopcodes.c > +++ b/src/acpica/source/compiler/aslopcodes.c > @@ -863,43 +863,6 @@ OpcEncodePldBuffer ( > > /******************************************************************************* > * > - * FUNCTION: OpcStrupr (strupr) > - * > - * PARAMETERS: SrcString - The source string to convert > - * > - * RETURN: None > - * > - * DESCRIPTION: Convert string to uppercase > - * > - * NOTE: This is not a POSIX function, so it appears here, not in utclib.c > - * > - ******************************************************************************/ > - > -static void > -OpcStrupr ( > - char *SrcString) > -{ > - char *String; > - > - > - if (!SrcString) > - { > - return; > - } > - > - /* Walk entire string, uppercasing the letters */ > - > - for (String = SrcString; *String; String++) > - { > - *String = (char) toupper ((int) *String); > - } > - > - return; > -} > - > - > -/******************************************************************************* > - * > * FUNCTION: OpcFindName > * > * PARAMETERS: List - Array of char strings to be searched > @@ -923,7 +886,7 @@ OpcFindName ( > UINT32 i; > > > - OpcStrupr (Name); > + AcpiUtStrupr (Name); > > for (i = 0, Str = List[0]; Str; i++, Str = List[i]) > { > @@ -972,13 +935,6 @@ OpcDoPld ( > return; > } > > - Buffer = UtLocalCalloc (ACPI_PLD_BUFFER_SIZE); > - if (!Buffer) > - { > - AslError(ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, Op, NULL); > - return; > - } > - > memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO)); > > Node = Op->Asl.Child; > diff --git a/src/acpica/source/compiler/aslopt.c b/src/acpica/source/compiler/aslopt.c > index 8aae62e..ae8cbb3 100644 > --- a/src/acpica/source/compiler/aslopt.c > +++ b/src/acpica/source/compiler/aslopt.c > @@ -727,7 +727,7 @@ OptOptimizeNamePath ( > * format -- something we can easily manipulate > */ > TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > - Status = AcpiNsHandleToPathname (TargetNode, &TargetPath); > + Status = AcpiNsHandleToPathname (TargetNode, &TargetPath, FALSE); > if (ACPI_FAILURE (Status)) > { > AslCoreSubsystemError (Op, Status, "Getting Target NamePath", > @@ -739,7 +739,7 @@ OptOptimizeNamePath ( > /* CurrentPath is the path to this scope (where we are in the namespace) */ > > CurrentPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > - Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath); > + Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath, FALSE); > if (ACPI_FAILURE (Status)) > { > AslCoreSubsystemError (Op, Status, "Getting Current NamePath", > diff --git a/src/acpica/source/compiler/aslstartup.c b/src/acpica/source/compiler/aslstartup.c > index 0f8c728..9fa4f80 100644 > --- a/src/acpica/source/compiler/aslstartup.c > +++ b/src/acpica/source/compiler/aslstartup.c > @@ -318,6 +318,11 @@ AslDoDisassembly ( > return (Status); > } > > + /* Handle additional output files for disassembler */ > + > + Gbl_FileType = ASL_INPUT_TYPE_ACPI_TABLE; > + Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); > + > /* This is where the disassembly happens */ > > AcpiGbl_DbOpt_Disasm = TRUE; > @@ -333,13 +338,6 @@ AslDoDisassembly ( > > AcpiDmUnresolvedWarning (0); > > -#if 0 > - /* TBD: Handle additional output files for disassembler */ > - > - Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); > - NsDisplayNamespace (); > -#endif > - > /* Shutdown compiler and ACPICA subsystem */ > > AeClearErrorLog (); > diff --git a/src/acpica/source/compiler/aslstubs.c b/src/acpica/source/compiler/aslstubs.c > index 533f7de..bdb94c1 100644 > --- a/src/acpica/source/compiler/aslstubs.c > +++ b/src/acpica/source/compiler/aslstubs.c > @@ -237,15 +237,6 @@ AcpiEvInitializeRegion ( > return (AE_OK); > } > > -void > -AcpiExDoDebugObject ( > - ACPI_OPERAND_OBJECT *SourceDesc, > - UINT32 Level, > - UINT32 Index) > -{ > - return; > -} > - > ACPI_STATUS > AcpiExReadDataFromField ( > ACPI_WALK_STATE *WalkState, > @@ -288,6 +279,60 @@ AcpiExLoadOp ( > return (AE_SUPPORT); > } > > +void > +AcpiExDoDebugObject ( > + ACPI_OPERAND_OBJECT *SourceDesc, > + UINT32 Level, > + UINT32 Index) > +{ > + return; > +} > + > +void > +AcpiExStartTraceMethod ( > + ACPI_NAMESPACE_NODE *MethodNode, > + ACPI_OPERAND_OBJECT *ObjDesc, > + ACPI_WALK_STATE *WalkState) > +{ > + return; > +} > + > +void > +AcpiExStopTraceMethod ( > + ACPI_NAMESPACE_NODE *MethodNode, > + ACPI_OPERAND_OBJECT *ObjDesc, > + ACPI_WALK_STATE *WalkState) > +{ > + return; > +} > + > +void > +AcpiExStartTraceOpcode ( > + ACPI_PARSE_OBJECT *Op, > + ACPI_WALK_STATE *WalkState) > +{ > + return; > +} > + > +void > +AcpiExStopTraceOpcode ( > + ACPI_PARSE_OBJECT *Op, > + ACPI_WALK_STATE *WalkState) > + > +{ > + return; > +} > + > +void > +AcpiExTracePoint ( > + ACPI_TRACE_EVENT_TYPE Type, > + BOOLEAN Begin, > + UINT8 *Aml, > + char *Pathname) > +{ > + return; > +} > + > ACPI_STATUS > AcpiTbFindTable ( > char *Signature, > diff --git a/src/acpica/source/compiler/asltypes.h b/src/acpica/source/compiler/asltypes.h > index 0f08ae4..a536e02 100644 > --- a/src/acpica/source/compiler/asltypes.h > +++ b/src/acpica/source/compiler/asltypes.h > @@ -374,5 +374,19 @@ typedef struct acpi_serial_info > > } ACPI_SERIAL_INFO; > > +typedef struct asl_method_local > +{ > + ACPI_PARSE_OBJECT *Op; > + UINT8 Flags; > + > +} ASL_METHOD_LOCAL; > + > +/* Values for Flags field above */ > + > +#define ASL_LOCAL_INITIALIZED (1) > +#define ASL_LOCAL_REFERENCED (1<<1) > +#define ASL_ARG_IS_LOCAL (1<<2) > +#define ASL_ARG_INITIALIZED (1<<3) > +#define ASL_ARG_REFERENCED (1<<4) > > #endif /* __ASLTYPES_H */ > diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c > index 32d120d..6c0e757 100644 > --- a/src/acpica/source/compiler/aslutils.c > +++ b/src/acpica/source/compiler/aslutils.c > @@ -1080,17 +1080,17 @@ stroul64 ( > */ > if (*String == '-') > { > - Sign = NEGATIVE; > + Sign = ACPI_SIGN_NEGATIVE; > ++String; > } > else if (*String == '+') > { > ++String; > - Sign = POSITIVE; > + Sign = ACPI_SIGN_POSITIVE; > } > else > { > - Sign = POSITIVE; > + Sign = ACPI_SIGN_POSITIVE; > } > > /* > @@ -1178,7 +1178,7 @@ stroul64 ( > > /* If a minus sign was present, then "the conversion is negated": */ > > - if (Sign == NEGATIVE) > + if (Sign == ACPI_SIGN_NEGATIVE) > { > ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; > } > diff --git a/src/acpica/source/compiler/aslxref.c b/src/acpica/source/compiler/aslxref.c > index ab68b88..200abf3 100644 > --- a/src/acpica/source/compiler/aslxref.c > +++ b/src/acpica/source/compiler/aslxref.c > @@ -138,6 +138,10 @@ XfNamespaceLocateEnd ( > UINT32 Level, > void *Context); > > +static ACPI_PARSE_OBJECT * > +XfGetParentMethod ( > + ACPI_PARSE_OBJECT *Op); > + > static BOOLEAN > XfObjectExists ( > char *Name); > @@ -352,59 +356,16 @@ XfCheckFieldRange ( > } > > > -#ifdef __UNDER_DEVELOPMENT > -/******************************************************************************* > - * > - * FUNCTION: XfIsObjectParental > - * > - * PARAMETERS: ChildOp - Op to be checked > - * PossibleParentOp - Determine if this op is in the family > - * > - * RETURN: TRUE if ChildOp is a descendent of PossibleParentOp > - * > - * DESCRIPTION: Determine if an Op is a descendent of another Op. Used to > - * detect if a method is declared within another method. > - * > - ******************************************************************************/ > - > -static BOOLEAN > -XfIsObjectParental ( > - ACPI_PARSE_OBJECT *ChildOp, > - ACPI_PARSE_OBJECT *PossibleParentOp) > -{ > - ACPI_PARSE_OBJECT *ParentOp; > - > - > - /* Search upwards through the tree for possible parent */ > - > - ParentOp = ChildOp; > - while (ParentOp) > - { > - if (ParentOp == PossibleParentOp) > - { > - return (TRUE); > - } > - > - ParentOp = ParentOp->Asl.Parent; > - } > - > - return (FALSE); > -} > - > - > /******************************************************************************* > * > * FUNCTION: XfGetParentMethod > * > - * PARAMETERS: Op - Op to be checked > - * > - * RETURN: Op for parent method. NULL if object is not within a method. > + * PARAMETERS: Op - Parse Op to be checked > * > - * DESCRIPTION: Determine if an object is within a control method. Used to > - * implement special rules for named references from within a > - * control method. > + * RETURN: Control method Op if found. NULL otherwise > * > - * NOTE: It would be better to have the parser set a flag in the Op if possible. > + * DESCRIPTION: Find the control method parent of a parse op. Returns NULL if > + * the input Op is not within a control method. > * > ******************************************************************************/ > > @@ -412,120 +373,22 @@ static ACPI_PARSE_OBJECT * > XfGetParentMethod ( > ACPI_PARSE_OBJECT *Op) > { > - ACPI_PARSE_OBJECT *ParentOp; > - > - > - if (!Op) > - { > - return (NULL); > - } > - > - if (Op->Asl.ParseOpcode == PARSEOP_METHOD) > - { > - return (NULL); > - } > - > - /* Walk upwards through the parse tree, up to the root if necessary */ > - > - ParentOp = Op; > - while (ParentOp) > - { > - if (ParentOp->Asl.ParseOpcode == PARSEOP_METHOD) > - { > - return (ParentOp); > - } > - > - ParentOp = ParentOp->Asl.Parent; > - } > - > - /* Object is not within a method */ > - > - return (NULL); > -} > - > - > -/******************************************************************************* > - * > - * FUNCTION: XfCheckIllegalReference > - * > - * PARAMETERS: Op - Op referring to the target > - * TargetNode - Target of the reference > - * > - * RETURN: None. Emits error message for an illegal reference > - * > - * DESCRIPTION: Determine if a named reference is legal. A "named" reference > - * is something like: Store(ABCD, ...), where ABCD is an AML > - * Nameseg or Namepath. > - * > - * NOTE: Caller must ensure that the name Op is in fact a reference, and not > - * an actual name declaration (creation of a named object). > - * > - ******************************************************************************/ > - > -static void > -XfCheckIllegalReference ( > - ACPI_PARSE_OBJECT *Op, > - ACPI_NAMESPACE_NODE *TargetNode) > -{ > - ACPI_PARSE_OBJECT *MethodOp1; > - ACPI_PARSE_OBJECT *MethodOp2; > - ACPI_PARSE_OBJECT *TargetOp; > - > - > - /* > - * Check for an illegal reference to a named object: > - * > - * 1) References from one control method to another, non-parent > - * method are not allowed, they will fail at runtime. > - * > - * 2) Forward references within a control method are not allowed. > - * AML interpreters use a one-pass parse of control methods > - * so these forward references will fail at runtime. > - */ > - TargetOp = TargetNode->Op; > - > - MethodOp1 = XfGetParentMethod (Op); > - MethodOp2 = XfGetParentMethod (TargetOp); > - > - /* Are both objects within control method(s)? */ > - > - if (!MethodOp1 || !MethodOp2) > - { > - return; > - } > + ACPI_PARSE_OBJECT *NextOp; > > - /* Objects not in the same method? */ > > - if (MethodOp1 != MethodOp2) > + NextOp = Op->Asl.Parent; > + while (NextOp) > { > - /* > - * 1) Cross-method named reference > - * > - * This is OK if and only if the target reference is within in a > - * method that is a parent of current method > - */ > - if (!XfIsObjectParental (MethodOp1, MethodOp2)) > + if (NextOp->Asl.AmlOpcode == AML_METHOD_OP) > { > - AslError (ASL_ERROR, ASL_MSG_ILLEGAL_METHOD_REF, Op, > - Op->Asl.ExternalName); > + return (NextOp); > } > - } > > - /* > - * 2) Both reference and target are in the same method. Check if this is > - * an (illegal) forward reference by examining the exact source code > - * location of each (the referenced object and the object declaration). > - * This is a bit nasty, yet effective. > - */ > - else if (Op->Asl.LogicalByteOffset < TargetOp->Asl.LogicalByteOffset) > - { > - AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op, > - Op->Asl.ExternalName); > + NextOp = NextOp->Asl.Parent; > } > > + return (NULL); /* No parent method found */ > } > -#endif > - > > /******************************************************************************* > * > @@ -568,10 +431,67 @@ XfNamespaceLocateBegin ( > UINT8 Message = 0; > const ACPI_OPCODE_INFO *OpInfo; > UINT32 Flags; > + ASL_METHOD_LOCAL *MethodLocals = NULL; > + ASL_METHOD_LOCAL *MethodArgs = NULL; > + int RegisterNumber; > + UINT32 i; > > > ACPI_FUNCTION_TRACE_PTR (XfNamespaceLocateBegin, Op); > > + > + if ((Op->Asl.AmlOpcode == AML_METHOD_OP) && Op->Asl.Node) > + { > + Node = Op->Asl.Node; > + > + /* Support for method LocalX/ArgX analysis */ > + > + if (!Node->MethodLocals) > + { > + /* Create local/arg info blocks */ > + > + MethodLocals = UtLocalCalloc ( > + sizeof (ASL_METHOD_LOCAL) * ACPI_METHOD_NUM_LOCALS); > + Node->MethodLocals = MethodLocals; > + > + MethodArgs = UtLocalCalloc ( > + sizeof (ASL_METHOD_LOCAL) * ACPI_METHOD_NUM_ARGS); > + Node->MethodArgs = MethodArgs; > + > + /* > + * Get the method argument count > + * First, get the name node > + */ > + NextOp = Op->Asl.Child; > + > + /* Get the NumArguments node */ > + > + NextOp = NextOp->Asl.Next; > + Node->ArgCount = (UINT8) > + (((UINT8) NextOp->Asl.Value.Integer) & 0x07); > + > + /* We will track all posible ArgXs */ > + > + for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) > + { > + if (i < Node->ArgCount) > + { > + /* Real Args are always "initialized" */ > + > + MethodArgs[i].Flags = ASL_ARG_INITIALIZED; > + } > + else > + { > + /* Other ArgXs can be used as locals */ > + > + MethodArgs[i].Flags = ASL_ARG_IS_LOCAL; > + } > + > + MethodArgs[i].Op = Op; > + } > + } > + } > + > /* > * If this node is the actual declaration of a name > * [such as the XXXX name in "Method (XXXX)"], > @@ -584,10 +504,88 @@ XfNamespaceLocateBegin ( > return_ACPI_STATUS (AE_OK); > } > > - /* We are only interested in opcodes that have an associated name */ > - > OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); > > + /* Check method LocalX variables */ > + > + if (OpInfo->Type == AML_TYPE_LOCAL_VARIABLE) > + { > + /* Find parent method Op */ > + > + NextOp = XfGetParentMethod (Op); > + if (!NextOp) > + { > + return_ACPI_STATUS (AE_OK); > + } > + > + /* Get method node */ > + > + Node = NextOp->Asl.Node; > + > + RegisterNumber = Op->Asl.AmlOpcode & 0x0007; /* 0x60 through 0x67 */ > + MethodLocals = Node->MethodLocals; > + > + if (Op->Asl.CompileFlags & NODE_IS_TARGET) > + { > + /* Local is being initialized */ > + > + MethodLocals[RegisterNumber].Flags |= ASL_LOCAL_INITIALIZED; > + MethodLocals[RegisterNumber].Op = Op; > + > + return_ACPI_STATUS (AE_OK); > + } > + > + /* Mark this Local as referenced */ > + > + MethodLocals[RegisterNumber].Flags |= ASL_LOCAL_REFERENCED; > + MethodLocals[RegisterNumber].Op = Op; > + > + return_ACPI_STATUS (AE_OK); > + } > + > + /* Check method ArgX variables */ > + > + if (OpInfo->Type == AML_TYPE_METHOD_ARGUMENT) > + { > + /* Find parent method Op */ > + > + NextOp = XfGetParentMethod (Op); > + if (!NextOp) > + { > + return_ACPI_STATUS (AE_OK); > + } > + > + /* Get method node */ > + > + Node = NextOp->Asl.Node; > + > + /* Get Arg # */ > + > + RegisterNumber = Op->Asl.AmlOpcode - AML_ARG0; /* 0x68 through 0x6F */ > + MethodArgs = Node->MethodArgs; > + > + if (Op->Asl.CompileFlags & NODE_IS_TARGET) > + { > + /* Arg is being initialized */ > + > + MethodArgs[RegisterNumber].Flags |= ASL_ARG_INITIALIZED; > + MethodArgs[RegisterNumber].Op = Op; > + > + return_ACPI_STATUS (AE_OK); > + } > + > + /* Mark this Arg as referenced */ > + > + MethodArgs[RegisterNumber].Flags |= ASL_ARG_REFERENCED; > + MethodArgs[RegisterNumber].Op = Op; > + > + return_ACPI_STATUS (AE_OK); > + } > + > + /* > + * After method ArgX and LocalX, we are only interested in opcodes > + * that have an associated name > + */ > if ((!(OpInfo->Flags & AML_NAMED)) && > (!(OpInfo->Flags & AML_CREATE)) && > (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && > @@ -1166,3 +1164,178 @@ XfNamespaceLocateEnd ( > > return_ACPI_STATUS (AE_OK); > } > + > + > +#ifdef __UNDER_DEVELOPMENT > +/******************************************************************************* > + * > + * FUNCTION: XfIsObjectParental > + * > + * PARAMETERS: ChildOp - Op to be checked > + * PossibleParentOp - Determine if this op is in the family > + * > + * RETURN: TRUE if ChildOp is a descendent of PossibleParentOp > + * > + * DESCRIPTION: Determine if an Op is a descendent of another Op. Used to > + * detect if a method is declared within another method. > + * > + ******************************************************************************/ > + > +static BOOLEAN > +XfIsObjectParental ( > + ACPI_PARSE_OBJECT *ChildOp, > + ACPI_PARSE_OBJECT *PossibleParentOp) > +{ > + ACPI_PARSE_OBJECT *ParentOp; > + > + > + /* Search upwards through the tree for possible parent */ > + > + ParentOp = ChildOp; > + while (ParentOp) > + { > + if (ParentOp == PossibleParentOp) > + { > + return (TRUE); > + } > + > + ParentOp = ParentOp->Asl.Parent; > + } > + > + return (FALSE); > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: XfGetParentMethod > + * > + * PARAMETERS: Op - Op to be checked > + * > + * RETURN: Op for parent method. NULL if object is not within a method. > + * > + * DESCRIPTION: Determine if an object is within a control method. Used to > + * implement special rules for named references from within a > + * control method. > + * > + * NOTE: It would be better to have the parser set a flag in the Op if possible. > + * > + ******************************************************************************/ > + > +static ACPI_PARSE_OBJECT * > +XfGetParentMethod ( > + ACPI_PARSE_OBJECT *Op) > +{ > + ACPI_PARSE_OBJECT *ParentOp; > + > + > + if (!Op) > + { > + return (NULL); > + } > + > + if (Op->Asl.ParseOpcode == PARSEOP_METHOD) > + { > + return (NULL); > + } > + > + /* Walk upwards through the parse tree, up to the root if necessary */ > + > + ParentOp = Op; > + while (ParentOp) > + { > + if (ParentOp->Asl.ParseOpcode == PARSEOP_METHOD) > + { > + return (ParentOp); > + } > + > + ParentOp = ParentOp->Asl.Parent; > + } > + > + /* Object is not within a method */ > + > + return (NULL); > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: XfCheckIllegalReference > + * > + * PARAMETERS: Op - Op referring to the target > + * TargetNode - Target of the reference > + * > + * RETURN: None. Emits error message for an illegal reference > + * > + * DESCRIPTION: Determine if a named reference is legal. A "named" reference > + * is something like: Store(ABCD, ...), where ABCD is an AML > + * Nameseg or Namepath. > + * > + * NOTE: Caller must ensure that the name Op is in fact a reference, and not > + * an actual name declaration (creation of a named object). > + * > + ******************************************************************************/ > + > +static void > +XfCheckIllegalReference ( > + ACPI_PARSE_OBJECT *Op, > + ACPI_NAMESPACE_NODE *TargetNode) > +{ > + ACPI_PARSE_OBJECT *MethodOp1; > + ACPI_PARSE_OBJECT *MethodOp2; > + ACPI_PARSE_OBJECT *TargetOp; > + > + > + /* > + * Check for an illegal reference to a named object: > + * > + * 1) References from one control method to another, non-parent > + * method are not allowed, they will fail at runtime. > + * > + * 2) Forward references within a control method are not allowed. > + * AML interpreters use a one-pass parse of control methods > + * so these forward references will fail at runtime. > + */ > + TargetOp = TargetNode->Op; > + > + MethodOp1 = XfGetParentMethod (Op); > + MethodOp2 = XfGetParentMethod (TargetOp); > + > + /* Are both objects within control method(s)? */ > + > + if (!MethodOp1 || !MethodOp2) > + { > + return; > + } > + > + /* Objects not in the same method? */ > + > + if (MethodOp1 != MethodOp2) > + { > + /* > + * 1) Cross-method named reference > + * > + * This is OK if and only if the target reference is within in a > + * method that is a parent of current method > + */ > + if (!XfIsObjectParental (MethodOp1, MethodOp2)) > + { > + AslError (ASL_ERROR, ASL_MSG_ILLEGAL_METHOD_REF, Op, > + Op->Asl.ExternalName); > + } > + } > + > + /* > + * 2) Both reference and target are in the same method. Check if this is > + * an (illegal) forward reference by examining the exact source code > + * location of each (the referenced object and the object declaration). > + * This is a bit nasty, yet effective. > + */ > + else if (Op->Asl.LogicalByteOffset < TargetOp->Asl.LogicalByteOffset) > + { > + AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op, > + Op->Asl.ExternalName); > + } > + > +} > +#endif > diff --git a/src/acpica/source/compiler/dtcompiler.h b/src/acpica/source/compiler/dtcompiler.h > index 212e940..b40f371 100644 > --- a/src/acpica/source/compiler/dtcompiler.h > +++ b/src/acpica/source/compiler/dtcompiler.h > @@ -609,6 +609,10 @@ DtCompileStao ( > void **PFieldList); > > ACPI_STATUS > +DtCompileTcpa ( > + void **PFieldList); > + > +ACPI_STATUS > DtCompileUefi ( > void **PFieldList); > > diff --git a/src/acpica/source/compiler/dttable.c b/src/acpica/source/compiler/dttable.c > index 80b8a95..312c53f 100644 > --- a/src/acpica/source/compiler/dttable.c > +++ b/src/acpica/source/compiler/dttable.c > @@ -3194,6 +3194,77 @@ DtCompileStao ( > > /****************************************************************************** > * > + * FUNCTION: DtCompileTcpa > + * > + * PARAMETERS: PFieldList - Current field list pointer > + * > + * RETURN: Status > + * > + * DESCRIPTION: Compile TCPA. > + * > + *****************************************************************************/ > + > +ACPI_STATUS > +DtCompileTcpa ( > + void **List) > +{ > + DT_FIELD **PFieldList = (DT_FIELD **) List; > + DT_SUBTABLE *Subtable; > + ACPI_TABLE_TCPA_HDR *TcpaHeader; > + DT_SUBTABLE *ParentTable; > + ACPI_STATUS Status; > + > + > + /* Compile the main table */ > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaHdr, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + > + /* > + * Examine the PlatformClass field to determine the table type. > + * Either a client or server table. Only one. > + */ > + TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer); > + > + switch (TcpaHeader->PlatformClass) > + { > + case ACPI_TCPA_CLIENT_TABLE: > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaClient, > + &Subtable, TRUE); > + break; > + > + case ACPI_TCPA_SERVER_TABLE: > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaServer, > + &Subtable, TRUE); > + break; > + > + default: > + > + AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n", > + TcpaHeader->PlatformClass); > + Status = AE_ERROR; > + break; > + } > + > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + > + return (Status); > +} > + > + > +/****************************************************************************** > + * > * FUNCTION: DtGetGenericTableInfo > * > * PARAMETERS: Name - Generic type name > diff --git a/src/acpica/source/compiler/dttemplate.h b/src/acpica/source/compiler/dttemplate.h > index 9b08e4b..4f158b9 100644 > --- a/src/acpica/source/compiler/dttemplate.h > +++ b/src/acpica/source/compiler/dttemplate.h > @@ -1216,13 +1216,19 @@ const unsigned char TemplateStao[] = > > const unsigned char TemplateTcpa[] = > { > - 0x54,0x43,0x50,0x41,0x32,0x00,0x00,0x00, /* 00000000 "TCPA2..." */ > - 0x01,0x67,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".gINTEL " */ > - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ > + 0x54,0x43,0x50,0x41,0x64,0x00,0x00,0x00, /* 00000000 "TCPAd..." */ > + 0x02,0xFF,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ > + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ > 0x80,0x31,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 ".1..INTL" */ > - 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */ > - 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ > - 0x00,0x00 /* 00000030 ".." */ > + 0x19,0x06,0x15,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ > + 0x11,0x00,0xFF,0xEE,0xDD,0xCC,0xBB,0xAA, /* 00000030 "........" */ > + 0x02,0x01,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000038 "........" */ > + 0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x03, /* 00000040 "..... .." */ > + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ > + 0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x03, /* 00000050 "..... .." */ > + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ > + 0x01,0x01,0x01,0x01 /* 00000060 "...." */ > }; > > const unsigned char TemplateTpm2[] = > diff --git a/src/acpica/source/compiler/prparser.l b/src/acpica/source/compiler/prparser.l > index e104107..20197df 100644 > --- a/src/acpica/source/compiler/prparser.l > +++ b/src/acpica/source/compiler/prparser.l > @@ -122,14 +122,22 @@ > #define STRING_SETUP strcpy (StringBuffer, PrParsertext);\ > PrParserlval.str = StringBuffer > > -#define YY_NO_INPUT /* No file input, we use strings only */ > - > #define _COMPONENT ACPI_COMPILER > ACPI_MODULE_NAME ("prscanner") > + > + > +/* Local prototypes */ > + > +static char > +PrDoCommentType1 ( > + void); > + > +static char > +PrDoCommentType2 ( > + void); > %} > > %option noyywrap > -%option nounput > > Number [0-9a-fA-F]+ > HexNumber 0[xX][0-9a-fA-F]+ > @@ -138,6 +146,8 @@ NewLine [\n] > Identifier [a-zA-Z][0-9a-zA-Z]* > > %% > +"/*" { if (!PrDoCommentType1 ()) {yyterminate ();} } > +"//" { if (!PrDoCommentType2 ()) {yyterminate ();} } > > \( return (EXPOP_PAREN_OPEN); > \) return (EXPOP_PAREN_CLOSE); > @@ -223,3 +233,76 @@ PrTerminateLexer ( > > yy_delete_buffer (LexBuffer); > } > + > + > +/******************************************************************************** > + * > + * FUNCTION: PrDoCommentType1 > + * > + * PARAMETERS: none > + * > + * RETURN: none > + * > + * DESCRIPTION: Process a new legacy comment. Just toss it. > + * > + ******************************************************************************/ > + > +static char > +PrDoCommentType1 ( > + void) > +{ > + int c; > + > + > +Loop: > + while (((c = input ()) != '*') && (c != EOF)) > + { > + } > + if (c == EOF) > + { > + return (FALSE); > + } > + > + if (((c = input ()) != '/') && (c != EOF)) > + { > + unput (c); > + goto Loop; > + } > + if (c == EOF) > + { > + return (FALSE); > + } > + > + return (TRUE); > +} > + > + > +/******************************************************************************** > + * > + * FUNCTION: PrDoCommentType2 > + * > + * PARAMETERS: none > + * > + * RETURN: none > + * > + * DESCRIPTION: Process a new "//" comment. Just toss it. > + * > + ******************************************************************************/ > + > +static char > +PrDoCommentType2 ( > + void) > +{ > + int c; > + > + > + while (((c = input ()) != '\n') && (c != EOF)) > + { > + } > + if (c == EOF) > + { > + return (FALSE); > + } > + > + return (TRUE); > +} > diff --git a/src/acpica/source/compiler/prparser.y b/src/acpica/source/compiler/prparser.y > index 68c140f..dd88a2e 100644 > --- a/src/acpica/source/compiler/prparser.y > +++ b/src/acpica/source/compiler/prparser.y > @@ -285,8 +285,11 @@ void > PrParsererror ( > char const *Message) > { > + > + sprintf (StringBuffer, "Preprocessor Parser : %s (near line %u)", > + Message, Gbl_CurrentLineNumber); > DtError (ASL_ERROR, ASL_MSG_SYNTAX, > - NULL, (char *) Message); > + NULL, (char *) StringBuffer); > } > > > diff --git a/src/acpica/source/compiler/prscan.c b/src/acpica/source/compiler/prscan.c > index 51657d6..bc88f76 100644 > --- a/src/acpica/source/compiler/prscan.c > +++ b/src/acpica/source/compiler/prscan.c > @@ -192,7 +192,6 @@ static const PR_DIRECTIVE_INFO Gbl_DirectiveInfo[] = > {"include", 0}, /* Argument is not standard format, so just use 0 here */ > {"includebuffer", 0}, /* Argument is not standard format, so just use 0 here */ > {"line", 1}, > - {"loadbuffer", 0}, > {"pragma", 1}, > {"undef", 1}, > {"warning", 1}, > @@ -216,7 +215,7 @@ enum Gbl_DirectiveIndexes > PR_DIRECTIVE_LINE, > PR_DIRECTIVE_PRAGMA, > PR_DIRECTIVE_UNDEF, > - PR_DIRECTIVE_WARNING, > + PR_DIRECTIVE_WARNING > }; > > #define ASL_DIRECTIVE_NOT_FOUND -1 > @@ -400,7 +399,7 @@ PrPreprocessInputFile ( > > PrGetNextLineInit (); > > - /* Scan line-by-line. Comments and blank lines are skipped by this function */ > + /* Scan source line-by-line and process directives. Then write the .i file */ > > while ((Status = PrGetNextLine (Gbl_Files[ASL_FILE_INPUT].Handle)) != ASL_EOF) > { > @@ -551,6 +550,16 @@ PrDoDirective ( > } > > /* > + * Emit a line directive into the preprocessor file (.pre) after > + * every matched directive. This is passed through to the compiler > + * so that error/warning messages are kept in sync with the > + * original source file. > + */ > + FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\" // #%s\n", > + Gbl_CurrentLineNumber, Gbl_Files[ASL_FILE_INPUT].Filename, > + Gbl_DirectiveInfo[Directive].Name); > + > + /* > * If we are currently ignoring this block and we encounter a #else or > * #elif, we must ignore their blocks also if the parent block is also > * being ignored. > @@ -897,6 +906,9 @@ PrDoDirective ( > > PrError (ASL_WARNING, ASL_MSG_WARNING_DIRECTIVE, > THIS_TOKEN_OFFSET (Token)); > + > + Gbl_SourceLine = 0; > + Gbl_NextError = Gbl_ErrorLog; > break; > > default: > @@ -935,7 +947,9 @@ SyntaxError: > ******************************************************************************/ > > #define PR_NORMAL_TEXT 0 > -#define PR_WITHIN_COMMENT 1 > +#define PR_MULTI_LINE_COMMENT 1 > +#define PR_SINGLE_LINE_COMMENT 2 > +#define PR_QUOTED_STRING 3 > > static UINT8 AcpiGbl_LineScanState = PR_NORMAL_TEXT; > > @@ -976,22 +990,55 @@ PrGetNextLine ( > return (ASL_EOF); > } > > - /* We need to worry about multi-line slash-asterisk comments */ > - > - /* Check for comment open */ > + /* Update state machine as necessary */ > > - if ((AcpiGbl_LineScanState == PR_NORMAL_TEXT) && > - (PreviousChar == '/') && (c == '*')) > + switch (AcpiGbl_LineScanState) > { > - AcpiGbl_LineScanState = PR_WITHIN_COMMENT; > - } > + case PR_NORMAL_TEXT: > > - /* Check for comment close */ > + /* Check for multi-line comment start */ > > - if ((AcpiGbl_LineScanState == PR_WITHIN_COMMENT) && > - (PreviousChar == '*') && (c == '/')) > - { > - AcpiGbl_LineScanState = PR_NORMAL_TEXT; > + if ((PreviousChar == '/') && (c == '*')) > + { > + AcpiGbl_LineScanState = PR_MULTI_LINE_COMMENT; > + } > + > + /* Check for single-line comment start */ > + > + else if ((PreviousChar == '/') && (c == '/')) > + { > + AcpiGbl_LineScanState = PR_SINGLE_LINE_COMMENT; > + } > + > + /* Check for quoted string start */ > + > + else if (PreviousChar == '"') > + { > + AcpiGbl_LineScanState = PR_QUOTED_STRING; > + } > + break; > + > + case PR_QUOTED_STRING: > + > + if (PreviousChar == '"') > + { > + AcpiGbl_LineScanState = PR_NORMAL_TEXT; > + } > + break; > + > + case PR_MULTI_LINE_COMMENT: > + > + /* Check for multi-line comment end */ > + > + if ((PreviousChar == '*') && (c == '/')) > + { > + AcpiGbl_LineScanState = PR_NORMAL_TEXT; > + } > + break; > + > + case PR_SINGLE_LINE_COMMENT: /* Just ignore text until EOL */ > + default: > + break; > } > > /* Always copy the character into line buffer */ > @@ -1005,10 +1052,21 @@ PrGetNextLine ( > { > /* Handle multi-line comments */ > > - if (AcpiGbl_LineScanState == PR_WITHIN_COMMENT) > + if (AcpiGbl_LineScanState == PR_MULTI_LINE_COMMENT) > { > return (ASL_WITHIN_COMMENT); > } > + > + /* End of single-line comment */ > + > + if (AcpiGbl_LineScanState == PR_SINGLE_LINE_COMMENT) > + { > + AcpiGbl_LineScanState = PR_NORMAL_TEXT; > + return (AE_OK); > + } > + > + /* Blank line */ > + > if (i == 1) > { > return (ASL_BLANK_LINE); > diff --git a/src/acpica/source/components/debugger/dbcmds.c b/src/acpica/source/components/debugger/dbcmds.c > index db2f282..f3bed06 100644 > --- a/src/acpica/source/components/debugger/dbcmds.c > +++ b/src/acpica/source/components/debugger/dbcmds.c > @@ -158,6 +158,8 @@ AcpiDbDoOneSleepState ( > UINT8 SleepState); > > > +static char *AcpiDbTraceMethodName = NULL; > + > /******************************************************************************* > * > * FUNCTION: AcpiDbConvertToNode > @@ -1298,4 +1300,88 @@ AcpiDbGenerateSci ( > > #endif /* !ACPI_REDUCED_HARDWARE */ > > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiDbTrace > + * > + * PARAMETERS: EnableArg - ENABLE/AML to enable tracer > + * DISABLE to disable tracer > + * MethodArg - Method to trace > + * OnceArg - Whether trace once > + * > + * RETURN: None > + * > + * DESCRIPTION: Control method tracing facility > + * > + ******************************************************************************/ > + > +void > +AcpiDbTrace ( > + char *EnableArg, > + char *MethodArg, > + char *OnceArg) > +{ > + UINT32 DebugLevel = 0; > + UINT32 DebugLayer = 0; > + UINT32 Flags = 0; > + > + > + if (EnableArg) > + { > + AcpiUtStrupr (EnableArg); > + } > + if (OnceArg) > + { > + AcpiUtStrupr (OnceArg); > + } > + if (MethodArg) > + { > + if (AcpiDbTraceMethodName) > + { > + ACPI_FREE (AcpiDbTraceMethodName); > + AcpiDbTraceMethodName = NULL; > + } > + AcpiDbTraceMethodName = ACPI_ALLOCATE (strlen (MethodArg) + 1); > + if (!AcpiDbTraceMethodName) > + { > + AcpiOsPrintf ("Failed to allocate method name (%s)\n", MethodArg); > + return; > + } > + strcpy (AcpiDbTraceMethodName, MethodArg); > + } > + if (!strcmp (EnableArg, "ENABLE") || > + !strcmp (EnableArg, "METHOD") || > + !strcmp (EnableArg, "OPCODE")) > + { > + if (!strcmp (EnableArg, "ENABLE")) > + { > + /* Inherit current console settings */ > + > + DebugLevel = AcpiGbl_DbConsoleDebugLevel; > + DebugLayer = AcpiDbgLayer; > + } > + else > + { > + /* Restrict console output to trace points only */ > + > + DebugLevel = ACPI_LV_TRACE_POINT; > + DebugLayer = ACPI_EXECUTER; > + } > + > + Flags = ACPI_TRACE_ENABLED; > + if (!strcmp (EnableArg, "OPCODE")) > + { > + Flags |= ACPI_TRACE_OPCODE; > + } > + if (OnceArg && !strcmp (OnceArg, "ONCE")) > + { > + Flags |= ACPI_TRACE_ONESHOT; > + } > + } > + > + (void) AcpiDebugTrace (AcpiDbTraceMethodName, > + DebugLevel, DebugLayer, Flags); > +} > + > #endif /* ACPI_DEBUGGER */ > diff --git a/src/acpica/source/components/debugger/dbdisply.c b/src/acpica/source/components/debugger/dbdisply.c > index e8ea451..1dd679b 100644 > --- a/src/acpica/source/components/debugger/dbdisply.c > +++ b/src/acpica/source/components/debugger/dbdisply.c > @@ -121,7 +121,6 @@ > #include "acparser.h" > #include "acinterp.h" > #include "acdebug.h" > -#include "acdisasm.h" > > > #ifdef ACPI_DEBUGGER > @@ -585,7 +584,7 @@ AcpiDbDisplayLocals ( > return; > } > > - AcpiDmDisplayLocals (WalkState); > + AcpiDbDecodeLocals (WalkState); > } > > > @@ -615,7 +614,7 @@ AcpiDbDisplayArguments ( > return; > } > > - AcpiDmDisplayArguments (WalkState); > + AcpiDbDecodeArguments (WalkState); > } > > > @@ -671,7 +670,7 @@ AcpiDbDisplayResults ( > { > ObjDesc = Frame->Results.ObjDesc[Index]; > AcpiOsPrintf ("Result%u: ", i); > - AcpiDmDisplayInternalObject (ObjDesc, WalkState); > + AcpiDbDisplayInternalObject (ObjDesc, WalkState); > if (Index == 0) > { > Frame = Frame->Results.Next; > @@ -835,7 +834,7 @@ AcpiDbDisplayResultObject ( > } > > AcpiOsPrintf ("ResultObj: "); > - AcpiDmDisplayInternalObject (ObjDesc, WalkState); > + AcpiDbDisplayInternalObject (ObjDesc, WalkState); > AcpiOsPrintf ("\n"); > } > > @@ -865,7 +864,7 @@ AcpiDbDisplayArgumentObject ( > } > > AcpiOsPrintf ("ArgObj: "); > - AcpiDmDisplayInternalObject (ObjDesc, WalkState); > + AcpiDbDisplayInternalObject (ObjDesc, WalkState); > } > > > diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c > index c3553cb..02fd0cd 100644 > --- a/src/acpica/source/components/debugger/dbinput.c > +++ b/src/acpica/source/components/debugger/dbinput.c > @@ -290,7 +290,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = > {"TABLES", 0}, > {"TEMPLATE", 1}, > {"TERMINATE", 0}, > - {"TEST", 1}, > + {"TEST", 1}, > {"THREADS", 3}, > {"TRACE", 1}, > {"TREE", 0}, > @@ -342,7 +342,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = > {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"}, > {1, " Paths", "Display full pathnames of namespace objects\n"}, > {1, " Predefined", "Check all predefined names\n"}, > - {1, " Prefix [<NamePath>]", "Set or Get current execution prefix\n"}, > + {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"}, > {1, " References <Addr>", "Find all references to object at addr\n"}, > {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, > {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"}, > @@ -369,8 +369,12 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = > {1, " Results", "Display method result stack\n"}, > {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"}, > {1, " Stop", "Terminate control method\n"}, > - {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"}, > - {1, " Trace <method name>", "Trace method execution\n"}, > + {1, " Thread <Threads><Loops><Namepath>", "Spawn threads to execute method(s)\n"}, > + {5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"}, > + {1, " Enable", "Enable all messages\n"}, > + {1, " Disable", "Disable tracing\n"}, > + {1, " Method", "Enable method execution messages\n"}, > + {1, " Opcode", "Enable opcode execution messages\n"}, > {1, " Tree", "Display control method calling tree\n"}, > {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, > > @@ -821,15 +825,22 @@ AcpiDbCommandDispatch ( > return (AE_CTRL_TERMINATE); > } > > - > - /* Add all commands that come here to the history buffer */ > - > - AcpiDbAddToHistory (InputBuffer); > + /* Find command and add to the history buffer */ > > ParamCount = AcpiDbGetLine (InputBuffer); > CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]); > Temp = 0; > > + /* > + * We don't want to add the !! command to the history buffer. It > + * would cause an infinite loop because it would always be the > + * previous command. > + */ > + if (CommandIndex != CMD_HISTORY_LAST) > + { > + AcpiDbAddToHistory (InputBuffer); > + } > + > /* Verify that we have the minimum number of params */ > > if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs) > @@ -1182,7 +1193,7 @@ AcpiDbCommandDispatch ( > > case CMD_TRACE: > > - (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); > + AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); > break; > > case CMD_TREE: > diff --git a/src/acpica/source/components/debugger/dbmethod.c b/src/acpica/source/components/debugger/dbmethod.c > index f6c9c51..3ea2639 100644 > --- a/src/acpica/source/components/debugger/dbmethod.c > +++ b/src/acpica/source/components/debugger/dbmethod.c > @@ -118,7 +118,9 @@ > #include "acdispat.h" > #include "acnamesp.h" > #include "acdebug.h" > +#ifdef ACPI_DISASSEMBLER > #include "acdisasm.h" > +#endif > #include "acparser.h" > #include "acpredef.h" > > @@ -151,6 +153,7 @@ AcpiDbSetMethodBreakpoint ( > ACPI_PARSE_OBJECT *Op) > { > UINT32 Address; > + UINT32 AmlOffset; > > > if (!Op) > @@ -162,10 +165,12 @@ AcpiDbSetMethodBreakpoint ( > /* Get and verify the breakpoint address */ > > Address = strtoul (Location, NULL, 16); > - if (Address <= Op->Common.AmlOffset) > + AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, > + WalkState->ParserState.AmlStart); > + if (Address <= AmlOffset) > { > AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", > - Address, Op->Common.AmlOffset); > + Address, AmlOffset); > } > > /* Save breakpoint in current walk */ > @@ -310,7 +315,7 @@ AcpiDbSetMethodData ( > ObjDesc = WalkState->Arguments[Index].Object; > > AcpiOsPrintf ("Arg%u: ", Index); > - AcpiDmDisplayInternalObject (ObjDesc, WalkState); > + AcpiDbDisplayInternalObject (ObjDesc, WalkState); > break; > > case 'L': > @@ -333,7 +338,7 @@ AcpiDbSetMethodData ( > ObjDesc = WalkState->LocalVariables[Index].Object; > > AcpiOsPrintf ("Local%u: ", Index); > - AcpiDmDisplayInternalObject (ObjDesc, WalkState); > + AcpiDbDisplayInternalObject (ObjDesc, WalkState); > break; > > default: > @@ -379,7 +384,9 @@ AcpiDbDisassembleAml ( > NumStatements = strtoul (Statements, NULL, 0); > } > > +#ifdef ACPI_DISASSEMBLER > AcpiDmDisassemble (NULL, Op, NumStatements); > +#endif > } > > > @@ -422,7 +429,7 @@ AcpiDbDisassembleMethod ( > > ObjDesc = Method->Object; > > - Op = AcpiPsCreateScopeOp (); > + Op = AcpiPsCreateScopeOp (ObjDesc->Method.AmlStart); > if (!Op) > { > return (AE_NO_MEMORY); > @@ -462,6 +469,8 @@ AcpiDbDisassembleMethod ( > WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; > > Status = AcpiPsParseAml (WalkState); > + > +#ifdef ACPI_DISASSEMBER > (void) AcpiDmParseDeferredOps (Op); > > /* Now we can disassemble the method */ > @@ -469,6 +478,7 @@ AcpiDbDisassembleMethod ( > AcpiGbl_DbOpt_Verbose = FALSE; > AcpiDmDisassemble (NULL, Op, 0); > AcpiGbl_DbOpt_Verbose = TRUE; > +#endif > > AcpiPsDeleteParseTree (Op); > > diff --git a/src/acpica/source/components/debugger/dbnames.c b/src/acpica/source/components/debugger/dbnames.c > index 7d936c8..0fd752d 100644 > --- a/src/acpica/source/components/debugger/dbnames.c > +++ b/src/acpica/source/components/debugger/dbnames.c > @@ -457,7 +457,7 @@ AcpiDbWalkAndMatchName ( > /* Get the full pathname to this object */ > > Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); > + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); > if (ACPI_FAILURE (Status)) > { > AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); > @@ -654,7 +654,7 @@ AcpiDbWalkForSpecificObjects ( > /* Get and display the full pathname to this object */ > > Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); > + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); > if (ACPI_FAILURE (Status)) > { > AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); > @@ -958,7 +958,7 @@ AcpiDbBusWalk ( > /* Get the full path to this device object */ > > Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); > + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); > if (ACPI_FAILURE (Status)) > { > AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); > diff --git a/src/acpica/source/components/debugger/dbobject.c b/src/acpica/source/components/debugger/dbobject.c > new file mode 100644 > index 0000000..5d2e0fb > --- /dev/null > +++ b/src/acpica/source/components/debugger/dbobject.c > @@ -0,0 +1,597 @@ > +/******************************************************************************* > + * > + * Module Name: dbobject - ACPI object decode and display > + * > + ******************************************************************************/ > + > +/****************************************************************************** > + * > + * 1. Copyright Notice > + * > + * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp. > + * All rights reserved. > + * > + * 2. License > + * > + * 2.1. This is your license from Intel Corp. under its intellectual property > + * rights. You may have additional license terms from the party that provided > + * you this software, covering your right to use that party's intellectual > + * property rights. > + * > + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a > + * copy of the source code appearing in this file ("Covered Code") an > + * irrevocable, perpetual, worldwide license under Intel's copyrights in the > + * base code distributed originally by Intel ("Original Intel Code") to copy, > + * make derivatives, distribute, use and display any portion of the Covered > + * Code in any form, with the right to sublicense such rights; and > + * > + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent > + * license (with the right to sublicense), under only those claims of Intel > + * patents that are infringed by the Original Intel Code, to make, use, sell, > + * offer to sell, and import the Covered Code and derivative works thereof > + * solely to the minimum extent necessary to exercise the above copyright > + * license, and in no event shall the patent license extend to any additions > + * to or modifications of the Original Intel Code. No other license or right > + * is granted directly or by implication, estoppel or otherwise; > + * > + * The above copyright and patent license is granted only if the following > + * conditions are met: > + * > + * 3. Conditions > + * > + * 3.1. Redistribution of Source with Rights to Further Distribute Source. > + * Redistribution of source code of any substantial portion of the Covered > + * Code or modification with rights to further distribute source must include > + * the above Copyright Notice, the above License, this list of Conditions, > + * and the following Disclaimer and Export Compliance provision. In addition, > + * Licensee must cause all Covered Code to which Licensee contributes to > + * contain a file documenting the changes Licensee made to create that Covered > + * Code and the date of any change. Licensee must include in that file the > + * documentation of any changes made by any predecessor Licensee. Licensee > + * must include a prominent statement that the modification is derived, > + * directly or indirectly, from Original Intel Code. > + * > + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. > + * Redistribution of source code of any substantial portion of the Covered > + * Code or modification without rights to further distribute source must > + * include the following Disclaimer and Export Compliance provision in the > + * documentation and/or other materials provided with distribution. In > + * addition, Licensee may not authorize further sublicense of source of any > + * portion of the Covered Code, and must include terms to the effect that the > + * license from Licensee to its licensee is limited to the intellectual > + * property embodied in the software Licensee provides to its licensee, and > + * not to intellectual property embodied in modifications its licensee may > + * make. > + * > + * 3.3. Redistribution of Executable. Redistribution in executable form of any > + * substantial portion of the Covered Code or modification must reproduce the > + * above Copyright Notice, and the following Disclaimer and Export Compliance > + * provision in the documentation and/or other materials provided with the > + * distribution. > + * > + * 3.4. Intel retains all right, title, and interest in and to the Original > + * Intel Code. > + * > + * 3.5. Neither the name Intel nor any other trademark owned or controlled by > + * Intel shall be used in advertising or otherwise to promote the sale, use or > + * other dealings in products derived from or relating to the Covered Code > + * without prior written authorization from Intel. > + * > + * 4. Disclaimer and Export Compliance > + * > + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED > + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE > + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, > + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY > + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY > + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A > + * PARTICULAR PURPOSE. > + * > + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES > + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR > + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, > + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY > + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL > + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS > + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY > + * LIMITED REMEDY. > + * > + * 4.3. Licensee shall not export, either directly or indirectly, any of this > + * software or system incorporating such software without first obtaining any > + * required license or other approval from the U. S. Department of Commerce or > + * any other agency or department of the United States Government. In the > + * event Licensee exports any such software from the United States or > + * re-exports any such software from a foreign destination, Licensee shall > + * ensure that the distribution and export/re-export of the software is in > + * compliance with all laws, regulations, orders, or other restrictions of the > + * U.S. Export Administration Regulations. Licensee agrees that neither it nor > + * any of its subsidiaries will export/re-export any technical data, process, > + * software, or service, directly or indirectly, to any country for which the > + * United States government or any agency thereof requires an export license, > + * other governmental approval, or letter of assurance, without first obtaining > + * such license, approval or letter. > + * > + *****************************************************************************/ > + > +#include "acpi.h" > +#include "accommon.h" > +#include "acnamesp.h" > +#include "acdebug.h" > +#ifdef ACPI_DISASSEMBLER > +#include "acdisasm.h" > +#endif > + > + > +#ifdef ACPI_DEBUGGER > + > +#define _COMPONENT ACPI_CA_DEBUGGER > + ACPI_MODULE_NAME ("dbobject") > + > +/* Local prototypes */ > + > +static void > +AcpiDbDecodeNode ( > + ACPI_NAMESPACE_NODE *Node); > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiDbDumpMethodInfo > + * > + * PARAMETERS: Status - Method execution status > + * WalkState - Current state of the parse tree walk > + * > + * RETURN: None > + * > + * DESCRIPTION: Called when a method has been aborted because of an error. > + * Dumps the method execution stack, and the method locals/args, > + * and disassembles the AML opcode that failed. > + * > + ******************************************************************************/ > + > +void > +AcpiDbDumpMethodInfo ( > + ACPI_STATUS Status, > + ACPI_WALK_STATE *WalkState) > +{ > + ACPI_THREAD_STATE *Thread; > + > + > + /* Ignore control codes, they are not errors */ > + > + if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL) > + { > + return; > + } > + > + /* We may be executing a deferred opcode */ > + > + if (WalkState->DeferredNode) > + { > + AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); > + return; > + } > + > + /* > + * If there is no Thread, we are not actually executing a method. > + * This can happen when the iASL compiler calls the interpreter > + * to perform constant folding. > + */ > + Thread = WalkState->Thread; > + if (!Thread) > + { > + return; > + } > + > + /* Display the method locals and arguments */ > + > + AcpiOsPrintf ("\n"); > + AcpiDbDecodeLocals (WalkState); > + AcpiOsPrintf ("\n"); > + AcpiDbDecodeArguments (WalkState); > + AcpiOsPrintf ("\n"); > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiDbDecodeInternalObject > + * > + * PARAMETERS: ObjDesc - Object to be displayed > + * > + * RETURN: None > + * > + * DESCRIPTION: Short display of an internal object. Numbers/Strings/Buffers. > + * > + ******************************************************************************/ > + > +void > +AcpiDbDecodeInternalObject ( > + ACPI_OPERAND_OBJECT *ObjDesc) > +{ > + UINT32 i; > + > + > + if (!ObjDesc) > + { > + AcpiOsPrintf (" Uninitialized"); > + return; > + } > + > + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) > + { > + AcpiOsPrintf (" %p [%s]", ObjDesc, AcpiUtGetDescriptorName (ObjDesc)); > + return; > + } > + > + AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc)); > + > + switch (ObjDesc->Common.Type) > + { > + case ACPI_TYPE_INTEGER: > + > + AcpiOsPrintf (" %8.8X%8.8X", > + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); > + break; > + > + case ACPI_TYPE_STRING: > + > + AcpiOsPrintf ("(%u) \"%.24s", > + ObjDesc->String.Length, ObjDesc->String.Pointer); > + > + if (ObjDesc->String.Length > 24) > + { > + AcpiOsPrintf ("..."); > + } > + else > + { > + AcpiOsPrintf ("\""); > + } > + break; > + > + case ACPI_TYPE_BUFFER: > + > + AcpiOsPrintf ("(%u)", ObjDesc->Buffer.Length); > + for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++) > + { > + AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); > + } > + break; > + > + default: > + > + AcpiOsPrintf (" %p", ObjDesc); > + break; > + } > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiDbDecodeNode > + * > + * PARAMETERS: Node - Object to be displayed > + * > + * RETURN: None > + * > + * DESCRIPTION: Short display of a namespace node > + * > + ******************************************************************************/ > + > +static void > +AcpiDbDecodeNode ( > + ACPI_NAMESPACE_NODE *Node) > +{ > + > + AcpiOsPrintf ("<Node> Name %4.4s", > + AcpiUtGetNodeName (Node)); > + > + if (Node->Flags & ANOBJ_METHOD_ARG) > + { > + AcpiOsPrintf (" [Method Arg]"); > + } > + if (Node->Flags & ANOBJ_METHOD_LOCAL) > + { > + AcpiOsPrintf (" [Method Local]"); > + } > + > + switch (Node->Type) > + { > + /* These types have no attached object */ > + > + case ACPI_TYPE_DEVICE: > + > + AcpiOsPrintf (" Device"); > + break; > + > + case ACPI_TYPE_THERMAL: > + > + AcpiOsPrintf (" Thermal Zone"); > + break; > + > + default: > + > + AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node)); > + break; > + } > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiDbDisplayInternalObject > + * > + * PARAMETERS: ObjDesc - Object to be displayed > + * WalkState - Current walk state > + * > + * RETURN: None > + * > + * DESCRIPTION: Short display of an internal object > + * > + ******************************************************************************/ > + > +void > +AcpiDbDisplayInternalObject ( > + ACPI_OPERAND_OBJECT *ObjDesc, > + ACPI_WALK_STATE *WalkState) > +{ > + UINT8 Type; > + > + > + AcpiOsPrintf ("%p ", ObjDesc); > + > + if (!ObjDesc) > + { > + AcpiOsPrintf ("<Null Object>\n"); > + return; > + } > + > + /* Decode the object type */ > + > + switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) > + { > + case ACPI_DESC_TYPE_PARSER: > + > + AcpiOsPrintf ("<Parser> "); > + break; > + > + case ACPI_DESC_TYPE_NAMED: > + > + AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc); > + break; > + > + case ACPI_DESC_TYPE_OPERAND: > + > + Type = ObjDesc->Common.Type; > + if (Type > ACPI_TYPE_LOCAL_MAX) > + { > + AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type); > + return; > + } > + > + /* Decode the ACPI object type */ > + > + switch (ObjDesc->Common.Type) > + { > + case ACPI_TYPE_LOCAL_REFERENCE: > + > + AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc)); > + > + /* Decode the refererence */ > + > + switch (ObjDesc->Reference.Class) > + { > + case ACPI_REFCLASS_LOCAL: > + > + AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); > + if (WalkState) > + { > + ObjDesc = WalkState->LocalVariables > + [ObjDesc->Reference.Value].Object; > + AcpiOsPrintf ("%p", ObjDesc); > + AcpiDbDecodeInternalObject (ObjDesc); > + } > + break; > + > + case ACPI_REFCLASS_ARG: > + > + AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); > + if (WalkState) > + { > + ObjDesc = WalkState->Arguments > + [ObjDesc->Reference.Value].Object; > + AcpiOsPrintf ("%p", ObjDesc); > + AcpiDbDecodeInternalObject (ObjDesc); > + } > + break; > + > + case ACPI_REFCLASS_INDEX: > + > + switch (ObjDesc->Reference.TargetType) > + { > + case ACPI_TYPE_BUFFER_FIELD: > + > + AcpiOsPrintf ("%p", ObjDesc->Reference.Object); > + AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); > + break; > + > + case ACPI_TYPE_PACKAGE: > + > + AcpiOsPrintf ("%p", ObjDesc->Reference.Where); > + if (!ObjDesc->Reference.Where) > + { > + AcpiOsPrintf (" Uninitialized WHERE pointer"); > + } > + else > + { > + AcpiDbDecodeInternalObject ( > + *(ObjDesc->Reference.Where)); > + } > + break; > + > + default: > + > + AcpiOsPrintf ("Unknown index target type"); > + break; > + } > + break; > + > + case ACPI_REFCLASS_REFOF: > + > + if (!ObjDesc->Reference.Object) > + { > + AcpiOsPrintf ("Uninitialized reference subobject pointer"); > + break; > + } > + > + /* Reference can be to a Node or an Operand object */ > + > + switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object)) > + { > + case ACPI_DESC_TYPE_NAMED: > + AcpiDbDecodeNode (ObjDesc->Reference.Object); > + break; > + > + case ACPI_DESC_TYPE_OPERAND: > + AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); > + break; > + > + default: > + break; > + } > + break; > + > + case ACPI_REFCLASS_NAME: > + > + AcpiDbDecodeNode (ObjDesc->Reference.Node); > + break; > + > + case ACPI_REFCLASS_DEBUG: > + case ACPI_REFCLASS_TABLE: > + > + AcpiOsPrintf ("\n"); > + break; > + > + default: /* Unknown reference class */ > + > + AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class); > + break; > + } > + break; > + > + default: > + > + AcpiOsPrintf ("<Obj> "); > + AcpiDbDecodeInternalObject (ObjDesc); > + break; > + } > + break; > + > + default: > + > + AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]", > + AcpiUtGetDescriptorName (ObjDesc)); > + break; > + } > + > + AcpiOsPrintf ("\n"); > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiDbDecodeLocals > + * > + * PARAMETERS: WalkState - State for current method > + * > + * RETURN: None > + * > + * DESCRIPTION: Display all locals for the currently running control method > + * > + ******************************************************************************/ > + > +void > +AcpiDbDecodeLocals ( > + ACPI_WALK_STATE *WalkState) > +{ > + UINT32 i; > + ACPI_OPERAND_OBJECT *ObjDesc; > + ACPI_NAMESPACE_NODE *Node; > + > + > + ObjDesc = WalkState->MethodDesc; > + Node = WalkState->MethodNode; > + if (!Node) > + { > + AcpiOsPrintf ( > + "No method node (Executing subtree for buffer or opregion)\n"); > + return; > + } > + > + if (Node->Type != ACPI_TYPE_METHOD) > + { > + AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); > + return; > + } > + > + AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", > + AcpiUtGetNodeName (Node)); > + > + for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) > + { > + ObjDesc = WalkState->LocalVariables[i].Object; > + AcpiOsPrintf (" Local%X: ", i); > + AcpiDbDisplayInternalObject (ObjDesc, WalkState); > + } > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiDbDecodeArguments > + * > + * PARAMETERS: WalkState - State for current method > + * > + * RETURN: None > + * > + * DESCRIPTION: Display all arguments for the currently running control method > + * > + ******************************************************************************/ > + > +void > +AcpiDbDecodeArguments ( > + ACPI_WALK_STATE *WalkState) > +{ > + UINT32 i; > + ACPI_OPERAND_OBJECT *ObjDesc; > + ACPI_NAMESPACE_NODE *Node; > + > + > + ObjDesc = WalkState->MethodDesc; > + Node = WalkState->MethodNode; > + if (!Node) > + { > + AcpiOsPrintf ( > + "No method node (Executing subtree for buffer or opregion)\n"); > + return; > + } > + > + if (Node->Type != ACPI_TYPE_METHOD) > + { > + AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); > + return; > + } > + > + AcpiOsPrintf ( > + "Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n", > + AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount, ObjDesc->Method.SyncLevel); > + > + for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) > + { > + ObjDesc = WalkState->Arguments[i].Object; > + AcpiOsPrintf (" Arg%u: ", i); > + AcpiDbDisplayInternalObject (ObjDesc, WalkState); > + } > +} > + > +#endif > diff --git a/src/acpica/source/components/debugger/dbutils.c b/src/acpica/source/components/debugger/dbutils.c > index 5c85a15..22a5c45 100644 > --- a/src/acpica/source/components/debugger/dbutils.c > +++ b/src/acpica/source/components/debugger/dbutils.c > @@ -117,7 +117,6 @@ > #include "accommon.h" > #include "acnamesp.h" > #include "acdebug.h" > -#include "acdisasm.h" > > > #ifdef ACPI_DEBUGGER > @@ -295,7 +294,7 @@ AcpiDbDumpExternalObject ( > case ACPI_TYPE_LOCAL_REFERENCE: > > AcpiOsPrintf ("[Object Reference] = "); > - AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL); > + AcpiDbDisplayInternalObject (ObjDesc->Reference.Handle, NULL); > break; > > case ACPI_TYPE_PROCESSOR: > diff --git a/src/acpica/source/components/debugger/dbxface.c b/src/acpica/source/components/debugger/dbxface.c > index 673178f..2292152 100644 > --- a/src/acpica/source/components/debugger/dbxface.c > +++ b/src/acpica/source/components/debugger/dbxface.c > @@ -117,7 +117,9 @@ > #include "accommon.h" > #include "amlcode.h" > #include "acdebug.h" > +#ifdef ACPI_DISASSEMBLER > #include "acdisasm.h" > +#endif > > > #ifdef ACPI_DEBUGGER > @@ -251,6 +253,7 @@ AcpiDbSingleStep ( > UINT32 OriginalDebugLevel; > ACPI_PARSE_OBJECT *DisplayOp; > ACPI_PARSE_OBJECT *ParentOp; > + UINT32 AmlOffset; > > > ACPI_FUNCTION_ENTRY (); > @@ -264,15 +267,18 @@ AcpiDbSingleStep ( > return (AE_ABORT_METHOD); > } > > + AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, > + WalkState->ParserState.AmlStart); > + > /* Check for single-step breakpoint */ > > if (WalkState->MethodBreakpoint && > - (WalkState->MethodBreakpoint <= Op->Common.AmlOffset)) > + (WalkState->MethodBreakpoint <= AmlOffset)) > { > /* Check if the breakpoint has been reached or passed */ > /* Hit the breakpoint, resume single step, reset breakpoint */ > > - AcpiOsPrintf ("***Break*** at AML offset %X\n", Op->Common.AmlOffset); > + AcpiOsPrintf ("***Break*** at AML offset %X\n", AmlOffset); > AcpiGbl_CmSingleStep = TRUE; > AcpiGbl_StepToNextCall = FALSE; > WalkState->MethodBreakpoint = 0; > @@ -281,10 +287,10 @@ AcpiDbSingleStep ( > /* Check for user breakpoint (Must be on exact Aml offset) */ > > else if (WalkState->UserBreakpoint && > - (WalkState->UserBreakpoint == Op->Common.AmlOffset)) > + (WalkState->UserBreakpoint == AmlOffset)) > { > AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", > - Op->Common.AmlOffset); > + AmlOffset); > AcpiGbl_CmSingleStep = TRUE; > AcpiGbl_StepToNextCall = FALSE; > WalkState->MethodBreakpoint = 0; > @@ -380,7 +386,9 @@ AcpiDbSingleStep ( > > /* Now we can display it */ > > +#ifdef ACPI_DISASSEMBLER > AcpiDmDisassemble (WalkState, DisplayOp, ACPI_UINT32_MAX); > +#endif > > if ((Op->Common.AmlOpcode == AML_IF_OP) || > (Op->Common.AmlOpcode == AML_WHILE_OP)) > diff --git a/src/acpica/source/components/disassembler/dmdeferred.c b/src/acpica/source/components/disassembler/dmdeferred.c > index 7e654f2..6599c04 100644 > --- a/src/acpica/source/components/disassembler/dmdeferred.c > +++ b/src/acpica/source/components/disassembler/dmdeferred.c > @@ -237,7 +237,6 @@ AcpiDmDeferredParse ( > ACPI_STATUS Status; > ACPI_PARSE_OBJECT *SearchOp; > ACPI_PARSE_OBJECT *StartOp; > - UINT32 BaseAmlOffset; > ACPI_PARSE_OBJECT *NewRootOp; > ACPI_PARSE_OBJECT *ExtraOp; > > @@ -274,19 +273,10 @@ AcpiDmDeferredParse ( > WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; > Status = AcpiPsParseAml (WalkState); > > - /* > - * We need to update all of the AML offsets, since the parser thought > - * that the method began at offset zero. In reality, it began somewhere > - * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that > - * was just created and update the AmlOffset in each Op. > - */ > - BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1; > StartOp = (Op->Common.Value.Arg)->Common.Next; > SearchOp = StartOp; > - > while (SearchOp) > { > - SearchOp->Common.AmlOffset += BaseAmlOffset; > SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); > } > > diff --git a/src/acpica/source/components/disassembler/dmnames.c b/src/acpica/source/components/disassembler/dmnames.c > index 45df12a..1cf0700 100644 > --- a/src/acpica/source/components/disassembler/dmnames.c > +++ b/src/acpica/source/components/disassembler/dmnames.c > @@ -251,7 +251,7 @@ AcpiPsDisplayObjectPathname ( > /* Convert NamedDesc/handle to a full pathname */ > > Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > - Status = AcpiNsHandleToPathname (Node, &Buffer); > + Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE); > if (ACPI_FAILURE (Status)) > { > AcpiOsPrintf ("****Could not get pathname****)"); > diff --git a/src/acpica/source/components/disassembler/dmopcode.c b/src/acpica/source/components/disassembler/dmopcode.c > index 1838cc3..2941a40 100644 > --- a/src/acpica/source/components/disassembler/dmopcode.c > +++ b/src/acpica/source/components/disassembler/dmopcode.c > @@ -120,6 +120,7 @@ > #include "acdisasm.h" > #include "acinterp.h" > #include "acnamesp.h" > +#include "acdebug.h" > > #ifdef ACPI_DISASSEMBLER > > @@ -1039,7 +1040,7 @@ AcpiDmDisassembleOneOp ( > (WalkState->Results) && > (WalkState->ResultCount)) > { > - AcpiDmDecodeInternalObject ( > + AcpiDbDecodeInternalObject ( > WalkState->Results->Results.ObjDesc [ > (WalkState->ResultCount - 1) % > ACPI_RESULTS_FRAME_OBJ_NUM]); > diff --git a/src/acpica/source/components/disassembler/dmwalk.c b/src/acpica/source/components/disassembler/dmwalk.c > index 9c0a1ac..091c69c 100644 > --- a/src/acpica/source/components/disassembler/dmwalk.c > +++ b/src/acpica/source/components/disassembler/dmwalk.c > @@ -385,6 +385,8 @@ AcpiDmBlockType ( > return (BLOCK_NONE); > } > > + /*lint -fallthrough */ > + > default: > > OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); > @@ -482,7 +484,23 @@ AcpiDmDescendingOp ( > const ACPI_OPCODE_INFO *OpInfo; > UINT32 Name; > ACPI_PARSE_OBJECT *NextOp; > + UINT32 AmlOffset; > + > + > + if (AcpiGbl_DbOpt_Verbose && AcpiGbl_PreviousOp) > + { > + /* Dump the entire statement in AML byte code */ > > + if (Op->Common.Aml > AcpiGbl_PreviousOp->Common.Aml) > + { > + AcpiOsPrintf ("\n"); > + AcpiUtDumpBuffer (AcpiGbl_PreviousOp->Common.Aml, > + (Op->Common.Aml - AcpiGbl_PreviousOp->Common.Aml), > + DB_BYTE_DISPLAY, 0); > + AcpiDmIndent (Level); > + } > + } > + AcpiGbl_PreviousOp = Op; > > if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) > { > @@ -499,10 +517,12 @@ AcpiDmDescendingOp ( > > if (Info->WalkState) > { > + AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, > + Info->WalkState->ParserState.AmlStart); > VERBOSE_PRINT ((DB_FULL_OP_INFO, > (Info->WalkState->MethodNode ? > Info->WalkState->MethodNode->Name.Ascii : " "), > - Op->Common.AmlOffset, (UINT32) Op->Common.AmlOpcode)); > + AmlOffset, (UINT32) Op->Common.AmlOpcode)); > } > > if (Op->Common.AmlOpcode == AML_SCOPE_OP) > diff --git a/src/acpica/source/components/dispatcher/dsargs.c b/src/acpica/source/components/dispatcher/dsargs.c > index 8acb5dc..344e55e 100644 > --- a/src/acpica/source/components/dispatcher/dsargs.c > +++ b/src/acpica/source/components/dispatcher/dsargs.c > @@ -166,7 +166,7 @@ AcpiDsExecuteArguments ( > > /* Allocate a new parser op to be the root of the parsed tree */ > > - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); > + Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart); > if (!Op) > { > return_ACPI_STATUS (AE_NO_MEMORY); > @@ -213,7 +213,7 @@ AcpiDsExecuteArguments ( > > /* Evaluate the deferred arguments */ > > - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); > + Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart); > if (!Op) > { > return_ACPI_STATUS (AE_NO_MEMORY); > diff --git a/src/acpica/source/components/dispatcher/dsdebug.c b/src/acpica/source/components/dispatcher/dsdebug.c > new file mode 100644 > index 0000000..8c4a7ed > --- /dev/null > +++ b/src/acpica/source/components/dispatcher/dsdebug.c > @@ -0,0 +1,321 @@ > +/****************************************************************************** > + * > + * Module Name: dsdebug - Parser/Interpreter interface - debugging > + * > + *****************************************************************************/ > + > +/****************************************************************************** > + * > + * 1. Copyright Notice > + * > + * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp. > + * All rights reserved. > + * > + * 2. License > + * > + * 2.1. This is your license from Intel Corp. under its intellectual property > + * rights. You may have additional license terms from the party that provided > + * you this software, covering your right to use that party's intellectual > + * property rights. > + * > + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a > + * copy of the source code appearing in this file ("Covered Code") an > + * irrevocable, perpetual, worldwide license under Intel's copyrights in the > + * base code distributed originally by Intel ("Original Intel Code") to copy, > + * make derivatives, distribute, use and display any portion of the Covered > + * Code in any form, with the right to sublicense such rights; and > + * > + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent > + * license (with the right to sublicense), under only those claims of Intel > + * patents that are infringed by the Original Intel Code, to make, use, sell, > + * offer to sell, and import the Covered Code and derivative works thereof > + * solely to the minimum extent necessary to exercise the above copyright > + * license, and in no event shall the patent license extend to any additions > + * to or modifications of the Original Intel Code. No other license or right > + * is granted directly or by implication, estoppel or otherwise; > + * > + * The above copyright and patent license is granted only if the following > + * conditions are met: > + * > + * 3. Conditions > + * > + * 3.1. Redistribution of Source with Rights to Further Distribute Source. > + * Redistribution of source code of any substantial portion of the Covered > + * Code or modification with rights to further distribute source must include > + * the above Copyright Notice, the above License, this list of Conditions, > + * and the following Disclaimer and Export Compliance provision. In addition, > + * Licensee must cause all Covered Code to which Licensee contributes to > + * contain a file documenting the changes Licensee made to create that Covered > + * Code and the date of any change. Licensee must include in that file the > + * documentation of any changes made by any predecessor Licensee. Licensee > + * must include a prominent statement that the modification is derived, > + * directly or indirectly, from Original Intel Code. > + * > + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. > + * Redistribution of source code of any substantial portion of the Covered > + * Code or modification without rights to further distribute source must > + * include the following Disclaimer and Export Compliance provision in the > + * documentation and/or other materials provided with distribution. In > + * addition, Licensee may not authorize further sublicense of source of any > + * portion of the Covered Code, and must include terms to the effect that the > + * license from Licensee to its licensee is limited to the intellectual > + * property embodied in the software Licensee provides to its licensee, and > + * not to intellectual property embodied in modifications its licensee may > + * make. > + * > + * 3.3. Redistribution of Executable. Redistribution in executable form of any > + * substantial portion of the Covered Code or modification must reproduce the > + * above Copyright Notice, and the following Disclaimer and Export Compliance > + * provision in the documentation and/or other materials provided with the > + * distribution. > + * > + * 3.4. Intel retains all right, title, and interest in and to the Original > + * Intel Code. > + * > + * 3.5. Neither the name Intel nor any other trademark owned or controlled by > + * Intel shall be used in advertising or otherwise to promote the sale, use or > + * other dealings in products derived from or relating to the Covered Code > + * without prior written authorization from Intel. > + * > + * 4. Disclaimer and Export Compliance > + * > + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED > + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE > + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, > + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY > + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY > + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A > + * PARTICULAR PURPOSE. > + * > + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES > + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR > + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, > + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY > + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL > + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS > + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY > + * LIMITED REMEDY. > + * > + * 4.3. Licensee shall not export, either directly or indirectly, any of this > + * software or system incorporating such software without first obtaining any > + * required license or other approval from the U. S. Department of Commerce or > + * any other agency or department of the United States Government. In the > + * event Licensee exports any such software from the United States or > + * re-exports any such software from a foreign destination, Licensee shall > + * ensure that the distribution and export/re-export of the software is in > + * compliance with all laws, regulations, orders, or other restrictions of the > + * U.S. Export Administration Regulations. Licensee agrees that neither it nor > + * any of its subsidiaries will export/re-export any technical data, process, > + * software, or service, directly or indirectly, to any country for which the > + * United States government or any agency thereof requires an export license, > + * other governmental approval, or letter of assurance, without first obtaining > + * such license, approval or letter. > + * > + *****************************************************************************/ > + > +#include "acpi.h" > +#include "accommon.h" > +#include "acdispat.h" > +#include "acnamesp.h" > +#include "acdisasm.h" > +#include "acinterp.h" > + > + > +#define _COMPONENT ACPI_DISPATCHER > + ACPI_MODULE_NAME ("dsdebug") > + > + > +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) > + > +/* Local prototypes */ > + > +static void > +AcpiDsPrintNodePathname ( > + ACPI_NAMESPACE_NODE *Node, > + const char *Message); > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiDsPrintNodePathname > + * > + * PARAMETERS: Node - Object > + * Message - Prefix message > + * > + * DESCRIPTION: Print an object's full namespace pathname > + * Manages allocation/freeing of a pathname buffer > + * > + ******************************************************************************/ > + > +static void > +AcpiDsPrintNodePathname ( > + ACPI_NAMESPACE_NODE *Node, > + const char *Message) > +{ > + ACPI_BUFFER Buffer; > + ACPI_STATUS Status; > + > + > + ACPI_FUNCTION_TRACE (DsPrintNodePathname); > + > + if (!Node) > + { > + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[NULL NAME]")); > + return_VOID; > + } > + > + /* Convert handle to full pathname and print it (with supplied message) */ > + > + Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > + > + Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE); > + if (ACPI_SUCCESS (Status)) > + { > + if (Message) > + { > + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "%s ", Message)); > + } > + > + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[%s] (Node %p)", > + (char *) Buffer.Pointer, Node)); > + ACPI_FREE (Buffer.Pointer); > + } > + > + return_VOID; > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiDsDumpMethodStack > + * > + * PARAMETERS: Status - Method execution status > + * WalkState - Current state of the parse tree walk > + * Op - Executing parse op > + * > + * RETURN: None > + * > + * DESCRIPTION: Called when a method has been aborted because of an error. > + * Dumps the method execution stack. > + * > + ******************************************************************************/ > + > +void > +AcpiDsDumpMethodStack ( > + ACPI_STATUS Status, > + ACPI_WALK_STATE *WalkState, > + ACPI_PARSE_OBJECT *Op) > +{ > + ACPI_PARSE_OBJECT *Next; > + ACPI_THREAD_STATE *Thread; > + ACPI_WALK_STATE *NextWalkState; > + ACPI_NAMESPACE_NODE *PreviousMethod = NULL; > + ACPI_OPERAND_OBJECT *MethodDesc; > + > + > + ACPI_FUNCTION_TRACE (DsDumpMethodStack); > + > + /* Ignore control codes, they are not errors */ > + > + if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL) > + { > + return_VOID; > + } > + > + /* We may be executing a deferred opcode */ > + > + if (WalkState->DeferredNode) > + { > + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, > + "Executing subtree for Buffer/Package/Region\n")); > + return_VOID; > + } > + > + /* > + * If there is no Thread, we are not actually executing a method. > + * This can happen when the iASL compiler calls the interpreter > + * to perform constant folding. > + */ > + Thread = WalkState->Thread; > + if (!Thread) > + { > + return_VOID; > + } > + > + /* Display exception and method name */ > + > + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, > + "\n**** Exception %s during execution of method ", > + AcpiFormatException (Status))); > + AcpiDsPrintNodePathname (WalkState->MethodNode, NULL); > + > + /* Display stack of executing methods */ > + > + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, > + "\n\nMethod Execution Stack:\n")); > + NextWalkState = Thread->WalkStateList; > + > + /* Walk list of linked walk states */ > + > + while (NextWalkState) > + { > + MethodDesc = NextWalkState->MethodDesc; > + if (MethodDesc) > + { > + AcpiExStopTraceMethod ( > + (ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, > + MethodDesc, WalkState); > + } > + > + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, > + " Method [%4.4s] executing: ", > + AcpiUtGetNodeName (NextWalkState->MethodNode))); > + > + /* First method is the currently executing method */ > + > + if (NextWalkState == WalkState) > + { > + if (Op) > + { > + /* Display currently executing ASL statement */ > + > + Next = Op->Common.Next; > + Op->Common.Next = NULL; > + > +#ifdef ACPI_DISASSEMBLER > + AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX); > +#endif > + Op->Common.Next = Next; > + } > + } > + else > + { > + /* > + * This method has called another method > + * NOTE: the method call parse subtree is already deleted at this > + * point, so we cannot disassemble the method invocation. > + */ > + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Call to method ")); > + AcpiDsPrintNodePathname (PreviousMethod, NULL); > + } > + > + PreviousMethod = NextWalkState->MethodNode; > + NextWalkState = NextWalkState->Next; > + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "\n")); > + } > + > + return_VOID; > +} > + > +#else > + > +void > +AcpiDsDumpMethodStack ( > + ACPI_STATUS Status, > + ACPI_WALK_STATE *WalkState, > + ACPI_PARSE_OBJECT *Op) > +{ > + return; > +} > + > +#endif > diff --git a/src/acpica/source/components/dispatcher/dsmethod.c b/src/acpica/source/components/dispatcher/dsmethod.c > index 2e37795..10c3548 100644 > --- a/src/acpica/source/components/dispatcher/dsmethod.c > +++ b/src/acpica/source/components/dispatcher/dsmethod.c > @@ -118,9 +118,9 @@ > #include "acdispat.h" > #include "acinterp.h" > #include "acnamesp.h" > -#include "acdisasm.h" > #include "acparser.h" > #include "amlcode.h" > +#include "acdebug.h" > > > #define _COMPONENT ACPI_DISPATCHER > @@ -181,7 +181,7 @@ AcpiDsAutoSerializeMethod ( > > /* Create/Init a root op for the method parse tree */ > > - Op = AcpiPsAllocOp (AML_METHOD_OP); > + Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart); > if (!Op) > { > return_ACPI_STATUS (AE_NO_MEMORY); > @@ -285,7 +285,7 @@ AcpiDsDetectNamedOpcodes ( > * RETURN: Status > * > * DESCRIPTION: Called on method error. Invoke the global exception handler if > - * present, dump the method data if the disassembler is configured > + * present, dump the method data if the debugger is configured > * > * Note: Allows the exception handler to change the status code > * > @@ -296,6 +296,9 @@ AcpiDsMethodError ( > ACPI_STATUS Status, > ACPI_WALK_STATE *WalkState) > { > + UINT32 AmlOffset; > + > + > ACPI_FUNCTION_ENTRY (); > > > @@ -319,23 +322,28 @@ AcpiDsMethodError ( > * Handler can map the exception code to anything it wants, including > * AE_OK, in which case the executing method will not be aborted. > */ > + AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, > + WalkState->ParserState.AmlStart); > + > Status = AcpiGbl_ExceptionHandler (Status, > WalkState->MethodNode ? > WalkState->MethodNode->Name.Integer : 0, > - WalkState->Opcode, WalkState->AmlOffset, NULL); > + WalkState->Opcode, AmlOffset, NULL); > AcpiExEnterInterpreter (); > } > > AcpiDsClearImplicitReturn (WalkState); > > -#ifdef ACPI_DISASSEMBLER > if (ACPI_FAILURE (Status)) > { > - /* Display method locals/args if disassembler is present */ > + AcpiDsDumpMethodStack (Status, WalkState, WalkState->Op); > > - AcpiDmDumpMethodInfo (Status, WalkState, WalkState->Op); > - } > + /* Display method locals/args if debugger is present */ > + > +#ifdef ACPI_DEBUGGER > + AcpiDbDumpMethodInfo (Status, WalkState); > #endif > + } > > return (Status); > } > @@ -421,6 +429,8 @@ AcpiDsBeginMethodExecution ( > return_ACPI_STATUS (AE_NULL_ENTRY); > } > > + AcpiExStartTraceMethod (MethodNode, ObjDesc, WalkState); > + > /* Prevent wraparound of thread count */ > > if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX) > @@ -682,10 +692,7 @@ Cleanup: > /* On error, we must terminate the method properly */ > > AcpiDsTerminateControlMethod (ObjDesc, NextWalkState); > - if (NextWalkState) > - { > - AcpiDsDeleteWalkState (NextWalkState); > - } > + AcpiDsDeleteWalkState (NextWalkState); > > return_ACPI_STATUS (Status); > } > @@ -942,5 +949,8 @@ AcpiDsTerminateControlMethod ( > } > } > > + AcpiExStopTraceMethod ((ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, > + MethodDesc, WalkState); > + > return_VOID; > } > diff --git a/src/acpica/source/components/dispatcher/dswload.c b/src/acpica/source/components/dispatcher/dswload.c > index a1327ba..a984075 100644 > --- a/src/acpica/source/components/dispatcher/dswload.c > +++ b/src/acpica/source/components/dispatcher/dswload.c > @@ -470,7 +470,7 @@ AcpiDsLoad1BeginOp ( > { > /* Create a new op */ > > - Op = AcpiPsAllocOp (WalkState->Opcode); > + Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml); > if (!Op) > { > return_ACPI_STATUS (AE_NO_MEMORY); > diff --git a/src/acpica/source/components/dispatcher/dswload2.c b/src/acpica/source/components/dispatcher/dswload2.c > index 312b2cd..d5f9b1c 100644 > --- a/src/acpica/source/components/dispatcher/dswload2.c > +++ b/src/acpica/source/components/dispatcher/dswload2.c > @@ -416,7 +416,7 @@ AcpiDsLoad2BeginOp ( > { > /* Create a new op */ > > - Op = AcpiPsAllocOp (WalkState->Opcode); > + Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml); > if (!Op) > { > return_ACPI_STATUS (AE_NO_MEMORY); > diff --git a/src/acpica/source/components/executer/excreate.c b/src/acpica/source/components/executer/excreate.c > index 90a3632..9c7ffc1 100644 > --- a/src/acpica/source/components/executer/excreate.c > +++ b/src/acpica/source/components/executer/excreate.c > @@ -599,6 +599,7 @@ AcpiExCreateMethod ( > > ObjDesc->Method.AmlStart = AmlStart; > ObjDesc->Method.AmlLength = AmlLength; > + ObjDesc->Method.Node = Operand[0]; > > /* > * Disassemble the method flags. Split off the ArgCount, Serialized > diff --git a/src/acpica/source/components/executer/exdebug.c b/src/acpica/source/components/executer/exdebug.c > index 79ca96c..00ec43f 100644 > --- a/src/acpica/source/components/executer/exdebug.c > +++ b/src/acpica/source/components/executer/exdebug.c > @@ -115,13 +115,26 @@ > > #include "acpi.h" > #include "accommon.h" > +#include "acnamesp.h" > #include "acinterp.h" > +#include "acparser.h" > > > #define _COMPONENT ACPI_EXECUTER > ACPI_MODULE_NAME ("exdebug") > > > +static ACPI_OPERAND_OBJECT *AcpiGbl_TraceMethodObject = NULL; > + > +/* Local prototypes */ > + > +#ifdef ACPI_DEBUG_OUTPUT > +static const char * > +AcpiExGetTraceEventName ( > + ACPI_TRACE_EVENT_TYPE Type); > +#endif > + > + > #ifndef ACPI_NO_ERROR_MESSAGES > /******************************************************************************* > * > @@ -386,3 +399,362 @@ AcpiExDoDebugObject ( > return_VOID; > } > #endif > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiExInterpreterTraceEnabled > + * > + * PARAMETERS: Name - Whether method name should be matched, > + * this should be checked before starting > + * the tracer > + * > + * RETURN: TRUE if interpreter trace is enabled. > + * > + * DESCRIPTION: Check whether interpreter trace is enabled > + * > + ******************************************************************************/ > + > +static BOOLEAN > +AcpiExInterpreterTraceEnabled ( > + char *Name) > +{ > + > + /* Check if tracing is enabled */ > + > + if (!(AcpiGbl_TraceFlags & ACPI_TRACE_ENABLED)) > + { > + return (FALSE); > + } > + > + /* > + * Check if tracing is filtered: > + * > + * 1. If the tracer is started, AcpiGbl_TraceMethodObject should have > + * been filled by the trace starter > + * 2. If the tracer is not started, AcpiGbl_TraceMethodName should be > + * matched if it is specified > + * 3. If the tracer is oneshot style, AcpiGbl_TraceMethodName should > + * not be cleared by the trace stopper during the first match > + */ > + if (AcpiGbl_TraceMethodObject) > + { > + return (TRUE); > + } > + if (Name && > + (AcpiGbl_TraceMethodName && > + strcmp (AcpiGbl_TraceMethodName, Name))) > + { > + return (FALSE); > + } > + if ((AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) && > + !AcpiGbl_TraceMethodName) > + { > + return (FALSE); > + } > + > + return (TRUE); > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiExGetTraceEventName > + * > + * PARAMETERS: Type - Trace event type > + * > + * RETURN: Trace event name. > + * > + * DESCRIPTION: Used to obtain the full trace event name. > + * > + ******************************************************************************/ > + > +#ifdef ACPI_DEBUG_OUTPUT > + > +static const char * > +AcpiExGetTraceEventName ( > + ACPI_TRACE_EVENT_TYPE Type) > +{ > + switch (Type) > + { > + case ACPI_TRACE_AML_METHOD: > + > + return "Method"; > + > + case ACPI_TRACE_AML_OPCODE: > + > + return "Opcode"; > + > + case ACPI_TRACE_AML_REGION: > + > + return "Region"; > + > + default: > + > + return ""; > + } > +} > + > +#endif > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiExTracePoint > + * > + * PARAMETERS: Type - Trace event type > + * Begin - TRUE if before execution > + * Aml - Executed AML address > + * Pathname - Object path > + * > + * RETURN: None > + * > + * DESCRIPTION: Internal interpreter execution trace. > + * > + ******************************************************************************/ > + > +void > +AcpiExTracePoint ( > + ACPI_TRACE_EVENT_TYPE Type, > + BOOLEAN Begin, > + UINT8 *Aml, > + char *Pathname) > +{ > + > + ACPI_FUNCTION_NAME (ExTracePoint); > + > + > + if (Pathname) > + { > + ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT, > + "%s %s [0x%p:%s] execution.\n", > + AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End", > + Aml, Pathname)); > + } > + else > + { > + ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT, > + "%s %s [0x%p] execution.\n", > + AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End", > + Aml)); > + } > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiExStartTraceMethod > + * > + * PARAMETERS: MethodNode - Node of the method > + * ObjDesc - The method object > + * WalkState - current state, NULL if not yet executing > + * a method. > + * > + * RETURN: None > + * > + * DESCRIPTION: Start control method execution trace > + * > + ******************************************************************************/ > + > +void > +AcpiExStartTraceMethod ( > + ACPI_NAMESPACE_NODE *MethodNode, > + ACPI_OPERAND_OBJECT *ObjDesc, > + ACPI_WALK_STATE *WalkState) > +{ > + ACPI_STATUS Status; > + char *Pathname = NULL; > + BOOLEAN Enabled = FALSE; > + > + > + ACPI_FUNCTION_NAME (ExStartTraceMethod); > + > + > + if (MethodNode) > + { > + Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); > + } > + > + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); > + if (ACPI_FAILURE (Status)) > + { > + goto Exit; > + } > + > + Enabled = AcpiExInterpreterTraceEnabled (Pathname); > + if (Enabled && !AcpiGbl_TraceMethodObject) > + { > + AcpiGbl_TraceMethodObject = ObjDesc; > + AcpiGbl_OriginalDbgLevel = AcpiDbgLevel; > + AcpiGbl_OriginalDbgLayer = AcpiDbgLayer; > + AcpiDbgLevel = ACPI_TRACE_LEVEL_ALL; > + AcpiDbgLayer = ACPI_TRACE_LAYER_ALL; > + > + if (AcpiGbl_TraceDbgLevel) > + { > + AcpiDbgLevel = AcpiGbl_TraceDbgLevel; > + } > + if (AcpiGbl_TraceDbgLayer) > + { > + AcpiDbgLayer = AcpiGbl_TraceDbgLayer; > + } > + } > + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); > + > +Exit: > + if (Enabled) > + { > + ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, TRUE, > + ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); > + } > + if (Pathname) > + { > + ACPI_FREE (Pathname); > + } > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiExStopTraceMethod > + * > + * PARAMETERS: MethodNode - Node of the method > + * ObjDesc - The method object > + * WalkState - current state, NULL if not yet executing > + * a method. > + * > + * RETURN: None > + * > + * DESCRIPTION: Stop control method execution trace > + * > + ******************************************************************************/ > + > +void > +AcpiExStopTraceMethod ( > + ACPI_NAMESPACE_NODE *MethodNode, > + ACPI_OPERAND_OBJECT *ObjDesc, > + ACPI_WALK_STATE *WalkState) > +{ > + ACPI_STATUS Status; > + char *Pathname = NULL; > + BOOLEAN Enabled; > + > + > + ACPI_FUNCTION_NAME (ExStopTraceMethod); > + > + > + if (MethodNode) > + { > + Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); > + } > + > + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); > + if (ACPI_FAILURE (Status)) > + { > + goto ExitPath; > + } > + > + Enabled = AcpiExInterpreterTraceEnabled (NULL); > + > + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); > + > + if (Enabled) > + { > + ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, FALSE, > + ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); > + } > + > + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); > + if (ACPI_FAILURE (Status)) > + { > + goto ExitPath; > + } > + > + /* Check whether the tracer should be stopped */ > + > + if (AcpiGbl_TraceMethodObject == ObjDesc) > + { > + /* Disable further tracing if type is one-shot */ > + > + if (AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) > + { > + AcpiGbl_TraceMethodName = NULL; > + } > + > + AcpiDbgLevel = AcpiGbl_OriginalDbgLevel; > + AcpiDbgLayer = AcpiGbl_OriginalDbgLayer; > + AcpiGbl_TraceMethodObject = NULL; > + } > + > + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); > + > +ExitPath: > + if (Pathname) > + { > + ACPI_FREE (Pathname); > + } > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiExStartTraceOpcode > + * > + * PARAMETERS: Op - The parser opcode object > + * WalkState - current state, NULL if not yet executing > + * a method. > + * > + * RETURN: None > + * > + * DESCRIPTION: Start opcode execution trace > + * > + ******************************************************************************/ > + > +void > +AcpiExStartTraceOpcode ( > + ACPI_PARSE_OBJECT *Op, > + ACPI_WALK_STATE *WalkState) > +{ > + > + ACPI_FUNCTION_NAME (ExStartTraceOpcode); > + > + > + if (AcpiExInterpreterTraceEnabled (NULL) && > + (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE)) > + { > + ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, TRUE, > + Op->Common.Aml, Op->Common.AmlOpName); > + } > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiExStopTraceOpcode > + * > + * PARAMETERS: Op - The parser opcode object > + * WalkState - current state, NULL if not yet executing > + * a method. > + * > + * RETURN: None > + * > + * DESCRIPTION: Stop opcode execution trace > + * > + ******************************************************************************/ > + > +void > +AcpiExStopTraceOpcode ( > + ACPI_PARSE_OBJECT *Op, > + ACPI_WALK_STATE *WalkState) > +{ > + > + ACPI_FUNCTION_NAME (ExStopTraceOpcode); > + > + > + if (AcpiExInterpreterTraceEnabled (NULL) && > + (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE)) > + { > + ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, FALSE, > + Op->Common.Aml, Op->Common.AmlOpName); > + } > +} > diff --git a/src/acpica/source/components/executer/exdump.c b/src/acpica/source/components/executer/exdump.c > index bf9df64..c13839b 100644 > --- a/src/acpica/source/components/executer/exdump.c > +++ b/src/acpica/source/components/executer/exdump.c > @@ -1111,7 +1111,8 @@ AcpiExDumpReferenceObj ( > { > AcpiOsPrintf (" %p ", ObjDesc->Reference.Node); > > - Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf); > + Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, > + &RetBuf, FALSE); > if (ACPI_FAILURE (Status)) > { > AcpiOsPrintf (" Could not convert name to pathname\n"); > diff --git a/src/acpica/source/components/namespace/nsnames.c b/src/acpica/source/components/namespace/nsnames.c > index 2c7d9b9..3ca04f0 100644 > --- a/src/acpica/source/components/namespace/nsnames.c > +++ b/src/acpica/source/components/namespace/nsnames.c > @@ -125,82 +125,6 @@ > > /******************************************************************************* > * > - * FUNCTION: AcpiNsBuildExternalPath > - * > - * PARAMETERS: Node - NS node whose pathname is needed > - * Size - Size of the pathname > - * *NameBuffer - Where to return the pathname > - * > - * RETURN: Status > - * Places the pathname into the NameBuffer, in external format > - * (name segments separated by path separators) > - * > - * DESCRIPTION: Generate a full pathaname > - * > - ******************************************************************************/ > - > -ACPI_STATUS > -AcpiNsBuildExternalPath ( > - ACPI_NAMESPACE_NODE *Node, > - ACPI_SIZE Size, > - char *NameBuffer) > -{ > - ACPI_SIZE Index; > - ACPI_NAMESPACE_NODE *ParentNode; > - > - > - ACPI_FUNCTION_ENTRY (); > - > - > - /* Special case for root */ > - > - Index = Size - 1; > - if (Index < ACPI_NAME_SIZE) > - { > - NameBuffer[0] = AML_ROOT_PREFIX; > - NameBuffer[1] = 0; > - return (AE_OK); > - } > - > - /* Store terminator byte, then build name backwards */ > - > - ParentNode = Node; > - NameBuffer[Index] = 0; > - > - while ((Index > ACPI_NAME_SIZE) && (ParentNode != AcpiGbl_RootNode)) > - { > - Index -= ACPI_NAME_SIZE; > - > - /* Put the name into the buffer */ > - > - ACPI_MOVE_32_TO_32 ((NameBuffer + Index), &ParentNode->Name); > - ParentNode = ParentNode->Parent; > - > - /* Prefix name with the path separator */ > - > - Index--; > - NameBuffer[Index] = ACPI_PATH_SEPARATOR; > - } > - > - /* Overwrite final separator with the root prefix character */ > - > - NameBuffer[Index] = AML_ROOT_PREFIX; > - > - if (Index != 0) > - { > - ACPI_ERROR ((AE_INFO, > - "Could not construct external pathname; index=%u, size=%u, Path=%s", > - (UINT32) Index, (UINT32) Size, &NameBuffer[Size])); > - > - return (AE_BAD_PARAMETER); > - } > - > - return (AE_OK); > -} > - > - > -/******************************************************************************* > - * > * FUNCTION: AcpiNsGetExternalPathname > * > * PARAMETERS: Node - Namespace node whose pathname is needed > @@ -218,39 +142,13 @@ char * > AcpiNsGetExternalPathname ( > ACPI_NAMESPACE_NODE *Node) > { > - ACPI_STATUS Status; > char *NameBuffer; > - ACPI_SIZE Size; > > > ACPI_FUNCTION_TRACE_PTR (NsGetExternalPathname, Node); > > > - /* Calculate required buffer size based on depth below root */ > - > - Size = AcpiNsGetPathnameLength (Node); > - if (!Size) > - { > - return_PTR (NULL); > - } > - > - /* Allocate a buffer to be returned to caller */ > - > - NameBuffer = ACPI_ALLOCATE_ZEROED (Size); > - if (!NameBuffer) > - { > - ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size)); > - return_PTR (NULL); > - } > - > - /* Build the path in the allocated buffer */ > - > - Status = AcpiNsBuildExternalPath (Node, Size, NameBuffer); > - if (ACPI_FAILURE (Status)) > - { > - ACPI_FREE (NameBuffer); > - return_PTR (NULL); > - } > + NameBuffer = AcpiNsGetNormalizedPathname (Node, FALSE); > > return_PTR (NameBuffer); > } > @@ -273,38 +171,14 @@ AcpiNsGetPathnameLength ( > ACPI_NAMESPACE_NODE *Node) > { > ACPI_SIZE Size; > - ACPI_NAMESPACE_NODE *NextNode; > > > ACPI_FUNCTION_ENTRY (); > > > - /* > - * Compute length of pathname as 5 * number of name segments. > - * Go back up the parent tree to the root > - */ > - Size = 0; > - NextNode = Node; > + Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, FALSE); > > - while (NextNode && (NextNode != AcpiGbl_RootNode)) > - { > - if (ACPI_GET_DESCRIPTOR_TYPE (NextNode) != ACPI_DESC_TYPE_NAMED) > - { > - ACPI_ERROR ((AE_INFO, > - "Invalid Namespace Node (%p) while traversing namespace", > - NextNode)); > - return (0); > - } > - Size += ACPI_PATH_SEGMENT_LENGTH; > - NextNode = NextNode->Parent; > - } > - > - if (!Size) > - { > - Size = 1; /* Root node case */ > - } > - > - return (Size + 1); /* +1 for null string terminator */ > + return (Size); > } > > > @@ -315,6 +189,8 @@ AcpiNsGetPathnameLength ( > * PARAMETERS: TargetHandle - Handle of named object whose name is > * to be found > * Buffer - Where the pathname is returned > + * NoTrailing - Remove trailing '_' for each name > + * segment > * > * RETURN: Status, Buffer is filled with pathname if status is AE_OK > * > @@ -325,7 +201,8 @@ AcpiNsGetPathnameLength ( > ACPI_STATUS > AcpiNsHandleToPathname ( > ACPI_HANDLE TargetHandle, > - ACPI_BUFFER *Buffer) > + ACPI_BUFFER *Buffer, > + BOOLEAN NoTrailing) > { > ACPI_STATUS Status; > ACPI_NAMESPACE_NODE *Node; > @@ -343,7 +220,7 @@ AcpiNsHandleToPathname ( > > /* Determine size required for the caller buffer */ > > - RequiredSize = AcpiNsGetPathnameLength (Node); > + RequiredSize = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing); > if (!RequiredSize) > { > return_ACPI_STATUS (AE_BAD_PARAMETER); > @@ -359,7 +236,8 @@ AcpiNsHandleToPathname ( > > /* Build the path in the caller buffer */ > > - Status = AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer); > + (void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer, > + RequiredSize, NoTrailing); > if (ACPI_FAILURE (Status)) > { > return_ACPI_STATUS (Status); > @@ -369,3 +247,169 @@ AcpiNsHandleToPathname ( > (char *) Buffer->Pointer, (UINT32) RequiredSize)); > return_ACPI_STATUS (AE_OK); > } > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiNsBuildNormalizedPath > + * > + * PARAMETERS: Node - Namespace node > + * FullPath - Where the path name is returned > + * PathSize - Size of returned path name buffer > + * NoTrailing - Remove trailing '_' from each name segment > + * > + * RETURN: Return 1 if the AML path is empty, otherwise returning (length > + * of pathname + 1) which means the 'FullPath' contains a trailing > + * null. > + * > + * DESCRIPTION: Build and return a full namespace pathname. > + * Note that if the size of 'FullPath' isn't large enough to > + * contain the namespace node's path name, the actual required > + * buffer length is returned, and it should be greater than > + * 'PathSize'. So callers are able to check the returning value > + * to determine the buffer size of 'FullPath'. > + * > + ******************************************************************************/ > + > +UINT32 > +AcpiNsBuildNormalizedPath ( > + ACPI_NAMESPACE_NODE *Node, > + char *FullPath, > + UINT32 PathSize, > + BOOLEAN NoTrailing) > +{ > + UINT32 Length = 0, i; > + char Name[ACPI_NAME_SIZE]; > + BOOLEAN DoNoTrailing; > + char c, *Left, *Right; > + ACPI_NAMESPACE_NODE *NextNode; > + > + > + ACPI_FUNCTION_TRACE_PTR (NsBuildNormalizedPath, Node); > + > + > +#define ACPI_PATH_PUT8(Path, Size, Byte, Length) \ > + do { \ > + if ((Length) < (Size)) \ > + { \ > + (Path)[(Length)] = (Byte); \ > + } \ > + (Length)++; \ > + } while (0) > + > + /* > + * Make sure the PathSize is correct, so that we don't need to > + * validate both FullPath and PathSize. > + */ > + if (!FullPath) > + { > + PathSize = 0; > + } > + > + if (!Node) > + { > + goto BuildTrailingNull; > + } > + > + NextNode = Node; > + while (NextNode && NextNode != AcpiGbl_RootNode) > + { > + if (NextNode != Node) > + { > + ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length); > + } > + ACPI_MOVE_32_TO_32 (Name, &NextNode->Name); > + DoNoTrailing = NoTrailing; > + for (i = 0; i < 4; i++) > + { > + c = Name[4-i-1]; > + if (DoNoTrailing && c != '_') > + { > + DoNoTrailing = FALSE; > + } > + if (!DoNoTrailing) > + { > + ACPI_PATH_PUT8(FullPath, PathSize, c, Length); > + } > + } > + NextNode = NextNode->Parent; > + } > + ACPI_PATH_PUT8(FullPath, PathSize, AML_ROOT_PREFIX, Length); > + > + /* Reverse the path string */ > + > + if (Length <= PathSize) > + { > + Left = FullPath; > + Right = FullPath+Length-1; > + while (Left < Right) > + { > + c = *Left; > + *Left++ = *Right; > + *Right-- = c; > + } > + } > + > + /* Append the trailing null */ > + > +BuildTrailingNull: > + ACPI_PATH_PUT8(FullPath, PathSize, '\0', Length); > + > +#undef ACPI_PATH_PUT8 > + > + return_UINT32 (Length); > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiNsGetNormalizedPathname > + * > + * PARAMETERS: Node - Namespace node whose pathname is needed > + * NoTrailing - Remove trailing '_' from each name segment > + * > + * RETURN: Pointer to storage containing the fully qualified name of > + * the node, In external format (name segments separated by path > + * separators.) > + * > + * DESCRIPTION: Used to obtain the full pathname to a namespace node, usually > + * for error and debug statements. All trailing '_' will be > + * removed from the full pathname if 'NoTrailing' is specified.. > + * > + ******************************************************************************/ > + > +char * > +AcpiNsGetNormalizedPathname ( > + ACPI_NAMESPACE_NODE *Node, > + BOOLEAN NoTrailing) > +{ > + char *NameBuffer; > + ACPI_SIZE Size; > + > + > + ACPI_FUNCTION_TRACE_PTR (NsGetNormalizedPathname, Node); > + > + > + /* Calculate required buffer size based on depth below root */ > + > + Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing); > + if (!Size) > + { > + return_PTR (NULL); > + } > + > + /* Allocate a buffer to be returned to caller */ > + > + NameBuffer = ACPI_ALLOCATE_ZEROED (Size); > + if (!NameBuffer) > + { > + ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size)); > + return_PTR (NULL); > + } > + > + /* Build the path in the allocated buffer */ > + > + (void) AcpiNsBuildNormalizedPath (Node, NameBuffer, Size, NoTrailing); > + > + return_PTR (NameBuffer); > +} > diff --git a/src/acpica/source/components/namespace/nsparse.c b/src/acpica/source/components/namespace/nsparse.c > index 481e7c3..26dd9f3 100644 > --- a/src/acpica/source/components/namespace/nsparse.c > +++ b/src/acpica/source/components/namespace/nsparse.c > @@ -156,6 +156,22 @@ AcpiNsOneCompleteParse ( > ACPI_FUNCTION_TRACE (NsOneCompleteParse); > > > + Status = AcpiGetTableByIndex (TableIndex, &Table); > + if (ACPI_FAILURE (Status)) > + { > + return_ACPI_STATUS (Status); > + } > + > + /* Table must consist of at least a complete header */ > + > + if (Table->Length < sizeof (ACPI_TABLE_HEADER)) > + { > + return_ACPI_STATUS (AE_BAD_HEADER); > + } > + > + AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); > + AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); > + > Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); > if (ACPI_FAILURE (Status)) > { > @@ -164,7 +180,7 @@ AcpiNsOneCompleteParse ( > > /* Create and init a Root Node */ > > - ParseRoot = AcpiPsCreateScopeOp (); > + ParseRoot = AcpiPsCreateScopeOp (AmlStart); > if (!ParseRoot) > { > return_ACPI_STATUS (AE_NO_MEMORY); > @@ -179,26 +195,12 @@ AcpiNsOneCompleteParse ( > return_ACPI_STATUS (AE_NO_MEMORY); > } > > - Status = AcpiGetTableByIndex (TableIndex, &Table); > + Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, > + AmlStart, AmlLength, NULL, (UINT8) PassNumber); > if (ACPI_FAILURE (Status)) > { > AcpiDsDeleteWalkState (WalkState); > - AcpiPsFreeOp (ParseRoot); > - return_ACPI_STATUS (Status); > - } > - > - /* Table must consist of at least a complete header */ > - > - if (Table->Length < sizeof (ACPI_TABLE_HEADER)) > - { > - Status = AE_BAD_HEADER; > - } > - else > - { > - AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); > - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); > - Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, > - AmlStart, AmlLength, NULL, (UINT8) PassNumber); > + goto Cleanup; > } > > /* Found OSDT table, enable the namespace override feature */ > @@ -209,12 +211,6 @@ AcpiNsOneCompleteParse ( > WalkState->NamespaceOverride = TRUE; > } > > - if (ACPI_FAILURE (Status)) > - { > - AcpiDsDeleteWalkState (WalkState); > - goto Cleanup; > - } > - > /* StartNode is the default location to load the table */ > > if (StartNode && StartNode != AcpiGbl_RootNode) > diff --git a/src/acpica/source/components/namespace/nsutils.c b/src/acpica/source/components/namespace/nsutils.c > index c1187ba..03b9d18 100644 > --- a/src/acpica/source/components/namespace/nsutils.c > +++ b/src/acpica/source/components/namespace/nsutils.c > @@ -162,7 +162,7 @@ AcpiNsPrintNodePathname ( > > Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > > - Status = AcpiNsHandleToPathname (Node, &Buffer); > + Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE); > if (ACPI_SUCCESS (Status)) > { > if (Message) > diff --git a/src/acpica/source/components/namespace/nsxfname.c b/src/acpica/source/components/namespace/nsxfname.c > index d3f411b..51cc4f4 100644 > --- a/src/acpica/source/components/namespace/nsxfname.c > +++ b/src/acpica/source/components/namespace/nsxfname.c > @@ -265,11 +265,13 @@ AcpiGetName ( > return (Status); > } > > - if (NameType == ACPI_FULL_PATHNAME) > + if (NameType == ACPI_FULL_PATHNAME || > + NameType == ACPI_FULL_PATHNAME_NO_TRAILING) > { > /* Get the full pathname (From the namespace root) */ > > - Status = AcpiNsHandleToPathname (Handle, Buffer); > + Status = AcpiNsHandleToPathname (Handle, Buffer, > + NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE); > return (Status); > } > > diff --git a/src/acpica/source/components/parser/psargs.c b/src/acpica/source/components/parser/psargs.c > index 2453ab1..cbb24a9 100644 > --- a/src/acpica/source/components/parser/psargs.c > +++ b/src/acpica/source/components/parser/psargs.c > @@ -388,7 +388,7 @@ AcpiPsGetNextNamepath ( > ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, > "Control Method - %p Desc %p Path=%p\n", Node, MethodDesc, Path)); > > - NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); > + NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, Start); > if (!NameOp) > { > return_ACPI_STATUS (AE_NO_MEMORY); > @@ -596,7 +596,7 @@ static ACPI_PARSE_OBJECT * > AcpiPsGetNextField ( > ACPI_PARSE_STATE *ParserState) > { > - UINT32 AmlOffset; > + UINT8 *Aml; > ACPI_PARSE_OBJECT *Field; > ACPI_PARSE_OBJECT *Arg = NULL; > UINT16 Opcode; > @@ -612,8 +612,7 @@ AcpiPsGetNextField ( > ACPI_FUNCTION_TRACE (PsGetNextField); > > > - AmlOffset = (UINT32) ACPI_PTR_DIFF ( > - ParserState->Aml, ParserState->AmlStart); > + Aml = ParserState->Aml; > > /* Determine field type */ > > @@ -651,14 +650,12 @@ AcpiPsGetNextField ( > > /* Allocate a new field op */ > > - Field = AcpiPsAllocOp (Opcode); > + Field = AcpiPsAllocOp (Opcode, Aml); > if (!Field) > { > return_PTR (NULL); > } > > - Field->Common.AmlOffset = AmlOffset; > - > /* Decode the field type */ > > switch (Opcode) > @@ -722,6 +719,7 @@ AcpiPsGetNextField ( > * Argument for Connection operator can be either a Buffer > * (resource descriptor), or a NameString. > */ > + Aml = ParserState->Aml; > if (ACPI_GET8 (ParserState->Aml) == AML_BUFFER_OP) > { > ParserState->Aml++; > @@ -734,7 +732,7 @@ AcpiPsGetNextField ( > { > /* Non-empty list */ > > - Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP); > + Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP, Aml); > if (!Arg) > { > AcpiPsFreeOp (Field); > @@ -784,7 +782,7 @@ AcpiPsGetNextField ( > } > else > { > - Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); > + Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, Aml); > if (!Arg) > { > AcpiPsFreeOp (Field); > @@ -856,7 +854,7 @@ AcpiPsGetNextArg ( > > /* Constants, strings, and namestrings are all the same size */ > > - Arg = AcpiPsAllocOp (AML_BYTE_OP); > + Arg = AcpiPsAllocOp (AML_BYTE_OP, ParserState->Aml); > if (!Arg) > { > return_ACPI_STATUS (AE_NO_MEMORY); > @@ -908,7 +906,8 @@ AcpiPsGetNextArg ( > { > /* Non-empty list */ > > - Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP); > + Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP, > + ParserState->Aml); > if (!Arg) > { > return_ACPI_STATUS (AE_NO_MEMORY); > @@ -938,7 +937,7 @@ AcpiPsGetNextArg ( > { > /* NullName or NameString */ > > - Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); > + Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, ParserState->Aml); > if (!Arg) > { > return_ACPI_STATUS (AE_NO_MEMORY); > diff --git a/src/acpica/source/components/parser/psloop.c b/src/acpica/source/components/parser/psloop.c > index d75ac83..b7b2dcd 100644 > --- a/src/acpica/source/components/parser/psloop.c > +++ b/src/acpica/source/components/parser/psloop.c > @@ -123,6 +123,7 @@ > > #include "acpi.h" > #include "accommon.h" > +#include "acinterp.h" > #include "acparser.h" > #include "acdispat.h" > #include "amlcode.h" > @@ -206,8 +207,7 @@ AcpiPsGetArguments ( > */ > while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount) > { > - WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml, > - WalkState->ParserState.AmlStart); > + WalkState->Aml = WalkState->ParserState.Aml; > > Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState), > GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); > @@ -218,7 +218,6 @@ AcpiPsGetArguments ( > > if (Arg) > { > - Arg->Common.AmlOffset = WalkState->AmlOffset; > AcpiPsAppendArg (Op, Arg); > } > > @@ -574,15 +573,7 @@ AcpiPsParseLoop ( > continue; > } > > - Op->Common.AmlOffset = WalkState->AmlOffset; > - > - if (WalkState->OpInfo) > - { > - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, > - "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n", > - (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name, > - Op, ParserState->Aml, Op->Common.AmlOffset)); > - } > + AcpiExStartTraceOpcode (Op, WalkState); > } > > > diff --git a/src/acpica/source/components/parser/psobject.c b/src/acpica/source/components/parser/psobject.c > index a236ff5..77e9434 100644 > --- a/src/acpica/source/components/parser/psobject.c > +++ b/src/acpica/source/components/parser/psobject.c > @@ -145,12 +145,13 @@ static ACPI_STATUS > AcpiPsGetAmlOpcode ( > ACPI_WALK_STATE *WalkState) > { > + UINT32 AmlOffset; > + > > ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState); > > > - WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml, > - WalkState->ParserState.AmlStart); > + WalkState->Aml = WalkState->ParserState.Aml; > WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState)); > > /* > @@ -179,10 +180,13 @@ AcpiPsGetAmlOpcode ( > > if (WalkState->PassNumber == 2) > { > + AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, > + WalkState->ParserState.AmlStart); > + > ACPI_ERROR ((AE_INFO, > "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring", > WalkState->Opcode, > - (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER)))); > + (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER)))); > > ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48); > > @@ -194,13 +198,13 @@ AcpiPsGetAmlOpcode ( > AcpiOsPrintf ( > "/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n", > WalkState->Opcode, > - (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER))); > + (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER))); > > /* Dump the context surrounding the invalid opcode */ > > AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16), > 48, DB_BYTE_DISPLAY, > - (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16)); > + (AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16)); > AcpiOsPrintf (" */\n"); > #endif > } > @@ -385,7 +389,7 @@ AcpiPsCreateOp ( > /* Create Op structure and append to parent's argument list */ > > WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode); > - Op = AcpiPsAllocOp (WalkState->Opcode); > + Op = AcpiPsAllocOp (WalkState->Opcode, AmlOpStart); > if (!Op) > { > return_ACPI_STATUS (AE_NO_MEMORY); > diff --git a/src/acpica/source/components/parser/psparse.c b/src/acpica/source/components/parser/psparse.c > index 71c3fa0..599a766 100644 > --- a/src/acpica/source/components/parser/psparse.c > +++ b/src/acpica/source/components/parser/psparse.c > @@ -233,6 +233,8 @@ AcpiPsCompleteThisOp ( > return_ACPI_STATUS (AE_OK); /* OK for now */ > } > > + AcpiExStopTraceOpcode (Op, WalkState); > + > /* Delete this op and the subtree below it if asked to */ > > if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) || > @@ -270,7 +272,8 @@ AcpiPsCompleteThisOp ( > * These opcodes contain TermArg operands. The current > * op must be replaced by a placeholder return op > */ > - ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); > + ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP, > + Op->Common.Aml); > if (!ReplacementOp) > { > Status = AE_NO_MEMORY; > @@ -289,7 +292,8 @@ AcpiPsCompleteThisOp ( > (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP) || > (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) > { > - ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); > + ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP, > + Op->Common.Aml); > if (!ReplacementOp) > { > Status = AE_NO_MEMORY; > @@ -302,7 +306,8 @@ AcpiPsCompleteThisOp ( > (Op->Common.AmlOpcode == AML_PACKAGE_OP) || > (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) > { > - ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode); > + ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode, > + Op->Common.Aml); > if (!ReplacementOp) > { > Status = AE_NO_MEMORY; > @@ -318,7 +323,8 @@ AcpiPsCompleteThisOp ( > > default: > > - ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); > + ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP, > + Op->Common.Aml); > if (!ReplacementOp) > { > Status = AE_NO_MEMORY; > diff --git a/src/acpica/source/components/parser/psutils.c b/src/acpica/source/components/parser/psutils.c > index a36a3f3..3aa4954 100644 > --- a/src/acpica/source/components/parser/psutils.c > +++ b/src/acpica/source/components/parser/psutils.c > @@ -136,12 +136,12 @@ > > ACPI_PARSE_OBJECT * > AcpiPsCreateScopeOp ( > - void) > + UINT8 *Aml) > { > ACPI_PARSE_OBJECT *ScopeOp; > > > - ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP); > + ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP, Aml); > if (!ScopeOp) > { > return (NULL); > @@ -187,6 +187,7 @@ AcpiPsInitOp ( > * FUNCTION: AcpiPsAllocOp > * > * PARAMETERS: Opcode - Opcode that will be stored in the new Op > + * Aml - Address of the opcode > * > * RETURN: Pointer to the new Op, null on failure > * > @@ -198,7 +199,8 @@ AcpiPsInitOp ( > > ACPI_PARSE_OBJECT* > AcpiPsAllocOp ( > - UINT16 Opcode) > + UINT16 Opcode, > + UINT8 *Aml) > { > ACPI_PARSE_OBJECT *Op; > const ACPI_OPCODE_INFO *OpInfo; > @@ -245,6 +247,7 @@ AcpiPsAllocOp ( > if (Op) > { > AcpiPsInitOp (Op, Opcode); > + Op->Common.Aml = Aml; > Op->Common.Flags = Flags; > } > > diff --git a/src/acpica/source/components/parser/psxface.c b/src/acpica/source/components/parser/psxface.c > index 09833b6..eb5c018 100644 > --- a/src/acpica/source/components/parser/psxface.c > +++ b/src/acpica/source/components/parser/psxface.c > @@ -119,6 +119,7 @@ > #include "acdispat.h" > #include "acinterp.h" > #include "actables.h" > +#include "acnamesp.h" > > > #define _COMPONENT ACPI_PARSER > @@ -127,14 +128,6 @@ > /* Local Prototypes */ > > static void > -AcpiPsStartTrace ( > - ACPI_EVALUATE_INFO *Info); > - > -static void > -AcpiPsStopTrace ( > - ACPI_EVALUATE_INFO *Info); > - > -static void > AcpiPsUpdateParameterList ( > ACPI_EVALUATE_INFO *Info, > UINT16 Action); > @@ -158,7 +151,7 @@ AcpiPsUpdateParameterList ( > > ACPI_STATUS > AcpiDebugTrace ( > - char *Name, > + const char *Name, > UINT32 DebugLevel, > UINT32 DebugLayer, > UINT32 Flags) > @@ -172,128 +165,14 @@ AcpiDebugTrace ( > return (Status); > } > > - /* TBDs: Validate name, allow full path or just nameseg */ > - > - AcpiGbl_TraceMethodName = *ACPI_CAST_PTR (UINT32, Name); > + AcpiGbl_TraceMethodName = Name; > AcpiGbl_TraceFlags = Flags; > - > - if (DebugLevel) > - { > - AcpiGbl_TraceDbgLevel = DebugLevel; > - } > - if (DebugLayer) > - { > - AcpiGbl_TraceDbgLayer = DebugLayer; > - } > + AcpiGbl_TraceDbgLevel = DebugLevel; > + AcpiGbl_TraceDbgLayer = DebugLayer; > + Status = AE_OK; > > (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); > - return (AE_OK); > -} > - > - > -/******************************************************************************* > - * > - * FUNCTION: AcpiPsStartTrace > - * > - * PARAMETERS: Info - Method info struct > - * > - * RETURN: None > - * > - * DESCRIPTION: Start control method execution trace > - * > - ******************************************************************************/ > - > -static void > -AcpiPsStartTrace ( > - ACPI_EVALUATE_INFO *Info) > -{ > - ACPI_STATUS Status; > - > - > - ACPI_FUNCTION_ENTRY (); > - > - > - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); > - if (ACPI_FAILURE (Status)) > - { > - return; > - } > - > - if ((!AcpiGbl_TraceMethodName) || > - (AcpiGbl_TraceMethodName != Info->Node->Name.Integer)) > - { > - goto Exit; > - } > - > - AcpiGbl_OriginalDbgLevel = AcpiDbgLevel; > - AcpiGbl_OriginalDbgLayer = AcpiDbgLayer; > - > - AcpiDbgLevel = 0x00FFFFFF; > - AcpiDbgLayer = ACPI_UINT32_MAX; > - > - if (AcpiGbl_TraceDbgLevel) > - { > - AcpiDbgLevel = AcpiGbl_TraceDbgLevel; > - } > - if (AcpiGbl_TraceDbgLayer) > - { > - AcpiDbgLayer = AcpiGbl_TraceDbgLayer; > - } > - > - > -Exit: > - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); > -} > - > - > -/******************************************************************************* > - * > - * FUNCTION: AcpiPsStopTrace > - * > - * PARAMETERS: Info - Method info struct > - * > - * RETURN: None > - * > - * DESCRIPTION: Stop control method execution trace > - * > - ******************************************************************************/ > - > -static void > -AcpiPsStopTrace ( > - ACPI_EVALUATE_INFO *Info) > -{ > - ACPI_STATUS Status; > - > - > - ACPI_FUNCTION_ENTRY (); > - > - > - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); > - if (ACPI_FAILURE (Status)) > - { > - return; > - } > - > - if ((!AcpiGbl_TraceMethodName) || > - (AcpiGbl_TraceMethodName != Info->Node->Name.Integer)) > - { > - goto Exit; > - } > - > - /* Disable further tracing if type is one-shot */ > - > - if (AcpiGbl_TraceFlags & 1) > - { > - AcpiGbl_TraceMethodName = 0; > - AcpiGbl_TraceDbgLevel = 0; > - AcpiGbl_TraceDbgLayer = 0; > - } > - > - AcpiDbgLevel = AcpiGbl_OriginalDbgLevel; > - AcpiDbgLayer = AcpiGbl_OriginalDbgLayer; > - > -Exit: > - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); > + return (Status); > } > > > @@ -356,10 +235,6 @@ AcpiPsExecuteMethod ( > */ > AcpiPsUpdateParameterList (Info, REF_INCREMENT); > > - /* Begin tracing if requested */ > - > - AcpiPsStartTrace (Info); > - > /* > * Execute the method. Performs parse simultaneously > */ > @@ -369,7 +244,7 @@ AcpiPsExecuteMethod ( > > /* Create and init a Root Node */ > > - Op = AcpiPsCreateScopeOp (); > + Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart); > if (!Op) > { > Status = AE_NO_MEMORY; > @@ -442,10 +317,6 @@ AcpiPsExecuteMethod ( > Cleanup: > AcpiPsDeleteParseTree (Op); > > - /* End optional tracing */ > - > - AcpiPsStopTrace (Info); > - > /* Take away the extra reference that we gave the parameters above */ > > AcpiPsUpdateParameterList (Info, REF_DECREMENT); > diff --git a/src/acpica/source/components/resources/rscreate.c b/src/acpica/source/components/resources/rscreate.c > index 7d9009f..8cf00d3 100644 > --- a/src/acpica/source/components/resources/rscreate.c > +++ b/src/acpica/source/components/resources/rscreate.c > @@ -442,7 +442,8 @@ AcpiRsCreatePciRoutingTable ( > (UINT8 *) OutputBuffer->Pointer); > PathBuffer.Pointer = UserPrt->Source; > > - Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer); > + Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, > + &PathBuffer, FALSE); > > /* +1 to include null terminator */ > > diff --git a/src/acpica/source/components/utilities/utdebug.c b/src/acpica/source/components/utilities/utdebug.c > index 60c6067..df52d17 100644 > --- a/src/acpica/source/components/utilities/utdebug.c > +++ b/src/acpica/source/components/utilities/utdebug.c > @@ -117,6 +117,7 @@ > > #include "acpi.h" > #include "accommon.h" > +#include "acinterp.h" > > #define _COMPONENT ACPI_UTILITIES > ACPI_MODULE_NAME ("utdebug") > @@ -706,6 +707,42 @@ AcpiUtPtrExit ( > } > } > > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiTracePoint > + * > + * PARAMETERS: Type - Trace event type > + * Begin - TRUE if before execution > + * Aml - Executed AML address > + * Pathname - Object path > + * Pointer - Pointer to the related object > + * > + * RETURN: None > + * > + * DESCRIPTION: Interpreter execution trace. > + * > + ******************************************************************************/ > + > +void > +AcpiTracePoint ( > + ACPI_TRACE_EVENT_TYPE Type, > + BOOLEAN Begin, > + UINT8 *Aml, > + char *Pathname) > +{ > + > + ACPI_FUNCTION_ENTRY (); > + > + AcpiExTracePoint (Type, Begin, Aml, Pathname); > + > +#ifdef ACPI_USE_SYSTEM_TRACER > + AcpiOsTracePoint (Type, Begin, Aml, Pathname); > +#endif > +} > + > +ACPI_EXPORT_SYMBOL (AcpiTracePoint) > + > #endif > > > diff --git a/src/acpica/source/components/utilities/utdelete.c b/src/acpica/source/components/utilities/utdelete.c > index 80b8f98..8a55c8e 100644 > --- a/src/acpica/source/components/utilities/utdelete.c > +++ b/src/acpica/source/components/utilities/utdelete.c > @@ -292,6 +292,10 @@ AcpiUtDeleteInternalObj ( > AcpiUtDeleteObjectDesc (Object->Method.Mutex); > Object->Method.Mutex = NULL; > } > + if (Object->Method.Node) > + { > + Object->Method.Node = NULL; > + } > break; > > case ACPI_TYPE_REGION: > diff --git a/src/acpica/source/components/utilities/utinit.c b/src/acpica/source/components/utilities/utinit.c > index 6f701ad..9653a3a 100644 > --- a/src/acpica/source/components/utilities/utinit.c > +++ b/src/acpica/source/components/utilities/utinit.c > @@ -296,8 +296,6 @@ AcpiUtInitGlobals ( > AcpiGbl_AcpiHardwarePresent = TRUE; > AcpiGbl_LastOwnerIdIndex = 0; > AcpiGbl_NextOwnerIdOffset = 0; > - AcpiGbl_TraceDbgLevel = 0; > - AcpiGbl_TraceDbgLayer = 0; > AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; > AcpiGbl_OsiMutex = NULL; > AcpiGbl_RegMethodsExecuted = FALSE; > diff --git a/src/acpica/source/components/utilities/utmisc.c b/src/acpica/source/components/utilities/utmisc.c > index 141db80..762790d 100644 > --- a/src/acpica/source/components/utilities/utmisc.c > +++ b/src/acpica/source/components/utilities/utmisc.c > @@ -490,7 +490,7 @@ AcpiUtDisplayInitPathname ( > /* Get the full pathname to the node */ > > Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; > - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); > + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); > if (ACPI_FAILURE (Status)) > { > return; > diff --git a/src/acpica/source/components/utilities/utnonansi.c b/src/acpica/source/components/utilities/utnonansi.c > new file mode 100644 > index 0000000..01a4361 > --- /dev/null > +++ b/src/acpica/source/components/utilities/utnonansi.c > @@ -0,0 +1,525 @@ > +/******************************************************************************* > + * > + * Module Name: utnonansi - Non-ansi C library functions > + * > + ******************************************************************************/ > + > +/****************************************************************************** > + * > + * 1. Copyright Notice > + * > + * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp. > + * All rights reserved. > + * > + * 2. License > + * > + * 2.1. This is your license from Intel Corp. under its intellectual property > + * rights. You may have additional license terms from the party that provided > + * you this software, covering your right to use that party's intellectual > + * property rights. > + * > + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a > + * copy of the source code appearing in this file ("Covered Code") an > + * irrevocable, perpetual, worldwide license under Intel's copyrights in the > + * base code distributed originally by Intel ("Original Intel Code") to copy, > + * make derivatives, distribute, use and display any portion of the Covered > + * Code in any form, with the right to sublicense such rights; and > + * > + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent > + * license (with the right to sublicense), under only those claims of Intel > + * patents that are infringed by the Original Intel Code, to make, use, sell, > + * offer to sell, and import the Covered Code and derivative works thereof > + * solely to the minimum extent necessary to exercise the above copyright > + * license, and in no event shall the patent license extend to any additions > + * to or modifications of the Original Intel Code. No other license or right > + * is granted directly or by implication, estoppel or otherwise; > + * > + * The above copyright and patent license is granted only if the following > + * conditions are met: > + * > + * 3. Conditions > + * > + * 3.1. Redistribution of Source with Rights to Further Distribute Source. > + * Redistribution of source code of any substantial portion of the Covered > + * Code or modification with rights to further distribute source must include > + * the above Copyright Notice, the above License, this list of Conditions, > + * and the following Disclaimer and Export Compliance provision. In addition, > + * Licensee must cause all Covered Code to which Licensee contributes to > + * contain a file documenting the changes Licensee made to create that Covered > + * Code and the date of any change. Licensee must include in that file the > + * documentation of any changes made by any predecessor Licensee. Licensee > + * must include a prominent statement that the modification is derived, > + * directly or indirectly, from Original Intel Code. > + * > + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. > + * Redistribution of source code of any substantial portion of the Covered > + * Code or modification without rights to further distribute source must > + * include the following Disclaimer and Export Compliance provision in the > + * documentation and/or other materials provided with distribution. In > + * addition, Licensee may not authorize further sublicense of source of any > + * portion of the Covered Code, and must include terms to the effect that the > + * license from Licensee to its licensee is limited to the intellectual > + * property embodied in the software Licensee provides to its licensee, and > + * not to intellectual property embodied in modifications its licensee may > + * make. > + * > + * 3.3. Redistribution of Executable. Redistribution in executable form of any > + * substantial portion of the Covered Code or modification must reproduce the > + * above Copyright Notice, and the following Disclaimer and Export Compliance > + * provision in the documentation and/or other materials provided with the > + * distribution. > + * > + * 3.4. Intel retains all right, title, and interest in and to the Original > + * Intel Code. > + * > + * 3.5. Neither the name Intel nor any other trademark owned or controlled by > + * Intel shall be used in advertising or otherwise to promote the sale, use or > + * other dealings in products derived from or relating to the Covered Code > + * without prior written authorization from Intel. > + * > + * 4. Disclaimer and Export Compliance > + * > + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED > + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE > + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, > + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY > + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY > + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A > + * PARTICULAR PURPOSE. > + * > + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES > + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR > + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, > + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY > + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL > + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS > + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY > + * LIMITED REMEDY. > + * > + * 4.3. Licensee shall not export, either directly or indirectly, any of this > + * software or system incorporating such software without first obtaining any > + * required license or other approval from the U. S. Department of Commerce or > + * any other agency or department of the United States Government. In the > + * event Licensee exports any such software from the United States or > + * re-exports any such software from a foreign destination, Licensee shall > + * ensure that the distribution and export/re-export of the software is in > + * compliance with all laws, regulations, orders, or other restrictions of the > + * U.S. Export Administration Regulations. Licensee agrees that neither it nor > + * any of its subsidiaries will export/re-export any technical data, process, > + * software, or service, directly or indirectly, to any country for which the > + * United States government or any agency thereof requires an export license, > + * other governmental approval, or letter of assurance, without first obtaining > + * such license, approval or letter. > + * > + *****************************************************************************/ > + > +#include "acpi.h" > +#include "accommon.h" > + > + > +#define _COMPONENT ACPI_UTILITIES > + ACPI_MODULE_NAME ("utnonansi") > + > + > +/* > + * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit > + * version of strtoul. > + */ > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiUtStrlwr (strlwr) > + * > + * PARAMETERS: SrcString - The source string to convert > + * > + * RETURN: None > + * > + * DESCRIPTION: Convert a string to lowercase > + * > + ******************************************************************************/ > + > +void > +AcpiUtStrlwr ( > + char *SrcString) > +{ > + char *String; > + > + > + ACPI_FUNCTION_ENTRY (); > + > + > + if (!SrcString) > + { > + return; > + } > + > + /* Walk entire string, lowercasing the letters */ > + > + for (String = SrcString; *String; String++) > + { > + *String = (char) tolower ((int) *String); > + } > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiUtStrupr (strupr) > + * > + * PARAMETERS: SrcString - The source string to convert > + * > + * RETURN: None > + * > + * DESCRIPTION: Convert a string to uppercase > + * > + ******************************************************************************/ > + > +void > +AcpiUtStrupr ( > + char *SrcString) > +{ > + char *String; > + > + > + ACPI_FUNCTION_ENTRY (); > + > + > + if (!SrcString) > + { > + return; > + } > + > + /* Walk entire string, uppercasing the letters */ > + > + for (String = SrcString; *String; String++) > + { > + *String = (char) toupper ((int) *String); > + } > +} > + > + > +/****************************************************************************** > + * > + * FUNCTION: AcpiUtStricmp (stricmp) > + * > + * PARAMETERS: String1 - first string to compare > + * String2 - second string to compare > + * > + * RETURN: int that signifies string relationship. Zero means strings > + * are equal. > + * > + * DESCRIPTION: Case-insensitive string compare. Implementation of the > + * non-ANSI stricmp function. > + * > + ******************************************************************************/ > + > +int > +AcpiUtStricmp ( > + char *String1, > + char *String2) > +{ > + int c1; > + int c2; > + > + > + do > + { > + c1 = tolower ((int) *String1); > + c2 = tolower ((int) *String2); > + > + String1++; > + String2++; > + } > + while ((c1 == c2) && (c1)); > + > + return (c1 - c2); > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiUtStrtoul64 > + * > + * PARAMETERS: String - Null terminated string > + * Base - Radix of the string: 16 or ACPI_ANY_BASE; > + * ACPI_ANY_BASE means 'in behalf of ToInteger' > + * RetInteger - Where the converted integer is returned > + * > + * RETURN: Status and Converted value > + * > + * DESCRIPTION: Convert a string into an unsigned value. Performs either a > + * 32-bit or 64-bit conversion, depending on the current mode > + * of the interpreter. > + * > + * NOTE: Does not support Octal strings, not needed. > + * > + ******************************************************************************/ > + > +ACPI_STATUS > +AcpiUtStrtoul64 ( > + char *String, > + UINT32 Base, > + UINT64 *RetInteger) > +{ > + UINT32 ThisDigit = 0; > + UINT64 ReturnValue = 0; > + UINT64 Quotient; > + UINT64 Dividend; > + UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE); > + UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4); > + UINT8 ValidDigits = 0; > + UINT8 SignOf0x = 0; > + UINT8 Term = 0; > + > + > + ACPI_FUNCTION_TRACE_STR (UtStroul64, String); > + > + > + switch (Base) > + { > + case ACPI_ANY_BASE: > + case 16: > + > + break; > + > + default: > + > + /* Invalid Base */ > + > + return_ACPI_STATUS (AE_BAD_PARAMETER); > + } > + > + if (!String) > + { > + goto ErrorExit; > + } > + > + /* Skip over any white space in the buffer */ > + > + while ((*String) && (isspace ((int) *String) || *String == '\t')) > + { > + String++; > + } > + > + if (ToIntegerOp) > + { > + /* > + * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. > + * We need to determine if it is decimal or hexadecimal. > + */ > + if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x')) > + { > + SignOf0x = 1; > + Base = 16; > + > + /* Skip over the leading '0x' */ > + String += 2; > + } > + else > + { > + Base = 10; > + } > + } > + > + /* Any string left? Check that '0x' is not followed by white space. */ > + > + if (!(*String) || isspace ((int) *String) || *String == '\t') > + { > + if (ToIntegerOp) > + { > + goto ErrorExit; > + } > + else > + { > + goto AllDone; > + } > + } > + > + /* > + * Perform a 32-bit or 64-bit conversion, depending upon the current > + * execution mode of the interpreter > + */ > + Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; > + > + /* Main loop: convert the string to a 32- or 64-bit integer */ > + > + while (*String) > + { > + if (isdigit ((int) *String)) > + { > + /* Convert ASCII 0-9 to Decimal value */ > + > + ThisDigit = ((UINT8) *String) - '0'; > + } > + else if (Base == 10) > + { > + /* Digit is out of range; possible in ToInteger case only */ > + > + Term = 1; > + } > + else > + { > + ThisDigit = (UINT8) toupper ((int) *String); > + if (isxdigit ((int) ThisDigit)) > + { > + /* Convert ASCII Hex char to value */ > + > + ThisDigit = ThisDigit - 'A' + 10; > + } > + else > + { > + Term = 1; > + } > + } > + > + if (Term) > + { > + if (ToIntegerOp) > + { > + goto ErrorExit; > + } > + else > + { > + break; > + } > + } > + else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x) > + { > + /* Skip zeros */ > + String++; > + continue; > + } > + > + ValidDigits++; > + > + if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32))) > + { > + /* > + * This is ToInteger operation case. > + * No any restrictions for string-to-integer conversion, > + * see ACPI spec. > + */ > + goto ErrorExit; > + } > + > + /* Divide the digit into the correct position */ > + > + (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit), > + Base, &Quotient, NULL); > + > + if (ReturnValue > Quotient) > + { > + if (ToIntegerOp) > + { > + goto ErrorExit; > + } > + else > + { > + break; > + } > + } > + > + ReturnValue *= Base; > + ReturnValue += ThisDigit; > + String++; > + } > + > + /* All done, normal exit */ > + > +AllDone: > + > + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", > + ACPI_FORMAT_UINT64 (ReturnValue))); > + > + *RetInteger = ReturnValue; > + return_ACPI_STATUS (AE_OK); > + > + > +ErrorExit: > + /* Base was set/validated above */ > + > + if (Base == 10) > + { > + return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT); > + } > + else > + { > + return_ACPI_STATUS (AE_BAD_HEX_CONSTANT); > + } > +} > + > + > +#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) > +/******************************************************************************* > + * > + * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat > + * > + * PARAMETERS: Adds a "DestSize" parameter to each of the standard string > + * functions. This is the size of the Destination buffer. > + * > + * RETURN: TRUE if the operation would overflow the destination buffer. > + * > + * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that > + * the result of the operation will not overflow the output string > + * buffer. > + * > + * NOTE: These functions are typically only helpful for processing > + * user input and command lines. For most ACPICA code, the > + * required buffer length is precisely calculated before buffer > + * allocation, so the use of these functions is unnecessary. > + * > + ******************************************************************************/ > + > +BOOLEAN > +AcpiUtSafeStrcpy ( > + char *Dest, > + ACPI_SIZE DestSize, > + char *Source) > +{ > + > + if (strlen (Source) >= DestSize) > + { > + return (TRUE); > + } > + > + strcpy (Dest, Source); > + return (FALSE); > +} > + > +BOOLEAN > +AcpiUtSafeStrcat ( > + char *Dest, > + ACPI_SIZE DestSize, > + char *Source) > +{ > + > + if ((strlen (Dest) + strlen (Source)) >= DestSize) > + { > + return (TRUE); > + } > + > + strcat (Dest, Source); > + return (FALSE); > +} > + > +BOOLEAN > +AcpiUtSafeStrncat ( > + char *Dest, > + ACPI_SIZE DestSize, > + char *Source, > + ACPI_SIZE MaxTransferLength) > +{ > + ACPI_SIZE ActualTransferLength; > + > + > + ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); > + > + if ((strlen (Dest) + ActualTransferLength) >= DestSize) > + { > + return (TRUE); > + } > + > + strncat (Dest, Source, MaxTransferLength); > + return (FALSE); > +} > +#endif > diff --git a/src/acpica/source/components/utilities/utstring.c b/src/acpica/source/components/utilities/utstring.c > index 8120297..3660cbb 100644 > --- a/src/acpica/source/components/utilities/utstring.c > +++ b/src/acpica/source/components/utilities/utstring.c > @@ -122,343 +122,6 @@ > ACPI_MODULE_NAME ("utstring") > > > -/* > - * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit > - * version of strtoul. > - */ > - > -#ifdef ACPI_ASL_COMPILER > -/******************************************************************************* > - * > - * FUNCTION: AcpiUtStrlwr (strlwr) > - * > - * PARAMETERS: SrcString - The source string to convert > - * > - * RETURN: None > - * > - * DESCRIPTION: Convert string to lowercase > - * > - * NOTE: This is not a POSIX function, so it appears here, not in utclib.c > - * > - ******************************************************************************/ > - > -void > -AcpiUtStrlwr ( > - char *SrcString) > -{ > - char *String; > - > - > - ACPI_FUNCTION_ENTRY (); > - > - > - if (!SrcString) > - { > - return; > - } > - > - /* Walk entire string, lowercasing the letters */ > - > - for (String = SrcString; *String; String++) > - { > - *String = (char) tolower ((int) *String); > - } > - > - return; > -} > - > - > -/****************************************************************************** > - * > - * FUNCTION: AcpiUtStricmp (stricmp) > - * > - * PARAMETERS: String1 - first string to compare > - * String2 - second string to compare > - * > - * RETURN: int that signifies string relationship. Zero means strings > - * are equal. > - * > - * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare > - * strings with no case sensitivity) > - * > - ******************************************************************************/ > - > -int > -AcpiUtStricmp ( > - char *String1, > - char *String2) > -{ > - int c1; > - int c2; > - > - > - do > - { > - c1 = tolower ((int) *String1); > - c2 = tolower ((int) *String2); > - > - String1++; > - String2++; > - } > - while ((c1 == c2) && (c1)); > - > - return (c1 - c2); > -} > -#endif > - > - > -/******************************************************************************* > - * > - * FUNCTION: AcpiUtStrupr (strupr) > - * > - * PARAMETERS: SrcString - The source string to convert > - * > - * RETURN: None > - * > - * DESCRIPTION: Convert string to uppercase > - * > - * NOTE: This is not a POSIX function, so it appears here, not in utclib.c > - * > - ******************************************************************************/ > - > -void > -AcpiUtStrupr ( > - char *SrcString) > -{ > - char *String; > - > - > - ACPI_FUNCTION_ENTRY (); > - > - > - if (!SrcString) > - { > - return; > - } > - > - /* Walk entire string, uppercasing the letters */ > - > - for (String = SrcString; *String; String++) > - { > - *String = (char) toupper ((int) *String); > - } > - > - return; > -} > - > - > -/******************************************************************************* > - * > - * FUNCTION: AcpiUtStrtoul64 > - * > - * PARAMETERS: String - Null terminated string > - * Base - Radix of the string: 16 or ACPI_ANY_BASE; > - * ACPI_ANY_BASE means 'in behalf of ToInteger' > - * RetInteger - Where the converted integer is returned > - * > - * RETURN: Status and Converted value > - * > - * DESCRIPTION: Convert a string into an unsigned value. Performs either a > - * 32-bit or 64-bit conversion, depending on the current mode > - * of the interpreter. > - * NOTE: Does not support Octal strings, not needed. > - * > - ******************************************************************************/ > - > -ACPI_STATUS > -AcpiUtStrtoul64 ( > - char *String, > - UINT32 Base, > - UINT64 *RetInteger) > -{ > - UINT32 ThisDigit = 0; > - UINT64 ReturnValue = 0; > - UINT64 Quotient; > - UINT64 Dividend; > - UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE); > - UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4); > - UINT8 ValidDigits = 0; > - UINT8 SignOf0x = 0; > - UINT8 Term = 0; > - > - > - ACPI_FUNCTION_TRACE_STR (UtStroul64, String); > - > - > - switch (Base) > - { > - case ACPI_ANY_BASE: > - case 16: > - > - break; > - > - default: > - > - /* Invalid Base */ > - > - return_ACPI_STATUS (AE_BAD_PARAMETER); > - } > - > - if (!String) > - { > - goto ErrorExit; > - } > - > - /* Skip over any white space in the buffer */ > - > - while ((*String) && (isspace ((int) *String) || *String == '\t')) > - { > - String++; > - } > - > - if (ToIntegerOp) > - { > - /* > - * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. > - * We need to determine if it is decimal or hexadecimal. > - */ > - if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x')) > - { > - SignOf0x = 1; > - Base = 16; > - > - /* Skip over the leading '0x' */ > - String += 2; > - } > - else > - { > - Base = 10; > - } > - } > - > - /* Any string left? Check that '0x' is not followed by white space. */ > - > - if (!(*String) || isspace ((int) *String) || *String == '\t') > - { > - if (ToIntegerOp) > - { > - goto ErrorExit; > - } > - else > - { > - goto AllDone; > - } > - } > - > - /* > - * Perform a 32-bit or 64-bit conversion, depending upon the current > - * execution mode of the interpreter > - */ > - Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; > - > - /* Main loop: convert the string to a 32- or 64-bit integer */ > - > - while (*String) > - { > - if (isdigit ((int) *String)) > - { > - /* Convert ASCII 0-9 to Decimal value */ > - > - ThisDigit = ((UINT8) *String) - '0'; > - } > - else if (Base == 10) > - { > - /* Digit is out of range; possible in ToInteger case only */ > - > - Term = 1; > - } > - else > - { > - ThisDigit = (UINT8) toupper ((int) *String); > - if (isxdigit ((int) ThisDigit)) > - { > - /* Convert ASCII Hex char to value */ > - > - ThisDigit = ThisDigit - 'A' + 10; > - } > - else > - { > - Term = 1; > - } > - } > - > - if (Term) > - { > - if (ToIntegerOp) > - { > - goto ErrorExit; > - } > - else > - { > - break; > - } > - } > - else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x) > - { > - /* Skip zeros */ > - String++; > - continue; > - } > - > - ValidDigits++; > - > - if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32))) > - { > - /* > - * This is ToInteger operation case. > - * No any restrictions for string-to-integer conversion, > - * see ACPI spec. > - */ > - goto ErrorExit; > - } > - > - /* Divide the digit into the correct position */ > - > - (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit), > - Base, &Quotient, NULL); > - > - if (ReturnValue > Quotient) > - { > - if (ToIntegerOp) > - { > - goto ErrorExit; > - } > - else > - { > - break; > - } > - } > - > - ReturnValue *= Base; > - ReturnValue += ThisDigit; > - String++; > - } > - > - /* All done, normal exit */ > - > -AllDone: > - > - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", > - ACPI_FORMAT_UINT64 (ReturnValue))); > - > - *RetInteger = ReturnValue; > - return_ACPI_STATUS (AE_OK); > - > - > -ErrorExit: > - /* Base was set/validated above */ > - > - if (Base == 10) > - { > - return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT); > - } > - else > - { > - return_ACPI_STATUS (AE_BAD_HEX_CONSTANT); > - } > -} > - > - > /******************************************************************************* > * > * FUNCTION: AcpiUtPrintString > @@ -754,78 +417,3 @@ UtConvertBackslashes ( > } > } > #endif > - > -#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) > -/******************************************************************************* > - * > - * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat > - * > - * PARAMETERS: Adds a "DestSize" parameter to each of the standard string > - * functions. This is the size of the Destination buffer. > - * > - * RETURN: TRUE if the operation would overflow the destination buffer. > - * > - * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that > - * the result of the operation will not overflow the output string > - * buffer. > - * > - * NOTE: These functions are typically only helpful for processing > - * user input and command lines. For most ACPICA code, the > - * required buffer length is precisely calculated before buffer > - * allocation, so the use of these functions is unnecessary. > - * > - ******************************************************************************/ > - > -BOOLEAN > -AcpiUtSafeStrcpy ( > - char *Dest, > - ACPI_SIZE DestSize, > - char *Source) > -{ > - > - if (strlen (Source) >= DestSize) > - { > - return (TRUE); > - } > - > - strcpy (Dest, Source); > - return (FALSE); > -} > - > -BOOLEAN > -AcpiUtSafeStrcat ( > - char *Dest, > - ACPI_SIZE DestSize, > - char *Source) > -{ > - > - if ((strlen (Dest) + strlen (Source)) >= DestSize) > - { > - return (TRUE); > - } > - > - strcat (Dest, Source); > - return (FALSE); > -} > - > -BOOLEAN > -AcpiUtSafeStrncat ( > - char *Dest, > - ACPI_SIZE DestSize, > - char *Source, > - ACPI_SIZE MaxTransferLength) > -{ > - ACPI_SIZE ActualTransferLength; > - > - > - ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); > - > - if ((strlen (Dest) + ActualTransferLength) >= DestSize) > - { > - return (TRUE); > - } > - > - strncat (Dest, Source, MaxTransferLength); > - return (FALSE); > -} > -#endif > diff --git a/src/acpica/source/include/acdebug.h b/src/acpica/source/include/acdebug.h > index 2d91725..909c831 100644 > --- a/src/acpica/source/include/acdebug.h > +++ b/src/acpica/source/include/acdebug.h > @@ -209,6 +209,12 @@ AcpiDbSleep ( > char *ObjectArg); > > void > +AcpiDbTrace ( > + char *EnableArg, > + char *MethodArg, > + char *OnceArg); > + > +void > AcpiDbDisplayLocks ( > void); > > @@ -497,6 +503,32 @@ AcpiDbGetNextToken ( > > > /* > + * dbobject > + */ > +void > +AcpiDbDecodeInternalObject ( > + ACPI_OPERAND_OBJECT *ObjDesc); > + > +void > +AcpiDbDisplayInternalObject ( > + ACPI_OPERAND_OBJECT *ObjDesc, > + ACPI_WALK_STATE *WalkState); > + > +void > +AcpiDbDecodeArguments ( > + ACPI_WALK_STATE *WalkState); > + > +void > +AcpiDbDecodeLocals ( > + ACPI_WALK_STATE *WalkState); > + > +void > +AcpiDbDumpMethodInfo ( > + ACPI_STATUS Status, > + ACPI_WALK_STATE *WalkState); > + > + > +/* > * dbstats - Generation and display of ACPI table statistics > */ > void > diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h > index 30fbece..2cad1b9 100644 > --- a/src/acpica/source/include/acdisasm.h > +++ b/src/acpica/source/include/acdisasm.h > @@ -471,7 +471,9 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoStao[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[]; > -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaHdr[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaClient[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaServer[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc[]; > @@ -667,6 +669,10 @@ AcpiDmDumpStao ( > ACPI_TABLE_HEADER *Table); > > void > +AcpiDmDumpTcpa ( > + ACPI_TABLE_HEADER *Table); > + > +void > AcpiDmDumpVrtc ( > ACPI_TABLE_HEADER *Table); > > @@ -709,10 +715,6 @@ AcpiDmDisassembleOneOp ( > ACPI_OP_WALK_INFO *Info, > ACPI_PARSE_OBJECT *Op); > > -void > -AcpiDmDecodeInternalObject ( > - ACPI_OPERAND_OBJECT *ObjDesc); > - > UINT32 > AcpiDmListType ( > ACPI_PARSE_OBJECT *Op); > @@ -772,29 +774,6 @@ AcpiDmNamestring ( > > > /* > - * dmobject > - */ > -void > -AcpiDmDisplayInternalObject ( > - ACPI_OPERAND_OBJECT *ObjDesc, > - ACPI_WALK_STATE *WalkState); > - > -void > -AcpiDmDisplayArguments ( > - ACPI_WALK_STATE *WalkState); > - > -void > -AcpiDmDisplayLocals ( > - ACPI_WALK_STATE *WalkState); > - > -void > -AcpiDmDumpMethodInfo ( > - ACPI_STATUS Status, > - ACPI_WALK_STATE *WalkState, > - ACPI_PARSE_OBJECT *Op); > - > - > -/* > * dmbuffer > */ > void > diff --git a/src/acpica/source/include/acdispat.h b/src/acpica/source/include/acdispat.h > index 238cdde..2fac6ee 100644 > --- a/src/acpica/source/include/acdispat.h > +++ b/src/acpica/source/include/acdispat.h > @@ -533,4 +533,14 @@ AcpiDsResultPush ( > ACPI_OPERAND_OBJECT *Object, > ACPI_WALK_STATE *WalkState); > > + > +/* > + * dsdebug - parser debugging routines > + */ > +void > +AcpiDsDumpMethodStack ( > + ACPI_STATUS Status, > + ACPI_WALK_STATE *WalkState, > + ACPI_PARSE_OBJECT *Op); > + > #endif /* _ACDISPAT_H_ */ > diff --git a/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h > index 3e399ba..4061401 100644 > --- a/src/acpica/source/include/acglobal.h > +++ b/src/acpica/source/include/acglobal.h > @@ -365,8 +365,6 @@ ACPI_GLOBAL (UINT32, AcpiFixedEventCount[ACPI_NUM_FIXED_EVENT > > ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLevel); > ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLayer); > -ACPI_GLOBAL (UINT32, AcpiGbl_TraceDbgLevel); > -ACPI_GLOBAL (UINT32, AcpiGbl_TraceDbgLayer); > > > /***************************************************************************** > @@ -385,6 +383,7 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE); > ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE); > ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE); > ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE); > +ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT *, AcpiGbl_PreviousOp, NULL); > > ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_Disasm); > ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_Verbose); > diff --git a/src/acpica/source/include/acinterp.h b/src/acpica/source/include/acinterp.h > index 7c74e05..77d6953 100644 > --- a/src/acpica/source/include/acinterp.h > +++ b/src/acpica/source/include/acinterp.h > @@ -215,6 +215,35 @@ AcpiExDoDebugObject ( > UINT32 Level, > UINT32 Index); > > +void > +AcpiExStartTraceMethod ( > + ACPI_NAMESPACE_NODE *MethodNode, > + ACPI_OPERAND_OBJECT *ObjDesc, > + ACPI_WALK_STATE *WalkState); > + > +void > +AcpiExStopTraceMethod ( > + ACPI_NAMESPACE_NODE *MethodNode, > + ACPI_OPERAND_OBJECT *ObjDesc, > + ACPI_WALK_STATE *WalkState); > + > +void > +AcpiExStartTraceOpcode ( > + ACPI_PARSE_OBJECT *Op, > + ACPI_WALK_STATE *WalkState); > + > +void > +AcpiExStopTraceOpcode ( > + ACPI_PARSE_OBJECT *Op, > + ACPI_WALK_STATE *WalkState); > + > +void > +AcpiExTracePoint ( > + ACPI_TRACE_EVENT_TYPE Type, > + BOOLEAN Begin, > + UINT8 *Aml, > + char *Pathname); > + > > /* > * exfield - ACPI AML (p-code) execution - field manipulation > diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h > index b550282..bd026ae 100644 > --- a/src/acpica/source/include/aclocal.h > +++ b/src/acpica/source/include/aclocal.h > @@ -265,8 +265,12 @@ typedef struct acpi_namespace_node > */ > #ifdef ACPI_LARGE_NAMESPACE_NODE > union acpi_parse_object *Op; > + void *MethodLocals; > + void *MethodArgs; > UINT32 Value; > UINT32 Length; > + UINT8 ArgCount; > + > #endif > > } ACPI_NAMESPACE_NODE; > @@ -936,7 +940,7 @@ typedef union acpi_parse_value > } ACPI_PARSE_VALUE; > > > -#ifdef ACPI_DISASSEMBLER > +#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) > #define ACPI_DISASM_ONLY_MEMBERS(a) a; > #else > #define ACPI_DISASM_ONLY_MEMBERS(a) > @@ -947,7 +951,7 @@ typedef union acpi_parse_value > UINT8 DescriptorType; /* To differentiate various internal objs */\ > UINT8 Flags; /* Type of Op */\ > UINT16 AmlOpcode; /* AML opcode */\ > - UINT32 AmlOffset; /* Offset of declaration in AML */\ > + UINT8 *Aml; /* Address of declaration in AML */\ > union acpi_parse_object *Next; /* Next op */\ > ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\ > ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ > @@ -1363,7 +1367,9 @@ typedef struct acpi_db_method_info > * Index of current thread inside all them created. > */ > char InitArgs; > +#ifdef ACPI_DEBUGGER > ACPI_OBJECT_TYPE ArgTypes[4]; > +#endif > char *Arguments[4]; > char NumThreadsStr[11]; > char IdOfThreadStr[11]; > diff --git a/src/acpica/source/include/acmacros.h b/src/acpica/source/include/acmacros.h > index c1f5f81..f8dfffb 100644 > --- a/src/acpica/source/include/acmacros.h > +++ b/src/acpica/source/include/acmacros.h > @@ -295,6 +295,16 @@ > #define ACPI_MUL_32(a) _ACPI_MUL(a, 5) > #define ACPI_MOD_32(a) _ACPI_MOD(a, 32) > > +/* Test for ASCII character */ > + > +#define ACPI_IS_ASCII(c) ((c) < 0x80) > + > +/* Signed integers */ > + > +#define ACPI_SIGN_POSITIVE 0 > +#define ACPI_SIGN_NEGATIVE 1 > + > + > /* > * Rounding macros (Power of two boundaries only) > */ > diff --git a/src/acpica/source/include/acnamesp.h b/src/acpica/source/include/acnamesp.h > index 1b19357..db7f114 100644 > --- a/src/acpica/source/include/acnamesp.h > +++ b/src/acpica/source/include/acnamesp.h > @@ -422,16 +422,22 @@ UINT32 > AcpiNsOpensScope ( > ACPI_OBJECT_TYPE Type); > > -ACPI_STATUS > -AcpiNsBuildExternalPath ( > - ACPI_NAMESPACE_NODE *Node, > - ACPI_SIZE Size, > - char *NameBuffer); > - > char * > AcpiNsGetExternalPathname ( > ACPI_NAMESPACE_NODE *Node); > > +UINT32 > +AcpiNsBuildNormalizedPath ( > + ACPI_NAMESPACE_NODE *Node, > + char *FullPath, > + UINT32 PathSize, > + BOOLEAN NoTrailing); > + > +char * > +AcpiNsGetNormalizedPathname ( > + ACPI_NAMESPACE_NODE *Node, > + BOOLEAN NoTrailing); > + > char * > AcpiNsNameOfCurrentScope ( > ACPI_WALK_STATE *WalkState); > @@ -439,7 +445,8 @@ AcpiNsNameOfCurrentScope ( > ACPI_STATUS > AcpiNsHandleToPathname ( > ACPI_HANDLE TargetHandle, > - ACPI_BUFFER *Buffer); > + ACPI_BUFFER *Buffer, > + BOOLEAN NoTrailing); > > BOOLEAN > AcpiNsPatternMatch ( > diff --git a/src/acpica/source/include/acobject.h b/src/acpica/source/include/acobject.h > index fbd28a9..feaa9d1 100644 > --- a/src/acpica/source/include/acobject.h > +++ b/src/acpica/source/include/acobject.h > @@ -285,6 +285,7 @@ typedef struct acpi_object_method > UINT8 ParamCount; > UINT8 SyncLevel; > union acpi_operand_object *Mutex; > + union acpi_operand_object *Node; > UINT8 *AmlStart; > union > { > diff --git a/src/acpica/source/include/acoutput.h b/src/acpica/source/include/acoutput.h > index 9570a38..a9c73b9 100644 > --- a/src/acpica/source/include/acoutput.h > +++ b/src/acpica/source/include/acoutput.h > @@ -161,7 +161,8 @@ > #define ACPI_LV_DEBUG_OBJECT 0x00000002 > #define ACPI_LV_INFO 0x00000004 > #define ACPI_LV_REPAIR 0x00000008 > -#define ACPI_LV_ALL_EXCEPTIONS 0x0000000F > +#define ACPI_LV_TRACE_POINT 0x00000010 > +#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F > > /* Trace verbosity level 1 [Standard Trace Level] */ > > @@ -221,6 +222,7 @@ > #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) > #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) > #define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) > +#define ACPI_DB_TRACE_POINT ACPI_DEBUG_LEVEL (ACPI_LV_TRACE_POINT) > #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) > > /* Trace level -- also used in the global "DebugLevel" */ > @@ -257,6 +259,21 @@ > #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) > > > +/* > + * Global trace flags > + */ > +#define ACPI_TRACE_ENABLED ((UINT32) 4) > +#define ACPI_TRACE_ONESHOT ((UINT32) 2) > +#define ACPI_TRACE_OPCODE ((UINT32) 1) > + > +/* Defaults for trace debugging level/layer */ > + > +#define ACPI_TRACE_LEVEL_ALL ACPI_LV_ALL > +#define ACPI_TRACE_LAYER_ALL 0x000001FF > +#define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TRACE_POINT > +#define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECUTER > + > + > #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) > /* > * The module name is used primarily for error and debug messages. > @@ -511,6 +528,8 @@ > #define ACPI_DUMP_PATHNAME(a, b, c, d) AcpiNsDumpPathname(a, b, c, d) > #define ACPI_DUMP_BUFFER(a, b) AcpiUtDebugDumpBuffer((UINT8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) > > +#define ACPI_TRACE_POINT(a, b, c, d) AcpiTracePoint (a, b, c, d) > + > #else /* ACPI_DEBUG_OUTPUT */ > /* > * This is the non-debug case -- make everything go away, > @@ -532,6 +551,7 @@ > #define ACPI_DUMP_PATHNAME(a, b, c, d) > #define ACPI_DUMP_BUFFER(a, b) > #define ACPI_IS_DEBUG_ENABLED(Level, Component) 0 > +#define ACPI_TRACE_POINT(a, b, c, d) > > /* Return macros must have a return statement at the minimum */ > > diff --git a/src/acpica/source/include/acparser.h b/src/acpica/source/include/acparser.h > index e4fc0c7..c525dd3 100644 > --- a/src/acpica/source/include/acparser.h > +++ b/src/acpica/source/include/acparser.h > @@ -378,7 +378,7 @@ AcpiPsDeleteParseTree ( > */ > ACPI_PARSE_OBJECT * > AcpiPsCreateScopeOp ( > - void); > + UINT8 *Aml); > > void > AcpiPsInitOp ( > @@ -387,7 +387,8 @@ AcpiPsInitOp ( > > ACPI_PARSE_OBJECT * > AcpiPsAllocOp ( > - UINT16 opcode); > + UINT16 Opcode, > + UINT8 *Aml); > > void > AcpiPsFreeOp ( > diff --git a/src/acpica/source/include/acpiosxf.h b/src/acpica/source/include/acpiosxf.h > index 68d79c7..45cec74 100644 > --- a/src/acpica/source/include/acpiosxf.h > +++ b/src/acpica/source/include/acpiosxf.h > @@ -671,5 +671,14 @@ AcpiOsSetFileOffset ( > UINT8 From); > #endif > > +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint > +void > +AcpiOsTracePoint ( > + ACPI_TRACE_EVENT_TYPE Type, > + BOOLEAN Begin, > + UINT8 *Aml, > + char *Pathname); > +#endif > + > > #endif /* __ACPIOSXF_H__ */ > diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h > index c090d68..791aa64 100644 > --- a/src/acpica/source/include/acpixf.h > +++ b/src/acpica/source/include/acpixf.h > @@ -118,7 +118,7 @@ > > /* Current ACPICA subsystem version in YYYYMMDD format */ > > -#define ACPI_CA_VERSION 0x20150619 > +#define ACPI_CA_VERSION 0x20150717 > > #include "acconfig.h" > #include "actypes.h" > @@ -325,7 +325,9 @@ ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ReducedHardware, FALSE); > * traced each time it is executed. > */ > ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceFlags, 0); > -ACPI_INIT_GLOBAL (ACPI_NAME, AcpiGbl_TraceMethodName, 0); > +ACPI_INIT_GLOBAL (const char *, AcpiGbl_TraceMethodName, NULL); > +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceDbgLevel, ACPI_TRACE_LEVEL_DEFAULT); > +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceDbgLayer, ACPI_TRACE_LAYER_DEFAULT); > > /* > * Runtime configuration of debug output control masks. We want the debug > @@ -682,7 +684,7 @@ AcpiGetData ( > ACPI_EXTERNAL_RETURN_STATUS ( > ACPI_STATUS > AcpiDebugTrace ( > - char *Name, > + const char *Name, > UINT32 DebugLevel, > UINT32 DebugLayer, > UINT32 Flags)) > @@ -1263,6 +1265,14 @@ AcpiDebugPrintRaw ( > const char *Format, > ...)) > > +ACPI_DBG_DEPENDENT_RETURN_VOID ( > +void > +AcpiTracePoint ( > + ACPI_TRACE_EVENT_TYPE Type, > + BOOLEAN Begin, > + UINT8 *Aml, > + char *Pathname)) > + > ACPI_APP_DEPENDENT_RETURN_VOID ( > ACPI_PRINTF_LIKE(1) > void ACPI_INTERNAL_VAR_XFACE > diff --git a/src/acpica/source/include/acstruct.h b/src/acpica/source/include/acstruct.h > index d647826..f8443d6 100644 > --- a/src/acpica/source/include/acstruct.h > +++ b/src/acpica/source/include/acstruct.h > @@ -160,7 +160,7 @@ typedef struct acpi_walk_state > BOOLEAN NamespaceOverride; /* Override existing objects */ > UINT8 ResultSize; /* Total elements for the result stack */ > UINT8 ResultCount; /* Current number of occupied elements of result stack */ > - UINT32 AmlOffset; > + UINT8 *Aml; > UINT32 ArgTypes; > UINT32 MethodBreakpoint; /* For single stepping */ > UINT32 UserBreakpoint; /* User AML breakpoint */ > diff --git a/src/acpica/source/include/actbl2.h b/src/acpica/source/include/actbl2.h > index c838959..ab92589 100644 > --- a/src/acpica/source/include/actbl2.h > +++ b/src/acpica/source/include/actbl2.h > @@ -1447,14 +1447,28 @@ enum AcpiSpmiInterfaceTypes > * December 19, 2014 > * > * NOTE: There are two versions of the table with the same signature -- > - * the client version and the server version. > + * the client version and the server version. The common PlatformClass > + * field is used to differentiate the two types of tables. > * > ******************************************************************************/ > > -typedef struct acpi_table_tcpa_client > +typedef struct acpi_table_tcpa_hdr > { > ACPI_TABLE_HEADER Header; /* Common ACPI table header */ > UINT16 PlatformClass; > + > +} ACPI_TABLE_TCPA_HDR; > + > +/* > + * Values for PlatformClass above. > + * This is how the client and server subtables are differentiated > + */ > +#define ACPI_TCPA_CLIENT_TABLE 0 > +#define ACPI_TCPA_SERVER_TABLE 1 > + > + > +typedef struct acpi_table_tcpa_client > +{ > UINT32 MinimumLogLength; /* Minimum length for the event log area */ > UINT64 LogAddress; /* Address of the event log area */ > > @@ -1462,8 +1476,6 @@ typedef struct acpi_table_tcpa_client > > typedef struct acpi_table_tcpa_server > { > - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ > - UINT16 PlatformClass; > UINT16 Reserved; > UINT64 MinimumLogLength; /* Minimum length for the event log area */ > UINT64 LogAddress; /* Address of the event log area */ > diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h > index c8cb5ce..dcf11b5 100644 > --- a/src/acpica/source/include/actypes.h > +++ b/src/acpica/source/include/actypes.h > @@ -1094,7 +1094,8 @@ typedef struct acpi_buffer > */ > #define ACPI_FULL_PATHNAME 0 > #define ACPI_SINGLE_NAME 1 > -#define ACPI_NAME_TYPE_MAX 1 > +#define ACPI_FULL_PATHNAME_NO_TRAILING 2 > +#define ACPI_NAME_TYPE_MAX 2 > > > /* > @@ -1417,6 +1418,17 @@ typedef struct acpi_memory_list > } ACPI_MEMORY_LIST; > > > +/* Definitions of trace event types */ > + > +typedef enum > +{ > + ACPI_TRACE_AML_METHOD, > + ACPI_TRACE_AML_OPCODE, > + ACPI_TRACE_AML_REGION > + > +} ACPI_TRACE_EVENT_TYPE; > + > + > /* Definitions of _OSI support */ > > #define ACPI_VENDOR_STRINGS 0x01 > diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h > index 562499c..429c0a3 100644 > --- a/src/acpica/source/include/acutils.h > +++ b/src/acpica/source/include/acutils.h > @@ -245,6 +245,30 @@ typedef struct acpi_pkg_info > #define DB_DWORD_DISPLAY 4 > #define DB_QWORD_DISPLAY 8 > > + > +/* > + * utnonansi - Non-ANSI C library functions > + */ > +void > +AcpiUtStrupr ( > + char *SrcString); > + > +void > +AcpiUtStrlwr ( > + char *SrcString); > + > +int > +AcpiUtStricmp ( > + char *String1, > + char *String2); > + > +ACPI_STATUS > +AcpiUtStrtoul64 ( > + char *String, > + UINT32 Base, > + UINT64 *RetInteger); > + > + > /* > * utglobal - Global data structures and procedures > */ > @@ -318,8 +342,6 @@ AcpiUtSubsystemShutdown ( > void); > > > -#define ACPI_IS_ASCII(c) ((c) < 0x80) > - > /* > * utcopy - Object construction and conversion interfaces > */ > @@ -479,6 +501,7 @@ AcpiUtReportWarning ( > char *ModuleName, > UINT32 LineNumber); > > + > /* > * utdelete - Object deletion and reference counts > */ > @@ -804,11 +827,11 @@ AcpiUtWalkPackageTree ( > ACPI_PKG_CALLBACK WalkCallback, > void *Context); > > - > /* Values for Base above (16=Hex, 10=Decimal) */ > > #define ACPI_ANY_BASE 0 > > + > UINT32 > AcpiUtDwordByteSwap ( > UINT32 Value); > @@ -881,27 +904,6 @@ AcpiUtGetResourceEndTag ( > * utstring - String and character utilities > */ > void > -AcpiUtStrupr ( > - char *SrcString); > - > -#ifdef ACPI_ASL_COMPILER > -void > -AcpiUtStrlwr ( > - char *SrcString); > - > -int > -AcpiUtStricmp ( > - char *String1, > - char *String2); > -#endif > - > -ACPI_STATUS > -AcpiUtStrtoul64 ( > - char *String, > - UINT32 Base, > - UINT64 *RetInteger); > - > -void > AcpiUtPrintString ( > char *String, > UINT16 MaxLength); > @@ -1026,6 +1028,7 @@ AcpiUtCreateList ( > > #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ > > + > /* > * utaddress - address range check > */ > @@ -1052,6 +1055,7 @@ void > AcpiUtDeleteAddressLists ( > void); > > + > /* > * utxferror - various error/warning output functions > */ > @@ -1098,6 +1102,7 @@ AcpiUtMethodError ( > const char *Path, > ACPI_STATUS LookupStatus); > > + > /* > * Utility functions for ACPI names and IDs > */ > @@ -1113,6 +1118,7 @@ const char * > AcpiAhMatchUuid ( > UINT8 *Data); > > + > /* > * utprint - printf/vprintf output functions > */ > @@ -1154,6 +1160,7 @@ AcpiUtFilePrintf ( > ...); > #endif > > + > /* > * utuuid -- UUID support functions > */ > diff --git a/src/acpica/source/include/platform/acenvex.h b/src/acpica/source/include/platform/acenvex.h > index ac1cb92..3daf77e 100644 > --- a/src/acpica/source/include/platform/acenvex.h > +++ b/src/acpica/source/include/platform/acenvex.h > @@ -128,6 +128,9 @@ > #if defined(_LINUX) || defined(__linux__) > #include "aclinuxex.h" > > +#elif defined(WIN32) > +#include "acwinex.h" > + > #elif defined(_AED_EFI) > #include "acefiex.h" > Acked-by: Ivan Hu<ivan.hu@canonical.com>
On 07/18/2015 01:31 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Changes in this release of ACPICA are detailed at the following > link on the ACPICA developer mailing list: > > https://lists.acpica.org/pipermail/devel/2015-July/000788.html > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- Acked-by: Alex Hung <alex.hung@canonical.com>
diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am index 66bc1af..33d7444 100644 --- a/src/acpica/Makefile.am +++ b/src/acpica/Makefile.am @@ -75,6 +75,7 @@ libfwtsacpica_la_SOURCES = \ source/components/debugger/dbhistry.c \ source/components/debugger/dbinput.c \ source/components/debugger/dbstats.c \ + source/components/debugger/dbobject.c \ source/components/debugger/dbutils.c \ source/components/debugger/dbxface.c \ source/components/debugger/dbmethod.c \ @@ -93,6 +94,7 @@ libfwtsacpica_la_SOURCES = \ source/components/disassembler/dmwalk.c \ source/components/disassembler/dmresrcl2.c \ source/components/disassembler/dmdeferred.c \ + source/components/dispatcher/dsdebug.c \ source/components/dispatcher/dsfield.c \ source/components/dispatcher/dsinit.c \ source/components/dispatcher/dsmethod.c \ @@ -226,6 +228,7 @@ libfwtsacpica_la_SOURCES = \ source/components/utilities/utmath.c \ source/components/utilities/utmisc.c \ source/components/utilities/utmutex.c \ + source/components/utilities/utnonansi.c \ source/components/utilities/utobject.c \ source/components/utilities/utresrc.c \ source/components/utilities/utstate.c \ diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c index 9bfd0ae..3cf7676 100644 --- a/src/acpica/fwts_acpica.c +++ b/src/acpica/fwts_acpica.c @@ -1168,7 +1168,7 @@ static ACPI_STATUS fwts_acpi_walk_for_object_names( buffer.Pointer = tmpbuf; buffer.Length = sizeof(tmpbuf); - if (!ACPI_FAILURE(AcpiNsHandleToPathname(objHandle, &buffer))) + if (!ACPI_FAILURE(AcpiNsHandleToPathname(objHandle, &buffer, FALSE))) fwts_list_append(list, strdup((char *)buffer.Pointer)); return AE_OK; diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c index d4f0fe6..b0d48d2 100644 --- a/src/acpica/source/common/adisasm.c +++ b/src/acpica/source/common/adisasm.c @@ -259,6 +259,7 @@ AdInitialize ( AcpiGbl_RootTableList.CurrentTableCount = 0; AcpiGbl_RootTableList.Tables = LocalTables; + AcpiGbl_PreviousOp = NULL; return (Status); } @@ -868,8 +869,8 @@ AdStoreTable ( AcpiTbInitTableDescriptor (TableDesc, ACPI_PTR_TO_PHYSADDR (Table), ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table); - AcpiTbValidateTable (TableDesc); - return (AE_OK); + Status = AcpiTbValidateTable (TableDesc); + return (Status); } @@ -964,7 +965,7 @@ AdParseTable ( /* Create the root object */ - AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (); + AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart); if (!AcpiGbl_ParseOpRoot) { return (AE_NO_MEMORY); diff --git a/src/acpica/source/common/dmrestag.c b/src/acpica/source/common/dmrestag.c index d91ede9..5041f88 100644 --- a/src/acpica/source/common/dmrestag.c +++ b/src/acpica/source/common/dmrestag.c @@ -722,7 +722,7 @@ AcpiGetTagPathname ( /* Get the full pathname to the parent buffer */ - RequiredSize = AcpiNsGetPathnameLength (BufferNode); + RequiredSize = AcpiNsBuildNormalizedPath (BufferNode, NULL, 0, FALSE); if (!RequiredSize) { return (NULL); @@ -734,12 +734,8 @@ AcpiGetTagPathname ( return (NULL); } - Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (Pathname); - return (NULL); - } + (void) AcpiNsBuildNormalizedPath (BufferNode, Pathname, + RequiredSize, FALSE); /* * Create the full path to the resource and tag by: remove the buffer name, diff --git a/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c index e05e687..66dabde 100644 --- a/src/acpica/source/common/dmtable.c +++ b/src/acpica/source/common/dmtable.c @@ -440,7 +440,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi}, {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, - {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa}, + {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2}, {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc}, @@ -572,7 +572,11 @@ AcpiDmDumpDataTable ( if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS)) { Length = Table->Length; - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); + if (ACPI_FAILURE (Status)) + { + return; + } } else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature)) { @@ -633,7 +637,11 @@ AcpiDmDumpDataTable ( { /* Simple table, just walk the info table */ - AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo); + Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo); + if (ACPI_FAILURE (Status)) + { + return; + } } } @@ -792,6 +800,7 @@ AcpiDmDumpTable ( const AH_TABLE *TableData; const char *Name; BOOLEAN LastOutputBlankLine = FALSE; + ACPI_STATUS Status; char RepairedName[8]; @@ -1186,8 +1195,13 @@ AcpiDmDumpTable ( /* Generic Address Structure */ AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure"); - AcpiDmDumpTable (TableLength, CurrentOffset, Target, + Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + AcpiOsPrintf ("\n"); LastOutputBlankLine = TRUE; break; @@ -1322,8 +1336,13 @@ AcpiDmDumpTable ( AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure"); - AcpiDmDumpTable (TableLength, CurrentOffset, Target, + Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + AcpiOsPrintf ("\n"); LastOutputBlankLine = TRUE; break; @@ -1347,8 +1366,13 @@ AcpiDmDumpTable ( AcpiOsPrintf (STRING_FORMAT, "IORT Memory Access Properties"); - AcpiDmDumpTable (TableLength, CurrentOffset, Target, + Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + LastOutputBlankLine = TRUE; break; diff --git a/src/acpica/source/common/dmtbdump.c b/src/acpica/source/common/dmtbdump.c index 3b68637..f1b5512 100644 --- a/src/acpica/source/common/dmtbdump.c +++ b/src/acpica/source/common/dmtbdump.c @@ -280,11 +280,16 @@ AcpiDmDumpRsdp ( ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table); UINT32 Length = sizeof (ACPI_RSDP_COMMON); UINT8 Checksum; + ACPI_STATUS Status; /* Dump the common ACPI 1.0 portion */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1); + if (ACPI_FAILURE (Status)) + { + return (Length); + } /* Validate the first checksum */ @@ -301,7 +306,11 @@ AcpiDmDumpRsdp ( if (Rsdp->Revision > 0) { Length = Rsdp->Length; - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2); + if (ACPI_FAILURE (Status)) + { + return (Length); + } /* Validate the extended checksum over entire RSDP */ @@ -419,37 +428,59 @@ void AcpiDmDumpFadt ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; + /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */ - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1); + if (ACPI_FAILURE (Status)) + { + return; + } /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */ if ((Table->Length > ACPI_FADT_V1_SIZE) && (Table->Length <= ACPI_FADT_V2_SIZE)) { - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); + if (ACPI_FAILURE (Status)) + { + return; + } } /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */ else if (Table->Length > ACPI_FADT_V2_SIZE) { - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); + if (ACPI_FAILURE (Status)) + { + return; + } /* Check for FADT revision 5 fields and up (ACPI 5.0+) */ if (Table->Length > ACPI_FADT_V3_SIZE) { - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5); + if (ACPI_FAILURE (Status)) + { + return; + } } /* Check for FADT revision 6 fields and up (ACPI 6.0+) */ if (Table->Length > ACPI_FADT_V3_SIZE) { - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6); + if (ACPI_FAILURE (Status)) + { + return; + } } } @@ -1208,7 +1239,7 @@ AcpiDmDumpDrtm ( AcpiDmTableInfoDrtm1); if (ACPI_FAILURE (Status)) { - return; + return; } Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources); @@ -1236,13 +1267,9 @@ AcpiDmDumpDrtm ( DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset); AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, + (void) AcpiDmDumpTable (Table->Length, Offset, DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2); - if (ACPI_FAILURE (Status)) - { - return; - } } @@ -1866,6 +1893,10 @@ AcpiDmDumpIort ( Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), Length, AcpiDmTableInfoIort3a); + if (ACPI_FAILURE (Status)) + { + return; + } NodeOffset = IortSmmu->ContextInterruptOffset; for (i = 0; i < IortSmmu->ContextInterruptCount; i++) @@ -1873,6 +1904,10 @@ AcpiDmDumpIort ( Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 8, AcpiDmTableInfoIort3b); + if (ACPI_FAILURE (Status)) + { + return; + } NodeOffset += 8; } @@ -1882,6 +1917,10 @@ AcpiDmDumpIort ( Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 8, AcpiDmTableInfoIort3c); + if (ACPI_FAILURE (Status)) + { + return; + } NodeOffset += 8; } } @@ -1902,6 +1941,10 @@ AcpiDmDumpIort ( Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), Length, AcpiDmTableInfoIortMap); + if (ACPI_FAILURE (Status)) + { + return; + } NodeOffset += Length; } @@ -2076,6 +2119,10 @@ AcpiDmDumpIvrs ( Status = AcpiDmDumpTable (Table->Length, EntryOffset, DeviceEntry, EntryLength, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } EntryOffset += EntryLength; DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, @@ -2759,6 +2806,11 @@ AcpiDmDumpNfit ( Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, &Interleave->LineOffset[i], sizeof (UINT32), AcpiDmTableInfoNfit2a); + if (ACPI_FAILURE (Status)) + { + return; + } + FieldOffset += sizeof (UINT32); } break; @@ -2787,6 +2839,11 @@ AcpiDmDumpNfit ( Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, &Hint->HintAddress[i], sizeof (UINT64), AcpiDmTableInfoNfit6a); + if (ACPI_FAILURE (Status)) + { + return; + } + FieldOffset += sizeof (UINT64); } break; @@ -3198,7 +3255,7 @@ void AcpiDmDumpSlic ( ACPI_TABLE_HEADER *Table) { - AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table, + (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table, Table->Length - sizeof (*Table), AcpiDmTableInfoSlic); } @@ -3430,6 +3487,77 @@ AcpiDmDumpStao ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpTcpa + * + * PARAMETERS: Table - A TCPA table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a TCPA. + * + * NOTE: There are two versions of the table with the same signature: + * the client version and the server version. The common + * PlatformClass field is used to differentiate the two types of + * tables. + * + ******************************************************************************/ + +void +AcpiDmDumpTcpa ( + ACPI_TABLE_HEADER *Table) +{ + UINT32 Offset = sizeof (ACPI_TABLE_TCPA_HDR); + ACPI_TABLE_TCPA_HDR *CommonHeader = ACPI_CAST_PTR ( + ACPI_TABLE_TCPA_HDR, Table); + ACPI_TABLE_TCPA_HDR *SubTable = ACPI_ADD_PTR ( + ACPI_TABLE_TCPA_HDR, Table, Offset); + ACPI_STATUS Status; + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, + 0, AcpiDmTableInfoTcpaHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* + * Examine the PlatformClass field to determine the table type. + * Either a client or server table. Only one. + */ + switch (CommonHeader->PlatformClass) + { + case ACPI_TCPA_CLIENT_TABLE: + + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + Table->Length - Offset, AcpiDmTableInfoTcpaClient); + break; + + case ACPI_TCPA_SERVER_TABLE: + + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + Table->Length - Offset, AcpiDmTableInfoTcpaServer); + break; + + default: + + AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n", + CommonHeader->PlatformClass); + Status = AE_ERROR; + break; + } + + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n"); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpVrtc * * PARAMETERS: Table - A VRTC table @@ -3569,10 +3697,6 @@ AcpiDmDumpWpbt ( /* Dump the arguments buffer */ - AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength, + (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength, AcpiDmTableInfoWpbt0); - if (ACPI_FAILURE (Status)) - { - return; - } } diff --git a/src/acpica/source/common/dmtbinfo.c b/src/acpica/source/common/dmtbinfo.c index aab5d72..c10e089 100644 --- a/src/acpica/source/common/dmtbinfo.c +++ b/src/acpica/source/common/dmtbinfo.c @@ -185,7 +185,7 @@ #define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f) #define ACPI_SRAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f) #define ACPI_STAO_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_STAO,f) -#define ACPI_TCPA_CLIENT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f) +#define ACPI_TCPA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_HDR,f) #define ACPI_TPM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM2,f) #define ACPI_UEFI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f) #define ACPI_WAET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WAET,f) @@ -302,6 +302,8 @@ #define ACPI_SRAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) #define ACPI_SRAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f) #define ACPI_SRAT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_GICC_AFFINITY,f) +#define ACPI_TCPA_CLIENT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f) +#define ACPI_TCPA_SERVER_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_SERVER,f) #define ACPI_VRTC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VRTC_ENTRY,f) #define ACPI_WDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f) @@ -2685,16 +2687,53 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[] = * * TCPA - Trusted Computing Platform Alliance table (Client) * + * NOTE: There are two versions of the table with the same signature -- + * the client version and the server version. The common PlatformClass + * field is used to differentiate the two types of tables. + * ******************************************************************************/ -ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] = +ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaHdr[] = +{ + {ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (PlatformClass), "Platform Class", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaClient[] = { - {ACPI_DMT_UINT16, ACPI_TCPA_CLIENT_OFFSET (PlatformClass), "Platform Class", 0}, {ACPI_DMT_UINT32, ACPI_TCPA_CLIENT_OFFSET (MinimumLogLength), "Min Event Log Length", 0}, {ACPI_DMT_UINT64, ACPI_TCPA_CLIENT_OFFSET (LogAddress), "Event Log Address", 0}, ACPI_DMT_TERMINATOR }; +ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaServer[] = +{ + {ACPI_DMT_UINT16, ACPI_TCPA_SERVER_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_TCPA_SERVER_OFFSET (MinimumLogLength), "Min Event Log Length", 0}, + {ACPI_DMT_UINT64, ACPI_TCPA_SERVER_OFFSET (LogAddress), "Event Log Address", 0}, + {ACPI_DMT_UINT16, ACPI_TCPA_SERVER_OFFSET (SpecRevision), "Specification Revision", 0}, + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Device Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Pci Device", 0}, + {ACPI_DMT_FLAG1, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Bus is Pnp", 0}, + {ACPI_DMT_FLAG2, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Address Valid", 0}, + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Interrupt Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Polarity", 0}, + {ACPI_DMT_FLAG2, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "GPE SCI Triggered", 0}, + {ACPI_DMT_FLAG3, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Global System Interrupt", 0}, + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (GpeNumber), "Gpe Number", 0}, + {ACPI_DMT_UINT24, ACPI_TCPA_SERVER_OFFSET (Reserved2[0]), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_TCPA_SERVER_OFFSET (GlobalInterrupt), "Global Interrupt", 0}, + {ACPI_DMT_GAS, ACPI_TCPA_SERVER_OFFSET (Address), "Address", 0}, + {ACPI_DMT_UINT32, ACPI_TCPA_SERVER_OFFSET (Reserved3), "Reserved", 0}, + {ACPI_DMT_GAS, ACPI_TCPA_SERVER_OFFSET (ConfigAddress), "Configuration Address", 0}, + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Group), "Pci Group", 0}, + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Bus), "Pci Bus", 0}, + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Device), "Pci Device", 0}, + {ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Function), "Pci Function", 0}, + ACPI_DMT_TERMINATOR +}; + /******************************************************************************* * diff --git a/src/acpica/source/compiler/aslascii.c b/src/acpica/source/compiler/aslascii.c index 07f7af8..0037077 100644 --- a/src/acpica/source/compiler/aslascii.c +++ b/src/acpica/source/compiler/aslascii.c @@ -249,6 +249,11 @@ FlCheckForAscii ( /* Open file in text mode so file offset is always accurate */ Handle = fopen (Filename, "rb"); + if (!Handle) + { + perror ("Could not open input file"); + return (AE_ERROR); + } Status.Line = 1; Status.Offset = 0; diff --git a/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c index c172387..5a0379d 100644 --- a/src/acpica/source/compiler/aslcompile.c +++ b/src/acpica/source/compiler/aslcompile.c @@ -172,6 +172,10 @@ CmDoCompile ( Event = UtBeginEvent ("Preprocess input file"); if (Gbl_PreprocessFlag) { + /* Enter compiler name as a #define */ + + PrAddDefine (ASL_DEFINE, "", FALSE); + /* Preprocessor */ PrDoPreprocess (); diff --git a/src/acpica/source/compiler/asldefine.h b/src/acpica/source/compiler/asldefine.h index 4b71af1..168a129 100644 --- a/src/acpica/source/compiler/asldefine.h +++ b/src/acpica/source/compiler/asldefine.h @@ -124,6 +124,7 @@ #define AML_DISASSEMBLER_NAME "AML/ASL+ Disassembler" #define ASL_INVOCATION_NAME "iasl" #define ASL_CREATOR_ID "INTL" +#define ASL_DEFINE "__IASL__" #define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.0" @@ -227,12 +228,6 @@ #define ACPI_COMPILER_RESERVED_NAME (ACPI_UINT32_MAX - 3) -/* String to Integer conversion */ - -#define NEGATIVE 1 -#define POSITIVE 0 - - /* Helper macros for resource tag creation */ #define RsCreateMultiBitField \ diff --git a/src/acpica/source/compiler/aslfiles.c b/src/acpica/source/compiler/aslfiles.c index 8a99f76..234e9b4 100644 --- a/src/acpica/source/compiler/aslfiles.c +++ b/src/acpica/source/compiler/aslfiles.c @@ -618,6 +618,26 @@ FlOpenMiscOutputFiles ( char *Filename; + /* Create/Open a map file if requested */ + + if (Gbl_MapfileFlag) + { + Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_MAP); + if (!Filename) + { + AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + + /* Open the hex file, text mode (closed at compiler exit) */ + + FlOpenFile (ASL_FILE_MAP_OUTPUT, Filename, "w+t"); + + AslCompilerSignon (ASL_FILE_MAP_OUTPUT); + AslCompilerFileHeader (ASL_FILE_MAP_OUTPUT); + } + /* All done for disassembler */ if (Gbl_FileType == ASL_INPUT_TYPE_ACPI_TABLE) @@ -884,26 +904,6 @@ FlOpenMiscOutputFiles ( AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT); } - /* Create/Open a map file if requested */ - - if (Gbl_MapfileFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_MAP); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the hex file, text mode (closed at compiler exit) */ - - FlOpenFile (ASL_FILE_MAP_OUTPUT, Filename, "w+t"); - - AslCompilerSignon (ASL_FILE_MAP_OUTPUT); - AslCompilerFileHeader (ASL_FILE_MAP_OUTPUT); - } - return (AE_OK); } diff --git a/src/acpica/source/compiler/asllookup.c b/src/acpica/source/compiler/asllookup.c index 4a7539a..35e628e 100644 --- a/src/acpica/source/compiler/asllookup.c +++ b/src/acpica/source/compiler/asllookup.c @@ -191,8 +191,73 @@ LkIsObjectUsed ( { ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); ACPI_NAMESPACE_NODE *Next; + ASL_METHOD_LOCAL *MethodLocals; + ASL_METHOD_LOCAL *MethodArgs; + UINT32 i; + if (Node->Type == ACPI_TYPE_METHOD) + { + if (!Node->Op || !Node->MethodLocals) + { + return (AE_OK); + } + + MethodLocals = (ASL_METHOD_LOCAL *) Node->MethodLocals; + MethodArgs = (ASL_METHOD_LOCAL *) Node->MethodArgs; + + /* + * Analysis of LocalX variables + */ + for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) + { + /* Warn for Locals that are set but never referenced */ + + if ((MethodLocals[i].Flags & ASL_LOCAL_INITIALIZED) && + (!(MethodLocals[i].Flags & ASL_LOCAL_REFERENCED))) + { + sprintf (MsgBuffer, "Local%u", i); + AslError (ASL_WARNING, ASL_MSG_LOCAL_NOT_USED, + MethodLocals[i].Op, MsgBuffer); + } + } + + /* + * Analysis of ArgX variables (standard method arguments, + * and remaining unused ArgX can also be used as locals) + */ + for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) + { + if (MethodArgs[i].Flags & ASL_ARG_IS_LOCAL) + { + /* Warn if ArgX is being used as a local, but not referenced */ + + if ((MethodArgs[i].Flags & ASL_ARG_INITIALIZED) && + (!(MethodArgs[i].Flags & ASL_ARG_REFERENCED))) + { + sprintf (MsgBuffer, "Arg%u", i); + AslError (ASL_WARNING, ASL_MSG_ARG_AS_LOCAL_NOT_USED, + MethodArgs[i].Op, MsgBuffer); + } + } + else + { + /* + * Remark if a normal method ArgX is not referenced. + * We ignore the predefined methods since often, not + * all arguments are needed or used. + */ + if ((Node->Name.Ascii[0] != '_') && + (!(MethodArgs[i].Flags & ASL_ARG_REFERENCED))) + { + sprintf (MsgBuffer, "Arg%u", i); + AslError (ASL_REMARK, ASL_MSG_ARG_NOT_USED, + MethodArgs[i].Op, MsgBuffer); + } + } + } + } + /* Referenced flag is set during the namespace xref */ if (Node->Flags & ANOBJ_IS_REFERENCED) diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c index 6e332f1..5373c2d 100644 --- a/src/acpica/source/compiler/aslmessages.c +++ b/src/acpica/source/compiler/aslmessages.c @@ -307,7 +307,11 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_BUFFER_ALLOCATION */ "Could not allocate line buffer", /* ASL_MSG_MISSING_DEPENDENCY */ "Missing dependency", /* ASL_MSG_ILLEGAL_FORWARD_REF */ "Illegal forward reference within a method", -/* ASL_MSG_ILLEGAL_METHOD_REF */ "Illegal reference across two methods" +/* ASL_MSG_ILLEGAL_METHOD_REF */ "Illegal reference across two methods", +/* ASL_MSG_LOCAL_NOT_USED */ "Method Local is set but never used", +/* ASL_MSG_ARG_AS_LOCAL_NOT_USED */ "Method Argument (as a local) is set but never used", +/* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used" + }; /* Table compiler */ diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h index 7501bbb..0e5469d 100644 --- a/src/acpica/source/compiler/aslmessages.h +++ b/src/acpica/source/compiler/aslmessages.h @@ -310,6 +310,9 @@ typedef enum ASL_MSG_MISSING_DEPENDENCY, ASL_MSG_ILLEGAL_FORWARD_REF, ASL_MSG_ILLEGAL_METHOD_REF, + ASL_MSG_LOCAL_NOT_USED, + ASL_MSG_ARG_AS_LOCAL_NOT_USED, + ASL_MSG_ARG_NOT_USED, /* These messages are used by the Data Table compiler only */ diff --git a/src/acpica/source/compiler/aslmethod.c b/src/acpica/source/compiler/aslmethod.c index c997c54..8ffb837 100644 --- a/src/acpica/source/compiler/aslmethod.c +++ b/src/acpica/source/compiler/aslmethod.c @@ -327,7 +327,7 @@ MtMethodAnalysisWalkBegin ( return (AE_ERROR); } - RegisterNumber = (Op->Asl.AmlOpcode & 0x000F); + RegisterNumber = (Op->Asl.AmlOpcode & 0x0007); /* * If the local is being used as a target, mark the local diff --git a/src/acpica/source/compiler/aslnamesp.c b/src/acpica/source/compiler/aslnamesp.c index e6d2898..c5a6fbd 100644 --- a/src/acpica/source/compiler/aslnamesp.c +++ b/src/acpica/source/compiler/aslnamesp.c @@ -481,7 +481,7 @@ NsDoOnePathname ( TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (Node, &TargetPath); + Status = AcpiNsHandleToPathname (Node, &TargetPath, FALSE); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/src/acpica/source/compiler/asloffset.c b/src/acpica/source/compiler/asloffset.c index 1dc432c..210a6f9 100644 --- a/src/acpica/source/compiler/asloffset.c +++ b/src/acpica/source/compiler/asloffset.c @@ -435,7 +435,7 @@ LsEmitOffsetTableEntry ( /* Get the full pathname to the namespace node */ TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (Node, &TargetPath); + Status = AcpiNsHandleToPathname (Node, &TargetPath, FALSE); if (ACPI_FAILURE (Status)) { return; diff --git a/src/acpica/source/compiler/aslopcodes.c b/src/acpica/source/compiler/aslopcodes.c index 809e5e7..4a00b74 100644 --- a/src/acpica/source/compiler/aslopcodes.c +++ b/src/acpica/source/compiler/aslopcodes.c @@ -863,43 +863,6 @@ OpcEncodePldBuffer ( /******************************************************************************* * - * FUNCTION: OpcStrupr (strupr) - * - * PARAMETERS: SrcString - The source string to convert - * - * RETURN: None - * - * DESCRIPTION: Convert string to uppercase - * - * NOTE: This is not a POSIX function, so it appears here, not in utclib.c - * - ******************************************************************************/ - -static void -OpcStrupr ( - char *SrcString) -{ - char *String; - - - if (!SrcString) - { - return; - } - - /* Walk entire string, uppercasing the letters */ - - for (String = SrcString; *String; String++) - { - *String = (char) toupper ((int) *String); - } - - return; -} - - -/******************************************************************************* - * * FUNCTION: OpcFindName * * PARAMETERS: List - Array of char strings to be searched @@ -923,7 +886,7 @@ OpcFindName ( UINT32 i; - OpcStrupr (Name); + AcpiUtStrupr (Name); for (i = 0, Str = List[0]; Str; i++, Str = List[i]) { @@ -972,13 +935,6 @@ OpcDoPld ( return; } - Buffer = UtLocalCalloc (ACPI_PLD_BUFFER_SIZE); - if (!Buffer) - { - AslError(ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, Op, NULL); - return; - } - memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO)); Node = Op->Asl.Child; diff --git a/src/acpica/source/compiler/aslopt.c b/src/acpica/source/compiler/aslopt.c index 8aae62e..ae8cbb3 100644 --- a/src/acpica/source/compiler/aslopt.c +++ b/src/acpica/source/compiler/aslopt.c @@ -727,7 +727,7 @@ OptOptimizeNamePath ( * format -- something we can easily manipulate */ TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (TargetNode, &TargetPath); + Status = AcpiNsHandleToPathname (TargetNode, &TargetPath, FALSE); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Getting Target NamePath", @@ -739,7 +739,7 @@ OptOptimizeNamePath ( /* CurrentPath is the path to this scope (where we are in the namespace) */ CurrentPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath); + Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath, FALSE); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Getting Current NamePath", diff --git a/src/acpica/source/compiler/aslstartup.c b/src/acpica/source/compiler/aslstartup.c index 0f8c728..9fa4f80 100644 --- a/src/acpica/source/compiler/aslstartup.c +++ b/src/acpica/source/compiler/aslstartup.c @@ -318,6 +318,11 @@ AslDoDisassembly ( return (Status); } + /* Handle additional output files for disassembler */ + + Gbl_FileType = ASL_INPUT_TYPE_ACPI_TABLE; + Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); + /* This is where the disassembly happens */ AcpiGbl_DbOpt_Disasm = TRUE; @@ -333,13 +338,6 @@ AslDoDisassembly ( AcpiDmUnresolvedWarning (0); -#if 0 - /* TBD: Handle additional output files for disassembler */ - - Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); - NsDisplayNamespace (); -#endif - /* Shutdown compiler and ACPICA subsystem */ AeClearErrorLog (); diff --git a/src/acpica/source/compiler/aslstubs.c b/src/acpica/source/compiler/aslstubs.c index 533f7de..bdb94c1 100644 --- a/src/acpica/source/compiler/aslstubs.c +++ b/src/acpica/source/compiler/aslstubs.c @@ -237,15 +237,6 @@ AcpiEvInitializeRegion ( return (AE_OK); } -void -AcpiExDoDebugObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - UINT32 Level, - UINT32 Index) -{ - return; -} - ACPI_STATUS AcpiExReadDataFromField ( ACPI_WALK_STATE *WalkState, @@ -288,6 +279,60 @@ AcpiExLoadOp ( return (AE_SUPPORT); } +void +AcpiExDoDebugObject ( + ACPI_OPERAND_OBJECT *SourceDesc, + UINT32 Level, + UINT32 Index) +{ + return; +} + +void +AcpiExStartTraceMethod ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState) +{ + return; +} + +void +AcpiExStopTraceMethod ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState) +{ + return; +} + +void +AcpiExStartTraceOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState) +{ + return; +} + +void +AcpiExStopTraceOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState) + +{ + return; +} + +void +AcpiExTracePoint ( + ACPI_TRACE_EVENT_TYPE Type, + BOOLEAN Begin, + UINT8 *Aml, + char *Pathname) +{ + return; +} + ACPI_STATUS AcpiTbFindTable ( char *Signature, diff --git a/src/acpica/source/compiler/asltypes.h b/src/acpica/source/compiler/asltypes.h index 0f08ae4..a536e02 100644 --- a/src/acpica/source/compiler/asltypes.h +++ b/src/acpica/source/compiler/asltypes.h @@ -374,5 +374,19 @@ typedef struct acpi_serial_info } ACPI_SERIAL_INFO; +typedef struct asl_method_local +{ + ACPI_PARSE_OBJECT *Op; + UINT8 Flags; + +} ASL_METHOD_LOCAL; + +/* Values for Flags field above */ + +#define ASL_LOCAL_INITIALIZED (1) +#define ASL_LOCAL_REFERENCED (1<<1) +#define ASL_ARG_IS_LOCAL (1<<2) +#define ASL_ARG_INITIALIZED (1<<3) +#define ASL_ARG_REFERENCED (1<<4) #endif /* __ASLTYPES_H */ diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c index 32d120d..6c0e757 100644 --- a/src/acpica/source/compiler/aslutils.c +++ b/src/acpica/source/compiler/aslutils.c @@ -1080,17 +1080,17 @@ stroul64 ( */ if (*String == '-') { - Sign = NEGATIVE; + Sign = ACPI_SIGN_NEGATIVE; ++String; } else if (*String == '+') { ++String; - Sign = POSITIVE; + Sign = ACPI_SIGN_POSITIVE; } else { - Sign = POSITIVE; + Sign = ACPI_SIGN_POSITIVE; } /* @@ -1178,7 +1178,7 @@ stroul64 ( /* If a minus sign was present, then "the conversion is negated": */ - if (Sign == NEGATIVE) + if (Sign == ACPI_SIGN_NEGATIVE) { ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; } diff --git a/src/acpica/source/compiler/aslxref.c b/src/acpica/source/compiler/aslxref.c index ab68b88..200abf3 100644 --- a/src/acpica/source/compiler/aslxref.c +++ b/src/acpica/source/compiler/aslxref.c @@ -138,6 +138,10 @@ XfNamespaceLocateEnd ( UINT32 Level, void *Context); +static ACPI_PARSE_OBJECT * +XfGetParentMethod ( + ACPI_PARSE_OBJECT *Op); + static BOOLEAN XfObjectExists ( char *Name); @@ -352,59 +356,16 @@ XfCheckFieldRange ( } -#ifdef __UNDER_DEVELOPMENT -/******************************************************************************* - * - * FUNCTION: XfIsObjectParental - * - * PARAMETERS: ChildOp - Op to be checked - * PossibleParentOp - Determine if this op is in the family - * - * RETURN: TRUE if ChildOp is a descendent of PossibleParentOp - * - * DESCRIPTION: Determine if an Op is a descendent of another Op. Used to - * detect if a method is declared within another method. - * - ******************************************************************************/ - -static BOOLEAN -XfIsObjectParental ( - ACPI_PARSE_OBJECT *ChildOp, - ACPI_PARSE_OBJECT *PossibleParentOp) -{ - ACPI_PARSE_OBJECT *ParentOp; - - - /* Search upwards through the tree for possible parent */ - - ParentOp = ChildOp; - while (ParentOp) - { - if (ParentOp == PossibleParentOp) - { - return (TRUE); - } - - ParentOp = ParentOp->Asl.Parent; - } - - return (FALSE); -} - - /******************************************************************************* * * FUNCTION: XfGetParentMethod * - * PARAMETERS: Op - Op to be checked - * - * RETURN: Op for parent method. NULL if object is not within a method. + * PARAMETERS: Op - Parse Op to be checked * - * DESCRIPTION: Determine if an object is within a control method. Used to - * implement special rules for named references from within a - * control method. + * RETURN: Control method Op if found. NULL otherwise * - * NOTE: It would be better to have the parser set a flag in the Op if possible. + * DESCRIPTION: Find the control method parent of a parse op. Returns NULL if + * the input Op is not within a control method. * ******************************************************************************/ @@ -412,120 +373,22 @@ static ACPI_PARSE_OBJECT * XfGetParentMethod ( ACPI_PARSE_OBJECT *Op) { - ACPI_PARSE_OBJECT *ParentOp; - - - if (!Op) - { - return (NULL); - } - - if (Op->Asl.ParseOpcode == PARSEOP_METHOD) - { - return (NULL); - } - - /* Walk upwards through the parse tree, up to the root if necessary */ - - ParentOp = Op; - while (ParentOp) - { - if (ParentOp->Asl.ParseOpcode == PARSEOP_METHOD) - { - return (ParentOp); - } - - ParentOp = ParentOp->Asl.Parent; - } - - /* Object is not within a method */ - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: XfCheckIllegalReference - * - * PARAMETERS: Op - Op referring to the target - * TargetNode - Target of the reference - * - * RETURN: None. Emits error message for an illegal reference - * - * DESCRIPTION: Determine if a named reference is legal. A "named" reference - * is something like: Store(ABCD, ...), where ABCD is an AML - * Nameseg or Namepath. - * - * NOTE: Caller must ensure that the name Op is in fact a reference, and not - * an actual name declaration (creation of a named object). - * - ******************************************************************************/ - -static void -XfCheckIllegalReference ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *TargetNode) -{ - ACPI_PARSE_OBJECT *MethodOp1; - ACPI_PARSE_OBJECT *MethodOp2; - ACPI_PARSE_OBJECT *TargetOp; - - - /* - * Check for an illegal reference to a named object: - * - * 1) References from one control method to another, non-parent - * method are not allowed, they will fail at runtime. - * - * 2) Forward references within a control method are not allowed. - * AML interpreters use a one-pass parse of control methods - * so these forward references will fail at runtime. - */ - TargetOp = TargetNode->Op; - - MethodOp1 = XfGetParentMethod (Op); - MethodOp2 = XfGetParentMethod (TargetOp); - - /* Are both objects within control method(s)? */ - - if (!MethodOp1 || !MethodOp2) - { - return; - } + ACPI_PARSE_OBJECT *NextOp; - /* Objects not in the same method? */ - if (MethodOp1 != MethodOp2) + NextOp = Op->Asl.Parent; + while (NextOp) { - /* - * 1) Cross-method named reference - * - * This is OK if and only if the target reference is within in a - * method that is a parent of current method - */ - if (!XfIsObjectParental (MethodOp1, MethodOp2)) + if (NextOp->Asl.AmlOpcode == AML_METHOD_OP) { - AslError (ASL_ERROR, ASL_MSG_ILLEGAL_METHOD_REF, Op, - Op->Asl.ExternalName); + return (NextOp); } - } - /* - * 2) Both reference and target are in the same method. Check if this is - * an (illegal) forward reference by examining the exact source code - * location of each (the referenced object and the object declaration). - * This is a bit nasty, yet effective. - */ - else if (Op->Asl.LogicalByteOffset < TargetOp->Asl.LogicalByteOffset) - { - AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op, - Op->Asl.ExternalName); + NextOp = NextOp->Asl.Parent; } + return (NULL); /* No parent method found */ } -#endif - /******************************************************************************* * @@ -568,10 +431,67 @@ XfNamespaceLocateBegin ( UINT8 Message = 0; const ACPI_OPCODE_INFO *OpInfo; UINT32 Flags; + ASL_METHOD_LOCAL *MethodLocals = NULL; + ASL_METHOD_LOCAL *MethodArgs = NULL; + int RegisterNumber; + UINT32 i; ACPI_FUNCTION_TRACE_PTR (XfNamespaceLocateBegin, Op); + + if ((Op->Asl.AmlOpcode == AML_METHOD_OP) && Op->Asl.Node) + { + Node = Op->Asl.Node; + + /* Support for method LocalX/ArgX analysis */ + + if (!Node->MethodLocals) + { + /* Create local/arg info blocks */ + + MethodLocals = UtLocalCalloc ( + sizeof (ASL_METHOD_LOCAL) * ACPI_METHOD_NUM_LOCALS); + Node->MethodLocals = MethodLocals; + + MethodArgs = UtLocalCalloc ( + sizeof (ASL_METHOD_LOCAL) * ACPI_METHOD_NUM_ARGS); + Node->MethodArgs = MethodArgs; + + /* + * Get the method argument count + * First, get the name node + */ + NextOp = Op->Asl.Child; + + /* Get the NumArguments node */ + + NextOp = NextOp->Asl.Next; + Node->ArgCount = (UINT8) + (((UINT8) NextOp->Asl.Value.Integer) & 0x07); + + /* We will track all posible ArgXs */ + + for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) + { + if (i < Node->ArgCount) + { + /* Real Args are always "initialized" */ + + MethodArgs[i].Flags = ASL_ARG_INITIALIZED; + } + else + { + /* Other ArgXs can be used as locals */ + + MethodArgs[i].Flags = ASL_ARG_IS_LOCAL; + } + + MethodArgs[i].Op = Op; + } + } + } + /* * If this node is the actual declaration of a name * [such as the XXXX name in "Method (XXXX)"], @@ -584,10 +504,88 @@ XfNamespaceLocateBegin ( return_ACPI_STATUS (AE_OK); } - /* We are only interested in opcodes that have an associated name */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); + /* Check method LocalX variables */ + + if (OpInfo->Type == AML_TYPE_LOCAL_VARIABLE) + { + /* Find parent method Op */ + + NextOp = XfGetParentMethod (Op); + if (!NextOp) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get method node */ + + Node = NextOp->Asl.Node; + + RegisterNumber = Op->Asl.AmlOpcode & 0x0007; /* 0x60 through 0x67 */ + MethodLocals = Node->MethodLocals; + + if (Op->Asl.CompileFlags & NODE_IS_TARGET) + { + /* Local is being initialized */ + + MethodLocals[RegisterNumber].Flags |= ASL_LOCAL_INITIALIZED; + MethodLocals[RegisterNumber].Op = Op; + + return_ACPI_STATUS (AE_OK); + } + + /* Mark this Local as referenced */ + + MethodLocals[RegisterNumber].Flags |= ASL_LOCAL_REFERENCED; + MethodLocals[RegisterNumber].Op = Op; + + return_ACPI_STATUS (AE_OK); + } + + /* Check method ArgX variables */ + + if (OpInfo->Type == AML_TYPE_METHOD_ARGUMENT) + { + /* Find parent method Op */ + + NextOp = XfGetParentMethod (Op); + if (!NextOp) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get method node */ + + Node = NextOp->Asl.Node; + + /* Get Arg # */ + + RegisterNumber = Op->Asl.AmlOpcode - AML_ARG0; /* 0x68 through 0x6F */ + MethodArgs = Node->MethodArgs; + + if (Op->Asl.CompileFlags & NODE_IS_TARGET) + { + /* Arg is being initialized */ + + MethodArgs[RegisterNumber].Flags |= ASL_ARG_INITIALIZED; + MethodArgs[RegisterNumber].Op = Op; + + return_ACPI_STATUS (AE_OK); + } + + /* Mark this Arg as referenced */ + + MethodArgs[RegisterNumber].Flags |= ASL_ARG_REFERENCED; + MethodArgs[RegisterNumber].Op = Op; + + return_ACPI_STATUS (AE_OK); + } + + /* + * After method ArgX and LocalX, we are only interested in opcodes + * that have an associated name + */ if ((!(OpInfo->Flags & AML_NAMED)) && (!(OpInfo->Flags & AML_CREATE)) && (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && @@ -1166,3 +1164,178 @@ XfNamespaceLocateEnd ( return_ACPI_STATUS (AE_OK); } + + +#ifdef __UNDER_DEVELOPMENT +/******************************************************************************* + * + * FUNCTION: XfIsObjectParental + * + * PARAMETERS: ChildOp - Op to be checked + * PossibleParentOp - Determine if this op is in the family + * + * RETURN: TRUE if ChildOp is a descendent of PossibleParentOp + * + * DESCRIPTION: Determine if an Op is a descendent of another Op. Used to + * detect if a method is declared within another method. + * + ******************************************************************************/ + +static BOOLEAN +XfIsObjectParental ( + ACPI_PARSE_OBJECT *ChildOp, + ACPI_PARSE_OBJECT *PossibleParentOp) +{ + ACPI_PARSE_OBJECT *ParentOp; + + + /* Search upwards through the tree for possible parent */ + + ParentOp = ChildOp; + while (ParentOp) + { + if (ParentOp == PossibleParentOp) + { + return (TRUE); + } + + ParentOp = ParentOp->Asl.Parent; + } + + return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION: XfGetParentMethod + * + * PARAMETERS: Op - Op to be checked + * + * RETURN: Op for parent method. NULL if object is not within a method. + * + * DESCRIPTION: Determine if an object is within a control method. Used to + * implement special rules for named references from within a + * control method. + * + * NOTE: It would be better to have the parser set a flag in the Op if possible. + * + ******************************************************************************/ + +static ACPI_PARSE_OBJECT * +XfGetParentMethod ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *ParentOp; + + + if (!Op) + { + return (NULL); + } + + if (Op->Asl.ParseOpcode == PARSEOP_METHOD) + { + return (NULL); + } + + /* Walk upwards through the parse tree, up to the root if necessary */ + + ParentOp = Op; + while (ParentOp) + { + if (ParentOp->Asl.ParseOpcode == PARSEOP_METHOD) + { + return (ParentOp); + } + + ParentOp = ParentOp->Asl.Parent; + } + + /* Object is not within a method */ + + return (NULL); +} + + +/******************************************************************************* + * + * FUNCTION: XfCheckIllegalReference + * + * PARAMETERS: Op - Op referring to the target + * TargetNode - Target of the reference + * + * RETURN: None. Emits error message for an illegal reference + * + * DESCRIPTION: Determine if a named reference is legal. A "named" reference + * is something like: Store(ABCD, ...), where ABCD is an AML + * Nameseg or Namepath. + * + * NOTE: Caller must ensure that the name Op is in fact a reference, and not + * an actual name declaration (creation of a named object). + * + ******************************************************************************/ + +static void +XfCheckIllegalReference ( + ACPI_PARSE_OBJECT *Op, + ACPI_NAMESPACE_NODE *TargetNode) +{ + ACPI_PARSE_OBJECT *MethodOp1; + ACPI_PARSE_OBJECT *MethodOp2; + ACPI_PARSE_OBJECT *TargetOp; + + + /* + * Check for an illegal reference to a named object: + * + * 1) References from one control method to another, non-parent + * method are not allowed, they will fail at runtime. + * + * 2) Forward references within a control method are not allowed. + * AML interpreters use a one-pass parse of control methods + * so these forward references will fail at runtime. + */ + TargetOp = TargetNode->Op; + + MethodOp1 = XfGetParentMethod (Op); + MethodOp2 = XfGetParentMethod (TargetOp); + + /* Are both objects within control method(s)? */ + + if (!MethodOp1 || !MethodOp2) + { + return; + } + + /* Objects not in the same method? */ + + if (MethodOp1 != MethodOp2) + { + /* + * 1) Cross-method named reference + * + * This is OK if and only if the target reference is within in a + * method that is a parent of current method + */ + if (!XfIsObjectParental (MethodOp1, MethodOp2)) + { + AslError (ASL_ERROR, ASL_MSG_ILLEGAL_METHOD_REF, Op, + Op->Asl.ExternalName); + } + } + + /* + * 2) Both reference and target are in the same method. Check if this is + * an (illegal) forward reference by examining the exact source code + * location of each (the referenced object and the object declaration). + * This is a bit nasty, yet effective. + */ + else if (Op->Asl.LogicalByteOffset < TargetOp->Asl.LogicalByteOffset) + { + AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op, + Op->Asl.ExternalName); + } + +} +#endif diff --git a/src/acpica/source/compiler/dtcompiler.h b/src/acpica/source/compiler/dtcompiler.h index 212e940..b40f371 100644 --- a/src/acpica/source/compiler/dtcompiler.h +++ b/src/acpica/source/compiler/dtcompiler.h @@ -609,6 +609,10 @@ DtCompileStao ( void **PFieldList); ACPI_STATUS +DtCompileTcpa ( + void **PFieldList); + +ACPI_STATUS DtCompileUefi ( void **PFieldList); diff --git a/src/acpica/source/compiler/dttable.c b/src/acpica/source/compiler/dttable.c index 80b8a95..312c53f 100644 --- a/src/acpica/source/compiler/dttable.c +++ b/src/acpica/source/compiler/dttable.c @@ -3194,6 +3194,77 @@ DtCompileStao ( /****************************************************************************** * + * FUNCTION: DtCompileTcpa + * + * PARAMETERS: PFieldList - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile TCPA. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileTcpa ( + void **List) +{ + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_SUBTABLE *Subtable; + ACPI_TABLE_TCPA_HDR *TcpaHeader; + DT_SUBTABLE *ParentTable; + ACPI_STATUS Status; + + + /* Compile the main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* + * Examine the PlatformClass field to determine the table type. + * Either a client or server table. Only one. + */ + TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer); + + switch (TcpaHeader->PlatformClass) + { + case ACPI_TCPA_CLIENT_TABLE: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaClient, + &Subtable, TRUE); + break; + + case ACPI_TCPA_SERVER_TABLE: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaServer, + &Subtable, TRUE); + break; + + default: + + AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n", + TcpaHeader->PlatformClass); + Status = AE_ERROR; + break; + } + + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + return (Status); +} + + +/****************************************************************************** + * * FUNCTION: DtGetGenericTableInfo * * PARAMETERS: Name - Generic type name diff --git a/src/acpica/source/compiler/dttemplate.h b/src/acpica/source/compiler/dttemplate.h index 9b08e4b..4f158b9 100644 --- a/src/acpica/source/compiler/dttemplate.h +++ b/src/acpica/source/compiler/dttemplate.h @@ -1216,13 +1216,19 @@ const unsigned char TemplateStao[] = const unsigned char TemplateTcpa[] = { - 0x54,0x43,0x50,0x41,0x32,0x00,0x00,0x00, /* 00000000 "TCPA2..." */ - 0x01,0x67,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".gINTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x54,0x43,0x50,0x41,0x64,0x00,0x00,0x00, /* 00000000 "TCPAd..." */ + 0x02,0xFF,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ 0x80,0x31,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 ".1..INTL" */ - 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */ - 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ - 0x00,0x00 /* 00000030 ".." */ + 0x19,0x06,0x15,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ + 0x11,0x00,0xFF,0xEE,0xDD,0xCC,0xBB,0xAA, /* 00000030 "........" */ + 0x02,0x01,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x03, /* 00000040 "..... .." */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x03, /* 00000050 "..... .." */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x01,0x01,0x01 /* 00000060 "...." */ }; const unsigned char TemplateTpm2[] = diff --git a/src/acpica/source/compiler/prparser.l b/src/acpica/source/compiler/prparser.l index e104107..20197df 100644 --- a/src/acpica/source/compiler/prparser.l +++ b/src/acpica/source/compiler/prparser.l @@ -122,14 +122,22 @@ #define STRING_SETUP strcpy (StringBuffer, PrParsertext);\ PrParserlval.str = StringBuffer -#define YY_NO_INPUT /* No file input, we use strings only */ - #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("prscanner") + + +/* Local prototypes */ + +static char +PrDoCommentType1 ( + void); + +static char +PrDoCommentType2 ( + void); %} %option noyywrap -%option nounput Number [0-9a-fA-F]+ HexNumber 0[xX][0-9a-fA-F]+ @@ -138,6 +146,8 @@ NewLine [\n] Identifier [a-zA-Z][0-9a-zA-Z]* %% +"/*" { if (!PrDoCommentType1 ()) {yyterminate ();} } +"//" { if (!PrDoCommentType2 ()) {yyterminate ();} } \( return (EXPOP_PAREN_OPEN); \) return (EXPOP_PAREN_CLOSE); @@ -223,3 +233,76 @@ PrTerminateLexer ( yy_delete_buffer (LexBuffer); } + + +/******************************************************************************** + * + * FUNCTION: PrDoCommentType1 + * + * PARAMETERS: none + * + * RETURN: none + * + * DESCRIPTION: Process a new legacy comment. Just toss it. + * + ******************************************************************************/ + +static char +PrDoCommentType1 ( + void) +{ + int c; + + +Loop: + while (((c = input ()) != '*') && (c != EOF)) + { + } + if (c == EOF) + { + return (FALSE); + } + + if (((c = input ()) != '/') && (c != EOF)) + { + unput (c); + goto Loop; + } + if (c == EOF) + { + return (FALSE); + } + + return (TRUE); +} + + +/******************************************************************************** + * + * FUNCTION: PrDoCommentType2 + * + * PARAMETERS: none + * + * RETURN: none + * + * DESCRIPTION: Process a new "//" comment. Just toss it. + * + ******************************************************************************/ + +static char +PrDoCommentType2 ( + void) +{ + int c; + + + while (((c = input ()) != '\n') && (c != EOF)) + { + } + if (c == EOF) + { + return (FALSE); + } + + return (TRUE); +} diff --git a/src/acpica/source/compiler/prparser.y b/src/acpica/source/compiler/prparser.y index 68c140f..dd88a2e 100644 --- a/src/acpica/source/compiler/prparser.y +++ b/src/acpica/source/compiler/prparser.y @@ -285,8 +285,11 @@ void PrParsererror ( char const *Message) { + + sprintf (StringBuffer, "Preprocessor Parser : %s (near line %u)", + Message, Gbl_CurrentLineNumber); DtError (ASL_ERROR, ASL_MSG_SYNTAX, - NULL, (char *) Message); + NULL, (char *) StringBuffer); } diff --git a/src/acpica/source/compiler/prscan.c b/src/acpica/source/compiler/prscan.c index 51657d6..bc88f76 100644 --- a/src/acpica/source/compiler/prscan.c +++ b/src/acpica/source/compiler/prscan.c @@ -192,7 +192,6 @@ static const PR_DIRECTIVE_INFO Gbl_DirectiveInfo[] = {"include", 0}, /* Argument is not standard format, so just use 0 here */ {"includebuffer", 0}, /* Argument is not standard format, so just use 0 here */ {"line", 1}, - {"loadbuffer", 0}, {"pragma", 1}, {"undef", 1}, {"warning", 1}, @@ -216,7 +215,7 @@ enum Gbl_DirectiveIndexes PR_DIRECTIVE_LINE, PR_DIRECTIVE_PRAGMA, PR_DIRECTIVE_UNDEF, - PR_DIRECTIVE_WARNING, + PR_DIRECTIVE_WARNING }; #define ASL_DIRECTIVE_NOT_FOUND -1 @@ -400,7 +399,7 @@ PrPreprocessInputFile ( PrGetNextLineInit (); - /* Scan line-by-line. Comments and blank lines are skipped by this function */ + /* Scan source line-by-line and process directives. Then write the .i file */ while ((Status = PrGetNextLine (Gbl_Files[ASL_FILE_INPUT].Handle)) != ASL_EOF) { @@ -551,6 +550,16 @@ PrDoDirective ( } /* + * Emit a line directive into the preprocessor file (.pre) after + * every matched directive. This is passed through to the compiler + * so that error/warning messages are kept in sync with the + * original source file. + */ + FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\" // #%s\n", + Gbl_CurrentLineNumber, Gbl_Files[ASL_FILE_INPUT].Filename, + Gbl_DirectiveInfo[Directive].Name); + + /* * If we are currently ignoring this block and we encounter a #else or * #elif, we must ignore their blocks also if the parent block is also * being ignored. @@ -897,6 +906,9 @@ PrDoDirective ( PrError (ASL_WARNING, ASL_MSG_WARNING_DIRECTIVE, THIS_TOKEN_OFFSET (Token)); + + Gbl_SourceLine = 0; + Gbl_NextError = Gbl_ErrorLog; break; default: @@ -935,7 +947,9 @@ SyntaxError: ******************************************************************************/ #define PR_NORMAL_TEXT 0 -#define PR_WITHIN_COMMENT 1 +#define PR_MULTI_LINE_COMMENT 1 +#define PR_SINGLE_LINE_COMMENT 2 +#define PR_QUOTED_STRING 3 static UINT8 AcpiGbl_LineScanState = PR_NORMAL_TEXT; @@ -976,22 +990,55 @@ PrGetNextLine ( return (ASL_EOF); } - /* We need to worry about multi-line slash-asterisk comments */ - - /* Check for comment open */ + /* Update state machine as necessary */ - if ((AcpiGbl_LineScanState == PR_NORMAL_TEXT) && - (PreviousChar == '/') && (c == '*')) + switch (AcpiGbl_LineScanState) { - AcpiGbl_LineScanState = PR_WITHIN_COMMENT; - } + case PR_NORMAL_TEXT: - /* Check for comment close */ + /* Check for multi-line comment start */ - if ((AcpiGbl_LineScanState == PR_WITHIN_COMMENT) && - (PreviousChar == '*') && (c == '/')) - { - AcpiGbl_LineScanState = PR_NORMAL_TEXT; + if ((PreviousChar == '/') && (c == '*')) + { + AcpiGbl_LineScanState = PR_MULTI_LINE_COMMENT; + } + + /* Check for single-line comment start */ + + else if ((PreviousChar == '/') && (c == '/')) + { + AcpiGbl_LineScanState = PR_SINGLE_LINE_COMMENT; + } + + /* Check for quoted string start */ + + else if (PreviousChar == '"') + { + AcpiGbl_LineScanState = PR_QUOTED_STRING; + } + break; + + case PR_QUOTED_STRING: + + if (PreviousChar == '"') + { + AcpiGbl_LineScanState = PR_NORMAL_TEXT; + } + break; + + case PR_MULTI_LINE_COMMENT: + + /* Check for multi-line comment end */ + + if ((PreviousChar == '*') && (c == '/')) + { + AcpiGbl_LineScanState = PR_NORMAL_TEXT; + } + break; + + case PR_SINGLE_LINE_COMMENT: /* Just ignore text until EOL */ + default: + break; } /* Always copy the character into line buffer */ @@ -1005,10 +1052,21 @@ PrGetNextLine ( { /* Handle multi-line comments */ - if (AcpiGbl_LineScanState == PR_WITHIN_COMMENT) + if (AcpiGbl_LineScanState == PR_MULTI_LINE_COMMENT) { return (ASL_WITHIN_COMMENT); } + + /* End of single-line comment */ + + if (AcpiGbl_LineScanState == PR_SINGLE_LINE_COMMENT) + { + AcpiGbl_LineScanState = PR_NORMAL_TEXT; + return (AE_OK); + } + + /* Blank line */ + if (i == 1) { return (ASL_BLANK_LINE); diff --git a/src/acpica/source/components/debugger/dbcmds.c b/src/acpica/source/components/debugger/dbcmds.c index db2f282..f3bed06 100644 --- a/src/acpica/source/components/debugger/dbcmds.c +++ b/src/acpica/source/components/debugger/dbcmds.c @@ -158,6 +158,8 @@ AcpiDbDoOneSleepState ( UINT8 SleepState); +static char *AcpiDbTraceMethodName = NULL; + /******************************************************************************* * * FUNCTION: AcpiDbConvertToNode @@ -1298,4 +1300,88 @@ AcpiDbGenerateSci ( #endif /* !ACPI_REDUCED_HARDWARE */ + +/******************************************************************************* + * + * FUNCTION: AcpiDbTrace + * + * PARAMETERS: EnableArg - ENABLE/AML to enable tracer + * DISABLE to disable tracer + * MethodArg - Method to trace + * OnceArg - Whether trace once + * + * RETURN: None + * + * DESCRIPTION: Control method tracing facility + * + ******************************************************************************/ + +void +AcpiDbTrace ( + char *EnableArg, + char *MethodArg, + char *OnceArg) +{ + UINT32 DebugLevel = 0; + UINT32 DebugLayer = 0; + UINT32 Flags = 0; + + + if (EnableArg) + { + AcpiUtStrupr (EnableArg); + } + if (OnceArg) + { + AcpiUtStrupr (OnceArg); + } + if (MethodArg) + { + if (AcpiDbTraceMethodName) + { + ACPI_FREE (AcpiDbTraceMethodName); + AcpiDbTraceMethodName = NULL; + } + AcpiDbTraceMethodName = ACPI_ALLOCATE (strlen (MethodArg) + 1); + if (!AcpiDbTraceMethodName) + { + AcpiOsPrintf ("Failed to allocate method name (%s)\n", MethodArg); + return; + } + strcpy (AcpiDbTraceMethodName, MethodArg); + } + if (!strcmp (EnableArg, "ENABLE") || + !strcmp (EnableArg, "METHOD") || + !strcmp (EnableArg, "OPCODE")) + { + if (!strcmp (EnableArg, "ENABLE")) + { + /* Inherit current console settings */ + + DebugLevel = AcpiGbl_DbConsoleDebugLevel; + DebugLayer = AcpiDbgLayer; + } + else + { + /* Restrict console output to trace points only */ + + DebugLevel = ACPI_LV_TRACE_POINT; + DebugLayer = ACPI_EXECUTER; + } + + Flags = ACPI_TRACE_ENABLED; + if (!strcmp (EnableArg, "OPCODE")) + { + Flags |= ACPI_TRACE_OPCODE; + } + if (OnceArg && !strcmp (OnceArg, "ONCE")) + { + Flags |= ACPI_TRACE_ONESHOT; + } + } + + (void) AcpiDebugTrace (AcpiDbTraceMethodName, + DebugLevel, DebugLayer, Flags); +} + #endif /* ACPI_DEBUGGER */ diff --git a/src/acpica/source/components/debugger/dbdisply.c b/src/acpica/source/components/debugger/dbdisply.c index e8ea451..1dd679b 100644 --- a/src/acpica/source/components/debugger/dbdisply.c +++ b/src/acpica/source/components/debugger/dbdisply.c @@ -121,7 +121,6 @@ #include "acparser.h" #include "acinterp.h" #include "acdebug.h" -#include "acdisasm.h" #ifdef ACPI_DEBUGGER @@ -585,7 +584,7 @@ AcpiDbDisplayLocals ( return; } - AcpiDmDisplayLocals (WalkState); + AcpiDbDecodeLocals (WalkState); } @@ -615,7 +614,7 @@ AcpiDbDisplayArguments ( return; } - AcpiDmDisplayArguments (WalkState); + AcpiDbDecodeArguments (WalkState); } @@ -671,7 +670,7 @@ AcpiDbDisplayResults ( { ObjDesc = Frame->Results.ObjDesc[Index]; AcpiOsPrintf ("Result%u: ", i); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); + AcpiDbDisplayInternalObject (ObjDesc, WalkState); if (Index == 0) { Frame = Frame->Results.Next; @@ -835,7 +834,7 @@ AcpiDbDisplayResultObject ( } AcpiOsPrintf ("ResultObj: "); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); + AcpiDbDisplayInternalObject (ObjDesc, WalkState); AcpiOsPrintf ("\n"); } @@ -865,7 +864,7 @@ AcpiDbDisplayArgumentObject ( } AcpiOsPrintf ("ArgObj: "); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); + AcpiDbDisplayInternalObject (ObjDesc, WalkState); } diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c index c3553cb..02fd0cd 100644 --- a/src/acpica/source/components/debugger/dbinput.c +++ b/src/acpica/source/components/debugger/dbinput.c @@ -290,7 +290,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = {"TABLES", 0}, {"TEMPLATE", 1}, {"TERMINATE", 0}, - {"TEST", 1}, + {"TEST", 1}, {"THREADS", 3}, {"TRACE", 1}, {"TREE", 0}, @@ -342,7 +342,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"}, {1, " Paths", "Display full pathnames of namespace objects\n"}, {1, " Predefined", "Check all predefined names\n"}, - {1, " Prefix [<NamePath>]", "Set or Get current execution prefix\n"}, + {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"}, {1, " References <Addr>", "Find all references to object at addr\n"}, {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"}, @@ -369,8 +369,12 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " Results", "Display method result stack\n"}, {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"}, {1, " Stop", "Terminate control method\n"}, - {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"}, - {1, " Trace <method name>", "Trace method execution\n"}, + {1, " Thread <Threads><Loops><Namepath>", "Spawn threads to execute method(s)\n"}, + {5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"}, + {1, " Enable", "Enable all messages\n"}, + {1, " Disable", "Disable tracing\n"}, + {1, " Method", "Enable method execution messages\n"}, + {1, " Opcode", "Enable opcode execution messages\n"}, {1, " Tree", "Display control method calling tree\n"}, {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, @@ -821,15 +825,22 @@ AcpiDbCommandDispatch ( return (AE_CTRL_TERMINATE); } - - /* Add all commands that come here to the history buffer */ - - AcpiDbAddToHistory (InputBuffer); + /* Find command and add to the history buffer */ ParamCount = AcpiDbGetLine (InputBuffer); CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]); Temp = 0; + /* + * We don't want to add the !! command to the history buffer. It + * would cause an infinite loop because it would always be the + * previous command. + */ + if (CommandIndex != CMD_HISTORY_LAST) + { + AcpiDbAddToHistory (InputBuffer); + } + /* Verify that we have the minimum number of params */ if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs) @@ -1182,7 +1193,7 @@ AcpiDbCommandDispatch ( case CMD_TRACE: - (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); + AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); break; case CMD_TREE: diff --git a/src/acpica/source/components/debugger/dbmethod.c b/src/acpica/source/components/debugger/dbmethod.c index f6c9c51..3ea2639 100644 --- a/src/acpica/source/components/debugger/dbmethod.c +++ b/src/acpica/source/components/debugger/dbmethod.c @@ -118,7 +118,9 @@ #include "acdispat.h" #include "acnamesp.h" #include "acdebug.h" +#ifdef ACPI_DISASSEMBLER #include "acdisasm.h" +#endif #include "acparser.h" #include "acpredef.h" @@ -151,6 +153,7 @@ AcpiDbSetMethodBreakpoint ( ACPI_PARSE_OBJECT *Op) { UINT32 Address; + UINT32 AmlOffset; if (!Op) @@ -162,10 +165,12 @@ AcpiDbSetMethodBreakpoint ( /* Get and verify the breakpoint address */ Address = strtoul (Location, NULL, 16); - if (Address <= Op->Common.AmlOffset) + AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, + WalkState->ParserState.AmlStart); + if (Address <= AmlOffset) { AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", - Address, Op->Common.AmlOffset); + Address, AmlOffset); } /* Save breakpoint in current walk */ @@ -310,7 +315,7 @@ AcpiDbSetMethodData ( ObjDesc = WalkState->Arguments[Index].Object; AcpiOsPrintf ("Arg%u: ", Index); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); + AcpiDbDisplayInternalObject (ObjDesc, WalkState); break; case 'L': @@ -333,7 +338,7 @@ AcpiDbSetMethodData ( ObjDesc = WalkState->LocalVariables[Index].Object; AcpiOsPrintf ("Local%u: ", Index); - AcpiDmDisplayInternalObject (ObjDesc, WalkState); + AcpiDbDisplayInternalObject (ObjDesc, WalkState); break; default: @@ -379,7 +384,9 @@ AcpiDbDisassembleAml ( NumStatements = strtoul (Statements, NULL, 0); } +#ifdef ACPI_DISASSEMBLER AcpiDmDisassemble (NULL, Op, NumStatements); +#endif } @@ -422,7 +429,7 @@ AcpiDbDisassembleMethod ( ObjDesc = Method->Object; - Op = AcpiPsCreateScopeOp (); + Op = AcpiPsCreateScopeOp (ObjDesc->Method.AmlStart); if (!Op) { return (AE_NO_MEMORY); @@ -462,6 +469,8 @@ AcpiDbDisassembleMethod ( WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; Status = AcpiPsParseAml (WalkState); + +#ifdef ACPI_DISASSEMBER (void) AcpiDmParseDeferredOps (Op); /* Now we can disassemble the method */ @@ -469,6 +478,7 @@ AcpiDbDisassembleMethod ( AcpiGbl_DbOpt_Verbose = FALSE; AcpiDmDisassemble (NULL, Op, 0); AcpiGbl_DbOpt_Verbose = TRUE; +#endif AcpiPsDeleteParseTree (Op); diff --git a/src/acpica/source/components/debugger/dbnames.c b/src/acpica/source/components/debugger/dbnames.c index 7d936c8..0fd752d 100644 --- a/src/acpica/source/components/debugger/dbnames.c +++ b/src/acpica/source/components/debugger/dbnames.c @@ -457,7 +457,7 @@ AcpiDbWalkAndMatchName ( /* Get the full pathname to this object */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); @@ -654,7 +654,7 @@ AcpiDbWalkForSpecificObjects ( /* Get and display the full pathname to this object */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); @@ -958,7 +958,7 @@ AcpiDbBusWalk ( /* Get the full path to this device object */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); diff --git a/src/acpica/source/components/debugger/dbobject.c b/src/acpica/source/components/debugger/dbobject.c new file mode 100644 index 0000000..5d2e0fb --- /dev/null +++ b/src/acpica/source/components/debugger/dbobject.c @@ -0,0 +1,597 @@ +/******************************************************************************* + * + * Module Name: dbobject - ACPI object decode and display + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acdebug.h" +#ifdef ACPI_DISASSEMBLER +#include "acdisasm.h" +#endif + + +#ifdef ACPI_DEBUGGER + +#define _COMPONENT ACPI_CA_DEBUGGER + ACPI_MODULE_NAME ("dbobject") + +/* Local prototypes */ + +static void +AcpiDbDecodeNode ( + ACPI_NAMESPACE_NODE *Node); + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDumpMethodInfo + * + * PARAMETERS: Status - Method execution status + * WalkState - Current state of the parse tree walk + * + * RETURN: None + * + * DESCRIPTION: Called when a method has been aborted because of an error. + * Dumps the method execution stack, and the method locals/args, + * and disassembles the AML opcode that failed. + * + ******************************************************************************/ + +void +AcpiDbDumpMethodInfo ( + ACPI_STATUS Status, + ACPI_WALK_STATE *WalkState) +{ + ACPI_THREAD_STATE *Thread; + + + /* Ignore control codes, they are not errors */ + + if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL) + { + return; + } + + /* We may be executing a deferred opcode */ + + if (WalkState->DeferredNode) + { + AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); + return; + } + + /* + * If there is no Thread, we are not actually executing a method. + * This can happen when the iASL compiler calls the interpreter + * to perform constant folding. + */ + Thread = WalkState->Thread; + if (!Thread) + { + return; + } + + /* Display the method locals and arguments */ + + AcpiOsPrintf ("\n"); + AcpiDbDecodeLocals (WalkState); + AcpiOsPrintf ("\n"); + AcpiDbDecodeArguments (WalkState); + AcpiOsPrintf ("\n"); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDecodeInternalObject + * + * PARAMETERS: ObjDesc - Object to be displayed + * + * RETURN: None + * + * DESCRIPTION: Short display of an internal object. Numbers/Strings/Buffers. + * + ******************************************************************************/ + +void +AcpiDbDecodeInternalObject ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + UINT32 i; + + + if (!ObjDesc) + { + AcpiOsPrintf (" Uninitialized"); + return; + } + + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) + { + AcpiOsPrintf (" %p [%s]", ObjDesc, AcpiUtGetDescriptorName (ObjDesc)); + return; + } + + AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc)); + + switch (ObjDesc->Common.Type) + { + case ACPI_TYPE_INTEGER: + + AcpiOsPrintf (" %8.8X%8.8X", + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); + break; + + case ACPI_TYPE_STRING: + + AcpiOsPrintf ("(%u) \"%.24s", + ObjDesc->String.Length, ObjDesc->String.Pointer); + + if (ObjDesc->String.Length > 24) + { + AcpiOsPrintf ("..."); + } + else + { + AcpiOsPrintf ("\""); + } + break; + + case ACPI_TYPE_BUFFER: + + AcpiOsPrintf ("(%u)", ObjDesc->Buffer.Length); + for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++) + { + AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); + } + break; + + default: + + AcpiOsPrintf (" %p", ObjDesc); + break; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDecodeNode + * + * PARAMETERS: Node - Object to be displayed + * + * RETURN: None + * + * DESCRIPTION: Short display of a namespace node + * + ******************************************************************************/ + +static void +AcpiDbDecodeNode ( + ACPI_NAMESPACE_NODE *Node) +{ + + AcpiOsPrintf ("<Node> Name %4.4s", + AcpiUtGetNodeName (Node)); + + if (Node->Flags & ANOBJ_METHOD_ARG) + { + AcpiOsPrintf (" [Method Arg]"); + } + if (Node->Flags & ANOBJ_METHOD_LOCAL) + { + AcpiOsPrintf (" [Method Local]"); + } + + switch (Node->Type) + { + /* These types have no attached object */ + + case ACPI_TYPE_DEVICE: + + AcpiOsPrintf (" Device"); + break; + + case ACPI_TYPE_THERMAL: + + AcpiOsPrintf (" Thermal Zone"); + break; + + default: + + AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node)); + break; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDisplayInternalObject + * + * PARAMETERS: ObjDesc - Object to be displayed + * WalkState - Current walk state + * + * RETURN: None + * + * DESCRIPTION: Short display of an internal object + * + ******************************************************************************/ + +void +AcpiDbDisplayInternalObject ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState) +{ + UINT8 Type; + + + AcpiOsPrintf ("%p ", ObjDesc); + + if (!ObjDesc) + { + AcpiOsPrintf ("<Null Object>\n"); + return; + } + + /* Decode the object type */ + + switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) + { + case ACPI_DESC_TYPE_PARSER: + + AcpiOsPrintf ("<Parser> "); + break; + + case ACPI_DESC_TYPE_NAMED: + + AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc); + break; + + case ACPI_DESC_TYPE_OPERAND: + + Type = ObjDesc->Common.Type; + if (Type > ACPI_TYPE_LOCAL_MAX) + { + AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type); + return; + } + + /* Decode the ACPI object type */ + + switch (ObjDesc->Common.Type) + { + case ACPI_TYPE_LOCAL_REFERENCE: + + AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc)); + + /* Decode the refererence */ + + switch (ObjDesc->Reference.Class) + { + case ACPI_REFCLASS_LOCAL: + + AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); + if (WalkState) + { + ObjDesc = WalkState->LocalVariables + [ObjDesc->Reference.Value].Object; + AcpiOsPrintf ("%p", ObjDesc); + AcpiDbDecodeInternalObject (ObjDesc); + } + break; + + case ACPI_REFCLASS_ARG: + + AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); + if (WalkState) + { + ObjDesc = WalkState->Arguments + [ObjDesc->Reference.Value].Object; + AcpiOsPrintf ("%p", ObjDesc); + AcpiDbDecodeInternalObject (ObjDesc); + } + break; + + case ACPI_REFCLASS_INDEX: + + switch (ObjDesc->Reference.TargetType) + { + case ACPI_TYPE_BUFFER_FIELD: + + AcpiOsPrintf ("%p", ObjDesc->Reference.Object); + AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); + break; + + case ACPI_TYPE_PACKAGE: + + AcpiOsPrintf ("%p", ObjDesc->Reference.Where); + if (!ObjDesc->Reference.Where) + { + AcpiOsPrintf (" Uninitialized WHERE pointer"); + } + else + { + AcpiDbDecodeInternalObject ( + *(ObjDesc->Reference.Where)); + } + break; + + default: + + AcpiOsPrintf ("Unknown index target type"); + break; + } + break; + + case ACPI_REFCLASS_REFOF: + + if (!ObjDesc->Reference.Object) + { + AcpiOsPrintf ("Uninitialized reference subobject pointer"); + break; + } + + /* Reference can be to a Node or an Operand object */ + + switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object)) + { + case ACPI_DESC_TYPE_NAMED: + AcpiDbDecodeNode (ObjDesc->Reference.Object); + break; + + case ACPI_DESC_TYPE_OPERAND: + AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); + break; + + default: + break; + } + break; + + case ACPI_REFCLASS_NAME: + + AcpiDbDecodeNode (ObjDesc->Reference.Node); + break; + + case ACPI_REFCLASS_DEBUG: + case ACPI_REFCLASS_TABLE: + + AcpiOsPrintf ("\n"); + break; + + default: /* Unknown reference class */ + + AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class); + break; + } + break; + + default: + + AcpiOsPrintf ("<Obj> "); + AcpiDbDecodeInternalObject (ObjDesc); + break; + } + break; + + default: + + AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]", + AcpiUtGetDescriptorName (ObjDesc)); + break; + } + + AcpiOsPrintf ("\n"); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDecodeLocals + * + * PARAMETERS: WalkState - State for current method + * + * RETURN: None + * + * DESCRIPTION: Display all locals for the currently running control method + * + ******************************************************************************/ + +void +AcpiDbDecodeLocals ( + ACPI_WALK_STATE *WalkState) +{ + UINT32 i; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_NAMESPACE_NODE *Node; + + + ObjDesc = WalkState->MethodDesc; + Node = WalkState->MethodNode; + if (!Node) + { + AcpiOsPrintf ( + "No method node (Executing subtree for buffer or opregion)\n"); + return; + } + + if (Node->Type != ACPI_TYPE_METHOD) + { + AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); + return; + } + + AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", + AcpiUtGetNodeName (Node)); + + for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) + { + ObjDesc = WalkState->LocalVariables[i].Object; + AcpiOsPrintf (" Local%X: ", i); + AcpiDbDisplayInternalObject (ObjDesc, WalkState); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDecodeArguments + * + * PARAMETERS: WalkState - State for current method + * + * RETURN: None + * + * DESCRIPTION: Display all arguments for the currently running control method + * + ******************************************************************************/ + +void +AcpiDbDecodeArguments ( + ACPI_WALK_STATE *WalkState) +{ + UINT32 i; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_NAMESPACE_NODE *Node; + + + ObjDesc = WalkState->MethodDesc; + Node = WalkState->MethodNode; + if (!Node) + { + AcpiOsPrintf ( + "No method node (Executing subtree for buffer or opregion)\n"); + return; + } + + if (Node->Type != ACPI_TYPE_METHOD) + { + AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); + return; + } + + AcpiOsPrintf ( + "Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n", + AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount, ObjDesc->Method.SyncLevel); + + for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) + { + ObjDesc = WalkState->Arguments[i].Object; + AcpiOsPrintf (" Arg%u: ", i); + AcpiDbDisplayInternalObject (ObjDesc, WalkState); + } +} + +#endif diff --git a/src/acpica/source/components/debugger/dbutils.c b/src/acpica/source/components/debugger/dbutils.c index 5c85a15..22a5c45 100644 --- a/src/acpica/source/components/debugger/dbutils.c +++ b/src/acpica/source/components/debugger/dbutils.c @@ -117,7 +117,6 @@ #include "accommon.h" #include "acnamesp.h" #include "acdebug.h" -#include "acdisasm.h" #ifdef ACPI_DEBUGGER @@ -295,7 +294,7 @@ AcpiDbDumpExternalObject ( case ACPI_TYPE_LOCAL_REFERENCE: AcpiOsPrintf ("[Object Reference] = "); - AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL); + AcpiDbDisplayInternalObject (ObjDesc->Reference.Handle, NULL); break; case ACPI_TYPE_PROCESSOR: diff --git a/src/acpica/source/components/debugger/dbxface.c b/src/acpica/source/components/debugger/dbxface.c index 673178f..2292152 100644 --- a/src/acpica/source/components/debugger/dbxface.c +++ b/src/acpica/source/components/debugger/dbxface.c @@ -117,7 +117,9 @@ #include "accommon.h" #include "amlcode.h" #include "acdebug.h" +#ifdef ACPI_DISASSEMBLER #include "acdisasm.h" +#endif #ifdef ACPI_DEBUGGER @@ -251,6 +253,7 @@ AcpiDbSingleStep ( UINT32 OriginalDebugLevel; ACPI_PARSE_OBJECT *DisplayOp; ACPI_PARSE_OBJECT *ParentOp; + UINT32 AmlOffset; ACPI_FUNCTION_ENTRY (); @@ -264,15 +267,18 @@ AcpiDbSingleStep ( return (AE_ABORT_METHOD); } + AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, + WalkState->ParserState.AmlStart); + /* Check for single-step breakpoint */ if (WalkState->MethodBreakpoint && - (WalkState->MethodBreakpoint <= Op->Common.AmlOffset)) + (WalkState->MethodBreakpoint <= AmlOffset)) { /* Check if the breakpoint has been reached or passed */ /* Hit the breakpoint, resume single step, reset breakpoint */ - AcpiOsPrintf ("***Break*** at AML offset %X\n", Op->Common.AmlOffset); + AcpiOsPrintf ("***Break*** at AML offset %X\n", AmlOffset); AcpiGbl_CmSingleStep = TRUE; AcpiGbl_StepToNextCall = FALSE; WalkState->MethodBreakpoint = 0; @@ -281,10 +287,10 @@ AcpiDbSingleStep ( /* Check for user breakpoint (Must be on exact Aml offset) */ else if (WalkState->UserBreakpoint && - (WalkState->UserBreakpoint == Op->Common.AmlOffset)) + (WalkState->UserBreakpoint == AmlOffset)) { AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", - Op->Common.AmlOffset); + AmlOffset); AcpiGbl_CmSingleStep = TRUE; AcpiGbl_StepToNextCall = FALSE; WalkState->MethodBreakpoint = 0; @@ -380,7 +386,9 @@ AcpiDbSingleStep ( /* Now we can display it */ +#ifdef ACPI_DISASSEMBLER AcpiDmDisassemble (WalkState, DisplayOp, ACPI_UINT32_MAX); +#endif if ((Op->Common.AmlOpcode == AML_IF_OP) || (Op->Common.AmlOpcode == AML_WHILE_OP)) diff --git a/src/acpica/source/components/disassembler/dmdeferred.c b/src/acpica/source/components/disassembler/dmdeferred.c index 7e654f2..6599c04 100644 --- a/src/acpica/source/components/disassembler/dmdeferred.c +++ b/src/acpica/source/components/disassembler/dmdeferred.c @@ -237,7 +237,6 @@ AcpiDmDeferredParse ( ACPI_STATUS Status; ACPI_PARSE_OBJECT *SearchOp; ACPI_PARSE_OBJECT *StartOp; - UINT32 BaseAmlOffset; ACPI_PARSE_OBJECT *NewRootOp; ACPI_PARSE_OBJECT *ExtraOp; @@ -274,19 +273,10 @@ AcpiDmDeferredParse ( WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; Status = AcpiPsParseAml (WalkState); - /* - * We need to update all of the AML offsets, since the parser thought - * that the method began at offset zero. In reality, it began somewhere - * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that - * was just created and update the AmlOffset in each Op. - */ - BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1; StartOp = (Op->Common.Value.Arg)->Common.Next; SearchOp = StartOp; - while (SearchOp) { - SearchOp->Common.AmlOffset += BaseAmlOffset; SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); } diff --git a/src/acpica/source/components/disassembler/dmnames.c b/src/acpica/source/components/disassembler/dmnames.c index 45df12a..1cf0700 100644 --- a/src/acpica/source/components/disassembler/dmnames.c +++ b/src/acpica/source/components/disassembler/dmnames.c @@ -251,7 +251,7 @@ AcpiPsDisplayObjectPathname ( /* Convert NamedDesc/handle to a full pathname */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (Node, &Buffer); + Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("****Could not get pathname****)"); diff --git a/src/acpica/source/components/disassembler/dmopcode.c b/src/acpica/source/components/disassembler/dmopcode.c index 1838cc3..2941a40 100644 --- a/src/acpica/source/components/disassembler/dmopcode.c +++ b/src/acpica/source/components/disassembler/dmopcode.c @@ -120,6 +120,7 @@ #include "acdisasm.h" #include "acinterp.h" #include "acnamesp.h" +#include "acdebug.h" #ifdef ACPI_DISASSEMBLER @@ -1039,7 +1040,7 @@ AcpiDmDisassembleOneOp ( (WalkState->Results) && (WalkState->ResultCount)) { - AcpiDmDecodeInternalObject ( + AcpiDbDecodeInternalObject ( WalkState->Results->Results.ObjDesc [ (WalkState->ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM]); diff --git a/src/acpica/source/components/disassembler/dmwalk.c b/src/acpica/source/components/disassembler/dmwalk.c index 9c0a1ac..091c69c 100644 --- a/src/acpica/source/components/disassembler/dmwalk.c +++ b/src/acpica/source/components/disassembler/dmwalk.c @@ -385,6 +385,8 @@ AcpiDmBlockType ( return (BLOCK_NONE); } + /*lint -fallthrough */ + default: OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); @@ -482,7 +484,23 @@ AcpiDmDescendingOp ( const ACPI_OPCODE_INFO *OpInfo; UINT32 Name; ACPI_PARSE_OBJECT *NextOp; + UINT32 AmlOffset; + + + if (AcpiGbl_DbOpt_Verbose && AcpiGbl_PreviousOp) + { + /* Dump the entire statement in AML byte code */ + if (Op->Common.Aml > AcpiGbl_PreviousOp->Common.Aml) + { + AcpiOsPrintf ("\n"); + AcpiUtDumpBuffer (AcpiGbl_PreviousOp->Common.Aml, + (Op->Common.Aml - AcpiGbl_PreviousOp->Common.Aml), + DB_BYTE_DISPLAY, 0); + AcpiDmIndent (Level); + } + } + AcpiGbl_PreviousOp = Op; if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) { @@ -499,10 +517,12 @@ AcpiDmDescendingOp ( if (Info->WalkState) { + AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, + Info->WalkState->ParserState.AmlStart); VERBOSE_PRINT ((DB_FULL_OP_INFO, (Info->WalkState->MethodNode ? Info->WalkState->MethodNode->Name.Ascii : " "), - Op->Common.AmlOffset, (UINT32) Op->Common.AmlOpcode)); + AmlOffset, (UINT32) Op->Common.AmlOpcode)); } if (Op->Common.AmlOpcode == AML_SCOPE_OP) diff --git a/src/acpica/source/components/dispatcher/dsargs.c b/src/acpica/source/components/dispatcher/dsargs.c index 8acb5dc..344e55e 100644 --- a/src/acpica/source/components/dispatcher/dsargs.c +++ b/src/acpica/source/components/dispatcher/dsargs.c @@ -166,7 +166,7 @@ AcpiDsExecuteArguments ( /* Allocate a new parser op to be the root of the parsed tree */ - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); + Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart); if (!Op) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -213,7 +213,7 @@ AcpiDsExecuteArguments ( /* Evaluate the deferred arguments */ - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); + Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart); if (!Op) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/src/acpica/source/components/dispatcher/dsdebug.c b/src/acpica/source/components/dispatcher/dsdebug.c new file mode 100644 index 0000000..8c4a7ed --- /dev/null +++ b/src/acpica/source/components/dispatcher/dsdebug.c @@ -0,0 +1,321 @@ +/****************************************************************************** + * + * Module Name: dsdebug - Parser/Interpreter interface - debugging + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acdisasm.h" +#include "acinterp.h" + + +#define _COMPONENT ACPI_DISPATCHER + ACPI_MODULE_NAME ("dsdebug") + + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + +/* Local prototypes */ + +static void +AcpiDsPrintNodePathname ( + ACPI_NAMESPACE_NODE *Node, + const char *Message); + + +/******************************************************************************* + * + * FUNCTION: AcpiDsPrintNodePathname + * + * PARAMETERS: Node - Object + * Message - Prefix message + * + * DESCRIPTION: Print an object's full namespace pathname + * Manages allocation/freeing of a pathname buffer + * + ******************************************************************************/ + +static void +AcpiDsPrintNodePathname ( + ACPI_NAMESPACE_NODE *Node, + const char *Message) +{ + ACPI_BUFFER Buffer; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (DsPrintNodePathname); + + if (!Node) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[NULL NAME]")); + return_VOID; + } + + /* Convert handle to full pathname and print it (with supplied message) */ + + Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + + Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE); + if (ACPI_SUCCESS (Status)) + { + if (Message) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "%s ", Message)); + } + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[%s] (Node %p)", + (char *) Buffer.Pointer, Node)); + ACPI_FREE (Buffer.Pointer); + } + + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsDumpMethodStack + * + * PARAMETERS: Status - Method execution status + * WalkState - Current state of the parse tree walk + * Op - Executing parse op + * + * RETURN: None + * + * DESCRIPTION: Called when a method has been aborted because of an error. + * Dumps the method execution stack. + * + ******************************************************************************/ + +void +AcpiDsDumpMethodStack ( + ACPI_STATUS Status, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *Next; + ACPI_THREAD_STATE *Thread; + ACPI_WALK_STATE *NextWalkState; + ACPI_NAMESPACE_NODE *PreviousMethod = NULL; + ACPI_OPERAND_OBJECT *MethodDesc; + + + ACPI_FUNCTION_TRACE (DsDumpMethodStack); + + /* Ignore control codes, they are not errors */ + + if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL) + { + return_VOID; + } + + /* We may be executing a deferred opcode */ + + if (WalkState->DeferredNode) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Executing subtree for Buffer/Package/Region\n")); + return_VOID; + } + + /* + * If there is no Thread, we are not actually executing a method. + * This can happen when the iASL compiler calls the interpreter + * to perform constant folding. + */ + Thread = WalkState->Thread; + if (!Thread) + { + return_VOID; + } + + /* Display exception and method name */ + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "\n**** Exception %s during execution of method ", + AcpiFormatException (Status))); + AcpiDsPrintNodePathname (WalkState->MethodNode, NULL); + + /* Display stack of executing methods */ + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, + "\n\nMethod Execution Stack:\n")); + NextWalkState = Thread->WalkStateList; + + /* Walk list of linked walk states */ + + while (NextWalkState) + { + MethodDesc = NextWalkState->MethodDesc; + if (MethodDesc) + { + AcpiExStopTraceMethod ( + (ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, + MethodDesc, WalkState); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + " Method [%4.4s] executing: ", + AcpiUtGetNodeName (NextWalkState->MethodNode))); + + /* First method is the currently executing method */ + + if (NextWalkState == WalkState) + { + if (Op) + { + /* Display currently executing ASL statement */ + + Next = Op->Common.Next; + Op->Common.Next = NULL; + +#ifdef ACPI_DISASSEMBLER + AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX); +#endif + Op->Common.Next = Next; + } + } + else + { + /* + * This method has called another method + * NOTE: the method call parse subtree is already deleted at this + * point, so we cannot disassemble the method invocation. + */ + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Call to method ")); + AcpiDsPrintNodePathname (PreviousMethod, NULL); + } + + PreviousMethod = NextWalkState->MethodNode; + NextWalkState = NextWalkState->Next; + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "\n")); + } + + return_VOID; +} + +#else + +void +AcpiDsDumpMethodStack ( + ACPI_STATUS Status, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + return; +} + +#endif diff --git a/src/acpica/source/components/dispatcher/dsmethod.c b/src/acpica/source/components/dispatcher/dsmethod.c index 2e37795..10c3548 100644 --- a/src/acpica/source/components/dispatcher/dsmethod.c +++ b/src/acpica/source/components/dispatcher/dsmethod.c @@ -118,9 +118,9 @@ #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" -#include "acdisasm.h" #include "acparser.h" #include "amlcode.h" +#include "acdebug.h" #define _COMPONENT ACPI_DISPATCHER @@ -181,7 +181,7 @@ AcpiDsAutoSerializeMethod ( /* Create/Init a root op for the method parse tree */ - Op = AcpiPsAllocOp (AML_METHOD_OP); + Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart); if (!Op) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -285,7 +285,7 @@ AcpiDsDetectNamedOpcodes ( * RETURN: Status * * DESCRIPTION: Called on method error. Invoke the global exception handler if - * present, dump the method data if the disassembler is configured + * present, dump the method data if the debugger is configured * * Note: Allows the exception handler to change the status code * @@ -296,6 +296,9 @@ AcpiDsMethodError ( ACPI_STATUS Status, ACPI_WALK_STATE *WalkState) { + UINT32 AmlOffset; + + ACPI_FUNCTION_ENTRY (); @@ -319,23 +322,28 @@ AcpiDsMethodError ( * Handler can map the exception code to anything it wants, including * AE_OK, in which case the executing method will not be aborted. */ + AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, + WalkState->ParserState.AmlStart); + Status = AcpiGbl_ExceptionHandler (Status, WalkState->MethodNode ? WalkState->MethodNode->Name.Integer : 0, - WalkState->Opcode, WalkState->AmlOffset, NULL); + WalkState->Opcode, AmlOffset, NULL); AcpiExEnterInterpreter (); } AcpiDsClearImplicitReturn (WalkState); -#ifdef ACPI_DISASSEMBLER if (ACPI_FAILURE (Status)) { - /* Display method locals/args if disassembler is present */ + AcpiDsDumpMethodStack (Status, WalkState, WalkState->Op); - AcpiDmDumpMethodInfo (Status, WalkState, WalkState->Op); - } + /* Display method locals/args if debugger is present */ + +#ifdef ACPI_DEBUGGER + AcpiDbDumpMethodInfo (Status, WalkState); #endif + } return (Status); } @@ -421,6 +429,8 @@ AcpiDsBeginMethodExecution ( return_ACPI_STATUS (AE_NULL_ENTRY); } + AcpiExStartTraceMethod (MethodNode, ObjDesc, WalkState); + /* Prevent wraparound of thread count */ if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX) @@ -682,10 +692,7 @@ Cleanup: /* On error, we must terminate the method properly */ AcpiDsTerminateControlMethod (ObjDesc, NextWalkState); - if (NextWalkState) - { - AcpiDsDeleteWalkState (NextWalkState); - } + AcpiDsDeleteWalkState (NextWalkState); return_ACPI_STATUS (Status); } @@ -942,5 +949,8 @@ AcpiDsTerminateControlMethod ( } } + AcpiExStopTraceMethod ((ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, + MethodDesc, WalkState); + return_VOID; } diff --git a/src/acpica/source/components/dispatcher/dswload.c b/src/acpica/source/components/dispatcher/dswload.c index a1327ba..a984075 100644 --- a/src/acpica/source/components/dispatcher/dswload.c +++ b/src/acpica/source/components/dispatcher/dswload.c @@ -470,7 +470,7 @@ AcpiDsLoad1BeginOp ( { /* Create a new op */ - Op = AcpiPsAllocOp (WalkState->Opcode); + Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml); if (!Op) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/src/acpica/source/components/dispatcher/dswload2.c b/src/acpica/source/components/dispatcher/dswload2.c index 312b2cd..d5f9b1c 100644 --- a/src/acpica/source/components/dispatcher/dswload2.c +++ b/src/acpica/source/components/dispatcher/dswload2.c @@ -416,7 +416,7 @@ AcpiDsLoad2BeginOp ( { /* Create a new op */ - Op = AcpiPsAllocOp (WalkState->Opcode); + Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml); if (!Op) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/src/acpica/source/components/executer/excreate.c b/src/acpica/source/components/executer/excreate.c index 90a3632..9c7ffc1 100644 --- a/src/acpica/source/components/executer/excreate.c +++ b/src/acpica/source/components/executer/excreate.c @@ -599,6 +599,7 @@ AcpiExCreateMethod ( ObjDesc->Method.AmlStart = AmlStart; ObjDesc->Method.AmlLength = AmlLength; + ObjDesc->Method.Node = Operand[0]; /* * Disassemble the method flags. Split off the ArgCount, Serialized diff --git a/src/acpica/source/components/executer/exdebug.c b/src/acpica/source/components/executer/exdebug.c index 79ca96c..00ec43f 100644 --- a/src/acpica/source/components/executer/exdebug.c +++ b/src/acpica/source/components/executer/exdebug.c @@ -115,13 +115,26 @@ #include "acpi.h" #include "accommon.h" +#include "acnamesp.h" #include "acinterp.h" +#include "acparser.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exdebug") +static ACPI_OPERAND_OBJECT *AcpiGbl_TraceMethodObject = NULL; + +/* Local prototypes */ + +#ifdef ACPI_DEBUG_OUTPUT +static const char * +AcpiExGetTraceEventName ( + ACPI_TRACE_EVENT_TYPE Type); +#endif + + #ifndef ACPI_NO_ERROR_MESSAGES /******************************************************************************* * @@ -386,3 +399,362 @@ AcpiExDoDebugObject ( return_VOID; } #endif + + +/******************************************************************************* + * + * FUNCTION: AcpiExInterpreterTraceEnabled + * + * PARAMETERS: Name - Whether method name should be matched, + * this should be checked before starting + * the tracer + * + * RETURN: TRUE if interpreter trace is enabled. + * + * DESCRIPTION: Check whether interpreter trace is enabled + * + ******************************************************************************/ + +static BOOLEAN +AcpiExInterpreterTraceEnabled ( + char *Name) +{ + + /* Check if tracing is enabled */ + + if (!(AcpiGbl_TraceFlags & ACPI_TRACE_ENABLED)) + { + return (FALSE); + } + + /* + * Check if tracing is filtered: + * + * 1. If the tracer is started, AcpiGbl_TraceMethodObject should have + * been filled by the trace starter + * 2. If the tracer is not started, AcpiGbl_TraceMethodName should be + * matched if it is specified + * 3. If the tracer is oneshot style, AcpiGbl_TraceMethodName should + * not be cleared by the trace stopper during the first match + */ + if (AcpiGbl_TraceMethodObject) + { + return (TRUE); + } + if (Name && + (AcpiGbl_TraceMethodName && + strcmp (AcpiGbl_TraceMethodName, Name))) + { + return (FALSE); + } + if ((AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) && + !AcpiGbl_TraceMethodName) + { + return (FALSE); + } + + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExGetTraceEventName + * + * PARAMETERS: Type - Trace event type + * + * RETURN: Trace event name. + * + * DESCRIPTION: Used to obtain the full trace event name. + * + ******************************************************************************/ + +#ifdef ACPI_DEBUG_OUTPUT + +static const char * +AcpiExGetTraceEventName ( + ACPI_TRACE_EVENT_TYPE Type) +{ + switch (Type) + { + case ACPI_TRACE_AML_METHOD: + + return "Method"; + + case ACPI_TRACE_AML_OPCODE: + + return "Opcode"; + + case ACPI_TRACE_AML_REGION: + + return "Region"; + + default: + + return ""; + } +} + +#endif + + +/******************************************************************************* + * + * FUNCTION: AcpiExTracePoint + * + * PARAMETERS: Type - Trace event type + * Begin - TRUE if before execution + * Aml - Executed AML address + * Pathname - Object path + * + * RETURN: None + * + * DESCRIPTION: Internal interpreter execution trace. + * + ******************************************************************************/ + +void +AcpiExTracePoint ( + ACPI_TRACE_EVENT_TYPE Type, + BOOLEAN Begin, + UINT8 *Aml, + char *Pathname) +{ + + ACPI_FUNCTION_NAME (ExTracePoint); + + + if (Pathname) + { + ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT, + "%s %s [0x%p:%s] execution.\n", + AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End", + Aml, Pathname)); + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT, + "%s %s [0x%p] execution.\n", + AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End", + Aml)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExStartTraceMethod + * + * PARAMETERS: MethodNode - Node of the method + * ObjDesc - The method object + * WalkState - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Start control method execution trace + * + ******************************************************************************/ + +void +AcpiExStartTraceMethod ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status; + char *Pathname = NULL; + BOOLEAN Enabled = FALSE; + + + ACPI_FUNCTION_NAME (ExStartTraceMethod); + + + if (MethodNode) + { + Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + Enabled = AcpiExInterpreterTraceEnabled (Pathname); + if (Enabled && !AcpiGbl_TraceMethodObject) + { + AcpiGbl_TraceMethodObject = ObjDesc; + AcpiGbl_OriginalDbgLevel = AcpiDbgLevel; + AcpiGbl_OriginalDbgLayer = AcpiDbgLayer; + AcpiDbgLevel = ACPI_TRACE_LEVEL_ALL; + AcpiDbgLayer = ACPI_TRACE_LAYER_ALL; + + if (AcpiGbl_TraceDbgLevel) + { + AcpiDbgLevel = AcpiGbl_TraceDbgLevel; + } + if (AcpiGbl_TraceDbgLayer) + { + AcpiDbgLayer = AcpiGbl_TraceDbgLayer; + } + } + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + +Exit: + if (Enabled) + { + ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, TRUE, + ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); + } + if (Pathname) + { + ACPI_FREE (Pathname); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExStopTraceMethod + * + * PARAMETERS: MethodNode - Node of the method + * ObjDesc - The method object + * WalkState - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Stop control method execution trace + * + ******************************************************************************/ + +void +AcpiExStopTraceMethod ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status; + char *Pathname = NULL; + BOOLEAN Enabled; + + + ACPI_FUNCTION_NAME (ExStopTraceMethod); + + + if (MethodNode) + { + Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + goto ExitPath; + } + + Enabled = AcpiExInterpreterTraceEnabled (NULL); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + + if (Enabled) + { + ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, FALSE, + ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + goto ExitPath; + } + + /* Check whether the tracer should be stopped */ + + if (AcpiGbl_TraceMethodObject == ObjDesc) + { + /* Disable further tracing if type is one-shot */ + + if (AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) + { + AcpiGbl_TraceMethodName = NULL; + } + + AcpiDbgLevel = AcpiGbl_OriginalDbgLevel; + AcpiDbgLayer = AcpiGbl_OriginalDbgLayer; + AcpiGbl_TraceMethodObject = NULL; + } + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + +ExitPath: + if (Pathname) + { + ACPI_FREE (Pathname); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExStartTraceOpcode + * + * PARAMETERS: Op - The parser opcode object + * WalkState - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Start opcode execution trace + * + ******************************************************************************/ + +void +AcpiExStartTraceOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState) +{ + + ACPI_FUNCTION_NAME (ExStartTraceOpcode); + + + if (AcpiExInterpreterTraceEnabled (NULL) && + (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE)) + { + ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, TRUE, + Op->Common.Aml, Op->Common.AmlOpName); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExStopTraceOpcode + * + * PARAMETERS: Op - The parser opcode object + * WalkState - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Stop opcode execution trace + * + ******************************************************************************/ + +void +AcpiExStopTraceOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState) +{ + + ACPI_FUNCTION_NAME (ExStopTraceOpcode); + + + if (AcpiExInterpreterTraceEnabled (NULL) && + (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE)) + { + ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, FALSE, + Op->Common.Aml, Op->Common.AmlOpName); + } +} diff --git a/src/acpica/source/components/executer/exdump.c b/src/acpica/source/components/executer/exdump.c index bf9df64..c13839b 100644 --- a/src/acpica/source/components/executer/exdump.c +++ b/src/acpica/source/components/executer/exdump.c @@ -1111,7 +1111,8 @@ AcpiExDumpReferenceObj ( { AcpiOsPrintf (" %p ", ObjDesc->Reference.Node); - Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf); + Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, + &RetBuf, FALSE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf (" Could not convert name to pathname\n"); diff --git a/src/acpica/source/components/namespace/nsnames.c b/src/acpica/source/components/namespace/nsnames.c index 2c7d9b9..3ca04f0 100644 --- a/src/acpica/source/components/namespace/nsnames.c +++ b/src/acpica/source/components/namespace/nsnames.c @@ -125,82 +125,6 @@ /******************************************************************************* * - * FUNCTION: AcpiNsBuildExternalPath - * - * PARAMETERS: Node - NS node whose pathname is needed - * Size - Size of the pathname - * *NameBuffer - Where to return the pathname - * - * RETURN: Status - * Places the pathname into the NameBuffer, in external format - * (name segments separated by path separators) - * - * DESCRIPTION: Generate a full pathaname - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsBuildExternalPath ( - ACPI_NAMESPACE_NODE *Node, - ACPI_SIZE Size, - char *NameBuffer) -{ - ACPI_SIZE Index; - ACPI_NAMESPACE_NODE *ParentNode; - - - ACPI_FUNCTION_ENTRY (); - - - /* Special case for root */ - - Index = Size - 1; - if (Index < ACPI_NAME_SIZE) - { - NameBuffer[0] = AML_ROOT_PREFIX; - NameBuffer[1] = 0; - return (AE_OK); - } - - /* Store terminator byte, then build name backwards */ - - ParentNode = Node; - NameBuffer[Index] = 0; - - while ((Index > ACPI_NAME_SIZE) && (ParentNode != AcpiGbl_RootNode)) - { - Index -= ACPI_NAME_SIZE; - - /* Put the name into the buffer */ - - ACPI_MOVE_32_TO_32 ((NameBuffer + Index), &ParentNode->Name); - ParentNode = ParentNode->Parent; - - /* Prefix name with the path separator */ - - Index--; - NameBuffer[Index] = ACPI_PATH_SEPARATOR; - } - - /* Overwrite final separator with the root prefix character */ - - NameBuffer[Index] = AML_ROOT_PREFIX; - - if (Index != 0) - { - ACPI_ERROR ((AE_INFO, - "Could not construct external pathname; index=%u, size=%u, Path=%s", - (UINT32) Index, (UINT32) Size, &NameBuffer[Size])); - - return (AE_BAD_PARAMETER); - } - - return (AE_OK); -} - - -/******************************************************************************* - * * FUNCTION: AcpiNsGetExternalPathname * * PARAMETERS: Node - Namespace node whose pathname is needed @@ -218,39 +142,13 @@ char * AcpiNsGetExternalPathname ( ACPI_NAMESPACE_NODE *Node) { - ACPI_STATUS Status; char *NameBuffer; - ACPI_SIZE Size; ACPI_FUNCTION_TRACE_PTR (NsGetExternalPathname, Node); - /* Calculate required buffer size based on depth below root */ - - Size = AcpiNsGetPathnameLength (Node); - if (!Size) - { - return_PTR (NULL); - } - - /* Allocate a buffer to be returned to caller */ - - NameBuffer = ACPI_ALLOCATE_ZEROED (Size); - if (!NameBuffer) - { - ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size)); - return_PTR (NULL); - } - - /* Build the path in the allocated buffer */ - - Status = AcpiNsBuildExternalPath (Node, Size, NameBuffer); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (NameBuffer); - return_PTR (NULL); - } + NameBuffer = AcpiNsGetNormalizedPathname (Node, FALSE); return_PTR (NameBuffer); } @@ -273,38 +171,14 @@ AcpiNsGetPathnameLength ( ACPI_NAMESPACE_NODE *Node) { ACPI_SIZE Size; - ACPI_NAMESPACE_NODE *NextNode; ACPI_FUNCTION_ENTRY (); - /* - * Compute length of pathname as 5 * number of name segments. - * Go back up the parent tree to the root - */ - Size = 0; - NextNode = Node; + Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, FALSE); - while (NextNode && (NextNode != AcpiGbl_RootNode)) - { - if (ACPI_GET_DESCRIPTOR_TYPE (NextNode) != ACPI_DESC_TYPE_NAMED) - { - ACPI_ERROR ((AE_INFO, - "Invalid Namespace Node (%p) while traversing namespace", - NextNode)); - return (0); - } - Size += ACPI_PATH_SEGMENT_LENGTH; - NextNode = NextNode->Parent; - } - - if (!Size) - { - Size = 1; /* Root node case */ - } - - return (Size + 1); /* +1 for null string terminator */ + return (Size); } @@ -315,6 +189,8 @@ AcpiNsGetPathnameLength ( * PARAMETERS: TargetHandle - Handle of named object whose name is * to be found * Buffer - Where the pathname is returned + * NoTrailing - Remove trailing '_' for each name + * segment * * RETURN: Status, Buffer is filled with pathname if status is AE_OK * @@ -325,7 +201,8 @@ AcpiNsGetPathnameLength ( ACPI_STATUS AcpiNsHandleToPathname ( ACPI_HANDLE TargetHandle, - ACPI_BUFFER *Buffer) + ACPI_BUFFER *Buffer, + BOOLEAN NoTrailing) { ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; @@ -343,7 +220,7 @@ AcpiNsHandleToPathname ( /* Determine size required for the caller buffer */ - RequiredSize = AcpiNsGetPathnameLength (Node); + RequiredSize = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing); if (!RequiredSize) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -359,7 +236,8 @@ AcpiNsHandleToPathname ( /* Build the path in the caller buffer */ - Status = AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer); + (void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer, + RequiredSize, NoTrailing); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -369,3 +247,169 @@ AcpiNsHandleToPathname ( (char *) Buffer->Pointer, (UINT32) RequiredSize)); return_ACPI_STATUS (AE_OK); } + + +/******************************************************************************* + * + * FUNCTION: AcpiNsBuildNormalizedPath + * + * PARAMETERS: Node - Namespace node + * FullPath - Where the path name is returned + * PathSize - Size of returned path name buffer + * NoTrailing - Remove trailing '_' from each name segment + * + * RETURN: Return 1 if the AML path is empty, otherwise returning (length + * of pathname + 1) which means the 'FullPath' contains a trailing + * null. + * + * DESCRIPTION: Build and return a full namespace pathname. + * Note that if the size of 'FullPath' isn't large enough to + * contain the namespace node's path name, the actual required + * buffer length is returned, and it should be greater than + * 'PathSize'. So callers are able to check the returning value + * to determine the buffer size of 'FullPath'. + * + ******************************************************************************/ + +UINT32 +AcpiNsBuildNormalizedPath ( + ACPI_NAMESPACE_NODE *Node, + char *FullPath, + UINT32 PathSize, + BOOLEAN NoTrailing) +{ + UINT32 Length = 0, i; + char Name[ACPI_NAME_SIZE]; + BOOLEAN DoNoTrailing; + char c, *Left, *Right; + ACPI_NAMESPACE_NODE *NextNode; + + + ACPI_FUNCTION_TRACE_PTR (NsBuildNormalizedPath, Node); + + +#define ACPI_PATH_PUT8(Path, Size, Byte, Length) \ + do { \ + if ((Length) < (Size)) \ + { \ + (Path)[(Length)] = (Byte); \ + } \ + (Length)++; \ + } while (0) + + /* + * Make sure the PathSize is correct, so that we don't need to + * validate both FullPath and PathSize. + */ + if (!FullPath) + { + PathSize = 0; + } + + if (!Node) + { + goto BuildTrailingNull; + } + + NextNode = Node; + while (NextNode && NextNode != AcpiGbl_RootNode) + { + if (NextNode != Node) + { + ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length); + } + ACPI_MOVE_32_TO_32 (Name, &NextNode->Name); + DoNoTrailing = NoTrailing; + for (i = 0; i < 4; i++) + { + c = Name[4-i-1]; + if (DoNoTrailing && c != '_') + { + DoNoTrailing = FALSE; + } + if (!DoNoTrailing) + { + ACPI_PATH_PUT8(FullPath, PathSize, c, Length); + } + } + NextNode = NextNode->Parent; + } + ACPI_PATH_PUT8(FullPath, PathSize, AML_ROOT_PREFIX, Length); + + /* Reverse the path string */ + + if (Length <= PathSize) + { + Left = FullPath; + Right = FullPath+Length-1; + while (Left < Right) + { + c = *Left; + *Left++ = *Right; + *Right-- = c; + } + } + + /* Append the trailing null */ + +BuildTrailingNull: + ACPI_PATH_PUT8(FullPath, PathSize, '\0', Length); + +#undef ACPI_PATH_PUT8 + + return_UINT32 (Length); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsGetNormalizedPathname + * + * PARAMETERS: Node - Namespace node whose pathname is needed + * NoTrailing - Remove trailing '_' from each name segment + * + * RETURN: Pointer to storage containing the fully qualified name of + * the node, In external format (name segments separated by path + * separators.) + * + * DESCRIPTION: Used to obtain the full pathname to a namespace node, usually + * for error and debug statements. All trailing '_' will be + * removed from the full pathname if 'NoTrailing' is specified.. + * + ******************************************************************************/ + +char * +AcpiNsGetNormalizedPathname ( + ACPI_NAMESPACE_NODE *Node, + BOOLEAN NoTrailing) +{ + char *NameBuffer; + ACPI_SIZE Size; + + + ACPI_FUNCTION_TRACE_PTR (NsGetNormalizedPathname, Node); + + + /* Calculate required buffer size based on depth below root */ + + Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing); + if (!Size) + { + return_PTR (NULL); + } + + /* Allocate a buffer to be returned to caller */ + + NameBuffer = ACPI_ALLOCATE_ZEROED (Size); + if (!NameBuffer) + { + ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size)); + return_PTR (NULL); + } + + /* Build the path in the allocated buffer */ + + (void) AcpiNsBuildNormalizedPath (Node, NameBuffer, Size, NoTrailing); + + return_PTR (NameBuffer); +} diff --git a/src/acpica/source/components/namespace/nsparse.c b/src/acpica/source/components/namespace/nsparse.c index 481e7c3..26dd9f3 100644 --- a/src/acpica/source/components/namespace/nsparse.c +++ b/src/acpica/source/components/namespace/nsparse.c @@ -156,6 +156,22 @@ AcpiNsOneCompleteParse ( ACPI_FUNCTION_TRACE (NsOneCompleteParse); + Status = AcpiGetTableByIndex (TableIndex, &Table); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Table must consist of at least a complete header */ + + if (Table->Length < sizeof (ACPI_TABLE_HEADER)) + { + return_ACPI_STATUS (AE_BAD_HEADER); + } + + AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); + AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); + Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); if (ACPI_FAILURE (Status)) { @@ -164,7 +180,7 @@ AcpiNsOneCompleteParse ( /* Create and init a Root Node */ - ParseRoot = AcpiPsCreateScopeOp (); + ParseRoot = AcpiPsCreateScopeOp (AmlStart); if (!ParseRoot) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -179,26 +195,12 @@ AcpiNsOneCompleteParse ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiGetTableByIndex (TableIndex, &Table); + Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, + AmlStart, AmlLength, NULL, (UINT8) PassNumber); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); - AcpiPsFreeOp (ParseRoot); - return_ACPI_STATUS (Status); - } - - /* Table must consist of at least a complete header */ - - if (Table->Length < sizeof (ACPI_TABLE_HEADER)) - { - Status = AE_BAD_HEADER; - } - else - { - AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); - Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, - AmlStart, AmlLength, NULL, (UINT8) PassNumber); + goto Cleanup; } /* Found OSDT table, enable the namespace override feature */ @@ -209,12 +211,6 @@ AcpiNsOneCompleteParse ( WalkState->NamespaceOverride = TRUE; } - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - /* StartNode is the default location to load the table */ if (StartNode && StartNode != AcpiGbl_RootNode) diff --git a/src/acpica/source/components/namespace/nsutils.c b/src/acpica/source/components/namespace/nsutils.c index c1187ba..03b9d18 100644 --- a/src/acpica/source/components/namespace/nsutils.c +++ b/src/acpica/source/components/namespace/nsutils.c @@ -162,7 +162,7 @@ AcpiNsPrintNodePathname ( Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (Node, &Buffer); + Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE); if (ACPI_SUCCESS (Status)) { if (Message) diff --git a/src/acpica/source/components/namespace/nsxfname.c b/src/acpica/source/components/namespace/nsxfname.c index d3f411b..51cc4f4 100644 --- a/src/acpica/source/components/namespace/nsxfname.c +++ b/src/acpica/source/components/namespace/nsxfname.c @@ -265,11 +265,13 @@ AcpiGetName ( return (Status); } - if (NameType == ACPI_FULL_PATHNAME) + if (NameType == ACPI_FULL_PATHNAME || + NameType == ACPI_FULL_PATHNAME_NO_TRAILING) { /* Get the full pathname (From the namespace root) */ - Status = AcpiNsHandleToPathname (Handle, Buffer); + Status = AcpiNsHandleToPathname (Handle, Buffer, + NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE); return (Status); } diff --git a/src/acpica/source/components/parser/psargs.c b/src/acpica/source/components/parser/psargs.c index 2453ab1..cbb24a9 100644 --- a/src/acpica/source/components/parser/psargs.c +++ b/src/acpica/source/components/parser/psargs.c @@ -388,7 +388,7 @@ AcpiPsGetNextNamepath ( ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Desc %p Path=%p\n", Node, MethodDesc, Path)); - NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); + NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, Start); if (!NameOp) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -596,7 +596,7 @@ static ACPI_PARSE_OBJECT * AcpiPsGetNextField ( ACPI_PARSE_STATE *ParserState) { - UINT32 AmlOffset; + UINT8 *Aml; ACPI_PARSE_OBJECT *Field; ACPI_PARSE_OBJECT *Arg = NULL; UINT16 Opcode; @@ -612,8 +612,7 @@ AcpiPsGetNextField ( ACPI_FUNCTION_TRACE (PsGetNextField); - AmlOffset = (UINT32) ACPI_PTR_DIFF ( - ParserState->Aml, ParserState->AmlStart); + Aml = ParserState->Aml; /* Determine field type */ @@ -651,14 +650,12 @@ AcpiPsGetNextField ( /* Allocate a new field op */ - Field = AcpiPsAllocOp (Opcode); + Field = AcpiPsAllocOp (Opcode, Aml); if (!Field) { return_PTR (NULL); } - Field->Common.AmlOffset = AmlOffset; - /* Decode the field type */ switch (Opcode) @@ -722,6 +719,7 @@ AcpiPsGetNextField ( * Argument for Connection operator can be either a Buffer * (resource descriptor), or a NameString. */ + Aml = ParserState->Aml; if (ACPI_GET8 (ParserState->Aml) == AML_BUFFER_OP) { ParserState->Aml++; @@ -734,7 +732,7 @@ AcpiPsGetNextField ( { /* Non-empty list */ - Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP); + Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP, Aml); if (!Arg) { AcpiPsFreeOp (Field); @@ -784,7 +782,7 @@ AcpiPsGetNextField ( } else { - Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); + Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, Aml); if (!Arg) { AcpiPsFreeOp (Field); @@ -856,7 +854,7 @@ AcpiPsGetNextArg ( /* Constants, strings, and namestrings are all the same size */ - Arg = AcpiPsAllocOp (AML_BYTE_OP); + Arg = AcpiPsAllocOp (AML_BYTE_OP, ParserState->Aml); if (!Arg) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -908,7 +906,8 @@ AcpiPsGetNextArg ( { /* Non-empty list */ - Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP); + Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP, + ParserState->Aml); if (!Arg) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -938,7 +937,7 @@ AcpiPsGetNextArg ( { /* NullName or NameString */ - Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); + Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, ParserState->Aml); if (!Arg) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/src/acpica/source/components/parser/psloop.c b/src/acpica/source/components/parser/psloop.c index d75ac83..b7b2dcd 100644 --- a/src/acpica/source/components/parser/psloop.c +++ b/src/acpica/source/components/parser/psloop.c @@ -123,6 +123,7 @@ #include "acpi.h" #include "accommon.h" +#include "acinterp.h" #include "acparser.h" #include "acdispat.h" #include "amlcode.h" @@ -206,8 +207,7 @@ AcpiPsGetArguments ( */ while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount) { - WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml, - WalkState->ParserState.AmlStart); + WalkState->Aml = WalkState->ParserState.Aml; Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState), GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); @@ -218,7 +218,6 @@ AcpiPsGetArguments ( if (Arg) { - Arg->Common.AmlOffset = WalkState->AmlOffset; AcpiPsAppendArg (Op, Arg); } @@ -574,15 +573,7 @@ AcpiPsParseLoop ( continue; } - Op->Common.AmlOffset = WalkState->AmlOffset; - - if (WalkState->OpInfo) - { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n", - (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name, - Op, ParserState->Aml, Op->Common.AmlOffset)); - } + AcpiExStartTraceOpcode (Op, WalkState); } diff --git a/src/acpica/source/components/parser/psobject.c b/src/acpica/source/components/parser/psobject.c index a236ff5..77e9434 100644 --- a/src/acpica/source/components/parser/psobject.c +++ b/src/acpica/source/components/parser/psobject.c @@ -145,12 +145,13 @@ static ACPI_STATUS AcpiPsGetAmlOpcode ( ACPI_WALK_STATE *WalkState) { + UINT32 AmlOffset; + ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState); - WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml, - WalkState->ParserState.AmlStart); + WalkState->Aml = WalkState->ParserState.Aml; WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState)); /* @@ -179,10 +180,13 @@ AcpiPsGetAmlOpcode ( if (WalkState->PassNumber == 2) { + AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, + WalkState->ParserState.AmlStart); + ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring", WalkState->Opcode, - (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER)))); + (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER)))); ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48); @@ -194,13 +198,13 @@ AcpiPsGetAmlOpcode ( AcpiOsPrintf ( "/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n", WalkState->Opcode, - (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER))); + (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER))); /* Dump the context surrounding the invalid opcode */ AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16), 48, DB_BYTE_DISPLAY, - (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16)); + (AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16)); AcpiOsPrintf (" */\n"); #endif } @@ -385,7 +389,7 @@ AcpiPsCreateOp ( /* Create Op structure and append to parent's argument list */ WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode); - Op = AcpiPsAllocOp (WalkState->Opcode); + Op = AcpiPsAllocOp (WalkState->Opcode, AmlOpStart); if (!Op) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/src/acpica/source/components/parser/psparse.c b/src/acpica/source/components/parser/psparse.c index 71c3fa0..599a766 100644 --- a/src/acpica/source/components/parser/psparse.c +++ b/src/acpica/source/components/parser/psparse.c @@ -233,6 +233,8 @@ AcpiPsCompleteThisOp ( return_ACPI_STATUS (AE_OK); /* OK for now */ } + AcpiExStopTraceOpcode (Op, WalkState); + /* Delete this op and the subtree below it if asked to */ if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) || @@ -270,7 +272,8 @@ AcpiPsCompleteThisOp ( * These opcodes contain TermArg operands. The current * op must be replaced by a placeholder return op */ - ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); + ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP, + Op->Common.Aml); if (!ReplacementOp) { Status = AE_NO_MEMORY; @@ -289,7 +292,8 @@ AcpiPsCompleteThisOp ( (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) { - ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); + ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP, + Op->Common.Aml); if (!ReplacementOp) { Status = AE_NO_MEMORY; @@ -302,7 +306,8 @@ AcpiPsCompleteThisOp ( (Op->Common.AmlOpcode == AML_PACKAGE_OP) || (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) { - ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode); + ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode, + Op->Common.Aml); if (!ReplacementOp) { Status = AE_NO_MEMORY; @@ -318,7 +323,8 @@ AcpiPsCompleteThisOp ( default: - ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); + ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP, + Op->Common.Aml); if (!ReplacementOp) { Status = AE_NO_MEMORY; diff --git a/src/acpica/source/components/parser/psutils.c b/src/acpica/source/components/parser/psutils.c index a36a3f3..3aa4954 100644 --- a/src/acpica/source/components/parser/psutils.c +++ b/src/acpica/source/components/parser/psutils.c @@ -136,12 +136,12 @@ ACPI_PARSE_OBJECT * AcpiPsCreateScopeOp ( - void) + UINT8 *Aml) { ACPI_PARSE_OBJECT *ScopeOp; - ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP); + ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP, Aml); if (!ScopeOp) { return (NULL); @@ -187,6 +187,7 @@ AcpiPsInitOp ( * FUNCTION: AcpiPsAllocOp * * PARAMETERS: Opcode - Opcode that will be stored in the new Op + * Aml - Address of the opcode * * RETURN: Pointer to the new Op, null on failure * @@ -198,7 +199,8 @@ AcpiPsInitOp ( ACPI_PARSE_OBJECT* AcpiPsAllocOp ( - UINT16 Opcode) + UINT16 Opcode, + UINT8 *Aml) { ACPI_PARSE_OBJECT *Op; const ACPI_OPCODE_INFO *OpInfo; @@ -245,6 +247,7 @@ AcpiPsAllocOp ( if (Op) { AcpiPsInitOp (Op, Opcode); + Op->Common.Aml = Aml; Op->Common.Flags = Flags; } diff --git a/src/acpica/source/components/parser/psxface.c b/src/acpica/source/components/parser/psxface.c index 09833b6..eb5c018 100644 --- a/src/acpica/source/components/parser/psxface.c +++ b/src/acpica/source/components/parser/psxface.c @@ -119,6 +119,7 @@ #include "acdispat.h" #include "acinterp.h" #include "actables.h" +#include "acnamesp.h" #define _COMPONENT ACPI_PARSER @@ -127,14 +128,6 @@ /* Local Prototypes */ static void -AcpiPsStartTrace ( - ACPI_EVALUATE_INFO *Info); - -static void -AcpiPsStopTrace ( - ACPI_EVALUATE_INFO *Info); - -static void AcpiPsUpdateParameterList ( ACPI_EVALUATE_INFO *Info, UINT16 Action); @@ -158,7 +151,7 @@ AcpiPsUpdateParameterList ( ACPI_STATUS AcpiDebugTrace ( - char *Name, + const char *Name, UINT32 DebugLevel, UINT32 DebugLayer, UINT32 Flags) @@ -172,128 +165,14 @@ AcpiDebugTrace ( return (Status); } - /* TBDs: Validate name, allow full path or just nameseg */ - - AcpiGbl_TraceMethodName = *ACPI_CAST_PTR (UINT32, Name); + AcpiGbl_TraceMethodName = Name; AcpiGbl_TraceFlags = Flags; - - if (DebugLevel) - { - AcpiGbl_TraceDbgLevel = DebugLevel; - } - if (DebugLayer) - { - AcpiGbl_TraceDbgLayer = DebugLayer; - } + AcpiGbl_TraceDbgLevel = DebugLevel; + AcpiGbl_TraceDbgLayer = DebugLayer; + Status = AE_OK; (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsStartTrace - * - * PARAMETERS: Info - Method info struct - * - * RETURN: None - * - * DESCRIPTION: Start control method execution trace - * - ******************************************************************************/ - -static void -AcpiPsStartTrace ( - ACPI_EVALUATE_INFO *Info) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_ENTRY (); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return; - } - - if ((!AcpiGbl_TraceMethodName) || - (AcpiGbl_TraceMethodName != Info->Node->Name.Integer)) - { - goto Exit; - } - - AcpiGbl_OriginalDbgLevel = AcpiDbgLevel; - AcpiGbl_OriginalDbgLayer = AcpiDbgLayer; - - AcpiDbgLevel = 0x00FFFFFF; - AcpiDbgLayer = ACPI_UINT32_MAX; - - if (AcpiGbl_TraceDbgLevel) - { - AcpiDbgLevel = AcpiGbl_TraceDbgLevel; - } - if (AcpiGbl_TraceDbgLayer) - { - AcpiDbgLayer = AcpiGbl_TraceDbgLayer; - } - - -Exit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsStopTrace - * - * PARAMETERS: Info - Method info struct - * - * RETURN: None - * - * DESCRIPTION: Stop control method execution trace - * - ******************************************************************************/ - -static void -AcpiPsStopTrace ( - ACPI_EVALUATE_INFO *Info) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_ENTRY (); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return; - } - - if ((!AcpiGbl_TraceMethodName) || - (AcpiGbl_TraceMethodName != Info->Node->Name.Integer)) - { - goto Exit; - } - - /* Disable further tracing if type is one-shot */ - - if (AcpiGbl_TraceFlags & 1) - { - AcpiGbl_TraceMethodName = 0; - AcpiGbl_TraceDbgLevel = 0; - AcpiGbl_TraceDbgLayer = 0; - } - - AcpiDbgLevel = AcpiGbl_OriginalDbgLevel; - AcpiDbgLayer = AcpiGbl_OriginalDbgLayer; - -Exit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return (Status); } @@ -356,10 +235,6 @@ AcpiPsExecuteMethod ( */ AcpiPsUpdateParameterList (Info, REF_INCREMENT); - /* Begin tracing if requested */ - - AcpiPsStartTrace (Info); - /* * Execute the method. Performs parse simultaneously */ @@ -369,7 +244,7 @@ AcpiPsExecuteMethod ( /* Create and init a Root Node */ - Op = AcpiPsCreateScopeOp (); + Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart); if (!Op) { Status = AE_NO_MEMORY; @@ -442,10 +317,6 @@ AcpiPsExecuteMethod ( Cleanup: AcpiPsDeleteParseTree (Op); - /* End optional tracing */ - - AcpiPsStopTrace (Info); - /* Take away the extra reference that we gave the parameters above */ AcpiPsUpdateParameterList (Info, REF_DECREMENT); diff --git a/src/acpica/source/components/resources/rscreate.c b/src/acpica/source/components/resources/rscreate.c index 7d9009f..8cf00d3 100644 --- a/src/acpica/source/components/resources/rscreate.c +++ b/src/acpica/source/components/resources/rscreate.c @@ -442,7 +442,8 @@ AcpiRsCreatePciRoutingTable ( (UINT8 *) OutputBuffer->Pointer); PathBuffer.Pointer = UserPrt->Source; - Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer); + Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, + &PathBuffer, FALSE); /* +1 to include null terminator */ diff --git a/src/acpica/source/components/utilities/utdebug.c b/src/acpica/source/components/utilities/utdebug.c index 60c6067..df52d17 100644 --- a/src/acpica/source/components/utilities/utdebug.c +++ b/src/acpica/source/components/utilities/utdebug.c @@ -117,6 +117,7 @@ #include "acpi.h" #include "accommon.h" +#include "acinterp.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utdebug") @@ -706,6 +707,42 @@ AcpiUtPtrExit ( } } + +/******************************************************************************* + * + * FUNCTION: AcpiTracePoint + * + * PARAMETERS: Type - Trace event type + * Begin - TRUE if before execution + * Aml - Executed AML address + * Pathname - Object path + * Pointer - Pointer to the related object + * + * RETURN: None + * + * DESCRIPTION: Interpreter execution trace. + * + ******************************************************************************/ + +void +AcpiTracePoint ( + ACPI_TRACE_EVENT_TYPE Type, + BOOLEAN Begin, + UINT8 *Aml, + char *Pathname) +{ + + ACPI_FUNCTION_ENTRY (); + + AcpiExTracePoint (Type, Begin, Aml, Pathname); + +#ifdef ACPI_USE_SYSTEM_TRACER + AcpiOsTracePoint (Type, Begin, Aml, Pathname); +#endif +} + +ACPI_EXPORT_SYMBOL (AcpiTracePoint) + #endif diff --git a/src/acpica/source/components/utilities/utdelete.c b/src/acpica/source/components/utilities/utdelete.c index 80b8f98..8a55c8e 100644 --- a/src/acpica/source/components/utilities/utdelete.c +++ b/src/acpica/source/components/utilities/utdelete.c @@ -292,6 +292,10 @@ AcpiUtDeleteInternalObj ( AcpiUtDeleteObjectDesc (Object->Method.Mutex); Object->Method.Mutex = NULL; } + if (Object->Method.Node) + { + Object->Method.Node = NULL; + } break; case ACPI_TYPE_REGION: diff --git a/src/acpica/source/components/utilities/utinit.c b/src/acpica/source/components/utilities/utinit.c index 6f701ad..9653a3a 100644 --- a/src/acpica/source/components/utilities/utinit.c +++ b/src/acpica/source/components/utilities/utinit.c @@ -296,8 +296,6 @@ AcpiUtInitGlobals ( AcpiGbl_AcpiHardwarePresent = TRUE; AcpiGbl_LastOwnerIdIndex = 0; AcpiGbl_NextOwnerIdOffset = 0; - AcpiGbl_TraceDbgLevel = 0; - AcpiGbl_TraceDbgLayer = 0; AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; AcpiGbl_OsiMutex = NULL; AcpiGbl_RegMethodsExecuted = FALSE; diff --git a/src/acpica/source/components/utilities/utmisc.c b/src/acpica/source/components/utilities/utmisc.c index 141db80..762790d 100644 --- a/src/acpica/source/components/utilities/utmisc.c +++ b/src/acpica/source/components/utilities/utmisc.c @@ -490,7 +490,7 @@ AcpiUtDisplayInitPathname ( /* Get the full pathname to the node */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); if (ACPI_FAILURE (Status)) { return; diff --git a/src/acpica/source/components/utilities/utnonansi.c b/src/acpica/source/components/utilities/utnonansi.c new file mode 100644 index 0000000..01a4361 --- /dev/null +++ b/src/acpica/source/components/utilities/utnonansi.c @@ -0,0 +1,525 @@ +/******************************************************************************* + * + * Module Name: utnonansi - Non-ansi C library functions + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utnonansi") + + +/* + * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit + * version of strtoul. + */ + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrlwr (strlwr) + * + * PARAMETERS: SrcString - The source string to convert + * + * RETURN: None + * + * DESCRIPTION: Convert a string to lowercase + * + ******************************************************************************/ + +void +AcpiUtStrlwr ( + char *SrcString) +{ + char *String; + + + ACPI_FUNCTION_ENTRY (); + + + if (!SrcString) + { + return; + } + + /* Walk entire string, lowercasing the letters */ + + for (String = SrcString; *String; String++) + { + *String = (char) tolower ((int) *String); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrupr (strupr) + * + * PARAMETERS: SrcString - The source string to convert + * + * RETURN: None + * + * DESCRIPTION: Convert a string to uppercase + * + ******************************************************************************/ + +void +AcpiUtStrupr ( + char *SrcString) +{ + char *String; + + + ACPI_FUNCTION_ENTRY (); + + + if (!SrcString) + { + return; + } + + /* Walk entire string, uppercasing the letters */ + + for (String = SrcString; *String; String++) + { + *String = (char) toupper ((int) *String); + } +} + + +/****************************************************************************** + * + * FUNCTION: AcpiUtStricmp (stricmp) + * + * PARAMETERS: String1 - first string to compare + * String2 - second string to compare + * + * RETURN: int that signifies string relationship. Zero means strings + * are equal. + * + * DESCRIPTION: Case-insensitive string compare. Implementation of the + * non-ANSI stricmp function. + * + ******************************************************************************/ + +int +AcpiUtStricmp ( + char *String1, + char *String2) +{ + int c1; + int c2; + + + do + { + c1 = tolower ((int) *String1); + c2 = tolower ((int) *String2); + + String1++; + String2++; + } + while ((c1 == c2) && (c1)); + + return (c1 - c2); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrtoul64 + * + * PARAMETERS: String - Null terminated string + * Base - Radix of the string: 16 or ACPI_ANY_BASE; + * ACPI_ANY_BASE means 'in behalf of ToInteger' + * RetInteger - Where the converted integer is returned + * + * RETURN: Status and Converted value + * + * DESCRIPTION: Convert a string into an unsigned value. Performs either a + * 32-bit or 64-bit conversion, depending on the current mode + * of the interpreter. + * + * NOTE: Does not support Octal strings, not needed. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtStrtoul64 ( + char *String, + UINT32 Base, + UINT64 *RetInteger) +{ + UINT32 ThisDigit = 0; + UINT64 ReturnValue = 0; + UINT64 Quotient; + UINT64 Dividend; + UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE); + UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4); + UINT8 ValidDigits = 0; + UINT8 SignOf0x = 0; + UINT8 Term = 0; + + + ACPI_FUNCTION_TRACE_STR (UtStroul64, String); + + + switch (Base) + { + case ACPI_ANY_BASE: + case 16: + + break; + + default: + + /* Invalid Base */ + + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + if (!String) + { + goto ErrorExit; + } + + /* Skip over any white space in the buffer */ + + while ((*String) && (isspace ((int) *String) || *String == '\t')) + { + String++; + } + + if (ToIntegerOp) + { + /* + * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. + * We need to determine if it is decimal or hexadecimal. + */ + if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x')) + { + SignOf0x = 1; + Base = 16; + + /* Skip over the leading '0x' */ + String += 2; + } + else + { + Base = 10; + } + } + + /* Any string left? Check that '0x' is not followed by white space. */ + + if (!(*String) || isspace ((int) *String) || *String == '\t') + { + if (ToIntegerOp) + { + goto ErrorExit; + } + else + { + goto AllDone; + } + } + + /* + * Perform a 32-bit or 64-bit conversion, depending upon the current + * execution mode of the interpreter + */ + Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; + + /* Main loop: convert the string to a 32- or 64-bit integer */ + + while (*String) + { + if (isdigit ((int) *String)) + { + /* Convert ASCII 0-9 to Decimal value */ + + ThisDigit = ((UINT8) *String) - '0'; + } + else if (Base == 10) + { + /* Digit is out of range; possible in ToInteger case only */ + + Term = 1; + } + else + { + ThisDigit = (UINT8) toupper ((int) *String); + if (isxdigit ((int) ThisDigit)) + { + /* Convert ASCII Hex char to value */ + + ThisDigit = ThisDigit - 'A' + 10; + } + else + { + Term = 1; + } + } + + if (Term) + { + if (ToIntegerOp) + { + goto ErrorExit; + } + else + { + break; + } + } + else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x) + { + /* Skip zeros */ + String++; + continue; + } + + ValidDigits++; + + if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32))) + { + /* + * This is ToInteger operation case. + * No any restrictions for string-to-integer conversion, + * see ACPI spec. + */ + goto ErrorExit; + } + + /* Divide the digit into the correct position */ + + (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit), + Base, &Quotient, NULL); + + if (ReturnValue > Quotient) + { + if (ToIntegerOp) + { + goto ErrorExit; + } + else + { + break; + } + } + + ReturnValue *= Base; + ReturnValue += ThisDigit; + String++; + } + + /* All done, normal exit */ + +AllDone: + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64 (ReturnValue))); + + *RetInteger = ReturnValue; + return_ACPI_STATUS (AE_OK); + + +ErrorExit: + /* Base was set/validated above */ + + if (Base == 10) + { + return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT); + } + else + { + return_ACPI_STATUS (AE_BAD_HEX_CONSTANT); + } +} + + +#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) +/******************************************************************************* + * + * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat + * + * PARAMETERS: Adds a "DestSize" parameter to each of the standard string + * functions. This is the size of the Destination buffer. + * + * RETURN: TRUE if the operation would overflow the destination buffer. + * + * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that + * the result of the operation will not overflow the output string + * buffer. + * + * NOTE: These functions are typically only helpful for processing + * user input and command lines. For most ACPICA code, the + * required buffer length is precisely calculated before buffer + * allocation, so the use of these functions is unnecessary. + * + ******************************************************************************/ + +BOOLEAN +AcpiUtSafeStrcpy ( + char *Dest, + ACPI_SIZE DestSize, + char *Source) +{ + + if (strlen (Source) >= DestSize) + { + return (TRUE); + } + + strcpy (Dest, Source); + return (FALSE); +} + +BOOLEAN +AcpiUtSafeStrcat ( + char *Dest, + ACPI_SIZE DestSize, + char *Source) +{ + + if ((strlen (Dest) + strlen (Source)) >= DestSize) + { + return (TRUE); + } + + strcat (Dest, Source); + return (FALSE); +} + +BOOLEAN +AcpiUtSafeStrncat ( + char *Dest, + ACPI_SIZE DestSize, + char *Source, + ACPI_SIZE MaxTransferLength) +{ + ACPI_SIZE ActualTransferLength; + + + ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); + + if ((strlen (Dest) + ActualTransferLength) >= DestSize) + { + return (TRUE); + } + + strncat (Dest, Source, MaxTransferLength); + return (FALSE); +} +#endif diff --git a/src/acpica/source/components/utilities/utstring.c b/src/acpica/source/components/utilities/utstring.c index 8120297..3660cbb 100644 --- a/src/acpica/source/components/utilities/utstring.c +++ b/src/acpica/source/components/utilities/utstring.c @@ -122,343 +122,6 @@ ACPI_MODULE_NAME ("utstring") -/* - * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit - * version of strtoul. - */ - -#ifdef ACPI_ASL_COMPILER -/******************************************************************************* - * - * FUNCTION: AcpiUtStrlwr (strlwr) - * - * PARAMETERS: SrcString - The source string to convert - * - * RETURN: None - * - * DESCRIPTION: Convert string to lowercase - * - * NOTE: This is not a POSIX function, so it appears here, not in utclib.c - * - ******************************************************************************/ - -void -AcpiUtStrlwr ( - char *SrcString) -{ - char *String; - - - ACPI_FUNCTION_ENTRY (); - - - if (!SrcString) - { - return; - } - - /* Walk entire string, lowercasing the letters */ - - for (String = SrcString; *String; String++) - { - *String = (char) tolower ((int) *String); - } - - return; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiUtStricmp (stricmp) - * - * PARAMETERS: String1 - first string to compare - * String2 - second string to compare - * - * RETURN: int that signifies string relationship. Zero means strings - * are equal. - * - * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare - * strings with no case sensitivity) - * - ******************************************************************************/ - -int -AcpiUtStricmp ( - char *String1, - char *String2) -{ - int c1; - int c2; - - - do - { - c1 = tolower ((int) *String1); - c2 = tolower ((int) *String2); - - String1++; - String2++; - } - while ((c1 == c2) && (c1)); - - return (c1 - c2); -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrupr (strupr) - * - * PARAMETERS: SrcString - The source string to convert - * - * RETURN: None - * - * DESCRIPTION: Convert string to uppercase - * - * NOTE: This is not a POSIX function, so it appears here, not in utclib.c - * - ******************************************************************************/ - -void -AcpiUtStrupr ( - char *SrcString) -{ - char *String; - - - ACPI_FUNCTION_ENTRY (); - - - if (!SrcString) - { - return; - } - - /* Walk entire string, uppercasing the letters */ - - for (String = SrcString; *String; String++) - { - *String = (char) toupper ((int) *String); - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrtoul64 - * - * PARAMETERS: String - Null terminated string - * Base - Radix of the string: 16 or ACPI_ANY_BASE; - * ACPI_ANY_BASE means 'in behalf of ToInteger' - * RetInteger - Where the converted integer is returned - * - * RETURN: Status and Converted value - * - * DESCRIPTION: Convert a string into an unsigned value. Performs either a - * 32-bit or 64-bit conversion, depending on the current mode - * of the interpreter. - * NOTE: Does not support Octal strings, not needed. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtStrtoul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger) -{ - UINT32 ThisDigit = 0; - UINT64 ReturnValue = 0; - UINT64 Quotient; - UINT64 Dividend; - UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE); - UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4); - UINT8 ValidDigits = 0; - UINT8 SignOf0x = 0; - UINT8 Term = 0; - - - ACPI_FUNCTION_TRACE_STR (UtStroul64, String); - - - switch (Base) - { - case ACPI_ANY_BASE: - case 16: - - break; - - default: - - /* Invalid Base */ - - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (!String) - { - goto ErrorExit; - } - - /* Skip over any white space in the buffer */ - - while ((*String) && (isspace ((int) *String) || *String == '\t')) - { - String++; - } - - if (ToIntegerOp) - { - /* - * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. - * We need to determine if it is decimal or hexadecimal. - */ - if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x')) - { - SignOf0x = 1; - Base = 16; - - /* Skip over the leading '0x' */ - String += 2; - } - else - { - Base = 10; - } - } - - /* Any string left? Check that '0x' is not followed by white space. */ - - if (!(*String) || isspace ((int) *String) || *String == '\t') - { - if (ToIntegerOp) - { - goto ErrorExit; - } - else - { - goto AllDone; - } - } - - /* - * Perform a 32-bit or 64-bit conversion, depending upon the current - * execution mode of the interpreter - */ - Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; - - /* Main loop: convert the string to a 32- or 64-bit integer */ - - while (*String) - { - if (isdigit ((int) *String)) - { - /* Convert ASCII 0-9 to Decimal value */ - - ThisDigit = ((UINT8) *String) - '0'; - } - else if (Base == 10) - { - /* Digit is out of range; possible in ToInteger case only */ - - Term = 1; - } - else - { - ThisDigit = (UINT8) toupper ((int) *String); - if (isxdigit ((int) ThisDigit)) - { - /* Convert ASCII Hex char to value */ - - ThisDigit = ThisDigit - 'A' + 10; - } - else - { - Term = 1; - } - } - - if (Term) - { - if (ToIntegerOp) - { - goto ErrorExit; - } - else - { - break; - } - } - else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x) - { - /* Skip zeros */ - String++; - continue; - } - - ValidDigits++; - - if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32))) - { - /* - * This is ToInteger operation case. - * No any restrictions for string-to-integer conversion, - * see ACPI spec. - */ - goto ErrorExit; - } - - /* Divide the digit into the correct position */ - - (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit), - Base, &Quotient, NULL); - - if (ReturnValue > Quotient) - { - if (ToIntegerOp) - { - goto ErrorExit; - } - else - { - break; - } - } - - ReturnValue *= Base; - ReturnValue += ThisDigit; - String++; - } - - /* All done, normal exit */ - -AllDone: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ReturnValue))); - - *RetInteger = ReturnValue; - return_ACPI_STATUS (AE_OK); - - -ErrorExit: - /* Base was set/validated above */ - - if (Base == 10) - { - return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT); - } - else - { - return_ACPI_STATUS (AE_BAD_HEX_CONSTANT); - } -} - - /******************************************************************************* * * FUNCTION: AcpiUtPrintString @@ -754,78 +417,3 @@ UtConvertBackslashes ( } } #endif - -#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) -/******************************************************************************* - * - * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat - * - * PARAMETERS: Adds a "DestSize" parameter to each of the standard string - * functions. This is the size of the Destination buffer. - * - * RETURN: TRUE if the operation would overflow the destination buffer. - * - * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that - * the result of the operation will not overflow the output string - * buffer. - * - * NOTE: These functions are typically only helpful for processing - * user input and command lines. For most ACPICA code, the - * required buffer length is precisely calculated before buffer - * allocation, so the use of these functions is unnecessary. - * - ******************************************************************************/ - -BOOLEAN -AcpiUtSafeStrcpy ( - char *Dest, - ACPI_SIZE DestSize, - char *Source) -{ - - if (strlen (Source) >= DestSize) - { - return (TRUE); - } - - strcpy (Dest, Source); - return (FALSE); -} - -BOOLEAN -AcpiUtSafeStrcat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source) -{ - - if ((strlen (Dest) + strlen (Source)) >= DestSize) - { - return (TRUE); - } - - strcat (Dest, Source); - return (FALSE); -} - -BOOLEAN -AcpiUtSafeStrncat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source, - ACPI_SIZE MaxTransferLength) -{ - ACPI_SIZE ActualTransferLength; - - - ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); - - if ((strlen (Dest) + ActualTransferLength) >= DestSize) - { - return (TRUE); - } - - strncat (Dest, Source, MaxTransferLength); - return (FALSE); -} -#endif diff --git a/src/acpica/source/include/acdebug.h b/src/acpica/source/include/acdebug.h index 2d91725..909c831 100644 --- a/src/acpica/source/include/acdebug.h +++ b/src/acpica/source/include/acdebug.h @@ -209,6 +209,12 @@ AcpiDbSleep ( char *ObjectArg); void +AcpiDbTrace ( + char *EnableArg, + char *MethodArg, + char *OnceArg); + +void AcpiDbDisplayLocks ( void); @@ -497,6 +503,32 @@ AcpiDbGetNextToken ( /* + * dbobject + */ +void +AcpiDbDecodeInternalObject ( + ACPI_OPERAND_OBJECT *ObjDesc); + +void +AcpiDbDisplayInternalObject ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +void +AcpiDbDecodeArguments ( + ACPI_WALK_STATE *WalkState); + +void +AcpiDbDecodeLocals ( + ACPI_WALK_STATE *WalkState); + +void +AcpiDbDumpMethodInfo ( + ACPI_STATUS Status, + ACPI_WALK_STATE *WalkState); + + +/* * dbstats - Generation and display of ACPI table statistics */ void diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h index 30fbece..2cad1b9 100644 --- a/src/acpica/source/include/acdisasm.h +++ b/src/acpica/source/include/acdisasm.h @@ -471,7 +471,9 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoStao[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaClient[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaServer[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc[]; @@ -667,6 +669,10 @@ AcpiDmDumpStao ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpTcpa ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpVrtc ( ACPI_TABLE_HEADER *Table); @@ -709,10 +715,6 @@ AcpiDmDisassembleOneOp ( ACPI_OP_WALK_INFO *Info, ACPI_PARSE_OBJECT *Op); -void -AcpiDmDecodeInternalObject ( - ACPI_OPERAND_OBJECT *ObjDesc); - UINT32 AcpiDmListType ( ACPI_PARSE_OBJECT *Op); @@ -772,29 +774,6 @@ AcpiDmNamestring ( /* - * dmobject - */ -void -AcpiDmDisplayInternalObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); - -void -AcpiDmDisplayArguments ( - ACPI_WALK_STATE *WalkState); - -void -AcpiDmDisplayLocals ( - ACPI_WALK_STATE *WalkState); - -void -AcpiDmDumpMethodInfo ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - - -/* * dmbuffer */ void diff --git a/src/acpica/source/include/acdispat.h b/src/acpica/source/include/acdispat.h index 238cdde..2fac6ee 100644 --- a/src/acpica/source/include/acdispat.h +++ b/src/acpica/source/include/acdispat.h @@ -533,4 +533,14 @@ AcpiDsResultPush ( ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState); + +/* + * dsdebug - parser debugging routines + */ +void +AcpiDsDumpMethodStack ( + ACPI_STATUS Status, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + #endif /* _ACDISPAT_H_ */ diff --git a/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h index 3e399ba..4061401 100644 --- a/src/acpica/source/include/acglobal.h +++ b/src/acpica/source/include/acglobal.h @@ -365,8 +365,6 @@ ACPI_GLOBAL (UINT32, AcpiFixedEventCount[ACPI_NUM_FIXED_EVENT ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLevel); ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLayer); -ACPI_GLOBAL (UINT32, AcpiGbl_TraceDbgLevel); -ACPI_GLOBAL (UINT32, AcpiGbl_TraceDbgLayer); /***************************************************************************** @@ -385,6 +383,7 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE); +ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT *, AcpiGbl_PreviousOp, NULL); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_Disasm); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_Verbose); diff --git a/src/acpica/source/include/acinterp.h b/src/acpica/source/include/acinterp.h index 7c74e05..77d6953 100644 --- a/src/acpica/source/include/acinterp.h +++ b/src/acpica/source/include/acinterp.h @@ -215,6 +215,35 @@ AcpiExDoDebugObject ( UINT32 Level, UINT32 Index); +void +AcpiExStartTraceMethod ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +void +AcpiExStopTraceMethod ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +void +AcpiExStartTraceOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState); + +void +AcpiExStopTraceOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState); + +void +AcpiExTracePoint ( + ACPI_TRACE_EVENT_TYPE Type, + BOOLEAN Begin, + UINT8 *Aml, + char *Pathname); + /* * exfield - ACPI AML (p-code) execution - field manipulation diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h index b550282..bd026ae 100644 --- a/src/acpica/source/include/aclocal.h +++ b/src/acpica/source/include/aclocal.h @@ -265,8 +265,12 @@ typedef struct acpi_namespace_node */ #ifdef ACPI_LARGE_NAMESPACE_NODE union acpi_parse_object *Op; + void *MethodLocals; + void *MethodArgs; UINT32 Value; UINT32 Length; + UINT8 ArgCount; + #endif } ACPI_NAMESPACE_NODE; @@ -936,7 +940,7 @@ typedef union acpi_parse_value } ACPI_PARSE_VALUE; -#ifdef ACPI_DISASSEMBLER +#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) #define ACPI_DISASM_ONLY_MEMBERS(a) a; #else #define ACPI_DISASM_ONLY_MEMBERS(a) @@ -947,7 +951,7 @@ typedef union acpi_parse_value UINT8 DescriptorType; /* To differentiate various internal objs */\ UINT8 Flags; /* Type of Op */\ UINT16 AmlOpcode; /* AML opcode */\ - UINT32 AmlOffset; /* Offset of declaration in AML */\ + UINT8 *Aml; /* Address of declaration in AML */\ union acpi_parse_object *Next; /* Next op */\ ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\ ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ @@ -1363,7 +1367,9 @@ typedef struct acpi_db_method_info * Index of current thread inside all them created. */ char InitArgs; +#ifdef ACPI_DEBUGGER ACPI_OBJECT_TYPE ArgTypes[4]; +#endif char *Arguments[4]; char NumThreadsStr[11]; char IdOfThreadStr[11]; diff --git a/src/acpica/source/include/acmacros.h b/src/acpica/source/include/acmacros.h index c1f5f81..f8dfffb 100644 --- a/src/acpica/source/include/acmacros.h +++ b/src/acpica/source/include/acmacros.h @@ -295,6 +295,16 @@ #define ACPI_MUL_32(a) _ACPI_MUL(a, 5) #define ACPI_MOD_32(a) _ACPI_MOD(a, 32) +/* Test for ASCII character */ + +#define ACPI_IS_ASCII(c) ((c) < 0x80) + +/* Signed integers */ + +#define ACPI_SIGN_POSITIVE 0 +#define ACPI_SIGN_NEGATIVE 1 + + /* * Rounding macros (Power of two boundaries only) */ diff --git a/src/acpica/source/include/acnamesp.h b/src/acpica/source/include/acnamesp.h index 1b19357..db7f114 100644 --- a/src/acpica/source/include/acnamesp.h +++ b/src/acpica/source/include/acnamesp.h @@ -422,16 +422,22 @@ UINT32 AcpiNsOpensScope ( ACPI_OBJECT_TYPE Type); -ACPI_STATUS -AcpiNsBuildExternalPath ( - ACPI_NAMESPACE_NODE *Node, - ACPI_SIZE Size, - char *NameBuffer); - char * AcpiNsGetExternalPathname ( ACPI_NAMESPACE_NODE *Node); +UINT32 +AcpiNsBuildNormalizedPath ( + ACPI_NAMESPACE_NODE *Node, + char *FullPath, + UINT32 PathSize, + BOOLEAN NoTrailing); + +char * +AcpiNsGetNormalizedPathname ( + ACPI_NAMESPACE_NODE *Node, + BOOLEAN NoTrailing); + char * AcpiNsNameOfCurrentScope ( ACPI_WALK_STATE *WalkState); @@ -439,7 +445,8 @@ AcpiNsNameOfCurrentScope ( ACPI_STATUS AcpiNsHandleToPathname ( ACPI_HANDLE TargetHandle, - ACPI_BUFFER *Buffer); + ACPI_BUFFER *Buffer, + BOOLEAN NoTrailing); BOOLEAN AcpiNsPatternMatch ( diff --git a/src/acpica/source/include/acobject.h b/src/acpica/source/include/acobject.h index fbd28a9..feaa9d1 100644 --- a/src/acpica/source/include/acobject.h +++ b/src/acpica/source/include/acobject.h @@ -285,6 +285,7 @@ typedef struct acpi_object_method UINT8 ParamCount; UINT8 SyncLevel; union acpi_operand_object *Mutex; + union acpi_operand_object *Node; UINT8 *AmlStart; union { diff --git a/src/acpica/source/include/acoutput.h b/src/acpica/source/include/acoutput.h index 9570a38..a9c73b9 100644 --- a/src/acpica/source/include/acoutput.h +++ b/src/acpica/source/include/acoutput.h @@ -161,7 +161,8 @@ #define ACPI_LV_DEBUG_OBJECT 0x00000002 #define ACPI_LV_INFO 0x00000004 #define ACPI_LV_REPAIR 0x00000008 -#define ACPI_LV_ALL_EXCEPTIONS 0x0000000F +#define ACPI_LV_TRACE_POINT 0x00000010 +#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F /* Trace verbosity level 1 [Standard Trace Level] */ @@ -221,6 +222,7 @@ #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) #define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) +#define ACPI_DB_TRACE_POINT ACPI_DEBUG_LEVEL (ACPI_LV_TRACE_POINT) #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) /* Trace level -- also used in the global "DebugLevel" */ @@ -257,6 +259,21 @@ #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) +/* + * Global trace flags + */ +#define ACPI_TRACE_ENABLED ((UINT32) 4) +#define ACPI_TRACE_ONESHOT ((UINT32) 2) +#define ACPI_TRACE_OPCODE ((UINT32) 1) + +/* Defaults for trace debugging level/layer */ + +#define ACPI_TRACE_LEVEL_ALL ACPI_LV_ALL +#define ACPI_TRACE_LAYER_ALL 0x000001FF +#define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TRACE_POINT +#define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECUTER + + #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) /* * The module name is used primarily for error and debug messages. @@ -511,6 +528,8 @@ #define ACPI_DUMP_PATHNAME(a, b, c, d) AcpiNsDumpPathname(a, b, c, d) #define ACPI_DUMP_BUFFER(a, b) AcpiUtDebugDumpBuffer((UINT8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) +#define ACPI_TRACE_POINT(a, b, c, d) AcpiTracePoint (a, b, c, d) + #else /* ACPI_DEBUG_OUTPUT */ /* * This is the non-debug case -- make everything go away, @@ -532,6 +551,7 @@ #define ACPI_DUMP_PATHNAME(a, b, c, d) #define ACPI_DUMP_BUFFER(a, b) #define ACPI_IS_DEBUG_ENABLED(Level, Component) 0 +#define ACPI_TRACE_POINT(a, b, c, d) /* Return macros must have a return statement at the minimum */ diff --git a/src/acpica/source/include/acparser.h b/src/acpica/source/include/acparser.h index e4fc0c7..c525dd3 100644 --- a/src/acpica/source/include/acparser.h +++ b/src/acpica/source/include/acparser.h @@ -378,7 +378,7 @@ AcpiPsDeleteParseTree ( */ ACPI_PARSE_OBJECT * AcpiPsCreateScopeOp ( - void); + UINT8 *Aml); void AcpiPsInitOp ( @@ -387,7 +387,8 @@ AcpiPsInitOp ( ACPI_PARSE_OBJECT * AcpiPsAllocOp ( - UINT16 opcode); + UINT16 Opcode, + UINT8 *Aml); void AcpiPsFreeOp ( diff --git a/src/acpica/source/include/acpiosxf.h b/src/acpica/source/include/acpiosxf.h index 68d79c7..45cec74 100644 --- a/src/acpica/source/include/acpiosxf.h +++ b/src/acpica/source/include/acpiosxf.h @@ -671,5 +671,14 @@ AcpiOsSetFileOffset ( UINT8 From); #endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint +void +AcpiOsTracePoint ( + ACPI_TRACE_EVENT_TYPE Type, + BOOLEAN Begin, + UINT8 *Aml, + char *Pathname); +#endif + #endif /* __ACPIOSXF_H__ */ diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h index c090d68..791aa64 100644 --- a/src/acpica/source/include/acpixf.h +++ b/src/acpica/source/include/acpixf.h @@ -118,7 +118,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20150619 +#define ACPI_CA_VERSION 0x20150717 #include "acconfig.h" #include "actypes.h" @@ -325,7 +325,9 @@ ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ReducedHardware, FALSE); * traced each time it is executed. */ ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceFlags, 0); -ACPI_INIT_GLOBAL (ACPI_NAME, AcpiGbl_TraceMethodName, 0); +ACPI_INIT_GLOBAL (const char *, AcpiGbl_TraceMethodName, NULL); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceDbgLevel, ACPI_TRACE_LEVEL_DEFAULT); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceDbgLayer, ACPI_TRACE_LAYER_DEFAULT); /* * Runtime configuration of debug output control masks. We want the debug @@ -682,7 +684,7 @@ AcpiGetData ( ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiDebugTrace ( - char *Name, + const char *Name, UINT32 DebugLevel, UINT32 DebugLayer, UINT32 Flags)) @@ -1263,6 +1265,14 @@ AcpiDebugPrintRaw ( const char *Format, ...)) +ACPI_DBG_DEPENDENT_RETURN_VOID ( +void +AcpiTracePoint ( + ACPI_TRACE_EVENT_TYPE Type, + BOOLEAN Begin, + UINT8 *Aml, + char *Pathname)) + ACPI_APP_DEPENDENT_RETURN_VOID ( ACPI_PRINTF_LIKE(1) void ACPI_INTERNAL_VAR_XFACE diff --git a/src/acpica/source/include/acstruct.h b/src/acpica/source/include/acstruct.h index d647826..f8443d6 100644 --- a/src/acpica/source/include/acstruct.h +++ b/src/acpica/source/include/acstruct.h @@ -160,7 +160,7 @@ typedef struct acpi_walk_state BOOLEAN NamespaceOverride; /* Override existing objects */ UINT8 ResultSize; /* Total elements for the result stack */ UINT8 ResultCount; /* Current number of occupied elements of result stack */ - UINT32 AmlOffset; + UINT8 *Aml; UINT32 ArgTypes; UINT32 MethodBreakpoint; /* For single stepping */ UINT32 UserBreakpoint; /* User AML breakpoint */ diff --git a/src/acpica/source/include/actbl2.h b/src/acpica/source/include/actbl2.h index c838959..ab92589 100644 --- a/src/acpica/source/include/actbl2.h +++ b/src/acpica/source/include/actbl2.h @@ -1447,14 +1447,28 @@ enum AcpiSpmiInterfaceTypes * December 19, 2014 * * NOTE: There are two versions of the table with the same signature -- - * the client version and the server version. + * the client version and the server version. The common PlatformClass + * field is used to differentiate the two types of tables. * ******************************************************************************/ -typedef struct acpi_table_tcpa_client +typedef struct acpi_table_tcpa_hdr { ACPI_TABLE_HEADER Header; /* Common ACPI table header */ UINT16 PlatformClass; + +} ACPI_TABLE_TCPA_HDR; + +/* + * Values for PlatformClass above. + * This is how the client and server subtables are differentiated + */ +#define ACPI_TCPA_CLIENT_TABLE 0 +#define ACPI_TCPA_SERVER_TABLE 1 + + +typedef struct acpi_table_tcpa_client +{ UINT32 MinimumLogLength; /* Minimum length for the event log area */ UINT64 LogAddress; /* Address of the event log area */ @@ -1462,8 +1476,6 @@ typedef struct acpi_table_tcpa_client typedef struct acpi_table_tcpa_server { - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 PlatformClass; UINT16 Reserved; UINT64 MinimumLogLength; /* Minimum length for the event log area */ UINT64 LogAddress; /* Address of the event log area */ diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h index c8cb5ce..dcf11b5 100644 --- a/src/acpica/source/include/actypes.h +++ b/src/acpica/source/include/actypes.h @@ -1094,7 +1094,8 @@ typedef struct acpi_buffer */ #define ACPI_FULL_PATHNAME 0 #define ACPI_SINGLE_NAME 1 -#define ACPI_NAME_TYPE_MAX 1 +#define ACPI_FULL_PATHNAME_NO_TRAILING 2 +#define ACPI_NAME_TYPE_MAX 2 /* @@ -1417,6 +1418,17 @@ typedef struct acpi_memory_list } ACPI_MEMORY_LIST; +/* Definitions of trace event types */ + +typedef enum +{ + ACPI_TRACE_AML_METHOD, + ACPI_TRACE_AML_OPCODE, + ACPI_TRACE_AML_REGION + +} ACPI_TRACE_EVENT_TYPE; + + /* Definitions of _OSI support */ #define ACPI_VENDOR_STRINGS 0x01 diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h index 562499c..429c0a3 100644 --- a/src/acpica/source/include/acutils.h +++ b/src/acpica/source/include/acutils.h @@ -245,6 +245,30 @@ typedef struct acpi_pkg_info #define DB_DWORD_DISPLAY 4 #define DB_QWORD_DISPLAY 8 + +/* + * utnonansi - Non-ANSI C library functions + */ +void +AcpiUtStrupr ( + char *SrcString); + +void +AcpiUtStrlwr ( + char *SrcString); + +int +AcpiUtStricmp ( + char *String1, + char *String2); + +ACPI_STATUS +AcpiUtStrtoul64 ( + char *String, + UINT32 Base, + UINT64 *RetInteger); + + /* * utglobal - Global data structures and procedures */ @@ -318,8 +342,6 @@ AcpiUtSubsystemShutdown ( void); -#define ACPI_IS_ASCII(c) ((c) < 0x80) - /* * utcopy - Object construction and conversion interfaces */ @@ -479,6 +501,7 @@ AcpiUtReportWarning ( char *ModuleName, UINT32 LineNumber); + /* * utdelete - Object deletion and reference counts */ @@ -804,11 +827,11 @@ AcpiUtWalkPackageTree ( ACPI_PKG_CALLBACK WalkCallback, void *Context); - /* Values for Base above (16=Hex, 10=Decimal) */ #define ACPI_ANY_BASE 0 + UINT32 AcpiUtDwordByteSwap ( UINT32 Value); @@ -881,27 +904,6 @@ AcpiUtGetResourceEndTag ( * utstring - String and character utilities */ void -AcpiUtStrupr ( - char *SrcString); - -#ifdef ACPI_ASL_COMPILER -void -AcpiUtStrlwr ( - char *SrcString); - -int -AcpiUtStricmp ( - char *String1, - char *String2); -#endif - -ACPI_STATUS -AcpiUtStrtoul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger); - -void AcpiUtPrintString ( char *String, UINT16 MaxLength); @@ -1026,6 +1028,7 @@ AcpiUtCreateList ( #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ + /* * utaddress - address range check */ @@ -1052,6 +1055,7 @@ void AcpiUtDeleteAddressLists ( void); + /* * utxferror - various error/warning output functions */ @@ -1098,6 +1102,7 @@ AcpiUtMethodError ( const char *Path, ACPI_STATUS LookupStatus); + /* * Utility functions for ACPI names and IDs */ @@ -1113,6 +1118,7 @@ const char * AcpiAhMatchUuid ( UINT8 *Data); + /* * utprint - printf/vprintf output functions */ @@ -1154,6 +1160,7 @@ AcpiUtFilePrintf ( ...); #endif + /* * utuuid -- UUID support functions */ diff --git a/src/acpica/source/include/platform/acenvex.h b/src/acpica/source/include/platform/acenvex.h index ac1cb92..3daf77e 100644 --- a/src/acpica/source/include/platform/acenvex.h +++ b/src/acpica/source/include/platform/acenvex.h @@ -128,6 +128,9 @@ #if defined(_LINUX) || defined(__linux__) #include "aclinuxex.h" +#elif defined(WIN32) +#include "acwinex.h" + #elif defined(_AED_EFI) #include "acefiex.h"