From nobody Tue Feb 10 13:01:39 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+52412+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+52412+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1576757736; cv=none; d=zohomail.com; s=zohoarc; b=GK+sT9lpnn2RJwMl2oWSVWCs9OWSKkeDiliHrkHGZ28jbiei5C4wYiUz1JippeZvjwWfBsSQVT6+pXZzy1Su5D92Pbn8oQ1NtpY8Qy6OXkSt5bzpMQp8GsnjsYgcHuNIikL8DCUUCVrYWxBqhktnQ8r4fc+9TukNlK1Kvto/R9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576757736; 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=vSTQjNOafXDUX97FnBx8VKewkpWojttI22FsQRN0gko=; b=lPa9gb5yphGfY3xipty/x/c6RySgI2l1VWunjfxpu957czY0fhuP+SWGGjlh/3+E/b/tz5AP9So3M86s6UjoJmtXn9IgBKnAAPP49pVnZvchlRUoXRJLyLxCsjZXRFdAFPfZcJuG4a415wWk6MBB5mf1XSGtUqW+VIIXXM/H/P4= 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+52412+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1576757736326149.9242607875899; Thu, 19 Dec 2019 04:15:36 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id kSk1YY1788612xsMquVqIq7I; Thu, 19 Dec 2019 04:15:35 -0800 X-Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.groups.io with SMTP id smtpd.web10.8830.1576757698340192908 for ; Thu, 19 Dec 2019 04:15:00 -0800 X-Received: by mail-wr1-f50.google.com with SMTP id y11so5748802wrt.6 for ; Thu, 19 Dec 2019 04:14:58 -0800 (PST) X-Gm-Message-State: fx4H4zLEgghbx3OmcPtZct7vx1787277AA= X-Google-Smtp-Source: APXvYqzGvjfmVs0t60bamnaL/MH4k8947eirK0xmsSW9f6DQR+HdJ8YzEgZrrO5MFzwHUsErOun/eg== X-Received: by 2002:adf:ec83:: with SMTP id z3mr8951075wrn.133.1576757696639; Thu, 19 Dec 2019 04:14:56 -0800 (PST) X-Received: from localhost.localdomain ([84.203.77.210]) by smtp.gmail.com with ESMTPSA id u8sm5823147wmm.15.2019.12.19.04.14.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 04:14:56 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH v2 7/7] Platform/RPi4: Add ACPI basic mode build option Date: Thu, 19 Dec 2019 12:14:34 +0000 Message-Id: <20191219121434.2856-8-pete@akeo.ie> In-Reply-To: <20191219121434.2856-1-pete@akeo.ie> References: <20191219121434.2856-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=1576757735; bh=Zzx7J/bZL24fp9qhEVWOI6/svOifXwhxiuiipdy8IR0=; h=Cc:Date:From:Reply-To:Subject:To; b=ovO1jAtidGgXmOsNqhNZZb518DGZDE5m0H6qHmo/pt2QDPMu8/Gse+k/9DjF4OyzhOp LjWAt2/tPS87DwqJ+oTTrF+CFr+1/fiS0gHi4TBxwexoWly5rPWyKIKj7o2zB6oNkm3qW bwDwbaPJBcknVYv/RWy+Eo9QkSbwiZHzRqg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel Add an ACPI_BASIC_MODE_ENABLE flag to produces builds intended to run in ACPI mode without any additional requirements (memory limits, acpi=3Dforce, etc). This flag is disabled by default. Signed-off-by: Pete Batard Reviewed-by: Leif Lindholm --- Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf | 3 +++ Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 8 ++++++++ Platform/RaspberryPi/RPi4/RPi4.dsc | 6 ++++++ Platform/RaspberryPi/RPi4/RPi4.fdf | 3 +++ Platform/RaspberryPi/RPi4/Readme.md | 9 +++++++-- Platform/RaspberryPi/RaspberryPi.dec | 3 +++ 6 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Pla= tform/RaspberryPi/Library/PlatformLib/PlatformLib.inf index 77cdbe399a06..9abcc2cc0075 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf +++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf @@ -59,5 +59,8 @@ [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 f8223d1b94e8..4b388465cdde 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c @@ -155,6 +155,14 @@ 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); + } + // If we have RAM above the 1 GB mark, declare it if (SystemMemorySize - SIZE_1GB > 0) { VirtualMemoryTable[Index].PhysicalBase =3D FixedPcdGet64 (PcdExtended= MemoryBase); diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index ccf5bd5b9ef3..02de104df5bf 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -39,6 +39,7 @@ [Defines] DEFINE INCLUDE_TFTP_COMMAND =3D FALSE DEFINE DEBUG_PRINT_ERROR_LEVEL =3D 0x8000004F DEFINE PL011_ENABLE =3D FALSE + DEFINE ACPI_BASIC_MODE_ENABLE =3D FALSE =20 ##########################################################################= ###### # @@ -263,6 +264,8 @@ [PcdsFeatureFlag.common] gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE =20 + gRaspberryPiTokenSpaceGuid.PcdAcpiBasicMode|$(ACPI_BASIC_MODE_ENABLE) + [PcdsFixedAtBuild.common] gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 @@ -558,12 +561,15 @@ [Components.common] MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf MdeModulePkg/Universal/SerialDxe/SerialDxe.inf Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf + EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.inf =20 MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf =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 50fe554ec9ec..2bcfdb3244f6 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.fdf +++ b/Platform/RaspberryPi/RPi4/RPi4.fdf @@ -208,10 +208,13 @@ [FV.FvMain] INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf INF Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf + INF EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.inf =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 acfbfee185b0..74afc0f89451 100644 --- a/Platform/RaspberryPi/RPi4/Readme.md +++ b/Platform/RaspberryPi/RPi4/Readme.md @@ -16,8 +16,9 @@ Raspberry Pi is a trademark of the [Raspberry Pi Foundati= on](https://www.raspber This firmware is still in development stage, meaning that it comes with the following __major__ limitations: =20 -- USB is likely to work only in pre-OS phase at this stage (nonstandard EC= AM, - missing ACPI tables). +- 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. - 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_ENABLE` compilation option. @@ -27,6 +28,10 @@ following __major__ limitations: 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. - `-D PL011_ENABLE=3D1`: Selects PL011 for the serial console instead of t= he miniUART (default). This doesn't change the GPIO pinout for the UART but can be useful if you find that the miniUART baud rate changes when the diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index c7e17350544a..bc378ffbfb8d 100644 --- a/Platform/RaspberryPi/RaspberryPi.dec +++ b/Platform/RaspberryPi/RaspberryPi.dec @@ -57,3 +57,6 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, Pc= dsDynamicEx] gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016 gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0|UINT8|0x000000= 17 gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018 + +[PcdsFeatureFlag.common] + gRaspberryPiTokenSpaceGuid.PcdAcpiBasicMode|FALSE|BOOLEAN|0x00000019 --=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 (#52412): https://edk2.groups.io/g/devel/message/52412 Mute This Topic: https://groups.io/mt/68829929/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-