]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/powerpc/booke/support.S
add -n option to suppress clearing the build tree and add -DNO_CLEAN
[FreeBSD/FreeBSD.git] / sys / powerpc / booke / support.S
1 /*-
2  * Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  *    derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
19  * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  * $FreeBSD$
28  */
29
30 #include "assym.s"
31
32 #include <machine/param.h>
33 #include <machine/asm.h>
34 #include <machine/spr.h>
35 #include <machine/psl.h>
36 #include <machine/pte.h>
37 #include <machine/trap.h>
38 #include <machine/vmparam.h>
39 #include <machine/tlb.h>
40
41         .text
42 /*
43  * void remap_ccsrbar(vm_offset_t old_ccsrbar_va, vm_offset_t new_ccsrbar_va,
44  *     vm_offset_t new_ccsrbar_pa)
45  *
46  * r3 - old_ccsrbar_va
47  * r4 - new_ccsrbar_va
48  * r5 - new_ccsrbar_pa
49  */
50 ENTRY(remap_ccsrbar)
51         /*
52          * CCSRBAR updating sequence according
53          * to section 4.3.1.1.1 of MPC8555E RM.
54          */
55
56         /* Read current value of CCSRBAR */
57         lwz     %r6, 0(%r3)
58         isync
59
60         /* Write new value */
61         rlwinm  %r6, %r5, 20, 12, 23
62         stw     %r6, 0(%r3)
63
64         /*
65          * Read from address that is outside of CCSRBAR space.
66          * We have RAM locations available at KERNBASE.
67          */
68         lis     %r7, KERNBASE@ha
69         addi    %r7, %r7, KERNBASE@l
70         lwz     %r6, 0(%r7)
71         isync
72
73         /* Read value of CCSRBAR from new location */
74         lwz     %r6, 0(%r4)
75         isync
76         blr
77
78 /*
79  * void switch_to_as0(void)
80  */
81 ENTRY(switch_to_as0)
82         mflr    %r5                     /* Save LR */
83
84         mfmsr   %r3
85         lis     %r6, (PSL_IS | PSL_DS)@ha
86         ori     %r6, %r6, (PSL_IS | PSL_DS)@l
87         not     %r6, %r6
88         and     %r3, %r3, %r6           /* Clear IS/DS bits */
89
90         bl      1f
91 1:      mflr    %r4                     /* Use current address */
92         addi    %r4, %r4, 20            /* Increment to instruction after rfi  */
93         mtspr   SPR_SRR0, %r4
94         mtspr   SPR_SRR1, %r3
95         rfi
96
97         mtlr    %r5                     /* Restore LR */
98         blr
99
100 /*
101  * void load_pid0(tlbtid_t)
102  */
103 ENTRY(load_pid0)
104         mtspr   SPR_PID0, %r3
105         isync
106         blr