usbtrans.c - wrong max packet size for bulk transfer

This commit is contained in:
starous 2010-10-02 20:50:07 +02:00
commit acf6a974d7
4 changed files with 15 additions and 7 deletions

View file

@ -1,3 +1,10 @@
2010-10-02 Aleš Nesrsta <starous@volny.cz>
* grub-core/bus/usb/ohci.c, grub-core/bus/usb/uhci.c:
Increased number of TDs.
* grub-core/bus/usb/usbtrans.c (grub_usb_bulk_setup_readwrite):
Corrected endpoint maxpacket size.
2010-10-01 Vladimir Serbinenko <phcoder@gmail.com>
Clear out 0x80 color bit on EFI.

View file

@ -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

View file

@ -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 dev,
/* 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 dev,
/* 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 dev,
/* 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! */

View file

@ -228,7 +228,7 @@ grub_usb_bulk_setup_readwrite (grub_usb_device_t dev,
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;