summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2020-02-28 10:38:50 +0000
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2020-03-02 12:12:33 +0100
commit76b2f7b6748b9e74e3386368e14d64d03b1cf871 (patch)
treeffcef23bea0695cc5b8a583d7a522fff62a5839e
parente15f93fc22b121be9af7c2bbf6079cb9b80b3533 (diff)
Platform/RPi4: Add RPI_MODEL constant and replace PL011_ENABLE
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@akeo.ie> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rw-r--r--Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf7
-rw-r--r--Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc2
-rw-r--r--Platform/RaspberryPi/RPi4/AcpiTables/Spcr.aslc3
-rw-r--r--Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl2
-rw-r--r--Platform/RaspberryPi/RPi4/RPi4.dsc4
5 files changed, 8 insertions, 10 deletions
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
index 358c315b..c95d75ed 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
@@ -56,10 +56,3 @@
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 dcad8e20..c3d5994f 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 cb17fbe0..bec4ad66 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 ad9d21e6..1be28522 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 7c193767..09bd19e3 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -229,6 +229,10 @@
###################################################################################################
[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