Replace as much of the hardcoded CACHELINESIZE with
curcpu()->ci_ci.dcache_line_size as I can. With this change, an ofppc kernel compiled with both PPC_OEA and PPC_OEA64_BRIDGE defined, boots.
This commit is contained in:
parent
84528b0430
commit
2234198b7f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu.h,v 1.61 2008/02/05 18:10:46 garbled Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.62 2008/02/05 18:52:55 garbled Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1999 Wolfgang Solfrank.
|
||||
|
@ -362,12 +362,15 @@ extern int cpu_altivec;
|
|||
#if defined(_KERNEL) || defined(_STANDALONE)
|
||||
#if !defined(CACHELINESIZE)
|
||||
#ifdef PPC_IBM403
|
||||
#define CACHELINESIZE 16
|
||||
#define CACHELINESIZE 16
|
||||
#define MAXCACHELINESIZE 16
|
||||
#else
|
||||
#if defined (PPC_OEA64_BRIDGE)
|
||||
#define CACHELINESIZE 128
|
||||
#define CACHELINESIZE 128
|
||||
#define MAXCACHELINESIZE 128
|
||||
#else
|
||||
#define CACHELINESIZE 32
|
||||
#define CACHELINESIZE 32
|
||||
#define MAXCACHELINESIZE 32
|
||||
#endif /* PPC_OEA64_BRIDGE */
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus_dma.c,v 1.14 2007/03/04 06:00:37 christos Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.15 2008/02/05 18:52:56 garbled Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.14 2007/03/04 06:00:37 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.15 2008/02/05 18:52:56 garbled Exp $");
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
|
@ -74,13 +74,13 @@ invaldcache(vaddr_t va, bus_size_t sz)
|
|||
KASSERT(sz != 0);
|
||||
|
||||
__asm volatile("eieio;");
|
||||
off = (u_int)va & (CACHELINESIZE - 1);
|
||||
off = (u_int)va & (curcpu()->ci_ci.dcache_line_size - 1);
|
||||
sz += off;
|
||||
va -= off;
|
||||
while ((int)sz > 0) {
|
||||
__asm volatile("dcbi 0, %0;" :: "r"(va));
|
||||
va += CACHELINESIZE;
|
||||
sz -= CACHELINESIZE;
|
||||
va += curcpu()->ci_ci.dcache_line_size;
|
||||
sz -= curcpu()->ci_ci.dcache_line_size;
|
||||
}
|
||||
__asm volatile("sync;");
|
||||
}
|
||||
|
@ -94,13 +94,13 @@ flushdcache(vaddr_t va, bus_size_t sz)
|
|||
KASSERT(sz != 0);
|
||||
|
||||
__asm volatile("eieio;");
|
||||
off = (u_int)va & (CACHELINESIZE - 1);
|
||||
off = (u_int)va & (curcpu()->ci_ci.dcache_line_size - 1);
|
||||
sz += off;
|
||||
va -= off;
|
||||
while ((int)sz > CACHELINESIZE) {
|
||||
while ((int)sz > curcpu()->ci_ci.dcache_line_size) {
|
||||
__asm volatile("dcbf 0, %0;" :: "r"(va));
|
||||
va += CACHELINESIZE;
|
||||
sz -= CACHELINESIZE;
|
||||
va += curcpu()->ci_ci.dcache_line_size;
|
||||
sz -= curcpu()->ci_ci.dcache_line_size;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -121,13 +121,13 @@ storedcache(vaddr_t va, bus_size_t sz)
|
|||
KASSERT(sz != 0);
|
||||
|
||||
__asm volatile("eieio;");
|
||||
off = (u_int)va & (CACHELINESIZE - 1);
|
||||
off = (u_int)va & (curcpu()->ci_ci.dcache_line_size - 1);
|
||||
sz += off;
|
||||
va -= off;
|
||||
while ((int)sz > 0) {
|
||||
__asm volatile("dcbst 0, %0;" :: "r"(va));
|
||||
va += CACHELINESIZE;
|
||||
sz -= CACHELINESIZE;
|
||||
va += curcpu()->ci_ci.dcache_line_size;
|
||||
sz -= curcpu()->ci_ci.dcache_line_size;
|
||||
}
|
||||
__asm volatile("sync;");
|
||||
}
|
||||
|
@ -550,10 +550,10 @@ _bus_dmamap_sync(t, map, offset, len, ops)
|
|||
if (len > dslen)
|
||||
minlen = dslen;
|
||||
va = map->dm_segs[i].ds_vaddr + offset;
|
||||
if (va & (CACHELINESIZE-1))
|
||||
if (va & (curcpu()->ci_ci.dcache_line_size-1))
|
||||
storedcache(va, 1);
|
||||
va += minlen;
|
||||
if (va & (CACHELINESIZE-1))
|
||||
if (va & (curcpu()->ci_ci.dcache_line_size-1))
|
||||
storedcache(va, 1);
|
||||
invaldcache(map->dm_segs[i].ds_vaddr + offset, minlen);
|
||||
len -= minlen;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu_subr.c,v 1.42 2008/02/05 18:10:47 garbled Exp $ */
|
||||
/* $NetBSD: cpu_subr.c,v 1.43 2008/02/05 18:52:56 garbled Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Matt Thomas.
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.42 2008/02/05 18:10:47 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.43 2008/02/05 18:52:56 garbled Exp $");
|
||||
|
||||
#include "opt_ppcparam.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
|
@ -294,8 +294,8 @@ cpu_probe_cache(void)
|
|||
|
||||
|
||||
/* Presently common across almost all implementations. */
|
||||
curcpu()->ci_ci.dcache_line_size = CACHELINESIZE;
|
||||
curcpu()->ci_ci.icache_line_size = CACHELINESIZE;
|
||||
curcpu()->ci_ci.dcache_line_size = 32;
|
||||
curcpu()->ci_ci.icache_line_size = 32;
|
||||
|
||||
|
||||
switch (vers) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: powerpc_machdep.c,v 1.37 2008/02/05 18:10:48 garbled Exp $ */
|
||||
/* $NetBSD: powerpc_machdep.c,v 1.38 2008/02/05 18:52:56 garbled Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.37 2008/02/05 18:10:48 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.38 2008/02/05 18:52:56 garbled Exp $");
|
||||
|
||||
#include "opt_altivec.h"
|
||||
|
||||
|
@ -171,7 +171,7 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup")
|
|||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
||||
CTLTYPE_INT, "cachelinesize", NULL,
|
||||
NULL, CACHELINESIZE, NULL, 0,
|
||||
NULL, curcpu()->ci_ci.dcache_line_size, NULL, 0,
|
||||
CTL_MACHDEP, CPU_CACHELINE, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: trap.c,v 1.124 2008/02/05 18:10:48 garbled Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.125 2008/02/05 18:52:56 garbled Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.124 2008/02/05 18:10:48 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.125 2008/02/05 18:52:56 garbled Exp $");
|
||||
|
||||
#include "opt_altivec.h"
|
||||
#include "opt_ddb.h"
|
||||
|
@ -670,11 +670,11 @@ fix_unaligned(struct lwp *l, struct trapframe *frame)
|
|||
* case when we are running with the cache disabled
|
||||
* for debugging.
|
||||
*/
|
||||
static char zeroes[CACHELINESIZE];
|
||||
static char zeroes[MAXCACHELINESIZE];
|
||||
int error;
|
||||
error = copyout(zeroes,
|
||||
(void *)(frame->dar & -CACHELINESIZE),
|
||||
CACHELINESIZE);
|
||||
(void *)(frame->dar & -curcpu()->ci_ci.dcache_line_size),
|
||||
curcpu()->ci_ci.dcache_line_size);
|
||||
if (error)
|
||||
return -1;
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue