summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2020-02-28 10:38:45 +0000
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2020-03-02 12:12:15 +0100
commit59cc660662fd226864915e16df216102464d4be0 (patch)
tree9e9e33f1b655f382df6838b1ca404ceaf1703c8a
parenta409cb000932238d4065bc685805b0bd15566e8e (diff)
Platform/RPi4: Use Silicon constants in ACPI headers
With the new constants added, remove some of the hardcoded values from the ACPI tables. Note that because the ASL compiler is very limited in terms of macro processing, we can not use any arithmetic constants (e.g BASE + OFFSET) as parameters to MEMORY32FIXED (), and instead must alter the base address using CreateDwordField () after MEMORY32FIXED () has been invoked. To achieve that, we create a MEMORY32SETBASE () macro and move the MEMORY32FIXED () calls outside of Method (_CRS...). Signed-off-by: Pete Batard <pete@akeo.ie> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rw-r--r--Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h8
-rw-r--r--Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf2
-rw-r--r--Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc7
-rw-r--r--Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl416
-rw-r--r--Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl32
-rw-r--r--Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl73
6 files changed, 297 insertions, 241 deletions
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h
index dcdbac7a..fcfad3b5 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h
@@ -15,6 +15,14 @@
#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.
+#define MEMORY32SETBASE(BufName, MemName, VarName, Offset) \
+ CreateDwordField (^BufName, ^MemName._BAS, VarName) \
+ Add (BCM2836_SOC_REGISTERS, Offset, VarName)
+
#define EFI_ACPI_OEM_ID {'M','C','R','S','F','T'} // OEMID 6 bytes long
#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','4','E','D','K','2') // OEM table id 8 bytes long
#define EFI_ACPI_OEM_REVISION 0x02000820
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
index aa8f67de..358c315b 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf
@@ -41,6 +41,7 @@
MdePkg/MdePkg.dec
Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
Silicon/Broadcom/Bcm283x/Bcm283x.dec
+ Silicon/Broadcom/Drivers/Net/BcmNet.dec
[FixedPcd]
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
@@ -52,6 +53,7 @@
gBcm27xxTokenSpaceGuid.PcdBcm27xxPciCpuMmioAdr
gBcm27xxTokenSpaceGuid.PcdBcm27xxPciRegBase
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
+ gBcmNetTokenSpaceGuid.PcdBcmGenetRegistersAddress
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc
index f8bf3f26..03d888ff 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc
@@ -10,6 +10,7 @@
**/
#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/Bcm2836.h>
#include "AcpiTables.h"
@@ -137,9 +138,9 @@ EFI_ACPI_5_1_CSRT_TABLE Csrt =
{
sizeof (DMA_CONTROLLER_VENDOR_DATA), // Controller vendor data here
1,
- 0xFE007000, // Base address for channels
- RPI_DMA_CHANNEL_COUNT * 0x100, // Base size = Number of channels x 0x100 size for each channel
- 0xFE007FE0, // Base address for controller
+ BCM2836_DMA0_BASE_ADDRESS, // Base address for channels
+ RPI_DMA_CHANNEL_COUNT * BCM2836_DMA_CHANNEL_LENGTH, // Base size = Number of channels x channel size
+ BCM2836_DMA_CTRL_BASE_ADDRESS,// Base address for controller
8, // Base size = two registers
RPI_DMA_USED_CHANNEL_COUNT,
0, // cannot use controller interrupt
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl
index 8d2938a6..3bab307a 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl
@@ -2,6 +2,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) Microsoft Corporation. All rights reserved.
*
@@ -9,6 +10,14 @@
*
**/
+#include <IndustryStandard/Bcm2836.h>
+#include <IndustryStandard/Bcm2836Gpio.h>
+#include <IndustryStandard/Bcm2836Gpu.h>
+#include <IndustryStandard/Bcm2836Pwm.h>
+#include <Net/Genet.h>
+
+#include "AcpiTables.h"
+
#define BCM_ALT0 0x4
#define BCM_ALT1 0x5
#define BCM_ALT2 0x6
@@ -75,14 +84,15 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Return (0xf)
}
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_USB_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x69 }
+ })
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED(ReadWrite, 0xFE980000, 0x10000,)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x69 }
- })
- Return(RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_USB_OFFSET)
+ Return (^RBUF)
}
}
@@ -97,44 +107,49 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Return(0xf)
}
+ Name (RBUF, ResourceTemplate ()
+ {
+ // Memory and interrupt for the GPU
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_V3D_BUS_LENGTH, RM01)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x2A }
+
+ // HVS - Hardware Video Scalar
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_HVS_LENGTH, RM02)
+ // The HVS interrupt is reserved by the VPU
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x41 }
+
+ // PixelValve0 - DSI0 or DPI
+ // MEMORY32FIXED (ReadWrite, BCM2836_PV0_BASE_ADDRESS, BCM2836_PV0_LENGTH, RM03)
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4D }
+
+ // PixelValve1 - DS1 or SMI
+ // MEMORY32FIXED (ReadWrite, BCM2836_PV1_BASE_ADDRESS, BCM2836_PV1_LENGTH, RM04)
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4E }
+
+ // PixelValve2 - HDMI output - connected to HVS display FIFO 1
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_PV2_LENGTH, RM05)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4A }
+
+ // HDMI registers
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_HDMI0_LENGTH, RM06)
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_HDMI1_LENGTH, RM07)
+ // 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
+ })
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- // Memory and interrupt for the GPU
- MEMORY32FIXED(ReadWrite, 0xFEC00000, 0x1000,)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x2A }
-
- // HVS - Hardware Video Scalar
- MEMORY32FIXED (ReadWrite, 0xFE400000, 0x6000,)
- // The HVS interrupt is reserved by the VPU
- // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x41 }
-
- // PixelValve0 - DSI0 or DPI
- // MEMORY32FIXED (ReadWrite, 0xFE206000, 0x100,)
- // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4D }
-
- // PixelValve1 - DS1 or SMI
- // MEMORY32FIXED (ReadWrite, 0xFE207000, 0x100,)
- // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4E }
-
- // PixelValve2 - HDMI output - connected to HVS display FIFO 1
- MEMORY32FIXED (ReadWrite, 0xFE807000, 0x100,)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4A }
-
- // HDMI 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]
- // 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)
+ 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
@@ -196,14 +211,16 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Return (0xf)
}
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_MBOX_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x61 }
+ })
+
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- Memory32Fixed (ReadWrite, 0xFE00B880, 0x00000024,)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x61 }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MBOX_OFFSET)
+ Return (^RBUF)
}
}
@@ -219,14 +236,16 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Return (0xf)
}
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_VCHIQ_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x62 }
+ })
+
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- Memory32Fixed (ReadWrite, 0xFE00B840, 0x00000010,)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x62 }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_VCHIQ_OFFSET)
+ Return (^RBUF)
}
}
@@ -255,15 +274,15 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Return(0xf)
}
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, GPIO_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x51, 0x53 }
+ })
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0xFE200000, 0xB4, )
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x51 }
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x53 }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, GPIO_OFFSET)
+ Return (^RBUF)
}
}
@@ -281,9 +300,9 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Name (RBUF, ResourceTemplate ()
{
- Memory32Fixed (ReadWrite, 0xfd580000, 0x10000, )
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0xBD }
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0xBE }
+ // No need for MEMORY32SETBASE on Genet as we have a straight base address constant
+ MEMORY32FIXED (ReadWrite, GENET_BASE_ADDRESS, GENET_LENGTH, )
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0xBD, 0xBE }
})
Return (RBUF)
}
@@ -307,30 +326,31 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Return(0xf)
}
- Method (_CRS, 0x0, Serialized)
+ Name (RBUF, ResourceTemplate ()
{
- Name (RBUF, ResourceTemplate ()
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C1_LENGTH, RMEM)
+ 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
{
- Memory32Fixed(ReadWrite, 0xFE804000, 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)
+ /* 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 // .
+ }
+ })
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C1_OFFSET)
+ Return (^RBUF)
}
}
@@ -345,14 +365,16 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Return (0xf)
}
+ Name (RBUF, ResourceTemplate()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C2_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x55 }
+ })
+
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate()
- {
- Memory32Fixed (ReadWrite, 0xFE805000, 0x20)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) {0x55}
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C2_OFFSET)
+ Return (^RBUF)
}
}
@@ -367,57 +389,59 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Return (0xf)
}
- Method (_CRS, 0x0, Serialized)
+ Name (RBUF, ResourceTemplate ()
{
- Name (RBUF, ResourceTemplate ()
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI0_LENGTH, RMEM)
+ 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
{
- MEMORY32FIXED (ReadWrite, 0xFE204000, 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.
- }
+ /* 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, ) {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)
+ //
+ // 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.
+ }
+ })
+
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI0_OFFSET)
+ Return (^RBUF)
}
}
@@ -432,43 +456,45 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
Return (0xf)
}
- Method (_CRS, 0x0, Serialized)
+ Name (RBUF, ResourceTemplate ()
{
- Name (RBUF, ResourceTemplate ()
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI1_LENGTH, RMEM)
+ 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
{
- MEMORY32FIXED (ReadWrite, 0xFE215080, 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.
- }
+ /* 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)
+ //
+ // 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.
+ }
+ })
+
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI1_OFFSET)
+ Return (^RBUF)
}
}
@@ -488,8 +514,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
// {
// Name (RBUF, ResourceTemplate ()
// {
- // MEMORY32FIXED (ReadWrite, 0xFE2150C0, 0x40,)
- // Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) {0x3D}
+ // MEMORY32FIXED (ReadWrite, BCM2836_SPI2_BASE_ADDRESS, BCM2836_SPI2_LENGTH, RMEM)
+ // Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { 0x3D }
// })
// Return (RBUF)
// }
@@ -506,26 +532,30 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
{
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) { 0x3B }
+ // DMA channel 11, DREQ 5 for PWM
+ FixedDMA (5, 11, Width32Bit, )
+ })
+
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- // DMA channel 11 control
- Memory32Fixed (ReadWrite, 0xFE007B00, 0x00000100,)
- // PWM control
- Memory32Fixed (ReadWrite, 0xFE20C000, 0x00000028,)
- // PWM control bus
- Memory32Fixed (ReadWrite, 0x7E20C000, 0x00000028,)
- // PWM control uncached
- Memory32Fixed (ReadWrite, 0xFF20C000, 0x00000028,)
- // PWM clock control
- Memory32Fixed (ReadWrite, 0xFE1010A0, 0x00000008,)
- // Interrupt DMA channel 11
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x3B }
- // DMA channel 11, DREQ 5 for PWM
- FixedDMA (5, 11, Width32Bit, )
- })
- Return (RBUF)
+ 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)
}
}
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl
index 56d15c39..590c71ed 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl
@@ -2,6 +2,7 @@
*
* [DSDT] SD controller/card definition (SDHC)
*
+ * Copyright (c) 2020, Pete Batard <pete@akeo.ie>
* Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) Microsoft Corporation. All rights reserved.
*
@@ -9,6 +10,11 @@
*
**/
+#include <IndustryStandard/Bcm2836SdHost.h>
+#include <IndustryStandard/Bcm2836Sdio.h>
+
+#include "AcpiTables.h"
+
//
// Note: UEFI can use either SDHost or Arasan. We expose both to the OS.
//
@@ -28,14 +34,15 @@ Device (SDC1)
{
Return(0xf)
}
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, MMCHS1_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x9E }
+ })
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0xFE300000, 0x100,)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x9E }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, MMCHS1_OFFSET)
+ Return (^RBUF)
}
//
@@ -71,14 +78,15 @@ Device (SDC2)
{
Return (0xf)
}
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, SDHOST_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x98 }
+ })
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0xFE202000, 0x100,)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x98 }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, SDHOST_OFFSET)
+ Return (^RBUF)
}
//
diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
index 5b59f2dd..ad9d21e6 100644
--- a/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
+++ b/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl
@@ -2,6 +2,7 @@
*
* [DSDT] Serial devices (UART).
*
+ * Copyright (c) 2020, Pete Batard <pete@akeo.ie>
* Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) Microsoft Corporation. All rights reserved.
*
@@ -9,6 +10,10 @@
*
**/
+#include <IndustryStandard/Bcm2836.h>
+
+#include "AcpiTables.h"
+
// PL011 based UART.
Device (URT0)
{
@@ -20,14 +25,15 @@ Device (URT0)
{
Return (0xf)
}
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_PL011_UART_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x99 }
+ })
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0xFE201000, 0x1000,)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x99 }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_PL011_UART_OFFSET)
+ Return (^RBUF)
}
Name (CLCK, 48000000)
@@ -59,37 +65,38 @@ Device (URTM)
{
Return (0xf)
}
- Method (_CRS, 0x0, Serialized)
+ Name (RBUF, ResourceTemplate ()
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0xFE215000, 0x70,)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) { 0x7D }
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_MINI_UART_LENGTH, RMEM)
+ 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.
- // 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.
+ // 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 // .
- //}
+ //
+ // 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)
+ })
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MINI_UART_OFFSET)
+ Return (^RBUF)
}
}