summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler/asllookup.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2011-11-28 23:36:48 +0000
committerjkim <jkim@FreeBSD.org>2011-11-28 23:36:48 +0000
commit1bdf3ee8a88f36389b6ebd626dc91b14c9674b9d (patch)
tree9ddf54564f2132efa4b2bc210ee8f94df85b4d86 /sys/contrib/dev/acpica/compiler/asllookup.c
parent7cc588c10b92dcba82aa8dd93162b1a9d4e5f342 (diff)
parent371a323d3dee8126616c1fdb31a8319c8718310f (diff)
downloadFreeBSD-src-1bdf3ee8a88f36389b6ebd626dc91b14c9674b9d.zip
FreeBSD-src-1bdf3ee8a88f36389b6ebd626dc91b14c9674b9d.tar.gz
Merge ACPICA 20111123.
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/asllookup.c')
-rw-r--r--sys/contrib/dev/acpica/compiler/asllookup.c111
1 files changed, 74 insertions, 37 deletions
diff --git a/sys/contrib/dev/acpica/compiler/asllookup.c b/sys/contrib/dev/acpica/compiler/asllookup.c
index 7112236..c8f5417 100644
--- a/sys/contrib/dev/acpica/compiler/asllookup.c
+++ b/sys/contrib/dev/acpica/compiler/asllookup.c
@@ -822,7 +822,10 @@ LkNamespaceLocateBegin (
ACPI_PARSE_OBJECT *OwningOp;
ACPI_PARSE_OBJECT *SpaceIdOp;
UINT32 MinimumLength;
- UINT32 Temp;
+ UINT32 Offset;
+ UINT32 FieldBitLength;
+ UINT32 TagBitLength;
+ UINT8 Message = 0;
const ACPI_OPCODE_INFO *OpInfo;
UINT32 Flags;
@@ -1026,74 +1029,106 @@ LkNamespaceLocateBegin (
/* 2) Check for a reference to a resource descriptor */
if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
- (Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
+ (Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
{
/*
- * This was a reference to a field within a resource descriptor. Extract
- * the associated field offset (either a bit or byte offset depending on
- * the field type) and change the named reference into an integer for
- * AML code generation
+ * This was a reference to a field within a resource descriptor.
+ * Extract the associated field offset (either a bit or byte
+ * offset depending on the field type) and change the named
+ * reference into an integer for AML code generation
*/
- Temp = Node->Value;
- if (Node->Flags & ANOBJ_IS_BIT_OFFSET)
- {
- Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET;
- }
-
- /* Perform BitOffset <--> ByteOffset conversion if necessary */
+ Offset = Node->Value;
+ TagBitLength = Node->Length;
+ /*
+ * If a field is being created, generate the length (in bits) of
+ * the field. Note: Opcodes other than CreateXxxField and Index
+ * can come through here. For other opcodes, we just need to
+ * convert the resource tag reference to an integer offset.
+ */
switch (Op->Asl.Parent->Asl.AmlOpcode)
{
- case AML_CREATE_FIELD_OP:
+ case AML_CREATE_FIELD_OP: /* Variable "Length" field, in bits */
+ /*
+ * We know the length operand is an integer constant because
+ * we know that it contains a reference to a resource
+ * descriptor tag.
+ */
+ FieldBitLength = (UINT32) Op->Asl.Next->Asl.Value.Integer;
+ break;
- /* We allow a Byte offset to Bit Offset conversion for this op */
+ case AML_CREATE_BIT_FIELD_OP:
+ FieldBitLength = 1;
+ break;
- if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
- {
- /* Simply multiply byte offset times 8 to get bit offset */
+ case AML_CREATE_BYTE_FIELD_OP:
+ case AML_INDEX_OP:
+ FieldBitLength = 8;
+ break;
- Temp = ACPI_MUL_8 (Temp);
- }
+ case AML_CREATE_WORD_FIELD_OP:
+ FieldBitLength = 16;
break;
+ case AML_CREATE_DWORD_FIELD_OP:
+ FieldBitLength = 32;
+ break;
- case AML_CREATE_BIT_FIELD_OP:
+ case AML_CREATE_QWORD_FIELD_OP:
+ FieldBitLength = 64;
+ break;
+
+ default:
+ FieldBitLength = 0;
+ break;
+ }
- /* This op requires a Bit Offset */
+ /* Check the field length against the length of the resource tag */
- if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
+ if (FieldBitLength)
+ {
+ if (TagBitLength < FieldBitLength)
{
- AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL);
+ Message = ASL_MSG_TAG_SMALLER;
}
- break;
+ else if (TagBitLength > FieldBitLength)
+ {
+ Message = ASL_MSG_TAG_LARGER;
+ }
+
+ if (Message)
+ {
+ sprintf (MsgBuffer, "Tag: %u bit%s, Field: %u bit%s",
+ TagBitLength, (TagBitLength > 1) ? "s" : "",
+ FieldBitLength, (FieldBitLength > 1) ? "s" : "");
+ AslError (ASL_WARNING, Message, Op, MsgBuffer);
+ }
+ }
+ /* Convert the BitOffset to a ByteOffset for certain opcodes */
+
+ switch (Op->Asl.Parent->Asl.AmlOpcode)
+ {
case AML_CREATE_BYTE_FIELD_OP:
case AML_CREATE_WORD_FIELD_OP:
case AML_CREATE_DWORD_FIELD_OP:
case AML_CREATE_QWORD_FIELD_OP:
case AML_INDEX_OP:
- /* These Ops require Byte offsets */
-
- if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)
- {
- AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL);
- }
+ Offset = ACPI_DIV_8 (Offset);
break;
-
default:
- /* Nothing to do for other opcodes */
break;
}
/* Now convert this node to an integer whose value is the field offset */
- Op->Asl.AmlLength = 0;
- Op->Asl.ParseOpcode = PARSEOP_INTEGER;
- Op->Asl.Value.Integer = (UINT64) Temp;
- Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
+ Op->Asl.AmlLength = 0;
+ Op->Asl.ParseOpcode = PARSEOP_INTEGER;
+ Op->Asl.Value.Integer = (UINT64) Offset;
+ Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
OpcGenerateAmlOpcode (Op);
}
@@ -1253,6 +1288,7 @@ LkNamespaceLocateBegin (
{
case ACPI_ADR_SPACE_EC:
case ACPI_ADR_SPACE_CMOS:
+ case ACPI_ADR_SPACE_GPIO:
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
{
@@ -1262,6 +1298,7 @@ LkNamespaceLocateBegin (
case ACPI_ADR_SPACE_SMBUS:
case ACPI_ADR_SPACE_IPMI:
+ case ACPI_ADR_SPACE_GSBUS:
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
{
OpenPOWER on IntegriCloud