diff mbox

[U-Boot,3/4] distro bootcmd: enumerate PCI before network operations

Message ID 1453831814-23973-3-git-send-email-swarren@wwwdotorg.org
State Accepted
Commit 986691fb97bc245be517a9db1297cfa71dd865cf
Delegated to: Simon Glass
Headers show

Commit Message

Stephen Warren Jan. 26, 2016, 6:10 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

The PCI bus must be enumerated before PCI devices, such as Ethernet
devices, are known to U-Boot. Enhance the distro boot commands to perform
PCI enumeration when needed.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 doc/README.distro               |  8 ++++++++
 include/config_distro_bootcmd.h | 12 ++++++++++++
 2 files changed, 20 insertions(+)

Comments

Simon Glass Jan. 26, 2016, 8 p.m. UTC | #1
Hi Stephen,

On 26 January 2016 at 11:10, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> The PCI bus must be enumerated before PCI devices, such as Ethernet
> devices, are known to U-Boot. Enhance the distro boot commands to perform
> PCI enumeration when needed.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  doc/README.distro               |  8 ++++++++
>  include/config_distro_bootcmd.h | 12 ++++++++++++
>  2 files changed, 20 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

I wonder whether longer term we can invent something that 'knows' that
USB and PCI are needed for particular features. This would have to be
board-specific though, so probably isn't that different from what you
have here.

Regards,
Simon
Simon Glass Jan. 29, 2016, 4:02 a.m. UTC | #2
On 26 January 2016 at 13:00, Simon Glass <sjg@chromium.org> wrote:
> Hi Stephen,
>
> On 26 January 2016 at 11:10, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> The PCI bus must be enumerated before PCI devices, such as Ethernet
>> devices, are known to U-Boot. Enhance the distro boot commands to perform
>> PCI enumeration when needed.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>>  doc/README.distro               |  8 ++++++++
>>  include/config_distro_bootcmd.h | 12 ++++++++++++
>>  2 files changed, 20 insertions(+)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> I wonder whether longer term we can invent something that 'knows' that
> USB and PCI are needed for particular features. This would have to be
> board-specific though, so probably isn't that different from what you
> have here.
>
> Regards,
> Simon

Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/doc/README.distro b/doc/README.distro
index 019903ea7d91..3715c8c3bad7 100644
--- a/doc/README.distro
+++ b/doc/README.distro
@@ -349,6 +349,14 @@  boot_net_usb_start:
   device is not attached to USB, and you wish to increase boot speed by
   avoiding unnecessary actions.
 
+boot_net_pci_enum:
+
+  If you want to prevent PCI enumeration by distro boot commands which execute
+  network operations, set the value to something innocuous, e.g. setenv
+  boot_net_pci_enum true. This would be useful if you know your Ethernet
+  device is not attached to PCI, and you wish to increase boot speed by
+  avoiding unnecessary actions.
+
 Interactively booting from a specific device at the u-boot prompt
 =================================================================
 
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index c027d8643967..37c6b438e29f 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -139,6 +139,15 @@ 
 	BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_CMD_IDE
 #endif
 
+#if defined(CONFIG_CMD_PCI_ENUM) || defined(CONFIG_DM_PCI)
+#define BOOTENV_RUN_NET_PCI_ENUM "run boot_net_pci_enum; "
+#define BOOTENV_SHARED_PCI \
+	"boot_net_pci_enum=pci enum\0"
+#else
+#define BOOTENV_RUN_NET_PCI_ENUM
+#define BOOTENV_SHARED_PCI
+#endif
+
 #ifdef CONFIG_CMD_USB
 #define BOOTENV_RUN_NET_USB_START "run boot_net_usb_start; "
 #define BOOTENV_SHARED_USB \
@@ -161,6 +170,7 @@ 
 #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \
 	"bootcmd_dhcp=" \
 		BOOTENV_RUN_NET_USB_START \
+		BOOTENV_RUN_NET_PCI_ENUM \
 		"if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \
 			"source ${scriptaddr}; " \
 		"fi\0"
@@ -177,6 +187,7 @@ 
 #define BOOTENV_DEV_PXE(devtypeu, devtypel, instance) \
 	"bootcmd_pxe=" \
 		BOOTENV_RUN_NET_USB_START \
+		BOOTENV_RUN_NET_PCI_ENUM \
 		"dhcp; " \
 		"if pxe get; then " \
 			"pxe boot; " \
@@ -200,6 +211,7 @@ 
 #define BOOTENV \
 	BOOTENV_SHARED_HOST \
 	BOOTENV_SHARED_MMC \
+	BOOTENV_SHARED_PCI \
 	BOOTENV_SHARED_USB \
 	BOOTENV_SHARED_SATA \
 	BOOTENV_SHARED_SCSI \