diff options
Diffstat (limited to 'source/components')
25 files changed, 459 insertions, 206 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index 3b5c266e744d5..76f01acb3d743 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -405,7 +405,7 @@ AcpiDbDisplayTableInfo ( { /* If the pointer is null, the table has been unloaded */ - ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded", + ACPI_INFO (("%4.4s - Table has been unloaded", TableDesc->Signature.Ascii)); } } diff --git a/source/components/debugger/dbconvert.c b/source/components/debugger/dbconvert.c index fc3bbda8ab1ae..01cb37a228323 100644 --- a/source/components/debugger/dbconvert.c +++ b/source/components/debugger/dbconvert.c @@ -465,7 +465,7 @@ AcpiDbDumpPldBuffer ( NewBuffer = AcpiDbEncodePldBuffer (PldInfo); if (!NewBuffer) { - return; + goto Exit; } /* The two bit-packed buffers should match */ @@ -524,6 +524,7 @@ AcpiDbDumpPldBuffer ( AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_HorizontalOffset", PldInfo->HorizontalOffset); } - ACPI_FREE (PldInfo); ACPI_FREE (NewBuffer); +Exit: + ACPI_FREE (PldInfo); } diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index dd5a0d40ac0d6..20d7ce5fc6119 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -969,6 +969,10 @@ AcpiDmDisassembleOneOp ( AcpiDmConvertToElseIf (Op); break; + case AML_EXTERNAL_OP: + + break; + default: /* Just get the opcode name and print it */ diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index 8dd001108b2a4..43f5686a4566e 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -410,6 +410,7 @@ AcpiDmDescendingOp ( const ACPI_OPCODE_INFO *OpInfo; UINT32 Name; ACPI_PARSE_OBJECT *NextOp; + ACPI_PARSE_OBJECT *NextOp2; UINT32 AmlOffset; @@ -436,8 +437,7 @@ AcpiDmDescendingOp ( AcpiUtDumpBuffer ( (Info->StartAml + Info->AmlOffset), (Op->Common.Aml - Info->PreviousAml), - DB_BYTE_DISPLAY, - Info->AmlOffset); + DB_BYTE_DISPLAY, Info->AmlOffset); AcpiOsPrintf ("\n"); } @@ -455,6 +455,33 @@ AcpiDmDescendingOp ( return (AE_CTRL_DEPTH); } + if (Op->Common.AmlOpcode == AML_IF_OP) + { + NextOp = AcpiPsGetDepthNext (NULL, Op); + if (NextOp) + { + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; + } + + /* + * A Zero predicate indicates the possibility of one or more + * External() opcodes within the If() block. + */ + if (NextOp->Common.AmlOpcode == AML_ZERO_OP) + { + NextOp2 = NextOp->Common.Next; + + if (NextOp2 && + (NextOp2->Common.AmlOpcode == AML_EXTERNAL_OP)) + { + /* Ignore the If 0 block and all children */ + + Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + return (AE_CTRL_DEPTH); + } + } + } + /* Level 0 is at the Definition Block level */ if (Level == 0) @@ -788,8 +815,8 @@ AcpiDmDescendingOp ( NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; return (AE_OK); - case AML_VAR_PACKAGE_OP: case AML_IF_OP: + case AML_VAR_PACKAGE_OP: case AML_WHILE_OP: /* The next op is the size or predicate parameter */ diff --git a/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c index 356739ac26559..25d278ca1699f 100644 --- a/source/components/dispatcher/dsmethod.c +++ b/source/components/dispatcher/dsmethod.c @@ -867,7 +867,7 @@ AcpiDsTerminateControlMethod ( { if (WalkState) { - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Marking method %4.4s as Serialized " "because of AE_ALREADY_EXISTS error", WalkState->MethodNode->Name.Ascii)); diff --git a/source/components/dispatcher/dsobject.c b/source/components/dispatcher/dsobject.c index 452c66bce14d1..3f7b54058029d 100644 --- a/source/components/dispatcher/dsobject.c +++ b/source/components/dispatcher/dsobject.c @@ -538,7 +538,7 @@ AcpiDsBuildInternalPackageObj ( Arg = Arg->Common.Next; } - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Actual Package length (%u) is larger than " "NumElements field (%u), truncated", i, ElementCount)); diff --git a/source/components/events/evgpeblk.c b/source/components/events/evgpeblk.c index 21f0692725380..2e1d354d15799 100644 --- a/source/components/events/evgpeblk.c +++ b/source/components/events/evgpeblk.c @@ -542,7 +542,7 @@ AcpiEvInitializeGpeBlock ( if (GpeEnabledCount) { - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Enabled %u GPEs in block %02X to %02X", GpeEnabledCount, (UINT32) GpeBlock->BlockBaseNumber, (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)))); diff --git a/source/components/events/evgpeinit.c b/source/components/events/evgpeinit.c index b62f91ad19d8b..8e2fd340230bb 100644 --- a/source/components/events/evgpeinit.c +++ b/source/components/events/evgpeinit.c @@ -292,7 +292,7 @@ AcpiEvUpdateGpes ( if (WalkInfo.Count) { - ACPI_INFO ((AE_INFO, "Enabled %u new GPEs", WalkInfo.Count)); + ACPI_INFO (("Enabled %u new GPEs", WalkInfo.Count)); } (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c index db4080a9dc1bb..0853a324f3794 100644 --- a/source/components/events/evregion.c +++ b/source/components/events/evregion.c @@ -99,7 +99,6 @@ AcpiEvInitializeOpRegions ( /* Run the _REG methods for OpRegions in each default address space */ - AcpiGbl_RegMethodsEnabled = TRUE; for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { /* @@ -637,7 +636,7 @@ AcpiEvExecuteRegMethod ( if (RegionObj2->Extra.Method_REG == NULL || RegionObj->Region.Handler == NULL || - !AcpiGbl_RegMethodsEnabled) + !AcpiGbl_NamespaceInitialized) { return_ACPI_STATUS (AE_OK); } diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index 60aea38c69640..7a78e3c2c6227 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -276,7 +276,7 @@ AcpiExLoadTableOp ( Status = AcpiGetTableByIndex (TableIndex, &Table); if (ACPI_SUCCESS (Status)) { - ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:")); + ACPI_INFO (("Dynamic OEM Table Load:")); AcpiTbPrintTableHeader (0, Table); } @@ -516,7 +516,7 @@ AcpiExLoadOp ( /* Install the new table into the local data structures */ - ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:")); + ACPI_INFO (("Dynamic OEM Table Load:")); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), diff --git a/source/components/executer/exoparg3.c b/source/components/executer/exoparg3.c index db9fd11f936a7..de46a97c9caca 100644 --- a/source/components/executer/exoparg3.c +++ b/source/components/executer/exoparg3.c @@ -134,8 +134,10 @@ AcpiExOpcode_3A_0T_0R ( * op is intended for use by disassemblers in order to properly * disassemble control method invocations. The opcode or group of * opcodes should be surrounded by an "if (0)" clause to ensure that - * AML interpreters never see the opcode. + * AML interpreters never see the opcode. Thus, something is + * wrong if an external opcode ever gets here. */ + ACPI_ERROR ((AE_INFO, "Executed External Op")); Status = AE_OK; goto Cleanup; diff --git a/source/components/hardware/hwxfsleep.c b/source/components/hardware/hwxfsleep.c index 1e43d987cdd52..7a0eaf5061ded 100644 --- a/source/components/hardware/hwxfsleep.c +++ b/source/components/hardware/hwxfsleep.c @@ -97,7 +97,7 @@ static ACPI_SLEEP_FUNCTIONS AcpiSleepDispatch[] = * PhysicalAddress - 32-bit physical address of ACPI real mode * entry point * PhysicalAddress64 - 64-bit physical address of ACPI protected - * entry point + * mode entry point * * RETURN: Status * @@ -153,7 +153,7 @@ AcpiHwSetFirmwareWakingVector ( * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode * entry point * PhysicalAddress64 - 64-bit physical address of ACPI protected - * entry point + * mode entry point * * RETURN: Status * diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index 33a45c03a7e1e..63051b8a52f89 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -396,7 +396,7 @@ AcpiNsExecModuleCodeList ( AcpiUtRemoveReference (Prev); } - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Executed %u blocks of module-level executable AML code", MethodCount)); diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index fc0819786db6c..99f1527e028d8 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -46,6 +46,7 @@ #include "acnamesp.h" #include "acdispat.h" #include "acinterp.h" +#include "acevents.h" #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsinit") @@ -151,84 +152,112 @@ AcpiNsInitializeObjects ( ACPI_STATUS AcpiNsInitializeDevices ( - void) + UINT32 Flags) { - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; ACPI_DEVICE_WALK_INFO Info; ACPI_FUNCTION_TRACE (NsInitializeDevices); - /* Init counters */ + if (!(Flags & ACPI_NO_DEVICE_INIT)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[Init] Initializing ACPI Devices\n")); - Info.DeviceCount = 0; - Info.Num_STA = 0; - Info.Num_INI = 0; + /* Init counters */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Initializing Device/Processor/Thermal objects " - "and executing _INI/_STA methods:\n")); + Info.DeviceCount = 0; + Info.Num_STA = 0; + Info.Num_INI = 0; - /* Tree analysis: find all subtrees that contain _INI methods */ + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + "Initializing Device/Processor/Thermal objects " + "and executing _INI/_STA methods:\n")); - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } + /* Tree analysis: find all subtrees that contain _INI methods */ - /* Allocate the evaluation information block */ + Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } - Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info.EvaluateInfo) - { - Status = AE_NO_MEMORY; - goto ErrorExit; - } + /* Allocate the evaluation information block */ - /* - * Execute the "global" _INI method that may appear at the root. This - * support is provided for Windows compatibility (Vista+) and is not - * part of the ACPI specification. - */ - Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; - Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI; - Info.EvaluateInfo->Parameters = NULL; - Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; + Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); + if (!Info.EvaluateInfo) + { + Status = AE_NO_MEMORY; + goto ErrorExit; + } - Status = AcpiNsEvaluate (Info.EvaluateInfo); - if (ACPI_SUCCESS (Status)) - { - Info.Num_INI++; + /* + * Execute the "global" _INI method that may appear at the root. + * This support is provided for Windows compatibility (Vista+) and + * is not part of the ACPI specification. + */ + Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; + Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI; + Info.EvaluateInfo->Parameters = NULL; + Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; + + Status = AcpiNsEvaluate (Info.EvaluateInfo); + if (ACPI_SUCCESS (Status)) + { + Info.Num_INI++; + } } - /* Walk namespace to execute all _INIs on present devices */ - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); - /* - * Any _OSI requests should be completed by now. If the BIOS has - * requested any Windows OSI strings, we will always truncate - * I/O addresses to 16 bits -- for Windows compatibility. + * Run all _REG methods + * + * Note: Any objects accessed by the _REG methods will be automatically + * initialized, even if they contain executable AML (see the call to + * AcpiNsInitializeObjects below). */ - if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000) + if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) { - AcpiGbl_TruncateIoAddresses = TRUE; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[Init] Executing _REG OpRegion methods\n")); + + Status = AcpiEvInitializeOpRegions (); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } } - ACPI_FREE (Info.EvaluateInfo); - if (ACPI_FAILURE (Status)) + if (!(Flags & ACPI_NO_DEVICE_INIT)) { - goto ErrorExit; - } + /* Walk namespace to execute all _INIs on present devices */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - " Executed %u _INI methods requiring %u _STA executions " - "(examined %u objects)\n", - Info.Num_INI, Info.Num_STA, Info.DeviceCount)); + Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); + + /* + * Any _OSI requests should be completed by now. If the BIOS has + * requested any Windows OSI strings, we will always truncate + * I/O addresses to 16 bits -- for Windows compatibility. + */ + if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000) + { + AcpiGbl_TruncateIoAddresses = TRUE; + } + + ACPI_FREE (Info.EvaluateInfo); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + " Executed %u _INI methods requiring %u _STA executions " + "(examined %u objects)\n", + Info.Num_INI, Info.Num_STA, Info.DeviceCount)); + } return_ACPI_STATUS (Status); diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c index ccffb7190ecf9..a4745c3adc1df 100644 --- a/source/components/parser/psargs.c +++ b/source/components/parser/psargs.c @@ -298,7 +298,7 @@ AcpiPsGetNextNamepath ( PossibleMethodCall && (Node->Type == ACPI_TYPE_METHOD)) { - if (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_SUPERNAME) + if (WalkState->Opcode == AML_UNLOAD_OP) { /* * AcpiPsGetNextNamestring has increased the AML pointer, @@ -744,7 +744,7 @@ AcpiPsGetNextField ( * * PARAMETERS: WalkState - Current state * ParserState - Current parser state object - * ArgType - The parser argument type (ARGP_*) + * ArgType - The argument type (AML_*_ARG) * ReturnArg - Where the next arg is returned * * RETURN: Status, and an op object containing the next argument. @@ -873,9 +873,9 @@ AcpiPsGetNextArg ( return_ACPI_STATUS (AE_NO_MEMORY); } - /* SuperName allows argument to be a method call */ + /* To support SuperName arg of Unload */ - if (ArgType == ARGP_SUPERNAME) + if (WalkState->Opcode == AML_UNLOAD_OP) { Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, ACPI_POSSIBLE_METHOD_CALL); diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index d5ae920835552..32d63eedd7215 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -292,7 +292,7 @@ AcpiTbInstallStandardTable ( AcpiGbl_DisableSsdtTableInstall && ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) { - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Ignoring installation of %4.4s at %8.8X%8.8X", NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address))); goto ReleaseAndExit; @@ -464,7 +464,7 @@ FinishOverride: return; } - ACPI_INFO ((AE_INFO, "%4.4s 0x%8.8X%8.8X" + ACPI_INFO (("%4.4s 0x%8.8X%8.8X" " %s table override, new table: 0x%8.8X%8.8X", OldTableDesc->Signature.Ascii, ACPI_FORMAT_UINT64 (OldTableDesc->Address), diff --git a/source/components/tables/tbprint.c b/source/components/tables/tbprint.c index 65ce7093638c3..9dab6d9d4a8d5 100644 --- a/source/components/tables/tbprint.c +++ b/source/components/tables/tbprint.c @@ -149,7 +149,7 @@ AcpiTbPrintTableHeader ( { /* FACS only has signature and length fields */ - ACPI_INFO ((AE_INFO, "%-4.4s 0x%8.8X%8.8X %06X", + ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X", Header->Signature, ACPI_FORMAT_UINT64 (Address), Header->Length)); } @@ -161,7 +161,7 @@ AcpiTbPrintTableHeader ( Header)->OemId, ACPI_OEM_ID_SIZE); AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); - ACPI_INFO ((AE_INFO, "RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)", + ACPI_INFO (("RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)", ACPI_FORMAT_UINT64 (Address), (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ? ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20, @@ -174,7 +174,7 @@ AcpiTbPrintTableHeader ( AcpiTbCleanupTableHeader (&LocalHeader, Header); - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "%-4.4s 0x%8.8X%8.8X" " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address), diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 0a34708af78de..3e68d75f1a0ec 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -185,7 +185,7 @@ AcpiTbCopyDsdt ( ACPI_PTR_TO_PHYSADDR (NewTable), ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, NewTable); - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Forced DSDT copy: length 0x%05X copied locally, original unmapped", NewTable->Length)); diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c index 3583e819e3732..0302eb94a02a9 100644 --- a/source/components/tables/tbxfload.c +++ b/source/components/tables/tbxfload.c @@ -47,6 +47,7 @@ #include "accommon.h" #include "acnamesp.h" #include "actables.h" +#include "acevents.h" #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbxfload") @@ -74,6 +75,28 @@ AcpiLoadTables ( ACPI_FUNCTION_TRACE (AcpiLoadTables); + /* + * Install the default operation region handlers. These are the + * handlers that are defined by the ACPI specification to be + * "always accessible" -- namely, SystemMemory, SystemIO, and + * PCI_Config. This also means that no _REG methods need to be + * run for these address spaces. We need to have these handlers + * installed before any AML code can be executed, especially any + * module-level code (11/2015). + * Note that we allow OSPMs to install their own region handlers + * between AcpiInitializeSubsystem() and AcpiLoadTables() to use + * their customized default region handlers. + */ + if (AcpiGbl_GroupModuleLevelCode) + { + Status = AcpiEvInstallRegionHandlers (); + if (ACPI_FAILURE (Status) && Status != AE_ALREADY_EXISTS) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization")); + return_ACPI_STATUS (Status); + } + } + /* Load the namespace from the tables */ Status = AcpiTbLoadNamespace (); @@ -227,7 +250,7 @@ AcpiTbLoadNamespace ( if (!TablesFailed) { - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "%u ACPI AML tables successfully acquired and loaded\n", TablesLoaded)); } @@ -340,7 +363,7 @@ AcpiLoadTable ( /* Install the table and load it into the namespace */ - ACPI_INFO ((AE_INFO, "Host-directed Dynamic ACPI Table Load:")); + ACPI_INFO (("Host-directed Dynamic ACPI Table Load:")); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), diff --git a/source/components/utilities/utcache.c b/source/components/utilities/utcache.c index 66fa8680619ad..049dae8e98a01 100644 --- a/source/components/utilities/utcache.c +++ b/source/components/utilities/utcache.c @@ -279,7 +279,7 @@ AcpiOsAcquireObject ( void *Object; - ACPI_FUNCTION_NAME (OsAcquireObject); + ACPI_FUNCTION_TRACE (OsAcquireObject); if (!Cache) diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index 06817ab3b0d17..648cc5c5c973d 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -506,7 +506,7 @@ AcpiUtGetMutexName ( /* Names for Notify() values, used for debug output */ -static const char *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] = +static const char *AcpiGbl_GenericNotify[ACPI_GENERIC_NOTIFY_MAX + 1] = { /* 00 */ "Bus Check", /* 01 */ "Device Check", @@ -520,32 +520,35 @@ static const char *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] = /* 09 */ "Device PLD Check", /* 0A */ "Reserved", /* 0B */ "System Locality Update", - /* 0C */ "Shutdown Request", + /* 0C */ "Shutdown Request", /* Reserved in ACPI 6.0 */ /* 0D */ "System Resource Affinity Update" }; -static const char *AcpiGbl_DeviceNotify[4] = +static const char *AcpiGbl_DeviceNotify[5] = { /* 80 */ "Status Change", /* 81 */ "Information Change", /* 82 */ "Device-Specific Change", - /* 83 */ "Device-Specific Change" + /* 83 */ "Device-Specific Change", + /* 84 */ "Reserved" }; -static const char *AcpiGbl_ProcessorNotify[4] = +static const char *AcpiGbl_ProcessorNotify[5] = { /* 80 */ "Performance Capability Change", /* 81 */ "C-State Change", /* 82 */ "Throttling Capability Change", - /* 83 */ "Device-Specific Change" + /* 83 */ "Guaranteed Change", + /* 84 */ "Minimum Excursion" }; -static const char *AcpiGbl_ThermalNotify[4] = +static const char *AcpiGbl_ThermalNotify[5] = { /* 80 */ "Thermal Status Change", /* 81 */ "Thermal Trip Point Change", /* 82 */ "Thermal Device List Change", - /* 83 */ "Thermal Relationship Change" + /* 83 */ "Thermal Relationship Change", + /* 84 */ "Reserved" }; @@ -555,23 +558,23 @@ AcpiUtGetNotifyName ( ACPI_OBJECT_TYPE Type) { - /* 00 - 0D are common to all object types */ + /* 00 - 0D are "common to all object types" (from ACPI Spec) */ - if (NotifyValue <= ACPI_NOTIFY_MAX) + if (NotifyValue <= ACPI_GENERIC_NOTIFY_MAX) { return (AcpiGbl_GenericNotify[NotifyValue]); } - /* 0D - 7F are reserved */ + /* 0E - 7F are reserved */ if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) { return ("Reserved"); } - /* 80 - 83 are per-object-type */ + /* 80 - 84 are per-object-type */ - if (NotifyValue <= 0x83) + if (NotifyValue <= ACPI_SPECIFIC_NOTIFY_MAX) { switch (Type) { diff --git a/source/components/utilities/utnonansi.c b/source/components/utilities/utnonansi.c index 5f45aaa1ff73d..572d24a6b6c3c 100644 --- a/source/components/utilities/utnonansi.c +++ b/source/components/utilities/utnonansi.c @@ -164,6 +164,82 @@ AcpiUtStricmp ( } +#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 + + /******************************************************************************* * * FUNCTION: AcpiUtStrtoul64 @@ -179,7 +255,15 @@ AcpiUtStricmp ( * 32-bit or 64-bit conversion, depending on the current mode * of the interpreter. * - * NOTE: Does not support Octal strings, not needed. + * NOTES: AcpiGbl_IntegerByteWidth should be set to the proper width. + * For the core ACPICA code, this width depends on the DSDT + * version. For iASL, the default byte width is always 8. + * + * Does not support Octal strings, not needed at this time. + * + * There is an earlier version of the function after this one, + * below. It is slightly different than this one, and the two + * may eventually may need to be merged. (01/2016). * ******************************************************************************/ @@ -200,7 +284,7 @@ AcpiUtStrtoul64 ( UINT8 Term = 0; - ACPI_FUNCTION_TRACE_STR (UtStroul64, String); + ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String); switch (Base) @@ -376,78 +460,201 @@ ErrorExit: } } +#ifdef _OBSOLETE_FUNCTIONS +/* TBD: use version in ACPICA main code base? */ +/* DONE: 01/2016 */ -#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) /******************************************************************************* * - * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat + * FUNCTION: strtoul64 * - * PARAMETERS: Adds a "DestSize" parameter to each of the standard string - * functions. This is the size of the Destination buffer. + * PARAMETERS: String - Null terminated string + * Terminater - Where a pointer to the terminating byte + * is returned + * Base - Radix of the string * - * 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. + * RETURN: Converted value * - * 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. + * DESCRIPTION: Convert a string into an unsigned value. * ******************************************************************************/ -BOOLEAN -AcpiUtSafeStrcpy ( - char *Dest, - ACPI_SIZE DestSize, - char *Source) +ACPI_STATUS +strtoul64 ( + char *String, + UINT32 Base, + UINT64 *RetInteger) { + UINT32 Index; + UINT32 Sign; + UINT64 ReturnValue = 0; + ACPI_STATUS Status = AE_OK; - if (strlen (Source) >= DestSize) + + *RetInteger = 0; + + switch (Base) { - return (TRUE); + case 0: + case 8: + case 10: + case 16: + + break; + + default: + /* + * The specified Base parameter is not in the domain of + * this function: + */ + return (AE_BAD_PARAMETER); } - strcpy (Dest, Source); - return (FALSE); -} + /* Skip over any white space in the buffer: */ -BOOLEAN -AcpiUtSafeStrcat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source) -{ + while (isspace ((int) *String) || *String == '\t') + { + ++String; + } - if ((strlen (Dest) + strlen (Source)) >= DestSize) + /* + * The buffer may contain an optional plus or minus sign. + * If it does, then skip over it but remember what is was: + */ + if (*String == '-') { - return (TRUE); + Sign = ACPI_SIGN_NEGATIVE; + ++String; + } + else if (*String == '+') + { + ++String; + Sign = ACPI_SIGN_POSITIVE; + } + else + { + Sign = ACPI_SIGN_POSITIVE; } - strcat (Dest, Source); - return (FALSE); -} + /* + * If the input parameter Base is zero, then we need to + * determine if it is octal, decimal, or hexadecimal: + */ + if (Base == 0) + { + if (*String == '0') + { + if (tolower ((int) *(++String)) == 'x') + { + Base = 16; + ++String; + } + else + { + Base = 8; + } + } + else + { + Base = 10; + } + } -BOOLEAN -AcpiUtSafeStrncat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source, - ACPI_SIZE MaxTransferLength) -{ - ACPI_SIZE ActualTransferLength; + /* + * For octal and hexadecimal bases, skip over the leading + * 0 or 0x, if they are present. + */ + if (Base == 8 && *String == '0') + { + String++; + } + if (Base == 16 && + *String == '0' && + tolower ((int) *(++String)) == 'x') + { + String++; + } - ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); + /* Main loop: convert the string to an unsigned long */ - if ((strlen (Dest) + ActualTransferLength) >= DestSize) + while (*String) { - return (TRUE); + if (isdigit ((int) *String)) + { + Index = ((UINT8) *String) - '0'; + } + else + { + Index = (UINT8) toupper ((int) *String); + if (isupper ((int) Index)) + { + Index = Index - 'A' + 10; + } + else + { + goto ErrorExit; + } + } + + if (Index >= Base) + { + goto ErrorExit; + } + + /* Check to see if value is out of range: */ + + if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) / + (UINT64) Base)) + { + goto ErrorExit; + } + else + { + ReturnValue *= Base; + ReturnValue += Index; + } + + ++String; } - strncat (Dest, Source, MaxTransferLength); - return (FALSE); + + /* If a minus sign was present, then "the conversion is negated": */ + + if (Sign == ACPI_SIGN_NEGATIVE) + { + ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; + } + + *RetInteger = ReturnValue; + return (Status); + + +ErrorExit: + switch (Base) + { + case 8: + + Status = AE_BAD_OCTAL_CONSTANT; + break; + + case 10: + + Status = AE_BAD_DECIMAL_CONSTANT; + break; + + case 16: + + Status = AE_BAD_HEX_CONSTANT; + break; + + default: + + /* Base validated above */ + + break; + } + + return (Status); } #endif diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index b5383c8c383f2..b6d6a33639bc6 100644 --- a/source/components/utilities/uttrack.c +++ b/source/components/utilities/uttrack.c @@ -775,7 +775,7 @@ AcpiUtDumpAllocations ( if (!NumOutstanding) { - ACPI_INFO ((AE_INFO, "No outstanding allocations")); + ACPI_INFO (("No outstanding allocations")); } else { diff --git a/source/components/utilities/utxferror.c b/source/components/utilities/utxferror.c index 35efd522b023d..e79ffc94f3017 100644 --- a/source/components/utilities/utxferror.c +++ b/source/components/utilities/utxferror.c @@ -205,8 +205,6 @@ ACPI_EXPORT_SYMBOL (AcpiWarning) void ACPI_INTERNAL_VAR_XFACE AcpiInfo ( - const char *ModuleName, - UINT32 LineNumber, const char *Format, ...) { diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c index 898a75cf314e8..a8ea3fdf49f45 100644 --- a/source/components/utilities/utxfinit.c +++ b/source/components/utilities/utxfinit.c @@ -132,25 +132,6 @@ AcpiInitializeSubsystem ( return_ACPI_STATUS (Status); } - if (!AcpiGbl_OverrideDefaultRegionHandlers) - { - /* - * Install the default operation region handlers. These are the - * handlers that are defined by the ACPI specification to be - * "always accessible" -- namely, SystemMemory, SystemIO, and - * PCI_Config. This also means that no _REG methods need to be - * run for these address spaces. We need to have these handlers - * installed before any AML code can be executed, especially any - * module-level code (11/2015). - */ - Status = AcpiEvInstallRegionHandlers (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization")); - return_ACPI_STATUS (Status); - } - } - return_ACPI_STATUS (AE_OK); } @@ -187,17 +168,17 @@ AcpiEnableSubsystem ( */ AcpiGbl_EarlyInitialization = FALSE; - if (AcpiGbl_OverrideDefaultRegionHandlers) + /* + * Install the default operation region handlers. These are the + * handlers that are defined by the ACPI specification to be + * "always accessible" -- namely, SystemMemory, SystemIO, and + * PCI_Config. This also means that no _REG methods need to be + * run for these address spaces. We need to have these handlers + * installed before any AML code can be executed, especially any + * module-level code (11/2015). + */ + if (!AcpiGbl_GroupModuleLevelCode) { - /* - * Install the default operation region handlers. These are the - * handlers that are defined by the ACPI specification to be - * "always accessible" -- namely, SystemMemory, SystemIO, and - * PCI_Config. This also means that no _REG methods need to be - * run for these address spaces. We need to have these handlers - * installed before any AML code can be executed, especially any - * module-level code (11/2015). - */ Status = AcpiEvInstallRegionHandlers (); if (ACPI_FAILURE (Status)) { @@ -206,7 +187,6 @@ AcpiEnableSubsystem ( } } - #if (!ACPI_REDUCED_HARDWARE) /* Enable ACPI mode */ @@ -312,25 +292,6 @@ AcpiInitializeObjects ( ACPI_FUNCTION_TRACE (AcpiInitializeObjects); - /* - * Run all _REG methods - * - * Note: Any objects accessed by the _REG methods will be automatically - * initialized, even if they contain executable AML (see the call to - * AcpiNsInitializeObjects below). - */ - if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Executing _REG OpRegion methods\n")); - - Status = AcpiEvInitializeOpRegions (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - #ifdef ACPI_EXEC_APP /* * This call implements the "initialization file" option for AcpiExec. @@ -373,16 +334,15 @@ AcpiInitializeObjects ( } } + AcpiGbl_NamespaceInitialized = TRUE; + /* - * Initialize all device objects in the namespace. This runs the device - * _STA and _INI methods. + * Initialize all device/region objects in the namespace. This runs + * the device _STA and _INI methods and region _REG methods. */ - if (!(Flags & ACPI_NO_DEVICE_INIT)) + if (!(Flags & (ACPI_NO_DEVICE_INIT | ACPI_NO_ADDRESS_SPACE_INIT))) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Initializing ACPI Devices\n")); - - Status = AcpiNsInitializeDevices (); + Status = AcpiNsInitializeDevices (Flags); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); |