EHCI support. All of the credit goes to Aleš Nesrsta. I've just added
the support for the CS5536 modification thereos and few bugfixes. * grub-core/Makefile.core.def (ehci): New module. * grub-core/bus/usb/ehci.c: New file. * grub-core/bus/usb/usbhub.c (grub_usb_hub_add_dev): New arguments port and hubaddr. All users updated. Save port and hubaddr into dev structure. * include/grub/cs5536.h (GRUB_CS5536_MSR_USB_BASE_SMI_ENABLE): New define. * include/grub/pci.h (grub_dma_phys2virt): New function. (grub_dma_virt2phys): Likewise. * include/grub/usb.h (grub_usb_device): New members port and hubaddr.
This commit is contained in:
commit
a2b81d5399
7 changed files with 1903 additions and 4 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2012-02-01 Aleš Nesrsta <starous@volny.cz>
|
||||
2012-02-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
EHCI support. All of the credit goes to Aleš Nesrsta. I've just added
|
||||
the support for the CS5536 modification thereos and few bugfixes.
|
||||
|
||||
* grub-core/Makefile.core.def (ehci): New module.
|
||||
* grub-core/bus/usb/ehci.c: New file.
|
||||
* grub-core/bus/usb/usbhub.c (grub_usb_hub_add_dev): New arguments
|
||||
port and hubaddr. All users updated.
|
||||
Save port and hubaddr into dev structure.
|
||||
* include/grub/cs5536.h (GRUB_CS5536_MSR_USB_BASE_SMI_ENABLE): New
|
||||
define.
|
||||
* include/grub/pci.h (grub_dma_phys2virt): New function.
|
||||
(grub_dma_virt2phys): Likewise.
|
||||
* include/grub/usb.h (grub_usb_device): New members port and hubaddr.
|
||||
|
||||
2012-01-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/fs/fat.c (grub_fat_mount) [!MODE_EXFAT]: Remove fstype
|
||||
|
|
|
@ -462,6 +462,12 @@ module = {
|
|||
enable = pci;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = ehci;
|
||||
common = bus/usb/ehci.c;
|
||||
enable = pci;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = pci;
|
||||
common = bus/pci.c;
|
||||
|
|
1846
grub-core/bus/usb/ehci.c
Normal file
1846
grub-core/bus/usb/ehci.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -44,7 +44,9 @@ static struct grub_usb_hub *hubs;
|
|||
/* Add a device that currently has device number 0 and resides on
|
||||
CONTROLLER, the Hub reported that the device speed is SPEED. */
|
||||
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;
|
||||
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->speed = speed;
|
||||
dev->port = port;
|
||||
dev->hubaddr = hubaddr;
|
||||
|
||||
err = grub_usb_device_initialize (dev);
|
||||
if (err)
|
||||
|
@ -97,6 +101,11 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
|
|||
dev->initialized = 1;
|
||||
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 */
|
||||
grub_millisleep (2);
|
||||
|
||||
|
@ -220,7 +229,7 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
|
|||
grub_millisleep (10);
|
||||
|
||||
/* 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;
|
||||
if (! dev)
|
||||
return;
|
||||
|
@ -475,7 +484,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
|||
grub_millisleep (10);
|
||||
|
||||
/* 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;
|
||||
if (! next_dev)
|
||||
continue;
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
#define GRUB_CS5536_MSR_USB_CONTROLLER_BASE 0x4000000a
|
||||
#define GRUB_CS5536_MSR_USB_OPTION_CONTROLLER_BASE 0x4000000b
|
||||
#define GRUB_CS5536_MSR_USB_BASE_ADDR_MASK 0x00ffffff00ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_SMI_ENABLE 0x3f000000000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_BUS_MASTER 0x0400000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE 0x0200000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_PME_ENABLED 0x0800000000ULL
|
||||
|
|
|
@ -132,6 +132,21 @@ void EXPORT_FUNC(grub_dma_free) (struct grub_pci_dma_chunk *ch);
|
|||
volatile void *EXPORT_FUNC(grub_dma_get_virt) (struct grub_pci_dma_chunk *ch);
|
||||
grub_uint32_t EXPORT_FUNC(grub_dma_get_phys) (struct grub_pci_dma_chunk *ch);
|
||||
|
||||
static inline void *
|
||||
grub_dma_phys2virt (grub_uint32_t phys, struct grub_pci_dma_chunk *chunk)
|
||||
{
|
||||
return ((grub_uint8_t *) grub_dma_get_virt (chunk)
|
||||
+ (phys - grub_dma_get_phys (chunk)));
|
||||
}
|
||||
|
||||
static inline grub_uint32_t
|
||||
grub_dma_virt2phys (volatile void *virt, struct grub_pci_dma_chunk *chunk)
|
||||
{
|
||||
return (((grub_uint8_t *) virt - (grub_uint8_t *) grub_dma_get_virt (chunk))
|
||||
+ grub_dma_get_phys (chunk));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_PCI_H */
|
||||
|
|
|
@ -198,6 +198,11 @@ struct grub_usb_device
|
|||
grub_uint32_t statuschange;
|
||||
|
||||
struct grub_usb_desc_endp *hub_endpoint;
|
||||
|
||||
/* EHCI Split Transfer information */
|
||||
int port;
|
||||
|
||||
int hubaddr;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue