* [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform
@ 2019-12-11 11:25 Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 1/5] Platform/RPi: Fix overlap of SoC registers and RAM Pete Batard
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Pete Batard @ 2019-12-11 11:25 UTC (permalink / raw)
To: devel
Cc: ard.biesheuvel, leif.lindholm, philmd, andrey.warkentin,
samer.el-haj-mahmoud
This series adds basic support to build the Raspberry Pi 4 platform.
It requires the earlier series, that add binary files for the platform,
to have been applied to edk2-non-osi.
For the introduction of the platform, USB support is not yet enabled
which means that user I/O has to be carried out through serial.
The first two patches of the series are fixes for the common RPi
platform that will become relevant when we introduce support for
PCIe/xHCI.
The second two patch deal with the specific ACPI changes for the
Pi 4 platform. To make these clearer, an intermediate patch, that
simply enacts a straight unaltered copy of the Pi 3 ACPI files is
added, so that the changes we apply can be made obvious. We also
use this opportunity to switch the source of some tables (GTDT,
MADT) to proper aslc.
Finally, the last patch in this series adds the platform files
along with a Readme detailing the installation requirements and
current state of the platform.
Andrei Warkentin (2):
Platform/RPi4: Update ACPI tables for the new platform
Platform/RPi4: Add base platform files
Ard Biesheuvel (2):
Platform/RPi: Fix overlap of SoC registers and RAM
Platform/RPi: Don't describe MMIO regions as memory
Samer El-Haj-Mahmoud (1):
Platform/RPi4: Add initial ACPI tables
Platform/RaspberryPi/Include/Library/RPiMem.h | 7 +-
Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 10 +
Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 42 +-
Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h | 92 +++
Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf | 49 ++
Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc | 327 ++++++++++
Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc | 28 +
Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl | 505 ++++++++++++++++
Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc | 46 ++
Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc | 56 ++
Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc | 64 ++
Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl | 90 +++
Platform/RaspberryPi/RPi4/AcpiTables/Pep.c | 79 +++
Platform/RaspberryPi/RPi4/AcpiTables/Pep.h | 121 ++++
Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl | 195 ++++++
Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl | 99 +++
Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl | 48 ++
Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl | 152 +++++
Platform/RaspberryPi/RPi4/RPi4.dsc | 637 ++++++++++++++++++++
Platform/RaspberryPi/RPi4/RPi4.fdf | 432 +++++++++++++
Platform/RaspberryPi/RPi4/Readme.md | 110 ++++
21 files changed, 3170 insertions(+), 19 deletions(-)
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Pep.c
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Pep.h
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl
create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
create mode 100644 Platform/RaspberryPi/RPi4/RPi4.dsc
create mode 100644 Platform/RaspberryPi/RPi4/RPi4.fdf
create mode 100644 Platform/RaspberryPi/RPi4/Readme.md
--
2.21.0.windows.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [edk2-platforms][PATCH 1/5] Platform/RPi: Fix overlap of SoC registers and RAM
2019-12-11 11:25 [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Pete Batard
@ 2019-12-11 11:25 ` Pete Batard
2019-12-11 12:21 ` Philippe Mathieu-Daudé
2019-12-11 11:25 ` [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory Pete Batard
` (4 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Pete Batard @ 2019-12-11 11:25 UTC (permalink / raw)
To: devel
Cc: ard.biesheuvel, leif.lindholm, philmd, andrey.warkentin,
samer.el-haj-mahmoud
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Having RAM and SoC register regions overlap is problematic for MMIO,
since, at the very least, we don't want these regions to be declared
as cacheable.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 36 +++++++++++++-------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
index cc761bea1307..781cf78b83d3 100644
--- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
+++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
@@ -60,7 +60,7 @@ ArmPlatformGetVirtualMemoryMap (
{
UINTN Index = 0;
UINTN GpuIndex;
- INT64 ExtendedMemorySize;
+ INT64 SystemMemorySize;
ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
// Early output of the info we got from VideoCore can prove valuable.
@@ -120,21 +120,21 @@ ArmPlatformGetVirtualMemoryMap (
VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
VirtualMemoryInfo[Index++].Name = L"GPU Reserved";
- // Compute the amount of extended RAM available on this platform
- ExtendedMemorySize = SIZE_256MB;
- ExtendedMemorySize <<= (mBoardRevision >> 20) & 0x07;
- ExtendedMemorySize -= SIZE_1GB;
- if (ExtendedMemorySize > 0) {
- VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdExtendedMemoryBase);
- VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
- VirtualMemoryTable[Index].Length = ExtendedMemorySize;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
- VirtualMemoryInfo[Index].Type = RPI_MEM_BASIC_REGION;
- VirtualMemoryInfo[Index++].Name = L"Extended System RAM";
- }
+ // Compute the total RAM size available on this platform
+ SystemMemorySize = SIZE_256MB;
+ SystemMemorySize <<= (mBoardRevision >> 20) & 0x07;
+
+ //
+ // Ensure that what we declare as System Memory doesn't overlap with the
+ // Bcm2836 SoC registers. This can be achieved through a MIN () with the
+ // base address since SystemMemoryBase is 0 (we assert if it isn't).
+ //
+ SystemMemorySize = MIN(SystemMemorySize, BCM2836_SOC_REGISTERS);
// Extended SoC registers (PCIe, genet, ...)
if (BCM2711_SOC_REGISTERS > 0) {
+ // Same overlap protection as above for the Bcm2711 SoC registers
+ SystemMemorySize = MIN(SystemMemorySize, BCM2711_SOC_REGISTERS);
VirtualMemoryTable[Index].PhysicalBase = BCM2711_SOC_REGISTERS;
VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
VirtualMemoryTable[Index].Length = BCM2711_SOC_REGISTER_LENGTH;
@@ -155,6 +155,16 @@ ArmPlatformGetVirtualMemoryMap (
VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
VirtualMemoryInfo[Index++].Name = L"SoC Reserved (283x)";
+ // If we have RAM above the 1 GB mark, declare it
+ if (SystemMemorySize - SIZE_1GB > 0) {
+ VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdExtendedMemoryBase);
+ VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
+ VirtualMemoryTable[Index].Length = SystemMemorySize - SIZE_1GB;
+ VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+ VirtualMemoryInfo[Index].Type = RPI_MEM_BASIC_REGION;
+ VirtualMemoryInfo[Index++].Name = L"Extended System RAM";
+ }
+
// End of Table
VirtualMemoryTable[Index].PhysicalBase = 0;
VirtualMemoryTable[Index].VirtualBase = 0;
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory
2019-12-11 11:25 [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 1/5] Platform/RPi: Fix overlap of SoC registers and RAM Pete Batard
@ 2019-12-11 11:25 ` Pete Batard
2019-12-11 12:22 ` Philippe Mathieu-Daudé
2019-12-11 11:25 ` [edk2-platforms][PATCH 3/5] Platform/RPi4: Add initial ACPI tables Pete Batard
` (3 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Pete Batard @ 2019-12-11 11:25 UTC (permalink / raw)
To: devel
Cc: ard.biesheuvel, leif.lindholm, philmd, andrey.warkentin,
samer.el-haj-mahmoud
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
When using ACPI OpRegions to poke device registers, Linux will use
the UEFI memory map to decide which memory attributes to use, and
so they should not be described as cacheable memory.
Since MMIO regions that don't require an OS virtual mapping at runtime
don't really belong in the UEFI memory map to begin with, omit them
entirely.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/Include/Library/RPiMem.h | 7 ++++---
Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 10 ++++++++++
Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 6 +++---
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/Platform/RaspberryPi/Include/Library/RPiMem.h b/Platform/RaspberryPi/Include/Library/RPiMem.h
index 9d38e4b6cfb3..a033af369bb0 100644
--- a/Platform/RaspberryPi/Include/Library/RPiMem.h
+++ b/Platform/RaspberryPi/Include/Library/RPiMem.h
@@ -9,9 +9,10 @@
#ifndef RPI_MEM_H__
#define RPI_MEM_H__
-#define RPI_MEM_BASIC_REGION 0
-#define RPI_MEM_RUNTIME_REGION 1
-#define RPI_MEM_RESERVED_REGION 2
+#define RPI_MEM_UNMAPPED_REGION 0
+#define RPI_MEM_BASIC_REGION 1
+#define RPI_MEM_RUNTIME_REGION 2
+#define RPI_MEM_RESERVED_REGION 3
typedef struct {
CONST CHAR16* Name;
diff --git a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
index 3a0f7e19e993..7ba1cc5602d2 100644
--- a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
+++ b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
@@ -72,6 +72,15 @@ AddRuntimeServicesRegion (
);
}
+STATIC
+VOID
+AddUnmappedMemoryRegion (
+ IN ARM_MEMORY_REGION_DESCRIPTOR *Desc
+ )
+{
+ // Do nothing
+}
+
STATIC
VOID
AddReservedMemoryRegion (
@@ -88,6 +97,7 @@ AddReservedMemoryRegion (
}
void (*AddRegion[]) (IN ARM_MEMORY_REGION_DESCRIPTOR *Desc) = {
+ AddUnmappedMemoryRegion,
AddBasicMemoryRegion,
AddRuntimeServicesRegion,
AddReservedMemoryRegion,
diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
index 781cf78b83d3..f8223d1b94e8 100644
--- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
+++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
@@ -117,7 +117,7 @@ ArmPlatformGetVirtualMemoryMap (
VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
VirtualMemoryTable[Index].Length = mVideoCoreSize;
VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
- VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
+ VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION;
VirtualMemoryInfo[Index++].Name = L"GPU Reserved";
// Compute the total RAM size available on this platform
@@ -139,7 +139,7 @@ ArmPlatformGetVirtualMemoryMap (
VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
VirtualMemoryTable[Index].Length = BCM2711_SOC_REGISTER_LENGTH;
VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
- VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
+ VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION;
VirtualMemoryInfo[Index++].Name = L"SoC Reserved (27xx)";
}
@@ -152,7 +152,7 @@ ArmPlatformGetVirtualMemoryMap (
VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
VirtualMemoryTable[Index].Length = BCM2836_SOC_REGISTER_LENGTH;
VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
- VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
+ VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION;
VirtualMemoryInfo[Index++].Name = L"SoC Reserved (283x)";
// If we have RAM above the 1 GB mark, declare it
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [edk2-platforms][PATCH 3/5] Platform/RPi4: Add initial ACPI tables
2019-12-11 11:25 [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 1/5] Platform/RPi: Fix overlap of SoC registers and RAM Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory Pete Batard
@ 2019-12-11 11:25 ` Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 4/5] Platform/RPi4: Update ACPI tables for the new platform Pete Batard
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Pete Batard @ 2019-12-11 11:25 UTC (permalink / raw)
To: devel
Cc: ard.biesheuvel, leif.lindholm, philmd, andrey.warkentin,
samer.el-haj-mahmoud
From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
For this initial commit, we duplicate the RPi3 ones.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h | 76 +++
Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf | 40 ++
Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc | 326 +++++++++++++
Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc | 28 ++
Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl | 505 ++++++++++++++++++++
Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc | 46 ++
Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc | 27 ++
Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc | 56 +++
Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl | 89 ++++
Platform/RaspberryPi/RPi4/AcpiTables/Pep.c | 78 +++
Platform/RaspberryPi/RPi4/AcpiTables/Pep.h | 120 +++++
Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl | 195 ++++++++
Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl | 99 ++++
Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl | 47 ++
Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl | 152 ++++++
15 files changed, 1884 insertions(+)
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h
new file mode 100644
index 000000000000..958af026c8a3
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h
@@ -0,0 +1,76 @@
+/** @file
+ *
+ * RPi3 defines for constructing ACPI tables
+ *
+ * Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+#ifndef __ACPITABLES_H__
+#define __ACPITABLES_H__
+
+#include <IndustryStandard/Acpi50.h>
+
+#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','3','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','3')
+#define EFI_ACPI_CREATOR_REVISION 0x00000097
+
+#define EFI_ACPI_VENDOR_ID SIGNATURE_32 ('M','S','F','T')
+#define EFI_ACPI_CSRT_REVISION 0x00000005
+#define EFI_ACPI_CSRT_DEVICE_ID_DMA 0x00000009 // Fixed id
+#define EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP 0x0 // Count up from 0
+
+#define RPI3_DMA_CHANNEL_COUNT 10 // All 10 DMA channels are listed, including the reserved ones
+#define RPI3_DMA_USED_CHANNEL_COUNT 5 // Use 5 DMA channels
+
+#define EFI_ACPI_5_0_CSRT_REVISION 0x00000000
+
+typedef enum
+{
+ EFI_ACPI_CSRT_RESOURCE_TYPE_RESERVED, // 0
+ EFI_ACPI_CSRT_RESOURCE_TYPE_INTERRUPT, // 1
+ EFI_ACPI_CSRT_RESOURCE_TYPE_TIMER, // 2
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, // 3
+ EFI_ACPI_CSRT_RESOURCE_TYPE_CACHE, // 4
+}
+CSRT_RESOURCE_TYPE;
+
+typedef enum
+{
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, // 0
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CONTROLLER // 1
+}
+CSRT_DMA_SUBTYPE;
+
+//------------------------------------------------------------------------
+// CSRT Resource Group header 24 bytes long
+//------------------------------------------------------------------------
+typedef struct
+{
+ UINT32 Length; // Length
+ UINT32 VendorID; // 4 bytes
+ UINT32 SubVendorId; // 4 bytes
+ UINT16 DeviceId; // 2 bytes
+ UINT16 SubdeviceId; // 2 bytes
+ UINT16 Revision; // 2 bytes
+ UINT16 Reserved; // 2 bytes
+ UINT32 SharedInfoLength; // 4 bytes
+} EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER;
+
+//------------------------------------------------------------------------
+// CSRT Resource Descriptor 12 bytes total
+//------------------------------------------------------------------------
+typedef struct
+{
+ UINT32 Length; // 4 bytes
+ UINT16 ResourceType; // 2 bytes
+ UINT16 ResourceSubType; // 2 bytes
+ UINT32 UID; // 4 bytes
+} EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER;
+
+#endif // __ACPITABLES_H__
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
new file mode 100644
index 000000000000..7ef41e79ad46
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
@@ -0,0 +1,40 @@
+#/** @file
+#
+# ACPI table data and ASL sources required to boot the platform.
+#
+# Copyright (c) 2017, Andrey Warkentin <andrey.warkentin@gmail.com>
+# Copyright (c) Microsoft Corporation. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+ INF_VERSION = 0x0001001A
+ BASE_NAME = AcpiTables
+ FILE_GUID = 7E374E25-8E01-4FEE-87F2-390C23C606CD
+ MODULE_TYPE = USER_DEFINED
+ VERSION_STRING = 1.0
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = AARCH64
+#
+
+[Sources]
+ AcpiTables.h
+ Madt.aslc
+ Fadt.aslc
+ Dbg2.aslc
+ Gtdt.aslc
+ Dsdt.asl
+ Csrt.aslc
+ Spcr.asl
+
+[Packages]
+ MdePkg/MdePkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
+
+[FixedPcd]
+ gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc
new file mode 100644
index 000000000000..3b617c0a832b
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc
@@ -0,0 +1,326 @@
+/** @file
+ *
+ * Core System Resource Table (CSRT)
+ *
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+#include "AcpiTables.h"
+
+#define DMA_MAX_REQ_LINES 32
+
+#pragma pack (push, 1)
+
+//------------------------------------------------------------------------
+// DMA Controller Vendor Data for RPi3
+//------------------------------------------------------------------------
+typedef struct
+{
+ UINT32 Length;
+ UINT32 Type;
+ UINT64 ChannelsBaseAddress;
+ UINT32 ChannelsBaseSize;
+ UINT64 ControllerBaseAddress;
+ UINT32 ControllerBaseSize;
+ UINT32 ChannelCount;
+ UINT32 ControllerInterrupt;
+ UINT32 MinimumRequestLine;
+ UINT32 MaximumRequestLine;
+ BOOLEAN CacheCoherent;
+} DMA_CONTROLLER_VENDOR_DATA;
+
+//------------------------------------------------------------------------
+// DMA Controller on RPi3
+//------------------------------------------------------------------------
+typedef struct
+{
+ EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER DmaControllerHeader;
+ DMA_CONTROLLER_VENDOR_DATA ControllerVendorData;
+} RD_DMA_CONTROLLER;
+
+//------------------------------------------------------------------------
+// DMA Channel Vendor Data for RPi3
+//------------------------------------------------------------------------
+typedef struct
+{
+ UINT32 ChannelNumber;
+ UINT32 ChannelInterrupt;
+ UINT16 IsReservedChannel;
+ UINT16 NoSrcNoDestAddrIncr;
+} DMA_CHANNEL_VENDOR_DATA;
+
+//------------------------------------------------------------------------
+// DMA Channel on RPi3
+//------------------------------------------------------------------------
+typedef struct
+{
+ EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER DmaChannelHeader;
+ DMA_CHANNEL_VENDOR_DATA ChannelVendorData;
+} RD_DMA_CHANNEL;
+
+//------------------------------------------------------------------------
+// DMA Resource Group on RPi3
+//------------------------------------------------------------------------
+
+typedef struct
+{
+ EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER ResGroupHeader;
+ RD_DMA_CONTROLLER DmaController;
+ RD_DMA_CHANNEL DmaChannels[RPI3_DMA_CHANNEL_COUNT];
+} RG_DMA;
+
+//----------------------------------------------------------------------------
+// CSRT table structure for RPi3 platform - current revision only includes DMA
+//----------------------------------------------------------------------------
+typedef struct
+{
+// Standard ACPI Header
+ EFI_ACPI_DESCRIPTION_HEADER CsrtHeader;
+
+// DMA Resource Group
+ RG_DMA DmaResourceGroup;
+
+} EFI_ACPI_5_0_CSRT_TABLE;
+
+EFI_ACPI_5_0_CSRT_TABLE Csrt =
+{
+ //------------------------------------------------------------------------
+ // ACPI Table Header
+ //------------------------------------------------------------------------
+ {
+ EFI_ACPI_5_0_CORE_SYSTEM_RESOURCE_TABLE_SIGNATURE, // Signature "CSRT"
+ sizeof (EFI_ACPI_DESCRIPTION_HEADER) + sizeof (RG_DMA), // Length
+ EFI_ACPI_5_0_CSRT_REVISION, // Revision
+ 0x00, // Checksum calculated at runtime.
+ EFI_ACPI_OEM_ID, // OEMID is a 6 bytes long field "BC2836"
+ EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes long) "RPI3EDK2"
+ EFI_ACPI_OEM_REVISION, // OEM revision number.
+ EFI_ACPI_CREATOR_ID, // ASL compiler vendor ID.
+ EFI_ACPI_CREATOR_REVISION // ASL compiler revision number.
+ },
+
+ //------------------------------------------------------------------------
+ // DMA Resource Group
+ //------------------------------------------------------------------------
+ {
+
+ //------------------------------------------------------------------------
+ // DMA Resource Group Header
+ //------------------------------------------------------------------------
+ {
+ sizeof (RG_DMA), // Resource Group Length
+ EFI_ACPI_VENDOR_ID, // VendorId
+ 0, // SubvendorId
+ EFI_ACPI_CSRT_DEVICE_ID_DMA, // DeviceId 9
+ 0, // SubdeviceId
+ 0, // Revision
+ 0, // Reserved
+ 0 // SharedInfoLength
+ },
+
+ //-------------------------------------------------------------------------------
+ // Resource Descriptor - DMA Controller
+ //-------------------------------------------------------------------------------
+ {
+ {
+ sizeof (RD_DMA_CONTROLLER), // Length of this Resource Descriptor
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, // Type for this resource 3=DMA
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CONTROLLER, // Subtype for this resource 1=DMA Controller
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 0, // ResourceId - 1st DMA controller
+ },
+ {
+ sizeof (DMA_CONTROLLER_VENDOR_DATA), // Controller vendor data here
+ 1,
+ 0x3F007000, // Base address for channels
+ RPI3_DMA_CHANNEL_COUNT * 0x100, // Base size = Number of channels x 0x100 size for each channel
+ 0x3F007FE0, // Base address for controller
+ 8, // Base size = two registers
+ RPI3_DMA_USED_CHANNEL_COUNT,
+ 0, // cannot use controller interrupt
+ 0, // Minimum Request Line
+ DMA_MAX_REQ_LINES - 1, // Maximum Request Line
+ FALSE,
+ },
+ },
+
+ //------------------------------------------------------------------------
+ // Resource Descriptor(s) - DMA Channels 0 to n-1
+ //------------------------------------------------------------------------
+ {
+
+ // Channel 0
+ {
+ {
+ sizeof (RD_DMA_CHANNEL), // Length of this Resource Descriptor
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, // Type for this resource 3=DMA
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, // Subtype for this resource 0=DMA Channel
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 1, // ResourceId
+ },
+ {
+ 0, // Channel vendor data here
+ 0x30, // 16+32 dma_int[0]
+ 0,
+ 0
+ },
+ },
+
+ // Channel 1 reserved
+ {
+ {
+ sizeof (RD_DMA_CHANNEL),
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA,
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL,
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 2, // ResourceId
+ },
+ {
+ 1, // Channel vendor data here
+ 0x31, // 17+32 dma_int[1]
+ 1,
+ 0
+ },
+ },
+
+ // Channel 2 - VC4 use only
+ {
+ {
+ sizeof (RD_DMA_CHANNEL),
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA,
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL,
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 3, // ResourceId
+ },
+ {
+ 2, // Channel vendor data here
+ 0x32, // 18+32 dma_int[2]
+ 1,
+ 0
+ },
+ },
+
+ // Channel 3 - VC4 use only
+ {
+ {
+ sizeof (RD_DMA_CHANNEL),
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA,
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL,
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 4,
+ },
+ {
+ 3, // Channel vendor data here
+ 0x33, // 19+32 dma_int[3]
+ 1,
+ 0
+ },
+ },
+
+ // channel 4
+ {
+ {
+ sizeof (RD_DMA_CHANNEL),
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA,
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL,
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 5,
+ },
+ {
+ 4, // Channel vendor data here
+ 0x34, // 20+32 dma_int[4]
+ 0,
+ 1 // SD host controller candidate
+ },
+ },
+
+ // Channel 5
+ {
+ {
+ sizeof (RD_DMA_CHANNEL),
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA,
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL,
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 6,
+ },
+ {
+ 5, // Channel vendor data here
+ 0x35, // 21+32 dma_int[5]
+ 0,
+ 0
+ },
+ },
+
+ // Channel 6 is reserved
+ {
+ {
+ sizeof (RD_DMA_CHANNEL),
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA,
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL,
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 7,
+ },
+ {
+ 6, // Channel vendor data here
+ 0x36, // 22+32 dma_int[6]
+ 1,
+ 0
+ },
+ },
+
+ // Channel 7 is reserved
+ {
+ {
+ sizeof (RD_DMA_CHANNEL),
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA,
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL,
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 8,
+ },
+ {
+ 7, // Channel vendor data here
+ 0x37, // 23+32 dma_int[7]
+ 1,
+ 0
+ },
+ },
+
+ // Channel 8
+ {
+ {
+ sizeof (RD_DMA_CHANNEL),
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA,
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL,
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 9,
+ },
+ {
+ 8, // Channel vendor data here
+ 0x38, // 24+32 dma_int[8]
+ 0,
+ 0
+ },
+ },
+
+ // Channel 9
+ {
+ {
+ sizeof (RD_DMA_CHANNEL),
+ EFI_ACPI_CSRT_RESOURCE_TYPE_DMA,
+ EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL,
+ EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 10,
+ },
+ {
+ 9, // channel vendor data here
+ 0x39, // 25+32 dma_int[9]
+ 0,
+ 0
+ },
+ }
+
+ } // End DMA Channels 0 to 14
+
+ } // End DMA Resource group
+
+};
+
+#pragma pack(pop)
+
+//
+// Reference the table being generated to prevent the optimizer from removing the
+// data structure from the executable
+//
+VOID* CONST ReferenceAcpiTable = &Csrt;
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc
new file mode 100644
index 000000000000..9315f23e0d2d
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc
@@ -0,0 +1,28 @@
+/** @file
+ *
+ * Debug Port Table (DBG2)
+ *
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+UINT8 Dbg2[92] = {
+ 0x44, 0x42, 0x47, 0x32, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x4D, 0x53, 0x46, 0x54, 0x20, 0x20, 0x45, 0x44, 0x4B, 0x32,
+ 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x4D, 0x53,
+ 0x46, 0x54, 0x01, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x01, 0x0A, 0x00,
+ 0x26, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x10, 0x00,
+ 0x00, 0x00, 0x16, 0x00, 0x22, 0x00, 0x00, 0x20, 0x00, 0x10,
+ 0x00, 0x50, 0x21, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00,
+ 0x00, 0x00, '\\', '_', 'S', 'B', '.', 'U', 'R', 'T',
+ 'M', 0x00,
+};
+
+//
+// Reference the table being generated to prevent the optimizer from removing the
+// data structure from the executable
+//
+VOID* CONST ReferenceAcpiTable = &Dbg2;
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl
new file mode 100644
index 000000000000..ab4d4bf4851f
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl
@@ -0,0 +1,505 @@
+/** @file
+ *
+ * Differentiated System Definition Table (DSDT)
+ *
+ * Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+#define BCM_ALT0 0x4
+#define BCM_ALT1 0x5
+#define BCM_ALT2 0x6
+#define BCM_ALT3 0x7
+#define BCM_ALT4 0x3
+#define BCM_ALT5 0x2
+
+DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
+{
+ Scope (\_SB_)
+ {
+ include ("Sdhc.asl")
+ include ("Pep.asl")
+
+ Device (CPU0)
+ {
+ Name (_HID, "ACPI0007")
+ Name (_UID, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ }
+
+ Device (CPU1)
+ {
+ Name (_HID, "ACPI0007")
+ Name (_UID, 0x1)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ }
+
+ Device (CPU2)
+ {
+ Name (_HID, "ACPI0007")
+ Name (_UID, 0x2)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ }
+
+ Device (CPU3)
+ {
+ Name (_HID, "ACPI0007")
+ Name (_UID, 0x3)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ }
+
+ // DWC OTG Controller
+ Device (USB0)
+ {
+ Name (_HID, "BCM2848")
+ Name (_CID, Package() { "DWC_OTG", "DWC2_OTG"})
+ Name (_UID, 0x0)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED(ReadWrite, 0x3F980000, 0x10000,)
+ Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x29 }
+ })
+ Return(RBUF)
+ }
+ }
+
+ // Video Core 4 GPU
+ Device (GPU0)
+ {
+ Name (_HID, "BCM2850")
+ Name (_CID, "VC4")
+ Name (_UID, 0x0)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return(0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ // Memory and interrupt for the GPU
+ MEMORY32FIXED(ReadWrite, 0x3FC00000, 0x1000,)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x2A }
+
+ // HVS - Hardware Video Scalar
+ MEMORY32FIXED (ReadWrite, 0x3F400000, 0x6000,)
+ // The HVS interrupt is reserved by the VPU
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x41 }
+
+ // PixelValve0 - DSI0 or DPI
+ // MEMORY32FIXED (ReadWrite, 0x3F206000, 0x100,)
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4D }
+
+ // PixelValve1 - DS1 or SMI
+ // MEMORY32FIXED (ReadWrite, 0x73F207000, 0x100,)
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4E }
+
+ // PixelValve2 - HDMI output - connected to HVS display FIFO 1
+ MEMORY32FIXED (ReadWrite, 0x3F807000, 0x100,)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4A }
+
+ // HDMI registers
+ MEMORY32FIXED (ReadWrite, 0x3F902000, 0x600,) // HDMI registers
+ MEMORY32FIXED (ReadWrite, 0x3F808000, 0x100,) // HD registers
+ // hdmi_int[0]
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x48 }
+ // hdmi_int[1]
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x49 }
+
+ // HDMI DDC connection
+ I2CSerialBus (0x50,, 100000,, "\\_SB.I2C2",,,,) // EDID
+ I2CSerialBus (0x30,, 100000,, "\\_SB.I2C2",,,,) // E-DDC Segment Pointer
+ })
+ Return(RBUF)
+ }
+
+ // GPU Power Management Component Data
+ // Reference : https://github.com/Microsoft/graphics-driver-samples/wiki/Install-Driver-in-a-Windows-VM
+ Method (PMCD, 0, Serialized)
+ {
+ Name (RBUF, Package ()
+ {
+ 1, // Version
+ 1, // Number of graphics power components
+ Package () // Power components package
+ {
+ Package () // GPU component package
+ {
+ 0, // Component Index
+ 0, // DXGK_POWER_COMPONENT_MAPPING.ComponentType (0 = DXGK_POWER_COMPONENT_ENGINE)
+ 0, // DXGK_POWER_COMPONENT_MAPPING.NodeIndex
+
+ Buffer () // DXGK_POWER_RUNTIME_COMPONENT.ComponentGuid
+ { // 9B2D1E26-1575-4747-8FC0-B9EB4BAA2D2B
+ 0x26, 0x1E, 0x2D, 0x9B, 0x75, 0x15, 0x47, 0x47,
+ 0x8f, 0xc0, 0xb9, 0xeb, 0x4b, 0xaa, 0x2d, 0x2b
+ },
+
+ "VC4_Engine_00",// DXGK_POWER_RUNTIME_COMPONENT.ComponentName
+ 2, // DXGK_POWER_RUNTIME_COMPONENT.StateCount
+
+ Package () // DXGK_POWER_RUNTIME_COMPONENT.States[] package
+ {
+ Package () // F0
+ {
+ 0, // DXGK_POWER_RUNTIME_STATE.TransitionLatency
+ 0, // DXGK_POWER_RUNTIME_STATE.ResidencyRequirement
+ 1210000, // DXGK_POWER_RUNTIME_STATE.NominalPower (microwatt)
+ },
+
+ Package () // F1 - Placeholder
+ {
+ 10000, // DXGK_POWER_RUNTIME_STATE.TransitionLatency
+ 10000, // DXGK_POWER_RUNTIME_STATE.ResidencyRequirement
+ 4, // DXGK_POWER_RUNTIME_STATE.NominalPower
+ },
+ }
+ }
+ }
+ })
+ Return (RBUF)
+ }
+ }
+
+ // PiQ Mailbox Driver
+ Device (RPIQ)
+ {
+ Name (_HID, "BCM2849")
+ Name (_CID, "RPIQ")
+ Name (_UID, 0)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ Memory32Fixed (ReadWrite, 0x3F00B880, 0x00000024,)
+ Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x61 }
+ })
+ Return (RBUF)
+ }
+ }
+
+ // VCHIQ Driver
+ Device (VCIQ)
+ {
+ Name (_HID, "BCM2835")
+ Name (_CID, "VCIQ")
+ Name (_UID, 0)
+ Name (_CCA, 0x0)
+ Name (_DEP, Package() { \_SB.RPIQ })
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ Memory32Fixed (ReadWrite, 0x3F00B840, 0x00000010,)
+ Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x62 }
+ })
+ Return (RBUF)
+ }
+ }
+
+ // VC Shared Memory Driver
+ Device (VCSM)
+ {
+ Name (_HID, "BCM2856")
+ Name (_CID, "VCSM")
+ Name (_UID, 0)
+ Name (_CCA, 0x0)
+ Name (_DEP, Package() { \_SB.VCIQ })
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ }
+
+ // Description: GPIO
+ Device (GPI0)
+ {
+ Name (_HID, "BCM2845")
+ Name (_CID, "BCMGPIO")
+ Name (_UID, 0x0)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return(0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0x3F200000, 0xB4, )
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x51 }
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x53 }
+ })
+ Return (RBUF)
+ }
+ }
+
+ // Description: I2C
+ Device (I2C1)
+ {
+ Name (_HID, "BCM2841")
+ Name (_CID, "BCMI2C")
+ Name (_UID, 0x1)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return(0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ Memory32Fixed(ReadWrite, 0x3F804000, 0x20)
+ Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x55}
+
+ //
+ // MsftFunctionConfig is encoded as the VendorLong.
+ //
+ // MsftFunctionConfig (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer,) {2, 3}
+ //
+ VendorLong () // Length = 0x31
+ {
+ /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....`
+ /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0.
+ /* 0010 */ 0x2F, 0x8D, 0x1D, 0x00, 0x01, 0x10, 0x00, 0x01, // /.......
+ /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x16, 0x00, 0x20, // ........
+ /* 0020 */ 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x5C, // ........
+ /* 0028 */ 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, // _SB.GPI0
+ /* 0030 */ 0x00 // .
+ }
+ })
+ Return (RBUF)
+ }
+ }
+
+ // I2C2 is the HDMI DDC connection
+ Device (I2C2)
+ {
+ Name (_HID, "BCM2841")
+ Name (_CID, "BCMI2C")
+ Name (_UID, 0x2)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate()
+ {
+ Memory32Fixed (ReadWrite, 0x3F805000, 0x20)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) {0x55}
+ })
+ Return (RBUF)
+ }
+ }
+
+ // SPI
+ Device (SPI0)
+ {
+ Name (_HID, "BCM2838")
+ Name (_CID, "BCMSPI0")
+ Name (_UID, 0x0)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0x3F204000, 0x20,)
+ Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x56}
+
+ //
+ // MsftFunctionConfig is encoded as the VendorLong.
+ //
+ // MsftFunctionConfig (Exclusive, PullDown, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, ) {9, 10, 11} // MISO, MOSI, SCLK
+ VendorLong () // Length = 0x33
+ {
+ /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....`
+ /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0.
+ /* 0010 */ 0x2F, 0x8D, 0x1F, 0x00, 0x01, 0x10, 0x00, 0x02, // /.......
+ /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x18, 0x00, 0x22, // ......."
+ /* 0020 */ 0x00, 0x00, 0x00, 0x09, 0x00, 0x0A, 0x00, 0x0B, // ........
+ /* 0028 */ 0x00, 0x5C, 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, // .\_SB.GP
+ /* 0030 */ 0x49, 0x30, 0x00 // I0.
+ }
+
+ //
+ // MsftFunctionConfig is encoded as the VendorLong.
+ //
+ // MsftFunctionConfig (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, ) {8} // CE0
+ VendorLong () // Length = 0x2F
+ {
+ /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....`
+ /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0.
+ /* 0010 */ 0x2F, 0x8D, 0x1B, 0x00, 0x01, 0x10, 0x00, 0x01, // /.......
+ /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x1E, // ........
+ /* 0020 */ 0x00, 0x00, 0x00, 0x08, 0x00, 0x5C, 0x5F, 0x53, // .....\_S
+ /* 0028 */ 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, 0x00 // B.GPI0.
+ }
+
+ //
+ // MsftFunctionConfig is encoded as the VendorLong.
+ //
+ // MsftFunctionConfig (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, ) {7} // CE1
+ VendorLong () // Length = 0x2F
+ {
+ /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....`
+ /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0.
+ /* 0010 */ 0x2F, 0x8D, 0x1B, 0x00, 0x01, 0x10, 0x00, 0x01, // /.......
+ /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x1E, // ........
+ /* 0020 */ 0x00, 0x00, 0x00, 0x07, 0x00, 0x5C, 0x5F, 0x53, // .....\_S
+ /* 0028 */ 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, 0x00 // B.GPI0.
+ }
+ })
+ Return (RBUF)
+ }
+ }
+
+ Device (SPI1)
+ {
+ Name (_HID, "BCM2839")
+ Name (_CID, "BCMAUXSPI")
+ Name (_UID, 0x1)
+ Name (_CCA, 0x0)
+ Name (_DEP, Package() { \_SB.RPIQ })
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0x3F215080, 0x40,)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) {0x3D}
+
+ //
+ // MsftFunctionConfig is encoded as the VendorLong.
+ //
+ // MsftFunctionConfig(Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, ) {19, 20, 21} // MISO, MOSI, SCLK
+ VendorLong () // Length = 0x33
+ {
+ /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....`
+ /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0.
+ /* 0010 */ 0x2F, 0x8D, 0x1F, 0x00, 0x01, 0x10, 0x00, 0x02, // /.......
+ /* 0018 */ 0x03, 0x00, 0x12, 0x00, 0x00, 0x18, 0x00, 0x22, // ......."
+ /* 0020 */ 0x00, 0x00, 0x00, 0x13, 0x00, 0x14, 0x00, 0x15, // ........
+ /* 0028 */ 0x00, 0x5C, 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, // .\_SB.GP
+ /* 0030 */ 0x49, 0x30, 0x00 // I0.
+ }
+
+ //
+ // MsftFunctionConfig is encoded as the VendorLong.
+ //
+ // MsftFunctionConfig(Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, ) {16} // CE2
+ VendorLong () // Length = 0x2F
+ {
+ /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....`
+ /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0.
+ /* 0010 */ 0x2F, 0x8D, 0x1B, 0x00, 0x01, 0x10, 0x00, 0x02, // /.......
+ /* 0018 */ 0x03, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x1E, // ........
+ /* 0020 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x5C, 0x5F, 0x53, // .....\_S
+ /* 0028 */ 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, 0x00 // B.GPI0.
+ }
+ })
+ Return (RBUF)
+ }
+ }
+
+ // SPI2 has no pins on GPIO header
+ // Device (SPI2)
+ // {
+ // Name (_HID, "BCM2839")
+ // Name (_CID, "BCMAUXSPI")
+ // Name (_UID, 0x2)
+ // Name (_CCA, 0x0)
+ // Name (_DEP, Package() { \_SB.RPIQ })
+ // Method (_STA)
+ // {
+ // Return (0xf) // Disabled
+ // }
+ // Method (_CRS, 0x0, Serialized)
+ // {
+ // Name (RBUF, ResourceTemplate ()
+ // {
+ // MEMORY32FIXED (ReadWrite, 0x3F2150C0, 0x40,)
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) {0x3D}
+ // })
+ // Return (RBUF)
+ // }
+ // }
+
+ // PWM Driver
+ Device (PWM0)
+ {
+ Name (_HID, "BCM2844")
+ Name (_CID, "BCM2844")
+ Name (_UID, 0)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ // DMA channel 11 control
+ Memory32Fixed (ReadWrite, 0x3F007B00, 0x00000100,)
+ // PWM control
+ Memory32Fixed (ReadWrite, 0x3F20C000, 0x00000028,)
+ // PWM control bus
+ Memory32Fixed (ReadWrite, 0x7E20C000, 0x00000028,)
+ // PWM control uncached
+ Memory32Fixed (ReadWrite, 0xFF20C000, 0x00000028,)
+ // PWM clock control
+ Memory32Fixed (ReadWrite, 0x3F1010A0, 0x00000008,)
+ // Interrupt DMA channel 11
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x3B }
+ // DMA channel 11, DREQ 5 for PWM
+ FixedDMA (5, 11, Width32Bit, )
+ })
+ Return (RBUF)
+ }
+ }
+
+ include ("Uart.asl")
+ include ("Rhpx.asl")
+ }
+}
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc
new file mode 100644
index 000000000000..3ef877fde5f4
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc
@@ -0,0 +1,46 @@
+/** @file
+ *
+ * Fixed ACPI Description Table (FADT)
+ *
+ * Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+UINT8 Fadt[268] = {
+ 0x46, 0x41, 0x43, 0x50, 0x0C, 0x01, 0x00, 0x00, 0x05, 0x00, /* 0 */
+ 0x42, 0x43, 0x32, 0x38, 0x33, 0x36, 0x45, 0x44, 0x4B, 0x32, /* 10 */
+ 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x4D, 0x53, /* 20 */
+ 0x46, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 30 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, /* 40 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 50 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 60 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 70 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 80 */
+ 0x00, 0x04, 0x00, 0x00, 0x00, 0xE3, 0x00, 0x00, 0x00, 0x00, /* 90 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, /* 100 */
+ 0x00, 0x00, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, /* 110 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 120 */
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 130 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 140 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 150 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 160 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 170 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 180 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 190 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 200 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 210 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 220 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 230 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 240 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 250 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 268 */
+};
+
+//
+// Reference the table being generated to prevent the optimizer from removing the
+// data structure from the executable
+//
+VOID* CONST ReferenceAcpiTable = &Fadt;
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc
new file mode 100644
index 000000000000..6551315a5502
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc
@@ -0,0 +1,27 @@
+/** @file
+ *
+ * Generic Timer Description Table (GTDT)
+ * Automatically generated by AutoAcpi
+ *
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+UINT8 Gtdt[80] = {
+ 0x47, 0x54, 0x44, 0x54, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x4D, 0x53, 0x46, 0x54, 0x20, 0x20, 0x45, 0x44, 0x4B, 0x32,
+ 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x4D, 0x53,
+ 0x46, 0x54, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+//
+// Reference the table being generated to prevent the optimizer from removing the
+// data structure from the executable
+//
+VOID* CONST ReferenceAcpiTable = &Gtdt;
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc
new file mode 100644
index 000000000000..39cd4c5cee6c
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc
@@ -0,0 +1,56 @@
+/** @file
+ *
+ * Multiple APIC Description Table (MADT)
+ *
+ * Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+/*
+ * Even though the BCM283x don't contain a GIC, these
+ * GICC definitions enable multi-core support (with PSCI).
+ *
+ * Mind the signatures in the header, they must be kept.
+ */
+UINT8 Madt[] = {
+ 0x41, 0x50, 0x49, 0x43, 0x6c, 0x01, 0x00, 0x00, 0x03, 0xaf, 0x42, 0x43,
+ 0x32, 0x38, 0x33, 0x36, 0x45, 0x44, 0x4b, 0x32, 0x20, 0x20, 0x20, 0x20,
+ 0x01, 0x00, 0x00, 0x00, 0x4d, 0x53, 0x46, 0x54, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0b, 0x50, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00
+};
+
+//
+// Reference the table being generated to prevent the optimizer from removing the
+// data structure from the executable
+//
+VOID* CONST ReferenceAcpiTable = &Madt;
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl
new file mode 100644
index 000000000000..2ddb27bcdbb3
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl
@@ -0,0 +1,89 @@
+/** @file
+ *
+ * Platform Extension Plugin (PEP).
+ *
+ * Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+Device(PEPD)
+{
+ //
+ // RPI3 PEP virtual device.
+ //
+ Name (_HID, "BCM2854") // Note: since pep on rpi3 is virtual device,
+ Name (_CID, "BCM2854") // its device id needs to be generated by Microsoft
+ Name (_UID, 0x0)
+ Name (_CRS, ResourceTemplate ()
+ {
+ // No hardware resources for PEP driver are needed.
+ })
+
+ //
+ // Processor info. PEP proprietary method to return
+ // PEP_PROCESSOR_TABLE_PLAT structure.
+ //
+ // See Pep.h and Pep.c.
+ //
+ Name (_GPI, Buffer()
+ {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x5F, 0x00, 0x53,
+ 0x00, 0x42, 0x00, 0x2E, 0x00, 0x43, 0x00, 0x50, 0x00, 0x55, 0x00, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ })
+
+ //
+ // Coordinated state info. PEP proprietary method to return
+ // PEP_COORDINATED_STATE_TABLE_PLAT structure.
+ //
+ // See Pep.h and Pep.c.
+ //
+ Name (_GCI, Buffer()
+ {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+ })
+
+ //
+ // Device info. PEP proprietary method to return
+ // PEP_DEVICE_TABLE_PLAT structure.
+ //
+ // See Pep.h and Pep.c.
+ //
+ Name (_GDI, Buffer()
+ {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x5F, 0x00, 0x53,
+ 0x00, 0x42, 0x00, 0x2E, 0x00, 0x49, 0x00, 0x32, 0x00, 0x43, 0x00, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ })
+}
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c
new file mode 100644
index 000000000000..51db779d7976
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c
@@ -0,0 +1,78 @@
+/** @file
+ *
+ * PEP device tables
+ *
+ * Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+#include "Pep.h"
+
+PEP_PROCESSOR_TABLE_PLAT RPI3Processors = {
+ 1, // Version
+ 1, // NumberProcessors
+ { // ProcessorInfo
+ { // [0]
+ L"\\_SB.CPU0", // DevicePath, wchar_t[16]
+ 0, // FeedbackCounterCount
+ 0x00000000, // Flags
+ 0, // NumberIdleStates
+ 0, // NumberPerfStates
+ { // IdleInfo
+ },
+ { // perfinfo
+ }
+ }
+ }
+};
+
+PEP_COORDINATED_STATE_TABLE_PLAT RPI3CoordinatedStates = {
+ 1, // Version
+ 1, // CoordinatedStateCount
+ { // CordinatedStates[]
+ { // [0]
+ { // DependencyInfo
+ { // [0]
+ 1, // ExpectedState
+ 0, // TargetProcessor
+ 0x0 | 0x2 | 0x4, // LooseDependency = FALSE, InitialState = TRUE, DependentState = TRUE
+ }
+ },
+ SOC_STATE_TYPE, // StateType
+ 0x1, // Flags
+ 0, // Latency
+ 0, // BreakEvenDuration
+ 1, // DependencyCount
+ 1, // MaximumDependencySize
+ }
+ }
+};
+
+PEP_DEVICE_TABLE_PLAT RPI3Devices = {
+ 1, // Version
+ 1, // NumberDevices
+ { // DeviceInfo
+ { // [1]
+ L"\\_SB.I2C0", // DevicePath, wchar_t[16]
+ 0x1 | (1 << 3), // DStateSupportMask (D0 and D3)
+ 1, // NumberCompoenents
+ { // DStateRequirement
+ { // [0]
+ PowerDeviceD3 // DState
+ }
+ },
+ { // FStateRequirement
+ { // [0]
+ { // FState
+ { // [0]
+ 0
+ }
+ }
+ }
+ }
+ }
+ }
+};
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h
new file mode 100644
index 000000000000..f5f04518dec6
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h
@@ -0,0 +1,120 @@
+/** @file
+ *
+ * PEP device defines
+ *
+ * Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+/*
+ * Note: Not everything is here. At least SOC_STATE_TYPE is missing.
+ */
+
+#ifndef _RPI3PEP_H_INCLUDED_
+#define _RPI3PEP_H_INCLUDED_
+
+#include <IndustryStandard/Acpi50.h>
+
+#define PEP_MAX_DEPENDENCIES_PER_STATE 16
+#define MAX_PROCESSOR_PATH_LENGTH 16
+#define MAX_DEVICE_PATH_LENGTH 32
+#define MAX_COMPONENT_COUNT 8
+#define P_NUMBER_PROCESSORS 1
+#define P_NUMBER_IDLE_STATES 1
+#define P_NUMBER_PERF_STATES 0
+#define P_NUMBER_DEVICES 1
+#define P_NUMBER_COORDINATED_STATS 1
+
+typedef struct _PEP_PROCESSOR_IDLE_STATE_INFO {
+ UINT32 Ulong;
+ UINT32 Latency;
+ UINT32 BreakEvenDuration;
+} PEP_PROCESSOR_IDLE_STATE_INFO, *PEP_PROCESSOR_IDLE_STATE_INFO;
+
+typedef struct _PEP_PROCESSOR_IDLE_INFO_PLAT {
+ //
+ // Processor idle states.
+ //
+ PEP_PROCESSOR_IDLE_STATE_INFO IdleStates[P_NUMBER_IDLE_STATES];
+} PEP_PROCESSOR_IDLE_INFO_PLAT, *PPEP_PROCESSOR_IDLE_INFO_PLAT;
+
+typedef struct COORDINATED_DEPENDENCY_INFO {
+ UINT32 ExpectedState;
+ UINT32 TargetProcessor;
+ UINT32 Ulong;
+} COORDINATED_DEPENDENCY_INFO, *PCOORDINATED_DEPENDENCY_INFO;
+
+typedef struct {
+ COORDINATED_DEPENDENCY_INFO DependencyInfo[PEP_MAX_DEPENDENCIES_PER_STATE];
+ UINT32 StateType;
+ UINT32 Ulong;
+ UINT32 Latency;
+ UINT32 BreakEvenDuration;
+ UINT32 DependencyCount;
+ UINT32 MaximumDependencySize;
+} COORDINATED_STATE_INFO;
+
+typedef struct {
+ UINT32 Unused;
+} PEP_PROCESSOR_PERF_INFO;
+
+typedef struct {
+ UINT32 FState[MAX_COMPONENT_COUNT];
+} COORDINATED_FSTATE_REQUIREMENT;
+
+typedef struct {
+ UINT32 DState;
+} COORDINATED_DSTATE_REQUIREMENT;
+
+//
+// Top level device table
+// *N.B. The exact length of the structure is determined by the NumberIdleStates/NumberPerfStates variables.
+//
+
+typedef struct _PEP_PROCESSOR_INFO_PLAT {
+ WCHAR DevicePath[MAX_PROCESSOR_PATH_LENGTH]; // Null-terminated ACPI name
+ ULONG FeedbackCounterCount;
+ ULONG Flags;
+
+ //
+ // We are putting the idle/perf state count here (instead
+ // of the PEP_PROCESSOR_xxx_INFO structure for the ease of parsing.
+ //
+ ULONG NumberIdleStates;
+ ULONG NumberPerfStates;
+
+ PEP_PROCESSOR_IDLE_INFO_PLAT IdleInfo;
+ PEP_PROCESSOR_PERF_INFO PerfInfo;
+} PEP_PROCESSOR_INFO_PLAT, *PPEP_PROCESSOR_INFO_PLAT;
+
+typedef struct _PEP_PROCESSOR_TABLE_PLAT {
+ UINT32 Version;
+ UINT32 NumberProcessors;
+ PEP_PROCESSOR_INFO_PLAT ProcessorInfo[P_NUMBER_PROCESSORS];
+} PEP_PROCESSOR_TABLE_PLAT;
+
+typedef struct _PEP_COORDINATED_STATE_TABLE_PLAT {
+ ULONG Version;
+ ULONG CoordinatedStateCount;
+ COORDINATED_STATE_INFO CoordinatedStates[P_NUMBER_COORDINATED_STATS];
+} PEP_COORDINATED_STATE_TABLE_PLAT, *PPEP_COORDINATED_STATE_TABLE_PLAT;
+
+typedef struct _PEP_DEVICE_INFO_PLAT {
+ WCHAR DevicePath[MAX_DEVICE_PATH_LENGTH]; // Null-terminated ACPI name
+ ULONG DStateSupportMask;
+ ULONG NumberComponents;
+
+ COORDINATED_DSTATE_REQUIREMENT DStateRequirement[P_NUMBER_COORDINATED_STATS];
+ COORDINATED_FSTATE_REQUIREMENT FStateRequirement[P_NUMBER_COORDINATED_STATS];
+} PEP_DEVICE_INFO_PLAT, *PPEP_DEVICE_INFO_PLAT;
+
+typedef struct _PEP_DEVICE_TABLE_PLAT {
+ ULONG Version;
+ ULONG NumberDevices;
+ PEP_DEVICE_INFO_PLAT DeviceInfo[P_NUMBER_DEVICES];
+} PEP_DEVICE_TABLE_PLAT, *PPEP_DEVICE_TABLE_PLAT;
+
+#endif // _RPI3PEP_H_INCLUDED_
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl
new file mode 100644
index 000000000000..0971e13ee013
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl
@@ -0,0 +1,195 @@
+/** @file
+ *
+ * [DSDT] RHProxy device to enable WinRT API (RHPX)
+ *
+ * Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+Device (RHPX)
+{
+ Name (_HID, "MSFT8000")
+ Name (_CID, "MSFT8000")
+ Name (_UID, 1)
+
+ Name(_CRS, ResourceTemplate ()
+ {
+ // Index 0
+ SPISerialBus ( // SCKL - GPIO 11 - Pin 23
+ // MOSI - GPIO 10 - Pin 19
+ // MISO - GPIO 9 - Pin 21
+ // CE0 - GPIO 8 - Pin 24
+ 0, // Device selection (CE0)
+ PolarityLow, // Device selection polarity
+ FourWireMode, // WireMode
+ 8, // DataBit len
+ ControllerInitiated, // Slave mode
+ 4000000, // Connection speed
+ ClockPolarityLow, // Clock polarity
+ ClockPhaseFirst, // Clock phase
+ "\\_SB.SPI0", // ResourceSource: SPI bus controller name
+ 0, // ResourceSourceIndex
+ // Resource usage
+ // DescriptorName: creates name for offset of resource descriptor
+ ) // Vendor Data
+
+ // Index 1
+ SPISerialBus ( // SCKL - GPIO 11 - Pin 23
+ // MOSI - GPIO 10 - Pin 19
+ // MISO - GPIO 9 - Pin 21
+ // CE1 - GPIO 7 - Pin 26
+ 1, // Device selection (CE1)
+ PolarityLow, // Device selection polarity
+ FourWireMode, // WireMode
+ 8, // DataBit len
+ ControllerInitiated, // Slave mode
+ 4000000, // Connection speed
+ ClockPolarityLow, // Clock polarity
+ ClockPhaseFirst, // Clock phase
+ "\\_SB.SPI0", // ResourceSource: SPI bus controller name
+ 0, // ResourceSourceIndex
+ // Resource usage
+ // DescriptorName: creates name for offset of resource descriptor
+ ) // Vendor Data
+
+ // Index 2
+ I2CSerialBus ( // Pin 3 (GPIO2, SDA1), 5 (GPIO3, SCL1)
+ 0xFFFF, // SlaveAddress: placeholder
+ , // SlaveMode: default to ControllerInitiated
+ 0, // ConnectionSpeed: placeholder
+ , // Addressing Mode: default to 7 bit
+ "\\_SB.I2C1", // ResourceSource: I2C bus controller name
+ ,
+ ,
+ , // Descriptor Name: creates name for offset of resource descriptor
+ ) // Vendor Data
+
+ // Index 3
+ SPISerialBus ( // SPI1_SCLK - GPIO21
+ // SPI1_MOSI - GPIO20
+ // SPI1_MISO - GPIO19
+ // SPI1_CE2_N - GPIO16
+ 2, // Device selection (CE2)
+ PolarityLow, // Device selection polarity
+ FourWireMode, // WireMode
+ 8, // DataBit len
+ ControllerInitiated, // Slave mode
+ 4000000, // Connection speed
+ ClockPolarityLow, // Clock polarity
+ ClockPhaseFirst, // Clock phase
+ "\\_SB.SPI1", // ResourceSource: SPI bus controller name
+ 0, // ResourceSourceIndex
+ // Resource usage
+ // DescriptorName: creates name for offset of resource descriptor
+ ) // Vendor Data
+
+ // GPIO 2
+ GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 2 }
+ GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) { 2 }
+ // GPIO 3
+ GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 3 }
+ GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) { 3 }
+ // GPIO 4
+ GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 4 }
+ GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) { 4 }
+ // GPIO 5
+ GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 5 }
+ GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) { 5 }
+ // GPIO 6
+ GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 6 }
+ GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) { 6 }
+ // GPIO 7
+ GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 7 }
+ GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) { 7 }
+ // GPIO 8
+ GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 8 }
+ GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) { 8 }
+ // GPIO 9
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 9 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 9 }
+ // GPIO 10
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 10 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 10 }
+ // GPIO 11
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 11 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 11 }
+ // GPIO 12
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 12 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 12 }
+ // GPIO 13
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 13 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 13 }
+ // NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing
+ // until a proper solution can be created for the dmap conflict
+ // GPIO 14 - UART TX
+ // GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 14 }
+ // GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 14 }
+ // GPIO 15 - UART RX
+ // GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 15 }
+ // GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 15 }
+ // GPIO 16
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 16 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 16 }
+ // GPIO 17
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 17 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 17 }
+ // GPIO 18
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 18 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 18 }
+ // GPIO 19
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 19 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 19 }
+ // GPIO 20
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 20 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 20 }
+ // GPIO 21
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 21 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 21 }
+ // GPIO 22
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 22 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 22 }
+ // GPIO 23
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 23 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 23 }
+ // GPIO 24
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 24 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 24 }
+ // GPIO 25
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 25 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 25 }
+ // GPIO 26
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 26 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 26 }
+ // GPIO 27
+ GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, ResourceConsumer,,) { 27 }
+ GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) { 27 }
+ })
+
+ Name (_DSD, Package()
+ {
+ ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+ Package ()
+ {
+ // Reference http://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md
+ // SPI 0
+ Package (2) { "bus-SPI-SPI0", Package() { 0, 1 } }, // Index 0 & 1
+ Package (2) { "SPI0-MinClockInHz", 7629 }, // 7629 Hz
+ Package (2) { "SPI0-MaxClockInHz", 125000000 }, // 125 MHz
+ Package (2) { "SPI0-SupportedDataBitLengths", Package() { 8 } }, // Data Bit Length
+ // I2C1
+ Package (2) { "bus-I2C-I2C1", Package() { 2 } },
+ // GPIO Pin Count and supported drive modes
+ Package (2) { "GPIO-PinCount", 54 },
+ Package (2) { "GPIO-UseDescriptorPinNumbers", 1 },
+ Package (2) { "GPIO-SupportedDriveModes", 0xf }, // InputHighImpedance, InputPullUp, InputPullDown, OutputCmos
+ // SPI 1
+ Package (2) { "bus-SPI-SPI1", Package() { 3 }}, // Index 3
+ Package (2) { "SPI1-MinClockInHz", 30511 }, // 30.5 kHz
+ Package (2) { "SPI1-MaxClockInHz", 20000000 }, // 20 MHz
+ Package (2) { "SPI1-SupportedDataBitLengths", Package() { 8 } }, // Data Bit Length
+ }
+ })
+}
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl
new file mode 100644
index 000000000000..0d42db30ae22
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl
@@ -0,0 +1,99 @@
+/** @file
+ *
+ * [DSDT] SD controller/card definition (SDHC)
+ *
+ * Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+//
+// Note: UEFI can use either SDHost or Arasan. We expose both to the OS.
+//
+
+// ArasanSD 3.0 SD Host Controller.
+Device (SDC1)
+{
+ Name (_HID, "BCM2847")
+ Name (_CID, "ARASAN")
+ Name (_UID, 0x0)
+ Name (_CCA, 0x0)
+ Name (_S1D, 0x1)
+ Name (_S2D, 0x1)
+ Name (_S3D, 0x1)
+ Name (_S4D, 0x1)
+ Method (_STA)
+ {
+ Return(0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0x3F300000, 0x100,)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x5E }
+ })
+ Return (RBUF)
+ }
+
+ //
+ // A child device that represents the
+ // sd card, which is marked as non-removable.
+ //
+ Device (SDMM)
+ {
+ Method (_ADR)
+ {
+ Return (0)
+ }
+ Method (_RMV) // Is removable
+ {
+ Return (0) // 0 - fixed
+ }
+ }
+}
+
+
+// Broadcom SDHost 2.0 SD Host Controller
+Device (SDC2)
+{
+ Name (_HID, "BCM2855")
+ Name (_CID, "SDHST")
+ Name (_UID, 0x0)
+ Name (_CCA, 0x0)
+ Name (_S1D, 0x1)
+ Name (_S2D, 0x1)
+ Name (_S3D, 0x1)
+ Name (_S4D, 0x1)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0x3F202000, 0x100,)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x58 }
+ })
+ Return (RBUF)
+ }
+
+ //
+ // A child device that represents the
+ // sd card, which is marked as non-removable.
+ //
+ Device (SDMM)
+ {
+ Method (_ADR)
+ {
+ Return (0)
+ }
+ Method (_RMV) // Is removable
+ {
+ Return (0) // 0 - fixed
+ }
+ }
+}
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl
new file mode 100644
index 000000000000..2e6a37323794
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl
@@ -0,0 +1,47 @@
+/** @file
+ *
+ * Serial Port Console Redirection Table (SPCR)
+ *
+ * Copyright (c) 2017-2018, Andrey Warkentin <andrey.warkentin@gmail.com>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+[000h 0000 4] Signature : "SPCR" [Serial Port Console Redirection table]
+[004h 0004 4] Table Length : 00000050
+[008h 0008 1] Revision : 02
+[009h 0009 1] Checksum : 00
+[00Ah 0010 6] Oem ID : "RPiEFI"
+[010h 0016 8] Oem Table ID : "RPi3UEFI"
+[018h 0024 4] Oem Revision : 00000001
+[01Ch 0028 4] Asl Compiler ID : "----"
+[020h 0032 4] Asl Compiler Revision : 00000000
+
+[024h 0036 1] Interface Type : 10
+[025h 0037 3] Reserved : 000000
+
+[028h 0040 12] Serial Port Register : [Generic Address Structure]
+[028h 0040 1] Space ID : 00 [SystemMemory]
+[029h 0041 1] Bit Width : 20
+[02Ah 0042 1] Bit Offset : 00
+[02Bh 0043 1] Encoded Access Width : 03 [DWord Access:32]
+[02Ch 0044 8] Address : 000000003f215000
+
+[034h 0052 1] Interrupt Type : 0E
+[035h 0053 1] PCAT-compatible IRQ : 00
+[036h 0054 4] Interrupt : 3D
+[03Ah 0058 1] Baud Rate : 07
+[03Bh 0059 1] Parity : 00
+[03Ch 0060 1] Stop Bits : 01
+[03Dh 0061 1] Flow Control : 00
+[03Eh 0062 1] Terminal Type : 00
+[04Ch 0076 1] Reserved : 00
+[040h 0064 2] PCI Device ID : FFFF
+[042h 0066 2] PCI Vendor ID : FFFF
+[044h 0068 1] PCI Bus : 00
+[045h 0069 1] PCI Device : 00
+[046h 0070 1] PCI Function : 00
+[047h 0071 4] PCI Flags : 00000000
+[04Bh 0075 1] PCI Segment : 00
+[04Ch 0076 4] Reserved : 00000000
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
new file mode 100644
index 000000000000..a0067c82c661
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
@@ -0,0 +1,152 @@
+/** @file
+ *
+ * [DSDT] Serial devices (UART).
+ *
+ * Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+// PL011 based UART.
+Device (URT0)
+{
+ Name (_HID, "BCM2837")
+ Name (_CID, "HID3123")
+ Name (_UID, 0x4)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0x3F201000, 0x1000,)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x59 }
+ })
+ Return (RBUF)
+ }
+
+ Name (CLCK, 3000000)
+
+ Name (_DSD, Package ()
+ {
+ ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package ()
+ {
+ Package (2) { "clock-frequency", CLCK },
+ }
+ })
+}
+
+//
+// UART Mini.
+//
+// This device is referenced in the DBG2 table, which will cause the system to
+// not start the driver when the debugger is enabled and to mark the device
+// with problem code 53 (CM_PROB_USED_BY_DEBUGGER).
+//
+
+Device (URTM)
+{
+ Name (_HID, "BCM2836")
+ Name (_CID, "MINIUART")
+ Name (_UID, 0x0)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0x3F215000, 0x70,)
+ Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x3D}
+
+ // NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing
+ // until a proper solution can be created for the dmap conflict.
+ // When muxing is enabled, must consider DBG2 table conflict.
+ // The alternate function resource needs to be reserved when
+ // the kernel debugger is enabled to prevent another client
+ // from muxing the pins away.
+
+ //
+ // MsftFunctionConfig is encoded as the VendorLong.
+ //
+ // MsftFunctionConfig(Exclusive, PullDown, BCM_ALT5, "\\_SB.GPI0", 0, ResourceConsumer, ) {14, 15}
+ // VendorLong () // Length = 0x31
+ // {
+ // /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....`
+ // /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0.
+ // /* 0010 */ 0x2F, 0x8D, 0x1D, 0x00, 0x01, 0x10, 0x00, 0x02, // /.......
+ // /* 0018 */ 0x02, 0x00, 0x12, 0x00, 0x00, 0x16, 0x00, 0x20, // .......
+ // /* 0020 */ 0x00, 0x00, 0x00, 0x0E, 0x00, 0x0F, 0x00, 0x5C, // .......\
+ // /* 0028 */ 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, // _SB.GPI0
+ // /* 0030 */ 0x00 // .
+ //}
+
+ })
+ Return (RBUF)
+ }
+}
+
+//
+// Multifunction serial bus device to support Bluetooth function.
+//
+Device(BTH0)
+{
+ Name (_HID, "BCM2EA6")
+ Name (_CID, "BCM2EA6")
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Method (_CRS, 0x0, Serialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ // BT UART: UART0 (PL011)
+ UARTSerialBus(
+ 115200, // InitialBaudRate: in BPS
+ , // BitsPerByte: default to 8 bits
+ , // StopBits: Defaults to one bit
+ 0x00, // LinesInUse: 8 1-bit flags to
+ // declare enabled control lines.
+ // Raspberry Pi does not exposed
+ // HW control signals -> not supported.
+ // Optional bits:
+ // - Bit 7 (0x80) Request To Send (RTS)
+ // - Bit 6 (0x40) Clear To Send (CTS)
+ // - Bit 5 (0x20) Data Terminal Ready (DTR)
+ // - Bit 4 (0x10) Data Set Ready (DSR)
+ // - Bit 3 (0x08) Ring Indicator (RI)
+ // - Bit 2 (0x04) Data Carrier Detect (DTD)
+ // - Bit 1 (0x02) Reserved. Must be 0.
+ // - Bit 0 (0x01) Reserved. Must be 0.
+ , // IsBigEndian:
+ // default to LittleEndian.
+ , // Parity: Defaults to no parity
+ , // FlowControl: Defaults to
+ // no flow control.
+ 16, // ReceiveBufferSize
+ 16, // TransmitBufferSize
+ "\\_SB.URT0", // ResourceSource:
+ // UART bus controller name
+ , // ResourceSourceIndex: assumed to be 0
+ , // ResourceUsage: assumed to be
+ // ResourceConsumer
+ UAR0, // DescriptorName: creates name
+ // for offset of resource descriptor
+ ) // Vendor data
+
+ //
+ // RPIQ connection for BT_ON/OFF
+ //
+ GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.RPIQ", 0, ResourceConsumer, , ) { 128 }
+ })
+ Return (RBUF)
+ }
+}
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [edk2-platforms][PATCH 4/5] Platform/RPi4: Update ACPI tables for the new platform
2019-12-11 11:25 [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Pete Batard
` (2 preceding siblings ...)
2019-12-11 11:25 ` [edk2-platforms][PATCH 3/5] Platform/RPi4: Add initial ACPI tables Pete Batard
@ 2019-12-11 11:25 ` Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 5/5] Platform/RPi4: Add base platform files Pete Batard
2019-12-11 16:21 ` [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Ard Biesheuvel
5 siblings, 0 replies; 10+ messages in thread
From: Pete Batard @ 2019-12-11 11:25 UTC (permalink / raw)
To: devel
Cc: ard.biesheuvel, leif.lindholm, philmd, andrey.warkentin,
samer.el-haj-mahmoud
From: Andrei Warkentin <andrey.warkentin@gmail.com>
Update CSRT, DSDT, GTDT, MADT, SDHC and serial tables for the new
base addresses and switch ACPI to GIC.
We use ACPI 5.1 for MADT because older versions of the Linux kernel
can be finicky when it comes to checking the size of the GICC entries
the table: depending on the FADT version (either 5, or 6 or later),
the size must be exactly 76 or 80 bytes, respectively. However, using
the ACPI 6.0 or 6.1 GICC macros results in 80 byte entries, which
triggers a mismatch error since the FADT we are exposing is 5.1.
Since GICv2 doesn't care about any of the fields that were added
after ACPI 5.1, we can simply use that version to keep Linux happy.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h | 26 ++++-
Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf | 12 ++-
Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc | 25 ++---
Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc | 2 +-
Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl | 40 ++++----
Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc | 69 +++++++++----
Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc | 102 +++++++++++---------
Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl | 5 +-
Platform/RaspberryPi/RPi4/AcpiTables/Pep.c | 7 +-
Platform/RaspberryPi/RPi4/AcpiTables/Pep.h | 7 +-
Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl | 4 +-
Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl | 15 +--
Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl | 12 +--
13 files changed, 197 insertions(+), 129 deletions(-)
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h
index 958af026c8a3..e61f3fa0bcfa 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h
@@ -1,7 +1,8 @@
/** @file
*
- * RPi3 defines for constructing ACPI tables
+ * RPi4 defines for constructing ACPI tables
*
+ * Copyright (c) 2019, ARM Ltd. All rights reserved.
* Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) Microsoft Corporation. All rights reserved.
*
@@ -15,18 +16,33 @@
#include <IndustryStandard/Acpi50.h>
#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','3','E','D','K','2') // OEM table id 8 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','3')
+#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('R','P','I','4')
#define EFI_ACPI_CREATOR_REVISION 0x00000097
#define EFI_ACPI_VENDOR_ID SIGNATURE_32 ('M','S','F','T')
+
+// A macro to initialise the common header part of EFI ACPI tables as defined by
+// EFI_ACPI_DESCRIPTION_HEADER structure.
+#define ACPI_HEADER(Signature, Type, Revision) { \
+ Signature, /* UINT32 Signature */ \
+ sizeof (Type), /* UINT32 Length */ \
+ Revision, /* UINT8 Revision */ \
+ 0, /* UINT8 Checksum */ \
+ EFI_ACPI_OEM_ID, /* UINT8 OemId[6] */ \
+ EFI_ACPI_OEM_TABLE_ID, /* UINT64 OemTableId */ \
+ EFI_ACPI_OEM_REVISION, /* UINT32 OemRevision */ \
+ EFI_ACPI_CREATOR_ID, /* UINT32 CreatorId */ \
+ EFI_ACPI_CREATOR_REVISION /* UINT32 CreatorRevision */ \
+ }
+
#define EFI_ACPI_CSRT_REVISION 0x00000005
#define EFI_ACPI_CSRT_DEVICE_ID_DMA 0x00000009 // Fixed id
#define EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP 0x0 // Count up from 0
-#define RPI3_DMA_CHANNEL_COUNT 10 // All 10 DMA channels are listed, including the reserved ones
-#define RPI3_DMA_USED_CHANNEL_COUNT 5 // Use 5 DMA channels
+#define RPI4_DMA_CHANNEL_COUNT 10 // All 10 DMA channels are listed, including the reserved ones
+#define RPI4_DMA_USED_CHANNEL_COUNT 5 // Use 5 DMA channels
#define EFI_ACPI_5_0_CSRT_REVISION 0x00000000
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
index 7ef41e79ad46..50c9f7694d84 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
@@ -2,6 +2,7 @@
#
# ACPI table data and ASL sources required to boot the platform.
#
+# Copyright (c) 2019, ARM Limited. All rights reserved.
# Copyright (c) 2017, Andrey Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) Microsoft Corporation. All rights reserved.
#
@@ -33,8 +34,17 @@ [Sources]
Spcr.asl
[Packages]
- MdePkg/MdePkg.dec
+ ArmPkg/ArmPkg.dec
+ ArmPlatformPkg/ArmPlatformPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
[FixedPcd]
+ gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
+ gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
+ gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
+ gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
+ gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
+ gArmTokenSpaceGuid.PcdGicDistributorBase
gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc
index 3b617c0a832b..22a370d04017 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc
@@ -2,6 +2,7 @@
*
* Core System Resource Table (CSRT)
*
+ * Copyright (c) 2019, ARM Ltd. All rights reserved.
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -15,7 +16,7 @@
#pragma pack (push, 1)
//------------------------------------------------------------------------
-// DMA Controller Vendor Data for RPi3
+// DMA Controller Vendor Data for RPi4
//------------------------------------------------------------------------
typedef struct
{
@@ -33,7 +34,7 @@ typedef struct
} DMA_CONTROLLER_VENDOR_DATA;
//------------------------------------------------------------------------
-// DMA Controller on RPi3
+// DMA Controller on RPi4
//------------------------------------------------------------------------
typedef struct
{
@@ -42,7 +43,7 @@ typedef struct
} RD_DMA_CONTROLLER;
//------------------------------------------------------------------------
-// DMA Channel Vendor Data for RPi3
+// DMA Channel Vendor Data for RPi4
//------------------------------------------------------------------------
typedef struct
{
@@ -53,7 +54,7 @@ typedef struct
} DMA_CHANNEL_VENDOR_DATA;
//------------------------------------------------------------------------
-// DMA Channel on RPi3
+// DMA Channel on RPi4
//------------------------------------------------------------------------
typedef struct
{
@@ -62,18 +63,18 @@ typedef struct
} RD_DMA_CHANNEL;
//------------------------------------------------------------------------
-// DMA Resource Group on RPi3
+// DMA Resource Group on RPi4
//------------------------------------------------------------------------
typedef struct
{
EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER ResGroupHeader;
RD_DMA_CONTROLLER DmaController;
- RD_DMA_CHANNEL DmaChannels[RPI3_DMA_CHANNEL_COUNT];
+ RD_DMA_CHANNEL DmaChannels[RPI4_DMA_CHANNEL_COUNT];
} RG_DMA;
//----------------------------------------------------------------------------
-// CSRT table structure for RPi3 platform - current revision only includes DMA
+// CSRT table structure for RPi4 platform - current revision only includes DMA
//----------------------------------------------------------------------------
typedef struct
{
@@ -96,7 +97,7 @@ EFI_ACPI_5_0_CSRT_TABLE Csrt =
EFI_ACPI_5_0_CSRT_REVISION, // Revision
0x00, // Checksum calculated at runtime.
EFI_ACPI_OEM_ID, // OEMID is a 6 bytes long field "BC2836"
- EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes long) "RPI3EDK2"
+ EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes long) "RPI4EDK2"
EFI_ACPI_OEM_REVISION, // OEM revision number.
EFI_ACPI_CREATOR_ID, // ASL compiler vendor ID.
EFI_ACPI_CREATOR_REVISION // ASL compiler revision number.
@@ -134,11 +135,11 @@ EFI_ACPI_5_0_CSRT_TABLE Csrt =
{
sizeof (DMA_CONTROLLER_VENDOR_DATA), // Controller vendor data here
1,
- 0x3F007000, // Base address for channels
- RPI3_DMA_CHANNEL_COUNT * 0x100, // Base size = Number of channels x 0x100 size for each channel
- 0x3F007FE0, // Base address for controller
+ 0xFE007000, // Base address for channels
+ RPI4_DMA_CHANNEL_COUNT * 0x100, // Base size = Number of channels x 0x100 size for each channel
+ 0xFE007FE0, // Base address for controller
8, // Base size = two registers
- RPI3_DMA_USED_CHANNEL_COUNT,
+ RPI4_DMA_USED_CHANNEL_COUNT,
0, // cannot use controller interrupt
0, // Minimum Request Line
DMA_MAX_REQ_LINES - 1, // Maximum Request Line
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc
index 9315f23e0d2d..849cf5134793 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc
@@ -16,7 +16,7 @@ UINT8 Dbg2[92] = {
0x01, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x01, 0x0A, 0x00,
0x26, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x10, 0x00,
0x00, 0x00, 0x16, 0x00, 0x22, 0x00, 0x00, 0x20, 0x00, 0x10,
- 0x00, 0x50, 0x21, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00,
+ 0x00, 0x50, 0x21, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00,
0x00, 0x00, '\\', '_', 'S', 'B', '.', 'U', 'R', 'T',
'M', 0x00,
};
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl
index ab4d4bf4851f..42e650a3ef29 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl
@@ -78,8 +78,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Name (RBUF, ResourceTemplate ()
{
- MEMORY32FIXED(ReadWrite, 0x3F980000, 0x10000,)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x29 }
+ MEMORY32FIXED(ReadWrite, 0xFE980000, 0x10000,)
+ Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x69 }
})
Return(RBUF)
}
@@ -101,29 +101,29 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
Name (RBUF, ResourceTemplate ()
{
// Memory and interrupt for the GPU
- MEMORY32FIXED(ReadWrite, 0x3FC00000, 0x1000,)
+ MEMORY32FIXED(ReadWrite, 0xFEC00000, 0x1000,)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x2A }
// HVS - Hardware Video Scalar
- MEMORY32FIXED (ReadWrite, 0x3F400000, 0x6000,)
+ MEMORY32FIXED (ReadWrite, 0xFE400000, 0x6000,)
// The HVS interrupt is reserved by the VPU
// Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x41 }
// PixelValve0 - DSI0 or DPI
- // MEMORY32FIXED (ReadWrite, 0x3F206000, 0x100,)
+ // MEMORY32FIXED (ReadWrite, 0xFE206000, 0x100,)
// Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4D }
// PixelValve1 - DS1 or SMI
- // MEMORY32FIXED (ReadWrite, 0x73F207000, 0x100,)
+ // MEMORY32FIXED (ReadWrite, 0xFE207000, 0x100,)
// Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4E }
// PixelValve2 - HDMI output - connected to HVS display FIFO 1
- MEMORY32FIXED (ReadWrite, 0x3F807000, 0x100,)
+ MEMORY32FIXED (ReadWrite, 0xFE807000, 0x100,)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4A }
// HDMI registers
- MEMORY32FIXED (ReadWrite, 0x3F902000, 0x600,) // HDMI registers
- MEMORY32FIXED (ReadWrite, 0x3F808000, 0x100,) // HD registers
+ MEMORY32FIXED (ReadWrite, 0xFE902000, 0x600,) // HDMI registers
+ MEMORY32FIXED (ReadWrite, 0xFE808000, 0x100,) // HD registers
// hdmi_int[0]
// Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x48 }
// hdmi_int[1]
@@ -199,7 +199,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Name (RBUF, ResourceTemplate ()
{
- Memory32Fixed (ReadWrite, 0x3F00B880, 0x00000024,)
+ Memory32Fixed (ReadWrite, 0xFE00B880, 0x00000024,)
Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x61 }
})
Return (RBUF)
@@ -222,7 +222,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Name (RBUF, ResourceTemplate ()
{
- Memory32Fixed (ReadWrite, 0x3F00B840, 0x00000010,)
+ Memory32Fixed (ReadWrite, 0xFE00B840, 0x00000010,)
Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x62 }
})
Return (RBUF)
@@ -258,7 +258,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Name (RBUF, ResourceTemplate ()
{
- MEMORY32FIXED (ReadWrite, 0x3F200000, 0xB4, )
+ MEMORY32FIXED (ReadWrite, 0xFE200000, 0xB4, )
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x51 }
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x53 }
})
@@ -281,7 +281,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Name (RBUF, ResourceTemplate ()
{
- Memory32Fixed(ReadWrite, 0x3F804000, 0x20)
+ Memory32Fixed(ReadWrite, 0xFE804000, 0x20)
Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x55}
//
@@ -319,7 +319,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Name (RBUF, ResourceTemplate()
{
- Memory32Fixed (ReadWrite, 0x3F805000, 0x20)
+ Memory32Fixed (ReadWrite, 0xFE805000, 0x20)
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) {0x55}
})
Return (RBUF)
@@ -341,7 +341,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Name (RBUF, ResourceTemplate ()
{
- MEMORY32FIXED (ReadWrite, 0x3F204000, 0x20,)
+ MEMORY32FIXED (ReadWrite, 0xFE204000, 0x20,)
Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x56}
//
@@ -406,7 +406,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Name (RBUF, ResourceTemplate ()
{
- MEMORY32FIXED (ReadWrite, 0x3F215080, 0x40,)
+ MEMORY32FIXED (ReadWrite, 0xFE215080, 0x40,)
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) {0x3D}
//
@@ -458,7 +458,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
// {
// Name (RBUF, ResourceTemplate ()
// {
- // MEMORY32FIXED (ReadWrite, 0x3F2150C0, 0x40,)
+ // MEMORY32FIXED (ReadWrite, 0xFE2150C0, 0x40,)
// Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) {0x3D}
// })
// Return (RBUF)
@@ -481,15 +481,15 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
Name (RBUF, ResourceTemplate ()
{
// DMA channel 11 control
- Memory32Fixed (ReadWrite, 0x3F007B00, 0x00000100,)
+ Memory32Fixed (ReadWrite, 0xFE007B00, 0x00000100,)
// PWM control
- Memory32Fixed (ReadWrite, 0x3F20C000, 0x00000028,)
+ Memory32Fixed (ReadWrite, 0xFE20C000, 0x00000028,)
// PWM control bus
Memory32Fixed (ReadWrite, 0x7E20C000, 0x00000028,)
// PWM control uncached
Memory32Fixed (ReadWrite, 0xFF20C000, 0x00000028,)
// PWM clock control
- Memory32Fixed (ReadWrite, 0x3F1010A0, 0x00000008,)
+ Memory32Fixed (ReadWrite, 0xFE1010A0, 0x00000008,)
// Interrupt DMA channel 11
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x3B }
// DMA channel 11, DREQ 5 for PWM
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc
index 6551315a5502..293c6022d258 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc
@@ -1,27 +1,56 @@
/** @file
- *
- * Generic Timer Description Table (GTDT)
- * Automatically generated by AutoAcpi
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-2-Clause-Patent
- *
- **/
+* Generic Timer Description Table (GTDT)
+*
+* Copyright (c) 2018, Linaro Limited. All rights reserved.
+* Copyright (c) 2012 - 2016, ARM Limited. All rights reserved.
+*
+* SPDX-License-Identifier: BSD-2-Clause-Patent
+*
+**/
-UINT8 Gtdt[80] = {
- 0x47, 0x54, 0x44, 0x54, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00,
- 0x4D, 0x53, 0x46, 0x54, 0x20, 0x20, 0x45, 0x44, 0x4B, 0x32,
- 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x4D, 0x53,
- 0x46, 0x54, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+#include <Library/AcpiLib.h>
+#include <Library/PcdLib.h>
+#include <IndustryStandard/Acpi.h>
+
+#include "AcpiTables.h"
+
+#define SYSTEM_TIMER_BASE_ADDRESS 0xFF80001C
+#define GTDT_GLOBAL_FLAGS 0
+#define GTDT_GTIMER_FLAGS EFI_ACPI_6_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
+
+#pragma pack (1)
+
+typedef struct {
+ EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt;
+} EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES;
+
+#pragma pack ()
+
+EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES Gtdt = {
+ {
+ ACPI_HEADER(
+ EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
+ EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES,
+ EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION
+ ),
+ SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress
+ 0, // UINT32 Reserved
+ FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1TimerGSIV
+ GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags
+ FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1TimerGSIV
+ GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags
+ FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerGSIV
+ GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags
+ FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV
+ GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2TimerFlags
+ 0xFFFFFFFFFFFFFFFF, // UINT64 CntReadBasePhysicalAddress
+ 0, // UINT32 PlatformTimerCount
+ 0 // UINT32 PlatfromTimerOffset
+ },
};
//
-// Reference the table being generated to prevent the optimizer from removing the
-// data structure from the executable
+// Reference the table being generated to prevent the optimizer
+// from removing the data structure from the executable
//
VOID* CONST ReferenceAcpiTable = &Gtdt;
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc
index 39cd4c5cee6c..0027cb9fe8bb 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc
@@ -1,52 +1,60 @@
/** @file
- *
- * Multiple APIC Description Table (MADT)
- *
- * Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
- * Copyright (c) Microsoft Corporation. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-2-Clause-Patent
- *
- **/
+* Multiple APIC Description Table (MADT)
+*
+* Copyright (c) 2016 Linaro Ltd. All rights reserved.
+* Copyright (c) 2012 - 2015, ARM Limited. All rights reserved.
+*
+* SPDX-License-Identifier: BSD-2-Clause-Patent
+*
+**/
-/*
- * Even though the BCM283x don't contain a GIC, these
- * GICC definitions enable multi-core support (with PSCI).
- *
- * Mind the signatures in the header, they must be kept.
- */
-UINT8 Madt[] = {
- 0x41, 0x50, 0x49, 0x43, 0x6c, 0x01, 0x00, 0x00, 0x03, 0xaf, 0x42, 0x43,
- 0x32, 0x38, 0x33, 0x36, 0x45, 0x44, 0x4b, 0x32, 0x20, 0x20, 0x20, 0x20,
- 0x01, 0x00, 0x00, 0x00, 0x4d, 0x53, 0x46, 0x54, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0b, 0x50, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00
+#include "AcpiTables.h"
+#include <Library/AcpiLib.h>
+#include <Library/ArmLib.h>
+#include <Library/PcdLib.h>
+#include <IndustryStandard/Acpi51.h>
+
+//
+// Multiple APIC Description Table
+//
+#pragma pack (1)
+
+typedef struct {
+ EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
+ EFI_ACPI_5_1_GIC_STRUCTURE GicInterfaces[4];
+ EFI_ACPI_5_1_GIC_DISTRIBUTOR_STRUCTURE GicDistributor;
+} PI_MULTIPLE_APIC_DESCRIPTION_TABLE;
+
+#pragma pack ()
+
+PI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
+ {
+ ACPI_HEADER (
+ EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+ PI_MULTIPLE_APIC_DESCRIPTION_TABLE,
+ EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
+ ),
+ //
+ // MADT specific fields
+ //
+ 0, // LocalApicAddress
+ 0, // Flags
+ },
+ {
+ 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),
+ EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
+ 1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, 49, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
+ 0xFF846000, 0xFF844000, 0x19, 0),
+ EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
+ 2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, 50, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
+ 0xFF846000, 0xFF844000, 0x19, 0),
+ 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),
+ },
+ EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet64 (PcdGicDistributorBase), 0)
};
//
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl
index 2ddb27bcdbb3..7096109f8819 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl
@@ -2,6 +2,7 @@
*
* Platform Extension Plugin (PEP).
*
+ * Copyright (c) 2019, ARM Ltd. All rights reserved.
* Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) Microsoft Corporation. All rights reserved.
*
@@ -12,9 +13,9 @@
Device(PEPD)
{
//
- // RPI3 PEP virtual device.
+ // RPI4 PEP virtual device.
//
- Name (_HID, "BCM2854") // Note: since pep on rpi3 is virtual device,
+ Name (_HID, "BCM2854") // Note: since pep on rpi4 is virtual device,
Name (_CID, "BCM2854") // its device id needs to be generated by Microsoft
Name (_UID, 0x0)
Name (_CRS, ResourceTemplate ()
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c
index 51db779d7976..1a78392f05a0 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c
@@ -2,6 +2,7 @@
*
* PEP device tables
*
+ * Copyright (c) 2019, ARM Ltd. All rights reserved.
* Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) Microsoft Corporation. All rights reserved.
*
@@ -11,7 +12,7 @@
#include "Pep.h"
-PEP_PROCESSOR_TABLE_PLAT RPI3Processors = {
+PEP_PROCESSOR_TABLE_PLAT RPI4Processors = {
1, // Version
1, // NumberProcessors
{ // ProcessorInfo
@@ -29,7 +30,7 @@ PEP_PROCESSOR_TABLE_PLAT RPI3Processors = {
}
};
-PEP_COORDINATED_STATE_TABLE_PLAT RPI3CoordinatedStates = {
+PEP_COORDINATED_STATE_TABLE_PLAT RPI4CoordinatedStates = {
1, // Version
1, // CoordinatedStateCount
{ // CordinatedStates[]
@@ -51,7 +52,7 @@ PEP_COORDINATED_STATE_TABLE_PLAT RPI3CoordinatedStates = {
}
};
-PEP_DEVICE_TABLE_PLAT RPI3Devices = {
+PEP_DEVICE_TABLE_PLAT RPI4Devices = {
1, // Version
1, // NumberDevices
{ // DeviceInfo
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h
index f5f04518dec6..19b801caf783 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h
@@ -2,6 +2,7 @@
*
* PEP device defines
*
+ * Copyright (c) 2019, ARM Ltd. All rights reserved.
* Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) Microsoft Corporation. All rights reserved.
*
@@ -13,8 +14,8 @@
* Note: Not everything is here. At least SOC_STATE_TYPE is missing.
*/
-#ifndef _RPI3PEP_H_INCLUDED_
-#define _RPI3PEP_H_INCLUDED_
+#ifndef _RPI4PEP_H_INCLUDED_
+#define _RPI4PEP_H_INCLUDED_
#include <IndustryStandard/Acpi50.h>
@@ -117,4 +118,4 @@ typedef struct _PEP_DEVICE_TABLE_PLAT {
PEP_DEVICE_INFO_PLAT DeviceInfo[P_NUMBER_DEVICES];
} PEP_DEVICE_TABLE_PLAT, *PPEP_DEVICE_TABLE_PLAT;
-#endif // _RPI3PEP_H_INCLUDED_
+#endif // _RPI4PEP_H_INCLUDED_
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl
index 0d42db30ae22..57ee411a6157 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl
@@ -32,7 +32,7 @@ Device (SDC1)
{
Name (RBUF, ResourceTemplate ()
{
- MEMORY32FIXED (ReadWrite, 0x3F300000, 0x100,)
+ MEMORY32FIXED (ReadWrite, 0xFE300000, 0x100,)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x5E }
})
Return (RBUF)
@@ -75,7 +75,7 @@ Device (SDC2)
{
Name (RBUF, ResourceTemplate ()
{
- MEMORY32FIXED (ReadWrite, 0x3F202000, 0x100,)
+ MEMORY32FIXED (ReadWrite, 0xFE202000, 0x100,)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x58 }
})
Return (RBUF)
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl
index 2e6a37323794..4632a4f193e7 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl
@@ -2,6 +2,7 @@
*
* Serial Port Console Redirection Table (SPCR)
*
+ * Copyright (c) 2019, ARM Ltd. All rights reserved.
* Copyright (c) 2017-2018, Andrey Warkentin <andrey.warkentin@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -13,12 +14,12 @@
[008h 0008 1] Revision : 02
[009h 0009 1] Checksum : 00
[00Ah 0010 6] Oem ID : "RPiEFI"
-[010h 0016 8] Oem Table ID : "RPi3UEFI"
+[010h 0016 8] Oem Table ID : "RPi4UEFI"
[018h 0024 4] Oem Revision : 00000001
[01Ch 0028 4] Asl Compiler ID : "----"
[020h 0032 4] Asl Compiler Revision : 00000000
-[024h 0036 1] Interface Type : 10
+[024h 0036 1] Interface Type : 10 // 0x03 = PL011, 0x10 = BCM2835
[025h 0037 3] Reserved : 000000
[028h 0040 12] Serial Port Register : [Generic Address Structure]
@@ -26,16 +27,16 @@
[029h 0041 1] Bit Width : 20
[02Ah 0042 1] Bit Offset : 00
[02Bh 0043 1] Encoded Access Width : 03 [DWord Access:32]
-[02Ch 0044 8] Address : 000000003f215000
+[02Ch 0044 8] Address : FE215000
-[034h 0052 1] Interrupt Type : 0E
+[034h 0052 1] Interrupt Type : 08 // ARMH GIC interrupt
[035h 0053 1] PCAT-compatible IRQ : 00
-[036h 0054 4] Interrupt : 3D
-[03Ah 0058 1] Baud Rate : 07
+[036h 0054 4] Interrupt : 7D
+[03Ah 0058 1] Baud Rate : 07 // 115200
[03Bh 0059 1] Parity : 00
[03Ch 0060 1] Stop Bits : 01
[03Dh 0061 1] Flow Control : 00
-[03Eh 0062 1] Terminal Type : 00
+[03Eh 0062 1] Terminal Type : 02 // VT-UTF8
[04Ch 0076 1] Reserved : 00
[040h 0064 2] PCI Device ID : FFFF
[042h 0066 2] PCI Vendor ID : FFFF
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
index a0067c82c661..15149892f3b0 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
@@ -13,7 +13,7 @@
Device (URT0)
{
Name (_HID, "BCM2837")
- Name (_CID, "HID3123")
+ Name (_CID, "ARMH0011")
Name (_UID, 0x4)
Name (_CCA, 0x0)
Method (_STA)
@@ -24,13 +24,13 @@ Device (URT0)
{
Name (RBUF, ResourceTemplate ()
{
- MEMORY32FIXED (ReadWrite, 0x3F201000, 0x1000,)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x59 }
+ MEMORY32FIXED (ReadWrite, 0xFE201000, 0x1000,)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x99 }
})
Return (RBUF)
}
- Name (CLCK, 3000000)
+ Name (CLCK, 48000000)
Name (_DSD, Package ()
{
@@ -63,8 +63,8 @@ Device (URTM)
{
Name (RBUF, ResourceTemplate ()
{
- MEMORY32FIXED (ReadWrite, 0x3F215000, 0x70,)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x3D}
+ MEMORY32FIXED (ReadWrite, 0xFE215000, 0x70,)
+ Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) { 0x7D }
// NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing
// until a proper solution can be created for the dmap conflict.
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [edk2-platforms][PATCH 5/5] Platform/RPi4: Add base platform files
2019-12-11 11:25 [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Pete Batard
` (3 preceding siblings ...)
2019-12-11 11:25 ` [edk2-platforms][PATCH 4/5] Platform/RPi4: Update ACPI tables for the new platform Pete Batard
@ 2019-12-11 11:25 ` Pete Batard
2019-12-11 16:21 ` [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Ard Biesheuvel
5 siblings, 0 replies; 10+ messages in thread
From: Pete Batard @ 2019-12-11 11:25 UTC (permalink / raw)
To: devel
Cc: ard.biesheuvel, leif.lindholm, philmd, andrey.warkentin,
samer.el-haj-mahmoud
From: Andrei Warkentin <andrey.warkentin@gmail.com>
This enables building the initial RPi4 platform firmware.
Note that PCIe and xHCI are missing at this stage and that this
version of the firmware uses miniUART for serial I/O. PCIe and
xHCI support will be added in a later patch series as well as
the ability to switch between PL011 and miniUART for serial.
Details on how to use the resulting firmware, and especially how
to configure the media for boot, are provided in the Readme.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/RPi4/RPi4.dsc | 637 ++++++++++++++++++++
Platform/RaspberryPi/RPi4/RPi4.fdf | 432 +++++++++++++
Platform/RaspberryPi/RPi4/Readme.md | 110 ++++
3 files changed, 1179 insertions(+)
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
new file mode 100644
index 000000000000..3764d1b3d794
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -0,0 +1,637 @@
+# @file
+#
+# Copyright (c) 2011 - 2019, ARM Limited. All rights reserved.
+# Copyright (c) 2017 - 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
+# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2014, Linaro Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+ PLATFORM_NAME = RPi4
+ PLATFORM_GUID = a7eca3b4-21b0-4989-8c18-c08f3ae87837
+ PLATFORM_VERSION = 1.0
+ DSC_SPECIFICATION = 0x0001001A
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = AARCH64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ FLASH_DEFINITION = Platform/RaspberryPi/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
+
+ #
+ # Network definition
+ #
+ DEFINE NETWORK_TLS_ENABLE = FALSE
+ DEFINE NETWORK_HTTP_BOOT_ENABLE = FALSE
+
+ #
+ # Defines for default states. These can be changed on the command line.
+ # -D FLAG=VALUE
+ #
+ DEFINE SECURE_BOOT_ENABLE = FALSE
+ DEFINE INCLUDE_TFTP_COMMAND = FALSE
+ DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this Platform.
+#
+################################################################################
+[LibraryClasses.common]
+!if $(TARGET) == RELEASE
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+!else
+ DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+!endif
+ DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
+
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+ BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+ SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+ PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+ ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+ PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+ UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+ CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+
+ UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+ OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
+
+ #
+ # Ramdisk Requirements
+ #
+ FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+
+ # Allow dynamic PCDs
+ #
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+
+ # use the accelerated BaseMemoryLibOptDxe by default, overrides for SEC/PEI below
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
+
+ #
+ # It is not possible to prevent the ARM compiler from inserting calls to intrinsic functions.
+ # This library provides the instrinsic functions such a compiler may generate calls to.
+ #
+ NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+
+ # Add support for GCC stack protector
+ NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
+
+ # ARM Architectural Libraries
+ CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
+ DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
+ CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
+ ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
+ ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
+ ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf
+ DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf
+ TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
+ ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
+ 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
+
+ # Cryptographic libraries
+ IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+ BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+ OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
+
+ #
+ # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window
+ # in the debugger will show load and unload commands for symbols. You can cut and paste this
+ # into the command window to load symbols. We should be able to use a script to do this, but
+ # the version of RVD I have does not support scripts accessing system memory.
+ #
+ #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf
+ PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf
+ #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
+
+ DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
+ DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf
+
+ # Flattened Device Tree (FDT) access library
+ FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+
+ # USB Libraries
+ UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
+
+ #
+ # Secure Boot dependencies
+ #
+!if $(SECURE_BOOT_ENABLE) == TRUE
+ TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
+ AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
+
+ # re-use the UserPhysicalPresent() dummy implementation from the ovmf tree
+ PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
+!else
+ TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
+ AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
+!endif
+ VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+ GpioLib|Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
+
+[LibraryClasses.common.SEC]
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+ MemoryInitPeiLib|Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf
+ PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
+ ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
+ LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+ PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
+ HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
+ PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
+ MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
+
+[LibraryClasses.common.DXE_CORE]
+ HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
+ MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
+ DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+ ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+ PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+ SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
+ PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+!if $(INCLUDE_TFTP_COMMAND) == TRUE
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+!endif
+
+[LibraryClasses.common.UEFI_APPLICATION]
+ PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+
+[LibraryClasses.common.UEFI_DRIVER]
+ ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+ PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+
+[LibraryClasses.common.DXE_RUNTIME_DRIVER]
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+ EfiResetSystemLib|Platform/RaspberryPi/Library/ResetLib/ResetLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
+
+!if $(SECURE_BOOT_ENABLE) == TRUE
+ BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
+!endif
+
+###################################################################################################
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process.
+###################################################################################################
+
+[BuildOptions]
+ GCC:*_*_AARCH64_DLINK_FLAGS = -Wl,--fix-cortex-a53-843419
+ GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG -DNDEBUG
+
+[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
+ GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
+
+################################################################################
+#
+# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+#
+################################################################################
+
+[PcdsFeatureFlag.common]
+ # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress
+ gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE
+
+ gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE
+ gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
+
+ ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
+ # It could be set FALSE to save size.
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
+
+[PcdsFixedAtBuild.common]
+ gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
+ gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
+ gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000
+ gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000
+ gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF
+ gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1
+ gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0
+ gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
+ gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress|0x20000
+
+ # DEBUG_ASSERT_ENABLED 0x01
+ # DEBUG_PRINT_ENABLED 0x02
+ # DEBUG_CODE_ENABLED 0x04
+ # CLEAR_MEMORY_ENABLED 0x08
+ # ASSERT_BREAKPOINT_ENABLED 0x10
+ # ASSERT_DEADLOOP_ENABLED 0x20
+!if $(TARGET) == RELEASE
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21
+!else
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
+!endif
+
+ # DEBUG_INIT 0x00000001 // Initialization
+ # DEBUG_WARN 0x00000002 // Warnings
+ # DEBUG_LOAD 0x00000004 // Load events
+ # DEBUG_FS 0x00000008 // EFI File system
+ # DEBUG_POOL 0x00000010 // Alloc & Free (pool)
+ # DEBUG_PAGE 0x00000020 // Alloc & Free (page)
+ # DEBUG_INFO 0x00000040 // Informational debug messages
+ # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers
+ # DEBUG_VARIABLE 0x00000100 // Variable
+ # DEBUG_BM 0x00000400 // Boot Manager
+ # DEBUG_BLKIO 0x00001000 // BlkIo Driver
+ # DEBUG_NET 0x00004000 // SNP Driver
+ # DEBUG_UNDI 0x00010000 // UNDI Driver
+ # DEBUG_LOADFILE 0x00020000 // LoadFile
+ # DEBUG_EVENT 0x00080000 // Event messages
+ # DEBUG_GCD 0x00100000 // Global Coherency Database changes
+ # DEBUG_CACHE 0x00200000 // Memory range cachability changes
+ # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
+ # // significantly impact boot performance
+ # DEBUG_ERROR 0x80000000 // Error
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|$(DEBUG_PRINT_ERROR_LEVEL)
+
+ gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
+
+ #
+ # Optional feature to help prevent EFI memory map fragments
+ # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob
+ # Values are in EFI Pages (4K). DXE Core will make sure that
+ # at least this much of each type of memory can be allocated
+ # from a single memory range. This way you only end up with
+ # maximum of two fragments for each type in the memory map
+ # (the memory used, and the free memory that was prereserved
+ # but not used).
+ #
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0
+!if $(SECURE_BOOT_ENABLE) == TRUE
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|600
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|400
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|1500
+!else
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|300
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|150
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|1000
+!endif
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|12000
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
+
+ gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0xc0000000
+
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"EDK2-DEV"
+
+!if $(SECURE_BOOT_ENABLE) == TRUE
+ # override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
+ gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
+ gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
+ gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
+!endif
+
+[LibraryClasses.common]
+ ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+ ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+ ArmPlatformLib|Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
+ TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
+ CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+ UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+ BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+ PlatformBootManagerLib|Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+ CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
+ FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+
+[LibraryClasses.common.UEFI_DRIVER]
+ UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+
+################################################################################
+#
+# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+#
+################################################################################
+
+[PcdsFeatureFlag.common]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
+ gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
+
+[PcdsFixedAtBuild.common]
+ gArmPlatformTokenSpaceGuid.PcdCoreCount|4
+ gArmTokenSpaceGuid.PcdVFPEnabled|1
+
+ gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
+ gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
+ gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
+
+ # Size of the region used by UEFI in permanent memory (Reserved 64MB)
+ gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
+ #
+ # This matches PcdFvBaseAddress, since everything less is ATF, and
+ # will be reserved away.
+ #
+ gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000
+ gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fc00000
+
+ #
+ # Device specific addresses
+ #
+ gRaspberryPiTokenSpaceGuid.PcdExtendedMemoryBase|0x40000000
+ gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress|0xfc000000
+ gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0xfe000000
+
+ ## NS16550 compatible UART
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0xfe215040
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|500000000
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|0x27
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|8
+ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
+
+ #
+ # ARM General Interrupt Controller
+ #
+ gArmTokenSpaceGuid.PcdGicDistributorBase|0xFF841000
+ gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0xFF842000
+
+ ## Default Terminal Type
+ ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
+ gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
+
+ gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
+ gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
+
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"EDK2"
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
+
+[PcdsDynamicHii.common.DEFAULT]
+
+ #
+ # Clock overrides.
+ #
+
+ gRaspberryPiTokenSpaceGuid.PcdCpuClock|L"CpuClock"|gConfigDxeFormSetGuid|0x0|0
+ gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|L"CustomCpuClock"|gConfigDxeFormSetGuid|0x0|600
+
+ #
+ # SD-related.
+ #
+
+ gRaspberryPiTokenSpaceGuid.PcdSdIsArasan|L"SdIsArasan"|gConfigDxeFormSetGuid|0x0|1
+ gRaspberryPiTokenSpaceGuid.PcdMmcForce1Bit|L"MmcForce1Bit"|gConfigDxeFormSetGuid|0x0|0
+ gRaspberryPiTokenSpaceGuid.PcdMmcForceDefaultSpeed|L"MmcForceDefaultSpeed"|gConfigDxeFormSetGuid|0x0|0
+ gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefaultSpeedMHz"|gConfigDxeFormSetGuid|0x0|25
+ gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|L"MmcSdHighSpeedMHz"|gConfigDxeFormSetGuid|0x0|50
+ gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|L"MmcDisableMulti"|gConfigDxeFormSetGuid|0x0|0
+
+ #
+ # Debug-related.
+ #
+
+ gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|L"DebugEnableJTAG"|gConfigDxeFormSetGuid|0x0|0
+ gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit|L"DebugShowUEFIExit"|gConfigDxeFormSetGuid|0x0|0
+
+ #
+ # Display-related.
+ #
+ gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableScaledVModes"|gConfigDxeFormSetGuid|0x0|0xff
+ gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|gConfigDxeFormSetGuid|0x0|1
+
+ #
+ # Common UEFI ones.
+ #
+
+ gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|5
+ #
+ # This is silly, but by pointing SetupConXXX and ConXXX PCDs to
+ # the same variables, I can use the graphical configuration to
+ # change the mode used by ConSplitter.
+ #
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn|L"Columns"|gRaspberryPiTokenSpaceGuid|0x0|80
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Columns"|gRaspberryPiTokenSpaceGuid|0x0|80
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"Rows"|gRaspberryPiTokenSpaceGuid|0x0|25
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Rows"|gRaspberryPiTokenSpaceGuid|0x0|25
+
+[PcdsDynamicDefault.common]
+ #
+ # Set video resolution for boot options and for text setup.
+ #
+ gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0
+ gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|0
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
+
+################################################################################
+#
+# Components Section - list of all EDK II Modules needed by this Platform
+#
+################################################################################
+[Components.common]
+ #
+ # PEI Phase modules
+ #
+ ArmPlatformPkg/PrePi/PeiUniCore.inf
+
+ #
+ # DXE
+ #
+ MdeModulePkg/Core/Dxe/DxeMain.inf {
+ <LibraryClasses>
+ NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
+ }
+ MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
+ <LibraryClasses>
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ }
+
+ #
+ # Architectural Protocols
+ #
+ ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+ MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+ Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.inf
+ MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+ MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
+ <LibraryClasses>
+ NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ }
+!if $(SECURE_BOOT_ENABLE) == TRUE
+ MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
+ <LibraryClasses>
+ NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
+ }
+ SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
+!else
+ MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+!endif
+ MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+ MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
+ EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
+ EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
+ <LibraryClasses>
+ RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
+ }
+ EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+
+ MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+ MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+ Platform/RaspberryPi/Drivers/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+ MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+ MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+ Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf
+
+ MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+
+ UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
+ ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
+ Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
+ Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf
+ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
+ ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+ MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+ MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+
+ #
+ # FAT filesystem + GPT/MBR partitioning
+ #
+ MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+ MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+ MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+ FatPkg/EnhancedFatDxe/Fat.inf
+
+ #
+ # ACPI Support
+ #
+ MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+ MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+ MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+ Platform/RaspberryPi/$(PLATFORM_NAME)/AcpiTables/AcpiTables.inf
+
+ #
+ # SMBIOS Support
+ #
+ Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
+ MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+
+ #
+ # RAM Disk Support
+ #
+ MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
+
+ #
+ # Bds
+ #
+ MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+ MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
+ MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+ MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
+ MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+ Platform/RaspberryPi/Drivers/LogoDxe/LogoDxe.inf
+ MdeModulePkg/Application/UiApp/UiApp.inf {
+ <LibraryClasses>
+ NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
+ NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
+ NULL|Platform/RaspberryPi/Library/PlatformUiAppLib/PlatformUiAppLib.inf
+ NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
+ }
+
+ #
+ # SCSI Bus and Disk Driver
+ #
+ MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
+ MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+
+ #
+ # USB Support
+ #
+ Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
+ MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
+ MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+ MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+ Drivers/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf
+
+ #
+ # SD/MMC support
+ #
+ # Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
+ Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
+ Platform/RaspberryPi/Drivers/MmcDxe/MmcDxe.inf
+
+ #
+ # Networking stack
+ #
+!include NetworkPkg/Network.dsc.inc
+
+ #
+ # RNG
+ #
+ Silicon/Broadcom/Bcm283x/Drivers/Bcm2838RngDxe/Bcm2838RngDxe.inf
+
+ #
+ # UEFI application (Shell Embedded Boot Loader)
+ #
+ ShellPkg/Application/Shell/Shell.inf {
+ <LibraryClasses>
+ ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
+ NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
+ HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
+
+ <PcdsFixedAtBuild>
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF
+ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+ gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000
+ gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x200000
+ }
+!if $(INCLUDE_TFTP_COMMAND) == TRUE
+ ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+!endif
diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf b/Platform/RaspberryPi/RPi4/RPi4.fdf
new file mode 100644
index 000000000000..f0ab47c6c0a9
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/RPi4.fdf
@@ -0,0 +1,432 @@
+## @file
+#
+# Copyright (c) 2011 - 2019, ARM Limited. All rights reserved.
+# Copyright (c) 2017 - 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
+# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2014, Linaro Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# FD Section
+# The [FD] Section is made up of the definition statements and a
+# description of what goes into the Flash Device Image. Each FD section
+# defines one flash "device" image. A flash device image may be one of
+# the following: Removable media bootable image (like a boot floppy
+# image,) an Option ROM image (that would be "flashed" into an add-in
+# card,) a System "Flash" image (that would be burned into a system's
+# flash) or an Update ("Capsule") image that will be used to update and
+# existing system flash.
+#
+################################################################################
+
+[FD.RPI_EFI]
+BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress
+Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize
+ErasePolarity = 1
+
+BlockSize = 0x00001000|gRaspberryPiTokenSpaceGuid.PcdFirmwareBlockSize
+NumBlocks = 0x200
+
+################################################################################
+#
+# Following are lists of FD Region layout which correspond to the locations of different
+# images within the flash device.
+#
+# Regions must be defined in ascending order and may not overlap.
+#
+# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
+# the pipe "|" character, followed by the size of the region, also in hex with the leading
+# "0x" characters. Like:
+# Offset|Size
+# PcdOffsetCName|PcdSizeCName
+# RegionType <FV, DATA, or FILE>
+#
+################################################################################
+
+#
+# ATF primary boot image
+#
+0x00000000|0x00020000
+FILE = Platform/RaspberryPi/$(PLATFORM_NAME)/TrustedFirmware/bl31_miniuart.bin
+
+#
+# DTB.
+#
+0x00020000|0x00010000
+DATA = { 0x00 }
+
+#
+# UEFI image
+#
+0x00030000|0x001b0000
+gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
+FV = FVMAIN_COMPACT
+
+#
+# Variables (0x20000 overall).
+#
+# 0x001e0000 - 0x001edfff EFI_FIRMWARE_VOLUME_HEADER
+# 0x001ee000 - 0x001eefff Event log
+# 0x001ef000 - 0x001effff EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER-
+# 0x001f0000 - 0x001fffff Data
+#
+
+# NV_VARIABLE_STORE
+0x001e0000|0x0000e000
+gRaspberryPiTokenSpaceGuid.PcdNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
+
+DATA = {
+ ## This is the EFI_FIRMWARE_VOLUME_HEADER
+ # ZeroVector []
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ # FileSystemGuid: gEfiSystemNvDataFvGuid =
+ # { 0xFFF12B8D, 0x7696, 0x4C8B,
+ # { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }}
+ 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C,
+ 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50,
+ # FvLength: 0x20000
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ # Signature "_FVH" # Attributes
+ 0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00,
+ # HeaderLength
+ 0x48, 0x00,
+ # CheckSum
+ 0x19, 0xF9,
+ # ExtHeaderOffset #Reserved #Revision
+ 0x00, 0x00, 0x00, 0x02,
+ # Blockmap[0]: 0x20 Blocks * 0x1000 Bytes / Block
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+ # Blockmap[1]: End
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ ## This is the VARIABLE_STORE_HEADER
+ # It is compatible with SECURE_BOOT_ENABLE == FALSE as well.
+ # Signature: gEfiAuthenticatedVariableGuid =
+ # { 0xaaf32c78, 0x947b, 0x439a,
+ # { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 }}
+ 0x78, 0x2c, 0xf3, 0xaa, 0x7b, 0x94, 0x9a, 0x43,
+ 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92,
+ # Size: 0xe000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize) -
+ # 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) = 0xdfb8
+ # This can speed up the Variable Dispatch a bit.
+ 0xB8, 0xDF, 0x00, 0x00,
+ # FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32
+ 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+}
+
+# NV_EVENT_LOG
+0x001ee000|0x00001000
+gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogBase|gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogSize
+
+# NV_FTW_WORKING header
+0x001ef000|0x00001000
+gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
+
+DATA = {
+ # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature = gEdkiiWorkingBlockSignatureGuid =
+ # { 0x9e58292b, 0x7c68, 0x497d, { 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95 }}
+ 0x2b, 0x29, 0x58, 0x9e, 0x68, 0x7c, 0x7d, 0x49,
+ 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95,
+ # Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Reserved
+ 0x2c, 0xaf, 0x2c, 0x64, 0xFE, 0xFF, 0xFF, 0xFF,
+ # WriteQueueSize: UINT64
+ 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+}
+
+# NV_FTW_WORKING data
+0x001f0000|0x00010000
+gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
+
+################################################################################
+#
+# FV Section
+#
+# [FV] section is used to define what components or modules are placed within a flash
+# device file. This section also defines order the components and modules are positioned
+# within the image. The [FV] section consists of define statements, set statements and
+# module statements.
+#
+################################################################################
+
+[FV.FvMain]
+FvNameGuid = 9a15aa37-d555-4a4e-b541-86391ff68164
+BlockSize = 0x40
+NumBlocks = 0 # This FV gets compressed so make it just big enough
+FvAlignment = 16 # FV alignment and FV attributes setting.
+ERASE_POLARITY = 1
+MEMORY_MAPPED = TRUE
+STICKY_WRITE = TRUE
+LOCK_CAP = TRUE
+LOCK_STATUS = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP = TRUE
+WRITE_STATUS = TRUE
+WRITE_LOCK_CAP = TRUE
+WRITE_LOCK_STATUS = TRUE
+READ_DISABLED_CAP = TRUE
+READ_ENABLED_CAP = TRUE
+READ_STATUS = TRUE
+READ_LOCK_CAP = TRUE
+READ_LOCK_STATUS = TRUE
+
+ INF MdeModulePkg/Core/Dxe/DxeMain.inf
+ INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+
+ #
+ # PI DXE Drivers producing Architectural Protocols (EFI Services)
+ #
+ INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+ INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+ INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+ INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+ INF Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.inf
+ INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+ INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+!if $(SECURE_BOOT_ENABLE) == TRUE
+ INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
+!endif
+ INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
+ INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
+ INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
+ INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+ INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+
+ #
+ # Multiple Console IO support
+ #
+ INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+ INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+ INF Platform/RaspberryPi/Drivers/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+ INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+ INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+ INF Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf
+
+ INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
+ INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
+ INF Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
+ INF Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf
+ INF Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
+ INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+ INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+ INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+
+ #
+ # FAT filesystem + GPT/MBR partitioning
+ #
+ INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+ INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+ INF FatPkg/EnhancedFatDxe/Fat.inf
+ INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+
+ #
+ # UEFI application (Shell Embedded Boot Loader)
+ #
+ INF ShellPkg/Application/Shell/Shell.inf
+!if $(INCLUDE_TFTP_COMMAND) == TRUE
+ INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+!endif
+
+ #
+ # ACPI Support
+ #
+ INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+ INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+ INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+ INF RuleOverride = ACPITABLE Platform/RaspberryPi/$(PLATFORM_NAME)/AcpiTables/AcpiTables.inf
+
+ #
+ # SMBIOS Support
+ #
+ INF Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
+ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+
+ #
+ # RAM Disk Support
+ #
+ INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
+
+ #
+ # Bds
+ #
+ INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+ INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
+ INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+ INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
+ INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+ INF MdeModulePkg/Application/UiApp/UiApp.inf
+
+ #
+ # Networking stack
+ #
+!include NetworkPkg/Network.fdf.inc
+
+ #
+ # RNG
+ #
+ INF Silicon/Broadcom/Bcm283x/Drivers/Bcm2838RngDxe/Bcm2838RngDxe.inf
+
+ #
+ # SCSI Bus and Disk Driver
+ #
+ INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
+ INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+
+ #
+ # USB Support
+ #
+ INF Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
+ INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
+ INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+ INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+ INF Drivers/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf
+
+ #
+ # SD/MMC support
+ #
+ # INF Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
+ INF Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
+ INF Platform/RaspberryPi/Drivers/MmcDxe/MmcDxe.inf
+
+ #
+ # Pi logo (splash screen)
+ #
+ INF Platform/RaspberryPi/Drivers/LogoDxe/LogoDxe.inf
+
+ #
+ # Device Tree support (used by FdtDxe)
+ # GUIDs should match gRaspberryPi#####FdtGuid's from the .dec
+ #
+ FILE FREEFORM = 80AB6833-CAE4-4CEE-B59D-EB2039B05551 {
+ SECTION RAW = Platform/RaspberryPi/$(PLATFORM_NAME)/DeviceTree/bcm2711-rpi-4-b.dtb
+ }
+
+[FV.FVMAIN_COMPACT]
+FvAlignment = 16
+ERASE_POLARITY = 1
+MEMORY_MAPPED = TRUE
+STICKY_WRITE = TRUE
+LOCK_CAP = TRUE
+LOCK_STATUS = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP = TRUE
+WRITE_STATUS = TRUE
+WRITE_LOCK_CAP = TRUE
+WRITE_LOCK_STATUS = TRUE
+READ_DISABLED_CAP = TRUE
+READ_ENABLED_CAP = TRUE
+READ_STATUS = TRUE
+READ_LOCK_CAP = TRUE
+READ_LOCK_STATUS = TRUE
+
+ INF ArmPlatformPkg/PrePi/PeiUniCore.inf
+ FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
+ SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
+ SECTION FV_IMAGE = FVMAIN
+ }
+ }
+
+################################################################################
+#
+# Rules are use with the [FV] section's module INF type to define
+# how an FFS file is created for a given INF file. The following Rule are the default
+# rules for the different module type. User can add the customized rules to define the
+# content of the FFS file.
+#
+################################################################################
+
+
+############################################################################
+# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
+############################################################################
+#
+#[Rule.Common.DXE_DRIVER]
+# FILE DRIVER = $(NAMED_GUID) {
+# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+# COMPRESS PI_STD {
+# GUIDED {
+# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+# UI STRING="$(MODULE_NAME)" Optional
+# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+# }
+# }
+# }
+#
+############################################################################
+
+[Rule.Common.SEC]
+ FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED FIXED {
+ TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
+ }
+
+[Rule.Common.PEI_CORE]
+ FILE PEI_CORE = $(NAMED_GUID) FIXED {
+ TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING ="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.PEIM]
+ FILE PEIM = $(NAMED_GUID) FIXED {
+ PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+ TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.DXE_CORE]
+ FILE DXE_CORE = $(NAMED_GUID) {
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.UEFI_DRIVER]
+ FILE DRIVER = $(NAMED_GUID) {
+ DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.DXE_DRIVER]
+ FILE DRIVER = $(NAMED_GUID) {
+ DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ RAW ACPI Optional |.acpi
+ RAW ASL Optional |.aml
+ }
+
+[Rule.Common.DXE_RUNTIME_DRIVER]
+ FILE DRIVER = $(NAMED_GUID) {
+ DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.UEFI_APPLICATION]
+ FILE APPLICATION = $(NAMED_GUID) {
+ UI STRING ="$(MODULE_NAME)" Optional
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ }
+
+[Rule.Common.UEFI_DRIVER.BINARY]
+ FILE DRIVER = $(NAMED_GUID) {
+ DXE_DEPEX DXE_DEPEX Optional |.depex
+ PE32 PE32 |.efi
+ UI STRING="$(MODULE_NAME)" Optional
+ VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+ }
+
+[Rule.Common.UEFI_APPLICATION.BINARY]
+ FILE APPLICATION = $(NAMED_GUID) {
+ PE32 PE32 |.efi
+ UI STRING="$(MODULE_NAME)" Optional
+ VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+ }
+
+[Rule.Common.USER_DEFINED.ACPITABLE]
+ FILE FREEFORM = $(NAMED_GUID) {
+ RAW ACPI |.acpi
+ RAW ASL |.aml
+ }
diff --git a/Platform/RaspberryPi/RPi4/Readme.md b/Platform/RaspberryPi/RPi4/Readme.md
new file mode 100644
index 000000000000..917f8436a382
--- /dev/null
+++ b/Platform/RaspberryPi/RPi4/Readme.md
@@ -0,0 +1,110 @@
+Raspberry Pi 4 Platform
+=======================
+
+# Summary
+
+This is a port of 64-bit Tiano Core UEFI firmware for the Raspberry Pi 4 platforms.
+
+This is intended to be useful 64-bit [TF-A](https://www.trustedfirmware.org/) +
+UEFI implementation for the Raspberry Pi 4 which should be good enough for most
+kind of UEFI development, as well as for running consummer Operating Systems
+such as Linux or Windows.
+
+Raspberry Pi is a trademark of the [Raspberry Pi Foundation](https://www.raspberrypi.org).
+
+# Status
+
+This firmware is still in early stage of development, meaning that it comes with
+the following __major__ limitations:
+
+- USB is not supported yet (will be added soon)
+- Booting of vanilla Operating Systems (Windows, Linux) is not supported yet,
+ let alone expected to work at all.
+
+The only features that are expected to work with this first iteration of the
+firmware are HDMI and serial I/O.
+
+## Known issues
+
+- The serial output from TF-A is garbled when using a `start4.elf` that was
+ released after 2019.11.18. This is a TF-A issue that will be fixed in a
+ later version.
+
+# Building
+
+Build instructions from the top level edk2-platforms Readme.md apply.
+
+# Booting the firmware
+
+1. Format a uSD card as FAT16 or FAT32
+2. Copy the generated `RPI_EFI.fd` firmware onto the partition
+3. Download and copy the following files from https://github.com/raspberrypi/firmware/tree/master/boot
+ - `bcm2711-rpi-4-b.dtb`
+ - `fixup4.dat`
+ - `start4.elf`
+4. Create a `config.txt` with the following content:
+ ```
+ arm_64bit=1
+ enable_uart=1
+ core_freq=250
+ enable_gic=1
+ armstub=RPI_EFI.fd
+ ```
+5. Insert the uSD card and power up the Pi.
+
+# Notes
+
+## ARM Trusted Firmware (TF-A)
+
+The TF-A binaries were compiled from a TF-A source over which 2 serial-output related
+patches were applied, the first one to fix the miniUART baud rate not being properly
+set to 115200 bauds with recent versions of `start4.elf` and the second one to allow
+swicthing between miniUART and PL011 at build time.
+
+No other alterations to the official source have been applied.
+
+For more details on the TF-A compilation, see the [Readme](./TrustedFirmware/Readme.md)
+in the `TrustedFirmware/` directory.
+
+## Device Tree
+
+You can pass a custom Device Tree and overlays using the following:
+
+```
+(...)
+disable_commandline_tags=2
+device_tree_address=0x20000
+device_tree_end=0x30000
+device_tree=bcm2711-rpi-4-b.dtb
+```
+
+Note: the address range **must** be `[0x20000:0x30000]`.
+`dtoverlay` and `dtparam` parameters are also supported **when** providing a Device Tree`.
+
+## Custom `bootargs`
+
+This firmware will honor the command line passed by the GPU via `cmdline.txt`.
+
+Note, that the ultimate contents of `/chosen/bootargs` are a combination of several pieces:
+- Original `/chosen/bootargs` if using the internal DTB. Seems to be completely discarded by GPU when booting with a custom device tree.
+- GPU-passed hardware configuration. This one is always present.
+- Additional boot options passed via `cmdline.txt`.
+
+# Limitations
+
+## NVRAM
+
+The Raspberry Pi has no NVRAM.
+
+NVRAM is emulated, with the non-volatile store backed by the UEFI image itself. This
+means that any changes made in UEFI proper are persisted, but changes made from within
+an Operating System aren't.
+
+## RTC
+
+The Rasberry Pi has no RTC.
+
+An `RtcEpochSeconds` NVRAM variable is used to store the boot time.
+This should allow you to set whatever date/time you want using the Shell date and
+time commands. While in UEFI or HLOS, the time will tick forward.
+`RtcEpochSeconds` is not updated on reboots.
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [edk2-platforms][PATCH 1/5] Platform/RPi: Fix overlap of SoC registers and RAM
2019-12-11 11:25 ` [edk2-platforms][PATCH 1/5] Platform/RPi: Fix overlap of SoC registers and RAM Pete Batard
@ 2019-12-11 12:21 ` Philippe Mathieu-Daudé
2019-12-11 12:39 ` Pete Batard
0 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-11 12:21 UTC (permalink / raw)
To: Pete Batard, devel
Cc: ard.biesheuvel, leif.lindholm, andrey.warkentin,
samer.el-haj-mahmoud
On 12/11/19 12:25 PM, Pete Batard wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> Having RAM and SoC register regions overlap is problematic for MMIO,
> since, at the very least, we don't want these regions to be declared
> as cacheable.
>
> Signed-off-by: Pete Batard <pete@akeo.ie>
> ---
> Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 36 +++++++++++++-------
> 1 file changed, 23 insertions(+), 13 deletions(-)
>
> diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> index cc761bea1307..781cf78b83d3 100644
> --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> @@ -60,7 +60,7 @@ ArmPlatformGetVirtualMemoryMap (
> {
> UINTN Index = 0;
> UINTN GpuIndex;
> - INT64 ExtendedMemorySize;
> + INT64 SystemMemorySize;
> ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
>
> // Early output of the info we got from VideoCore can prove valuable.
> @@ -120,21 +120,21 @@ ArmPlatformGetVirtualMemoryMap (
> VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
> VirtualMemoryInfo[Index++].Name = L"GPU Reserved";
>
> - // Compute the amount of extended RAM available on this platform
> - ExtendedMemorySize = SIZE_256MB;
> - ExtendedMemorySize <<= (mBoardRevision >> 20) & 0x07;
> - ExtendedMemorySize -= SIZE_1GB;
> - if (ExtendedMemorySize > 0) {
> - VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdExtendedMemoryBase);
> - VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
> - VirtualMemoryTable[Index].Length = ExtendedMemorySize;
> - VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> - VirtualMemoryInfo[Index].Type = RPI_MEM_BASIC_REGION;
> - VirtualMemoryInfo[Index++].Name = L"Extended System RAM";
> - }
> + // Compute the total RAM size available on this platform
> + SystemMemorySize = SIZE_256MB;
> + SystemMemorySize <<= (mBoardRevision >> 20) & 0x07;
TIL I learn this field is 3 bits (I thought it was 4).
> +
> + //
> + // Ensure that what we declare as System Memory doesn't overlap with the
> + // Bcm2836 SoC registers. This can be achieved through a MIN () with the
> + // base address since SystemMemoryBase is 0 (we assert if it isn't).
Is the later comment "// On the Pi 3 the SoC registers may overlap
VideoCore => fix this
" still accurate?
> + //
> + SystemMemorySize = MIN(SystemMemorySize, BCM2836_SOC_REGISTERS);
>
> // Extended SoC registers (PCIe, genet, ...)
> if (BCM2711_SOC_REGISTERS > 0) {
> + // Same overlap protection as above for the Bcm2711 SoC registers
> + SystemMemorySize = MIN(SystemMemorySize, BCM2711_SOC_REGISTERS);
> VirtualMemoryTable[Index].PhysicalBase = BCM2711_SOC_REGISTERS;
> VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
> VirtualMemoryTable[Index].Length = BCM2711_SOC_REGISTER_LENGTH;
> @@ -155,6 +155,16 @@ ArmPlatformGetVirtualMemoryMap (
> VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
> VirtualMemoryInfo[Index++].Name = L"SoC Reserved (283x)";
Sigh, the 2711/2838 naming is very confusing.
>
> + // If we have RAM above the 1 GB mark, declare it
> + if (SystemMemorySize - SIZE_1GB > 0) {
> + VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdExtendedMemoryBase);
> + VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
> + VirtualMemoryTable[Index].Length = SystemMemorySize - SIZE_1GB;
> + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> + VirtualMemoryInfo[Index].Type = RPI_MEM_BASIC_REGION;
> + VirtualMemoryInfo[Index++].Name = L"Extended System RAM";
> + }
> +
> // End of Table
> VirtualMemoryTable[Index].PhysicalBase = 0;
> VirtualMemoryTable[Index].VirtualBase = 0;
>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory
2019-12-11 11:25 ` [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory Pete Batard
@ 2019-12-11 12:22 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-11 12:22 UTC (permalink / raw)
To: Pete Batard, devel
Cc: ard.biesheuvel, leif.lindholm, andrey.warkentin,
samer.el-haj-mahmoud
On 12/11/19 12:25 PM, Pete Batard wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> When using ACPI OpRegions to poke device registers, Linux will use
> the UEFI memory map to decide which memory attributes to use, and
> so they should not be described as cacheable memory.
>
> Since MMIO regions that don't require an OS virtual mapping at runtime
> don't really belong in the UEFI memory map to begin with, omit them
> entirely.
>
> Signed-off-by: Pete Batard <pete@akeo.ie>
> ---
> Platform/RaspberryPi/Include/Library/RPiMem.h | 7 ++++---
> Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 10 ++++++++++
> Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 6 +++---
> 3 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/Platform/RaspberryPi/Include/Library/RPiMem.h b/Platform/RaspberryPi/Include/Library/RPiMem.h
> index 9d38e4b6cfb3..a033af369bb0 100644
> --- a/Platform/RaspberryPi/Include/Library/RPiMem.h
> +++ b/Platform/RaspberryPi/Include/Library/RPiMem.h
> @@ -9,9 +9,10 @@
> #ifndef RPI_MEM_H__
> #define RPI_MEM_H__
>
> -#define RPI_MEM_BASIC_REGION 0
> -#define RPI_MEM_RUNTIME_REGION 1
> -#define RPI_MEM_RESERVED_REGION 2
> +#define RPI_MEM_UNMAPPED_REGION 0
> +#define RPI_MEM_BASIC_REGION 1
> +#define RPI_MEM_RUNTIME_REGION 2
> +#define RPI_MEM_RESERVED_REGION 3
>
> typedef struct {
> CONST CHAR16* Name;
> diff --git a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
> index 3a0f7e19e993..7ba1cc5602d2 100644
> --- a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
> +++ b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
> @@ -72,6 +72,15 @@ AddRuntimeServicesRegion (
> );
> }
>
> +STATIC
> +VOID
> +AddUnmappedMemoryRegion (
> + IN ARM_MEMORY_REGION_DESCRIPTOR *Desc
> + )
> +{
> + // Do nothing
> +}
> +
> STATIC
> VOID
> AddReservedMemoryRegion (
> @@ -88,6 +97,7 @@ AddReservedMemoryRegion (
> }
>
> void (*AddRegion[]) (IN ARM_MEMORY_REGION_DESCRIPTOR *Desc) = {
> + AddUnmappedMemoryRegion,
> AddBasicMemoryRegion,
> AddRuntimeServicesRegion,
> AddReservedMemoryRegion,
> diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> index 781cf78b83d3..f8223d1b94e8 100644
> --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> @@ -117,7 +117,7 @@ ArmPlatformGetVirtualMemoryMap (
> VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
> VirtualMemoryTable[Index].Length = mVideoCoreSize;
> VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
> + VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION;
> VirtualMemoryInfo[Index++].Name = L"GPU Reserved";
>
> // Compute the total RAM size available on this platform
> @@ -139,7 +139,7 @@ ArmPlatformGetVirtualMemoryMap (
> VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
> VirtualMemoryTable[Index].Length = BCM2711_SOC_REGISTER_LENGTH;
> VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
> + VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION;
> VirtualMemoryInfo[Index++].Name = L"SoC Reserved (27xx)";
> }
>
> @@ -152,7 +152,7 @@ ArmPlatformGetVirtualMemoryMap (
> VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
> VirtualMemoryTable[Index].Length = BCM2836_SOC_REGISTER_LENGTH;
> VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
> + VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION;
> VirtualMemoryInfo[Index++].Name = L"SoC Reserved (283x)";
>
> // If we have RAM above the 1 GB mark, declare it
>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-platforms][PATCH 1/5] Platform/RPi: Fix overlap of SoC registers and RAM
2019-12-11 12:21 ` Philippe Mathieu-Daudé
@ 2019-12-11 12:39 ` Pete Batard
0 siblings, 0 replies; 10+ messages in thread
From: Pete Batard @ 2019-12-11 12:39 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, devel
Cc: ard.biesheuvel, leif.lindholm, andrey.warkentin,
samer.el-haj-mahmoud
Hi Philippe, thanks for reviewing these.
On 2019.12.11 12:21, Philippe Mathieu-Daudé wrote:
> On 12/11/19 12:25 PM, Pete Batard wrote:
>> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>
>> Having RAM and SoC register regions overlap is problematic for MMIO,
>> since, at the very least, we don't want these regions to be declared
>> as cacheable.
>>
>> Signed-off-by: Pete Batard <pete@akeo.ie>
>> ---
>> Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 36
>> +++++++++++++-------
>> 1 file changed, 23 insertions(+), 13 deletions(-)
>>
>> diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
>> b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
>> index cc761bea1307..781cf78b83d3 100644
>> --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
>> +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
>> @@ -60,7 +60,7 @@ ArmPlatformGetVirtualMemoryMap (
>> {
>> UINTN Index = 0;
>> UINTN GpuIndex;
>> - INT64 ExtendedMemorySize;
>> + INT64 SystemMemorySize;
>> ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
>> // Early output of the info we got from VideoCore can prove valuable.
>> @@ -120,21 +120,21 @@ ArmPlatformGetVirtualMemoryMap (
>> VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
>> VirtualMemoryInfo[Index++].Name = L"GPU Reserved";
>> - // Compute the amount of extended RAM available on this platform
>> - ExtendedMemorySize = SIZE_256MB;
>> - ExtendedMemorySize <<= (mBoardRevision >> 20) & 0x07;
>> - ExtendedMemorySize -= SIZE_1GB;
>> - if (ExtendedMemorySize > 0) {
>> - VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64
>> (PcdExtendedMemoryBase);
>> - VirtualMemoryTable[Index].VirtualBase =
>> VirtualMemoryTable[Index].PhysicalBase;
>> - VirtualMemoryTable[Index].Length = ExtendedMemorySize;
>> - VirtualMemoryTable[Index].Attributes =
>> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
>> - VirtualMemoryInfo[Index].Type = RPI_MEM_BASIC_REGION;
>> - VirtualMemoryInfo[Index++].Name = L"Extended System RAM";
>> - }
>> + // Compute the total RAM size available on this platform
>> + SystemMemorySize = SIZE_256MB;
>> + SystemMemorySize <<= (mBoardRevision >> 20) & 0x07;
>
> TIL I learn this field is 3 bits (I thought it was 4).
"32 GB should be enough for everybody" (which is the max RAM you'll be
able to declare in 3 bits with the current scheme).
Unless RAM becomes very very cheap, I doubt the Raspberry Pi foundation
considers the current limit as much of a problem...
>
>> +
>> + //
>> + // Ensure that what we declare as System Memory doesn't overlap
>> with the
>> + // Bcm2836 SoC registers. This can be achieved through a MIN ()
>> with the
>> + // base address since SystemMemoryBase is 0 (we assert if it isn't).
>
> Is the later comment "// On the Pi 3 the SoC registers may overlap
> VideoCore => fix this
> " still accurate?
It is. We read the size of the GPU region (mVideoCoreSize) and the size
of the System RAM from different queries. The thing is actually that
VideoCore on the Pi 3 considers that its region should encompass the SoC
registers, so it reports a size that does so, whereas we want to report
them as separate regions (like they are reported on the Pi 4).
Regards,
/Pete
>> + //
>> + SystemMemorySize = MIN(SystemMemorySize, BCM2836_SOC_REGISTERS);
>> // Extended SoC registers (PCIe, genet, ...)
>> if (BCM2711_SOC_REGISTERS > 0) {
>> + // Same overlap protection as above for the Bcm2711 SoC registers
>> + SystemMemorySize = MIN(SystemMemorySize,
>> BCM2711_SOC_REGISTERS);
>> VirtualMemoryTable[Index].PhysicalBase = BCM2711_SOC_REGISTERS;
>> VirtualMemoryTable[Index].VirtualBase =
>> VirtualMemoryTable[Index].PhysicalBase;
>> VirtualMemoryTable[Index].Length =
>> BCM2711_SOC_REGISTER_LENGTH;
>> @@ -155,6 +155,16 @@ ArmPlatformGetVirtualMemoryMap (
>> VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
>> VirtualMemoryInfo[Index++].Name = L"SoC Reserved (283x)";
>
> Sigh, the 2711/2838 naming is very confusing.
>
>> + // If we have RAM above the 1 GB mark, declare it
>> + if (SystemMemorySize - SIZE_1GB > 0) {
>> + VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64
>> (PcdExtendedMemoryBase);
>> + VirtualMemoryTable[Index].VirtualBase =
>> VirtualMemoryTable[Index].PhysicalBase;
>> + VirtualMemoryTable[Index].Length = SystemMemorySize -
>> SIZE_1GB;
>> + VirtualMemoryTable[Index].Attributes =
>> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
>> + VirtualMemoryInfo[Index].Type = RPI_MEM_BASIC_REGION;
>> + VirtualMemoryInfo[Index++].Name = L"Extended System RAM";
>> + }
>> +
>> // End of Table
>> VirtualMemoryTable[Index].PhysicalBase = 0;
>> VirtualMemoryTable[Index].VirtualBase = 0;
>>
>
> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform
2019-12-11 11:25 [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Pete Batard
` (4 preceding siblings ...)
2019-12-11 11:25 ` [edk2-platforms][PATCH 5/5] Platform/RPi4: Add base platform files Pete Batard
@ 2019-12-11 16:21 ` Ard Biesheuvel
5 siblings, 0 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2019-12-11 16:21 UTC (permalink / raw)
To: Pete Batard
Cc: edk2-devel-groups-io, Leif Lindholm, Philippe Mathieu-Daudé,
Andrei E. Warkentin, samer.el-haj-mahmoud
On Wed, 11 Dec 2019 at 12:26, Pete Batard <pete@akeo.ie> wrote:
>
> This series adds basic support to build the Raspberry Pi 4 platform.
>
> It requires the earlier series, that add binary files for the platform,
> to have been applied to edk2-non-osi.
>
> For the introduction of the platform, USB support is not yet enabled
> which means that user I/O has to be carried out through serial.
>
> The first two patches of the series are fixes for the common RPi
> platform that will become relevant when we introduce support for
> PCIe/xHCI.
>
> The second two patch deal with the specific ACPI changes for the
> Pi 4 platform. To make these clearer, an intermediate patch, that
> simply enacts a straight unaltered copy of the Pi 3 ACPI files is
> added, so that the changes we apply can be made obvious. We also
> use this opportunity to switch the source of some tables (GTDT,
> MADT) to proper aslc.
>
> Finally, the last patch in this series adds the platform files
> along with a Readme detailing the installation requirements and
> current state of the platform.
>
> Andrei Warkentin (2):
> Platform/RPi4: Update ACPI tables for the new platform
> Platform/RPi4: Add base platform files
>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Ard Biesheuvel (2):
> Platform/RPi: Fix overlap of SoC registers and RAM
> Platform/RPi: Don't describe MMIO regions as memory
>
> Samer El-Haj-Mahmoud (1):
> Platform/RPi4: Add initial ACPI tables
>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Pushed as c5a2065ee8c2..065a5597f36a
Thanks!
> Platform/RaspberryPi/Include/Library/RPiMem.h | 7 +-
> Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 10 +
> Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 42 +-
> Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h | 92 +++
> Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf | 49 ++
> Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc | 327 ++++++++++
> Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc | 28 +
> Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl | 505 ++++++++++++++++
> Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc | 46 ++
> Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc | 56 ++
> Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc | 64 ++
> Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl | 90 +++
> Platform/RaspberryPi/RPi4/AcpiTables/Pep.c | 79 +++
> Platform/RaspberryPi/RPi4/AcpiTables/Pep.h | 121 ++++
> Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl | 195 ++++++
> Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl | 99 +++
> Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl | 48 ++
> Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl | 152 +++++
> Platform/RaspberryPi/RPi4/RPi4.dsc | 637 ++++++++++++++++++++
> Platform/RaspberryPi/RPi4/RPi4.fdf | 432 +++++++++++++
> Platform/RaspberryPi/RPi4/Readme.md | 110 ++++
> 21 files changed, 3170 insertions(+), 19 deletions(-)
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Pep.c
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Pep.h
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl
> create mode 100644 Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
> create mode 100644 Platform/RaspberryPi/RPi4/RPi4.dsc
> create mode 100644 Platform/RaspberryPi/RPi4/RPi4.fdf
> create mode 100644 Platform/RaspberryPi/RPi4/Readme.md
>
> --
> 2.21.0.windows.1
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-12-11 16:21 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-11 11:25 [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 1/5] Platform/RPi: Fix overlap of SoC registers and RAM Pete Batard
2019-12-11 12:21 ` Philippe Mathieu-Daudé
2019-12-11 12:39 ` Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory Pete Batard
2019-12-11 12:22 ` Philippe Mathieu-Daudé
2019-12-11 11:25 ` [edk2-platforms][PATCH 3/5] Platform/RPi4: Add initial ACPI tables Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 4/5] Platform/RPi4: Update ACPI tables for the new platform Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 5/5] Platform/RPi4: Add base platform files Pete Batard
2019-12-11 16:21 ` [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox