summaryrefslogtreecommitdiff
path: root/OvmfPkg
AgeCommit message (Collapse)Author
2016-05-17OvmfPkg/PlatformPei: provide 10 * 4KB of PCI IO Port space on Q35Laszlo Ersek
This can accommodate 10 bridges (including root bridges, PCIe upstream and downstream ports, etc -- see <https://bugzilla.redhat.com/show_bug.cgi?id=1333238#c12> for more details). 10 is not a whole lot, but closer to the architectural limit of 15 than our current 4, so it can be considered a stop-gap solution until all guests manage to migrate to virtio-1.0, and no longer need PCI IO BARs behind PCIe downstream ports. Cc: Gabriel Somlo <somlo@cmu.edu> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1333238 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Gabriel Somlo <somlo@cmu.edu>
2016-05-17OvmfPkg/PlatformPei: set PCI IO port aperture dynamicallyLaszlo Ersek
Make PcdPciIoBase and PcdPciIoSize dynamic PCDs, and set them in MemMapInitialization(), where we produce our EFI_RESOURCE_IO descriptor HOB. (The PCD is consumed by the core PciHostBridgeDxe driver, through our PciHostBridgeLib instance.) Take special care to keep the GCD IO space map unchanged on all platforms OVMF runs on. Cc: Gabriel Somlo <somlo@cmu.edu> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1333238 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Gabriel Somlo <somlo@cmu.edu>
2016-05-17OvmfPkg: determine PMBA value dependent on host bridge device IDLaszlo Ersek
In this patch, the AcpiTimerLib instances, ResetSystemLib, and PlatformPei are modified together in order to keep VMs functional across a bisection: they all must agree on the PMBA value used. ResetSystemLib must not use dynamic PCDs. With SOURCE_DEBUG_ENABLE, it gets linked into the debug agent, therefore the same restrictions apply to it as to BaseRomAcpiTimerLib. Luckily, AcpiPmControl() is only used for powering off the virtual machine, thus the extra cost of a PCI config space read, compared to a PcdGet16(), should be negligible. This is the patch that moves the PMBA to IO port 0x0600 on Q35 in practice. The ResetSystemLib change is easiest to verify with the "reset -s" command in the UEFI shell (which goes through gRT->ResetSystem() and, in OVMF, PcAtChipsetPkg/KbcResetDxe). Cc: Gabriel Somlo <somlo@cmu.edu> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1333238 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Gabriel Somlo <somlo@cmu.edu>
2016-05-17OvmfPkg: introduce ICH9_PMBASE_VALUELaszlo Ersek
According to the ICH9 spec, PMBASE "provides 128 bytes of I/O space for ACPI, GPIO, and TCO logic. This is placed on a 128-byte boundary". On the Q35 machine type of QEMU, our current PMBASE setting of 0xB000 is the only thing that prevents us from lowering the base of the PCI IO port aperture from 0xC000. (The base must be aligned to 0x1000 due to PCI bridge requirements.) By moving our PMBASE to 0x0600 (moving the register block to 0x0600..0x067F inclusive), which is also what SeaBIOS uses on Q35, we will be able to lower the PCI IO port aperture base to 0x6000 (the next IO port under it being taken by the "vmport" device, at fixed 0x5658), while steering clear of other QEMU devices. On PIIX4, freeing up the 0x1000 IO ports at 0xB000 wouldn't help much, because the 0xA000 block right below it is occupied by unmovable devices (see <https://bugzilla.redhat.com/show_bug.cgi?id=1333238#c19> for details). Doing this for Q35 only has two more benefits: - It won't interfere with Xen guests, - The Q35 machine type with the smallest version number is "pc-q35-2.4", which is guaranteed to have an ACPI generator. This matters because the ACPI tables (FACP, DSDT) have to reflect the PM base address that we program. Cc: Gabriel Somlo <somlo@cmu.edu> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1333238 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Gabriel Somlo <somlo@cmu.edu>
2016-05-17OvmfPkg: add and use industry standard macro PIIX4_PMBA_MASKLaszlo Ersek
We already have the identical purpose (but different value) macro for ICH9, namely ICH9_PMBASE_MASK in "OvmfPkg/Include/IndustryStandard/Q35MchIch9.h". Also, stop bit-negating signed integer constants. Cc: Gabriel Somlo <somlo@cmu.edu> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1333238 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Gabriel Somlo <somlo@cmu.edu>
2016-05-17OvmfPkg: replace PcdAcpiPmBaseAddress with PIIX4_PMBA_VALUELaszlo Ersek
In the next patches, we'll differentiate the PMBA IO port address that we program on PIIX4 vs. Q35. Normally we'd just turn PcdAcpiPmBaseAddress into a dynamic PCD. However, because we need this value in BaseRomAcpiTimerLib too (which cannot access RAM and dynamic PCDs), it must remain a build time constant. We will introduce its Q35 counterpart later. As first step, replace the PCD with a new macro in "OvmfPlatforms.h"; Jordan prefers the latter to fixed PCDs in this instance. Cc: Gabriel Somlo <somlo@cmu.edu> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1333238 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Gabriel Somlo <somlo@cmu.edu>
2016-05-17OvmfPkg/AcpiTimerLib: don't use possibly unset PMBA register (PEI phase)Laszlo Ersek
We should store the right value to the PMBA (if the PMBA needs initialization) before setting mAcpiTimerIoAddr from the PMBA. Cc: Gabriel Somlo <somlo@cmu.edu> Cc: Jordan Justen <jordan.l.justen@intel.com> Fixes: f122712b42af3d63902c2c141e90d2c200df6790 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Gabriel Somlo <somlo@cmu.edu>
2016-05-17OvmfPkg/XenBusDxe: duplicate twice-iterated VA_LIST in XenStoreVSPrint()Zenith432
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Laszlo Ersek <lersek@redhat.com> [lersek@redhat.com: add spaces before macro invocation parentheses; clean up subject line] Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2016-05-12OvmfPkg/PlatformBootManagerLib: Postpone the shell registrationGary Lin
We currently register the shell before creating the boot options for the block devices and the network devices, so the boot manager boots into the internal shell if the user doesn't specify the boot order. However, Xen doesn't support fw_cfg, so there is no way to change the boot order with the external command, and the firmware will always boot into the internal shell if the user doesn't interfere the boot process. This patch postpones the shell registration after MdeModulePkg/BDS creates all the boot options for the block and network devices, so that firmware will try to boot the block/network devices first. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2016-05-12OvmfPkg/QemuBootOrderLib: adapt Q35 SATA PMPN to UEFI spec Mantis 1353Laszlo Ersek
On the Q35 machine type of QEMU, there is no port multiplier connected to the on-board SATA controller. Therefore the AtaAtapiPassThru driver update for Mantis ticket 1353 <https://mantis.uefi.org/mantis/view.php?id=1353> changes the middle number (the Port Multiplier Port Number) in the Sata() device path nodes from 0x0 to 0xFFFF. Adapt the translation from OpenFirmware in QemuBootOrderLib. (Note: QemuBootOrderLib is deprecated at this point (see USE_OLD_BDS in the DSC files), but until we remove it, it should be kept in sync with QemuNewBootOrderLib.) Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-05-12OvmfPkg/QemuNewBootOrderLib: adapt Q35 SATA PMPN to UEFI spec Mantis 1353Laszlo Ersek
On the Q35 machine type of QEMU, there is no port multiplier connected to the on-board SATA controller. Therefore the AtaAtapiPassThru driver update for Mantis ticket 1353 <https://mantis.uefi.org/mantis/view.php?id=1353> changes the middle number (the Port Multiplier Port Number) in the Sata() device path nodes from 0x0 to 0xFFFF. Adapt the translation from OpenFirmware in QemuNewBootOrderLib. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-05-11OvmfPkg/PciHostBridgeLib: Scan for root bridges when running over XenRuiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Gary Lin <glin@suse.com>
2016-05-11OvmfPkg/PciHostBridgeLib: Change InitRootBridge prototypeRuiyu Ni
The patch re-factors the code without functionality impact. Next patch will add code to support OVMF above Xen. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-11OvmfPkg/PciHostBridgeLib: Set correct Base/Limit for absent resourceRuiyu Ni
In order to match the previous commit, Base must be strictly larger than Limit if some type of aperture is not available on a PCI root bridge. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-10OvmfPkg: Modify FDF/DSC files for RamDiskDxe's adding NFIT report featureHao Wu
The RamDiskDxe driver in MdeModulePkg now will use EFI_ACPI_TABLE_PROTOCOL and EFI_ACPI_SDT_PROTOCOL during reporting RAM disks to NVDIMM Firmware Interface Table (NFIT). A Pcd 'PcdInstallAcpiSdtProtocol' controls whether the EFI_ACPI_SDT_PROTOCOL will be produced. Its default value is set to FALSE in MdeModulePkg. To make the NFIT reporting feature working properly under OVMF, the patch will set the Pcd to TRUE in OVMF DSC files. Also, the RamDiskDxe driver will sometimes report a NVDIMM Root Device using ASL code which is put in a Secondary System Description Table (SSDT) according to the ACPI 6.1 spec. Locating the SSDT requires modifying the [Rule.Common.DXE_DRIVER] field in OVMF FDF files. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
2016-05-04OvmfPkg/OvmfPkgIa32X64.dsc: Move PcdShellFile to [PcdsFixedAtBuild.X64]Ruiyu Ni
PcdShellFile is never used in the PEI phase. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg: Use MdeModulePkg/BDSRuiyu Ni
By default the new MdeModulePkg/BDS is used. If USE_OLD_BDS is defined to TRUE, IntelFrameworkModulePkg/BDS is used. Fixes: https://github.com/tianocore/edk2/issues/62 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Remove unused C structures definitionsRuiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Fix gcc-4.8 Ia32 build failureRuiyu Ni
The Width and Height assignment suppresses an invalid gcc-4.8 warning on Ia32. These warnings look unjustified to me. Namely, near the beginning of the function, there is a while(1) loop. In that loop, ConvertBmpToGopBlt() is called unconditionally. If the call fails, the rest of the loop body is not reached (where the Height and Width variables are used -- the compiler warns about their use in the switch statement). If the call succeeds, then the variables are set. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Add EnableQuietBoot & DisableQuietBootRuiyu Ni
EnableQuietBoot and DisableQuietBoot are copied from IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c. Because these two functions are not in UefiBootManagerLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Remove unused vars and func prototypesRuiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Remove unnecessary memory testRuiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Use GetBootModeHob() in HobLibRuiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Remove PlatformBdsGetDriverOption()Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Use EfiBootManagerRefreshAllBootOption()Ruiyu Ni
The patch uses EfiBootManagerRefreshAllBootOption() to collect all boot options and uses SetBootOrderFromQemu exposed by QemuNewBootOrderLib to adjust the boot option order. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: port PlatformBdsConnectSequence to ↵Ruiyu Ni
UefiBootManagerLib The patch changes PlatformBdsConnectSequence() to use library API exposed from UefiBootManagerLib and removes the additional connect ALL action. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Remove unused local functions.Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Register boot options and hot keysRuiyu Ni
The patch registers "Enter" key as the continue key (hot key to skip the boot timeout wait), maps "F2" key to UI, and registers Shell boot option. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Do not launch Boot Manager MenuRuiyu Ni
MdeModulePkg/BDS doesn't launch UI (Boot Manager Menu) from platform side. The change removes the code which launches the UI but still set the boot timeout. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Init console vars in *BeforeConsole()Ruiyu Ni
The major difference between IntelFrameworkModulePkg/BDS and MdeModulePkg/BDS is the latter connects the consoles in core code while the former connects in platform code. The change initializes the console variables in PlatformBootManagerBeforeConsole() and removes the console connection code. It also removes unused functions: PlatformBdsNoConsoleAction() and LockKeyboards(). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Use ConvertDevicePathToText()Ruiyu Ni
The DevicePathToStr() function (in "IntelFrameworkModulePkg/Library/GenericBdsLib/DevicePath.c") is a simple wrapper around ConvertDevicePathToText(). DevicePathToStr() passes DisplayOnly=TRUE and AllowShortcuts=TRUE to ConvertDevicePathToText(), whereas in this patch, both parameters are flipped to FALSE. The formatted devpaths are used only for debugging purposes, so this change is safe. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: link to UefiBootManagerLibRuiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: use EfiBootManagerUpdateConsoleVariableRuiyu Ni
Call EfiBootManagerUpdateConsoleVariable in UefiBootManagerLib instead of BdsLibUpdateConsoleVariable in GenericBdsLib. Still cannot pass build. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformBootManagerLib: Follow PlatformBootManagerLib interfacesRuiyu Ni
Change the function name to follow new library class PlatformBootManagerLib interfaces. NOTE: There is no progress bar during BDS timeout waiting. In order to show the progress bar, PlatformBootManagerWaitCallback () needs to change to draw it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg: Duplicate PlatformBdsLib to PlatformBootManagerLibRuiyu Ni
It will be changed to build with MdeModulePkg/BDS. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/QemuNewBootOrderLib: Build with UefiBootManagerLibRuiyu Ni
NOTE: SetBootOrderFromQemu() interface is not changed. But when the old IntelFrameworkModulePkg/BDS is no longer used in OVMF and ArmVirtPkg, additional patch will be submitted to change this interface to remove parameter BootOptionList. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg: Duplicate QemuBootOrderLib to QemuNewBootOrderLibRuiyu Ni
QemuNewBootOrderLib will be changed to work with MdeModulePkg/BDS. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-05-04OvmfPkg/PlatformPei: Add memory above 4GB as testedRuiyu Ni
Since PlatformBootManagerLib do not run memory test to convert untested memory to tested. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-04-28OvmfPkg: PlatformBdsLib: lock down SMM regardless of S3Laszlo Ersek
At the moment, the EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL is only installed if S3 is enabled -- at the end of SaveS3BootScript(). While a runtime OS is never booted with SMM unlocked (because the SMM IPL locks down SMM as a last resort: > SMM IPL! DXE SMM Ready To Lock Protocol not installed before Ready To > Boot signal > SmmInstallProtocolInterface: [EfiSmmReadyToLockProtocol] 0 > Patch page table start ... > Patch page table done! > SMM IPL locked SMRAM window ), we shouldn't allow UEFI drivers and applications either to mess with SMM just because S3 is disabled. So install EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL in PlatformBdsInit() unconditionally. Cc: Feng Tian <feng.tian@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-04-28OvmfPkg: PlatformBdsLib: lock down SMM in PlatformBdsInit()Laszlo Ersek
OVMF's PlatformBdsLib currently makes SMM vulnerable to the following attack: (1) a malicious guest OS copies a UEFI driver module to the EFI system partition, (2) the OS adds the driver as a Driver#### option, and references it from DriverOrder, (3) at next boot, the BdsEntry() function in "IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c" processes Driver#### and DriverOrder between the calls to PlatformBdsInit() and PlatformBdsPolicyBehavior(), (4) OVMF locks down SMM only in PlatformBdsPolicyBehavior(), hence the driver runs with SMM unlocked. The BdsEntry() function of the MdeModulePkg BDS driver (in file "MdeModulePkg/Universal/BdsDxe/BdsEntry.c") recommends to "Signal ReadyToLock event" in PlatformBootManagerBeforeConsole() -- which corresponds to PlatformBdsInit() --, not in PlatformBootManagerAfterConsole() -- which corresponds to PlatformBdsPolicyBehavior(). Albeit an independent question, but it's worth mentioning: this patch also brings OvmfPkg's PlatformBdsInit() closer to ArmVirtPkg's. Namely, the latter signals End-of-Dxe in PlatformBdsInit() already. Cc: Feng Tian <feng.tian@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-04-26OvmfPkg: SataControllerDxe: SataControllerStop: fix use after freeLaszlo Ersek
It would be possible to remove the UAF without local variables, by calling SataPrivateData->PciIo->Attributes() before releasing SataPrivateData. However, by keeping the location of the call (for which temporary variables are necessary), we continue to match the error path logic in SataControllerStart(), which is always recommended. Reported-by: wang xiaofeng <winggundum82@163.com> Fixes: bcab71413407e61c144994925556725dd65eede9 Cc: wang xiaofeng <winggundum82@163.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-04-26OvmfPkg: SataControllerDxe: SataControllerStop: remove useless null checkLaszlo Ersek
"ASSERT (SataPrivateData != NULL)" is just a few lines higher up. Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-04-19OvmfPkg: AcpiPlatformDxe: Don't enable unsupported PCI attributesVolker Rümelin
Current code in PciEnableDecoding tries to unconditionally enable EFI_PCI_IO_ATTRIBUTE_IO and EFI_PCI_IO_ATTRIBUTE_MEMORY even if they are unsupported attributes. This fails on devices which don't support both attributes. This patch masks out unsupported attributes. Information to reproduce the bug. Host lspci -s 0000:04:00.0 -vnn: 04:00.0 USB controller [0c03]: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller [1912:0014] (rev 03) (prog-if 30 [XHCI]) Flags: fast devsel, IRQ 19 Memory at ef900000 (64-bit, non-prefetchable) [size=8K] Capabilities: [50] Power Management version 3 Capabilities: [70] MSI: Enable- Count=1/8 Maskable- 64bit+ Capabilities: [90] MSI-X: Enable- Count=8 Masked- Capabilities: [a0] Express Endpoint, MSI 00 Capabilities: [100] Advanced Error Reporting Capabilities: [150] Latency Tolerance Reporting Kernel driver in use: pci-stub Kernel modules: xhci_pci libvirt xml: <hostdev mode='subsystem' type='pci' managed='yes'> <driver name='vfio'/> <source> <address domain='0x0000' bus='0x04' slot='0x00' function='0'/> </source> <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0'/> </hostdev> OVMF debug log with additional DEBUG statement: OnRootBridgesConnected: root bridges have been connected, installing ACPI tables Select Item: 0x19 EnablePciDecoding: GetLocation: D=0000:00:00.0 OrigAttr=0000000000004000 SuppAttr=000000000000E700 EnablePciDecoding: GetLocation: D=0000:00:10.0 OrigAttr=0000000000004000 SuppAttr=000000000000E700 EnablePciDecoding: GetLocation: D=0000:00:11.0 OrigAttr=0000000000004000 SuppAttr=000000000000E600 EnablePciDecoding: EfiPciIoAttributeOperationEnable: Unsupported Select Item: 0x28 Select Item: 0x19 Select Item: 0x2A Select Item: 0x19 Select Item: 0x27 InstallQemuFwCfgTables: installed 6 tables Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
2016-04-13OvmfPkg/XenIoMmioLib: add missing MemoryAllocationLib dependency to INFArd Biesheuvel
XenIoMmioLib depends on MemoryAllocationLib, and uses its header, but failed to declare the dependency in its INF. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-04-07OvmfPkg: remove PciHostBridgeDxe forkLaszlo Ersek
This driver is now unused. Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-04-07OvmfPkg: remove USE_OLD_PCI_HOST build optionLaszlo Ersek
It's been a month since the following commits appeared in the repo: 4014885ffdfa8 OvmfPkg: switch to MdeModulePkg/Bus/Pci/PciHostBridgeDxe c47ed6fcb5e60 OvmfPkg: match PCI config access to machine type (if not USE_OLD_PCI_HOST) in which we introduced the USE_OLD_PCI_HOST fallback, and made other work depend on it. I have not heard of any problems (primarily from the vfio-users group that uses Gerd's daily / hourly OVMF builds), so it's time to drop the fallback. Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-04-07OvmfPkg: Convert to using FatPkg in the EDK II treeJordan Justen
Now that FatPkg is open source (and therefore can be included in the EDK II tree) we build and use it directly. Build tested with GCC 5.3 on IA32 and X64. Boot tested to UEFI Shell on IA32 and UEFI Linux on X64. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-04-07OvmfPkg: Retire AcpiS3SaveDxeStar Zeng
The same functional code has been in S3SaveStateDxe, OVMF AcpiS3SaveDxe can be retired now. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
2016-04-07OvmfPkg: Install LockBox protocol in constructor of LockBoxDxeLibStar Zeng
Currently, the LockBox protocol is installed in entrypoint of OVMF AcpiS3SaveDxe. We can let the first driver run with LockBoxDxeLib linked to have its library constructor to install LockBox protocol on the ImageHandle. As other drivers may have gEfiLockBoxProtocolGuid dependency, the first driver should run before them. The later patches to retire AcpiS3SaveDxe for OVMF depends on this patch. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-04-07OvmfPkg: Set PcdAcpiS3Enable according to QemuFwCfgS3Enabled()Star Zeng
Also need to declare PcdAcpiS3Enable as DynamicDefault in *.dsc. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>