]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: CloudHv: Fix FW_BASE_ADDRESS
authorSebastien Boeuf <sebastien.boeuf@intel.com>
Tue, 10 May 2022 12:50:43 +0000 (20:50 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 3 Jun 2022 10:51:26 +0000 (10:51 +0000)
The FW_BASE_ADDRESS value provided by OvmfPkgDefines.fdf.inc is
incorrect for the CloudHv target. We know the generated firmware
contains a PVH ELF header, meaning it will be loaded according to the
address provided through this header. And since we know this address
isn't going to change as it's part of CloudHvElfHeader.fdf.inc, we can
hardcode it through a new include file CloudHvDefines.fdf.inc, which
replaces the generic one OvmfPkgDefines.fdf.inc.

With this change, we prevent the firmware from accessing MMIO addresses
from the address range 0xffc00000-0xffffffff since we know the firmware
hasn't been loaded on this address range.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
OvmfPkg/CloudHv/CloudHvDefines.fdf.inc [new file with mode: 0644]
OvmfPkg/CloudHv/CloudHvX64.fdf

diff --git a/OvmfPkg/CloudHv/CloudHvDefines.fdf.inc b/OvmfPkg/CloudHv/CloudHvDefines.fdf.inc
new file mode 100644 (file)
index 0000000..2198cbc
--- /dev/null
@@ -0,0 +1,65 @@
+## @file\r
+#  FDF include file that defines the main macros and sets the dependent PCDs.\r
+#\r
+#  Copyright (C) 2014, Red Hat, Inc.\r
+#  Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+DEFINE BLOCK_SIZE        = 0x1000\r
+DEFINE VARS_OFFSET       = 0\r
+\r
+DEFINE VARS_SIZE         = 0x84000\r
+DEFINE VARS_BLOCKS       = 0x84\r
+DEFINE VARS_LIVE_SIZE    = 0x40000\r
+DEFINE VARS_SPARE_SIZE   = 0x42000\r
+\r
+DEFINE FW_BASE_ADDRESS   = 0x004FFFD0\r
+DEFINE FW_SIZE           = 0x00400000\r
+DEFINE FW_BLOCKS         = 0x400\r
+DEFINE CODE_BASE_ADDRESS = 0x00583FD0\r
+DEFINE CODE_SIZE         = 0x0037C000\r
+DEFINE CODE_BLOCKS       = 0x37C\r
+DEFINE FVMAIN_SIZE       = 0x00348000\r
+DEFINE SECFV_OFFSET      = 0x003CC000\r
+DEFINE SECFV_SIZE        = 0x34000\r
+\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress     = $(FW_BASE_ADDRESS)\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize    = $(FW_SIZE)\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize = $(BLOCK_SIZE)\r
+\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase = $(FW_BASE_ADDRESS)\r
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize = $(VARS_LIVE_SIZE)\r
+\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize = $(BLOCK_SIZE)\r
+\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize\r
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = $(BLOCK_SIZE)\r
+\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize\r
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = $(VARS_SPARE_SIZE)\r
+\r
+# The OVMF WorkArea contains a fixed size header followed by the actual data.\r
+# The size of header is accessed through a fixed PCD in the reset vector code.\r
+# The value need to be kept in sync with the any changes to the Confidential\r
+# Computing Work Area header defined in the Include/WorkArea.h\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader  = 4\r
+\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdCfvBase           = $(FW_BASE_ADDRESS)\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdCfvRawDataOffset  = $(VARS_OFFSET)\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdCfvRawDataSize    = $(VARS_SIZE)\r
+\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdBfvBase           = $(CODE_BASE_ADDRESS)\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdBfvRawDataOffset  = $(VARS_SIZE)\r
+SET gUefiOvmfPkgTokenSpaceGuid.PcdBfvRawDataSize    = $(CODE_SIZE)\r
+\r
+!if $(SMM_REQUIRE) == TRUE\r
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase\r
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase\r
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase   = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase\r
+!endif\r
+\r
+DEFINE MEMFD_BASE_ADDRESS = 0x800000\r
index de64a3a709329ed51301844fa520e97f9a601e5e..a41a5536933de398a81b6429087db2467a55aaa2 100644 (file)
@@ -11,7 +11,7 @@
 ################################################################################\r
 \r
 [Defines]\r
-!include OvmfPkg/OvmfPkgDefines.fdf.inc\r
+!include CloudHvDefines.fdf.inc\r
 \r
 #\r
 # This will allow the flash device image to be recognize as an ELF, with first\r