EHCI implementation by Aleš Nesrsta.

This commit is contained in:
Aleš Nesrsta 2011-10-01 20:18:47 +02:00 committed by Vladimir 'phcoder' Serbinenko
parent fc5efcc083
commit 2f82ea948d
4 changed files with 1802 additions and 4 deletions

View file

@ -437,6 +437,12 @@ module = {
enable = pci; enable = pci;
}; };
module = {
name = ehci;
common = bus/usb/ehci.c;
enable = pci;
};
module = { module = {
name = pci; name = pci;
noemu = bus/pci.c; noemu = bus/pci.c;

1778
grub-core/bus/usb/ehci.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -44,7 +44,9 @@ static struct grub_usb_hub *hubs;
/* Add a device that currently has device number 0 and resides on /* Add a device that currently has device number 0 and resides on
CONTROLLER, the Hub reported that the device speed is SPEED. */ CONTROLLER, the Hub reported that the device speed is SPEED. */
static grub_usb_device_t static grub_usb_device_t
grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed) grub_usb_hub_add_dev (grub_usb_controller_t controller,
grub_usb_speed_t speed,
int port, int hubaddr)
{ {
grub_usb_device_t dev; grub_usb_device_t dev;
int i; int i;
@ -56,6 +58,8 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
dev->controller = *controller; dev->controller = *controller;
dev->speed = speed; dev->speed = speed;
dev->port = port;
dev->hubaddr = hubaddr;
err = grub_usb_device_initialize (dev); err = grub_usb_device_initialize (dev);
if (err) if (err)
@ -97,6 +101,11 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
dev->initialized = 1; dev->initialized = 1;
grub_usb_devs[i] = dev; grub_usb_devs[i] = dev;
grub_dprintf ("usb", "Added new usb device: %08x, addr=%d\n",
(grub_uint32_t)dev, i);
grub_dprintf ("usb", "speed=%d, port=%d, hubaddr=%d\n",
speed, port, hubaddr);
/* Wait "recovery interval", spec. says 2ms */ /* Wait "recovery interval", spec. says 2ms */
grub_millisleep (2); grub_millisleep (2);
@ -218,7 +227,7 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
grub_millisleep (10); grub_millisleep (10);
/* Enable the port and create a device. */ /* Enable the port and create a device. */
dev = grub_usb_hub_add_dev (hub->controller, speed); dev = grub_usb_hub_add_dev (hub->controller, speed, portno, 0);
hub->controller->dev->pending_reset = 0; hub->controller->dev->pending_reset = 0;
if (! dev) if (! dev)
return; return;
@ -353,7 +362,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
0, i, sizeof (status), (char *) &status); 0, i, sizeof (status), (char *) &status);
grub_dprintf ("usb", "dev = %p, i = %d, status = %08x\n", grub_dprintf ("usb", "dev = %p, i = %d, status = %08x\n",
dev, i, status); dev, i, status);
if (err) if (err)
continue; continue;
@ -472,7 +481,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
grub_millisleep (10); grub_millisleep (10);
/* Add the device and assign a device address to it. */ /* Add the device and assign a device address to it. */
next_dev = grub_usb_hub_add_dev (&dev->controller, speed); next_dev = grub_usb_hub_add_dev (&dev->controller, speed, i, dev->addr);
dev->controller.dev->pending_reset = 0; dev->controller.dev->pending_reset = 0;
if (! next_dev) if (! next_dev)
continue; continue;

View file

@ -198,6 +198,11 @@ struct grub_usb_device
grub_uint32_t statuschange; grub_uint32_t statuschange;
struct grub_usb_desc_endp *hub_endpoint; struct grub_usb_desc_endp *hub_endpoint;
/* EHCI Split Transfer information */
int port;
int hubaddr;
}; };