summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2020-02-28 10:38:46 +0000
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2020-03-02 12:12:19 +0100
commit2e94c0d3042ca172ca06ba37e3011161ab2402a0 (patch)
treefa54da4711759c2b310a18b276959c48a3377ed1
parent59cc660662fd226864915e16df216102464d4be0 (diff)
Platform/RPi3: 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/RPi3/AcpiTables/AcpiTables.h8
-rw-r--r--Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.inf2
-rw-r--r--Platform/RaspberryPi/RPi3/AcpiTables/Csrt.aslc8
-rw-r--r--Platform/RaspberryPi/RPi3/AcpiTables/Dsdt.asl411
-rw-r--r--Platform/RaspberryPi/RPi3/AcpiTables/Sdhc.asl32
-rw-r--r--Platform/RaspberryPi/RPi3/AcpiTables/Uart.asl83
6 files changed, 302 insertions, 242 deletions
diff --git a/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.h
index 958af026..3e68923d 100644
--- a/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.h
+++ b/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.h
@@ -14,6 +14,14 @@
#include <IndustryStandard/Acpi50.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','3','E','D','K','2') // OEM table id 8 bytes long
#define EFI_ACPI_OEM_REVISION 0x02000820
diff --git a/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.inf
index 7ef41e79..942acf2c 100644
--- a/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.inf
@@ -35,6 +35,8 @@
[Packages]
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
+ Silicon/Broadcom/Bcm283x/Bcm283x.dec
[FixedPcd]
+ gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
diff --git a/Platform/RaspberryPi/RPi3/AcpiTables/Csrt.aslc b/Platform/RaspberryPi/RPi3/AcpiTables/Csrt.aslc
index 3b617c0a..62f1a1fb 100644
--- a/Platform/RaspberryPi/RPi3/AcpiTables/Csrt.aslc
+++ b/Platform/RaspberryPi/RPi3/AcpiTables/Csrt.aslc
@@ -8,6 +8,8 @@
*
**/
+#include <IndustryStandard/Bcm2836.h>
+
#include "AcpiTables.h"
#define DMA_MAX_REQ_LINES 32
@@ -134,9 +136,9 @@ 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
+ BCM2836_DMA0_BASE_ADDRESS, // Base address for channels
+ RPI3_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
RPI3_DMA_USED_CHANNEL_COUNT,
0, // cannot use controller interrupt
diff --git a/Platform/RaspberryPi/RPi3/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/RPi3/AcpiTables/Dsdt.asl
index ab4d4bf4..693e4b15 100644
--- a/Platform/RaspberryPi/RPi3/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/RPi3/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,13 @@
*
**/
+#include <IndustryStandard/Bcm2836.h>
+#include <IndustryStandard/Bcm2836Gpio.h>
+#include <IndustryStandard/Bcm2836Gpu.h>
+#include <IndustryStandard/Bcm2836Pwm.h>
+
+#include "AcpiTables.h"
+
#define BCM_ALT0 0x4
#define BCM_ALT1 0x5
#define BCM_ALT2 0x6
@@ -74,14 +82,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) { 0x29 }
+ })
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED(ReadWrite, 0x3F980000, 0x10000,)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x29 }
- })
- Return(RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_USB_OFFSET)
+ Return (^RBUF)
}
}
@@ -96,44 +105,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, 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)
+ 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
@@ -195,14 +209,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, 0x3F00B880, 0x00000024,)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x61 }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MBOX_OFFSET)
+ Return (^RBUF)
}
}
@@ -218,14 +234,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, 0x3F00B840, 0x00000010,)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x62 }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_VCHIQ_OFFSET)
+ Return (^RBUF)
}
}
@@ -254,15 +272,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, 0x3F200000, 0xB4, )
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x51 }
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x53 }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, GPIO_OFFSET)
+ Return (^RBUF)
}
}
@@ -277,30 +295,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, 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)
+ /* 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)
}
}
@@ -315,14 +334,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, 0x3F805000, 0x20)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) {0x55}
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C2_OFFSET)
+ Return (^RBUF)
}
}
@@ -337,57 +358,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, 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.
- }
+ /* 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.
+ }
+ })
- //
- // 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)
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI0_OFFSET)
+ Return (^RBUF)
}
}
@@ -402,43 +425,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, 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.
- }
+ /* 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.
+ }
+ })
- //
- // 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)
+ Method (_CRS, 0x0, Serialized)
+ {
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI1_OFFSET)
+ Return (^RBUF)
}
}
@@ -458,8 +483,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2)
// {
// Name (RBUF, ResourceTemplate ()
// {
- // MEMORY32FIXED (ReadWrite, 0x3F2150C0, 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)
// }
@@ -476,26 +501,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, 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)
+ 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/RPi3/AcpiTables/Sdhc.asl b/Platform/RaspberryPi/RPi3/AcpiTables/Sdhc.asl
index 0d42db30..f7553280 100644
--- a/Platform/RaspberryPi/RPi3/AcpiTables/Sdhc.asl
+++ b/Platform/RaspberryPi/RPi3/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) { 0x5E }
+ })
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0x3F300000, 0x100,)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x5E }
- })
- 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) { 0x58 }
+ })
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0x3F202000, 0x100,)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x58 }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, SDHOST_OFFSET)
+ Return (^RBUF)
}
//
diff --git a/Platform/RaspberryPi/RPi3/AcpiTables/Uart.asl b/Platform/RaspberryPi/RPi3/AcpiTables/Uart.asl
index a0067c82..ddab63f1 100644
--- a/Platform/RaspberryPi/RPi3/AcpiTables/Uart.asl
+++ b/Platform/RaspberryPi/RPi3/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,28 +10,33 @@
*
**/
+#include <IndustryStandard/Bcm2836.h>
+
+#include "AcpiTables.h"
+
// PL011 based UART.
Device (URT0)
{
Name (_HID, "BCM2837")
- Name (_CID, "HID3123")
+ Name (_CID, "ARMH0011")
Name (_UID, 0x4)
Name (_CCA, 0x0)
Method (_STA)
{
Return (0xf)
}
+ Name (RBUF, ResourceTemplate ()
+ {
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_PL011_UART_LENGTH, RMEM)
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x59 }
+ })
Method (_CRS, 0x0, Serialized)
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0x3F201000, 0x1000,)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x59 }
- })
- Return (RBUF)
+ MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_PL011_UART_OFFSET)
+ Return (^RBUF)
}
- Name (CLCK, 3000000)
+ Name (CLCK, 48000000)
Name (_DSD, Package ()
{
@@ -59,37 +65,38 @@ Device (URTM)
{
Return (0xf)
}
- Method (_CRS, 0x0, Serialized)
+ Name (RBUF, ResourceTemplate ()
{
- Name (RBUF, ResourceTemplate ()
- {
- MEMORY32FIXED (ReadWrite, 0x3F215000, 0x70,)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x3D}
+ MEMORY32FIXED (ReadWrite, 0, BCM2836_MINI_UART_LENGTH, RMEM)
+ 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.
+ // 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)
}
}
@@ -108,7 +115,7 @@ Device(BTH0)
{
Name (RBUF, ResourceTemplate ()
{
- // BT UART: UART0 (PL011)
+ // BT UART: URT0 (PL011) or URTM (miniUART)
UARTSerialBus(
115200, // InitialBaudRate: in BPS
, // BitsPerByte: default to 8 bits
@@ -133,7 +140,11 @@ Device(BTH0)
// no flow control.
16, // ReceiveBufferSize
16, // TransmitBufferSize
+#ifdef PL011_ENABLE
+ "\\_SB.URTM", // ResourceSource:
+#else
"\\_SB.URT0", // ResourceSource:
+#endif
// UART bus controller name
, // ResourceSourceIndex: assumed to be 0
, // ResourceUsage: assumed to be