This is RFC for UEFI implementation for new machine based on Qemu Virt which is
faithful as possible to real hardware. In opposition to existing Qemu Virt
machine which is suited for performing workloads, the purpose of this machine
is development of firmware and OS for AARCH64 server alike platforms (like in
situation where real HW is not available yet or the debugging is easier to
control under emulation). The SBSAQemu name, was chosen because the modeled HW
is aimed to follow way that server-style armv8 machines are recommended to be
set up.
Implementation does not use fw-cfg nor DT provided by Qemu.
This patch is provided as presentation for progress, not functional UEFI
implementation. You cannot boot system at current state.
To mention just few missing features:
- Qemu <-> ATF <-> UEFI communication channel for dynamic parameters like DRAM size
- Related dynamic initialization in UEFI is for now with static PCD's
- ACPI platform driver
- SMBIOS Support
Implementation support sbsa-ref machine which is also work in progress.
The provided patch is compatible with V3 of Qemu patches:
"[PATCH v3] hw/arm: Add arm SBSA reference machine" by Hongbo Zhang:
Compatible Qemu code can be also found in repo:
https://git.linaro.org/people/hongbo.zhang/qemu-enterprise.git/
branch sbsa-v3.0.0 1e47e69c69
The most recent v5 patches contains memory map change which is not compatible
with provided UEFI code at this momment.
The compatible ATF code can be downloaded from:
ssh://git@git.linaro.org/people/radoslaw.biernacki/atf.git
branch wip_rad_sbsa_continue 05b8dfb7
For compilation of ATF code please follow atf/docs/plat/sbsa.rst
The compilation of edk2-platforms follows usual way described in
edk2-platform/Readme.md. The only change is that SBSAQemu requires
that ATF images (bl1.bin and fip.bin) need to be copied to workspace directory.
To compile issue following command seqence from workspace dir:
$ export WORKSPACE=$PWD
$ export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms
$ make -C edk2/BaseTools
$ export GCC5_AARCH64_PREFIX=aarch64-linux-gnu-
$ . edk2/edksetup.sh
$ build -n 4 -b DEBUG -a AARCH64 -t GCC5 -p edk2-platforms/Platform/SBSAQemu/SBSAQemu.dsc
The resulting SBSA_FLASH0.fd file will contain secure flash0 image (ATF code).
The SBSA_FLASH1.fd will contain non-secure UEFI code and UEFI variables.
As Qemu expects both files to be specific size those files need a trim by:
truncate -s 67108864 SBSA_FLASH0.fd (this issue will be fixed in following patches)
Similar instruction how to build ATF and EDK2 for SBSAQemu can be
found in atf/docs/plat/sbsa.rst
For testing author used following command sequence issued from workspace dir:
$ cp Build/SBSAQemu-AARCH64/DEBUG_GCC5/FV/SBSA_FLASH[01].fd .
$ truncate -s 67108864 SBSA_FLASH0.fd
$ truncate -s 67108864 SBSA_FLASH1.fd
$ qemu_inst/bin/qemu-system-aarch64 -m 1024 -cpu cortex-a57 -M sbsa-ref,secure=on -pflash SBSA_FLASH0.fd -pflash SBSA_FLASH1.fd -serial stdio -hda disk1.img
Where disk1.img is disk image with EFI compatible partition layout.
In case you provide Linux with GRUB you should be able to see working Qemu
emulated VGA with list of boot options. The proper boot requires future work on
mentioned missing features.
Please provide feedback which might be helpfull for future development.
Radoslaw Biernacki (1):
SBSAQemu: Initial implementation for QemuSBSA
Silicon/Qemu/SBSAQemuPkg.dec | 45 ++
Platform/SBSAQemu/SBSAQemu.dsc | 807 ++++++++++++++++++++
Platform/SBSAQemu/SBSAQemu.fdf | 368 +++++++++
Silicon/Qemu/Drivers/SBSAQemuPlatformDxe/SBSAQemuPlatformDxe.inf | 47 ++
Silicon/Qemu/Library/SBSANorFlashQemuLib/SBSANorFlashQemuLib.inf | 35 +
Silicon/Qemu/Library/SBSAPciHostBridgeLib/SBSAPciHostBridgeLib.inf | 44 ++
Silicon/Qemu/Library/SBSAQemuLib/SBSAQemuLib.inf | 54 ++
Silicon/Qemu/Drivers/SBSAQemuPlatformDxe/SBSAQemuPlatformDxe.c | 61 ++
Silicon/Qemu/Library/SBSANorFlashQemuLib/SBSANorFlashQemuLib.c | 45 ++
Silicon/Qemu/Library/SBSAPciHostBridgeLib/SBSAPciHostBridgeLib.c | 201 +++++
Silicon/Qemu/Library/SBSAQemuLib/SBSAQemuLib.c | 148 ++++
Silicon/Qemu/Library/SBSAQemuLib/SBSAQemuMem.c | 109 +++
Silicon/Qemu/Library/SBSAQemuLib/SBSAQemuHelper.S | 63 ++
13 files changed, 2027 insertions(+)
create mode 100644 Silicon/Qemu/SBSAQemuPkg.dec
create mode 100644 Platform/SBSAQemu/SBSAQemu.dsc
create mode 100644 Platform/SBSAQemu/SBSAQemu.fdf
create mode 100644 Silicon/Qemu/Drivers/SBSAQemuPlatformDxe/SBSAQemuPlatformDxe.inf
create mode 100644 Silicon/Qemu/Library/SBSANorFlashQemuLib/SBSANorFlashQemuLib.inf
create mode 100644 Silicon/Qemu/Library/SBSAPciHostBridgeLib/SBSAPciHostBridgeLib.inf
create mode 100644 Silicon/Qemu/Library/SBSAQemuLib/SBSAQemuLib.inf
create mode 100644 Silicon/Qemu/Drivers/SBSAQemuPlatformDxe/SBSAQemuPlatformDxe.c
create mode 100644 Silicon/Qemu/Library/SBSANorFlashQemuLib/SBSANorFlashQemuLib.c
create mode 100644 Silicon/Qemu/Library/SBSAPciHostBridgeLib/SBSAPciHostBridgeLib.c
create mode 100644 Silicon/Qemu/Library/SBSAQemuLib/SBSAQemuLib.c
create mode 100644 Silicon/Qemu/Library/SBSAQemuLib/SBSAQemuMem.c
create mode 100644 Silicon/Qemu/Library/SBSAQemuLib/SBSAQemuHelper.S
--
2.14.1