800-fix_cfe_detection.patch 2.4 KB

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