From nobody Sat May 4 20:02:40 2024 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+55304+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+55304+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1583231636; cv=none; d=zohomail.com; s=zohoarc; b=Z+0ar6LQin/PePhf9LqAV/omIB2xoXiD7rGvtB1iY9dhZBYRdE7+/PgqUIaONAMsSwYjPfLI7F/Vi90b5YrjuQWHeBuximQEM3msU4G0XeR8vBKtG7FX4St0R3+YkjG8tXJe/llnOvlzo/InELNwV0t5NbtTcFMpzuBOWoL5rLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583231636; 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=gECo1qk4TbqgDbNl2qwch0T20BfZSFRXa8Q+f6d9s4U=; b=itpMLrjDt0eJavhimSvCoDzhzQe4V6vebkbWz7GWbdACG8Ps/h/F5rqGCHsq1JKOBHAzSrCNJKfIaxm4jiPbjz1pQiq/Yco446WzG15OGbyofztKrRntW44pGD4Atr4nkC2199F+g3CGEfL7Fe9OzVU/tcSfxs9d1ZtchfiRktA= 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+55304+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 158323163651180.35768000988651; Tue, 3 Mar 2020 02:33:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id SKN0YY1788612xhKHDUokuoC; Tue, 03 Mar 2020 02:33:55 -0800 X-Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web11.1945.1583231634837799756 for ; Tue, 03 Mar 2020 02:33:55 -0800 X-Received: by mail-wm1-f66.google.com with SMTP id a141so2282890wme.2 for ; Tue, 03 Mar 2020 02:33:54 -0800 (PST) X-Gm-Message-State: Ddi7mIfuCFeIA0V4st1l6BEbx1787277AA= X-Google-Smtp-Source: ADFU+vtRTBQ8Vwjysyg5UXr6hL4YSMrzkZCMPPrjMzmfoHsg3YDVIsPCmOrR3E7jgNe15qXjOXG8kg== X-Received: by 2002:a1c:1d84:: with SMTP id d126mr3538676wmd.187.1583231632940; Tue, 03 Mar 2020 02:33:52 -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.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2020 02:33:52 -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 1/5] Platform/RPi: Add firmware call to read installed memory size Date: Tue, 3 Mar 2020 10:33:35 +0000 Message-Id: <20200303103339.7468-2-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=1583231635; bh=P3yQS2Wmp4EN0eRHywHT2wDolT85zi9ecXz0cAUz9lY=; h=Cc:Date:From:Reply-To:Subject:To; b=BN5BbpMq8S9X7VxtAnt0ENXtibcy1qtI3K6BqfNhuNMRZOVYmI14OPMsUmZsVOGV/aB JoqX0BNE5jmgKVTE3aUIGJMaad1Ab2jEMy0xgYODO/kOsYWB4pppY3Z0KxEM1fIEeGC3J iXNVQVykiz7XzqJMrXP+pR1yRWueabKpW0E= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Andrei Warkentin Add a new RPiFirmwareGetModelInstalledMB () call in RpiFirmwareDxe to return the amount of detected installed RAM on the system (in MB). Use the new call in PlatformSmbiosDxe. Signed-off-by: Pete Batard --- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 10 ++= --- Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 29 ++= +++++++++- Platform/RaspberryPi/Include/Protocol/RpiFirmware.h | 47 ++= +++++++++--------- 3 files changed, 59 insertions(+), 27 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c index f25c439f89c8..5585cb846f41 100644 --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c @@ -870,21 +870,19 @@ MemArrMapInfoUpdateSmbiosType19 ( ) { EFI_STATUS Status; - UINT32 BoardRevision =3D 0; + UINT32 InstalledMB =3D 0; =20 // Note: Type 19 addresses are expressed in KB, not bytes // The memory layout used in all known Pi SoC's starts at 0 mMemArrMapInfoType19.StartingAddress =3D 0; + // The minimum RAM size used on any Raspberry Pi model is 256 MB mMemArrMapInfoType19.EndingAddress =3D 256 * 1024; - Status =3D mFwProtocol->GetModelRevision (&BoardRevision); + Status =3D mFwProtocol->GetModelInstalledMB (&InstalledMB); if (Status !=3D EFI_SUCCESS) { DEBUG ((DEBUG_WARN, "Couldn't get the board memory size - defaulting t= o 256 MB: %r\n", Status)); } else { - // www.raspberrypi.org/documentation/hardware/raspberrypi/revision-cod= es/README.md - // Bits [20-22] indicate the amount of memory starting with 256MB (000= b) - // and doubling in size for each value (001b =3D 512 MB, 010b =3D 1GB,= etc.) - mMemArrMapInfoType19.EndingAddress <<=3D (BoardRevision >> 20) & 0x07; + mMemArrMapInfoType19.EndingAddress =3D InstalledMB * 1024; } mMemArrMapInfoType19.EndingAddress -=3D 1; =20 diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b= /Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c index 75826fdc0e53..40c78b5d57cf 100644 --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c @@ -606,6 +606,32 @@ RpiFirmwareGetModelName ( } } =20 +STATIC +EFI_STATUS +EFIAPI +RPiFirmwareGetModelInstalledMB ( + OUT UINT32 *InstalledMB + ) +{ + EFI_STATUS Status; + UINT32 Revision; + + Status =3D RpiFirmwareGetModelRevision(&Revision); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_ERROR, "%a: Could not get the board revision: Status =3D= =3D %r\n", + __FUNCTION__, Status)); + return EFI_DEVICE_ERROR; + } + + // + // www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes= /README.md + // Bits [20-22] indicate the amount of memory starting with 256MB (000b) + // and doubling in size for each value (001b =3D 512 MB, 010b =3D 1GB, e= tc.) + // + *InstalledMB =3D 256 << ((Revision >> 20) & 0x07); + return EFI_SUCCESS; +} + STATIC EFI_STATUS EFIAPI @@ -1236,7 +1262,8 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL mRpiFirmwarePro= tocol =3D { RpiFirmwareGetFirmwareRevision, RpiFirmwareGetManufacturerName, RpiFirmwareGetCpuName, - RpiFirmwareGetArmMemory + RpiFirmwareGetArmMemory, + RPiFirmwareGetModelInstalledMB, }; =20 /** diff --git a/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h b/Platform= /RaspberryPi/Include/Protocol/RpiFirmware.h index e3287e3c040f..108becbd3b6d 100644 --- a/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h +++ b/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h @@ -115,6 +115,12 @@ EFI_STATUS UINT32 *Revision ); =20 +typedef +EFI_STATUS +(EFIAPI *GET_MODEL_INSTALLED_MB) ( + UINT32 *InstalledMB + ); + typedef CHAR8* (EFIAPI *GET_MANUFACTURER_NAME) ( @@ -135,26 +141,27 @@ EFI_STATUS ); =20 typedef struct { - SET_POWER_STATE SetPowerState; - GET_MAC_ADDRESS GetMacAddress; - GET_COMMAND_LINE GetCommandLine; - GET_CLOCK_RATE GetClockRate; - GET_CLOCK_RATE GetMaxClockRate; - GET_CLOCK_RATE GetMinClockRate; - SET_CLOCK_RATE SetClockRate; - GET_FB GetFB; - FREE_FB FreeFB; - GET_FB_SIZE GetFBSize; - SET_LED SetLed; - GET_SERIAL GetSerial; - GET_MODEL GetModel; - GET_MODEL_REVISION GetModelRevision; - GET_MODEL_NAME GetModelName; - GET_MODEL_FAMILY GetModelFamily; - GET_FIRMWARE_REVISION GetFirmwareRevision; - GET_MANUFACTURER_NAME GetManufacturerName; - GET_CPU_NAME GetCpuName; - GET_ARM_MEM GetArmMem; + SET_POWER_STATE SetPowerState; + GET_MAC_ADDRESS GetMacAddress; + GET_COMMAND_LINE GetCommandLine; + GET_CLOCK_RATE GetClockRate; + GET_CLOCK_RATE GetMaxClockRate; + GET_CLOCK_RATE GetMinClockRate; + SET_CLOCK_RATE SetClockRate; + GET_FB GetFB; + FREE_FB FreeFB; + GET_FB_SIZE GetFBSize; + SET_LED SetLed; + GET_SERIAL GetSerial; + GET_MODEL GetModel; + GET_MODEL_REVISION GetModelRevision; + GET_MODEL_NAME GetModelName; + GET_MODEL_FAMILY GetModelFamily; + GET_FIRMWARE_REVISION GetFirmwareRevision; + GET_MANUFACTURER_NAME GetManufacturerName; + GET_CPU_NAME GetCpuName; + GET_ARM_MEM GetArmMem; + GET_MODEL_INSTALLED_MB GetModelInstalledMB; } RASPBERRY_PI_FIRMWARE_PROTOCOL; =20 extern EFI_GUID gRaspberryPiFirmwareProtocolGuid; --=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 (#55304): https://edk2.groups.io/g/devel/message/55304 Mute This Topic: https://groups.io/mt/71697495/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 Sat May 4 20:02:40 2024 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+55305+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+55305+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1583231638; cv=none; d=zohomail.com; s=zohoarc; b=oCfrT6GJHQe+tKZ1z/Q72Pw0PiXsjdEq16D9LvYrlW3OCI/mbqLNvY5zApI1sE57N/u+vlCTgnilx7b4ZnjeO6OV7A135MFnxhvq6ddf4CNCaO5kNVVFHosAyVWPQ+0in23d0/EdoG9fUPhhK6yGHYEpMnGqmo5arx0qX9vRtss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583231638; 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=VfZwxAyOnFKRJLSggnYU65oZ56KyRLqwvl4LgdptOOM=; b=JHYtWk2dEljCiXSbZQ0Jf5x/tUyB0TsJ7oOsXdIWQ0PJJMg9nJur1nzBMip5SOC2iz/7poHWixFJw8GnnWjUbCVA3jb1aAEVclEa2VKlsQRS3wK0cDrUD34n+0tD4Pr2qLbtCyn5Eg+5RLmOpoM/wFHM44sKadNMBltjRYTMs6I= 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+55305+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1583231638082470.82445736781915; Tue, 3 Mar 2020 02:33:58 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5as7YY1788612xvIq36WSLo3; Tue, 03 Mar 2020 02:33:57 -0800 X-Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web12.1927.1583231636183589883 for ; Tue, 03 Mar 2020 02:33:56 -0800 X-Received: by mail-wr1-f68.google.com with SMTP id q8so3667849wrm.4 for ; Tue, 03 Mar 2020 02:33:55 -0800 (PST) X-Gm-Message-State: FCL9L5dgMNi4T9x85r1Hxfudx1787277AA= X-Google-Smtp-Source: ADFU+vt2AwDhBUf+OlUYEnCVVnF2K+Ez8J6WZmiqQDD4xZVkatAz5zxH07gZpgIpCYeu7mfzuh03BA== X-Received: by 2002:a5d:4ac8:: with SMTP id y8mr4791546wrs.272.1583231634312; Tue, 03 Mar 2020 02:33:54 -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.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2020 02:33:53 -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 2/5] Platform/RPi: Separate RAM descriptors between 0-3 GB and 3+ GB Date: Tue, 3 Mar 2020 10:33:36 +0000 Message-Id: <20200303103339.7468-3-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=1583231637; bh=osOHX4PhMdAkLYtxih9upkQub7fJ1ei0Hs7s01cMne4=; h=Cc:Date:From:Reply-To:Subject:To; b=iiUoLIXC3jitEBKIoNYYahcy5HIGZccQcSiBOeLDZRKnR097mrErlpdVuWfs01iFDlm xReZkHMRb6+m47DrURQJBV2B2mPnCMduXlRM/C3CE6FIq82KIKzsIKNcwkc9ovl6i3sw8 mrsKR5ACPcY3xVwDum/6rYj11qYfgjejJlc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Andrei Warkentin This is required so that we can make the 3 to 4 GB segment of the Raspberry Pi 4 a user-configurable option. This also removes the need for the PcdAcpiBasicMode PCD. Signed-off-by: Pete Batard --- Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf | 3 -- Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 33 +++++++++++= +++------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Pla= tform/RaspberryPi/Library/PlatformLib/PlatformLib.inf index 9abcc2cc0075..77cdbe399a06 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf +++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf @@ -59,8 +59,5 @@ [FixedPcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize =20 -[FeaturePcd] - gRaspberryPiTokenSpaceGuid.PcdAcpiBasicMode - [Ppis] gArmMpCoreInfoPpiGuid diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Pl= atform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c index 4b388465cdde..3f257d4fa528 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c @@ -25,7 +25,7 @@ UINT32 mBoardRevision; =20 =20 // The total number of descriptors, including the final "end-of-table" des= criptor. -#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 10 +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 11 =20 STATIC BOOLEAN VirtualMemoryInfoInitialized =3D FALSE; STATIC RPI_MEMORY_REGION_INFO VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_D= ESCRIPTORS]; @@ -60,6 +60,7 @@ ArmPlatformGetVirtualMemoryMap ( { UINTN Index =3D 0; UINTN GpuIndex; + INT64 OrigMemorySize; INT64 SystemMemorySize; ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; =20 @@ -78,7 +79,6 @@ ArmPlatformGetVirtualMemoryMap ( return; } =20 - // Firmware Volume VirtualMemoryTable[Index].PhysicalBase =3D FixedPcdGet64 (PcdFdBaseAd= dress); VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; @@ -155,13 +155,13 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryInfo[Index].Type =3D RPI_MEM_UNMAPPED_REGION; VirtualMemoryInfo[Index++].Name =3D L"SoC Reserved (283x)"; =20 - if (FeaturePcdGet (PcdAcpiBasicMode)) { - // - // Limit the memory to 3 GB to work around the DMA bugs in the SoC wit= hout - // having to rely on IORT or _DMA descriptions. - // - SystemMemorySize =3D MIN(SystemMemorySize, 3U * SIZE_1GB); - } + // + // By default we limit the memory to 3 GB to work around the DMA bugs in= the SoC, for + // OSes that don't support _DMA range descriptors. On 4GB boards, it's r= untime + // setting to boot with 4GB, and the additional 1GB is added by ConfigDx= e. + // + OrigMemorySize =3D SystemMemorySize; + SystemMemorySize =3D MIN(SystemMemorySize, 3U * SIZE_1GB); =20 // If we have RAM above the 1 GB mark, declare it if (SystemMemorySize - SIZE_1GB > 0) { @@ -170,7 +170,20 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length =3D SystemMemorySize - SIZE_1G= B; VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; VirtualMemoryInfo[Index].Type =3D RPI_MEM_BASIC_REGION; - VirtualMemoryInfo[Index++].Name =3D L"Extended System RAM"; + VirtualMemoryInfo[Index++].Name =3D L"Extended System RAM belo= w 3GB"; + } + + // + // If we have RAM above 3 GB mark, declare it so it's mapped, but + // don't add it to the memory map. This is done later by ConfigDxe if ne= cessary. + // + if (OrigMemorySize > (3UL * SIZE_1GB)) { + VirtualMemoryTable[Index].PhysicalBase =3D 3UL * SIZE_1GB; + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D OrigMemorySize - VirtualMe= moryTable[Index].PhysicalBase; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_UNMAPPED_REGION; + VirtualMemoryInfo[Index++].Name =3D L"Extended System RAM abov= e 3GB"; } =20 // End of Table --=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 (#55305): https://edk2.groups.io/g/devel/message/55305 Mute This Topic: https://groups.io/mt/71697496/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 Sat May 4 20:02:40 2024 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+55306+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+55306+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1583231640; cv=none; d=zohomail.com; s=zohoarc; b=YC3Ru2cZU+j5OLRo+G3Yqj5N4QG7Cd4gkq0X1SFpzOLBRuNQLiQXaVYUC8+EMVlMMg4nEcQZ6AOTmjUSBE9ioJnyW07hCIIYsfc2cKYWmrvU0iheFW/fFegbwrgUbtnn+vhtchqTq7ehBWYogpGPkAKfhHtx7tm46/ZiwJOyIiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583231640; 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=GS+IfjFUI3s2FF9/sWb8fn3ArZ9bk/iKaLxymoZrv78=; b=WuEAYA+3xmsztziOqkgcZfp75uq6iyBkZox1+7pPAko9172SjlhSwijqbm/f40EmCLNmCkFuqtiD75XXQPxNRcnblZ1LDr0juAyTOriZVOE+nxO2VABWJIjcIWkUAS9YJ8z8GQd4GGoPpaVcRgM9EPxfElnA2rAMX/zhQ1B0yto= 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+55306+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1583231640106953.2598680601982; Tue, 3 Mar 2020 02:34:00 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id IUMtYY1788612xfnzEmWprP5; Tue, 03 Mar 2020 02:33:58 -0800 X-Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web11.1947.1583231637883427710 for ; Tue, 03 Mar 2020 02:33:58 -0800 X-Received: by mail-wr1-f68.google.com with SMTP id r7so3688921wro.2 for ; Tue, 03 Mar 2020 02:33:57 -0800 (PST) X-Gm-Message-State: ESwcaHoD5O3vNiT9D7eSjDMax1787277AA= X-Google-Smtp-Source: ADFU+vvFfdonZJ6Jpw0FQDOSzpn8ezitXqD209Zo3+oRc/CAZA4e6DIJx9eoiErI3hrfiILTAtliqw== X-Received: by 2002:adf:f60b:: with SMTP id t11mr4856146wrp.344.1583231635870; Tue, 03 Mar 2020 02:33:55 -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.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2020 02:33:55 -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 3/5] Platform/RPi: Make 3GB/4GB a runtime (BIOS setup) choice Date: Tue, 3 Mar 2020 10:33:37 +0000 Message-Id: <20200303103339.7468-4-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=1583231638; bh=MOVSkS8BSmG6LmV2jGuB2wQ+VNlmdoEyjbEtlzhdlfk=; h=Cc:Date:From:Reply-To:Subject:To; b=Jn01Cv+edbyd4i/y7h/OEsQ/HLxVvi9X1pCKwk3gPyYajxBgIM/SH7OTYLrHSSsN/FR Rq5SMIHriGRFLqYo/IFFqkBeaPEpxMnVWvI7TiWQrocYvk8bft/ERjXmCILPfDj0RpE/C MF3/+05+hiKS5efzrlXExh6wc067PXkrk60= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Andrei Warkentin Currently some OSes (e.g FreeBSD) can make full use of the maximum 4 GB of RAM a Raspberry Pi 4 can offer, whereas others (e.g. Linux) must be restricted to only the first 3 GB. Previously this was a compile-time choice chosen by PcdAcpiBasicMode, and now we make it user-selectable. The default is a 3 GB limit. Signed-off-by: Pete Batard --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 58 +++++++++++++= +++---- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 8 ++- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 11 ++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 41 ++++++++++++++ Platform/RaspberryPi/RPi3/RPi3.dsc | 6 ++ Platform/RaspberryPi/RPi4/RPi4.dsc | 6 ++ Platform/RaspberryPi/RaspberryPi.dec | 4 +- 7 files changed, 120 insertions(+), 14 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 2f48ca0dd758..451a419a5358 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -11,11 +11,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -26,6 +28,8 @@ extern UINT8 ConfigDxeHiiBin[]; extern UINT8 ConfigDxeStrings[]; =20 STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol; +STATIC UINT32 mModelFamily =3D 0; +STATIC UINT32 mModelInstalledMB =3D 0; =20 /* * The GUID inside Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.inf and @@ -129,6 +133,24 @@ SetupVariables ( PcdSet32 (PcdCustomCpuClock, PcdGet32 (PcdCustomCpuClock)); } =20 + if (mModelFamily >=3D 4 && mModelInstalledMB > 3 * 1024) { + /* + * This allows changing PcdRamLimitTo3GB in forms. + */ + PcdSet32 (PcdRamMoreThan3GB, 1); + + Size =3D sizeof (UINT32); + Status =3D gRT->GetVariable (L"RamLimitTo3GB", + &gConfigDxeFormSetGuid, + NULL, &Size, &Var32); + if (EFI_ERROR (Status)) { + PcdSet32 (PcdRamLimitTo3GB, PcdGet32 (PcdRamLimitTo3GB)); + } + } else { + PcdSet32 (PcdRamMoreThan3GB, 0); + PcdSet32 (PcdRamLimitTo3GB, 0); + } + Size =3D sizeof (UINT32); Status =3D gRT->GetVariable (L"SdIsArasan", &gConfigDxeFormSetGuid, @@ -224,7 +246,6 @@ ApplyVariables ( UINT32 CpuClock =3D PcdGet32 (PcdCpuClock); UINT32 CustomCpuClock =3D PcdGet32 (PcdCustomCpuClock); UINT32 Rate =3D 0; - UINT32 ModelFamily =3D 0; =20 if (CpuClock !=3D 0) { if (CpuClock =3D=3D 2) { @@ -258,15 +279,18 @@ ApplyVariables ( DEBUG ((DEBUG_INFO, "Current CPU speed is %uHz\n", Rate)); } =20 - Status =3D mFwProtocol->GetModelFamily (&ModelFamily); - if (Status !=3D EFI_SUCCESS) { - DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi model family: %r\n= ", Status)); - } else { - DEBUG ((DEBUG_INFO, "Current Raspberry Pi model family is 0x%x\n", Mod= elFamily)); + if (mModelFamily >=3D 4 && PcdGet32 (PcdRamLimitTo3GB) =3D=3D 0) { + Status =3D gDS->AddMemorySpace (EfiGcdMemoryTypeSystemMemory, BASE_1GB= + SIZE_2GB, + SIZE_1GB - (SIZE_4GB - BCM2711_SOC_REGISTERS), + EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_ME= MORY_WB); + ASSERT_EFI_ERROR (Status); + Status =3D gDS->SetMemorySpaceAttributes (BASE_1GB + SIZE_2GB, + SIZE_1GB - (SIZE_4GB - BCM2711_SOC_REGISTERS), + EFI_MEMORY_WB); + ASSERT_EFI_ERROR (Status); } =20 - - if (ModelFamily =3D=3D 3) { + if (mModelFamily =3D=3D 3) { /* * Pi 3: either Arasan or SdHost goes to SD card. * @@ -316,7 +340,7 @@ ApplyVariables ( GpioPinFuncSet (52, Gpio48Group); GpioPinFuncSet (53, Gpio48Group); =20 - } else if (ModelFamily =3D=3D 4) { + } else if (mModelFamily =3D=3D 4) { /* * Pi 4: either Arasan or eMMC2 goes to SD card. */ @@ -352,7 +376,7 @@ ApplyVariables ( GpioPinFuncSet (39, GPIO_FSEL_ALT3); } } else { - DEBUG ((DEBUG_ERROR, "Model Family %d not supported...\n", ModelFamily= )); + DEBUG ((DEBUG_ERROR, "Model Family %d not supported...\n", mModelFamil= y)); } =20 /* @@ -400,6 +424,20 @@ ConfigInitialize ( return Status; } =20 + Status =3D mFwProtocol->GetModelFamily (&mModelFamily); + if (Status !=3D EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi model family: %r\n= ", Status)); + } else { + DEBUG ((DEBUG_INFO, "Current Raspberry Pi model family is %d\n", mMode= lFamily)); + } + + Status =3D mFwProtocol->GetModelInstalledMB (&mModelInstalledMB); + if (Status !=3D EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi installed RAM size= : %r\n", Status)); + } else { + DEBUG ((DEBUG_INFO, "Current Raspberry Pi installed RAM size is %d MB\= n", mModelInstalledMB)); + } + Status =3D SetupVariables (); if (Status !=3D EFI_SUCCESS) { DEBUG ((DEBUG_ERROR, "Couldn't not setup NV vars: %r\n", Status)); diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf index dc726cc6d934..407aac89c7b3 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf @@ -33,6 +33,7 @@ [Packages] ArmPlatformPkg/ArmPlatformPkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec + Silicon/Broadcom/Bcm27xx/Bcm27xx.dec Silicon/Broadcom/Bcm283x/Bcm283x.dec Platform/RaspberryPi/RaspberryPi.dec EmbeddedPkg/EmbeddedPkg.dec @@ -53,10 +54,11 @@ [Guids] gConfigDxeFormSetGuid =20 [Protocols] - gRaspberryPiFirmwareProtocolGuid ## CONSUMES + gRaspberryPiFirmwareProtocolGuid ## CONSUMES gRaspberryPiConfigAppliedProtocolGuid ## PRODUCES =20 [Pcd] + gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress gRaspberryPiTokenSpaceGuid.PcdCpuClock gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock @@ -70,8 +72,8 @@ [Pcd] gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot - -[FeaturePcd] + gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB + gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB =20 [Depex] gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni index 9b4076635f05..830533a9dc49 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni @@ -35,6 +35,17 @@ #string STR_CHIPSET_SD_SDHOST #language en-US "Broadcom SDHOST" #string STR_CHIPSET_SD_ARASAN #language en-US "Arasan SDHCI" =20 +/* + * Advanced configuration. + */ + +#string STR_ADVANCED_FORM_TITLE #language en-US "Advanced Configurati= on" + +#string STR_ADVANCED_3GB_PROMPT #language en-US "Limit RAM to 3 GB" +#string STR_ADVANCED_3GB_HELP #language en-US "OSes not supporting = ACPI DMA constraints require a 3 GB limit or face broken xHCI USB" +#string STR_ADVANCED_3GB_OFF #language en-US "Disabled" +#string STR_ADVANCED_3GB_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 60bfdbd4d17e..483edd7459c5 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -73,6 +73,18 @@ typedef struct { UINT32 Routing; } CHIPSET_SD_VARSTORE_DATA; =20 +typedef struct { + /* + * Always set by ConfigDxe prior to HII init to reflect + * platform capability. + */ + UINT32 Supported; +} ADVANCED_RAM_MORE_THAN_3GB_VARSTORE_DATA; + +typedef struct { + UINT32 Enabled; +} ADVANCED_RAM_LIMIT_TO_3GB_VARSTORE_DATA; + typedef struct { /* * 0 - Don't disable multi-block. @@ -140,6 +152,16 @@ formset name =3D SdIsArasan, guid =3D CONFIGDXE_FORM_SET_GUID; =20 + efivarstore ADVANCED_RAM_MORE_THAN_3GB_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D RamMoreThan3GB, + guid =3D CONFIGDXE_FORM_SET_GUID; + + efivarstore ADVANCED_RAM_LIMIT_TO_3GB_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D RamLimitTo3GB, + 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, @@ -193,6 +215,10 @@ formset prompt =3D STRING_TOKEN(STR_CHIPSET_FORM_TITLE), help =3D STRING_TOKEN(STR_NULL_STRING); =20 + goto 0x1006, + prompt =3D STRING_TOKEN(STR_ADVANCED_FORM_TITLE), + help =3D STRING_TOKEN(STR_NULL_STRING); + goto 0x1003, prompt =3D STRING_TOKEN(STR_MMC_FORM_TITLE), help =3D STRING_TOKEN(STR_NULL_STRING); @@ -240,6 +266,21 @@ formset endoneof; endform; =20 + form formid =3D 0x1006, + title =3D STRING_TOKEN(STR_ADVANCED_FORM_TITLE); + subtitle text =3D STRING_TOKEN(STR_NULL_STRING); + + grayoutif ideqval RamMoreThan3GB.Supported =3D=3D 0; + oneof varid =3D RamLimitTo3GB.Enabled, + prompt =3D STRING_TOKEN(STR_ADVANCED_3GB_PROMPT), + help =3D STRING_TOKEN(STR_ADVANCED_3GB_HELP), + flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRE= D, + option text =3D STRING_TOKEN(STR_ADVANCED_3GB_OFF), value = =3D 0, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_ADVANCED_3GB_ON), value =3D= 1, flags =3D 0; + endoneof; + endif; + endform; + form formid =3D 0x1003, title =3D STRING_TOKEN(STR_MMC_FORM_TITLE); subtitle text =3D STRING_TOKEN(STR_MMC_FORM_SUBTITLE); diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index df5b246af1f8..48e1a32e1d24 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -439,6 +439,12 @@ [PcdsDynamicHii.common.DEFAULT] gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableS= caledVModes"|gConfigDxeFormSetGuid|0x0|0xff gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|g= ConfigDxeFormSetGuid|0x0|1 =20 + # + # Supporting > 3GB of memory. + # + gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|L"RamMoreThan3GB"|gConfigDx= eFormSetGuid|0x0|0 + gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L"RamLimitTo3GB"|gConfigDxeF= ormSetGuid|0x0|0 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index 60a5e38da778..3ce2c3e4d519 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -477,6 +477,12 @@ [PcdsDynamicHii.common.DEFAULT] gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableS= caledVModes"|gConfigDxeFormSetGuid|0x0|0xff gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|g= ConfigDxeFormSetGuid|0x0|1 =20 + # + # Supporting > 3GB of memory. + # + gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|L"RamMoreThan3GB"|gConfigDx= eFormSetGuid|0x0|0 + gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L"RamLimitTo3GB"|gConfigDxeF= ormSetGuid|0x0|1 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index bc378ffbfb8d..7f2c37ac9a7f 100644 --- a/Platform/RaspberryPi/RaspberryPi.dec +++ b/Platform/RaspberryPi/RaspberryPi.dec @@ -57,6 +57,8 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, Pc= dsDynamicEx] gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016 gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0|UINT8|0x000000= 17 gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018 + gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|0|UINT32|0x00000019 + gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|0|UINT32|0x0000001A =20 [PcdsFeatureFlag.common] - gRaspberryPiTokenSpaceGuid.PcdAcpiBasicMode|FALSE|BOOLEAN|0x00000019 + 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 (#55306): https://edk2.groups.io/g/devel/message/55306 Mute This Topic: https://groups.io/mt/71697498/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 Sat May 4 20:02:40 2024 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- From nobody Sat May 4 20:02:40 2024 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+55308+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+55308+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1583231645; cv=none; d=zohomail.com; s=zohoarc; b=DXPFnZYT+6KfA8XquGpgYZFWBg30mPJNd9nQG73TKc/3y8glqUNCE6DewX4PceCRfLEdcbqXWYdGOxB8DgGQx8Ff0z10PmhLcDg5NSBZ4mCi5wtY65Ltl9IiypsjmRym5kAVQzTaNmZWatHUnWqBuNW22O4oCJPaIBznTKent4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583231645; 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=+J5JUbUui/SfDxXB29Z194gEb7y2cQGzHakPh2HHkJE=; b=AdXQwFvYAmk+xDFUhWWyoTXk3gysDC7D8vXm+JJDr8pN72EzwUeK/uR4dhZEHxpt2V1AEu7uHeSQYcNMxc3G/Z/DshBniPK8+hxdgranFoDsdqaotA7y+mHyHpvjGw0hzZKMphN1oGVIbw0V7OFVZwFstmbX+a4ehRu1xAUz2vQ= 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+55308+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 158323164588146.29930974048034; Tue, 3 Mar 2020 02:34:05 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id zO01YY1788612x1jHOoAGKs2; Tue, 03 Mar 2020 02:34:02 -0800 X-Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.web12.1929.1583231641862224080 for ; Tue, 03 Mar 2020 02:34:02 -0800 X-Received: by mail-wr1-f48.google.com with SMTP id q8so3668200wrm.4 for ; Tue, 03 Mar 2020 02:34:01 -0800 (PST) X-Gm-Message-State: AbKZUboQB3vuzPdy90evsc0Wx1787277AA= X-Google-Smtp-Source: ADFU+vvW35Fa0jpVA/I84OOT/6USNAKTmGaEw7mvYZGjTveJMMt+lN1Eu/5yDdCAx+HXRwa3dbCKoA== X-Received: by 2002:adf:fc12:: with SMTP id i18mr4791518wrr.354.1583231639762; Tue, 03 Mar 2020 02:33:59 -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.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2020 02:33:58 -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 5/5] Platform/RPi/ConfigDxe: Improve RPi configuration forms Date: Tue, 3 Mar 2020 10:33:39 +0000 Message-Id: <20200303103339.7468-6-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=1583231642; bh=eTcLbR8UACq1AcOiWYNRPUnZccCFVUwdIEG4Yy5FFwk=; h=Cc:Date:From:Reply-To:Subject:To; b=PqqCsUNx7bPaBGRDHxkCJMyH1uoVzWEQ6GhtCcELfvDoie8mts6SG4tBduspx9R20aN 2XeHpclY7zokIjUG0PMr7oHdgGiF4vuqCUeVT2iIoeIRY8dRg2Tw50xjIZdXlB8YXPfkH S487nXHg3CJ9nmdf9OROkb1L47iGBO9s27E= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Group all SD/MMC settings under the SD/MMC form. Make CPU settings more prominent. Harmonise form titles and text content. Reorder forms in the order they are most likely to be queried. Signed-off-by: Pete Batard Reviewed-by: Ard Biesheuvel --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 24 +++++----- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 50 ++++++++++---= ------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni index 2e79e322e558..77eda96d8136 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni @@ -14,11 +14,11 @@ #string STR_FORM_SET_TITLE_HELP #language en-US "Press to configu= re system settings." =20 /* - * Chipset config. + * Chipset configuration. */ =20 -#string STR_CHIPSET_FORM_TITLE #language en-US "Chipset Configuration" -#string STR_CHIPSET_FORM_SUBTITLE #language en-US "Note: OS may override= settings when booted." +#string STR_CHIPSET_FORM_TITLE #language en-US "CPU Configuration" +#string STR_CHIPSET_FORM_SUBTITLE #language en-US "Note: OS may override= settings." =20 #string STR_CHIPSET_CLOCK_CPU_PROMPT #language en-US "CPU Clock" #string STR_CHIPSET_CLOCK_CPU_HELP #language en-US "CPU Speed" @@ -30,11 +30,6 @@ #string STR_CHIPSET_CUSTOM_CPU_CLOCK_PROMPT #language en-US "CPU Clock Rat= e (MHz)" #string STR_CHIPSET_CUSTOM_CPU_CLOCK_HELP #language en-US "Adjust the CP= U speed.\nMin value: 100 MHz\nMax value: 1600 MHz\n\nWarning: Overclocking = can make the system unbootable!" =20 -#string STR_CHIPSET_SD_PROMPT #language en-US "uSD Routing" -#string STR_CHIPSET_SD_HELP #language en-US "Choose host controll= er to drive uSD slot" -#string STR_CHIPSET_SD_SDHOST #language en-US "Broadcom SDHOST" -#string STR_CHIPSET_SD_ARASAN #language en-US "Arasan SDHCI" - /* * Advanced configuration. */ @@ -55,8 +50,13 @@ * MMC/SD configuration. */ =20 -#string STR_MMC_FORM_TITLE #language en-US "SD/MMC Tweaks" -#string STR_MMC_FORM_SUBTITLE #language en-US "Note: UEFI only, OS will= override settings when booted." +#string STR_MMC_FORM_TITLE #language en-US "SD/MMC Configuration" +#string STR_MMC_FORM_SUBTITLE #language en-US "Note: UEFI only, OS may = override settings." + +#string STR_MMC_SD_PROMPT #language en-US "uSD Routing" +#string STR_MMC_SD_HELP #language en-US "Choose host controller t= o drive uSD slot" +#string STR_MMC_SD_SDHOST #language en-US "Broadcom SDHOST" +#string STR_MMC_SD_ARASAN #language en-US "Arasan SDHCI" =20 #string STR_MMC_DISMULTI_PROMPT #language en-US "Multi-Block Support" #string STR_MMC_DISMULTI_HELP #language en-US "Use CMD18/CMD25 for tran= sfers when possible" @@ -84,7 +84,7 @@ * Display settings. */ =20 -#string STR_DISPLAY_FORM_TITLE #language en-US "Display" +#string STR_DISPLAY_FORM_TITLE #language en-US "Display Configuration" #string STR_DISPLAY_FORM_SUBTITLE #language en-US "UEFI video driver set= tings" =20 #string STR_DISPLAY_VMODES_640_PROMPT #language en-US "Virtual 640x480" @@ -109,7 +109,7 @@ /* * Debugging settings go here. */ -#string STR_DEBUG_FORM_TITLE #language en-US "Debugging" +#string STR_DEBUG_FORM_TITLE #language en-US "Debugging Configurati= on" #string STR_DEBUG_FORM_SUBTITLE #language en-US "For UEFI/OS Developer= s" =20 #string STR_DEBUG_JTAG_PROMPT #language en-US "JTAG Routing" diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index d16058da4926..9c2fd64a8e27 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -65,14 +65,6 @@ typedef struct { UINT32 Clock; } CHIPSET_CUSTOM_CPU_CLOCK_VARSTORE_DATA; =20 -typedef struct { - /* - * 0 - uSD slot routed to Broadcom SDHOST. - * 1 - uSD slot routed to Arasan SDHCI. - */ - UINT32 Routing; -} CHIPSET_SD_VARSTORE_DATA; - typedef struct { /* * Always set by ConfigDxe prior to HII init to reflect @@ -93,6 +85,14 @@ typedef struct { UINT32 Enabled; } ADVANCED_DEVICE_TREE_VARSTORE_DATA; =20 +typedef struct { + /* + * 0 - uSD slot routed to Broadcom SDHOST. + * 1 - uSD slot routed to Arasan SDHCI. + */ + UINT32 Routing; +} MMC_SD_VARSTORE_DATA; + typedef struct { /* * 0 - Don't disable multi-block. @@ -155,11 +155,6 @@ formset name =3D CustomCpuClock, guid =3D CONFIGDXE_FORM_SET_GUID; =20 - efivarstore CHIPSET_SD_VARSTORE_DATA, - attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, - name =3D SdIsArasan, - guid =3D CONFIGDXE_FORM_SET_GUID; - efivarstore ADVANCED_RAM_MORE_THAN_3GB_VARSTORE_DATA, attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, name =3D RamMoreThan3GB, @@ -175,6 +170,11 @@ formset name =3D OptDeviceTree, guid =3D CONFIGDXE_FORM_SET_GUID; =20 + efivarstore MMC_SD_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D SdIsArasan, + 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, @@ -228,6 +228,10 @@ formset prompt =3D STRING_TOKEN(STR_CHIPSET_FORM_TITLE), help =3D STRING_TOKEN(STR_NULL_STRING); =20 + goto 0x1004, + prompt =3D STRING_TOKEN(STR_DISPLAY_FORM_TITLE), + help =3D STRING_TOKEN(STR_NULL_STRING); + goto 0x1006, prompt =3D STRING_TOKEN(STR_ADVANCED_FORM_TITLE), help =3D STRING_TOKEN(STR_NULL_STRING); @@ -236,10 +240,6 @@ formset prompt =3D STRING_TOKEN(STR_MMC_FORM_TITLE), help =3D STRING_TOKEN(STR_NULL_STRING); =20 - goto 0x1004, - prompt =3D STRING_TOKEN(STR_DISPLAY_FORM_TITLE), - help =3D STRING_TOKEN(STR_NULL_STRING); - goto 0x1005, prompt =3D STRING_TOKEN(STR_DEBUG_FORM_TITLE), help =3D STRING_TOKEN(STR_NULL_STRING); @@ -269,14 +269,6 @@ formset default =3D 600, endnumeric; endif; - - oneof varid =3D SdIsArasan.Routing, - prompt =3D STRING_TOKEN(STR_CHIPSET_SD_PROMPT), - help =3D STRING_TOKEN(STR_CHIPSET_SD_HELP), - flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, - option text =3D STRING_TOKEN(STR_CHIPSET_SD_ARASAN), value =3D= 1, flags =3D 0; - option text =3D STRING_TOKEN(STR_CHIPSET_SD_SDHOST), value =3D= 0, flags =3D DEFAULT; - endoneof; endform; =20 form formid =3D 0x1006, @@ -306,6 +298,14 @@ formset title =3D STRING_TOKEN(STR_MMC_FORM_TITLE); subtitle text =3D STRING_TOKEN(STR_MMC_FORM_SUBTITLE); =20 + oneof varid =3D SdIsArasan.Routing, + prompt =3D STRING_TOKEN(STR_MMC_SD_PROMPT), + help =3D STRING_TOKEN(STR_MMC_SD_HELP), + flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_MMC_SD_ARASAN), value =3D 1, = flags =3D 0; + option text =3D STRING_TOKEN(STR_MMC_SD_SDHOST), value =3D 0, = flags =3D DEFAULT; + endoneof; + oneof varid =3D MmcDisableMulti.DisableMulti, prompt =3D STRING_TOKEN(STR_MMC_DISMULTI_PROMPT), help =3D STRING_TOKEN(STR_MMC_DISMULTI_HELP), --=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 (#55308): https://edk2.groups.io/g/devel/message/55308 Mute This Topic: https://groups.io/mt/71697501/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-