1 /* $NetBSD: romboot.S,v 1.6.16.3 2004/09/21 13:16:12 skrll Exp $ */
4 * Copyright (c) 2001, 2002, 2003 Takao Shinohara.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. 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.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * simple boot loader for ROM
30 * supported platform: LASER5 L-Router(L-Board)
66 #define MIPS_KSEG0_START 0x80000000
67 #define MIPS_KSEG1_START 0xa0000000
68 #define KSEG1_KSEG0_DIFF (MIPS_KSEG1_START - MIPS_KSEG0_START)
69 #define KERNEL_LOADADDR 0x80001000
70 #define MAX_KERNEL_SIZE (1024*1024*6) # 6MB
71 #define MAX_DCACHE_SIZE (1024*32) # 32KB
77 bal 1f # ra = ROM address + 8
79 1: subu a0, ra, 8 # a0 = ROM address(kseg1)
80 subu a0, KSEG1_KSEG0_DIFF # convert to kseg0 address
81 move s0, a0 # keep it in s0
84 subu t0, t1 # t0 = size of boot loader
85 addu a0, t0 # a0 = kernel address in ROM
86 li a1, KERNEL_LOADADDR
87 li t2, MAX_KERNEL_SIZE # max kernel size = 6MB - boot
89 addu t2, a1 # kernel end address
92 jr t9 # jump to cached address
101 /* purge data cache */
102 li v0, MAX_DCACHE_SIZE
108 li sp, KERNEL_LOADADDR # initialize stack pointer
110 addu a1, sp, -16 # argv
113 sw t0, 0(a1) # argv[0] = "netbsd"
114 sw zero, 4(a1) # argv[1] = NULL
118 li t9, KERNEL_LOADADDR
122 argv0: .asciiz "netbsd"
126 .word 0x13536135 # magic
128 .word 0, 0 # fb_line_bytes, fb_width, fb_height, fb_type
129 .word 2 # BI_CNUSE_SERIAL
130 .word 0x04104500 # VR4122
131 .word 0x03810200 # LASER5 L-BOARD
133 * kernel binary image begins here.