From d55842d81e7ecfdf7f200b1671ad2ae173fe847d Mon Sep 17 00:00:00 2001 From: proski Date: Mon, 8 Jun 2009 20:23:09 +0000 Subject: [PATCH] 2009-06-08 Oliver Henshaw * bus/usb/ohci.c (grub_ohci_pci_iter): Define the Class, Subclass and Programming Interface fields in terms of the 3 byte Class Code register. * bus/usb/uhci.c (grub_uhci_pci_iter): Likewise. --- ChangeLog | 5 +++++ bus/usb/ohci.c | 9 +++++---- bus/usb/uhci.c | 9 +++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ddd746bd..4f0fbb587 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-08 Oliver Henshaw + * bus/usb/ohci.c (grub_ohci_pci_iter): Define the Class, + Subclass and Programming Interface fields in terms of the 3 byte + Class Code register. + * bus/usb/uhci.c (grub_uhci_pci_iter): Likewise. + * bus/usb/ohci.c (grub_ohci_pci_iter): Check that programming interface is OHCI. Add grub_dprintf for symmetry with bus/usb/uhci.c. diff --git a/bus/usb/ohci.c b/bus/usb/ohci.c index 146862bde..ce7ea6efd 100644 --- a/bus/usb/ohci.c +++ b/bus/usb/ohci.c @@ -116,6 +116,7 @@ static int NESTED_FUNC_ATTR grub_ohci_pci_iter (int bus, int device, int func, grub_pci_id_t pciid __attribute__((unused))) { + grub_uint32_t class_code; grub_uint32_t class; grub_uint32_t subclass; grub_uint32_t interf; @@ -126,11 +127,11 @@ grub_ohci_pci_iter (int bus, int device, int func, grub_uint32_t frame_interval; addr = grub_pci_make_address (bus, device, func, 2); - class = grub_pci_read (addr); + class_code = grub_pci_read (addr) >> 8; - interf = (class >> 8) & 0xFF; - subclass = (class >> 16) & 0xFF; - class >>= 24; + interf = class_code & 0xFF; + subclass = (class_code >> 8) & 0xFF; + class = class_code >> 16; /* If this is not an OHCI controller, just return. */ if (class != 0x0c || subclass != 0x03 || interf != 0x10) diff --git a/bus/usb/uhci.c b/bus/usb/uhci.c index f59d26b43..a0836f805 100644 --- a/bus/usb/uhci.c +++ b/bus/usb/uhci.c @@ -141,6 +141,7 @@ static int NESTED_FUNC_ATTR grub_uhci_pci_iter (int bus, int device, int func, grub_pci_id_t pciid __attribute__((unused))) { + grub_uint32_t class_code; grub_uint32_t class; grub_uint32_t subclass; grub_uint32_t interf; @@ -151,11 +152,11 @@ grub_uhci_pci_iter (int bus, int device, int func, int i; addr = grub_pci_make_address (bus, device, func, 2); - class = grub_pci_read (addr); + class_code = grub_pci_read (addr) >> 8; - interf = (class >> 8) & 0xFF; - subclass = (class >> 16) & 0xFF; - class >>= 24; + interf = class_code & 0xFF; + subclass = (class_code >> 8) & 0xFF; + class = class_code >> 16; /* If this is not an UHCI controller, just return. */ if (class != 0x0c || subclass != 0x03 || interf != 0x00)