1 | #
|
---|
2 | # Copyright (c) 2006 Martin Decky
|
---|
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 | #
|
---|
9 | # - Redistributions of source code must retain the above copyright
|
---|
10 | # notice, this list of conditions and the following disclaimer.
|
---|
11 | # - Redistributions in binary form must reproduce the above copyright
|
---|
12 | # notice, this list of conditions and the following disclaimer in the
|
---|
13 | # documentation and/or other materials provided with the distribution.
|
---|
14 | # - The name of the author may not be used to endorse or promote products
|
---|
15 | # derived from this software without specific prior written permission.
|
---|
16 | #
|
---|
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | #
|
---|
28 |
|
---|
29 | #include <abi/asmtool.h>
|
---|
30 | #include <arch/arch.h>
|
---|
31 | #include <arch/regname.h>
|
---|
32 |
|
---|
33 | .set noat
|
---|
34 | .set noreorder
|
---|
35 | .set nomacro
|
---|
36 |
|
---|
37 | .section BOOTSTRAP
|
---|
38 |
|
---|
39 | SYMBOL(start)
|
---|
40 | /*
|
---|
41 | * Setup the CP0 configuration
|
---|
42 | * - Disable 64-bit kernel addressing mode
|
---|
43 | * - Disable 64-bit supervisor adressing mode
|
---|
44 | * - Disable 64-bit user addressing mode
|
---|
45 | */
|
---|
46 | mfc0 $a0, $status
|
---|
47 | la $a1, 0xffffff1f
|
---|
48 | and $a0, $a1, $a0
|
---|
49 | mtc0 $a0, $status
|
---|
50 |
|
---|
51 | #if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
|
---|
52 | /*
|
---|
53 | * Remember the size of the SDRAM in bootinfo.
|
---|
54 | */
|
---|
55 | la $a0, PA2KA(BOOTINFO_OFFSET)
|
---|
56 | sw $a3, 0($a0)
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | /*
|
---|
60 | * Setup CPU map (on msim this code
|
---|
61 | * is executed in parallel on all CPUs,
|
---|
62 | * but it not an issue).
|
---|
63 | */
|
---|
64 | la $a0, PA2KA(CPUMAP_OFFSET)
|
---|
65 |
|
---|
66 | sw $zero, 0($a0)
|
---|
67 | sw $zero, 4($a0)
|
---|
68 | sw $zero, 8($a0)
|
---|
69 | sw $zero, 12($a0)
|
---|
70 |
|
---|
71 | sw $zero, 16($a0)
|
---|
72 | sw $zero, 20($a0)
|
---|
73 | sw $zero, 24($a0)
|
---|
74 | sw $zero, 28($a0)
|
---|
75 |
|
---|
76 | sw $zero, 32($a0)
|
---|
77 | sw $zero, 36($a0)
|
---|
78 | sw $zero, 40($a0)
|
---|
79 | sw $zero, 44($a0)
|
---|
80 |
|
---|
81 | sw $zero, 48($a0)
|
---|
82 | sw $zero, 52($a0)
|
---|
83 | sw $zero, 56($a0)
|
---|
84 | sw $zero, 60($a0)
|
---|
85 |
|
---|
86 | sw $zero, 64($a0)
|
---|
87 | sw $zero, 68($a0)
|
---|
88 | sw $zero, 72($a0)
|
---|
89 | sw $zero, 76($a0)
|
---|
90 |
|
---|
91 | sw $zero, 80($a0)
|
---|
92 | sw $zero, 84($a0)
|
---|
93 | sw $zero, 88($a0)
|
---|
94 | sw $zero, 92($a0)
|
---|
95 |
|
---|
96 | sw $zero, 96($a0)
|
---|
97 | sw $zero, 100($a0)
|
---|
98 | sw $zero, 104($a0)
|
---|
99 | sw $zero, 108($a0)
|
---|
100 |
|
---|
101 | sw $zero, 112($a0)
|
---|
102 | sw $zero, 116($a0)
|
---|
103 | sw $zero, 120($a0)
|
---|
104 | sw $zero, 124($a0)
|
---|
105 |
|
---|
106 | lui $a1, 1
|
---|
107 |
|
---|
108 | #ifdef MACHINE_msim
|
---|
109 |
|
---|
110 | /* Read dorder value */
|
---|
111 | la $k0, MSIM_DORDER_ADDRESS
|
---|
112 | lw $k1, ($k0)
|
---|
113 |
|
---|
114 | /*
|
---|
115 | * If we are not running on BSP
|
---|
116 | * then end in an infinite loop.
|
---|
117 | */
|
---|
118 | beq $k1, $zero, bsp
|
---|
119 | nop
|
---|
120 |
|
---|
121 | /* Record CPU presence */
|
---|
122 | sll $a2, $k1, 2
|
---|
123 | addu $a2, $a2, $a0
|
---|
124 | sw $a1, ($a2)
|
---|
125 |
|
---|
126 | loop:
|
---|
127 | j loop
|
---|
128 | nop
|
---|
129 |
|
---|
130 | #endif
|
---|
131 |
|
---|
132 | bsp:
|
---|
133 | /* Record CPU presence */
|
---|
134 | sw $a1, ($a0)
|
---|
135 |
|
---|
136 | /* Setup initial stack */
|
---|
137 | la $sp, PA2KA(STACK_OFFSET)
|
---|
138 |
|
---|
139 | j bootstrap
|
---|
140 | nop
|
---|
141 |
|
---|
142 | .text
|
---|
143 |
|
---|
144 | FUNCTION_BEGIN(halt)
|
---|
145 | j halt
|
---|
146 | nop
|
---|
147 | FUNCTION_END(halt)
|
---|
148 |
|
---|
149 | FUNCTION_BEGIN(jump_to_kernel)
|
---|
150 | /*
|
---|
151 | * TODO:
|
---|
152 | *
|
---|
153 | * Make sure that the I-cache, D-cache and memory are mutually
|
---|
154 | * coherent before passing control to the copied code.
|
---|
155 | */
|
---|
156 | j $a0
|
---|
157 | nop
|
---|
158 | FUNCTION_END(jump_to_kernel)
|
---|