1
2
3
4
5
6
7
8#include <common.h>
9#include <command.h>
10#include <console.h>
11#if !defined(CONFIG_440)
12#include <asm/4xx_pci.h>
13#endif
14
15#if defined(CONFIG_CMD_BSP)
16#define ADDRMASK 0xfffff000
17
18
19
20
21int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
22{
23 u32 *ptr = 0;
24 int count = 0;
25 int count2 = 0;
26 char addr[16];
27 char str[] = "\\|/-";
28 u32 la, ptm1la;
29
30#if defined(CONFIG_440)
31 ptm1la = in32r(PCIL0_PTM1LA);
32#else
33 ptm1la = in32r(PTM1LA);
34#endif
35 while(1) {
36
37
38
39 ptr = (u32 *)ptm1la;
40 memset(ptr, 0, 0x20);
41
42 *ptr = 0xffffffff;
43 puts("\nWaiting for action from pci host -");
44
45
46
47
48 while (*ptr == 0xffffffff) {
49 count++;
50 if (!(count % 100)) {
51 count2++;
52 putc(0x08);
53 putc(str[count2 % 4]);
54 }
55
56
57 if (ctrlc()) {
58 puts("\nAbort\n");
59 return 0;
60 }
61
62 udelay(1000);
63 }
64
65 printf("\nGot bootcode %08x: ", *ptr);
66 la = ptm1la + (*ptr & ADDRMASK);
67 sprintf(addr, "%08x", la);
68
69 switch (*ptr & ~ADDRMASK) {
70 case 0:
71
72
73
74 printf("booting image at addr 0x%s ...\n", addr);
75 setenv("loadaddr", addr);
76 do_bootm(cmdtp, 0, 0, NULL);
77 break;
78
79 case 1:
80
81
82
83 printf("executing script at addr 0x%s ...\n", addr);
84 source(la, NULL);
85 break;
86
87 case 2:
88
89
90
91 printf("running command at addr 0x%s ...\n", addr);
92 run_command((char *)la, 0);
93 break;
94
95 default:
96 printf("unhandled boot method\n");
97 break;
98 }
99 }
100}
101
102U_BOOT_CMD(
103 loadpci, 1, 1, do_loadpci,
104 "Wait for pci bootcmd and boot it",
105 ""
106);
107
108#endif
109