There are a few missing wrappers for which I've submitted a patch
upstream. The patch is pending, so include it under edk2-patches for
now.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
- The PCIe MMIO regions on this SoC are absurdly small. Some demanding
devices (like NVIDIA GPUs) need more than 16 MB of 32-bit
non-prefetchable memory. To address this, carve out 256 MB at the top of
MMIO64 for ECAM (128 MB), followed by MEM32 (128 MB, with 32-bit
translation). MEM64 takes up the remaining space (768 MB), starting at
the bottom of MMIO64 (to preserve the alignment). This should be enough
to cover most use cases and allows for even a larger 512 MB prefetchable
BAR.
- Since all RCs share the same SMMU and ITS blocks, segments need
distinct bus numbers so that Requester IDs don't overlap. With 128 MB of
ECAM and 5 segments, this gives a spacing of 25 buses. Ideally, we
would've encoded the segment number instead, but that doesn't seem
possible here.
- Sync ACPI and FDT with the updated resources.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
The x64 driver in the GPU's Option ROM does not work properly on
non-coherent hardware through the emulator (framebuffer gets corrupted).
We also need to install EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL on the
native driver's handle in order to override the Option ROM version.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
- Scan all supported file systems (FAT, ext4) on the selected boot
device, rather than just the one containing the OS loader.
- Also look for base DTB overrides in `\dtb` and `\dtb\rockchip`. Fedora
images conveniently have a symlink to the current kernel DTBs in the
latter path, on the second ext4 boot partition.
- Add config options to allow specifying custom relative paths for the
base DTB override and overlays.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
Latest device tree changes have broken the partial HDMI0 support on
kernels < 6.15 for boards exposing the HDMI1 port.
The "Force UEFI GOP Display" option must be used instead with those
older kernels.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
- Clean up dead code.
- Perform init only once. This fixes an issue in bifurcation mode where
PCIe 3x2 init would reset the PHY, forcing the previously configured
PCIe 3x4 link to restart at the lowest speed.
- Set PHP_GRF_PCIESEL_CON to fix routing of PCIe3x1 controllers to the
PCIe 3 PHY instead of the Combo PHY.
- Wait for sram_init_done (does not seem necessary since
sram_bypass=0x1, but just follow suit with the BSP code).
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
For M.2 slots supporting both PCIe and SATA, we must reference the 3V3
supply in SATA mode as well, to prevent the kernel from turning it off.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
Note that this only applies to the firmware DTB override mechanism. It
won't work with Grub's `devicetree` command.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
PWRCTRL1 on RK806 is connected to GPIO0_A2, which gets set high by PSCI
SYSTEM_OFF.
This fixes shutdown from UEFI/ACPI.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
Return EFI_NO_MEDIA instead of EFI_NOT_READY to avoid the long delays at
boot.
From DxeNetLib:
> If Aip protocol is supported by low layer drivers, three kinds of
> media states can be detected: EFI_SUCCESS, EFI_NOT_READY and
> EFI_NO_MEDIA, represents connected state, connecting state and no
> media state respectively. When function detects the current state is
> EFI_NOT_READY, it will loop to wait for next time's check until state
> turns to be EFI_SUCCESS or EFI_NO_MEDIA.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
Firmware updates can invalidate existing FvFile entries. Attempting to
clean them up after registering the boot keys (e.g. ESC) often leads to
the keys not working until after a reboot - perhaps because the options
they reference no longer match?
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
This allows enabling/disabling various parts of the UEFI network stack:
- Entire stack
- IPv4 stack
- IPv6 stack
- PXE boot
- HTTP boot
All options are enabled by default.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
This allows controlling the boot discovery policy (Minimal, Connect
Network, Connect All).
We now default to "Connect All" because it appears that BDS does not
properly connect all child handles on some controllers, resulting in
missing partitions and ultimately the boot option being skipped. This
seems to affect SATA and NVME at least, however USB is fine.
Fixes#101
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
edk2-platforms has removed pretty much all the dependencies we had on
it: Pcf8563RealTimeClockLib and the Hisilicon package. Also drop the
Ax88772c driver as it's not needed.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
Swap the reported horizontal and vertical resolutions and rotate block
transfer operations. Also set PixelFormat to PixelBltOnly as we
shouldn't claim to support a framebuffer given the fake resolution.
This approach is flawed in multiple ways: slow perf, no framebuffer in
OS (or garbled up). But it is way more convenient on the Fydetab - and
realistically it's going to be fine for Linux boot as it has a native
display driver.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
- no need for cache maintenance as the framebuffer is already non-cached
- remove handling for different bits per pixel - we only support 32 bpp
- simplify EfiBltVideoToVideo overlap case handling
The console no longer lags at high resolutions.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
RK3588 requires HActive to be 4-pixel aligned.
This fixes modes such as 1366x768 (rounded up to 1368), which would
otherwise appear fuzzy.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
The preferred display mode is now automatically detected by parsing the
EDID in this order:
- detailed timings from base block and CEA-861 & VTB-EXT extensions
- SVDs / HDMI VICs from CEA-861 extensions
- standard timings from base block
- established timings from base block
Only supported on HDMI for now.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
Display connectors are now probed in a configurable priority order, with
the first found display set as the primary output. All other connectors
remain disabled, though it's still possible to enable duplication in the
settings (all displays will be considered identical to the primary one).
If no display is found, by default, output will be forced with the
configured mode (Native - fallback to 640x480 / custom / predefined) on
all connectors. This is mainly done to allow using connectors that don't
have detection implemented yet (DP/eDP). It might also be useful to
recover from potential issues with EDID in the future - one can plug in
the display after boot and *hopefully* have it work at the fallback
resolution.
This option can also be disabled in the settings, which is recommended
when using the serial port, as some OSes don't redirect the text output
there if a GOP instance is always present.
For now, detection is supported only on HDMI and DSI (which is assumed
to be permanently connected).
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
DwHdmiQp:
- Follow BSP code and add retries to the I2C read/write ops, because I
have seen timeouts with one TV sink while writing SCDC registers.
- Set DVI mode correctly based on sink info (needs EDID).
- Add a configuration option to force DVI mode -- this can be useful to
trick some TVs into using PC mode: no overscan, full range RGB. We don't
currently support limited range for CEA modes, which leads to slightly
crushed black levels.
- Setup AVI & HDMI vendor infoframes.
- Set scrambling for HDMI 2.0 modes (up to 4K 60 Hz).
HdptxHdmiPhy:
- Use actual bitrate rather than a hardcoded value for 1080p60.
- Calculate PLL config to support arbitrary rates.
- Add more precise predefined PLL configs for some modes.
Vop2:
- Switch DCLK to the HDMI PHY PLL as it provides better accuracy and
enables more modes.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
Add a configuration menu which allows changing the preferred display
mode:
- Native: uses predefined timings from panel (for DSI) or EDID (to-do)
- Custom: user can enter arbitrary timings (pixel clock, front porch,
sync width, back porch, sync polarity)
- Common predefined modes from 640x480p60 to 4096x2160p60
In case the custom display settings are invalid/unsupported, pressing
LCtrl+LShift+F6 at any time will cause a reboot with default settings.
The HDMI output will currently not work because it's still hardcoded to
1080p60 and we're now falling back to a safe 480p due to lack of EDID.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
Particularly for HDMI and eDP as the other drivers could already bind to
multiple outputs.
The eDP driver is still disabled by default because it requires
EdpEnableBacklight() to be implemented in RockchipPlatformLib, but it
does appear to load fine and has been tested to work some time ago.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
This reverts commit 06408b6bf6.
Turns out that HDMI0 is routed to the EDP connector and a DP->HDMI
converter is used instead for the 2nd 4K port.
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>