source: mainline/boot/arch/mips32/src/asm.S

Last change on this file was dabaa83, checked in by Jakub Jermar <jakub@…>, 6 years ago

Add boot arguments support for Malta

This commit makes it possible to pass console configuration via proper
boot arguemnts instead of having a hardcoded value in the kernel.

  • Property mode set to 100644
File size: 3.6 KB
Line 
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
36.section BOOTSTRAP
37
38/*
39 * Registers on entry:
40 *
41 * a0: kernel argument count (kargc)
42 * a1: kernel argument vector (kargv) of kargc elements
43 * a2: unused here (kenvp on Malta)
44 * a3: RAM size on Malta
45 *
46 * This is the case on Malta.
47 * msim clears these registers, so it is de facto correct as well.
48 */
49SYMBOL(start)
50 /*
51 * Setup the CP0 configuration
52 * - Disable 64-bit kernel addressing mode
53 * - Disable 64-bit supervisor adressing mode
54 * - Disable 64-bit user addressing mode
55 */
56 mfc0 $t0, $status
57 la $t1, 0xffffff1f
58 and $t0, $t1, $t0
59 mtc0 $t0, $status
60
61#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
62 /*
63 * Remember the size of the SDRAM in bootinfo.
64 */
65 la $t0, PA2KA(BOOTINFO_OFFSET)
66 sw $a3, 0($t0)
67#endif
68
69 /*
70 * Setup CPU map (on msim this code
71 * is executed in parallel on all CPUs,
72 * but it not an issue).
73 */
74 la $t0, PA2KA(CPUMAP_OFFSET)
75
76 sw $zero, 0($t0)
77 sw $zero, 4($t0)
78 sw $zero, 8($t0)
79 sw $zero, 12($t0)
80
81 sw $zero, 16($t0)
82 sw $zero, 20($t0)
83 sw $zero, 24($t0)
84 sw $zero, 28($t0)
85
86 sw $zero, 32($t0)
87 sw $zero, 36($t0)
88 sw $zero, 40($t0)
89 sw $zero, 44($t0)
90
91 sw $zero, 48($t0)
92 sw $zero, 52($t0)
93 sw $zero, 56($t0)
94 sw $zero, 60($t0)
95
96 sw $zero, 64($t0)
97 sw $zero, 68($t0)
98 sw $zero, 72($t0)
99 sw $zero, 76($t0)
100
101 sw $zero, 80($t0)
102 sw $zero, 84($t0)
103 sw $zero, 88($t0)
104 sw $zero, 92($t0)
105
106 sw $zero, 96($t0)
107 sw $zero, 100($t0)
108 sw $zero, 104($t0)
109 sw $zero, 108($t0)
110
111 sw $zero, 112($t0)
112 sw $zero, 116($t0)
113 sw $zero, 120($t0)
114 sw $zero, 124($t0)
115
116 lui $t1, 1
117
118#ifdef MACHINE_msim
119
120 /* Read dorder value */
121 la $k0, MSIM_DORDER_ADDRESS
122 lw $k1, ($k0)
123
124 /*
125 * If we are not running on BSP
126 * then end in an infinite loop.
127 */
128 beq $k1, $zero, bsp
129 nop
130
131 /* Record CPU presence */
132 sll $t2, $k1, 2
133 addu $t2, $t2, $t0
134 sw $t1, ($t2)
135
136 loop:
137 j loop
138 nop
139
140#endif
141
142 bsp:
143 /* Record CPU presence */
144 sw $t1, ($t0)
145
146 /* Setup initial stack */
147 la $sp, PA2KA(STACK_OFFSET)
148
149 /* a0=kargc, a1=kargv */
150 j bootstrap
151 nop
152
153.text
154
155FUNCTION_BEGIN(halt)
156 j halt
157 nop
158FUNCTION_END(halt)
159
160FUNCTION_BEGIN(jump_to_kernel)
161 j $a0
162 nop
163FUNCTION_END(jump_to_kernel)
Note: See TracBrowser for help on using the repository browser.