Use the word 'uclass' instead of 'if_type' to complete the conversion.
Signed-off-by: Simon Glass <sjg@chromium.org>
if (!desc)
return;
- name = blk_get_if_type_name(desc->if_type);
+ name = blk_get_uclass_name(desc->uclass_id);
devnum = desc->devnum;
len = strlen(buf);
char *endp;
int part, ret;
- desc = blk_get_devnum_by_type(UCLASS_MMC, devnum);
+ desc = blk_get_devnum_by_uclass_id(UCLASS_MMC, devnum);
if (!desc) {
ret = -ENODEV;
goto err_read_fail;
u64 cnt;
int ret;
- desc = blk_get_devnum_by_type(UCLASS_MMC, bcb_dev);
+ desc = blk_get_devnum_by_uclass_id(UCLASS_MMC, bcb_dev);
if (!desc) {
ret = -ENODEV;
goto err;
#include <blk.h>
#include <command.h>
-int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
+int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
int *cur_devnump)
{
- const char *if_name = blk_get_if_type_name(if_type);
+ const char *if_name = blk_get_uclass_name(uclass_id);
switch (argc) {
case 0:
return CMD_RET_USAGE;
case 2:
if (strncmp(argv[1], "inf", 3) == 0) {
- blk_list_devices(if_type);
+ blk_list_devices(uclass_id);
return 0;
} else if (strncmp(argv[1], "dev", 3) == 0) {
- if (blk_print_device_num(if_type, *cur_devnump)) {
+ if (blk_print_device_num(uclass_id, *cur_devnump)) {
printf("\nno %s devices available\n", if_name);
return CMD_RET_FAILURE;
}
return 0;
} else if (strncmp(argv[1], "part", 4) == 0) {
- if (blk_list_part(if_type))
+ if (blk_list_part(uclass_id))
printf("\nno %s partition table available\n",
if_name);
return 0;
if (strncmp(argv[1], "dev", 3) == 0) {
int dev = (int)dectoul(argv[2], NULL);
- if (!blk_show_device(if_type, dev)) {
+ if (!blk_show_device(uclass_id, dev)) {
*cur_devnump = dev;
printf("... is now current device\n");
} else {
} else if (strncmp(argv[1], "part", 4) == 0) {
int dev = (int)dectoul(argv[2], NULL);
- if (blk_print_part_devnum(if_type, dev)) {
+ if (blk_print_part_devnum(uclass_id, dev)) {
printf("\n%s device %d not available\n",
if_name, dev);
return CMD_RET_FAILURE;
printf("\n%s read: device %d block # "LBAFU", count %lu ... ",
if_name, *cur_devnump, blk, cnt);
- n = blk_read_devnum(if_type, *cur_devnump, blk, cnt,
+ n = blk_read_devnum(uclass_id, *cur_devnump, blk, cnt,
(ulong *)addr);
printf("%ld blocks read: %s\n", n,
printf("\n%s write: device %d block # "LBAFU", count %lu ... ",
if_name, *cur_devnump, blk, cnt);
- n = blk_write_devnum(if_type, *cur_devnump, blk, cnt,
+ n = blk_write_devnum(uclass_id, *cur_devnump, blk, cnt,
(ulong *)addr);
printf("%ld blocks written: %s\n", n,
continue;
desc = dev_get_uclass_plat(udev);
printf("%c %s %u", i ? ',' : ':',
- blk_get_if_type_name(desc->if_type),
+ blk_get_uclass_name(desc->uclass_id),
desc->devnum);
i++;
}
#ifdef CONFIG_BLOCK_CACHE
struct blk_desc *bd = mmc_get_blk_desc(mmc);
- blkcache_invalidate(bd->if_type, bd->devnum);
+ blkcache_invalidate(bd->uclass_id, bd->devnum);
#endif
return mmc;
if (!mmc)
return CMD_RET_FAILURE;
- mmc_dev = blk_get_devnum_by_type(UCLASS_MMC, curr_device);
+ mmc_dev = blk_get_devnum_by_uclass_id(UCLASS_MMC, curr_device);
if (mmc_dev != NULL && mmc_dev->type != DEV_TYPE_UNKNOWN) {
part_print(mmc_dev);
return CMD_RET_SUCCESS;
/* try to recognize storage devices immediately */
scsi_scan(false);
- stor_dev = blk_get_devnum_by_type(UCLASS_SCSI, 0);
+ stor_dev = blk_get_devnum_by_uclass_id(UCLASS_SCSI, 0);
if (!stor_dev)
return -ENODEV;
/* try to recognize storage devices immediately */
usb_stor_curr_dev = usb_stor_scan(1);
- stor_dev = blk_get_devnum_by_type(UCLASS_USB, usb_stor_curr_dev);
+ stor_dev = blk_get_devnum_by_uclass_id(UCLASS_USB, usb_stor_curr_dev);
if (!stor_dev)
return -ENODEV;
blkdev = &usb_dev_desc[usb_max_devs];
memset(blkdev, '\0', sizeof(struct blk_desc));
- blkdev->if_type = UCLASS_USB;
+ blkdev->uclass_id = UCLASS_USB;
blkdev->devnum = usb_max_devs;
blkdev->part_type = PART_TYPE_UNKNOWN;
blkdev->target = 0xff;
};
#else
U_BOOT_LEGACY_BLK(usb) = {
- .if_typename = "usb",
- .if_type = UCLASS_USB,
+ .uclass_idname = "usb",
+ .uclass_id = UCLASS_USB,
.max_devs = USB_MAX_STOR_DEV,
.desc = usb_dev_desc,
};
start_in_disk += part->gpt_part_info.start;
}
- if (blkcache_read(block_dev->if_type, block_dev->devnum,
+ if (blkcache_read(block_dev->uclass_id, block_dev->devnum,
start_in_disk, blkcnt, block_dev->blksz, buffer))
return blkcnt;
blks_read = ops->read(dev, start, blkcnt, buffer);
if (blks_read == blkcnt)
- blkcache_fill(block_dev->if_type, block_dev->devnum,
+ blkcache_fill(block_dev->uclass_id, block_dev->devnum,
start_in_disk, blkcnt, block_dev->blksz, buffer);
return blks_read;
if (!ops->write)
return -ENOSYS;
- blkcache_invalidate(block_dev->if_type, block_dev->devnum);
+ blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);
return ops->write(dev, start, blkcnt, buffer);
}
if (!ops->erase)
return -ENOSYS;
- blkcache_invalidate(block_dev->if_type, block_dev->devnum);
+ blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);
return ops->erase(dev, start, blkcnt);
}
if (!blk_enabled())
return NULL;
- dev_desc = blk_get_devnum_by_typename(ifname, dev);
+ dev_desc = blk_get_devnum_by_uclass_idname(ifname, dev);
if (!dev_desc) {
debug("%s: No device for iface '%s', dev %d\n", __func__,
ifname, dev);
return;
}
- switch (dev_desc->if_type) {
+ switch (dev_desc->uclass_id) {
case UCLASS_SCSI:
printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n",
dev_desc->target,dev_desc->lun,
puts("device type unknown\n");
return;
default:
- printf("Unhandled device type: %i\n", dev_desc->if_type);
+ printf("Unhandled device type: %i\n", dev_desc->uclass_id);
return;
}
puts (" Type: ");
const int n_ents = ll_entry_count(struct part_driver, part_driver);
struct part_driver *entry;
- blkcache_invalidate(dev_desc->if_type, dev_desc->devnum);
+ blkcache_invalidate(dev_desc->uclass_id, dev_desc->devnum);
dev_desc->part_type = PART_TYPE_UNKNOWN;
for (entry = drv; entry != drv + n_ents; entry++) {
CONFIG_IS_ENABLED(AMIGA_PARTITION) || \
CONFIG_IS_ENABLED(EFI_PARTITION)
puts ("\nPartition Map for ");
- switch (dev_desc->if_type) {
+ switch (dev_desc->uclass_id) {
case UCLASS_IDE:
puts ("IDE");
break;
* Always should be done, otherwise hw partition 0 will return
* stale data after displaying a non-zero hw partition.
*/
- if ((*dev_desc)->if_type == UCLASS_MMC)
+ if ((*dev_desc)->uclass_id == UCLASS_MMC)
part_init(*dev_desc);
}
{
char *devtype;
- switch (dev_desc->if_type) {
+ switch (dev_desc->uclass_id) {
case UCLASS_IDE:
case UCLASS_AHCI:
devtype = "hd";
interface
The interface used to access the partition's device, like ``mmc`` or
``scsi``. For a full list of supported interfaces, consult the
- ``if_typename_str`` array in ``drivers/block/blk-uclass.c``
+ ``uclass_idname_str`` array in ``drivers/block/blk-uclass.c``
devnum
The device number. This defaults to 0.
for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) {
memset(&sata_dev_desc[i], 0, sizeof(struct blk_desc));
- sata_dev_desc[i].if_type = UCLASS_AHCI;
+ sata_dev_desc[i].uclass_id = UCLASS_AHCI;
sata_dev_desc[i].devnum = i;
sata_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
sata_dev_desc[i].type = DEV_TYPE_HARDDISK;
static struct {
enum uclass_id id;
const char *name;
-} if_typename_str[] = {
+} uclass_idname_str[] = {
{ UCLASS_IDE, "ide" },
{ UCLASS_SCSI, "scsi" },
{ UCLASS_USB, "usb" },
{ UCLASS_PVBLOCK, "pvblock" },
};
-static enum uclass_id if_typename_to_iftype(const char *if_typename)
+static enum uclass_id uclass_name_to_iftype(const char *uclass_idname)
{
int i;
- for (i = 0; i < ARRAY_SIZE(if_typename_str); i++) {
- if (!strcmp(if_typename, if_typename_str[i].name))
- return if_typename_str[i].id;
+ for (i = 0; i < ARRAY_SIZE(uclass_idname_str); i++) {
+ if (!strcmp(uclass_idname, uclass_idname_str[i].name))
+ return uclass_idname_str[i].id;
}
return UCLASS_INVALID;
}
-static enum uclass_id if_type_to_uclass_id(enum uclass_id if_type)
+static enum uclass_id conv_uclass_id(enum uclass_id uclass_id)
{
/*
* This strange adjustment is used because we use UCLASS_MASS_STORAGE
* - rename UCLASS_USB name to "usb_ctlr"
* - use UCLASS_MASS_STORAGE instead of UCLASS_USB in if_typename_str
*/
- if (if_type == UCLASS_USB)
+ if (uclass_id == UCLASS_USB)
return UCLASS_MASS_STORAGE;
-
- return if_type;
+ return uclass_id;
}
-const char *blk_get_if_type_name(enum uclass_id if_type)
+const char *blk_get_uclass_name(enum uclass_id uclass_id)
{
int i;
- for (i = 0; i < ARRAY_SIZE(if_typename_str); i++) {
- if (if_typename_str[i].id == if_type)
- return if_typename_str[i].name;
+ for (i = 0; i < ARRAY_SIZE(uclass_idname_str); i++) {
+ if (uclass_idname_str[i].id == uclass_id)
+ return uclass_idname_str[i].name;
}
return "(none)";
}
-struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum)
+struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnum)
{
struct blk_desc *desc;
struct udevice *dev;
int ret;
- ret = blk_get_device(if_type, devnum, &dev);
+ ret = blk_get_device(uclass_id, devnum, &dev);
if (ret)
return NULL;
desc = dev_get_uclass_plat(dev);
* name in a local table. This gives us an interface type which we can match
* against the uclass of the block device's parent.
*/
-struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum)
+struct blk_desc *blk_get_devnum_by_uclass_idname(const char *uclass_idname, int devnum)
{
enum uclass_id uclass_id;
enum uclass_id type;
struct uclass *uc;
int ret;
- type = if_typename_to_iftype(if_typename);
+ type = uclass_name_to_iftype(uclass_idname);
if (type == UCLASS_INVALID) {
debug("%s: Unknown interface type '%s'\n", __func__,
- if_typename);
+ uclass_idname);
return NULL;
}
- uclass_id = if_type_to_uclass_id(type);
+ uclass_id = conv_uclass_id(type);
if (uclass_id == UCLASS_INVALID) {
debug("%s: Unknown uclass for interface type'\n",
- blk_get_if_type_name(type));
+ blk_get_uclass_name(type));
return NULL;
}
uclass_foreach_dev(dev, uc) {
struct blk_desc *desc = dev_get_uclass_plat(dev);
- debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__,
- type, devnum, dev->name, desc->if_type, desc->devnum);
+ debug("%s: uclass_id=%d, devnum=%d: %s, %d, %d\n", __func__,
+ type, devnum, dev->name, desc->uclass_id, desc->devnum);
if (desc->devnum != devnum)
continue;
/**
* get_desc() - Get the block device descriptor for the given device number
*
- * @if_type: Interface type
+ * @uclass_id: Interface type
* @devnum: Device number (0 = first)
* @descp: Returns block device descriptor on success
* Return: 0 on success, -ENODEV if there is no such device and no device
* with a higher device number, -ENOENT if there is no such device but there
* is one with a higher number, or other -ve on other error.
*/
-static int get_desc(enum uclass_id if_type, int devnum, struct blk_desc **descp)
+static int get_desc(enum uclass_id uclass_id, int devnum, struct blk_desc **descp)
{
bool found_more = false;
struct udevice *dev;
uclass_foreach_dev(dev, uc) {
struct blk_desc *desc = dev_get_uclass_plat(dev);
- debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__,
- if_type, devnum, dev->name, desc->if_type, desc->devnum);
- if (desc->if_type == if_type) {
+ debug("%s: uclass_id=%d, devnum=%d: %s, %d, %d\n", __func__,
+ uclass_id, devnum, dev->name, desc->uclass_id, desc->devnum);
+ if (desc->uclass_id == uclass_id) {
if (desc->devnum == devnum) {
ret = device_probe(dev);
if (ret)
return found_more ? -ENOENT : -ENODEV;
}
-int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int hwpart)
+int blk_select_hwpart_devnum(enum uclass_id uclass_id, int devnum, int hwpart)
{
struct udevice *dev;
int ret;
- ret = blk_get_device(if_type, devnum, &dev);
+ ret = blk_get_device(uclass_id, devnum, &dev);
if (ret)
return ret;
return blk_select_hwpart(dev, hwpart);
}
-int blk_list_part(enum uclass_id if_type)
+int blk_list_part(enum uclass_id uclass_id)
{
struct blk_desc *desc;
int devnum, ok;
int ret;
for (ok = 0, devnum = 0;; ++devnum) {
- ret = get_desc(if_type, devnum, &desc);
+ ret = get_desc(uclass_id, devnum, &desc);
if (ret == -ENODEV)
break;
else if (ret)
return 0;
}
-int blk_print_part_devnum(enum uclass_id if_type, int devnum)
+int blk_print_part_devnum(enum uclass_id uclass_id, int devnum)
{
struct blk_desc *desc;
int ret;
- ret = get_desc(if_type, devnum, &desc);
+ ret = get_desc(uclass_id, devnum, &desc);
if (ret)
return ret;
if (desc->type == DEV_TYPE_UNKNOWN)
return 0;
}
-void blk_list_devices(enum uclass_id if_type)
+void blk_list_devices(enum uclass_id uclass_id)
{
struct blk_desc *desc;
int ret;
int i;
for (i = 0;; ++i) {
- ret = get_desc(if_type, i, &desc);
+ ret = get_desc(uclass_id, i, &desc);
if (ret == -ENODEV)
break;
else if (ret)
}
}
-int blk_print_device_num(enum uclass_id if_type, int devnum)
+int blk_print_device_num(enum uclass_id uclass_id, int devnum)
{
struct blk_desc *desc;
int ret;
- ret = get_desc(if_type, devnum, &desc);
+ ret = get_desc(uclass_id, devnum, &desc);
if (ret)
return ret;
printf("\nIDE device %d: ", devnum);
return 0;
}
-int blk_show_device(enum uclass_id if_type, int devnum)
+int blk_show_device(enum uclass_id uclass_id, int devnum)
{
struct blk_desc *desc;
int ret;
printf("\nDevice %d: ", devnum);
- ret = get_desc(if_type, devnum, &desc);
+ ret = get_desc(uclass_id, devnum, &desc);
if (ret == -ENODEV || ret == -ENOENT) {
printf("unknown device\n");
return -ENODEV;
return 0;
}
-ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
+ulong blk_read_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start,
lbaint_t blkcnt, void *buffer)
{
struct blk_desc *desc;
ulong n;
int ret;
- ret = get_desc(if_type, devnum, &desc);
+ ret = get_desc(uclass_id, devnum, &desc);
if (ret)
return ret;
n = blk_dread(desc, start, blkcnt, buffer);
return n;
}
-ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
+ulong blk_write_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start,
lbaint_t blkcnt, const void *buffer)
{
struct blk_desc *desc;
int ret;
- ret = get_desc(if_type, devnum, &desc);
+ ret = get_desc(uclass_id, devnum, &desc);
if (ret)
return ret;
return blk_dwrite(desc, start, blkcnt, buffer);
return blk_select_hwpart(desc->bdev, hwpart);
}
-int blk_first_device(int if_type, struct udevice **devp)
+int blk_first_device(int uclass_id, struct udevice **devp)
{
struct blk_desc *desc;
int ret;
return -ENODEV;
do {
desc = dev_get_uclass_plat(*devp);
- if (desc->if_type == if_type)
+ if (desc->uclass_id == uclass_id)
return 0;
ret = uclass_find_next_device(devp);
if (ret)
int blk_next_device(struct udevice **devp)
{
struct blk_desc *desc;
- int ret, if_type;
+ int ret, uclass_id;
desc = dev_get_uclass_plat(*devp);
- if_type = desc->if_type;
+ uclass_id = desc->uclass_id;
do {
ret = uclass_find_next_device(devp);
if (ret)
if (!*devp)
return -ENODEV;
desc = dev_get_uclass_plat(*devp);
- if (desc->if_type == if_type)
+ if (desc->uclass_id == uclass_id)
return 0;
} while (1);
}
-int blk_find_device(int if_type, int devnum, struct udevice **devp)
+int blk_find_device(int uclass_id, int devnum, struct udevice **devp)
{
struct uclass *uc;
struct udevice *dev;
uclass_foreach_dev(dev, uc) {
struct blk_desc *desc = dev_get_uclass_plat(dev);
- debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__,
- if_type, devnum, dev->name, desc->if_type, desc->devnum);
- if (desc->if_type == if_type && desc->devnum == devnum) {
+ debug("%s: uclass_id=%d, devnum=%d: %s, %d, %d\n", __func__,
+ uclass_id, devnum, dev->name, desc->uclass_id, desc->devnum);
+ if (desc->uclass_id == uclass_id && desc->devnum == devnum) {
*devp = dev;
return 0;
}
return -ENODEV;
}
-int blk_get_device(int if_type, int devnum, struct udevice **devp)
+int blk_get_device(int uclass_id, int devnum, struct udevice **devp)
{
int ret;
- ret = blk_find_device(if_type, devnum, devp);
+ ret = blk_find_device(uclass_id, devnum, devp);
if (ret)
return ret;
if (!ops->read)
return -ENOSYS;
- if (blkcache_read(block_dev->if_type, block_dev->devnum,
+ if (blkcache_read(block_dev->uclass_id, block_dev->devnum,
start, blkcnt, block_dev->blksz, buffer))
return blkcnt;
blks_read = ops->read(dev, start, blkcnt, buffer);
if (blks_read == blkcnt)
- blkcache_fill(block_dev->if_type, block_dev->devnum,
+ blkcache_fill(block_dev->uclass_id, block_dev->devnum,
start, blkcnt, block_dev->blksz, buffer);
return blks_read;
if (!ops->write)
return -ENOSYS;
- blkcache_invalidate(block_dev->if_type, block_dev->devnum);
+ blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);
return ops->write(dev, start, blkcnt, buffer);
}
if (!ops->erase)
return -ENOSYS;
- blkcache_invalidate(block_dev->if_type, block_dev->devnum);
+ blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);
return ops->erase(dev, start, blkcnt);
}
return uclass_get_name(device_get_uclass_id(parent));
};
-int blk_find_max_devnum(enum uclass_id if_type)
+int blk_find_max_devnum(enum uclass_id uclass_id)
{
struct udevice *dev;
int max_devnum = -ENODEV;
uclass_foreach_dev(dev, uc) {
struct blk_desc *desc = dev_get_uclass_plat(dev);
- if (desc->if_type == if_type && desc->devnum > max_devnum)
+ if (desc->uclass_id == uclass_id && desc->devnum > max_devnum)
max_devnum = desc->devnum;
}
return max_devnum;
}
-int blk_next_free_devnum(enum uclass_id if_type)
+int blk_next_free_devnum(enum uclass_id uclass_id)
{
int ret;
- ret = blk_find_max_devnum(if_type);
+ ret = blk_find_max_devnum(uclass_id);
if (ret == -ENODEV)
return 0;
if (ret < 0)
return count;
}
-static int blk_claim_devnum(enum uclass_id if_type, int devnum)
+static int blk_claim_devnum(enum uclass_id uclass_id, int devnum)
{
struct udevice *dev;
struct uclass *uc;
uclass_foreach_dev(dev, uc) {
struct blk_desc *desc = dev_get_uclass_plat(dev);
- if (desc->if_type == if_type && desc->devnum == devnum) {
- int next = blk_next_free_devnum(if_type);
+ if (desc->uclass_id == uclass_id && desc->devnum == devnum) {
+ int next = blk_next_free_devnum(uclass_id);
if (next < 0)
return next;
}
int blk_create_device(struct udevice *parent, const char *drv_name,
- const char *name, int if_type, int devnum, int blksz,
+ const char *name, int uclass_id, int devnum, int blksz,
lbaint_t lba, struct udevice **devp)
{
struct blk_desc *desc;
int ret;
if (devnum == -1) {
- devnum = blk_next_free_devnum(if_type);
+ devnum = blk_next_free_devnum(uclass_id);
} else {
- ret = blk_claim_devnum(if_type, devnum);
+ ret = blk_claim_devnum(uclass_id, devnum);
if (ret < 0 && ret != -ENOENT)
return ret;
}
if (ret)
return ret;
desc = dev_get_uclass_plat(dev);
- desc->if_type = if_type;
+ desc->uclass_id = uclass_id;
desc->blksz = blksz;
desc->log2blksz = LOG2(desc->blksz);
desc->lba = lba;
}
int blk_create_devicef(struct udevice *parent, const char *drv_name,
- const char *name, int if_type, int devnum, int blksz,
+ const char *name, int uclass_id, int devnum, int blksz,
lbaint_t lba, struct udevice **devp)
{
char dev_name[30], *str;
if (!str)
return -ENOMEM;
- ret = blk_create_device(parent, drv_name, str, if_type, devnum,
+ ret = blk_create_device(parent, drv_name, str, uclass_id, devnum,
blksz, lba, devp);
if (ret) {
free(str);
return ret;
}
-int blk_unbind_all(int if_type)
+int blk_unbind_all(int uclass_id)
{
struct uclass *uc;
struct udevice *dev, *next;
uclass_foreach_dev_safe(dev, next, uc) {
struct blk_desc *desc = dev_get_uclass_plat(dev);
- if (desc->if_type == if_type) {
+ if (desc->uclass_id == uclass_id) {
ret = device_remove(dev, DM_REMOVE_NORMAL);
if (ret)
return ret;
#include <part.h>
#include <linux/err.h>
-struct blk_driver *blk_driver_lookup_type(int if_type)
+struct blk_driver *blk_driver_lookup_type(int uclass_id)
{
struct blk_driver *drv = ll_entry_start(struct blk_driver, blk_driver);
const int n_ents = ll_entry_count(struct blk_driver, blk_driver);
struct blk_driver *entry;
for (entry = drv; entry != drv + n_ents; entry++) {
- if (if_type == entry->if_type)
+ if (uclass_id == entry->uclass_id)
return entry;
}
return NULL;
}
-static struct blk_driver *blk_driver_lookup_typename(const char *if_typename)
+static struct blk_driver *blk_driver_lookup_typename(const char *uclass_idname)
{
struct blk_driver *drv = ll_entry_start(struct blk_driver, blk_driver);
const int n_ents = ll_entry_count(struct blk_driver, blk_driver);
struct blk_driver *entry;
for (entry = drv; entry != drv + n_ents; entry++) {
- if (!strcmp(if_typename, entry->if_typename))
+ if (!strcmp(uclass_idname, entry->uclass_idname))
return entry;
}
return NULL;
}
-const char *blk_get_if_type_name(enum uclass_id if_type)
+const char *blk_get_uclass_name(enum uclass_id uclass_id)
{
- struct blk_driver *drv = blk_driver_lookup_type(if_type);
+ struct blk_driver *drv = blk_driver_lookup_type(uclass_id);
- return drv ? drv->if_typename : NULL;
+ return drv ? drv->uclass_idname : NULL;
}
/**
return drv->get_dev(devnum, descp);
}
-int blk_list_part(enum uclass_id if_type)
+int blk_list_part(enum uclass_id uclass_id)
{
struct blk_driver *drv;
struct blk_desc *desc;
int devnum, ok;
bool first = true;
- drv = blk_driver_lookup_type(if_type);
+ drv = blk_driver_lookup_type(uclass_id);
if (!drv)
return -ENOSYS;
for (ok = 0, devnum = 0; devnum < drv->max_devs; ++devnum) {
return 0;
}
-int blk_print_part_devnum(enum uclass_id if_type, int devnum)
+int blk_print_part_devnum(enum uclass_id uclass_id, int devnum)
{
- struct blk_driver *drv = blk_driver_lookup_type(if_type);
+ struct blk_driver *drv = blk_driver_lookup_type(uclass_id);
struct blk_desc *desc;
int ret;
return 0;
}
-void blk_list_devices(enum uclass_id if_type)
+void blk_list_devices(enum uclass_id uclass_id)
{
- struct blk_driver *drv = blk_driver_lookup_type(if_type);
+ struct blk_driver *drv = blk_driver_lookup_type(uclass_id);
struct blk_desc *desc;
int i;
}
}
-int blk_print_device_num(enum uclass_id if_type, int devnum)
+int blk_print_device_num(enum uclass_id uclass_id, int devnum)
{
- struct blk_driver *drv = blk_driver_lookup_type(if_type);
+ struct blk_driver *drv = blk_driver_lookup_type(uclass_id);
struct blk_desc *desc;
int ret;
ret = get_desc(drv, devnum, &desc);
if (ret)
return ret;
- printf("\n%s device %d: ", drv->if_typename, devnum);
+ printf("\n%s device %d: ", drv->uclass_idname, devnum);
dev_print(desc);
return 0;
}
-int blk_show_device(enum uclass_id if_type, int devnum)
+int blk_show_device(enum uclass_id uclass_id, int devnum)
{
- struct blk_driver *drv = blk_driver_lookup_type(if_type);
+ struct blk_driver *drv = blk_driver_lookup_type(uclass_id);
struct blk_desc *desc;
int ret;
return 0;
}
-struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum)
+struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnum)
{
- struct blk_driver *drv = blk_driver_lookup_type(if_type);
+ struct blk_driver *drv = blk_driver_lookup_type(uclass_id);
struct blk_desc *desc;
if (!drv)
int blk_dselect_hwpart(struct blk_desc *desc, int hwpart)
{
- struct blk_driver *drv = blk_driver_lookup_type(desc->if_type);
+ struct blk_driver *drv = blk_driver_lookup_type(desc->uclass_id);
if (!drv)
return -ENOSYS;
return 0;
}
-struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum)
+struct blk_desc *blk_get_devnum_by_uclass_idname(const char *uclass_idname, int devnum)
{
- struct blk_driver *drv = blk_driver_lookup_typename(if_typename);
+ struct blk_driver *drv = blk_driver_lookup_typename(uclass_idname);
struct blk_desc *desc;
if (!drv)
return desc;
}
-ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
+ulong blk_read_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start,
lbaint_t blkcnt, void *buffer)
{
- struct blk_driver *drv = blk_driver_lookup_type(if_type);
+ struct blk_driver *drv = blk_driver_lookup_type(uclass_id);
struct blk_desc *desc;
ulong n;
int ret;
return n;
}
-ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
+ulong blk_write_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start,
lbaint_t blkcnt, const void *buffer)
{
- struct blk_driver *drv = blk_driver_lookup_type(if_type);
+ struct blk_driver *drv = blk_driver_lookup_type(uclass_id);
struct blk_desc *desc;
int ret;
return desc->block_write(desc, start, blkcnt, buffer);
}
-int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int hwpart)
+int blk_select_hwpart_devnum(enum uclass_id uclass_id, int devnum, int hwpart)
{
- struct blk_driver *drv = blk_driver_lookup_type(if_type);
+ struct blk_driver *drv = blk_driver_lookup_type(uclass_id);
struct blk_desc *desc;
int ret;
/* Select device
*/
ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
- dev_desc->if_type = UCLASS_IDE;
+ dev_desc->uclass_id = UCLASS_IDE;
#ifdef CONFIG_ATAPI
retries = 0;
for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; ++i) {
ide_dev_desc[i].type = DEV_TYPE_UNKNOWN;
- ide_dev_desc[i].if_type = UCLASS_IDE;
+ ide_dev_desc[i].uclass_id = UCLASS_IDE;
ide_dev_desc[i].devnum = i;
ide_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
ide_dev_desc[i].blksz = 0;
};
#else
U_BOOT_LEGACY_BLK(ide) = {
- .if_typename = "ide",
- .if_type = UCLASS_IDE,
+ .uclass_idname = "ide",
+ .uclass_id = UCLASS_IDE,
.max_devs = CONFIG_SYS_IDE_MAXDEVICE,
.desc = ide_dev_desc,
};
goto err_file;
}
- desc = blk_get_devnum_by_type(UCLASS_ROOT, devnum);
+ desc = blk_get_devnum_by_uclass_id(UCLASS_ROOT, devnum);
desc->removable = removable;
snprintf(desc->vendor, BLK_VEN_SIZE, "U-Boot");
snprintf(desc->product, BLK_PRD_SIZE, "hostfile");
}
struct blk_desc *blk_dev = &host_dev->blk_dev;
- blk_dev->if_type = UCLASS_ROOT;
+ blk_dev->uclass_id = UCLASS_ROOT;
blk_dev->priv = host_dev;
blk_dev->blksz = 512;
blk_dev->lba = os_lseek(host_dev->fd, 0, OS_SEEK_END) / blk_dev->blksz;
};
#else
U_BOOT_LEGACY_BLK(sandbox_host) = {
- .if_typename = "host",
- .if_type = UCLASS_ROOT,
+ .uclass_idname = "host",
+ .uclass_id = UCLASS_ROOT,
.max_devs = SANDBOX_HOST_MAX_DEVICES,
.get_dev = host_get_dev_err,
};
ret = mmc_switch_part(mmc, hwpart);
if (!ret)
- blkcache_invalidate(desc->if_type, desc->devnum);
+ blkcache_invalidate(desc->uclass_id, desc->devnum);
return ret;
}
.dsr_imp = 0,
.dsr = 0xffffffff,
.block_dev = {
- .if_type = UCLASS_MMC,
+ .uclass_id = UCLASS_MMC,
.removable = 1,
.devnum = 0,
.block_read = mmc_bread,
mmc->dsr = 0xffffffff;
/* Setup the universal parts of the block interface just once */
bdesc = mmc_get_blk_desc(mmc);
- bdesc->if_type = UCLASS_MMC;
+ bdesc->uclass_id = UCLASS_MMC;
bdesc->removable = 1;
bdesc->devnum = mmc_get_next_devnum();
bdesc->block_read = mmc_bread;
}
U_BOOT_LEGACY_BLK(mmc) = {
- .if_typename = "mmc",
- .if_type = UCLASS_MMC,
+ .uclass_idname = "mmc",
+ .uclass_id = UCLASS_MMC,
.max_devs = -1,
.get_dev = mmc_get_dev,
.select_hwpart = mmc_select_hwpartp,
if (!enetc_has_imdio(dev))
return 0;
- if (priv->if_type == PHY_INTERFACE_MODE_2500BASEX)
+ if (priv->uclass_id == PHY_INTERFACE_MODE_2500BASEX)
is2500 = true;
/*
struct enetc_priv *priv = dev_get_priv(dev);
u32 if_mode;
- switch (priv->if_type) {
+ switch (priv->uclass_id) {
case PHY_INTERFACE_MODE_RGMII:
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID:
return;
}
- priv->if_type = dev_read_phy_mode(dev);
- if (priv->if_type == PHY_INTERFACE_MODE_NA) {
+ priv->uclass_id = dev_read_phy_mode(dev);
+ if (priv->uclass_id == PHY_INTERFACE_MODE_NA) {
enetc_dbg(dev,
"phy-mode property not found, defaulting to SGMII\n");
- priv->if_type = PHY_INTERFACE_MODE_SGMII;
+ priv->uclass_id = PHY_INTERFACE_MODE_SGMII;
}
- switch (priv->if_type) {
+ switch (priv->uclass_id) {
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_2500BASEX:
enetc_init_sgmii(dev);
struct bd_ring tx_bdr;
struct bd_ring rx_bdr;
- int if_type;
+ int uclass_id;
struct mii_dev imdio;
struct phy_device *phy;
};
{
dev_desc->lba = 0;
dev_desc->blksz = 0;
- dev_desc->if_type = UCLASS_SCSI;
+ dev_desc->uclass_id = UCLASS_SCSI;
dev_desc->devnum = devnum;
dev_desc->part_type = PART_TYPE_UNKNOWN;
};
#else
U_BOOT_LEGACY_BLK(scsi) = {
- .if_typename = "scsi",
- .if_type = UCLASS_SCSI,
+ .uclass_idname = "scsi",
+ .uclass_id = UCLASS_SCSI,
.max_devs = SCSI_MAX_DEVICE,
.desc = scsi_dev_desc,
};
struct blk_desc *desc = dev_get_uclass_plat(dev);
int devnum;
- desc->if_type = UCLASS_VIRTIO;
+ desc->uclass_id = UCLASS_VIRTIO;
/*
* Initialize the devnum to -ENODEV. This is to make sure that
* blk_next_free_devnum() works as expected, since the default
struct blk_desc *desc = dev_get_uclass_plat(udev);
int devnum;
- desc->if_type = UCLASS_PVBLOCK;
+ desc->uclass_id = UCLASS_PVBLOCK;
/*
* Initialize the devnum to -ENODEV. This is to make sure that
* blk_next_free_devnum() works as expected, since the default
}
if (blk_enabled()) {
- printf("Interface: %s\n", blk_get_if_type_name(cur_dev->if_type));
+ printf("Interface: %s\n", blk_get_uclass_name(cur_dev->uclass_id));
printf(" Device %d: ", cur_dev->devnum);
dev_print(cur_dev);
}
* TODO: With driver model we should be able to use the parent
* device's uclass instead.
*/
- enum uclass_id if_type; /* type of the interface */
+ enum uclass_id uclass_id; /* type of the interface */
int devnum; /* device number */
unsigned char part_type; /* partition type */
unsigned char target; /* target SCSI ID */
/**
* blkcache_read() - attempt to read a set of blocks from cache
*
- * @param iftype - IF_TYPE_x for type of device
+ * @param iftype - uclass_id_x for type of device
* @param dev - device index of particular type
* @param start - starting block number
* @param blkcnt - number of blocks to read
* blkcache_fill() - make data read from a block device available
* to the block cache
*
- * @param iftype - IF_TYPE_x for type of device
+ * @param iftype - uclass_id_x for type of device
* @param dev - device index of particular type
* @param start - starting block number
* @param blkcnt - number of blocks available
* blkcache_invalidate() - discard the cache for a set of blocks
* because of a write or device (re)initialization.
*
- * @param iftype - IF_TYPE_x for type of device
+ * @param iftype - uclass_id_x for type of device
* @param dev - device index of particular type
*/
void blkcache_invalidate(int iftype, int dev);
* This function does not activate the device. The device will be returned
* whether or not it is activated.
*
- * @if_type: Interface type (enum uclass_id_t)
+ * @uclass_id: Interface type (enum uclass_id_t)
* @devnum: Device number (specific to each interface type)
* @devp: the device, if found
* Return: 0 if found, -ENODEV if no device found, or other -ve error value
*/
-int blk_find_device(int if_type, int devnum, struct udevice **devp);
+int blk_find_device(int uclass_id, int devnum, struct udevice **devp);
/**
* blk_get_device() - Find and probe a block device ready for use
*
- * @if_type: Interface type (enum uclass_id_t)
+ * @uclass_id: Interface type (enum uclass_id_t)
* @devnum: Device number (specific to each interface type)
* @devp: the device, if found
* Return: 0 if found, -ENODEV if no device found, or other -ve error value
*/
-int blk_get_device(int if_type, int devnum, struct udevice **devp);
+int blk_get_device(int uclass_id, int devnum, struct udevice **devp);
/**
* blk_first_device() - Find the first device for a given interface
* @devp: the device, if found
* Return: 0 if found, -ENODEV if no device, or other -ve error value
*/
-int blk_first_device(int if_type, struct udevice **devp);
+int blk_first_device(int uclass_id, struct udevice **devp);
/**
* blk_next_device() - Find the next device for a given interface
* @parent: Parent of the new device
* @drv_name: Driver name to use for the block device
* @name: Name for the device
- * @if_type: Interface type (enum uclass_id_t)
+ * @uclass_id: Interface type (enum uclass_id_t)
* @devnum: Device number, specific to the interface type, or -1 to
* allocate the next available number
* @blksz: Block size of the device in bytes (typically 512)
* @devp: the new device (which has not been probed)
*/
int blk_create_device(struct udevice *parent, const char *drv_name,
- const char *name, int if_type, int devnum, int blksz,
+ const char *name, int uclass_id, int devnum, int blksz,
lbaint_t lba, struct udevice **devp);
/**
* @parent: Parent of the new device
* @drv_name: Driver name to use for the block device
* @name: Name for the device (parent name is prepended)
- * @if_type: Interface type (enum uclass_id_t)
+ * @uclass_id: Interface type (enum uclass_id_t)
* @devnum: Device number, specific to the interface type, or -1 to
* allocate the next available number
* @blksz: Block size of the device in bytes (typically 512)
* @devp: the new device (which has not been probed)
*/
int blk_create_devicef(struct udevice *parent, const char *drv_name,
- const char *name, int if_type, int devnum, int blksz,
+ const char *name, int uclass_id, int devnum, int blksz,
lbaint_t lba, struct udevice **devp);
/**
*
* The devices are removed and then unbound.
*
- * @if_type: Interface type to unbind
+ * @uclass_id: Interface type to unbind
* Return: 0 if OK, -ve on error
*/
-int blk_unbind_all(int if_type);
+int blk_unbind_all(int uclass_id);
/**
* blk_find_max_devnum() - find the maximum device number for an interface type
*
- * Finds the last allocated device number for an interface type @if_type. The
+ * Finds the last allocated device number for an interface type @uclass_id. The
* next number is safe to use for a newly allocated device.
*
- * @if_type: Interface type to scan
+ * @uclass_id: Interface type to scan
* Return: maximum device number found, or -ENODEV if none, or other -ve on
* error
*/
-int blk_find_max_devnum(enum uclass_id if_type);
+int blk_find_max_devnum(enum uclass_id uclass_id);
/**
* blk_next_free_devnum() - get the next device number for an interface type
*
* Finds the next number that is safe to use for a newly allocated device for
- * an interface type @if_type.
+ * an interface type @uclass_id.
*
- * @if_type: Interface type to scan
+ * @uclass_id: Interface type to scan
* Return: next device number safe to use, or -ve on error
*/
-int blk_next_free_devnum(enum uclass_id if_type);
+int blk_next_free_devnum(enum uclass_id uclass_id);
/**
* blk_select_hwpart() - select a hardware partition
lbaint_t blkcnt, void *buffer)
{
ulong blks_read;
- if (blkcache_read(block_dev->if_type, block_dev->devnum,
+ if (blkcache_read(block_dev->uclass_id, block_dev->devnum,
start, blkcnt, block_dev->blksz, buffer))
return blkcnt;
*/
blks_read = block_dev->block_read(block_dev, start, blkcnt, buffer);
if (blks_read == blkcnt)
- blkcache_fill(block_dev->if_type, block_dev->devnum,
+ blkcache_fill(block_dev->uclass_id, block_dev->devnum,
start, blkcnt, block_dev->blksz, buffer);
return blks_read;
static inline ulong blk_dwrite(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, const void *buffer)
{
- blkcache_invalidate(block_dev->if_type, block_dev->devnum);
+ blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);
return block_dev->block_write(block_dev, start, blkcnt, buffer);
}
static inline ulong blk_derase(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt)
{
- blkcache_invalidate(block_dev->if_type, block_dev->devnum);
+ blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);
return block_dev->block_erase(block_dev, start, blkcnt);
}
* driver should be provided using U_BOOT_LEGACY_BLK() for each interface
* type that is to be supported.
*
- * @if_typename: Interface type name
- * @if_type: Interface type
+ * @uclass_idname: Interface type name
+ * @uclass_id: Interface type
* @max_devs: Maximum number of devices supported
* @desc: Pointer to list of devices for this interface type,
* or NULL to use @get_dev() instead
*/
struct blk_driver {
- const char *if_typename;
- enum uclass_id if_type;
+ const char *uclass_idname;
+ enum uclass_id uclass_id;
int max_devs;
struct blk_desc *desc;
/**
#define U_BOOT_LEGACY_BLK(__name) \
ll_entry_declare(struct blk_driver, __name, blk_driver)
-struct blk_driver *blk_driver_lookup_type(int if_type);
+struct blk_driver *blk_driver_lookup_type(int uclass_id);
#endif /* !CONFIG_BLK */
/**
- * blk_get_devnum_by_typename() - Get a block device by type and number
+ * blk_get_devnum_by_uclass_idname() - Get a block device by type and number
*
* This looks through the available block devices of the given type, returning
* the one with the given @devnum.
*
- * @if_type: Block device type
+ * @uclass_id: Block device type
* @devnum: Device number
* Return: point to block device descriptor, or NULL if not found
*/
-struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum);
+struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnum);
/**
- * blk_get_devnum_by_type() - Get a block device by type name, and number
+ * blk_get_devnum_by_uclass_id() - Get a block device by type name, and number
*
- * This looks up the block device type based on @if_typename, then calls
- * blk_get_devnum_by_type().
+ * This looks up the block device type based on @uclass_idname, then calls
+ * blk_get_devnum_by_uclass_id().
*
- * @if_typename: Block device type name
+ * @uclass_idname: Block device type name
* @devnum: Device number
* Return: point to block device descriptor, or NULL if not found
*/
-struct blk_desc *blk_get_devnum_by_typename(const char *if_typename,
+struct blk_desc *blk_get_devnum_by_uclass_idname(const char *uclass_idname,
int devnum);
/**
/**
* blk_list_part() - list the partitions for block devices of a given type
*
- * This looks up the partition type for each block device of type @if_type,
+ * This looks up the partition type for each block device of type @uclass_id,
* then displays a list of partitions.
*
- * @if_type: Block device type
+ * @uclass_id: Block device type
* Return: 0 if OK, -ENODEV if there is none of that type
*/
-int blk_list_part(enum uclass_id if_type);
+int blk_list_part(enum uclass_id uclass_id);
/**
* blk_list_devices() - list the block devices of a given type
*
- * This lists each block device of the type @if_type, showing the capacity
+ * This lists each block device of the type @uclass_id, showing the capacity
* as well as type-specific information.
*
- * @if_type: Block device type
+ * @uclass_id: Block device type
*/
-void blk_list_devices(enum uclass_id if_type);
+void blk_list_devices(enum uclass_id uclass_id);
/**
* blk_show_device() - show information about a given block device
*
* This shows the block device capacity as well as type-specific information.
*
- * @if_type: Block device type
+ * @uclass_id: Block device type
* @devnum: Device number
* Return: 0 if OK, -ENODEV for invalid device number
*/
-int blk_show_device(enum uclass_id if_type, int devnum);
+int blk_show_device(enum uclass_id uclass_id, int devnum);
/**
* blk_print_device_num() - show information about a given block device
* This is similar to blk_show_device() but returns an error if the block
* device type is unknown.
*
- * @if_type: Block device type
+ * @uclass_id: Block device type
* @devnum: Device number
* Return: 0 if OK, -ENODEV for invalid device number, -ENOENT if the block
* device is not connected
*/
-int blk_print_device_num(enum uclass_id if_type, int devnum);
+int blk_print_device_num(enum uclass_id uclass_id, int devnum);
/**
* blk_print_part_devnum() - print the partition information for a device
*
- * @if_type: Block device type
+ * @uclass_id: Block device type
* @devnum: Device number
* Return: 0 if OK, -ENOENT if the block device is not connected, -ENOSYS if
* the interface type is not supported, other -ve on other error
*/
-int blk_print_part_devnum(enum uclass_id if_type, int devnum);
+int blk_print_part_devnum(enum uclass_id uclass_id, int devnum);
/**
* blk_read_devnum() - read blocks from a device
*
- * @if_type: Block device type
+ * @uclass_id: Block device type
* @devnum: Device number
* @blkcnt: Number of blocks to read
* @buffer: Address to write data to
* Return: number of blocks read, or -ve error number on error
*/
-ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
+ulong blk_read_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start,
lbaint_t blkcnt, void *buffer);
/**
* blk_write_devnum() - write blocks to a device
*
- * @if_type: Block device type
+ * @uclass_id: Block device type
* @devnum: Device number
* @blkcnt: Number of blocks to write
* @buffer: Address to read data from
* Return: number of blocks written, or -ve error number on error
*/
-ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
+ulong blk_write_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start,
lbaint_t blkcnt, const void *buffer);
/**
* This is similar to blk_dselect_hwpart() but it looks up the interface and
* device number.
*
- * @if_type: Block device type
+ * @uclass_id: Block device type
* @devnum: Device number
* @hwpart: Partition number to select
* Return: 0 if OK, -ve on error
*/
-int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int hwpart);
+int blk_select_hwpart_devnum(enum uclass_id uclass_id, int devnum, int hwpart);
/**
- * blk_get_if_type_name() - Get the name of an interface type
+ * blk_get_uclass_name() - Get the name of an interface type
*
- * @if_type: Interface type to check
+ * @uclass_id: Interface type to check
* Return: name of interface, or NULL if none
*/
-const char *blk_get_if_type_name(enum uclass_id if_type);
+const char *blk_get_uclass_name(enum uclass_id uclass_id);
/**
* blk_common_cmd() - handle common commands with block devices
*
* @args: Number of arguments to the command (argv[0] is the command itself)
* @argv: Command arguments
- * @if_type: Interface type
+ * @uclass_id: Interface type
* @cur_devnump: Current device number for this interface type
* Return: 0 if OK, CMD_RET_ERROR on error
*/
-int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
+int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
int *cur_devnump);
enum blk_flag_t {
/* EFI system partition */
extern struct efi_system_partition {
- enum uclass_id if_type;
+ enum uclass_id uclass_id;
int devnum;
u8 part;
} efi_system_partition;
struct efi_loaded_image *loaded_image_info);
/* Create handles and protocols for the partitions of a block device */
int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
- const char *if_typename, int diskid,
+ const char *uclass_idname, int diskid,
const char *pdevname);
/* Called by bootefi to make GOP (graphical) interface available */
efi_status_t efi_gop_register(void);
diskobj->media.last_block);
/* Store first EFI system partition */
- if (part && !efi_system_partition.if_type) {
+ if (part && !efi_system_partition.uclass_id) {
if (part_info->bootable & PART_EFI_SYSTEM_PARTITION) {
- efi_system_partition.if_type = desc->if_type;
+ efi_system_partition.uclass_id = desc->uclass_id;
efi_system_partition.devnum = desc->devnum;
efi_system_partition.part = part;
EFI_PRINT("EFI system partition: %s %x:%x\n",
- blk_get_if_type_name(desc->if_type),
+ blk_get_uclass_name(desc->uclass_id),
desc->devnum, part);
}
}
* has already created an efi_disk at this moment.
*/
desc = dev_get_uclass_plat(dev);
- if (desc->if_type != UCLASS_EFI_LOADER) {
+ if (desc->uclass_id != UCLASS_EFI_LOADER) {
ret = efi_disk_create_raw(dev);
if (ret)
return -1;
return -1;
desc = dev_get_uclass_plat(dev);
- if (desc->if_type != UCLASS_EFI_LOADER) {
+ if (desc->uclass_id != UCLASS_EFI_LOADER) {
diskobj = container_of(handle, struct efi_disk_obj, header);
efi_free_pool(diskobj->dp);
}
} else {
return EFI_INVALID_PARAMETER;
}
- if_typename = blk_get_if_type_name(desc->if_type);
+ if_typename = blk_get_uclass_name(desc->uclass_id);
diskid = desc->devnum;
if (is_partition) {
char part_str[PART_STR_LEN];
int r;
- if (efi_system_partition.if_type == UCLASS_INVALID) {
+ if (efi_system_partition.uclass_id == UCLASS_INVALID) {
log_err("No EFI system partition\n");
return EFI_DEVICE_ERROR;
}
snprintf(part_str, PART_STR_LEN, "%x:%x",
efi_system_partition.devnum, efi_system_partition.part);
- r = fs_set_blk_dev(blk_get_if_type_name(efi_system_partition.if_type),
+ r = fs_set_blk_dev(blk_get_uclass_name(efi_system_partition.uclass_id),
part_str, FS_TYPE_ANY);
if (r) {
log_err("Cannot read EFI system partition\n");