[U-Boot-Users] [RFC][WIP] ePAPR boot and provide a mechanism to disable ft board setup

Kumar Gala galak at kernel.crashing.org
Wed Aug 6 01:13:17 CEST 2008


Is this something we'd be willing to put into mainline?

- k

diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index a872d31..3ebddd3 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -192,7 +192,8 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 		}
 #ifdef CONFIG_OF_BOARD_SETUP
 		/* Call the board-specific fixup routine */
-		ft_board_setup(of_flat_tree, gd->bd);
+		if (!getenv_yesno("disable_fdt_boardsetup"))
+			ft_board_setup(of_flat_tree, gd->bd);
 #endif
 	}

@@ -821,3 +822,67 @@ error:
 	return 1;
 }
 #endif
+
+/*******************************************************************/
+/* boote - boot ePAPR */
+/*******************************************************************/
+#if defined(CONFIG_CMD_BOOT_EPAPR)
+int do_boot_epapr (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	void  (*kernel)(ulong r3, ulong r4, ulong r5, ulong r6,
+			ulong r7, ulong r8, ulong r9);
+	ulong kern, of_flat_tree, epapr_magic;
+
+	if (argc != 3) {
+                printf ("Usage:\n%s\n", cmdtp->usage);
+                return 1;
+        }
+
+	kern = simple_strtoul (argv[1], NULL, 16);
+	of_flat_tree = simple_strtoul (argv[2], NULL, 16);
+
+	if (kern & 0x3) {
+                printf ("kernel address 0x%lx is not 4-byte aligned\n", kern);
+                return 1;
+	}
+
+	if (of_flat_tree & 0x7) {
+                printf ("Flat device tree address 0x%lx is not 8-byte aligned\n", of_flat_tree);
+                return 1;
+	}
+
+	if (!getenv_yesno ("autostart"))
+		return 0;
+
+	kernel = (void (*)(ulong, ulong, ulong, ulong,
+			   ulong, ulong, ulong))kern;
+
+	/*
+	 * Linux Kernel Parameters (passing device tree):
+	 *   r3: pointer to the fdt
+	 *   r4: 0
+	 *   r5: 0
+	 *   r6: epapr magic
+	 *   r7: 0
+	 *   r8: 0
+	 *   r9: 0
+	 */
+#if defined(CONFIG_85xx) || defined(CONFIG_440)
+	epapr_magic = 0x45504150;
+#else
+	epapr_magic = 0x65504150;
+#endif
+
+	debug ("   Booting using OF flat tree...\n");
+	(*kernel) (of_flat_tree, 0, 0, epapr_magic, 0, 0, 0);
+	/* does not return */
+
+	return 0;
+}
+
+U_BOOT_CMD(
+	bootepapr,	3,	1,	do_boot_epapr,
+	"bootepapr - boot according to ePAPR client interface\n",
+	"<entry point> <device tree address>\n"
+);
+#endif
-- 
1.5.5.1





More information about the U-Boot mailing list