With DualSerialPortLib available, we can remove the PL011_ENABLE
option and use this library instead of being tied to selecting only
one of PL011SerialPortLib or BaseSerialPortLib16550.
Note that, for the time being, we choose to default to selecting the
PL011 based TF-A binary, since we have to pick one and we expect that
most usage of the firmware will be for a PL011 configuration (we of
course validated that the only drawback of using PL011 with a miniUART
configuration the loss of the 2 lines of serial debug output from TF-A
on startup and that there was no other issue besides that), but work
is underway to add runtime UART detection to TF-A, after which we will
revert to using a single TF-A binary that supports both UARTs.
Also note that this patch currently enforces the use of PL011 for the
ACPI tables, as we also have to pick one until we can switch to using
DynamicTablesPkg/ConfigurationManagerDxe for ACPI generation, which
we should do in a future update, and which will enable us to update
the ACPI tables at runtime according to the user-selected UART.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf | 7 ++++++
Platform/RaspberryPi/RPi4/RPi4.dsc | 26 +++-----------------
Platform/RaspberryPi/RPi4/RPi4.fdf | 4 ---
Platform/RaspberryPi/RPi4/Readme.md | 21 ++++------------
4 files changed, 15 insertions(+), 43 deletions(-)
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
index 5ce4c0b52b32..aa8f67dec95e 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
@@ -54,3 +54,10 @@ [FixedPcd]
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
+
+# The following is a stopgap solution to default to PL011
+# usage in ACPI (most common case), until we can switch
+# to using DynamicTablesPkg/ConfigurationManagerDxe.
+[BuildOptions]
+ GCC:*_*_*_ASLPP_FLAGS = -DPL011_ENABLE
+ GCC:*_*_*_ASLCC_FLAGS = -DPL011_ENABLE
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
index bd3800c1d653..7c1937672597 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -38,7 +38,6 @@ [Defines]
DEFINE SECURE_BOOT_ENABLE = FALSE
DEFINE INCLUDE_TFTP_COMMAND = FALSE
DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
- DEFINE PL011_ENABLE = FALSE
DEFINE ACPI_BASIC_MODE_ENABLE = FALSE
################################################################################
@@ -118,16 +117,10 @@ [LibraryClasses.common]
ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf
ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
-!if $(PL011_ENABLE) == TRUE
+ # Dual serial port library
PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf
PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
- SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
-!else
- PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
- PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
- PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
- SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
-!endif
+ SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSerialPortLib.inf
# Cryptographic libraries
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -239,12 +232,6 @@ [BuildOptions]
GCC:*_*_AARCH64_DLINK_FLAGS = -Wl,--fix-cortex-a53-843419
GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG -DNDEBUG
-!if $(PL011_ENABLE) == TRUE
- GCC:*_*_*_CC_FLAGS = -DPL011_ENABLE
- GCC:*_*_*_ASLPP_FLAGS = -DPL011_ENABLE
- GCC:*_*_*_ASLCC_FLAGS = -DPL011_ENABLE
-!endif
-
[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
@@ -410,22 +397,15 @@ [PcdsFixedAtBuild.common]
gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioLen|0x3ffffff
gBcm27xxTokenSpaceGuid.PcdBcm27xxPciCpuMmioAdr|0x600000000
-!if $(PL011_ENABLE) == TRUE
- ## PL011 UART
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0xfe201000
+ # UARTs
gArmPlatformTokenSpaceGuid.PL011UartInteger|0
gArmPlatformTokenSpaceGuid.PL011UartFractional|0
gArmPlatformTokenSpaceGuid.PL011UartClkInHz|48000000
-!else
- ## NS16550 compatible UART
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0xfe215040
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|500000000
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|0x27
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|8
-!endif
-
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|0
diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf b/Platform/RaspberryPi/RPi4/RPi4.fdf
index db393d47bcea..52ae1e5b65cb 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.fdf
+++ b/Platform/RaspberryPi/RPi4/RPi4.fdf
@@ -51,11 +51,7 @@ [FD.RPI_EFI]
# ATF primary boot image
#
0x00000000|0x00020000
-!if $(PL011_ENABLE) == TRUE
FILE = Platform/RaspberryPi/$(PLATFORM_NAME)/TrustedFirmware/bl31_pl011.bin
-!else
-FILE = Platform/RaspberryPi/$(PLATFORM_NAME)/TrustedFirmware/bl31_miniuart.bin
-!endif
#
# DTB.
diff --git a/Platform/RaspberryPi/RPi4/Readme.md b/Platform/RaspberryPi/RPi4/Readme.md
index 74afc0f89451..758d0124a6cf 100644
--- a/Platform/RaspberryPi/RPi4/Readme.md
+++ b/Platform/RaspberryPi/RPi4/Readme.md
@@ -20,8 +20,8 @@ following __major__ limitations:
missing/incomplete ACPI tables as well as other factors. For Linux, using
the `ACPI_BASIC_MODE_ENABLE` build option may help.
- Serial I/O from the OS may not work due to CPU throttling affecting the
- miniUART baudrate. This can be worked around by using the `PL011_ENABLE`
- compilation option.
+ miniUART baudrate. This can be worked around by using the PL011 UART
+ through the device tree overlays.
# Building
@@ -32,11 +32,6 @@ The following additional build options are also available:
ACPI (by disabling the Device Tree driver altogether). This may be required
to boot Operating Systems such as Linux on account of the current PCIe/xHCI
limitations.
-- `-D PL011_ENABLE=1`: Selects PL011 for the serial console instead of the
- miniUART (default). This doesn't change the GPIO pinout for the UART but
- can be useful if you find that the miniUART baud rate changes when the
- OS throttles the CPU. Note that this requires one of `disable-bt.dtbo` or
- `miniuart-bt.dtbo` overlays to have been applied (see below).
# Booting the firmware
@@ -48,27 +43,21 @@ The following additional build options are also available:
- `start4.elf`
- `overlays/miniuart-bt.dbto` or `overlays/disable-bt.dtbo` (Optional)
4. Create a `config.txt` with the following content:
- - For a firmware **without** the `PL011_ENABLE` build option:
```
arm_64bit=1
enable_uart=1
- core_freq=250
enable_gic=1
armstub=RPI_EFI.fd
disable_commandline_tags=1
```
- - For a firmware **with** the `PL011_ENABLE` build option:
+ Additionally, if you want to use PL011 instead of the miniUART, you can add the lines:
```
- arm_64bit=1
- enable_gic=1
- armstub=RPI_EFI.fd
- disable_commandline_tags=1
device_tree_address=0x20000
device_tree_end=0x30000
device_tree=bcm2711-rpi-4-b.dtb
dtoverlay=miniuart-bt
```
- The above also requires `miniuart-bt.dbto` to have been copied into an `overlays/`
+ Note that doing so requires `miniuart-bt.dbto` to have been copied into an `overlays/`
directory on the uSD card. Alternatively, you may use `disable-bt` instead of
`miniuart-bt` if you don't require BlueTooth.
5. Insert the uSD card and power up the Pi.
@@ -80,7 +69,7 @@ The following additional build options are also available:
The TF-A binaries were compiled from a TF-A source over which 2 serial-output related
patches were applied, the first one to fix the miniUART baud rate not being properly
set to 115200 bauds with recent versions of `start4.elf` and the second one to allow
-swicthing between miniUART and PL011 at build time.
+the use of the PL011 UART.
No other alterations to the official source have been applied.
--
2.21.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#53511): https://edk2.groups.io/g/devel/message/53511
Mute This Topic: https://groups.io/mt/70222632/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.