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