Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
[platform/kernel/u-boot.git] / disk / part.c
index 5705c22..5ee60a7 100644 (file)
@@ -61,7 +61,7 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
 
        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);
@@ -120,7 +120,7 @@ void dev_print(struct blk_desc *dev_desc)
                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,
@@ -139,7 +139,7 @@ void dev_print(struct blk_desc *dev_desc)
        case UCLASS_USB:
        case UCLASS_NVME:
        case UCLASS_PVBLOCK:
-       case UCLASS_ROOT:
+       case UCLASS_HOST:
                printf ("Vendor: %s Rev: %s Prod: %s\n",
                        dev_desc->vendor,
                        dev_desc->revision,
@@ -155,7 +155,7 @@ void dev_print(struct blk_desc *dev_desc)
                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: ");
@@ -225,7 +225,7 @@ void part_init(struct blk_desc *dev_desc)
        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++) {
@@ -248,7 +248,7 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
        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;
@@ -264,7 +264,7 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
        case UCLASS_MMC:
                puts ("MMC");
                break;
-       case UCLASS_ROOT:
+       case UCLASS_HOST:
                puts ("HOST");
                break;
        case UCLASS_NVME:
@@ -408,7 +408,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
                 * 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);
        }
 
@@ -433,48 +433,35 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
        int part;
        struct disk_partition tmpinfo;
 
+       *dev_desc = NULL;
+       memset(info, 0, sizeof(*info));
+
 #if IS_ENABLED(CONFIG_SANDBOX) || IS_ENABLED(CONFIG_SEMIHOSTING)
        /*
         * Special-case a pseudo block device "hostfs", to allow access to the
         * host's own filesystem.
         */
-       if (0 == strcmp(ifname, "hostfs")) {
-               *dev_desc = NULL;
-               info->start = 0;
-               info->size = 0;
-               info->blksz = 0;
-               info->bootable = 0;
+       if (!strcmp(ifname, "hostfs")) {
                strcpy((char *)info->type, BOOT_PART_TYPE);
                strcpy((char *)info->name, "Host filesystem");
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-               info->uuid[0] = 0;
-#endif
-#ifdef CONFIG_PARTITION_TYPE_GUID
-               info->type_guid[0] = 0;
-#endif
 
                return 0;
        }
 #endif
 
-#ifdef CONFIG_CMD_UBIFS
+#if IS_ENABLED(CONFIG_CMD_UBIFS) && !IS_ENABLED(CONFIG_SPL_BUILD)
        /*
         * Special-case ubi, ubi goes through a mtd, rather than through
         * a regular block device.
         */
-       if (0 == strcmp(ifname, "ubi")) {
+       if (!strcmp(ifname, "ubi")) {
                if (!ubifs_is_mounted()) {
                        printf("UBIFS not mounted, use ubifsmount to mount volume first!\n");
                        return -EINVAL;
                }
 
-               *dev_desc = NULL;
-               memset(info, 0, sizeof(*info));
                strcpy((char *)info->type, BOOT_PART_TYPE);
                strcpy((char *)info->name, "UBI");
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-               info->uuid[0] = 0;
-#endif
                return 0;
        }
 #endif
@@ -762,7 +749,7 @@ void part_set_generic_name(const struct blk_desc *dev_desc,
 {
        char *devtype;
 
-       switch (dev_desc->if_type) {
+       switch (dev_desc->uclass_id) {
        case UCLASS_IDE:
        case UCLASS_AHCI:
                devtype = "hd";