Re: [edk2-devel] [edk2-platforms][PATCH v2 25/35] MinPlatformPkg: Remove SpiFvbService modules

2021-05-19 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: mikub...@linux.microsoft.com 
> Sent: Wednesday, May 19, 2021 12:00 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Liming Gao ;
> Dong, Eric 
> Subject: [edk2-platforms][PATCH v2 25/35] MinPlatformPkg: Remove
> SpiFvbService modules
> 
> From: Michael Kubacki 
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3307
> 
> SpiFvbServiceSmm and SpiFvbServiceStandaloneMm have moved to
> IntelSiliconPkg.
> 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Signed-off-by: Michael Kubacki 
> ---
>  Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/FvbInfo.c  
>|  94 -
> -
>  Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c
> | 903 
>  Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c
> | 271 --
> 
> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneM
> m.c   |  32 -
> 
> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTraditionalM
> m.c  |  32 -
>  Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.h
> | 158 
>  Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.h
> |  22 -
>  Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
> |  68 --
> 
> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneM
> m.inf |  67 --
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
>|   2 -
>  10 files changed, 1649 deletions(-)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/FvbInfo.c
> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/FvbInfo.c
> deleted file mode 100644
> index 7f2678fa9e5a..
> --- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/FvbInfo.c
> +++ /dev/null
> @@ -1,94 +0,0 @@
> -/**@file
> -  Defines data structure that is the volume header found.
> -  These data is intent to decouple FVB driver with FV header.
> -
> -Copyright (c) 2017, Intel Corporation. All rights reserved.
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#include "SpiFvbServiceCommon.h"
> -
> -#define FIRMWARE_BLOCK_SIZE 0x1
> -#define FVB_MEDIA_BLOCK_SIZEFIRMWARE_BLOCK_SIZE
> -
> -#define NV_STORAGE_BASE_ADDRESS
> FixedPcdGet32(PcdFlashNvStorageVariableBase)
> -#define SYSTEM_NV_BLOCK_NUM
> ((FixedPcdGet32(PcdFlashNvStorageVariableSize)+
> FixedPcdGet32(PcdFlashNvStorageFtwWorkingSize) +
> FixedPcdGet32(PcdFlashNvStorageFtwSpareSize))/ FVB_MEDIA_BLOCK_SIZE)
> -
> -typedef struct {
> -  EFI_PHYSICAL_ADDRESSBaseAddress;
> -  EFI_FIRMWARE_VOLUME_HEADER  FvbInfo;
> -  EFI_FV_BLOCK_MAP_ENTRY  End[1];
> -} EFI_FVB2_MEDIA_INFO;
> -
> -//
> -// This data structure contains a template of all correct FV headers, which 
> is
> used to restore
> -// Fv header if it's corrupted.
> -//
> -EFI_FVB2_MEDIA_INFO mPlatformFvbMediaInfo[] = {
> -  //
> -  // Systen NvStorage FVB
> -  //
> -  {
> -NV_STORAGE_BASE_ADDRESS,
> -{
> -  {0,}, //ZeroVector[16]
> -  EFI_SYSTEM_NV_DATA_FV_GUID,
> -  FVB_MEDIA_BLOCK_SIZE * SYSTEM_NV_BLOCK_NUM,
> -  EFI_FVH_SIGNATURE,
> -  0x0004feff, // check MdePkg/Include/Pi/PiFirmwareVolume.h for details 
> on
> EFI_FVB_ATTRIBUTES_2
> -  sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof
> (EFI_FV_BLOCK_MAP_ENTRY),
> -  0,//CheckSum which will be calucated dynamically.
> -  0,//ExtHeaderOffset
> -  {0,}, //Reserved[1]
> -  2,//Revision
> -  {
> -{
> -  SYSTEM_NV_BLOCK_NUM,
> -  FVB_MEDIA_BLOCK_SIZE,
> -}
> -  }
> -},
> -{
> -  {
> -0,
> -0
> -  }
> -}
> -  }
> -};
> -
> -EFI_STATUS
> -GetFvbInfo (
> -  IN  EFI_PHYSICAL_ADDRESS FvBaseAddress,
> -  OUT EFI_FIRMWARE_VOLUME_HEADER   **FvbInfo
> -  )
> -{
> -  UINTN   Index;
> -  EFI_FIRMWARE_VOLUME_HEADER  *FvHeader;
> -
> -  for (Index = 0; Index < sizeof (mPlatformFvbMediaInfo) / sizeof
> (EFI_FVB2_MEDIA_INFO); Index++) {
> -if (mPlatformFvbMediaInfo[Index].BaseAddress == FvBaseAddress) {
> -  FvHeader = [Index].FvbInfo;
> -
> -  //
> -  // Update the checksum value of FV header.
> -  //
> -  FvHeader->Checksum = CalculateCheckSum16 ( (UINT16 *) FvHeader,
> FvHeader->HeaderLength);
> -
> -  *FvbInfo = FvHeader;
> -
> -  DEBUG ((DEBUG_INFO, "BaseAddr: 0x%lx \n", FvBaseAddress));
> -  DEBUG ((DEBUG_INFO, "FvLength: 0x%lx \n", (*FvbInfo)->FvLength));
> -  DEBUG ((DEBUG_INFO, "HeaderLength: 0x%x \n", (*FvbInfo)-
> >HeaderLength));
> -  DEBUG ((DEBUG_INFO, "Header Checksum: 0x%X\n", (*FvbInfo)-
> >Checksum));
> -  DEBUG ((DEBUG_INFO, "FvBlockMap[0].NumBlocks: 0x%x \n", (*FvbInfo)-
> >BlockMap[0].NumBlocks));
> -  DEBUG ((DEBUG_INFO, "FvBlockMap[0].BlockLength: 0x%x \n", (*FvbInfo)-
> >BlockMap[0].Length));
> -  DEBUG ((DEBUG_INFO, 

[edk2-devel] [edk2-platforms][PATCH v2 25/35] MinPlatformPkg: Remove SpiFvbService modules

2021-05-18 Thread Michael Kubacki
From: Michael Kubacki 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3307

SpiFvbServiceSmm and SpiFvbServiceStandaloneMm have moved to
IntelSiliconPkg.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Michael Kubacki 
---
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/FvbInfo.c
 |  94 --
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c
 | 903 
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c
 | 271 --
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.c  
 |  32 -
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTraditionalMm.c 
 |  32 -
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.h
 | 158 
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.h
 |  22 -
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf 
 |  68 --
 
Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf 
|  67 --
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc   
 |   2 -
 10 files changed, 1649 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/FvbInfo.c 
b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/FvbInfo.c
deleted file mode 100644
index 7f2678fa9e5a..
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/FvbInfo.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/**@file
-  Defines data structure that is the volume header found.
-  These data is intent to decouple FVB driver with FV header.
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SpiFvbServiceCommon.h"
-
-#define FIRMWARE_BLOCK_SIZE 0x1
-#define FVB_MEDIA_BLOCK_SIZEFIRMWARE_BLOCK_SIZE
-
-#define NV_STORAGE_BASE_ADDRESS 
FixedPcdGet32(PcdFlashNvStorageVariableBase)
-#define SYSTEM_NV_BLOCK_NUM 
((FixedPcdGet32(PcdFlashNvStorageVariableSize)+ 
FixedPcdGet32(PcdFlashNvStorageFtwWorkingSize) + 
FixedPcdGet32(PcdFlashNvStorageFtwSpareSize))/ FVB_MEDIA_BLOCK_SIZE)
-
-typedef struct {
-  EFI_PHYSICAL_ADDRESSBaseAddress;
-  EFI_FIRMWARE_VOLUME_HEADER  FvbInfo;
-  EFI_FV_BLOCK_MAP_ENTRY  End[1];
-} EFI_FVB2_MEDIA_INFO;
-
-//
-// This data structure contains a template of all correct FV headers, which is 
used to restore
-// Fv header if it's corrupted.
-//
-EFI_FVB2_MEDIA_INFO mPlatformFvbMediaInfo[] = {
-  //
-  // Systen NvStorage FVB
-  //
-  {
-NV_STORAGE_BASE_ADDRESS,
-{
-  {0,}, //ZeroVector[16]
-  EFI_SYSTEM_NV_DATA_FV_GUID,
-  FVB_MEDIA_BLOCK_SIZE * SYSTEM_NV_BLOCK_NUM,
-  EFI_FVH_SIGNATURE,
-  0x0004feff, // check MdePkg/Include/Pi/PiFirmwareVolume.h for details on 
EFI_FVB_ATTRIBUTES_2
-  sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),
-  0,//CheckSum which will be calucated dynamically.
-  0,//ExtHeaderOffset
-  {0,}, //Reserved[1]
-  2,//Revision
-  {
-{
-  SYSTEM_NV_BLOCK_NUM,
-  FVB_MEDIA_BLOCK_SIZE,
-}
-  }
-},
-{
-  {
-0,
-0
-  }
-}
-  }
-};
-
-EFI_STATUS
-GetFvbInfo (
-  IN  EFI_PHYSICAL_ADDRESS FvBaseAddress,
-  OUT EFI_FIRMWARE_VOLUME_HEADER   **FvbInfo
-  )
-{
-  UINTN   Index;
-  EFI_FIRMWARE_VOLUME_HEADER  *FvHeader;
-
-  for (Index = 0; Index < sizeof (mPlatformFvbMediaInfo) / sizeof 
(EFI_FVB2_MEDIA_INFO); Index++) {
-if (mPlatformFvbMediaInfo[Index].BaseAddress == FvBaseAddress) {
-  FvHeader = [Index].FvbInfo;
-
-  //
-  // Update the checksum value of FV header.
-  //
-  FvHeader->Checksum = CalculateCheckSum16 ( (UINT16 *) FvHeader, 
FvHeader->HeaderLength);
-
-  *FvbInfo = FvHeader;
-
-  DEBUG ((DEBUG_INFO, "BaseAddr: 0x%lx \n", FvBaseAddress));
-  DEBUG ((DEBUG_INFO, "FvLength: 0x%lx \n", (*FvbInfo)->FvLength));
-  DEBUG ((DEBUG_INFO, "HeaderLength: 0x%x \n", (*FvbInfo)->HeaderLength));
-  DEBUG ((DEBUG_INFO, "Header Checksum: 0x%X\n", (*FvbInfo)->Checksum));
-  DEBUG ((DEBUG_INFO, "FvBlockMap[0].NumBlocks: 0x%x \n", 
(*FvbInfo)->BlockMap[0].NumBlocks));
-  DEBUG ((DEBUG_INFO, "FvBlockMap[0].BlockLength: 0x%x \n", 
(*FvbInfo)->BlockMap[0].Length));
-  DEBUG ((DEBUG_INFO, "FvBlockMap[1].NumBlocks: 0x%x \n", 
(*FvbInfo)->BlockMap[1].NumBlocks));
-  DEBUG ((DEBUG_INFO, "FvBlockMap[1].BlockLength: 0x%x \n\n", 
(*FvbInfo)->BlockMap[1].Length));
-
-  return EFI_SUCCESS;
-}
-  }
-  return EFI_NOT_FOUND;
-}
diff --git 
a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c 
b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c
deleted file mode 100644
index 113c749d04ff..
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c
+++ /dev/null
@@ -1,903