summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pcmcia/if_ray.c56
-rw-r--r--sys/dev/pcmcia/if_rayreg.h32
2 files changed, 22 insertions, 66 deletions
diff --git a/sys/dev/pcmcia/if_ray.c b/sys/dev/pcmcia/if_ray.c
index 8daa8d45c5b..bd50b35bdfd 100644
--- a/sys/dev/pcmcia/if_ray.c
+++ b/sys/dev/pcmcia/if_ray.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ray.c,v 1.18 2002/03/14 01:27:01 millert Exp $ */
+/* $OpenBSD: if_ray.c,v 1.19 2002/03/24 20:53:56 mickey Exp $ */
/* $NetBSD: if_ray.c,v 1.21 2000/07/05 02:35:54 onoe Exp $ */
/*
@@ -112,8 +112,6 @@
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
#endif
-#define RAY_USE_AMEM 0
-
/*#define RAY_DEBUG*/
#ifndef RAY_PID_COUNTRY_CODE_DEFAULT
@@ -173,10 +171,6 @@ struct ray_softc {
struct pcmcia_function *sc_pf;
struct pcmcia_mem_handle sc_mem;
int sc_window;
-#if RAY_USE_AMEM
- struct pcmcia_mem_handle sc_amem;
- int sc_awindow;
-#endif
void *sc_ih;
void *sc_sdhook;
void *sc_pwrhook;
@@ -242,6 +236,7 @@ struct ray_softc {
#define sc_memh sc_mem.memh
#define sc_ccrt sc_pf->pf_ccrt
#define sc_ccrh sc_pf->pf_ccrh
+#define sc_ccroff sc_pf->pf_ccr_offset
#define sc_startup_4 sc_u.u_params_4
#define sc_startup_5 sc_u.u_params_5
#define sc_version sc_ecf_startup.e_fw_build_string
@@ -407,21 +402,14 @@ void ray_dump_mbuf(struct ray_softc *, struct mbuf *);
* macros for writing to various regions in the mapped memory space
*/
-#if RAY_USE_AMEM
-/* read and write the registers in the CCR (attribute) space */
-#define REG_WRITE(sc, off, val) \
- bus_space_write_1((sc)->sc_amem.memt, (sc)->sc_amem.memh, (off), (val))
-
-#define REG_READ(sc, off) \
- bus_space_read_1((sc)->sc_amem.memt, (sc)->sc_amem.memh, (off))
-#else
/* use already mapped ccrt */
#define REG_WRITE(sc, off, val) \
- bus_space_write_1((sc)->sc_ccrt, (sc)->sc_ccrh, (off), (val))
+ bus_space_write_1((sc)->sc_ccrt, (sc)->sc_ccrh, \
+ ((sc)->sc_ccroff + (off)), (val))
#define REG_READ(sc, off) \
- bus_space_read_1((sc)->sc_ccrt, (sc)->sc_ccrh, (off))
-#endif
+ bus_space_read_1((sc)->sc_ccrt, (sc)->sc_ccrh, \
+ ((sc)->sc_ccroff + (off)))
#define SRAM_READ_1(sc, off) \
((u_int8_t)bus_space_read_1((sc)->sc_memt, (sc)->sc_memh, (off)))
@@ -540,9 +528,6 @@ ray_attach(parent, self, aux)
sc->sc_pf = pa->pf;
ifp = &sc->sc_if;
sc->sc_window = -1;
-#if RAY_USE_AMEM
- sc->sc_awindow = -1;
-#endif
printf("\n");
@@ -569,23 +554,6 @@ ray_attach(parent, self, aux)
goto fail;
}
-#if RAY_USE_AMEM
- /* use the already mapped ccrt in our pf */
- /*
- * map in the memory
- */
- if (pcmcia_mem_alloc(sc->sc_pf, 0x1000, &sc->sc_amem)) {
- printf(": can\'t alloc attr memory\n");
- goto fail;
- }
-
- if (pcmcia_mem_map(sc->sc_pf, PCMCIA_MEM_ATTR, 0,
- 0x1000, &sc->sc_amem, &memoff, &sc->sc_awindow)) {
- printf(": can\'t map attr memory\n");
- pcmcia_mem_free(sc->sc_pf, &sc->sc_amem);
- goto fail;
- }
-#endif
/* get startup results */
ep = &sc->sc_ecf_startup;
ray_read_region(sc, RAY_ECF_TO_HOST_BASE, ep,
@@ -680,12 +648,6 @@ fail:
pcmcia_function_disable(sc->sc_pf);
/* free the alloc/map */
-#if RAY_USE_AMEM
- if (sc->sc_awindow != -1) {
- pcmcia_mem_unmap(sc->sc_pf, sc->sc_awindow);
- pcmcia_mem_free(sc->sc_pf, &sc->sc_amem);
- }
-#endif
if (sc->sc_window != -1) {
pcmcia_mem_unmap(sc->sc_pf, sc->sc_window);
pcmcia_mem_free(sc->sc_pf, &sc->sc_mem);
@@ -746,12 +708,6 @@ ray_detach(self, flags)
ray_disable(sc);
/* give back the memory */
-#if RAY_USE_AMEM
- if (sc->sc_awindow != -1) {
- pcmcia_mem_unmap(sc->sc_pf, sc->sc_awindow);
- pcmcia_mem_free(sc->sc_pf, &sc->sc_amem);
- }
-#endif
if (sc->sc_window != -1) {
pcmcia_mem_unmap(sc->sc_pf, sc->sc_window);
pcmcia_mem_free(sc->sc_pf, &sc->sc_mem);
diff --git a/sys/dev/pcmcia/if_rayreg.h b/sys/dev/pcmcia/if_rayreg.h
index 1fbf3baec87..7ed3cd9a448 100644
--- a/sys/dev/pcmcia/if_rayreg.h
+++ b/sys/dev/pcmcia/if_rayreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rayreg.h,v 1.4 2001/06/08 17:48:22 mickey Exp $ */
+/* $OpenBSD: if_rayreg.h,v 1.5 2002/03/24 20:53:56 mickey Exp $ */
/* $NetBSD: if_rayreg.h,v 1.3 2000/08/10 11:48:46 ad Exp $ */
/*
@@ -37,26 +37,26 @@
/*
* CCR registers
*/
-#define RAY_COR (0xf00 + 0) /* config option register */
-#define RAY_CCSR (0xf00 + 1) /* card config and status register */
-#define RAY_PIN (0xf00 + 2) /* not in hw */
-#define RAY_SOCKETCOPY (0xf00 + 3) /* not used by hw */
-#define RAY_HCSIR (0xf00 + 5) /* HCS intr register */
-#define RAY_ECFIR (0xf00 + 6) /* ECF intr register */
-#define RAY_AR0 (0xf00 + 8) /* authorization register 0 (unused) */
-#define RAY_AR1 (0xf00 + 9) /* authorization register 1 (unused) */
+#define RAY_COR (0x00) /* config option register */
+#define RAY_CCSR (0x01) /* card config and status register */
+#define RAY_PIN (0x02) /* not in hw */
+#define RAY_SOCKETCOPY (0x03) /* not used by hw */
+#define RAY_HCSIR (0x05) /* HCS intr register */
+#define RAY_ECFIR (0x06) /* ECF intr register */
+#define RAY_AR0 (0x08) /* authorization register 0 (unused) */
+#define RAY_AR1 (0x09) /* authorization register 1 (unused) */
/*
* XXX these registers cannot be accessed with pcmcia.c's 14 byte mapping
* of the CCR for us
*/
#if 0
-#define RAY_PMR 0xf0a /* program mode register (unused) */
-#define RAY_TMR 0xf0b /* pc test mode register (unused) */
-#define RAY_FCWR 0xf10 /* frequency control word register */
-#define RAY_TMC1 0xf14 /* test mode control 1 (unused) */
-#define RAY_TMC2 0xf15 /* test mode control 1 (unused) */
-#define RAY_TMC3 0xf16 /* test mode control 1 (unused) */
-#define RAY_TMC4 0xf17 /* test mode control 1 (unused) */
+#define RAY_PMR 0x0a /* program mode register (unused) */
+#define RAY_TMR 0x0b /* pc test mode register (unused) */
+#define RAY_FCWR 0x10 /* frequency control word register */
+#define RAY_TMC1 0x14 /* test mode control 1 (unused) */
+#define RAY_TMC2 0x15 /* test mode control 1 (unused) */
+#define RAY_TMC3 0x16 /* test mode control 1 (unused) */
+#define RAY_TMC4 0x17 /* test mode control 1 (unused) */
#endif
/*