diff options
author | imp <imp@FreeBSD.org> | 2002-07-26 08:01:08 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2002-07-26 08:01:08 +0000 |
commit | 6823d78fc0af17d53eefedfc8f8564646d7727ee (patch) | |
tree | cfb565386fa3c048776405fc6729dc8e53c74769 /sys/dev/exca | |
parent | 80521ec01304e8ac0e34f91e350651fe7b728ee2 (diff) | |
download | FreeBSD-src-6823d78fc0af17d53eefedfc8f8564646d7727ee.zip FreeBSD-src-6823d78fc0af17d53eefedfc8f8564646d7727ee.tar.gz |
MFp4:
o Protect .h against multiple includes.
o eliminate the pointers to the read/write routines. The
bus_space_read routines can cope since we have the offset
field.
o Print a warning if the requested map address is > 16M and
your chipset doesn't support the extended ExCA registers.
Diffstat (limited to 'sys/dev/exca')
-rw-r--r-- | sys/dev/exca/exca.c | 19 | ||||
-rw-r--r-- | sys/dev/exca/excareg.h | 5 | ||||
-rw-r--r-- | sys/dev/exca/excavar.h | 21 |
3 files changed, 25 insertions, 20 deletions
diff --git a/sys/dev/exca/exca.c b/sys/dev/exca/exca.c index 3fd199f..825579c 100644 --- a/sys/dev/exca/exca.c +++ b/sys/dev/exca/exca.c @@ -82,7 +82,6 @@ #define DPRINTF(fmt, args...) #endif - /* memory */ #define EXCA_MEMINFO(NUM) { \ @@ -198,6 +197,11 @@ exca_mem_map(struct exca_softc *sc, int kind, struct resource *res) } if (win >= EXCA_MEM_WINS) return (1); + if (((rman_get_start(res) >> EXCA_CARDMEM_ADDRX_SHIFT) & 0xff) != 0 && + (sc->flags & EXCA_HAS_MEMREG_WIN) == 0) { + device_printf(sc->dev, "Does not support mapping above 24M."); + return (1); + } sc->mem[win].cardaddr = 0; sc->mem[win].memt = rman_get_bustag(res); @@ -555,13 +559,10 @@ exca_reset(struct exca_softc *sc, device_t child) * Initialize the exca_softc data structure for the first time. */ void -exca_init(struct exca_softc *sc, device_t dev, exca_write_t *wrfn, - exca_read_t *rdfn, bus_space_tag_t bst, bus_space_handle_t bsh, - uint32_t offset) +exca_init(struct exca_softc *sc, device_t dev, + bus_space_tag_t bst, bus_space_handle_t bsh, uint32_t offset) { sc->dev = dev; - sc->write_exca = wrfn; - sc->read_exca = rdfn; sc->memalloc = 0; sc->ioalloc = 0; sc->bst = bst; @@ -580,8 +581,7 @@ exca_init(struct exca_softc *sc, device_t dev, exca_write_t *wrfn, * "exca" parameter. */ int -exca_probe_slots(device_t dev, struct exca_softc *exca, exca_write_t writefnp, - exca_read_t readfnp) +exca_probe_slots(device_t dev, struct exca_softc *exca) { int rid; struct resource *res; @@ -599,8 +599,7 @@ exca_probe_slots(device_t dev, struct exca_softc *exca, exca_write_t writefnp, iot = rman_get_bustag(res); ioh = rman_get_bushandle(res); for (i = 0; i < EXCA_NSLOTS; i++) { - exca_init(&exca[i], dev, writefnp, readfnp, iot, ioh, - i * EXCA_SOCKET_SIZE); + exca_init(&exca[i], dev, iot, ioh, i * EXCA_SOCKET_SIZE); if (exca_is_pcic(&exca[i])) { err = 0; exca[i].flags |= EXCA_SOCKET_PRESENT; diff --git a/sys/dev/exca/excareg.h b/sys/dev/exca/excareg.h index 6fbc8ae..14e95df 100644 --- a/sys/dev/exca/excareg.h +++ b/sys/dev/exca/excareg.h @@ -55,6 +55,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _SYS_DEV_EXCA_EXCAREG_H +#define _SYS_DEV_EXCA_EXCAREG_H + /* * All information is from the intel 82365sl PC Card Interface Controller * (PCIC) data sheet, marked "preliminary". Order number 290423-002, January @@ -419,3 +422,5 @@ #else #define EXCA_INT_MASK_ALLOWED 0xDEB8 /* AT */ #endif + +#endif /* !_SYS_DEV_EXCA_EXCAREG_H */ diff --git a/sys/dev/exca/excavar.h b/sys/dev/exca/excavar.h index 9bd2246..1bdd9bf 100644 --- a/sys/dev/exca/excavar.h +++ b/sys/dev/exca/excavar.h @@ -54,18 +54,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _SYS_DEV_EXCA_EXCAVAR_H +#define _SYS_DEV_EXCA_EXCAVAR_H + /* * Structure to manage the ExCA part of the chip. */ struct exca_softc; -typedef uint8_t (exca_read_t)(struct exca_softc *, int); -typedef void (exca_write_t)(struct exca_softc *, int, uint8_t); struct exca_softc { device_t dev; - exca_read_t *read_exca; - exca_write_t *write_exca; int memalloc; struct pccard_mem_handle mem[EXCA_MEM_WINS]; int ioalloc; @@ -74,11 +73,12 @@ struct exca_softc bus_space_handle_t bsh; uint32_t flags; #define EXCA_SOCKET_PRESENT 0x00000001 +#define EXCA_HAS_MEMREG_WIN 0x00000002 uint32_t offset; }; -void exca_init(struct exca_softc *sc, device_t dev, exca_write_t *wrfn, - exca_read_t *rdfn, bus_space_tag_t, bus_space_handle_t, uint32_t); +void exca_init(struct exca_softc *sc, device_t dev, + bus_space_tag_t, bus_space_handle_t, uint32_t); int exca_io_map(struct exca_softc *sc, int width, struct resource *r); int exca_io_unmap_res(struct exca_softc *sc, struct resource *res); int exca_is_pcic(struct exca_softc *sc); @@ -88,20 +88,19 @@ int exca_mem_set_flags(struct exca_softc *sc, struct resource *res, int exca_mem_set_offset(struct exca_softc *sc, struct resource *res, uint32_t cardaddr, uint32_t *deltap); int exca_mem_unmap_res(struct exca_softc *sc, struct resource *res); -int exca_probe_slots(device_t dev, struct exca_softc *, exca_write_t *, - exca_read_t *); +int exca_probe_slots(device_t dev, struct exca_softc *); void exca_reset(struct exca_softc *, device_t child); static __inline uint8_t exca_read(struct exca_softc *sc, int reg) { - return (sc->read_exca(sc, reg)); + return (bus_space_read_1(sc->bst, sc->bsh, sc->offset + reg)); } static __inline void exca_write(struct exca_softc *sc, int reg, uint8_t val) { - sc->write_exca(sc, reg, val); + return (bus_space_write_1(sc->bst, sc->bsh, sc->offset + reg, val)); } static __inline void @@ -115,3 +114,5 @@ exca_clrb(struct exca_softc *sc, int reg, uint8_t mask) { exca_write(sc, reg, exca_read(sc, reg) & ~mask); } + +#endif /* !_SYS_DEV_EXCA_EXCAVAR_H */ |