4 * Ichiro FUKUHARA <ichiro@ichiro.org>.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Copyright (c) 1997,1998 Mark Brinicombe.
30 * Copyright (c) 1997,1998 Causality Limited.
31 * All rights reserved.
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by Mark Brinicombe
44 * for the NetBSD Project.
45 * 4. The name of the company nor the name of the author may be used to
46 * endorse or promote products derived from this software without specific
47 * prior written permission.
49 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
50 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
51 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
52 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
53 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
54 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
55 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 /* Machine dependant functions for kernel setup for Intel IXP425 evaluation
63 * boards using RedBoot firmware.
66 #include <sys/cdefs.h>
67 __KERNEL_RCSID(0, "$NetBSD$");
71 #include "opt_pmap_debug.h"
73 #include <sys/param.h>
74 #include <sys/device.h>
75 #include <sys/systm.h>
76 #include <sys/kernel.h>
79 #include <sys/msgbuf.h>
80 #include <sys/reboot.h>
81 #include <sys/termios.h>
82 #include <sys/ksyms.h>
84 #include <uvm/uvm_extern.h>
88 #include <machine/db_machdep.h>
89 #include <ddb/db_sym.h>
90 #include <ddb/db_extern.h>
92 #include <machine/bootconfig.h>
93 #include <machine/bus.h>
94 #include <machine/cpu.h>
95 #include <machine/frame.h>
96 #include <arm/undefined.h>
98 #include <arm/arm32/machdep.h>
100 #include <arm/xscale/ixp425reg.h>
101 #include <arm/xscale/ixp425var.h>
102 #include <arm/xscale/ixp425_sipvar.h>
104 #include <evbarm/ixdp425/ixdp425reg.h>
108 #include <dev/ic/comreg.h>
109 #include <dev/ic/comvar.h>
114 /* Kernel text starts 2MB in from the bottom of the kernel address space. */
115 #define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00200000)
116 #define KERNEL_VM_BASE (KERNEL_BASE + 0x01000000)
119 * The range 0xc1000000 - 0xccffffff is available for kernel VM space
120 * Core-logic registers and I/O mappings occupy 0xfd000000 - 0xffffffff
122 #define KERNEL_VM_SIZE 0x0C000000
126 * Address to call from cpu_reset() to reset the machine.
127 * This is machine architecture dependant as it varies depending
128 * on where the ROM appears when you turn the MMU off.
131 u_int cpu_reset_address
= 0x00000000;
133 /* Define various stack sizes in pages */
134 #define IRQ_STACK_SIZE 1
135 #define ABT_STACK_SIZE 1
136 #define UND_STACK_SIZE 1
138 BootConfig bootconfig
; /* Boot config storage */
139 char *boot_args
= NULL
;
140 char *boot_file
= NULL
;
142 vm_offset_t physical_start
;
143 vm_offset_t physical_freestart
;
144 vm_offset_t physical_freeend
;
145 vm_offset_t physical_end
;
148 /* Physical and virtual addresses for some global pages */
152 pv_addr_t kernelstack
;
153 pv_addr_t minidataclean
;
155 vm_offset_t msgbufphys
;
157 extern u_int data_abort_handler_address
;
158 extern u_int prefetch_abort_handler_address
;
159 extern u_int undefined_handler_address
;
163 extern int pmap_debug_level
;
166 #define KERNEL_PT_SYS 0 /* L2 table for mapping zero page */
168 #define KERNEL_PT_KERNEL 1 /* L2 table for mapping kernel */
169 #define KERNEL_PT_KERNEL_NUM 4
170 #define KERNEL_PT_IO (KERNEL_PT_KERNEL + KERNEL_PT_KERNEL_NUM)
171 /* L2 tables for mapping kernel VM */
172 #define KERNEL_PT_VMDATA (KERNEL_PT_IO + 1)
173 #define KERNEL_PT_VMDATA_NUM 4 /* start with 16MB of KVM */
174 #define NUM_KERNEL_PTS (KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
176 pv_addr_t kernel_pt_table
[NUM_KERNEL_PTS
];
181 u_int
cpu_get_control(void);
184 * Define the default console speed for the board. This is generally
185 * what the firmware provided with the board defaults to.
188 #define CONSPEED B115200
189 #endif /* ! CONSPEED */
196 #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB)) | CS8) /* 8N1 */
199 int comcnspeed
= CONSPEED
;
200 int comcnmode
= CONMODE
;
201 int comcnunit
= CONUNIT
;
205 #error Must define KGDB_DEVNAME
207 const char kgdb_devname
[] = KGDB_DEVNAME
;
210 #error Must define KGDB_DEVADDR
212 unsigned long kgdb_devaddr
= KGDB_DEVADDR
;
215 #define KGDB_DEVRATE CONSPEED
217 int kgdb_devrate
= KGDB_DEVRATE
;
220 #define KGDB_DEVMODE CONMODE
222 int kgdb_devmode
= KGDB_DEVMODE
;
226 * void cpu_reboot(int howto, char *bootstr)
230 * Deal with any syncing, unmounting, dumping and shutdown hooks,
231 * then reset the CPU.
234 cpu_reboot(int howto
, char *bootstr
)
240 printf("boot: howto=%08x curproc=%p\n", howto
, curproc
);
244 * If we are still cold then hit the air brakes
245 * and crash to earth fast
249 pmf_system_shutdown(boothowto
);
250 printf("The operating system has halted.\n");
251 printf("Please press any key to reboot.\n\n");
253 printf("rebooting...\n");
257 /* Disable console buffering */
260 * If RB_NOSYNC was not specified sync the discs.
261 * Note: Unless cold is set to 1 here, syslogd will die during the
262 * unmount. It looks like syslogd is getting woken up only to find
263 * that it cannot page part of the binary in as the filesystem has
266 if (!(howto
& RB_NOSYNC
))
269 /* Say NO to interrupts */
272 /* Do a dump if requested. */
273 if ((howto
& (RB_DUMP
| RB_HALT
)) == RB_DUMP
)
276 /* Run any shutdown hooks */
279 pmf_system_shutdown(boothowto
);
281 /* Make sure IRQ's are disabled */
284 if (howto
& RB_HALT
) {
285 printf("The operating system has halted.\n");
286 printf("Please press any key to reboot.\n\n");
290 printf("rebooting...\n\r");
293 * Make really really sure that all interrupts are disabled,
295 (void) disable_interrupts(I32_bit
|F32_bit
);
296 IXPREG(IXP425_INT_ENABLE
) = 0;
299 * Map the boot Flash device down at physical address 0.
300 * This is safe since NetBSD runs out of an alias of
301 * SDRAM at 0x10000000.
303 reg
= EXP_CSR_READ_4(ixpsip_softc
, EXP_CNFG0_OFFSET
);
304 reg
|= EXP_CNFG0_MEM_MAP
;
305 EXP_CSR_WRITE_4(ixpsip_softc
, EXP_CNFG0_OFFSET
, reg
);
308 * Jump into the bootcode's reset vector
311 * Redboot doesn't like the state in which we leave the PCI
312 * ethernet card, and so fails to detect it on reboot. This
313 * pretty much necessitates a hard reset/power cycle to be
314 * able to download a new kernel image over ethernet.
316 * I suspect this is due to a bug in Redboot's i82557 driver.
320 /* ...and if that didn't work, just croak. */
321 printf("RESET FAILED!\n");
325 /* Static device mappings. */
326 static const struct pmap_devmap ixp425_devmap
[] = {
327 /* Physical/Virtual address for I/O space */
332 VM_PROT_READ
|VM_PROT_WRITE
,
341 VM_PROT_READ
|VM_PROT_WRITE
,
345 /* IXP425 PCI Configuration */
350 VM_PROT_READ
|VM_PROT_WRITE
,
354 /* SDRAM Controller */
359 VM_PROT_READ
|VM_PROT_WRITE
,
363 /* PCI Memory Space */
365 IXP425_PCI_MEM_VBASE
,
366 IXP425_PCI_MEM_HWBASE
,
368 VM_PROT_READ
|VM_PROT_WRITE
,
384 * Initial entry point on startup. This gets called before main() is
386 * It should be responsible for setting up everything that must be
387 * in place when main is called.
389 * Taking a copy of the boot configuration structure.
390 * Initialising the physical console so characters can be printed.
391 * Setting up page tables for the kernel
392 * Relocating the kernel to the bottom of physical memory
397 extern vaddr_t xscale_cache_clean_addr
;
399 extern vsize_t xscale_minidata_clean_size
;
403 u_int kerneldatasize
;
408 * Since we map v0xf0000000 == p0xc8000000, it's possible for
409 * us to initialize the console now.
413 #ifdef VERBOSE_INIT_ARM
414 /* Talk to the user */
415 printf("\nNetBSD/evbarm (Intel IXDP425) booting ...\n");
419 * Heads up ... Setup the CPU / MMU / TLB functions
422 panic("cpu not recognized!");
424 /* XXX overwrite bootconfig to hardcoded values */
425 bootconfig
.dramblocks
= 1;
426 bootconfig
.dram
[0].address
= 0x10000000;
427 bootconfig
.dram
[0].pages
= ixp425_sdram_size() / PAGE_SIZE
;
429 kerneldatasize
= (u_int32_t
)&end
- (u_int32_t
)KERNEL_TEXT_BASE
;
431 #ifdef VERBOSE_INIT_ARM
432 printf("kernsize=0x%x\n", kerneldatasize
);
434 kerneldatasize
= ((kerneldatasize
- 1) & ~(PAGE_SIZE
* 4 - 1)) + PAGE_SIZE
* 8;
437 * Set up the variables that define the availablilty of
438 * physical memory. For now, we're going to set
439 * physical_freestart to 0x10200000 (where the kernel
440 * was loaded), and allocate the memory we need downwards.
441 * If we get too close to the L1 table that we set up, we
442 * will panic. We will update physical_freestart and
443 * physical_freeend later to reflect what pmap_bootstrap()
446 * XXX pmap_bootstrap() needs an enema.
448 physical_start
= bootconfig
.dram
[0].address
;
449 physical_end
= physical_start
+ (bootconfig
.dram
[0].pages
* PAGE_SIZE
);
451 physical_freestart
= physical_start
452 + (KERNEL_TEXT_BASE
- KERNEL_BASE
) + kerneldatasize
;
453 physical_freeend
= physical_end
;
455 physmem
= (physical_end
- physical_start
) / PAGE_SIZE
;
457 /* Tell the user about the memory */
458 #ifdef VERBOSE_INIT_ARM
459 printf("physmemory: %d pages at 0x%08lx -> 0x%08lx\n", physmem
,
460 physical_start
, physical_end
- 1);
462 printf("Allocating page tables\n");
464 free_pages
= (physical_freeend
- physical_freestart
) / PAGE_SIZE
;
466 freemempos
= 0x10000000;
468 #ifdef VERBOSE_INIT_ARM
469 printf("physical_start = 0x%08lx, physical_end = 0x%08lx\n",
470 physical_start
, physical_end
);
473 /* Define a macro to simplify memory allocation */
474 #define valloc_pages(var, np) \
475 alloc_pages((var).pv_pa, (np)); \
476 (var).pv_va = KERNEL_BASE + (var).pv_pa - physical_start;
479 #define alloc_pages(var, np) \
480 physical_freeend -= ((np) * PAGE_SIZE); \
481 if (physical_freeend < physical_freestart) \
482 panic("initarm: out of memory"); \
483 (var) = physical_freeend; \
484 free_pages -= (np); \
485 memset((char *)(var), 0, ((np) * PAGE_SIZE));
487 #define alloc_pages(var, np) \
488 (var) = freemempos; \
489 memset((char *)(var), 0, ((np) * PAGE_SIZE)); \
490 freemempos += (np) * PAGE_SIZE;
494 for (loop
= 0; loop
<= NUM_KERNEL_PTS
; ++loop
) {
495 /* Are we 16KB aligned for an L1 ? */
496 if (((physical_freeend
- L1_TABLE_SIZE
) & (L1_TABLE_SIZE
- 1)) == 0
497 && kernel_l1pt
.pv_pa
== 0) {
498 valloc_pages(kernel_l1pt
, L1_TABLE_SIZE
/ PAGE_SIZE
);
500 valloc_pages(kernel_pt_table
[loop1
],
501 L2_TABLE_SIZE
/ PAGE_SIZE
);
506 /* This should never be able to happen but better confirm that. */
507 if (!kernel_l1pt
.pv_pa
|| (kernel_l1pt
.pv_pa
& (L1_TABLE_SIZE
-1)) != 0)
508 panic("initarm: Failed to align the kernel page directory");
511 * Allocate a page for the system page.
512 * This page will just contain the system vectors and can be
513 * shared by all processes.
515 alloc_pages(systempage
.pv_pa
, 1);
517 /* Allocate stacks for all modes */
518 valloc_pages(irqstack
, IRQ_STACK_SIZE
);
519 valloc_pages(abtstack
, ABT_STACK_SIZE
);
520 valloc_pages(undstack
, UND_STACK_SIZE
);
521 valloc_pages(kernelstack
, UPAGES
);
523 /* Allocate enough pages for cleaning the Mini-Data cache. */
524 KASSERT(xscale_minidata_clean_size
<= PAGE_SIZE
);
525 valloc_pages(minidataclean
, 1);
527 #ifdef VERBOSE_INIT_ARM
528 printf("IRQ stack: p0x%08lx v0x%08lx\n", irqstack
.pv_pa
,
530 printf("ABT stack: p0x%08lx v0x%08lx\n", abtstack
.pv_pa
,
532 printf("UND stack: p0x%08lx v0x%08lx\n", undstack
.pv_pa
,
534 printf("SVC stack: p0x%08lx v0x%08lx\n", kernelstack
.pv_pa
,
539 * XXX Defer this to later so that we can reclaim the memory
540 * XXX used by the RedBoot page tables.
542 alloc_pages(msgbufphys
, round_page(MSGBUFSIZE
) / PAGE_SIZE
);
545 * Ok we have allocated physical pages for the primary kernel
549 #ifdef VERBOSE_INIT_ARM
550 printf("Creating L1 page table at 0x%08lx\n", kernel_l1pt
.pv_pa
);
554 * Now we start construction of the L1 page table
555 * We start by mapping the L2 page tables into the L1.
556 * This means that we can replace L1 mappings later on if necessary
558 l1pagetable
= kernel_l1pt
.pv_pa
;
560 /* Map the L2 pages tables in the L1 page table */
561 pmap_link_l2pt(l1pagetable
, ARM_VECTORS_HIGH
& ~(0x00400000 - 1),
562 &kernel_pt_table
[KERNEL_PT_SYS
]);
563 for (loop
= 0; loop
< KERNEL_PT_KERNEL_NUM
; loop
++)
564 pmap_link_l2pt(l1pagetable
, KERNEL_BASE
+ loop
* 0x00400000,
565 &kernel_pt_table
[KERNEL_PT_KERNEL
+ loop
]);
566 for (loop
= 0; loop
< KERNEL_PT_VMDATA_NUM
; loop
++)
567 pmap_link_l2pt(l1pagetable
, KERNEL_VM_BASE
+ loop
* 0x00400000,
568 &kernel_pt_table
[KERNEL_PT_VMDATA
+ loop
]);
570 /* update the top of the kernel VM */
572 KERNEL_VM_BASE
+ (KERNEL_PT_VMDATA_NUM
* 0x00400000);
574 pmap_link_l2pt(l1pagetable
, IXP425_IO_VBASE
,
575 &kernel_pt_table
[KERNEL_PT_IO
]);
577 #ifdef VERBOSE_INIT_ARM
578 printf("Mapping kernel\n");
581 /* Now we fill in the L2 pagetable for the kernel static code/data */
583 extern char etext
[], _end
[];
584 size_t textsize
= (uintptr_t) etext
- KERNEL_TEXT_BASE
;
585 size_t totalsize
= (uintptr_t) _end
- KERNEL_TEXT_BASE
;
588 textsize
= (textsize
+ PGOFSET
) & ~PGOFSET
;
589 totalsize
= (totalsize
+ PGOFSET
) & ~PGOFSET
;
591 logical
= 0x00200000; /* offset of kernel in RAM */
593 logical
+= pmap_map_chunk(l1pagetable
, KERNEL_BASE
+ logical
,
594 physical_start
+ logical
, textsize
,
595 VM_PROT_READ
|VM_PROT_WRITE
, PTE_CACHE
);
596 logical
+= pmap_map_chunk(l1pagetable
, KERNEL_BASE
+ logical
,
597 physical_start
+ logical
, totalsize
- textsize
,
598 VM_PROT_READ
|VM_PROT_WRITE
, PTE_CACHE
);
601 #ifdef VERBOSE_INIT_ARM
602 printf("Constructing L2 page tables\n");
605 /* Map the stack pages */
606 pmap_map_chunk(l1pagetable
, irqstack
.pv_va
, irqstack
.pv_pa
,
607 IRQ_STACK_SIZE
* PAGE_SIZE
, VM_PROT_READ
|VM_PROT_WRITE
, PTE_CACHE
);
608 pmap_map_chunk(l1pagetable
, abtstack
.pv_va
, abtstack
.pv_pa
,
609 ABT_STACK_SIZE
* PAGE_SIZE
, VM_PROT_READ
|VM_PROT_WRITE
, PTE_CACHE
);
610 pmap_map_chunk(l1pagetable
, undstack
.pv_va
, undstack
.pv_pa
,
611 UND_STACK_SIZE
* PAGE_SIZE
, VM_PROT_READ
|VM_PROT_WRITE
, PTE_CACHE
);
612 pmap_map_chunk(l1pagetable
, kernelstack
.pv_va
, kernelstack
.pv_pa
,
613 UPAGES
* PAGE_SIZE
, VM_PROT_READ
|VM_PROT_WRITE
, PTE_CACHE
);
615 pmap_map_chunk(l1pagetable
, kernel_l1pt
.pv_va
, kernel_l1pt
.pv_pa
,
616 L1_TABLE_SIZE
, VM_PROT_READ
|VM_PROT_WRITE
, PTE_PAGETABLE
);
618 for (loop
= 0; loop
< NUM_KERNEL_PTS
; ++loop
) {
619 pmap_map_chunk(l1pagetable
, kernel_pt_table
[loop
].pv_va
,
620 kernel_pt_table
[loop
].pv_pa
, L2_TABLE_SIZE
,
621 VM_PROT_READ
|VM_PROT_WRITE
, PTE_PAGETABLE
);
624 /* Map the Mini-Data cache clean area. */
625 xscale_setup_minidata(l1pagetable
, minidataclean
.pv_va
,
626 minidataclean
.pv_pa
);
628 /* Map the vector page. */
629 pmap_map_entry(l1pagetable
, ARM_VECTORS_HIGH
, systempage
.pv_pa
,
630 VM_PROT_READ
|VM_PROT_WRITE
, PTE_CACHE
);
633 * Map the IXP425 registers
635 pmap_devmap_bootstrap(l1pagetable
, ixp425_devmap
);
638 * Give the XScale global cache clean code an appropriately
639 * sized chunk of unmapped VA space starting at 0xff000000
640 * (our device mappings end before this address).
642 xscale_cache_clean_addr
= 0xff000000U
;
645 * Now we have the real page tables in place so we can switch to them.
646 * Once this is done we will be running with the REAL kernel page
651 * Update the physical_freestart/physical_freeend/free_pages
657 physical_freestart
= physical_start
+
658 (((((uintptr_t) _end
) + PGOFSET
) & ~PGOFSET
) -
660 physical_freeend
= physical_end
;
662 (physical_freeend
- physical_freestart
) / PAGE_SIZE
;
666 #ifdef VERBOSE_INIT_ARM
667 printf("freestart = 0x%08lx, free_pages = %d (0x%x)\n",
668 physical_freestart
, free_pages
, free_pages
);
669 printf("switching to new L1 page table @%#lx...", kernel_l1pt
.pv_pa
);
671 cpu_domains((DOMAIN_CLIENT
<< (PMAP_DOMAIN_KERNEL
*2)) | DOMAIN_CLIENT
);
672 cpu_setttb(kernel_l1pt
.pv_pa
);
674 cpu_domains(DOMAIN_CLIENT
<< (PMAP_DOMAIN_KERNEL
*2));
677 * Moved from cpu_startup() as data_abort_handler() references
678 * this during uvm init
680 uvm_lwp_setuarea(&lwp0
, kernelstack
.pv_va
);
682 #ifdef VERBOSE_INIT_ARM
683 printf("bootstrap done.\n");
686 arm32_vector_init(ARM_VECTORS_HIGH
, ARM_VEC_ALL
);
689 * Pages were allocated during the secondary bootstrap for the
690 * stacks for different CPU modes.
691 * We must now set the r13 registers in the different CPU modes to
692 * point to these stacks.
693 * Since the ARM stacks use STMFD etc. we must set r13 to the top end
694 * of the stack memory.
696 #ifdef VERBOSE_INIT_ARM
697 printf("init subsystems: stacks ");
700 set_stackptr(PSR_IRQ32_MODE
,
701 irqstack
.pv_va
+ IRQ_STACK_SIZE
* PAGE_SIZE
);
702 set_stackptr(PSR_ABT32_MODE
,
703 abtstack
.pv_va
+ ABT_STACK_SIZE
* PAGE_SIZE
);
704 set_stackptr(PSR_UND32_MODE
,
705 undstack
.pv_va
+ UND_STACK_SIZE
* PAGE_SIZE
);
708 * Well we should set a data abort handler.
709 * Once things get going this will change as we will need a proper
711 * Until then we will use a handler that just panics but tells us
713 * Initialisation of the vectors will just panic on a data abort.
714 * This just fills in a slightly better one.
716 #ifdef VERBOSE_INIT_ARM
719 data_abort_handler_address
= (u_int
)data_abort_handler
;
720 prefetch_abort_handler_address
= (u_int
)prefetch_abort_handler
;
721 undefined_handler_address
= (u_int
)undefinedinstruction_bounce
;
723 /* Initialise the undefined instruction handlers */
724 #ifdef VERBOSE_INIT_ARM
725 printf("undefined ");
729 /* Load memory into UVM. */
730 #ifdef VERBOSE_INIT_ARM
733 uvm_setpagesize(); /* initialize PAGE_SIZE-dependent variables */
734 uvm_page_physload(atop(physical_freestart
), atop(physical_freeend
),
735 atop(physical_freestart
), atop(physical_freeend
),
736 VM_FREELIST_DEFAULT
);
738 /* Boot strap pmap telling it where the kernel page table is */
739 #ifdef VERBOSE_INIT_ARM
742 pmap_bootstrap(KERNEL_VM_BASE
, KERNEL_VM_BASE
+ KERNEL_VM_SIZE
);
744 /* Setup the IRQ system */
745 #ifdef VERBOSE_INIT_ARM
749 #ifdef VERBOSE_INIT_ARM
750 printf("\nAll initialize done!\nNow Starting NetBSD, Hear we go!\n");
754 boothowto
= BOOTHOWTO
;
759 if (boothowto
& RB_KDB
)
763 /* We return the new stack pointer address */
764 return(kernelstack
.pv_va
+ USPACE_SVC_STACK_TOP
);
773 static int consinit_called
;
774 static const bus_addr_t addrs
[2] = {
775 IXP425_UART0_HWBASE
, IXP425_UART1_HWBASE
778 if (consinit_called
!= 0)
783 pmap_devmap_register(ixp425_devmap
);
785 if (comcnattach(&ixp425_a4x_bs_tag
, addrs
[comcnunit
],
786 comcnspeed
, IXP425_UART_FREQ
, COM_TYPE_PXA2x0
, comcnmode
))
787 panic("can't init serial console (UART%d)", comcnunit
);