1 /* $NetBSD: vr41xx.c,v 1.5 2007/03/04 05:59:53 christos Exp $ */
4 * Copyright (c) 1999 Shin Takemura.
7 * This software is part of the PocketBSD.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the PocketBSD project
20 * and its contributors.
21 * 4. Neither the name of the project nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 extern void vr41xx_asm_code();
41 extern void vr41xx_asm_code_end();
42 void vr41xx_asm_code_holder(void);
45 vr41xx_init(SYSTEM_INFO
*info
)
48 system_info
.si_pagesize
= info
->dwPageSize
;
49 /* DRAM Bank 0/1 physical addr range */
50 system_info
.si_dramstart
= 0x80000000;
51 system_info
.si_drammaxsize
= 0x08000000;
52 /* Pointer for bootstrap code */
53 system_info
.si_asmcode
= (unsigned char*)vr41xx_asm_code
;
54 system_info
.si_asmcodelen
= (unsigned char*)vr41xx_asm_code_end
55 - system_info
.si_asmcode
;
56 system_info
.si_boot
= mips_boot
;
57 system_info
.si_intrvec
= 0;
61 vr41xx_asm_code_holder()
65 * startprog(register struct map_s *map)
67 * register unsigned char *addr;
68 * register unsigned char *p;
73 * while (p = map->leaf[i / map->leafsize][i % map->leafsize]) {
74 * register unsigned char *pe = p + map->pagesize;
82 * register assignment:
83 * struct map_s *map a0
84 * unsigned char *addr a1
86 * unsigned char *pe a3
103 * void **leaf[32]; +36
108 " .globl vr41xx_asm_code;"
113 /* addr = map->base; */
121 /* while (p = map->leaf[i / map->leafsize][i % map->leafsize]) { */
122 /* t1 = map->leafsize */
125 /* lo = i / map->leafsize, hi = i % map->leafsize */
130 /* t3 = i / map->leafsize */
133 /* t2 = map->leaf[i / map->leafsize] */
137 /* t3 = i % map->leafsize */
140 /* p = map->leaf[i / map->leafsize][i % map->leafsize] */
145 /* if (p == NULL) { */
148 "beq a2, zero, loop_end;"
151 /* register unsigned char *pe = p + map->pagesize; */
155 /* while (p < pe) { */
158 "beq zero,t1,loop_end2;"
161 /* *addr++ = *p++; */
168 "beq zero, zero, loop_start2;"
174 "beq zero, zero, loop_start;"
181 * flush instruction cache
184 " li t0, 0x80000000;"
185 " addu t1, t0, 1024*128;"
204 " li t0, 0x80000000;"
205 " addu t1, t0, 1024*128;"
221 " lw t0, 0(a0);" /* entry addr */
222 " lw a1, 24(a0);" /* arg1 */
223 " lw a2, 28(a0);" /* arg2 */
224 " lw a3, 32(a0);" /* arg3 */
225 " lw a0, 20(a0);" /* arg0 */
229 " .globl vr41xx_asm_code_end;"
230 "vr41xx_asm_code_end: nop;"