| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: amiga_init.c,v 1.101 2008/12/31 10:33:13 tsutsui Exp $ */ | | 1 | /* $NetBSD: amiga_init.c,v 1.102 2008/12/31 18:48:14 tsutsui Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1994 Michael L. Hitch | | 4 | * Copyright (c) 1994 Michael L. Hitch |
5 | * Copyright (c) 1993 Markus Wild | | 5 | * Copyright (c) 1993 Markus Wild |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -26,27 +26,27 @@ | | | @@ -26,27 +26,27 @@ |
26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include "opt_amigaccgrf.h" | | 34 | #include "opt_amigaccgrf.h" |
35 | #include "opt_p5ppc68kboard.h" | | 35 | #include "opt_p5ppc68kboard.h" |
36 | #include "opt_devreload.h" | | 36 | #include "opt_devreload.h" |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | __KERNEL_RCSID(0, "$NetBSD: amiga_init.c,v 1.101 2008/12/31 10:33:13 tsutsui Exp $"); | | 39 | __KERNEL_RCSID(0, "$NetBSD: amiga_init.c,v 1.102 2008/12/31 18:48:14 tsutsui Exp $"); |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | #include <sys/proc.h> | | 43 | #include <sys/proc.h> |
44 | #include <uvm/uvm_extern.h> | | 44 | #include <uvm/uvm_extern.h> |
45 | #include <sys/user.h> | | 45 | #include <sys/user.h> |
46 | #include <sys/ioctl.h> | | 46 | #include <sys/ioctl.h> |
47 | #include <sys/select.h> | | 47 | #include <sys/select.h> |
48 | #include <sys/tty.h> | | 48 | #include <sys/tty.h> |
49 | #include <sys/buf.h> | | 49 | #include <sys/buf.h> |
50 | #include <sys/msgbuf.h> | | 50 | #include <sys/msgbuf.h> |
51 | #include <sys/mbuf.h> | | 51 | #include <sys/mbuf.h> |
52 | #include <sys/protosw.h> | | 52 | #include <sys/protosw.h> |
| @@ -198,27 +198,27 @@ start_c(id, fphystart, fphysize, cphysiz | | | @@ -198,27 +198,27 @@ start_c(id, fphystart, fphysize, cphysiz |
198 | boot_part, loadbase) | | 198 | boot_part, loadbase) |
199 | int id; | | 199 | int id; |
200 | u_int fphystart, fphysize, cphysize; | | 200 | u_int fphystart, fphysize, cphysize; |
201 | char *esym_addr; | | 201 | char *esym_addr; |
202 | u_int flags; | | 202 | u_int flags; |
203 | u_long inh_sync; | | 203 | u_long inh_sync; |
204 | u_long boot_part; | | 204 | u_long boot_part; |
205 | u_int loadbase; | | 205 | u_int loadbase; |
206 | { | | 206 | { |
207 | extern char end[]; | | 207 | extern char end[]; |
208 | extern u_int protorp[2]; | | 208 | extern u_int protorp[2]; |
209 | struct cfdev *cd; | | 209 | struct cfdev *cd; |
210 | u_int pstart, pend, vstart, vend, avail; | | 210 | u_int pstart, pend, vstart, vend, avail; |
211 | u_int pt, ptpa, ptsize, ptextra, kstsize; | | 211 | u_int ptpa, ptsize, ptextra, kstsize; |
212 | u_int Sysptmap_pa; | | 212 | u_int Sysptmap_pa; |
213 | register st_entry_t sg_proto, *sg, *esg; | | 213 | register st_entry_t sg_proto, *sg, *esg; |
214 | register pt_entry_t pg_proto, *pg; | | 214 | register pt_entry_t pg_proto, *pg; |
215 | u_int end_loaded, ncd, i; | | 215 | u_int end_loaded, ncd, i; |
216 | struct boot_memlist *ml; | | 216 | struct boot_memlist *ml; |
217 | | | 217 | |
218 | #ifdef DEBUG_KERNEL_START | | 218 | #ifdef DEBUG_KERNEL_START |
219 | /* XXX this only is valid if Altais is in slot 0 */ | | 219 | /* XXX this only is valid if Altais is in slot 0 */ |
220 | volatile u_int8_t *altaiscolpt = (u_int8_t *)0x200003c8; | | 220 | volatile u_int8_t *altaiscolpt = (u_int8_t *)0x200003c8; |
221 | volatile u_int8_t *altaiscol = (u_int8_t *)0x200003c9; | | 221 | volatile u_int8_t *altaiscol = (u_int8_t *)0x200003c9; |
222 | #endif | | 222 | #endif |
223 | | | 223 | |
224 | #ifdef DEBUG_KERNEL_START | | 224 | #ifdef DEBUG_KERNEL_START |
| @@ -372,52 +372,45 @@ start_c(id, fphystart, fphysize, cphysiz | | | @@ -372,52 +372,45 @@ start_c(id, fphystart, fphysize, cphysiz |
372 | | | 372 | |
373 | /* | | 373 | /* |
374 | * allocate kernel page table map | | 374 | * allocate kernel page table map |
375 | */ | | 375 | */ |
376 | RELOC(Sysptmap, u_int) = vstart; | | 376 | RELOC(Sysptmap, u_int) = vstart; |
377 | Sysptmap_pa = pstart; | | 377 | Sysptmap_pa = pstart; |
378 | vstart += PAGE_SIZE; | | 378 | vstart += PAGE_SIZE; |
379 | pstart += PAGE_SIZE; | | 379 | pstart += PAGE_SIZE; |
380 | avail -= PAGE_SIZE; | | 380 | avail -= PAGE_SIZE; |
381 | | | 381 | |
382 | /* | | 382 | /* |
383 | * allocate initial page table pages | | 383 | * allocate initial page table pages |
384 | */ | | 384 | */ |
385 | pt = vstart; | | | |
386 | ptpa = pstart; | | 385 | ptpa = pstart; |
387 | #ifdef DRACO | | 386 | #ifdef DRACO |
388 | if ((id>>24)==0x7D) { | | 387 | if ((id>>24)==0x7D) { |
389 | ptextra = NDRCCPG | | 388 | ptextra = NDRCCPG |
390 | + RELOC(NZTWOMEMPG, u_int) | | 389 | + RELOC(NZTWOMEMPG, u_int) |
391 | + btoc(RELOC(ZBUSAVAIL, u_int)); | | 390 | + btoc(RELOC(ZBUSAVAIL, u_int)); |
392 | } else | | 391 | } else |
393 | #endif | | 392 | #endif |
394 | ptextra = NCHIPMEMPG + NCIAPG + NZTWOROMPG + RELOC(NZTWOMEMPG, u_int) + | | 393 | ptextra = NCHIPMEMPG + NCIAPG + NZTWOROMPG + RELOC(NZTWOMEMPG, u_int) + |
395 | btoc(RELOC(ZBUSAVAIL, u_int)) + NPCMCIAPG; | | 394 | btoc(RELOC(ZBUSAVAIL, u_int)) + NPCMCIAPG; |
396 | | | 395 | |
397 | ptsize = (RELOC(Sysptsize, u_int) + | | 396 | ptsize = (RELOC(Sysptsize, u_int) + |
398 | howmany(ptextra, NPTEPG)) << PGSHIFT; | | 397 | howmany(ptextra, NPTEPG)) << PGSHIFT; |
399 | | | 398 | |
400 | vstart += ptsize; | | 399 | vstart += ptsize; |
401 | pstart += ptsize; | | 400 | pstart += ptsize; |
402 | avail -= ptsize; | | 401 | avail -= ptsize; |
403 | | | 402 | |
404 | /* | | 403 | /* |
405 | * pt maps the first N megs of ram Sysptmap comes directly | | | |
406 | * after pt (ptpa) and so it must map >= N meg + Its one | | | |
407 | * page and so it must map 8M of space. Specifically | | | |
408 | * Sysptmap holds the pte's that map the kernel page tables. | | | |
409 | * | | | |
410 | * We want Sysmap to be the first address mapped by Sysptmap. | | | |
411 | * Sysmap is now placed at the end of Supervisor virtual address space. | | 404 | * Sysmap is now placed at the end of Supervisor virtual address space. |
412 | */ | | 405 | */ |
413 | RELOC(Sysmap, u_int *) = (u_int *)-(NPTEPG * PAGE_SIZE); | | 406 | RELOC(Sysmap, u_int *) = (u_int *)-(NPTEPG * PAGE_SIZE); |
414 | | | 407 | |
415 | /* | | 408 | /* |
416 | * initialize segment table and page table map | | 409 | * initialize segment table and page table map |
417 | */ | | 410 | */ |
418 | #if defined(M68040) || defined(M68060) | | 411 | #if defined(M68040) || defined(M68060) |
419 | if (RELOC(mmutype, int) == MMU_68040) { | | 412 | if (RELOC(mmutype, int) == MMU_68040) { |
420 | /* | | 413 | /* |
421 | * First invalidate the entire "segment table" pages | | 414 | * First invalidate the entire "segment table" pages |
422 | * (levels 1 and 2 have the same "invalid" values). | | 415 | * (levels 1 and 2 have the same "invalid" values). |
423 | */ | | 416 | */ |