summaryrefslogtreecommitdiff
path: root/disk
diff options
context:
space:
mode:
authorJi Luo <ji.luo@nxp.com>2019-06-21 15:53:50 +0800
committerJi Luo <ji.luo@nxp.com>2020-05-18 09:45:08 +0800
commited915f7d455a34ede75d9962919181b8b8ba57ec (patch)
tree4c0a39ebbc104a1231f1e285f863fcab3400f260 /disk
parent648a4c5376bed206061bd12f5991a55ac8aeabb3 (diff)
MA-14916-4 support dual bootloader for imx8m/imx8q
This commit enables dual bootloader feature for imx8m/imx8q, but as commit 'a2018ab' already brings in some dual bootloader codes when enabling fastboot support, so this commit won't be a complete and standalone patch to introduce the dual bootloader feature. This commit will do the following: 1. clean up dual bootloader flow and add missing implementation. 2. Merge the dual bootloader entry for fit and container to one function 'mmc_load_image_raw_sector_dual_uboot'. Change-Id: Ic9410a48092cc05de599dd897fc912177e2a1fe1 Signed-off-by: Ji Luo <ji.luo@nxp.com>
Diffstat (limited to 'disk')
-rw-r--r--disk/part_efi.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/disk/part_efi.c b/disk/part_efi.c
index d7203e68d2..0ac9ea6d9b 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -266,8 +266,10 @@ void part_print_efi(struct blk_desc *dev_desc)
printf("\tguid:\t%s\n", uuid);
}
+#if !defined(CONFIG_DUAL_BOOTLOADER) || !defined(CONFIG_SPL_BUILD)
/* Remember to free pte */
free(gpt_pte);
+#endif
return;
}
@@ -291,7 +293,9 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part,
!is_pte_valid(&gpt_pte[part - 1])) {
debug("%s: *** ERROR: Invalid partition number %d ***\n",
__func__, part);
+#if !defined(CONFIG_DUAL_BOOTLOADER) || !defined(CONFIG_SPL_BUILD)
free(gpt_pte);
+#endif
return -1;
}
@@ -318,8 +322,14 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part,
debug("%s: start 0x" LBAF ", size 0x" LBAF ", name %s\n", __func__,
info->start, info->size, info->name);
- /* Remember to free pte */
+#if !defined(CONFIG_DUAL_BOOTLOADER) || !defined(CONFIG_SPL_BUILD)
+ /* Heap memory is very limited in SPL, if the dual bootloader is
+ * enabled, just load pte to dram instead of oc-ram. In such case,
+ * this part of memory shouldn't be freed. But in common routine,
+ * don't forget to free the memory after use.
+ */
free(gpt_pte);
+#endif
return 0;
}
@@ -1106,10 +1116,19 @@ static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc,
(u32) le32_to_cpu(pgpt_head->sizeof_partition_entry),
(ulong)count);
- /* Allocate memory for PTE, remember to FREE */
+ /* Allocate memory for PTE.
+ * Heap memory is very limited in SPL, if the dual bootloader is
+ * enabled, just load pte to dram instead of oc-ram. In such case,
+ * this part of memory shouldn't be freed. But in common routine,
+ * don't forget to free the memory after use.
+ */
if (count != 0) {
+#if defined(CONFIG_DUAL_BOOTLOADER) && defined(CONFIG_SPL_BUILD)
+ pte = (gpt_entry *)CONFIG_SYS_SPL_PTE_RAM_BASE;
+#else
pte = memalign(ARCH_DMA_MINALIGN,
PAD_TO_BLOCKSIZE(count, dev_desc));
+#endif
}
if (count == 0 || pte == NULL) {
@@ -1123,7 +1142,9 @@ static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc,
blk_cnt = BLOCK_CNT(count, dev_desc);
if (blk_dread(dev_desc, blk, (lbaint_t)blk_cnt, pte) != blk_cnt) {
printf("*** ERROR: Can't read GPT Entries ***\n");
+#if !defined(CONFIG_DUAL_BOOTLOADER) || !defined(CONFIG_SPL_BUILD)
free(pte);
+#endif
return NULL;
}
return pte;