CRIME revision 1.1 has a bug that affects PIO operations to/from the MACE.
The recommended workaround is a 5-10ms delay before and after accesses. Therefore, move the affected bus_space_* operations from bus.h to bus.c and special-case MACE accesses. CRIME accesses are not affected, so introduce SGIMIPS_BUS_SPACE_CRIME and use it as the CRIME tag. My ip32 seems a little bit happier with this change, and my ip22 didn't notice the change.
This commit is contained in:
parent
bb9d36c069
commit
74e150c7b1
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: crime.c,v 1.14 2003/11/17 10:07:58 keihan Exp $ */
|
||||
/* $NetBSD: crime.c,v 1.15 2004/01/12 03:30:51 sekiya Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Soren S. Jorvang
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.14 2003/11/17 10:07:58 keihan Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.15 2004/01/12 03:30:51 sekiya Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
@ -98,7 +98,7 @@ crime_attach(parent, self, aux)
|
||||
|
||||
crime_sc = sc;
|
||||
|
||||
sc->iot = SGIMIPS_BUS_SPACE_HPC;
|
||||
sc->iot = SGIMIPS_BUS_SPACE_CRIME;
|
||||
|
||||
if (bus_space_map(sc->iot, ma->ma_addr, 0 /* XXX */,
|
||||
BUS_SPACE_MAP_LINEAR, &sc->ioh))
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bus.h,v 1.10 2003/10/07 16:03:09 tsutsui Exp $ */
|
||||
/* $NetBSD: bus.h,v 1.11 2004/01/12 03:30:51 sekiya Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
|
||||
@ -68,6 +68,7 @@ typedef u_long bus_space_handle_t;
|
||||
#define SGIMIPS_BUS_SPACE_MEM 2
|
||||
#define SGIMIPS_BUS_SPACE_MACE 3
|
||||
#define SGIMIPS_BUS_SPACE_IO 4
|
||||
#define SGIMIPS_BUS_SPACE_CRIME 5
|
||||
|
||||
/*
|
||||
* int bus_space_map(bus_space_tag_t t, bus_addr_t addr,
|
||||
@ -142,12 +143,8 @@ void * bus_space_vaddr(bus_space_tag_t t, bus_space_handle_t bsh);
|
||||
|
||||
u_int8_t bus_space_read_1(bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
u_int16_t bus_space_read_2(bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
|
||||
#define bus_space_read_4(t, h, o) \
|
||||
(wbflush(), /* XXX */ \
|
||||
(void) t, (*(volatile u_int32_t *)((h) + (o))))
|
||||
|
||||
#define bus_space_read_8(t, h, o) mips3_ld((u_int64_t *)((h) + (o)))
|
||||
u_int32_t bus_space_read_4(bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
u_int64_t bus_space_read_8(bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
|
||||
/*
|
||||
* void bus_space_read_multi_N(bus_space_tag_t tag,
|
||||
@ -239,15 +236,10 @@ void bus_space_write_1(bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
u_int8_t);
|
||||
void bus_space_write_2(bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
u_int16_t);
|
||||
|
||||
#define bus_space_write_4(t, h, o, v) \
|
||||
do { \
|
||||
(void) t; \
|
||||
*(volatile u_int32_t *)((h) + (o)) = (v); \
|
||||
wbflush(); /* XXX */ \
|
||||
} while (0)
|
||||
|
||||
#define bus_space_write_8(t, h, o, v) (mips3_sd((u_int64_t *)((h) + (o)), (v)))
|
||||
void bus_space_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
u_int32_t);
|
||||
void bus_space_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
u_int64_t);
|
||||
|
||||
/*
|
||||
* void bus_space_write_multi_N(bus_space_tag_t tag,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bus.c,v 1.22 2003/10/07 16:03:09 tsutsui Exp $ */
|
||||
/* $NetBSD: bus.c,v 1.23 2004/01/12 03:30:51 sekiya Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.22 2003/10/07 16:03:09 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.23 2004/01/12 03:30:51 sekiya Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -178,6 +178,88 @@ bus_space_write_2(t, h, o, v)
|
||||
wbflush(); /* XXX */
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
bus_space_read_4(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t o)
|
||||
{
|
||||
u_int32_t reg;
|
||||
int s;
|
||||
|
||||
switch (tag) {
|
||||
case SGIMIPS_BUS_SPACE_MACE:
|
||||
s = splhigh();
|
||||
delay(10);
|
||||
reg = (*(volatile u_int32_t *)(bsh + o));
|
||||
delay(10);
|
||||
splx(s);
|
||||
break;
|
||||
default:
|
||||
wbflush();
|
||||
reg = (*(volatile u_int32_t *)(bsh + o));
|
||||
break;
|
||||
}
|
||||
return reg;
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_write_4(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t o, u_int32_t v)
|
||||
{
|
||||
int s;
|
||||
|
||||
switch (tag) {
|
||||
case SGIMIPS_BUS_SPACE_MACE:
|
||||
s = splhigh();
|
||||
delay(10);
|
||||
*(volatile u_int32_t *)((bsh) + (o)) = (v);
|
||||
delay(10);
|
||||
splx(s);
|
||||
break;
|
||||
default:
|
||||
*(volatile u_int32_t *)((bsh) + (o)) = (v);
|
||||
wbflush(); /* XXX */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
u_int64_t
|
||||
bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t o)
|
||||
{
|
||||
u_int64_t reg;
|
||||
int s;
|
||||
|
||||
switch (tag) {
|
||||
case SGIMIPS_BUS_SPACE_MACE:
|
||||
s = splhigh();
|
||||
delay(10);
|
||||
reg = mips3_ld( (u_int64_t *)(bsh + o));
|
||||
delay(10);
|
||||
splx(s);
|
||||
break;
|
||||
default:
|
||||
reg = mips3_ld( (u_int64_t *)(bsh + o));
|
||||
break;
|
||||
}
|
||||
return reg;
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_write_8(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t o, u_int64_t v)
|
||||
{
|
||||
int s;
|
||||
|
||||
switch (tag) {
|
||||
case SGIMIPS_BUS_SPACE_MACE:
|
||||
s = splhigh();
|
||||
delay(10);
|
||||
mips3_sd( (u_int64_t *)(bsh + o), v);
|
||||
delay(10);
|
||||
splx(s);
|
||||
break;
|
||||
default:
|
||||
mips3_sd( (u_int64_t *)(bsh + o), v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
bus_space_map(t, bpa, size, flags, bshp)
|
||||
bus_space_tag_t t;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ip32.c,v 1.22 2003/12/14 05:23:12 sekiya Exp $ */
|
||||
/* $NetBSD: ip32.c,v 1.23 2004/01/12 03:30:51 sekiya Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Soren S. Jorvang
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip32.c,v 1.22 2003/12/14 05:23:12 sekiya Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip32.c,v 1.23 2004/01/12 03:30:51 sekiya Exp $");
|
||||
|
||||
#include "opt_machtypes.h"
|
||||
|
||||
@ -81,6 +81,7 @@ ip32_init(void)
|
||||
u_int32_t cps;
|
||||
|
||||
/* XXX nasty hack */
|
||||
bus_space_tag_t iot = SGIMIPS_BUS_SPACE_CRIME;
|
||||
bus_space_handle_t ioh = MIPS_PHYS_TO_KSEG1(CRIME_BASE);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user