[U-Boot] [PATCH 3/6] ppc4xx: Fix esd loadpci command

matthias.fuchs at esd-electronics.com matthias.fuchs at esd-electronics.com
Wed Oct 8 18:20:08 CEST 2008


From: Matthias Fuchs <matthias.fuchs at esd-electronics.com>

This patch fixes esd's loadpci command when not all
memory on adapter boards is accessable via PCI.

Signed-off-by: Matthias Fuchs <matthias.fuchs at esd-electronics.com>
---
 board/esd/common/cmd_loadpci.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/board/esd/common/cmd_loadpci.c b/board/esd/common/cmd_loadpci.c
index d88b387..5db0678 100644
--- a/board/esd/common/cmd_loadpci.c
+++ b/board/esd/common/cmd_loadpci.c
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2005
+ * (C) Copyright 2005-2008
  * Matthias Fuchs, esd GmbH Germany, matthias.fuchs at esd-electronics.com
  *
  * See file CREDITS for list of people who contributed to this
@@ -36,18 +36,21 @@ extern int do_autoscript (cmd_tbl_t *, int, int, char *[]);
  */
 int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-	unsigned int *ptr = 0;
+	u32 *ptr = 0;
 	int count = 0;
 	int count2 = 0;
 	char addr[16];
 	char str[] = "\\|/-";
 	char *local_args[2];
+	u32 la, ptm1la;
+
+	ptm1la = in32r(PCIX0_PTM1LA);
 
 	while(1) {
 		/*
 		 * Mark sync address
 		 */
-		ptr = 0;
+		ptr = (u32 *)ptm1la;
 		memset(ptr, 0, 0x20);
 
 		*ptr = 0xffffffff;
@@ -74,7 +77,8 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		}
 
 		printf("\nGot bootcode %08x: ", *ptr);
-		sprintf(addr, "%08x", *ptr & ADDRMASK);
+		la = ptm1la + (*ptr & ADDRMASK);
+		sprintf(addr, "%08x", la);
 
 		switch (*ptr & ~ADDRMASK) {
 		case 0:
@@ -83,8 +87,7 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 			 */
 			printf("booting image at addr 0x%s ...\n", addr);
 			setenv("loadaddr", addr);
-
-			do_bootm (cmdtp, 0, 0, NULL);
+			do_bootm(cmdtp, 0, 0, NULL);
 			break;
 
 		case 1:
@@ -92,7 +95,6 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 			 * Boot image via autoscr
 			 */
 			printf("executing script at addr 0x%s ...\n", addr);
-
 			local_args[0] = addr;
 			local_args[1] = NULL;
 			do_autoscript(cmdtp, 0, 1, local_args);
@@ -103,7 +105,7 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 			 * Call run_cmd
 			 */
 			printf("running command at addr 0x%s ...\n", addr);
-			run_command ((char*)(*ptr & ADDRMASK), 0);
+			run_command((char*)la, 0);
 			break;
 
 		default:
-- 
1.5.3



More information about the U-Boot mailing list