5 #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
7 #include <ppc_asm.tmpl>
10 #include <asm/cache.h>
13 /* To boot secondary cpus, we need a place for them to start up.
14 * Normally, they start at 0xfffffffc, but that's usually the
15 * firmware, and we don't want to have to run the firmware again.
16 * Instead, the primary cpu will set the BPTR to point here to
17 * this page. We then set up the core, and head to
18 * start_secondary. Note that this means that the code below
19 * must never exceed 1023 instructions (the branch at the end
20 * would then be the 1024th).
22 .globl __secondary_start_page
24 __secondary_start_page:
25 /* First do some preliminary setup */
26 lis r3, HID0_EMCP@h /* enable machine check */
27 ori r3,r3,HID0_TBEN@l /* enable Timebase */
28 #ifdef CONFIG_PHYS_64BIT
29 ori r3,r3,HID0_ENMAS7@l /* enable MAS7 updates */
33 li r3,(HID1_ASTME|HID1_ABE)@l /* Addr streaming & broadcast */
36 /* Enable branch prediction */
45 /* Enable/invalidate the I-Cache */
47 ori r0,r0,(L1CSR1_ICFI|L1CSR1_ICE)
51 /* Enable/invalidate the D-Cache */
53 ori r0,r0,(L1CSR0_DCFI|L1CSR0_DCE)
59 #define toreset(x) (x - __secondary_start_page + 0xfffff000)
61 /* get our PIR to figure out our table entry */
62 lis r3,toreset(__spin_table)@h
63 ori r3,r3,toreset(__spin_table)@l
65 /* r10 has the base address for the entry */
71 #define EPAPR_MAGIC (0x45504150)
72 #define ENTRY_ADDR_UPPER 0
73 #define ENTRY_ADDR_LOWER 4
74 #define ENTRY_R3_UPPER 8
75 #define ENTRY_R3_LOWER 12
78 #define ENTRY_R6_UPPER 24
79 #define ENTRY_R6_LOWER 28
86 stw r3,ENTRY_ADDR_UPPER(r10)
87 stw r8,ENTRY_ADDR_LOWER(r10)
88 stw r3,ENTRY_R3_UPPER(r10)
89 stw r4,ENTRY_R3_LOWER(r10)
90 stw r3,ENTRY_R6_UPPER(r10)
91 stw r3,ENTRY_R6_LOWER(r10)
93 /* setup mapping for AS = 1, and jump there */
94 lis r11,(MAS0_TLBSEL(1)|MAS0_ESEL(1))@h
96 lis r11,(MAS1_VALID|MAS1_IPROT)@h
97 ori r11,r11,(MAS1_TS|MAS1_TSIZE(BOOKE_PAGESZ_4K))@l
99 lis r11,(0xfffff000|MAS2_I)@h
100 ori r11,r11,(0xfffff000|MAS2_I)@l
102 lis r11,(0xfffff000|MAS3_SX|MAS3_SW|MAS3_SR)@h
103 ori r11,r11,(0xfffff000|MAS3_SX|MAS3_SW|MAS3_SR)@l
111 ori r12,r13,MSR_IS|MSR_DS@l
117 /* spin waiting for addr */
119 lwz r4,ENTRY_ADDR_LOWER(r10)
124 /* get the upper bits of the addr */
125 lwz r11,ENTRY_ADDR_UPPER(r10)
127 /* setup branch addr */
130 /* mark the entry as released */
132 stw r8,ENTRY_ADDR_LOWER(r10)
134 /* mask by ~64M to setup our tlb we will jump to */
137 /* setup r3, r4, r5, r6, r7, r8, r9 */
138 lwz r3,ENTRY_R3_LOWER(r10)
141 lwz r6,ENTRY_R6_LOWER(r10)
142 lis r7,(64*1024*1024)@h
146 /* load up the pir */
147 lwz r0,ENTRY_PIR(r10)
150 stw r0,ENTRY_PIR(r10)
153 * Coming here, we know the cpu has one TLB mapping in TLB1[0]
154 * which maps 0xfffff000-0xffffffff one-to-one. We set up a
155 * second mapping that maps addr 1:1 for 64M, and then we jump to
158 lis r10,(MAS0_TLBSEL(1)|MAS0_ESEL(0))@h
160 lis r10,(MAS1_VALID|MAS1_IPROT)@h
161 ori r10,r10,(MAS1_TSIZE(BOOKE_PAGESZ_64M))@l
163 /* WIMGE = 0b00000 for now */
165 ori r12,r12,(MAS3_SX|MAS3_SW|MAS3_SR)
167 #ifdef CONFIG_ENABLE_36BIT_PHYS
172 /* Now we have another mapping for this page, so we jump to that
178 .align L1_CACHE_SHIFT
181 .space CONFIG_NUM_CPUS*ENTRY_SIZE
183 /* Fill in the empty space. The actual reset vector is
184 * the last word of the page */
185 __secondary_start_code_end:
186 .space 4092 - (__secondary_start_code_end - __secondary_start_page)
187 __secondary_reset_vector:
188 b __secondary_start_page