diff options
author | jkim <jkim@FreeBSD.org> | 2014-09-11 21:38:09 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2014-09-11 21:38:09 +0000 |
commit | 9f91b0b83a53651519b3bbe3b8c1f2a324da984e (patch) | |
tree | 67d2b76905535d056ba6911186285d0325dc703f /source/components/disassembler/dmbuffer.c | |
parent | b4cfb84e01b0a37b535b69118259bb16e9614b0f (diff) | |
download | FreeBSD-src-9f91b0b83a53651519b3bbe3b8c1f2a324da984e.zip FreeBSD-src-9f91b0b83a53651519b3bbe3b8c1f2a324da984e.tar.gz |
Import ACPICA 20140828.
Diffstat (limited to 'source/components/disassembler/dmbuffer.c')
-rw-r--r-- | source/components/disassembler/dmbuffer.c | 143 |
1 files changed, 142 insertions, 1 deletions
diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 739fb44..2231ce1 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 |