summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k/dev
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-12-28 19:44:27 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-12-28 19:44:27 +0000
commit559e3371541c36a9f1c43547f23288c6608884c5 (patch)
tree42441b9951cc5bfc894fa255236c4365efb52603 /sys/arch/mvme88k/dev
parent3c188707056cc91217824e195dc827249f1cd2e9 (diff)
Having vmel and vmes keep another pointer to their parent in their softc is
just plain silly!
Diffstat (limited to 'sys/arch/mvme88k/dev')
-rw-r--r--sys/arch/mvme88k/dev/vme.c14
-rw-r--r--sys/arch/mvme88k/dev/vme.h109
-rw-r--r--sys/arch/mvme88k/dev/vmel.c20
-rw-r--r--sys/arch/mvme88k/dev/vmes.c20
4 files changed, 26 insertions, 137 deletions
diff --git a/sys/arch/mvme88k/dev/vme.c b/sys/arch/mvme88k/dev/vme.c
index de9f6cba2aa..601833c38d0 100644
--- a/sys/arch/mvme88k/dev/vme.c
+++ b/sys/arch/mvme88k/dev/vme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.c,v 1.26 2003/12/27 23:56:41 miod Exp $ */
+/* $OpenBSD: vme.c,v 1.27 2003/12/28 19:44:26 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1995 Theo de Raadt
@@ -116,7 +116,7 @@ vmematch(parent, cf, args)
*/
void *
vmepmap(sc, vmeaddr, len, bustype)
- struct vmesoftc *sc;
+ struct device *sc;
off_t vmeaddr;
int len;
int bustype;
@@ -137,7 +137,7 @@ vmepmap(sc, vmeaddr, len, bustype)
base = vme2chip_map(base, len, 16);
if (base == NULL) {
printf("%s: cannot map pa 0x%x len 0x%x\n",
- sc->sc_dev.dv_xname, base, len);
+ sc->dv_xname, base, len);
return (NULL);
}
break;
@@ -149,7 +149,7 @@ vmepmap(sc, vmeaddr, len, bustype)
base = vme2chip_map(base, len, 32);
if (base == NULL) {
printf("%s: cannot map pa 0x%x len 0x%x\n",
- sc->sc_dev.dv_xname, base, len);
+ sc->dv_xname, base, len);
return (NULL);
}
break;
@@ -170,7 +170,7 @@ vmemap(sc, vmeaddr, len, bustype)
{
void *pa, *va;
- pa = vmepmap(sc, vmeaddr, len, bustype);
+ pa = vmepmap((struct device *)sc, vmeaddr, len, bustype);
if (pa == NULL)
return (NULL);
va = mapiodev(pa, len);
@@ -187,7 +187,7 @@ vmeunmap(va, len)
int
vmerw(sc, uio, flags, bus)
- struct vmesoftc *sc;
+ struct device *sc;
struct uio *uio;
int flags;
int bus;
@@ -214,7 +214,7 @@ vmerw(sc, uio, flags, bus)
c = NBPG - (v & PGOFSET);
if (c == 0)
return (0);
- vme = vmemap(sc, v & ~PGOFSET,
+ vme = vmemap((struct vmesoftc *)sc, v & ~PGOFSET,
NBPG, BUS_VMES);
if (vme == NULL) {
error = EFAULT; /* XXX? */
diff --git a/sys/arch/mvme88k/dev/vme.h b/sys/arch/mvme88k/dev/vme.h
index b9fc049b7a4..2dc06011d28 100644
--- a/sys/arch/mvme88k/dev/vme.h
+++ b/sys/arch/mvme88k/dev/vme.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.h,v 1.12 2003/12/25 21:01:39 miod Exp $ */
+/* $OpenBSD: vme.h,v 1.13 2003/12/28 19:44:26 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -34,109 +34,6 @@ struct vmesoftc {
struct intrhand sc_abih; /* `abort' switch */
};
-struct vmessoftc {
- struct device sc_dev;
- struct vmesoftc *sc_vme;
-};
-
-struct vmelsoftc {
- struct device sc_dev;
- struct vmesoftc *sc_vme;
-};
-
-/*
- * MVME147 vme configuration registers.
-*/
-struct vme1reg {
-/*01*/ volatile u_short vme1_scon;
-#define VME1_SCON_SWITCH 0x01 /* SCON jumper is set */
-#define VME1_SCON_SRESET 0x02 /* assert SRESET on bus */
-#define VME1_SCON_SYSFAIL 0x04 /* assert SYSFAIL on bus */
-#define VME1_SCON_ROBIN 0x08 /* round robin bus requests */
-/*03*/ volatile u_short vme1_reqconf;
-#define VME1_REQ_IPLMASK 0x03 /* interrupt level for requester */
-#define VME1_REQ_RNEVER 0x08
-#define VME1_REQ_RWD 0x10
-#define VME1_REQ_DHB 0x40
-#define VME1_REQ_DWB 0x80
-/*05*/ volatile u_short vme1_masconf;
-#define VME1_MAS_D16 0x01 /* force d8/16 accesses only */
-#define VME1_MAS_MASA24 0x02 /* send address mod for A24 access */
-#define VME1_MAS_MASA16 0x04 /* send address mod for A16 access */
-#define VME1_MAS_MASUAT 0x08 /* handle unaligned VME cycles */
-#define VME1_MAS_CFILL 0x10 /* DO NOT USE */
-#define VME1_MAS_MASWP 0x20 /* VME fast mode (DO NOT USE) */
-/*07*/ volatile u_short vme1_slconf;
-#define VME1_SLAVE_SLVD16 0x01 /* DO NOT USE */
-#define VME1_SLAVE_SLVWP 0x20 /* DO NOT USE */
-#define VME1_SLAVE_SLVEN 0x80 /* allow access to onboard DRAM */
-/*09*/ volatile u_short vme1_timerconf;
-#define VME1_TIMER_LOCAL_MASK 0x03
-#define VME1_TIMER_LOCAL_T0 0x00 /* local timeout 102 microsec */
-#define VME1_TIMER_LOCAL_T1 0x01 /* local timeout 205 microsec */
-#define VME1_TIMER_LOCAL_T2 0x02 /* local timeout 410 microsec */
-#define VME1_TIMER_LOCAL_T3 0x03 /* local timeout disabled */
-#define VME1_TIMER_VMEACC_MASK 0x0c
-#define VME1_TIMER_VMEACC_T0 0x00 /* VME access timeout 102 microsec */
-#define VME1_TIMER_VMEACC_T1 0x04 /* VME access timeout 1.6 millisec */
-#define VME1_TIMER_VMEACC_T2 0x08 /* VME access timeout 51 millisec */
-#define VME1_TIMER_VMEACC_T3 0x0c /* VME access timeout disabled */
-#define VME1_TIMER_VMEGLO_MASK 0x30
-#define VME1_TIMER_VMEGLO_T0 0x00 /* VME glob timeout 102 microsec */
-#define VME1_TIMER_VMEGLO_T1 0x10 /* VME glob timeout 205 microsec */
-#define VME1_TIMER_VMEGLO_T2 0x20 /* VME glob timeout 410 microsec */
-#define VME1_TIMER_VMEGLO_T3 0x30 /* VME glob timeout disabled */
-#define VME1_TIMER_ARBTO 0x40 /* enable VME arbitration timer */
-/*0b*/ volatile u_short vme1_sladdrmod;
-#define VME1_SLMOD_DATA 0x01
-#define VME1_SLMOD_PRGRM 0x02
-#define VME1_SLMOD_BLOCK 0x04
-#define VME1_SLMOD_SHORT 0x08
-#define VME1_SLMOD_STND 0x10
-#define VME1_SLMOD_EXTED 0x20
-#define VME1_SLMOD_USER 0x40
-#define VME1_SLMOD_SUPER 0x80
-/*0d*/ volatile u_short vme1_msaddrmod;
-#define VME1_MSMOD_AM_MASK 0x3f
-#define VME1_MSMOD_AMSEL 0x80
-/*0f*/ volatile u_short vme1_irqen;
-#define VME1_IRQ_VME(x) (1 << (x))
-/*11*/ volatile u_short vme1_uirqen;
-/*13*/ volatile u_short vme1_uirq;
-/*15*/ volatile u_short vme1_irq;
-/*17*/ volatile u_short vme1_vmeid;
-/*19*/ volatile u_short vme1_buserr;
-/*1b*/ volatile u_short vme1_gcsr;
-#define VME1_GCSR_OFF 0x0f
-/*1d*/ u_short :16;
-/*1f*/ u_short :16;
-/*21*/ volatile u_short vme1_gcsr_gr0;
-/*23*/ volatile u_short vme1_gcsr_gr1;
-/*25*/ volatile u_short vme1_gcsr_boardid;
-/*27*/ volatile u_short vme1_gcsr_gpr0;
-/*29*/ volatile u_short vme1_gcsr_gpr1;
-/*2b*/ volatile u_short vme1_gcsr_gpr2;
-/*2d*/ volatile u_short vme1_gcsr_gpr3;
-/*2f*/ volatile u_short vme1_gcsr_gpr4;
-};
-
-/*
- * Basic VME memory layout for the MVME147 follows:
- * - A32D32 accesses occur at memsize-0xefffffff. This makes it
- * impossible to do A32D32 accesses before the end of your onboard
- * memory. If you want to do low address A24D32 accesses, and you
- * have 16M or more onboard memory you'll find you cannot.
- * - A32D16 accesses can occur at 0xf0000000-0xff7fffff.
- * - A16D16 accesses can occur at 0xffff0000-0xffffffff.
- */
-#define VME1_A32D32BASE 0x00000000UL
-#define VME1_A32D32LEN 0xf0000000UL
-#define VME1_A32D16BASE 0xf0000000UL
-#define VME1_A32D16LEN 0x0f800000UL
-#define VME1_A16D16BASE 0xffff0000UL
-#define VME1_A16D16LEN 0x00010000UL
-#define VME1_A16BASE 0xffff0000UL
-
/*
* XXX: this chip has some rather inane access rules!
*/
@@ -368,8 +265,8 @@ struct vme2reg {
#define VME2_A16BASE 0xffff0000UL
#define VME2_A24BASE 0xff000000UL
-void *vmepmap(struct vmesoftc *sc, off_t vmeaddr, int len, int bustype);
-int vmerw(struct vmesoftc *sc, struct uio *uio, int flags, int bus);
+void *vmepmap(struct device *sc, off_t vmeaddr, int len, int bustype);
+int vmerw(struct device *sc, struct uio *uio, int flags, int bus);
int vmeintr_establish(int vec, struct intrhand *ih);
int vme_findvec(void);
int vmescan(struct device *, void *, void *, int);
diff --git a/sys/arch/mvme88k/dev/vmel.c b/sys/arch/mvme88k/dev/vmel.c
index f75813807e4..01a0b5875b8 100644
--- a/sys/arch/mvme88k/dev/vmel.c
+++ b/sys/arch/mvme88k/dev/vmel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmel.c,v 1.12 2003/12/19 22:30:18 miod Exp $ */
+/* $OpenBSD: vmel.c,v 1.13 2003/12/28 19:44:26 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -48,7 +48,7 @@ void vmelattach(struct device *, struct device *, void *);
int vmelmatch(struct device *, void *, void *);
struct cfattach vmel_ca = {
- sizeof(struct vmelsoftc), vmelmatch, vmelattach
+ sizeof(struct device), vmelmatch, vmelattach
};
struct cfdriver vmel_cd = {
@@ -78,12 +78,8 @@ vmelattach(parent, self, args)
struct device *parent, *self;
void *args;
{
- struct vmelsoftc *sc = (struct vmelsoftc *)self;
-
printf("\n");
- sc->sc_vme = (struct vmesoftc *)parent;
-
config_search(vmelscan, self, args);
}
@@ -137,9 +133,9 @@ vmelread(dev, uio, flags)
int flags;
{
int unit = minor(dev);
- struct vmelsoftc *sc = (struct vmelsoftc *) vmel_cd.cd_devs[unit];
+ struct device *sc = (struct device *)vmel_cd.cd_devs[unit];
- return (vmerw(sc->sc_vme, uio, flags, BUS_VMEL));
+ return (vmerw(sc->dv_parent, uio, flags, BUS_VMEL));
}
int
@@ -149,9 +145,9 @@ vmelwrite(dev, uio, flags)
int flags;
{
int unit = minor(dev);
- struct vmelsoftc *sc = (struct vmelsoftc *) vmel_cd.cd_devs[unit];
+ struct device *sc = (struct device *)vmel_cd.cd_devs[unit];
- return (vmerw(sc->sc_vme, uio, flags, BUS_VMEL));
+ return (vmerw(sc->dv_parent, uio, flags, BUS_VMEL));
}
paddr_t
@@ -161,10 +157,10 @@ vmelmmap(dev, off, prot)
int prot;
{
int unit = minor(dev);
- struct vmelsoftc *sc = (struct vmelsoftc *) vmel_cd.cd_devs[unit];
+ struct device *sc = (struct device *)vmel_cd.cd_devs[unit];
void * pa;
- pa = vmepmap(sc->sc_vme, off, NBPG, BUS_VMEL);
+ pa = vmepmap(sc->dv_parent, off, NBPG, BUS_VMEL);
#ifdef DEBUG
printf("vmel %llx pa %p\n", off, pa);
#endif
diff --git a/sys/arch/mvme88k/dev/vmes.c b/sys/arch/mvme88k/dev/vmes.c
index 6352ebedea0..8b70e83adb4 100644
--- a/sys/arch/mvme88k/dev/vmes.c
+++ b/sys/arch/mvme88k/dev/vmes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmes.c,v 1.15 2003/12/27 23:57:06 miod Exp $ */
+/* $OpenBSD: vmes.c,v 1.16 2003/12/28 19:44:26 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -48,7 +48,7 @@ void vmesattach(struct device *, struct device *, void *);
int vmesmatch(struct device *, void *, void *);
struct cfattach vmes_ca = {
- sizeof(struct vmessoftc), vmesmatch, vmesattach
+ sizeof(struct device), vmesmatch, vmesattach
};
struct cfdriver vmes_cd = {
@@ -78,12 +78,8 @@ vmesattach(parent, self, args)
struct device *parent, *self;
void *args;
{
- struct vmessoftc *sc = (struct vmessoftc *)self;
-
printf("\n");
- sc->sc_vme = (struct vmesoftc *)parent;
-
config_search(vmesscan, self, args);
}
@@ -137,9 +133,9 @@ vmesread(dev, uio, flags)
int flags;
{
int unit = minor(dev);
- struct vmessoftc *sc = (struct vmessoftc *) vmes_cd.cd_devs[unit];
+ struct device *sc = (struct device *)vmes_cd.cd_devs[unit];
- return (vmerw(sc->sc_vme, uio, flags, BUS_VMES));
+ return (vmerw(sc->dv_parent, uio, flags, BUS_VMES));
}
int
@@ -149,9 +145,9 @@ vmeswrite(dev, uio, flags)
int flags;
{
int unit = minor(dev);
- struct vmessoftc *sc = (struct vmessoftc *) vmes_cd.cd_devs[unit];
+ struct device *sc = (struct device *)vmes_cd.cd_devs[unit];
- return (vmerw(sc->sc_vme, uio, flags, BUS_VMES));
+ return (vmerw(sc->dv_parent, uio, flags, BUS_VMES));
}
paddr_t
@@ -161,10 +157,10 @@ vmesmmap(dev, off, prot)
int prot;
{
int unit = minor(dev);
- struct vmessoftc *sc = (struct vmessoftc *) vmes_cd.cd_devs[unit];
+ struct device *sc = (struct device *)vmes_cd.cd_devs[unit];
void * pa;
- pa = vmepmap(sc->sc_vme, off, NBPG, BUS_VMES);
+ pa = vmepmap(sc->dv_parent, off, NBPG, BUS_VMES);
#ifdef DEBUG
printf("vmes %llx pa %p\n", off, pa);
#endif