]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
OvmfPkg/QemuVideoDxe/VbeShim: handle PAM1 register on Q35 correctly
[mirror_edk2.git] / OvmfPkg / QemuFlashFvbServicesRuntimeDxe / QemuFlash.c
index f9c6f5c553a6b3ec04fbe33b7dea65f797dbfd3f..5677b5ee119ca11f1e8322962e8d3408652ff814 100644 (file)
@@ -2,9 +2,10 @@
   OVMF support for QEMU system firmware flash device\r
 \r
   Copyright (c) 2009 - 2013, 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
+\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
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 \r
 **/\r
 \r
-#include "PiDxe.h"\r
-#include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
 #include <Library/PcdLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiRuntimeLib.h>\r
-#include <Guid/EventGroup.h>\r
 \r
 #include "QemuFlash.h"\r
 \r
 #define CLEARED_ARRAY_STATUS  0x00\r
 \r
 \r
-STATIC UINT8       *mFlashBase = NULL;\r
+UINT8 *mFlashBase;\r
+\r
 STATIC UINTN       mFdBlockSize = 0;\r
 STATIC UINTN       mFdBlockCount = 0;\r
 \r
-\r
-VOID\r
-QemuFlashConvertPointers (\r
-  VOID\r
-  )\r
-{\r
-  EfiConvertPointer (0x0, (VOID **) &mFlashBase);\r
-}\r
-\r
-\r
 STATIC\r
 volatile UINT8*\r
 QemuFlashPtr (\r
@@ -54,7 +42,7 @@ QemuFlashPtr (
   IN        UINTN                               Offset\r
   )\r
 {\r
-  return mFlashBase + (Lba * mFdBlockSize) + Offset;\r
+  return mFlashBase + ((UINTN)Lba * mFdBlockSize) + Offset;\r
 }\r
 \r
 \r
@@ -257,6 +245,7 @@ QemuFlashInitialize (
   mFdBlockCount = PcdGet32 (PcdOvmfFirmwareFdSize) / mFdBlockSize;\r
 \r
   if (!QemuFlashDetected ()) {\r
+    ASSERT (!FeaturePcdGet (PcdSmmSmramRequire));\r
     return EFI_WRITE_PROTECTED;\r
   }\r
 \r