diff options
Diffstat (limited to 'source/components')
76 files changed, 576 insertions, 181 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index d9aa2e7aa1c3..44aafbf0caa0 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acevents.h" diff --git a/source/components/debugger/dbconvert.c b/source/components/debugger/dbconvert.c index ab809f8112f1..ad8b13967cce 100644 --- a/source/components/debugger/dbconvert.c +++ b/source/components/debugger/dbconvert.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdebug.h" diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c index fb47c7ba6376..9d0a216af4e8 100644 --- a/source/components/debugger/dbdisply.c +++ b/source/components/debugger/dbdisply.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index 806b80fb3e1f..71db787c4d30 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdebug.h" diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c index ee4ba15f0f13..abdc454b398a 100644 --- a/source/components/debugger/dbfileio.c +++ b/source/components/debugger/dbfileio.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdebug.h" diff --git a/source/components/debugger/dbhistry.c b/source/components/debugger/dbhistry.c index b56d4ef82d5d..6680306ae9ae 100644 --- a/source/components/debugger/dbhistry.c +++ b/source/components/debugger/dbhistry.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdebug.h" diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 88fbb9475246..abf9688c2932 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdebug.h" diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c index 90d131408c36..05fd2affb0d8 100644 --- a/source/components/debugger/dbmethod.c +++ b/source/components/debugger/dbmethod.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdispat.h" diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c index de02fb635ed7..29fe1ec1d477 100644 --- a/source/components/debugger/dbnames.c +++ b/source/components/debugger/dbnames.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" diff --git a/source/components/debugger/dbstats.c b/source/components/debugger/dbstats.c index 450afcb73b15..db29db5584e7 100644 --- a/source/components/debugger/dbstats.c +++ b/source/components/debugger/dbstats.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdebug.h" diff --git a/source/components/debugger/dbutils.c b/source/components/debugger/dbutils.c index fcc33ed6848c..1d4963d4d46e 100644 --- a/source/components/debugger/dbutils.c +++ b/source/components/debugger/dbutils.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c index 671a8f31e465..9a304ad4c0b8 100644 --- a/source/components/debugger/dbxface.c +++ b/source/components/debugger/dbxface.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 739fb44a1890..2231ce1efdd1 100644 --- a/source/components/disassembler/dmbuffer.c +++ b/source/components/disassembler/dmbuffer.c @@ -41,9 +41,9 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" +#include "acutils.h" #include "acdisasm.h" #include "acparser.h" #include "amlcode.h" @@ -58,6 +58,10 @@ /* Local prototypes */ static void +AcpiDmUuid ( + ACPI_PARSE_OBJECT *Op); + +static void AcpiDmUnicode ( ACPI_PARSE_OBJECT *Op); @@ -71,6 +75,7 @@ AcpiDmPldBuffer ( UINT8 *ByteData, UINT32 ByteCount); + #define ACPI_BUFFER_BYTES_PER_LINE 8 @@ -216,6 +221,11 @@ AcpiDmByteList ( AcpiOsPrintf ("\n"); break; + case ACPI_DASM_UUID: + + AcpiDmUuid (Op); + break; + case ACPI_DASM_UNICODE: AcpiDmUnicode (Op); @@ -241,6 +251,137 @@ AcpiDmByteList ( /******************************************************************************* * + * FUNCTION: AcpiDmIsUuidBuffer + * + * PARAMETERS: Op - Buffer Object to be examined + * + * RETURN: TRUE if buffer contains a UUID + * + * DESCRIPTION: Determine if a buffer Op contains a UUID + * + * To help determine whether the buffer is a UUID versus a raw data buffer, + * there a are a couple bytes we can look at: + * + * xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx + * + * The variant covered by the UUID specification is indicated by the two most + * significant bits of N being 1 0 (i.e., the hexadecimal N will always be + * 8, 9, A, or B). + * + * The variant covered by the UUID specification has five versions. For this + * variant, the four bits of M indicates the UUID version (i.e., the + * hexadecimal M will be either 1, 2, 3, 4, or 5). + * + ******************************************************************************/ + +BOOLEAN +AcpiDmIsUuidBuffer ( + ACPI_PARSE_OBJECT *Op) +{ + UINT8 *ByteData; + UINT32 ByteCount; + ACPI_PARSE_OBJECT *SizeOp; + ACPI_PARSE_OBJECT *NextOp; + + + /* Buffer size is the buffer argument */ + + SizeOp = Op->Common.Value.Arg; + + /* Next, the initializer byte list to examine */ + + NextOp = SizeOp->Common.Next; + if (!NextOp) + { + return (FALSE); + } + + /* Extract the byte list info */ + + ByteData = NextOp->Named.Data; + ByteCount = (UINT32) NextOp->Common.Value.Integer; + + /* Byte count must be exactly 16 */ + + if (ByteCount != UUID_BUFFER_LENGTH) + { + return (FALSE); + } + + /* Check for valid "M" and "N" values (see function header above) */ + + if (((ByteData[7] & 0xF0) == 0x00) || /* M={1,2,3,4,5} */ + ((ByteData[7] & 0xF0) > 0x50) || + ((ByteData[8] & 0xF0) < 0x80) || /* N={8,9,A,B} */ + ((ByteData[8] & 0xF0) > 0xB0)) + { + return (FALSE); + } + + /* Ignore the Size argument in the disassembly of this buffer op */ + + SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmUuid + * + * PARAMETERS: Op - Byte List op containing a UUID + * + * RETURN: None + * + * DESCRIPTION: Dump a buffer containing a UUID as a standard ASCII string. + * + * Output Format: + * In its canonical form, the UUID is represented by a string containing 32 + * lowercase hexadecimal digits, displayed in 5 groups separated by hyphens. + * The complete form is 8-4-4-4-12 for a total of 36 characters (32 + * alphanumeric characters representing hex digits and 4 hyphens). In bytes, + * 4-2-2-2-6. Example: + * + * ToUUID ("107ededd-d381-4fd7-8da9-08e9a6c79644") + * + ******************************************************************************/ + +static void +AcpiDmUuid ( + ACPI_PARSE_OBJECT *Op) +{ + UINT8 *Data; + const char *Description; + + + Data = ACPI_CAST_PTR (UINT8, Op->Named.Data); + + /* Emit the 36-byte UUID string in the proper format/order */ + + AcpiOsPrintf ( + "\"%2.2x%2.2x%2.2x%2.2x-" + "%2.2x%2.2x-" + "%2.2x%2.2x-" + "%2.2x%2.2x-" + "%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\")", + Data[3], Data[2], Data[1], Data[0], + Data[5], Data[4], + Data[7], Data[6], + Data[8], Data[9], + Data[10], Data[11], Data[12], Data[13], Data[14], Data[15]); + + /* Dump the UUID description string if available */ + + Description = AcpiAhMatchUuid (Data); + if (Description) + { + AcpiOsPrintf (" /* %s */", Description); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmIsUnicodeBuffer * * PARAMETERS: Op - Buffer Object to be examined diff --git a/source/components/disassembler/dmdeferred.c b/source/components/disassembler/dmdeferred.c index dd0be81a4e86..56c6b3899ebb 100644 --- a/source/components/disassembler/dmdeferred.c +++ b/source/components/disassembler/dmdeferred.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdispat.h" diff --git a/source/components/disassembler/dmnames.c b/source/components/disassembler/dmnames.c index 66d50a44335b..4b48a348fe7e 100644 --- a/source/components/disassembler/dmnames.c +++ b/source/components/disassembler/dmnames.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" diff --git a/source/components/disassembler/dmobject.c b/source/components/disassembler/dmobject.c index c938bdefd067..00fc680d7b98 100644 --- a/source/components/disassembler/dmobject.c +++ b/source/components/disassembler/dmobject.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index 30f985c524c1..52e01a9cb074 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -827,7 +827,12 @@ AcpiDmDisassembleOneOp ( } } - if (AcpiDmIsUnicodeBuffer (Op)) + if (AcpiDmIsUuidBuffer (Op)) + { + Op->Common.DisasmOpcode = ACPI_DASM_UUID; + AcpiOsPrintf ("ToUUID ("); + } + else if (AcpiDmIsUnicodeBuffer (Op)) { Op->Common.DisasmOpcode = ACPI_DASM_UNICODE; AcpiOsPrintf ("Unicode ("); diff --git a/source/components/disassembler/dmresrc.c b/source/components/disassembler/dmresrc.c index 9bd47db6ffd2..ff6278b2e77e 100644 --- a/source/components/disassembler/dmresrc.c +++ b/source/components/disassembler/dmresrc.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" diff --git a/source/components/disassembler/dmresrcl.c b/source/components/disassembler/dmresrcl.c index 41cbc01817fc..d6707d39b813 100644 --- a/source/components/disassembler/dmresrcl.c +++ b/source/components/disassembler/dmresrcl.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdisasm.h" diff --git a/source/components/disassembler/dmresrcl2.c b/source/components/disassembler/dmresrcl2.c index 3e48afca745a..dd9039ea095f 100644 --- a/source/components/disassembler/dmresrcl2.c +++ b/source/components/disassembler/dmresrcl2.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdisasm.h" @@ -274,7 +273,7 @@ AcpiDmGpioIntDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("GpioInt (%s, %s, %s, ", AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)], - AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Gpio.IntFlags, 1)], + AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)], AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]); /* PinConfig, DebounceTimeout */ diff --git a/source/components/disassembler/dmresrcs.c b/source/components/disassembler/dmresrcs.c index 104189098258..cbbdc7114d72 100644 --- a/source/components/disassembler/dmresrcs.c +++ b/source/components/disassembler/dmresrcs.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acdisasm.h" diff --git a/source/components/disassembler/dmutils.c b/source/components/disassembler/dmutils.c index 2771d44abdd3..700cfecc3092 100644 --- a/source/components/disassembler/dmutils.c +++ b/source/components/disassembler/dmutils.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index 0aa305282a04..92f27e506224 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acparser.h" @@ -285,7 +284,8 @@ AcpiDmBlockType ( case AML_BUFFER_OP: - if (Op->Common.DisasmOpcode == ACPI_DASM_UNICODE) + if ((Op->Common.DisasmOpcode == ACPI_DASM_UNICODE) || + (Op->Common.DisasmOpcode == ACPI_DASM_UUID)) { return (BLOCK_NONE); } diff --git a/source/components/dispatcher/dswstate.c b/source/components/dispatcher/dswstate.c index 18208f393049..389a7d068996 100644 --- a/source/components/dispatcher/dswstate.c +++ b/source/components/dispatcher/dswstate.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __DSWSTATE_C__ #include "acpi.h" diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c index c31f0b385197..939402559e0b 100644 --- a/source/components/events/evgpe.c +++ b/source/components/events/evgpe.c @@ -761,22 +761,6 @@ AcpiEvGpeDispatch ( } /* - * If edge-triggered, clear the GPE status bit now. Note that - * level-triggered events are cleared after the GPE is serviced. - */ - if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_EDGE_TRIGGERED) - { - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to clear GPE %02X", GpeNumber)); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } - } - - /* * Always disable the GPE so that it does not keep firing before * any asynchronous activity completes (either from the execution * of a GPE method or an asynchronous GPE handler.) @@ -794,6 +778,24 @@ AcpiEvGpeDispatch ( } /* + * If edge-triggered, clear the GPE status bit now. Note that + * level-triggered events are cleared after the GPE is serviced. + */ + if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == + ACPI_GPE_EDGE_TRIGGERED) + { + Status = AcpiHwClearGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Unable to clear GPE %02X", GpeNumber)); + (void) AcpiHwLowSetGpe (GpeEventInfo, + ACPI_GPE_CONDITIONAL_ENABLE); + return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); + } + } + + /* * Dispatch the GPE to either an installed handler or the control * method associated with this GPE (_Lxx or _Exx). If a handler * exists, we invoke it and do not attempt to run the method. diff --git a/source/components/events/evgpeinit.c b/source/components/events/evgpeinit.c index 6251b36f4d7a..a8aea022f858 100644 --- a/source/components/events/evgpeinit.c +++ b/source/components/events/evgpeinit.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acevents.h" diff --git a/source/components/events/evhandler.c b/source/components/events/evhandler.c index 150f73f77169..0fd1cba30de3 100644 --- a/source/components/events/evhandler.c +++ b/source/components/events/evhandler.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EVHANDLER_C__ #include "acpi.h" diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c index 4b5cb9b1ddb0..8531b5ae2a6e 100644 --- a/source/components/events/evregion.c +++ b/source/components/events/evregion.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EVREGION_C__ #include "acpi.h" diff --git a/source/components/events/evrgnini.c b/source/components/events/evrgnini.c index 1c3dbbc49df4..cd0ca2eea5f0 100644 --- a/source/components/events/evrgnini.c +++ b/source/components/events/evrgnini.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EVRGNINI_C__ #include "acpi.h" diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c index 51437a915b39..bbd88dc370ff 100644 --- a/source/components/events/evxface.c +++ b/source/components/events/evxface.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EVXFACE_C__ #define EXPORT_ACPI_INTERFACES diff --git a/source/components/events/evxfevnt.c b/source/components/events/evxfevnt.c index f854145a4915..683c73b56876 100644 --- a/source/components/events/evxfevnt.c +++ b/source/components/events/evxfevnt.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EVXFEVNT_C__ #define EXPORT_ACPI_INTERFACES diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c index 73164e1d04b1..79e888ff8053 100644 --- a/source/components/events/evxfgpe.c +++ b/source/components/events/evxfgpe.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EVXFGPE_C__ #define EXPORT_ACPI_INTERFACES @@ -141,12 +140,23 @@ AcpiEnableGpe ( Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - /* Ensure that we have a valid GPE number */ - + /* + * Ensure that we have a valid GPE number and that there is some way + * of handling the GPE (handler or a GPE method). In other words, we + * won't allow a valid GPE to be enabled if there is no way to handle it. + */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); if (GpeEventInfo) { - Status = AcpiEvAddGpeReference (GpeEventInfo); + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != + ACPI_GPE_DISPATCH_NONE) + { + Status = AcpiEvAddGpeReference (GpeEventInfo); + } + else + { + Status = AE_NO_HANDLER; + } } AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); @@ -276,6 +286,60 @@ ACPI_EXPORT_SYMBOL (AcpiSetGpe) /******************************************************************************* * + * FUNCTION: AcpiMarkGpeForWake + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Mark a GPE as having the ability to wake the system. Simply + * sets the ACPI_GPE_CAN_WAKE flag. + * + * Some potential callers of AcpiSetupGpeForWake may know in advance that + * there won't be any notify handlers installed for device wake notifications + * from the given GPE (one example is a button GPE in Linux). For these cases, + * AcpiMarkGpeForWake should be used instead of AcpiSetupGpeForWake. + * This will set the ACPI_GPE_CAN_WAKE flag for the GPE without trying to + * setup implicit wake notification for it (since there's no handler method). + * + ******************************************************************************/ + +ACPI_STATUS +AcpiMarkGpeForWake ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_STATUS Status = AE_BAD_PARAMETER; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiMarkGpeForWake); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (GpeEventInfo) + { + /* Mark the GPE as a possible wake event */ + + GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; + Status = AE_OK; + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiMarkGpeForWake) + + +/******************************************************************************* + * * FUNCTION: AcpiSetupGpeForWake * * PARAMETERS: WakeDevice - Device associated with the GPE (via _PRW) diff --git a/source/components/executer/exconvrt.c b/source/components/executer/exconvrt.c index fbfd137deb9f..9803cb6a0528 100644 --- a/source/components/executer/exconvrt.c +++ b/source/components/executer/exconvrt.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EXCONVRT_C__ #include "acpi.h" diff --git a/source/components/executer/exdebug.c b/source/components/executer/exdebug.c index df61b7988da1..5b13d19dca4f 100644 --- a/source/components/executer/exdebug.c +++ b/source/components/executer/exdebug.c @@ -82,6 +82,7 @@ AcpiExDoDebugObject ( UINT32 Index) { UINT32 i; + UINT32 Timer; ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); @@ -96,12 +97,20 @@ AcpiExDoDebugObject ( } /* + * We will emit the current timer value (in microseconds) with each + * debug output. Only need the lower 26 bits. This allows for 67 + * million microseconds or 67 seconds before rollover. + */ + Timer = ((UINT32) AcpiOsGetTimer () / 10); /* (100 nanoseconds to microseconds) */ + Timer &= 0x03FFFFFF; + + /* * Print line header as long as we are not in the middle of an * object display */ if (!((Level > 0) && Index == 0)) { - AcpiOsPrintf ("[ACPI Debug] %*s", Level, " "); + AcpiOsPrintf ("[ACPI Debug %.8u] %*s", Timer, Level, " "); } /* Display the index for package output only */ diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c index 815e337be5b2..6e7de67bf880 100644 --- a/source/components/executer/exdump.c +++ b/source/components/executer/exdump.c @@ -508,7 +508,7 @@ AcpiExDumpObject ( } } - AcpiOsPrintf ("\n", Next); + AcpiOsPrintf ("\n"); break; case ACPI_EXD_HDLR_LIST: @@ -542,7 +542,7 @@ AcpiExDumpObject ( } } - AcpiOsPrintf ("\n", Next); + AcpiOsPrintf ("\n"); break; case ACPI_EXD_RGN_LIST: @@ -576,7 +576,7 @@ AcpiExDumpObject ( } } - AcpiOsPrintf ("\n", Next); + AcpiOsPrintf ("\n"); break; case ACPI_EXD_NODE: diff --git a/source/components/executer/exfield.c b/source/components/executer/exfield.c index a1de0ca237c7..49d3b667b78e 100644 --- a/source/components/executer/exfield.c +++ b/source/components/executer/exfield.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EXFIELD_C__ #include "acpi.h" @@ -203,14 +202,13 @@ AcpiExReadDataFromField ( Length = AcpiExGetSerialAccessLength (AccessorType, ObjDesc->Field.AccessLength); - /* - * Add additional 2 bytes for modeled GenericSerialBus data buffer: - * typedef struct { - * BYTEStatus; // Byte 0 of the data buffer - * BYTELength; // Byte 1 of the data buffer - * BYTE[x-1]Data; // Bytes 2-x of the arbitrary length data buffer, - * } - */ + /* + * Add additional 2 bytes for the GenericSerialBus data buffer: + * + * Status; (Byte 0 of the data buffer) + * Length; (Byte 1 of the data buffer) + * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer) + */ Length += 2; Function = ACPI_READ | (AccessorType << 16); } @@ -397,14 +395,13 @@ AcpiExWriteDataToField ( Length = AcpiExGetSerialAccessLength (AccessorType, ObjDesc->Field.AccessLength); - /* - * Add additional 2 bytes for modeled GenericSerialBus data buffer: - * typedef struct { - * BYTEStatus; // Byte 0 of the data buffer - * BYTELength; // Byte 1 of the data buffer - * BYTE[x-1]Data; // Bytes 2-x of the arbitrary length data buffer, - * } - */ + /* + * Add additional 2 bytes for the GenericSerialBus data buffer: + * + * Status; (Byte 0 of the data buffer) + * Length; (Byte 1 of the data buffer) + * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer) + */ Length += 2; Function = ACPI_WRITE | (AccessorType << 16); } diff --git a/source/components/executer/exfldio.c b/source/components/executer/exfldio.c index 448d455d55bd..e35559fffa5e 100644 --- a/source/components/executer/exfldio.c +++ b/source/components/executer/exfldio.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EXFLDIO_C__ #include "acpi.h" diff --git a/source/components/executer/exoparg2.c b/source/components/executer/exoparg2.c index 8f25f7b16d59..f3e976ce536f 100644 --- a/source/components/executer/exoparg2.c +++ b/source/components/executer/exoparg2.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EXOPARG2_C__ #include "acpi.h" diff --git a/source/components/executer/exregion.c b/source/components/executer/exregion.c index 1fa07e3490bc..7532630a232a 100644 --- a/source/components/executer/exregion.c +++ b/source/components/executer/exregion.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __EXREGION_C__ #include "acpi.h" diff --git a/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c index 0f29a8491622..d465a37e5b8b 100644 --- a/source/components/namespace/nsalloc.c +++ b/source/components/namespace/nsalloc.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __NSALLOC_C__ #include "acpi.h" diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index 27ff7a13244c..53155977f39f 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __NSXFINIT_C__ #include "acpi.h" diff --git a/source/components/namespace/nsobject.c b/source/components/namespace/nsobject.c index 9221ac00aa2e..5247ca61b41b 100644 --- a/source/components/namespace/nsobject.c +++ b/source/components/namespace/nsobject.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __NSOBJECT_C__ #include "acpi.h" @@ -263,17 +262,16 @@ AcpiNsDetachObject ( { Node->Object = Node->Object->Common.NextObject; } - } - - /* - * Detach the object from any data objects (which are still held by - * the namespace node) - */ - if (ObjDesc->Common.NextObject && - ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA)) - { - ObjDesc->Common.NextObject = NULL; + /* + * Detach the object from any data objects (which are still held by + * the namespace node) + */ + if (ObjDesc->Common.NextObject && + ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA)) + { + ObjDesc->Common.NextObject = NULL; + } } /* Reset the node type to untyped */ diff --git a/source/components/namespace/nsprepkg.c b/source/components/namespace/nsprepkg.c index 1e66b5aee2da..6cc3c700f29b 100644 --- a/source/components/namespace/nsprepkg.c +++ b/source/components/namespace/nsprepkg.c @@ -321,6 +321,46 @@ AcpiNsCheckPackage ( Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; + case ACPI_PTYPE2_UUID_PAIR: + + /* The package must contain pairs of (UUID + type) */ + + if (Count & 1) + { + ExpectedCount = Count + 1; + goto PackageTooSmall; + } + + while (Count > 0) + { + Status = AcpiNsCheckObjectType(Info, Elements, + Package->RetInfo.ObjectType1, 0); + if (ACPI_FAILURE(Status)) + { + return (Status); + } + + /* Validate length of the UUID buffer */ + + if ((*Elements)->Buffer.Length != 16) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, + Info->NodeFlags, "Invalid length for UUID Buffer")); + return (AE_AML_OPERAND_VALUE); + } + + Status = AcpiNsCheckObjectType(Info, Elements + 1, + Package->RetInfo.ObjectType2, 0); + if (ACPI_FAILURE(Status)) + { + return (Status); + } + + Elements += 2; + Count -= 2; + } + break; + default: /* Should not get here if predefined info table is correct */ diff --git a/source/components/namespace/nswalk.c b/source/components/namespace/nswalk.c index 48b5a27f0f53..147e4ce816c7 100644 --- a/source/components/namespace/nswalk.c +++ b/source/components/namespace/nswalk.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __NSWALK_C__ #include "acpi.h" diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 1423da30349a..2b2663cabb56 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __NSXFEVAL_C__ #define EXPORT_ACPI_INTERFACES diff --git a/source/components/namespace/nsxfobj.c b/source/components/namespace/nsxfobj.c index 86e109778524..69b656e12620 100644 --- a/source/components/namespace/nsxfobj.c +++ b/source/components/namespace/nsxfobj.c @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __NSXFOBJ_C__ #define EXPORT_ACPI_INTERFACES diff --git a/source/components/parser/psloop.c b/source/components/parser/psloop.c index ace1d6b2bbbf..5d5dab496759 100644 --- a/source/components/parser/psloop.c +++ b/source/components/parser/psloop.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - /* * Parse the AML and build an operation tree as most interpreters, (such as * Perl) do. Parsing is done by hand rather than with a YACC generated parser diff --git a/source/components/parser/psobject.c b/source/components/parser/psobject.c index 661817178d8e..2f69a1489728 100644 --- a/source/components/parser/psobject.c +++ b/source/components/parser/psobject.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acparser.h" diff --git a/source/components/parser/psopcode.c b/source/components/parser/psopcode.c index bcfb57dd4a4b..60758e4eb043 100644 --- a/source/components/parser/psopcode.c +++ b/source/components/parser/psopcode.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acopcode.h" diff --git a/source/components/parser/psopinfo.c b/source/components/parser/psopinfo.c index af15d303bad1..d419aa0fa1fb 100644 --- a/source/components/parser/psopinfo.c +++ b/source/components/parser/psopinfo.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acparser.h" diff --git a/source/components/parser/psparse.c b/source/components/parser/psparse.c index 7b8e1b986361..31899bd55a9e 100644 --- a/source/components/parser/psparse.c +++ b/source/components/parser/psparse.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - /* * Parse the AML and build an operation tree as most interpreters, * like Perl, do. Parsing is done by hand rather than with a YACC diff --git a/source/components/parser/psscope.c b/source/components/parser/psscope.c index 1a512410d841..d0068b7913e0 100644 --- a/source/components/parser/psscope.c +++ b/source/components/parser/psscope.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acparser.h" diff --git a/source/components/parser/pstree.c b/source/components/parser/pstree.c index 1d57826e4c88..746d5759f53b 100644 --- a/source/components/parser/pstree.c +++ b/source/components/parser/pstree.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __PSTREE_C__ #include "acpi.h" diff --git a/source/components/parser/psutils.c b/source/components/parser/psutils.c index 6c37839c91f7..f6d8c5977ecc 100644 --- a/source/components/parser/psutils.c +++ b/source/components/parser/psutils.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acparser.h" diff --git a/source/components/parser/pswalk.c b/source/components/parser/pswalk.c index 4e41d4bc7174..026205d21e11 100644 --- a/source/components/parser/pswalk.c +++ b/source/components/parser/pswalk.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "acparser.h" diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index 91675ed08d90..b83d05849afc 100644 --- a/source/components/resources/rsdump.c +++ b/source/components/resources/rsdump.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __RSDUMP_C__ #include "acpi.h" diff --git a/source/components/resources/rsdumpinfo.c b/source/components/resources/rsdumpinfo.c index 665a76a1cf3c..906544ad86b8 100644 --- a/source/components/resources/rsdumpinfo.c +++ b/source/components/resources/rsdumpinfo.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __RSDUMPINFO_C__ #include "acpi.h" diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c index e1fb7777ec7a..b010ea031f0c 100644 --- a/source/components/resources/rsutils.c +++ b/source/components/resources/rsutils.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __RSUTILS_C__ #include "acpi.h" diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c index 49b087812e89..1e15f8dd848b 100644 --- a/source/components/resources/rsxface.c +++ b/source/components/resources/rsxface.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __RSXFACE_C__ #define EXPORT_ACPI_INTERFACES diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c index d7faee926529..7fbcaee9351f 100644 --- a/source/components/utilities/utclib.c +++ b/source/components/utilities/utclib.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __CMCLIB_C__ #include "acpi.h" diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index 28617dd8bf47..1666a36b254f 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -93,38 +93,6 @@ const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = /******************************************************************************* * - * FUNCTION: AcpiUtHexToAsciiChar - * - * PARAMETERS: Integer - Contains the hex digit - * Position - bit position of the digit within the - * integer (multiple of 4) - * - * RETURN: The converted Ascii character - * - * DESCRIPTION: Convert a hex digit to an Ascii character - * - ******************************************************************************/ - -/* Hex to ASCII conversion table */ - -static const char AcpiGbl_HexToAscii[] = -{ - '0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F' -}; - -char -AcpiUtHexToAsciiChar ( - UINT64 Integer, - UINT32 Position) -{ - - return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); -} - - -/******************************************************************************* - * * FUNCTION: AcpiUtGetRegionName * * PARAMETERS: Space ID - ID for the region @@ -541,7 +509,8 @@ 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", + /* 0D */ "System Resource Affinity Update" }; static const char *AcpiGbl_DeviceNotify[4] = @@ -575,7 +544,7 @@ AcpiUtGetNotifyName ( ACPI_OBJECT_TYPE Type) { - /* 00 - 0C are common to all object types */ + /* 00 - 0D are common to all object types */ if (NotifyValue <= ACPI_NOTIFY_MAX) { diff --git a/source/components/utilities/utexcep.c b/source/components/utilities/utexcep.c index c941c5615271..550719cfe145 100644 --- a/source/components/utilities/utexcep.c +++ b/source/components/utilities/utexcep.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTEXCEP_C__ #define EXPORT_ACPI_INTERFACES diff --git a/source/components/utilities/utfileio.c b/source/components/utilities/utfileio.c index 1d9adbbb5552..c6ee29cfabb4 100644 --- a/source/components/utilities/utfileio.c +++ b/source/components/utilities/utfileio.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "acpi.h" #include "accommon.h" #include "actables.h" @@ -232,8 +231,7 @@ AcpiUtReadTable ( Status = FlCheckForAscii (fp, NULL, FALSE); if (ACPI_SUCCESS (Status)) { - AcpiOsPrintf ("File appears to be ASCII only, must be binary\n", - TableHeader.Length, FileSize); + AcpiOsPrintf ("File appears to be ASCII only, must be binary\n"); } #endif return (AE_BAD_HEADER); diff --git a/source/components/utilities/uthex.c b/source/components/utilities/uthex.c new file mode 100644 index 000000000000..e71cacdbc96c --- /dev/null +++ b/source/components/utilities/uthex.c @@ -0,0 +1,113 @@ +/****************************************************************************** + * + * Module Name: uthex -- Hex/ASCII support functions + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#define __UTHEX_C__ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("uthex") + + +/* Hex to ASCII conversion table */ + +static char AcpiGbl_HexToAscii[] = +{ + '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtHexToAsciiChar + * + * PARAMETERS: Integer - Contains the hex digit + * Position - bit position of the digit within the + * integer (multiple of 4) + * + * RETURN: The converted Ascii character + * + * DESCRIPTION: Convert a hex digit to an Ascii character + * + ******************************************************************************/ + +char +AcpiUtHexToAsciiChar ( + UINT64 Integer, + UINT32 Position) +{ + + return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtHexCharToValue + * + * PARAMETERS: AsciiChar - Hex character in Ascii + * + * RETURN: The binary value of the ascii/hex character + * + * DESCRIPTION: Perform ascii-to-hex translation + * + ******************************************************************************/ + +UINT8 +AcpiUtAsciiCharToHex ( + int HexChar) +{ + + if (HexChar <= 0x39) + { + return ((UINT8) (HexChar - 0x30)); + } + + if (HexChar <= 0x46) + { + return ((UINT8) (HexChar - 0x37)); + } + + return ((UINT8) (HexChar - 0x57)); +} diff --git a/source/components/utilities/utinit.c b/source/components/utilities/utinit.c index 17030be64043..8e11c516751a 100644 --- a/source/components/utilities/utinit.c +++ b/source/components/utilities/utinit.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTINIT_C__ #include "acpi.h" diff --git a/source/components/utilities/utmath.c b/source/components/utilities/utmath.c index 871a3e6c93b2..51393353b173 100644 --- a/source/components/utilities/utmath.c +++ b/source/components/utilities/utmath.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTMATH_C__ #include "acpi.h" diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index 93cb288a5bfd..de2673c6c7d3 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTMISC_C__ #include "acpi.h" diff --git a/source/components/utilities/utmutex.c b/source/components/utilities/utmutex.c index e787cd0a7d24..8fc977a63f50 100644 --- a/source/components/utilities/utmutex.c +++ b/source/components/utilities/utmutex.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTMUTEX_C__ #include "acpi.h" diff --git a/source/components/utilities/utownerid.c b/source/components/utilities/utownerid.c index 55756e457301..91943501241d 100644 --- a/source/components/utilities/utownerid.c +++ b/source/components/utilities/utownerid.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTOWNERID_C__ #include "acpi.h" diff --git a/source/components/utilities/utprint.c b/source/components/utilities/utprint.c index 0194d561157c..21f70347bc5c 100644 --- a/source/components/utilities/utprint.c +++ b/source/components/utilities/utprint.c @@ -88,6 +88,12 @@ AcpiUtPutNumber ( BOOLEAN Upper); +/* Module globals */ + +static const char AcpiGbl_LowerHexDigits[] = "0123456789abcdef"; +static const char AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF"; + + /******************************************************************************* * * FUNCTION: AcpiUtBoundStringLength @@ -95,7 +101,7 @@ AcpiUtPutNumber ( * PARAMETERS: String - String with boundary * Count - Boundary of the string * - * RETURN: Length of the string. + * RETURN: Length of the string. Less than or equal to Count. * * DESCRIPTION: Calculate the length of a string with boundary. * @@ -145,8 +151,8 @@ AcpiUtBoundStringOutput ( { *String = c; } - ++String; + ++String; return (String); } @@ -174,15 +180,13 @@ AcpiUtPutNumber ( UINT8 Base, BOOLEAN Upper) { - const char LowerDigits[] = "0123456789abcdef"; - const char UpperDigits[] = "0123456789ABCDEF"; const char *Digits; UINT64 DigitIndex; char *Pos; Pos = String; - Digits = Upper ? UpperDigits : LowerDigits; + Digits = Upper ? AcpiGbl_UpperHexDigits : AcpiGbl_LowerHexDigits; if (Number == 0) { @@ -196,8 +200,8 @@ AcpiUtPutNumber ( *(Pos++) = Digits[DigitIndex]; } } - /* *(Pos++) = '0'; */ + /* *(Pos++) = '0'; */ return (Pos); } @@ -228,8 +232,8 @@ AcpiUtScanNumber ( Number *= 10; Number += *(String++) - '0'; } - *NumberPtr = Number; + *NumberPtr = Number; return (String); } @@ -264,8 +268,8 @@ AcpiUtPrintNumber ( { *(Pos2++) = *(--Pos1); } - *Pos2 = 0; + *Pos2 = 0; return (String); } @@ -298,6 +302,7 @@ AcpiUtFormatNumber ( INT32 Precision, UINT8 Type) { + char *Pos; char Sign; char Zero; BOOLEAN NeedPrefix; @@ -306,12 +311,13 @@ AcpiUtFormatNumber ( char ReversedString[66]; - /* Perform sanity checks */ + /* Parameter validation */ if (Base < 2 || Base > 16) { - return NULL; + return (NULL); } + if (Type & ACPI_FORMAT_LEFT) { Type &= ~ACPI_FORMAT_ZERO; @@ -354,9 +360,8 @@ AcpiUtFormatNumber ( /* Generate full string in reverse order */ - i = ACPI_PTR_DIFF ( - AcpiUtPutNumber (ReversedString, Number, Base, Upper), - ReversedString); + Pos = AcpiUtPutNumber (ReversedString, Number, Base, Upper); + i = ACPI_PTR_DIFF (Pos, ReversedString); /* Printing 100 using %2d gives "100", not "00" */ @@ -364,6 +369,7 @@ AcpiUtFormatNumber ( { Precision = i; } + Width -= Precision; /* Output the string */ @@ -386,7 +392,7 @@ AcpiUtFormatNumber ( { String = AcpiUtBoundStringOutput (String, End, Upper ? 'X' : 'x'); - } + } } if (!(Type & ACPI_FORMAT_LEFT)) { @@ -395,6 +401,7 @@ AcpiUtFormatNumber ( String = AcpiUtBoundStringOutput (String, End, Zero); } } + while (i <= --Precision) { String = AcpiUtBoundStringOutput (String, End, '0'); @@ -422,7 +429,7 @@ AcpiUtFormatNumber ( * Format - Standard printf format * Args - Argument list * - * RETURN: Size of successfully output bytes + * RETURN: Number of bytes actually written. * * DESCRIPTION: Formatted output to a string using argument list pointer. * @@ -453,7 +460,7 @@ AcpiUtVsnprintf ( Pos = String; End = String + Size; - for (; *Format ; ++Format) + for (; *Format; ++Format) { if (*Format != '%') { @@ -494,6 +501,7 @@ AcpiUtVsnprintf ( /* Process width */ + Width = -1; if (ACPI_IS_DIGIT (*Format)) { Format = AcpiUtScanNumber (Format, &Number); @@ -502,7 +510,7 @@ AcpiUtVsnprintf ( else if (*Format == '*') { ++Format; - Width = va_arg(Args, int); + Width = va_arg (Args, int); if (Width < 0) { Width = -Width; @@ -512,6 +520,7 @@ AcpiUtVsnprintf ( /* Process precision */ + Precision = -1; if (*Format == '.') { ++Format; @@ -523,7 +532,7 @@ AcpiUtVsnprintf ( else if (*Format == '*') { ++Format; - Precision = va_arg(Args, int); + Precision = va_arg (Args, int); } if (Precision < 0) { @@ -533,10 +542,12 @@ AcpiUtVsnprintf ( /* Process qualifier */ + Qualifier = -1; if (*Format == 'h' || *Format == 'l' || *Format == 'L') { Qualifier = *Format; ++Format; + if (Qualifier == 'l' && *Format == 'l') { Qualifier = 'L'; @@ -560,8 +571,10 @@ AcpiUtVsnprintf ( Pos = AcpiUtBoundStringOutput (Pos, End, ' '); } } + c = (char) va_arg (Args, int); Pos = AcpiUtBoundStringOutput (Pos, End, c); + while (--Width > 0) { Pos = AcpiUtBoundStringOutput (Pos, End, ' '); @@ -624,10 +637,10 @@ AcpiUtVsnprintf ( Width = 2 * sizeof (void *); Type |= ACPI_FORMAT_ZERO; } + p = va_arg (Args, void *); Pos = AcpiUtFormatNumber (Pos, End, - ACPI_TO_INTEGER (p), - 16, Width, Precision, Type); + ACPI_TO_INTEGER (p), 16, Width, Precision, Type); continue; default: @@ -676,7 +689,8 @@ AcpiUtVsnprintf ( Number = (signed int) Number; } } - Pos = AcpiUtFormatNumber(Pos, End, Number, Base, + + Pos = AcpiUtFormatNumber (Pos, End, Number, Base, Width, Precision, Type); } @@ -704,7 +718,7 @@ AcpiUtVsnprintf ( * Size - Boundary of the string * Format, ... - Standard printf format * - * RETURN: Size of successfully output bytes + * RETURN: Number of bytes actually written. * * DESCRIPTION: Formatted output to a string. * @@ -738,7 +752,7 @@ AcpiUtSnprintf ( * Format - Standard printf format * Args - Argument list * - * RETURN: Size of successfully output bytes + * RETURN: Number of bytes actually written. * * DESCRIPTION: Formatted output to a file using argument list pointer. * @@ -755,8 +769,9 @@ AcpiUtFileVprintf ( Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); - Length = AcpiUtVsnprintf(AcpiGbl_PrintBuffer, + Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer, sizeof (AcpiGbl_PrintBuffer), Format, Args); + (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1); AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); @@ -771,7 +786,7 @@ AcpiUtFileVprintf ( * PARAMETERS: File - File descriptor * Format, ... - Standard printf format * - * RETURN: Size of successfully output bytes + * RETURN: Number of bytes actually written. * * DESCRIPTION: Formatted output to a file. * diff --git a/source/components/utilities/utresrc.c b/source/components/utilities/utresrc.c index 53ad155a69b0..af077aec8215 100644 --- a/source/components/utilities/utresrc.c +++ b/source/components/utilities/utresrc.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTRESRC_C__ #include "acpi.h" @@ -100,7 +99,9 @@ const char *AcpiGbl_IoDecode[] = const char *AcpiGbl_LlDecode[] = { "ActiveHigh", - "ActiveLow" + "ActiveLow", + "ActiveBoth", + "Reserved" }; const char *AcpiGbl_MaxDecode[] = diff --git a/source/components/utilities/utstate.c b/source/components/utilities/utstate.c index 5dae9328c589..12de2731932f 100644 --- a/source/components/utilities/utstate.c +++ b/source/components/utilities/utstate.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTSTATE_C__ #include "acpi.h" diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c index 435f6988892d..2fa7710725dc 100644 --- a/source/components/utilities/utstring.c +++ b/source/components/utilities/utstring.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTSTRING_C__ #include "acpi.h" diff --git a/source/components/utilities/utuuid.c b/source/components/utilities/utuuid.c new file mode 100644 index 000000000000..ebf03231e4f8 --- /dev/null +++ b/source/components/utilities/utuuid.c @@ -0,0 +1,103 @@ +/****************************************************************************** + * + * Module Name: utuuid -- UUID support functions + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#define __UTUUID_C__ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("utuuid") + + +/* + * UUID support functions. + * + * This table is used to convert an input UUID ascii string to a 16 byte + * buffer and the reverse. The table maps a UUID buffer index 0-15 to + * the index within the 36-byte UUID string where the associated 2-byte + * hex value can be found. + * + * 36-byte UUID strings are of the form: + * aabbccdd-eeff-gghh-iijj-kkllmmnnoopp + * Where aa-pp are one byte hex numbers, made up of two hex digits + * + * Note: This table is basically the inverse of the string-to-offset table + * found in the ACPI spec in the description of the ToUUID macro. + */ +const UINT8 AcpiGbl_MapToUuidOffset[UUID_BUFFER_LENGTH] = +{ + 6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34 +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtConvertStringToUuid + * + * PARAMETERS: InString - 36-byte formatted UUID string + * UuidBuffer - Where the 16-byte UUID buffer is returned + * + * RETURN: None. Output data is returned in the UuidBuffer + * + * DESCRIPTION: Convert a 36-byte formatted UUID string to 16-byte UUID buffer + * + ******************************************************************************/ + +void +AcpiUtConvertStringToUuid ( + char *InString, + UINT8 *UuidBuffer) +{ + UINT32 i; + + + for (i = 0; i < UUID_BUFFER_LENGTH; i++) + { + UuidBuffer[i] = + (AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i]]) << 4); + + UuidBuffer[i] |= + AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i] + 1]); + } +} diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index 6e5628ef7d5f..dedeab39b418 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTXFACE_C__ #define EXPORT_ACPI_INTERFACES diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c index 7c4b66d748b6..0f1a6c3a9a87 100644 --- a/source/components/utilities/utxfinit.c +++ b/source/components/utilities/utxfinit.c @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #define __UTXFINIT_C__ #define EXPORT_ACPI_INTERFACES |