<div dir="ltr"><div>Hi,</div><div><br></div><div>Just wanted to note that this patch set is not mergeable/testable right now. I'll submit a correct v2 as soon as possible.</div><div><br></div><div>Thanks for the understanding,</div><div>Pedro<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 27, 2022 at 12:59 AM Pedro Falcato <<a href="mailto:pedro.falcato@gmail.com">pedro.falcato@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">BZ: <a href="https://bugzilla.tianocore.org/show_bug.cgi?id=3871" rel="noreferrer" target="_blank">https://bugzilla.tianocore.org/show_bug.cgi?id=3871</a><br>
<br>
Delete BaseCrcLib and slightly adjust each CalculateCrc16 call<br>
for the BaseLib CalculateCrc16() interface, as part of an effort to<br>
unify CRC16 implementations.<br>
<br>
Cc: Isaac Oram <<a href="mailto:isaac.w.oram@intel.com" target="_blank">isaac.w.oram@intel.com</a>><br>
Cc: Nate DeSimone <<a href="mailto:nathaniel.l.desimone@intel.com" target="_blank">nathaniel.l.desimone@intel.com</a>><br>
Cc: Chasel Chiu <<a href="mailto:chasel.chiu@intel.com" target="_blank">chasel.chiu@intel.com</a>><br>
<br>
Signed-off-by: Pedro Falcato <<a href="mailto:pedro.falcato@gmail.com" target="_blank">pedro.falcato@gmail.com</a>><br>
---<br>
 .../Include/Library/CrcLib.h                  | 42 -----------<br>
 .../AcpiPlatformLibBdat.c                     | 46 ++++--------<br>
 .../Library/BaseCrcLib/BaseCrcLib.c           | 71 -------------------<br>
 .../Library/BaseCrcLib/BaseCrcLib.inf         | 23 ------<br>
 .../Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc |  1 -<br>
 5 files changed, 12 insertions(+), 171 deletions(-)<br>
 delete mode 100644 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h<br>
 delete mode 100644 Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c<br>
 delete mode 100644 Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf<br>
<br>
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h<br>
deleted file mode 100644<br>
index 7ca3b7cabb14..000000000000<br>
--- a/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h<br>
+++ /dev/null<br>
@@ -1,42 +0,0 @@<br>
-/** @file<br>
-  Interface header file for the CRC library class.<br>
-<br>
-  @copyright<br>
-  Copyright 2016 - 2018 Intel Corporation. <BR><br>
-<br>
-  SPDX-License-Identifier: BSD-2-Clause-Patent<br>
-**/<br>
-<br>
-#ifndef _CRC_LIB_H_<br>
-#define _CRC_LIB_H_<br>
-<br>
-#include <Uefi.h><br>
-<br>
-/**<br>
-  Calculate a 16-bit CRC.<br>
-<br>
-  The algorithm used is MSB-first form of the ITU-T Recommendation V.41, which<br>
-  uses an initial value of 0x0000 and a polynomial of 0x1021. It is the same<br>
-  algorithm used by XMODEM.<br>
-<br>
-  The output CRC location is not updated until the calculation is finished, so<br>
-  it is possible to pass a structure as the data, and the CRC field of the same<br>
-  structure as the output location for the calculated CRC. The CRC field should<br>
-  be set to zero before calling this function. Once the CRC field is updated by<br>
-  this function, running it again over the structure produces a CRC of zero.<br>
-<br>
-  @param[in]  Data              A pointer to the target data.<br>
-  @param[in]  DataSize          The target data size.<br>
-  @param[out] CrcOut            A pointer to the return location of the CRC.<br>
-<br>
-  @retval EFI_SUCCESS           The CRC was calculated successfully.<br>
-  @retval EFI_INVALID_PARAMETER A null pointer was provided.<br>
-**/<br>
-EFI_STATUS<br>
-CalculateCrc16 (<br>
-  IN  VOID    *Data,<br>
-  IN  UINTN   DataSize,<br>
-  OUT UINT16  *CrcOut<br>
-  );<br>
-<br>
-#endif  // _CRC_LIB_H_<br>
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibBdat.c b/Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibBdat.c<br>
index 09464b4a11d1..a1780ced39aa 100644<br>
--- a/Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibBdat.c<br>
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibBdat.c<br>
@@ -11,9 +11,9 @@<br>
 // Statements that include other files<br>
 //<br>
 #include "AcpiPlatformLibLocal.h"<br>
-#include <Library/CrcLib.h><br>
 #include <BdatSchema.h><br>
 #include <Guid/MemoryMapData.h><br>
+#include <Library/BaseLib.h><br>
 #include <Library/CompressedVariableLib.h><br>
 #include <Protocol/DynamicSiLibraryProtocol2.h><br>
 #include <Protocol/DynamicSiLibraryProtocol2.h><br>
@@ -287,15 +287,12 @@ CreateBdatHeader (<br>
   // CRC16 value of the BDAT_STRUCTURE<br>
   //<br>
   (*BdatHeaderStructPtr)->BdatHeader.Crc16 = 0;<br>
-  Status = CalculateCrc16 (<br>
+  (*BdatHeaderStructPtr)->BdatHeader.Crc16 = CalculateCrc16 (<br>
     (VOID *)(*BdatHeaderStructPtr),<br>
     BdatSize,<br>
-    &(*BdatHeaderStructPtr)->BdatHeader.Crc16<br>
+    0<br>
   );<br>
-  ASSERT_EFI_ERROR (Status);<br>
-  if (EFI_ERROR (Status)) {<br>
-    (*BdatHeaderStructPtr)->BdatHeader.Crc16 = 0xFFFF;<br>
-  }<br>
+<br>
   (*BdatHeaderStructPtr)->BdatSchemas.SchemaListLength = NumberOfSchema;<br>
   (*BdatHeaderStructPtr)->BdatSchemas.Reserved = 0;<br>
   (*BdatHeaderStructPtr)->BdatSchemas.Reserved1 = 0;<br>
@@ -1088,15 +1085,11 @@ SaveBssaResultsToBdat (<br>
       // CRC16 value of the BDAT_SCHEMA_HEADER_STRUCTURE<br>
       //<br>
       BssaSchemaHeaderPtr->Crc16 = 0;<br>
-      Status = CalculateCrc16 (<br>
+      BssaSchemaHeaderPtr->Crc16 = CalculateCrc16 (<br>
         (VOID *) BssaSchemaHeaderPtr,<br>
         sizeof (BDAT_SCHEMA_HEADER_STRUCTURE),<br>
-        &BssaSchemaHeaderPtr->Crc16<br>
+        0<br>
         );<br>
-      ASSERT_EFI_ERROR (Status);<br>
-      if (EFI_ERROR (Status)) {<br>
-        BssaSchemaHeaderPtr->Crc16 = 0xFFFF;<br>
-      }<br>
<br>
       if (RemainingHobSizeBssaSchema < CurrentHobSize) {<br>
         DEBUG ((DEBUG_WARN, "Not enough space to add complete BIOS SSA result\n"));<br>
@@ -1217,17 +1210,12 @@ SaveEwlToBdat (<br>
   // CRC16 value of the BDAT_SCHEMA_HEADER_STRUCTURE<br>
   //<br>
   EwlSchemaHeaderPtr->Crc16 = 0;<br>
-  Status = CalculateCrc16 (<br>
+  EwlSchemaHeaderPtr->Crc16 = CalculateCrc16 (<br>
     (VOID *)EwlSchemaHeaderPtr,<br>
     sizeof(BDAT_SCHEMA_HEADER_STRUCTURE),<br>
-    &EwlSchemaHeaderPtr->Crc16<br>
+    0<br>
   );<br>
<br>
-  ASSERT_EFI_ERROR (Status);<br>
-  if (EFI_ERROR (Status)) {<br>
-    EwlSchemaHeaderPtr->Crc16 = 0xFFFF;<br>
-  }<br>
-<br>
   GuidHob = GetFirstGuidHob (&EWLDataGuid);<br>
   EwlPrivateData = GET_GUID_HOB_DATA (GuidHob);<br>
<br>
@@ -1334,17 +1322,12 @@ SaveSpdToBdat (<br>
   // CRC16 value of the BDAT_SCHEMA_HEADER_STRUCTURE<br>
   //<br>
   SpdSchemaHeaderPtr->Crc16 = 0;<br>
-  Status = CalculateCrc16 (<br>
+  SpdSchemaHeaderPtr->Crc16 = CalculateCrc16 (<br>
     (VOID *)SpdSchemaHeaderPtr,<br>
     sizeof(BDAT_SCHEMA_HEADER_STRUCTURE),<br>
-    &SpdSchemaHeaderPtr->Crc16<br>
+    0<br>
   );<br>
<br>
-  ASSERT_EFI_ERROR (Status);<br>
-  if (EFI_ERROR (Status)) {<br>
-    SpdSchemaHeaderPtr->Crc16 = 0xFFFF;<br>
-  }<br>
-<br>
   Address = Address + sizeof(BDAT_SCHEMA_HEADER_STRUCTURE);<br>
   *SchemaSpaceUsed = *SchemaSpaceUsed + sizeof(BDAT_SCHEMA_HEADER_STRUCTURE);<br>
<br>
@@ -1483,17 +1466,12 @@ SaveTrainingDataToBdat (<br>
   // CRC16 value of the BDAT_SCHEMA_HEADER_STRUCTURE<br>
   //<br>
   SchemaHeaderPtr->Crc16 = 0;<br>
-  Status = CalculateCrc16 (<br>
+  SchemaHeaderPtr->Crc16 = CalculateCrc16 (<br>
     (VOID *)SchemaHeaderPtr,<br>
     sizeof(BDAT_SCHEMA_HEADER_STRUCTURE),<br>
-    &SchemaHeaderPtr->Crc16<br>
+    0<br>
   );<br>
<br>
-  ASSERT_EFI_ERROR (Status);<br>
-  if (EFI_ERROR (Status)) {<br>
-    SchemaHeaderPtr->Crc16 = 0xFFFF;<br>
-  }<br>
-<br>
   GuidHob = GetFirstGuidHob (&TrainingDataGuid);<br>
<br>
   ASSERT (GuidHob != NULL);<br>
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c b/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c<br>
deleted file mode 100644<br>
index 3e8fa402add3..000000000000<br>
--- a/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c<br>
+++ /dev/null<br>
@@ -1,71 +0,0 @@<br>
-/** @file<br>
-  Base implementation of the CRC library class.<br>
-<br>
-  @copyright<br>
-  Copyright 2016 - 2018 Intel Corporation. <BR><br>
-<br>
-  SPDX-License-Identifier: BSD-2-Clause-Patent<br>
-**/<br>
-<br>
-#include <Base.h><br>
-#include <Library/CrcLib.h><br>
-<br>
-/**<br>
-  Calculate a 16-bit CRC.<br>
-<br>
-  The algorithm used is MSB-first form of the ITU-T Recommendation V.41, which<br>
-  uses an initial value of 0x0000 and a polynomial of 0x1021. It is the same<br>
-  algorithm used by XMODEM.<br>
-<br>
-  The output CRC location is not updated until the calculation is finished, so<br>
-  it is possible to pass a structure as the data, and the CRC field of the same<br>
-  structure as the output location for the calculated CRC. The CRC field should<br>
-  be set to zero before calling this function. Once the CRC field is updated by<br>
-  this function, running it again over the structure produces a CRC of zero.<br>
-<br>
-  @param[in]  Data              A pointer to the target data.<br>
-  @param[in]  DataSize          The target data size.<br>
-  @param[out] CrcOut            A pointer to the return location of the CRC.<br>
-<br>
-  @retval EFI_SUCCESS           The CRC was calculated successfully.<br>
-  @retval EFI_INVALID_PARAMETER A null pointer was provided.<br>
-**/<br>
-EFI_STATUS<br>
-CalculateCrc16 (<br>
-  IN  VOID    *Data,<br>
-  IN  UINTN   DataSize,<br>
-  OUT UINT16  *CrcOut<br>
-  )<br>
-{<br>
-  UINT32  Crc;<br>
-  UINTN   Index;<br>
-  UINT8   *Byte;<br>
-<br>
-  if (Data == NULL || CrcOut == NULL) {<br>
-    return EFI_INVALID_PARAMETER;<br>
-  }<br>
-<br>
-  Crc = 0x0000;<br>
-  for (Byte = (UINT8 *) Data; Byte < (UINT8 *) Data + DataSize; Byte++) {<br>
-    //<br>
-    // XOR the next data byte into the CRC.<br>
-    //<br>
-    Crc ^= (UINT16) *Byte << 8;<br>
-    //<br>
-    // Shift out eight bits, feeding back based on the polynomial whenever a<br>
-    // 1 is shifted out of bit 15.<br>
-    //<br>
-    for (Index = 0; Index < 8; Index++) {<br>
-      Crc <<= 1;<br>
-      if (Crc & BIT16) {<br>
-        Crc ^= 0x1021;<br>
-      }<br>
-    }<br>
-  }<br>
-<br>
-  //<br>
-  // Mask and return the 16-bit CRC.<br>
-  //<br>
-  *CrcOut = (UINT16) (Crc & 0xFFFF);<br>
-  return EFI_SUCCESS;<br>
-}<br>
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf b/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf<br>
deleted file mode 100644<br>
index 6b404e125959..000000000000<br>
--- a/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf<br>
+++ /dev/null<br>
@@ -1,23 +0,0 @@<br>
-## @file<br>
-# Base implementation of the CRC library class.<br>
-#<br>
-# @copyright<br>
-# Copyright 2016 Intel Corporation. <BR><br>
-#<br>
-# SPDX-License-Identifier: BSD-2-Clause-Patent<br>
-##<br>
-<br>
-[Defines]<br>
-  INF_VERSION                   = 0x00010019<br>
-  BASE_NAME                     = BaseCrcLib<br>
-  FILE_GUID                     = F3BE9A28-78A2-4B02-AB26-D27EE85D9256<br>
-  MODULE_TYPE                   = BASE<br>
-  VERSION_STRING                = 1.0<br>
-  LIBRARY_CLASS                 = CrcLib<br>
-<br>
-[Sources]<br>
-  BaseCrcLib.c<br>
-<br>
-[Packages]<br>
-  MdePkg/MdePkg.dec<br>
-  WhitleyOpenBoardPkg/PlatformPkg.dec<br>
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc b/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc<br>
index 8c4b9cf6ce28..5b9b08feca46 100644<br>
--- a/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc<br>
+++ b/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc<br>
@@ -618,7 +618,6 @@<br>
   PciSegmentInfoLib|$(PLATFORM_PKG)/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.inf<br>
   PlatformOpromPolicyLib|$(RP_PKG)/Library/PlatformOpromPolicyLibNull/PlatformOpromPolicyLibNull.inf<br>
   VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf<br>
-  CrcLib|WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf<br>
   PlatformSpecificAcpiTableLib|WhitleyOpenBoardPkg/Library/PlatformSpecificAcpiTableLibNull/PlatformSpecificAcpiTableLibNull.inf<br>
   BuildAcpiTablesLib|WhitleyOpenBoardPkg/Library/BuildAcpiTablesLib/DxeBuildAcpiTablesLib.inf<br>
   AcpiPlatformTableLib|WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLib.inf<br>
-- <br>
2.35.1<br>
<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Pedro Falcato</div></div>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr>   Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/88085">View/Reply Online (#88085)</a> |    |  <a target="_blank" href="https://groups.io/mt/90054868/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>