summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler/aslopcodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/aslopcodes.c')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslopcodes.c120
1 files changed, 116 insertions, 4 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslopcodes.c b/sys/contrib/dev/acpica/compiler/aslopcodes.c
index e838d7b..4f2033b 100644
--- a/sys/contrib/dev/acpica/compiler/aslopcodes.c
+++ b/sys/contrib/dev/acpica/compiler/aslopcodes.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslopcode - AML opcode generation
- * $Revision: 55 $
+ * $Revision: 60 $
*
*****************************************************************************/
@@ -206,6 +206,18 @@ OpcSetOptimalIntegerSize (
ACPI_PARSE_OBJECT *Op)
{
+/*
+ TBD: - we don't want to optimize integers in the block header, but the
+ code below does not work correctly.
+
+ if (Op->Asl.Parent &&
+ Op->Asl.Parent->Asl.Parent &&
+ (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK))
+ {
+ return 0;
+ }
+*/
+
/*
* Check for the special AML integers first - Zero, One, Ones.
* These are single-byte opcodes that are the smallest possible
@@ -407,7 +419,6 @@ OpcDoUnicode (
*
* RETURN: None
*
- *
* DESCRIPTION: Convert a string EISA ID to numeric representation. See the
* Pnp BIOS Specification for details. Here is an excerpt:
*
@@ -464,11 +475,11 @@ OpcDoEisaId (
for (i = 0; i < 7; i++)
{
- /* First 3 characters must be letters */
+ /* First 3 characters must be uppercase letters */
if (i < 3)
{
- if (!isalpha (InString[i]))
+ if (!isupper (InString[i]))
{
Status = AE_BAD_PARAMETER;
}
@@ -523,6 +534,102 @@ OpcDoEisaId (
/*******************************************************************************
*
+ * FUNCTION: OpcDoUiId
+ *
+ * PARAMETERS: Op - Parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+static UINT8 OpcMapToUUID[16] = {6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34};
+
+void
+OpcDoUuId (
+ ACPI_PARSE_OBJECT *Op)
+{
+ char *InString;
+ char *Buffer;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_NATIVE_UINT i;
+ ACPI_PARSE_OBJECT *NewOp;
+
+
+ InString = (char *) Op->Asl.Value.String;
+
+ if (ACPI_STRLEN (InString) != 36)
+ {
+ Status = AE_BAD_PARAMETER;
+ }
+ else
+ {
+ /* Check all 36 characters for correct format */
+
+ for (i = 0; i < 36; i++)
+ {
+ if ((i == 8) || (i == 13) || (i == 18) || (i == 23))
+ {
+ if (InString[i] != '-')
+ {
+ Status = AE_BAD_PARAMETER;
+ }
+ }
+ else
+ {
+ if (!isxdigit (InString[i]))
+ {
+ Status = AE_BAD_PARAMETER;
+ }
+ }
+ }
+ }
+
+ Buffer = UtLocalCalloc (16);
+
+ if (ACPI_FAILURE (Status))
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_UUID, Op, Op->Asl.Value.String);
+ }
+ else for (i = 0; i < 16; i++)
+ {
+ Buffer[i] = (char) (UtHexCharToValue (InString[OpcMapToUUID[i]]) << 4);
+ Buffer[i] = (char) UtHexCharToValue (InString[OpcMapToUUID[i] + 1]);
+ }
+
+ /* Change Op to a Buffer */
+
+ Op->Asl.ParseOpcode = PARSEOP_BUFFER;
+ Op->Common.AmlOpcode = AML_BUFFER_OP;
+ Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; /* Disable further optimization */
+ UtSetParseOpName (Op);
+
+ /* Child node is the buffer length */
+
+ NewOp = TrAllocateNode (PARSEOP_INTEGER);
+
+ NewOp->Asl.AmlOpcode = AML_BYTE_OP;
+ NewOp->Asl.Value.Integer = 16;
+ NewOp->Asl.Parent = Op;
+
+ Op->Asl.Child = NewOp;
+ Op = NewOp;
+
+ /* Peer to the child is the raw buffer data */
+
+ NewOp = TrAllocateNode (PARSEOP_RAW_DATA);
+ NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
+ NewOp->Asl.AmlLength = 16;
+ NewOp->Asl.Value.String = (char *) Buffer;
+ NewOp->Asl.Parent = Op->Asl.Parent;
+
+ Op->Asl.Next = NewOp;
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: OpcGenerateAmlOpcode
*
* PARAMETERS: Op - Parse node
@@ -580,6 +687,11 @@ OpcGenerateAmlOpcode (
OpcDoEisaId (Op);
break;
+ case PARSEOP_TOUUID:
+
+ OpcDoUuId (Op);
+ break;
+
case PARSEOP_UNICODE:
OpcDoUnicode (Op);
OpenPOWER on IntegriCloud