#ifndef TABLE_HELPER_LIB_H_\r
#define TABLE_HELPER_LIB_H_\r
\r
+#include <Library/AmlLib/AmlLib.h>\r
+\r
/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO\r
object from the Configuration Manager.\r
\r
IN CONST UINT32 Length\r
);\r
\r
+/** Build a RootNode containing SSDT ACPI header information using the AmlLib.\r
+\r
+ The function utilizes the ACPI table Generator and the Configuration\r
+ Manager protocol to obtain any information required for constructing the\r
+ header. It then creates a RootNode. The SSDT ACPI header is part of the\r
+ RootNode.\r
+\r
+ This is essentially a wrapper around AmlCodeGenDefinitionBlock ()\r
+ from the AmlLib.\r
+\r
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager\r
+ protocol interface.\r
+ @param [in] Generator Pointer to the ACPI table Generator.\r
+ @param [in] AcpiTableInfo Pointer to the ACPI table info structure.\r
+ @param [out] RootNode If success, contains the created RootNode.\r
+ The SSDT ACPI header is part of the RootNode.\r
+\r
+ @retval EFI_SUCCESS Success.\r
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.\r
+ @retval EFI_NOT_FOUND The required object information is not found.\r
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration\r
+ Manager is less than the Object size for the\r
+ requested object.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AddSsdtAcpiHeader (\r
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,\r
+ IN CONST ACPI_TABLE_GENERATOR * CONST Generator,\r
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,\r
+ OUT AML_ROOT_NODE_HANDLE * RootNode\r
+ );\r
+\r
/**\r
Function prototype for testing if two arbitrary objects are equal.\r
\r
return Status;\r
}\r
\r
+/** Build a RootNode containing SSDT ACPI header information using the AmlLib.\r
+\r
+ The function utilizes the ACPI table Generator and the Configuration\r
+ Manager protocol to obtain any information required for constructing the\r
+ header. It then creates a RootNode. The SSDT ACPI header is part of the\r
+ RootNode.\r
+\r
+ This is essentially a wrapper around AmlCodeGenDefinitionBlock ()\r
+ from the AmlLib.\r
+\r
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager\r
+ protocol interface.\r
+ @param [in] Generator Pointer to the ACPI table Generator.\r
+ @param [in] AcpiTableInfo Pointer to the ACPI table info structure.\r
+ @param [out] RootNode If success, contains the created RootNode.\r
+ The SSDT ACPI header is part of the RootNode.\r
+\r
+ @retval EFI_SUCCESS Success.\r
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.\r
+ @retval EFI_NOT_FOUND The required object information is not found.\r
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration\r
+ Manager is less than the Object size for the\r
+ requested object.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AddSsdtAcpiHeader (\r
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,\r
+ IN CONST ACPI_TABLE_GENERATOR * CONST Generator,\r
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,\r
+ OUT AML_ROOT_NODE_HANDLE * RootNode\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINT64 OemTableId;\r
+ UINT32 OemRevision;\r
+ CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo;\r
+\r
+ ASSERT (CfgMgrProtocol != NULL);\r
+ ASSERT (Generator != NULL);\r
+ ASSERT (AcpiTableInfo != NULL);\r
+\r
+ if ((CfgMgrProtocol == NULL) ||\r
+ (Generator == NULL) ||\r
+ (AcpiTableInfo == NULL)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Status = GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo);\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "ERROR: Failed to get Configuration Manager info. Status = %r\n",\r
+ Status\r
+ ));\r
+ return Status;\r
+ }\r
+\r
+ if (AcpiTableInfo->OemTableId != 0) {\r
+ OemTableId = AcpiTableInfo->OemTableId;\r
+ } else {\r
+ OemTableId = SIGNATURE_32 (\r
+ CfgMfrInfo->OemId[0],\r
+ CfgMfrInfo->OemId[1],\r
+ CfgMfrInfo->OemId[2],\r
+ CfgMfrInfo->OemId[3]\r
+ ) |\r
+ ((UINT64)Generator->AcpiTableSignature << 32);\r
+ }\r
+\r
+ if (AcpiTableInfo->OemRevision != 0) {\r
+ OemRevision = AcpiTableInfo->OemRevision;\r
+ } else {\r
+ OemRevision = CfgMfrInfo->Revision;\r
+ }\r
+\r
+ Status = AmlCodeGenDefinitionBlock (\r
+ "SSDT",\r
+ (CONST CHAR8*)&CfgMfrInfo->OemId,\r
+ (CONST CHAR8*)&OemTableId,\r
+ OemRevision,\r
+ RootNode\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ return Status;\r
+}\r
+\r
/**\r
Test and report if a duplicate entry exists in the given array of comparable\r
elements.\r