Merge branch 'master' of /usr/src/ntfs-2.6/
[sfrench/cifs-2.6.git] / arch / ppc / platforms / gemini_prom.S
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
9 #include <linux/config.h>
10 #include <asm/reg.h>
11 #include <asm/page.h>
12 #include <platforms/gemini.h>
13 #include <asm/ppc_asm.h>
14
15 /*
16  *  On 750's the MMU is on when Linux is booted, so we need to clear out the
17  *  bootloader's BAT settings, make sure we're in supervisor state (gotcha!),
18  *  and turn off the MMU.
19  *
20  */
21
22 _GLOBAL(gemini_prom_init)
23 #ifdef CONFIG_SMP
24         /* Since the MMU's on, get stuff in rom space that we'll need */
25         lis     r4,GEMINI_CPUSTAT@h
26         ori     r4,r4,GEMINI_CPUSTAT@l
27         lbz     r5,0(r4)
28         andi.   r5,r5,3
29         mr      r24,r5          /* cpu # used later on */
30 #endif
31         mfmsr   r4
32         li      r3,MSR_PR       /* ensure supervisor! */
33         ori     r3,r3,MSR_IR|MSR_DR
34         andc    r4,r4,r3
35         mtmsr   r4
36         isync
37 #if 0
38         /* zero out the bats now that the MMU is off */
39 prom_no_mmu:    
40         li      r3,0
41         mtspr   SPRN_IBAT0U,r3
42         mtspr   SPRN_IBAT0L,r3
43         mtspr   SPRN_IBAT1U,r3
44         mtspr   SPRN_IBAT1L,r3
45         mtspr   SPRN_IBAT2U,r3
46         mtspr   SPRN_IBAT2L,r3
47         mtspr   SPRN_IBAT3U,r3
48         mtspr   SPRN_IBAT3L,r3
49
50         mtspr   SPRN_DBAT0U,r3
51         mtspr   SPRN_DBAT0L,r3
52         mtspr   SPRN_DBAT1U,r3
53         mtspr   SPRN_DBAT1L,r3
54         mtspr   SPRN_DBAT2U,r3
55         mtspr   SPRN_DBAT2L,r3
56         mtspr   SPRN_DBAT3U,r3
57         mtspr   SPRN_DBAT3L,r3
58 #endif
59
60         /* the bootloader (as far as I'm currently aware) doesn't mess with page
61            tables, but since we're already here, might as well zap these, too */
62         li      r4,0
63         mtspr   SPRN_SDR1,r4
64
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
73 #ifdef CONFIG_SMP
74         /* The 750 book (and Mot/IBM support) says that this will "assist" snooping
75            when in SMP.  Not sure yet whether this should stay or leave... */
76         mfspr   r4,SPRN_HID0
77         ori     r4,r4,HID0_ABE
78         mtspr   SPRN_HID0,r4
79         sync
80 #endif /* CONFIG_SMP */
81         blr
82
83 /*  apparently, SMon doesn't pay attention to HID0[SRST].  Disable the MMU and
84     branch to 0xfff00100 */
85 _GLOBAL(_gemini_reboot)
86         lis     r5,GEMINI_BOOT_INIT@h
87         ori     r5,r5,GEMINI_BOOT_INIT@l
88         li      r6,MSR_IP
89         mtspr   SPRN_SRR0,r5
90         mtspr   SPRN_SRR1,r6
91         rfi