diff options
Diffstat (limited to 'disk/part.c')
-rw-r--r-- | disk/part.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/disk/part.c b/disk/part.c index 0acc5c2..783b391 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"); } |