|
|
f96e0b |
From e3e32021b775ea8066f4c76d03e803e2d50716ce Mon Sep 17 00:00:00 2001
|
|
|
f96e0b |
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
Date: Wed, 20 Mar 2013 17:07:08 +0100
|
|
|
f96e0b |
Subject: [PATCH 217/482] Fix a conflict between ports structures with 2
|
|
|
f96e0b |
controllers of same kind.
|
|
|
f96e0b |
|
|
|
f96e0b |
---
|
|
|
f96e0b |
ChangeLog | 5 +++++
|
|
|
f96e0b |
grub-core/bus/usb/usbhub.c | 39 ++++++++++++++++++++++-----------------
|
|
|
f96e0b |
include/grub/usb.h | 2 --
|
|
|
f96e0b |
3 files changed, 27 insertions(+), 19 deletions(-)
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/ChangeLog b/ChangeLog
|
|
|
f96e0b |
index 0c28b11..0fcaa65 100644
|
|
|
f96e0b |
--- a/ChangeLog
|
|
|
f96e0b |
+++ b/ChangeLog
|
|
|
f96e0b |
@@ -1,5 +1,10 @@
|
|
|
f96e0b |
2013-03-20 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
|
|
|
f96e0b |
+ Fix a conflict between ports structures with 2 controllers of
|
|
|
f96e0b |
+ same kind.
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+2013-03-20 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
+
|
|
|
f96e0b |
* include/grub/boottime.h: Add missing file.
|
|
|
f96e0b |
|
|
|
f96e0b |
2013-03-19 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
diff --git a/grub-core/bus/usb/usbhub.c b/grub-core/bus/usb/usbhub.c
|
|
|
f96e0b |
index d0be80d..fd7b94e 100644
|
|
|
f96e0b |
--- a/grub-core/bus/usb/usbhub.c
|
|
|
f96e0b |
+++ b/grub-core/bus/usb/usbhub.c
|
|
|
f96e0b |
@@ -37,6 +37,7 @@ struct grub_usb_hub
|
|
|
f96e0b |
grub_usb_controller_t controller;
|
|
|
f96e0b |
int nports;
|
|
|
f96e0b |
struct grub_usb_device **devices;
|
|
|
f96e0b |
+ struct grub_usb_hub_port *ports;
|
|
|
f96e0b |
grub_usb_device_t dev;
|
|
|
f96e0b |
};
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -263,11 +264,11 @@ grub_usb_controller_dev_register_iter (grub_usb_controller_t controller, void *d
|
|
|
f96e0b |
/* Query the number of ports the root Hub has. */
|
|
|
f96e0b |
hub->nports = controller->dev->hubports (controller);
|
|
|
f96e0b |
hub->devices = grub_zalloc (sizeof (hub->devices[0]) * hub->nports);
|
|
|
f96e0b |
- usb->ports = grub_zalloc (sizeof (usb->ports[0]) * hub->nports);
|
|
|
f96e0b |
- if (!hub->devices || !usb->ports)
|
|
|
f96e0b |
+ hub->ports = grub_zalloc (sizeof (hub->ports[0]) * hub->nports);
|
|
|
f96e0b |
+ if (!hub->devices || !hub->ports)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_free (hub->devices);
|
|
|
f96e0b |
- grub_free (usb->ports);
|
|
|
f96e0b |
+ grub_free (hub->ports);
|
|
|
f96e0b |
grub_free (hub->controller);
|
|
|
f96e0b |
grub_free (hub);
|
|
|
f96e0b |
grub_print_error ();
|
|
|
f96e0b |
@@ -323,33 +324,37 @@ grub_usb_controller_dev_register (grub_usb_controller_dev_t usb)
|
|
|
f96e0b |
speed = hub->controller->dev->detect_dev (hub->controller, portno,
|
|
|
f96e0b |
&changed);
|
|
|
f96e0b |
|
|
|
f96e0b |
- if (usb->ports[portno].state == PORT_STATE_NORMAL
|
|
|
f96e0b |
+ if (hub->ports[portno].state == PORT_STATE_NORMAL
|
|
|
f96e0b |
&& speed != GRUB_USB_SPEED_NONE)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- usb->ports[portno].soft_limit_time = grub_get_time_ms () + 250;
|
|
|
f96e0b |
- usb->ports[portno].hard_limit_time = usb->ports[portno].soft_limit_time + 1750;
|
|
|
f96e0b |
- usb->ports[portno].state = PORT_STATE_WAITING_FOR_STABLE_POWER;
|
|
|
f96e0b |
+ hub->ports[portno].soft_limit_time = grub_get_time_ms () + 250;
|
|
|
f96e0b |
+ hub->ports[portno].hard_limit_time = hub->ports[portno].soft_limit_time + 1750;
|
|
|
f96e0b |
+ hub->ports[portno].state = PORT_STATE_WAITING_FOR_STABLE_POWER;
|
|
|
f96e0b |
+ grub_boot_time ("Scheduling stable power wait for port %p:%d",
|
|
|
f96e0b |
+ usb, portno);
|
|
|
f96e0b |
continue_waiting++;
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
- if (usb->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER
|
|
|
f96e0b |
+ if (hub->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER
|
|
|
f96e0b |
&& speed == GRUB_USB_SPEED_NONE)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- usb->ports[portno].soft_limit_time = grub_get_time_ms () + 250;
|
|
|
f96e0b |
+ hub->ports[portno].soft_limit_time = grub_get_time_ms () + 250;
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- if (usb->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER
|
|
|
f96e0b |
- && grub_get_time_ms () > usb->ports[portno].soft_limit_time)
|
|
|
f96e0b |
+ if (hub->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER
|
|
|
f96e0b |
+ && grub_get_time_ms () > hub->ports[portno].soft_limit_time)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- usb->ports[portno].state = PORT_STATE_STABLE_POWER;
|
|
|
f96e0b |
+ hub->ports[portno].state = PORT_STATE_STABLE_POWER;
|
|
|
f96e0b |
+ grub_boot_time ("Got stable power wait for port %p:%d",
|
|
|
f96e0b |
+ usb, portno);
|
|
|
f96e0b |
continue_waiting--;
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- if (usb->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER
|
|
|
f96e0b |
- && grub_get_time_ms () > usb->ports[portno].hard_limit_time)
|
|
|
f96e0b |
+ if (hub->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER
|
|
|
f96e0b |
+ && grub_get_time_ms () > hub->ports[portno].hard_limit_time)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- usb->ports[portno].state = PORT_STATE_FAILED_DEVICE;
|
|
|
f96e0b |
+ hub->ports[portno].state = PORT_STATE_FAILED_DEVICE;
|
|
|
f96e0b |
continue_waiting--;
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
@@ -365,11 +370,11 @@ grub_usb_controller_dev_register (grub_usb_controller_dev_t usb)
|
|
|
f96e0b |
for (hub = hubs; hub; hub = hub->next)
|
|
|
f96e0b |
if (hub->controller->dev == usb)
|
|
|
f96e0b |
for (portno = 0; portno < hub->nports; portno++)
|
|
|
f96e0b |
- if (usb->ports[portno].state == PORT_STATE_STABLE_POWER)
|
|
|
f96e0b |
+ if (hub->ports[portno].state == PORT_STATE_STABLE_POWER)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_usb_speed_t speed;
|
|
|
f96e0b |
int changed = 0;
|
|
|
f96e0b |
- usb->ports[portno].state = PORT_STATE_NORMAL;
|
|
|
f96e0b |
+ hub->ports[portno].state = PORT_STATE_NORMAL;
|
|
|
f96e0b |
speed = hub->controller->dev->detect_dev (hub->controller, portno, &changed);
|
|
|
f96e0b |
attach_root_port (hub, portno, speed);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
diff --git a/include/grub/usb.h b/include/grub/usb.h
|
|
|
f96e0b |
index 12a456b..9e2c221 100644
|
|
|
f96e0b |
--- a/include/grub/usb.h
|
|
|
f96e0b |
+++ b/include/grub/usb.h
|
|
|
f96e0b |
@@ -121,8 +121,6 @@ struct grub_usb_controller_dev
|
|
|
f96e0b |
|
|
|
f96e0b |
grub_usb_speed_t (*detect_dev) (grub_usb_controller_t dev, int port, int *changed);
|
|
|
f96e0b |
|
|
|
f96e0b |
- struct grub_usb_hub_port *ports;
|
|
|
f96e0b |
-
|
|
|
f96e0b |
/* Per controller flag - port reset pending, don't do another reset */
|
|
|
f96e0b |
grub_uint64_t pending_reset;
|
|
|
f96e0b |
|
|
|
f96e0b |
--
|
|
|
f96e0b |
1.8.2.1
|
|
|
f96e0b |
|