summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bmp.c12
-rw-r--r--cmd/cbfs.c5
-rw-r--r--cmd/cramfs.c5
-rw-r--r--cmd/disk.c12
-rw-r--r--cmd/fat.c12
-rw-r--r--cmd/gpt.c10
-rw-r--r--cmd/host.c13
-rw-r--r--cmd/ide.c44
-rw-r--r--cmd/mmc.c4
-rw-r--r--cmd/mmc_spi.c4
-rw-r--r--cmd/part.c24
-rw-r--r--cmd/read.c10
-rw-r--r--cmd/reiser.c12
-rw-r--r--cmd/sata.c22
-rw-r--r--cmd/scsi.c24
-rw-r--r--cmd/tpm.c4
-rw-r--r--cmd/unzip.c4
-rw-r--r--cmd/usb.c12
-rw-r--r--cmd/usb_mass_storage.c10
-rw-r--r--cmd/zfs.c10
20 files changed, 125 insertions, 128 deletions
diff --git a/cmd/bmp.c b/cmd/bmp.c
index 01b3d39..fb6fe3f 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -246,18 +246,14 @@ int bmp_display(ulong addr, int x, int y)
addr = map_to_sysmem(bmp);
#ifdef CONFIG_DM_VIDEO
- ret = uclass_first_device(UCLASS_VIDEO, &dev);
+ ret = uclass_first_device_err(UCLASS_VIDEO, &dev);
if (!ret) {
- if (!dev)
- ret = -ENODEV;
- if (!ret) {
- bool align = false;
+ bool align = false;
# ifdef CONFIG_SPLASH_SCREEN_ALIGN
- align = true;
+ align = true;
# endif /* CONFIG_SPLASH_SCREEN_ALIGN */
- ret = video_bmp_display(dev, addr, x, y, align);
- }
+ ret = video_bmp_display(dev, addr, x, y, align);
}
#elif defined(CONFIG_LCD)
ret = lcd_display_bitmap(addr, x, y);
diff --git a/cmd/cbfs.c b/cmd/cbfs.c
index 35d8a7a..779e9c0 100644
--- a/cmd/cbfs.c
+++ b/cmd/cbfs.c
@@ -103,7 +103,7 @@ int do_cbfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
printf(" size type name\n");
printf("------------------------------------------\n");
while (file) {
- u32 type = file_cbfs_type(file);
+ int type = file_cbfs_type(file);
char *type_name = NULL;
const char *filename = file_cbfs_name(file);
@@ -140,7 +140,8 @@ int do_cbfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
case CBFS_COMPONENT_CMOS_LAYOUT:
type_name = "cmos layout";
break;
- case -1UL:
+ case -1:
+ case 0:
type_name = "null";
break;
}
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index 270701b..c103491 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -29,7 +29,6 @@
# define DEBUGF(fmt, args...)
#endif
-#ifdef CONFIG_CRAMFS_CMDLINE
#include <flash.h>
#ifdef CONFIG_SYS_NO_FLASH
@@ -201,7 +200,3 @@ U_BOOT_CMD(
"[ directory ]\n"
" - list files in a directory.\n"
);
-
-#endif /* #ifdef CONFIG_CRAMFS_CMDLINE */
-
-/***************************************************/
diff --git a/cmd/disk.c b/cmd/disk.c
index 106f2d1..2fd1717 100644
--- a/cmd/disk.c
+++ b/cmd/disk.c
@@ -20,7 +20,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
image_header_t *hdr;
#endif
- block_dev_desc_t *dev_desc;
+ struct blk_desc *dev_desc;
#if CONFIG_IS_ENABLED(FIT)
const void *fit_hdr = NULL;
@@ -38,14 +38,14 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
bootstage_mark(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
- part = get_device_and_partition(intf, (argc == 3) ? argv[2] : NULL,
+ part = blk_get_device_part_str(intf, (argc == 3) ? argv[2] : NULL,
&dev_desc, &info, 1);
if (part < 0) {
bootstage_error(BOOTSTAGE_ID_IDE_TYPE);
return 1;
}
- dev = dev_desc->dev;
+ dev = dev_desc->devnum;
bootstage_mark(BOOTSTAGE_ID_IDE_TYPE);
printf("\nLoading from %s device %d, partition %d: "
@@ -56,7 +56,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
", Block Size: %ld\n",
info.start, info.size, info.blksz);
- if (dev_desc->block_read(dev_desc, info.start, 1, (ulong *)addr) != 1) {
+ if (blk_dread(dev_desc, info.start, 1, (ulong *)addr) != 1) {
printf("** Read error on %d:%d\n", dev, part);
bootstage_error(BOOTSTAGE_ID_IDE_PART_READ);
return 1;
@@ -100,8 +100,8 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
cnt /= info.blksz;
cnt -= 1;
- if (dev_desc->block_read(dev_desc, info.start + 1, cnt,
- (ulong *)(addr + info.blksz)) != cnt) {
+ if (blk_dread(dev_desc, info.start + 1, cnt,
+ (ulong *)(addr + info.blksz)) != cnt) {
printf("** Read error on %d:%d\n", dev, part);
bootstage_error(BOOTSTAGE_ID_IDE_READ);
return 1;
diff --git a/cmd/fat.c b/cmd/fat.c
index aae993d..4e20746 100644
--- a/cmd/fat.c
+++ b/cmd/fat.c
@@ -69,7 +69,7 @@ static int do_fat_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
int dev, part;
- block_dev_desc_t *dev_desc;
+ struct blk_desc *dev_desc;
disk_partition_t info;
if (argc < 2) {
@@ -77,11 +77,11 @@ static int do_fat_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc,
return 0;
}
- part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
+ part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
- dev = dev_desc->dev;
+ dev = dev_desc->devnum;
if (fat_set_blk_dev(dev_desc, &info) != 0) {
printf("\n** Unable to use %s %d:%d for fatinfo **\n",
argv[1], dev, part);
@@ -105,7 +105,7 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
int ret;
unsigned long addr;
unsigned long count;
- block_dev_desc_t *dev_desc = NULL;
+ struct blk_desc *dev_desc = NULL;
disk_partition_t info;
int dev = 0;
int part = 1;
@@ -114,11 +114,11 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
if (argc < 5)
return cmd_usage(cmdtp);
- part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
+ part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
- dev = dev_desc->dev;
+ dev = dev_desc->devnum;
if (fat_set_blk_dev(dev_desc, &info) != 0) {
printf("\n** Unable to use %s %d:%d for fatwrite **\n",
diff --git a/cmd/gpt.c b/cmd/gpt.c
index d94d553..8ffaef3 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -168,7 +168,7 @@ static bool found_key(const char *str, const char *key)
* @return - zero on success, otherwise error
*
*/
-static int set_gpt_info(block_dev_desc_t *dev_desc,
+static int set_gpt_info(struct blk_desc *dev_desc,
const char *str_part,
char **str_disk_guid,
disk_partition_t **partitions,
@@ -328,7 +328,7 @@ err:
return errno;
}
-static int gpt_default(block_dev_desc_t *blk_dev_desc, const char *str_part)
+static int gpt_default(struct blk_desc *blk_dev_desc, const char *str_part)
{
int ret;
char *str_disk_guid;
@@ -356,7 +356,7 @@ static int gpt_default(block_dev_desc_t *blk_dev_desc, const char *str_part)
return ret;
}
-static int gpt_verify(block_dev_desc_t *blk_dev_desc, const char *str_part)
+static int gpt_verify(struct blk_desc *blk_dev_desc, const char *str_part)
{
ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1,
blk_dev_desc->blksz);
@@ -408,7 +408,7 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int ret = CMD_RET_SUCCESS;
int dev = 0;
char *ep;
- block_dev_desc_t *blk_dev_desc = NULL;
+ struct blk_desc *blk_dev_desc = NULL;
if (argc < 4 || argc > 5)
return CMD_RET_USAGE;
@@ -418,7 +418,7 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("'%s' is not a number\n", argv[3]);
return CMD_RET_USAGE;
}
- blk_dev_desc = get_dev(argv[2], dev);
+ blk_dev_desc = blk_get_dev(argv[2], dev);
if (!blk_dev_desc) {
printf("%s: %s dev %d NOT available\n",
__func__, argv[2], dev);
diff --git a/cmd/host.c b/cmd/host.c
index ba1460e..8d84415 100644
--- a/cmd/host.c
+++ b/cmd/host.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <dm.h>
#include <fs.h>
#include <part.h>
#include <sandboxblockdev.h>
@@ -67,7 +68,7 @@ static int do_host_info(cmd_tbl_t *cmdtp, int flag, int argc,
int dev;
printf("%3s %12s %s\n", "dev", "blocks", "path");
for (dev = min_dev; dev <= max_dev; dev++) {
- block_dev_desc_t *blk_dev;
+ struct blk_desc *blk_dev;
int ret;
printf("%3d ", dev);
@@ -80,7 +81,13 @@ static int do_host_info(cmd_tbl_t *cmdtp, int flag, int argc,
continue;
}
- struct host_block_dev *host_dev = blk_dev->priv;
+ struct host_block_dev *host_dev;
+
+#ifdef CONFIG_BLK
+ host_dev = dev_get_priv(blk_dev->bdev);
+#else
+ host_dev = blk_dev->priv;
+#endif
printf("%12lu %s\n", (unsigned long)blk_dev->lba,
host_dev->filename);
}
@@ -92,7 +99,7 @@ static int do_host_dev(cmd_tbl_t *cmdtp, int flag, int argc,
{
int dev;
char *ep;
- block_dev_desc_t *blk_dev;
+ struct blk_desc *blk_dev;
int ret;
if (argc < 1 || argc > 3)
diff --git a/cmd/ide.c b/cmd/ide.c
index f19a7ce..c4c08c8 100644
--- a/cmd/ide.c
+++ b/cmd/ide.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <blk.h>
#include <config.h>
#include <watchdog.h>
#include <command.h>
@@ -53,7 +54,7 @@ ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS] = {
static int ide_bus_ok[CONFIG_SYS_IDE_MAXBUS];
-block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
+struct blk_desc ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
/* ------------------------------------------------------------------------- */
#ifdef CONFIG_IDE_RESET
@@ -62,7 +63,7 @@ static void ide_reset (void);
#define ide_reset() /* dummy */
#endif
-static void ide_ident (block_dev_desc_t *dev_desc);
+static void ide_ident(struct blk_desc *dev_desc);
static uchar ide_wait (int dev, ulong t);
#define IDE_TIME_OUT 2000 /* 2 sec timeout */
@@ -78,8 +79,8 @@ static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len
#endif
#ifdef CONFIG_ATAPI
-static void atapi_inquiry(block_dev_desc_t *dev_desc);
-static ulong atapi_read(block_dev_desc_t *block_dev, lbaint_t blknr,
+static void atapi_inquiry(struct blk_desc *dev_desc);
+static ulong atapi_read(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, void *buffer);
#endif
@@ -137,7 +138,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
++ok;
if (dev)
putc('\n');
- print_part(&ide_dev_desc[dev]);
+ part_print(&ide_dev_desc[dev]);
}
}
if (!ok) {
@@ -171,7 +172,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
int dev = (int) simple_strtoul(argv[2], NULL, 10);
if (ide_dev_desc[dev].part_type != PART_TYPE_UNKNOWN) {
- print_part(&ide_dev_desc[dev]);
+ part_print(&ide_dev_desc[dev]);
} else {
printf("\nIDE device %d not available\n",
dev);
@@ -187,7 +188,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (strcmp(argv[1], "read") == 0) {
ulong addr = simple_strtoul(argv[2], NULL, 16);
ulong cnt = simple_strtoul(argv[4], NULL, 16);
- block_dev_desc_t *dev_desc;
+ struct blk_desc *dev_desc;
ulong n;
#ifdef CONFIG_SYS_64BIT_LBA
@@ -203,8 +204,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
#endif
dev_desc = &ide_dev_desc[curr_device];
- n = dev_desc->block_read(dev_desc, blk, cnt,
- (ulong *)addr);
+ n = blk_dread(dev_desc, blk, cnt, (ulong *)addr);
/* flush cache after read */
flush_cache(addr,
cnt * ide_dev_desc[curr_device].blksz);
@@ -418,7 +418,7 @@ void ide_init(void)
int led = (IDE_BUS(i) == 0) ? LED_IDE1 : LED_IDE2;
ide_dev_desc[i].type = DEV_TYPE_UNKNOWN;
ide_dev_desc[i].if_type = IF_TYPE_IDE;
- ide_dev_desc[i].dev = i;
+ ide_dev_desc[i].devnum = i;
ide_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
ide_dev_desc[i].blksz = 0;
ide_dev_desc[i].log2blksz =
@@ -435,7 +435,7 @@ void ide_init(void)
if ((ide_dev_desc[i].lba > 0) && (ide_dev_desc[i].blksz > 0)) {
/* initialize partition type */
- init_part(&ide_dev_desc[i]);
+ part_init(&ide_dev_desc[i]);
if (curr_device < 0)
curr_device = i;
}
@@ -446,7 +446,7 @@ void ide_init(void)
/* ------------------------------------------------------------------------- */
#ifdef CONFIG_PARTITIONS
-block_dev_desc_t *ide_get_dev(int dev)
+struct blk_desc *ide_get_dev(int dev)
{
return (dev < CONFIG_SYS_IDE_MAXDEVICE) ? &ide_dev_desc[dev] : NULL;
}
@@ -541,7 +541,7 @@ __weak void ide_input_data(int dev, ulong *sect_buf, int words)
/* -------------------------------------------------------------------------
*/
-static void ide_ident(block_dev_desc_t *dev_desc)
+static void ide_ident(struct blk_desc *dev_desc)
{
unsigned char c;
hd_driveid_t iop;
@@ -551,7 +551,7 @@ static void ide_ident(block_dev_desc_t *dev_desc)
#endif
int device;
- device = dev_desc->dev;
+ device = dev_desc->devnum;
printf(" Device %d: ", device);
ide_led(DEVICE_LED(device), 1); /* LED on */
@@ -713,10 +713,10 @@ static void ide_ident(block_dev_desc_t *dev_desc)
/* ------------------------------------------------------------------------- */
-ulong ide_read(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
+ulong ide_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
void *buffer)
{
- int device = block_dev->dev;
+ int device = block_dev->devnum;
ulong n = 0;
unsigned char c;
unsigned char pwrsave = 0; /* power save */
@@ -839,10 +839,10 @@ IDE_READ_E:
/* ------------------------------------------------------------------------- */
-ulong ide_write(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
+ulong ide_write(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
const void *buffer)
{
- int device = block_dev->dev;
+ int device = block_dev->devnum;
ulong n = 0;
unsigned char c;
@@ -1301,14 +1301,14 @@ error:
}
-static void atapi_inquiry(block_dev_desc_t *dev_desc)
+static void atapi_inquiry(struct blk_desc *dev_desc)
{
unsigned char ccb[12]; /* Command descriptor block */
unsigned char iobuf[64]; /* temp buf */
unsigned char c;
int device;
- device = dev_desc->dev;
+ device = dev_desc->devnum;
dev_desc->type = DEV_TYPE_UNKNOWN; /* not yet valid */
dev_desc->block_read = atapi_read;
@@ -1394,10 +1394,10 @@ static void atapi_inquiry(block_dev_desc_t *dev_desc)
#define ATAPI_READ_BLOCK_SIZE 2048 /* assuming CD part */
#define ATAPI_READ_MAX_BLOCK (ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE)
-ulong atapi_read(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
+ulong atapi_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
void *buffer)
{
- int device = block_dev->dev;
+ int device = block_dev->devnum;
ulong n = 0;
unsigned char ccb[12]; /* Command descriptor block */
ulong cnt;
diff --git a/cmd/mmc.c b/cmd/mmc.c
index 1c7156f..fb4382e 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -424,7 +424,7 @@ static int do_mmc_rescan(cmd_tbl_t *cmdtp, int flag,
static int do_mmc_part(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
{
- block_dev_desc_t *mmc_dev;
+ struct blk_desc *mmc_dev;
struct mmc *mmc;
mmc = init_mmc_device(curr_device, false);
@@ -433,7 +433,7 @@ static int do_mmc_part(cmd_tbl_t *cmdtp, int flag,
mmc_dev = mmc_get_dev(curr_device);
if (mmc_dev != NULL && mmc_dev->type != DEV_TYPE_UNKNOWN) {
- print_part(mmc_dev);
+ part_print(mmc_dev);
return CMD_RET_SUCCESS;
}
diff --git a/cmd/mmc_spi.c b/cmd/mmc_spi.c
index a2138b8..0c44d06 100644
--- a/cmd/mmc_spi.c
+++ b/cmd/mmc_spi.c
@@ -72,8 +72,8 @@ static int do_mmc_spi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("Failed to create MMC Device\n");
return 1;
}
- printf("%s: %d at %u:%u hz %u mode %u\n", mmc->cfg->name, mmc->block_dev.dev,
- bus, cs, speed, mode);
+ printf("%s: %d at %u:%u hz %u mode %u\n", mmc->cfg->name,
+ mmc->block_dev.devnum, bus, cs, speed, mode);
mmc_init(mmc);
return 0;
diff --git a/cmd/part.c b/cmd/part.c
index 5599509..414031e 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -29,7 +29,7 @@
static int do_part_uuid(int argc, char * const argv[])
{
int part;
- block_dev_desc_t *dev_desc;
+ struct blk_desc *dev_desc;
disk_partition_t info;
if (argc < 2)
@@ -37,7 +37,7 @@ static int do_part_uuid(int argc, char * const argv[])
if (argc > 3)
return CMD_RET_USAGE;
- part = get_device_and_partition(argv[0], argv[1], &dev_desc, &info, 0);
+ part = blk_get_device_part_str(argv[0], argv[1], &dev_desc, &info, 0);
if (part < 0)
return 1;
@@ -52,7 +52,7 @@ static int do_part_uuid(int argc, char * const argv[])
static int do_part_list(int argc, char * const argv[])
{
int ret;
- block_dev_desc_t *desc;
+ struct blk_desc *desc;
char *var = NULL;
bool bootable = false;
int i;
@@ -81,7 +81,7 @@ static int do_part_list(int argc, char * const argv[])
return CMD_RET_USAGE;
}
- ret = get_device(argv[0], argv[1], &desc);
+ ret = blk_get_device_by_str(argv[0], argv[1], &desc);
if (ret < 0)
return 1;
@@ -92,7 +92,7 @@ static int do_part_list(int argc, char * const argv[])
for (p = 1; p < 128; p++) {
char t[5];
- int r = get_partition_info(desc, p, &info);
+ int r = part_get_info(desc, p, &info);
if (r != 0)
continue;
@@ -107,14 +107,14 @@ static int do_part_list(int argc, char * const argv[])
return 0;
}
- print_part(desc);
+ part_print(desc);
return 0;
}
static int do_part_start(int argc, char * const argv[])
{
- block_dev_desc_t *desc;
+ struct blk_desc *desc;
disk_partition_t info;
char buf[512] = { 0 };
int part;
@@ -128,11 +128,11 @@ static int do_part_start(int argc, char * const argv[])
part = simple_strtoul(argv[2], NULL, 0);
- ret = get_device(argv[0], argv[1], &desc);
+ ret = blk_get_device_by_str(argv[0], argv[1], &desc);
if (ret < 0)
return 1;
- err = get_partition_info(desc, part, &info);
+ err = part_get_info(desc, part, &info);
if (err)
return 1;
@@ -148,7 +148,7 @@ static int do_part_start(int argc, char * const argv[])
static int do_part_size(int argc, char * const argv[])
{
- block_dev_desc_t *desc;
+ struct blk_desc *desc;
disk_partition_t info;
char buf[512] = { 0 };
int part;
@@ -162,11 +162,11 @@ static int do_part_size(int argc, char * const argv[])
part = simple_strtoul(argv[2], NULL, 0);
- ret = get_device(argv[0], argv[1], &desc);
+ ret = blk_get_device_by_str(argv[0], argv[1], &desc);
if (ret < 0)
return 1;
- err = get_partition_info(desc, part, &info);
+ err = part_get_info(desc, part, &info);
if (err)
return 1;
diff --git a/cmd/read.c b/cmd/read.c
index 8710288..61d8ce7 100644
--- a/cmd/read.c
+++ b/cmd/read.c
@@ -15,7 +15,7 @@
int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char *ep;
- block_dev_desc_t *dev_desc = NULL;
+ struct blk_desc *dev_desc = NULL;
int dev;
int part = 0;
disk_partition_t part_info;
@@ -39,7 +39,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
part = (int)simple_strtoul(++ep, NULL, 16);
}
- dev_desc = get_dev(argv[1], dev);
+ dev_desc = blk_get_dev(argv[1], dev);
if (dev_desc == NULL) {
printf("Block device %s %d not supported\n", argv[1], dev);
return 1;
@@ -50,14 +50,14 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
cnt = simple_strtoul(argv[5], NULL, 16);
if (part != 0) {
- if (get_partition_info(dev_desc, part, &part_info)) {
+ if (part_get_info(dev_desc, part, &part_info)) {
printf("Cannot find partition %d\n", part);
return 1;
}
offset = part_info.start;
limit = part_info.size;
} else {
- /* Largest address not available in block_dev_desc_t. */
+ /* Largest address not available in struct blk_desc. */
limit = ~0;
}
@@ -66,7 +66,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
}
- if (dev_desc->block_read(dev_desc, offset + blk, cnt, addr) < 0) {
+ if (blk_read(dev_desc, offset + blk, cnt, addr) < 0) {
printf("Error reading blocks\n");
return 1;
}
diff --git a/cmd/reiser.c b/cmd/reiser.c
index 8871564..cbdad36 100644
--- a/cmd/reiser.c
+++ b/cmd/reiser.c
@@ -34,13 +34,13 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char *filename = "/";
int dev, part;
- block_dev_desc_t *dev_desc=NULL;
+ struct blk_desc *dev_desc = NULL;
disk_partition_t info;
if (argc < 3)
return CMD_RET_USAGE;
- part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
+ part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
@@ -48,7 +48,7 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
filename = argv[3];
}
- dev = dev_desc->dev;
+ dev = dev_desc->devnum;
PRINTF("Using device %s %d:%d, directory: %s\n", argv[1], dev, part, filename);
reiserfs_set_blk_dev(dev_desc, &info);
@@ -82,7 +82,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int dev, part;
ulong addr = 0, filelen;
disk_partition_t info;
- block_dev_desc_t *dev_desc = NULL;
+ struct blk_desc *dev_desc = NULL;
unsigned long count;
char *addr_str;
@@ -122,11 +122,11 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
}
- part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
+ part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
- dev = dev_desc->dev;
+ dev = dev_desc->devnum;
printf("Loading file \"%s\" from %s device %d%c%c\n",
filename, argv[1], dev,
diff --git a/cmd/sata.c b/cmd/sata.c
index 76bacea..c8de9a3 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -16,18 +16,18 @@
#include <sata.h>
static int sata_curr_device = -1;
-block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
+struct blk_desc sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
-static unsigned long sata_bread(block_dev_desc_t *block_dev, lbaint_t start,
+static unsigned long sata_bread(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, void *dst)
{
- return sata_read(block_dev->dev, start, blkcnt, dst);
+ return sata_read(block_dev->devnum, start, blkcnt, dst);
}
-static unsigned long sata_bwrite(block_dev_desc_t *block_dev, lbaint_t start,
+static unsigned long sata_bwrite(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, const void *buffer)
{
- return sata_write(block_dev->dev, start, blkcnt, buffer);
+ return sata_write(block_dev->devnum, start, blkcnt, buffer);
}
int __sata_initialize(void)
@@ -36,9 +36,9 @@ int __sata_initialize(void)
int i;
for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) {
- memset(&sata_dev_desc[i], 0, sizeof(struct block_dev_desc));
+ memset(&sata_dev_desc[i], 0, sizeof(struct blk_desc));
sata_dev_desc[i].if_type = IF_TYPE_SATA;
- sata_dev_desc[i].dev = i;
+ sata_dev_desc[i].devnum = i;
sata_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
sata_dev_desc[i].type = DEV_TYPE_HARDDISK;
sata_dev_desc[i].lba = 0;
@@ -52,7 +52,7 @@ int __sata_initialize(void)
rc = scan_sata(i);
if (!rc && (sata_dev_desc[i].lba > 0) &&
(sata_dev_desc[i].blksz > 0))
- init_part(&sata_dev_desc[i]);
+ part_init(&sata_dev_desc[i]);
}
}
sata_curr_device = 0;
@@ -75,7 +75,7 @@ __weak int __sata_stop(void)
int sata_stop(void) __attribute__((weak, alias("__sata_stop")));
#ifdef CONFIG_PARTITIONS
-block_dev_desc_t *sata_get_dev(int dev)
+struct blk_desc *sata_get_dev(int dev)
{
return (dev < CONFIG_SYS_SATA_MAX_DEVICE) ? &sata_dev_desc[dev] : NULL;
}
@@ -131,7 +131,7 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
++ok;
if (dev)
putc ('\n');
- print_part(&sata_dev_desc[dev]);
+ part_print(&sata_dev_desc[dev]);
}
}
if (!ok) {
@@ -164,7 +164,7 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int dev = (int)simple_strtoul(argv[2], NULL, 10);
if (sata_dev_desc[dev].part_type != PART_TYPE_UNKNOWN) {
- print_part(&sata_dev_desc[dev]);
+ part_print(&sata_dev_desc[dev]);
} else {
printf("\nSATA device %d not available\n", dev);
rc = 1;
diff --git a/cmd/scsi.c b/cmd/scsi.c
index bc7d1b6..951d1e5 100644
--- a/cmd/scsi.c
+++ b/cmd/scsi.c
@@ -48,7 +48,7 @@ static int scsi_max_devs; /* number of highest available scsi device */
static int scsi_curr_dev; /* current device */
-static block_dev_desc_t scsi_dev_desc[CONFIG_SYS_SCSI_MAX_DEVICE];
+static struct blk_desc scsi_dev_desc[CONFIG_SYS_SCSI_MAX_DEVICE];
/********************************************************************************
* forward declerations of some Setup Routines
@@ -66,9 +66,9 @@ void scsi_ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len);
static int scsi_read_capacity(ccb *pccb, lbaint_t *capacity,
unsigned long *blksz);
-static ulong scsi_read(block_dev_desc_t *block_dev, lbaint_t blknr,
+static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, void *buffer);
-static ulong scsi_write(block_dev_desc_t *block_dev, lbaint_t blknr,
+static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, const void *buffer);
@@ -99,7 +99,7 @@ void scsi_scan(int mode)
scsi_dev_desc[i].revision[0]=0;
scsi_dev_desc[i].removable = false;
scsi_dev_desc[i].if_type=IF_TYPE_SCSI;
- scsi_dev_desc[i].dev=i;
+ scsi_dev_desc[i].devnum = i;
scsi_dev_desc[i].part_type=PART_TYPE_UNKNOWN;
scsi_dev_desc[i].block_read=scsi_read;
scsi_dev_desc[i].block_write = scsi_write;
@@ -156,7 +156,7 @@ void scsi_scan(int mode)
scsi_dev_desc[scsi_max_devs].log2blksz =
LOG2(scsi_dev_desc[scsi_max_devs].blksz);
scsi_dev_desc[scsi_max_devs].type=perq;
- init_part(&scsi_dev_desc[scsi_max_devs]);
+ part_init(&scsi_dev_desc[scsi_max_devs]);
removable:
if(mode==1) {
printf (" Device %d: ", scsi_max_devs);
@@ -239,7 +239,7 @@ void scsi_init(void)
#endif
#ifdef CONFIG_PARTITIONS
-block_dev_desc_t * scsi_get_dev(int dev)
+struct blk_desc *scsi_get_dev(int dev)
{
return (dev < CONFIG_SYS_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL;
}
@@ -301,7 +301,7 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (dev)
printf("\n");
debug ("print_part of %x\n",dev);
- print_part(&scsi_dev_desc[dev]);
+ part_print(&scsi_dev_desc[dev]);
}
}
if (!ok)
@@ -329,7 +329,7 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (strncmp(argv[1],"part",4) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
if(scsi_dev_desc[dev].type != DEV_TYPE_UNKNOWN) {
- print_part(&scsi_dev_desc[dev]);
+ part_print(&scsi_dev_desc[dev]);
}
else {
printf ("\nSCSI device %d not available\n", dev);
@@ -376,10 +376,10 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#define SCSI_MAX_READ_BLK 0xFFFF
#define SCSI_LBA48_READ 0xFFFFFFF
-static ulong scsi_read(block_dev_desc_t *block_dev, lbaint_t blknr,
+static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, void *buffer)
{
- int device = block_dev->dev;
+ int device = block_dev->devnum;
lbaint_t start, blks;
uintptr_t buf_addr;
unsigned short smallblks = 0;
@@ -443,10 +443,10 @@ static ulong scsi_read(block_dev_desc_t *block_dev, lbaint_t blknr,
/* Almost the maximum amount of the scsi_ext command.. */
#define SCSI_MAX_WRITE_BLK 0xFFFF
-static ulong scsi_write(block_dev_desc_t *block_dev, lbaint_t blknr,
+static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, const void *buffer)
{
- int device = block_dev->dev;
+ int device = block_dev->devnum;
lbaint_t start, blks;
uintptr_t buf_addr;
unsigned short smallblks;
diff --git a/cmd/tpm.c b/cmd/tpm.c
index 6edf3e9..312503f 100644
--- a/cmd/tpm.c
+++ b/cmd/tpm.c
@@ -447,8 +447,8 @@ static int get_tpm(struct udevice **devp)
{
int rc;
- rc = uclass_first_device(UCLASS_TPM, devp);
- if (rc || !*devp) {
+ rc = uclass_first_device_err(UCLASS_TPM, devp);
+ if (rc) {
printf("Could not find TPM (ret=%d)\n", rc);
return CMD_RET_FAILURE;
}
diff --git a/cmd/unzip.c b/cmd/unzip.c
index 0686be6..a8bcb1f 100644
--- a/cmd/unzip.c
+++ b/cmd/unzip.c
@@ -43,7 +43,7 @@ U_BOOT_CMD(
static int do_gzwrite(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
{
- block_dev_desc_t *bdev;
+ struct blk_desc *bdev;
int ret;
unsigned char *addr;
unsigned long length;
@@ -53,7 +53,7 @@ static int do_gzwrite(cmd_tbl_t *cmdtp, int flag,
if (argc < 5)
return CMD_RET_USAGE;
- ret = get_device(argv[1], argv[2], &bdev);
+ ret = blk_get_device_by_str(argv[1], argv[2], &bdev);
if (ret < 0)
return CMD_RET_FAILURE;
diff --git a/cmd/usb.c b/cmd/usb.c
index c7b642c..9ed5dc6 100644
--- a/cmd/usb.c
+++ b/cmd/usb.c
@@ -625,7 +625,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int i;
extern char usb_started;
#ifdef CONFIG_USB_STORAGE
- block_dev_desc_t *stor_dev;
+ struct blk_desc *stor_dev;
#endif
if (argc < 2)
@@ -727,7 +727,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (devno)
printf("\n");
debug("print_part of %x\n", devno);
- print_part(stor_dev);
+ part_print(stor_dev);
}
}
} else {
@@ -737,7 +737,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
stor_dev->type != DEV_TYPE_UNKNOWN) {
ok++;
debug("print_part of %x\n", devno);
- print_part(stor_dev);
+ part_print(stor_dev);
}
}
if (!ok) {
@@ -759,8 +759,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("\nUSB read: device %d block # %ld, count %ld"
" ... ", usb_stor_curr_dev, blk, cnt);
stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
- n = stor_dev->block_read(stor_dev, blk, cnt,
- (ulong *)addr);
+ n = blk_dread(stor_dev, blk, cnt, (ulong *)addr);
printf("%ld blocks read: %s\n", n,
(n == cnt) ? "OK" : "ERROR");
if (n == cnt)
@@ -781,8 +780,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("\nUSB write: device %d block # %ld, count %ld"
" ... ", usb_stor_curr_dev, blk, cnt);
stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
- n = stor_dev->block_write(stor_dev, blk, cnt,
- (ulong *)addr);
+ n = blk_dwrite(stor_dev, blk, cnt, (ulong *)addr);
printf("%ld blocks write: %s\n", n,
(n == cnt) ? "OK" : "ERROR");
if (n == cnt)
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
index 0415591..14eed98 100644
--- a/cmd/usb_mass_storage.c
+++ b/cmd/usb_mass_storage.c
@@ -19,7 +19,7 @@
static int ums_read_sector(struct ums *ums_dev,
ulong start, lbaint_t blkcnt, void *buf)
{
- block_dev_desc_t *block_dev = &ums_dev->block_dev;
+ struct blk_desc *block_dev = &ums_dev->block_dev;
lbaint_t blkstart = start + ums_dev->start_sector;
return block_dev->block_read(block_dev, blkstart, blkcnt, buf);
@@ -28,7 +28,7 @@ static int ums_read_sector(struct ums *ums_dev,
static int ums_write_sector(struct ums *ums_dev,
ulong start, lbaint_t blkcnt, const void *buf)
{
- block_dev_desc_t *block_dev = &ums_dev->block_dev;
+ struct blk_desc *block_dev = &ums_dev->block_dev;
lbaint_t blkstart = start + ums_dev->start_sector;
return block_dev->block_write(block_dev, blkstart, blkcnt, buf);
@@ -53,7 +53,7 @@ static void ums_fini(void)
static int ums_init(const char *devtype, const char *devnums)
{
char *s, *t, *devnum, *name;
- block_dev_desc_t *block_dev;
+ struct blk_desc *block_dev;
int ret;
struct ums *ums_new;
@@ -69,7 +69,7 @@ static int ums_init(const char *devtype, const char *devnums)
if (!devnum)
break;
- ret = get_device(devtype, devnum, &block_dev);
+ ret = blk_get_device_by_str(devtype, devnum, &block_dev);
if (ret < 0)
goto cleanup;
@@ -100,7 +100,7 @@ static int ums_init(const char *devtype, const char *devnums)
ums[ums_count].block_dev = *block_dev;
printf("UMS: LUN %d, dev %d, hwpart %d, sector %#x, count %#x\n",
- ums_count, ums[ums_count].block_dev.dev,
+ ums_count, ums[ums_count].block_dev.devnum,
ums[ums_count].block_dev.hwpart,
ums[ums_count].start_sector,
ums[ums_count].num_sectors);
diff --git a/cmd/zfs.c b/cmd/zfs.c
index 0aed29e..93067a9 100644
--- a/cmd/zfs.c
+++ b/cmd/zfs.c
@@ -39,7 +39,7 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
int part;
ulong addr = 0;
disk_partition_t info;
- block_dev_desc_t *dev_desc;
+ struct blk_desc *dev_desc;
char buf[12];
unsigned long count;
const char *addr_str;
@@ -80,11 +80,11 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
return 1;
}
- part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
+ part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
- dev = dev_desc->dev;
+ dev = dev_desc->devnum;
printf("Loading file \"%s\" from %s device %d%c%c\n",
filename, argv[1], dev,
part ? ':' : ' ', part ? part + '0' : ' ');
@@ -135,7 +135,7 @@ static int do_zfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
const char *filename = "/";
int part;
- block_dev_desc_t *dev_desc;
+ struct blk_desc *dev_desc;
disk_partition_t info;
struct device_s vdev;
@@ -145,7 +145,7 @@ static int do_zfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (argc == 4)
filename = argv[3];
- part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
+ part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;