Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sgimips CRIME revision 1.1 has a bug that affects P...
details: https://anonhg.NetBSD.org/src/rev/80a2b2818948
branches: trunk
changeset: 557565:80a2b2818948
user: sekiya <sekiya%NetBSD.org@localhost>
date: Mon Jan 12 03:30:51 2004 +0000
description:
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.
diffstat:
sys/arch/sgimips/dev/crime.c | 6 +-
sys/arch/sgimips/include/bus.h | 24 +++-------
sys/arch/sgimips/sgimips/bus.c | 86 ++++++++++++++++++++++++++++++++++++++++-
sys/arch/sgimips/sgimips/ip32.c | 5 +-
4 files changed, 98 insertions(+), 23 deletions(-)
diffs (212 lines):
diff -r fd44ebdcacbf -r 80a2b2818948 sys/arch/sgimips/dev/crime.c
--- a/sys/arch/sgimips/dev/crime.c Mon Jan 12 03:26:08 2004 +0000
+++ b/sys/arch/sgimips/dev/crime.c Mon Jan 12 03:30:51 2004 +0000
@@ -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_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))
diff -r fd44ebdcacbf -r 80a2b2818948 sys/arch/sgimips/include/bus.h
--- a/sys/arch/sgimips/include/bus.h Mon Jan 12 03:26:08 2004 +0000
+++ b/sys/arch/sgimips/include/bus.h Mon Jan 12 03:30:51 2004 +0000
@@ -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 @@
#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 @@
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 @@
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,
diff -r fd44ebdcacbf -r 80a2b2818948 sys/arch/sgimips/sgimips/bus.c
--- a/sys/arch/sgimips/sgimips/bus.c Mon Jan 12 03:26:08 2004 +0000
+++ b/sys/arch/sgimips/sgimips/bus.c Mon Jan 12 03:30:51 2004 +0000
@@ -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 @@
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;
diff -r fd44ebdcacbf -r 80a2b2818948 sys/arch/sgimips/sgimips/ip32.c
--- a/sys/arch/sgimips/sgimips/ip32.c Mon Jan 12 03:26:08 2004 +0000
+++ b/sys/arch/sgimips/sgimips/ip32.c Mon Jan 12 03:30:51 2004 +0000
@@ -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 @@
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);
/*
Home |
Main Index |
Thread Index |
Old Index