From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web12.12400.1582886358071647065 for ; Fri, 28 Feb 2020 02:39:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=xm3YWsbR; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.128.66, mailfrom: pete@akeo.ie) Received: by mail-wm1-f66.google.com with SMTP id t23so2685007wmi.1 for ; Fri, 28 Feb 2020 02:39:17 -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=9xyarX+5OH+gEyoIc3PlUCTbIHZM+zQJi3SeBx7cqME=; b=xm3YWsbRNAMQ/QgHPq1wog/Zxuv3dWMv27zqSvR3Yd9mkgGKIJDikcv6lRAKicIGlA VhmKu4mLVKYCm5ifSAEGI89VmmYDuwy2711AXsFUJFNCcQGizWg6NaDNaAc3F68zv5Z5 JCqDROdlD4wBlquEBJhn4NY6pEPaufB7554GImESfzLcaK5t2uQNQfYC0Zr9KuP3rY/3 JT8eRvuRX5vMpKcHCRHM91ducgO1n5JqYUy+oQ/In1Fpd11eEqYo+CdAY1BTawNXWeKj vYhvo1HRtfVU0bbsZyOF9gKRMHyYL8Vsp5YrEicBt3zgfNd0xroIvowOw/F2XGpsz/Uu tYrg== 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=9xyarX+5OH+gEyoIc3PlUCTbIHZM+zQJi3SeBx7cqME=; b=or1TjNPr3VcKcXV77k+N0kUg4sl3dDkiSEUNjfwa15U3SpCV8bDvwI2dzhJ4C3Skir A+n9SbKYZH5sYZIgu2iSFZp650lr8uetk5hs7Jis2ZgdpVGnbR3k7aAIV0IZ3xUgvSn4 jud+j4Otmw/NvO07Wo/dAVm6A4opqqV46JQrZ2zK9bBycC7y+hMz4YQqe2L0I0EOS9KH irg+lr4kVp1EtyGG+C6f/k192o8mHzFmBZVytyTTlOQstCu2I531/orm+5Eyvgv5vNHO r0/1lKk/WpuKJPfhGUL6HZKNvcXDk0L65/6zLZ5aGHEv4ixGkLIsgapo2mJfpeSjFK8J 61Tg== X-Gm-Message-State: APjAAAU0Ew8HkmcnqEH35mrjPiFtZip9R8sy0hDFx549tD8lwmEVk5WF lnGJqn2eRuMo76GO7JQitxUVUh4+pCo= X-Google-Smtp-Source: APXvYqw4A9dOukNix3FJWN2/E86KxsECmQRDvsKqZBSyVafyw/zAKAnj6JG98U6xm4Zz334tJyNQ1w== X-Received: by 2002:a1c:3b89:: with SMTP id i131mr2480614wma.171.1582886354481; Fri, 28 Feb 2020 02:39:14 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Feb 2020 02:39:13 -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 05/15] Platform/RPi4: Use Silicon constants in ACPI headers Date: Fri, 28 Feb 2020 10:38:45 +0000 Message-Id: <20200228103855.11352-6-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/RPi4/AcpiTables/AcpiTables.h | 8 + Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf | 2 + Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc | 7 +- Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl | 422 +++++++++++--------- Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl | 32 +- Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl | 77 ++-- 6 files changed, 302 insertions(+), 246 deletions(-) diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h index dcdbac7a0b7b..fcfad3b5d93b 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h +++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h @@ -15,6 +15,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','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 aa8f67dec95e..358c315b6da1 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf +++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf @@ -41,6 +41,7 @@ [Packages] 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 @@ [FixedPcd] 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 f8bf3f26a341..03d888fffb8b 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc @@ -10,6 +10,7 @@ **/ #include +#include #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 8d2938a6596c..c505413bcba2 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 * Copyright (c) 2018, Andrey Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -9,6 +10,14 @@ * **/ +#include +#include +#include +#include +#include + +#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, 0xFE804000, 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) } } @@ -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) } + 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, 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. - } - - // - // 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) } } @@ -432,43 +456,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, 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. - } - - // - // 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) } } @@ -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 56d15c392743..590c71edd484 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 * 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) { 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 5b59f2dd3e16..ad9d21e6272d 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 * Copyright (c) 2018, Andrey Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -9,6 +10,10 @@ * **/ +#include + +#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) } + Name (RBUF, ResourceTemplate () + { + 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. + + // + // 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, 0xFE215000, 0x70,) - Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) { 0x7D } - - // NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing - // until a proper solution can be created for the dmap conflict. - // 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) } } -- 2.21.0.windows.1