]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbInfo.c
OvmfPkg/QemuVideoDxe: handle invalid BltOperation gracefully
[mirror_edk2.git] / OvmfPkg / QemuFlashFvbServicesRuntimeDxe / FvbInfo.c
index 72845f955527219559b1298f1972382f40b9d6e7..6edbeed82f4b1ae4d505aab5f5b8e006027d4430 100644 (file)
@@ -1,50 +1,39 @@
 /**@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
-                                                                                          \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
 \r
-Module Name:\r
+  This program and the accompanying materials are licensed and made available\r
+  under the terms and conditions of the BSD License which accompanies this\r
+  distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
 \r
-  FvbInfo.c\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
 \r
-Abstract:\r
+  Module Name:\r
 \r
-  Defines data structure that is the volume header found.These data is intent\r
-  to decouple FVB driver with FV header.\r
+    FvbInfo.c\r
+\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
 \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
 //\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
@@ -75,7 +64,7 @@ EFI_FVB_MEDIA_INFO  mPlatformFvbMediaInfo[] = {
       FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
       FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize),\r
       EFI_FVH_SIGNATURE,\r
-      EFI_FVB2_MEMORY_MAPPED |  \r
+      EFI_FVB2_MEMORY_MAPPED |\r
         EFI_FVB2_READ_ENABLED_CAP |\r
         EFI_FVB2_READ_STATUS |\r
         EFI_FVB2_WRITE_ENABLED_CAP |\r
@@ -90,17 +79,22 @@ EFI_FVB_MEDIA_INFO  mPlatformFvbMediaInfo[] = {
       },  // Reserved[1]\r
       2,  // Revision\r
       {\r
-       (FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
-        FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
-        FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
-        FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize)) / FixedPcdGet32 (PcdOvmfFirmwareBlockSize),\r
-        FixedPcdGet32 (PcdOvmfFirmwareBlockSize),\r
-      }\r
+        {\r
+          (FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
+           FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
+           FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
+           FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize)) /\r
+          FixedPcdGet32 (PcdOvmfFirmwareBlockSize),\r
+          FixedPcdGet32 (PcdOvmfFirmwareBlockSize),\r
+        }\r
+      } // BlockMap[1]\r
     },\r
     {\r
-      0,\r
-      0\r
-    }\r
+      {\r
+        0,\r
+        0\r
+      }\r
+    }  // End[1]\r
   }\r
 };\r
 \r
@@ -114,7 +108,9 @@ GetFvbInfo (
   UINTN Index;\r
 \r
   if (!Checksummed) {\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
       UINT16 Checksum;\r
       mPlatformFvbMediaInfo[Index].FvbInfo.Checksum = 0;\r
       Checksum = CalculateCheckSum16 (\r
@@ -126,7 +122,9 @@ GetFvbInfo (
     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
     if (mPlatformFvbMediaInfo[Index].FvLength == FvLength) {\r
       *FvbInfo = &mPlatformFvbMediaInfo[Index].FvbInfo;\r
       return EFI_SUCCESS;\r