]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbInfo.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / OvmfPkg / QemuFlashFvbServicesRuntimeDxe / FvbInfo.c
index 4eb69616b38a1aa0fb1f1c3818112094ef36bb4e..ea5ce837119a664390dedd2d6ebddb895d224bf7 100644 (file)
@@ -1,64 +1,47 @@
 /**@file\r
 \r
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+  Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
-Module Name:\r
+  Module Name:\r
 \r
-  FvbInfo.c\r
+    FvbInfo.c\r
 \r
-Abstract:\r
+  Abstract:\r
 \r
-  Defines data structure that is the volume header found.These data is intent\r
-  to decouple FVB driver with FV header.\r
+    Defines data structure that is the volume header found.These data is intent\r
+    to decouple FVB driver with FV header.\r
 \r
 **/\r
 \r
 //\r
 // The package level header files this module uses\r
 //\r
-#include <PiDxe.h>\r
+#include <Pi/PiFirmwareVolume.h>\r
+\r
 //\r
-// The protocols, PPI and GUID defintions for this module\r
+// The protocols, PPI and GUID definitions for this module\r
 //\r
-#include <Guid/EventGroup.h>\r
-#include <Guid/FirmwareFileSystem2.h>\r
 #include <Guid/SystemNvDataGuid.h>\r
-#include <Protocol/FirmwareVolumeBlock.h>\r
-#include <Protocol/DevicePath.h>\r
 //\r
 // The Library classes this module consumes\r
 //\r
-#include <Library/UefiLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/BaseLib.h>\r
-#include <Library/DxeServicesTableLib.h>\r
-#include <Library/UefiRuntimeLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/HobLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/PcdLib.h>\r
 \r
 typedef struct {\r
-  UINT64                      FvLength;\r
-  EFI_FIRMWARE_VOLUME_HEADER  FvbInfo;\r
+  UINT64                        FvLength;\r
+  EFI_FIRMWARE_VOLUME_HEADER    FvbInfo;\r
   //\r
   // EFI_FV_BLOCK_MAP_ENTRY    ExtraBlockMap[n];//n=0\r
   //\r
-  EFI_FV_BLOCK_MAP_ENTRY      End[1];\r
+  EFI_FV_BLOCK_MAP_ENTRY        End[1];\r
 } EFI_FVB_MEDIA_INFO;\r
 \r
 EFI_FVB_MEDIA_INFO  mPlatformFvbMediaInfo[] = {\r
   //\r
-  // Systen NvStorage FVB\r
+  // System NvStorage FVB\r
   //\r
   {\r
     FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
@@ -76,12 +59,12 @@ EFI_FVB_MEDIA_INFO  mPlatformFvbMediaInfo[] = {
       FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize),\r
       EFI_FVH_SIGNATURE,\r
       EFI_FVB2_MEMORY_MAPPED |\r
-        EFI_FVB2_READ_ENABLED_CAP |\r
-        EFI_FVB2_READ_STATUS |\r
-        EFI_FVB2_WRITE_ENABLED_CAP |\r
-        EFI_FVB2_WRITE_STATUS |\r
-        EFI_FVB2_ERASE_POLARITY |\r
-        EFI_FVB2_ALIGNMENT_16,\r
+      EFI_FVB2_READ_ENABLED_CAP |\r
+      EFI_FVB2_READ_STATUS |\r
+      EFI_FVB2_WRITE_ENABLED_CAP |\r
+      EFI_FVB2_WRITE_STATUS |\r
+      EFI_FVB2_ERASE_POLARITY |\r
+      EFI_FVB2_ALIGNMENT_16,\r
       sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),\r
       0,  // CheckSum\r
       0,  // ExtHeaderOffset\r
@@ -94,7 +77,8 @@ EFI_FVB_MEDIA_INFO  mPlatformFvbMediaInfo[] = {
           (FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
            FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
            FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
-           FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize)) / FixedPcdGet32 (PcdOvmfFirmwareBlockSize),\r
+           FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize)) /\r
+          FixedPcdGet32 (PcdOvmfFirmwareBlockSize),\r
           FixedPcdGet32 (PcdOvmfFirmwareBlockSize),\r
         }\r
       } // BlockMap[1]\r
@@ -110,27 +94,34 @@ EFI_FVB_MEDIA_INFO  mPlatformFvbMediaInfo[] = {
 \r
 EFI_STATUS\r
 GetFvbInfo (\r
-  IN  UINT64                        FvLength,\r
-  OUT EFI_FIRMWARE_VOLUME_HEADER    **FvbInfo\r
+  IN  UINT64                      FvLength,\r
+  OUT EFI_FIRMWARE_VOLUME_HEADER  **FvbInfo\r
   )\r
 {\r
-  STATIC BOOLEAN Checksummed = FALSE;\r
-  UINTN Index;\r
+  STATIC BOOLEAN  Checksummed = FALSE;\r
+  UINTN           Index;\r
 \r
   if (!Checksummed) {\r
-    for (Index = 0; Index < sizeof (mPlatformFvbMediaInfo) / sizeof (EFI_FVB_MEDIA_INFO); Index += 1) {\r
-      UINT16 Checksum;\r
+    for (Index = 0;\r
+         Index < sizeof (mPlatformFvbMediaInfo) / sizeof (EFI_FVB_MEDIA_INFO);\r
+         Index += 1)\r
+    {\r
+      UINT16  Checksum;\r
       mPlatformFvbMediaInfo[Index].FvbInfo.Checksum = 0;\r
-      Checksum = CalculateCheckSum16 (\r
-                   (UINT16*) &mPlatformFvbMediaInfo[Index].FvbInfo,\r
-                   mPlatformFvbMediaInfo[Index].FvbInfo.HeaderLength\r
-                   );\r
+      Checksum                                      = CalculateCheckSum16 (\r
+                                                        (UINT16 *)&mPlatformFvbMediaInfo[Index].FvbInfo,\r
+                                                        mPlatformFvbMediaInfo[Index].FvbInfo.HeaderLength\r
+                                                        );\r
       mPlatformFvbMediaInfo[Index].FvbInfo.Checksum = Checksum;\r
     }\r
+\r
     Checksummed = TRUE;\r
   }\r
 \r
-  for (Index = 0; Index < sizeof (mPlatformFvbMediaInfo) / sizeof (EFI_FVB_MEDIA_INFO); Index += 1) {\r
+  for (Index = 0;\r
+       Index < sizeof (mPlatformFvbMediaInfo) / sizeof (EFI_FVB_MEDIA_INFO);\r
+       Index += 1)\r
+  {\r
     if (mPlatformFvbMediaInfo[Index].FvLength == FvLength) {\r
       *FvbInfo = &mPlatformFvbMediaInfo[Index].FvbInfo;\r
       return EFI_SUCCESS;\r