tools: value checks in rkcommon_check_params()
[oweals/u-boot.git] / disk / part_iso.c
index f9a741d2973ba896932753142c3354b27db8f553..822f2c4d9f4084abf7e3424d8face1e55a353108 100644 (file)
@@ -1,16 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2001
  * Denis Peter, MPL AG Switzerland, d.peter@mpl.ch.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <blk.h>
 #include <command.h>
+#include <part.h>
+#include <asm/cache.h>
 #include <asm/unaligned.h>
 #include "part_iso.h"
 
-#ifdef HAVE_BLOCK_DEVICE
+#ifdef CONFIG_HAVE_BLOCK_DEVICE
 
 /* #define     ISO_PART_DEBUG */
 
@@ -24,7 +26,7 @@
 #undef CHECK_FOR_POWERPC_PLATTFORM
 #define CD_SECTSIZE 2048
 
-static unsigned char tmpbuf[CD_SECTSIZE];
+static unsigned char tmpbuf[CD_SECTSIZE] __aligned(ARCH_DMA_MINALIGN);
 
 unsigned long iso_dread(struct blk_desc *block_dev, lbaint_t start,
                         lbaint_t blkcnt, void *buffer)
@@ -47,7 +49,7 @@ unsigned long iso_dread(struct blk_desc *block_dev, lbaint_t start,
 
 /* only boot records will be listed as valid partitions */
 int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
-                          disk_partition_t *info, int verb)
+                          struct disk_partition *info, int verb)
 {
        int i,offset,entry_num;
        unsigned short *chksumbuf;
@@ -137,30 +139,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
        entry_num=1;
        offset=0x20;
        strcpy((char *)info->type, "U-Boot");
-       switch(dev_desc->if_type) {
-               case IF_TYPE_IDE:
-               case IF_TYPE_SATA:
-               case IF_TYPE_ATAPI:
-                       sprintf ((char *)info->name, "hd%c%d",
-                               'a' + dev_desc->devnum, part_num);
-                       break;
-               case IF_TYPE_SCSI:
-                       sprintf ((char *)info->name, "sd%c%d",
-                               'a' + dev_desc->devnum, part_num);
-                       break;
-               case IF_TYPE_USB:
-                       sprintf ((char *)info->name, "usbd%c%d",
-                               'a' + dev_desc->devnum, part_num);
-                       break;
-               case IF_TYPE_DOC:
-                       sprintf ((char *)info->name, "docd%c%d",
-                               'a' + dev_desc->devnum, part_num);
-                       break;
-               default:
-                       sprintf ((char *)info->name, "xx%c%d",
-                               'a' + dev_desc->devnum, part_num);
-                       break;
-       }
+       part_set_generic_name(dev_desc, part_num, (char *)info->name);
        /* the bootcatalog (including validation Entry) is limited to 2048Bytes
         * (63 boot entries + validation entry) */
         while(offset<2048) {
@@ -223,14 +202,14 @@ found:
 }
 
 static int part_get_info_iso(struct blk_desc *dev_desc, int part_num,
-                                 disk_partition_t *info)
+                            struct disk_partition *info)
 {
-       return part_get_info_iso_verb(dev_desc, part_num, info, 1);
+       return part_get_info_iso_verb(dev_desc, part_num, info, 0);
 }
 
 static void part_print_iso(struct blk_desc *dev_desc)
 {
-       disk_partition_t info;
+       struct disk_partition info;
        int i;
 
        if (part_get_info_iso_verb(dev_desc, 1, &info, 0) == -1) {
@@ -249,14 +228,15 @@ static void part_print_iso(struct blk_desc *dev_desc)
 
 static int part_test_iso(struct blk_desc *dev_desc)
 {
-       disk_partition_t info;
+       struct disk_partition info;
 
-       return part_get_info_iso_verb(dev_desc, 1, &info, 1);
+       return part_get_info_iso_verb(dev_desc, 1, &info, 0);
 }
 
 U_BOOT_PART_TYPE(iso) = {
        .name           = "ISO",
        .part_type      = PART_TYPE_ISO,
+       .max_entries    = ISO_ENTRY_NUMBERS,
        .get_info       = part_get_info_iso,
        .print          = part_print_iso,
        .test           = part_test_iso,