Print this page
acpica-unix2-20130823
PANKOVs restructure
*** 3,13 ****
* Module Name: psargs - Parse AML opcode arguments
*
*****************************************************************************/
/*
! * Copyright (C) 2000 - 2011, 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:
--- 3,13 ----
* Module Name: psargs - Parse AML opcode arguments
*
*****************************************************************************/
/*
! * Copyright (C) 2000 - 2013, 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:
*** 180,190 ****
ACPI_FUNCTION_TRACE (PsGetNextNamestring);
/* Point past any namestring prefix characters (backslash or carat) */
! while (AcpiPsIsPrefixChar (*End))
{
End++;
}
/* Decode the path prefix character */
--- 180,191 ----
ACPI_FUNCTION_TRACE (PsGetNextNamestring);
/* Point past any namestring prefix characters (backslash or carat) */
! while (ACPI_IS_ROOT_PREFIX (*End) ||
! ACPI_IS_PARENT_PREFIX (*End))
{
End++;
}
/* Decode the path prefix character */
*** 444,484 ****
Opcode = AML_BYTE_OP;
Arg->Common.Value.Integer = (UINT64) *Aml;
Length = 1;
break;
-
case ARGP_WORDDATA:
/* Get 2 bytes from the AML stream */
Opcode = AML_WORD_OP;
ACPI_MOVE_16_TO_64 (&Arg->Common.Value.Integer, Aml);
Length = 2;
break;
-
case ARGP_DWORDDATA:
/* Get 4 bytes from the AML stream */
Opcode = AML_DWORD_OP;
ACPI_MOVE_32_TO_64 (&Arg->Common.Value.Integer, Aml);
Length = 4;
break;
-
case ARGP_QWORDDATA:
/* Get 8 bytes from the AML stream */
Opcode = AML_QWORD_OP;
ACPI_MOVE_64_TO_64 (&Arg->Common.Value.Integer, Aml);
Length = 8;
break;
-
case ARGP_CHARLIST:
/* Get a pointer to the string, point past the string */
Opcode = AML_STRING_OP;
--- 445,481 ----
*** 492,510 ****
Length++;
}
Length++;
break;
-
case ARGP_NAME:
case ARGP_NAMESTRING:
AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
return_VOID;
-
default:
ACPI_ERROR ((AE_INFO, "Invalid ArgType 0x%X", ArgType));
return_VOID;
}
--- 489,505 ----
*** 529,569 ****
static ACPI_PARSE_OBJECT *
AcpiPsGetNextField (
ACPI_PARSE_STATE *ParserState)
{
! UINT32 AmlOffset = (UINT32)
! ACPI_PTR_DIFF (ParserState->Aml,
! ParserState->AmlStart);
ACPI_PARSE_OBJECT *Field;
UINT16 Opcode;
UINT32 Name;
ACPI_FUNCTION_TRACE (PsGetNextField);
/* Determine field type */
switch (ACPI_GET8 (ParserState->Aml))
{
! default:
! Opcode = AML_INT_NAMEDFIELD_OP;
break;
! case 0x00:
! Opcode = AML_INT_RESERVEDFIELD_OP;
ParserState->Aml++;
break;
! case 0x01:
! Opcode = AML_INT_ACCESSFIELD_OP;
ParserState->Aml++;
break;
}
/* Allocate a new field op */
Field = AcpiPsAllocOp (Opcode);
--- 524,584 ----
static ACPI_PARSE_OBJECT *
AcpiPsGetNextField (
ACPI_PARSE_STATE *ParserState)
{
! UINT32 AmlOffset;
ACPI_PARSE_OBJECT *Field;
+ ACPI_PARSE_OBJECT *Arg = NULL;
UINT16 Opcode;
UINT32 Name;
+ UINT8 AccessType;
+ UINT8 AccessAttribute;
+ UINT8 AccessLength;
+ UINT32 PkgLength;
+ UINT8 *PkgEnd;
+ UINT32 BufferLength;
ACPI_FUNCTION_TRACE (PsGetNextField);
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (
+ ParserState->Aml, ParserState->AmlStart);
+
/* Determine field type */
switch (ACPI_GET8 (ParserState->Aml))
{
! case AML_FIELD_OFFSET_OP:
! Opcode = AML_INT_RESERVEDFIELD_OP;
! ParserState->Aml++;
break;
! case AML_FIELD_ACCESS_OP:
! Opcode = AML_INT_ACCESSFIELD_OP;
ParserState->Aml++;
break;
! case AML_FIELD_CONNECTION_OP:
! Opcode = AML_INT_CONNECTION_OP;
ParserState->Aml++;
break;
+
+ case AML_FIELD_EXT_ACCESS_OP:
+
+ Opcode = AML_INT_EXTACCESSFIELD_OP;
+ ParserState->Aml++;
+ break;
+
+ default:
+
+ Opcode = AML_INT_NAMEDFIELD_OP;
+ break;
}
/* Allocate a new field op */
Field = AcpiPsAllocOp (Opcode);
*** 599,621 ****
Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
break;
case AML_INT_ACCESSFIELD_OP:
/*
* Get AccessType and AccessAttrib and merge into the field Op
! * AccessType is first operand, AccessAttribute is second
*/
! Field->Common.Value.Integer = (((UINT32) ACPI_GET8 (ParserState->Aml) << 8));
ParserState->Aml++;
! Field->Common.Value.Integer |= ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
break;
default:
/* Opcode was set in previous switch */
break;
}
return_PTR (Field);
--- 614,741 ----
Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
break;
case AML_INT_ACCESSFIELD_OP:
+ case AML_INT_EXTACCESSFIELD_OP:
/*
* Get AccessType and AccessAttrib and merge into the field Op
! * AccessType is first operand, AccessAttribute is second. stuff
! * these bytes into the node integer value for convenience.
*/
!
! /* Get the two bytes (Type/Attribute) */
!
! AccessType = ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
! AccessAttribute = ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
+
+ Field->Common.Value.Integer = (UINT8) AccessType;
+ Field->Common.Value.Integer |= (UINT16) (AccessAttribute << 8);
+
+ /* This opcode has a third byte, AccessLength */
+
+ if (Opcode == AML_INT_EXTACCESSFIELD_OP)
+ {
+ AccessLength = ACPI_GET8 (ParserState->Aml);
+ ParserState->Aml++;
+
+ Field->Common.Value.Integer |= (UINT32) (AccessLength << 16);
+ }
break;
+
+ case AML_INT_CONNECTION_OP:
+
+ /*
+ * Argument for Connection operator can be either a Buffer
+ * (resource descriptor), or a NameString.
+ */
+ if (ACPI_GET8 (ParserState->Aml) == AML_BUFFER_OP)
+ {
+ ParserState->Aml++;
+
+ PkgEnd = ParserState->Aml;
+ PkgLength = AcpiPsGetNextPackageLength (ParserState);
+ PkgEnd += PkgLength;
+
+ if (ParserState->Aml < PkgEnd)
+ {
+ /* Non-empty list */
+
+ Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP);
+ if (!Arg)
+ {
+ AcpiPsFreeOp (Field);
+ return_PTR (NULL);
+ }
+
+ /* Get the actual buffer length argument */
+
+ Opcode = ACPI_GET8 (ParserState->Aml);
+ ParserState->Aml++;
+
+ switch (Opcode)
+ {
+ case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
+
+ BufferLength = ACPI_GET8 (ParserState->Aml);
+ ParserState->Aml += 1;
+ break;
+
+ case AML_WORD_OP: /* AML_WORDDATA_ARG */
+
+ BufferLength = ACPI_GET16 (ParserState->Aml);
+ ParserState->Aml += 2;
+ break;
+
+ case AML_DWORD_OP: /* AML_DWORDATA_ARG */
+
+ BufferLength = ACPI_GET32 (ParserState->Aml);
+ ParserState->Aml += 4;
+ break;
+
default:
+ BufferLength = 0;
+ break;
+ }
+
+ /* Fill in bytelist data */
+
+ Arg->Named.Value.Size = BufferLength;
+ Arg->Named.Data = ParserState->Aml;
+ }
+
+ /* Skip to End of byte data */
+
+ ParserState->Aml = PkgEnd;
+ }
+ else
+ {
+ Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+ if (!Arg)
+ {
+ AcpiPsFreeOp (Field);
+ return_PTR (NULL);
+ }
+
+ /* Get the Namestring argument */
+
+ Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
+ }
+
+ /* Link the buffer/namestring to parent (CONNECTION_OP) */
+
+ AcpiPsAppendArg (Field, Arg);
+ break;
+
+
+ default:
+
/* Opcode was set in previous switch */
break;
}
return_PTR (Field);
*** 672,690 ****
return_ACPI_STATUS (AE_NO_MEMORY);
}
AcpiPsGetNextSimpleArg (ParserState, ArgType, Arg);
break;
-
case ARGP_PKGLENGTH:
/* Package length, nothing returned */
ParserState->PkgEnd = AcpiPsGetNextPackageEnd (ParserState);
break;
-
case ARGP_FIELDLIST:
if (ParserState->Aml < ParserState->PkgEnd)
{
/* Non-empty list */
--- 792,808 ----
*** 712,722 ****
ParserState->Aml = ParserState->PkgEnd;
}
break;
-
case ARGP_BYTELIST:
if (ParserState->Aml < ParserState->PkgEnd)
{
/* Non-empty list */
--- 830,839 ----
*** 737,755 ****
ParserState->Aml = ParserState->PkgEnd;
}
break;
-
case ARGP_TARGET:
case ARGP_SUPERNAME:
case ARGP_SIMPLENAME:
Subop = AcpiPsPeekOpcode (ParserState);
if (Subop == 0 ||
AcpiPsIsLeadingChar (Subop) ||
! AcpiPsIsPrefixChar (Subop))
{
/* NullName or NameString */
Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
if (!Arg)
--- 854,872 ----
ParserState->Aml = ParserState->PkgEnd;
}
break;
case ARGP_TARGET:
case ARGP_SUPERNAME:
case ARGP_SIMPLENAME:
Subop = AcpiPsPeekOpcode (ParserState);
if (Subop == 0 ||
AcpiPsIsLeadingChar (Subop) ||
! ACPI_IS_ROOT_PREFIX (Subop) ||
! ACPI_IS_PARENT_PREFIX (Subop))
{
/* NullName or NameString */
Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
if (!Arg)
*** 784,803 ****
WalkState->ArgCount = 1;
}
break;
-
case ARGP_DATAOBJ:
case ARGP_TERMARG:
/* Single complex argument, nothing returned */
WalkState->ArgCount = 1;
break;
-
case ARGP_DATAOBJLIST:
case ARGP_TERMLIST:
case ARGP_OBJLIST:
if (ParserState->Aml < ParserState->PkgEnd)
--- 901,918 ----
*** 806,816 ****
WalkState->ArgCount = ACPI_VAR_ARGS;
}
break;
-
default:
ACPI_ERROR ((AE_INFO, "Invalid ArgType: 0x%X", ArgType));
Status = AE_AML_OPERAND_TYPE;
break;
--- 921,930 ----