[edk2-devel] [edk2-platforms][PATCH 10/15] Platform/RPi4: Add RPI_MODEL constant and replace PL011_ENABLE

Pete Batard pete at akeo.ie
Fri Feb 28 10:38:50 UTC 2020


Since there are multiple Raspberry Pi Models and a lot of the code we use
can be factorized, it is useful to have an RPI_MODEL build time constant,
set to the platform model number, that can be referenced in the source.

Make use this new constant to replace the PL011_ENABLE feature check.

Signed-off-by: Pete Batard <pete at akeo.ie>
---
 Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf | 7 -------
 Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc      | 2 +-
 Platform/RaspberryPi/RPi4/AcpiTables/Spcr.aslc      | 3 ++-
 Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl       | 2 +-
 Platform/RaspberryPi/RPi4/RPi4.dsc                  | 4 ++++
 5 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
index 358c315b6da1..c95d75ed01bb 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
@@ -56,10 +56,3 @@ [FixedPcd]
   gBcmNetTokenSpaceGuid.PcdBcmGenetRegistersAddress
   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/AcpiTables/Dbg2.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc
index dcad8e205596..c3d5994f8e97 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc
@@ -23,7 +23,7 @@
 #define RPI_DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS    1
 #define RPI_DBG2_NAMESPACESTRING_FIELD_SIZE             10
 
-#ifdef PL011_ENABLE
+#if (RPI_MODEL == 4)
 #define RPI_UART_INTERFACE_TYPE                         EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART
 #define RPI_UART_BASE_ADDRESS                           BCM2836_PL011_UART_BASE_ADDRESS
 #define RPI_UART_LENGTH                                 BCM2836_PL011_UART_LENGTH
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.aslc
index cb17fbe0ff2f..bec4ad660ec9 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.aslc
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.aslc
@@ -18,7 +18,8 @@
 
 #define RPI_UART_FLOW_CONTROL_NONE           0
 
-#ifdef PL011_ENABLE
+// Prefer PL011 serial output on the Raspberry Pi 4
+#if (RPI_MODEL == 4)
 #define RPI_UART_INTERFACE_TYPE              EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART
 #define RPI_UART_BASE_ADDRESS                BCM2836_PL011_UART_BASE_ADDRESS
 #define RPI_UART_INTERRUPT                   BCM2836_PL011_UART_INTERRUPT
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
index ad9d21e6272d..1be285220ad7 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
@@ -140,7 +140,7 @@ Device(BTH0)
                        //   no flow control.
         16,            // ReceiveBufferSize
         16,            // TransmitBufferSize
-#ifdef PL011_ENABLE
+#if (RPI_MODEL == 4)
         "\\_SB.URTM",  // ResourceSource:
 #else
         "\\_SB.URT0",  // ResourceSource:
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
index 7c1937672597..09bd19e3b724 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -229,6 +229,10 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER]
 ###################################################################################################
 
 [BuildOptions]
+  GCC:*_*_*_CC_FLAGS          = -DRPI_MODEL=4
+  GCC:*_*_*_ASLPP_FLAGS       = -DRPI_MODEL=4
+  GCC:*_*_*_ASLCC_FLAGS       = -DRPI_MODEL=4
+  GCC:*_*_*_VFRPP_FLAGS       = -DRPI_MODEL=4
   GCC:*_*_AARCH64_DLINK_FLAGS = -Wl,--fix-cortex-a53-843419
   GCC:RELEASE_*_*_CC_FLAGS    = -DMDEPKG_NDEBUG -DNDEBUG
 
-- 
2.21.0.windows.1


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

View/Reply Online (#55073): https://edk2.groups.io/g/devel/message/55073
Mute This Topic: https://groups.io/mt/71605849/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list