]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/platforms/ps3/repository.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
[linux-2.6-omap-h63xx.git] / arch / powerpc / platforms / ps3 / repository.c
index 8cc37cfea0f22306e487709a0f2f49328f57c952..1c94824f7b6311c632440ceaffbd78d453a8aa90 100644 (file)
@@ -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);