1
0
Fork 0

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
utp
Simon Glass 2016-02-29 15:25:51 -07:00
parent 782b97805e
commit bcce53d048
28 changed files with 111 additions and 109 deletions

View File

@ -337,8 +337,8 @@ int board_mmc_init(bd_t *bis)
if (!sunxi_mmc_has_egon_boot_signature(mmc0) && if (!sunxi_mmc_has_egon_boot_signature(mmc0) &&
sunxi_mmc_has_egon_boot_signature(mmc1)) { sunxi_mmc_has_egon_boot_signature(mmc1)) {
/* Booting from emmc / mmc2, swap */ /* Booting from emmc / mmc2, swap */
mmc0->block_dev.dev = 1; mmc0->block_dev.devnum = 1;
mmc1->block_dev.dev = 0; mmc1->block_dev.devnum = 0;
} }
#endif #endif

View File

@ -45,7 +45,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
return 1; return 1;
} }
dev = dev_desc->dev; dev = dev_desc->devnum;
bootstage_mark(BOOTSTAGE_ID_IDE_TYPE); bootstage_mark(BOOTSTAGE_ID_IDE_TYPE);
printf("\nLoading from %s device %d, partition %d: " printf("\nLoading from %s device %d, partition %d: "

View File

@ -81,7 +81,7 @@ static int do_fat_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc,
if (part < 0) if (part < 0)
return 1; return 1;
dev = dev_desc->dev; dev = dev_desc->devnum;
if (fat_set_blk_dev(dev_desc, &info) != 0) { if (fat_set_blk_dev(dev_desc, &info) != 0) {
printf("\n** Unable to use %s %d:%d for fatinfo **\n", printf("\n** Unable to use %s %d:%d for fatinfo **\n",
argv[1], dev, part); argv[1], dev, part);
@ -118,7 +118,7 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
if (part < 0) if (part < 0)
return 1; return 1;
dev = dev_desc->dev; dev = dev_desc->devnum;
if (fat_set_blk_dev(dev_desc, &info) != 0) { if (fat_set_blk_dev(dev_desc, &info) != 0) {
printf("\n** Unable to use %s %d:%d for fatwrite **\n", printf("\n** Unable to use %s %d:%d for fatwrite **\n",

View File

@ -418,7 +418,7 @@ void ide_init(void)
int led = (IDE_BUS(i) == 0) ? LED_IDE1 : LED_IDE2; int led = (IDE_BUS(i) == 0) ? LED_IDE1 : LED_IDE2;
ide_dev_desc[i].type = DEV_TYPE_UNKNOWN; ide_dev_desc[i].type = DEV_TYPE_UNKNOWN;
ide_dev_desc[i].if_type = IF_TYPE_IDE; 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].part_type = PART_TYPE_UNKNOWN;
ide_dev_desc[i].blksz = 0; ide_dev_desc[i].blksz = 0;
ide_dev_desc[i].log2blksz = ide_dev_desc[i].log2blksz =
@ -551,7 +551,7 @@ static void ide_ident(struct blk_desc *dev_desc)
#endif #endif
int device; int device;
device = dev_desc->dev; device = dev_desc->devnum;
printf(" Device %d: ", device); printf(" Device %d: ", device);
ide_led(DEVICE_LED(device), 1); /* LED on */ ide_led(DEVICE_LED(device), 1); /* LED on */
@ -716,7 +716,7 @@ static void ide_ident(struct blk_desc *dev_desc)
ulong ide_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt, ulong ide_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
void *buffer) void *buffer)
{ {
int device = block_dev->dev; int device = block_dev->devnum;
ulong n = 0; ulong n = 0;
unsigned char c; unsigned char c;
unsigned char pwrsave = 0; /* power save */ unsigned char pwrsave = 0; /* power save */
@ -842,7 +842,7 @@ IDE_READ_E:
ulong ide_write(struct blk_desc *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) const void *buffer)
{ {
int device = block_dev->dev; int device = block_dev->devnum;
ulong n = 0; ulong n = 0;
unsigned char c; unsigned char c;
@ -1308,7 +1308,7 @@ static void atapi_inquiry(struct blk_desc *dev_desc)
unsigned char c; unsigned char c;
int device; int device;
device = dev_desc->dev; device = dev_desc->devnum;
dev_desc->type = DEV_TYPE_UNKNOWN; /* not yet valid */ dev_desc->type = DEV_TYPE_UNKNOWN; /* not yet valid */
dev_desc->block_read = atapi_read; dev_desc->block_read = atapi_read;
@ -1397,7 +1397,7 @@ static void atapi_inquiry(struct blk_desc *dev_desc)
ulong atapi_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt, ulong atapi_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
void *buffer) void *buffer)
{ {
int device = block_dev->dev; int device = block_dev->devnum;
ulong n = 0; ulong n = 0;
unsigned char ccb[12]; /* Command descriptor block */ unsigned char ccb[12]; /* Command descriptor block */
ulong cnt; ulong cnt;

View File

@ -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"); printf("Failed to create MMC Device\n");
return 1; return 1;
} }
printf("%s: %d at %u:%u hz %u mode %u\n", mmc->cfg->name, mmc->block_dev.dev, printf("%s: %d at %u:%u hz %u mode %u\n", mmc->cfg->name,
bus, cs, speed, mode); mmc->block_dev.devnum, bus, cs, speed, mode);
mmc_init(mmc); mmc_init(mmc);
return 0; return 0;

View File

@ -48,7 +48,7 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
filename = argv[3]; 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); PRINTF("Using device %s %d:%d, directory: %s\n", argv[1], dev, part, filename);
reiserfs_set_blk_dev(dev_desc, &info); reiserfs_set_blk_dev(dev_desc, &info);
@ -126,7 +126,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (part < 0) if (part < 0)
return 1; return 1;
dev = dev_desc->dev; dev = dev_desc->devnum;
printf("Loading file \"%s\" from %s device %d%c%c\n", printf("Loading file \"%s\" from %s device %d%c%c\n",
filename, argv[1], dev, filename, argv[1], dev,

View File

@ -21,13 +21,13 @@ struct blk_desc sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
static unsigned long sata_bread(struct blk_desc *block_dev, lbaint_t start, static unsigned long sata_bread(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, void *dst) 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(struct blk_desc *block_dev, lbaint_t start, static unsigned long sata_bwrite(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, const void *buffer) 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) int __sata_initialize(void)
@ -38,7 +38,7 @@ int __sata_initialize(void)
for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) { for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) {
memset(&sata_dev_desc[i], 0, sizeof(struct blk_desc)); memset(&sata_dev_desc[i], 0, sizeof(struct blk_desc));
sata_dev_desc[i].if_type = IF_TYPE_SATA; 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].part_type = PART_TYPE_UNKNOWN;
sata_dev_desc[i].type = DEV_TYPE_HARDDISK; sata_dev_desc[i].type = DEV_TYPE_HARDDISK;
sata_dev_desc[i].lba = 0; sata_dev_desc[i].lba = 0;

View File

@ -99,7 +99,7 @@ void scsi_scan(int mode)
scsi_dev_desc[i].revision[0]=0; scsi_dev_desc[i].revision[0]=0;
scsi_dev_desc[i].removable = false; scsi_dev_desc[i].removable = false;
scsi_dev_desc[i].if_type=IF_TYPE_SCSI; 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].part_type=PART_TYPE_UNKNOWN;
scsi_dev_desc[i].block_read=scsi_read; scsi_dev_desc[i].block_read=scsi_read;
scsi_dev_desc[i].block_write = scsi_write; scsi_dev_desc[i].block_write = scsi_write;
@ -379,7 +379,7 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr, static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, void *buffer) lbaint_t blkcnt, void *buffer)
{ {
int device = block_dev->dev; int device = block_dev->devnum;
lbaint_t start, blks; lbaint_t start, blks;
uintptr_t buf_addr; uintptr_t buf_addr;
unsigned short smallblks = 0; unsigned short smallblks = 0;
@ -446,7 +446,7 @@ static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr,
static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr, static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, const void *buffer) lbaint_t blkcnt, const void *buffer)
{ {
int device = block_dev->dev; int device = block_dev->devnum;
lbaint_t start, blks; lbaint_t start, blks;
uintptr_t buf_addr; uintptr_t buf_addr;
unsigned short smallblks; unsigned short smallblks;

View File

@ -100,7 +100,7 @@ static int ums_init(const char *devtype, const char *devnums)
ums[ums_count].block_dev = *block_dev; ums[ums_count].block_dev = *block_dev;
printf("UMS: LUN %d, dev %d, hwpart %d, sector %#x, count %#x\n", 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].block_dev.hwpart,
ums[ums_count].start_sector, ums[ums_count].start_sector,
ums[ums_count].num_sectors); ums[ums_count].num_sectors);

View File

@ -84,7 +84,7 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
if (part < 0) if (part < 0)
return 1; return 1;
dev = dev_desc->dev; dev = dev_desc->devnum;
printf("Loading file \"%s\" from %s device %d%c%c\n", printf("Loading file \"%s\" from %s device %d%c%c\n",
filename, argv[1], dev, filename, argv[1], dev,
part ? ':' : ' ', part ? part + '0' : ' '); part ? ':' : ' ', part ? part + '0' : ' ');

View File

@ -54,7 +54,7 @@ int saveenv(void)
if (part < 0) if (part < 0)
return 1; return 1;
dev = dev_desc->dev; dev = dev_desc->devnum;
if (fat_set_blk_dev(dev_desc, &info) != 0) { if (fat_set_blk_dev(dev_desc, &info) != 0) {
printf("\n** Unable to use %s %d:%d for saveenv **\n", printf("\n** Unable to use %s %d:%d for saveenv **\n",
FAT_ENV_INTERFACE, dev, part); FAT_ENV_INTERFACE, dev, part);
@ -88,7 +88,7 @@ void env_relocate_spec(void)
if (part < 0) if (part < 0)
goto err_env_relocate; goto err_env_relocate;
dev = dev_desc->dev; dev = dev_desc->devnum;
if (fat_set_blk_dev(dev_desc, &info) != 0) { if (fat_set_blk_dev(dev_desc, &info) != 0) {
printf("\n** Unable to use %s %d:%d for loading the env **\n", printf("\n** Unable to use %s %d:%d for loading the env **\n",
FAT_ENV_INTERFACE, dev, part); FAT_ENV_INTERFACE, dev, part);

View File

@ -86,7 +86,7 @@ static void write_raw_image(struct blk_desc *dev_desc, disk_partition_t *info,
blks = dev_desc->block_write(dev_desc, info->start, blkcnt, buffer); blks = dev_desc->block_write(dev_desc, info->start, blkcnt, buffer);
if (blks != blkcnt) { if (blks != blkcnt) {
error("failed writing to device %d\n", dev_desc->dev); error("failed writing to device %d\n", dev_desc->devnum);
fastboot_fail(response_str, "failed writing to device"); fastboot_fail(response_str, "failed writing to device");
return; return;
} }
@ -207,7 +207,7 @@ void fb_mmc_erase(const char *cmd, char *response)
blks = dev_desc->block_erase(dev_desc, blks_start, blks_size); blks = dev_desc->block_erase(dev_desc, blks_start, blks_size);
if (blks != blks_size) { if (blks != blks_size) {
error("failed erasing from device %d", dev_desc->dev); error("failed erasing from device %d", dev_desc->devnum);
fastboot_fail(response_str, "failed erasing from device"); fastboot_fail(response_str, "failed erasing from device");
return; return;
} }

View File

@ -192,7 +192,7 @@ static int usb_stor_probe_device(struct usb_device *dev)
blkdev = &usb_dev_desc[usb_max_devs]; blkdev = &usb_dev_desc[usb_max_devs];
memset(blkdev, '\0', sizeof(struct blk_desc)); memset(blkdev, '\0', sizeof(struct blk_desc));
blkdev->if_type = IF_TYPE_USB; blkdev->if_type = IF_TYPE_USB;
blkdev->dev = usb_max_devs; blkdev->devnum = usb_max_devs;
blkdev->part_type = PART_TYPE_UNKNOWN; blkdev->part_type = PART_TYPE_UNKNOWN;
blkdev->target = 0xff; blkdev->target = 0xff;
blkdev->type = DEV_TYPE_UNKNOWN; blkdev->type = DEV_TYPE_UNKNOWN;
@ -1029,7 +1029,7 @@ static void usb_bin_fixup(struct usb_device_descriptor descriptor,
static unsigned long usb_stor_read(struct blk_desc *block_dev, lbaint_t blknr, static unsigned long usb_stor_read(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, void *buffer) lbaint_t blkcnt, void *buffer)
{ {
int device = block_dev->dev; int device = block_dev->devnum;
lbaint_t start, blks; lbaint_t start, blks;
uintptr_t buf_addr; uintptr_t buf_addr;
unsigned short smallblks; unsigned short smallblks;
@ -1100,7 +1100,7 @@ retry_it:
static unsigned long usb_stor_write(struct blk_desc *block_dev, lbaint_t blknr, static unsigned long usb_stor_write(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, const void *buffer) lbaint_t blkcnt, const void *buffer)
{ {
int device = block_dev->dev; int device = block_dev->devnum;
lbaint_t start, blks; lbaint_t start, blks;
uintptr_t buf_addr; uintptr_t buf_addr;
unsigned short smallblks; unsigned short smallblks;

View File

@ -108,7 +108,7 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
return dev_desc; return dev_desc;
if (!select_hwpart) if (!select_hwpart)
return NULL; return NULL;
ret = select_hwpart(dev_desc->dev, hwpart); ret = select_hwpart(dev_desc->devnum, hwpart);
if (ret < 0) if (ret < 0)
return NULL; return NULL;
return dev_desc; return dev_desc;
@ -325,7 +325,7 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
break; break;
} }
printf (" device %d -- Partition Type: %s\n\n", printf (" device %d -- Partition Type: %s\n\n",
dev_desc->dev, type); dev_desc->devnum, type);
#endif /* any CONFIG_..._PARTITION */ #endif /* any CONFIG_..._PARTITION */
} }
@ -457,10 +457,6 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
int part; int part;
disk_partition_t tmpinfo; 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 #ifdef CONFIG_SANDBOX
/* /*
* Special-case a pseudo block device "hostfs", to allow access to the * Special-case a pseudo block device "hostfs", to allow access to the

View File

@ -114,7 +114,7 @@ static void print_partition_extended(struct blk_desc *dev_desc,
if (dev_desc->block_read(dev_desc, ext_part_sector, 1, if (dev_desc->block_read(dev_desc, ext_part_sector, 1,
(ulong *)buffer) != 1) { (ulong *)buffer) != 1) {
printf ("** Can't read partition table on %d:" LBAFU " **\n", printf ("** Can't read partition table on %d:" LBAFU " **\n",
dev_desc->dev, ext_part_sector); dev_desc->devnum, ext_part_sector);
return; return;
} }
i=test_block_type(buffer); i=test_block_type(buffer);
@ -180,7 +180,7 @@ static int part_get_info_extended(struct blk_desc *dev_desc,
if (dev_desc->block_read(dev_desc, ext_part_sector, 1, if (dev_desc->block_read(dev_desc, ext_part_sector, 1,
(ulong *)buffer) != 1) { (ulong *)buffer) != 1) {
printf ("** Can't read partition table on %d:" LBAFU " **\n", printf ("** Can't read partition table on %d:" LBAFU " **\n",
dev_desc->dev, ext_part_sector); dev_desc->devnum, ext_part_sector);
return -1; return -1;
} }
if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 || if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 ||
@ -215,24 +215,29 @@ static int part_get_info_extended(struct blk_desc *dev_desc,
case IF_TYPE_IDE: case IF_TYPE_IDE:
case IF_TYPE_SATA: case IF_TYPE_SATA:
case IF_TYPE_ATAPI: case IF_TYPE_ATAPI:
sprintf ((char *)info->name, "hd%c%d", sprintf((char *)info->name, "hd%c%d",
'a' + dev_desc->dev, part_num); 'a' + dev_desc->devnum,
part_num);
break; break;
case IF_TYPE_SCSI: case IF_TYPE_SCSI:
sprintf ((char *)info->name, "sd%c%d", sprintf((char *)info->name, "sd%c%d",
'a' + dev_desc->dev, part_num); 'a' + dev_desc->devnum,
part_num);
break; break;
case IF_TYPE_USB: case IF_TYPE_USB:
sprintf ((char *)info->name, "usbd%c%d", sprintf((char *)info->name, "usbd%c%d",
'a' + dev_desc->dev, part_num); 'a' + dev_desc->devnum,
part_num);
break; break;
case IF_TYPE_DOC: case IF_TYPE_DOC:
sprintf ((char *)info->name, "docd%c%d", sprintf((char *)info->name, "docd%c%d",
'a' + dev_desc->dev, part_num); 'a' + dev_desc->devnum,
part_num);
break; break;
default: default:
sprintf ((char *)info->name, "xx%c%d", sprintf((char *)info->name, "xx%c%d",
'a' + dev_desc->dev, part_num); 'a' + dev_desc->devnum,
part_num);
break; break;
} }
/* sprintf(info->type, "%d, pt->sys_ind); */ /* sprintf(info->type, "%d, pt->sys_ind); */

View File

@ -356,7 +356,7 @@ static int set_protective_mbr(struct blk_desc *dev_desc)
/* Write MBR sector to the MMC device */ /* Write MBR sector to the MMC device */
if (dev_desc->block_write(dev_desc, 0, 1, p_mbr) != 1) { if (dev_desc->block_write(dev_desc, 0, 1, p_mbr) != 1) {
printf("** Can't write to device %d **\n", printf("** Can't write to device %d **\n",
dev_desc->dev); dev_desc->devnum);
return -1; return -1;
} }
@ -410,7 +410,7 @@ int write_gpt_table(struct blk_desc *dev_desc,
return 0; return 0;
err: err:
printf("** Can't write to device %d **\n", dev_desc->dev); printf("** Can't write to device %d **\n", dev_desc->devnum);
return -1; return -1;
} }

View File

@ -68,13 +68,13 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
if(ppr->desctype!=0x01) { if(ppr->desctype!=0x01) {
if(verb) if(verb)
printf ("** First descriptor is NOT a primary desc on %d:%d **\n", printf ("** First descriptor is NOT a primary desc on %d:%d **\n",
dev_desc->dev, part_num); dev_desc->devnum, part_num);
return (-1); return (-1);
} }
if(strncmp((char *)ppr->stand_ident,"CD001",5)!=0) { if(strncmp((char *)ppr->stand_ident,"CD001",5)!=0) {
if(verb) if(verb)
printf ("** Wrong ISO Ident: %s on %d:%d **\n", printf ("** Wrong ISO Ident: %s on %d:%d **\n",
ppr->stand_ident,dev_desc->dev, part_num); ppr->stand_ident, dev_desc->devnum, part_num);
return (-1); return (-1);
} }
lastsect= ((ppr->firstsek_LEpathtab1_LE & 0x000000ff)<<24) + lastsect= ((ppr->firstsek_LEpathtab1_LE & 0x000000ff)<<24) +
@ -92,7 +92,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
if(ppr->desctype==0xff) { if(ppr->desctype==0xff) {
if(verb) if(verb)
printf ("** No valid boot catalog found on %d:%d **\n", printf ("** No valid boot catalog found on %d:%d **\n",
dev_desc->dev, part_num); dev_desc->devnum, part_num);
return (-1); return (-1);
} }
} }
@ -100,7 +100,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
if(strncmp(pbr->ident_str,"EL TORITO SPECIFICATION",23)!=0) { if(strncmp(pbr->ident_str,"EL TORITO SPECIFICATION",23)!=0) {
if(verb) if(verb)
printf ("** Wrong El Torito ident: %s on %d:%d **\n", printf ("** Wrong El Torito ident: %s on %d:%d **\n",
pbr->ident_str,dev_desc->dev, part_num); pbr->ident_str, dev_desc->devnum, part_num);
return (-1); return (-1);
} }
bootaddr=le32_to_int(pbr->pointer); bootaddr=le32_to_int(pbr->pointer);
@ -108,7 +108,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
if (dev_desc->block_read(dev_desc, bootaddr, 1, (ulong *)tmpbuf) != 1) { if (dev_desc->block_read(dev_desc, bootaddr, 1, (ulong *)tmpbuf) != 1) {
if(verb) if(verb)
printf ("** Can't read Boot Entry at %lX on %d:%d **\n", printf ("** Can't read Boot Entry at %lX on %d:%d **\n",
bootaddr,dev_desc->dev, part_num); bootaddr, dev_desc->devnum, part_num);
return (-1); return (-1);
} }
chksum=0; chksum=0;
@ -117,21 +117,21 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
chksum+=((chksumbuf[i] &0xff)<<8)+((chksumbuf[i] &0xff00)>>8); chksum+=((chksumbuf[i] &0xff)<<8)+((chksumbuf[i] &0xff00)>>8);
if(chksum!=0) { if(chksum!=0) {
if(verb) if(verb)
printf ("** Checksum Error in booting catalog validation entry on %d:%d **\n", printf("** Checksum Error in booting catalog validation entry on %d:%d **\n",
dev_desc->dev, part_num); dev_desc->devnum, part_num);
return (-1); return (-1);
} }
if((pve->key[0]!=0x55)||(pve->key[1]!=0xAA)) { if((pve->key[0]!=0x55)||(pve->key[1]!=0xAA)) {
if(verb) if(verb)
printf ("** Key 0x55 0xAA error on %d:%d **\n", printf ("** Key 0x55 0xAA error on %d:%d **\n",
dev_desc->dev, part_num); dev_desc->devnum, part_num);
return(-1); return(-1);
} }
#ifdef CHECK_FOR_POWERPC_PLATTFORM #ifdef CHECK_FOR_POWERPC_PLATTFORM
if(pve->platform!=0x01) { if(pve->platform!=0x01) {
if(verb) if(verb)
printf ("** No PowerPC platform CD on %d:%d **\n", printf ("** No PowerPC platform CD on %d:%d **\n",
dev_desc->dev, part_num); dev_desc->devnum, part_num);
return(-1); return(-1);
} }
#endif #endif
@ -144,23 +144,23 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
case IF_TYPE_SATA: case IF_TYPE_SATA:
case IF_TYPE_ATAPI: case IF_TYPE_ATAPI:
sprintf ((char *)info->name, "hd%c%d", sprintf ((char *)info->name, "hd%c%d",
'a' + dev_desc->dev, part_num); 'a' + dev_desc->devnum, part_num);
break; break;
case IF_TYPE_SCSI: case IF_TYPE_SCSI:
sprintf ((char *)info->name, "sd%c%d", sprintf ((char *)info->name, "sd%c%d",
'a' + dev_desc->dev, part_num); 'a' + dev_desc->devnum, part_num);
break; break;
case IF_TYPE_USB: case IF_TYPE_USB:
sprintf ((char *)info->name, "usbd%c%d", sprintf ((char *)info->name, "usbd%c%d",
'a' + dev_desc->dev, part_num); 'a' + dev_desc->devnum, part_num);
break; break;
case IF_TYPE_DOC: case IF_TYPE_DOC:
sprintf ((char *)info->name, "docd%c%d", sprintf ((char *)info->name, "docd%c%d",
'a' + dev_desc->dev, part_num); 'a' + dev_desc->devnum, part_num);
break; break;
default: default:
sprintf ((char *)info->name, "xx%c%d", sprintf ((char *)info->name, "xx%c%d",
'a' + dev_desc->dev, part_num); 'a' + dev_desc->devnum, part_num);
break; break;
} }
/* the bootcatalog (including validation Entry) is limited to 2048Bytes /* the bootcatalog (including validation Entry) is limited to 2048Bytes
@ -184,7 +184,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
else { else {
if(verb) if(verb)
printf ("** Partition %d not found on device %d **\n", printf ("** Partition %d not found on device %d **\n",
part_num,dev_desc->dev); part_num, dev_desc->devnum);
return(-1); return(-1);
} }
} }
@ -192,13 +192,13 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
* searched w/o succsess */ * searched w/o succsess */
if(verb) if(verb)
printf ("** Partition %d not found on device %d **\n", printf ("** Partition %d not found on device %d **\n",
part_num,dev_desc->dev); part_num, dev_desc->devnum);
return(-1); return(-1);
found: found:
if(pide->boot_ind!=0x88) { if(pide->boot_ind!=0x88) {
if(verb) if(verb)
printf ("** Partition %d is not bootable on device %d **\n", printf("** Partition %d is not bootable on device %d **\n",
part_num,dev_desc->dev); part_num, dev_desc->devnum);
return (-1); return (-1);
} }
switch(pide->boot_media) { switch(pide->boot_media) {
@ -229,7 +229,8 @@ static void print_part_iso(struct blk_desc *dev_desc)
int i; int i;
if (part_get_info_iso_verb(dev_desc, 0, &info, 0) == -1) { if (part_get_info_iso_verb(dev_desc, 0, &info, 0) == -1) {
printf("** No boot partition found on device %d **\n",dev_desc->dev); printf("** No boot partition found on device %d **\n",
dev_desc->devnum);
return; return;
} }
printf("Part Start Sect x Size Type\n"); printf("Part Start Sect x Size Type\n");

View File

@ -108,14 +108,14 @@ static void print_part_mac(struct blk_desc *dev_desc)
printf ("%4ld: ", i); printf ("%4ld: ", i);
if (dev_desc->block_read(dev_desc, i, 1, (ulong *)mpart) != 1) { if (dev_desc->block_read(dev_desc, i, 1, (ulong *)mpart) != 1) {
printf ("** Can't read Partition Map on %d:%ld **\n", printf ("** Can't read Partition Map on %d:%ld **\n",
dev_desc->dev, i); dev_desc->devnum, i);
return; return;
} }
if (mpart->signature != MAC_PARTITION_MAGIC) { if (mpart->signature != MAC_PARTITION_MAGIC) {
printf ("** Bad Signature on %d:%ld - " printf("** Bad Signature on %d:%ld - expected 0x%04x, got 0x%04x\n",
"expected 0x%04x, got 0x%04x\n", dev_desc->devnum, i, MAC_PARTITION_MAGIC,
dev_desc->dev, i, MAC_PARTITION_MAGIC, mpart->signature); mpart->signature);
return; return;
} }
@ -184,14 +184,14 @@ static int part_mac_read_pdb(struct blk_desc *dev_desc, int part,
*/ */
if (dev_desc->block_read(dev_desc, n, 1, (ulong *)pdb_p) != 1) { if (dev_desc->block_read(dev_desc, n, 1, (ulong *)pdb_p) != 1) {
printf ("** Can't read Partition Map on %d:%d **\n", printf ("** Can't read Partition Map on %d:%d **\n",
dev_desc->dev, n); dev_desc->devnum, n);
return (-1); return (-1);
} }
if (pdb_p->signature != MAC_PARTITION_MAGIC) { if (pdb_p->signature != MAC_PARTITION_MAGIC) {
printf ("** Bad Signature on %d:%d: " printf("** Bad Signature on %d:%d: expected 0x%04x, got 0x%04x\n",
"expected 0x%04x, got 0x%04x\n", dev_desc->devnum, n, MAC_PARTITION_MAGIC,
dev_desc->dev, n, MAC_PARTITION_MAGIC, pdb_p->signature); pdb_p->signature);
return (-1); return (-1);
} }
@ -200,9 +200,9 @@ static int part_mac_read_pdb(struct blk_desc *dev_desc, int part,
if ((part < 1) || (part > pdb_p->map_count)) { if ((part < 1) || (part > pdb_p->map_count)) {
printf ("** Invalid partition %d:%d [%d:1...%d:%d only]\n", printf ("** Invalid partition %d:%d [%d:1...%d:%d only]\n",
dev_desc->dev, part, dev_desc->devnum, part,
dev_desc->dev, dev_desc->devnum,
dev_desc->dev, pdb_p->map_count); dev_desc->devnum, pdb_p->map_count);
return (-1); return (-1);
} }

View File

@ -26,7 +26,7 @@ static unsigned long host_block_read(struct blk_desc *block_dev,
unsigned long start, lbaint_t blkcnt, unsigned long start, lbaint_t blkcnt,
void *buffer) void *buffer)
{ {
int dev = block_dev->dev; int dev = block_dev->devnum;
struct host_block_dev *host_dev = find_host_device(dev); struct host_block_dev *host_dev = find_host_device(dev);
if (!host_dev) if (!host_dev)
@ -48,7 +48,7 @@ static unsigned long host_block_write(struct blk_desc *block_dev,
unsigned long start, lbaint_t blkcnt, unsigned long start, lbaint_t blkcnt,
const void *buffer) const void *buffer)
{ {
int dev = block_dev->dev; int dev = block_dev->devnum;
struct host_block_dev *host_dev = find_host_device(dev); struct host_block_dev *host_dev = find_host_device(dev);
if (os_lseek(host_dev->fd, if (os_lseek(host_dev->fd,
start * host_dev->blk_dev.blksz, start * host_dev->blk_dev.blksz,
@ -96,7 +96,7 @@ int host_dev_bind(int dev, char *filename)
blk_dev->lba = os_lseek(host_dev->fd, 0, OS_SEEK_END) / blk_dev->blksz; blk_dev->lba = os_lseek(host_dev->fd, 0, OS_SEEK_END) / blk_dev->blksz;
blk_dev->block_read = host_block_read; blk_dev->block_read = host_block_read;
blk_dev->block_write = host_block_write; blk_dev->block_write = host_block_write;
blk_dev->dev = dev; blk_dev->devnum = dev;
blk_dev->part_type = PART_TYPE_UNKNOWN; blk_dev->part_type = PART_TYPE_UNKNOWN;
part_init(blk_dev); part_init(blk_dev);

View File

@ -111,7 +111,7 @@ struct blk_desc *systemace_get_dev(int dev)
not yet initialized. In that case, fill it in. */ not yet initialized. In that case, fill it in. */
if (systemace_dev.blksz == 0) { if (systemace_dev.blksz == 0) {
systemace_dev.if_type = IF_TYPE_UNKNOWN; systemace_dev.if_type = IF_TYPE_UNKNOWN;
systemace_dev.dev = 0; systemace_dev.devnum = 0;
systemace_dev.part_type = PART_TYPE_UNKNOWN; systemace_dev.part_type = PART_TYPE_UNKNOWN;
systemace_dev.type = DEV_TYPE_HARDDISK; systemace_dev.type = DEV_TYPE_HARDDISK;
systemace_dev.blksz = 512; systemace_dev.blksz = 512;

View File

@ -375,7 +375,7 @@ int arm_pl180_mmci_init(struct pl180_mmc_host *host)
if (mmc == NULL) if (mmc == NULL)
return -1; return -1;
debug("registered mmc interface number is:%d\n", mmc->block_dev.dev); debug("registered mmc interface number is:%d\n", mmc->block_dev.devnum);
return 0; return 0;
} }

View File

@ -182,7 +182,7 @@ struct mmc *find_mmc_device(int dev_num)
list_for_each(entry, &mmc_devices) { list_for_each(entry, &mmc_devices) {
m = list_entry(entry, struct mmc, link); m = list_entry(entry, struct mmc, link);
if (m->block_dev.dev == dev_num) if (m->block_dev.devnum == dev_num)
return m; return m;
} }
@ -237,7 +237,7 @@ static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start,
static ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, static ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, void *dst) lbaint_t blkcnt, void *dst)
{ {
int dev_num = block_dev->dev; int dev_num = block_dev->devnum;
int err; int err;
lbaint_t cur, blocks_todo = blkcnt; lbaint_t cur, blocks_todo = blkcnt;
@ -1556,7 +1556,7 @@ struct mmc *mmc_create(const struct mmc_config *cfg, void *priv)
mmc->dsr = 0xffffffff; mmc->dsr = 0xffffffff;
/* Setup the universal parts of the block interface just once */ /* Setup the universal parts of the block interface just once */
mmc->block_dev.if_type = IF_TYPE_MMC; mmc->block_dev.if_type = IF_TYPE_MMC;
mmc->block_dev.dev = cur_dev_num++; mmc->block_dev.devnum = cur_dev_num++;
mmc->block_dev.removable = 1; mmc->block_dev.removable = 1;
mmc->block_dev.block_read = mmc_bread; mmc->block_dev.block_read = mmc_bread;
mmc->block_dev.block_write = mmc_bwrite; mmc->block_dev.block_write = mmc_bwrite;
@ -1728,7 +1728,7 @@ void print_mmc_devices(char separator)
else else
mmc_type = NULL; mmc_type = NULL;
printf("%s: %d", m->cfg->name, m->block_dev.dev); printf("%s: %d", m->cfg->name, m->block_dev.devnum);
if (mmc_type) if (mmc_type)
printf(" (%s)", mmc_type); printf(" (%s)", mmc_type);

View File

@ -68,7 +68,7 @@ err_out:
unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start, unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt) lbaint_t blkcnt)
{ {
int dev_num = block_dev->dev; int dev_num = block_dev->devnum;
int err = 0; int err = 0;
u32 start_rem, blkcnt_rem; u32 start_rem, blkcnt_rem;
struct mmc *mmc = find_mmc_device(dev_num); struct mmc *mmc = find_mmc_device(dev_num);
@ -174,7 +174,7 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t start,
ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
const void *src) const void *src)
{ {
int dev_num = block_dev->dev; int dev_num = block_dev->devnum;
lbaint_t cur, blocks_todo = blkcnt; lbaint_t cur, blocks_todo = blkcnt;
int err; int err;

View File

@ -142,7 +142,7 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
uint32_t ctrl0; uint32_t ctrl0;
int ret; int ret;
debug("MMC%d: CMD%d\n", mmc->block_dev.dev, cmd->cmdidx); debug("MMC%d: CMD%d\n", mmc->block_dev.devnum, cmd->cmdidx);
/* Check bus busy */ /* Check bus busy */
timeout = MXSMMC_MAX_TIMEOUT; timeout = MXSMMC_MAX_TIMEOUT;
@ -157,13 +157,13 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
} }
if (!timeout) { if (!timeout) {
printf("MMC%d: Bus busy timeout!\n", mmc->block_dev.dev); printf("MMC%d: Bus busy timeout!\n", mmc->block_dev.devnum);
return TIMEOUT; return TIMEOUT;
} }
/* See if card is present */ /* See if card is present */
if (!mxsmmc_cd(priv)) { if (!mxsmmc_cd(priv)) {
printf("MMC%d: No card detected!\n", mmc->block_dev.dev); printf("MMC%d: No card detected!\n", mmc->block_dev.devnum);
return NO_CARD_ERR; return NO_CARD_ERR;
} }
@ -200,9 +200,9 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
if (data->flags & MMC_DATA_READ) { if (data->flags & MMC_DATA_READ) {
ctrl0 |= SSP_CTRL0_READ; ctrl0 |= SSP_CTRL0_READ;
} else if (priv->mmc_is_wp && } else if (priv->mmc_is_wp &&
priv->mmc_is_wp(mmc->block_dev.dev)) { priv->mmc_is_wp(mmc->block_dev.devnum)) {
printf("MMC%d: Can not write a locked card!\n", printf("MMC%d: Can not write a locked card!\n",
mmc->block_dev.dev); mmc->block_dev.devnum);
return UNUSABLE_ERR; return UNUSABLE_ERR;
} }
@ -243,21 +243,21 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
if (!timeout) { if (!timeout) {
printf("MMC%d: Command %d busy\n", printf("MMC%d: Command %d busy\n",
mmc->block_dev.dev, cmd->cmdidx); mmc->block_dev.devnum, cmd->cmdidx);
return TIMEOUT; return TIMEOUT;
} }
/* Check command timeout */ /* Check command timeout */
if (reg & SSP_STATUS_RESP_TIMEOUT) { if (reg & SSP_STATUS_RESP_TIMEOUT) {
printf("MMC%d: Command %d timeout (status 0x%08x)\n", printf("MMC%d: Command %d timeout (status 0x%08x)\n",
mmc->block_dev.dev, cmd->cmdidx, reg); mmc->block_dev.devnum, cmd->cmdidx, reg);
return TIMEOUT; return TIMEOUT;
} }
/* Check command errors */ /* Check command errors */
if (reg & (SSP_STATUS_RESP_CRC_ERR | SSP_STATUS_RESP_ERR)) { if (reg & (SSP_STATUS_RESP_CRC_ERR | SSP_STATUS_RESP_ERR)) {
printf("MMC%d: Command %d error (status 0x%08x)!\n", printf("MMC%d: Command %d error (status 0x%08x)!\n",
mmc->block_dev.dev, cmd->cmdidx, reg); mmc->block_dev.devnum, cmd->cmdidx, reg);
return COMM_ERR; return COMM_ERR;
} }
@ -279,14 +279,14 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
if (ret) { if (ret) {
printf("MMC%d: Data timeout with command %d " printf("MMC%d: Data timeout with command %d "
"(status 0x%08x)!\n", "(status 0x%08x)!\n",
mmc->block_dev.dev, cmd->cmdidx, reg); mmc->block_dev.devnum, cmd->cmdidx, reg);
return ret; return ret;
} }
} else { } else {
ret = mxsmmc_send_cmd_dma(priv, data); ret = mxsmmc_send_cmd_dma(priv, data);
if (ret) { if (ret) {
printf("MMC%d: DMA transfer failed\n", printf("MMC%d: DMA transfer failed\n",
mmc->block_dev.dev); mmc->block_dev.devnum);
return ret; return ret;
} }
} }
@ -297,7 +297,7 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
(SSP_STATUS_TIMEOUT | SSP_STATUS_DATA_CRC_ERR | (SSP_STATUS_TIMEOUT | SSP_STATUS_DATA_CRC_ERR |
SSP_STATUS_FIFO_OVRFLW | SSP_STATUS_FIFO_UNDRFLW)) { SSP_STATUS_FIFO_OVRFLW | SSP_STATUS_FIFO_UNDRFLW)) {
printf("MMC%d: Data error with command %d (status 0x%08x)!\n", printf("MMC%d: Data error with command %d (status 0x%08x)!\n",
mmc->block_dev.dev, cmd->cmdidx, reg); mmc->block_dev.devnum, cmd->cmdidx, reg);
return COMM_ERR; return COMM_ERR;
} }
@ -330,7 +330,7 @@ static void mxsmmc_set_ios(struct mmc *mmc)
SSP_CTRL0_BUS_WIDTH_MASK, priv->buswidth); SSP_CTRL0_BUS_WIDTH_MASK, priv->buswidth);
debug("MMC%d: Set %d bits bus width\n", debug("MMC%d: Set %d bits bus width\n",
mmc->block_dev.dev, mmc->bus_width); mmc->block_dev.devnum, mmc->bus_width);
} }
static int mxsmmc_init(struct mmc *mmc) static int mxsmmc_init(struct mmc *mmc)

View File

@ -177,11 +177,11 @@ static unsigned char mmc_board_init(struct mmc *mmc)
#if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER) #if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER)
/* PBIAS config needed for MMC1 only */ /* PBIAS config needed for MMC1 only */
if (mmc->block_dev.dev == 0) if (mmc->block_dev.devnum == 0)
omap4_vmmc_pbias_config(mmc); omap4_vmmc_pbias_config(mmc);
#endif #endif
#if defined(CONFIG_OMAP54XX) && defined(CONFIG_PALMAS_POWER) #if defined(CONFIG_OMAP54XX) && defined(CONFIG_PALMAS_POWER)
if (mmc->block_dev.dev == 0) if (mmc->block_dev.devnum == 0)
omap5_pbias_config(mmc); omap5_pbias_config(mmc);
#endif #endif

View File

@ -137,7 +137,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
int trans_bytes = 0, is_aligned = 1; int trans_bytes = 0, is_aligned = 1;
u32 mask, flags, mode; u32 mask, flags, mode;
unsigned int time = 0, start_addr = 0; unsigned int time = 0, start_addr = 0;
int mmc_dev = mmc->block_dev.dev; int mmc_dev = mmc->block_dev.devnum;
unsigned start = get_timer(0); unsigned start = get_timer(0);
/* Timeout unit - ms */ /* Timeout unit - ms */

View File

@ -100,7 +100,7 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no)
if (part_get_info(dev_desc, part_no, &info)) { if (part_get_info(dev_desc, part_no, &info)) {
if (part_no != 0) { if (part_no != 0) {
printf("** Partition %d not valid on device %d **\n", printf("** Partition %d not valid on device %d **\n",
part_no, dev_desc->dev); part_no, dev_desc->devnum);
return -1; return -1;
} }
@ -1284,7 +1284,7 @@ int file_fat_detectfs(void)
printf("Unknown"); printf("Unknown");
} }
printf("\n Device %d: ", cur_dev->dev); printf("\n Device %d: ", cur_dev->devnum);
dev_print(cur_dev); dev_print(cur_dev);
#endif #endif

View File

@ -36,7 +36,7 @@ enum if_type {
struct blk_desc { struct blk_desc {
enum if_type if_type; /* type of the interface */ enum if_type if_type; /* type of the interface */
int dev; /* device number */ int devnum; /* device number */
unsigned char part_type; /* partition type */ unsigned char part_type; /* partition type */
unsigned char target; /* target SCSI ID */ unsigned char target; /* target SCSI ID */
unsigned char lun; /* target LUN */ unsigned char lun; /* target LUN */