Don't panic in _bus_dmamap_sync() if a segment start address/length are
not aligned to a cacheline boundary. Instead round down the start address, round up the length and "DTRT".
This commit is contained in:
parent
37ed68b3e4
commit
813efd148a
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: bus_dma.c,v 1.11 2001/04/24 04:31:03 thorpej Exp $ */
|
/* $NetBSD: bus_dma.c,v 1.12 2001/05/01 07:32:51 scw Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file was taken from from next68k/dev/bus_dma.c, which was originally
|
* This file was taken from from next68k/dev/bus_dma.c, which was originally
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||||
|
|
||||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.11 2001/04/24 04:31:03 thorpej Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.12 2001/05/01 07:32:51 scw Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
@ -476,16 +476,12 @@ _bus_dmamap_sync_0460(t, map, offset, len, ops)
|
||||||
*/
|
*/
|
||||||
if (ops & BUS_DMASYNC_PREWRITE) {
|
if (ops & BUS_DMASYNC_PREWRITE) {
|
||||||
for(i=0;i<map->dm_nsegs;i++) {
|
for(i=0;i<map->dm_nsegs;i++) {
|
||||||
p = map->dm_segs[i]._ds_cpuaddr;
|
/*
|
||||||
e = p + map->dm_segs[i].ds_len;
|
* Ensure the start and end addresses are aligned
|
||||||
#ifdef DIAGNOSTIC
|
* on a cacheline boundary.
|
||||||
if ((p % 16) || (e % 16)) {
|
*/
|
||||||
panic("unaligned address in _bus_dmamap_sync "
|
p = map->dm_segs[i]._ds_cpuaddr & ~0xf;
|
||||||
"while flushing.\n"
|
e = p + ((map->dm_segs[i].ds_len + 15) & ~0xf);
|
||||||
"address=0x%08lx, end=0x%08lx, ops=0x%x",
|
|
||||||
p, e, ops);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while((p<e)&&(p%NBPG)) {
|
while((p<e)&&(p%NBPG)) {
|
||||||
DCFL_40(p); /* flush cache line (060 too) */
|
DCFL_40(p); /* flush cache line (060 too) */
|
||||||
|
@ -504,16 +500,12 @@ _bus_dmamap_sync_0460(t, map, offset, len, ops)
|
||||||
|
|
||||||
if (ops & BUS_DMASYNC_POSTREAD) {
|
if (ops & BUS_DMASYNC_POSTREAD) {
|
||||||
for(i=0;i<map->dm_nsegs;i++) {
|
for(i=0;i<map->dm_nsegs;i++) {
|
||||||
p = map->dm_segs[i]._ds_cpuaddr;
|
/*
|
||||||
e = p + map->dm_segs[i].ds_len;
|
* Ensure the start and end addresses are aligned
|
||||||
#ifdef DIAGNOSTIC
|
* on a cacheline boundary.
|
||||||
if ((p % 16) || (e % 16)) {
|
*/
|
||||||
panic("unaligned address in _bus_dmamap_sync "
|
p = map->dm_segs[i]._ds_cpuaddr & ~0xf;
|
||||||
"while purging.\n"
|
e = p + ((map->dm_segs[i].ds_len + 15) & ~0xf);
|
||||||
"address=0x%08lx, end=0x%08lx, ops=0x%x",
|
|
||||||
p, e, ops);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while((p<e)&&(p%NBPG)) {
|
while((p<e)&&(p%NBPG)) {
|
||||||
DCPL_40(p); /* purge cache line */
|
DCPL_40(p); /* purge cache line */
|
||||||
|
|
Loading…
Reference in New Issue