summaryrefslogtreecommitdiffstats
path: root/common/cmd_ide.c
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.com>2013-04-09 21:11:56 +0000
committerTom Rini <trini@ti.com>2013-05-01 16:24:02 -0400
commit0472fbfd3250d1a33d3de78afdcbf24f78ac026b (patch)
tree1d5f822e2d95f800121368bba96a185ae6f7b0fb /common/cmd_ide.c
parentbc8d98713f10582f4e35b9208f1b967c6a9f9953 (diff)
downloadtalos-obmc-uboot-0472fbfd3250d1a33d3de78afdcbf24f78ac026b.tar.gz
talos-obmc-uboot-0472fbfd3250d1a33d3de78afdcbf24f78ac026b.zip
part/dev_desc: Add log2 of blocksize to block_dev_desc data struct
log2 of the device block size serves as the shift value used to calculate the block number to read in file systems when implementing avaiable block sizes. It is needed quite often in file systems thus it is pre-calculated and stored in the block device descriptor. Signed-off-by: Egbert Eich <eich@suse.com>
Diffstat (limited to 'common/cmd_ide.c')
-rw-r--r--common/cmd_ide.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 0105bdbb7f..78b4aa70ba 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -455,6 +455,8 @@ void ide_init(void)
ide_dev_desc[i].dev = i;
ide_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
ide_dev_desc[i].blksz = 0;
+ ide_dev_desc[i].log2blksz =
+ LOG2_INVALID(typeof(ide_dev_desc[i].log2blksz));
ide_dev_desc[i].lba = 0;
ide_dev_desc[i].block_read = ide_read;
ide_dev_desc[i].block_write = ide_write;
@@ -806,6 +808,7 @@ static void ide_ident(block_dev_desc_t *dev_desc)
/* assuming HD */
dev_desc->type = DEV_TYPE_HARDDISK;
dev_desc->blksz = ATA_BLOCKSIZE;
+ dev_desc->log2blksz = LOG2(dev_desc->blksz);
dev_desc->lun = 0; /* just to fill something in... */
#if 0 /* only used to test the powersaving mode,
@@ -1448,6 +1451,7 @@ static void atapi_inquiry(block_dev_desc_t *dev_desc)
dev_desc->lun = 0;
dev_desc->lba = 0;
dev_desc->blksz = 0;
+ dev_desc->log2blksz = LOG2_INVALID(typeof(dev_desc->log2blksz));
dev_desc->type = iobuf[0] & 0x1f;
if ((iobuf[1] & 0x80) == 0x80)
@@ -1492,6 +1496,7 @@ static void atapi_inquiry(block_dev_desc_t *dev_desc)
dev_desc->blksz = ((unsigned long) iobuf[4] << 24) +
((unsigned long) iobuf[5] << 16) +
((unsigned long) iobuf[6] << 8) + ((unsigned long) iobuf[7]);
+ dev_desc->log2blksz = LOG2(dev_desc->blksz);
#ifdef CONFIG_LBA48
/* ATAPI devices cannot use 48bit addressing (ATA/ATAPI v7) */
dev_desc->lba48 = 0;
OpenPOWER on IntegriCloud