]> git.sur5r.net Git - u-boot/blobdiff - disk/part.c
spi: fsl_qspi: Fix issues on arm64
[u-boot] / disk / part.c
index 978b85c6eb45658c27ee62b6bf8273f025a53db3..543cab8103204e0bc8fcba57e8b1b0474b4fe1bd 100644 (file)
 #define PRINTF(fmt,args...)
 #endif
 
-struct block_drvr {
-       char *name;
-       struct blk_desc* (*get_dev)(int dev);
-       int (*select_hwpart)(int dev_num, int hwpart);
-};
-
-static const struct block_drvr block_drvr[] = {
+const struct block_drvr block_drvr[] = {
 #if defined(CONFIG_CMD_IDE)
        { .name = "ide", .get_dev = ide_get_dev, },
 #endif
@@ -108,7 +102,7 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
                                return dev_desc;
                        if (!select_hwpart)
                                return NULL;
-                       ret = select_hwpart(dev_desc->dev, hwpart);
+                       ret = select_hwpart(dev_desc->devnum, hwpart);
                        if (ret < 0)
                                return NULL;
                        return dev_desc;
@@ -267,13 +261,15 @@ void dev_print (struct blk_desc *dev_desc)
 
 #ifdef HAVE_BLOCK_DEVICE
 
-void init_part(struct blk_desc *dev_desc)
+void part_init(struct blk_desc *dev_desc)
 {
        struct part_driver *drv =
                ll_entry_start(struct part_driver, part_driver);
        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);
+
        dev_desc->part_type = PART_TYPE_UNKNOWN;
        for (entry = drv; entry != drv + n_ents; entry++) {
                int ret;
@@ -325,11 +321,11 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
                break;
        }
        printf (" device %d  --   Partition Type: %s\n\n",
-                       dev_desc->dev, type);
+                       dev_desc->devnum, type);
 #endif /* any CONFIG_..._PARTITION */
 }
 
-void print_part(struct blk_desc *dev_desc)
+void part_print(struct blk_desc *dev_desc)
 {
        struct part_driver *drv;
 
@@ -348,7 +344,7 @@ void print_part(struct blk_desc *dev_desc)
 
 #endif /* HAVE_BLOCK_DEVICE */
 
-int get_partition_info(struct blk_desc *dev_desc, int part,
+int part_get_info(struct blk_desc *dev_desc, int part,
                       disk_partition_t *info)
 {
 #ifdef HAVE_BLOCK_DEVICE
@@ -369,7 +365,8 @@ int get_partition_info(struct blk_desc *dev_desc, int part,
                return -EPROTONOSUPPORT;
        }
        if (!drv->get_info) {
-               PRINTF("## Driver %s does not have the get_info() method\n");
+               PRINTF("## Driver %s does not have the get_info() method\n",
+                      drv->name);
                return -ENOSYS;
        }
        if (drv->get_info(dev_desc, part, info) == 0) {
@@ -432,7 +429,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
         * already loaded.
         */
        if(hwpart != 0)
-               init_part(*dev_desc);
+               part_init(*dev_desc);
 #endif
 
 cleanup:
@@ -457,10 +454,6 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
        int part;
        disk_partition_t tmpinfo;
 
-#if defined CONFIG_SANDBOX && defined CONFIG_CMD_UBIFS
-#error Only one of CONFIG_SANDBOX and CONFIG_CMD_UBIFS may be selected
-#endif
-
 #ifdef CONFIG_SANDBOX
        /*
         * Special-case a pseudo block device "hostfs", to allow access to the
@@ -607,7 +600,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
         * other than "auto", use that partition number directly.
         */
        if (part != PART_AUTO) {
-               ret = get_partition_info(*dev_desc, part, info);
+               ret = part_get_info(*dev_desc, part, info);
                if (ret) {
                        printf("** Invalid partition %d **\n", part);
                        goto cleanup;
@@ -619,7 +612,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
                 */
                part = 0;
                for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
-                       ret = get_partition_info(*dev_desc, p, info);
+                       ret = part_get_info(*dev_desc, p, info);
                        if (ret)
                                continue;