[PATCH v3 5/5] test: x86: add test for uefi usb io

Fabian Pflug <[email protected]>
Newsgroups org.infradead.lists.barebox
Message-ID <20260820-v2026-06-0-topic-efi_usb-v3-5-faf0b9267966@pengutronix.de>
Check, that the EFI-USB-IO controller will create a USB Network device
in barebox. The device has currently no driver, but is available
nevertheless.

Reviewed-by: Ahmad Fatoum <[email protected]>
Signed-off-by: Fabian Pflug <[email protected]>
---
 drivers/usb/host/efi-io-protocol.c | 15 ++++++++++++---
 test/x86/pc@efi_defconfig.yaml     |  9 ++++++++-
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/efi-io-protocol.c b/drivers/usb/host/efi-io-protocol.c
index cdba353e96..955e583703 100644
--- a/drivers/usb/host/efi-io-protocol.c
+++ b/drivers/usb/host/efi-io-protocol.c
@@ -146,6 +146,16 @@ static int efi_get_usb_string(struct efi_usb_io_protocol *protocol, u16 lang_id,
 	return 0;
 }
 
+static void print_usb_device_info(struct device *dev)
+{
+	struct usb_device *usb_dev = container_of(dev, struct usb_device, dev);
+
+	dev_info(dev, "Bus %03d Device %03d: ID %04x:%04x %s\n",
+		 usb_dev->host->busnum, usb_dev->devnum,
+		 usb_dev->descriptor->idVendor, usb_dev->descriptor->idProduct,
+		 usb_dev->prod);
+}
+
 static int create_usb_device(struct efi_usb_io_priv *priv)
 {
 	struct usb_host *host = &priv->host;
@@ -250,9 +260,8 @@ static int create_usb_device(struct efi_usb_io_priv *priv)
 				   sizeof(dev->serial));
 	}
 
-	dev_info(&dev->dev, "Bus %03d Device %03d: ID %04x:%04x %s\n",
-		 dev->host->busnum, dev->devnum, dev->descriptor->idVendor,
-		 dev->descriptor->idProduct, dev->prod);
+	print_usb_device_info(&dev->dev);
+	devinfo_add(&dev->dev, print_usb_device_info);
 
 	err = register_device(&dev->dev);
 	if (err) {
diff --git a/test/x86/pc@efi_defconfig.yaml b/test/x86/pc@efi_defconfig.yaml
index 2c077d5509..4feabb232d 100644
--- a/test/x86/pc@efi_defconfig.yaml
+++ b/test/x86/pc@efi_defconfig.yaml
@@ -8,7 +8,11 @@ targets:
         memory: 1024M
         kernel: barebox.efi
         display: qemu-default
-        extra_args: '-bios OVMF.fd'
+        extra_args: >
+          -bios OVMF.fd
+          -device qemu-xhci,id=xhci
+          -device usb-net,netdev=usb0,bus=xhci.0
+          -netdev user,id=usb0
       BareboxDriver:
         prompt: 'barebox@[^:]+:[^ ]+ '
         bootstring: 'commandline:'
@@ -16,6 +20,7 @@ targets:
     features:
       - pci
     devices:
+      usb1: 'usb1: Bus 001 Device 000: ID 0525:a4a2 RNDIS/QEMU USB Network Device'
       fb0: 'Type: primary'
       fbconsole0: 'Parent: fb0'
       wdog0: 'Parent: efi-wdt'
@@ -25,6 +30,8 @@ targets:
       acpi-APIC0: 'Signature: APIC (Multiple APIC Description Table)'
     runner:
       kconfig_add:
+        - CONFIG_USB_HOST=y
+        - CONFIG_USB_EFI_IO_PROTOCOL=y
         - CONFIG_DRIVER_SERIAL_NS16550=y
         - CONFIG_CONSOLE_ACTIVATE_FIRST=y # avoid duplicate output
 images:

-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.