]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - disk/part_efi.c
Fix PCI_BASE_ADDRESS_5 handling in pci_hose_config_device()
[karo-tx-uboot.git] / disk / part_efi.c
index 979019ac80175053da7da32b7bfbcb3b6ac4d410..1b04c27cea914186eea0187713287e19b13e6f9e 100644 (file)
  */
 
 /*
- * Problems with CFG_64BIT_LBA:
+ * Problems with CONFIG_SYS_64BIT_LBA:
  *
  * struct disk_partition.start in include/part.h is sized as ulong.
- * When CFG_64BIT_LBA is activated, lbaint_t changes from ulong to uint64_t.
+ * When CONFIG_SYS_64BIT_LBA is activated, lbaint_t changes from ulong to uint64_t.
  * For now, it is cast back to ulong at assignment.
  *
  * This limits the maximum size of addressable storage to < 2 Terra Bytes
 #include <malloc.h>
 #include "part_efi.h"
 
-#if (defined(CONFIG_CMD_IDE) || \
-     defined(CONFIG_CMD_SATA) || \
-     defined(CONFIG_CMD_SCSI) || \
-     defined(CONFIG_CMD_USB) || \
-     defined(CONFIG_MMC) || \
-     defined(CONFIG_SYSTEMACE) ) && defined(CONFIG_EFI_PARTITION)
+#if defined(CONFIG_CMD_IDE) || \
+    defined(CONFIG_CMD_MG_DISK) || \
+    defined(CONFIG_CMD_SATA) || \
+    defined(CONFIG_CMD_SCSI) || \
+    defined(CONFIG_CMD_USB) || \
+    defined(CONFIG_MMC) || \
+    defined(CONFIG_SYSTEMACE)
 
 /* Convert char[2] in little endian format to the host format integer
  */
@@ -163,10 +164,12 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
 
        /* The ulong casting limits the maximum disk size to 2 TB */
        info->start = (ulong) le64_to_int((*pgpt_pte)[part - 1].starting_lba);
-       info->size = (ulong) le64_to_int((*pgpt_pte)[part - 1].ending_lba) - info->start;
+       /* The ending LBA is inclusive, to calculate size, add 1 to it */
+       info->size = ((ulong)le64_to_int((*pgpt_pte)[part - 1].ending_lba) + 1)
+                    - info->start;
        info->blksz = GPT_BLOCK_SIZE;
 
-       sprintf((char *)info->name, "%s%d\n", GPT_ENTRY_NAME, part);
+       sprintf((char *)info->name, "%s%d", GPT_ENTRY_NAME, part);
        sprintf((char *)info->type, "U-Boot");
 
        debug("%s: start 0x%lX, size 0x%lX, name %s", __FUNCTION__,