[U-Boot] [PATCH 4/5] part/dev_desc: Add log2 of Blocksize to block_dev_desc data struct.

2013-03-26 Thread egbert . eich
From: Egbert Eich e...@suse.com

This value serves as the shift value used to calculate the block number
to read in file systems when implementing aviable block sizes.

Signed-off-by: Egbert Eich e...@suse.com
---
 common/cmd_ide.c  |4 
 common/cmd_sata.c |1 +
 common/cmd_scsi.c |2 ++
 common/usb_storage.c  |1 +
 drivers/block/ata_piix.c  |1 +
 drivers/block/pata_bfin.c |1 +
 drivers/block/systemace.c |1 +
 drivers/mmc/mmc.c |1 +
 include/part.h|5 +
 9 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 0105bdb..de981f7 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -455,6 +455,7 @@ 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)); /* just init to an invalid 
value */
ide_dev_desc[i].lba = 0;
ide_dev_desc[i].block_read = ide_read;
ide_dev_desc[i].block_write = ide_write;
@@ -806,6 +807,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 +1450,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)); /* 
just init to an invalid value */
dev_desc-type = iobuf[0]  0x1f;
 
if ((iobuf[1]  0x80) == 0x80)
@@ -1492,6 +1495,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;
diff --git a/common/cmd_sata.c b/common/cmd_sata.c
index 8d57285..5a57a37 100644
--- a/common/cmd_sata.c
+++ b/common/cmd_sata.c
@@ -44,6 +44,7 @@ int __sata_initialize(void)
sata_dev_desc[i].type = DEV_TYPE_HARDDISK;
sata_dev_desc[i].lba = 0;
sata_dev_desc[i].blksz = 512;
+   sata_dev_desc[i].log2blksz = LOG2(sata_dev_desc[i].blksz);
sata_dev_desc[i].block_read = sata_read;
sata_dev_desc[i].block_write = sata_write;
 
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 266bfa6..cf2cbba 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -106,6 +106,7 @@ void scsi_scan(int mode)
scsi_dev_desc[i].lun=0xff;
scsi_dev_desc[i].lba=0;
scsi_dev_desc[i].blksz=0;
+   scsi_dev_desc[i].log2blksz = 
LOG2_INVALID(typeof(scsi_dev_desc[i].log2blksz)); /* just init to an invalid 
value */
scsi_dev_desc[i].type=DEV_TYPE_UNKNOWN;
scsi_dev_desc[i].vendor[0]=0;
scsi_dev_desc[i].product[0]=0;
@@ -166,6 +167,7 @@ void scsi_scan(int mode)
}
scsi_dev_desc[scsi_max_devs].lba=capacity;
scsi_dev_desc[scsi_max_devs].blksz=blksz;
+   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]);
 removable:
diff --git a/common/usb_storage.c b/common/usb_storage.c
index fb322b4..c5db044 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -1430,6 +1430,7 @@ int usb_stor_get_info(struct usb_device *dev, struct 
us_data *ss,
*capacity, *blksz);
dev_desc-lba = *capacity;
dev_desc-blksz = *blksz;
+   dev_desc-log2blksz = LOG2(dev_desc-blksz);
dev_desc-type = perq;
USB_STOR_PRINTF( address %d\n, dev_desc-target);
USB_STOR_PRINTF(partype: %d\n, dev_desc-part_type);
diff --git a/drivers/block/ata_piix.c b/drivers/block/ata_piix.c
index 1e33a66..fcae448 100644
--- a/drivers/block/ata_piix.c
+++ b/drivers/block/ata_piix.c
@@ -406,6 +406,7 @@ void sata_identify(int num, int dev)
/* assuming HD */
sata_dev_desc[devno].type = DEV_TYPE_HARDDISK;
sata_dev_desc[devno].blksz = ATA_BLOCKSIZE;
+   sata_dev_desc[devno].log2blksz = LOG2(sata_dev_desc[devno].blksz);
sata_dev_desc[devno].lun = 0;   /* just to fill something in... */
 }
 
diff --git a/drivers/block/pata_bfin.c b/drivers/block/pata_bfin.c

Re: [U-Boot] [PATCH 4/5] part/dev_desc: Add log2 of Blocksize to block_dev_desc data struct.

2013-03-26 Thread Wolfgang Denk
Dear egbert.e...@googlemail.com,

In message 1364285735-2364-5-git-send-email-egbert.e...@gmail.com you wrote:
 From: Egbert Eich e...@suse.com
 
 This value serves as the shift value used to calculate the block number
 to read in file systems when implementing aviable block sizes.
 
 Signed-off-by: Egbert Eich e...@suse.com
 ---
  common/cmd_ide.c  |4 
  common/cmd_sata.c |1 +
  common/cmd_scsi.c |2 ++
  common/usb_storage.c  |1 +
  drivers/block/ata_piix.c  |1 +
  drivers/block/pata_bfin.c |1 +
  drivers/block/systemace.c |1 +
  drivers/mmc/mmc.c |1 +
  include/part.h|5 +
  9 files changed, 17 insertions(+), 0 deletions(-)


WARNING: line over 80 characters
#127: FILE: common/cmd_ide.c:458:
+   ide_dev_desc[i].log2blksz = 
LOG2_INVALID(typeof(ide_dev_desc[i].log2blksz)); /* just init to an invalid 
value */

WARNING: line over 80 characters
#143: FILE: common/cmd_ide.c:1453:
+   dev_desc-log2blksz = LOG2_INVALID(typeof(dev_desc-log2blksz)); /* 
just init to an invalid value */

WARNING: line over 80 characters
#175: FILE: common/cmd_scsi.c:109:
+   scsi_dev_desc[i].log2blksz = 
LOG2_INVALID(typeof(scsi_dev_desc[i].log2blksz)); /* just init to an invalid 
value */

WARNING: line over 80 characters
#183: FILE: common/cmd_scsi.c:170:
+   scsi_dev_desc[scsi_max_devs].log2blksz = 
LOG2(scsi_dev_desc[scsi_max_devs].blksz);

WARNING: line over 80 characters
#219: FILE: drivers/block/pata_bfin.c:900:
+   sata_dev_desc[ap-port_no].log2blksz = 
LOG2(sata_dev_desc[ap-port_no].blksz);

total: 0 errors, 5 warnings, 101 lines checked

/home/wd/Mail/U-Boot/7152 has style problems, please review.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
It follows that any commander in chief who undertakes to carry out a
plan which he considers defective is at fault; he must put forth  his
reasons,  insist  of  the  plan being changed, and finally tender his
resignation rather than be the instrument of his army's downfall.
- Napoleon, Military Maxims and Thought
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot