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 0921d4f7f1..4858d30eb9 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


Reply via email to