diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf index 5ce4c0b52b3..aa8f67dec95 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf +++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf @@ -54,3 +54,10 @@ 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 bd3800c1d65..7c193767259 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -38,7 +38,6 @@ 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 @@ 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 @@ 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 @@ 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 db393d47bce..52ae1e5b65c 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.fdf +++ b/Platform/RaspberryPi/RPi4/RPi4.fdf @@ -51,11 +51,7 @@ NumBlocks = 0x200 # 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 74afc0f8945..758d0124a6c 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.