From nobody Tue Feb 10 06:58:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+55307+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55307+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1583231641; cv=none; d=zohomail.com; s=zohoarc; b=PeK3Ayo7QkCjXrdF1szc8+FrZT+yM2hhhHQQIxFmtplGuECRi+eJaIwxE/x8LydWMGM3xJWD7fkIhwSO0UlGNI+mSrfGM5JbBDog/DZBzJA9LyKspgO80iwgcBUKR942OR1yOxrgcbQXew7Ha+3AtoY0/cePRMyZZ5iZS1yxBWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583231641; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=9LLmu8RK21cWW2vKT0QWEBWbjZfCsNDg4mzSoJLLASk=; b=nZ5gTRKXtdexMSWH/4z1DHi1goncWa7a+c1Lnuoc/BaEMJnu84Qoi5TZvy5DztpuH49MIN3bOj4jlP8ejTddAM5B5Sh7wPPmAI+GNGGDcHJdqD5JWEADJJD3Ey5Ab4oHWGqoeww7k3ZzvaYnwWuuu4SS+FWZs9RT79HuoPm7XSU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55307+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1583231641936338.6156662822797; Tue, 3 Mar 2020 02:34:01 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id M5VHYY1788612xSzBM8cnbag; Tue, 03 Mar 2020 02:34:00 -0800 X-Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by mx.groups.io with SMTP id smtpd.web09.1948.1583231639630000659 for ; Tue, 03 Mar 2020 02:34:00 -0800 X-Received: by mail-wm1-f67.google.com with SMTP id j1so832276wmi.4 for ; Tue, 03 Mar 2020 02:33:59 -0800 (PST) X-Gm-Message-State: i9KPeHM0rOhr1suaun5ioXkAx1787277AA= X-Google-Smtp-Source: ADFU+vtFFPF52ntOZ//MWlZqiFVGAyCp8NBfjVmRPI49Xaw4oD+dqbgA3pYczEm7eL0o19G8YX5OxA== X-Received: by 2002:a1c:960c:: with SMTP id y12mr3654486wmd.9.1583231637536; Tue, 03 Mar 2020 02:33:57 -0800 (PST) X-Received: from localhost.localdomain ([84.203.56.244]) by smtp.gmail.com with ESMTPSA id c4sm3255193wml.7.2020.03.03.02.33.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2020 02:33:56 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif@nuviainc.com, philmd@redhat.com, awarkentin@vmware.com Subject: [edk2-devel][PATCH 4/5] Platform/RPi: Make Device Tree provision a runtime (BIOS setup) choice Date: Tue, 3 Mar 2020 10:33:38 +0000 Message-Id: <20200303103339.7468-5-pete@akeo.ie> In-Reply-To: <20200303103339.7468-1-pete@akeo.ie> References: <20200303103339.7468-1-pete@akeo.ie> 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,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1583231640; bh=oCJo7d6SxByKbureKN2lM+1P20RzaRzZSAyUbruwkQQ=; h=Cc:Date:From:Reply-To:Subject:To; b=E4Yq8cFDUKsuptl7k9eWvJAGcS/MyjxCJ3+pw+1b2sWhju5e7W/SCjdpYOMJ0Po+G/L aPfgh1+F1jLPIeyPLcNbLNVx9lRNSauXILzMJq9JBW++O16xqKfpBe0f2rDYLhyX7/WA8 HNWH0htJYlOnR9yNdbHGhk8H54AFEqjTplc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" With this and the previous commit, ACPI_BASIC_MODE_ENABLE becomes superfluous so remove it. New option defaults to enabled on Pi 3, disabled on Pi 4. Signed-off-by: Pete Batard Reviewed-by: Ard Biesheuvel --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 8 ++++++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 + Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 +++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 21 +++++++++++++= +++++++ Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c | 5 +++++ Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf | 3 +++ Platform/RaspberryPi/RPi3/RPi3.dsc | 5 +++++ Platform/RaspberryPi/RPi4/RPi4.dsc | 10 +++++----- Platform/RaspberryPi/RPi4/RPi4.fdf | 2 -- Platform/RaspberryPi/RPi4/Readme.md | 15 ++++++-------- Platform/RaspberryPi/RaspberryPi.dec | 4 +--- 11 files changed, 60 insertions(+), 19 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 451a419a5358..31a62094e33e 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -151,6 +151,14 @@ SetupVariables ( PcdSet32 (PcdRamLimitTo3GB, 0); } =20 + Size =3D sizeof (UINT32); + Status =3D gRT->GetVariable (L"OptDeviceTree", + &gConfigDxeFormSetGuid, + NULL, &Size, &Var32); + if (EFI_ERROR (Status)) { + PcdSet32 (PcdOptDeviceTree, PcdGet32 (PcdOptDeviceTree)); + } + Size =3D sizeof (UINT32); Status =3D gRT->GetVariable (L"SdIsArasan", &gConfigDxeFormSetGuid, diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf index 407aac89c7b3..736d49df562b 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf @@ -72,6 +72,7 @@ [Pcd] gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot + gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB =20 diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni index 830533a9dc49..2e79e322e558 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni @@ -46,6 +46,11 @@ #string STR_ADVANCED_3GB_OFF #language en-US "Disabled" #string STR_ADVANCED_3GB_ON #language en-US "Enabled" =20 +#string STR_ADVANCED_DT_PROMPT #language en-US "Device Tree" +#string STR_ADVANCED_DT_HELP #language en-US "Disable this option = to force OSes such as GNU/Linux to use ACPI" +#string STR_ADVANCED_DT_OFF #language en-US "Disabled (Force ACPI= )" +#string STR_ADVANCED_DT_ON #language en-US "Enabled" + /* * MMC/SD configuration. */ diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index 483edd7459c5..d16058da4926 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -85,6 +85,14 @@ typedef struct { UINT32 Enabled; } ADVANCED_RAM_LIMIT_TO_3GB_VARSTORE_DATA; =20 +typedef struct { + /* + * 0 - Do not provide a Device Tree to the OS + * 1 - Provide a Device Tree to the OS + */ + UINT32 Enabled; +} ADVANCED_DEVICE_TREE_VARSTORE_DATA; + typedef struct { /* * 0 - Don't disable multi-block. @@ -162,6 +170,11 @@ formset name =3D RamLimitTo3GB, guid =3D CONFIGDXE_FORM_SET_GUID; =20 + efivarstore ADVANCED_DEVICE_TREE_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D OptDeviceTree, + guid =3D CONFIGDXE_FORM_SET_GUID; + efivarstore MMC_DISMULTI_VARSTORE_DATA, attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, name =3D MmcDisableMulti, @@ -279,6 +292,14 @@ formset option text =3D STRING_TOKEN(STR_ADVANCED_3GB_ON), value =3D= 1, flags =3D 0; endoneof; endif; + + oneof varid =3D OptDeviceTree.Enabled, + prompt =3D STRING_TOKEN(STR_ADVANCED_DT_PROMPT), + help =3D STRING_TOKEN(STR_ADVANCED_DT_HELP), + flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_ADVANCED_DT_OFF), value =3D 0= , flags =3D 0; + option text =3D STRING_TOKEN(STR_ADVANCED_DT_ON), value =3D 1,= flags =3D DEFAULT; + endoneof; endform; =20 form formid =3D 0x1003, diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/Raspbe= rryPi/Drivers/FdtDxe/FdtDxe.c index eb8048930c30..e7143f57b3b6 100644 --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c @@ -443,6 +443,11 @@ FdtDxeInitialize ( UINT32 BoardRevision; BOOLEAN Internal; =20 + if (PcdGet32 (PcdOptDeviceTree) =3D=3D 0) { + DEBUG ((DEBUG_INFO, "Device Tree disabled per user configuration\n")); + return EFI_SUCCESS; + } + Status =3D gBS->LocateProtocol (&gRaspberryPiFirmwareProtocolGuid, NULL, (VOID**)&mFwProtocol); ASSERT_EFI_ERROR (Status); diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf b/Platform/Rasp= berryPi/Drivers/FdtDxe/FdtDxe.inf index bf9912b4f7d8..fc37353f883f 100644 --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf @@ -48,3 +48,6 @@ [Depex] =20 [FixedPcd] gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress + +[Pcd] + gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index 48e1a32e1d24..91d5738afbc6 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -445,6 +445,11 @@ [PcdsDynamicHii.common.DEFAULT] gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|L"RamMoreThan3GB"|gConfigDx= eFormSetGuid|0x0|0 gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L"RamLimitTo3GB"|gConfigDxeF= ormSetGuid|0x0|0 =20 + # + # Device Tree + # + gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|L"OptDeviceTree"|gConfigDxeF= ormSetGuid|0x0|1 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index 3ce2c3e4d519..79295729f6ee 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -38,7 +38,6 @@ [Defines] DEFINE SECURE_BOOT_ENABLE =3D FALSE DEFINE INCLUDE_TFTP_COMMAND =3D FALSE DEFINE DEBUG_PRINT_ERROR_LEVEL =3D 0x8000004F - DEFINE ACPI_BASIC_MODE_ENABLE =3D FALSE =20 !ifndef TFA_BUILD_ARTIFACTS # @@ -271,8 +270,6 @@ [PcdsFeatureFlag.common] gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE =20 - gRaspberryPiTokenSpaceGuid.PcdAcpiBasicMode|$(ACPI_BASIC_MODE_ENABLE) - [PcdsFixedAtBuild.common] gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 @@ -483,6 +480,11 @@ [PcdsDynamicHii.common.DEFAULT] gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|L"RamMoreThan3GB"|gConfigDx= eFormSetGuid|0x0|0 gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L"RamLimitTo3GB"|gConfigDxeF= ormSetGuid|0x0|1 =20 + # + # Device Tree + # + gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|L"OptDeviceTree"|gConfigDxeF= ormSetGuid|0x0|0 + # # Common UEFI ones. # @@ -575,9 +577,7 @@ [Components.common] =20 ArmPkg/Drivers/ArmGic/ArmGicDxe.inf Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf -!if $(ACPI_BASIC_MODE_ENABLE) =3D=3D FALSE Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf -!endif Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf ArmPkg/Drivers/TimerDxe/TimerDxe.inf MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf b/Platform/RaspberryPi/RPi4= /RPi4.fdf index cb5e8e9ae92e..c38320350213 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.fdf +++ b/Platform/RaspberryPi/RPi4/RPi4.fdf @@ -208,9 +208,7 @@ [FV.FvMain] =20 INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf INF Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf -!if $(ACPI_BASIC_MODE_ENABLE) =3D=3D FALSE INF Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf -!endif INF Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf diff --git a/Platform/RaspberryPi/RPi4/Readme.md b/Platform/RaspberryPi/RPi= 4/Readme.md index 758d0124a6cf..21c9fd4f0a4a 100644 --- a/Platform/RaspberryPi/RPi4/Readme.md +++ b/Platform/RaspberryPi/RPi4/Readme.md @@ -16,9 +16,12 @@ Raspberry Pi is a trademark of the [Raspberry Pi Foundat= ion](https://www.raspber This firmware is still in development stage, meaning that it comes with the following __major__ limitations: =20 -- USB may only work in pre-OS phase at this stage due to nonstandard ECAM, - missing/incomplete ACPI tables as well as other factors. For Linux, using - the `ACPI_BASIC_MODE_ENABLE` build option may help. +- xHCI USB may only work in pre-OS phase due to nonstandard DMA constraint= s. + For 4 GB models running Linux, limiting the RAM to 3 GB should help. + The 3 GB limitation is currently enabled by default in the user settings. +- Device Tree boot of OSes such as Linux may not work at all. + For this reason, the provision of a Device Tree is disabled by default in + the user settings, in order to enforce ACPI boot. - Serial I/O from the OS may not work due to CPU throttling affecting the miniUART baudrate. This can be worked around by using the PL011 UART through the device tree overlays. @@ -27,12 +30,6 @@ following __major__ limitations: =20 Build instructions from the top level edk2-platforms Readme.md apply. =20 -The following additional build options are also available: -- `-D ACPI_BASIC_MODE_ENABLE=3D1`: Limits OS visible memory to 3 GB and fo= rces - ACPI (by disabling the Device Tree driver altogether). This may be requi= red - to boot Operating Systems such as Linux on account of the current PCIe/x= HCI - limitations. - # Booting the firmware =20 1. Format a uSD card as FAT16 or FAT32 diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index 7f2c37ac9a7f..25058ccc7783 100644 --- a/Platform/RaspberryPi/RaspberryPi.dec +++ b/Platform/RaspberryPi/RaspberryPi.dec @@ -57,8 +57,6 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, Pc= dsDynamicEx] gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016 gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0|UINT8|0x000000= 17 gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018 + gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|1|UINT32|0x0000001B gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|0|UINT32|0x00000019 gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|0|UINT32|0x0000001A - -[PcdsFeatureFlag.common] - gRaspberryPiTokenSpaceGuid.PcdAcpiBasicMode|FALSE|BOOLEAN|0x0000001B --=20 2.21.0.windows.1 -=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 (#55307): https://edk2.groups.io/g/devel/message/55307 Mute This Topic: https://groups.io/mt/71697499/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-