📄 aslresource.c
字号:
{ case PARSEOP_DMA: Rnode = RsDoDmaDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_DWORDIO: Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_DWORDMEMORY: Rnode = RsDoDwordMemoryDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_DWORDSPACE: Rnode = RsDoDwordSpaceDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_ENDDEPENDENTFN: switch (*State) { case ACPI_RSTATE_NORMAL: AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT, DescriptorTypeOp, NULL); break; case ACPI_RSTATE_START_DEPENDENT: AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL); break; case ACPI_RSTATE_DEPENDENT_LIST: default: break; } *State = ACPI_RSTATE_NORMAL; Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_ENDTAG: Rnode = RsDoEndTagDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_EXTENDEDIO: Rnode = RsDoExtendedIoDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_EXTENDEDMEMORY: Rnode = RsDoExtendedMemoryDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_EXTENDEDSPACE: Rnode = RsDoExtendedSpaceDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_FIXEDIO: Rnode = RsDoFixedIoDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_INTERRUPT: Rnode = RsDoInterruptDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_IO: Rnode = RsDoIoDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_IRQ: Rnode = RsDoIrqDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_IRQNOFLAGS: Rnode = RsDoIrqNoFlagsDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_MEMORY24: Rnode = RsDoMemory24Descriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_MEMORY32: Rnode = RsDoMemory32Descriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_MEMORY32FIXED: Rnode = RsDoMemory32FixedDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_QWORDIO: Rnode = RsDoQwordIoDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_QWORDMEMORY: Rnode = RsDoQwordMemoryDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_QWORDSPACE: Rnode = RsDoQwordSpaceDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_REGISTER: Rnode = RsDoGeneralRegisterDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_STARTDEPENDENTFN: switch (*State) { case ACPI_RSTATE_START_DEPENDENT: AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL); break; case ACPI_RSTATE_NORMAL: case ACPI_RSTATE_DEPENDENT_LIST: default: break; } *State = ACPI_RSTATE_START_DEPENDENT; Rnode = RsDoStartDependentDescriptor (DescriptorTypeOp, CurrentByteOffset); *State = ACPI_RSTATE_DEPENDENT_LIST; break; case PARSEOP_STARTDEPENDENTFN_NOPRI: switch (*State) { case ACPI_RSTATE_START_DEPENDENT: AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL); break; case ACPI_RSTATE_NORMAL: case ACPI_RSTATE_DEPENDENT_LIST: default: break; } *State = ACPI_RSTATE_START_DEPENDENT; Rnode = RsDoStartDependentNoPriDescriptor (DescriptorTypeOp, CurrentByteOffset); *State = ACPI_RSTATE_DEPENDENT_LIST; break; case PARSEOP_VENDORLONG: Rnode = RsDoVendorLargeDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_VENDORSHORT: Rnode = RsDoVendorSmallDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_WORDBUSNUMBER: Rnode = RsDoWordBusNumberDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_WORDIO: Rnode = RsDoWordIoDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_WORDSPACE: Rnode = RsDoWordSpaceDescriptor (DescriptorTypeOp, CurrentByteOffset); break; case PARSEOP_DEFAULT_ARG: /* Just ignore any of these, they are used as fillers/placeholders */ break; default: printf ("Unknown resource descriptor type [%s]\n", DescriptorTypeOp->Asl.ParseOpName); break; } /* * Mark original node as unused, but head of a resource descriptor. * This allows the resource to be installed in the namespace so that * references to the descriptor can be resolved. */ DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC; DescriptorTypeOp->Asl.Value.Integer = CurrentByteOffset; if (Rnode) { DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength; } return (Rnode);}/******************************************************************************* * * FUNCTION: RsLinkDescriptorChain * * PARAMETERS: PreviousRnode - Pointer to the node that will be previous * to the linked node, At exit, set to the * last node in the new chain. * Rnode - Resource node to link into the list * * RETURN: Cumulative buffer byte offset of the new segment of chain * * DESCRIPTION: Link a descriptor chain at the end of an existing chain. * ******************************************************************************/UINT32RsLinkDescriptorChain ( ASL_RESOURCE_NODE **PreviousRnode, ASL_RESOURCE_NODE *Rnode){ ASL_RESOURCE_NODE *LastRnode; UINT32 CurrentByteOffset; /* Anything to do? */ if (!Rnode) { return 0; } /* Point the previous node to the new node */ (*PreviousRnode)->Next = Rnode; CurrentByteOffset = Rnode->BufferLength; /* Walk to the end of the chain headed by Rnode */ LastRnode = Rnode; while (LastRnode->Next) { LastRnode = LastRnode->Next; CurrentByteOffset += LastRnode->BufferLength; } /* Previous node becomes the last node in the chain */ *PreviousRnode = LastRnode; return CurrentByteOffset;}/******************************************************************************* * * FUNCTION: RsDoResourceTemplate * * PARAMETERS: Op - Parent of a resource template list * * RETURN: None. Sets input node to point to a list of AML code * * DESCRIPTION: Merge a list of resource descriptors into a single AML buffer, * in preparation for output to the AML output file. * ******************************************************************************/voidRsDoResourceTemplate ( 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;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -