From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MDiux-0000xJ-3E for mharc-grub-devel@gnu.org; Mon, 08 Jun 2009 13:45:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDiuv-0000w3-75 for grub-devel@gnu.org; Mon, 08 Jun 2009 13:45:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDiup-0000sJ-Qz for grub-devel@gnu.org; Mon, 08 Jun 2009 13:45:52 -0400 Received: from [199.232.76.173] (port=49900 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDiup-0000sA-Ic for grub-devel@gnu.org; Mon, 08 Jun 2009 13:45:47 -0400 Received: from mail-ew0-f210.google.com ([209.85.219.210]:52212) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MDiuo-0005Nh-Vb for grub-devel@gnu.org; Mon, 08 Jun 2009 13:45:47 -0400 Received: by mail-ew0-f210.google.com with SMTP id 6so6603935ewy.42 for ; Mon, 08 Jun 2009 10:45:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:user-agent:date :from:to:subject:references:content-disposition; bh=E6lKBtG+jcy3UJ8rS8gcMPrvLAczLdaQvMtI7XKKUMk=; b=Uub3Ur1JOAhPra8pa6SxiQfCKCxiO72Sc7eztyycxn+yAjKvxlB1BQ33zph/s1Kdff FUuvPyR3vtep5toaOVpyynhITxAdv986sjzCLF5Pfz9xOYmivXXq3oc4aBOxSOVu5q8p 56iA3cNcOpsJLB0+EUutZQRzpdpoZVcCltOW4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:user-agent:date:from:to:subject:references :content-disposition; b=jDdlpwUdNtVOJtUJUAIJdiI4ua5D/h1LzRk0ib+HgrA/LlXWxN5q7k5D76xXxjg+hD ANzz335JsQ6XYddKYH5ECpWSBur6BzrrFZnRXKMFKC5CZsImv6boV3zHtDz4wA4uJ1Ge i1lv3A+95KnwwwpsZhWtDyE++2rY37n/kdowg= Received: by 10.210.71.12 with SMTP id t12mr1907569eba.63.1244483146420; Mon, 08 Jun 2009 10:45:46 -0700 (PDT) Received: from localhost (host86-171-7-124.range86-171.btcentralplus.com [86.171.7.124]) by mx.google.com with ESMTPS id 7sm266815eyg.17.2009.06.08.10.45.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 08 Jun 2009 10:45:46 -0700 (PDT) Message-Id: <20090608174543.573892962@gmail.com> User-Agent: quilt/0.47-1 Date: Mon, 08 Jun 2009 18:45:18 +0100 From: oliver.henshaw@gmail.com To: grub-devel@gnu.org References: <6d6c12960906071127l4f73e145s38b8f0937eef8f40@mail.gmail.com> <20090608174515.881183682@gmail.com> Content-Disposition: inline; filename=usb-check-interface X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [PATCH 3/4] Check usb programming interface X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jun 2009 17:45:53 -0000 Changelog: * bus/usb/ohci.c: Check programming interface is ohci. Add grub_dprintf for symmetry with bus/usb/uhci.c. * bus/usb/uhci.c: Check programming interface is uhci. Add interf variable for Programming Interface. Print interface with class/subclass. --- bus/usb/ohci.c | 5 ++++- bus/usb/uhci.c | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) Index: grub2/bus/usb/ohci.c =================================================================== --- grub2.orig/bus/usb/ohci.c +++ grub2/bus/usb/ohci.c @@ -133,7 +133,7 @@ grub_ohci_pci_iter (int bus, int device, class >>= 24; /* If this is not an OHCI controller, just return. */ - if (class != 0x0c || subclass != 0x03) + if (class != 0x0c || subclass != 0x03 || interf != 0x10) return 0; /* Determine IO base address. */ @@ -159,6 +159,9 @@ grub_ohci_pci_iter (int bus, int device, /* Reserve memory for the HCCA. */ o->hcca = (struct grub_ohci_hcca *) grub_memalign (256, 256); + grub_dprintf ("ohci", "class=0x%02x 0x%02x interface 0x%02x base=0x%x\n", + class, subclass, interf, o->iobase); + /* Check if the OHCI revision is actually 1.0 as supported. */ revision = grub_ohci_readreg32 (o, GRUB_OHCI_REG_REVISION); grub_dprintf ("ohci", "OHCI revision=0x%02x\n", revision & 0xFF); Index: grub2/bus/usb/uhci.c =================================================================== --- grub2.orig/bus/usb/uhci.c +++ grub2/bus/usb/uhci.c @@ -143,6 +143,7 @@ grub_uhci_pci_iter (int bus, int device, { grub_uint32_t class; grub_uint32_t subclass; + grub_uint32_t interf; grub_uint32_t base; grub_uint32_t fp; grub_pci_address_t addr; @@ -152,11 +153,12 @@ grub_uhci_pci_iter (int bus, int device, addr = grub_pci_make_address (bus, device, func, 2); class = grub_pci_read (addr); + interf = (class >> 8) & 0xFF; subclass = (class >> 16) & 0xFF; class >>= 24; /* If this is not an UHCI controller, just return. */ - if (class != 0x0c || subclass != 0x03) + if (class != 0x0c || subclass != 0x03 || interf != 0x00) return 0; /* Determine IO base address. */ @@ -177,8 +179,8 @@ grub_uhci_pci_iter (int bus, int device, u->framelist = 0; u->qh = 0; u->td = 0; - grub_dprintf ("uhci", "class=0x%02x 0x%02x base=0x%x\n", - class, subclass, u->iobase); + grub_dprintf ("uhci", "class=0x%02x 0x%02x interface 0x%02x base=0x%x\n", + class, subclass, interf, u->iobase); /* Reserve a page for the frame list. */ u->framelist = grub_memalign (4096, 4096);