2 * (C) Copyright 2005-2008
3 * Matthias Fuchs, esd GmbH Germany, matthias.fuchs@esd-electronics.com
5 * SPDX-License-Identifier: GPL-2.0+
10 #if !defined(CONFIG_440)
11 #include <asm/4xx_pci.h>
14 #if defined(CONFIG_CMD_BSP)
16 extern int do_source (cmd_tbl_t *, int, int, char *[]);
18 #define ADDRMASK 0xfffff000
21 * Command loadpci: wait for signal from host and boot image.
23 int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
33 #if defined(CONFIG_440)
34 ptm1la = in32r(PCIL0_PTM1LA);
36 ptm1la = in32r(PTM1LA);
46 puts("\nWaiting for action from pci host -");
49 * Wait for host to write the start address
51 while (*ptr == 0xffffffff) {
55 putc(0x08); /* backspace */
56 putc(str[count2 % 4]);
59 /* Abort if ctrl-c was pressed */
68 printf("\nGot bootcode %08x: ", *ptr);
69 la = ptm1la + (*ptr & ADDRMASK);
70 sprintf(addr, "%08x", la);
72 switch (*ptr & ~ADDRMASK) {
75 * Boot image via bootm
77 printf("booting image at addr 0x%s ...\n", addr);
78 setenv("loadaddr", addr);
79 do_bootm(cmdtp, 0, 0, NULL);
84 * Boot image via "source" command
86 printf("executing script at addr 0x%s ...\n", addr);
89 do_source(cmdtp, 0, 1, local_args);
96 printf("running command at addr 0x%s ...\n", addr);
97 run_command((char *)la, 0);
101 printf("unhandled boot method\n");
108 loadpci, 1, 1, do_loadpci,
109 "Wait for pci bootcmd and boot it",