]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/FvbServicesRuntimeDxe/FvbInfo.c
UefiCpuPkg: Remove double \r
[mirror_edk2.git] / Nt32Pkg / FvbServicesRuntimeDxe / FvbInfo.c
index 25df9522792172b2678f2552e2270994f04b241e..1b4d08282863579a2dbb1ef9cdc0a278a1317ea1 100644 (file)
@@ -1,13 +1,7 @@
-/*++\r
+/**@file\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-                                                                                          \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
+Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 Module Name:\r
 \r
@@ -18,7 +12,7 @@ Abstract:
   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
 //\r
 // The package level header files this module uses\r
@@ -31,9 +25,7 @@ Abstract:
 #include <Guid/EventGroup.h>\r
 #include <Guid/FirmwareFileSystem2.h>\r
 #include <Guid/SystemNvDataGuid.h>\r
-#include <Protocol/FvbExtension.h>\r
 #include <Protocol/FirmwareVolumeBlock.h>\r
-#include <Guid/AlternateFvBlock.h>\r
 #include <Protocol/DevicePath.h>\r
 //\r
 // The Library classes this module consumes\r
@@ -48,10 +40,7 @@ Abstract:
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
-\r
-#include "FlashLayout.h"\r
-\r
-#define FIRMWARE_BLOCK_SIZE 0x10000\r
+#include <Library/PcdLib.h>\r
 \r
 typedef struct {\r
   UINT64                      FvLength;\r
@@ -62,38 +51,36 @@ typedef struct {
   EFI_FV_BLOCK_MAP_ENTRY      End[1];\r
 } EFI_FVB_MEDIA_INFO;\r
 \r
-#define FVB_MEDIA_BLOCK_SIZE    FIRMWARE_BLOCK_SIZE\r
-#define RECOVERY_BOIS_BLOCK_NUM FIRMWARE_BLOCK_NUMBER\r
-#define SYSTEM_NV_BLOCK_NUM     2\r
-\r
 EFI_FVB_MEDIA_INFO  mPlatformFvbMediaInfo[] = {\r
   //\r
   // Recovery BOIS FVB\r
   //\r
   {\r
-    EFI_WINNT_FIRMWARE_LENGTH,\r
+    FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),\r
     {\r
       {\r
         0,\r
       },  // ZeroVector[16]\r
       EFI_FIRMWARE_FILE_SYSTEM2_GUID,\r
-      FVB_MEDIA_BLOCK_SIZE * RECOVERY_BOIS_BLOCK_NUM,\r
+      FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),\r
       EFI_FVH_SIGNATURE,\r
-      EFI_FVB2_READ_ENABLED_CAP |\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_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
+      0xE947,   // CheckSum\r
+      0,        // ExtHeaderOffset\r
       {\r
         0,\r
       },  // Reserved[1]\r
-      1,  // Revision\r
+      2,  // Revision\r
       {\r
-        RECOVERY_BOIS_BLOCK_NUM,\r
-        FVB_MEDIA_BLOCK_SIZE,\r
+        FixedPcdGet32 (PcdWinNtFlashFvRecoverySize)/FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
+        FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
       }\r
     },\r
     {\r
@@ -105,29 +92,40 @@ EFI_FVB_MEDIA_INFO  mPlatformFvbMediaInfo[] = {
   // Systen NvStorage FVB\r
   //\r
   {\r
-    EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,\r
+    FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
+    FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
+    FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
+    FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),\r
     {\r
       {\r
         0,\r
       },  // ZeroVector[16]\r
-      EFI_SYSTEM_NV_DATA_HOB_GUID,\r
-      FVB_MEDIA_BLOCK_SIZE * SYSTEM_NV_BLOCK_NUM,\r
+      EFI_SYSTEM_NV_DATA_FV_GUID,\r
+      FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
+      FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
+      FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
+      FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),\r
       EFI_FVH_SIGNATURE,\r
-      EFI_FVB2_READ_ENABLED_CAP |\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_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
+      0xFBFF,  // CheckSum\r
+      0,       // ExtHeaderOffset\r
       {\r
         0,\r
       },  // Reserved[1]\r
-      1,  // Revision\r
+      2,  // Revision\r
       {\r
-        SYSTEM_NV_BLOCK_NUM,\r
-        FVB_MEDIA_BLOCK_SIZE,\r
+       (FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
+        FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
+        FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
+        FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize)) / FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
+        FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
       }\r
     },\r
     {\r