gumstix_machdep.c revision 1.2.4.6 1 1.2.4.6 yamt /* $NetBSD: gumstix_machdep.c,v 1.2.4.6 2008/01/21 09:36:10 yamt Exp $ */
2 1.2.4.2 yamt /*
3 1.2.4.3 yamt * Copyright (C) 2005, 2006, 2007 WIDE Project and SOUM Corporation.
4 1.2.4.2 yamt * All rights reserved.
5 1.2.4.2 yamt *
6 1.2.4.2 yamt * Written by Takashi Kiyohara and Susumu Miki for WIDE Project and SOUM
7 1.2.4.2 yamt * Corporation.
8 1.2.4.2 yamt *
9 1.2.4.2 yamt * Redistribution and use in source and binary forms, with or without
10 1.2.4.2 yamt * modification, are permitted provided that the following conditions
11 1.2.4.2 yamt * are met:
12 1.2.4.2 yamt * 1. Redistributions of source code must retain the above copyright
13 1.2.4.2 yamt * notice, this list of conditions and the following disclaimer.
14 1.2.4.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
15 1.2.4.2 yamt * notice, this list of conditions and the following disclaimer in the
16 1.2.4.2 yamt * documentation and/or other materials provided with the distribution.
17 1.2.4.2 yamt * 3. Neither the name of the project nor the name of SOUM Corporation
18 1.2.4.2 yamt * may be used to endorse or promote products derived from this software
19 1.2.4.2 yamt * without specific prior written permission.
20 1.2.4.2 yamt *
21 1.2.4.2 yamt * THIS SOFTWARE IS PROVIDED BY THE PROJECT and SOUM CORPORATION ``AS IS''
22 1.2.4.2 yamt * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 1.2.4.2 yamt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 1.2.4.2 yamt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT AND SOUM CORPORATION
25 1.2.4.2 yamt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 1.2.4.2 yamt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 1.2.4.2 yamt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 1.2.4.2 yamt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 1.2.4.2 yamt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 1.2.4.2 yamt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 1.2.4.2 yamt * POSSIBILITY OF SUCH DAMAGE.
32 1.2.4.2 yamt */
33 1.2.4.2 yamt /*
34 1.2.4.2 yamt * Copyright (c) 2002, 2003, 2004, 2005 Genetec Corporation.
35 1.2.4.2 yamt * All rights reserved.
36 1.2.4.2 yamt *
37 1.2.4.2 yamt * Written by Hiroyuki Bessho for Genetec Corporation.
38 1.2.4.2 yamt *
39 1.2.4.2 yamt * Redistribution and use in source and binary forms, with or without
40 1.2.4.2 yamt * modification, are permitted provided that the following conditions
41 1.2.4.2 yamt * are met:
42 1.2.4.2 yamt * 1. Redistributions of source code must retain the above copyright
43 1.2.4.2 yamt * notice, this list of conditions and the following disclaimer.
44 1.2.4.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
45 1.2.4.2 yamt * notice, this list of conditions and the following disclaimer in the
46 1.2.4.2 yamt * documentation and/or other materials provided with the distribution.
47 1.2.4.2 yamt * 3. The name of Genetec Corporation may not be used to endorse or
48 1.2.4.2 yamt * promote products derived from this software without specific prior
49 1.2.4.2 yamt * written permission.
50 1.2.4.2 yamt *
51 1.2.4.2 yamt * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
52 1.2.4.2 yamt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
53 1.2.4.2 yamt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
54 1.2.4.2 yamt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION
55 1.2.4.2 yamt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
56 1.2.4.2 yamt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
57 1.2.4.2 yamt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
58 1.2.4.2 yamt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
59 1.2.4.2 yamt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
60 1.2.4.2 yamt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
61 1.2.4.2 yamt * POSSIBILITY OF SUCH DAMAGE.
62 1.2.4.2 yamt *
63 1.2.4.2 yamt * Machine dependant functions for kernel setup for Genetec G4250EBX
64 1.2.4.2 yamt * evaluation board.
65 1.2.4.2 yamt *
66 1.2.4.2 yamt * Based on iq80310_machhdep.c
67 1.2.4.2 yamt */
68 1.2.4.2 yamt /*
69 1.2.4.2 yamt * Copyright (c) 2001 Wasabi Systems, Inc.
70 1.2.4.2 yamt * All rights reserved.
71 1.2.4.2 yamt *
72 1.2.4.2 yamt * Written by Jason R. Thorpe for Wasabi Systems, Inc.
73 1.2.4.2 yamt *
74 1.2.4.2 yamt * Redistribution and use in source and binary forms, with or without
75 1.2.4.2 yamt * modification, are permitted provided that the following conditions
76 1.2.4.2 yamt * are met:
77 1.2.4.2 yamt * 1. Redistributions of source code must retain the above copyright
78 1.2.4.2 yamt * notice, this list of conditions and the following disclaimer.
79 1.2.4.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
80 1.2.4.2 yamt * notice, this list of conditions and the following disclaimer in the
81 1.2.4.2 yamt * documentation and/or other materials provided with the distribution.
82 1.2.4.2 yamt * 3. All advertising materials mentioning features or use of this software
83 1.2.4.2 yamt * must display the following acknowledgement:
84 1.2.4.2 yamt * This product includes software developed for the NetBSD Project by
85 1.2.4.2 yamt * Wasabi Systems, Inc.
86 1.2.4.2 yamt * 4. The name of Wasabi Systems, Inc. may not be used to endorse
87 1.2.4.2 yamt * or promote products derived from this software without specific prior
88 1.2.4.2 yamt * written permission.
89 1.2.4.2 yamt *
90 1.2.4.2 yamt * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
91 1.2.4.2 yamt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
92 1.2.4.2 yamt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
93 1.2.4.2 yamt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
94 1.2.4.2 yamt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
95 1.2.4.2 yamt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
96 1.2.4.2 yamt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
97 1.2.4.2 yamt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
98 1.2.4.2 yamt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
99 1.2.4.2 yamt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
100 1.2.4.2 yamt * POSSIBILITY OF SUCH DAMAGE.
101 1.2.4.2 yamt */
102 1.2.4.2 yamt
103 1.2.4.2 yamt /*
104 1.2.4.2 yamt * Copyright (c) 1997,1998 Mark Brinicombe.
105 1.2.4.2 yamt * Copyright (c) 1997,1998 Causality Limited.
106 1.2.4.2 yamt * All rights reserved.
107 1.2.4.2 yamt *
108 1.2.4.2 yamt * Redistribution and use in source and binary forms, with or without
109 1.2.4.2 yamt * modification, are permitted provided that the following conditions
110 1.2.4.2 yamt * are met:
111 1.2.4.2 yamt * 1. Redistributions of source code must retain the above copyright
112 1.2.4.2 yamt * notice, this list of conditions and the following disclaimer.
113 1.2.4.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
114 1.2.4.2 yamt * notice, this list of conditions and the following disclaimer in the
115 1.2.4.2 yamt * documentation and/or other materials provided with the distribution.
116 1.2.4.2 yamt * 3. All advertising materials mentioning features or use of this software
117 1.2.4.2 yamt * must display the following acknowledgement:
118 1.2.4.2 yamt * This product includes software developed by Mark Brinicombe
119 1.2.4.2 yamt * for the NetBSD Project.
120 1.2.4.2 yamt * 4. The name of the company nor the name of the author may be used to
121 1.2.4.2 yamt * endorse or promote products derived from this software without specific
122 1.2.4.2 yamt * prior written permission.
123 1.2.4.2 yamt *
124 1.2.4.2 yamt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
125 1.2.4.2 yamt * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
126 1.2.4.2 yamt * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
127 1.2.4.2 yamt * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
128 1.2.4.2 yamt * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
129 1.2.4.2 yamt * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
130 1.2.4.2 yamt * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
131 1.2.4.2 yamt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
132 1.2.4.2 yamt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
133 1.2.4.2 yamt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
134 1.2.4.2 yamt * SUCH DAMAGE.
135 1.2.4.2 yamt *
136 1.2.4.2 yamt * Machine dependant functions for kernel setup for Intel IQ80310 evaluation
137 1.2.4.2 yamt * boards using RedBoot firmware.
138 1.2.4.2 yamt */
139 1.2.4.2 yamt
140 1.2.4.2 yamt #include "opt_ddb.h"
141 1.2.4.2 yamt #include "opt_kgdb.h"
142 1.2.4.2 yamt #include "opt_pmap_debug.h"
143 1.2.4.2 yamt #include "opt_md.h"
144 1.2.4.2 yamt #include "opt_com.h"
145 1.2.4.2 yamt #include "md.h"
146 1.2.4.2 yamt
147 1.2.4.2 yamt #include <sys/param.h>
148 1.2.4.2 yamt #include <sys/device.h>
149 1.2.4.2 yamt #include <sys/systm.h>
150 1.2.4.2 yamt #include <sys/kernel.h>
151 1.2.4.2 yamt #include <sys/exec.h>
152 1.2.4.2 yamt #include <sys/proc.h>
153 1.2.4.2 yamt #include <sys/msgbuf.h>
154 1.2.4.2 yamt #include <sys/reboot.h>
155 1.2.4.2 yamt #include <sys/termios.h>
156 1.2.4.2 yamt #include <sys/ksyms.h>
157 1.2.4.2 yamt
158 1.2.4.2 yamt #include <uvm/uvm_extern.h>
159 1.2.4.2 yamt
160 1.2.4.2 yamt #include <sys/conf.h>
161 1.2.4.2 yamt #include <dev/cons.h>
162 1.2.4.2 yamt #include <dev/md.h>
163 1.2.4.2 yamt
164 1.2.4.2 yamt #include <machine/db_machdep.h>
165 1.2.4.2 yamt #include <ddb/db_sym.h>
166 1.2.4.2 yamt #include <ddb/db_extern.h>
167 1.2.4.2 yamt #ifdef KGDB
168 1.2.4.2 yamt #include <sys/kgdb.h>
169 1.2.4.2 yamt #endif
170 1.2.4.2 yamt
171 1.2.4.2 yamt #include <machine/bootconfig.h>
172 1.2.4.2 yamt #include <machine/bus.h>
173 1.2.4.2 yamt #include <machine/cpu.h>
174 1.2.4.2 yamt #include <machine/frame.h>
175 1.2.4.2 yamt #include <arm/undefined.h>
176 1.2.4.2 yamt
177 1.2.4.2 yamt #include <arm/arm32/machdep.h>
178 1.2.4.2 yamt
179 1.2.4.2 yamt #include <arm/xscale/pxa2x0reg.h>
180 1.2.4.2 yamt #include <arm/xscale/pxa2x0var.h>
181 1.2.4.2 yamt #include <arm/xscale/pxa2x0_gpio.h>
182 1.2.4.2 yamt #include <evbarm/gumstix/gumstixreg.h>
183 1.2.4.2 yamt #include <evbarm/gumstix/gumstixvar.h>
184 1.2.4.2 yamt
185 1.2.4.2 yamt /* Kernel text starts 2MB in from the bottom of the kernel address space. */
186 1.2.4.2 yamt #define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00200000)
187 1.2.4.2 yamt #define KERNEL_VM_BASE (KERNEL_BASE + 0x01000000)
188 1.2.4.2 yamt
189 1.2.4.2 yamt /*
190 1.2.4.2 yamt * The range 0xc1000000 - 0xccffffff is available for kernel VM space
191 1.2.4.2 yamt * Core-logic registers and I/O mappings occupy 0xfd000000 - 0xffffffff
192 1.2.4.2 yamt */
193 1.2.4.2 yamt #define KERNEL_VM_SIZE 0x0C000000
194 1.2.4.2 yamt
195 1.2.4.2 yamt
196 1.2.4.2 yamt /*
197 1.2.4.2 yamt * Address to call from cpu_reset() to reset the machine.
198 1.2.4.2 yamt * This is machine architecture dependant as it varies depending
199 1.2.4.2 yamt * on where the ROM appears when you turn the MMU off.
200 1.2.4.2 yamt */
201 1.2.4.2 yamt
202 1.2.4.2 yamt u_int cpu_reset_address = 0;
203 1.2.4.2 yamt
204 1.2.4.2 yamt /* Define various stack sizes in pages */
205 1.2.4.2 yamt #define IRQ_STACK_SIZE 1
206 1.2.4.2 yamt #define ABT_STACK_SIZE 1
207 1.2.4.2 yamt #define UND_STACK_SIZE 1
208 1.2.4.2 yamt
209 1.2.4.2 yamt BootConfig bootconfig; /* Boot config storage */
210 1.2.4.2 yamt static char bootargs[MAX_BOOT_STRING];
211 1.2.4.2 yamt char *boot_args = NULL;
212 1.2.4.2 yamt
213 1.2.4.2 yamt uint32_t system_serial_high;
214 1.2.4.2 yamt uint32_t system_serial_low;
215 1.2.4.2 yamt
216 1.2.4.2 yamt vm_offset_t physical_start;
217 1.2.4.2 yamt vm_offset_t physical_freestart;
218 1.2.4.2 yamt vm_offset_t physical_freeend;
219 1.2.4.2 yamt vm_offset_t physical_end;
220 1.2.4.2 yamt u_int free_pages;
221 1.2.4.2 yamt vm_offset_t pagetables_start;
222 1.2.4.2 yamt int physmem = 0;
223 1.2.4.2 yamt
224 1.2.4.2 yamt /*int debug_flags;*/
225 1.2.4.2 yamt #ifndef PMAP_STATIC_L1S
226 1.2.4.2 yamt int max_processes = 64; /* Default number */
227 1.2.4.2 yamt #endif /* !PMAP_STATIC_L1S */
228 1.2.4.2 yamt
229 1.2.4.2 yamt /* Physical and virtual addresses for some global pages */
230 1.2.4.2 yamt pv_addr_t systempage;
231 1.2.4.2 yamt pv_addr_t irqstack;
232 1.2.4.2 yamt pv_addr_t undstack;
233 1.2.4.2 yamt pv_addr_t abtstack;
234 1.2.4.2 yamt pv_addr_t kernelstack;
235 1.2.4.2 yamt pv_addr_t minidataclean;
236 1.2.4.2 yamt
237 1.2.4.2 yamt vm_offset_t msgbufphys;
238 1.2.4.2 yamt
239 1.2.4.2 yamt extern u_int data_abort_handler_address;
240 1.2.4.2 yamt extern u_int prefetch_abort_handler_address;
241 1.2.4.2 yamt extern u_int undefined_handler_address;
242 1.2.4.2 yamt
243 1.2.4.2 yamt #ifdef PMAP_DEBUG
244 1.2.4.2 yamt extern int pmap_debug_level;
245 1.2.4.2 yamt #endif
246 1.2.4.2 yamt
247 1.2.4.2 yamt #define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */
248 1.2.4.2 yamt #define KERNEL_PT_KERNEL 1 /* Page table for mapping kernel */
249 1.2.4.2 yamt #define KERNEL_PT_KERNEL_NUM 4
250 1.2.4.2 yamt #define KERNEL_PT_VMDATA (KERNEL_PT_KERNEL+KERNEL_PT_KERNEL_NUM)
251 1.2.4.2 yamt /* Page tables for mapping kernel VM */
252 1.2.4.2 yamt #define KERNEL_PT_VMDATA_NUM 4 /* start with 16MB of KVM */
253 1.2.4.2 yamt #define NUM_KERNEL_PTS (KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
254 1.2.4.2 yamt
255 1.2.4.2 yamt pv_addr_t kernel_pt_table[NUM_KERNEL_PTS];
256 1.2.4.2 yamt
257 1.2.4.2 yamt struct user *proc0paddr;
258 1.2.4.2 yamt
259 1.2.4.2 yamt /* Prototypes */
260 1.2.4.3 yamt static void read_system_serial(void);
261 1.2.4.3 yamt static void process_kernel_args(int, char *[]);
262 1.2.4.3 yamt #ifdef KGDB
263 1.2.4.3 yamt static void kgdb_port_init(void);
264 1.2.4.3 yamt #endif
265 1.2.4.2 yamt
266 1.2.4.2 yamt bs_protos(bs_notimpl);
267 1.2.4.2 yamt
268 1.2.4.2 yamt #include "com.h"
269 1.2.4.2 yamt #if NCOM > 0
270 1.2.4.2 yamt #include <dev/ic/comreg.h>
271 1.2.4.2 yamt #include <dev/ic/comvar.h>
272 1.2.4.2 yamt #endif
273 1.2.4.2 yamt
274 1.2.4.2 yamt #ifndef CONSPEED
275 1.2.4.2 yamt #define CONSPEED B115200 /* It's a setting of the default of u-boot */
276 1.2.4.2 yamt #endif
277 1.2.4.2 yamt #ifndef CONMODE
278 1.2.4.2 yamt #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
279 1.2.4.2 yamt #endif
280 1.2.4.2 yamt
281 1.2.4.2 yamt int comcnspeed = CONSPEED;
282 1.2.4.2 yamt int comcnmode = CONMODE;
283 1.2.4.2 yamt
284 1.2.4.3 yamt extern void gxio_config_pin(void);
285 1.2.4.4 yamt extern void gxio_config_expansion(char *);
286 1.2.4.3 yamt
287 1.2.4.2 yamt /*
288 1.2.4.2 yamt * void cpu_reboot(int howto, char *bootstr)
289 1.2.4.2 yamt *
290 1.2.4.2 yamt * Deal with any syncing, unmounting, dumping and shutdown hooks,
291 1.2.4.2 yamt * then reset the CPU.
292 1.2.4.2 yamt */
293 1.2.4.2 yamt void
294 1.2.4.2 yamt cpu_reboot(int howto, char *bootstr)
295 1.2.4.2 yamt {
296 1.2.4.5 yamt
297 1.2.4.2 yamt #ifdef DIAGNOSTIC
298 1.2.4.2 yamt /* info */
299 1.2.4.2 yamt printf("boot: howto=%08x curproc=%p\n", howto, curproc);
300 1.2.4.2 yamt #endif
301 1.2.4.2 yamt
302 1.2.4.2 yamt /*
303 1.2.4.2 yamt * If we are still cold then hit the air brakes
304 1.2.4.2 yamt * and crash to earth fast
305 1.2.4.2 yamt */
306 1.2.4.2 yamt if (cold) {
307 1.2.4.2 yamt doshutdownhooks();
308 1.2.4.2 yamt printf("The operating system has halted.\n");
309 1.2.4.2 yamt printf("Please press any key to reboot.\n\n");
310 1.2.4.2 yamt cngetc();
311 1.2.4.2 yamt printf("rebooting...\n");
312 1.2.4.2 yamt cpu_reset();
313 1.2.4.2 yamt /*NOTREACHED*/
314 1.2.4.2 yamt }
315 1.2.4.2 yamt
316 1.2.4.2 yamt /*
317 1.2.4.2 yamt * If RB_NOSYNC was not specified sync the discs.
318 1.2.4.2 yamt * Note: Unless cold is set to 1 here, syslogd will die during the
319 1.2.4.2 yamt * unmount. It looks like syslogd is getting woken up only to find
320 1.2.4.2 yamt * that it cannot page part of the binary in as the filesystem has
321 1.2.4.2 yamt * been unmounted.
322 1.2.4.2 yamt */
323 1.2.4.2 yamt if (!(howto & RB_NOSYNC))
324 1.2.4.2 yamt bootsync();
325 1.2.4.2 yamt
326 1.2.4.2 yamt /* Say NO to interrupts */
327 1.2.4.2 yamt splhigh();
328 1.2.4.2 yamt
329 1.2.4.2 yamt /* Do a dump if requested. */
330 1.2.4.2 yamt if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
331 1.2.4.2 yamt dumpsys();
332 1.2.4.2 yamt
333 1.2.4.2 yamt /* Run any shutdown hooks */
334 1.2.4.2 yamt doshutdownhooks();
335 1.2.4.2 yamt
336 1.2.4.2 yamt /* Make sure IRQ's are disabled */
337 1.2.4.2 yamt IRQdisable;
338 1.2.4.2 yamt
339 1.2.4.2 yamt if (howto & RB_HALT) {
340 1.2.4.2 yamt printf("The operating system has halted.\n");
341 1.2.4.2 yamt printf("Please press any key to reboot.\n\n");
342 1.2.4.2 yamt cngetc();
343 1.2.4.2 yamt }
344 1.2.4.2 yamt
345 1.2.4.2 yamt printf("rebooting...\n");
346 1.2.4.2 yamt cpu_reset();
347 1.2.4.2 yamt /*NOTREACHED*/
348 1.2.4.2 yamt }
349 1.2.4.2 yamt
350 1.2.4.2 yamt static inline
351 1.2.4.2 yamt pd_entry_t *
352 1.2.4.2 yamt read_ttb(void)
353 1.2.4.2 yamt {
354 1.2.4.2 yamt long ttb;
355 1.2.4.2 yamt
356 1.2.4.2 yamt __asm volatile("mrc p15, 0, %0, c2, c0, 0" : "=r" (ttb));
357 1.2.4.2 yamt
358 1.2.4.2 yamt
359 1.2.4.2 yamt return (pd_entry_t *)(ttb & ~((1<<14)-1));
360 1.2.4.2 yamt }
361 1.2.4.2 yamt
362 1.2.4.2 yamt /*
363 1.2.4.2 yamt * Static device mappings. These peripheral registers are mapped at
364 1.2.4.2 yamt * fixed virtual addresses very early in initarm() so that we can use
365 1.2.4.2 yamt * them while booting the kernel, and stay at the same address
366 1.2.4.2 yamt * throughout whole kernel's life time.
367 1.2.4.2 yamt *
368 1.2.4.2 yamt * We use this table twice; once with bootstrap page table, and once
369 1.2.4.2 yamt * with kernel's page table which we build up in initarm().
370 1.2.4.2 yamt *
371 1.2.4.2 yamt * Since we map these registers into the bootstrap page table using
372 1.2.4.2 yamt * pmap_devmap_bootstrap() which calls pmap_map_chunk(), we map
373 1.2.4.2 yamt * registers segment-aligned and segment-rounded in order to avoid
374 1.2.4.2 yamt * using the 2nd page tables.
375 1.2.4.2 yamt */
376 1.2.4.2 yamt
377 1.2.4.2 yamt #define _A(a) ((a) & ~L1_S_OFFSET)
378 1.2.4.2 yamt #define _S(s) (((s) + L1_S_SIZE - 1) & ~(L1_S_SIZE-1))
379 1.2.4.2 yamt
380 1.2.4.2 yamt static const struct pmap_devmap gumstix_devmap[] = {
381 1.2.4.2 yamt {
382 1.2.4.2 yamt GUMSTIX_GPIO_VBASE,
383 1.2.4.2 yamt _A(PXA2X0_GPIO_BASE),
384 1.2.4.2 yamt _S(PXA250_GPIO_SIZE),
385 1.2.4.2 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
386 1.2.4.2 yamt },
387 1.2.4.2 yamt {
388 1.2.4.2 yamt GUMSTIX_CLKMAN_VBASE,
389 1.2.4.2 yamt _A(PXA2X0_CLKMAN_BASE),
390 1.2.4.2 yamt _S(PXA2X0_CLKMAN_SIZE),
391 1.2.4.2 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
392 1.2.4.2 yamt },
393 1.2.4.2 yamt {
394 1.2.4.2 yamt GUMSTIX_INTCTL_VBASE,
395 1.2.4.2 yamt _A(PXA2X0_INTCTL_BASE),
396 1.2.4.2 yamt _S(PXA2X0_INTCTL_SIZE),
397 1.2.4.2 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
398 1.2.4.2 yamt },
399 1.2.4.2 yamt {
400 1.2.4.2 yamt GUMSTIX_FFUART_VBASE,
401 1.2.4.2 yamt _A(PXA2X0_FFUART_BASE),
402 1.2.4.2 yamt _S(4 * COM_NPORTS),
403 1.2.4.2 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
404 1.2.4.2 yamt },
405 1.2.4.2 yamt {
406 1.2.4.3 yamt GUMSTIX_STUART_VBASE,
407 1.2.4.3 yamt _A(PXA2X0_STUART_BASE),
408 1.2.4.3 yamt _S(4 * COM_NPORTS),
409 1.2.4.3 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
410 1.2.4.3 yamt },
411 1.2.4.3 yamt {
412 1.2.4.2 yamt GUMSTIX_BTUART_VBASE,
413 1.2.4.2 yamt _A(PXA2X0_BTUART_BASE),
414 1.2.4.2 yamt _S(4 * COM_NPORTS),
415 1.2.4.2 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
416 1.2.4.2 yamt },
417 1.2.4.3 yamt {
418 1.2.4.3 yamt GUMSTIX_HWUART_VBASE,
419 1.2.4.3 yamt _A(PXA2X0_HWUART_BASE),
420 1.2.4.3 yamt _S(4 * COM_NPORTS),
421 1.2.4.3 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
422 1.2.4.3 yamt },
423 1.2.4.5 yamt {0, 0, 0, 0, 0}
424 1.2.4.2 yamt };
425 1.2.4.2 yamt
426 1.2.4.2 yamt #undef _A
427 1.2.4.2 yamt #undef _S
428 1.2.4.2 yamt
429 1.2.4.2 yamt
430 1.2.4.2 yamt /*
431 1.2.4.2 yamt * u_int initarm(...)
432 1.2.4.2 yamt *
433 1.2.4.2 yamt * Initial entry point on startup. This gets called before main() is
434 1.2.4.2 yamt * entered.
435 1.2.4.2 yamt * It should be responsible for setting up everything that must be
436 1.2.4.2 yamt * in place when main is called.
437 1.2.4.2 yamt * This includes
438 1.2.4.2 yamt * Taking a copy of the boot configuration structure.
439 1.2.4.2 yamt * Initialising the physical console so characters can be printed.
440 1.2.4.2 yamt * Setting up page tables for the kernel
441 1.2.4.2 yamt * Relocating the kernel to the bottom of physical memory
442 1.2.4.2 yamt */
443 1.2.4.2 yamt u_int
444 1.2.4.2 yamt initarm(void *arg)
445 1.2.4.2 yamt {
446 1.2.4.2 yamt extern vaddr_t xscale_cache_clean_addr;
447 1.2.4.2 yamt extern uint32_t *u_boot_args[];
448 1.2.4.2 yamt enum { r3 = 0, r4 = 1, r5 = 2, r6 = 3 }; /* args from u-boot */
449 1.2.4.2 yamt int loop;
450 1.2.4.2 yamt int loop1;
451 1.2.4.2 yamt u_int l1pagetable;
452 1.2.4.2 yamt pv_addr_t kernel_l1pt;
453 1.2.4.2 yamt paddr_t memstart;
454 1.2.4.2 yamt psize_t memsize;
455 1.2.4.2 yamt #ifdef DIAGNOSTIC
456 1.2.4.2 yamt extern vsize_t xscale_minidata_clean_size; /* used in KASSERT */
457 1.2.4.2 yamt #endif
458 1.2.4.2 yamt
459 1.2.4.2 yamt /* map some peripheral registers at static I/O area */
460 1.2.4.2 yamt pmap_devmap_bootstrap((vaddr_t)read_ttb(), gumstix_devmap);
461 1.2.4.2 yamt
462 1.2.4.2 yamt /* start 32.768kHz OSC */
463 1.2.4.2 yamt ioreg_write(GUMSTIX_CLKMAN_VBASE + CLKMAN_OSCC, OSCC_OON);
464 1.2.4.2 yamt
465 1.2.4.2 yamt /* Get ready for splfoo() */
466 1.2.4.2 yamt pxa2x0_intr_bootstrap(GUMSTIX_INTCTL_VBASE);
467 1.2.4.2 yamt
468 1.2.4.2 yamt /*
469 1.2.4.2 yamt * Heads up ... Setup the CPU / MMU / TLB functions
470 1.2.4.2 yamt */
471 1.2.4.2 yamt if (set_cpufuncs())
472 1.2.4.2 yamt panic("cpu not recognized!");
473 1.2.4.2 yamt
474 1.2.4.2 yamt /*
475 1.2.4.2 yamt * U-Boot doesn't use the virtual memory.
476 1.2.4.2 yamt *
477 1.2.4.2 yamt * Physical Address Range Description
478 1.2.4.2 yamt * ----------------------- ----------------------------------
479 1.2.4.2 yamt * 0x00000000 - 0x00ffffff flash Memory (16MB or 4MB)
480 1.2.4.2 yamt * 0x40000000 - 0x480fffff Processor Registers
481 1.2.4.2 yamt * 0xa0000000 - 0xa3ffffff SDRAM Bank 0 (64MB)
482 1.2.4.2 yamt */
483 1.2.4.2 yamt
484 1.2.4.2 yamt cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
485 1.2.4.2 yamt
486 1.2.4.3 yamt /* setup GPIO for {FF,ST,HW}UART. */
487 1.2.4.2 yamt pxa2x0_gpio_bootstrap(GUMSTIX_GPIO_VBASE);
488 1.2.4.3 yamt
489 1.2.4.3 yamt /* configure GPIOs. */
490 1.2.4.3 yamt gxio_config_pin();
491 1.2.4.2 yamt
492 1.2.4.2 yamt consinit();
493 1.2.4.2 yamt #ifdef KGDB
494 1.2.4.2 yamt kgdb_port_init();
495 1.2.4.2 yamt #endif
496 1.2.4.2 yamt
497 1.2.4.2 yamt /* Talk to the user */
498 1.2.4.2 yamt printf("\nNetBSD/evbarm (gumstix) booting ...\n");
499 1.2.4.2 yamt
500 1.2.4.2 yamt /* Read system serial */
501 1.2.4.2 yamt read_system_serial();
502 1.2.4.2 yamt
503 1.2.4.2 yamt /*
504 1.2.4.2 yamt * Examine the boot args string for options we need to know about
505 1.2.4.2 yamt * now.
506 1.2.4.2 yamt */
507 1.2.4.2 yamt process_kernel_args((int)u_boot_args[r6], (char **)u_boot_args[r5]);
508 1.2.4.2 yamt
509 1.2.4.5 yamt memstart = 0xa0000000UL;
510 1.2.4.5 yamt memsize = 0x04000000UL; /* 64MB */
511 1.2.4.2 yamt
512 1.2.4.5 yamt #ifdef VERBOSE_INIT_ARM
513 1.2.4.2 yamt printf("initarm: Configuring system ...\n");
514 1.2.4.5 yamt #endif
515 1.2.4.2 yamt
516 1.2.4.2 yamt /* Fake bootconfig structure for the benefit of pmap.c */
517 1.2.4.2 yamt /* XXX must make the memory description h/w independent */
518 1.2.4.2 yamt bootconfig.dramblocks = 1;
519 1.2.4.2 yamt bootconfig.dram[0].address = memstart;
520 1.2.4.2 yamt bootconfig.dram[0].pages = memsize / PAGE_SIZE;
521 1.2.4.2 yamt
522 1.2.4.2 yamt /*
523 1.2.4.2 yamt * Set up the variables that define the availablilty of
524 1.2.4.2 yamt * physical memory. For now, we're going to set
525 1.2.4.2 yamt * physical_freestart to 0xa0200000 (where the kernel
526 1.2.4.2 yamt * was loaded), and allocate the memory we need downwards.
527 1.2.4.2 yamt * If we get too close to the L1 table that we set up, we
528 1.2.4.2 yamt * will panic. We will update physical_freestart and
529 1.2.4.2 yamt * physical_freeend later to reflect what pmap_bootstrap()
530 1.2.4.2 yamt * wants to see.
531 1.2.4.2 yamt *
532 1.2.4.2 yamt * XXX pmap_bootstrap() needs an enema.
533 1.2.4.2 yamt */
534 1.2.4.2 yamt physical_start = bootconfig.dram[0].address;
535 1.2.4.5 yamt physical_end = physical_start + memsize;
536 1.2.4.2 yamt
537 1.2.4.2 yamt physical_freestart = 0xa0009000UL;
538 1.2.4.2 yamt physical_freeend = 0xa0200000UL;
539 1.2.4.2 yamt
540 1.2.4.2 yamt physmem = (physical_end - physical_start) / PAGE_SIZE;
541 1.2.4.2 yamt
542 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
543 1.2.4.2 yamt /* Tell the user about the memory */
544 1.2.4.2 yamt printf("physmemory: %d pages at 0x%08lx -> 0x%08lx\n", physmem,
545 1.2.4.2 yamt physical_start, physical_end - 1);
546 1.2.4.2 yamt #endif
547 1.2.4.2 yamt
548 1.2.4.2 yamt /*
549 1.2.4.2 yamt * Okay, the kernel starts 2MB in from the bottom of physical
550 1.2.4.2 yamt * memory. We are going to allocate our bootstrap pages downwards
551 1.2.4.2 yamt * from there.
552 1.2.4.2 yamt *
553 1.2.4.2 yamt * We need to allocate some fixed page tables to get the kernel
554 1.2.4.2 yamt * going. We allocate one page directory and a number of page
555 1.2.4.2 yamt * tables and store the physical addresses in the kernel_pt_table
556 1.2.4.2 yamt * array.
557 1.2.4.2 yamt *
558 1.2.4.2 yamt * The kernel page directory must be on a 16K boundary. The page
559 1.2.4.2 yamt * tables must be on 4K bounaries. What we do is allocate the
560 1.2.4.2 yamt * page directory on the first 16K boundary that we encounter, and
561 1.2.4.2 yamt * the page tables on 4K boundaries otherwise. Since we allocate
562 1.2.4.2 yamt * at least 3 L2 page tables, we are guaranteed to encounter at
563 1.2.4.2 yamt * least one 16K aligned region.
564 1.2.4.2 yamt */
565 1.2.4.2 yamt
566 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
567 1.2.4.2 yamt printf("Allocating page tables\n");
568 1.2.4.2 yamt #endif
569 1.2.4.2 yamt
570 1.2.4.2 yamt free_pages = (physical_freeend - physical_freestart) / PAGE_SIZE;
571 1.2.4.2 yamt
572 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
573 1.2.4.2 yamt printf("freestart = 0x%08lx, free_pages = %d (0x%08x)\n",
574 1.2.4.2 yamt physical_freestart, free_pages, free_pages);
575 1.2.4.2 yamt #endif
576 1.2.4.2 yamt
577 1.2.4.2 yamt /* Define a macro to simplify memory allocation */
578 1.2.4.2 yamt #define valloc_pages(var, np) \
579 1.2.4.2 yamt alloc_pages((var).pv_pa, (np)); \
580 1.2.4.2 yamt (var).pv_va = KERNEL_BASE + (var).pv_pa - physical_start;
581 1.2.4.2 yamt
582 1.2.4.2 yamt #define alloc_pages(var, np) \
583 1.2.4.2 yamt physical_freeend -= ((np) * PAGE_SIZE); \
584 1.2.4.2 yamt if (physical_freeend < physical_freestart) \
585 1.2.4.2 yamt panic("initarm: out of memory"); \
586 1.2.4.2 yamt (var) = physical_freeend; \
587 1.2.4.2 yamt free_pages -= (np); \
588 1.2.4.2 yamt memset((char *)(var), 0, ((np) * PAGE_SIZE));
589 1.2.4.2 yamt
590 1.2.4.2 yamt loop1 = 0;
591 1.2.4.2 yamt kernel_l1pt.pv_pa = 0;
592 1.2.4.2 yamt kernel_l1pt.pv_va = 0;
593 1.2.4.2 yamt for (loop = 0; loop <= NUM_KERNEL_PTS; ++loop) {
594 1.2.4.2 yamt /* Are we 16KB aligned for an L1 ? */
595 1.2.4.5 yamt if ((physical_freeend & (L1_TABLE_SIZE - 1)) == 0 &&
596 1.2.4.5 yamt kernel_l1pt.pv_pa == 0) {
597 1.2.4.2 yamt valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE);
598 1.2.4.2 yamt } else {
599 1.2.4.2 yamt valloc_pages(kernel_pt_table[loop1],
600 1.2.4.2 yamt L2_TABLE_SIZE / PAGE_SIZE);
601 1.2.4.2 yamt ++loop1;
602 1.2.4.2 yamt }
603 1.2.4.2 yamt }
604 1.2.4.2 yamt
605 1.2.4.2 yamt /* This should never be able to happen but better confirm that. */
606 1.2.4.2 yamt if (!kernel_l1pt.pv_pa || (kernel_l1pt.pv_pa & (L1_TABLE_SIZE-1)) != 0)
607 1.2.4.2 yamt panic("initarm: Failed to align the kernel page directory");
608 1.2.4.2 yamt
609 1.2.4.2 yamt /*
610 1.2.4.2 yamt * Allocate a page for the system page mapped to V0x00000000
611 1.2.4.2 yamt * This page will just contain the system vectors and can be
612 1.2.4.2 yamt * shared by all processes.
613 1.2.4.2 yamt */
614 1.2.4.2 yamt alloc_pages(systempage.pv_pa, 1);
615 1.2.4.2 yamt
616 1.2.4.2 yamt /* Allocate stacks for all modes */
617 1.2.4.2 yamt valloc_pages(irqstack, IRQ_STACK_SIZE);
618 1.2.4.2 yamt valloc_pages(abtstack, ABT_STACK_SIZE);
619 1.2.4.2 yamt valloc_pages(undstack, UND_STACK_SIZE);
620 1.2.4.2 yamt valloc_pages(kernelstack, UPAGES);
621 1.2.4.2 yamt
622 1.2.4.2 yamt /* Allocate enough pages for cleaning the Mini-Data cache. */
623 1.2.4.2 yamt KASSERT(xscale_minidata_clean_size <= PAGE_SIZE);
624 1.2.4.2 yamt valloc_pages(minidataclean, 1);
625 1.2.4.2 yamt
626 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
627 1.2.4.2 yamt printf("IRQ stack: p0x%08lx v0x%08lx\n", irqstack.pv_pa,
628 1.2.4.2 yamt irqstack.pv_va);
629 1.2.4.2 yamt printf("ABT stack: p0x%08lx v0x%08lx\n", abtstack.pv_pa,
630 1.2.4.2 yamt abtstack.pv_va);
631 1.2.4.2 yamt printf("UND stack: p0x%08lx v0x%08lx\n", undstack.pv_pa,
632 1.2.4.2 yamt undstack.pv_va);
633 1.2.4.2 yamt printf("SVC stack: p0x%08lx v0x%08lx\n", kernelstack.pv_pa,
634 1.2.4.2 yamt kernelstack.pv_va);
635 1.2.4.2 yamt #endif
636 1.2.4.2 yamt
637 1.2.4.2 yamt /*
638 1.2.4.2 yamt * XXX Defer this to later so that we can reclaim the memory
639 1.2.4.2 yamt * XXX used by the RedBoot page tables.
640 1.2.4.2 yamt */
641 1.2.4.2 yamt alloc_pages(msgbufphys, round_page(MSGBUFSIZE) / PAGE_SIZE);
642 1.2.4.2 yamt
643 1.2.4.2 yamt /*
644 1.2.4.2 yamt * Ok we have allocated physical pages for the primary kernel
645 1.2.4.2 yamt * page tables
646 1.2.4.2 yamt */
647 1.2.4.2 yamt
648 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
649 1.2.4.2 yamt printf("Creating L1 page table at 0x%08lx\n", kernel_l1pt.pv_pa);
650 1.2.4.2 yamt #endif
651 1.2.4.2 yamt
652 1.2.4.2 yamt /*
653 1.2.4.2 yamt * Now we start construction of the L1 page table
654 1.2.4.2 yamt * We start by mapping the L2 page tables into the L1.
655 1.2.4.2 yamt * This means that we can replace L1 mappings later on if necessary
656 1.2.4.2 yamt */
657 1.2.4.2 yamt l1pagetable = kernel_l1pt.pv_va;
658 1.2.4.2 yamt
659 1.2.4.2 yamt /* Map the L2 pages tables in the L1 page table */
660 1.2.4.2 yamt pmap_link_l2pt(l1pagetable, 0x00000000,
661 1.2.4.2 yamt &kernel_pt_table[KERNEL_PT_SYS]);
662 1.2.4.2 yamt for (loop = 0; loop < KERNEL_PT_KERNEL_NUM; loop++)
663 1.2.4.2 yamt pmap_link_l2pt(l1pagetable, KERNEL_BASE + loop * 0x00400000,
664 1.2.4.2 yamt &kernel_pt_table[KERNEL_PT_KERNEL + loop]);
665 1.2.4.2 yamt for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; loop++)
666 1.2.4.2 yamt pmap_link_l2pt(l1pagetable, KERNEL_VM_BASE + loop * 0x00400000,
667 1.2.4.2 yamt &kernel_pt_table[KERNEL_PT_VMDATA + loop]);
668 1.2.4.2 yamt
669 1.2.4.2 yamt /* update the top of the kernel VM */
670 1.2.4.2 yamt pmap_curmaxkvaddr =
671 1.2.4.2 yamt KERNEL_VM_BASE + (KERNEL_PT_VMDATA_NUM * 0x00400000);
672 1.2.4.2 yamt
673 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
674 1.2.4.2 yamt printf("Mapping kernel\n");
675 1.2.4.2 yamt #endif
676 1.2.4.2 yamt
677 1.2.4.2 yamt /* Now we fill in the L2 pagetable for the kernel static code/data */
678 1.2.4.2 yamt {
679 1.2.4.2 yamt extern char etext[], _end[];
680 1.2.4.2 yamt size_t textsize = (uintptr_t) etext - KERNEL_TEXT_BASE;
681 1.2.4.2 yamt size_t totalsize = (uintptr_t) _end - KERNEL_TEXT_BASE;
682 1.2.4.2 yamt u_int logical;
683 1.2.4.2 yamt
684 1.2.4.2 yamt textsize = (textsize + PGOFSET) & ~PGOFSET;
685 1.2.4.2 yamt totalsize = (totalsize + PGOFSET) & ~PGOFSET;
686 1.2.4.2 yamt
687 1.2.4.2 yamt logical = 0x00200000; /* offset of kernel in RAM */
688 1.2.4.2 yamt
689 1.2.4.2 yamt logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
690 1.2.4.2 yamt physical_start + logical, textsize,
691 1.2.4.2 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
692 1.2.4.2 yamt logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
693 1.2.4.2 yamt physical_start + logical, totalsize - textsize,
694 1.2.4.2 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
695 1.2.4.2 yamt }
696 1.2.4.2 yamt
697 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
698 1.2.4.2 yamt printf("Constructing L2 page tables\n");
699 1.2.4.2 yamt #endif
700 1.2.4.2 yamt
701 1.2.4.2 yamt /* Map the stack pages */
702 1.2.4.2 yamt pmap_map_chunk(l1pagetable, irqstack.pv_va, irqstack.pv_pa,
703 1.2.4.2 yamt IRQ_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
704 1.2.4.2 yamt pmap_map_chunk(l1pagetable, abtstack.pv_va, abtstack.pv_pa,
705 1.2.4.2 yamt ABT_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
706 1.2.4.2 yamt pmap_map_chunk(l1pagetable, undstack.pv_va, undstack.pv_pa,
707 1.2.4.2 yamt UND_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
708 1.2.4.2 yamt pmap_map_chunk(l1pagetable, kernelstack.pv_va, kernelstack.pv_pa,
709 1.2.4.2 yamt UPAGES * PAGE_SIZE, VM_PROT_READ | VM_PROT_WRITE, PTE_CACHE);
710 1.2.4.2 yamt
711 1.2.4.2 yamt pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
712 1.2.4.2 yamt L1_TABLE_SIZE, VM_PROT_READ | VM_PROT_WRITE, PTE_PAGETABLE);
713 1.2.4.2 yamt
714 1.2.4.2 yamt for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) {
715 1.2.4.2 yamt pmap_map_chunk(l1pagetable, kernel_pt_table[loop].pv_va,
716 1.2.4.2 yamt kernel_pt_table[loop].pv_pa, L2_TABLE_SIZE,
717 1.2.4.2 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
718 1.2.4.2 yamt }
719 1.2.4.2 yamt
720 1.2.4.2 yamt /* Map the Mini-Data cache clean area. */
721 1.2.4.2 yamt xscale_setup_minidata(l1pagetable, minidataclean.pv_va,
722 1.2.4.2 yamt minidataclean.pv_pa);
723 1.2.4.2 yamt
724 1.2.4.2 yamt /* Map the vector page. */
725 1.2.4.2 yamt #if 1
726 1.2.4.2 yamt /* MULTI-ICE requires that page 0 is NC/NB so that it can download the
727 1.2.4.2 yamt * cache-clean code there. */
728 1.2.4.2 yamt pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
729 1.2.4.2 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
730 1.2.4.2 yamt #else
731 1.2.4.2 yamt pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
732 1.2.4.2 yamt VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
733 1.2.4.2 yamt #endif
734 1.2.4.2 yamt
735 1.2.4.2 yamt /*
736 1.2.4.2 yamt * map integrated peripherals at same address in l1pagetable
737 1.2.4.2 yamt * so that we can continue to use console.
738 1.2.4.2 yamt */
739 1.2.4.2 yamt pmap_devmap_bootstrap(l1pagetable, gumstix_devmap);
740 1.2.4.2 yamt
741 1.2.4.2 yamt /*
742 1.2.4.2 yamt * Give the XScale global cache clean code an appropriately
743 1.2.4.2 yamt * sized chunk of unmapped VA space starting at 0xff000000
744 1.2.4.2 yamt * (our device mappings end before this address).
745 1.2.4.2 yamt */
746 1.2.4.2 yamt xscale_cache_clean_addr = 0xff000000U;
747 1.2.4.2 yamt
748 1.2.4.2 yamt /*
749 1.2.4.2 yamt * Now we have the real page tables in place so we can switch to them.
750 1.2.4.2 yamt * Once this is done we will be running with the REAL kernel page
751 1.2.4.2 yamt * tables.
752 1.2.4.2 yamt */
753 1.2.4.2 yamt
754 1.2.4.2 yamt /*
755 1.2.4.2 yamt * Update the physical_freestart/physical_freeend/free_pages
756 1.2.4.2 yamt * variables.
757 1.2.4.2 yamt */
758 1.2.4.2 yamt {
759 1.2.4.2 yamt extern char _end[];
760 1.2.4.2 yamt
761 1.2.4.2 yamt physical_freestart = physical_start +
762 1.2.4.2 yamt (((((uintptr_t) _end) + PGOFSET) & ~PGOFSET) -
763 1.2.4.2 yamt KERNEL_BASE);
764 1.2.4.2 yamt physical_freeend = physical_end;
765 1.2.4.2 yamt free_pages =
766 1.2.4.2 yamt (physical_freeend - physical_freestart) / PAGE_SIZE;
767 1.2.4.2 yamt }
768 1.2.4.2 yamt
769 1.2.4.2 yamt /* Switch tables */
770 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
771 1.2.4.2 yamt printf("freestart = 0x%08lx, free_pages = %d (0x%x)\n",
772 1.2.4.2 yamt physical_freestart, free_pages, free_pages);
773 1.2.4.2 yamt printf("switching to new L1 page table @%#lx...", kernel_l1pt.pv_pa);
774 1.2.4.2 yamt #endif
775 1.2.4.2 yamt
776 1.2.4.2 yamt setttb(kernel_l1pt.pv_pa);
777 1.2.4.2 yamt cpu_tlb_flushID();
778 1.2.4.2 yamt cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2));
779 1.2.4.2 yamt
780 1.2.4.2 yamt /*
781 1.2.4.2 yamt * Moved from cpu_startup() as data_abort_handler() references
782 1.2.4.2 yamt * this during uvm init
783 1.2.4.2 yamt */
784 1.2.4.2 yamt proc0paddr = (struct user *)kernelstack.pv_va;
785 1.2.4.2 yamt lwp0.l_addr = proc0paddr;
786 1.2.4.2 yamt
787 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
788 1.2.4.2 yamt printf("bootstrap done.\n");
789 1.2.4.2 yamt #endif
790 1.2.4.2 yamt
791 1.2.4.2 yamt arm32_vector_init(ARM_VECTORS_LOW, ARM_VEC_ALL);
792 1.2.4.2 yamt
793 1.2.4.2 yamt /*
794 1.2.4.2 yamt * Pages were allocated during the secondary bootstrap for the
795 1.2.4.2 yamt * stacks for different CPU modes.
796 1.2.4.2 yamt * We must now set the r13 registers in the different CPU modes to
797 1.2.4.2 yamt * point to these stacks.
798 1.2.4.2 yamt * Since the ARM stacks use STMFD etc. we must set r13 to the top end
799 1.2.4.2 yamt * of the stack memory.
800 1.2.4.2 yamt */
801 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
802 1.2.4.2 yamt printf("init subsystems: stacks ");
803 1.2.4.2 yamt #endif
804 1.2.4.2 yamt
805 1.2.4.2 yamt set_stackptr(PSR_IRQ32_MODE,
806 1.2.4.2 yamt irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE);
807 1.2.4.2 yamt set_stackptr(PSR_ABT32_MODE,
808 1.2.4.2 yamt abtstack.pv_va + ABT_STACK_SIZE * PAGE_SIZE);
809 1.2.4.2 yamt set_stackptr(PSR_UND32_MODE,
810 1.2.4.2 yamt undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE);
811 1.2.4.2 yamt
812 1.2.4.2 yamt /*
813 1.2.4.2 yamt * Well we should set a data abort handler.
814 1.2.4.2 yamt * Once things get going this will change as we will need a proper
815 1.2.4.2 yamt * handler.
816 1.2.4.2 yamt * Until then we will use a handler that just panics but tells us
817 1.2.4.2 yamt * why.
818 1.2.4.2 yamt * Initialisation of the vectors will just panic on a data abort.
819 1.2.4.2 yamt * This just fills in a slighly better one.
820 1.2.4.2 yamt */
821 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
822 1.2.4.2 yamt printf("vectors ");
823 1.2.4.2 yamt #endif
824 1.2.4.2 yamt data_abort_handler_address = (u_int)data_abort_handler;
825 1.2.4.2 yamt prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
826 1.2.4.2 yamt undefined_handler_address = (u_int)undefinedinstruction_bounce;
827 1.2.4.2 yamt
828 1.2.4.2 yamt /* Initialise the undefined instruction handlers */
829 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
830 1.2.4.2 yamt printf("undefined ");
831 1.2.4.2 yamt #endif
832 1.2.4.2 yamt undefined_init();
833 1.2.4.2 yamt
834 1.2.4.2 yamt /* Load memory into UVM. */
835 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
836 1.2.4.2 yamt printf("page ");
837 1.2.4.2 yamt #endif
838 1.2.4.2 yamt uvm_setpagesize(); /* initialize PAGE_SIZE-dependent variables */
839 1.2.4.2 yamt uvm_page_physload(atop(physical_freestart), atop(physical_freeend),
840 1.2.4.2 yamt atop(physical_freestart), atop(physical_freeend),
841 1.2.4.2 yamt VM_FREELIST_DEFAULT);
842 1.2.4.2 yamt
843 1.2.4.2 yamt /* Boot strap pmap telling it where the kernel page table is */
844 1.2.4.2 yamt #ifdef VERBOSE_INIT_ARM
845 1.2.4.2 yamt printf("pmap ");
846 1.2.4.2 yamt #endif
847 1.2.4.2 yamt pmap_bootstrap((pd_entry_t *)kernel_l1pt.pv_va, KERNEL_VM_BASE,
848 1.2.4.2 yamt KERNEL_VM_BASE + KERNEL_VM_SIZE);
849 1.2.4.2 yamt
850 1.2.4.2 yamt #ifdef __HAVE_MEMORY_DISK__
851 1.2.4.2 yamt md_root_setconf(memory_disk, sizeof memory_disk);
852 1.2.4.2 yamt #endif
853 1.2.4.2 yamt
854 1.2.4.2 yamt #ifdef BOOTHOWTO
855 1.2.4.2 yamt boothowto |= BOOTHOWTO;
856 1.2.4.2 yamt #endif
857 1.2.4.2 yamt
858 1.2.4.2 yamt #ifdef KGDB
859 1.2.4.2 yamt if (boothowto & RB_KDB) {
860 1.2.4.2 yamt kgdb_debug_init = 1;
861 1.2.4.2 yamt kgdb_connect(1);
862 1.2.4.2 yamt }
863 1.2.4.2 yamt #endif
864 1.2.4.2 yamt
865 1.2.4.5 yamt #if NKSYMS || defined(DDB) || defined(LKM)
866 1.2.4.2 yamt /* Firmware doesn't load symbols. */
867 1.2.4.2 yamt ddb_init(0, NULL, NULL);
868 1.2.4.5 yamt #endif
869 1.2.4.2 yamt
870 1.2.4.5 yamt #ifdef DDB
871 1.2.4.5 yamt db_machine_init();
872 1.2.4.2 yamt if (boothowto & RB_KDB)
873 1.2.4.2 yamt Debugger();
874 1.2.4.2 yamt #endif
875 1.2.4.2 yamt
876 1.2.4.2 yamt /* We return the new stack pointer address */
877 1.2.4.2 yamt return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);
878 1.2.4.2 yamt }
879 1.2.4.2 yamt
880 1.2.4.3 yamt static void
881 1.2.4.2 yamt read_system_serial()
882 1.2.4.2 yamt {
883 1.2.4.2 yamt #define GUMSTIX_SYSTEM_SERIAL_ADDR 0
884 1.2.4.2 yamt #define GUMSTIX_SYSTEM_SERIAL_SIZE 8
885 1.2.4.2 yamt #define FLASH_OFFSET_INTEL_PROTECTION 0x81
886 1.2.4.2 yamt #define FLASH_OFFSET_USER_PROTECTION 0x85
887 1.2.4.2 yamt #define FLASH_CMD_READ_ID 0x90
888 1.2.4.2 yamt #define FLASH_CMD_RESET 0xff
889 1.2.4.2 yamt int i;
890 1.2.4.2 yamt char system_serial[GUMSTIX_SYSTEM_SERIAL_SIZE], *src;
891 1.2.4.2 yamt char x;
892 1.2.4.2 yamt
893 1.2.4.2 yamt src = (char *)(FLASH_OFFSET_USER_PROTECTION * 2 /*word*/);
894 1.2.4.2 yamt *(volatile uint16_t *)0 = FLASH_CMD_READ_ID;
895 1.2.4.2 yamt memcpy(system_serial,
896 1.2.4.2 yamt src + GUMSTIX_SYSTEM_SERIAL_ADDR, sizeof (system_serial));
897 1.2.4.2 yamt *(volatile uint16_t *)0 = FLASH_CMD_RESET;
898 1.2.4.2 yamt
899 1.2.4.2 yamt for (i = 1, x = system_serial[0]; i < sizeof (system_serial); i++)
900 1.2.4.2 yamt x &= system_serial[i];
901 1.2.4.2 yamt if (x == 0xff) {
902 1.2.4.2 yamt src = (char *)(FLASH_OFFSET_INTEL_PROTECTION * 2 /*word*/);
903 1.2.4.2 yamt *(volatile uint16_t *)0 = FLASH_CMD_READ_ID;
904 1.2.4.2 yamt memcpy(system_serial,
905 1.2.4.2 yamt src + GUMSTIX_SYSTEM_SERIAL_ADDR, sizeof (system_serial));
906 1.2.4.2 yamt *(volatile uint16_t *)0 = FLASH_CMD_RESET;
907 1.2.4.2 yamt
908 1.2.4.2 yamt /*
909 1.2.4.2 yamt * XXXX: Don't need ???
910 1.2.4.2 yamt * gumstix_serial_hash(system_serial);
911 1.2.4.2 yamt */
912 1.2.4.2 yamt }
913 1.2.4.2 yamt system_serial_high = system_serial[0] << 24 | system_serial[1] << 16 |
914 1.2.4.2 yamt system_serial[2] << 8 | system_serial[3];
915 1.2.4.2 yamt system_serial_low = system_serial[4] << 24 | system_serial[5] << 16 |
916 1.2.4.2 yamt system_serial[6] << 8 | system_serial[7];
917 1.2.4.2 yamt
918 1.2.4.2 yamt printf("system serial: 0x");
919 1.2.4.2 yamt for (i = 0; i < sizeof (system_serial); i++)
920 1.2.4.2 yamt printf("%02x", system_serial[i]);
921 1.2.4.2 yamt printf("\n");
922 1.2.4.2 yamt }
923 1.2.4.2 yamt
924 1.2.4.3 yamt static void
925 1.2.4.2 yamt process_kernel_args(int argc, char *argv[])
926 1.2.4.2 yamt {
927 1.2.4.2 yamt static const char busheader_name[] = "busheader=";
928 1.2.4.4 yamt int gxio_configured = 0, i, j;
929 1.2.4.2 yamt
930 1.2.4.2 yamt boothowto = 0;
931 1.2.4.2 yamt
932 1.2.4.2 yamt /*
933 1.2.4.2 yamt * XXXXX: The value of argc is wrong. The number of arguments is
934 1.2.4.2 yamt * corrected in the do_go() of u-boot. However, it is not actually
935 1.2.4.2 yamt * corrected.
936 1.2.4.2 yamt */
937 1.2.4.2 yamt argc --;
938 1.2.4.2 yamt
939 1.2.4.2 yamt for (i = 1, j = 0; i < argc; i++) {
940 1.2.4.2 yamt if (!strncmp(argv[i], busheader_name, strlen(busheader_name))) {
941 1.2.4.4 yamt /* configure for GPIOs of busheader side */
942 1.2.4.4 yamt gxio_config_expansion(argv[i] + strlen(busheader_name));
943 1.2.4.4 yamt gxio_configured = 1;
944 1.2.4.2 yamt continue;
945 1.2.4.2 yamt }
946 1.2.4.2 yamt if (j == MAX_BOOT_STRING) {
947 1.2.4.2 yamt *(bootargs + j) = '\0';
948 1.2.4.2 yamt continue;
949 1.2.4.2 yamt }
950 1.2.4.2 yamt if (j != 0)
951 1.2.4.2 yamt *(bootargs + j++) = ' ';
952 1.2.4.2 yamt strncpy(bootargs + j, argv[i], MAX_BOOT_STRING - j);
953 1.2.4.2 yamt j += strlen(argv[i]);
954 1.2.4.2 yamt }
955 1.2.4.2 yamt boot_args = bootargs;
956 1.2.4.2 yamt
957 1.2.4.2 yamt parse_mi_bootargs(boot_args);
958 1.2.4.4 yamt
959 1.2.4.4 yamt if (!gxio_configured)
960 1.2.4.4 yamt gxio_config_expansion(NULL);
961 1.2.4.2 yamt }
962 1.2.4.2 yamt
963 1.2.4.2 yamt #ifdef KGDB
964 1.2.4.2 yamt #ifndef KGDB_DEVNAME
965 1.2.4.5 yamt #define KGDB_DEVNAME "ffuart"
966 1.2.4.2 yamt #endif
967 1.2.4.2 yamt const char kgdb_devname[] = KGDB_DEVNAME;
968 1.2.4.2 yamt
969 1.2.4.5 yamt #ifndef KGDB_DEVRATE
970 1.2.4.5 yamt #define KGDB_DEVRATE CONSPEED
971 1.2.4.5 yamt #endif
972 1.2.4.5 yamt int kgdb_devrate = KGDB_DEVRATE;
973 1.2.4.5 yamt
974 1.2.4.2 yamt #if (NCOM > 0)
975 1.2.4.2 yamt #ifndef KGDB_DEVMODE
976 1.2.4.5 yamt #define KGDB_DEVMODE CONMODE
977 1.2.4.2 yamt #endif
978 1.2.4.2 yamt int comkgdbmode = KGDB_DEVMODE;
979 1.2.4.2 yamt #endif /* NCOM */
980 1.2.4.2 yamt
981 1.2.4.2 yamt #endif /* KGDB */
982 1.2.4.2 yamt
983 1.2.4.2 yamt
984 1.2.4.2 yamt void
985 1.2.4.2 yamt consinit(void)
986 1.2.4.2 yamt {
987 1.2.4.2 yamt static int consinit_called = 0;
988 1.2.4.2 yamt uint32_t ckenreg = ioreg_read(GUMSTIX_CLKMAN_VBASE + CLKMAN_CKEN);
989 1.2.4.2 yamt
990 1.2.4.2 yamt if (consinit_called != 0)
991 1.2.4.2 yamt return;
992 1.2.4.2 yamt
993 1.2.4.2 yamt consinit_called = 1;
994 1.2.4.2 yamt
995 1.2.4.2 yamt #if NCOM > 0
996 1.2.4.2 yamt
997 1.2.4.2 yamt #ifdef FFUARTCONSOLE
998 1.2.4.2 yamt #ifdef KGDB
999 1.2.4.2 yamt if (0 == strcmp(kgdb_devname, "ffuart")){
1000 1.2.4.2 yamt /* port is reserved for kgdb */
1001 1.2.4.2 yamt } else
1002 1.2.4.2 yamt #endif
1003 1.2.4.3 yamt {
1004 1.2.4.3 yamt if (0 == comcnattach(&pxa2x0_a4x_bs_tag, PXA2X0_FFUART_BASE,
1005 1.2.4.3 yamt comcnspeed, PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comcnmode)) {
1006 1.2.4.3 yamt ioreg_write(GUMSTIX_CLKMAN_VBASE + CLKMAN_CKEN,
1007 1.2.4.3 yamt ckenreg|CKEN_FFUART);
1008 1.2.4.2 yamt
1009 1.2.4.3 yamt return;
1010 1.2.4.3 yamt }
1011 1.2.4.2 yamt }
1012 1.2.4.2 yamt #endif /* FFUARTCONSOLE */
1013 1.2.4.2 yamt
1014 1.2.4.3 yamt #ifdef STUARTCONSOLE
1015 1.2.4.3 yamt #ifdef KGDB
1016 1.2.4.3 yamt if (0 == strcmp(kgdb_devname, "stuart")) {
1017 1.2.4.3 yamt /* port is reserved for kgdb */
1018 1.2.4.3 yamt } else
1019 1.2.4.3 yamt #endif
1020 1.2.4.3 yamt {
1021 1.2.4.3 yamt if (0 == comcnattach(&pxa2x0_a4x_bs_tag, PXA2X0_STUART_BASE,
1022 1.2.4.3 yamt comcnspeed, PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comcnmode)) {
1023 1.2.4.3 yamt ioreg_write(GUMSTIX_CLKMAN_VBASE + CLKMAN_CKEN,
1024 1.2.4.3 yamt ckenreg|CKEN_STUART);
1025 1.2.4.3 yamt return;
1026 1.2.4.3 yamt }
1027 1.2.4.3 yamt }
1028 1.2.4.3 yamt #endif /* STUARTCONSOLE */
1029 1.2.4.3 yamt
1030 1.2.4.2 yamt #ifdef BTUARTCONSOLE
1031 1.2.4.2 yamt #ifdef KGDB
1032 1.2.4.2 yamt if (0 == strcmp(kgdb_devname, "btuart")) {
1033 1.2.4.2 yamt /* port is reserved for kgdb */
1034 1.2.4.2 yamt } else
1035 1.2.4.2 yamt #endif
1036 1.2.4.3 yamt {
1037 1.2.4.3 yamt if (0 == comcnattach(&pxa2x0_a4x_bs_tag, PXA2X0_BTUART_BASE,
1038 1.2.4.3 yamt comcnspeed, PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comcnmode)) {
1039 1.2.4.3 yamt ioreg_write(GUMSTIX_CLKMAN_VBASE + CLKMAN_CKEN,
1040 1.2.4.3 yamt ckenreg|CKEN_BTUART);
1041 1.2.4.3 yamt return;
1042 1.2.4.3 yamt }
1043 1.2.4.2 yamt }
1044 1.2.4.2 yamt #endif /* BTUARTCONSOLE */
1045 1.2.4.2 yamt
1046 1.2.4.3 yamt #ifdef HWUARTCONSOLE
1047 1.2.4.3 yamt #ifdef KGDB
1048 1.2.4.3 yamt if (0 == strcmp(kgdb_devname, "hwuart")) {
1049 1.2.4.3 yamt /* port is reserved for kgdb */
1050 1.2.4.3 yamt } else
1051 1.2.4.3 yamt #endif
1052 1.2.4.3 yamt {
1053 1.2.4.3 yamt if (0 == comcnattach(&pxa2x0_a4x_bs_tag, PXA2X0_HWUART_BASE,
1054 1.2.4.3 yamt comcnspeed, PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comcnmode)) {
1055 1.2.4.3 yamt ioreg_write(GUMSTIX_CLKMAN_VBASE + CLKMAN_CKEN,
1056 1.2.4.3 yamt ckenreg|CKEN_HWUART);
1057 1.2.4.3 yamt return;
1058 1.2.4.3 yamt }
1059 1.2.4.3 yamt }
1060 1.2.4.3 yamt #endif /* HWUARTCONSOLE */
1061 1.2.4.2 yamt
1062 1.2.4.2 yamt #endif /* NCOM */
1063 1.2.4.2 yamt
1064 1.2.4.2 yamt }
1065 1.2.4.2 yamt
1066 1.2.4.2 yamt #ifdef KGDB
1067 1.2.4.3 yamt static void
1068 1.2.4.2 yamt kgdb_port_init(void)
1069 1.2.4.2 yamt {
1070 1.2.4.2 yamt #if (NCOM > 0) && defined(COM_PXA2X0)
1071 1.2.4.2 yamt paddr_t paddr = 0;
1072 1.2.4.2 yamt uint32_t ckenreg = ioreg_read(GUMSTIX_CLKMAN_VBASE + CLKMAN_CKEN);
1073 1.2.4.2 yamt
1074 1.2.4.2 yamt if (0 == strcmp(kgdb_devname, "ffuart")) {
1075 1.2.4.2 yamt paddr = PXA2X0_FFUART_BASE;
1076 1.2.4.2 yamt ckenreg |= CKEN_FFUART;
1077 1.2.4.3 yamt } else if (0 == strcmp(kgdb_devname, "stuart")) {
1078 1.2.4.3 yamt paddr = PXA2X0_STUART_BASE;
1079 1.2.4.3 yamt ckenreg |= CKEN_STUART;
1080 1.2.4.3 yamt } else if (0 == strcmp(kgdb_devname, "btuart")) {
1081 1.2.4.2 yamt paddr = PXA2X0_BTUART_BASE;
1082 1.2.4.2 yamt ckenreg |= CKEN_BTUART;
1083 1.2.4.3 yamt } else if (0 == strcmp(kgdb_devname, "hwuart")) {
1084 1.2.4.3 yamt paddr = PXA2X0_HWUART_BASE;
1085 1.2.4.3 yamt ckenreg |= CKEN_HWUART;
1086 1.2.4.2 yamt }
1087 1.2.4.2 yamt
1088 1.2.4.2 yamt if (paddr &&
1089 1.2.4.2 yamt 0 == com_kgdb_attach(&pxa2x0_a4x_bs_tag, paddr,
1090 1.2.4.5 yamt kgdb_devrate, PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comkgdbmode)) {
1091 1.2.4.2 yamt
1092 1.2.4.2 yamt ioreg_write(GUMSTIX_CLKMAN_VBASE + CLKMAN_CKEN, ckenreg);
1093 1.2.4.2 yamt
1094 1.2.4.2 yamt }
1095 1.2.4.2 yamt
1096 1.2.4.2 yamt #endif
1097 1.2.4.2 yamt }
1098 1.2.4.2 yamt #endif
1099