diff options
Diffstat (limited to 'cmd/ide.c')
-rw-r--r-- | cmd/ide.c | 44 |
1 files changed, 22 insertions, 22 deletions
@@ -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; |