ASL_RESOURCE_NODE * RsDoStartDependentNoPriDescriptor ( ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ASL_RESOURCE_NODE *Rnode; ASL_RESOURCE_NODE *PreviousRnode; ASL_RESOURCE_NODE *NextRnode; ASL_RESOURCE_INFO NextInfo; UINT32 CurrentByteOffset; UINT8 State; InitializerOp = Info->DescriptorTypeOp->Asl.Child; CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)); Descriptor = Rnode->Buffer; Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | ASL_RDESC_ST_DEPEND_SIZE; PreviousRnode = Rnode; /* Increment offset past StartDependentNoPri descriptor */ CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO); /* Process all child initialization nodes */ State = ACPI_RSTATE_START_DEPENDENT; while (InitializerOp) { NextInfo.CurrentByteOffset = CurrentByteOffset; NextInfo.DescriptorTypeOp = InitializerOp; NextRnode = RsDoOneResourceDescriptor (&NextInfo, &State); /* * Update current byte offset to indicate the number of bytes from the * start of the buffer. Buffer can include multiple descriptors, we * must keep track of the offset of not only each descriptor, but each * element (field) within each descriptor as well. */ CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode); InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } return (Rnode); }
void RsDoResourceTemplate ( ACPI_PARSE_OBJECT *Op) { ACPI_PARSE_OBJECT *BufferLengthOp; ACPI_PARSE_OBJECT *BufferOp; ACPI_PARSE_OBJECT *DescriptorTypeOp; ACPI_PARSE_OBJECT *LastOp = NULL; UINT32 CurrentByteOffset = 0; ASL_RESOURCE_NODE HeadRnode; ASL_RESOURCE_NODE *PreviousRnode; ASL_RESOURCE_NODE *Rnode; UINT8 State; /* Mark parent as containing a resource template */ if (Op->Asl.Parent) { Op->Asl.Parent->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC; } /* ResourceTemplate Opcode is first (Op) */ /* Buffer Length node is first child */ BufferLengthOp = ASL_GET_CHILD_NODE (Op); /* Buffer Op is first peer */ BufferOp = ASL_GET_PEER_NODE (BufferLengthOp); /* First Descriptor type is next */ DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp); /* * Process all resource descriptors in the list * Note: It is assumed that the EndTag node has been automatically * inserted at the end of the template by the parser. */ State = ACPI_RSTATE_NORMAL; PreviousRnode = &HeadRnode; while (DescriptorTypeOp) { DescriptorTypeOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC; Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset, &State); /* * Update current byte offset to indicate the number of bytes from the * start of the buffer. Buffer can include multiple descriptors, we * must keep track of the offset of not only each descriptor, but each * element (field) within each descriptor as well. */ CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode); /* Get the next descriptor in the list */ LastOp = DescriptorTypeOp; DescriptorTypeOp = ASL_GET_PEER_NODE (DescriptorTypeOp); } if (State == ACPI_RSTATE_DEPENDENT_LIST) { if (LastOp) { LastOp = LastOp->Asl.Parent; } AslError (ASL_ERROR, ASL_MSG_MISSING_ENDDEPENDENT, LastOp, NULL); } /* * Transform the nodes into the following * * Op -> AML_BUFFER_OP * First Child -> BufferLength * Second Child -> Descriptor Buffer (raw byte data) */ Op->Asl.ParseOpcode = PARSEOP_BUFFER; Op->Asl.AmlOpcode = AML_BUFFER_OP; Op->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC; BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; BufferLengthOp->Asl.Value.Integer = CurrentByteOffset; (void) OpcSetOptimalIntegerSize (BufferLengthOp); BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; BufferOp->Asl.AmlOpcodeLength = 0; BufferOp->Asl.AmlLength = CurrentByteOffset; BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next; BufferOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DATA; return; }
ASL_RESOURCE_NODE * RsDoStartDependentDescriptor ( ACPI_PARSE_OBJECT *Op, UINT32 CurrentByteOffset) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ASL_RESOURCE_NODE *Rnode; ASL_RESOURCE_NODE *PreviousRnode; ASL_RESOURCE_NODE *NextRnode; UINT32 i; UINT8 State; InitializerOp = Op->Asl.Child; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT)); PreviousRnode = Rnode; Descriptor = Rnode->Buffer; /* Descriptor has priority byte */ Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | (ASL_RDESC_ST_DEPEND_SIZE + 0x01); /* Process all child initialization nodes */ State = ACPI_RSTATE_START_DEPENDENT; for (i = 0; InitializerOp; i++) { switch (i) { case 0: /* Compatibility Priority */ if ((UINT8) InitializerOp->Asl.Value.Integer > 2) { AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY, InitializerOp, NULL); } RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0); break; case 1: /* Performance/Robustness Priority */ if ((UINT8) InitializerOp->Asl.Value.Integer > 2) { AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE, InitializerOp, NULL); } RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0); break; default: NextRnode = RsDoOneResourceDescriptor (InitializerOp, CurrentByteOffset, &State); /* * Update current byte offset to indicate the number of bytes from the * start of the buffer. Buffer can include multiple descriptors, we * must keep track of the offset of not only each descriptor, but each * element (field) within each descriptor as well. */ CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode); break; } InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } return (Rnode); }
void RsDoResourceTemplate ( ACPI_PARSE_OBJECT *Op) { ACPI_PARSE_OBJECT *BufferLengthOp; ACPI_PARSE_OBJECT *BufferOp; ACPI_PARSE_OBJECT *DescriptorTypeOp; ACPI_PARSE_OBJECT *LastOp = NULL; ASL_RESOURCE_DESC *Descriptor; UINT32 CurrentByteOffset = 0; ASL_RESOURCE_NODE HeadRnode; ASL_RESOURCE_NODE *PreviousRnode; ASL_RESOURCE_NODE *Rnode; UINT8 State; /* ResourceTemplate Opcode is first (Op) */ /* Buffer Length node is first child */ BufferLengthOp = ASL_GET_CHILD_NODE (Op); /* Buffer Op is first peer */ BufferOp = ASL_GET_PEER_NODE (BufferLengthOp); /* First Descriptor type is next */ DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp); /* Process all resource descriptors in the list */ State = ACPI_RSTATE_NORMAL; PreviousRnode = &HeadRnode; while (DescriptorTypeOp) { Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset, &State); /* * Update current byte offset to indicate the number of bytes from the * start of the buffer. Buffer can include multiple descriptors, we * must keep track of the offset of not only each descriptor, but each * element (field) within each descriptor as well. */ CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode); /* Get the next descriptor in the list */ LastOp = DescriptorTypeOp; DescriptorTypeOp = ASL_GET_PEER_NODE (DescriptorTypeOp); } if (State == ACPI_RSTATE_DEPENDENT_LIST) { if (LastOp) { LastOp = LastOp->Asl.Parent; } AslError (ASL_ERROR, ASL_MSG_MISSING_ENDDEPENDENT, LastOp, NULL); } /* * Insert the EndTag descriptor after all other descriptors have been processed */ Rnode = RsAllocateResourceNode (sizeof (ASL_END_TAG_DESC)); Descriptor = Rnode->Buffer; Descriptor->Et.DescriptorType = ACPI_RDESC_TYPE_END_TAG | ASL_RDESC_END_TAG_SIZE; Descriptor->Et.Checksum = 0; CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode); /* * Transform the nodes into the following * * Op -> AML_BUFFER_OP * First Child -> BufferLength * Second Child -> Descriptor Buffer (raw byte data) */ Op->Asl.ParseOpcode = PARSEOP_BUFFER; Op->Asl.AmlOpcode = AML_BUFFER_OP; Op->Asl.CompileFlags = NODE_AML_PACKAGE; BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; BufferLengthOp->Asl.Value.Integer = CurrentByteOffset; (void) OpcSetOptimalIntegerSize (BufferLengthOp); BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; BufferOp->Asl.AmlOpcodeLength = 0; BufferOp->Asl.AmlLength = CurrentByteOffset; BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next; return; }