CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Fri May 3 01:08:28 UTC 2019 Modified Files: src/sys/arch/atari/atari: autoconf.c locore.s Log Message: Make sure interrupts are disabled during cpu_configure(9). Fixes 'panic: kernel diagnostic assertion "cv_is_valid(cv)" failed' during fdcisa(4) probe on Milan's DIAGNOSTIC kernel, caused by a stray interrupt from the FDC right after isa_intr_establish(). No visible bad side effect on TT030 with this change. Should be pulled up to netbsd-8. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/arch/atari/atari/autoconf.c cvs rdiff -u -r1.113 -r1.114 src/sys/arch/atari/atari/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/autoconf.c diff -u src/sys/arch/atari/atari/autoconf.c:1.65 src/sys/arch/atari/atari/autoconf.c:1.66 --- src/sys/arch/atari/atari/autoconf.c:1.65 Mon Mar 24 18:39:57 2014 +++ src/sys/arch/atari/atari/autoconf.c Fri May 3 01:08:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.65 2014/03/24 18:39:57 christos Exp $ */ +/* $NetBSD: autoconf.c,v 1.66 2019/05/03 01:08:28 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.65 2014/03/24 18:39:57 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.66 2019/05/03 01:08:28 tsutsui Exp $"); #include "opt_md.h" @@ -73,10 +73,14 @@ cpu_configure(void) atari_realconfig = 1; + (void)splhigh(); + init_sicallback(); if (config_rootfound("mainbus", __UNCONST("mainbus")) == NULL) panic("no mainbus found"); + + (void)spl0(); } void Index: src/sys/arch/atari/atari/locore.s diff -u src/sys/arch/atari/atari/locore.s:1.113 src/sys/arch/atari/atari/locore.s:1.114 --- src/sys/arch/atari/atari/locore.s:1.113 Tue Mar 19 20:30:05 2019 +++ src/sys/arch/atari/atari/locore.s Fri May 3 01:08:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.113 2019/03/19 20:30:05 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.114 2019/05/03 01:08:28 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -1000,8 +1000,6 @@ Lcacheon: /* * Final setup for C code */ - movw #PSL_LOWIPL,%sr | lower SPL - #ifdef notdef movl %d6,_C_LABEL(bootdev) |and boot device #endif
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Sat Mar 10 03:44:43 UTC 2018 Modified Files: src/sys/arch/atari/atari: bus.c Log Message: Replace bus_dmamap_sync(9) op with a newer one taken from m68k/bus_dma.c. This could fix memory corruption issue caused by PREREAD ops with regions whose boundaries are not aligned at cacheline size. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/arch/atari/atari/bus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/bus.c diff -u src/sys/arch/atari/atari/bus.c:1.59 src/sys/arch/atari/atari/bus.c:1.60 --- src/sys/arch/atari/atari/bus.c:1.59 Sat Jan 20 17:37:15 2018 +++ src/sys/arch/atari/atari/bus.c Sat Mar 10 03:44:43 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bus.c,v 1.59 2018/01/20 17:37:15 tsutsui Exp $ */ +/* $NetBSD: bus.c,v 1.60 2018/03/10 03:44:43 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include "opt_m68k_arch.h" #include -__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.59 2018/01/20 17:37:15 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.60 2018/03/10 03:44:43 tsutsui Exp $"); #include #include @@ -548,46 +548,203 @@ _bus_dmamap_unload(bus_dma_tag_t t, bus_ * by bus-specific DMA map synchronization functions. */ void -_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t off, +_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset, bus_size_t len, int ops) { #if defined(M68040) || defined(M68060) - int i, pa_off, inc, seglen; - u_long pa, end_pa; + bus_addr_t p, e, ps, pe; + bus_size_t seglen; + bus_dma_segment_t *seg; + int i; +#endif - pa_off = t->_displacement; +#if defined(M68020) || defined(M68030) +#if defined(M68040) || defined(M68060) + if (cputype == CPU_68020 || cputype == CPU_68030) +#endif + /* assume no L2 physical cache */ + return; +#endif - /* Flush granularity */ - inc = (len > 1024) ? PAGE_SIZE : 16; +#if defined(M68040) || defined(M68060) + /* If the whole DMA map is uncached, do nothing. */ + if ((map->_dm_flags & BUS_DMA_COHERENT) != 0) + return; + + /* Short-circuit for unsupported `ops' */ + if ((ops & (BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE)) == 0) + return; - for (i = 0; i < map->dm_nsegs && len > 0; i++) { - if (map->dm_segs[i].ds_len <= off) { + /* + * flush/purge the cache. + */ + for (i = 0; i < map->dm_nsegs && len != 0; i++) { + seg = >dm_segs[i]; + if (seg->ds_len <= offset) { /* Segment irrelevant - before requested offset */ - off -= map->dm_segs[i].ds_len; + offset -= seg->ds_len; continue; } - seglen = map->dm_segs[i].ds_len - off; + + /* + * Now at the first segment to sync; nail + * each segment until we have exhausted the + * length. + */ + seglen = seg->ds_len - offset; if (seglen > len) seglen = len; - len -= seglen; - pa = map->dm_segs[i].ds_addr + off - pa_off; - end_pa = pa + seglen; - if (inc == 16) { - pa &= ~15; - while (pa < end_pa) { -DCFL(pa); -pa += 16; + ps = seg->ds_addr + offset; + pe = ps + seglen; + + if (ops & BUS_DMASYNC_PREWRITE) { + p = ps & ~CACHELINE_MASK; + e = (pe + CACHELINE_MASK) & ~CACHELINE_MASK; + + /* flush cacheline */ + while ((p < e) && (p & (CACHELINE_SIZE * 8 - 1)) != 0) { +DCFL(p); +p += CACHELINE_SIZE; } - } else { - pa &= ~PGOFSET; - while (pa < end_pa) { -DCFP(pa); -pa += PAGE_SIZE; + + /* flush cachelines per 128bytes */ + while ((p < e) && (p & PAGE_MASK) != 0) { +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; + } + + /* flush page */ + while (p + PAGE_SIZE <= e) { +DCFP(p); +p += PAGE_SIZE; + } + + /* flush cachelines per 128bytes */ + while (p + CACHELINE_SIZE * 8 <= e) { +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; +DCFL(p); +p += CACHELINE_SIZE; + } + + /* flush cacheline */ + while (p < e) { +DCFL(p); +p += CACHELINE_SIZE; } } + + /* + * Normally, the `PREREAD' flag instructs us to purge the + * cache for the specified offset and length. However, if + * the offset/length is not aligned to a cacheline boundary, + * we may end up purging some legitimate data from the + * start/end of the cache. In such a case, *flush* the + * cachelines at the start and end of the required region. + */ + else if (ops & BUS_DMASYNC_PREREAD) { + /* flush cacheline on start
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Sat Mar 10 02:48:51 UTC 2018 Modified Files: src/sys/arch/atari/atari: pmap_bootstrap.c Log Message: Fix another possible out of bounds. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/atari/atari/pmap_bootstrap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/pmap_bootstrap.c diff -u src/sys/arch/atari/atari/pmap_bootstrap.c:1.8 src/sys/arch/atari/atari/pmap_bootstrap.c:1.9 --- src/sys/arch/atari/atari/pmap_bootstrap.c:1.8 Thu Dec 22 14:47:54 2016 +++ src/sys/arch/atari/atari/pmap_bootstrap.c Sat Mar 10 02:48:51 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.8 2016/12/22 14:47:54 cherry Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.9 2018/03/10 02:48:51 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -113,11 +113,11 @@ pmap_bootstrap(vaddr_t vstart) /* * Setup physical address ranges */ - for (i = 0; usable_segs[i + 1].start; i++) - ; + for (i = 0; i < NMEM_SEGS && usable_segs[i].start; i++) + continue; /* XXX: allow for msgbuf */ - usable_segs[i].end -= m68k_round_page(MSGBUFSIZE); - msgbufpa = usable_segs[i].end; + usable_segs[i - 1].end -= m68k_round_page(MSGBUFSIZE); + msgbufpa = usable_segs[i - 1].end; /* * Count physical memory @@ -132,7 +132,7 @@ pmap_bootstrap(vaddr_t vstart) /* * Announce available memory to the VM-system */ - for (i = 0; usable_segs[i].start; i++) + for (i = 0; i < NMEM_SEGS && usable_segs[i].start; i++) uvm_page_physload(atop(usable_segs[i].start), atop(usable_segs[i].end), atop(usable_segs[i].start),
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Sat Jan 20 18:04:28 UTC 2018 Modified Files: src/sys/arch/atari/atari: locore.s Log Message: Fix silent hang after isa_intr_establish() on Milan. The problems (wrong macro replacements) were slipped in rev 1.107: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/atari/atari/locore.s#rev1.107 To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/sys/arch/atari/atari/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/locore.s diff -u src/sys/arch/atari/atari/locore.s:1.110 src/sys/arch/atari/atari/locore.s:1.111 --- src/sys/arch/atari/atari/locore.s:1.110 Thu Dec 22 15:33:28 2011 +++ src/sys/arch/atari/atari/locore.s Sat Jan 20 18:04:28 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.110 2011/12/22 15:33:28 tsutsui Exp $ */ +/* $NetBSD: locore.s,v 1.111 2018/01/20 18:04:28 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -399,7 +399,7 @@ ENTRY_NOPROFILE(lev6intr) movel %d1,%sp@- | Call handler jbsr _C_LABEL(milan_isa_intr) addql #8,%sp - INTERRUPT_RESTOREREG + moveml %sp@+,%d0-%d2/%a0-%a1 subql #1,_C_LABEL(idepth) jra _ASM_LABEL(rei) @@ -450,7 +450,6 @@ ENTRY_NOPROFILE(lev7intr) tstl _ASM_LABEL(plx_nonmi) | milan_conf_read shortcut jne 1f | get out immediately INTERRUPT_SAVEREG - moveml %d0-%d1/%a0-%a1,%sp@- movl _C_LABEL(stio_addr),%a0 | get KVA of ST-IO area movw %a0@(PLX_PCICR),_C_LABEL(plx_status) movw #0xf900,%a0@(PLX_PCICR) | Clear error bits @@ -464,7 +463,6 @@ ENTRY_NOPROFILE(lev7intr) ENTRY_NOPROFILE(lev3intr) ENTRY_NOPROFILE(badtrap) addql #1,_C_LABEL(idepth) - moveml #0xC0C0,%sp@- | save scratch regs INTERRUPT_SAVEREG movw %sp@(22),%sp@- | push exception vector info clrw %sp@-
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Sat Jan 20 17:37:15 UTC 2018 Modified Files: src/sys/arch/atari/atari: bus.c Log Message: Fix I/O access failures for regions allocated by bus_space_map(9) on Milan. Passing to PMAP_WIRED against I/O spaces seems problematic, probably after yamt-km branch merge, which was committed between NetBSD 3.0 and NetBSD 4.0. (i.e. ISA and PCI devices on Milan didn't work after 4.0 release) XXX: According to pmap(9) man page, the "flags" arg for pmap_enter(9) doesn't take VM_PROT_READ and VM_PROT_WRITE, but pmap_enter() implementation in sys/arch/m68k/m68k/pmap_motolora.c historically checks them. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/atari/atari/bus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/bus.c diff -u src/sys/arch/atari/atari/bus.c:1.58 src/sys/arch/atari/atari/bus.c:1.59 --- src/sys/arch/atari/atari/bus.c:1.58 Sat Oct 18 08:33:24 2014 +++ src/sys/arch/atari/atari/bus.c Sat Jan 20 17:37:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bus.c,v 1.58 2014/10/18 08:33:24 snj Exp $ */ +/* $NetBSD: bus.c,v 1.59 2018/01/20 17:37:15 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include "opt_m68k_arch.h" #include -__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.58 2014/10/18 08:33:24 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.59 2018/01/20 17:37:15 tsutsui Exp $"); #include #include @@ -251,7 +251,7 @@ bus_mem_add_mapping(bus_space_tag_t t, b u_int *ptep, npte; pmap_enter(pmap_kernel(), (vaddr_t)va, pa, - VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); + VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE); ptep = kvtopte(va); npte = *ptep & ~PG_CMASK; @@ -667,7 +667,7 @@ bus_dmamem_map(bus_dma_tag_t t, bus_dma_ panic("_bus_dmamem_map: size botch"); pmap_enter(pmap_kernel(), va, addr - offset, VM_PROT_READ | VM_PROT_WRITE, - VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); + VM_PROT_READ | VM_PROT_WRITE); } } pmap_update(pmap_kernel());
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: maya Date: Thu Oct 13 06:48:07 UTC 2016 Modified Files: src/sys/arch/atari/atari: le_bus.c Log Message: Correct misleading indentation. While here, remove whitespace. NFC To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/atari/atari/le_bus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/le_bus.c diff -u src/sys/arch/atari/atari/le_bus.c:1.18 src/sys/arch/atari/atari/le_bus.c:1.19 --- src/sys/arch/atari/atari/le_bus.c:1.18 Fri Jul 1 20:34:05 2011 +++ src/sys/arch/atari/atari/le_bus.c Thu Oct 13 06:48:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: le_bus.c,v 1.18 2011/07/01 20:34:05 dyoung Exp $ */ +/* $NetBSD: le_bus.c,v 1.19 2016/10/13 06:48:07 maya Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: le_bus.c,v 1.18 2011/07/01 20:34:05 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: le_bus.c,v 1.19 2016/10/13 06:48:07 maya Exp $"); #include #include @@ -268,10 +268,10 @@ leb_alloc_bus_space_tag(bus_space_tag_t leb_t = storage; else { if ((leb_t = malloc(sizeof(*leb_t), M_TEMP, M_NOWAIT)) == NULL) - return NULL; + return NULL; } memset(leb_t, 0, sizeof(*leb_t)); - + leb_t->abs_p_1 = leb_bus_space_peek_1; leb_t->abs_p_2 = leb_bus_space_peek_2; leb_t->abs_p_4 = leb_bus_space_peek_4;
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: christos Date: Fri Sep 26 17:11:05 UTC 2014 Modified Files: src/sys/arch/atari/atari: intr.c Log Message: copy the leak fix to the other switch branch (from max) To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/atari/atari/intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/intr.c diff -u src/sys/arch/atari/atari/intr.c:1.24 src/sys/arch/atari/atari/intr.c:1.25 --- src/sys/arch/atari/atari/intr.c:1.24 Sun Sep 21 11:49:21 2014 +++ src/sys/arch/atari/atari/intr.c Fri Sep 26 13:11:05 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.24 2014/09/21 15:49:21 christos Exp $ */ +/* $NetBSD: intr.c,v 1.25 2014/09/26 17:11:05 christos Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.24 2014/09/21 15:49:21 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.25 2014/09/26 17:11:05 christos Exp $); #include sys/param.h #include sys/systm.h @@ -141,14 +141,16 @@ intr_establish(int vector, int type, int ih-ih_intrcnt = intrcnt_auto[vector-1]; break; case USER_VEC: - if (vector UVEC_MIN || vector UVEC_MAX) + if (vector UVEC_MIN || vector UVEC_MAX) { + free(ih, M_DEVBUF); return NULL; + } vec_list = uservec_list[vector]; hard_vec = uservects[vector]; ih-ih_intrcnt = intrcnt_user[vector]; break; default: - printf(intr_establish: bogus vector type\n); + printf(%s: bogus vector type\n, __func__); free(ih, M_DEVBUF); return NULL; }
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: christos Date: Sun Sep 21 15:49:21 UTC 2014 Modified Files: src/sys/arch/atari/atari: intr.c Log Message: fix leak. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/atari/atari/intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/intr.c diff -u src/sys/arch/atari/atari/intr.c:1.23 src/sys/arch/atari/atari/intr.c:1.24 --- src/sys/arch/atari/atari/intr.c:1.23 Sun Dec 19 19:25:30 2010 +++ src/sys/arch/atari/atari/intr.c Sun Sep 21 11:49:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.23 2010/12/20 00:25:30 matt Exp $ */ +/* $NetBSD: intr.c,v 1.24 2014/09/21 15:49:21 christos Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.23 2010/12/20 00:25:30 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.24 2014/09/21 15:49:21 christos Exp $); #include sys/param.h #include sys/systm.h @@ -132,8 +132,10 @@ intr_establish(int vector, int type, int */ switch (type (AUTO_VEC|USER_VEC)) { case AUTO_VEC: - if (vector AVEC_MIN || vector AVEC_MAX) + if (vector AVEC_MIN || vector AVEC_MAX) { + free(ih, M_DEVBUF); return NULL; + } vec_list = autovec_list[vector-1]; hard_vec = autovects[vector-1]; ih-ih_intrcnt = intrcnt_auto[vector-1];
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: christos Date: Sat Nov 23 22:52:40 UTC 2013 Modified Files: src/sys/arch/atari/atari: stalloc.c stalloc.h Log Message: convert from CIRCLEQ to TAILQ; remove open coding. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/atari/atari/stalloc.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/atari/atari/stalloc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/stalloc.c diff -u src/sys/arch/atari/atari/stalloc.c:1.13 src/sys/arch/atari/atari/stalloc.c:1.14 --- src/sys/arch/atari/atari/stalloc.c:1.13 Tue Apr 13 07:22:22 2010 +++ src/sys/arch/atari/atari/stalloc.c Sat Nov 23 17:52:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: stalloc.c,v 1.13 2010/04/13 11:22:22 tsutsui Exp $ */ +/* $NetBSD: stalloc.c,v 1.14 2013/11/23 22:52:40 christos Exp $ */ /* * Copyright (c) 1995 Leo Weppelman (Atari modifications) @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: stalloc.c,v 1.13 2010/04/13 11:22:22 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: stalloc.c,v 1.14 2013/11/23 22:52:40 christos Exp $); #include sys/types.h #include sys/param.h @@ -53,8 +53,8 @@ extern u_long st_pool_size, st_pool_virt #define PHYS_ADDR(virt) ((u_long)(virt) - st_pool_virt + st_pool_phys) -static CIRCLEQ_HEAD(stlist, mem_node) st_list; -static CIRCLEQ_HEAD(freelist, mem_node) free_list; +static TAILQ_HEAD(stlist, mem_node) st_list; +static TAILQ_HEAD(freelist, mem_node) free_list; u_long stmem_total; /* total free. */ void @@ -68,11 +68,11 @@ init_stmem(void) mem = (struct mem_node *)st_pool_virt; mem-size = st_pool_size - sizeof(*mem); - CIRCLEQ_INIT(st_list); - CIRCLEQ_INIT(free_list); + TAILQ_INIT(st_list); + TAILQ_INIT(free_list); - CIRCLEQ_INSERT_HEAD(st_list, mem, link); - CIRCLEQ_INSERT_HEAD(free_list, mem, free_link); + TAILQ_INSERT_HEAD(st_list, mem, link); + TAILQ_INSERT_HEAD(free_list, mem, free_link); splx(s); } @@ -93,22 +93,22 @@ alloc_stmem(u_long size, void **phys_add /* * walk list of available nodes, finding the best-fit. */ - bfit = NULL; - mn = free_list.cqh_first; - for (; mn != (void *)free_list; mn = mn-free_link.cqe_next) { + bfit = TAILQ_END(free_list); + TAILQ_FOREACH(mn, free_list, free_link) { if (size = mn-size) { - if ((bfit != NULL) (bfit-size mn-size)) + if ((bfit != TAILQ_END(free_list)) + (bfit-size mn-size)) continue; bfit = mn; } } - if (bfit != NULL) + if (bfit != TAILQ_END(free_list)) mn = bfit; - if (mn == (void *)free_list) { + if (mn == TAILQ_END(free_list)) { printf(St-mem pool exhausted, binpatch 'st_pool_size' to get more\n); splx(s); - return(NULL); + return NULL; } if ((mn-size - size) = sizeof (*mn)) { @@ -116,8 +116,8 @@ alloc_stmem(u_long size, void **phys_add * our allocation would not leave room * for a new node in between. */ - CIRCLEQ_REMOVE(free_list, mn, free_link); - mn-free_link.cqe_next = NULL; + TAILQ_REMOVE(free_list, mn, free_link); + TAILQ_NEXT(mn, free_link) = TAILQ_END(free_list); size = mn-size; /* increase size. (or same) */ stmem_total -= mn-size; splx(s); @@ -137,8 +137,8 @@ alloc_stmem(u_long size, void **phys_add * add split node to node list * and mark as not on free list */ - CIRCLEQ_INSERT_AFTER(st_list, new, mn, link); - mn-free_link.cqe_next = NULL; + TAILQ_INSERT_AFTER(st_list, new, mn, link); + TAILQ_NEXT(mn, free_link) = TAILQ_END(free_list); stmem_total -= size + sizeof(struct mem_node); splx(s); @@ -157,63 +157,67 @@ free_stmem(void *mem) s = splhigh(); mn = (struct mem_node *)mem - 1; - next = mn-link.cqe_next; - prev = mn-link.cqe_prev; + next = TAILQ_NEXT(mn, link); + prev = TAILQ_PREV(mn, stlist, link); /* * check ahead of us. */ - if (next != (void *)st_list next-free_link.cqe_next) { + if (next != LIST_END(st_list) + TAILQ_NEXT(next, free_link) != TAILQ_END(free_list)) { /* * if next is: a valid node and a free node. == merge */ - CIRCLEQ_INSERT_BEFORE(free_list, next, mn, free_link); - CIRCLEQ_REMOVE(st_list, next, link); - CIRCLEQ_REMOVE(st_list, next, free_link); + TAILQ_INSERT_BEFORE(next, mn, free_link); + TAILQ_REMOVE(st_list, next, link); + TAILQ_REMOVE(st_list, next, free_link); stmem_total += mn-size + sizeof(struct mem_node); mn-size += next-size + sizeof(struct mem_node); } - if (prev != (void *)st_list prev-free_link.cqe_prev) { + if (prev != LIST_END(st_list) + TAILQ_PREV(prev, freelist, free_link) != TAILQ_END(free_list)) { /* * if prev is: a valid node and a free node. == merge */ - if (mn-free_link.cqe_next == NULL) + if (TAILQ_NEXT(mn, free_link) == TAILQ_END(free_list)) stmem_total += mn-size + sizeof(struct mem_node); else { /* already on free list */ - CIRCLEQ_REMOVE(free_list, mn, free_link); + TAILQ_REMOVE(free_list,
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Sat Jun 30 10:37:00 UTC 2012 Modified Files: src/sys/arch/atari/atari: autoconf.c Log Message: Add a dirty hack for atari's ancient installation ramdisk: Forcibly configure md0, md1, and md2 devices before setroot() for atari's traditional auto-load from floppy on open md_root device which loads installation ramdisk image from floppy. md(4) has been changed dynamically configured at first open after 5.0 and md devices won't appear in root device: prompt without this hack. Tested on TT030. Should be pulled up to netbsd-6. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/arch/atari/atari/autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/autoconf.c diff -u src/sys/arch/atari/atari/autoconf.c:1.61 src/sys/arch/atari/atari/autoconf.c:1.62 --- src/sys/arch/atari/atari/autoconf.c:1.61 Sun Jun 5 17:09:18 2011 +++ src/sys/arch/atari/atari/autoconf.c Sat Jun 30 10:37:00 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.61 2011/06/05 17:09:18 matt Exp $ */ +/* $NetBSD: autoconf.c,v 1.62 2012/06/30 10:37:00 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -31,7 +31,9 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.61 2011/06/05 17:09:18 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.62 2012/06/30 10:37:00 tsutsui Exp $); + +#include opt_md.h #include sys/param.h #include sys/systm.h @@ -41,10 +43,17 @@ __KERNEL_RCSID(0, $NetBSD: autoconf.c,v #include sys/device.h #include sys/disklabel.h #include sys/disk.h +#include sys/malloc.h #include machine/disklabel.h #include machine/cpu.h #include atari/atari/device.h +#if defined(MEMORY_DISK_HOOKS) +#include dev/md.h +#endif + +#include ioconf.h + static void findroot(void); int mbmatch(device_t, cfdata_t, void *); void mbattach(device_t, device_t, void *); @@ -75,6 +84,41 @@ cpu_rootconf(void) { findroot(); +#if defined(MEMORY_DISK_HOOKS) + /* + * XXX + * quick hacks for atari's traditional auto-load from floppy on open + * installation md(4) ramdisk. + * See sys/arch/atari/dev/md_root.c for details. + */ +#define RAMD_NDEV 3 /* XXX */ + + if ((boothowto RB_ASKNAME) != 0) { + int md_major, i; + dev_t md_dev; + cfdata_t cf; + struct md_softc *sc; + + md_major = devsw_name2blk(md, NULL, 0); + if (md_major = 0) { + for (i = 0; i RAMD_NDEV; i++) { +md_dev = MAKEDISKDEV(md_major, i, RAW_PART); +cf = malloc(sizeof(*cf), M_DEVBUF, +M_ZERO|M_WAITOK); +if (cf == NULL) + break; /* XXX */ +cf-cf_name = md_cd.cd_name; +cf-cf_atname = md_cd.cd_name; +cf-cf_unit = i; +cf-cf_fstate = FSTATE_STAR; +/* XXX mutex */ +sc = device_private(config_attach_pseudo(cf)); +if (sc == NULL) + break; /* XXX */ + } + } + } +#endif setroot(booted_device, booted_partition); }
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Tue Feb 21 12:09:50 UTC 2012 Modified Files: src/sys/arch/atari/atari: atari_init.c Log Message: Use actual physmem size for allocation of bootstrap extra PT pages to avoid wasting pages on low memory machines. Improves atari specific part of PR/45915, tested on TT030. To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/arch/atari/atari/atari_init.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/atari_init.c diff -u src/sys/arch/atari/atari/atari_init.c:1.98 src/sys/arch/atari/atari/atari_init.c:1.99 --- src/sys/arch/atari/atari/atari_init.c:1.98 Fri Feb 10 04:49:44 2012 +++ src/sys/arch/atari/atari/atari_init.c Tue Feb 21 12:09:50 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.98 2012/02/10 04:49:44 mhitch Exp $ */ +/* $NetBSD: atari_init.c,v 1.99 2012/02/21 12:09:50 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -33,7 +33,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: atari_init.c,v 1.98 2012/02/10 04:49:44 mhitch Exp $); +__KERNEL_RCSID(0, $NetBSD: atari_init.c,v 1.99 2012/02/21 12:09:50 tsutsui Exp $); #include opt_ddb.h #include opt_mbtype.h @@ -226,6 +226,7 @@ start_c(int id, u_int ttphystart, u_int st_pool_phys = stphysize - st_pool_size; stphysize = st_pool_phys; + physmem= btoc(stphysize) + btoc(ttphysize); machineid = id; esym = esym_addr;
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Tue Apr 13 09:49:54 UTC 2010 Modified Files: src/sys/arch/atari/atari: pmap_bootstrap.c Log Message: Remove a declaration of unused variable. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/atari/atari/pmap_bootstrap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/pmap_bootstrap.c diff -u src/sys/arch/atari/atari/pmap_bootstrap.c:1.6 src/sys/arch/atari/atari/pmap_bootstrap.c:1.7 --- src/sys/arch/atari/atari/pmap_bootstrap.c:1.6 Sun Dec 6 06:41:29 2009 +++ src/sys/arch/atari/atari/pmap_bootstrap.c Tue Apr 13 09:49:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.6 2009/12/06 06:41:29 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.7 2010/04/13 09:49:54 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -83,9 +83,6 @@ extern paddr_t avail_start; extern paddr_t avail_end; -#if defined(M68040) || defined(M68060) -extern u_int protostfree; -#endif extern paddr_t msgbufpa;
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Tue Apr 13 11:22:22 UTC 2010 Modified Files: src/sys/arch/atari/atari: atari_init.c bus.c disksubr.c intr.c machdep.c stalloc.c Log Message: Misc KNF. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/arch/atari/atari/atari_init.c cvs rdiff -u -r1.52 -r1.53 src/sys/arch/atari/atari/bus.c cvs rdiff -u -r1.42 -r1.43 src/sys/arch/atari/atari/disksubr.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/atari/atari/intr.c cvs rdiff -u -r1.166 -r1.167 src/sys/arch/atari/atari/machdep.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/atari/atari/stalloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/atari_init.c diff -u src/sys/arch/atari/atari/atari_init.c:1.92 src/sys/arch/atari/atari/atari_init.c:1.93 --- src/sys/arch/atari/atari/atari_init.c:1.92 Fri Dec 11 22:23:08 2009 +++ src/sys/arch/atari/atari/atari_init.c Tue Apr 13 11:22:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.92 2009/12/11 22:23:08 tsutsui Exp $ */ +/* $NetBSD: atari_init.c,v 1.93 2010/04/13 11:22:22 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -33,7 +33,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: atari_init.c,v 1.92 2009/12/11 22:23:08 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: atari_init.c,v 1.93 2010/04/13 11:22:22 tsutsui Exp $); #include opt_ddb.h #include opt_mbtype.h @@ -525,7 +525,7 @@ lp = (paddr_t *)0; le = (paddr_t *)pstart; fp = (paddr_t *)kbase; - while(lp le) + while (lp le) *fp++ = *lp++; } #if defined(M68040) || defined(M68060) @@ -747,7 +747,7 @@ #else pg_proto = STIO_PHYS | PG_RW | PG_CI | PG_V; #endif - while(pg epg) { + while (pg epg) { *pg++ = pg_proto; pg_proto += PAGE_SIZE; } Index: src/sys/arch/atari/atari/bus.c diff -u src/sys/arch/atari/atari/bus.c:1.52 src/sys/arch/atari/atari/bus.c:1.53 --- src/sys/arch/atari/atari/bus.c:1.52 Wed Mar 31 13:15:52 2010 +++ src/sys/arch/atari/atari/bus.c Tue Apr 13 11:22:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bus.c,v 1.52 2010/03/31 13:15:52 tsutsui Exp $ */ +/* $NetBSD: bus.c,v 1.53 2010/04/13 11:22:22 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: bus.c,v 1.52 2010/03/31 13:15:52 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: bus.c,v 1.53 2010/04/13 11:22:22 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -110,7 +110,7 @@ pg_proto = pa | PG_RW | PG_V; if (!(flags BUS_SPACE_MAP_CACHEABLE)) pg_proto |= PG_CI; - while(pg epg) { + while (pg epg) { *pg++ = pg_proto; pg_proto += PAGE_SIZE; #if defined(M68040) || defined(M68060) @@ -245,7 +245,7 @@ *bshp = va + (bpa PGOFSET); - for(; pa endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { + for (; pa endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { u_int *ptep, npte; pmap_enter(pmap_kernel(), (vaddr_t)va, pa, Index: src/sys/arch/atari/atari/disksubr.c diff -u src/sys/arch/atari/atari/disksubr.c:1.42 src/sys/arch/atari/atari/disksubr.c:1.43 --- src/sys/arch/atari/atari/disksubr.c:1.42 Wed Mar 31 14:12:55 2010 +++ src/sys/arch/atari/atari/disksubr.c Tue Apr 13 11:22:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: disksubr.c,v 1.42 2010/03/31 14:12:55 tsutsui Exp $ */ +/* $NetBSD: disksubr.c,v 1.43 2010/04/13 11:22:22 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.42 2010/03/31 14:12:55 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.43 2010/04/13 11:22:22 tsutsui Exp $); #ifndef DISKLABEL_NBDA #define DISKLABEL_NBDA /* required */ @@ -509,7 +509,7 @@ break; } if (pno 0) { - if((pno = user_part + 1) = MAXPARTITIONS) + if ((pno = user_part + 1) = MAXPARTITIONS) continue; user_part = pno; } Index: src/sys/arch/atari/atari/intr.c diff -u src/sys/arch/atari/atari/intr.c:1.21 src/sys/arch/atari/atari/intr.c:1.22 --- src/sys/arch/atari/atari/intr.c:1.21 Wed Mar 31 14:12:55 2010 +++ src/sys/arch/atari/atari/intr.c Tue Apr 13 11:22:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.21 2010/03/31 14:12:55 tsutsui Exp $ */ +/* $NetBSD: intr.c,v 1.22 2010/04/13 11:22:22 tsutsui Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.21 2010/03/31 14:12:55 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.22 2010/04/13 11:22:22 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -226,7 +226,7 @@ struct intrhand *cur_vec; vector = ih-ih_vector; - switch(ih-ih_type (AUTO_VEC|USER_VEC)) { + switch (ih-ih_type (AUTO_VEC|USER_VEC)) { case AUTO_VEC: if (vector AVEC_MIN || vector AVEC_MAX) return 0; Index: src/sys/arch/atari/atari/machdep.c diff -u
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Sat Apr 10 16:12:34 UTC 2010 Modified Files: src/sys/arch/atari/atari: device.h Log Message: Remove now unused getsoftc() macro. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/atari/atari/device.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/device.h diff -u src/sys/arch/atari/atari/device.h:1.4 src/sys/arch/atari/atari/device.h:1.5 --- src/sys/arch/atari/atari/device.h:1.4 Thu Mar 5 13:21:44 2009 +++ src/sys/arch/atari/atari/device.h Sat Apr 10 16:12:34 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.4 2009/03/05 13:21:44 tsutsui Exp $ */ +/* $NetBSD: device.h,v 1.5 2010/04/10 16:12:34 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -47,7 +47,4 @@ */ extern int atari_realconfig; - -#define getsoftc(cdnam, unit) device_lookup_private((cdnam), (unit)) - #endif /* _ATARI_DEVICE_H_ */
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Sat Apr 10 16:14:07 UTC 2010 Modified Files: src/sys/arch/atari/atari: autoconf.c Log Message: Remove extern int atari_realconfig decls. It's in atari/atari/device.h. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/arch/atari/atari/autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/autoconf.c diff -u src/sys/arch/atari/atari/autoconf.c:1.57 src/sys/arch/atari/atari/autoconf.c:1.58 --- src/sys/arch/atari/atari/autoconf.c:1.57 Thu Apr 1 17:07:51 2010 +++ src/sys/arch/atari/atari/autoconf.c Sat Apr 10 16:14:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.57 2010/04/01 17:07:51 tsutsui Exp $ */ +/* $NetBSD: autoconf.c,v 1.58 2010/04/10 16:14:07 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.57 2010/04/01 17:07:51 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.58 2010/04/10 16:14:07 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -59,8 +59,7 @@ void cpu_configure(void) { - extern int atari_realconfig; - + atari_realconfig = 1; init_sicallback(); @@ -98,7 +97,6 @@ struct device temp; struct cfdata *cf; const struct cfattach *ca; - extern int atari_realconfig; if (atari_realconfig) return config_found(pdp, auxp, pfn) != NULL;
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Sat Apr 10 17:40:36 UTC 2010 Modified Files: src/sys/arch/atari/atari: autoconf.c Log Message: Comment out currently unused mbprint(). To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/atari/atari/autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/autoconf.c diff -u src/sys/arch/atari/atari/autoconf.c:1.58 src/sys/arch/atari/atari/autoconf.c:1.59 --- src/sys/arch/atari/atari/autoconf.c:1.58 Sat Apr 10 16:14:07 2010 +++ src/sys/arch/atari/atari/autoconf.c Sat Apr 10 17:40:36 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.58 2010/04/10 16:14:07 tsutsui Exp $ */ +/* $NetBSD: autoconf.c,v 1.59 2010/04/10 17:40:36 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.58 2010/04/10 16:14:07 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.59 2010/04/10 17:40:36 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -46,9 +46,11 @@ #include atari/atari/device.h static void findroot(void); +int mbmatch(struct device *, struct cfdata *, void *); void mbattach(struct device *, struct device *, void *); +#if 0 int mbprint(void *, const char *); -int mbmatch(struct device *, struct cfdata *, void *); +#endif int atari_realconfig; #include sys/kernel.h @@ -284,6 +286,7 @@ config_found(dp, __UNCONST(avmebus) , simple_devprint); } +#if 0 int mbprint(void *auxp, const char *pnp) { @@ -292,3 +295,4 @@ aprint_normal(%s at %s, (char *)auxp, pnp); return UNCONF; } +#endif
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Wed Mar 31 13:15:52 UTC 2010 Modified Files: src/sys/arch/atari/atari: be_bus.c bus.c Log Message: ANSIfy, some KNF. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/atari/atari/be_bus.c cvs rdiff -u -r1.51 -r1.52 src/sys/arch/atari/atari/bus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/be_bus.c diff -u src/sys/arch/atari/atari/be_bus.c:1.13 src/sys/arch/atari/atari/be_bus.c:1.14 --- src/sys/arch/atari/atari/be_bus.c:1.13 Wed Mar 18 16:00:10 2009 +++ src/sys/arch/atari/atari/be_bus.c Wed Mar 31 13:15:52 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: be_bus.c,v 1.13 2009/03/18 16:00:10 cegger Exp $ */ +/* $NetBSD: be_bus.c,v 1.14 2010/03/31 13:15:52 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: be_bus.c,v 1.13 2009/03/18 16:00:10 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: be_bus.c,v 1.14 2010/03/31 13:15:52 tsutsui Exp $); #include sys/types.h #include sys/param.h @@ -184,7 +184,7 @@ beb_t = storage; else { if ((beb_t = malloc(sizeof(*beb_t), M_TEMP, M_NOWAIT)) == NULL) - return(NULL); + return NULL; } memset(beb_t, 0, sizeof(*beb_t)); Index: src/sys/arch/atari/atari/bus.c diff -u src/sys/arch/atari/atari/bus.c:1.51 src/sys/arch/atari/atari/bus.c:1.52 --- src/sys/arch/atari/atari/bus.c:1.51 Wed Mar 18 16:00:10 2009 +++ src/sys/arch/atari/atari/bus.c Wed Mar 31 13:15:52 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bus.c,v 1.51 2009/03/18 16:00:10 cegger Exp $ */ +/* $NetBSD: bus.c,v 1.52 2010/03/31 13:15:52 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: bus.c,v 1.51 2009/03/18 16:00:10 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: bus.c,v 1.52 2010/03/31 13:15:52 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -128,6 +128,7 @@ int bootm_free(vaddr_t va, u_long size) { + if ((va bootm_ex-ex_start) || ((va + size) bootm_ex-ex_end)) return 0; /* Not for us! */ extent_free(bootm_ex, va, size, EX_NOWAIT); @@ -135,7 +136,8 @@ } int -bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *mhp) +bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, +bus_space_handle_t *mhp) { int error; @@ -147,21 +149,24 @@ EX_NOWAIT | (iomem_malloc_safe ? EX_MALLOCOK : 0)); if (error) - return (error); + return error; error = bus_mem_add_mapping(t, bpa, size, flags, mhp); if (error) { if (extent_free(iomem_ex, bpa + t-base, size, EX_NOWAIT | -(iomem_malloc_safe ? EX_MALLOCOK : 0))) { - printf(bus_space_map: pa 0x%lx, size 0x%lx\n, bpa, size); - printf(bus_space_map: can't free region\n); + (iomem_malloc_safe ? EX_MALLOCOK : 0))) { + printf(bus_space_map: pa 0x%lx, size 0x%lx\n, + bpa, size); + printf(bus_space_map: can't free region\n); } } - return (error); + return error; } int -bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, bus_addr_t *bpap, bus_space_handle_t *bshp) +bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, +bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, +bus_addr_t *bpap, bus_space_handle_t *bshp) { u_long bpa; int error; @@ -172,8 +177,8 @@ * XXX: Since we manage the whole of memory in a single map, * this is nonsense for now! Brace it DIAGNOSTIC */ - if ((rstart + t-base) iomem_ex-ex_start -|| (rend + t-base) iomem_ex-ex_end) + if ((rstart + t-base) iomem_ex-ex_start || + (rend + t-base) iomem_ex-ex_end) panic(bus_space_alloc: bad region start/end); #endif /* DIAGNOSTIC */ @@ -186,7 +191,7 @@ bpa); if (error) - return (error); + return error; /* * Map the bus physical address to a kernel virtual address. @@ -203,11 +208,12 @@ *bpap = bpa; - return (error); + return error; } static int -bus_mem_add_mapping(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp) +bus_mem_add_mapping(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, +int flags, bus_space_handle_t *bshp) { vaddr_t va; paddr_t pa, endpa; @@ -227,15 +233,15 @@ */ va = bootm_alloc(pa, endpa - pa, flags); if (va == 0) - return (ENOMEM); + return ENOMEM; *bshp = va + (bpa PGOFSET); - return (0); + return 0; } va = uvm_km_alloc(kernel_map, endpa - pa, 0, UVM_KMF_VAONLY | UVM_KMF_NOWAIT); if (va == 0) - return (ENOMEM); + return ENOMEM; *bshp = va + (bpa PGOFSET); @@ -243,12 +249,12 @@ u_int *ptep, npte; pmap_enter(pmap_kernel(), (vaddr_t)va, pa, -
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Wed Mar 31 14:12:55 UTC 2010 Modified Files: src/sys/arch/atari/atari: disksubr.c intr.c machdep.c Log Message: Misc KNF and cosmetics. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/atari/atari/disksubr.c cvs rdiff -u -r1.20 -r1.21 src/sys/arch/atari/atari/intr.c cvs rdiff -u -r1.165 -r1.166 src/sys/arch/atari/atari/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/disksubr.c diff -u src/sys/arch/atari/atari/disksubr.c:1.41 src/sys/arch/atari/atari/disksubr.c:1.42 --- src/sys/arch/atari/atari/disksubr.c:1.41 Tue Oct 20 19:10:10 2009 +++ src/sys/arch/atari/atari/disksubr.c Wed Mar 31 14:12:55 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: disksubr.c,v 1.41 2009/10/20 19:10:10 snj Exp $ */ +/* $NetBSD: disksubr.c,v 1.42 2010/03/31 14:12:55 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.41 2009/10/20 19:10:10 snj Exp $); +__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.42 2010/03/31 14:12:55 tsutsui Exp $); #ifndef DISKLABEL_NBDA #define DISKLABEL_NBDA /* required */ @@ -69,13 +69,15 @@ * Returns NULL on success and an error string on failure. */ const char * -readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, struct cpu_disklabel *clp) +readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, +struct cpu_disklabel *clp) { - int e; + int e; if (clp != NULL) memset(clp, 0, sizeof *clp); - else printf(Warning: clp == NULL\n); + else + printf(Warning: clp == NULL\n); /* * Give some guaranteed validity to the disk label. @@ -85,7 +87,7 @@ if (lp-d_secperunit == 0) lp-d_secperunit = 0x1fff; if (lp-d_secpercyl == 0) - return(Zero secpercyl); + return Zero secpercyl; /* * Some parts of the kernel (see scsipi/cd.c for an example) @@ -117,39 +119,41 @@ e = ahdi_label(dev, strat, lp, clp); #endif if (e 0) - return(I/O error); + return I/O error; /* Unknown format or uninitialized volume? */ if (e 0) uprintf(Warning: unknown disklabel format - - assuming empty disk\n); + - assuming empty disk\n); /* Calulate new checksum. */ lp-d_magic = lp-d_magic2 = DISKMAGIC; lp-d_checksum = 0; lp-d_checksum = dkcksum(lp); - return(NULL); + return NULL; } /* * Check new disk label for sensibility before setting it. */ int -setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, struct cpu_disklabel *clp) +setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, +struct cpu_disklabel *clp) { + /* special case to allow disklabel to be invalidated */ if (nlp-d_magic == 0x) { *olp = *nlp; - return(0); + return 0; } /* sanity clause */ - if (nlp-d_secpercyl == 0 || nlp-d_npartitions MAXPARTITIONS - || nlp-d_secsize == 0 || (nlp-d_secsize % DEV_BSIZE) != 0 - || nlp-d_magic != DISKMAGIC || nlp-d_magic2 != DISKMAGIC - || dkcksum(nlp) != 0) - return(EINVAL); + if (nlp-d_secpercyl == 0 || nlp-d_npartitions MAXPARTITIONS || + nlp-d_secsize == 0 || (nlp-d_secsize % DEV_BSIZE) != 0 || + nlp-d_magic != DISKMAGIC || nlp-d_magic2 != DISKMAGIC || + dkcksum(nlp) != 0) + return EINVAL; #ifdef DISKLABEL_AHDI if (clp clp-cd_bblock) @@ -160,11 +164,11 @@ int i = ffs(openmask) - 1; openmask = ~(1 i); if (i = nlp-d_npartitions) - return(EBUSY); + return EBUSY; op = olp-d_partitions[i]; np = nlp-d_partitions[i]; if (np-p_offset != op-p_offset || np-p_size op-p_size) - return(EBUSY); + return EBUSY; /* * Copy internally-set partition information * if new label doesn't include it. XXX @@ -179,22 +183,23 @@ nlp-d_checksum = 0; nlp-d_checksum = dkcksum(nlp); *olp = *nlp; - return(0); + return 0; } /* * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, struct cpu_disklabel *clp) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, +struct cpu_disklabel *clp) { - struct buf *bp; - u_int blk; - int rv; + struct buf *bp; + u_int blk; + int rv; blk = clp-cd_bblock; if (blk == NO_BOOT_BLOCK) - return(ENXIO); + return ENXIO; bp = geteblk(BBMINSIZE); bp-b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART); @@ -204,7 +209,7 @@ bp-b_cylinder = blk / lp-d_secpercyl; (*strat)(bp); rv = biowait(bp); - if (!rv) { + if (rv == 0) { struct bootblock *bb = (struct bootblock *)bp-b_data; /* * Allthough the disk pack label may appear anywhere @@ -228,7 +233,7 @@ rv = biowait(bp); } brelse(bp, 0); - return(rv); + return rv; } /* @@ -240,15 +245,11 @@ * +1 if no valid label was found. */ static int
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Wed Dec 2 15:53:34 UTC 2009 Modified Files: src/sys/arch/atari/atari: atari_init.c locore.s Log Message: Use common pmap_bootstrap_finalize() to initialize lwp0 uarea etc. Tested on TT030. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/arch/atari/atari/atari_init.c cvs rdiff -u -r1.103 -r1.104 src/sys/arch/atari/atari/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/atari_init.c diff -u src/sys/arch/atari/atari/atari_init.c:1.88 src/sys/arch/atari/atari/atari_init.c:1.89 --- src/sys/arch/atari/atari/atari_init.c:1.88 Fri Nov 27 03:23:05 2009 +++ src/sys/arch/atari/atari/atari_init.c Wed Dec 2 15:53:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.88 2009/11/27 03:23:05 rmind Exp $ */ +/* $NetBSD: atari_init.c,v 1.89 2009/12/02 15:53:34 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -33,7 +33,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: atari_init.c,v 1.88 2009/11/27 03:23:05 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: atari_init.c,v 1.89 2009/12/02 15:53:34 tsutsui Exp $); #include opt_ddb.h #include opt_mbtype.h @@ -41,7 +41,6 @@ #include sys/param.h #include sys/systm.h -#include sys/proc.h #include sys/ioctl.h #include sys/select.h #include sys/tty.h @@ -275,7 +274,7 @@ /* * Save KVA of lwp0 uarea and allocate it. */ - uvm_lwp_setuarea(lwp0, vstart); + lwp0uarea = vstart; pstart+= USPACE; vstart+= USPACE; avail -= USPACE; @@ -567,14 +566,9 @@ } /* - * Initialize the u-area pages. - * - * Must initialize uarea before autoconfig or the fault handler - * will get a NULL reference. + * Initialize the u-area pages etc. */ - memset((void*)uvm_lwp_getuarea(lwp0), 0, USPACE); - curlwp = lwp0; - curpcb = lwp_getpcb(lwp0); + pmap_bootstrap_finalize(); /* * Get the hardware into a defined state Index: src/sys/arch/atari/atari/locore.s diff -u src/sys/arch/atari/atari/locore.s:1.103 src/sys/arch/atari/atari/locore.s:1.104 --- src/sys/arch/atari/atari/locore.s:1.103 Thu Nov 26 00:19:13 2009 +++ src/sys/arch/atari/atari/locore.s Wed Dec 2 15:53:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.103 2009/11/26 00:19:13 matt Exp $ */ +/* $NetBSD: locore.s,v 1.104 2009/12/02 15:53:34 tsutsui Exp $ */ /* * Copyright (c) 1980, 1990 The Regents of the University of California. @@ -1024,15 +1024,13 @@ jsr _C_LABEL(start_c) /* - * set kernel stack, user SP, and initial pcb + * set kernel stack, user SP */ - lea _C_LABEL(lwp0),%a0 | grab lwp0.p_addr - movl %a0@(L_ADDR),%a1 + movl _C_LABEL(lwp0uarea),%a1 | grab lwp0 uarea lea %a1@(USPACE-4),%sp | set kernel stack to end of area movl #USRSTACK-4,%a2 movl %a2,%usp | init user SP movl %a2,%a1@(PCB_USP) | and save it - movl %a1,_C_LABEL(curpcb) | lwp0 is running clrw %a1@(PCB_FLAGS) | clear flags /* flush TLB and turn on caches */ @@ -1077,7 +1075,7 @@ movw #PSL_USER,%...@- | in user mode clrl %...@- | stack adjust count lea %sp@(-64),%sp | construct space for D0-D7/A0-A7 - #lea _C_LABEL(lwp0),%a0 | lwp0 in a0 + lea _C_LABEL(lwp0),%a0 | lwp0 in a0 movl %sp,%a0@(L_MD_REGS) | save frame for lwp0 movl %usp,%a1 movl %a1,%sp@(FR_SP) | save user stack pointer in frame
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: he Date: Wed Aug 19 19:39:05 UTC 2009 Modified Files: src/sys/arch/atari/atari: atari_init.c Log Message: One more file needing sys/exec_aout.h. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/arch/atari/atari/atari_init.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/atari_init.c diff -u src/sys/arch/atari/atari/atari_init.c:1.83 src/sys/arch/atari/atari/atari_init.c:1.84 --- src/sys/arch/atari/atari/atari_init.c:1.83 Wed Jul 8 12:23:09 2009 +++ src/sys/arch/atari/atari/atari_init.c Wed Aug 19 19:39:05 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.83 2009/07/08 12:23:09 tsutsui Exp $ */ +/* $NetBSD: atari_init.c,v 1.84 2009/08/19 19:39:05 he Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -33,7 +33,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: atari_init.c,v 1.83 2009/07/08 12:23:09 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: atari_init.c,v 1.84 2009/08/19 19:39:05 he Exp $); #include opt_ddb.h #include opt_mbtype.h @@ -55,6 +55,7 @@ #include sys/dkbad.h #include sys/reboot.h #include sys/exec.h +#include sys/exec_aout.h #include sys/core.h #include sys/kcore.h
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: he Date: Wed Aug 19 23:46:52 UTC 2009 Modified Files: src/sys/arch/atari/atari: machdep.c Log Message: Another needing sys/exec_aout.h. To generate a diff of this commit: cvs rdiff -u -r1.160 -r1.161 src/sys/arch/atari/atari/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/machdep.c diff -u src/sys/arch/atari/atari/machdep.c:1.160 src/sys/arch/atari/atari/machdep.c:1.161 --- src/sys/arch/atari/atari/machdep.c:1.160 Thu Mar 5 13:42:59 2009 +++ src/sys/arch/atari/atari/machdep.c Wed Aug 19 23:46:52 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.160 2009/03/05 13:42:59 tsutsui Exp $ */ +/* $NetBSD: machdep.c,v 1.161 2009/08/19 23:46:52 he Exp $ */ /* * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. @@ -77,7 +77,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.160 2009/03/05 13:42:59 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.161 2009/08/19 23:46:52 he Exp $); #include opt_ddb.h #include opt_compat_netbsd.h @@ -106,6 +106,7 @@ #include sys/ksyms.h #include sys/intr.h #include sys/exec.h +#include sys/exec_aout.h #include sys/cpu.h #if defined(DDB) defined(__ELF__) #include sys/exec_elf.h
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Wed Jul 1 13:44:33 UTC 2009 Modified Files: src/sys/arch/atari/atari: atari_init.c Log Message: Define and use macro to calculate kernel physical addresses after relocation to TT RAM. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/arch/atari/atari/atari_init.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/atari/atari/atari_init.c diff -u src/sys/arch/atari/atari/atari_init.c:1.79 src/sys/arch/atari/atari/atari_init.c:1.80 --- src/sys/arch/atari/atari/atari_init.c:1.79 Wed Mar 18 16:00:10 2009 +++ src/sys/arch/atari/atari/atari_init.c Wed Jul 1 13:44:32 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.79 2009/03/18 16:00:10 cegger Exp $ */ +/* $NetBSD: atari_init.c,v 1.80 2009/07/01 13:44:32 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -33,7 +33,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: atari_init.c,v 1.79 2009/03/18 16:00:10 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: atari_init.c,v 1.80 2009/07/01 13:44:32 tsutsui Exp $); #include opt_ddb.h #include opt_mbtype.h @@ -153,6 +153,8 @@ #endif int reloc_kernel = RELOC_KERNEL; /* Patchable */ +#define RELOC_PA(base, pa) ((base) + (pa)) /* used to set up PTE etc. */ + /* * this is the C-level entry function, it's called from locore.s. * Preconditions: @@ -358,7 +360,7 @@ * - Text pages are RO * - Page zero is invalid */ - pg_proto = (0 + kbase) /* relocated PA */ | PG_RO | PG_V; + pg_proto = RELOC_PA(kbase, 0) | PG_RO | PG_V; pg = (pt_entry_t *)ptpa; *pg++= PG_NV; @@ -934,8 +936,8 @@ sg = (st_entry_t *)sysseg_pa; pg = (pt_entry_t *)sysptmap_pa; epg = pg[ptsize PGSHIFT]; - sg_proto = (ptpa + kbase) /* relocated PA */ | SG_RW | SG_V; - pg_proto = (ptpa + kbase) /* relocated PA */ | PG_RW | PG_CI | PG_V; + sg_proto = RELOC_PA(kbase, ptpa) | SG_RW | SG_V; + pg_proto = RELOC_PA(kbase, ptpa) | PG_RW | PG_CI | PG_V; while (pg epg) { *sg++ = sg_proto; *pg++ = pg_proto; @@ -962,8 +964,8 @@ sg = sg[256 - 1]; /* XXX should be TIA_SIZE */ pg = (pt_entry_t *)sysptmap_pa; pg = pg[256 - 1]; /* XXX should be TIA_SIZE */ - *sg = (sysptmap_pa + kbase) /* relocated PA */ | SG_RW | SG_V; - *pg = (sysptmap_pa + kbase) /* relocated PA */ | PG_RW | PG_CI | PG_V; + *sg = RELOC_PA(kbase, sysptmap_pa) | SG_RW | SG_V; + *pg = RELOC_PA(kbase, sysptmap_pa) | PG_RW | PG_CI | PG_V; } #if defined(M68040) || defined(M68060) @@ -1001,7 +1003,7 @@ sg = (st_entry_t *)sysseg_pa; sg = sg[SG4_LEV1SIZE]; esg = sg[nl2desc]; - sg_proto = (ptpa + kbase) /* relocated PA */ | SG_U | SG_RW | SG_V; + sg_proto = RELOC_PA(kbase, ptpa) | SG_U | SG_RW | SG_V; while (sg esg) { *sg++ = sg_proto; sg_proto += (SG4_LEV3SIZE * sizeof(st_entry_t)); @@ -1015,7 +1017,7 @@ nl1desc = howmany(nl2desc, SG4_LEV2SIZE); sg = (st_entry_t *)sysseg_pa; esg = sg[nl1desc]; - sg_proto = ((paddr_t)sg[SG4_LEV1SIZE] + kbase) /* relocated PA */ + sg_proto = RELOC_PA(kbase, (paddr_t)sg[SG4_LEV1SIZE]) | SG_U | SG_RW | SG_V; while (sg esg) { *sg++ = sg_proto; @@ -1034,8 +1036,7 @@ sg = (st_entry_t *)sysseg_pa; sg = sg[i + SG4_LEV2SIZE - (NPTEPG / SG4_LEV3SIZE)]; esg = sg[NPTEPG / SG4_LEV3SIZE]; - sg_proto = (sysptmap_pa + kbase) /* relocated PA */ - | SG_U | SG_RW | SG_V; + sg_proto = RELOC_PA(kbase, sysptmap_pa) | SG_U | SG_RW | SG_V; while (sg esg) { *sg++ = sg_proto; sg_proto += (SG4_LEV3SIZE * sizeof(st_entry_t)); @@ -1049,7 +1050,7 @@ */ pg = (pt_entry_t *)sysptmap_pa; epg = pg[ptsize PGSHIFT]; - pg_proto = (ptpa + kbase) /* relocated PA */ | PG_RW | PG_CI | PG_V; + pg_proto = RELOC_PA(kbase + ptpa) | PG_RW | PG_CI | PG_V; while (pg epg) { *pg++ = pg_proto; pg_proto += PAGE_SIZE; @@ -1068,7 +1069,7 @@ */ pg = (pt_entry_t *)sysptmap_pa; pg = pg[256 - 1]; /* XXX: should be TIA_SIZE */ - *pg = (sysptmap_pa + kbase) /* relocated PA */ | PG_RW | PG_CI | PG_V; + *pg = RELOC_PA(kbase, sysptmap_pa) | PG_RW | PG_CI | PG_V; } #endif /* M68040 */