use a merged sys_machdep.c for all the motorola-MMU m68k platforms.

This commit is contained in:
chs 2002-11-03 02:29:37 +00:00
parent 302149111d
commit 95aae207e0
20 changed files with 84 additions and 2219 deletions

View File

@ -1,244 +0,0 @@
/* $NetBSD: sys_machdep.c,v 1.33 2002/01/28 09:56:48 aymeric Exp $ */
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sys_machdep.c 7.7 (Berkeley) 5/7/91
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.33 2002/01/28 09:56:48 aymeric Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_extern.h>
#include <machine/cpu.h>
#include <m68k/cacheops.h>
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
#define CC_FLUSH 2
#define CC_IPURGE 4
#define CC_EXTPURGE 0x80000000
/* XXX end should be */
/*ARGSUSED1*/
int
cachectl1(req, addr, len, p)
unsigned long req;
vaddr_t addr;
size_t len;
struct proc *p;
{
int error = 0;
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
register int inc = 0;
int doall = 0;
vaddr_t end = 0;
paddr_t pa = 0;
if (addr == 0
#if defined(M68040)
#if defined(M68060)
|| (cputype == CPU_68040 && req & CC_IPURGE)
#else
|| (req & CC_IPURGE)
#endif
#endif
|| ((req & ~CC_EXTPURGE) != CC_PURGE
&& len > 2*NBPG))
doall = 1;
if (!doall) {
end = addr + len;
if (len <= 1024) {
addr = addr & ~0xF;
inc = 16;
} else {
addr = addr & ~PGOFSET;
inc = NBPG;
}
}
do {
/*
* Convert to physical address if needed.
* If translation fails, we perform operation on
* entire cache (XXX is this a rational thing to do?)
*/
if (!doall &&
(pa == 0 || (addr & PGOFSET) == 0)) {
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {
case CC_EXTPURGE|CC_IPURGE:
case CC_IPURGE:
if (doall) {
DCFA();
ICPA();
} else if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else if (inc == NBPG) {
DCFP(pa);
ICPP(pa);
}
break;
case CC_EXTPURGE|CC_PURGE:
case CC_PURGE:
if (doall)
DCFA(); /* note: flush not purge */
else if (inc == 16)
DCPL(pa);
else if (inc == NBPG)
DCPP(pa);
break;
case CC_EXTPURGE|CC_FLUSH:
case CC_FLUSH:
if (doall)
DCFA();
else if (inc == 16)
DCFL(pa);
else if (inc == NBPG)
DCFP(pa);
break;
default:
error = EINVAL;
break;
}
if (doall)
break;
pa += inc;
addr += inc;
} while (addr < end);
return(error);
}
#endif /* M68040 */
switch (req) {
case CC_EXTPURGE|CC_PURGE:
case CC_EXTPURGE|CC_FLUSH:
case CC_PURGE:
case CC_FLUSH:
DCIU();
break;
case CC_EXTPURGE|CC_IPURGE:
DCIU();
/*FALLTHROUGH*/
case CC_IPURGE:
ICIA();
break;
default:
error = EINVAL;
break;
}
return(error);
}
/*
* DMA cache control
*/
/*ARGSUSED1*/
int
dma_cachectl(addr, len)
caddr_t addr;
int len;
{
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
register int inc = 0;
int pa = 0;
caddr_t end;
end = addr + len;
if (len <= 1024) {
addr = (caddr_t)((int)addr & ~0xF);
inc = 16;
} else {
addr = (caddr_t)((int)addr & ~PGOFSET);
inc = NBPG;
}
do {
/*
* Convert to physical address.
*/
if (pa == 0 || ((int)addr & PGOFSET) == 0) {
pa = kvtop (addr);
}
if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else {
DCFP(pa);
ICPP(pa);
}
pa += inc;
addr += inc;
} while (addr < end);
}
#endif /* M68040 */
return(0);
}
int
sys_sysarch(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
#ifdef notyet
struct sys_sysarch_args /* {
syscallarg(int) op;
syscallarg(void *) parms;
} */ *uap = v;
#endif
return (ENOSYS);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: files.amiga,v 1.126 2002/11/02 20:26:37 chs Exp $
# $NetBSD: files.amiga,v 1.127 2002/11/03 02:29:38 chs Exp $
# maxpartitions must be first item in files.${ARCH}.newconf
maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
@ -445,12 +445,12 @@ file arch/amiga/amiga/machdep.c
file arch/amiga/amiga/mem.c
file arch/amiga/amiga/pmap.c
file arch/amiga/amiga/procfs_machdep.c procfs
file arch/amiga/amiga/sys_machdep.c
file arch/amiga/amiga/trap.c
file arch/amiga/amiga/cc.c
file dev/md_root.c memory_disk_hooks
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
define gayle

View File

@ -1,242 +0,0 @@
/* $NetBSD: sys_machdep.c,v 1.24 2000/12/13 18:13:06 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sys_machdep.c 7.7 (Berkeley) 5/7/91
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_extern.h>
#include <m68k/cpu.h>
#include <m68k/cacheops.h>
#include <machine/cpu.h>
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
#define CC_FLUSH 2
#define CC_IPURGE 4
#define CC_EXTPURGE 0x80000000
/* XXX end should be */
/*ARGSUSED1*/
int
cachectl1(req, addr, len, p)
unsigned long req;
vaddr_t addr;
size_t len;
struct proc *p;
{
int error = 0;
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
register int inc = 0;
int doall = 0;
vaddr_t end = 0;
paddr_t pa = 0;
if (addr == 0 ||
#if defined(M68040)
#if defined(M68060)
(cputype == CPU_68040 && req & CC_IPURGE) ||
#else
(req & CC_IPURGE) ||
#endif
#endif
((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG))
doall = 1;
if (!doall) {
end = addr + len;
if (len <= 1024) {
addr = addr & ~0xF;
inc = 16;
} else {
addr = addr & ~PGOFSET;
inc = NBPG;
}
}
do {
/*
* Convert to physical address if needed.
* If translation fails, we perform operation on
* entire cache (XXX is this a rational thing to do?)
*/
if (!doall &&
(pa == 0 || (addr & PGOFSET) == 0)) {
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {
case CC_EXTPURGE|CC_IPURGE:
case CC_IPURGE:
if (doall) {
DCFA();
ICPA();
} else if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else if (inc == NBPG) {
DCFP(pa);
ICPP(pa);
}
break;
case CC_EXTPURGE|CC_PURGE:
case CC_PURGE:
if (doall)
DCFA(); /* note: flush not purge */
else if (inc == 16)
DCPL(pa);
else if (inc == NBPG)
DCPP(pa);
break;
case CC_EXTPURGE|CC_FLUSH:
case CC_FLUSH:
if (doall)
DCFA();
else if (inc == 16)
DCFL(pa);
else if (inc == NBPG)
DCFP(pa);
break;
default:
error = EINVAL;
break;
}
if (doall)
break;
pa += inc;
addr += inc;
} while (addr < end);
return(error);
}
#endif /* M68040 */
switch (req) {
case CC_EXTPURGE|CC_PURGE:
case CC_EXTPURGE|CC_FLUSH:
case CC_PURGE:
case CC_FLUSH:
DCIU();
break;
case CC_EXTPURGE|CC_IPURGE:
DCIU();
/*FALLTHROUGH*/
case CC_IPURGE:
ICIA();
break;
default:
error = EINVAL;
break;
}
return(error);
}
/*
* DMA cache control
*/
/*ARGSUSED1*/
int
dma_cachectl(addr, len)
caddr_t addr;
int len;
{
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
register int inc = 0;
int pa = 0;
caddr_t end;
end = addr + len;
if (len <= 1024) {
addr = (caddr_t)((int)addr & ~0xF);
inc = 16;
} else {
addr = (caddr_t)((int)addr & ~PGOFSET);
inc = NBPG;
}
do {
/*
* Convert to physical address.
*/
if (pa == 0 || ((int)addr & PGOFSET) == 0) {
pa = kvtop ((caddr_t)addr);
}
if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else {
DCFP(pa);
ICPP(pa);
}
pa += inc;
addr += inc;
} while (addr < end);
}
#endif /* M68040 */
return(0);
}
int
sys_sysarch(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
#ifdef notyet
struct sys_sysarch_args /* {
syscallarg(int) op;
syscallarg(void *) parms;
} */ *uap = v;
#endif
return (ENOSYS);
}

View File

@ -1,5 +1,5 @@
#
# $NetBSD: files.atari,v 1.99 2002/11/02 20:26:37 chs Exp $
# $NetBSD: files.atari,v 1.100 2002/11/03 02:29:39 chs Exp $
maxpartitions 16
@ -201,7 +201,6 @@ file arch/atari/atari/mainbus.c
file arch/atari/atari/mem.c
file arch/atari/atari/pmap.c
file arch/atari/atari/procfs_machdep.c procfs
file arch/atari/atari/sys_machdep.c
file arch/atari/atari/trap.c
file arch/atari/atari/stalloc.c
file arch/atari/atari/fpu.c
@ -209,6 +208,7 @@ file arch/atari/dev/ym2149.c _atarihw_
file arch/atari/atari/intr.c
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
# Emulation modules

View File

@ -1,223 +0,0 @@
/* $NetBSD: sys_machdep.c,v 1.2 2002/10/20 02:37:23 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sys_machdep.c 8.2 (Berkeley) 1/13/94
*/
#include "opt_compat_hpux.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <uvm/uvm_extern.h>
#include <sys/syscallargs.h>
#include <machine/cpu.h>
#include <m68k/cacheops.h>
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
#define CC_FLUSH 2
#define CC_IPURGE 4
#define CC_EXTPURGE 0x80000000
/* XXX end should be */
/*
* Note that what we do here for a 68040 is different than HP-UX.
*
* In 'pux they either act on a line (len == 16), a page (len == NBPG)
* or the whole cache (len == anything else).
*
* In BSD we attempt to be more optimal when acting on "odd" sizes.
* For lengths up to 1024 we do all affected lines, up to 2*NBPG we
* do pages, above that we do the entire cache.
*/
/*ARGSUSED1*/
int
cachectl1(req, addr, len, p)
unsigned long req;
vaddr_t addr;
size_t len;
struct proc *p;
{
int error = 0;
#if defined(M68040)
if (mmutype == MMU_68040) {
int inc = 0;
int doall = 0;
paddr_t pa = 0;
vaddr_t end = 0;
#ifdef COMPAT_HPUX
extern struct emul emul_hpux;
if ((p->p_emul == &emul_hpux) &&
len != 16 && len != NBPG)
doall = 1;
#endif
if (addr == 0 ||
#if defined(M68040)
#if defined(M68060)
(cputype == CPU_68040 && req & CC_IPURGE) ||
#else
(req & CC_IPURGE) ||
#endif
#endif
((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG))
doall = 1;
if (!doall) {
end = addr + len;
if (len <= 1024) {
addr = addr & ~0xF;
inc = 16;
} else {
addr = addr & ~PGOFSET;
inc = NBPG;
}
}
do {
/*
* Convert to physical address if needed.
* If translation fails, we perform operation on
* entire cache (XXX is this a rational thing to do?)
*/
if (!doall &&
(pa == 0 || ((int)addr & PGOFSET) == 0)) {
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {
case CC_EXTPURGE|CC_IPURGE:
case CC_IPURGE:
if (doall) {
DCFA();
ICPA();
} else if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else if (inc == NBPG) {
DCFP(pa);
ICPP(pa);
}
break;
case CC_EXTPURGE|CC_PURGE:
case CC_PURGE:
if (doall)
DCFA(); /* note: flush not purge */
else if (inc == 16)
DCPL(pa);
else if (inc == NBPG)
DCPP(pa);
break;
case CC_EXTPURGE|CC_FLUSH:
case CC_FLUSH:
if (doall)
DCFA();
else if (inc == 16)
DCFL(pa);
else if (inc == NBPG)
DCFP(pa);
break;
default:
error = EINVAL;
break;
}
if (doall)
break;
pa += inc;
addr += inc;
} while (addr < end);
return (error);
}
#endif
switch (req) {
case CC_EXTPURGE|CC_PURGE:
case CC_EXTPURGE|CC_FLUSH:
#if defined(CACHE_HAVE_PAC)
if (ectype == EC_PHYS)
PCIA();
/* fall into... */
#endif
case CC_PURGE:
case CC_FLUSH:
DCIU();
break;
case CC_EXTPURGE|CC_IPURGE:
#if defined(CACHE_HAVE_PAC)
if (ectype == EC_PHYS)
PCIA();
else
#endif
DCIU();
/* fall into... */
case CC_IPURGE:
ICIA();
break;
default:
error = EINVAL;
break;
}
return (error);
}
int
sys_sysarch(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
#if 0 /* unused */
struct sys_sysarch_args /* {
syscallarg(int) op;
syscallarg(char *) parms;
} */ *uap = v;
#endif
return ENOSYS;
}

View File

@ -1,4 +1,4 @@
# $NetBSD: files.cesfic,v 1.9 2002/11/03 01:11:59 chs Exp $
# $NetBSD: files.cesfic,v 1.10 2002/11/03 02:29:39 chs Exp $
#
# cesfic-specific configuration info
@ -54,11 +54,11 @@ file arch/cesfic/cesfic/isr.c
file arch/cesfic/cesfic/mem.c
file arch/cesfic/cesfic/pmap.c
file arch/cesfic/cesfic/pmap_bootstrap.c
file arch/cesfic/cesfic/sys_machdep.c
file arch/cesfic/cesfic/trap.c
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb | kgdb
file arch/m68k/m68k/kgdb_machdep.c kgdb
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
file dev/cons.c

View File

@ -1,4 +1,4 @@
# $NetBSD: files.hp300,v 1.60 2002/11/03 01:11:59 chs Exp $
# $NetBSD: files.hp300,v 1.61 2002/11/03 02:29:39 chs Exp $
#
# hp300-specific configuration info
@ -199,13 +199,13 @@ file arch/hp300/hp300/pmap.c
file arch/hp300/hp300/pmap_bootstrap.c compile-with "${NOPROF_C}"
file arch/hp300/hp300/procfs_machdep.c procfs
file arch/hp300/hp300/softintr.c
file arch/hp300/hp300/sys_machdep.c
file arch/hp300/hp300/trap.c
file arch/hp300/hp300/disksubr.c
file arch/hp300/dev/dma.c
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb | kgdb
file arch/m68k/m68k/kgdb_machdep.c kgdb
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
file dev/clock_subr.c

View File

@ -1,5 +1,5 @@
#
# $NetBSD: files.luna68k,v 1.10 2002/11/02 20:26:39 chs Exp $
# $NetBSD: files.luna68k,v 1.11 2002/11/03 02:29:40 chs Exp $
#
maxpartitions 8
maxusers 2 8 64
@ -13,10 +13,10 @@ file arch/luna68k/luna68k/mem.c
file arch/luna68k/luna68k/pmap.c
file arch/luna68k/luna68k/pmap_bootstrap.c
file arch/luna68k/luna68k/procfs_machdep.c procfs
file arch/luna68k/luna68k/sys_machdep.c
file arch/luna68k/luna68k/trap.c
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb | kgdb
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
file dev/clock_subr.c
file dev/cons.c

View File

@ -1,255 +0,0 @@
/* $NetBSD: sys_machdep.c,v 1.4 2000/12/13 18:13:07 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sys_machdep.c 8.2 (Berkeley) 1/13/94
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.4 2000/12/13 18:13:07 jdolecek Exp $");
#include "opt_compat_hpux.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <uvm/uvm_extern.h>
#include <sys/syscallargs.h>
#include <machine/cpu.h>
#include <m68k/cacheops_30.h>
#include <m68k/cacheops_40.h>
#include <machine/cpu.h>
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
#define CC_FLUSH 2
#define CC_IPURGE 4
#define CC_EXTPURGE 0x80000000
/* XXX end should be */
/*
* Note that what we do here for a 68040 is different than HP-UX.
*
* In 'pux they either act on a line (len == 16), a page (len == NBPG)
* or the whole cache (len == anything else).
*
* In BSD we attempt to be more optimal when acting on "odd" sizes.
* For lengths up to 1024 we do all affected lines, up to 2*NBPG we
* do pages, above that we do the entire cache.
*/
/*ARGSUSED1*/
int
cachectl1(req, addr, len, p)
unsigned long req;
vaddr_t addr;
size_t len;
struct proc *p;
{
int error = 0;
#if defined(M68040)
if (mmutype == MMU_68040) {
int inc = 0, doall = 0;
paddr_t pa = 0;
vaddr_t end;
if (addr == 0 ||
((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG))
doall = 1;
if (!doall) {
end = addr + len;
if (len <= 1024) {
addr = addr & ~0xF;
inc = 16;
} else {
addr = addr & ~PGOFSET;
inc = NBPG;
}
}
do {
/*
* Convert to physical address if needed.
* If translation fails, we perform operation on
* entire cache (XXX is this a rational thing to do?)
*/
if (!doall &&
(pa == 0 || ((int)addr & PGOFSET) == 0)) {
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {
case CC_EXTPURGE|CC_IPURGE:
case CC_IPURGE:
if (doall) {
DCFA_40();
ICPA_40();
} else if (inc == 16) {
DCFL_40(pa);
ICPL_40(pa);
} else if (inc == NBPG) {
DCFP_40(pa);
ICPP_40(pa);
}
break;
case CC_EXTPURGE|CC_PURGE:
case CC_PURGE:
if (doall)
DCFA_40(); /* note: flush not purge */
else if (inc == 16)
DCPL_40(pa);
else if (inc == NBPG)
DCPP_40(pa);
break;
case CC_EXTPURGE|CC_FLUSH:
case CC_FLUSH:
if (doall)
DCFA_40();
else if (inc == 16)
DCFL_40(pa);
else if (inc == NBPG)
DCFP_40(pa);
break;
default:
error = EINVAL;
break;
}
if (doall)
break;
pa += inc;
addr += inc;
} while (addr < end);
return(error);
}
#endif
/* see descriptions in <m68k/include/cacheops_30.h> */
#define DCIU()
#define DCIA()
#define ICIA() ICIA_30()
switch (req) {
case CC_EXTPURGE|CC_PURGE:
case CC_EXTPURGE|CC_FLUSH:
case CC_PURGE:
case CC_FLUSH:
DCIU();
break;
case CC_EXTPURGE|CC_IPURGE:
DCIU();
/* fall into... */
case CC_IPURGE:
ICIA();
break;
default:
error = EINVAL;
break;
}
return(error);
}
/*
* DMA cache control
*/
/*ARGSUSED1*/
int
dma_cachectl(addr, len)
caddr_t addr;
int len;
{
#if defined(M68040)
if (mmutype == MMU_68040) {
int inc = 0;
int pa = 0;
caddr_t end;
end = addr + len;
if (len <= 1024) {
addr = (caddr_t)((int)addr & ~0xF);
inc = 16;
} else {
addr = (caddr_t)((int)addr & ~PGOFSET);
inc = NBPG;
}
do {
/*
* Convert to physical address.
*/
if (pa == 0 || ((int)addr & PGOFSET) == 0) {
pa = kvtop(addr);
}
if (inc == 16) {
DCFL_40(pa);
ICPL_40(pa);
} else {
DCFP_40(pa);
ICPP_40(pa);
}
pa += inc;
addr += inc;
} while (addr < end);
}
#endif /* M68040 */
return(0);
}
int
sys_sysarch(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
#if 0 /* unused */
struct sys_sysarch_args /* {
syscallarg(int) op;
syscallarg(void *) parms;
} */ *uap = v;
#endif
return (ENOSYS);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_machdep.c,v 1.32 2002/10/20 02:37:26 chs Exp $ */
/* $NetBSD: sys_machdep.c,v 1.1 2002/11/03 02:29:40 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -36,21 +36,12 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.32 2002/10/20 02:37:26 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD");
#include "opt_compat_hpux.h"
#include <machine/hp300spu.h> /* XXX param.h includes cpu.h */
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <uvm/uvm_extern.h>
@ -68,7 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.32 2002/10/20 02:37:26 chs Exp $")
/* XXX end should be */
/*
* Note that what we do here for a 68040 is different than HP-UX.
* Note that what we do here on 040/060 for BSD is different than for HP-UX.
*
* In 'pux they either act on a line (len == 16), a page (len == NBPG)
* or the whole cache (len == anything else).
@ -87,10 +78,10 @@ cachectl1(req, addr, len, p)
{
int error = 0;
#if defined(M68040)
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
int inc = 0;
int doall = 0;
boolean_t doall = FALSE;
paddr_t pa = 0;
vaddr_t end = 0;
#ifdef COMPAT_HPUX
@ -102,20 +93,18 @@ cachectl1(req, addr, len, p)
#endif
if (addr == 0 ||
#if defined(M68040)
#if defined(M68060)
(cputype == CPU_68040 && req & CC_IPURGE) ||
#else
(req & CC_IPURGE) ||
#endif
#endif
((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG))
((req & ~CC_EXTPURGE) != CC_PURGE && len > 2 * NBPG))
doall = 1;
if (!doall) {
end = addr + len;
if (len <= 1024) {
addr = addr & ~0xF;
addr = addr & ~0xf;
inc = 16;
} else {
addr = addr & ~PGOFSET;
@ -126,10 +115,10 @@ cachectl1(req, addr, len, p)
/*
* Convert to physical address if needed.
* If translation fails, we perform operation on
* entire cache (XXX is this a rational thing to do?)
* entire cache.
*/
if (!doall &&
(pa == 0 || ((int)addr & PGOFSET) == 0)) {
(pa == 0 || m68k_page_offset(addr) == 0)) {
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
@ -148,7 +137,7 @@ cachectl1(req, addr, len, p)
ICPP(pa);
}
break;
case CC_EXTPURGE|CC_PURGE:
case CC_PURGE:
if (doall)
@ -168,7 +157,7 @@ cachectl1(req, addr, len, p)
else if (inc == NBPG)
DCFP(pa);
break;
default:
error = EINVAL;
break;
@ -178,7 +167,7 @@ cachectl1(req, addr, len, p)
pa += inc;
addr += inc;
} while (addr < end);
return(error);
return (error);
}
#endif
switch (req) {
@ -208,7 +197,7 @@ cachectl1(req, addr, len, p)
error = EINVAL;
break;
}
return(error);
return (error);
}
int
@ -217,12 +206,57 @@ sys_sysarch(p, v, retval)
void *v;
register_t *retval;
{
#if 0 /* unused */
struct sys_sysarch_args /* {
syscallarg(int) op;
syscallarg(void *) parms;
} */ *uap = v;
#endif
return (ENOSYS);
}
#if defined(amiga) || defined(x68k)
/*
* DMA cache control
*/
/*ARGSUSED1*/
int
dma_cachectl(addr, len)
caddr_t addr;
int len;
{
#if defined(M68040) || defined(M68060)
int inc = 0;
int pa = 0;
caddr_t end;
if (mmutype != MMU_68040) {
return (0);
}
end = addr + len;
if (len <= 1024) {
addr = (caddr_t)((vaddr_t)addr & ~0xf);
inc = 16;
} else {
addr = (caddr_t)((vaddr_t)addr & ~PGOFSET);
inc = NBPG;
}
do {
/*
* Convert to physical address.
*/
if (pa == 0 || ((vaddr_t)addr & PGOFSET) == 0) {
pa = kvtop(addr);
}
if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else {
DCFP(pa);
ICPP(pa);
}
pa += inc;
addr += inc;
} while (addr < end);
#endif /* defined(M68040) || defined(M68060) */
return (0);
}
#endif /* defined(amiga) || defined(x68k) */

View File

@ -1,4 +1,4 @@
# $NetBSD: files.mac68k,v 1.110 2002/11/03 01:12:01 chs Exp $
# $NetBSD: files.mac68k,v 1.111 2002/11/03 02:29:41 chs Exp $
# mac68k-specific configuration info
@ -174,13 +174,13 @@ file arch/mac68k/mac68k/pram.c
file arch/mac68k/mac68k/pramasm.s
file arch/mac68k/mac68k/procfs_machdep.c procfs
file arch/mac68k/mac68k/psc.c
file arch/mac68k/mac68k/sys_machdep.c
file arch/mac68k/mac68k/trap.c
file arch/mac68k/mac68k/via.c
file arch/m68k/m68k/bus_dma.c
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb | kgdb
file arch/m68k/m68k/kgdb_machdep.c kgdb
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
file arch/mac68k/dev/grf_compat.c grf needs-flag

View File

@ -1,244 +0,0 @@
/* $NetBSD: sys_machdep.c,v 1.19 2002/10/28 00:55:16 chs Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*-
* Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
* Michael L. Finch, Bradley A. Grantham, and
* Lawrence A. Kesteloot
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the Alice Group.
* 4. The names of the Alice Group or any of its members may not be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*
* @(#)sys_machdep.c 7.7 (Berkeley) 5/7/91
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <uvm/uvm_extern.h>
#include <sys/syscallargs.h>
#include <m68k/cacheops.h>
#include <machine/cpu.h>
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
#define CC_FLUSH 2
#define CC_IPURGE 4
#define CC_EXTPURGE 0x80000000
/* XXX end should be */
/*
* Note that what we do here for a 68040 is different than HP-UX.
*
* In 'pux they either act on a line (len == 16), a page (len == NBPG)
* or the whole cache (len == anything else).
*
* In BSD we attempt to be more optimal when acting on "odd" sizes.
* For lengths up to 1024 we do all affected lines, up to 2*NBPG we
* do pages, above that we do the entire cache.
*/
/*ARGSUSED1*/
int
cachectl1(req, addr, len, p)
unsigned long req;
vaddr_t addr;
size_t len;
struct proc *p;
{
int error = 0;
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
int inc = 0;
int doall = 0;
paddr_t pa = 0;
vaddr_t end = 0;
#ifdef COMPAT_HPUX
extern struct emul emul_hpux;
if ((p->p_emul == &emul_hpux) &&
len != 16 && len != NBPG)
doall = 1;
#endif
if (addr == 0 ||
#if defined(M68040)
#if defined(M68060)
(cputype == CPU_68040 && req & CC_IPURGE) ||
#else
(req & CC_IPURGE) ||
#endif
#endif
((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG))
doall = 1;
if (!doall) {
end = addr + len;
if (len <= 1024) {
addr = addr & ~0xF;
inc = 16;
} else {
addr = m68k_trunc_page(addr);
inc = NBPG;
}
}
do {
/*
* Convert to physical address if needed.
* If translation fails, we perform operation on
* entire cache (XXX is this a rational thing to do?)
*/
if (!doall &&
(pa == 0 || m68k_page_offset(addr) == 0)) {
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {
case CC_EXTPURGE|CC_IPURGE:
case CC_IPURGE:
if (doall) {
DCFA();
ICPA();
} else if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else if (inc == NBPG) {
DCFP(pa);
ICPP(pa);
}
break;
case CC_EXTPURGE|CC_PURGE:
case CC_PURGE:
if (doall)
DCFA(); /* note: flush not purge */
else if (inc == 16)
DCPL(pa);
else if (inc == NBPG)
DCPP(pa);
break;
case CC_EXTPURGE|CC_FLUSH:
case CC_FLUSH:
if (doall)
DCFA();
else if (inc == 16)
DCFL(pa);
else if (inc == NBPG)
DCFP(pa);
break;
default:
error = EINVAL;
break;
}
if (doall)
break;
pa += inc;
addr += inc;
} while (addr < end);
return(error);
}
#endif
switch (req) {
case CC_EXTPURGE|CC_PURGE:
case CC_EXTPURGE|CC_FLUSH:
case CC_PURGE:
case CC_FLUSH:
DCIU();
break;
case CC_EXTPURGE|CC_IPURGE:
DCIU();
/* fall into... */
case CC_IPURGE:
ICIA();
break;
default:
error = EINVAL;
break;
}
return(error);
}
int sys_sysarch(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
#if 0
struct sysarch_args /* {
syscallarg(int) op;
syscallarg(void *) parms;
} */ *uap = v;
#endif
return (ENOSYS);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: files.mvme68k,v 1.54 2002/11/02 20:26:40 chs Exp $
# $NetBSD: files.mvme68k,v 1.55 2002/11/03 02:29:41 chs Exp $
# config file for mvme68k
@ -97,10 +97,10 @@ file arch/mvme68k/mvme68k/pmap.c
file arch/mvme68k/mvme68k/pmap_bootstrap.c compile-with "${NOPROF_C}"
file arch/mvme68k/mvme68k/procfs_machdep.c procfs
file arch/mvme68k/mvme68k/softintr.c
file arch/mvme68k/mvme68k/sys_machdep.c
file arch/mvme68k/mvme68k/trap.c
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb | kgdb
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
file dev/clock_subr.c
file dev/cons.c

View File

@ -1,265 +0,0 @@
/* $NetBSD: sys_machdep.c,v 1.24 2000/12/20 16:53:50 scw Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sys_machdep.c 8.2 (Berkeley) 1/13/94
*/
#include "opt_compat_hpux.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <uvm/uvm_extern.h>
#include <sys/syscallargs.h>
#include <machine/cpu.h>
#include <m68k/cacheops.h>
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
#define CC_FLUSH 2
#define CC_IPURGE 4
#define CC_EXTPURGE 0x80000000
/* XXX end should be */
/*
* Note that what we do here for a 68040 is different than HP-UX.
*
* In 'pux they either act on a line (len == 16), a page (len == NBPG)
* or the whole cache (len == anything else).
*
* In BSD we attempt to be more optimal when acting on "odd" sizes.
* For lengths up to 1024 we do all affected lines, up to 2*NBPG we
* do pages, above that we do the entire cache.
*/
/*ARGSUSED1*/
int
cachectl1(req, addr, len, p)
unsigned long req;
vaddr_t addr;
size_t len;
struct proc *p;
{
int error = 0;
#if defined(M68040) || defined(M68060)
#if defined(M68020) || defined(M68030)
if (mmutype == MMU_68040)
#endif
{
int inc = 0;
int doall = 0;
paddr_t pa = 0;
vaddr_t end = 0;
#ifdef COMPAT_HPUX
extern struct emul emul_hpux;
if ((p->p_emul == &emul_hpux) &&
len != 16 && len != NBPG)
doall = 1;
#endif
if (addr == 0 ||
#if defined(M68040)
#if defined(M68060)
(cputype == CPU_68040 && req & CC_IPURGE) ||
#else
(req & CC_IPURGE) ||
#endif
#endif
((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG))
doall = 1;
if (!doall) {
end = addr + len;
if (len <= 1024) {
addr = addr & ~0xF;
inc = 16;
} else {
addr = addr & ~PGOFSET;
inc = NBPG;
}
}
do {
/*
* Convert to physical address if needed.
* If translation fails, we perform operation on
* entire cache (XXX is this a rational thing to do?)
*/
if (!doall &&
(pa == 0 || ((int)addr & PGOFSET) == 0)) {
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {
case CC_EXTPURGE|CC_IPURGE:
case CC_IPURGE:
if (doall) {
DCFA();
ICPA();
} else if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else if (inc == NBPG) {
DCFP(pa);
ICPP(pa);
}
break;
case CC_EXTPURGE|CC_PURGE:
case CC_PURGE:
if (doall)
DCFA(); /* note: flush not purge */
else if (inc == 16)
DCPL(pa);
else if (inc == NBPG)
DCPP(pa);
break;
case CC_EXTPURGE|CC_FLUSH:
case CC_FLUSH:
if (doall)
DCFA();
else if (inc == 16)
DCFL(pa);
else if (inc == NBPG)
DCFP(pa);
break;
default:
error = EINVAL;
break;
}
if (doall)
break;
pa += inc;
addr += inc;
} while (addr < end);
return(error);
}
#endif
switch (req) {
case CC_EXTPURGE|CC_PURGE:
case CC_EXTPURGE|CC_FLUSH:
case CC_PURGE:
case CC_FLUSH:
DCIU();
break;
case CC_EXTPURGE|CC_IPURGE:
DCIU();
/* fall into... */
case CC_IPURGE:
ICIA();
break;
default:
error = EINVAL;
break;
}
return(error);
}
/*
* DMA cache control
*/
/*ARGSUSED1*/
int
dma_cachectl(addr, len)
caddr_t addr;
int len;
{
#if defined(M68040) || defined(M68060)
#if defined(M68020) || defined(M68030)
if (mmutype == MMU_68040)
#endif
{
register int inc = 0;
int pa = 0;
caddr_t end;
end = addr + len;
if (len <= 1024) {
addr = (caddr_t)((int)addr & ~0xF);
inc = 16;
} else {
addr = (caddr_t)((int)addr & ~PGOFSET);
inc = NBPG;
}
do {
/*
* Convert to physical address.
*/
if (pa == 0 || ((int)addr & PGOFSET) == 0) {
pa = kvtop (addr);
}
if (inc == 16) {
DCFL_40(pa); /* 040 versions work for 060 */
ICPL_40(pa);
} else {
DCFP_40(pa); /* 040 versions work for 060 */
ICPP_40(pa);
}
pa += inc;
addr += inc;
} while (addr < end);
}
#endif /* M68040 || M68060 */
return(0);
}
int
sys_sysarch(p, v, retval)
struct proc *p;
void *v;
int *retval;
{
#if 0 /* unused */
struct sysarch_args /* {
syscallarg(int) op;
syscallarg(void *) parms;
} */ *uap = v;
#endif
return (ENOSYS);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: files.news68k,v 1.20 2002/11/02 20:26:40 chs Exp $
# $NetBSD: files.news68k,v 1.21 2002/11/03 02:29:42 chs Exp $
# NEWS68K-specific configuration info
@ -24,10 +24,10 @@ file arch/news68k/news68k/mem.c
file arch/news68k/news68k/pmap.c
file arch/news68k/news68k/pmap_bootstrap.c compile-with "${NOPROF_C}"
file arch/news68k/news68k/procfs_machdep.c procfs
file arch/news68k/news68k/sys_machdep.c
file arch/news68k/news68k/trap.c
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb | kgdb
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
file dev/clock_subr.c
file dev/cons.c

View File

@ -1,211 +0,0 @@
/* $NetBSD: sys_machdep.c,v 1.5 2002/10/20 02:37:31 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sys_machdep.c 8.2 (Berkeley) 1/13/94
*/
#include "opt_compat_hpux.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/mount.h>
#include <uvm/uvm_extern.h>
#include <sys/syscallargs.h>
#include <machine/cpu.h>
#include <m68k/cacheops.h>
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
#define CC_FLUSH 2
#define CC_IPURGE 4
#define CC_EXTPURGE 0x80000000
/* XXX end should be */
/*
* Note that what we do here for a 68040 is different than HP-UX.
*
* In 'pux they either act on a line (len == 16), a page (len == NBPG)
* or the whole cache (len == anything else).
*
* In BSD we attempt to be more optimal when acting on "odd" sizes.
* For lengths up to 1024 we do all affected lines, up to 2*NBPG we
* do pages, above that we do the entire cache.
*/
/*ARGSUSED1*/
int
cachectl1(req, addr, len, p)
unsigned long req;
vaddr_t addr;
size_t len;
struct proc *p;
{
int error = 0;
#if defined(M68040)
if (mmutype == MMU_68040) {
int inc = 0;
int doall = 0;
paddr_t pa = 0;
vaddr_t end = 0;
#ifdef COMPAT_HPUX
extern struct emul emul_hpux;
if ((p->p_emul == &emul_hpux) &&
len != 16 && len != NBPG)
doall = 1;
#endif
if (addr == 0 ||
((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG))
doall = 1;
if (!doall) {
end = addr + len;
if (len <= 1024) {
addr = addr & ~0xF;
inc = 16;
} else {
addr = m68k_trunc_page(addr);
inc = NBPG;
}
}
do {
/*
* Convert to physical address if needed.
* If translation fails, we perform operation on
* entire cache (XXX is this a rational thing to do?)
*/
if (!doall &&
(pa == 0 || m68k_page_offset(addr) == 0)) {
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {
case CC_EXTPURGE|CC_IPURGE:
case CC_IPURGE:
if (doall) {
DCFA();
ICPA();
} else if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else if (inc == NBPG) {
DCFP(pa);
ICPP(pa);
}
break;
case CC_EXTPURGE|CC_PURGE:
case CC_PURGE:
if (doall)
DCFA(); /* note: flush not purge */
else if (inc == 16)
DCPL(pa);
else if (inc == NBPG)
DCPP(pa);
break;
case CC_EXTPURGE|CC_FLUSH:
case CC_FLUSH:
if (doall)
DCFA();
else if (inc == 16)
DCFL(pa);
else if (inc == NBPG)
DCFP(pa);
break;
default:
error = EINVAL;
break;
}
if (doall)
break;
pa += inc;
addr += inc;
} while (addr < end);
return(error);
}
#endif
switch (req) {
case CC_EXTPURGE|CC_PURGE:
case CC_EXTPURGE|CC_FLUSH:
#if defined(CACHE_HAVE_PAC)
if (ectype == EC_PHYS)
PCIA();
/* fall into... */
#endif
case CC_PURGE:
case CC_FLUSH:
DCIU();
break;
case CC_EXTPURGE|CC_IPURGE:
#if defined(CACHE_HAVE_PAC)
if (ectype == EC_PHYS)
PCIA();
else
#endif
DCIU();
/* fall into... */
case CC_IPURGE:
ICIA();
break;
default:
error = EINVAL;
break;
}
return(error);
}
int
sys_sysarch(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
#if 0 /* unused */
struct sys_sysarch_args /* {
syscallarg(int) op;
syscallarg(void *) parms;
} */ *uap = v;
#endif
return (ENOSYS);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: files.next68k,v 1.30 2002/11/03 01:12:02 chs Exp $
# $NetBSD: files.next68k,v 1.31 2002/11/03 02:29:42 chs Exp $
# next68k-specific configuration info
@ -33,6 +33,7 @@ file arch/next68k/dev/zs_kgdb.c kgdb
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb | kgdb
file arch/m68k/m68k/kgdb_machdep.c kgdb
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
# include "arch/m68k/fpe/files.fpe"
@ -45,7 +46,6 @@ file arch/next68k/next68k/procfs_machdep.c procfs
file arch/next68k/next68k/machdep.c
file arch/next68k/next68k/clock.c
file arch/next68k/next68k/conf.c
file arch/next68k/next68k/sys_machdep.c
file arch/next68k/next68k/isr.c
file arch/next68k/next68k/autoconf.c
file arch/next68k/next68k/mainbus.c

View File

@ -1,221 +0,0 @@
/* $NetBSD: sys_machdep.c,v 1.13 2001/05/13 16:55:40 chs Exp $ */
/*
* This file was taken from mvme68k/mvme68k/sys_machdep.c
* should probably be re-synced when needed.
* Darrin B. Jewell <jewell@mit.edu> Tue Nov 10 05:07:16 1998
* original cvs id: NetBSD: sys_machdep.c,v 1.12 1998/08/22 10:55:36 scw Exp
*/
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sys_machdep.c 8.2 (Berkeley) 1/13/94
*/
#include "opt_compat_hpux.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <uvm/uvm_extern.h>
#include <sys/syscallargs.h>
#include <machine/cpu.h>
#include <m68k/cacheops.h>
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
#define CC_FLUSH 2
#define CC_IPURGE 4
#define CC_EXTPURGE 0x80000000
/* XXX end should be */
/*
* Note that what we do here for a 68040 is different than HP-UX.
*
* In 'pux they either act on a line (len == 16), a page (len == NBPG)
* or the whole cache (len == anything else).
*
* In BSD we attempt to be more optimal when acting on "odd" sizes.
* For lengths up to 1024 we do all affected lines, up to 2*NBPG we
* do pages, above that we do the entire cache.
*/
/*ARGSUSED1*/
int
cachectl1(req, addr, len, p)
unsigned long req;
vaddr_t addr;
size_t len;
struct proc *p;
{
int error = 0;
#if defined(M68040)
if (mmutype == MMU_68040) {
int inc = 0;
int doall = 0;
paddr_t pa = 0;
vaddr_t end;
#ifdef COMPAT_HPUX
extern struct emul emul_hpux;
if ((p->p_emul == &emul_hpux) &&
len != 16 && len != NBPG)
doall = 1;
#endif
if (addr == 0 ||
#if defined(M68060)
(cputype == CPU_68040 && req & CC_IPURGE) ||
#else
(req & CC_IPURGE) ||
#endif
((req & ~CC_EXTPURGE) != CC_PURGE && len > 2 * NBPG))
doall = 1;
if (!doall) {
end = addr + len;
if (len <= 1024) {
addr = addr & ~0xF;
inc = 16;
} else {
addr = addr & ~PGOFSET;
inc = NBPG;
}
}
do {
/*
* Convert to physical address if needed.
* If translation fails, we perform operation on
* entire cache (XXX is this a rational thing to do?)
*/
if (!doall &&
(pa == 0 || ((int)addr & PGOFSET) == 0)) {
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {
case CC_EXTPURGE|CC_IPURGE:
case CC_IPURGE:
if (doall) {
DCFA();
ICPA();
} else if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else if (inc == NBPG) {
DCFP(pa);
ICPP(pa);
}
break;
case CC_EXTPURGE|CC_PURGE:
case CC_PURGE:
if (doall)
DCFA(); /* note: flush not purge */
else if (inc == 16)
DCPL(pa);
else if (inc == NBPG)
DCPP(pa);
break;
case CC_EXTPURGE|CC_FLUSH:
case CC_FLUSH:
if (doall)
DCFA();
else if (inc == 16)
DCFL(pa);
else if (inc == NBPG)
DCFP(pa);
break;
default:
error = EINVAL;
break;
}
if (doall)
break;
pa += inc;
addr += inc;
} while (addr < end);
return(error);
}
#endif
switch (req) {
case CC_EXTPURGE|CC_PURGE:
case CC_EXTPURGE|CC_FLUSH:
#if defined(HP370)
if (ectype == EC_PHYS)
PCIA();
/* fall into... */
#endif
case CC_PURGE:
case CC_FLUSH:
DCIU();
break;
case CC_EXTPURGE|CC_IPURGE:
#if defined(HP370)
if (ectype == EC_PHYS)
PCIA();
else
#endif
DCIU();
/* fall into... */
case CC_IPURGE:
ICIA();
break;
default:
error = EINVAL;
break;
}
return(error);
}
int
sys_sysarch(p, v, retval)
struct proc *p;
void *v;
int *retval;
{
return (ENOSYS);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: files.x68k,v 1.50 2002/11/02 20:26:42 chs Exp $
# $NetBSD: files.x68k,v 1.51 2002/11/03 02:29:43 chs Exp $
#
# new style config file for x68k architecture
#
@ -35,12 +35,12 @@ file arch/x68k/x68k/mem.c
file arch/x68k/x68k/pmap_bootstrap.c compile-with "${NOPROF_C}"
file arch/x68k/x68k/pmap.c
file arch/x68k/x68k/procfs_machdep.c procfs
file arch/x68k/x68k/sys_machdep.c
file arch/x68k/x68k/trap.c
file arch/x68k/x68k/fpu.c
file arch/x68k/x68k/bus.c
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
file dev/cons.c

View File

@ -1,264 +0,0 @@
/* $NetBSD: sys_machdep.c,v 1.25 2002/10/28 00:55:19 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sys_machdep.c 8.2 (Berkeley) 1/13/94
*/
#include "opt_m680x0.h"
#include "opt_compat_hpux.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <uvm/uvm_extern.h> /* XXX needed? */
#include <sys/syscallargs.h>
#include <m68k/cacheops.h>
#include <machine/cpu.h>
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
#define CC_FLUSH 2
#define CC_IPURGE 4
#define CC_EXTPURGE 0x80000000
/* XXX end should be */
/*
* Note that what we do here for a 68040 is different than HP-UX.
*
* In 'pux they either act on a line (len == 16), a page (len == NBPG)
* or the whole cache (len == anything else).
*
* In BSD we attempt to be more optimal when acting on "odd" sizes.
* For lengths up to 1024 we do all affected lines, up to 2*NBPG we
* do pages, above that we do the entire cache.
*/
/*ARGSUSED1*/
int
cachectl1(req, addr, len, p)
unsigned long req;
vaddr_t addr;
size_t len;
struct proc *p;
{
int error = 0;
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
int inc = 0;
int doall = 0;
vaddr_t end;
paddr_t pa = 0;
#ifdef COMPAT_HPUX
extern struct emul emul_hpux;
if ((p->p_emul == &emul_hpux) &&
len != 16 && len != NBPG)
doall = 1;
#endif
if (addr == 0 ||
#if defined(M68040)
#if defined(M68060)
(cputype == CPU_68040 && req & CC_IPURGE) ||
#else
(req & CC_IPURGE) ||
#endif
#endif
((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG))
doall = 1;
if (!doall) {
end = addr + len;
if (len <= 1024) {
addr = addr & ~0xF;
inc = 16;
} else {
addr = m68k_trunc_page(addr);
inc = NBPG;
}
}
do {
/*
* Convert to physical address if needed.
* If translation fails, we perform operation on
* entire cache (XXX is this a rational thing to do?)
*/
if (!doall &&
(pa == 0 || m68k_page_offset(addr) == 0)) {
if (pmap_extract(p->p_vmspace->vm_map.pmap,
addr, &pa) == FALSE)
doall = 1;
}
switch (req) {
case CC_EXTPURGE|CC_IPURGE:
case CC_IPURGE:
if (doall) {
DCFA();
ICPA();
} else if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else if (inc == NBPG) {
DCFP(pa);
ICPP(pa);
}
break;
case CC_EXTPURGE|CC_PURGE:
case CC_PURGE:
if (doall)
DCFA(); /* note: flush not purge */
else if (inc == 16)
DCPL(pa);
else if (inc == NBPG)
DCPP(pa);
break;
case CC_EXTPURGE|CC_FLUSH:
case CC_FLUSH:
if (doall)
DCFA();
else if (inc == 16)
DCFL(pa);
else if (inc == NBPG)
DCFP(pa);
break;
default:
error = EINVAL;
break;
}
if (doall)
break;
pa += inc;
addr += inc;
} while (addr < end);
return(error);
}
#endif
switch (req) {
case CC_EXTPURGE|CC_PURGE:
case CC_EXTPURGE|CC_FLUSH:
case CC_PURGE:
case CC_FLUSH:
DCIU();
break;
case CC_EXTPURGE|CC_IPURGE:
DCIU();
/* fall into... */
case CC_IPURGE:
ICIA();
break;
default:
error = EINVAL;
break;
}
return(error);
}
/*
* DMA cache control
*/
#if defined(M68040) || defined(M68060)
/*ARGSUSED1*/
int
dma_cachectl(addr, len)
caddr_t addr;
int len;
{
#if defined(M68020) || defined(M68030)
if (mmutype == MMU_68040) {
#endif
int inc = 0;
int pa = 0;
caddr_t end;
end = addr + len;
if (len <= 1024) {
addr = (caddr_t)((int)addr & ~0xF);
inc = 16;
} else {
addr = (caddr_t) m68k_trunc_page(addr);
inc = NBPG;
}
do {
/*
* Convert to physical address.
*/
if (pa == 0 || m68k_page_offset(addr) == 0) {
pa = kvtop(addr);
}
if (inc == 16) {
DCFL(pa);
ICPL(pa);
} else {
DCFP(pa);
ICPP(pa);
}
pa += inc;
addr += inc;
} while (addr < end);
#if defined(M68020) || defined(M68030)
}
#endif
return(0);
}
#endif /* M68040 || M68060 */
int
sys_sysarch(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
#if 0 /* unused */
struct sys_sysarch_args /* {
syscallarg(int) op;
syscallarg(void *) parms;
} */ *uap = v;
#endif
return (ENOSYS);
}