Commit 972b1f04 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Paul Mackerras

[POWERPC] PS3: Add repository polling loop to work around timing bug

PS3: Add repository polling loop to work around timing bug

On some firmware versions (e.g. 1.90), the storage device may not show up
in the repository immediately after receiving the notification message.
Add a small polling loop to make sure we don't miss it.
Signed-off-by: default avatarGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: default avatarGeoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent b4cb2941
...@@ -489,6 +489,38 @@ static int ps3_register_repository_device( ...@@ -489,6 +489,38 @@ static int ps3_register_repository_device(
return result; return result;
} }
static void ps3_find_and_add_device(u64 bus_id, u64 dev_id)
{
struct ps3_repository_device repo;
int res;
unsigned int retries;
unsigned long rem;
/*
* On some firmware versions (e.g. 1.90), the device may not show up
* in the repository immediately
*/
for (retries = 0; retries < 10; retries++) {
res = ps3_repository_find_device_by_id(&repo, bus_id, dev_id);
if (!res)
goto found;
rem = msleep_interruptible(100);
if (rem)
break;
}
pr_warning("%s:%u: device %lu:%lu not found\n", __func__, __LINE__,
bus_id, dev_id);
return;
found:
if (retries)
pr_debug("%s:%u: device %lu:%lu found after %u retries\n",
__func__, __LINE__, bus_id, dev_id, retries);
ps3_register_repository_device(&repo);
return;
}
#define PS3_NOTIFICATION_DEV_ID ULONG_MAX #define PS3_NOTIFICATION_DEV_ID ULONG_MAX
#define PS3_NOTIFICATION_INTERRUPT_ID 0 #define PS3_NOTIFICATION_INTERRUPT_ID 0
...@@ -600,7 +632,6 @@ static struct task_struct *probe_task; ...@@ -600,7 +632,6 @@ static struct task_struct *probe_task;
static int ps3_probe_thread(void *data) static int ps3_probe_thread(void *data)
{ {
struct ps3_notification_device dev; struct ps3_notification_device dev;
struct ps3_repository_device repo;
int res; int res;
unsigned int irq; unsigned int irq;
u64 lpar; u64 lpar;
...@@ -682,18 +713,7 @@ static int ps3_probe_thread(void *data) ...@@ -682,18 +713,7 @@ static int ps3_probe_thread(void *data)
continue; continue;
} }
res = ps3_repository_find_device_by_id(&repo, dev.sbd.bus_id, ps3_find_and_add_device(dev.sbd.bus_id, notify_event->dev_id);
notify_event->dev_id);
if (res) {
pr_warning("%s:%u: device %lu:%lu not found\n",
__func__, __LINE__, dev.sbd.bus_id,
notify_event->dev_id);
continue;
}
pr_debug("%s:%u: device %lu:%lu found\n", __func__, __LINE__,
dev.sbd.bus_id, notify_event->dev_id);
ps3_register_repository_device(&repo);
} while (!kthread_should_stop()); } while (!kthread_should_stop());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment