summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2005-02-08 23:57:43 +0000
committerimp <imp@FreeBSD.org>2005-02-08 23:57:43 +0000
commit29710254fb0ff15d92ba8f19cc07f68192f367ea (patch)
tree702b41dbfd5a5d893e9b7efe883ae356bcdaaae8 /sys
parent06f7a532e93276cb96108556ec3b75f092592f21 (diff)
downloadFreeBSD-src-29710254fb0ff15d92ba8f19cc07f68192f367ea.zip
FreeBSD-src-29710254fb0ff15d92ba8f19cc07f68192f367ea.tar.gz
Convenience function to clear memory of the card, and then check to make
sure that it works by reading back as 0.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ed/if_ed.c22
-rw-r--r--sys/dev/ed/if_edvar.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c
index 9f17bfa..22f9704 100644
--- a/sys/dev/ed/if_ed.c
+++ b/sys/dev/ed/if_ed.c
@@ -3463,3 +3463,25 @@ ed_ds_getmcaf(struct ed_softc *sc, uint32_t *mcaf)
af[index >> 3] |= 1 << (index & 7);
}
}
+
+int
+ed_clear_memory(device_t dev)
+{
+ struct ed_softc *sc = device_get_softc(dev);
+ int i;
+
+ /*
+ * Now zero memory and verify that it is clear
+ */
+ bzero(sc->mem_start, sc->mem_size);
+
+ for (i = 0; i < sc->mem_size; ++i) {
+ if (sc->mem_start[i]) {
+ device_printf(dev, "failed to clear shared memory at "
+ "0x%jx - check configuration\n",
+ (uintmax_t)rman_get_start(sc->mem_res) + i);
+ return (ENXIO);
+ }
+ }
+ return (0);
+}
diff --git a/sys/dev/ed/if_edvar.h b/sys/dev/ed/if_edvar.h
index 0abc95e..5020858 100644
--- a/sys/dev/ed/if_edvar.h
+++ b/sys/dev/ed/if_edvar.h
@@ -206,6 +206,7 @@ int ed_probe_HP_pclanp(device_t, int, int);
int ed_attach(device_t);
int ed_detach(device_t);
+int ed_clear_memory(device_t);
void ed_stop(struct ed_softc *);
void ed_pio_readmem(struct ed_softc *, long, uint8_t *, uint16_t);
void ed_pio_writemem(struct ed_softc *, uint8_t *, uint16_t, uint16_t);
OpenPOWER on IntegriCloud