gemini_prom.S
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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