1/*-
2 * Copyright (C) 2007-2009 Semihalf, Rafal Jaworowski <raj@semihalf.com>
3 * Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
--- 9 unchanged lines hidden (view full) ---
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
20 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/powerpc/booke/locore.S 279623 2015-03-05 05:53:08Z nwhitehorn $
27 */
28
29#include "assym.s"
30
31#include <machine/asm.h>
32#include <machine/hid.h>
33#include <machine/param.h>
34#include <machine/spr.h>
--- 165 unchanged lines hidden (view full) ---
200 mr %r3, %r28
201 bl tlb1_inval_entry
202
203done_mapping:
204
205/*
206 * Setup a temporary stack
207 */
208 lis %r1, tmpstack@ha
209 addi %r1, %r1, tmpstack@l
210 addi %r1, %r1, (TMPSTACKSZ - 16)
211
212/*
213 * Initialise exception vector offsets
214 */
215 bl ivor_setup
216
217/*
218 * Set up arguments and jump to system initialization code
219 */
220 mr %r3, %r30
--- 112 unchanged lines hidden (view full) ---
333 isync
334 msync
335 addi %r5, %r5, 12
336 addi %r4, %r4, 1
337 cmpw %r4, %r6
338 blt 4b
339
340 /* Switch to the final mapping */
341 lis %r5, __boot_page@ha
342 ori %r5, %r5, __boot_page@l
343 bl 5f
3445: mflr %r3
345 rlwinm %r3, %r3, 0, 0xfff /* Offset from boot page start */
346 add %r3, %r3, %r5 /* Make this virtual address */
347 addi %r3, %r3, 32
348 li %r4, 0 /* Note AS=0 */
349 mtspr SPR_SRR0, %r3
350 mtspr SPR_SRR1, %r4
351 rfi
352
--- 7 unchanged lines hidden (view full) ---
360 * Invalidate temp mapping
361 */
362 mr %r3, %r28
363 bl tlb1_inval_entry
364
365/*
366 * Setup a temporary stack
367 */
368 lis %r1, tmpstack@ha
369 addi %r1, %r1, tmpstack@l
370 addi %r1, %r1, (TMPSTACKSZ - 16)
371
372/*
373 * Initialise exception vector offsets
374 */
375 bl ivor_setup
376
377 /*
378 * Assign our pcpu instance
379 */
380 lis %r3, ap_pcpu@h
381 ori %r3, %r3, ap_pcpu@l
382 lwz %r3, 0(%r3)
383 mtsprg0 %r3
384
385 bl pmap_bootstrap_ap
386
387 bl cpudep_ap_bootstrap
388 /* Switch to the idle thread's kstack */
389 mr %r1, %r3
--- 148 unchanged lines hidden (view full) ---
538
539/*
540 * void tid_flush(tlbtid_t tid);
541 *
542 * Invalidate all TLB0 entries which match the given TID. Note this is
543 * dedicated for cases when invalidation(s) should NOT be propagated to other
544 * CPUs.
545 *
546 * Global vars tlb0_ways, tlb0_entries_per_way are assumed to have been set up
547 * correctly (by tlb0_get_tlbconf()).
548 *
549 */
550ENTRY(tid_flush)
551 cmpwi %r3, TID_KERNEL
552 beq tid_flush_end /* don't evict kernel translations */
553
554 /* Number of TLB0 ways */
555 lis %r4, tlb0_ways@h
556 ori %r4, %r4, tlb0_ways@l
557 lwz %r4, 0(%r4)
558
559 /* Number of entries / way */
560 lis %r5, tlb0_entries_per_way@h
561 ori %r5, %r5, tlb0_entries_per_way@l
562 lwz %r5, 0(%r5)
563
564 /* Disable interrupts */
565 mfmsr %r10
566 wrteei 0
567
568 li %r6, 0 /* ways counter */
569loop_ways:
570 li %r7, 0 /* entries [per way] counter */
571loop_entries:
--- 141 unchanged lines hidden (view full) ---
713 stmw %r10, 12(%r3) /* store CR, CTR, XER, [r13 .. r31] */
714 li %r3, 0 /* return FALSE */
715 blr
716
717/************************************************************************/
718/* Data section */
719/************************************************************************/
720 .data
721 .align 4
722tmpstack:
723 .space TMPSTACKSZ
724tmpstackbound:
725 .space 10240 /* XXX: this really should not be necessary */
726
727/*
728 * Compiled KERNBASE locations
729 */
730 .globl kernbase
731 .set kernbase, KERNBASE
732
733#include <powerpc/booke/trap_subr.S>
2 * Copyright (C) 2007-2009 Semihalf, Rafal Jaworowski <raj@semihalf.com>
3 * Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
--- 9 unchanged lines hidden (view full) ---
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
20 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/powerpc/booke/locore.S 279623 2015-03-05 05:53:08Z nwhitehorn $
27 */
28
29#include "assym.s"
30
31#include <machine/asm.h>
32#include <machine/hid.h>
33#include <machine/param.h>
34#include <machine/spr.h>
--- 165 unchanged lines hidden (view full) ---
200 mr %r3, %r28
201 bl tlb1_inval_entry
202
203done_mapping:
204
205/*
206 * Setup a temporary stack
207 */
208 lis %r1, tmpstack@ha
209 addi %r1, %r1, tmpstack@l
210 addi %r1, %r1, (TMPSTACKSZ - 16)
211
212/*
213 * Initialise exception vector offsets
214 */
215 bl ivor_setup
216
217/*
218 * Set up arguments and jump to system initialization code
219 */
220 mr %r3, %r30
--- 112 unchanged lines hidden (view full) ---
333 isync
334 msync
335 addi %r5, %r5, 12
336 addi %r4, %r4, 1
337 cmpw %r4, %r6
338 blt 4b
339
340 /* Switch to the final mapping */
341 lis %r5, __boot_page@ha
342 ori %r5, %r5, __boot_page@l
343 bl 5f
3445: mflr %r3
345 rlwinm %r3, %r3, 0, 0xfff /* Offset from boot page start */
346 add %r3, %r3, %r5 /* Make this virtual address */
347 addi %r3, %r3, 32
348 li %r4, 0 /* Note AS=0 */
349 mtspr SPR_SRR0, %r3
350 mtspr SPR_SRR1, %r4
351 rfi
352
--- 7 unchanged lines hidden (view full) ---
360 * Invalidate temp mapping
361 */
362 mr %r3, %r28
363 bl tlb1_inval_entry
364
365/*
366 * Setup a temporary stack
367 */
368 lis %r1, tmpstack@ha
369 addi %r1, %r1, tmpstack@l
370 addi %r1, %r1, (TMPSTACKSZ - 16)
371
372/*
373 * Initialise exception vector offsets
374 */
375 bl ivor_setup
376
377 /*
378 * Assign our pcpu instance
379 */
380 lis %r3, ap_pcpu@h
381 ori %r3, %r3, ap_pcpu@l
382 lwz %r3, 0(%r3)
383 mtsprg0 %r3
384
385 bl pmap_bootstrap_ap
386
387 bl cpudep_ap_bootstrap
388 /* Switch to the idle thread's kstack */
389 mr %r1, %r3
--- 148 unchanged lines hidden (view full) ---
538
539/*
540 * void tid_flush(tlbtid_t tid);
541 *
542 * Invalidate all TLB0 entries which match the given TID. Note this is
543 * dedicated for cases when invalidation(s) should NOT be propagated to other
544 * CPUs.
545 *
546 * Global vars tlb0_ways, tlb0_entries_per_way are assumed to have been set up
547 * correctly (by tlb0_get_tlbconf()).
548 *
549 */
550ENTRY(tid_flush)
551 cmpwi %r3, TID_KERNEL
552 beq tid_flush_end /* don't evict kernel translations */
553
554 /* Number of TLB0 ways */
555 lis %r4, tlb0_ways@h
556 ori %r4, %r4, tlb0_ways@l
557 lwz %r4, 0(%r4)
558
559 /* Number of entries / way */
560 lis %r5, tlb0_entries_per_way@h
561 ori %r5, %r5, tlb0_entries_per_way@l
562 lwz %r5, 0(%r5)
563
564 /* Disable interrupts */
565 mfmsr %r10
566 wrteei 0
567
568 li %r6, 0 /* ways counter */
569loop_ways:
570 li %r7, 0 /* entries [per way] counter */
571loop_entries:
--- 141 unchanged lines hidden (view full) ---
713 stmw %r10, 12(%r3) /* store CR, CTR, XER, [r13 .. r31] */
714 li %r3, 0 /* return FALSE */
715 blr
716
717/************************************************************************/
718/* Data section */
719/************************************************************************/
720 .data
721 .align 4
722tmpstack:
723 .space TMPSTACKSZ
724tmpstackbound:
725 .space 10240 /* XXX: this really should not be necessary */
726
727/*
728 * Compiled KERNBASE locations
729 */
730 .globl kernbase
731 .set kernbase, KERNBASE
732
733#include <powerpc/booke/trap_subr.S>