return LinkRdNode (RdNode, NameOpNode, NewRdNode);\r
}\r
\r
+/** Code generation for the EndTag resource data.\r
+\r
+ The EndTag resource data is automatically generated by the ASL compiler\r
+ at the end of a list of resource data elements. Thus, it doesn't have\r
+ a corresponding ASL function.\r
+\r
+ This function allocates memory to create a data node. It is the caller's\r
+ responsibility to either:\r
+ - attach this node to an AML tree;\r
+ - delete this node.\r
+\r
+ ACPI 6.4, s6.4.2.9 "End Tag":\r
+ "This checksum is generated such that adding it to the sum of all the data\r
+ bytes will produce a zero sum."\r
+ "If the checksum field is zero, the resource data is treated as if the\r
+ checksum operation succeeded. Configuration proceeds normally."\r
+\r
+ To avoid re-computing checksums, if a new resource data elements is\r
+ added/removed/modified in a list of resource data elements, the AmlLib\r
+ resets the checksum to 0.\r
+\r
+ @param [in] CheckSum CheckSum to store in the EndTag.\r
+ To ignore/avoid computing the checksum,\r
+ give 0.\r
+ @param [in] ParentNode If not NULL, add the generated node\r
+ to the end of the variable list of\r
+ argument of the ParentNode.\r
+ The ParentNode must not initially contain\r
+ an EndTag resource data element.\r
+ @param [out] NewRdNode If success, contains the generated node.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter.\r
+ @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AmlCodeGenEndTag (\r
+ IN UINT8 CheckSum, OPTIONAL\r
+ IN AML_OBJECT_NODE * ParentNode, OPTIONAL\r
+ OUT AML_DATA_NODE ** NewRdNode OPTIONAL\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ AML_DATA_NODE * RdNode;\r
+ EFI_ACPI_END_TAG_DESCRIPTOR EndTag;\r
+ ACPI_SMALL_RESOURCE_HEADER SmallResHdr;\r
+\r
+ if ((ParentNode == NULL) && (NewRdNode == NULL)) {\r
+ ASSERT (0);\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ RdNode = NULL;\r
+\r
+ // Header\r
+ SmallResHdr.Bits.Length = sizeof (EFI_ACPI_END_TAG_DESCRIPTOR) -\r
+ sizeof (ACPI_SMALL_RESOURCE_HEADER);\r
+ SmallResHdr.Bits.Name = ACPI_SMALL_END_TAG_DESCRIPTOR_NAME;\r
+ SmallResHdr.Bits.Type = ACPI_SMALL_ITEM_FLAG;\r
+\r
+ // Body\r
+ EndTag.Desc = SmallResHdr.Byte;\r
+ EndTag.Checksum = CheckSum;\r
+\r
+ Status = AmlCreateDataNode (\r
+ EAmlNodeDataTypeResourceData,\r
+ (UINT8*)&EndTag,\r
+ sizeof (EFI_ACPI_END_TAG_DESCRIPTOR),\r
+ &RdNode\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ASSERT (0);\r
+ return Status;\r
+ }\r
+\r
+ if (NewRdNode != NULL) {\r
+ *NewRdNode = RdNode;\r
+ }\r
+\r
+ if (ParentNode != NULL) {\r
+ // Check the BufferOp doesn't contain any resource data yet.\r
+ // This is a hard check: do not allow to add an EndTag if the BufferNode\r
+ // already has resource data elements attached. Indeed, the EndTag should\r
+ // have already been added.\r
+ if (AmlGetNextVariableArgument ((AML_NODE_HEADER*)ParentNode, NULL) !=\r
+ NULL) {\r
+ ASSERT (0);\r
+ Status = EFI_INVALID_PARAMETER;\r
+ goto error_handler;\r
+ }\r
+\r
+ // Add the EndTag RdNode. Indeed, the AmlAppendRdNode function\r
+ // is looking for an EndTag, which we are adding here.\r
+ Status = AmlVarListAddTail (\r
+ (AML_NODE_HEADER*)ParentNode,\r
+ (AML_NODE_HEADER*)RdNode\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ASSERT (0);\r
+ goto error_handler;\r
+ }\r
+ }\r
+\r
+ return Status;\r
+\r
+error_handler:\r
+ if (RdNode != NULL) {\r
+ AmlDeleteTree ((AML_NODE_HEADER*)RdNode);\r
+ }\r
+ return Status;\r
+}\r
+\r
// DEPRECATED APIS\r
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r
\r
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL\r
);\r
\r
+/** Code generation for the EndTag resource data.\r
+\r
+ The EndTag resource data is automatically generated by the ASL compiler\r
+ at the end of a list of resource data elements. Thus, it doesn't have\r
+ a corresponding ASL function.\r
+\r
+ This function allocates memory to create a data node. It is the caller's\r
+ responsibility to either:\r
+ - attach this node to an AML tree;\r
+ - delete this node.\r
+\r
+ ACPI 6.4, s6.4.2.9 "End Tag":\r
+ "This checksum is generated such that adding it to the sum of all the data\r
+ bytes will produce a zero sum."\r
+ "If the checksum field is zero, the resource data is treated as if the\r
+ checksum operation succeeded. Configuration proceeds normally."\r
+\r
+ To avoid re-computing checksums, if a new resource data elements is\r
+ added/removed/modified in a list of resource data elements, the AmlLib\r
+ resets the checksum to 0.\r
+\r
+ @param [in] CheckSum CheckSum to store in the EndTag.\r
+ To ignore/avoid computing the checksum,\r
+ give 0.\r
+ @param [in] ParentNode If not NULL, add the generated node\r
+ to the end of the variable list of\r
+ argument of the ParentNode.\r
+ The ParentNode must not initially contain\r
+ an EndTag resource data element.\r
+ @param [out] NewRdNode If success, contains the generated node.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter.\r
+ @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AmlCodeGenEndTag (\r
+ IN UINT8 CheckSum, OPTIONAL\r
+ IN AML_OBJECT_NODE * ParentNode, OPTIONAL\r
+ OUT AML_DATA_NODE ** NewRdNode OPTIONAL\r
+ );\r
+\r
#endif // AML_RESOURCE_DATA_CODE_GEN_H_\r