[edk2-devel] [edk2-platforms][PATCH 3/4] Platform/RPi3: Enable the use of DualSerialPortLib

Pete Batard posted 4 patches 6 years ago
[edk2-devel] [edk2-platforms][PATCH 3/4] Platform/RPi3: Enable the use of DualSerialPortLib
Posted by Pete Batard 6 years ago
Note that, for the time being, the TF-A binary only outputs to the
miniUART, but work is underway to add runtime UART detection to TF-A,
after which we will use such a binary.

Also note that this patch currently enforces the use of miniUART in
the ACPI tables, as we have to pick one until we can switch to using
DynamicTablesPkg/ConfigurationManagerDxe for ACPI generation.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/RPi3/RPi3.dsc  | 15 +++++++++------
 Platform/RaspberryPi/RPi3/Readme.md |  7 +++++++
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
index 2368b04f40a4..40fb0879c2ed 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dsc
+++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -114,10 +114,10 @@ [LibraryClasses.common]
   ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf
   ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
 
-  PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
-  PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
-  PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
-  SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
+  # Dual serial port library
+  PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf
+  PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
+  SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSerialPortLib.inf
 
   # Cryptographic libraries
   IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -379,14 +379,17 @@ [PcdsFixedAtBuild.common]
   #
   gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x3f000000
 
-  ## NS16550 compatible UART
-  gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3f215040
+  # UARTs
+  gArmPlatformTokenSpaceGuid.PL011UartInteger|0
+  gArmPlatformTokenSpaceGuid.PL011UartFractional|0
+  gArmPlatformTokenSpaceGuid.PL011UartClkInHz|48000000
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|500000000
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|0x27
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|8
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|0
 
   ## Default Terminal Type
   ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
diff --git a/Platform/RaspberryPi/RPi3/Readme.md b/Platform/RaspberryPi/RPi3/Readme.md
index 797da1bab4a9..58c0124ef75e 100644
--- a/Platform/RaspberryPi/RPi3/Readme.md
+++ b/Platform/RaspberryPi/RPi3/Readme.md
@@ -52,6 +52,13 @@ Build instructions from the top level edk2-platforms Readme.md apply.
   armstub=RPI_EFI.fd
   disable_commandline_tags=1
   ```
+  Additionally, if you want to use PL011 instead of the miniUART, you can add the lines:
+  ```
+  device_tree_address=0x20000
+  device_tree_end=0x30000
+  device_tree=bcm2710-rpi-3-b[-plus].dtb
+  dtoverlay=miniuart-bt
+  ```
 5. Insert the uSD card and power up the Pi.
 
 Note that if you have a model 3+ or a model 3 where you enabled USB boot through OTP
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#53510): https://edk2.groups.io/g/devel/message/53510
Mute This Topic: https://groups.io/mt/70222631/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-