From: "Pete Batard" <pete@akeo.ie>
To: devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, leif@nuviainc.com, philmd@redhat.com
Subject: [edk2-platforms][PATCH 13/15] Platform/RPi4: Prepare ACPI code for factorization
Date: Fri, 28 Feb 2020 10:38:53 +0000 [thread overview]
Message-ID: <20200228103855.11352-14-pete@akeo.ie> (raw)
In-Reply-To: <20200228103855.11352-1-pete@akeo.ie>
* 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>
---
Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h | 48 +++++++++++++++++---
Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl | 4 ++
Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc | 1 -
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 3d1737aed41a..0b8a8494450c 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 e1ddb742376a..c2775088b5a2 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 7c2aa9389456..8453e487fb63 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 f847a9310ff7..4029cd191ab5 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
};
//
--
2.21.0.windows.1
next prev parent reply other threads:[~2020-02-28 10:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-28 10:38 [edk2-platforms][PATCH 00/15] Platform/RPi: Clean up and factorize ACPI Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 01/15] Platform/RPi: Move DW USB base address to Silicon Pete Batard
2020-03-02 11:21 ` Philippe Mathieu-Daudé
2020-02-28 10:38 ` [edk2-platforms][PATCH 02/15] Silicon/Bcm283x: Add missing peripherals constants Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 03/15] Silicon/Bcm283x: Add GPU/VideoCore and Power Management constants Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 04/15] Silicon/BcmGenet: Add missing I/O mapping length and clean up Pete Batard
2020-02-28 10:45 ` Ard Biesheuvel
2020-02-28 10:51 ` Pete Batard
2020-02-28 10:58 ` Ard Biesheuvel
2020-02-28 11:01 ` Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 05/15] Platform/RPi4: Use Silicon constants in ACPI headers Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 06/15] Platform/RPi3: " Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 07/15] Platform/RPi3: Switch to .aslc for serial related ACPI tables Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 08/15] Platform/RPi3: Update CSRT table to ACPI 5.1 Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 09/15] Platform/RPi3: Use proper aslc for FADT, GTDT and MADT tables generation Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 10/15] Platform/RPi4: Add RPI_MODEL constant and replace PL011_ENABLE Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 11/15] Platform/RPi4: Move ACPI interrupts definitions to AcpiTables.h Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 12/15] Platform/RPi3: " Pete Batard
2020-02-28 10:38 ` Pete Batard [this message]
2020-02-28 10:38 ` [edk2-platforms][PATCH 14/15] Platform/RPi3: Merge ACPI code from RPi4 Pete Batard
2020-02-28 10:38 ` [edk2-platforms][PATCH 15/15] Platform/RPi: Factorize ACPI tables Pete Batard
2020-02-28 12:17 ` [edk2-platforms][PATCH 00/15] Platform/RPi: Clean up and factorize ACPI Ard Biesheuvel
2020-03-02 11:14 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200228103855.11352-14-pete@akeo.ie \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox