2 * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
3 * Scott McNutt <smcnutt@psyent.com>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #if !defined(CONFIG_IDENT_STRING)
29 #define CONFIG_IDENT_STRING ""
32 #define STATUS_INIT 0x8600 /* IE=1, IPRI=2 */
34 /*************************************************************************
36 ************************************************************************/
46 /* GERMS -- The "standard-32" configuration GERMS monitor looks
47 * for the string "Nios" at flash_base + 0xc (actually it only
48 * tests for 'N', 'i'). You can leave support for this in place
49 * as it's only a few words.
57 * Early setup -- set cwp = HI_LIMIT, IPRI = 2, IE = 1 to
58 * enable underflow exceptions. Disable cache.
59 * NOTE: %o7 has return addr -- save in %g7 use later.
67 or %g0, %lo(STATUS_INIT)
68 wrctl %g0 /* update status */
75 movi %sp, %lo(CFG_INIT_SP)
77 movhi %sp, %xlo(CFG_INIT_SP)
81 subi %sp, %lo(4*16) /* Space for reg window mgmt */
84 * RELOCATE -- %g7 has return addr from bsr at _start.
86 pfx %hi(__u_boot_cmd_end)
87 movi %g5, %lo(__u_boot_cmd_end)
88 pfx %xhi(__u_boot_cmd_end)
89 movhi %g5, %xlo(__u_boot_cmd_end) /* %g5 <- end address */
91 lsli %g7, 1 /* mem = retaddr << 1 */
93 subi %g6, 4 /* %g6 <- src addr */
94 ld %g7, [%g7] /* %g7 <- dst addr */
102 addi %g6, 4 /* src++ */
104 addi %g7, 4 /* dst++ */
110 * Jump to relocation address
113 movi %g0, %lo(reloc@h)
115 movhi %g0, %xlo(reloc@h)
123 movi %g5, %lo(__bss_end)
125 movhi %g5, %xlo(__bss_end) /* %g5 <- end address */
127 movi %g7, %lo(__bss_start)
128 pfx %xhi(__bss_start)
129 movhi %g7, %xlo(__bss_start) /* %g7 <- end address */
138 addi %g7, 4 /* (delay slot) dst++ */
144 * Call board_init -- never returns
146 pfx %hi(board_init@h)
147 movi %g1, %lo(board_init@h)
148 pfx %xhi(board_init@h)
149 movhi %g1, %xlo(board_init@h)
151 nop /* Delaly slot */
155 * dly_clks -- Nios doesn't have a time/clk reference for simple
156 * delay loops, so we do our best by counting instruction cycles.
157 * A control register that counts system clock cycles would be
158 * a handy feature -- hint for Altera ;-)
161 /* Each loop is 4 instructions as delay slot is always
162 * executed. Each instruction is approximately 4 clocks
163 * (according to some lame info from Altera). So ...
164 * ... each loop is about 16 clocks.
168 lsri %o0, 4 /* cnt/16 */
172 subi %o0, 1 /* cnt--, Delay slot */
181 .globl version_string
184 .ascii U_BOOT_VERSION
185 .ascii " (", __DATE__, " - ", __TIME__, ")"
186 .ascii CONFIG_IDENT_STRING, "\0"