* include/grub/usb.h (grub_usb_controller_dev): Make portstatus
return grub_usb_err_t for cosistency. All users updated.
This commit is contained in:
parent
5701750c2c
commit
dac6ce73be
6 changed files with 25 additions and 27 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2013-11-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* include/grub/usb.h (grub_usb_controller_dev): Make portstatus
|
||||||
|
return grub_usb_err_t for cosistency. All users updated.
|
||||||
|
|
||||||
2013-11-07 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-11-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* util/mkimage.c (SzAlloc): Use attribute unused rather than dubious
|
* util/mkimage.c (SzAlloc): Use attribute unused rather than dubious
|
||||||
|
|
|
@ -1677,7 +1677,7 @@ grub_ehci_hubports (grub_usb_controller_t dev)
|
||||||
return portinfo;
|
return portinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_usb_err_t
|
||||||
grub_ehci_portstatus (grub_usb_controller_t dev,
|
grub_ehci_portstatus (grub_usb_controller_t dev,
|
||||||
unsigned int port, unsigned int enable)
|
unsigned int port, unsigned int enable)
|
||||||
{
|
{
|
||||||
|
@ -1699,14 +1699,14 @@ grub_ehci_portstatus (grub_usb_controller_t dev,
|
||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while (grub_ehci_port_read (e, port) & GRUB_EHCI_PORT_ENABLED)
|
while (grub_ehci_port_read (e, port) & GRUB_EHCI_PORT_ENABLED)
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "portstatus: EHCI Timed out - disable");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
if (!enable) /* We don't need reset port */
|
if (!enable) /* We don't need reset port */
|
||||||
{
|
{
|
||||||
grub_dprintf ("ehci", "portstatus: Disabled.\n");
|
grub_dprintf ("ehci", "portstatus: Disabled.\n");
|
||||||
grub_dprintf ("ehci", "portstatus: end, status=0x%02x\n",
|
grub_dprintf ("ehci", "portstatus: end, status=0x%02x\n",
|
||||||
grub_ehci_port_read (e, port));
|
grub_ehci_port_read (e, port));
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_dprintf ("ehci", "portstatus: enable\n");
|
grub_dprintf ("ehci", "portstatus: enable\n");
|
||||||
|
@ -1724,8 +1724,7 @@ grub_ehci_portstatus (grub_usb_controller_t dev,
|
||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while (grub_ehci_port_read (e, port) & GRUB_EHCI_PORT_RESET)
|
while (grub_ehci_port_read (e, port) & GRUB_EHCI_PORT_RESET)
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO,
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
"portstatus: EHCI Timed out - reset port");
|
|
||||||
grub_boot_time ("Port %d reset", port);
|
grub_boot_time ("Port %d reset", port);
|
||||||
/* Remember "we did the reset" - needed by detect_dev */
|
/* Remember "we did the reset" - needed by detect_dev */
|
||||||
e->reset |= (1 << port);
|
e->reset |= (1 << port);
|
||||||
|
@ -1753,7 +1752,7 @@ grub_ehci_portstatus (grub_usb_controller_t dev,
|
||||||
grub_dprintf ("ehci", "portstatus: end, status=0x%02x\n",
|
grub_dprintf ("ehci", "portstatus: end, status=0x%02x\n",
|
||||||
grub_ehci_port_read (e, port));
|
grub_ehci_port_read (e, port));
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_usb_speed_t
|
static grub_usb_speed_t
|
||||||
|
|
|
@ -1216,7 +1216,7 @@ grub_ohci_cancel_transfer (grub_usb_controller_t dev,
|
||||||
return GRUB_USB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_usb_err_t
|
||||||
grub_ohci_portstatus (grub_usb_controller_t dev,
|
grub_ohci_portstatus (grub_usb_controller_t dev,
|
||||||
unsigned int port, unsigned int enable)
|
unsigned int port, unsigned int enable)
|
||||||
{
|
{
|
||||||
|
@ -1236,11 +1236,11 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
||||||
while ((grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
while ((grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
||||||
& (1 << 1)))
|
& (1 << 1)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "OHCI Timed out - disable");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OHCI does one reset signal 10ms long but USB spec.
|
/* OHCI does one reset signal 10ms long but USB spec.
|
||||||
|
@ -1257,7 +1257,7 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
||||||
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
||||||
& GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE))
|
& GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "OHCI Timed out - reset");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
/* End the reset signaling - reset the reset status change */
|
/* End the reset signaling - reset the reset status change */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
|
@ -1275,7 +1275,7 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
||||||
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
||||||
& (1 << 1)))
|
& (1 << 1)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "OHCI Timed out - enable");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
/* Reset bit Connect Status Change */
|
/* Reset bit Connect Status Change */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
|
@ -1287,7 +1287,7 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
||||||
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_usb_speed_t
|
static grub_usb_speed_t
|
||||||
|
|
|
@ -189,11 +189,6 @@ grub_uhci_writereg32 (struct grub_uhci *u,
|
||||||
grub_outl (val, u->iobase + reg);
|
grub_outl (val, u->iobase + reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_uhci_portstatus (grub_usb_controller_t dev,
|
|
||||||
unsigned int port, unsigned int enable);
|
|
||||||
|
|
||||||
|
|
||||||
/* Iterate over all PCI devices. Determine if a device is an UHCI
|
/* Iterate over all PCI devices. Determine if a device is an UHCI
|
||||||
controller. If this is the case, initialize it. */
|
controller. If this is the case, initialize it. */
|
||||||
static int
|
static int
|
||||||
|
@ -715,7 +710,7 @@ grub_uhci_iterate (grub_usb_controller_iterate_hook_t hook, void *hook_data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_usb_err_t
|
||||||
grub_uhci_portstatus (grub_usb_controller_t dev,
|
grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
unsigned int port, unsigned int enable)
|
unsigned int port, unsigned int enable)
|
||||||
{
|
{
|
||||||
|
@ -733,8 +728,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
else if (port == 1)
|
else if (port == 1)
|
||||||
reg = GRUB_UHCI_REG_PORTSC2;
|
reg = GRUB_UHCI_REG_PORTSC2;
|
||||||
else
|
else
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
"UHCI Root Hub port does not exist");
|
|
||||||
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
grub_dprintf ("uhci", "detect=0x%02x\n", status);
|
grub_dprintf ("uhci", "detect=0x%02x\n", status);
|
||||||
|
@ -747,11 +741,11 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while ((grub_uhci_readreg16 (u, reg) & (1 << 2)))
|
while ((grub_uhci_readreg16 (u, reg) & (1 << 2)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "UHCI Timed out - disable");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the port. */
|
/* Reset the port. */
|
||||||
|
@ -782,7 +776,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while (! ((status = grub_uhci_readreg16 (u, reg)) & (1 << 2)))
|
while (! ((status = grub_uhci_readreg16 (u, reg)) & (1 << 2)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "UHCI Timed out - enable");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
/* Reset recovery time */
|
/* Reset recovery time */
|
||||||
grub_millisleep (10);
|
grub_millisleep (10);
|
||||||
|
@ -792,7 +786,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
||||||
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_usb_speed_t
|
static grub_usb_speed_t
|
||||||
|
|
|
@ -203,7 +203,7 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
|
||||||
grub_usb_speed_t speed)
|
grub_usb_speed_t speed)
|
||||||
{
|
{
|
||||||
grub_usb_device_t dev;
|
grub_usb_device_t dev;
|
||||||
grub_err_t err;
|
grub_usb_err_t err;
|
||||||
|
|
||||||
grub_boot_time ("After detect_dev");
|
grub_boot_time ("After detect_dev");
|
||||||
|
|
||||||
|
|
|
@ -116,8 +116,8 @@ struct grub_usb_controller_dev
|
||||||
|
|
||||||
int (*hubports) (grub_usb_controller_t dev);
|
int (*hubports) (grub_usb_controller_t dev);
|
||||||
|
|
||||||
grub_err_t (*portstatus) (grub_usb_controller_t dev, unsigned int port,
|
grub_usb_err_t (*portstatus) (grub_usb_controller_t dev, unsigned int port,
|
||||||
unsigned int enable);
|
unsigned int enable);
|
||||||
|
|
||||||
grub_usb_speed_t (*detect_dev) (grub_usb_controller_t dev, int port, int *changed);
|
grub_usb_speed_t (*detect_dev) (grub_usb_controller_t dev, int port, int *changed);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue