Several users have reported devices that take more than 100ms to announce their presence on a USB port. Allow the sigatt timeout to be specified at runtime as a way to extend the default timeout.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- docs/Runtime_config.md | 1 + src/hw/usb.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/docs/Runtime_config.md b/docs/Runtime_config.md index d6fea28..483c375 100644 --- a/docs/Runtime_config.md +++ b/docs/Runtime_config.md @@ -189,3 +189,4 @@ There are several additional configuration options available in the | floppy1 | The type of the second floppy drive in the system. See the description of **floppy0** for more info. | threads | By default, SeaBIOS will parallelize hardware initialization during bootup to reduce boot time. Multiple hardware devices can be initialized in parallel between vga initialization and option rom initialization. One can set this file to a value of zero to force hardware initialization to run serially. Alternatively, one can set this file to 2 to enable early hardware initialization that runs in parallel with vga, option rom initialization, and the boot menu. | sdcard* | One may create one or more files with an "sdcard" prefix (eg, "etc/sdcard0") with the physical memory address of an SDHCI controller (one memory address per file). This may be useful for SDHCI controllers that do not appear as PCI devices, but are mapped to a consistent memory address. +| usb-time-sigatt | The USB2 specification requires devices to signal that they are attached within 100ms of the USB port being powered on. Some USB devices are known to require more time. Prior to receiving an attachment signal there is no way to know if a USB port is empty or if it has a device attached. One may specify an amount of time here (in milliseconds, default 100) to wait for a USB device attachment signal. Increasing this value will also increase the overall machine bootup time. diff --git a/src/hw/usb.c b/src/hw/usb.c index e46092c..2bffd25 100644 --- a/src/hw/usb.c +++ b/src/hw/usb.c @@ -8,6 +8,7 @@ #include "config.h" // CONFIG_* #include "malloc.h" // free #include "output.h" // dprintf +#include "romfile.h" // romfile_loadint #include "string.h" // memset #include "usb.h" // struct usb_s #include "usb-ehci.h" // ehci_setup @@ -455,12 +456,14 @@ resetfail: goto done; }
+u32 usb_time_sigatt; + void usb_enumerate(struct usbhub_s *hub) { u32 portcount = hub->portcount; hub->threads = portcount; - hub->detectend = timer_calc(USB_TIME_SIGATT); + hub->detectend = timer_calc(usb_time_sigatt);
// Launch a thread for every port. int i; @@ -497,5 +500,6 @@ usb_setup(void) ASSERT32FLAT(); if (! CONFIG_USB) return; + usb_time_sigatt = romfile_loadint("etc/usb-time-sigatt", USB_TIME_SIGATT); run_thread(__usb_setup, NULL); }