ASL_RESOURCE_NODE * RsDoQwordSpaceDescriptor ( ACPI_PARSE_OBJECT *Op, UINT32 CurrentByteOffset) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ACPI_PARSE_OBJECT *MinOp = NULL; ACPI_PARSE_OBJECT *MaxOp = NULL; ACPI_PARSE_OBJECT *LengthOp = NULL; ACPI_PARSE_OBJECT *GranOp = NULL; ASL_RESOURCE_NODE *Rnode; UINT8 *OptionalFields; UINT16 StringLength = 0; UINT32 OptionIndex = 0; UINT32 i; BOOLEAN ResSourceIndex = FALSE; InitializerOp = Op->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); Descriptor = Rnode->Buffer; Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; /* * Initial descriptor length -- may be enlarged if there are * optional fields present */ OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64); Descriptor->Address64.ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) - sizeof (AML_RESOURCE_LARGE_HEADER)); /* Process all child initialization nodes */ for (i = 0; InitializerOp; i++) { switch (i) { case 0: /* Resource Type */ Descriptor->Address64.ResourceType = (UINT8) InitializerOp->Asl.Value.Integer; break; case 1: /* Resource Usage */ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1); break; case 2: /* DecodeType */ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0); RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1); break; case 3: /* MinType */ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0); RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2); break; case 4: /* MaxType */ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0); RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3); break; case 5: /* Type-Specific flags */ Descriptor->Address64.SpecificFlags = (UINT8) InitializerOp->Asl.Value.Integer; break; case 6: /* Address Granularity */ Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); GranOp = InitializerOp; break; case 7: /* Min Address */ Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); MinOp = InitializerOp; break; case 8: /* Max Address */ Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); MaxOp = InitializerOp; break; case 9: /* Translation Offset */ Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); break; case 10: /* Address Length */ Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); LengthOp = InitializerOp; break; case 11: /* ResSourceIndex [Optional Field - BYTE] */ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) { OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; OptionIndex++; Descriptor->Address64.ResourceLength++; ResSourceIndex = TRUE; } break; case 12: /* ResSource [Optional Field - STRING] */ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && (InitializerOp->Asl.Value.String)) { if (StringLength) { Descriptor->Address64.ResourceLength = (UINT16) (Descriptor->Address64.ResourceLength + StringLength); strcpy ((char *) &OptionalFields[OptionIndex], InitializerOp->Asl.Value.String); /* ResourceSourceIndex must also be valid */ if (!ResSourceIndex) { AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, InitializerOp, NULL); } } } #if 0 /* * Not a valid ResourceSource, ResourceSourceIndex must also * be invalid */ else if (ResSourceIndex) { AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, InitializerOp, NULL); } #endif break; case 13: /* ResourceTag */ UtAttachNamepathToOwner (Op, InitializerOp); break; default: AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); break; } InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } /* Validate the Min/Max/Len/Gran values */ RsLargeAddressCheck ( Descriptor->Address64.Minimum, Descriptor->Address64.Maximum, Descriptor->Address64.AddressLength, Descriptor->Address64.Granularity, Descriptor->Address64.Flags, MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + OptionIndex + StringLength; return (Rnode); }
ASL_RESOURCE_NODE * RsDoExtendedSpaceDescriptor ( ACPI_PARSE_OBJECT *Op, UINT32 CurrentByteOffset) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ACPI_PARSE_OBJECT *MinOp = NULL; ACPI_PARSE_OBJECT *MaxOp = NULL; ACPI_PARSE_OBJECT *LengthOp = NULL; ACPI_PARSE_OBJECT *GranOp = NULL; ASL_RESOURCE_NODE *Rnode; UINT16 StringLength = 0; UINT32 i; InitializerOp = Op->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); Descriptor = Rnode->Buffer; Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; Descriptor->ExtAddress64.ResourceLength = (UINT16) (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - sizeof (AML_RESOURCE_LARGE_HEADER)); /* Process all child initialization nodes */ for (i = 0; InitializerOp; i++) { switch (i) { case 0: /* Resource Type */ Descriptor->ExtAddress64.ResourceType = (UINT8) InitializerOp->Asl.Value.Integer; break; case 1: /* Resource Usage */ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1); break; case 2: /* DecodeType */ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0); RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1); break; case 3: /* MinType */ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0); RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2); break; case 4: /* MaxType */ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0); RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3); break; case 5: /* Type-Specific flags */ Descriptor->ExtAddress64.SpecificFlags = (UINT8) InitializerOp->Asl.Value.Integer; break; case 6: /* Address Granularity */ Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); GranOp = InitializerOp; break; case 7: /* Min Address */ Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); MinOp = InitializerOp; break; case 8: /* Max Address */ Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); MaxOp = InitializerOp; break; case 9: /* Translation Offset */ Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); break; case 10: /* Address Length */ Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); LengthOp = InitializerOp; break; case 11: /* Type-Specific Attributes */ Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); break; case 12: /* ResourceTag */ UtAttachNamepathToOwner (Op, InitializerOp); break; default: AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); break; } InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } /* Validate the Min/Max/Len/Gran values */ RsLargeAddressCheck ( Descriptor->ExtAddress64.Minimum, Descriptor->ExtAddress64.Maximum, Descriptor->ExtAddress64.AddressLength, Descriptor->ExtAddress64.Granularity, Descriptor->ExtAddress64.Flags, MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; return (Rnode); }