2 * (C) Copyright 2002-2004
3 * Stefan Roese, esd gmbh germany, stefan.roese@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,
30 #include <asm/4xx_pci.h>
31 #include <asm/processor.h>
35 #if defined(CONFIG_CMD_BSP)
38 * Command loadpci: wait for signal from host and boot image.
40 int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
42 unsigned int *ptr = 0;
56 puts("\nWaiting for image from pci host -");
59 * Wait for host to write the start address
61 while (*ptr == 0xffffffff) {
65 putc(0x08); /* backspace */
66 putc(str[count2 % 4]);
69 /* Abort if ctrl-c was pressed */
78 if (*ptr == PCI_RECONFIG_MAGIC) {
80 * Save own pci configuration in PRAM
82 memset((char *)PCI_REGS_ADDR, 0, PCI_REGS_LEN);
83 ptr = (unsigned int *)PCI_REGS_ADDR + 1;
84 for (i=0; i<0x40; i+=4) {
85 pci_read_config_dword(PCIDEVID_405GP, i, ptr++);
87 ptr = (unsigned int *)PCI_REGS_ADDR;
88 *ptr = crc32(0, (uchar *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4);
90 printf("\nStoring PCI Configuration Regs...\n");
92 sprintf(addr, "%08x", *ptr);
95 * Boot image via bootm
97 printf("\nBooting Image at addr 0x%s ...\n", addr);
98 setenv("loadaddr", addr);
100 local_args[0] = argv[0];
101 local_args[1] = NULL;
102 status = do_bootm (cmdtp, 0, 1, local_args);
108 loadpci, 1, 1, do_loadpci,
109 "Wait for pci-image and boot it",