* Patch by Rune Torgersen, 27 Feb 2004:
- Added LBA48 support (CONFIG_LBA48 & CFG_64BIT_LBA) - Added support for 64bit printing in vsprintf (CFG_64BIT_VSPRINTF) - Added support for 64bit strtoul (CFG_64BIT_STRTOUL) * Patch by Masami Komiya, 27 Feb 2004: Fix rarpboot: add autoload by NFS * Patch by Dan Eisenhut, 26 Feb 2004: fix flash_write return value in saveenv * Patch by Stephan Linz, 11 Dec 2003 expand config.mk to avoid trigraph warnings on NIOS * Rename "BMS2003" board into "HMI10"
This commit is contained in:
31
disk/part.c
31
disk/part.c
@@ -44,7 +44,11 @@
|
||||
*/
|
||||
void dev_print (block_dev_desc_t *dev_desc)
|
||||
{
|
||||
ulong lba512; /* number of blocks if 512bytes block size */
|
||||
#if CONFIG_LBA48
|
||||
uint64_t lba512; /* number of blocks if 512bytes block size */
|
||||
#else
|
||||
lbaint_t lba512;
|
||||
#endif
|
||||
|
||||
if (dev_desc->type==DEV_TYPE_UNKNOWN) {
|
||||
puts ("not available\n");
|
||||
@@ -82,9 +86,15 @@ void dev_print (block_dev_desc_t *dev_desc)
|
||||
puts ("\n");
|
||||
if ((dev_desc->lba * dev_desc->blksz)>0L) {
|
||||
ulong mb, mb_quot, mb_rem, gb, gb_quot, gb_rem;
|
||||
lbaint_t lba;
|
||||
#if CONFIG_LBA48
|
||||
if (dev_desc->lba48support)
|
||||
lba = dev_desc->lba48;
|
||||
else
|
||||
#endif
|
||||
lba = dev_desc->lba;
|
||||
|
||||
lba512 = (dev_desc->lba * (dev_desc->blksz/512));
|
||||
|
||||
lba512 = (lba * (dev_desc->blksz/512));
|
||||
mb = (10 * lba512) / 2048; /* 2048 = (1024 * 1024) / 512 MB */
|
||||
/* round to 1 digit */
|
||||
mb_quot = mb / 10;
|
||||
@@ -93,12 +103,23 @@ void dev_print (block_dev_desc_t *dev_desc)
|
||||
gb = mb / 1024;
|
||||
gb_quot = gb / 10;
|
||||
gb_rem = gb - (10 * gb_quot);
|
||||
|
||||
#if CONFIG_LBA48
|
||||
if (dev_desc->lba48support)
|
||||
printf (" Supports 48-bit addressing\n");
|
||||
#endif
|
||||
#if CFG_64BIT_LBA && CFG_64BIT_VSPRINTF
|
||||
printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%qd x %ld)\n",
|
||||
mb_quot, mb_rem,
|
||||
gb_quot, gb_rem,
|
||||
lba,
|
||||
dev_desc->blksz);
|
||||
#else
|
||||
printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%ld x %ld)\n",
|
||||
mb_quot, mb_rem,
|
||||
gb_quot, gb_rem,
|
||||
dev_desc->lba,
|
||||
(ulong)lba,
|
||||
dev_desc->blksz);
|
||||
#endif
|
||||
} else {
|
||||
puts (" Capacity: not available\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user