summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-07-23 17:50:34 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-07-23 17:50:34 +0000
commit5259b36f77648d82c08d84c6aac774d9f02d871c (patch)
tree22448816c93d59b1b31545f791a860bedb54e78f
parent067a4a154586a24b0880e01be1b807462f8f7120 (diff)
Turn READ/WRITE into function calls (driver was getting too bloated with
inline macro's; if hifn wanted to make it possible to write a very efficient driver they would have fixed the bugs in the chips). Also, invalidate the burst write checks when a read is executed.
-rw-r--r--sys/dev/pci/hifn7751.c42
-rw-r--r--sys/dev/pci/hifn7751var.h28
2 files changed, 35 insertions, 35 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c
index a75e4d769b5..e60d5f95654 100644
--- a/sys/dev/pci/hifn7751.c
+++ b/sys/dev/pci/hifn7751.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751.c,v 1.126 2002/07/22 18:05:10 jason Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.127 2002/07/23 17:50:33 jason Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -109,7 +109,9 @@ void hifn_rng(void *);
void hifn_tick(void *);
void hifn_abort(struct hifn_softc *);
void hifn_alloc_slot(struct hifn_softc *, int *, int *, int *, int *);
-void hifn_write_waw_4(struct hifn_softc *, int, bus_size_t, u_int32_t);
+void hifn_write_4(struct hifn_softc *, int, bus_size_t, u_int32_t);
+u_int32_t hifn_read_4(struct hifn_softc *, int, bus_size_t);
+
struct hifn_stats hifnstats;
@@ -204,7 +206,7 @@ hifn_attach(parent, self, aux)
if (sc->sc_flags & HIFN_NO_BURSTWRITE) {
sc->sc_waw_lastgroup = -1;
- sc->sc_waw_lastreg = 0xffffffff;
+ sc->sc_waw_lastreg = 1;
}
sc->sc_dmat = pa->pa_dmat;
@@ -2302,7 +2304,7 @@ hifn_callback(sc, cmd, macbuf)
}
void
-hifn_write_waw_4(sc, reggrp, reg, val)
+hifn_write_4(sc, reggrp, reg, val)
struct hifn_softc *sc;
int reggrp;
bus_size_t reg;
@@ -2313,16 +2315,32 @@ hifn_write_waw_4(sc, reggrp, reg, val)
* and Group 1 registers; avoid conditions that could create
* burst writes by doing a read in between the writes.
*/
- if (sc->sc_waw_lastgroup != reggrp)
- goto chipit;
- if (sc->sc_waw_lastreg == reg - 4)
- bus_space_read_4(sc->sc_st1, sc->sc_sh1, HIFN_1_REVID);
-
-chipit:
- sc->sc_waw_lastgroup = reggrp;
- sc->sc_waw_lastreg = reg;
+ if (sc->sc_flags & HIFN_NO_BURSTWRITE) {
+ if (sc->sc_waw_lastgroup == reggrp &&
+ sc->sc_waw_lastreg == reg - 4) {
+ bus_space_read_4(sc->sc_st1, sc->sc_sh1, HIFN_1_REVID);
+ sc->sc_waw_lastgroup = reggrp;
+ sc->sc_waw_lastreg = reg;
+ }
+ }
if (reggrp == 0)
bus_space_write_4(sc->sc_st0, sc->sc_sh0, reg, val);
else
bus_space_write_4(sc->sc_st1, sc->sc_sh1, reg, val);
+
+}
+
+u_int32_t
+hifn_read_4(sc, reggrp, reg)
+ struct hifn_softc *sc;
+ int reggrp;
+ bus_size_t reg;
+{
+ if (sc->sc_flags & HIFN_NO_BURSTWRITE) {
+ sc->sc_waw_lastgroup = -1;
+ sc->sc_waw_lastreg = 1;
+ }
+ if (reggrp == 0)
+ return (bus_space_read_4(sc->sc_st0, sc->sc_sh0, reg));
+ return (bus_space_read_4(sc->sc_st1, sc->sc_sh1, reg));
}
diff --git a/sys/dev/pci/hifn7751var.h b/sys/dev/pci/hifn7751var.h
index 9424c182b40..647e211892f 100644
--- a/sys/dev/pci/hifn7751var.h
+++ b/sys/dev/pci/hifn7751var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751var.h,v 1.44 2002/07/21 19:55:33 jason Exp $ */
+/* $OpenBSD: hifn7751var.h,v 1.45 2002/07/23 17:50:33 jason Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -168,28 +168,10 @@ struct hifn_softc {
int sc_waw_lastgroup;
};
-#define WRITE_REG_0(sc,reg,val) \
- do { \
- if (sc->sc_flags & HIFN_NO_BURSTWRITE) \
- hifn_write_waw_4((sc), 0, (reg), (val)); \
- else \
- bus_space_write_4((sc)->sc_st0, (sc)->sc_sh0, \
- (reg), (val)); \
- } while (0)
-
-#define WRITE_REG_1(sc,reg,val) \
- do { \
- if (sc->sc_flags & HIFN_NO_BURSTWRITE) \
- hifn_write_waw_4((sc), 1, (reg), (val)); \
- else \
- bus_space_write_4((sc)->sc_st1, (sc)->sc_sh1, \
- (reg), (val)); \
- } while (0)
-
-#define READ_REG_0(sc,reg) \
- bus_space_read_4((sc)->sc_st0, (sc)->sc_sh0, reg)
-#define READ_REG_1(sc,reg) \
- bus_space_read_4((sc)->sc_st1, (sc)->sc_sh1, reg)
+#define WRITE_REG_0(sc,reg,val) hifn_write_4((sc), 0, (reg), (val))
+#define WRITE_REG_1(sc,reg,val) hifn_write_4((sc), 1, (reg), (val))
+#define READ_REG_0(sc,reg) hifn_read_4((sc), 0, (reg))
+#define READ_REG_1(sc,reg) hifn_read_4((sc), 1, (reg))
#define SET_LED(sc,v) \
if (sc->sc_flags & HIFN_HAS_LEDS) \