3 * Matthias Fuchs, esd GmbH Germany, matthias.fuchs@esd-electronics.com
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 #if (CONFIG_COMMANDS & CFG_CMD_BSP)
29 extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
30 extern int do_autoscript (cmd_tbl_t *, int, int, char *[]);
32 #define ADDRMASK 0xfffff000
35 * Command loadpci: wait for signal from host and boot image.
37 int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
39 unsigned int *ptr = 0;
54 puts("\nWaiting for action from pci host -");
57 * Wait for host to write the start address
59 while (*ptr == 0xffffffff) {
63 putc(0x08); /* backspace */
64 putc(str[count2 % 4]);
67 /* Abort if ctrl-c was pressed */
76 printf("\nGot bootcode %08x: ", *ptr);
77 sprintf(addr, "%08x", *ptr & ADDRMASK);
79 switch (*ptr & ~ADDRMASK) {
82 * Boot image via bootm
84 printf("booting image at addr 0x%s ...\n", addr);
85 setenv("loadaddr", addr);
87 do_bootm (cmdtp, 0, 0, NULL);
92 * Boot image via autoscr
94 printf("executing script at addr 0x%s ...\n", addr);
98 do_autoscript(cmdtp, 0, 1, local_args);
105 printf("running command at addr 0x%s ...\n", addr);
106 run_command ((char*)(*ptr & ADDRMASK), 0);
110 printf("unhandled boot method\n");
117 loadpci, 1, 1, do_loadpci,
118 "loadpci - Wait for pci bootcmd and boot it\n",