All of lore.kernel.org
 help / color / mirror / Atom feed
* Grub needs to check the programming interface for usb controllers
@ 2009-06-07 18:27 Oliver Henshaw
  2009-06-08 17:45 ` [PATCH 0/4] " oliver.henshaw
  0 siblings, 1 reply; 8+ messages in thread
From: Oliver Henshaw @ 2009-06-07 18:27 UTC (permalink / raw)
  To: grub-devel

Grub needs to check that the usb programming interface is of the
correct type. Otherwise, hilarity ensues when e.g. bus/usb/ohci.c
attempts to initialise an uhci controller. This can easily be
reproduced by typing 'insmod ohci' in the grub rescue disk in qemu,
with usb enabled.

Additionally, the usb interface (which was defined but not used in
bus/usb/ohci.c) was set to the wrong value.

I've split this into a patch series bookended by more cosmetic
patches. The first patch consists of minor fixes: removing some
doubled lines (which look like a pasto, but I could be wrong),
changing an int to a grub_uint32_t (to match the types of all other
similar variables) and I've added some whitespace fixes. The final
patch is purely cosmetic: it defines the pci Class, Subclass and
Programming Interface fields in terms of the Class Code register, so
that the code better reflects the spec.

This last patch may seem minor, but the (previously unused) usb
interface was set to the wrong value in bus/usb/ohci.c up to now -
this means that the code now better reflects the structure of the
Class Code register, and better documents the specification.

The patch series has been tested on on real hardware, and each patch
has been tested with qemu and a grub rescue image. Both ohci and uhci
cases have been tested (qemu has a virtual ohci controller, but the
option to enable it must be patched in).


Thanks,
Oliver



^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH 2/4] Fix inteface definition for ohci
@ 2009-06-07 18:33 Oliver Henshaw
  0 siblings, 0 replies; 8+ messages in thread
From: Oliver Henshaw @ 2009-06-07 18:33 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: usb-fix-interface --]
[-- Type: application/octet-stream, Size: 556 bytes --]

Changelog:
	* bus/usb/ohci.c: Set interf with correct field.
---
 bus/usb/ohci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: grub2/bus/usb/ohci.c
===================================================================
--- grub2.orig/bus/usb/ohci.c
+++ grub2/bus/usb/ohci.c
@@ -128,7 +128,7 @@ grub_ohci_pci_iter (int bus, int device,
   addr = grub_pci_make_address (bus, device, func, 2);
   class = grub_pci_read (addr);
 
-  interf = class & 0xFF;
+  interf = (class >> 8) & 0xFF;
   subclass = (class >> 16) & 0xFF;
   class >>= 24;
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-06-08 20:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-07 18:27 Grub needs to check the programming interface for usb controllers Oliver Henshaw
2009-06-08 17:45 ` [PATCH 0/4] " oliver.henshaw
2009-06-08 17:45   ` [PATCH 1/4] Minor Cleanup oliver.henshaw
2009-06-08 17:45   ` [PATCH 2/4] Fix inteface definition for ohci oliver.henshaw
2009-06-08 17:45   ` [PATCH 3/4] Check usb programming interface oliver.henshaw
2009-06-08 17:45   ` [PATCH 4/4] Define fields in terms of the Class Code register oliver.henshaw
2009-06-08 20:30   ` [PATCH 0/4] Re: Grub needs to check the programming interface for usb controllers Pavel Roskin
  -- strict thread matches above, loose matches on Subject: below --
2009-06-07 18:33 [PATCH 2/4] Fix inteface definition for ohci Oliver Henshaw

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.