Commit Graph

208 Commits

Author SHA1 Message Date
Samer El-Haj-Mahmoud
734fed7db6 Platforms/RaspberryPi: RPi4 PMU interrupts are SPI not PPI
REF: https://github.com/pftf/RPi4/issues/103

Commit 602a7ea1ab changed the RPi4 PMU interrupts reported
in GICC to the PPI values recommended by SBSA specification.
This caused the PMU overflow interrupts to stop working.

The RPi documentation (Figure 7, page 111) state that the
PMU interrupts are SPI not PPI: https://www.raspberrypi.org/
documentation/hardware/raspberrypi/bcm2711/rpi_DATA_2711_1p0.pdf

Also, the BSA 1.0 spec (page 24) clarifies hat the PPI values are
recommendations, not requirements:
https://developer.arm.com/documentation/den0094/latest

Fix by reverting to the old SPI values per the RPi spec.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Signed-off-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
2020-11-25 16:17:27 +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
Jeremy Linton
78c884bbe7 Platform/RaspberryPi4: Correct thermal offset
The current mainline DT indicates that the thermal offset
on the rpi is 410040 rather than the 419949 being used.
This means our temp calculation is offset nearly 10C higher
when running in ACPI mode vs DT.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
2020-10-22 15:44:59 +02:00
Ard Biesheuvel
dac891da5c Platform/RaspberryPi/AcpiTables: add a IORT ACPI table to limit XHCI DMA
Add an IORT table that will limit XHCI DMA to 2 GB, by setting the
DMA width to 31 bits. This is needed for Linux/arm64, which can
only reliably deal with devices that are unable to perform DMA to
the entire 32-bit address range if it can discover their existence
early during boot, and this is before the ACPI interpreter is up
and running (which rules out calling the _DMA method of the XHC0
object)

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
2020-10-12 19:27:52 +02:00
Jeff Booher-Kaeding
8ef23e848b Platform/RaspberryPi/ConfigDxe: Fix JTAG Pinout for Pi3/4
Updated the pinout to match the Pi4 datasheet, tested with the RPi4.
RPi3 Datasheet has same pinout.

Signed-off-by: Jeff Booher-Kaeding <Jeff.booher-kaeding@arm.com>
Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
2020-10-05 16:23:50 +02:00
Samer El-Haj-Mahmoud
1e09147a01 Platforms/RaspberryPi: Fix RPi4 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.

Tested booting OSes and running the SCT test for EFI_RNG_PROTOCOL.

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:41 +02: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
e08fccd8be Platform/RaspberryPi: Trivial whitespace and style cleanup
Pete's review pointed out some whitespace issues in the
context of a previous patch. Since there are a number of
similar errors in the file lets fix them separately.

[ardb: use MmioOr32/MmioAnd32 instead of separate reads and writes]

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
2020-09-01 15:19:17 +03: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
955930dcc5 Platform/RaspberryPi4: Create ACPI fan object
Now that we have a thermal zone we can add active cooling
by specifying active cooling points (_ACx) which can
be tied to fan objects that turn fans on/off using GPIO
pins.

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
Jeremy Linton
e372412acf Platform/RaspberryPi: Monitor ACPI Table installs
Hook the ACPI table install sequence and add some
basic conditional and AML NameOp update logic. If
a table has a non-zero PCD declared that pcd is
checked for a non-zero value before allowing the table
to be installed. We also add a table of NameOp to
PCD's which will be written into a DSDT/SSDT table
as part of its install process.

With this change we can declare something in
ASL like:

Name (VARN, 0x1234)

and then add a table entry like:

{"VARN", PcdToken(PcdVarn)}

and the value of PcdVarn will replace the
0x1234 declared in the ASL above.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Andrei Warkentin <andrey.warkentin@gmail.com>
2020-09-01 15:06:42 +03:00
Jeremy Linton
d7d712711d Platform/RaspberryPi4: Add a basic thermal zone
Rather than exporting the temp sensor or mailbox
in ACPI land we can wrap them in AML and use the default
ACPI drivers provided by the OS. This enables the use of
"sensors" in linux to report the SOC temp.

As a first pass add a basic passive cooling ACPI thermalzone
with trip points for passive cooling (throttling) handled
by the vc firmware, hibernate and critical shutdown. The
vc apparently kicks in at ~80C, so the hibernate and critical
set points are set at +5 and +10 of that. In the future
CPPC should be able to monitor the thermal throttling.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
2020-09-01 14:48:18 +03:00
Samer El-Haj-Mahmoud
5955ac2f10 Platforms/RaspberryPi: Fix build error in DisplayDxe
Commit 0c2af04985 added mDriverBinding
extern module global, but did not remove the STATIC declaration, which
caused the build to break. Fix the build error by removing STATIC for
that module global 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 <andrey.warkentin@gmail.com>
2020-08-27 09:54:52 +02:00
Samer El-Haj-Mahmoud
6a6f49ef1e Platforms/RaspberryPi: Fix DwUsbHostDxe ComponentName2 error checking
Fix input param error checking for the DwUsbHostDxe ComponentName2
protocol.

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

Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
2020-08-17 15:51:40 +02:00
Samer El-Haj-Mahmoud
0c2af04985 Platforms/RaspberryPi: Fix DisplayDxe ComponentName2 error checking
Fix input param error checking for the DisplayDxe ComponentName2
protocol.

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

Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
2020-08-17 15:47:16 +02:00
Samer El-Haj-Mahmoud
fe34d84a73 Platforms/RaspberryPi: Fix DBG2 UART namespace reference
The UART namespace reference in DBG2 is incorrect. Fix to point to the
correct name.

This fixes the certification failure reported by FWTS tests at:
https://github.com/pftf/RPi4/issues/69

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 18:57:09 +02: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
c711db2aea Platforms/RaspberryPi: Set RPi4 Language supported to English
Set the supported RPi4 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>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
2020-08-13 15:53:41 +02:00
Samer El-Haj-Mahmoud
602a7ea1ab Platforms/RaspberryPi: Fix RPi4 GICC PMU PPI
Arm SBSA specification section ver 6.0, 4.1.5 defines specific PPI
values for certain standard interrupt IDs. The value for
"Performance Monitors Interrupt" needs to be 23.

REF: https://developer.arm.com/documentation/den0029/latest

This partially fixes SBSA test #11 ("Incorrect PPI value") reported in
https://github.com/pftf/RPi4/issues/74

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:51:39 +02:00
Samer El-Haj-Mahmoud
cf825de918 Platforms/RaspberryPi: Fix GOP FrameBufferSize returned by SetMode()
GOP SetMode() returns the frame buffer size in FrameBufferSize.
The value is obtained from the RPi mailbox call to AllocateBuffer
(tag RPI_MBOX_ALLOC_FB), which for a native resolution of 1920 x 1080
returns 8355840 bytes. The size should be 1920 x 1080 x 4 (bytes/pixel),
or 8294400 bytes, as defined by the UEFI Spec: "FrameBufferSize :
Amount of frame buffer needed to support the active mode as defined by
PixelsPerScanLine x VerticalResolution x PixelElementSize".

This change forces the returned FrameBufferSize to match the value
required by UEFI Spec. The actual buffer allocted by the VPU is larger
due to the alignment request when calling RPI_MBOX_ALLOC_FB
(32 bytes). A vertical resolution of 1080 aligns to 1088 on 32-bytes,
resulting in the increased buffer size (1920 x 1088 x 4 = 8355840).

This fixes the SetMode_Conf failure reported by SCT tests at
https://github.com/pftf/RPi4/issues/73

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: Andrei Warkentin <awarkentin@vmware.com>
2020-08-13 15:49:54 +02:00
Samer El-Haj-Mahmoud
c276ec5fdf Platforms/RaspberryPi: Return GOP PixelInformation in QueryMode()
Return correct values of PixelInformation in QueryMode().

This fixes the QueryMode_Func failures reported by SCT tests at
https://github.com/pftf/RPi4/issues/73

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: Andrei Warkentin <awarkentin@vmware.com>
2020-08-13 15:49:51 +02:00
Samer El-Haj-Mahmoud
0b3d1a3b5b Platforms/RaspberryPi: Fix GOP parameter handling
Handle incorrect parameters passed to DisplayDxe GOP functions
QueryMode(), SetMode(), and Blt().

This fixes Blt_Conf and QueryMode_Conf failures
reported by SCT tests at:
https://github.com/pftf/RPi4/issues/73

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: Andrei Warkentin <awarkentin@vmware.com>
2020-08-13 15:49:42 +02:00
Samer El-Haj-Mahmoud
f2e4f25b83 Platforms/RaspberryPi: SMBIOS minor cleanup
Minor code cleanup:
 - Update file header to list SBBR required/recommended tables
 - Rename DataSmbiosHande to DataSmbiosHandle
 - Remove SMBIOS_HANDLE_PI_RESERVED from Type 11 template for
   consistency. This is already done in LogSmbiosData().

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: Ard Biesheuvel <ard.biesheuvel@arm.com>
2020-08-13 15:38:17 +02:00