From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mx.groups.io with SMTP id smtpd.web11.382.1596212378103026577 for ; Fri, 31 Jul 2020 09:19:38 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=A+XIryOj; spf=pass (domain: nuviainc.com, ip: 209.85.221.45, mailfrom: tomas@nuviainc.com) Received: by mail-wr1-f45.google.com with SMTP id r4so25547894wrx.9 for ; Fri, 31 Jul 2020 09:19:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RdxUpflOCbkEOxrWxeN2knFwv38oMjGa5YqI7UaVPVE=; b=A+XIryOjbCJmiM3t8bfO+wOU0FnIWfmPmOx99TqdEWyW9qqA0dGiFQub4Rw8rRT/HC 4tDLk3zYdZOIYmPmVVTv8BOmFlZrUVaIkNztDRuMjKvnZY7v++3LUQLaT1kGkZNZI8jx gTr0x8n90Rw6WyKDBhxm7y9SMewVPF4r5G2FypSA9dk29qKScJsomKYE2HAXJR86xrT8 mgS8rtfXECilqG42AouTvSo95A6BqrSaZt19Aeh0o/T0bUdW4181/MFIwUG4LVmH+04u IwEbZL1dL1cjZEr9ZUpoSwMn1nnkCyLLzl0XObuua4x7NRBZv8IRKLuqXghgE3+roo7G BERQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RdxUpflOCbkEOxrWxeN2knFwv38oMjGa5YqI7UaVPVE=; b=j7MIJ7uK9w0+1o3oh9Wa06XM5LBTOxmVg7SE19pvUlsZL1aOWqr1j9/gTE+0+K3WZs Y8aCFGvGlkmjkCevIOxTfsWWtG9O5ASSao9Sgq38FXLSOzyr1cswvDy7bhKNpukHhCvr V1TB/y+8BflsQDyM+UQ0jNthA8RqIAVIbsjYT4hn9GM6MF8nIxC2QTY3WWaFp5lZjq2t 0puFiij8XP8XD3MOgU+sjV9f3Qk4SUoPZQyODFUTMomMzUMbu0DlioV5R3ksLgn90dHq C1vdSHo+V0HYPE34M+EIYutyb30/orRHdzNjmq3SiyLMKg9GZ2kwiDyFrmUqWtXtEicn n31A== X-Gm-Message-State: AOAM5331ABtW+bfGnaSpl6rzMhI1W+XsaGLUl/SUuC8/ySCuQC/vZvGl lws/In5T+8Htf6/tbSBypnpaS7kNsqwiDJtmwGEnOTtUvE55mSm5u8kp5ocROS9BkiQj+8qhuBh IJI97TwvQ+7OqFfi4LF+pgZiEACoL6NlrtnLmr5jiGiR5yqEM71pXfhJWVAKRZUYduvw= X-Google-Smtp-Source: ABdhPJz6cj6JMvrwtGCjhG+TKuWErxCsj92vnhmDjcFogkrnMoLR4+Xk/wQXsPUoEp7yGpA2txQQxQ== X-Received: by 2002:a5d:4642:: with SMTP id j2mr4076240wrs.82.1596212376034; Fri, 31 Jul 2020 09:19:36 -0700 (PDT) Return-Path: Received: from localhost.localdomain (cpc159317-cmbg20-2-0-cust162.5-4.cable.virginm.net. [81.111.29.163]) by smtp.gmail.com with ESMTPSA id v11sm14149739wrr.10.2020.07.31.09.19.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 09:19:35 -0700 (PDT) From: "Tomas Pilar (tpilar)" To: devel@edk2.groups.io Cc: Sami Mujawar , Alexei Fedorov Subject: [PATCH 7/8] DynamicTablesPkg: Simplify AddAcpiHeader, CfgMgrGetInfo Date: Fri, 31 Jul 2020 17:19:25 +0100 Message-Id: <20200731161926.341330-8-tomas@nuviainc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200731161926.341330-1-tomas@nuviainc.com> References: <20200731161926.341330-1-tomas@nuviainc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Simplify the methods to use the other object getter methods. The methods no longer need CfgMgr context parameter, the getter helpers retrieve the singleton platform protocol. The CfgMgrGetInfo always allocates the memory that is passed to the caller. Cc: Sami Mujawar Cc: Alexei Fedorov Signed-off-by: Tomas Pilar --- .../DynamicTableManagerDxe.c | 20 ++-- .../Include/Library/TableHelperLib.h | 23 ++--- .../Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 10 +- .../Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c | 12 +-- .../Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 8 +- .../Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 8 +- .../Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c | 8 +- .../Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c | 8 +- .../Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 8 +- .../Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 10 +- .../Acpi/Arm/AcpiSratLibArm/SratGenerator.c | 8 +- .../Common/TableHelperLib/TableHelper.c | 97 ++++--------------- .../Common/TableHelperLib/TableHelperLib.inf | 3 +- 13 files changed, 56 insertions(+), 167 deletions(-) diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c index e27dcaf374..b194a38659 100644 --- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c @@ -661,7 +661,7 @@ DynamicTableManagerDxeInitialize ( { EFI_STATUS Status; EDKII_CONFIGURATION_MANAGER_PROTOCOL * CfgMgrProtocol; - CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo; + CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMgrInfo; EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * TableFactoryProtocol; // Locate the Dynamic Table Factory @@ -695,7 +695,7 @@ DynamicTableManagerDxeInitialize ( return Status; } - Status = GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo); + Status = CfgMgrGetInfo (&CfgMgrInfo); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, @@ -708,15 +708,17 @@ DynamicTableManagerDxeInitialize ( DEBUG (( DEBUG_INFO, "INFO: Configuration Manager Version = 0x%x, OemID = %c%c%c%c%c%c\n", - CfgMfrInfo->Revision, - CfgMfrInfo->OemId[0], - CfgMfrInfo->OemId[1], - CfgMfrInfo->OemId[2], - CfgMfrInfo->OemId[3], - CfgMfrInfo->OemId[4], - CfgMfrInfo->OemId[5] + CfgMgrInfo->Revision, + CfgMgrInfo->OemId[0], + CfgMgrInfo->OemId[1], + CfgMgrInfo->OemId[2], + CfgMgrInfo->OemId[3], + CfgMgrInfo->OemId[4], + CfgMgrInfo->OemId[5] )); + FreePool(CfgMgrInfo); + Status = ProcessAcpiTables (TableFactoryProtocol, CfgMgrProtocol); if (EFI_ERROR (Status)) { DEBUG (( diff --git a/DynamicTablesPkg/Include/Library/TableHelperLib.h b/DynamicTablesPkg/Include/Library/TableHelperLib.h index 9269e77377..0dce81827b 100644 --- a/DynamicTablesPkg/Include/Library/TableHelperLib.h +++ b/DynamicTablesPkg/Include/Library/TableHelperLib.h @@ -194,33 +194,26 @@ CfgMgrGetObjects ( OUT UINT32 * ItemCount OPTIONAL ); -/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO +/** The CfgMgrGetInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO object from the Configuration Manager. - @param [in] CfgMgrProtocol Pointer to the Configuration Manager protocol - interface. @param [out] CfgMfrInfo Pointer to the Configuration Manager Info object structure. @retval EFI_SUCCESS The object is returned. - @retval EFI_INVALID_PARAMETER The Object ID is invalid. @retval EFI_NOT_FOUND The requested Object is not found. - @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration - Manager is less than the Object size. **/ EFI_STATUS EFIAPI -GetCgfMgrInfo ( - IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, +CfgMgrGetInfo ( OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO ** CfgMfrInfo ); -/** The AddAcpiHeader function updates the ACPI header structure. It uses the - ACPI table Generator and the Configuration Manager protocol to obtain the - information required for constructing the header. +/** The AddAcpiHeader function updates the ACPI header structure pointed by + the AcpiHeader. It utilizes the ACPI table Generator and the Configuration + Manager protocol to obtain any information required for constructing the + header. - @param [in] CfgMgrProtocol Pointer to the Configuration Manager - protocol interface. @param [in] Generator Pointer to the ACPI table Generator. @param [in,out] AcpiHeader Pointer to the ACPI table header to be updated. @@ -230,14 +223,10 @@ GetCgfMgrInfo ( @retval EFI_SUCCESS The ACPI table is updated successfully. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND The required object information is not found. - @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration - Manager is less than the Object size for the - requested object. **/ EFI_STATUS EFIAPI AddAcpiHeader ( - IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST ACPI_TABLE_GENERATOR * CONST Generator, IN OUT EFI_ACPI_DESCRIPTION_HEADER * CONST AcpiHeader, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c index 51c843d25f..21a7f9bf64 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c @@ -330,12 +330,10 @@ BuildDbg2Table ( } Status = AddAcpiHeader ( - CfgMgrProtocol, - This, - (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2, - AcpiTableInfo, - sizeof (DBG2_TABLE) - ); + This, + (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiDbg2, + AcpiTableInfo, + sizeof (DBG2_TABLE)); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c index b748c982b2..febaca3dae 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c @@ -528,19 +528,17 @@ BuildFadtTable ( *Table = NULL; Status = AddAcpiHeader ( - CfgMgrProtocol, - This, - (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt, - AcpiTableInfo, - sizeof (EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE) - ); + This, + (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiFadt, + AcpiTableInfo, + sizeof (EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE)); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, "ERROR: FADT: Failed to add ACPI header. Status = %r\n", Status )); - goto error_handler; + return Status; } // Update PmProfile Info diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c index c109f2ac20..4af410fb5b 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c @@ -593,13 +593,7 @@ BuildGtdtTable ( TableSize )); - Status = AddAcpiHeader ( - CfgMgrProtocol, - This, - &Gtdt->Header, - AcpiTableInfo, - TableSize - ); + Status = AddAcpiHeader (This, &Gtdt->Header, AcpiTableInfo, TableSize); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c index 65d006c89e..97f86ddb30 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c @@ -1942,13 +1942,7 @@ BuildIortTable ( TableSize )); - Status = AddAcpiHeader ( - CfgMgrProtocol, - This, - &Iort->Header, - AcpiTableInfo, - (UINT32)TableSize - ); + Status = AddAcpiHeader (This, &Iort->Header, AcpiTableInfo, (UINT32) TableSize); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c index 2651ca1541..ab42c96b06 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c @@ -641,13 +641,7 @@ BuildMadtTable ( TableSize )); - Status = AddAcpiHeader ( - CfgMgrProtocol, - This, - &Madt->Header, - AcpiTableInfo, - TableSize - ); + Status = AddAcpiHeader (This, &Madt->Header, AcpiTableInfo, TableSize); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c index 1293ac8e43..a486e2297a 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c @@ -210,13 +210,7 @@ BuildMcfgTable ( TableSize )); - Status = AddAcpiHeader ( - CfgMgrProtocol, - This, - &Mcfg->Header, - AcpiTableInfo, - TableSize - ); + Status = AddAcpiHeader (This, &Mcfg->Header, AcpiTableInfo, TableSize); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c index d70fc59e75..99eb6e0929 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c @@ -1291,13 +1291,7 @@ BuildPpttTable ( )); // Add ACPI header - Status = AddAcpiHeader ( - CfgMgrProtocol, - This, - &Pptt->Header, - AcpiTableInfo, - TableSize - ); + Status = AddAcpiHeader (This, &Pptt->Header, AcpiTableInfo, TableSize); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c index 4b2580da7d..46f53f819a 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c @@ -202,12 +202,10 @@ BuildSpcrTable ( DEBUG ((DEBUG_INFO, " Interrupt = %d\n", SerialPortInfo->Interrupt)); Status = AddAcpiHeader ( - CfgMgrProtocol, - This, - (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr, - AcpiTableInfo, - sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE) - ); + This, + (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiSpcr, + AcpiTableInfo, + sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE)); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c index 620e2929ef..fda0837f32 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c @@ -610,13 +610,7 @@ BuildSratTable ( TableSize )); - Status = AddAcpiHeader ( - CfgMgrProtocol, - This, - &Srat->Header, - AcpiTableInfo, - TableSize - ); + Status = AddAcpiHeader (This, &Srat->Header, AcpiTableInfo, TableSize); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c index 18c0e95e0d..2f266feb9c 100644 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c @@ -392,74 +392,30 @@ CfgMgrRemoveObject ( } -/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO - object from the Configuration Manager. +/** The CfgMgrGetInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO + object from the Configuration Manager. The caller is responsible for freeing + the memory allocated by this function. - @param [in] CfgMgrProtocol Pointer to the Configuration Manager protocol - interface. - @param [out] CfgMfrInfo Pointer to the Configuration Manager Info + @param [out] CfgMgrInfo Pointer to the Configuration Manager Info object structure. @retval EFI_SUCCESS The object is returned. - @retval EFI_INVALID_PARAMETER The Object ID is invalid. @retval EFI_NOT_FOUND The requested Object is not found. - @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration - Manager is less than the Object size. + @retval EFI_INVALID_PARAMETER CfgMgrInfo is NULL. **/ EFI_STATUS EFIAPI -GetCgfMgrInfo ( - IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, - OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO ** CfgMfrInfo +CfgMgrGetInfo ( + OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO ** CfgMgrInfo ) { - EFI_STATUS Status; - CM_OBJ_DESCRIPTOR CmObjectDesc; - - ASSERT (CfgMgrProtocol != NULL); - ASSERT (CfgMfrInfo != NULL); - - *CfgMfrInfo = NULL; - - Status = CfgMgrProtocol->GetObject ( - CfgMgrProtocol, - CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo), - CM_NULL_TOKEN, - &CmObjectDesc - ); - if (EFI_ERROR (Status)) { - DEBUG (( - DEBUG_ERROR, - "ERROR: Failed to Get Configuration Manager Info. Status = %r\n", - Status - )); - return Status; - } - - if (CmObjectDesc.ObjectId != CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo)) { - DEBUG (( - DEBUG_ERROR, - "ERROR: EStdObjCfgMgrInfo: Invalid ObjectId = 0x%x, expected Id = 0x%x\n", - CmObjectDesc.ObjectId, - CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo) - )); - ASSERT (FALSE); + if (CfgMgrInfo == NULL) { return EFI_INVALID_PARAMETER; } - if (CmObjectDesc.Size < - (sizeof (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO) * CmObjectDesc.Count)) { - DEBUG (( - DEBUG_ERROR, - "ERROR: EStdObjCfgMgrInfo: Buffer too small, size = 0x%x\n", - CmObjectDesc.Size - )); - ASSERT (FALSE); - return EFI_BAD_BUFFER_SIZE; - } + *CfgMgrInfo = NULL; - *CfgMfrInfo = (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO*)CmObjectDesc.Data; - return Status; + return CfgMgrGetSimpleObject (EStdObjCfgMgrInfo, (VOID **)CfgMgrInfo); } /** The AddAcpiHeader function updates the ACPI header structure pointed by @@ -467,8 +423,6 @@ GetCgfMgrInfo ( Manager protocol to obtain any information required for constructing the header. - @param [in] CfgMgrProtocol Pointer to the Configuration Manager - protocol interface. @param [in] Generator Pointer to the ACPI table Generator. @param [in,out] AcpiHeader Pointer to the ACPI table header to be updated. @@ -478,14 +432,10 @@ GetCgfMgrInfo ( @retval EFI_SUCCESS The ACPI table is updated successfully. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND The required object information is not found. - @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration - Manager is less than the Object size for the - requested object. **/ EFI_STATUS EFIAPI AddAcpiHeader ( - IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST ACPI_TABLE_GENERATOR * CONST Generator, IN OUT EFI_ACPI_DESCRIPTION_HEADER * CONST AcpiHeader, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, @@ -495,27 +445,17 @@ AddAcpiHeader ( EFI_STATUS Status; CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo; - ASSERT (CfgMgrProtocol != NULL); - ASSERT (Generator != NULL); - ASSERT (AcpiHeader != NULL); - ASSERT (Length >= sizeof (EFI_ACPI_DESCRIPTION_HEADER)); - - if ((CfgMgrProtocol == NULL) || - (Generator == NULL) || + if ((Generator == NULL) || (AcpiHeader == NULL) || - (Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) - ) { + (Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER))) { + DEBUG ((DEBUG_ERROR, + "ERROR: Cannot add ACPI header [Invalid Pamrameter].\n")); return EFI_INVALID_PARAMETER; } - Status = GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo); + Status = CfgMgrGetInfo (&CfgMfrInfo); if (EFI_ERROR (Status)) { - DEBUG (( - DEBUG_ERROR, - "ERROR: Failed to get Configuration Manager info. Status = %r\n", - Status - )); - goto error_handler; + return Status; } // UINT32 Signature @@ -555,8 +495,9 @@ AddAcpiHeader ( // UINT32 CreatorRevision AcpiHeader->CreatorRevision = Generator->CreatorRevision; -error_handler: - return Status; + FreePool (CfgMfrInfo); + + return EFI_SUCCESS; } /** diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf index 0fbc1fe5b2..4ee478dab9 100644 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf @@ -32,6 +32,5 @@ [Protocols] gEfiSerialIoProtocolGuid - -[Guids] + gEdkiiConfigurationManagerProtocolGuid -- 2.25.1