* [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements
@ 2020-03-26 11:53 Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 1/6] Platform/RPi/AcpiTables: Fix Pi 4 interrupts values Pete Batard
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Pete Batard @ 2020-03-26 11:53 UTC (permalink / raw)
To: devel; +Cc: ard.biesheuvel, leif, philmd, awarkentin
This patchset brings additional cleanup and improvements to the factorized
ACPI table generation for the Pi platform by:
* Updating the Pi 4 interrupts we know of to their proper values.
* Removing VendorLong () sections in the ASL data we inherited from Microsoft.
* Improving MADT factorization through the use of PCDs.
* Setting ACPI IDs to more professional expected values.
* Adding proper DMA translation for devices that sit behind GPU/VideoCore.
It should be noted that this patchset was checked for regressions against a
Pi 3 running Windows 10 as well as well as a Pi 4 running Debian Linux.
Andrei Warkentin (3):
Platform/RPi/AcpiTables: Replace VendorLong () blobs with PinFunction
()
Platform/RPi/AcpiTables: Move GPU devices into a separate ASL file
Platform/RPi/AcpiTables: Describe DMA constraints for devices behind
GPU
Pete Batard (3):
Platform/RPi/AcpiTables: Fix Pi 4 interrupts values
Platform/RPi/AcpiTables: Use PCDs in MADT
Platform/RPi/AcpiTables: Clean up ACPI IDs
Platform/RaspberryPi/AcpiTables/AcpiTables.h | 46 +-
Platform/RaspberryPi/AcpiTables/AcpiTables.inf | 8 +
Platform/RaspberryPi/AcpiTables/Dsdt.asl | 581 +++++---------------
Platform/RaspberryPi/AcpiTables/Fadt.aslc | 10 +
Platform/RaspberryPi/AcpiTables/GpuDevs.asl | 393 +++++++++++++
Platform/RaspberryPi/AcpiTables/Madt.aslc | 31 +-
Platform/RaspberryPi/AcpiTables/Uart.asl | 16 +-
Platform/RaspberryPi/RPi3/RPi3.dsc | 9 +
Platform/RaspberryPi/RPi4/RPi4.dsc | 7 +
Platform/RaspberryPi/RaspberryPi.dec | 7 +
10 files changed, 601 insertions(+), 507 deletions(-)
create mode 100644 Platform/RaspberryPi/AcpiTables/GpuDevs.asl
--
2.21.0.windows.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [edk2-platforms][PATCH 1/6] Platform/RPi/AcpiTables: Fix Pi 4 interrupts values
2020-03-26 11:53 [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Pete Batard
@ 2020-03-26 11:53 ` Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 2/6] Platform/RPi/AcpiTables: Replace VendorLong () blobs with PinFunction () Pete Batard
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Pete Batard @ 2020-03-26 11:53 UTC (permalink / raw)
To: devel; +Cc: ard.biesheuvel, leif, philmd, awarkentin
Some of the Pi 4 interrupts were copied from Pi 3 and are incorrect.
We fix the ones that can be found by decompiling the official .dtbs.
We also add a couple more GPIO interrupts, that are used for both
the Pi 3 and the Pi 4, as per the dtbs.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/AcpiTables/AcpiTables.h | 24 ++++++++++++--------
Platform/RaspberryPi/AcpiTables/Dsdt.asl | 6 ++++-
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/AcpiTables/AcpiTables.h
index 0b8a8494450c..712a4a5806ae 100644
--- a/Platform/RaspberryPi/AcpiTables/AcpiTables.h
+++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.h
@@ -125,7 +125,9 @@ typedef struct
#define BCM2836_MBOX_INTERRUPT 0x61
#define BCM2836_VCHIQ_INTERRUPT 0x62
#define BCM2386_GPIO_INTERRUPT0 0x51
-#define BCM2386_GPIO_INTERRUPT1 0x53
+#define BCM2386_GPIO_INTERRUPT1 0x52
+#define BCM2386_GPIO_INTERRUPT2 0x53
+#define BCM2386_GPIO_INTERRUPT3 0x54
#define BCM2836_I2C1_INTERRUPT 0x55
#define BCM2836_I2C2_INTERRUPT 0x55
#define BCM2836_SPI0_INTERRUPT 0x56
@@ -137,21 +139,23 @@ typedef struct
#elif (RPI_MODEL == 4)
#define BCM2836_V3D_BUS_INTERRUPT 0x2A
#define BCM2836_DMA_INTERRUPT 0x3B
-#define BCM2836_SPI1_INTERRUPT 0x3D
-#define BCM2836_SPI2_INTERRUPT 0x3D
+#define BCM2836_SPI1_INTERRUPT 0x7D
+#define BCM2836_SPI2_INTERRUPT 0x7D
#define BCM2836_HVS_INTERRUPT 0x41
#define BCM2836_HDMI0_INTERRUPT 0x48
#define BCM2836_HDMI1_INTERRUPT 0x49
#define BCM2836_PV2_INTERRUPT 0x4A
#define BCM2836_PV0_INTERRUPT 0x4D
#define BCM2836_PV1_INTERRUPT 0x4E
-#define BCM2836_MBOX_INTERRUPT 0x61
-#define BCM2836_VCHIQ_INTERRUPT 0x62
-#define BCM2386_GPIO_INTERRUPT0 0x51
-#define BCM2386_GPIO_INTERRUPT1 0x53
-#define BCM2836_I2C1_INTERRUPT 0x55
-#define BCM2836_I2C2_INTERRUPT 0x55
-#define BCM2836_SPI0_INTERRUPT 0x56
+#define BCM2836_MBOX_INTERRUPT 0x41
+#define BCM2836_VCHIQ_INTERRUPT 0x42
+#define BCM2386_GPIO_INTERRUPT0 0x91
+#define BCM2386_GPIO_INTERRUPT1 0x92
+#define BCM2386_GPIO_INTERRUPT2 0x93
+#define BCM2386_GPIO_INTERRUPT3 0x94
+#define BCM2836_I2C1_INTERRUPT 0x95
+#define BCM2836_I2C2_INTERRUPT 0x95
+#define BCM2836_SPI0_INTERRUPT 0x96
#define BCM2836_USB_INTERRUPT 0x69
#define BCM2836_SDHOST_INTERRUPT 0x98
#define BCM2836_MMCHS1_INTERRUPT 0x9E
diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
index 4a6fa6377d1b..2aa7d10bd40c 100644
--- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
@@ -279,7 +279,11 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
Name (RBUF, ResourceTemplate ()
{
MEMORY32FIXED (ReadWrite, 0, GPIO_LENGTH, RMEM)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2386_GPIO_INTERRUPT0, BCM2386_GPIO_INTERRUPT1 }
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared)
+ {
+ BCM2386_GPIO_INTERRUPT0, BCM2386_GPIO_INTERRUPT1,
+ BCM2386_GPIO_INTERRUPT2, BCM2386_GPIO_INTERRUPT3
+ }
})
Method (_CRS, 0x0, Serialized)
{
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [edk2-platforms][PATCH 2/6] Platform/RPi/AcpiTables: Replace VendorLong () blobs with PinFunction ()
2020-03-26 11:53 [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 1/6] Platform/RPi/AcpiTables: Fix Pi 4 interrupts values Pete Batard
@ 2020-03-26 11:53 ` Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 3/6] Platform/RPi/AcpiTables: Use PCDs in MADT Pete Batard
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Pete Batard @ 2020-03-26 11:53 UTC (permalink / raw)
To: devel; +Cc: ard.biesheuvel, leif, philmd, awarkentin
From: Andrei Warkentin <andrey.warkentin@gmail.com>
Per https://github.com/MicrosoftDocs/windows-uwp/issues/1751,
MsftFunctionConfig () calls can be replaced by PinFunction () calls.
Since these had been converted to VendorLong () blobs due to lack of
implementation of MsftFunctionConfig (), we replace them back now
that PinFunction () is available.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/AcpiTables/Dsdt.asl | 94 ++------------------
Platform/RaspberryPi/AcpiTables/Uart.asl | 16 +---
2 files changed, 7 insertions(+), 103 deletions(-)
diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
index 2aa7d10bd40c..2e63091cdba0 100644
--- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
@@ -338,22 +338,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C1_LENGTH, RMEM)
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_I2C1_INTERRUPT }
-
- //
- // 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 // .
- }
+ PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 2, 3 }
})
Method (_CRS, 0x0, Serialized)
{
@@ -401,49 +386,9 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI0_LENGTH, RMEM)
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_SPI0_INTERRUPT }
-
- //
- // 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.
- }
+ PinFunction (Exclusive, PullDown, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 9, 10, 11 } // MISO, MOSI, SCLK
+ PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 8 } // CE0
+ PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 7 } // CE1
})
Method (_CRS, 0x0, Serialized)
@@ -468,35 +413,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI1_LENGTH, RMEM)
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2836_SPI1_INTERRUPT }
-
- //
- // 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.
- }
+ PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 19, 20, 21 } // MISO, MOSI, SCLK
+ PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 16 } // CE2
})
Method (_CRS, 0x0, Serialized)
diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryPi/AcpiTables/Uart.asl
index c466247bb33b..f6a14d6fd069 100644
--- a/Platform/RaspberryPi/AcpiTables/Uart.asl
+++ b/Platform/RaspberryPi/AcpiTables/Uart.asl
@@ -77,21 +77,7 @@ Device (URTM)
// 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 // .
- //}
-
+ // PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 14, 15 }
})
Method (_CRS, 0x0, Serialized)
{
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [edk2-platforms][PATCH 3/6] Platform/RPi/AcpiTables: Use PCDs in MADT
2020-03-26 11:53 [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 1/6] Platform/RPi/AcpiTables: Fix Pi 4 interrupts values Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 2/6] Platform/RPi/AcpiTables: Replace VendorLong () blobs with PinFunction () Pete Batard
@ 2020-03-26 11:53 ` Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 4/6] Platform/RPi/AcpiTables: Clean up ACPI IDs Pete Batard
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Pete Batard @ 2020-03-26 11:53 UTC (permalink / raw)
To: devel; +Cc: ard.biesheuvel, leif, philmd, awarkentin
Instead of going through a model #ifdef, the call to
EFI_ACPI_5_1_GICC_STRUCTURE_INIT () is factorized by
setting up a new set of PCDs.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/AcpiTables/AcpiTables.inf | 8 +++++
Platform/RaspberryPi/AcpiTables/Madt.aslc | 31 ++++++++------------
Platform/RaspberryPi/RPi3/RPi3.dsc | 9 ++++++
Platform/RaspberryPi/RPi4/RPi4.dsc | 7 +++++
Platform/RaspberryPi/RaspberryPi.dec | 7 +++++
5 files changed, 43 insertions(+), 19 deletions(-)
diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
index 9ad5246d6bb6..6642541d6a0a 100644
--- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
@@ -39,6 +39,7 @@ [Packages]
EmbeddedPkg/EmbeddedPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
+ Platform/RaspberryPi/RaspberryPi.dec
Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
Silicon/Broadcom/Bcm283x/Bcm283x.dec
Silicon/Broadcom/Drivers/Net/BcmNet.dec
@@ -56,6 +57,13 @@ [FixedPcd]
gBcmNetTokenSpaceGuid.PcdBcmGenetRegistersAddress
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
+ gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceHBase
+ gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceVBase
+ gRaspberryPiTokenSpaceGuid.PcdGicGsivId
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq0
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq1
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq2
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq3
[BuildOptions]
GCC:*_*_*_ASL_FLAGS = -vw3133 -vw3150
diff --git a/Platform/RaspberryPi/AcpiTables/Madt.aslc b/Platform/RaspberryPi/AcpiTables/Madt.aslc
index 4029cd191ab5..faf461814536 100644
--- a/Platform/RaspberryPi/AcpiTables/Madt.aslc
+++ b/Platform/RaspberryPi/AcpiTables/Madt.aslc
@@ -44,29 +44,22 @@ PI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
0, // Flags
},
{
-#if (RPI_MODEL == 3)
EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
- 0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
+ 0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, FixedPcdGet32 (PcdGicPmuIrq0),
+ FixedPcdGet64 (PcdGicInterruptInterfaceBase), FixedPcdGet64 (PcdGicInterruptInterfaceVBase),
+ FixedPcdGet64 (PcdGicInterruptInterfaceHBase), FixedPcdGet32 (PcdGicGsivId), 0),
EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
- 1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
+ 1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, FixedPcdGet32 (PcdGicPmuIrq1),
+ FixedPcdGet64 (PcdGicInterruptInterfaceBase), FixedPcdGet64 (PcdGicInterruptInterfaceVBase),
+ FixedPcdGet64 (PcdGicInterruptInterfaceHBase), FixedPcdGet32 (PcdGicGsivId), 0),
EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
- 2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
+ 2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, FixedPcdGet32 (PcdGicPmuIrq2),
+ FixedPcdGet64 (PcdGicInterruptInterfaceBase), FixedPcdGet64 (PcdGicInterruptInterfaceVBase),
+ FixedPcdGet64 (PcdGicInterruptInterfaceHBase), FixedPcdGet32 (PcdGicGsivId), 0),
EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
- 3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
-#elif (RPI_MODEL == 4)
- EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
- 0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, 48, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
- 0xFF846000, 0xFF844000, 0x19, 0),
- 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),
-#endif
+ 3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, FixedPcdGet32 (PcdGicPmuIrq3),
+ FixedPcdGet64 (PcdGicInterruptInterfaceBase), FixedPcdGet64 (PcdGicInterruptInterfaceVBase),
+ FixedPcdGet64 (PcdGicInterruptInterfaceHBase), FixedPcdGet32 (PcdGicGsivId), 0),
},
#if (RPI_MODEL != 3)
EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet64 (PcdGicDistributorBase), 0)
diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
index 7fb9a41f3d9a..1651def87ce1 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dsc
+++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -403,6 +403,15 @@ [PcdsFixedAtBuild.common]
gRaspberryPiTokenSpaceGuid.PcdCpuDefSpeedMHz|1200
gRaspberryPiTokenSpaceGuid.PcdCpuMaxSpeedMHz|1500
+ #
+ # ARM General Interrupt Controller
+ #
+ gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x40000000
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq0|0x09
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq1|0x09
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq2|0x09
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq3|0x09
+
## Default Terminal Type
## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
index 1abb010469f5..4fe4d810a0bc 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -431,6 +431,13 @@ [PcdsFixedAtBuild.common]
#
gArmTokenSpaceGuid.PcdGicDistributorBase|0xFF841000
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0xFF842000
+ gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceHBase|0xFF844000
+ gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceVBase|0xFF846000
+ gRaspberryPiTokenSpaceGuid.PcdGicGsivId|0x19
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq0|0x30
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq1|0x31
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq2|0x32
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq3|0x33
#
# Fixed CPU settings.
diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec
index dc37541f3732..d59b548185e3 100644
--- a/Platform/RaspberryPi/RaspberryPi.dec
+++ b/Platform/RaspberryPi/RaspberryPi.dec
@@ -47,6 +47,13 @@ [PcdsFixedAtBuild.common]
gRaspberryPiTokenSpaceGuid.PcdCpuLowSpeedMHz|600|UINT32|0x0000000a
gRaspberryPiTokenSpaceGuid.PcdCpuDefSpeedMHz|800|UINT32|0x0000000b
gRaspberryPiTokenSpaceGuid.PcdCpuMaxSpeedMHz|1000|UINT32|0x0000000c
+ gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceHBase|0x0|UINT64|0x00000030
+ gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceVBase|0x0|UINT64|0x00000031
+ gRaspberryPiTokenSpaceGuid.PcdGicGsivId|0x0|UINT32|0x00000032
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq0|0x0|UINT32|0x00000033
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq1|0x0|UINT32|0x00000034
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq2|0x0|UINT32|0x00000035
+ gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq3|0x0|UINT32|0x00000036
[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
gRaspberryPiTokenSpaceGuid.PcdCpuClock|0|UINT32|0x0000000d
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [edk2-platforms][PATCH 4/6] Platform/RPi/AcpiTables: Clean up ACPI IDs
2020-03-26 11:53 [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Pete Batard
` (2 preceding siblings ...)
2020-03-26 11:53 ` [edk2-platforms][PATCH 3/6] Platform/RPi/AcpiTables: Use PCDs in MADT Pete Batard
@ 2020-03-26 11:53 ` Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 5/6] Platform/RPi/AcpiTables: Move GPU devices into a separate ASL file Pete Batard
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Pete Batard @ 2020-03-26 11:53 UTC (permalink / raw)
To: devel; +Cc: ard.biesheuvel, leif, philmd, awarkentin
Only apply the "BC2836" override to the one table that needs it for
Pi 3, instead of setting it globally.
Use more appropriate OEM and Vendor IDs for hardware that is
produced by the Raspberry Pi Foundation.
Ensure that the Pi 3 and Pi 4 have different OEM IDs.
Additionally fix a comment typo (MEMORY32SETBASE -> MEMORY32FIXED).
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/AcpiTables/AcpiTables.h | 22 ++++++++++----------
Platform/RaspberryPi/AcpiTables/Dsdt.asl | 2 +-
Platform/RaspberryPi/AcpiTables/Fadt.aslc | 10 +++++++++
3 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/AcpiTables/AcpiTables.h
index 712a4a5806ae..dfae763d8107 100644
--- a/Platform/RaspberryPi/AcpiTables/AcpiTables.h
+++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.h
@@ -16,25 +16,25 @@
#include <IndustryStandard/Acpi.h>
-// The ASL compiler can't perform arithmetic on MEMORY32SETBASE ()
-// parameters so you can't pass a constant like BASE + OFFSET (the
-// compiler just silently sets it to zero). So we need a macro that
-// can perform arithmetic base address update with an offset.
+// The ASL compiler can't perform arithmetic on MEMORY32FIXED ()
+// parameters so you can't pass a constant like BASE + OFFSET.
+// We therefore define a macro that can perform arithmetic base
+// address update with an offset.
#define MEMORY32SETBASE(BufName, MemName, VarName, Offset) \
CreateDwordField (^BufName, ^MemName._BAS, VarName) \
Add (BCM2836_SOC_REGISTERS, Offset, VarName)
+#define EFI_ACPI_OEM_ID {'R','P','I','F','D','N'}
#if (RPI_MODEL == 3)
-#define EFI_ACPI_OEM_ID {'B','C','2','8','3','6'}
-#else
-#define EFI_ACPI_OEM_ID {'M','C','R','S','F','T'}
+#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','3',' ',' ',' ',' ')
+#elif (RPI_MODEL == 4)
+#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','4',' ',' ',' ',' ')
#endif
-#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','_','E','D','K','2')
-#define EFI_ACPI_OEM_REVISION 0x00000100
+#define EFI_ACPI_OEM_REVISION 0x00000200
#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('E','D','K','2')
-#define EFI_ACPI_CREATOR_REVISION 0x00000100
+#define EFI_ACPI_CREATOR_REVISION 0x00000200
-#define EFI_ACPI_VENDOR_ID SIGNATURE_32 ('M','S','F','T')
+#define EFI_ACPI_VENDOR_ID SIGNATURE_32 ('R','P','I','F')
// A macro to initialise the common header part of EFI ACPI tables as defined by
// EFI_ACPI_DESCRIPTION_HEADER structure.
diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
index 2e63091cdba0..1ca55ff12e35 100644
--- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
@@ -25,7 +25,7 @@
#define BCM_ALT4 0x3
#define BCM_ALT5 0x2
-DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
+DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
{
Scope (\_SB_)
{
diff --git a/Platform/RaspberryPi/AcpiTables/Fadt.aslc b/Platform/RaspberryPi/AcpiTables/Fadt.aslc
index ebf58fb7fc3c..3e3d68703298 100644
--- a/Platform/RaspberryPi/AcpiTables/Fadt.aslc
+++ b/Platform/RaspberryPi/AcpiTables/Fadt.aslc
@@ -16,6 +16,16 @@
#include "AcpiTables.h"
+/*
+ * Windows 10 on the Raspberry Pi 3 requires a specific OEM Id for FADT.
+ * We replace the one that was defined in "AcpiTables.h", so that it is
+ * picked by the ACPI_HEADER () macro.
+ */
+#if (RPI_MODEL == 3)
+#undef EFI_ACPI_OEM_ID
+#define EFI_ACPI_OEM_ID {'B','C','2','8','3','6'}
+#endif
+
/*
* Note: Use ACPI 5.1 since we need to match MADT ACPI requirements
*/
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [edk2-platforms][PATCH 5/6] Platform/RPi/AcpiTables: Move GPU devices into a separate ASL file
2020-03-26 11:53 [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Pete Batard
` (3 preceding siblings ...)
2020-03-26 11:53 ` [edk2-platforms][PATCH 4/6] Platform/RPi/AcpiTables: Clean up ACPI IDs Pete Batard
@ 2020-03-26 11:53 ` Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 6/6] Platform/RPi/AcpiTables: Describe DMA constraints for devices behind GPU Pete Batard
2020-03-26 14:06 ` [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Ard Biesheuvel
6 siblings, 0 replies; 8+ messages in thread
From: Pete Batard @ 2020-03-26 11:53 UTC (permalink / raw)
To: devel; +Cc: ard.biesheuvel, leif, philmd, awarkentin
From: Andrei Warkentin <andrey.warkentin@gmail.com>
In order to describe the DMA constraints of legacy devices behind
the Raspberry Pi GPU/VideoCore, we move them into their own separate
ASL file.
This is a straight copy of the existing content from Dsdt.asl, with
no alteration, so that the changes applied in the next patch are
made more obvious.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/AcpiTables/Dsdt.asl | 382 +------------------
Platform/RaspberryPi/AcpiTables/GpuDevs.asl | 393 ++++++++++++++++++++
2 files changed, 394 insertions(+), 381 deletions(-)
diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
index 1ca55ff12e35..6b0fb7161718 100644
--- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
@@ -29,7 +29,6 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
{
Scope (\_SB_)
{
- include ("Sdhc.asl")
include ("Pep.asl")
#if (RPI_MODEL == 4)
include ("Xhci.asl")
@@ -75,222 +74,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
}
}
- // 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)
- }
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0, BCM2836_USB_LENGTH, RMEM)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_USB_INTERRUPT }
- })
- Method (_CRS, 0x0, Serialized)
- {
- MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_USB_OFFSET)
- Return (^RBUF)
- }
- }
-
- // Video Core 4 GPU
- Device (GPU0)
- {
- Name (_HID, "BCM2850")
- Name (_CID, "VC4")
- Name (_UID, 0x0)
- Name (_CCA, 0x0)
- Method (_STA)
- {
- Return(0xf)
- }
- Name (RBUF, ResourceTemplate ()
- {
- // Memory and interrupt for the GPU
- MEMORY32FIXED (ReadWrite, 0, BCM2836_V3D_BUS_LENGTH, RM01)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_V3D_BUS_INTERRUPT }
-
- // HVS - Hardware Video Scalar
- MEMORY32FIXED (ReadWrite, 0, BCM2836_HVS_LENGTH, RM02)
- // The HVS interrupt is reserved by the VPU
- // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_HVS_INTERRUPT }
-
- // PixelValve0 - DSI0 or DPI
- // MEMORY32FIXED (ReadWrite, BCM2836_PV0_BASE_ADDRESS, BCM2836_PV0_LENGTH, RM03)
- // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PV0_INTERRUPT }
-
- // PixelValve1 - DS1 or SMI
- // MEMORY32FIXED (ReadWrite, BCM2836_PV1_BASE_ADDRESS, BCM2836_PV1_LENGTH, RM04)
- // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PV1_INTERRUPT }
-
- // PixelValve2 - HDMI output - connected to HVS display FIFO 1
- MEMORY32FIXED (ReadWrite, 0, BCM2836_PV2_LENGTH, RM05)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PV2_INTERRUPT }
-
- // HDMI registers
- MEMORY32FIXED (ReadWrite, 0, BCM2836_HDMI0_LENGTH, RM06)
- MEMORY32FIXED (ReadWrite, 0, BCM2836_HDMI1_LENGTH, RM07)
- // hdmi_int[0]
- // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_HDMI0_INTERRUPT }
- // hdmi_int[1]
- // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_HDMI1_INTERRUPT }
-
- // HDMI DDC connection
- I2CSerialBus (0x50,, 100000,, "\\_SB.I2C2",,,,) // EDID
- I2CSerialBus (0x30,, 100000,, "\\_SB.I2C2",,,,) // E-DDC Segment Pointer
- })
- Method (_CRS, 0x0, Serialized)
- {
- MEMORY32SETBASE (RBUF, RM01, RB01, BCM2836_V3D_BUS_OFFSET)
- MEMORY32SETBASE (RBUF, RM02, RB02, BCM2836_HVS_OFFSET)
- MEMORY32SETBASE (RBUF, RM05, RB05, BCM2836_PV2_OFFSET)
- MEMORY32SETBASE (RBUF, RM06, RB06, BCM2836_HDMI0_OFFSET)
- MEMORY32SETBASE (RBUF, RM07, RB07, BCM2836_HDMI1_OFFSET)
- 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)
- }
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0, BCM2836_MBOX_LENGTH, RMEM)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_MBOX_INTERRUPT }
- })
-
- Method (_CRS, 0x0, Serialized)
- {
- MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MBOX_OFFSET)
- 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)
- }
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0, BCM2836_VCHIQ_LENGTH, RMEM)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_VCHIQ_INTERRUPT }
- })
-
- Method (_CRS, 0x0, Serialized)
- {
- MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_VCHIQ_OFFSET)
- 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)
- }
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0, GPIO_LENGTH, RMEM)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared)
- {
- BCM2386_GPIO_INTERRUPT0, BCM2386_GPIO_INTERRUPT1,
- BCM2386_GPIO_INTERRUPT2, BCM2386_GPIO_INTERRUPT3
- }
- })
- Method (_CRS, 0x0, Serialized)
- {
- MEMORY32SETBASE (RBUF, RMEM, RBAS, GPIO_OFFSET)
- Return (^RBUF)
- }
- }
+ include ("GpuDevs.asl")
#if (RPI_MODEL == 4)
Device (ETH0)
@@ -323,169 +107,5 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
}
#endif
- // Description: I2C
- Device (I2C1)
- {
- Name (_HID, "BCM2841")
- Name (_CID, "BCMI2C")
- Name (_UID, 0x1)
- Name (_CCA, 0x0)
- Method (_STA)
- {
- Return(0xf)
- }
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C1_LENGTH, RMEM)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_I2C1_INTERRUPT }
- PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 2, 3 }
- })
- Method (_CRS, 0x0, Serialized)
- {
- MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C1_OFFSET)
- 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)
- }
- Name (RBUF, ResourceTemplate()
- {
- MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C2_LENGTH, RMEM)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_I2C2_INTERRUPT }
- })
-
- Method (_CRS, 0x0, Serialized)
- {
- MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C2_OFFSET)
- Return (^RBUF)
- }
- }
-
- // SPI
- Device (SPI0)
- {
- Name (_HID, "BCM2838")
- Name (_CID, "BCMSPI0")
- Name (_UID, 0x0)
- Name (_CCA, 0x0)
- Method (_STA)
- {
- Return (0xf)
- }
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI0_LENGTH, RMEM)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_SPI0_INTERRUPT }
- PinFunction (Exclusive, PullDown, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 9, 10, 11 } // MISO, MOSI, SCLK
- PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 8 } // CE0
- PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 7 } // CE1
- })
-
- Method (_CRS, 0x0, Serialized)
- {
- MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI0_OFFSET)
- 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)
- }
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI1_LENGTH, RMEM)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2836_SPI1_INTERRUPT }
- PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 19, 20, 21 } // MISO, MOSI, SCLK
- PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 16 } // CE2
- })
-
- Method (_CRS, 0x0, Serialized)
- {
- MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI1_OFFSET)
- 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, BCM2836_SPI2_BASE_ADDRESS, BCM2836_SPI2_LENGTH, RMEM)
- // Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2836_SPI2_INTERRUPT }
- // })
- // Return (RBUF)
- // }
- // }
-
- // PWM Driver
- Device (PWM0)
- {
- Name (_HID, "BCM2844")
- Name (_CID, "BCM2844")
- Name (_UID, 0)
- Name (_CCA, 0x0)
- Method (_STA)
- {
- Return (0xf)
- }
- Name (RBUF, ResourceTemplate ()
- {
- // DMA channel 11 control
- MEMORY32FIXED (ReadWrite, 0, BCM2836_PWM_DMA_LENGTH, RM01)
- // PWM control
- MEMORY32FIXED (ReadWrite, 0, BCM2836_PWM_CTRL_LENGTH, RM02)
- // PWM control bus
- MEMORY32FIXED (ReadWrite, BCM2836_PWM_BUS_BASE_ADDRESS, BCM2836_PWM_BUS_LENGTH, )
- // PWM control uncached
- MEMORY32FIXED (ReadWrite, BCM2836_PWM_CTRL_UNCACHED_BASE_ADDRESS, BCM2836_PWM_CTRL_UNCACHED_LENGTH, )
- // PWM clock control
- MEMORY32FIXED (ReadWrite, 0, BCM2836_PWM_CLK_LENGTH, RM03)
- // Interrupt DMA channel 11
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_DMA_INTERRUPT }
- // DMA channel 11, DREQ 5 for PWM
- FixedDMA (5, 11, Width32Bit, )
- })
-
- Method (_CRS, 0x0, Serialized)
- {
- MEMORY32SETBASE (RBUF, RM01, RB01, BCM2836_PWM_DMA_OFFSET)
- MEMORY32SETBASE (RBUF, RM02, RB02, BCM2836_PWM_CTRL_OFFSET)
- MEMORY32SETBASE (RBUF, RM03, RB03, BCM2836_PWM_CLK_OFFSET)
- Return (^RBUF)
- }
- }
-
- include ("Uart.asl")
- include ("Rhpx.asl")
}
}
diff --git a/Platform/RaspberryPi/AcpiTables/GpuDevs.asl b/Platform/RaspberryPi/AcpiTables/GpuDevs.asl
new file mode 100644
index 000000000000..99f03333abcf
--- /dev/null
+++ b/Platform/RaspberryPi/AcpiTables/GpuDevs.asl
@@ -0,0 +1,393 @@
+/** @file
+ *
+ * [DSDT] Devices behind the GPU.
+ *
+ * Copyright (c) 2018-2020, Andrey Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+// 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)
+ }
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_USB_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_USB_INTERRUPT }
+ })
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_USB_OFFSET)
+ Return (^RBUF)
+ }
+}
+
+// Video Core 4 GPU
+Device (GPU0)
+{
+ Name (_HID, "BCM2850")
+ Name (_CID, "VC4")
+ Name (_UID, 0x0)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Name (RBUF, ResourceTemplate ()
+ {
+ // Memory and interrupt for the GPU
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_V3D_BUS_LENGTH, RM01)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_V3D_BUS_INTERRUPT }
+
+ // HVS - Hardware Video Scalar
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_HVS_LENGTH, RM02)
+ // The HVS interrupt is reserved by the VPU
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_HVS_INTERRUPT }
+
+ // PixelValve0 - DSI0 or DPI
+ // MEMORY32FIXED (ReadWrite, BCM2836_PV0_BASE_ADDRESS, BCM2836_PV0_LENGTH, RM03)
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PV0_INTERRUPT }
+
+ // PixelValve1 - DS1 or SMI
+ // MEMORY32FIXED (ReadWrite, BCM2836_PV1_BASE_ADDRESS, BCM2836_PV1_LENGTH, RM04)
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PV1_INTERRUPT }
+
+ // PixelValve2 - HDMI output - connected to HVS display FIFO 1
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_PV2_LENGTH, RM05)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PV2_INTERRUPT }
+
+ // HDMI registers
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_HDMI0_LENGTH, RM06)
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_HDMI1_LENGTH, RM07)
+ // hdmi_int[0]
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_HDMI0_INTERRUPT }
+ // hdmi_int[1]
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_HDMI1_INTERRUPT }
+
+ // HDMI DDC connection
+ I2CSerialBus (0x50,, 100000,, "\\_SB.I2C2",,,,) // EDID
+ I2CSerialBus (0x30,, 100000,, "\\_SB.I2C2",,,,) // E-DDC Segment Pointer
+ })
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RM01, RB01, BCM2836_V3D_BUS_OFFSET)
+ MEMORY32SETBASE (RBUF, RM02, RB02, BCM2836_HVS_OFFSET)
+ MEMORY32SETBASE (RBUF, RM05, RB05, BCM2836_PV2_OFFSET)
+ MEMORY32SETBASE (RBUF, RM06, RB06, BCM2836_HDMI0_OFFSET)
+ MEMORY32SETBASE (RBUF, RM07, RB07, BCM2836_HDMI1_OFFSET)
+ 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)
+ }
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_MBOX_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_MBOX_INTERRUPT }
+ })
+
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MBOX_OFFSET)
+ 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)
+ }
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_VCHIQ_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_VCHIQ_INTERRUPT }
+ })
+
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_VCHIQ_OFFSET)
+ 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)
+ }
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, GPIO_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared)
+ {
+ BCM2386_GPIO_INTERRUPT0, BCM2386_GPIO_INTERRUPT1,
+ BCM2386_GPIO_INTERRUPT2, BCM2386_GPIO_INTERRUPT3
+ }
+ })
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, GPIO_OFFSET)
+ Return (^RBUF)
+ }
+}
+
+// Description: I2C
+Device (I2C1)
+{
+ Name (_HID, "BCM2841")
+ Name (_CID, "BCMI2C")
+ Name (_UID, 0x1)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return(0xf)
+ }
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C1_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_I2C1_INTERRUPT }
+ PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 2, 3 }
+ })
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C1_OFFSET)
+ 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)
+ }
+ Name (RBUF, ResourceTemplate()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C2_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_I2C2_INTERRUPT }
+ })
+
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C2_OFFSET)
+ Return (^RBUF)
+ }
+}
+
+// SPI
+Device (SPI0)
+{
+ Name (_HID, "BCM2838")
+ Name (_CID, "BCMSPI0")
+ Name (_UID, 0x0)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI0_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_SPI0_INTERRUPT }
+ PinFunction (Exclusive, PullDown, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 9, 10, 11 } // MISO, MOSI, SCLK
+ PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 8 } // CE0
+ PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 7 } // CE1
+ })
+
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI0_OFFSET)
+ 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)
+ }
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI1_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2836_SPI1_INTERRUPT }
+ PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 19, 20, 21 } // MISO, MOSI, SCLK
+ PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 16 } // CE2
+ })
+
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI1_OFFSET)
+ 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, BCM2836_SPI2_BASE_ADDRESS, BCM2836_SPI2_LENGTH, RMEM)
+// Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2836_SPI2_INTERRUPT }
+// })
+// Return (RBUF)
+// }
+// }
+
+// PWM Driver
+Device (PWM0)
+{
+ Name (_HID, "BCM2844")
+ Name (_CID, "BCM2844")
+ Name (_UID, 0)
+ Name (_CCA, 0x0)
+ Method (_STA)
+ {
+ Return (0xf)
+ }
+ Name (RBUF, ResourceTemplate ()
+ {
+ // DMA channel 11 control
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_PWM_DMA_LENGTH, RM01)
+ // PWM control
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_PWM_CTRL_LENGTH, RM02)
+ // PWM control bus
+ MEMORY32FIXED (ReadWrite, BCM2836_PWM_BUS_BASE_ADDRESS, BCM2836_PWM_BUS_LENGTH, )
+ // PWM control uncached
+ MEMORY32FIXED (ReadWrite, BCM2836_PWM_CTRL_UNCACHED_BASE_ADDRESS, BCM2836_PWM_CTRL_UNCACHED_LENGTH, )
+ // PWM clock control
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_PWM_CLK_LENGTH, RM03)
+ // Interrupt DMA channel 11
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_DMA_INTERRUPT }
+ // DMA channel 11, DREQ 5 for PWM
+ FixedDMA (5, 11, Width32Bit, )
+ })
+
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RM01, RB01, BCM2836_PWM_DMA_OFFSET)
+ MEMORY32SETBASE (RBUF, RM02, RB02, BCM2836_PWM_CTRL_OFFSET)
+ MEMORY32SETBASE (RBUF, RM03, RB03, BCM2836_PWM_CLK_OFFSET)
+ Return (^RBUF)
+ }
+}
+
+include ("Uart.asl")
+include ("Rhpx.asl")
+include ("Sdhc.asl")
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [edk2-platforms][PATCH 6/6] Platform/RPi/AcpiTables: Describe DMA constraints for devices behind GPU
2020-03-26 11:53 [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Pete Batard
` (4 preceding siblings ...)
2020-03-26 11:53 ` [edk2-platforms][PATCH 5/6] Platform/RPi/AcpiTables: Move GPU devices into a separate ASL file Pete Batard
@ 2020-03-26 11:53 ` Pete Batard
2020-03-26 14:06 ` [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Ard Biesheuvel
6 siblings, 0 replies; 8+ messages in thread
From: Pete Batard @ 2020-03-26 11:53 UTC (permalink / raw)
To: devel; +Cc: ard.biesheuvel, leif, philmd, awarkentin
From: Andrei Warkentin <andrey.warkentin@gmail.com>
Legacy devices on a Raspberry Pi sit behind GPU/VideoCore and can only
address the first GB of RAM.
This address range of 0xc0000000-0xffffffff requires a translation,
since it is aliased to the first GB of memory 0x00000000-0x3fffffff,
which is what this commit accomplishes by introducing a new "GDV0"
device along with a "_DMA" ResourceTemplate that performs the address
translation.
Note that this translation does not apply to the ARM cores, PCIe,
GENET, and 40-bit DMA channels, that all have a wider view of the
address space.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/AcpiTables/Dsdt.asl | 139 +++++++++++++++++++-
Platform/RaspberryPi/AcpiTables/GpuDevs.asl | 24 ++--
2 files changed, 149 insertions(+), 14 deletions(-)
diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
index 6b0fb7161718..95766b007404 100644
--- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
@@ -3,7 +3,7 @@
* Differentiated System Definition Table (DSDT)
*
* Copyright (c) 2020, Pete Batard <pete@akeo.ie>
- * Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) 2018-2020, Andrey Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -14,6 +14,8 @@
#include <IndustryStandard/Bcm2836Gpio.h>
#include <IndustryStandard/Bcm2836Gpu.h>
#include <IndustryStandard/Bcm2836Pwm.h>
+#include <IndustryStandard/Bcm2836Sdio.h>
+#include <IndustryStandard/Bcm2836SdHost.h>
#include <Net/Genet.h>
#include "AcpiTables.h"
@@ -25,6 +27,25 @@
#define BCM_ALT4 0x3
#define BCM_ALT5 0x2
+//
+// The ASL compiler does not support argument arithmetic in functions
+// like QWordMemory (). So we need to instantiate dummy qword regions
+// that we can then update the Min, Max and Length attributes of.
+// The two macros below help accomplish this.
+//
+#define QWORDMEMORYBUF(Index) \
+ QWordMemory (ResourceProducer,, \
+ MinFixed, MaxFixed, NonCacheable, ReadWrite, \
+ 0x0, 0x0, 0x0, 0x0, 0x1,,, RB ## Index)
+
+#define QWORDMEMORYSET(Index, Offset, Length) \
+ CreateQwordField (RBUF, RB ## Index._MIN, MI ## Index) \
+ CreateQwordField (RBUF, RB ## Index._MAX, MA ## Index) \
+ CreateQwordField (RBUF, RB ## Index._LEN, LE ## Index) \
+ Store (Length, LE ## Index) \
+ Add (BCM2836_SOC_REGISTERS, Offset, MI ## Index) \
+ Add (MI ## Index, LE ## Index - 1, MA ## Index)
+
DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
{
Scope (\_SB_)
@@ -74,7 +95,121 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
}
}
- include ("GpuDevs.asl")
+ //
+ // GPU device container describes the DMA translation required
+ // when a device behind the GPU wants to access Arm memory.
+ // Only the first GB can be addressed.
+ //
+ Device (GDV0)
+ {
+ Name (_HID, "ACPI0004")
+ Name (_UID, 0x1)
+ Name (_CCA, 0x0)
+
+ Method (_CRS, 0, Serialized) {
+ //
+ // Container devices with _DMA must have _CRS, meaning GDV0
+ // to provide all resources that GpuDevs.asl consume (except
+ // interrupts).
+ //
+ Name (RBUF, ResourceTemplate () {
+ QWORDMEMORYBUF(01)
+ QWORDMEMORYBUF(02)
+ QWORDMEMORYBUF(03)
+ // QWORDMEMORYBUF(04)
+ // QWORDMEMORYBUF(05)
+ QWORDMEMORYBUF(06)
+ QWORDMEMORYBUF(07)
+ QWORDMEMORYBUF(08)
+ QWORDMEMORYBUF(09)
+ QWORDMEMORYBUF(10)
+ QWORDMEMORYBUF(11)
+ QWORDMEMORYBUF(12)
+ QWORDMEMORYBUF(13)
+ QWORDMEMORYBUF(14)
+ QWORDMEMORYBUF(15)
+ // QWORDMEMORYBUF(16)
+ QWORDMEMORYBUF(17)
+ QWORDMEMORYBUF(18)
+ QWORDMEMORYBUF(19)
+ QWORDMEMORYBUF(20)
+ QWORDMEMORYBUF(21)
+ QWORDMEMORYBUF(22)
+ QWORDMEMORYBUF(23)
+ QWORDMEMORYBUF(24)
+ QWORDMEMORYBUF(25)
+ })
+
+ // USB
+ QWORDMEMORYSET(01, BCM2836_USB_OFFSET, BCM2836_USB_LENGTH)
+
+ // GPU
+ QWORDMEMORYSET(02, BCM2836_V3D_BUS_OFFSET, BCM2836_V3D_BUS_LENGTH)
+ QWORDMEMORYSET(03, BCM2836_HVS_OFFSET, BCM2836_HVS_LENGTH)
+ // QWORDMEMORYSET(04, BCM2836_PV0_OFFSET, BCM2836_PV0_LENGTH)
+ // QWORDMEMORYSET(05, BCM2836_PV1_OFFSET, BCM2836_PV1_LENGTH)
+ QWORDMEMORYSET(06, BCM2836_PV2_OFFSET, BCM2836_PV2_LENGTH)
+ QWORDMEMORYSET(07, BCM2836_HDMI0_OFFSET, BCM2836_HDMI0_LENGTH)
+ QWORDMEMORYSET(08, BCM2836_HDMI1_OFFSET, BCM2836_HDMI1_LENGTH)
+
+ // Mailbox
+ QWORDMEMORYSET(09, BCM2836_MBOX_OFFSET, BCM2836_MBOX_LENGTH)
+
+ // VCHIQ
+ QWORDMEMORYSET(10, BCM2836_VCHIQ_OFFSET, BCM2836_VCHIQ_LENGTH)
+
+ // GPIO
+ QWORDMEMORYSET(11, GPIO_OFFSET, GPIO_LENGTH)
+
+ // I2C
+ QWORDMEMORYSET(12, BCM2836_I2C1_OFFSET, BCM2836_I2C1_LENGTH)
+ QWORDMEMORYSET(13, BCM2836_I2C2_OFFSET, BCM2836_I2C2_LENGTH)
+
+ // SPI
+ QWORDMEMORYSET(14, BCM2836_SPI0_OFFSET, BCM2836_SPI0_LENGTH)
+ QWORDMEMORYSET(15, BCM2836_SPI1_OFFSET, BCM2836_SPI1_LENGTH)
+ // QWORDMEMORYSET(16, BCM2836_SPI2_OFFSET, BCM2836_SPI2_LENGTH)
+
+ // PWM
+ QWORDMEMORYSET(17, BCM2836_PWM_DMA_OFFSET, BCM2836_PWM_DMA_LENGTH)
+ QWORDMEMORYSET(18, BCM2836_PWM_CTRL_OFFSET, BCM2836_PWM_CTRL_LENGTH)
+ QWORDMEMORYSET(19, BCM2836_PWM_BUS_BASE_ADDRESS, BCM2836_PWM_BUS_LENGTH)
+ QWORDMEMORYSET(20, BCM2836_PWM_CTRL_UNCACHED_BASE_ADDRESS, BCM2836_PWM_CTRL_UNCACHED_LENGTH)
+ QWORDMEMORYSET(21, BCM2836_PWM_CLK_OFFSET, BCM2836_PWM_CLK_LENGTH)
+
+ // UART
+ QWORDMEMORYSET(22, BCM2836_PL011_UART_OFFSET, BCM2836_PL011_UART_LENGTH)
+ QWORDMEMORYSET(23, BCM2836_MINI_UART_OFFSET, BCM2836_MINI_UART_LENGTH)
+
+ // SDC
+ QWORDMEMORYSET(24, MMCHS1_OFFSET, MMCHS1_LENGTH)
+ QWORDMEMORYSET(25, SDHOST_OFFSET, SDHOST_LENGTH)
+
+ Return (RBUF)
+ }
+
+ Name (_DMA, ResourceTemplate() {
+ //
+ // Only the first GB is available.
+ // Bus 0xC0000000 -> CPU 0x00000000.
+ //
+ QWordMemory (ResourceConsumer,
+ ,
+ MinFixed,
+ MaxFixed,
+ NonCacheable,
+ ReadWrite,
+ 0x0,
+ 0x00000000C0000000, // MIN
+ 0x00000000FFFFFFFF, // MAX
+ 0xFFFFFFFF40000000, // TRA
+ 0x0000000040000000, // LEN
+ ,
+ ,
+ )
+ })
+ include ("GpuDevs.asl")
+ }
#if (RPI_MODEL == 4)
Device (ETH0)
diff --git a/Platform/RaspberryPi/AcpiTables/GpuDevs.asl b/Platform/RaspberryPi/AcpiTables/GpuDevs.asl
index 99f03333abcf..966a94cdb5b5 100644
--- a/Platform/RaspberryPi/AcpiTables/GpuDevs.asl
+++ b/Platform/RaspberryPi/AcpiTables/GpuDevs.asl
@@ -75,8 +75,8 @@ Device (GPU0)
// Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_HDMI1_INTERRUPT }
// HDMI DDC connection
- I2CSerialBus (0x50,, 100000,, "\\_SB.I2C2",,,,) // EDID
- I2CSerialBus (0x30,, 100000,, "\\_SB.I2C2",,,,) // E-DDC Segment Pointer
+ I2CSerialBus (0x50,, 100000,, "\\_SB.GDV0.I2C2",,,,) // EDID
+ I2CSerialBus (0x30,, 100000,, "\\_SB.GDV0.I2C2",,,,) // E-DDC Segment Pointer
})
Method (_CRS, 0x0, Serialized)
{
@@ -167,7 +167,7 @@ Device (VCIQ)
Name (_CID, "VCIQ")
Name (_UID, 0)
Name (_CCA, 0x0)
- Name (_DEP, Package() { \_SB.RPIQ })
+ Name (_DEP, Package() { \_SB.GDV0.RPIQ })
Method (_STA)
{
Return (0xf)
@@ -192,7 +192,7 @@ Device (VCSM)
Name (_CID, "VCSM")
Name (_UID, 0)
Name (_CCA, 0x0)
- Name (_DEP, Package() { \_SB.VCIQ })
+ Name (_DEP, Package() { \_SB.GDV0.VCIQ })
Method (_STA)
{
Return (0xf)
@@ -241,7 +241,7 @@ Device (I2C1)
{
MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C1_LENGTH, RMEM)
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_I2C1_INTERRUPT }
- PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 2, 3 }
+ PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 2, 3 }
})
Method (_CRS, 0x0, Serialized)
{
@@ -289,9 +289,9 @@ Device (SPI0)
{
MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI0_LENGTH, RMEM)
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_SPI0_INTERRUPT }
- PinFunction (Exclusive, PullDown, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 9, 10, 11 } // MISO, MOSI, SCLK
- PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 8 } // CE0
- PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 7 } // CE1
+ PinFunction (Exclusive, PullDown, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 9, 10, 11 } // MISO, MOSI, SCLK
+ PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 8 } // CE0
+ PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 7 } // CE1
})
Method (_CRS, 0x0, Serialized)
@@ -307,7 +307,7 @@ Device (SPI1)
Name (_CID, "BCMAUXSPI")
Name (_UID, 0x1)
Name (_CCA, 0x0)
- Name (_DEP, Package() { \_SB.RPIQ })
+ Name (_DEP, Package() { \_SB.GDV0.RPIQ })
Method (_STA)
{
Return (0xf)
@@ -316,8 +316,8 @@ Device (SPI1)
{
MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI1_LENGTH, RMEM)
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2836_SPI1_INTERRUPT }
- PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 19, 20, 21 } // MISO, MOSI, SCLK
- PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 16 } // CE2
+ PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 19, 20, 21 } // MISO, MOSI, SCLK
+ PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 16 } // CE2
})
Method (_CRS, 0x0, Serialized)
@@ -334,7 +334,7 @@ Device (SPI1)
// Name (_CID, "BCMAUXSPI")
// Name (_UID, 0x2)
// Name (_CCA, 0x0)
-// Name (_DEP, Package() { \_SB.RPIQ })
+// Name (_DEP, Package() { \_SB.GDV0.RPIQ })
// Method (_STA)
// {
// Return (0xf) // Disabled
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements
2020-03-26 11:53 [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Pete Batard
` (5 preceding siblings ...)
2020-03-26 11:53 ` [edk2-platforms][PATCH 6/6] Platform/RPi/AcpiTables: Describe DMA constraints for devices behind GPU Pete Batard
@ 2020-03-26 14:06 ` Ard Biesheuvel
6 siblings, 0 replies; 8+ messages in thread
From: Ard Biesheuvel @ 2020-03-26 14:06 UTC (permalink / raw)
To: Pete Batard
Cc: edk2-devel-groups-io, Leif Lindholm, Philippe Mathieu-Daudé,
Andrei Warkentin
On Thu, 26 Mar 2020 at 12:53, Pete Batard <pete@akeo.ie> wrote:
>
> This patchset brings additional cleanup and improvements to the factorized
> ACPI table generation for the Pi platform by:
>
> * Updating the Pi 4 interrupts we know of to their proper values.
> * Removing VendorLong () sections in the ASL data we inherited from Microsoft.
> * Improving MADT factorization through the use of PCDs.
> * Setting ACPI IDs to more professional expected values.
> * Adding proper DMA translation for devices that sit behind GPU/VideoCore.
>
> It should be noted that this patchset was checked for regressions against a
> Pi 3 running Windows 10 as well as well as a Pi 4 running Debian Linux.
>
>
> Andrei Warkentin (3):
> Platform/RPi/AcpiTables: Replace VendorLong () blobs with PinFunction
> ()
> Platform/RPi/AcpiTables: Move GPU devices into a separate ASL file
> Platform/RPi/AcpiTables: Describe DMA constraints for devices behind
> GPU
>
> Pete Batard (3):
> Platform/RPi/AcpiTables: Fix Pi 4 interrupts values
> Platform/RPi/AcpiTables: Use PCDs in MADT
> Platform/RPi/AcpiTables: Clean up ACPI IDs
>
Thanks Pete
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Pushed as c9f3f689baa6..fcc2a81066a2
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-03-26 14:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-26 11:53 [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 1/6] Platform/RPi/AcpiTables: Fix Pi 4 interrupts values Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 2/6] Platform/RPi/AcpiTables: Replace VendorLong () blobs with PinFunction () Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 3/6] Platform/RPi/AcpiTables: Use PCDs in MADT Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 4/6] Platform/RPi/AcpiTables: Clean up ACPI IDs Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 5/6] Platform/RPi/AcpiTables: Move GPU devices into a separate ASL file Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 6/6] Platform/RPi/AcpiTables: Describe DMA constraints for devices behind GPU Pete Batard
2020-03-26 14:06 ` [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox