{
#ifdef CONFIG_AHCI
struct udevice *dev;
- struct udevice *blk;
int rc;
rc = uclass_get_device(UCLASS_AHCI, devnum, &dev);
return CMD_RET_FAILURE;
}
- rc = blk_get_from_parent(dev, &blk);
- if (!rc) {
- struct blk_desc *desc = dev_get_uclass_platdata(blk);
-
- if (desc->lba > 0 && desc->blksz > 0)
- part_init(desc);
- }
-
return 0;
#else
return sata_initialize() < 0 ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
blkdev->lun = lun;
ret = usb_stor_get_info(udev, data, blkdev);
- if (ret == 1)
- ret = blk_prepare_device(dev);
- if (!ret) {
+ if (ret == 1) {
usb_max_devs++;
debug("%s: Found device %p\n", __func__, udev);
} else {
return 0;
}
+static int blk_post_probe(struct udevice *dev)
+{
+#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT)
+ struct blk_desc *desc = dev_get_uclass_platdata(dev);
+
+ part_init(desc);
+#endif
+
+ return 0;
+}
+
UCLASS_DRIVER(blk) = {
.id = UCLASS_BLK,
.name = "blk",
+ .post_probe = blk_post_probe,
.per_device_platdata_auto_alloc_size = sizeof(struct blk_desc),
};
BLK_REV_SIZE);
desc->revision[BLK_REV_SIZE] = '\0';
- part_init(desc);
-
return 0;
}
goto err_file;
}
- return blk_prepare_device(dev);
+ return 0;
err_file:
os_close(fd);
err:
bdesc->product[0] = 0;
bdesc->revision[0] = 0;
#endif
-#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT)
- part_init(bdesc);
-#endif
return 0;
}
sprintf(desc->vendor, "0x%.4x", pplat->vendor);
memcpy(desc->product, ndev->serial, sizeof(ndev->serial));
memcpy(desc->revision, ndev->firmware_rev, sizeof(ndev->firmware_rev));
- part_init(desc);
return 0;
}
memcpy(&bdesc->vendor, &bd.vendor, sizeof(bd.vendor));
memcpy(&bdesc->product, &bd.product, sizeof(bd.product));
memcpy(&bdesc->revision, &bd.revision, sizeof(bd.revision));
- part_init(bdesc);
if (verbose) {
printf(" Device %d: ", 0);
return ret;
EFI_PRINT("%s: block device '%s' created\n", __func__, bdev->name);
- ret = blk_prepare_device(bdev);
-
/* Create handles for the partions of the block device */
disks = efi_bl_bind_partitions(handle, bdev);
EFI_PRINT("Found %d partitions\n", disks);