summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2005-10-24 02:53:33 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2005-10-24 02:53:33 +0000
commit40090a5854f768816777fb93a6b4dea614b79705 (patch)
tree9ab1cfd355a680111cf5284544f104bfb5de1be0 /sys/dev/ic
parentb2e0b4b7b64c8492674da9a8ec2e23e20776d20b (diff)
change read/write callbacks to use a void * instead of struct rtw_regs.
why? rtw uses the smc93cx6 EEPROM and a separate diff will allow accessing it without depending on the bus_space_* functions. this is required for the RTL8187L. discussed with jsg@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/rtw.c37
-rw-r--r--sys/dev/ic/rtwvar.h16
2 files changed, 30 insertions, 23 deletions
diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c
index 94faec79582..31e91bf99b0 100644
--- a/sys/dev/ic/rtw.c
+++ b/sys/dev/ic/rtw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtw.c,v 1.45 2005/10/24 02:43:56 reyk Exp $ */
+/* $OpenBSD: rtw.c,v 1.46 2005/10/24 02:53:31 reyk Exp $ */
/* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */
/*-
@@ -243,13 +243,13 @@ void rtw_rf_rtl8225_hostbangbits(struct rtw_regs *, u_int32_t, int, u_int);
int rtw_rf_macbangbits(struct rtw_regs *, u_int32_t);
const char *rtw_rfchipid_string(int);
-u_int8_t rtw_read8(struct rtw_regs *, u_int32_t);
-u_int16_t rtw_read16(struct rtw_regs *, u_int32_t);
-u_int32_t rtw_read32(struct rtw_regs *, u_int32_t);
-void rtw_write8(struct rtw_regs *, u_int32_t, u_int8_t);
-void rtw_write16(struct rtw_regs *, u_int32_t, u_int16_t);
-void rtw_write32(struct rtw_regs *, u_int32_t, u_int32_t);
-void rtw_barrier(struct rtw_regs *, u_int32_t, u_int32_t, int);
+u_int8_t rtw_read8(void *, u_int32_t);
+u_int16_t rtw_read16(void *, u_int32_t);
+u_int32_t rtw_read32(void *, u_int32_t);
+void rtw_write8(void *, u_int32_t, u_int8_t);
+void rtw_write16(void *, u_int32_t, u_int16_t);
+void rtw_write32(void *, u_int32_t, u_int32_t);
+void rtw_barrier(void *, u_int32_t, u_int32_t, int);
#ifdef RTW_DEBUG
void rtw_print_txdesc(struct rtw_softc *, const char *,
@@ -4766,44 +4766,51 @@ rtw_rf_macwrite(struct rtw_softc *sc, u_int addr, u_int32_t val)
u_int8_t
-rtw_read8(struct rtw_regs *regs, u_int32_t off)
+rtw_read8(void *arg, u_int32_t off)
{
+ struct rtw_regs *regs = (struct rtw_regs *)arg;
return (bus_space_read_1(regs->r_bt, regs->r_bh, off));
}
u_int16_t
-rtw_read16(struct rtw_regs *regs, u_int32_t off)
+rtw_read16(void *arg, u_int32_t off)
{
+ struct rtw_regs *regs = (struct rtw_regs *)arg;
return (bus_space_read_2(regs->r_bt, regs->r_bh, off));
}
u_int32_t
-rtw_read32(struct rtw_regs *regs, u_int32_t off)
+rtw_read32(void *arg, u_int32_t off)
{
+ struct rtw_regs *regs = (struct rtw_regs *)arg;
return (bus_space_read_4(regs->r_bt, regs->r_bh, off));
}
void
-rtw_write8(struct rtw_regs *regs, u_int32_t off, u_int8_t val)
+rtw_write8(void *arg, u_int32_t off, u_int8_t val)
{
+ struct rtw_regs *regs = (struct rtw_regs *)arg;
bus_space_write_1(regs->r_bt, regs->r_bh, off, val);
}
void
-rtw_write16(struct rtw_regs *regs, u_int32_t off, u_int16_t val)
+rtw_write16(void *arg, u_int32_t off, u_int16_t val)
{
+ struct rtw_regs *regs = (struct rtw_regs *)arg;
bus_space_write_2(regs->r_bt, regs->r_bh, off, val);
}
void
-rtw_write32(struct rtw_regs *regs, u_int32_t off, u_int32_t val)
+rtw_write32(void *arg, u_int32_t off, u_int32_t val)
{
+ struct rtw_regs *regs = (struct rtw_regs *)arg;
bus_space_write_4(regs->r_bt, regs->r_bh, off, val);
}
void
-rtw_barrier(struct rtw_regs *regs, u_int32_t reg0, u_int32_t reg1, int flags)
+rtw_barrier(void *arg, u_int32_t reg0, u_int32_t reg1, int flags)
{
+ struct rtw_regs *regs = (struct rtw_regs *)arg;
bus_space_barrier(regs->r_bh, regs->r_bt, MIN(reg0, reg1),
MAX(reg0, reg1) - MIN(reg0, reg1) + 4, flags);
}
diff --git a/sys/dev/ic/rtwvar.h b/sys/dev/ic/rtwvar.h
index 4a9390c2468..3d4d67332d5 100644
--- a/sys/dev/ic/rtwvar.h
+++ b/sys/dev/ic/rtwvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtwvar.h,v 1.18 2005/10/24 02:46:08 reyk Exp $ */
+/* $OpenBSD: rtwvar.h,v 1.19 2005/10/24 02:53:32 reyk Exp $ */
/* $NetBSD: rtwvar.h,v 1.10 2004/12/26 22:37:57 mycroft Exp $ */
/*-
@@ -126,13 +126,13 @@ struct rtw_regs {
void *r_priv;
/* bus independent I/O callbacks */
- u_int8_t (*r_read8)(struct rtw_regs *, u_int32_t);
- u_int16_t (*r_read16)(struct rtw_regs *, u_int32_t);
- u_int32_t (*r_read32)(struct rtw_regs *, u_int32_t);
- void (*r_write8)(struct rtw_regs *, u_int32_t, u_int8_t);
- void (*r_write16)(struct rtw_regs *, u_int32_t, u_int16_t);
- void (*r_write32)(struct rtw_regs *, u_int32_t, u_int32_t);
- void (*r_barrier)(struct rtw_regs *, u_int32_t, u_int32_t, int);
+ u_int8_t (*r_read8)(void *, u_int32_t);
+ u_int16_t (*r_read16)(void *, u_int32_t);
+ u_int32_t (*r_read32)(void *, u_int32_t);
+ void (*r_write8)(void *, u_int32_t, u_int8_t);
+ void (*r_write16)(void *, u_int32_t, u_int16_t);
+ void (*r_write32)(void *, u_int32_t, u_int32_t);
+ void (*r_barrier)(void *, u_int32_t, u_int32_t, int);
};
#define RTW_SR_GET(sr, ofs) \