summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler/asloffset.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/asloffset.c')
-rw-r--r--sys/contrib/dev/acpica/compiler/asloffset.c122
1 files changed, 92 insertions, 30 deletions
diff --git a/sys/contrib/dev/acpica/compiler/asloffset.c b/sys/contrib/dev/acpica/compiler/asloffset.c
index 02deb06..b21cc4b 100644
--- a/sys/contrib/dev/acpica/compiler/asloffset.c
+++ b/sys/contrib/dev/acpica/compiler/asloffset.c
@@ -58,7 +58,6 @@ LsEmitOffsetTableEntry (
UINT32 FileId,
ACPI_NAMESPACE_NODE *Node,
UINT32 Offset,
- UINT32 Length,
char *OpName,
UINT64 Value,
UINT8 AmlOpcode);
@@ -77,7 +76,9 @@ LsEmitOffsetTableEntry (
* Three types of objects are currently emitted to the offset table:
* 1) Tagged (named) resource descriptors
* 2) Named integer objects with constant integer values
- * 3) Operation Regions that have constant Offset (address) parameters
+ * 3) Named package objects
+ * 4) Operation Regions that have constant Offset (address) parameters
+ * 5) Control methods
*
* The offset table allows the BIOS to dynamically update the values of these
* objects at boot time.
@@ -94,7 +95,7 @@ LsAmlOffsetWalk (
ACPI_NAMESPACE_NODE *Node;
UINT32 Length;
UINT32 OffsetOfOpcode;
- ACPI_PARSE_OBJECT *AddressOp;
+ ACPI_PARSE_OBJECT *NextOp;
/* Ignore actual data blocks for resource descriptors */
@@ -119,13 +120,17 @@ LsAmlOffsetWalk (
(Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC))
{
LsEmitOffsetTableEntry (FileId, Node, Gbl_CurrentAmlOffset,
- Op->Asl.FinalAmlLength, Op->Asl.ParseOpName, 0, Op->Asl.Extra);
+ Op->Asl.ParseOpName, 0, Op->Asl.Extra);
+ Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength;
+ return (AE_OK);
}
- /* Named object -- Name (NameString, DataRefObject) */
-
- else if (Op->Asl.AmlOpcode == AML_NAME_OP)
+ switch (Op->Asl.AmlOpcode)
{
+ case AML_NAME_OP:
+
+ /* Named object -- Name (NameString, DataRefObject) */
+
if (!Op->Asl.Child)
{
FlPrintFile (FileId, "%s NO CHILD!\n", MsgBuffer);
@@ -154,39 +159,50 @@ LsAmlOffsetWalk (
case AML_DWORD_OP:
case AML_QWORD_OP:
- /* The +1/-1 is to handle the integer size prefix (opcode) */
+ /* The +1 is to handle the integer size prefix (opcode) */
LsEmitOffsetTableEntry (FileId, Node,
(Gbl_CurrentAmlOffset + OffsetOfOpcode + 1),
- (Op->Asl.FinalAmlLength - 1), Op->Asl.ParseOpName,
- Op->Asl.Value.Integer, (UINT8) Op->Asl.AmlOpcode);
+ Op->Asl.ParseOpName, Op->Asl.Value.Integer,
+ (UINT8) Op->Asl.AmlOpcode);
break;
- default:
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ NextOp = Op->Asl.Child;
+
+ LsEmitOffsetTableEntry (FileId, Node,
+ (Gbl_CurrentAmlOffset + OffsetOfOpcode),
+ Op->Asl.ParseOpName,
+ NextOp->Asl.Value.Integer,
+ (UINT8) Op->Asl.AmlOpcode);
break;
+
+ default:
+ break;
}
Gbl_CurrentAmlOffset += Length;
return (AE_OK);
- }
- /* OperationRegion (NameString, RegionSpace, RegionOffset, RegionLength) */
+ case AML_REGION_OP:
+
+ /* OperationRegion (NameString, RegionSpace, RegionOffset, RegionLength) */
- else if (Op->Asl.AmlOpcode == AML_REGION_OP)
- {
Length = Op->Asl.FinalAmlLength;
/* Get the name/namepath node */
- AddressOp = Op->Asl.Child;
- OffsetOfOpcode = Length + AddressOp->Asl.FinalAmlLength + 1;
+ NextOp = Op->Asl.Child;
+ OffsetOfOpcode = Length + NextOp->Asl.FinalAmlLength + 1;
/* Get the SpaceId node, then the Offset (address) node */
- AddressOp = AddressOp->Asl.Next;
- AddressOp = AddressOp->Asl.Next;
+ NextOp = NextOp->Asl.Next;
+ NextOp = NextOp->Asl.Next;
- switch (AddressOp->Asl.AmlOpcode)
+ switch (NextOp->Asl.AmlOpcode)
{
/*
* We are only interested in integer constants that can be changed
@@ -198,12 +214,10 @@ LsAmlOffsetWalk (
case AML_DWORD_OP:
case AML_QWORD_OP:
- /* The +1/-1 is to handle the integer size prefix (opcode) */
-
LsEmitOffsetTableEntry (FileId, Node,
(Gbl_CurrentAmlOffset + OffsetOfOpcode + 1),
- (AddressOp->Asl.FinalAmlLength - 1), Op->Asl.ParseOpName,
- AddressOp->Asl.Value.Integer, (UINT8) AddressOp->Asl.AmlOpcode);
+ Op->Asl.ParseOpName, NextOp->Asl.Value.Integer,
+ (UINT8) NextOp->Asl.AmlOpcode);
Gbl_CurrentAmlOffset += Length;
return (AE_OK);
@@ -211,6 +225,31 @@ LsAmlOffsetWalk (
default:
break;
}
+ break;
+
+ case AML_METHOD_OP:
+
+ /* Method (Namepath, ...) */
+
+ Length = Op->Asl.FinalAmlLength;
+
+ /* Get the NameSeg/NamePath Op */
+
+ NextOp = Op->Asl.Child;
+
+ /* Point to the *last* nameseg in the namepath */
+
+ OffsetOfOpcode = NextOp->Asl.FinalAmlLength - ACPI_NAME_SIZE;
+
+ LsEmitOffsetTableEntry (FileId, Node,
+ (Gbl_CurrentAmlOffset + OffsetOfOpcode + Length),
+ Op->Asl.ParseOpName,
+ *((UINT32 *) &NextOp->Asl.Value.Buffer[OffsetOfOpcode]),
+ (UINT8) Op->Asl.AmlOpcode);
+ break;
+
+ default:
+ break;
}
Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength;
@@ -225,7 +264,6 @@ LsAmlOffsetWalk (
* PARAMETERS: FileId - ID of current listing file
* Node - Namespace node associated with the name
* Offset - Offset of the value within the AML table
- * Length - Length in bytes of the value
* OpName - Name of the AML opcode
* Value - Current value of the AML field
* AmlOpcode - Opcode associated with the field
@@ -241,7 +279,6 @@ LsEmitOffsetTableEntry (
UINT32 FileId,
ACPI_NAMESPACE_NODE *Node,
UINT32 Offset,
- UINT32 Length,
char *OpName,
UINT64 Value,
UINT8 AmlOpcode)
@@ -293,8 +330,6 @@ LsDoOffsetTableHeader (
UINT32 FileId)
{
- Gbl_CurrentAmlOffset = 0;
-
FlPrintFile (FileId,
"#ifndef __AML_OFFSET_TABLE_H\n"
"#define __AML_OFFSET_TABLE_H\n\n");
@@ -302,14 +337,41 @@ LsDoOffsetTableHeader (
FlPrintFile (FileId, "typedef struct {\n"
" char *Pathname;\n"
" unsigned long Offset;\n"
- " unsigned char AmlOpcode;\n"
- " unsigned long long AmlValue;\n"
+ " unsigned char Opcode;\n"
+ " unsigned long long Value;\n"
"} AML_OFFSET_TABLE_ENTRY;\n\n");
FlPrintFile (FileId,
"#endif /* __AML_OFFSET_TABLE_H */\n\n");
FlPrintFile (FileId,
+ "/*\n"
+ " * Information about supported object types:\n"
+ " *\n"
+ " * Integers:\n"
+ " * Offset points to the actual integer data\n"
+ " * Opcode is the integer prefix, indicates length of the data\n"
+ " * Value is the existing value in the AML\n"
+ " *\n"
+ " * Packages:\n"
+ " * Offset points to the package opcode\n"
+ " * Opcode is the package or var_package opcode\n"
+ " * Value is the package element cound\n"
+ " *\n"
+ " * Operation Regions:\n"
+ " * Offset points to the region address data\n"
+ " * Opcode is the address integer prefix, indicates length of the data\n"
+ " * Value is the existing address value in the AML\n"
+ " *\n"
+ " * Control Methods:\n"
+ " * Offset points to the first byte of the namepath\n"
+ " *\n"
+ " * Resource Descriptors:\n"
+ " * Offset points to the start of the descriptor\n"
+ " * Opcode is the descriptor type\n"
+ " */\n");
+
+ FlPrintFile (FileId,
"AML_OFFSET_TABLE_ENTRY %s_%s_OffsetTable[] =\n{\n",
Gbl_TableSignature, Gbl_TableId);
}
OpenPOWER on IntegriCloud