immortalwrt/package/boot/uboot-rockchip/patches/105-bootstd-efi-Initialize-PCI-to-discover-network-controller.patch
Tianling Shen 4e6c404f65
uboot-rockchip: Update to 2024.04
Removed upstreamed patches.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-04-09 23:16:41 +08:00

52 lines
1.7 KiB
Diff

From 583d37d192d92c5e92efa68b1d97f8ecdef71c47 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sun, 12 Nov 2023 10:57:21 +0000
Subject: [PATCH] bootstd: efi: Initialize PCI to discover network controllers
Boards like Radxa ROCK 5 Model B and NanoPi R5C require PCI to be
initialized in order to discover their onboard network controllers.
During standard boot, PCI gets initialized after faster boot media have
been evaluated. However when an EFI bootflow is run from a fast boot
media, PCI initialization may not have happended and as a result no
network device is exposed to EFI.
Fix this by initializing PCI during EFI bootflow when no ethernet device
can be found.
This allows chainloading e.g. iPXE on ROCK 5B and NanoPi R5C without
having to enable PCI_INIT_R. Enabling of PCI_INIT_R has the side affect
of slowing down booting from faster boot media, by adding ~1 second off
boot delay for each unocupied M.2 slot.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
boot/bootmeth_efi.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -16,6 +16,7 @@
#include <dm.h>
#include <efi_loader.h>
#include <fs.h>
+#include <init.h>
#include <malloc.h>
#include <mapmem.h>
#include <mmc.h>
@@ -403,6 +404,14 @@ static int distro_efi_read_bootflow(stru
{
int ret;
+ /* init PCI first since this is often used to provide Ehternet */
+ if (IS_ENABLED(CONFIG_NETDEVICES) && IS_ENABLED(CONFIG_PCI) &&
+ !eth_get_dev()) {
+ ret = pci_init();
+ if (ret)
+ return log_msg_ret("pci", ret);
+ }
+
/*
* bootmeth_efi doesn't allocate any buffer neither for blk nor net device
* set flag to avoid freeing static buffer.