summaryrefslogtreecommitdiff
path: root/disk/part.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-03-13 23:29:43 +0000
committerwdenk <wdenk>2004-03-13 23:29:43 +0000
commitc40b29568232761e33400e58be86b15a167d3422 (patch)
treec306e01e8cf535467fb448499304020d251a763a /disk/part.c
parent6629d2f22b4af180dc41defe2396bafcd8fe4093 (diff)
* 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"
Diffstat (limited to 'disk/part.c')
-rw-r--r--disk/part.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/disk/part.c b/disk/part.c
index 0acc5c206cf..783b391c5ad 100644
--- a/disk/part.c
+++ b/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");
}