1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#include <linux/init.h>
28#include <asm/processor.h>
29#include <asm/page.h>
30#include <asm/mmu.h>
31#include <asm/pgtable.h>
32#include <asm/cputable.h>
33#include <asm/thread_info.h>
34#include <asm/ppc_asm.h>
35#include <asm/asm-offsets.h>
36#include <asm/ptrace.h>
37#include <asm/synch.h>
38#include <asm/export.h>
39#include <asm/code-patching-asm.h>
40#include "head_booke.h"
41
42
43
44
45
46
47
48
49
50
51
52
53
54 __HEAD
55_ENTRY(_stext);
56_ENTRY(_start);
57
58
59
60
61 nop
62 mr r31,r3
63 li r24,0
64
65#ifdef CONFIG_RELOCATABLE
66
67
68
69
70
71
72
73 bl 0f
740: mflr r21
75 addis r21,r21,(_stext - 0b)@ha
76 addi r21,r21,(_stext - 0b)@l
77
78
79
80
81
82
83
84 lis r4,KERNELBASE@h
85 ori r4,r4,KERNELBASE@l
86 rlwinm r6,r21,0,4,31
87 rlwinm r5,r4,0,4,31
88 subf r3,r5,r6
89 add r3,r4,r3
90
91 bl relocate
92#endif
93
94 bl init_cpu_state
95
96
97
98
99
100
101 lis r2,init_task@h
102 ori r2,r2,init_task@l
103
104
105 addi r4,r2,THREAD
106 mtspr SPRN_SPRG_THREAD,r4
107
108
109 lis r1,init_thread_union@h
110 ori r1,r1,init_thread_union@l
111 li r0,0
112 stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
113
114 bl early_init
115
116#ifdef CONFIG_RELOCATABLE
117
118
119
120
121
122
123
124 lis r3,kernstart_addr@ha
125 la r3,kernstart_addr@l(r3)
126
127
128
129
130
131
132 rlwinm r6,r25,0,28,31
133 rlwinm r7,r25,0,0,3
134 rlwinm r8,r21,0,4,31
135 or r8,r7,r8
136
137
138 stw r6,0(r3)
139 stw r8,4(r3)
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156 li r4, 0
157 lis r5,KERNELBASE@h
158 rlwinm r5,r5,0,0,3
159
160
161
162
163 subfc r5,r7,r5
164 subfe r4,r6,r4
165
166
167 lis r3,virt_phys_offset@ha
168 la r3,virt_phys_offset@l(r3)
169
170 stw r4,0(r3)
171 stw r5,4(r3)
172
173
174
175
176
177
178
179
180
181
182 lis r3,kernstart_addr@ha
183 la r3,kernstart_addr@l(r3)
184
185 lis r4,KERNELBASE@h
186 ori r4,r4,KERNELBASE@l
187 lis r5,PAGE_OFFSET@h
188 ori r5,r5,PAGE_OFFSET@l
189 subf r4,r5,r4
190
191 rlwinm r6,r25,0,28,31
192 rlwinm r7,r25,0,0,3
193 add r7,r7,r4
194
195 stw r6,0(r3)
196 stw r7,4(r3)
197#endif
198
199
200
201
202#ifdef CONFIG_KASAN
203 bl kasan_early_init
204#endif
205 li r3,0
206 mr r4,r31
207 bl machine_init
208 bl MMU_init
209
210
211 lis r6, swapper_pg_dir@h
212 ori r6, r6, swapper_pg_dir@l
213 lis r5, abatron_pteptrs@h
214 ori r5, r5, abatron_pteptrs@l
215 lis r4, KERNELBASE@h
216 ori r4, r4, KERNELBASE@l
217 stw r5, 0(r4)
218 stw r6, 0(r5)
219
220
221 li r0,0
222 mtspr SPRN_MCSR,r0
223
224
225 lis r4,start_kernel@h
226 ori r4,r4,start_kernel@l
227 lis r3,MSR_KERNEL@h
228 ori r3,r3,MSR_KERNEL@l
229 mtspr SPRN_SRR0,r4
230 mtspr SPRN_SRR1,r3
231 rfi
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250interrupt_base:
251
252 CRITICAL_EXCEPTION(0x0100, CRITICAL, CriticalInput, unknown_exception)
253
254
255 CRITICAL_EXCEPTION(0x0200, MACHINE_CHECK, MachineCheck, \
256 machine_check_exception)
257 MCHECK_EXCEPTION(0x0210, MachineCheckA, machine_check_exception)
258
259
260 DATA_STORAGE_EXCEPTION
261
262
263 INSTRUCTION_STORAGE_EXCEPTION
264
265
266 EXCEPTION(0x0500, BOOKE_INTERRUPT_EXTERNAL, ExternalInput, \
267 do_IRQ, EXC_XFER_LITE)
268
269
270 ALIGNMENT_EXCEPTION
271
272
273 PROGRAM_EXCEPTION
274
275
276#ifdef CONFIG_PPC_FPU
277 FP_UNAVAILABLE_EXCEPTION
278#else
279 EXCEPTION(0x2010, BOOKE_INTERRUPT_FP_UNAVAIL, \
280 FloatingPointUnavailable, unknown_exception, EXC_XFER_STD)
281#endif
282
283 START_EXCEPTION(SystemCall)
284 SYSCALL_ENTRY 0xc00 BOOKE_INTERRUPT_SYSCALL
285
286
287 EXCEPTION(0x2020, BOOKE_INTERRUPT_AP_UNAVAIL, \
288 AuxillaryProcessorUnavailable, unknown_exception, EXC_XFER_STD)
289
290
291 DECREMENTER_EXCEPTION
292
293
294
295 EXCEPTION(0x1010, BOOKE_INTERRUPT_FIT, FixedIntervalTimer, \
296 unknown_exception, EXC_XFER_STD)
297
298
299
300#ifdef CONFIG_BOOKE_WDT
301 CRITICAL_EXCEPTION(0x1020, WATCHDOG, WatchdogTimer, WatchdogException)
302#else
303 CRITICAL_EXCEPTION(0x1020, WATCHDOG, WatchdogTimer, unknown_exception)
304#endif
305
306
307 START_EXCEPTION(DataTLBError44x)
308 mtspr SPRN_SPRG_WSCRATCH0, r10
309 mtspr SPRN_SPRG_WSCRATCH1, r11
310 mtspr SPRN_SPRG_WSCRATCH2, r12
311 mtspr SPRN_SPRG_WSCRATCH3, r13
312 mfcr r11
313 mtspr SPRN_SPRG_WSCRATCH4, r11
314 mfspr r10, SPRN_DEAR
315
316
317
318
319 lis r11, PAGE_OFFSET@h
320 cmplw r10, r11
321 blt+ 3f
322 lis r11, swapper_pg_dir@h
323 ori r11, r11, swapper_pg_dir@l
324
325 mfspr r12,SPRN_MMUCR
326 rlwinm r12,r12,0,0,23
327
328 b 4f
329
330
3313:
332 mfspr r11,SPRN_SPRG_THREAD
333 lwz r11,PGDIR(r11)
334
335
336 mfspr r12,SPRN_MMUCR
337 mfspr r13,SPRN_PID
338 rlwimi r12,r13,0,24,31
339
3404:
341 mtspr SPRN_MMUCR,r12
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356 mfspr r12,SPRN_ESR
357 li r13,_PAGE_PRESENT|_PAGE_ACCESSED
358 rlwimi r13,r12,10,30,30
359
360
361
362 rlwinm r12, r10, PPC44x_PGD_OFF_SHIFT, PPC44x_PGD_OFF_MASK_BIT, 29
363 lwzx r11, r12, r11
364 rlwinm. r12, r11, 0, 0, 20
365 beq 2f
366
367
368 rlwimi r12, r10, PPC44x_PTE_ADD_SHIFT, PPC44x_PTE_ADD_MASK_BIT, 28
369 lwz r11, 0(r12)
370 lwz r12, 4(r12)
371
372 lis r10,tlb_44x_index@ha
373
374 andc. r13,r13,r12
375
376
377 lwz r13,tlb_44x_index@l(r10)
378
379 bne 2f
380
381
382 addi r13,r13,1
383
384 patch_site 0f, patch__tlb_44x_hwater_D
385
3860: cmpwi 0,r13,1
387 ble 5f
388 li r13,0
3895:
390
391 stw r13,tlb_44x_index@l(r10)
392
393
394 mfspr r10,SPRN_DEAR
395
396
397 b finish_tlb_load_44x
398
3992:
400
401
402
403 mfspr r11, SPRN_SPRG_RSCRATCH4
404 mtcr r11
405 mfspr r13, SPRN_SPRG_RSCRATCH3
406 mfspr r12, SPRN_SPRG_RSCRATCH2
407 mfspr r11, SPRN_SPRG_RSCRATCH1
408 mfspr r10, SPRN_SPRG_RSCRATCH0
409 b DataStorage
410
411
412
413
414
415
416
417 START_EXCEPTION(InstructionTLBError44x)
418 mtspr SPRN_SPRG_WSCRATCH0, r10
419 mtspr SPRN_SPRG_WSCRATCH1, r11
420 mtspr SPRN_SPRG_WSCRATCH2, r12
421 mtspr SPRN_SPRG_WSCRATCH3, r13
422 mfcr r11
423 mtspr SPRN_SPRG_WSCRATCH4, r11
424 mfspr r10, SPRN_SRR0
425
426
427
428
429 lis r11, PAGE_OFFSET@h
430 cmplw r10, r11
431 blt+ 3f
432 lis r11, swapper_pg_dir@h
433 ori r11, r11, swapper_pg_dir@l
434
435 mfspr r12,SPRN_MMUCR
436 rlwinm r12,r12,0,0,23
437
438 b 4f
439
440
4413:
442 mfspr r11,SPRN_SPRG_THREAD
443 lwz r11,PGDIR(r11)
444
445
446 mfspr r12,SPRN_MMUCR
447 mfspr r13,SPRN_PID
448 rlwimi r12,r13,0,24,31
449
4504:
451 mtspr SPRN_MMUCR,r12
452
453
454 li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
455
456
457 rlwinm r12, r10, PPC44x_PGD_OFF_SHIFT, PPC44x_PGD_OFF_MASK_BIT, 29
458 lwzx r11, r12, r11
459 rlwinm. r12, r11, 0, 0, 20
460 beq 2f
461
462
463 rlwimi r12, r10, PPC44x_PTE_ADD_SHIFT, PPC44x_PTE_ADD_MASK_BIT, 28
464 lwz r11, 0(r12)
465 lwz r12, 4(r12)
466
467 lis r10,tlb_44x_index@ha
468
469 andc. r13,r13,r12
470
471
472 lwz r13,tlb_44x_index@l(r10)
473
474 bne 2f
475
476
477 addi r13,r13,1
478
479 patch_site 0f, patch__tlb_44x_hwater_I
480
4810: cmpwi 0,r13,1
482 ble 5f
483 li r13,0
4845:
485
486 stw r13,tlb_44x_index@l(r10)
487
488
489 mfspr r10,SPRN_SRR0
490
491
492 b finish_tlb_load_44x
493
4942:
495
496
497
498 mfspr r11, SPRN_SPRG_RSCRATCH4
499 mtcr r11
500 mfspr r13, SPRN_SPRG_RSCRATCH3
501 mfspr r12, SPRN_SPRG_RSCRATCH2
502 mfspr r11, SPRN_SPRG_RSCRATCH1
503 mfspr r10, SPRN_SPRG_RSCRATCH0
504 b InstructionStorage
505
506
507
508
509
510
511
512
513
514
515
516finish_tlb_load_44x:
517
518 rlwimi r11,r12,0,0,31-PAGE_SHIFT
519 tlbwe r11,r13,PPC44x_TLB_XLAT
520
521
522
523
524
525 li r11,PPC44x_TLB_VALID | PPC44x_TLBE_SIZE
526
527 rlwimi r10,r11,0,PPC44x_PTE_ADD_MASK_BIT,31
528 tlbwe r10,r13,PPC44x_TLB_PAGEID
529
530
531 li r10,0xf85
532 rlwimi r10,r12,29,30,30
533 and r11,r12,r10
534 andi. r10,r12,_PAGE_USER
535 beq 1f
536 rlwimi r11,r11,3,26,28
5371: tlbwe r11,r13,PPC44x_TLB_ATTRIB
538
539
540
541 mfspr r11, SPRN_SPRG_RSCRATCH4
542 mtcr r11
543 mfspr r13, SPRN_SPRG_RSCRATCH3
544 mfspr r12, SPRN_SPRG_RSCRATCH2
545 mfspr r11, SPRN_SPRG_RSCRATCH1
546 mfspr r10, SPRN_SPRG_RSCRATCH0
547 rfi
548
549
550
551#ifdef CONFIG_PPC_47x
552 START_EXCEPTION(DataTLBError47x)
553 mtspr SPRN_SPRG_WSCRATCH0,r10
554 mtspr SPRN_SPRG_WSCRATCH1,r11
555 mtspr SPRN_SPRG_WSCRATCH2,r12
556 mtspr SPRN_SPRG_WSCRATCH3,r13
557 mfcr r11
558 mtspr SPRN_SPRG_WSCRATCH4,r11
559 mfspr r10,SPRN_DEAR
560
561
562
563
564 lis r11,PAGE_OFFSET@h
565 cmplw cr0,r10,r11
566 blt+ 3f
567 lis r11,swapper_pg_dir@h
568 ori r11,r11, swapper_pg_dir@l
569 li r12,0
570 b 4f
571
572
5733: mfspr r11,SPRN_SPRG3
574 lwz r11,PGDIR(r11)
575 mfspr r12,SPRN_PID
5764: mtspr SPRN_MMUCR,r12
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591 mfspr r12,SPRN_ESR
592 li r13,_PAGE_PRESENT|_PAGE_ACCESSED
593 rlwimi r13,r12,10,30,30
594
595
596
597 rlwinm r12,r10,PPC44x_PGD_OFF_SHIFT,PPC44x_PGD_OFF_MASK_BIT,29
598 lwzx r11,r12,r11
599
600
601 li r12,PPC47x_TLB0_VALID | PPC47x_TLBE_SIZE
602 rlwimi r10,r12,0,32-PAGE_SHIFT,31
603 li r12,0
604 tlbwe r10,r12,0
605
606
607
608#ifdef CONFIG_SMP
609 isync
610#endif
611
612 rlwinm. r12,r11,0,0,20
613
614 rlwimi r12,r10,PPC44x_PTE_ADD_SHIFT,PPC44x_PTE_ADD_MASK_BIT,28
615 beq 2f
616 lwz r11,0(r12)
617
618
619
620
621
622#ifdef CONFIG_SMP
623 lwsync
624#endif
625 lwz r12,4(r12)
626
627 andc. r13,r13,r12
628
629
630 beq finish_tlb_load_47x
631
6322:
633
634
635 mfspr r11,SPRN_SPRG_RSCRATCH4
636 mtcr r11
637 mfspr r13,SPRN_SPRG_RSCRATCH3
638 mfspr r12,SPRN_SPRG_RSCRATCH2
639 mfspr r11,SPRN_SPRG_RSCRATCH1
640 mfspr r10,SPRN_SPRG_RSCRATCH0
641 b DataStorage
642
643
644
645
646
647
648
649 START_EXCEPTION(InstructionTLBError47x)
650 mtspr SPRN_SPRG_WSCRATCH0,r10
651 mtspr SPRN_SPRG_WSCRATCH1,r11
652 mtspr SPRN_SPRG_WSCRATCH2,r12
653 mtspr SPRN_SPRG_WSCRATCH3,r13
654 mfcr r11
655 mtspr SPRN_SPRG_WSCRATCH4,r11
656 mfspr r10,SPRN_SRR0
657
658
659
660
661 lis r11,PAGE_OFFSET@h
662 cmplw cr0,r10,r11
663 blt+ 3f
664 lis r11,swapper_pg_dir@h
665 ori r11,r11, swapper_pg_dir@l
666 li r12,0
667 b 4f
668
669
6703: mfspr r11,SPRN_SPRG_THREAD
671 lwz r11,PGDIR(r11)
672 mfspr r12,SPRN_PID
6734: mtspr SPRN_MMUCR,r12
674
675
676 li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
677
678
679
680 rlwinm r12,r10,PPC44x_PGD_OFF_SHIFT,PPC44x_PGD_OFF_MASK_BIT,29
681 lwzx r11,r12,r11
682
683
684 li r12,PPC47x_TLB0_VALID | PPC47x_TLBE_SIZE
685 rlwimi r10,r12,0,32-PAGE_SHIFT,31
686 li r12,0
687 tlbwe r10,r12,0
688
689
690
691#ifdef CONFIG_SMP
692 isync
693#endif
694
695 rlwinm. r12,r11,0,0,20
696
697 rlwimi r12,r10,PPC44x_PTE_ADD_SHIFT,PPC44x_PTE_ADD_MASK_BIT,28
698 beq 2f
699
700 lwz r11,0(r12)
701
702
703
704
705#ifdef CONFIG_SMP
706 lwsync
707#endif
708 lwz r12,4(r12)
709
710 andc. r13,r13,r12
711
712
713 beq finish_tlb_load_47x
714
7152:
716
717
718 mfspr r11, SPRN_SPRG_RSCRATCH4
719 mtcr r11
720 mfspr r13, SPRN_SPRG_RSCRATCH3
721 mfspr r12, SPRN_SPRG_RSCRATCH2
722 mfspr r11, SPRN_SPRG_RSCRATCH1
723 mfspr r10, SPRN_SPRG_RSCRATCH0
724 b InstructionStorage
725
726
727
728
729
730
731
732
733
734
735
736finish_tlb_load_47x:
737
738 rlwimi r11,r12,0,0,31-PAGE_SHIFT
739 tlbwe r11,r13,1
740
741
742 li r10,0xf85
743 rlwimi r10,r12,29,30,30
744 and r11,r12,r10
745 andi. r10,r12,_PAGE_USER
746 beq 1f
747 rlwimi r11,r11,3,26,28
7481: tlbwe r11,r13,2
749
750
751
752 mfspr r11, SPRN_SPRG_RSCRATCH4
753 mtcr r11
754 mfspr r13, SPRN_SPRG_RSCRATCH3
755 mfspr r12, SPRN_SPRG_RSCRATCH2
756 mfspr r11, SPRN_SPRG_RSCRATCH1
757 mfspr r10, SPRN_SPRG_RSCRATCH0
758 rfi
759
760#endif
761
762
763
764
765
766
767
768 DEBUG_CRIT_EXCEPTION
769
770interrupt_end:
771
772
773
774
775
776
777
778
779_GLOBAL(__fixup_440A_mcheck)
780 li r3,MachineCheckA@l
781 mtspr SPRN_IVOR1,r3
782 sync
783 blr
784
785_GLOBAL(set_context)
786
787#ifdef CONFIG_BDI_SWITCH
788
789
790
791 lis r5, abatron_pteptrs@h
792 ori r5, r5, abatron_pteptrs@l
793 stw r4, 0x4(r5)
794#endif
795 mtspr SPRN_PID,r3
796 isync
797 blr
798
799
800
801
802
803
804_GLOBAL(init_cpu_state)
805 mflr r22
806#ifdef CONFIG_PPC_47x
807
808 mfspr r3,SPRN_PVR
809 srwi r3,r3,16
810 cmplwi cr0,r3,PVR_476FPE@h
811 beq head_start_47x
812 cmplwi cr0,r3,PVR_476@h
813 beq head_start_47x
814 cmplwi cr0,r3,PVR_476_ISS@h
815 beq head_start_47x
816#endif
817
818
819
820
821
822 mfspr r3,SPRN_CCR0
823 rlwinm r3,r3,0,0,27
824 isync
825 mtspr SPRN_CCR0,r3
826 isync
827 sync
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856 mfspr r3,SPRN_PID
857 mfmsr r4
858 andi. r4,r4,MSR_IS@l
859 beq wmmucr
860 oris r3,r3,PPC44x_MMUCR_STS@h
861wmmucr: mtspr SPRN_MMUCR,r3
862 sync
863
864 bl invstr
865invstr: mflr r5
866 tlbsx r23,0,r5
867 li r4,0
868 li r3,0
8691: cmpw r23,r4
870 beq skpinv
871 tlbwe r3,r4,PPC44x_TLB_PAGEID
872skpinv: addi r4,r4,1
873 cmpwi r4,64
874 bne 1b
875 isync
876
877
878
879
880#ifdef CONFIG_NONSTATIC_KERNEL
881
882
883
884
885
886
887
888 tlbre r25,r23,PPC44x_TLB_XLAT
889
890 lis r3,KERNELBASE@h
891 ori r3,r3,KERNELBASE@l
892
893
894 mr r4,r25
895#else
896
897 lis r3,PAGE_OFFSET@h
898 ori r3,r3,PAGE_OFFSET@l
899
900
901 li r4, 0
902#endif
903
904
905 li r0,0
906 mtspr SPRN_PID,r0
907 sync
908
909
910 li r5,0
911 mtspr SPRN_MMUCR,r5
912 sync
913
914
915 clrrwi r3,r3,10
916 ori r3,r3,PPC44x_TLB_VALID | PPC44x_TLB_256M
917
918
919 clrrwi r4,r4,10
920
921
922
923
924 li r5,0
925 ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G)
926
927 li r0,63
928
929 tlbwe r3,r0,PPC44x_TLB_PAGEID
930 tlbwe r4,r0,PPC44x_TLB_XLAT
931 tlbwe r5,r0,PPC44x_TLB_ATTRIB
932
933
934 mfmsr r0
935 mtspr SPRN_SRR1, r0
936 lis r0,3f@h
937 ori r0,r0,3f@l
938 mtspr SPRN_SRR0,r0
939 sync
940 rfi
941
942
9433: cmpwi r23,63
944 beq 4f
945 li r6,0
946 tlbwe r6,r23,PPC44x_TLB_PAGEID
947 isync
948
9494:
950#ifdef CONFIG_PPC_EARLY_DEBUG_44x
951
952
953
954 lis r3,PPC44x_EARLY_DEBUG_VIRTADDR@h
955 ori r3,r3,PPC44x_TLB_VALID|PPC44x_TLB_TS|PPC44x_TLB_64K
956
957
958 lis r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW@h
959 ori r4,r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH
960
961
962 li r5,(PPC44x_TLB_SW|PPC44x_TLB_SR|PPC44x_TLB_I|PPC44x_TLB_G)
963 li r0,62
964
965 tlbwe r3,r0,PPC44x_TLB_PAGEID
966 tlbwe r4,r0,PPC44x_TLB_XLAT
967 tlbwe r5,r0,PPC44x_TLB_ATTRIB
968
969
970 isync
971#endif
972
973
974 SET_IVOR(0, CriticalInput);
975 SET_IVOR(1, MachineCheck);
976 SET_IVOR(2, DataStorage);
977 SET_IVOR(3, InstructionStorage);
978 SET_IVOR(4, ExternalInput);
979 SET_IVOR(5, Alignment);
980 SET_IVOR(6, Program);
981 SET_IVOR(7, FloatingPointUnavailable);
982 SET_IVOR(8, SystemCall);
983 SET_IVOR(9, AuxillaryProcessorUnavailable);
984 SET_IVOR(10, Decrementer);
985 SET_IVOR(11, FixedIntervalTimer);
986 SET_IVOR(12, WatchdogTimer);
987 SET_IVOR(13, DataTLBError44x);
988 SET_IVOR(14, InstructionTLBError44x);
989 SET_IVOR(15, DebugCrit);
990
991 b head_start_common
992
993
994#ifdef CONFIG_PPC_47x
995
996#ifdef CONFIG_SMP
997
998
999_GLOBAL(start_secondary_47x)
1000 mr r24,r3
1001
1002 bl init_cpu_state
1003
1004
1005
1006
1007
1008
1009
1010
1011 lis r1,temp_boot_stack@h
1012 ori r1,r1,temp_boot_stack@l
1013 addi r1,r1,1024-STACK_FRAME_OVERHEAD
1014 li r0,0
1015 stw r0,0(r1)
1016 bl mmu_init_secondary
1017
1018
1019
1020
1021 lis r2,secondary_current@ha
1022 lwz r2,secondary_current@l(r2)
1023 lwz r1,TASK_STACK(r2)
1024
1025
1026 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
1027 li r0,0
1028 stw r0,0(r1)
1029
1030
1031 addi r4,r2,THREAD
1032 mtspr SPRN_SPRG3,r4
1033
1034 b start_secondary
1035
1036#endif
1037
1038
1039
1040
1041
1042
1043
1044
1045head_start_47x:
1046
1047 mfspr r3,SPRN_PID
1048 mfmsr r4
1049 andi. r4,r4,MSR_IS@l
1050 beq 1f
1051 oris r3,r3,PPC47x_MMUCR_STS@h
10521: mtspr SPRN_MMUCR,r3
1053 sync
1054
1055
1056 bl 1f
10571: mflr r23
1058 tlbsx r23,0,r23
1059 tlbre r24,r23,0
1060 tlbre r25,r23,1
1061 tlbre r26,r23,2
1062
1063
1064
1065
1066
1067
1068 li r5,0
1069 mtspr SPRN_MMUCR,r5
1070 sync
1071
1072clear_all_utlb_entries:
1073
1074
1075
1076 addis r3,0,0x8000
1077 addi r4,0,0
1078 addi r5,0,0
1079 b clear_utlb_entry
1080
1081
1082
1083 .align 6
1084
1085clear_utlb_entry:
1086
1087 tlbwe r4,r3,0
1088 tlbwe r5,r3,1
1089 tlbwe r5,r3,2
1090 addis r3,r3,0x2000
1091 cmpwi r3,0
1092 bne clear_utlb_entry
1093 addis r3,0,0x8000
1094 addis r4,r4,0x100
1095 cmpwi r4,0
1096 bne clear_utlb_entry
1097
1098
1099
1100 oris r23,r23,0x8000
1101 tlbwe r24,r23,0
1102 tlbwe r25,r23,1
1103 tlbwe r26,r23,2
1104
1105
1106
1107
1108
1109 lis r3,PAGE_OFFSET@h
1110 ori r3,r3,PAGE_OFFSET@l
1111
1112
1113 li r0,0
1114 mtspr SPRN_PID,r0
1115 sync
1116
1117
1118 clrrwi r3,r3,12
1119 ori r3,r3,PPC47x_TLB0_VALID | PPC47x_TLB0_256M
1120
1121
1122
1123
1124 li r5,0
1125 ori r5,r5,PPC47x_TLB2_S_RWX
1126#ifdef CONFIG_SMP
1127 ori r5,r5,PPC47x_TLB2_M
1128#endif
1129
1130
1131 lis r0,0x8800
1132 tlbwe r3,r0,0
1133 tlbwe r25,r0,1
1134 tlbwe r5,r0,2
1135
1136
1137
1138
1139
1140 LOAD_REG_IMMEDIATE(r3, 0x9abcdef0)
1141 mtspr SPRN_SSPCR,r3
1142 mtspr SPRN_USPCR,r3
1143 LOAD_REG_IMMEDIATE(r3, 0x12345670)
1144 mtspr SPRN_ISPCR,r3
1145
1146
1147 mfmsr r0
1148 mtspr SPRN_SRR1, r0
1149 lis r0,3f@h
1150 ori r0,r0,3f@l
1151 mtspr SPRN_SRR0,r0
1152 sync
1153 rfi
1154
1155
11563:
1157 rlwinm r24,r24,0,21,19
1158 tlbwe r24,r23,0
1159 addi r24,0,0
1160 tlbwe r24,r23,1
1161 tlbwe r24,r23,2
1162 isync
1163
1164#ifdef CONFIG_PPC_EARLY_DEBUG_44x
1165
1166
1167
1168 lis r3,PPC44x_EARLY_DEBUG_VIRTADDR@h
1169 ori r3,r3,PPC47x_TLB0_VALID | PPC47x_TLB0_TS | PPC47x_TLB0_1M
1170
1171
1172 lis r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW@h
1173 ori r4,r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH
1174
1175
1176 li r5,(PPC47x_TLB2_S_RW | PPC47x_TLB2_IMG)
1177
1178
1179
1180
1181
1182 lis r0,0x8d00
1183 tlbwe r3,r0,0
1184 tlbwe r4,r0,1
1185 tlbwe r5,r0,2
1186
1187
1188 isync
1189#endif
1190
1191
1192 SET_IVOR(0, CriticalInput);
1193 SET_IVOR(1, MachineCheckA);
1194 SET_IVOR(2, DataStorage);
1195 SET_IVOR(3, InstructionStorage);
1196 SET_IVOR(4, ExternalInput);
1197 SET_IVOR(5, Alignment);
1198 SET_IVOR(6, Program);
1199 SET_IVOR(7, FloatingPointUnavailable);
1200 SET_IVOR(8, SystemCall);
1201 SET_IVOR(9, AuxillaryProcessorUnavailable);
1202 SET_IVOR(10, Decrementer);
1203 SET_IVOR(11, FixedIntervalTimer);
1204 SET_IVOR(12, WatchdogTimer);
1205 SET_IVOR(13, DataTLBError47x);
1206 SET_IVOR(14, InstructionTLBError47x);
1207 SET_IVOR(15, DebugCrit);
1208
1209
1210
1211
1212
1213
1214 mfspr r3,SPRN_CCR0
1215 oris r3,r3,0x0020
1216 ori r3,r3,0x0040
1217 mtspr SPRN_CCR0,r3
1218 isync
1219
1220#endif
1221
1222
1223
1224
1225
1226
1227
1228head_start_common:
1229
1230 lis r4,interrupt_base@h
1231 mtspr SPRN_IVPR,r4
1232
1233
1234
1235
1236
1237
1238 rlwinm r22,r22,0,4,31
1239 addis r22,r22,PAGE_OFFSET@h
1240 mtlr r22
1241 isync
1242 blr
1243
1244
1245
1246
1247
1248 .data
1249 .align PAGE_SHIFT
1250 .globl sdata
1251sdata:
1252 .globl empty_zero_page
1253empty_zero_page:
1254 .space PAGE_SIZE
1255EXPORT_SYMBOL(empty_zero_page)
1256
1257
1258
1259
1260 .globl swapper_pg_dir
1261swapper_pg_dir:
1262 .space PGD_TABLE_SIZE
1263
1264
1265
1266
1267
1268abatron_pteptrs:
1269 .space 8
1270
1271#ifdef CONFIG_SMP
1272 .align 12
1273temp_boot_stack:
1274 .space 1024
1275#endif
1276