From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.9281.1641102583262087145 for ; Sat, 01 Jan 2022 21:49:45 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: jeremy.linton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 24B281435; Sat, 1 Jan 2022 21:49:45 -0800 (PST) Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C319E3F5A1; Sat, 1 Jan 2022 21:49:44 -0800 (PST) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, mariobalanica02@gmail.com, Jeremy Linton Subject: [PATCH V2 10/10] Platform/RaspberryPi: Update RPi4 Readme Date: Sat, 1 Jan 2022 23:49:24 -0600 Message-Id: <20220102054924.1195762-11-jeremy.linton@arm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220102054924.1195762-1-jeremy.linton@arm.com> References: <20220102054924.1195762-1-jeremy.linton@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Replace the paragraph about NVRAM/UEFI variables, with something that explains the situation a bit better. Update the UEFI settings table. Tweak the DT overlay list, and note support for CM4 and RPi400. Update the missing block to describe some higher level goals and point users at the github issues page. Signed-off-by: Jeremy Linton --- Platform/RaspberryPi/RPi4/Readme.md | 63 +++++++++++++++++++++++++++++++= ------ 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/Platform/RaspberryPi/RPi4/Readme.md b/Platform/RaspberryPi/R= Pi4/Readme.md index 80899f4ca4..38ae0372fb 100644 --- a/Platform/RaspberryPi/RPi4/Readme.md +++ b/Platform/RaspberryPi/RPi4/Readme.md @@ -16,6 +16,8 @@ Raspberry Pi is a trademark of the [Raspberry Pi Founda= tion](https://www.raspber =20 The RPi4 target supports Pi revisions based on the BCM2711 SoC: - Raspberry Pi 4B +- Raspberry Compute Module 4 +- Raspberry Pi 400 =20 Please see the RPi3 target for the BCM2837-based variants, such as the R= aspberry Pi 3B. @@ -44,10 +46,11 @@ Build instructions from the top level edk2-platforms = Readme.md apply. 1. Format a uSD card as FAT16 or FAT32 2. Copy the generated `RPI_EFI.fd` firmware onto the partition 3. Download and copy the following files from https://github.com/raspber= rypi/firmware/tree/master/boot - - `bcm2711-rpi-4-b.dtb` + - `bcm2711-rpi-4-b.dtb`, `bcm2711-rpi-cm4.dtb`, or `bcm2711-rpi-400.dt= b` - `fixup4.dat` - `start4.elf` - `overlays/miniuart-bt.dbto` or `overlays/disable-bt.dtbo` (Optional) + - `overlays/upstream-pi4.dtbo` (Optional) 4. Create a `config.txt` with the following content: ``` arm_64bit=3D1 @@ -62,7 +65,12 @@ Build instructions from the top level edk2-platforms R= eadme.md apply. ``` dtoverlay=3Dminiuart-bt ``` - Note: doing so requires `miniuart-bt.dbto` to have been copied into = an `overlays/` + Additionally, if you want to use linux in DT mode + ``` + dtoverlay=3Dupstream-pi4 + ``` + + Note: doing so requires `miniuart-bt.dbto` or `upstream-pi4.dtbo` to= have been copied into an `overlays/` directory on the uSD card. Alternatively, you may use `disable-bt` i= nstead of `miniuart-bt` if you don't require Bluetooth. 5. Insert the uSD card and power up the Pi. @@ -84,6 +92,8 @@ By default, UEFI will use the device tree loaded by the= VideoCore firmware. This depends on the model/variant, and relies on the presence on specific fil= es on your boot media. E.g.: - `bcm2711-rpi-4-b.dtb` (for Pi 4B) + - `bcm2711-rpi-cm4.dtb` (for CM4) + - `bcm2711-rpi-400.dtb` (for Pi 400) =20 You can override the DTB and provide a custom one. Copy the relevant `.d= tb` into the root of the SD or USB, and then edit your `config.txt` so that it looks like: @@ -110,11 +120,36 @@ Note, that the ultimate contents of `/chosen/bootar= gs` are a combination of seve =20 ## NVRAM =20 -The Raspberry Pi has no NVRAM. - -NVRAM is emulated, with the non-volatile store backed by the UEFI image = itself. This -means that any changes made in UEFI proper are persisted, but changes ma= de from within -an Operating System aren't. +The Raspberry Pi doesn't have NVRAM dedicated for UEFI. + +While UEFI variables and associated functions will appear to work correc= tly, +changes made while the OS is active won't persist over reboot except whe= n +three conditions are true. Those conditions are: +- The OS must be running in ACPI mode. +- The GPIO controller is not exported to the OS. +- There must be sufficient free space on the SPI flash. + +In explanation, there are two different methods used to persist firmware +configurations. The firmware first attempts to find 128K of free space o= n the +SPI flash utilized by the SoC for early boot. If that fails, updates are +written directly to the RPI_EFI.fd image, but only when two conditions a= re +true. Those conditions are: +- The OS is not yet booted. +- The RPI_EFI.fd image is stored on media that the firmware can rewrite. + +The SPI is generally a better choice, but it only works if the firmware +controls the GPIO pin muxing (since it shares pins with the PWM Audio) a= nd the +associated SPI controller while the OS is running. That is where the DT = and +GPIO restrictions come in. + +Finally, since the variables store utilizes free space on an SPI flash d= evice +reserved for early boot/low-level firmware functions, future versions of= the +RPi foundation firmware may consume more of the available free space. Th= e SPI +flash may be upgraded/downgraded using the official +[RPi imager](https://github.com/raspberrypi/rpi-imager) update flash too= l. That +tool writes an SD disk image that, when placed in the RPi, will erase an= d +reprogram the entire SPI flash, thereby wiping out the UEFI variable sto= re in +the process. =20 ## RTC =20 @@ -141,9 +176,12 @@ all functionality may be available. =20 ## Missing Functionality =20 -- Network booting via onboard NIC. -- SPCR hardcodes type to PL011, and thus will not expose correct - (miniUART) UART if DT overlays to switch UART are used on Pi 4B. +- Capsule update +- CPPC (in progress) +- External RTC support and CM4 IO Board RTC +- Support more HATs in ACPI mode +- Various OS drivers for onboard devices (GPU in linux, etc) +- Other stuff, check https://github.com/pftf/RPi4/issues =20 # Configuration Settings The Raspberry Pi UEFI configuration settings can be viewed and changed u= sing both the UI configuration menu (under `Device Manager` -> `Raspberry= Pi Configuration`), as well as the UEFI Shell. To configure using the UE= FI Shell, use `setvar` command to read/write the UEFI variables with GUID= =3D `CD7CC258-31DB-22E6-9F22-63B0B8EED6B5`. @@ -179,6 +217,11 @@ Screenshot support | `DisplayEnableSShot` = | Control-Alt-F12 =3D `0x00000 **Advanced Configuration** | Limit RAM to 3 GB | `RamLimitTo3GB` | Disable =3D `0x00000000= `
Enabled=3D `0x00000001` (default) System Table Selection | `SystemTableMode`| ACPI =3D `0x00000000` = (default)
ACPI + Devicetree =3D `0x00000001`
Devicetree =3D `0x0= 0000002` +ACPI fan control | `FanOnGpio` | Disable =3D `0x00000000` Otherwise numeric GPIO pin +ACPI fan temperature | `FanTemp` | Hex numeric value degrees C +ACPI XHCI/PCIe | `XhciPci` | Xhci =3D `0x00000000`
PC= Ie =3D `0x00000001`
always PCIe `0x00000002` +DT Reload XHCI firmware | `XhciReload` | Disable =3D `0x00000000` <= br> Enabled=3D `0x00000001` +Export GPIO devices to OS | `EnableGpio` | Disable =3D `0x00000000` <= br> Enabled=3D `0x00000001` Asset Tag | `AssetTag` | String, 32 characters or les= s (e.g. `L"ABCD123"`)
(default `L""`) **SD/MMC Configuration** | uSD/eMMC Routing | `SdIsArasan` | Arasan SDHC =3D `0x0000000= 1`
eMMC2 SDHCI =3D `0x00000000` (default) --=20 2.13.7