2 * Copyright (C) 2007 by Oleksandr Tymoshenko. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
17 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
34 #include <sys/param.h>
36 #include <sys/kernel.h>
37 #include <sys/systm.h>
38 #include <sys/imgact.h>
45 #include <sys/ucontext.h>
48 #include <sys/ptrace.h>
49 #include <sys/reboot.h>
50 #include <sys/signalvar.h>
51 #include <sys/sysent.h>
52 #include <sys/sysproto.h>
56 #include <vm/vm_object.h>
57 #include <vm/vm_page.h>
58 #include <vm/vm_pager.h>
60 #include <machine/cache.h>
61 #include <machine/clock.h>
62 #include <machine/cpu.h>
63 #include <machine/cpuinfo.h>
64 #include <machine/cpufunc.h>
65 #include <machine/cpuregs.h>
66 #include <machine/hwfunc.h>
67 #include <machine/intr_machdep.h>
68 #include <machine/locore.h>
69 #include <machine/md_var.h>
70 #include <machine/pte.h>
71 #include <machine/sigframe.h>
72 #include <machine/trap.h>
73 #include <machine/vmparam.h>
86 platform_identify(void)
94 volatile unsigned int * p = (void *)0xb8008000;
96 * TODO: we should take care of TLB stuff here. Otherwise
97 * board does not boots properly next time
100 /* Write 0x8000_0001 to the Reset register */
103 __asm __volatile("li $25, 0xbfc00000");
104 __asm __volatile("j $25");
108 platform_trap_enter(void)
114 platform_trap_exit(void)
120 platform_start(__register_t a0, __register_t a1,
121 __register_t a2 __unused, __register_t a3 __unused)
123 uint64_t platform_counter_freq;
126 char **argv = (char **)a1;
130 /* clear the BSS and SBSS segments */
131 kernend = round_page((vm_offset_t)&end);
132 memset(&edata, 0, kernend - (vm_offset_t)(&edata));
135 * Looking for mem=XXM argument
137 mem = 0; /* Just something to start with */
138 for (i=0; i < argc; i++) {
139 if (strncmp(argv[i], "mem=", 4) == 0) {
140 mem = strtol(argv[i] + 4, NULL, 0);
147 realmem = btoc(mem << 20);
149 realmem = btoc(32 << 20);
151 for (i = 0; i < 10; i++) {
155 /* phys_avail regions are in bytes */
156 phys_avail[0] = MIPS_KSEG0_TO_PHYS((vm_offset_t)&end);
157 phys_avail[1] = ctob(realmem);
162 * ns8250 uart code uses DELAY so ticker should be inititalized
163 * before cninit. And tick_init_params refers to hz, so * init_param1
164 * should be called first.
167 /* TODO: parse argc,argv */
168 platform_counter_freq = 330000000UL;
169 mips_timer_init_params(platform_counter_freq, 1);
171 /* Panic here, after cninit */
173 panic("No mem=XX parameter in arguments");
175 printf("cmd line: ");
176 for (i=0; i < argc; i++)
177 printf("%s ", argv[i]);
180 init_param2(physmem);