Skip to contentSkip to conversation

cmd: fdt: memory fixup

RFC In review Ladislav Michl 2 participants 3 messages Jan 31, 2017 – Feb 5, 2017

lore
Share & tools
lore
#0 lore raw

RFC 1/1 cmd: fdt: memory fixup

To get Falcon mode working with zImage is currently non trivial as zImages do not fit into U-Boot's image concept too well. Fortunately at least for ARM boards it seems getting memory node right is quite sufficient. What about changing 'fdt memory' command to update memory node according to detected memory layout when called without parameters?

ladis

cmd/fdt.c +16 -4
index 95dd673b95..e08296d51c 100644
@@ -517,11 +517,23 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	 * memory command
 	 */
 	} else if (strncmp(argv[1], "me", 2) == 0) {
-		uint64_t addr, size;
 		int err;
-		addr = simple_strtoull(argv[2], NULL, 16);
-		size = simple_strtoull(argv[3], NULL, 16);
-		err = fdt_fixup_memory(working_fdt, addr, size);
+		if (argc < 4) {
+			int i;
+			uint64_t start[CONFIG_NR_DRAM_BANKS];
+			uint64_t size[CONFIG_NR_DRAM_BANKS];
+			bd_t *bd = gd->bd;
+			for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+				start[i] = bd->bi_dram[i].start;
+				size[i] = bd->bi_dram[i].size;
+			}
+			err = fdt_fixup_memory_banks(working_fdt, start, size,
+						CONFIG_NR_DRAM_BANKS);
+		} else {
+			uint64_t addr = simple_strtoull(argv[2], NULL, 16);
+			uint64_t size = simple_strtoull(argv[3], NULL, 16);
+			err = fdt_fixup_memory(working_fdt, addr, size);
+		}
 		if (err < 0)
 			return err;
 
#1 lore raw
Quoted 5 lines · Ladislav Michl

To get Falcon mode working with zImage is currently non trivial as zImages do not fit into U-Boot's image concept too well. Fortunately at least for ARM boards it seems getting memory node right is quite sufficient. What about changing 'fdt memory' command to update memory node according to detected memory layout when called without parameters?

Looked at other (!arm) platforms implementation... Does not seem like good idea anymore. What about adding posibility to call ft_arch_fixup? Other ideas?

Thank you,
ladis

#2 lore raw
In reply to Ladislav Michl
Quoted 5 lines · Ladislav Michl

To get Falcon mode working with zImage is currently non trivial as zImages do not fit into U-Boot's image concept too well. Fortunately at least for ARM boards it seems getting memory node right is quite sufficient. What about changing 'fdt memory' command to update memory node according to detected memory layout when called without parameters?

I'm not quite sure I follow this, sorry. The 'spl' command should be extended cover 'zImage and 'Images', which I think shouldn't be too hard at this point given how the abstractions work today, and then the normal mechanism to prepare the 'args' portion should work.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170205/b617aa08/attachment.sig>