gemini_prom.S 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Not really prom support code (yet), but sort of anti-prom code. The current
  3. * bootloader does a number of things it shouldn't and doesn't do things that it
  4. * should. The stuff in here is mainly a hodge-podge collection of setup code
  5. * to get the board up and running.
  6. * ---Dan
  7. */
  8. #include <asm/reg.h>
  9. #include <asm/page.h>
  10. #include <platforms/gemini.h>
  11. #include <asm/ppc_asm.h>
  12. /*
  13. * On 750's the MMU is on when Linux is booted, so we need to clear out the
  14. * bootloader's BAT settings, make sure we're in supervisor state (gotcha!),
  15. * and turn off the MMU.
  16. *
  17. */
  18. _GLOBAL(gemini_prom_init)
  19. #ifdef CONFIG_SMP
  20. /* Since the MMU's on, get stuff in rom space that we'll need */
  21. lis r4,GEMINI_CPUSTAT@h
  22. ori r4,r4,GEMINI_CPUSTAT@l
  23. lbz r5,0(r4)
  24. andi. r5,r5,3
  25. mr r24,r5 /* cpu # used later on */
  26. #endif
  27. mfmsr r4
  28. li r3,MSR_PR /* ensure supervisor! */
  29. ori r3,r3,MSR_IR|MSR_DR
  30. andc r4,r4,r3
  31. mtmsr r4
  32. isync
  33. #if 0
  34. /* zero out the bats now that the MMU is off */
  35. prom_no_mmu:
  36. li r3,0
  37. mtspr SPRN_IBAT0U,r3
  38. mtspr SPRN_IBAT0L,r3
  39. mtspr SPRN_IBAT1U,r3
  40. mtspr SPRN_IBAT1L,r3
  41. mtspr SPRN_IBAT2U,r3
  42. mtspr SPRN_IBAT2L,r3
  43. mtspr SPRN_IBAT3U,r3
  44. mtspr SPRN_IBAT3L,r3
  45. mtspr SPRN_DBAT0U,r3
  46. mtspr SPRN_DBAT0L,r3
  47. mtspr SPRN_DBAT1U,r3
  48. mtspr SPRN_DBAT1L,r3
  49. mtspr SPRN_DBAT2U,r3
  50. mtspr SPRN_DBAT2L,r3
  51. mtspr SPRN_DBAT3U,r3
  52. mtspr SPRN_DBAT3L,r3
  53. #endif
  54. /* the bootloader (as far as I'm currently aware) doesn't mess with page
  55. tables, but since we're already here, might as well zap these, too */
  56. li r4,0
  57. mtspr SPRN_SDR1,r4
  58. li r4,16
  59. mtctr r4
  60. li r3,0
  61. li r4,0
  62. 3: mtsrin r3,r4
  63. addi r3,r3,1
  64. bdnz 3b
  65. #ifdef CONFIG_SMP
  66. /* The 750 book (and Mot/IBM support) says that this will "assist" snooping
  67. when in SMP. Not sure yet whether this should stay or leave... */
  68. mfspr r4,SPRN_HID0
  69. ori r4,r4,HID0_ABE
  70. mtspr SPRN_HID0,r4
  71. sync
  72. #endif /* CONFIG_SMP */
  73. blr
  74. /* apparently, SMon doesn't pay attention to HID0[SRST]. Disable the MMU and
  75. branch to 0xfff00100 */
  76. _GLOBAL(_gemini_reboot)
  77. lis r5,GEMINI_BOOT_INIT@h
  78. ori r5,r5,GEMINI_BOOT_INIT@l
  79. li r6,MSR_IP
  80. mtspr SPRN_SRR0,r5
  81. mtspr SPRN_SRR1,r6
  82. rfi