From nobody Fri May 3 13:06:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71740+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71740+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613570467951878.6321365149115; Wed, 17 Feb 2021 06:01:07 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Zw5EYY1788612xipCT0ozPOU; Wed, 17 Feb 2021 06:01:06 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.4213.1613542705685877884 for ; Tue, 16 Feb 2021 22:18:25 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 523F831B; Tue, 16 Feb 2021 22:18:25 -0800 (PST) X-Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0135D3F73B; Tue, 16 Feb 2021 22:18:24 -0800 (PST) From: jlinton To: devel@edk2.groups.io Cc: pete@akeo.ie, awarkentin@vmware.com, samer.el-haj-mahmoud@arm.com, leif@nuviainc.com, ardb+tianocore@kernel.org, Jeremy Linton Subject: [edk2-devel] [PATCH v3 1/4] Platform/RaspberryPi: Add Negative table check Date: Wed, 17 Feb 2021 00:18:06 -0600 Message-Id: <20210217061809.307479-2-lintonrjeremy@gmail.com> In-Reply-To: <20210217061809.307479-1-lintonrjeremy@gmail.com> References: <20210217061809.307479-1-lintonrjeremy@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lintonrjeremy@gmail.com X-Gm-Message-State: 3uf79RmznjJHsP6p3CC1ZU7Ix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613570466; bh=/qaEwroz673rTNP8N4TgzU1aGKaELdnlcpXk6PHddzc=; h=Cc:Date:From:Reply-To:Subject:To; b=l3CWcbm3CEN2StWRpg7oNAm+QWHAMTIKlAg15jFplLan6XngSvGG/UxGF2Sy8LL+fni PfeBt7rMcYuR73Zns8bjjakx4McKx/ngDJTd9k4Oaa895NTPgs0pXoIJZP8e9WxfNDzJM MMSkyqdsLUdm1LkWqsMTGy0yjMI0dcLy348= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Jeremy Linton Turns out its helpful to have a !PcdToken flag that enables a DSDT/SSDT. That simplifies both the emmc2 SSDT (it only installs when !SdIsArasan) and later for the XHCI/PCIe switch where we want to install one of two tables depending on whether a single Pcd is set. Signed-off-by: Jeremy Linton Reviewed-by: Pete Batard Reviewed-by: Andrei Warkentin --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 578f5ead8f..fc1b5f3420 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -606,6 +606,7 @@ typedef struct { typedef struct { UINT64 OemTableId; UINTN PcdToken; + UINTN PcdTokenNot; CONST AML_NAME_OP_REPLACE *SdtNameOpReplace; } NAMESPACE_TABLES; =20 @@ -703,6 +704,9 @@ VerifyUpdateTable ( if (SdtTable->PcdToken && !LibPcdGet32 (SdtTable->PcdToken)) { Result =3D FALSE; } + if (SdtTable->PcdTokenNot && LibPcdGet32 (SdtTable->PcdTokenNot)) { + Result =3D FALSE; + } if (Result && SdtTable->SdtNameOpReplace) { UpdateSdtNameOps (AcpiHeader, SdtTable->SdtNameOpReplace); } @@ -720,11 +724,13 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { { SIGNATURE_64 ('R', 'P', 'I', 'T', 'H', 'F', 'A', 'N'), PcdToken(PcdFanOnGpio), + 0, SsdtNameOpReplace }, { SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0), 0, + 0, NULL }, { } --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71740): https://edk2.groups.io/g/devel/message/71740 Mute This Topic: https://groups.io/mt/80703636/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 3 13:06:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71741+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71741+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 161357047434024.5568506951239; Wed, 17 Feb 2021 06:01:14 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UOopYY1788612x5hmdxIRUB8; Wed, 17 Feb 2021 06:01:13 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.4138.1613542706911021984 for ; Tue, 16 Feb 2021 22:18:27 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 895C3106F; Tue, 16 Feb 2021 22:18:26 -0800 (PST) X-Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3BA5D3F73B; Tue, 16 Feb 2021 22:18:26 -0800 (PST) From: jlinton To: devel@edk2.groups.io Cc: pete@akeo.ie, awarkentin@vmware.com, samer.el-haj-mahmoud@arm.com, leif@nuviainc.com, ardb+tianocore@kernel.org, Jeremy Linton Subject: [edk2-devel] [PATCH v3 2/4] Platform/RaspberryPi/Acpitables: Add eMMC2 device and tweak Arasan Date: Wed, 17 Feb 2021 00:18:07 -0600 Message-Id: <20210217061809.307479-3-lintonrjeremy@gmail.com> In-Reply-To: <20210217061809.307479-1-lintonrjeremy@gmail.com> References: <20210217061809.307479-1-lintonrjeremy@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lintonrjeremy@gmail.com X-Gm-Message-State: 7nRJwl0APK9nnojaAK3r6qq8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613570473; bh=Huj897z7DBdgGuWDkDRy64Ru+IwrXl1hDS1GaIlu4cw=; h=Cc:Date:From:Reply-To:Subject:To; b=FFYxSkksFbl1YjSIFWP3Bn2E9mrU6TZVzqXUDNL5tWr9nXHwgXVLZMAL+J9d3/rXO7O WSs05Sqcl1ulZsjjH0uKayD9Efn7hl0I3j9v9z5zElSTBZhmIjs3XvYjT0PXPeEr1GE1j 5YEfqMW7+AQIsw3r8VekSEAiBhwkWy6N8Go= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Jeremy Linton The primary problem with the RPi's Arasan controller is the lack of a meaningful capabilities register. With just a sdhci-caps _DSD entry we can provide that information. It can then be bound to the Linux sdhci_iproc driver which already hardcodes the remaining controller bugs. Further we have gotten BRCME88C approved as the HID for the newer eMMC2 controller. So lets define an ACPI object to describe it. Of course both devices are sharing an interrupt so we should also indicate that in the table as well. Signed-off-by: Jeremy Linton Reviewed-by: Pete Batard Reviewed-by: Andrei Warkentin --- Platform/RaspberryPi/AcpiTables/AcpiTables.inf | 1 + Platform/RaspberryPi/AcpiTables/Emmc.asl | 129 +++++++++++++++++= ++++ Platform/RaspberryPi/AcpiTables/Sdhc.asl | 18 ++- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 6 + 4 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 Platform/RaspberryPi/AcpiTables/Emmc.asl diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/Rasp= berryPi/AcpiTables/AcpiTables.inf index d2cce074e5..743261afcf 100644 --- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf +++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf @@ -35,6 +35,7 @@ Spcr.aslc Pptt.aslc SsdtThermal.asl + Emmc.asl =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/RaspberryPi/AcpiTables/Emmc.asl b/Platform/RaspberryP= i/AcpiTables/Emmc.asl new file mode 100644 index 0000000000..3cb5289d36 --- /dev/null +++ b/Platform/RaspberryPi/AcpiTables/Emmc.asl @@ -0,0 +1,129 @@ +/** @file + * + * Copyright (c) 2021 Arm. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#include +#include + +#include "AcpiTables.h" + +DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPI4EMMC", 2) +{ + Scope (\_SB_) + { +#if (RPI_MODEL =3D=3D 4) + Device (GDV1) { + Name (_HID, "ACPI0004") + Name (_UID, 0x0) + Name (_CCA, 0x0) + + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0, MMCHS2_LENGTH, RMEM) + }) + Method (_CRS, 0x0, Serialized) + { + MEMORY32SETBASE (RBUF, RMEM, RBAS, MMCHS2_OFFSET) + Return (^RBUF) + } + + Name (_DMA, ResourceTemplate() { + QWordMemory (ResourceConsumer, + , + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, + 0x00000000C0000000, // MIN + 0x00000000FFFFFFFF, // MAX + 0xFFFFFFFF40000000, // TRA + 0x0000000040000000, // LEN + , + , + ) + }) + =20 + // emmc2 Host Controller. (brcm,bcm2711-emmc2) + Device (SDC3) + { + Name (_HID, "BRCME88C") + Name (_UID, 0x1) + Name (_CCA, 0x0) + Name (_S1D, 0x1) + Name (_S2D, 0x1) + Name (_S3D, 0x1) + Name (_S4D, 0x1) + Name (SDMA, 0x2) + Method (_STA) + { + Return(0xf) + } + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0, MMCHS2_LENGTH, RMEM) + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM283= 6_MMCHS1_INTERRUPT } + }) + Method (_CRS, 0x0, Serialized) + { + MEMORY32SETBASE (RBUF, RMEM, RBAS, MMCHS2_OFFSET) + Return (^RBUF) + } + + // Unfortunately this controller doesn't honor the + // standard SDHCI voltage control registers + // (or at least Linux's standard code can't=20 + // lower the voltage) So, UHS mode is disabled with caps + Name (DSD1, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "sdhci-caps-mask", 0x0000000500080000 }, + } + }) + // Along with disabling UHS, here both SDMA and ADMA2 + // are also disabled until the linux _DMA() mask/translate + // works properly. + Name (DSD2, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "sdhci-caps-mask", 0x0000000504480000 }, + } + }) + Method (_DSD, 0x0, Serialized) + { + // Select one of the sdhci-caps-mask definitions + // depending on whether we also want to disable DMA + if (SDMA =3D=3D 0)=20 + { + return (^DSD2) + }=20 + else=20 + { + return (^DSD1) + } + } + + // + // A child device that represents the + // sd card, which is marked as non-removable. + // + Device (SDMM) + { + Method (_ADR) + { + Return (0) + } + Method (_RMV) // Is removable + { + Return (0) // 0 - fixed + } + } + } //SDC3 + } //GDV1 +#endif + } //\SB +} diff --git a/Platform/RaspberryPi/AcpiTables/Sdhc.asl b/Platform/RaspberryP= i/AcpiTables/Sdhc.asl index 0ab1ba27f2..0430ab7d2d 100644 --- a/Platform/RaspberryPi/AcpiTables/Sdhc.asl +++ b/Platform/RaspberryPi/AcpiTables/Sdhc.asl @@ -19,7 +19,7 @@ // Note: UEFI can use either SDHost or Arasan. We expose both to the OS. // =20 -// ArasanSD 3.0 SD Host Controller. +// ArasanSD 3.0 SD Host Controller. (brcm,bcm2835-sdhci) Device (SDC1) { Name (_HID, "BCM2847") @@ -37,7 +37,7 @@ Device (SDC1) Name (RBUF, ResourceTemplate () { MEMORY32FIXED (ReadWrite, 0, MMCHS1_LENGTH, RMEM) - Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_M= MCHS1_INTERRUPT } + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_MMCH= S1_INTERRUPT } }) Method (_CRS, 0x0, Serialized) { @@ -45,6 +45,17 @@ Device (SDC1) Return (^RBUF) } =20 + // The standard CAPs registers on this controller + // appear to be 0, lets set some minimal defaults + // Since this cap doesn't indicate DMA capability + // we don't need a _DMA() + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "sdhci-caps", 0x0100fa81 }, + } + }) + // // A child device that represents the // sd card, which is marked as non-removable. @@ -62,7 +73,7 @@ Device (SDC1) } } =20 - +#if (RPI_MODEL < 4) // Broadcom SDHost 2.0 SD Host Controller Device (SDC2) { @@ -105,3 +116,4 @@ Device (SDC2) } } } +#endif // !RPI4 diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index fc1b5f3420..402a2996b3 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -728,6 +728,12 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { SsdtNameOpReplace }, { + SIGNATURE_64 ('R', 'P', 'I', '4', 'E', 'M', 'M', 'C'), + 0, + PcdToken(PcdSdIsArasan), + NULL + }, + { SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0), 0, 0, --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71741): https://edk2.groups.io/g/devel/message/71741 Mute This Topic: https://groups.io/mt/80703637/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 3 13:06:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71742+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71742+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613570477028879.5777386303437; Wed, 17 Feb 2021 06:01:17 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id b6HeYY1788612xYC5PFdcmdv; Wed, 17 Feb 2021 06:01:15 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.4150.1613542707845663894 for ; Tue, 16 Feb 2021 22:18:28 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 79CEF31B; Tue, 16 Feb 2021 22:18:27 -0800 (PST) X-Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2B0B43F73B; Tue, 16 Feb 2021 22:18:27 -0800 (PST) From: jlinton To: devel@edk2.groups.io Cc: pete@akeo.ie, awarkentin@vmware.com, samer.el-haj-mahmoud@arm.com, leif@nuviainc.com, ardb+tianocore@kernel.org, Jeremy Linton Subject: [edk2-devel] [PATCH v3 3/4] Platform/RaspberryPi: User control of eMMC2 DMA Date: Wed, 17 Feb 2021 00:18:08 -0600 Message-Id: <20210217061809.307479-4-lintonrjeremy@gmail.com> In-Reply-To: <20210217061809.307479-1-lintonrjeremy@gmail.com> References: <20210217061809.307479-1-lintonrjeremy@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lintonrjeremy@gmail.com X-Gm-Message-State: nv1wg3MIajMCw6uzI8OdIYHex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613570475; bh=nV68FKWDhU/MK1OgQnLxQJVBblpzKL8tTMNk4W+g7ns=; h=Cc:Date:From:Reply-To:Subject:To; b=dMXPf4K9OAXC22dOiMXGMLq7Kd6PpmcL4lg4RfGs4YDoy5MTtN/s0UV3R17cRlMp71b yhQIQAL4kxDTcf8EuMTcMEbnn6ULyqBv1EEhSkGACvo77twpcWgACqlqIZzrdTVXTpJvx NqouceJUmwaDHAP6dZP/UHUhcK6IVqBVbS4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Jeremy Linton DMA translation on the eMMC2 vary based on SoC, and this is made worse by the poor _DMA support in Linux. For now the "safe" option is to simply run the eMMC2 controller in PIO mode. More advanced users or !Linux operating systems may choose to enable this to gain a perf boost. Signed-off-by: Jeremy Linton Reviewed-by: Pete Batard Reviewed-by: Andrei Warkentin --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 16 +++++++++++++= ++- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 + Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 4 ++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 17 +++++++++++++= ++++ Platform/RaspberryPi/Include/ConfigVars.h | 8 ++++++++ Platform/RaspberryPi/RPi3/RPi3.dsc | 1 + Platform/RaspberryPi/RPi4/RPi4.dsc | 1 + Platform/RaspberryPi/RaspberryPi.dec | 1 + 8 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 402a2996b3..22f86d4d44 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -336,6 +336,15 @@ SetupVariables ( } =20 Size =3D sizeof (UINT32); + Status =3D gRT->GetVariable (L"MmcEnableDma", + &gConfigDxeFormSetGuid, + NULL, &Size, &Var32); + if (EFI_ERROR (Status)) { + Status =3D PcdSet32S (PcdMmcEnableDma, PcdGet32 (PcdMmcEnableDma)); + ASSERT_EFI_ERROR (Status); + } + + Size =3D sizeof (UINT32); Status =3D gRT->GetVariable (L"DebugEnableJTAG", &gConfigDxeFormSetGuid, NULL, &Size, &Var32); @@ -720,6 +729,11 @@ STATIC CONST AML_NAME_OP_REPLACE SsdtNameOpReplace[] = =3D { { } }; =20 +STATIC CONST AML_NAME_OP_REPLACE SsdtEmmcNameOpReplace[] =3D { + { "SDMA", PcdToken (PcdMmcEnableDma) }, + { } +}; + STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { { SIGNATURE_64 ('R', 'P', 'I', 'T', 'H', 'F', 'A', 'N'), @@ -731,7 +745,7 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { SIGNATURE_64 ('R', 'P', 'I', '4', 'E', 'M', 'M', 'C'), 0, PcdToken(PcdSdIsArasan), - NULL + SsdtEmmcNameOpReplace }, { SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0), diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf index 544e3b3e10..d51e54e010 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf @@ -84,6 +84,7 @@ gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti + gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni index 2afe8f32ae..466fa852cb 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni @@ -94,6 +94,10 @@ #string STR_MMC_SD_HS_PROMPT #language en-US "SD High Speed (MHz)" #string STR_MMC_SD_HS_HELP #language en-US "Override default 50Mhz" =20 +#string STR_MMC_EMMC_PROMPT #language en-US "Enable eMMC DMA modes" +#string STR_MMC_EMMC_PIO #language en-US "PIO" +#string STR_MMC_EMMC_DMA #language en-US "SDMA/ADMA2" +#string STR_MMC_EMMC_HELP #language en-US "Enable eMMC DMA modes fo= r OSes that support ACPI _DMA() translations" =20 /* * Display settings. diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index de5e43471a..cc7a09cfb7 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -96,6 +96,11 @@ formset name =3D MmcSdHighSpeedMHz, guid =3D CONFIGDXE_FORM_SET_GUID; =20 + efivarstore MMC_EMMC_DMA_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D MmcEnableDma, + guid =3D CONFIGDXE_FORM_SET_GUID; + efivarstore DEBUG_ENABLE_JTAG_VARSTORE_DATA, attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, name =3D DebugEnableJTAG, @@ -275,6 +280,18 @@ formset maximum =3D 100, default =3D 50, endnumeric; +#if (RPI_MODEL =3D=3D 4) + grayoutif ideqval SdIsArasan.Routing =3D=3D 1; + oneof varid =3D MmcEnableDma.EnableDma, + prompt =3D STRING_TOKEN(STR_MMC_EMMC_PROMPT), + help =3D STRING_TOKEN(STR_MMC_EMMC_HELP), + flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_MMC_EMMC_PIO), value =3D 0, f= lags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_MMC_EMMC_DMA), value =3D 1, f= lags =3D 0; + endoneof; + endif; +#endif + endform; =20 form formid =3D 0x1004, diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspberry= Pi/Include/ConfigVars.h index c185bfe28b..142317985a 100644 --- a/Platform/RaspberryPi/Include/ConfigVars.h +++ b/Platform/RaspberryPi/Include/ConfigVars.h @@ -135,4 +135,12 @@ typedef struct { UINT32 MHz; } MMC_SD_HS_MHZ_VARSTORE_DATA; =20 +typedef struct { + /* + * 0 - eMMC PIO mode + * 1 - eMMC DMA mode + */ + UINT32 EnableDma; +} MMC_EMMC_DMA_VARSTORE_DATA; + #endif /* CONFIG_VARS_H */ diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index 530b42796a..107cbda297 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -470,6 +470,7 @@ gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefaultSpeedMH= z"|gConfigDxeFormSetGuid|0x0|25 gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|L"MmcSdHighSpeedMHz"|gCo= nfigDxeFormSetGuid|0x0|50 gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|L"MmcDisableMulti"|gConfig= DxeFormSetGuid|0x0|0 + gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|L"MmcEnableDma"|gConfigDxeFor= mSetGuid|0x0|0 =20 # # Debug-related. diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index 5f8452aa0b..9962df0076 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -481,6 +481,7 @@ gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefaultSpeedMH= z"|gConfigDxeFormSetGuid|0x0|25 gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|L"MmcSdHighSpeedMHz"|gCo= nfigDxeFormSetGuid|0x0|50 gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|L"MmcDisableMulti"|gConfig= DxeFormSetGuid|0x0|0 + gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|L"MmcEnableDma"|gConfigDxeFor= mSetGuid|0x0|0 =20 # # Debug-related. diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index 10723036aa..08135717ed 100644 --- a/Platform/RaspberryPi/RaspberryPi.dec +++ b/Platform/RaspberryPi/RaspberryPi.dec @@ -69,3 +69,4 @@ gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|0|UINT32|0x0000001C gRaspberryPiTokenSpaceGuid.PcdFanTemp|0|UINT32|0x0000001D gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|0|UINT32|0x0000001E + gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71742): https://edk2.groups.io/g/devel/message/71742 Mute This Topic: https://groups.io/mt/80703638/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 3 13:06:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71743+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71743+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613570476818823.3368142711721; Wed, 17 Feb 2021 06:01:16 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id MOWbYY1788612xeSzVukhCWb; Wed, 17 Feb 2021 06:01:15 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.4139.1613542708684956067 for ; Tue, 16 Feb 2021 22:18:28 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 64739106F; Tue, 16 Feb 2021 22:18:28 -0800 (PST) X-Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 16D553F73B; Tue, 16 Feb 2021 22:18:28 -0800 (PST) From: jlinton To: devel@edk2.groups.io Cc: pete@akeo.ie, awarkentin@vmware.com, samer.el-haj-mahmoud@arm.com, leif@nuviainc.com, ardb+tianocore@kernel.org, Jeremy Linton Subject: [edk2-devel] [PATCH v3 4/4] Platform/RaspberryPi: Invert default Arasan, eMMC2 routing Date: Wed, 17 Feb 2021 00:18:09 -0600 Message-Id: <20210217061809.307479-5-lintonrjeremy@gmail.com> In-Reply-To: <20210217061809.307479-1-lintonrjeremy@gmail.com> References: <20210217061809.307479-1-lintonrjeremy@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lintonrjeremy@gmail.com X-Gm-Message-State: X8B80p471vlx33PmB4xidew5x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613570475; bh=B4NYL9Zp3jh7cYieSs14ZpAd+pK+4EQ/dwOHAyr22vw=; h=Cc:Date:From:Reply-To:Subject:To; b=UMP3o+RX7K3+F+lLhB94nhq1Su9eC0GuwaV7L2whbl12CGHBflnkuMIeHCP1JP+MYHD 7PHAegk7qWe4NGZlaDa1fQsGzUIozpa2gsbqlBMrkczW/8oLAr/AP/CYTdCNiwyCsR8NJ vQV7AnM3jpivnwD7/0oQnz91LbrM68ESMHs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Jeremy Linton In order for the WiFi to work, and the SD to run at full speed we need to bind the SD slot to the eMMC2 controller. Since we now have a driver for the eMMC2 controller there isn't any reason to leave the SD card bound to the older Arasan controller. Signed-off-by: Jeremy Linton Reviewed-by: Pete Batard Reviewed-by: Andrei Warkentin --- Platform/RaspberryPi/RPi4/RPi4.dsc | 2 +- Platform/RaspberryPi/RPi4/Readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index 9962df0076..e0fad6f744 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -475,7 +475,7 @@ # SD-related. # =20 - gRaspberryPiTokenSpaceGuid.PcdSdIsArasan|L"SdIsArasan"|gConfigDxeFormSet= Guid|0x0|1 + gRaspberryPiTokenSpaceGuid.PcdSdIsArasan|L"SdIsArasan"|gConfigDxeFormSet= Guid|0x0|0 gRaspberryPiTokenSpaceGuid.PcdMmcForce1Bit|L"MmcForce1Bit"|gConfigDxeFor= mSetGuid|0x0|0 gRaspberryPiTokenSpaceGuid.PcdMmcForceDefaultSpeed|L"MmcForceDefaultSpee= d"|gConfigDxeFormSetGuid|0x0|0 gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefaultSpeedMH= z"|gConfigDxeFormSetGuid|0x0|25 diff --git a/Platform/RaspberryPi/RPi4/Readme.md b/Platform/RaspberryPi/RPi= 4/Readme.md index 3b2ed44e3c..80899f4ca4 100644 --- a/Platform/RaspberryPi/RPi4/Readme.md +++ b/Platform/RaspberryPi/RPi4/Readme.md @@ -181,7 +181,7 @@ Limit RAM to 3 GB | `RamLimitTo3GB` | Disabl= e =3D `0x00000000`
Ena System Table Selection | `SystemTableMode`| ACPI =3D `0x00000000` (d= efault)
ACPI + Devicetree =3D `0x00000001`
Devicetree =3D `0x00000= 002` Asset Tag | `AssetTag` | String, 32 characters or less = (e.g. `L"ABCD123"`)
(default `L""`) **SD/MMC Configuration** | -uSD/eMMC Routing | `SdIsArasan` | Arasan SDHC =3D `0x00000001`= (default)
eMMC2 SDHCI =3D `0x00000000` +uSD/eMMC Routing | `SdIsArasan` | Arasan SDHC =3D `0x00000001`=
eMMC2 SDHCI =3D `0x00000000` (default) Multi-Block Support | `MmcDisableMulti` | Multi-block transfers = =3D `0x00000000` (default)
Single block transfers =3D `0x00000001` uSD Max Bus Width | `MmcForce1Bit` | 4-bit Mode =3D `0x00000000= ` (default)
1-bit Mode =3D `0x00000001` uSD Force Default Speed | `MmcForceDefaultSpeed` | Allow High Speed = =3D `0x00000000` (default)
Force Default Speed =3D `0x00000001` --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71743): https://edk2.groups.io/g/devel/message/71743 Mute This Topic: https://groups.io/mt/80703639/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-