Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1P1hEC-0006S5-St for mharc-grub-devel@gnu.org; Fri, 01 Oct 2010 11:08:52 -0400 Received: from [140.186.70.92] (port=47544 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P1hE8-0006PK-EN for grub-devel@gnu.org; Fri, 01 Oct 2010 11:08:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P1hCu-0007Ig-JS for grub-devel@gnu.org; Fri, 01 Oct 2010 11:07:34 -0400 Received: from smtp-out3.iol.cz ([194.228.2.91]:43779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P1hCu-0007IT-AS for grub-devel@gnu.org; Fri, 01 Oct 2010 11:07:32 -0400 Received: from antivir5.iol.cz (unknown [192.168.30.212]) by smtp-out3.iol.cz (Postfix) with ESMTP id D96FDBC8F6C for ; Fri, 1 Oct 2010 15:07:31 +0000 (UTC) Received: from localhost (antivir5.iol.cz [127.0.0.1]) by antivir5.iol.cz (Postfix) with ESMTP id C75611E8031 for ; Fri, 1 Oct 2010 17:07:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at iol.cz Received: from antivir5.iol.cz ([127.0.0.1]) by localhost (antivir5.iol.cz [127.0.0.1]) (amavisd-new, port 10224) with LMTP id hTi4TfYP888b for ; Fri, 1 Oct 2010 17:07:31 +0200 (CEST) Received: from port1.iol.cz (unknown [192.168.30.91]) by antivir5.iol.cz (Postfix) with ESMTP id 96B431E802F for ; Fri, 1 Oct 2010 17:07:31 +0200 (CEST) X-SBRS: None X-SBRS-none: None X-RECVLIST: MTA-OUT-IOL X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiILAD6VpUxVRnXk/2dsb2JhbAAHgxeBAdNbkiSEUHQE Received: from 228.117.broadband3.iol.cz (HELO [192.168.6.160]) ([85.70.117.228]) by port1.iol.cz with ESMTP; 01 Oct 2010 17:07:31 +0200 From: =?UTF-8?Q?Ale=C5=A1?= Nesrsta To: The development of GNU GRUB In-Reply-To: <4CA58F52.4040404@gmail.com> References: <20100921183525.GP21862@riva.ucam.org> <20100923130819.GV21862@riva.ucam.org> <1285273648.6015.30.camel@pracovna> <4CA58F52.4040404@gmail.com> Content-Type: multipart/mixed; boundary="=-2lxxTeNmIhd/qdQMWZKw" Date: Fri, 01 Oct 2010 17:07:30 +0200 Message-Id: <1285945650.6460.15.camel@pracovna> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: Re: [PATCH] Trunk: usbtrans.c - wrong max packet size for bulk transfer X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2010 15:08:51 -0000 --=-2lxxTeNmIhd/qdQMWZKw Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Vladimir '=CF=86-coder/phcoder' Serbinenko wrote:=20 > On 09/23/2010 10:27 PM, Ale=C5=A1 Nesrsta wrote: > > code works on on 64 bits architectures. */ > > - u->td =3D (grub_uhci_td_t) grub_memalign (4096, 4096*2); > > + u->td =3D (grub_uhci_td_t) grub_memalign (4096, 32*N_TD); > > if (! u->td) > > goto fail; > > =20 > Could you use sizeof while on it? >=20 > - endpdesc =3D grub_usb_get_endpdescriptor (dev, 0); > + endpdesc =3D grub_usb_get_endpdescriptor (dev, endpoint); > It's hard to see the context of this change. Could you use --diff-optio= ns=3D-p in the future? > Other than that this patch is ok for trunk Hi, there is corrected patch (with sizeof and -p) for review before going to trunk. Regards Ales --=-2lxxTeNmIhd/qdQMWZKw Content-Disposition: attachment; filename=usb_maxpacketbulk_101001_0 Content-Type: text/x-patch; name=usb_maxpacketbulk_101001_0; charset=utf-8 Content-Transfer-Encoding: 7bit diff -purB ./grub/grub-core/bus/usb/ohci.c ./grub_patched/grub-core/bus/usb/ohci.c --- ./grub/grub-core/bus/usb/ohci.c 2010-09-30 22:17:31.000000000 +0200 +++ ./grub_patched/grub-core/bus/usb/ohci.c 2010-10-01 11:24:29.000000000 +0200 @@ -150,7 +150,7 @@ typedef enum #define GRUB_OHCI_RESET_CONNECT_CHANGE (1 << 16) #define GRUB_OHCI_CTRL_EDS 256 #define GRUB_OHCI_BULK_EDS 510 -#define GRUB_OHCI_TDS 256 +#define GRUB_OHCI_TDS 640 #define GRUB_OHCI_ED_ADDR_MASK 0x7ff diff -purB ./grub/grub-core/bus/usb/uhci.c ./grub_patched/grub-core/bus/usb/uhci.c --- ./grub/grub-core/bus/usb/uhci.c 2010-09-30 22:17:31.000000000 +0200 +++ ./grub_patched/grub-core/bus/usb/uhci.c 2010-10-01 11:31:44.000000000 +0200 @@ -29,6 +29,7 @@ #define GRUB_UHCI_IOMASK (0x7FF << 5) #define N_QH 256 +#define N_TD 640 typedef enum { @@ -105,7 +106,7 @@ struct grub_uhci /* N_QH Queue Heads. */ grub_uhci_qh_t qh; - /* 256 Transfer Descriptors. */ + /* N_TD Transfer Descriptors. */ grub_uhci_td_t td; /* Free Transfer Descriptors. */ @@ -213,7 +214,7 @@ grub_uhci_pci_iter (grub_pci_device_t de /* The QH pointer of UHCI is only 32 bits, make sure this code works on on 64 bits architectures. */ - u->qh = (grub_uhci_qh_t) grub_memalign (4096, 4096); + u->qh = (grub_uhci_qh_t) grub_memalign (4096, sizeof(struct grub_uhci_qh)*N_QH); if (! u->qh) goto fail; @@ -227,7 +228,7 @@ grub_uhci_pci_iter (grub_pci_device_t de /* The TD pointer of UHCI is only 32 bits, make sure this code works on on 64 bits architectures. */ - u->td = (grub_uhci_td_t) grub_memalign (4096, 4096*2); + u->td = (grub_uhci_td_t) grub_memalign (4096, sizeof(struct grub_uhci_td)*N_TD); if (! u->td) goto fail; @@ -244,9 +245,9 @@ grub_uhci_pci_iter (grub_pci_device_t de /* Link all Transfer Descriptors in a list of available Transfer Descriptors. */ - for (i = 0; i < 256; i++) + for (i = 0; i < N_TD; i++) u->td[i].linkptr = (grub_uint32_t) (grub_addr_t) &u->td[i + 1]; - u->td[255 - 1].linkptr = 0; + u->td[N_TD - 2].linkptr = 0; u->tdfree = u->td; /* Make sure UHCI is disabled! */ diff -purB ./grub/grub-core/bus/usb/usbtrans.c ./grub_patched/grub-core/bus/usb/usbtrans.c --- ./grub/grub-core/bus/usb/usbtrans.c 2010-09-30 22:17:31.000000000 +0200 +++ ./grub_patched/grub-core/bus/usb/usbtrans.c 2010-10-01 11:24:29.000000000 +0200 @@ -228,7 +228,7 @@ grub_usb_bulk_setup_readwrite (grub_usb_ if (dev->initialized) { struct grub_usb_desc_endp *endpdesc; - endpdesc = grub_usb_get_endpdescriptor (dev, 0); + endpdesc = grub_usb_get_endpdescriptor (dev, endpoint); if (endpdesc) max = endpdesc->maxpacket; --=-2lxxTeNmIhd/qdQMWZKw--