Skip to contentSkip to conversation

reset USB controller

PATCH In review Vladimir 'phcoder' Serbinenko 3 participants 6 messages Jul 15, 2009 – Sep 1, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reset USB controller

Hello, some BIOSes don't conform semaphore specification about handing over the control on UHCI and/or EHCI controller. Most OS cope with it by taking ownership regardless after some timeout. This however increases booting time. Also some OSes don't cope with this quirk correctly and are unable to access some devices. Here is a module to forcibly remove BIOS ownership without timeout. It adds 2 commands:
ehcireste and uhcireset. I choose to name both functions analogously even if actually only UHCI is really reset

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
#1 lore raw
Quoted 15 lines · Vladimir 'phcoder' Serbinenko

Hello, some BIOSes don't conform semaphore specification about handing over the control on UHCI and/or EHCI controller. Most OS cope with it by taking ownership regardless after some timeout. This however increases booting time. Also some OSes don't cope with this quirk correctly and are unable to access some devices. Here is a module to forcibly remove BIOS ownership without timeout. It adds 2 commands:
ehcireste and uhcireset. I choose to name both functions analogously even if actually only UHCI is really reset

--
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
ChangeLog +10 -0
index fd9b9e4..28ef356 100644
@@ -1,3 +1,13 @@
+2009-07-15  Vladimir Serbinenko  <[email protected]>
+
+	Reset USB controller
+
+	* commands/usbreset.c: new file
+	* conf/i386-pc.rmk (pkglib_MODULES): add usbreset.mod
+	(usbreset_mod_SOURCES): new variable
+	(usbreset_mod_CFLAGS): likewise
+	(usbreset_mod_LFFLAGS): likewise
+
 2009-07-15  Pavel Roskin  <[email protected]>
 
 	* include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_BPB_END):
commands/usbreset.c new file +182 -0

182 lines not on this page · raw message

conf/i386-pc.rmk +6 -1
index f1915b6..53d8510 100644
@@ -189,7 +189,7 @@ pkglib_MODULES = biosdisk.mod chain.mod \
 	aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
 	datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
 	usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
-	efiemu.mod mmap.mod acpi.mod drivemap.mod
+	efiemu.mod mmap.mod acpi.mod drivemap.mod usbreset.mod
 
 # For boot.mod.
 pkglib_MODULES += boot.mod 
@@ -214,6 +214,11 @@ efiemu_mod_SOURCES = efiemu/main.c efiemu/i386/loadcore32.c \
 efiemu_mod_CFLAGS = $(COMMON_CFLAGS)
 efiemu_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
+# For usbreset.mod.
+usbreset_mod_SOURCES = commands/usbreset.c
+usbreset_mod_CFLAGS = $(COMMON_CFLAGS)
+usbreset_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # For acpi.mod.
 acpi_mod_SOURCES = commands/acpi.c commands/i386/pc/acpi.c
 acpi_mod_CFLAGS = $(COMMON_CFLAGS)
#2 lore raw
In reply to Vladimir 'phcoder' Serbinenko
Quoted 8 lines · Vladimir 'phcoder' Serbinenko

Hello, some BIOSes don't conform semaphore specification about handing over the control on UHCI and/or EHCI controller. Most OS cope with it by taking ownership regardless after some timeout. This however increases booting time. Also some OSes don't cope with this quirk correctly and are unable to access some devices. Here is a module to forcibly remove BIOS ownership without timeout. It adds 2 commands:
ehcireste and uhcireset. I choose to name both functions analogously even if actually only UHCI is really reset

Is there some way we can make this simpler without compromising on boot speed? Adding more setup burden to the user should be the last ressort IMO.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#3 lore raw
Quoted 10 lines · Robert Millan
Quoted 8 lines · Vladimir 'phcoder' Serbinenko

Hello, some BIOSes don't conform semaphore specification about handing over the control on UHCI and/or EHCI controller. Most OS cope with it by taking ownership regardless after some timeout. This however increases booting time. Also some OSes don't cope with this quirk correctly and are unable to access some devices. Here is a module to forcibly remove BIOS ownership without timeout. It adds 2 commands:
ehcireste and uhcireset. I choose to name both functions analogously even if actually only UHCI is really reset

Quoted 4 lines

Is there some way we can make this simpler without compromising on boot speed?  Adding more setup burden to the user should be the last ressort IMO.

The only way I can think of is to have a quirk list. Most OS deal with this situation properly and increased boot time by one up to few seconds because of buggy BIOS is an acceptable compromise. This patch is mainly as a optimisation trick if user knows about the problem. Another usage is if OS doesn't deal with situation correctly. With such OSes (I'm aware about some kinds of Darwin unless USB drivers are corrected and not official from Apple) normal reaction would be to do the long reset procedure but experience with USB drivers show that fixing one thing may bring another bug. Once we have reliable USB drivers we could just use their (long) ownership acquire function and have an environment variable to do it hard and fast way.
If you consider this patch too hackish it can stay in my repo and people who really need can be said to use my repo or external module. If you consider this tweak possibility reasonable we can merge it

Quoted 13 lines

--
Robert Millan

 The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
#4 lore raw
Quoted 5 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines · Robert Millan
Quoted 3 lines · Vladimir 'phcoder' Serbinenko

Hello, some BIOSes don't conform semaphore specification about handing over the control on UHCI and/or EHCI controller. Most OS cope with it by taking ownership regardless after some timeout. This however

Please, notice that the EHCI specification does not not specify the required timeout. Especially, there's no timeout after which the forced taking of ownership is safe.

See http://bugzilla.kernel.org/show_bug.cgi?id=12148 for further discussion.

Notice that once mainstream grub deals with USB keyboards without BIOS support, the obvious fix is to disable the (buggy) USB legacy support in the BIOS.

The other obvious fix would be to upgrade to non-buggy BIOS version but unless your BIOS vendor fixes the issue, that's not really an option.

Quoted 10 lines
Quoted 4 lines

Is there some way we can make this simpler without compromising on boot speed? Adding more setup burden to the user should be the last ressort IMO.

[...]
Another usage is if OS doesn't deal with situation correctly. [...]
If you consider this patch too hackish it can stay in my repo and people who really need can be said to use my repo or external module. If you consider this tweak possibility reasonable we can merge it

I don't know if the code quality is up to the requirements for getting in the official trunk but I don't think that any method to deal with broken BIOS or hardware cannot be too hackish. If the hardware (and this includes the firmware) is broken and there's some hack that can make it usable, just apply the hack. IMHO.

Signature · 1 line
Mikko
#5 lore raw
Quoted 11 lines · Mikko Rantalainen
Quoted 10 lines
Quoted 4 lines

Is there some way we can make this simpler without compromising on boot speed? Adding more setup burden to the user should be the last ressort IMO.

[...]
Another usage is if OS doesn't deal with situation correctly. [...]
If you consider this patch too hackish it can stay in my repo and people who really need can be said to use my repo or external module. If you consider this tweak possibility reasonable we can merge it

Quoted 5 lines

I don't know if the code quality is up to the requirements for getting in the official trunk but I don't think that any method to deal with broken BIOS or hardware cannot be too hackish. If the hardware (and this includes the firmware) is broken and there's some hack that can make it usable, just apply the hack. IMHO.

Working around broken BIOS or hardware can be ok. It's putting burden on the user what sounds problematic.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."