[brcm47xx] Remove patches already applied in generic and refresh patches.
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-2.6.28 / 800-fix_cfe_detection.patch
1 --- a/arch/mips/bcm47xx/prom.c
2 +++ b/arch/mips/bcm47xx/prom.c
3 @@ -32,6 +32,7 @@
4 #include <asm/fw/cfe/cfe_error.h>
5
6 static int cfe_cons_handle;
7 +static void (* __prom_putchar)(char c);
8
9 const char *get_system_type(void)
10 {
11 @@ -40,65 +41,40 @@ const char *get_system_type(void)
12
13 void prom_putchar(char c)
14 {
15 + if (__prom_putchar)
16 + __prom_putchar(c);
17 +}
18 +
19 +void prom_putchar_cfe(char c)
20 +{
21 while (cfe_write(cfe_cons_handle, &c, 1) == 0)
22 ;
23 }
24
25 -static __init void prom_init_cfe(void)
26 +static __init int prom_init_cfe(void)
27 {
28 uint32_t cfe_ept;
29 uint32_t cfe_handle;
30 uint32_t cfe_eptseal;
31 - int argc = fw_arg0;
32 - char **envp = (char **) fw_arg2;
33 - int *prom_vec = (int *) fw_arg3;
34 -
35 - /*
36 - * Check if a loader was used; if NOT, the 4 arguments are
37 - * what CFE gives us (handle, 0, EPT and EPTSEAL)
38 - */
39 - if (argc < 0) {
40 - cfe_handle = (uint32_t)argc;
41 - cfe_ept = (uint32_t)envp;
42 - cfe_eptseal = (uint32_t)prom_vec;
43 - } else {
44 - if ((int)prom_vec < 0) {
45 - /*
46 - * Old loader; all it gives us is the handle,
47 - * so use the "known" entrypoint and assume
48 - * the seal.
49 - */
50 - cfe_handle = (uint32_t)prom_vec;
51 - cfe_ept = 0xBFC00500;
52 - cfe_eptseal = CFE_EPTSEAL;
53 - } else {
54 - /*
55 - * Newer loaders bundle the handle/ept/eptseal
56 - * Note: prom_vec is in the loader's useg
57 - * which is still alive in the TLB.
58 - */
59 - cfe_handle = prom_vec[0];
60 - cfe_ept = prom_vec[2];
61 - cfe_eptseal = prom_vec[3];
62 - }
63 - }
64
65 - if (cfe_eptseal != CFE_EPTSEAL) {
66 - /* too early for panic to do any good */
67 - printk(KERN_ERR "CFE's entrypoint seal doesn't match.");
68 - while (1) ;
69 - }
70 + cfe_eptseal = (uint32_t) fw_arg3;
71 + cfe_handle = (uint32_t) fw_arg0;
72 + cfe_ept = (uint32_t) fw_arg2;
73 +
74 + if (cfe_eptseal != CFE_EPTSEAL)
75 + return -1;
76
77 cfe_init(cfe_handle, cfe_ept);
78 + return 0;
79 }
80
81 -static __init void prom_init_console(void)
82 +static __init void prom_init_console_cfe(void)
83 {
84 /* Initialize CFE console */
85 cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE);
86 }
87
88 -static __init void prom_init_cmdline(void)
89 +static __init void prom_init_cmdline_cfe(void)
90 {
91 char buf[CL_SIZE];
92
93 @@ -154,9 +130,12 @@ static __init void prom_init_mem(void)
94
95 void __init prom_init(void)
96 {
97 - prom_init_cfe();
98 - prom_init_console();
99 - prom_init_cmdline();
100 + if (prom_init_cfe() == 0) {
101 + //prom_init_console_cfe();
102 + //prom_init_cmdline_cfe();
103 + __prom_putchar = prom_putchar_cfe;
104 + }
105 +
106 prom_init_mem();
107 }
108