Skip to content

Commit

Permalink
[POWERPC] cell/PS3: Ignore storage devices that are still being probed
Browse files Browse the repository at this point in the history
On PS3, A storage device may show up in the repository before the hypervisor
has finished probing:
  - If its type is not yet known, it shows up as PS3_DEV_TYPE_STOR_DUMMY,
  - If its regions are being probed, it shows up as having zero regions.
If any of these happen, consider the device not yet present.  The storage
probe thread will retry later.

This fixes the timing-dependent problem where a kernel booted from FLASH ROM
sometimes cannot find the hard disk.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Geert Uytterhoeven authored and Paul Mackerras committed Sep 10, 2007
1 parent ef8034d commit d51dd3d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/powerpc/platforms/ps3/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ enum ps3_dev_type {
PS3_DEV_TYPE_STOR_ROM = TYPE_ROM, /* 5 */
PS3_DEV_TYPE_SB_GPIO = 6,
PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC, /* 14 */
PS3_DEV_TYPE_STOR_DUMMY = 32,
PS3_DEV_TYPE_NOACCESS = 255,
};

Expand Down
29 changes: 29 additions & 0 deletions arch/powerpc/platforms/ps3/repository.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,35 @@ int ps3_repository_find_device(struct ps3_repository_device *repo)
return result;
}

if (tmp.bus_type == PS3_BUS_TYPE_STORAGE) {
/*
* A storage device may show up in the repository before the
* hypervisor has finished probing its type and regions
*/
unsigned int num_regions;

if (tmp.dev_type == PS3_DEV_TYPE_STOR_DUMMY) {
pr_debug("%s:%u storage device not ready\n", __func__,
__LINE__);
return -ENODEV;
}

result = ps3_repository_read_stor_dev_num_regions(tmp.bus_index,
tmp.dev_index,
&num_regions);
if (result) {
pr_debug("%s:%d read_stor_dev_num_regions failed\n",
__func__, __LINE__);
return result;
}

if (!num_regions) {
pr_debug("%s:%u storage device has no regions yet\n",
__func__, __LINE__);
return -ENODEV;
}
}

result = ps3_repository_read_dev_id(tmp.bus_index, tmp.dev_index,
&tmp.dev_id);

Expand Down

0 comments on commit d51dd3d

Please sign in to comment.