From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by mx.groups.io with SMTP id smtpd.web12.9693.1576671043283223576 for ; Wed, 18 Dec 2019 04:10:43 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=iwDV9U4J; spf=pass (domain: linaro.org, ip: 209.85.128.67, mailfrom: leif.lindholm@linaro.org) Received: by mail-wm1-f67.google.com with SMTP id p17so1646269wma.1 for ; Wed, 18 Dec 2019 04:10:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=n6CQMOKqUlr8Yue1hNhHFgRhPli8jA93zXY1BJ4i/Ds=; b=iwDV9U4Jou2aioqQJ6oHkPiVRBik+Ns8+R5imVhExdUZqG7d3RJFc0sFwjjEPph/X2 C1cuciAXbpCx2kLGn+sve9t6+1BXFDp9t9IXUwKZR5aelvtZHRP6yf3rP4jom8p3bwUV OzAu5cO5rdqWiEL1+m0/hEVqI2byiIPaYANHLGfu6a4h7sKxIYOjZLCqSkXTeIMjaWsW rFEvedtEl/rWMbFXWvgNMwLHJn43Vm3v6ZXuIVH0USCn5DX+Lh8dD5B7UQRbF1Cws+Fc gDhVdcg3jaua65tEoAIGPJJvIOCYHvxZ4wKk1f0vIb83RgYTYsdU+HOiuJoYx1nH4KBY ++mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=n6CQMOKqUlr8Yue1hNhHFgRhPli8jA93zXY1BJ4i/Ds=; b=LRBlqNS0mGOYwVicoaLPHa1JwEhbDT+Ic1a5HUcD4Wv8Runjz8yX90m7vr5Nhm5YEq AI7lacVvqXyn37biAE1/pt7kx7xnrya/TEK3NUglAqAWwQ3EsTrF//XzcaVUK0TotDIf Q1o1kzLSuYufQ8BeCEgMtcd5AbddPns1HiQ0SIJoKtfwCVBhVbIgCAzD28VNT3uE6N+k 9jzda8SroBwkjvEnTHYI+n5ieTBHazTkFzoGYw5xEveWDL/FaMPK5hWk2J9COB+aQzBV SLpie3lxzqTWLbXpj1hYyOOrMD56ScKKCE+630GSqpYeuuqMqkeZ7Hx6sgol3sDk8Jjz V+PA== X-Gm-Message-State: APjAAAVpKFnOMLqApK01xqE3wwtFMejN7pTWQk/TLGRt1OitXAxFlaIR UTtQSFuUlAgwu1ZzSo+0Kv3N3g== X-Google-Smtp-Source: APXvYqzbRjrRl2KSpa0CTbUgztomeR/diQ97SsbcCxfNEWbLdoQTl9fnh/34u/CifagOIpEwL7HK4g== X-Received: by 2002:a1c:628b:: with SMTP id w133mr2842804wmb.25.1576671041582; Wed, 18 Dec 2019 04:10:41 -0800 (PST) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id q3sm2438360wrn.33.2019.12.18.04.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 04:10:40 -0800 (PST) Date: Wed, 18 Dec 2019 12:10:39 +0000 From: "Leif Lindholm" To: Pete Batard Cc: devel@edk2.groups.io, ard.biesheuvel@linaro.org, philmd@redhat.com Subject: Re: [edk2-platforms][PATCH 6/6] Platform/RPi4: Add ACPI basic mode build option Message-ID: <20191218121039.GT7359@bivouac.eciton.net> References: <20191218114156.9036-1-pete@akeo.ie> <20191218114156.9036-7-pete@akeo.ie> MIME-Version: 1.0 In-Reply-To: <20191218114156.9036-7-pete@akeo.ie> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Dec 18, 2019 at 11:41:56 +0000, Pete Batard wrote: > 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=force, > 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/Platform/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 > > +[FeaturePcd] > + gRaspberryPiTokenSpaceGuid.PcdAcpiBasicMode > + > [Ppis] > gArmMpCoreInfoPpiGuid > diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/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 = RPI_MEM_UNMAPPED_REGION; > VirtualMemoryInfo[Index++].Name = L"SoC Reserved (283x)"; > > + if (FeaturePcdGet (PcdAcpiBasicMode)) { > + // > + // Limit the memory to 3 GB to work around the DMA bugs in the SoC without > + // having to rely on IORT or _DMA descriptions. > + // > + SystemMemorySize = MIN(SystemMemorySize, 3U * SIZE_1GB); > + } > + > // If we have RAM above the 1 GB mark, declare it > if (SystemMemorySize - SIZE_1GB > 0) { > VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdExtendedMemoryBase); > 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 = FALSE > DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F > DEFINE PL011_ENABLE = FALSE > + DEFINE ACPI_BASIC_MODE_ENABLE = FALSE > > ################################################################################ > # > @@ -263,6 +264,8 @@ [PcdsFeatureFlag.common] > gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE > gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE > > + 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 > > MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf > > ArmPkg/Drivers/ArmGic/ArmGicDxe.inf > Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf > +!if $(ACPI_BASIC_MODE_ENABLE) == 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 > > INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf > INF Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf > +!if $(ACPI_BASIC_MODE_ENABLE) == 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/RPi4/Readme.md > index 2ef38d1b2062..83e901c57b08 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 Foundation](https://www.raspber > This firmware is still in development stage, meaning that it comes with the > following __major__ limitations: > > -- USB is likely to work only in pre-OS phase at this stage (nonstandard ECAM, > - 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. > > The following additional build options are also available: > +- `-D ACPI_BASIC_MODE_ENABLE=1`: Limits OS visible memory to 3 GB and forces > + ACPI (by disabling the Device Tree driver altogether). This may be required > + to boot Operating Systems such as Linux on account of the current PCIe/xHCI > + limitations. > - `-D PL011_ENABLE=1`: Selects PL011 for the serial console instead of the > 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/RaspberryPi.dec > index c7e17350544a..bc378ffbfb8d 100644 > --- a/Platform/RaspberryPi/RaspberryPi.dec > +++ b/Platform/RaspberryPi/RaspberryPi.dec > @@ -57,3 +57,6 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] > gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016 > gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0|UINT8|0x00000017 > gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018 > + > +[PcdsFeatureFlag.common] > + gRaspberryPiTokenSpaceGuid.PcdAcpiBasicMode|FALSE|BOOLEAN|0x00000019 > -- > 2.21.0.windows.1 >