diff options
author | Pete Batard <pete@akeo.ie> | 2020-02-28 10:38:53 +0000 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2020-03-02 12:12:44 +0100 |
commit | 223bfea624cf39b9a2026465f52cde4d07c69082 (patch) | |
tree | d1070d7e85ba07842dea2bfcc41b4df9e4acdd2d | |
parent | 3627ffcf8ae6a0d4f6ab042eacf613ae42a028a1 (diff) |
Platform/RPi4: Prepare ACPI code for factorization
* Update the OEM IDs and base revision numbers.
* Move RPI_SYSTEM_TIMER_BASE_ADDRESS to AcpiTables.h.
* Add RPi3 constants and conditional blocks according to model.
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rw-r--r-- | Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h | 48 | ||||
-rw-r--r-- | Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl | 4 | ||||
-rw-r--r-- | Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc | 1 | ||||
-rw-r--r-- | Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc | 15 |
4 files changed, 61 insertions, 7 deletions
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h index 3d1737ae..0b8a8494 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h +++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h @@ -1,7 +1,8 @@ /** @file
*
- * RPi4 defines for constructing ACPI tables
+ * RPi defines for constructing ACPI tables
*
+ * Copyright (c) 2020, Pete Batard <pete@akeo.ie>
* Copyright (c) 2019, ARM Ltd. All rights reserved.
* Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23,11 +24,15 @@ CreateDwordField (^BufName, ^MemName._BAS, VarName) \
Add (BCM2836_SOC_REGISTERS, Offset, VarName)
-#define EFI_ACPI_OEM_ID {'M','C','R','S','F','T'} // OEMID 6 bytes long
-#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','4','E','D','K','2') // OEM table id 8 bytes long
-#define EFI_ACPI_OEM_REVISION 0x02000820
-#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('R','P','I','4')
-#define EFI_ACPI_CREATOR_REVISION 0x00000097
+#if (RPI_MODEL == 3)
+#define EFI_ACPI_OEM_ID {'B','C','2','8','3','6'}
+#else
+#define EFI_ACPI_OEM_ID {'M','C','R','S','F','T'}
+#endif
+#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','_','E','D','K','2')
+#define EFI_ACPI_OEM_REVISION 0x00000100
+#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('E','D','K','2')
+#define EFI_ACPI_CREATOR_REVISION 0x00000100
#define EFI_ACPI_VENDOR_ID SIGNATURE_32 ('M','S','F','T')
@@ -52,6 +57,12 @@ #define RPI_DMA_CHANNEL_COUNT 10 // All 10 DMA channels are listed, including the reserved ones
#define RPI_DMA_USED_CHANNEL_COUNT 5 // Use 5 DMA channels
+#if (RPI_MODEL == 3)
+#define RPI_SYSTEM_TIMER_BASE_ADDRESS 0x4000001C
+#elif (RPI_MODEL == 4)
+#define RPI_SYSTEM_TIMER_BASE_ADDRESS 0xFF80001C
+#endif
+
#define EFI_ACPI_5_1_CSRT_REVISION 0x00000000
typedef enum
@@ -100,6 +111,30 @@ typedef struct //------------------------------------------------------------------------
// Interrupts. These are specific to each platform
//------------------------------------------------------------------------
+#if (RPI_MODEL == 3)
+#define BCM2836_V3D_BUS_INTERRUPT 0x2A
+#define BCM2836_DMA_INTERRUPT 0x3B
+#define BCM2836_SPI1_INTERRUPT 0x3D
+#define BCM2836_SPI2_INTERRUPT 0x3D
+#define BCM2836_HVS_INTERRUPT 0x41
+#define BCM2836_HDMI0_INTERRUPT 0x48
+#define BCM2836_HDMI1_INTERRUPT 0x49
+#define BCM2836_PV2_INTERRUPT 0x4A
+#define BCM2836_PV0_INTERRUPT 0x4D
+#define BCM2836_PV1_INTERRUPT 0x4E
+#define BCM2836_MBOX_INTERRUPT 0x61
+#define BCM2836_VCHIQ_INTERRUPT 0x62
+#define BCM2386_GPIO_INTERRUPT0 0x51
+#define BCM2386_GPIO_INTERRUPT1 0x53
+#define BCM2836_I2C1_INTERRUPT 0x55
+#define BCM2836_I2C2_INTERRUPT 0x55
+#define BCM2836_SPI0_INTERRUPT 0x56
+#define BCM2836_USB_INTERRUPT 0x29
+#define BCM2836_SDHOST_INTERRUPT 0x58
+#define BCM2836_MMCHS1_INTERRUPT 0x5E
+#define BCM2836_MINI_UART_INTERRUPT 0x3D
+#define BCM2836_PL011_UART_INTERRUPT 0x59
+#elif (RPI_MODEL == 4)
#define BCM2836_V3D_BUS_INTERRUPT 0x2A
#define BCM2836_DMA_INTERRUPT 0x3B
#define BCM2836_SPI1_INTERRUPT 0x3D
@@ -124,5 +159,6 @@ typedef struct #define BCM2836_PL011_UART_INTERRUPT 0x99
#define GENET_INTERRUPT0 0xBD
#define GENET_INTERRUPT1 0xBE
+#endif
#endif // __ACPITABLES_H__
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl index 52cd5312..4a6fa637 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl @@ -31,7 +31,9 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2) {
include ("Sdhc.asl")
include ("Pep.asl")
+#if (RPI_MODEL == 4)
include ("Xhci.asl")
+#endif
Device (CPU0)
{
@@ -286,6 +288,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2) }
}
+#if (RPI_MODEL == 4)
Device (ETH0)
{
Name (_HID, "BCM6E4E")
@@ -314,6 +317,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2) }
})
}
+#endif
// Description: I2C
Device (I2C1)
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc index 7c2aa938..8453e487 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc @@ -14,7 +14,6 @@ #include "AcpiTables.h"
-#define RPI_SYSTEM_TIMER_BASE_ADDRESS 0xFF80001C
#define RPI_GTDT_GLOBAL_FLAGS 0
#define RPI_GTDT_GTIMER_FLAGS EFI_ACPI_5_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc index f847a931..4029cd19 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc @@ -23,7 +23,9 @@ typedef struct {
EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
EFI_ACPI_5_1_GIC_STRUCTURE GicInterfaces[4];
+#if (RPI_MODEL != 3)
EFI_ACPI_5_1_GIC_DISTRIBUTOR_STRUCTURE GicDistributor;
+#endif
} PI_MULTIPLE_APIC_DESCRIPTION_TABLE;
#pragma pack ()
@@ -42,6 +44,16 @@ PI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = { 0, // Flags
},
{
+#if (RPI_MODEL == 3)
+ EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
+ 0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
+ EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
+ 1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
+ EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
+ 2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
+ EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
+ 3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
+#elif (RPI_MODEL == 4)
EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, 48, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
0xFF846000, 0xFF844000, 0x19, 0),
@@ -54,8 +66,11 @@ PI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = { EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, 51, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
0xFF846000, 0xFF844000, 0x19, 0),
+#endif
},
+#if (RPI_MODEL != 3)
EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet64 (PcdGicDistributorBase), 0)
+#endif
};
//
|