104 Commits

Author SHA1 Message Date
Kun Qin
5000d967d1 RaspberryPi: Platform Build: Resolving newly introduced dependency
The new changes in SecureBootVariableLib brought in a new dependency
of PlatformPKProtectionLib.

This change added the new library instance from SecurityPkg to resolve
RaspberryPi platforms build.

Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
2022-08-16 19:53:14 +02:00
Michael Kubacki
24164d55ae RaspberryPi: Add VariableFlashInfoLib
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2022-05-19 11:46:19 +08:00
Adrien Thierry
b0f3f90372 Platform/RaspberryPi: Add 'clock-frequency' property for miniuart
Describe the miniuart clock frequency in a _DSD property, so that it can
be read from the Linux driver [1]

The miniuart clock frequency is the core clock frequency on the
Raspberry Pi. It can be modified by the user using the 'core_freq'
property in the config.txt file. So, we fetch it from the underlying
Raspberry Pi firmware.

[1] https://lore.kernel.org/all/20220207232129.402882-1-athierry@redhat.com/

Signed-off-by: Adrien Thierry <athierry@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2022-02-08 17:54:47 +01:00
Jeremy Linton
63a54c6f40 Platform/RaspberryPi: Add XHCI/PCI selection menu
Arm has standardized a PCI SMC conduit that can be used
to access the PCI config space in a standardized way. This
functionality doesn't yet exist in many OS/Distro's. Lets
add another advanced config item that allows the user
to toggle between presenting the XHCI on the base RPi4
as a platform device, or presenting this newer PCIe
conduit. The CM4 doesn't have an attached XHCI controller
soldered to the PCIe, so PCIe mode is the default.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
Reviewed-By: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Tested-by: Jared McNeill <jmcneill@invisible.ca>
2021-08-22 15:54:28 +02:00
Grzegorz Bernacki
6196d93328 Platform: add SecureBootVariableLib resolution to various ARM platforms
The edk2 patch
  SecurityPkg: Create library for setting Secure Boot variables.

removes generic functions from SecureBootConfigDxe and places
them into SecureBootVariableLib. This patch adds SecureBootVariableLib
mapping for each ARM platform which uses SecureBootConfigDxe.

Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Reviewed-by: Graeme Gregory <graeme@nuviainc.com> #SbsaQemu
Reviewed by: Sami Mujawar <sami.mujawar@arm.com>  #ArmVExpress
2021-08-04 14:29:32 +02:00
Grzegorz Bernacki
2f0188b56e Revert "Platform/RaspberryPi: Setup option for disabling Fast Boot"
This reverts commit efdc159ef7.

This commit is not longer required as Boot Discovery Policy has been
implemented for Raspberry Pi.

Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by: Pete Batard <pete@akeo.ie>
2021-08-03 18:37:04 +02:00
Sunny Wang
ea709f165d Platform/RaspberryPi: Dynamically build UARTs info in ACPI
Changes:
  1. Add code to ConfigDxe driver and AcpiTables module to dynamically
     build either Mini UART or PL011 UART info in ACPI. This also fixes
     the issue discussed in https://github.com/pftf/RPi4/issues/118.
  2. Cleanup by moving duplicate Debug Port 2 table related defines and
     structures to a newly created header file (RpiDebugPort2Table.h).

Testing Done:
  - Booted to UEFI shell and use acpiview command to check the result of
    the different UART settings in config.txt (enabling either Mini UART
    or PL011) and SPCR, DBG2 tables and device BTH0 are dynamically
    changed as expected.

Signed-off-by: Sunny Wang <sunny.wang@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by: Pete Batard <pete@akeo.ie>
2021-06-12 22:02:25 +02:00
Sunny Wang
efdc159ef7 Platform/RaspberryPi: Setup option for disabling Fast Boot
This is a fix for https://github.com/pftf/RPi4/issues/114.

Changes:
  1. Add a setup option called BootPolicy and consume the setting
     during boot to decide whether to perform or skip ConnectAll.
  2. The Default setting is set to Full discovery because it is not
     worth enabling Fast boot by default on RaspberryPi systems.
     Enabling it just saves boot time about 1 second, but caused a
     lot of issues.

Testing Done:
  - Booted to Standalone UEFI shell on SD card and use drivers
    command to check the result with Fast Boot and Full discovery
    settings. Then, child/device handles are created as expected.

Note and to-do items:
  - The root cause looks like that boot loaders and some tools like
    grub and iPXE haven't supported selective connect/Fast boot.
    However, system firmware should still provide a setup option for
    user to enable Fast boot with old version boot loaders and tools,
    which is why we proposed this change. We will also report this
    issue to boot loader and tool vendors/open source GitHubs.
  - We will add more options for connecting specific type devices so
    that we can still have the shortest boot time for all use cases.

Cc: Jeremy Linton <jeremy.linton@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Link: https://github.com/pftf/RPi4/issues/144
Link: https://github.com/pftf/RPi4/issues/114
Signed-off-by: Sunny Wang <sunny.wang@arm.com>
Acked-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
2021-04-15 20:48:51 +02:00
Dandan Bi
79d96063c6 Platform/RaspberryPi: Consume MdeLibs.dsc.inc for RegisterFilterLib
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2021-03-31 14:20:19 +08:00
Jeremy Linton
35f23fa784 Platform/RaspberryPi: User control of eMMC2 DMA
DMA translation on the eMMC2 vary based on SoC, and
this is made worse by the poor _DMA support in Linux.

For now the "safe" option is to simply run the eMMC2
controller in PIO mode. More advanced users or !Linux
operating systems may choose to enable this to gain
a perf boost.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
2021-02-20 15:37:20 +01:00
Pete Batard
94e9fba43d Platform/RaspberryPi: Add system/user defined reset delay
Due to the method in which NV variables are stored on removable media
for the Raspberry Pi platform, and the manner in which we dump updated
variables right before reset, it is possible, and has been repeatedly
demonstrated with SSD-based USB 3.0 devices, that the updated file does
not actually end up being written to permanent storage, due to the
device write-cache not having enough time to be flushed before reset.

To compensate for this, since we don't know of a generic method that
would allow turning off USB mass storage devices write cache (and also
because we are seeing an issue that seems related for SD-based media),
we add a new reset delay PCD, which can be set by the user, and which
we also set as required when NV variables are being dumped.

Our testing show that, with more than 3 seconds of extra delay, the
storage media has enough time to finalize its internal write, thus
solving the issue of configuration changes not being persisted.

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
Tested-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
2021-01-04 18:08:28 +01:00
Andrei Warkentin
663c3108f7 Platform/RaspberryPi: get RPi4 and RPi3 building again.
Add VariablePolicyLib and its dependency.

Testing: Pi 4 boot.

Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
2020-11-20 16:08:06 +01:00
Samer El-Haj-Mahmoud
38c387d2da Platforms/RaspberryPi: Fix incorrect display resolution
Fix https://github.com/pftf/RPi4/issues/100 by swapping RPi DisplayDxe
resolution settings for 640x480 and 800x600, which were incorrectly
mapped to the settings shown in the Setup configuration variable.

Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
2020-11-04 18:22:39 +01:00
Samer El-Haj-Mahmoud
38a1067be5 Platforms/RaspberryPi: Fix RPi3 RngLib build error
Commit b5701a4c7a0fb185e0c5b9db9525939c78664bfd introduced RngLib
dependency for OpensslLib, and caused the RPi build to break for lack
of an RngLib instance.

This patch adds RngLib using the DxeRngLib flavor, which is a wrapper
around the the EFI_RNG_PROTOCOL that the platform already produces.

Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
2020-09-27 11:56:13 +02:00
Jeremy Linton
7093026e92 Platform/RaspberryPi4: Allow the user to set Temp
Now that we have the ability to enable an AML fan object,
allow the user to select the temperature at which the
fan cycles on.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
2020-09-01 15:11:30 +03:00
Jeremy Linton
ee550dd7f2 Platform/RaspberryPi: Add entry for user fan control
Add a menu item that allows the user to enable GPIO based
fan control via SSDT and the previous NameObj replacement
commit. This should only be seen/enabled on RPI4
because that is what its been tested with.

Given GPIO pin current limitations its likely that a bit of
additional circuitry is required to drive a fan, and the GPIO
high/low signal can only be used as a enable/disable signal. A
search for "rpi npn gpio fan" or similar should turn up some
hits for how to do this. Alternatively there are some commercial
boards (FAN SHIM) which operate via simple GPIO control.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
2020-09-01 15:11:30 +03:00
Samer El-Haj-Mahmoud
cec6bb18ae Platforms/RaspberryPi: Set RPi3 Language supported to English
Set the supported RPi3 platform language to English (US),
and remove French.

This fixes https://github.com/pftf/RPi4/issues/35

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
2020-08-13 15:54:17 +02:00
Samer El-Haj-Mahmoud
69cefd028e Platform/RaspberryPi: Switch RPi3 USB NIC driver to Ax88772c
Switch the ASIX USB NIC driver used in the RPi3 to the new Ax88772c.

Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
2020-07-08 17:54:02 +03:00
Samer El-Haj-Mahmoud via groups.io
0f21db1139 Platforms/RaspberryPi: Add RPi3 settings to Readme
Add a section to the the RPi3 readme for 'Configuration Settings', with
instructions on scripting from the UEFI Shell.

Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
2020-06-17 20:44:15 +02:00
Samer El-Haj-Mahmoud
4c8c8868bb Platforms/RaspberryPi: Remove DebugShowUEFIExit
The "Verbose ExitBootServices" feature was originally added to the RPi
as part of early OS enablement to show that the OS boot loader did
actually call ExitBootServices (back when OS boot used to crash shortly
after that). This is no longer needed, and should be removed as part of
cleaning the RPi PlatformBootManager to be more in-line with the ArmPkg
version.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
2020-06-12 10:25:31 +02:00
Andrei Warkentin
bfa32ac70a Platform/RaspberryPi: default DisplayDxe to just native mode
The scaled resolutions are useful, but are not the default expected
by most users. Linux and BSDs don't set preferred resolution in
their OS loader, so when booting via setup UI, the OS is left
running at 800x600, not the native resolution. This looks crummy.

Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by: Pete Batard <pete@akeo.ie>
2020-05-11 13:54:05 +02:00
Andrei Warkentin
d492639638 RPi: allow selecting DT-only mode
Today the Pies can be booted in a way where only ACPI is exposed,
or both ACPI and DT are exposed.

This adds one more mode - DT only, no ACPI. The target audience
is developers. When both are exposed, it's up to the OS to decide
which gets used, and that choice can differ between OSes,

Note: this does _not_ change defaults. Pi 3 still defaults to
ACPI + DT, while Pi 4 still defaults to ACPI only.

We don't really want to remove DT + ACPI mode - it is the default
on Pi 3, and removing it is bound to just annoy users - WoA and
NetBSD (voa UEFI) on Pi 3 only work with ACPI, while everything
else (Linux, FreeBSD) only work with DT. I'd make an analogy of
MPS and ACPI being exposed for the longest time ever together on
PCs.

Testing: OpenBSD on Pi 4 with DT-only and ACPI-only boots.

Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
2020-05-11 13:27:50 +02:00
Ard Biesheuvel
644e223bb3 Platform/RaspberryPi: create DXE phase SerialPortLib version for RPi3
The Raspberry Pi 3 derives its 16550 baud clock from the variable core
clock, and so any reprogramming of the baud rate needs to take the
actual core clock value into account.

Introduce a DXE phase version of DualSerialPortLib that discovers this
value in its constructor, using the RPi firmware protocol, and wire it
up for the RPi3 platform.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by: Pete Batard <pete@akeo.ie>
2020-05-06 18:15:29 +02:00
Ard Biesheuvel
043ee2e65b Platform/RaspberryPi: query firmware for 16550 input clock at boot on RPi3
Query the firmware for the clock rate that is used to drive the
16550 baud clock, so that we can program the correct baud rate.

Co-authored-by: Pete Batard <pete@akeo.ie>
Co-authored-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Co-authored-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by: Pete Batard <pete@akeo.ie>
2020-05-06 18:15:18 +02:00
Ard Biesheuvel
3c29ba327d Platform/RaspberryPi: fix 16550 divisor calculation logic
The 16550 'miniUART' on the Raspberry Pi gets its input clock from
different sources on RPi3 and RPi4. Fix the logic that derives the
divisor for the 16550 baud clock on the respective platforms.

While at it, make the input clock PCD patchable for RPi3 so we can
manipulate it at runtime in a future patch.

Co-authored-by: Pete Batard <pete@akeo.ie>
Co-authored-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Co-authored-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by: Pete Batard <pete@akeo.ie>
2020-05-06 14:49:14 +02:00