Convenience function to clear memory of the card, and then check to make

sure that it works by reading back as 0.
This commit is contained in:
Warner Losh 2005-02-08 23:57:43 +00:00
parent 68f2274d97
commit 851a243f68
2 changed files with 23 additions and 0 deletions

View File

@ -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);
}

View File

@ -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);