In the DXE phase and later, it is possible for a module to dynamically
determine whether a CSM is enabled. An example can be seen in commit
855743f71774 ("OvmfPkg: prevent 64-bit MMIO BAR degradation if there is no
CSM", 2016-05-25).
SEC and PEI phase modules cannot check the Legacy BIOS Protocol however.
For their sake, introduce a new feature PCD that simply reflects the
CSM_ENABLE build flag.
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1512
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <
20200129214412.2361-11-lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
# runtime OS from tampering with firmware structures (special memory ranges\r
# used by OVMF, the varstore pflash chip, LockBox etc).\r
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|FALSE|BOOLEAN|0x1e\r
+\r
+ ## Informs modules (including pre-DXE-phase modules) whether the platform\r
+ # firmware contains a CSM (Compatibility Support Module).\r
+ #\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|FALSE|BOOLEAN|0x35\r
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE\r
+!ifdef $(CSM_ENABLE)\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE\r
+!endif\r
!if $(SMM_REQUIRE) == TRUE\r
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|TRUE\r
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection|FALSE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE\r
+!ifdef $(CSM_ENABLE)\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE\r
+!endif\r
!if $(SMM_REQUIRE) == TRUE\r
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|TRUE\r
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection|FALSE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE\r
+!ifdef $(CSM_ENABLE)\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE\r
+!endif\r
!if $(SMM_REQUIRE) == TRUE\r
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|TRUE\r
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection|FALSE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE\r
+!ifdef $(CSM_ENABLE)\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE\r
+!endif\r
\r
[PcdsFixedAtBuild]\r
gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1\r