From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.groups.io with SMTP id smtpd.web12.12401.1582886360284783615 for ; Fri, 28 Feb 2020 02:39:20 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=g6UmRGtY; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.66, mailfrom: pete@akeo.ie) Received: by mail-wr1-f66.google.com with SMTP id m16so2328916wrx.11 for ; Fri, 28 Feb 2020 02:39:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rim47MeYaPpDsb1doX/Lr1GqnMwBJkZ/LjYOAod13uc=; b=g6UmRGtYhlGSJjl+ZXfDaj3ZOkqy+Nj3Nj3LoL2oc/bHxedKhx2HwXvaBsFEsGgkIi 8ry75C+VFEL4NBfwi7bRaHAhI6XwoTCesgP3Rd4cG476XOdfK6oJcXB31rYKRnpU2uIT wp3qIJWQ9/huSAzmActVFBhpLn9ay/LwLyqPV9UmWWdfsyGv5lLboeMhkCs8/3wXQLo2 BkIRMTd1SxUpA1xxthzEkZXZxEpJj9/htp7/U2MP+2/XEc6y8nR3pNycEdiVjVLLiw0q wkP3k/ckESDIRWDvvIIqtj2q3kZDxmuNZ5P1BAWub6b14HHYLN7AYetH7W6BBzE/U9cw tScA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rim47MeYaPpDsb1doX/Lr1GqnMwBJkZ/LjYOAod13uc=; b=SQAX4VugXz1rtwAmr25+vGxdovtmjtdORgBv7stMF+IbZjmUFveMfhA9uYl7xNdDtw G6KAnhFgiELgZIemCr39d8o42gccubJWAHHpQ41N3Czzz9DRR8P58LqMviiyCBN+Buoh B2tZCRa2iGUTBn58GHras6X4txuM4mY1qE9/ynCKSPMcQb5+y9/ZS0s2OneS5n1tqCex 66qWuPDV4KZyFuZA1Q8+UBwYXReBPl8nCSHsGM8WsNMigbf9NbwMaJbb2yBmAYPSAbXw dY+pxk1+ZYldJ+sRAjJlWXBPGQkrWSgNP4X9xoPnmciJjOtn0LgznFGwKZ63rbybrVr7 wfgQ== X-Gm-Message-State: APjAAAVJtqMubOWfMYTOHd1p5yJWVTHLJk+rd24DoSC9Lg/18/n8EMIP UUQ8lWAFgqKuYyecKU5AqPLW3QT+mpQ= X-Google-Smtp-Source: APXvYqwTH6Wno3PxuXG28bvriNkzRyfkHAvxSzdTG3W8yD7/DLllA+1HvCBblEQx7Q4pb1y8DTed0w== X-Received: by 2002:a5d:4610:: with SMTP id t16mr4174184wrq.408.1582886357297; Fri, 28 Feb 2020 02:39:17 -0800 (PST) Return-Path: Received: from localhost.localdomain ([84.203.56.244]) by smtp.gmail.com with ESMTPSA id s8sm12341061wrt.57.2020.02.28.02.39.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Feb 2020 02:39:16 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif@nuviainc.com, philmd@redhat.com Subject: [edk2-platforms][PATCH 06/15] Platform/RPi3: Use Silicon constants in ACPI headers Date: Fri, 28 Feb 2020 10:38:46 +0000 Message-Id: <20200228103855.11352-7-pete@akeo.ie> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20200228103855.11352-1-pete@akeo.ie> References: <20200228103855.11352-1-pete@akeo.ie> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.h | 8 + Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.inf | 2 + Platform/RaspberryPi/RPi3/AcpiTables/Csrt.aslc | 8 +- Platform/RaspberryPi/RPi3/AcpiTables/Dsdt.asl | 415 +++++++++++--------- Platform/RaspberryPi/RPi3/AcpiTables/Sdhc.asl | 32 +- Platform/RaspberryPi/RPi3/AcpiTables/Uart.asl | 87 ++-- 6 files changed, 306 insertions(+), 246 deletions(-) diff --git a/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.h index 958af026c8a3..3e68923d3c05 100644 --- a/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.h +++ b/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.h @@ -14,6 +14,14 @@ #include +// 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 7ef41e79ad46..942acf2c6660 100644 --- a/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.inf +++ b/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.inf @@ -35,6 +35,8 @@ [Sources] [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 3b617c0a832b..62f1a1fbdf19 100644 --- a/Platform/RaspberryPi/RPi3/AcpiTables/Csrt.aslc +++ b/Platform/RaspberryPi/RPi3/AcpiTables/Csrt.aslc @@ -8,6 +8,8 @@ * **/ +#include + #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 ab4d4bf4851f..693e4b15e985 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 * Copyright (c) 2018, Andrey Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -9,6 +10,13 @@ * **/ +#include +#include +#include +#include + +#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, 0x3F804000, 0x20) - Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x55} + 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 - { - /* 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) + // + // 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 // . + } + }) + 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) } + 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 + { + /* 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. + } + }) + Method (_CRS, 0x0, Serialized) { - Name (RBUF, ResourceTemplate () - { - MEMORY32FIXED (ReadWrite, 0x3F204000, 0x20,) - Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x56} - - // - // MsftFunctionConfig is encoded as the VendorLong. - // - // MsftFunctionConfig (Exclusive, PullDown, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, ) {9, 10, 11} // MISO, MOSI, SCLK - VendorLong () // Length = 0x33 - { - /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....` - /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0. - /* 0010 */ 0x2F, 0x8D, 0x1F, 0x00, 0x01, 0x10, 0x00, 0x02, // /....... - /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x18, 0x00, 0x22, // ......." - /* 0020 */ 0x00, 0x00, 0x00, 0x09, 0x00, 0x0A, 0x00, 0x0B, // ........ - /* 0028 */ 0x00, 0x5C, 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, // .\_SB.GP - /* 0030 */ 0x49, 0x30, 0x00 // I0. - } - - // - // MsftFunctionConfig is encoded as the VendorLong. - // - // MsftFunctionConfig (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, ) {8} // CE0 - VendorLong () // Length = 0x2F - { - /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....` - /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0. - /* 0010 */ 0x2F, 0x8D, 0x1B, 0x00, 0x01, 0x10, 0x00, 0x01, // /....... - /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x1E, // ........ - /* 0020 */ 0x00, 0x00, 0x00, 0x08, 0x00, 0x5C, 0x5F, 0x53, // .....\_S - /* 0028 */ 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, 0x00 // B.GPI0. - } - - // - // MsftFunctionConfig is encoded as the VendorLong. - // - // MsftFunctionConfig (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0", 0, ResourceConsumer, ) {7} // CE1 - VendorLong () // Length = 0x2F - { - /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....` - /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0. - /* 0010 */ 0x2F, 0x8D, 0x1B, 0x00, 0x01, 0x10, 0x00, 0x01, // /....... - /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x1E, // ........ - /* 0020 */ 0x00, 0x00, 0x00, 0x07, 0x00, 0x5C, 0x5F, 0x53, // .....\_S - /* 0028 */ 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, 0x00 // B.GPI0. - } - }) - Return (RBUF) + MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI0_OFFSET) + Return (^RBUF) } } @@ -402,43 +425,45 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2) { Return (0xf) } + 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 + { + /* 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. + } + }) + Method (_CRS, 0x0, Serialized) { - Name (RBUF, ResourceTemplate () - { - MEMORY32FIXED (ReadWrite, 0x3F215080, 0x40,) - Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) {0x3D} - - // - // MsftFunctionConfig is encoded as the VendorLong. - // - // MsftFunctionConfig(Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, ) {19, 20, 21} // MISO, MOSI, SCLK - VendorLong () // Length = 0x33 - { - /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....` - /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0. - /* 0010 */ 0x2F, 0x8D, 0x1F, 0x00, 0x01, 0x10, 0x00, 0x02, // /....... - /* 0018 */ 0x03, 0x00, 0x12, 0x00, 0x00, 0x18, 0x00, 0x22, // ......." - /* 0020 */ 0x00, 0x00, 0x00, 0x13, 0x00, 0x14, 0x00, 0x15, // ........ - /* 0028 */ 0x00, 0x5C, 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, // .\_SB.GP - /* 0030 */ 0x49, 0x30, 0x00 // I0. - } - - // - // MsftFunctionConfig is encoded as the VendorLong. - // - // MsftFunctionConfig(Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0", 0, ResourceConsumer, ) {16} // CE2 - VendorLong () // Length = 0x2F - { - /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....` - /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0. - /* 0010 */ 0x2F, 0x8D, 0x1B, 0x00, 0x01, 0x10, 0x00, 0x02, // /....... - /* 0018 */ 0x03, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x1E, // ........ - /* 0020 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x5C, 0x5F, 0x53, // .....\_S - /* 0028 */ 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, 0x00 // B.GPI0. - } - }) - Return (RBUF) + 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 0d42db30ae22..f7553280b60e 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 * Copyright (c) 2018, Andrey Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -9,6 +10,11 @@ * **/ +#include +#include + +#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 a0067c82c661..ddab63f15268 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 * Copyright (c) 2018, Andrey Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -9,28 +10,33 @@ * **/ +#include + +#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) } + Name (RBUF, ResourceTemplate () + { + 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. + + // + // 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 // . + //} + + }) Method (_CRS, 0x0, Serialized) { - Name (RBUF, ResourceTemplate () - { - MEMORY32FIXED (ReadWrite, 0x3F215000, 0x70,) - Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x3D} - - // NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing - // until a proper solution can be created for the dmap conflict. - // When muxing is enabled, must consider DBG2 table conflict. - // The alternate function resource needs to be reserved when - // the kernel debugger is enabled to prevent another client - // from muxing the pins away. - - // - // MsftFunctionConfig is encoded as the VendorLong. - // - // MsftFunctionConfig(Exclusive, PullDown, BCM_ALT5, "\\_SB.GPI0", 0, ResourceConsumer, ) {14, 15} - // VendorLong () // Length = 0x31 - // { - // /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, // .`D....` - // /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, // J...-#0. - // /* 0010 */ 0x2F, 0x8D, 0x1D, 0x00, 0x01, 0x10, 0x00, 0x02, // /....... - // /* 0018 */ 0x02, 0x00, 0x12, 0x00, 0x00, 0x16, 0x00, 0x20, // ....... - // /* 0020 */ 0x00, 0x00, 0x00, 0x0E, 0x00, 0x0F, 0x00, 0x5C, // .......\ - // /* 0028 */ 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, // _SB.GPI0 - // /* 0030 */ 0x00 // . - //} - - }) - Return (RBUF) + 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 -- 2.21.0.windows.1