summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-12-22 11:54:49 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-12-22 11:54:49 +0000
commitc6a1b850531133e6900c8f4dbdffe8fa1e232aea (patch)
tree8ab5079c21ce2ca4b4c7e9fc26e129b8b7da247c /sys/arch/mvme88k
parent46f9808a6613fd9a139db6fffc33fa4243a6cd95 (diff)
Correctly handle vme attachments which specify a larger ca_len size than
initially expected.
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r--sys/arch/mvme88k/dev/bugtty.c21
-rw-r--r--sys/arch/mvme88k/dev/clock.c4
-rw-r--r--sys/arch/mvme88k/dev/vme.c31
-rw-r--r--sys/arch/mvme88k/dev/vme.h5
-rw-r--r--sys/arch/mvme88k/dev/vx.c14
5 files changed, 37 insertions, 38 deletions
diff --git a/sys/arch/mvme88k/dev/bugtty.c b/sys/arch/mvme88k/dev/bugtty.c
index b5873c4a88a..a5177b07116 100644
--- a/sys/arch/mvme88k/dev/bugtty.c
+++ b/sys/arch/mvme88k/dev/bugtty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bugtty.c,v 1.17 2003/10/11 22:08:57 miod Exp $ */
+/* $OpenBSD: bugtty.c,v 1.18 2003/12/22 11:54:48 miod Exp $ */
/* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
@@ -77,17 +77,6 @@ char bug_obuffer[BUGBUF+1];
struct tty *bugtty_tty[NBUGTTY];
int needprom = 1;
-/*
- int ca_bustype;
- void *ca_vaddr;
- void *ca_paddr;
- int ca_offset;
- int ca_len;
- int ca_ipl;
- int ca_vec;
- char *ca_name;
- void *ca_master; points to bus-dependent data
-*/
int
bugttymatch(parent, self, aux)
@@ -97,13 +86,17 @@ bugttymatch(parent, self, aux)
{
struct confargs *ca = aux;
+ /*
+ * Do not attach if a suitable console driver has been attached.
+ * XXX but bugtty is probed first!
+ */
if (needprom == 0)
return (0);
+
ca->ca_paddr = (void *)0xfff45000;
ca->ca_vaddr = (void *)0xfff45000;
- ca->ca_len = 0x200;
ca->ca_ipl = IPL_TTY;
- ca->ca_name = "bugtty\0";
+ ca->ca_name = "bugtty";
return (1);
}
diff --git a/sys/arch/mvme88k/dev/clock.c b/sys/arch/mvme88k/dev/clock.c
index 58415f8bbe9..0b26e51bd2d 100644
--- a/sys/arch/mvme88k/dev/clock.c
+++ b/sys/arch/mvme88k/dev/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.27 2003/12/12 21:51:29 miod Exp $ */
+/* $OpenBSD: clock.c,v 1.28 2003/12/22 11:54:48 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1995 Theo de Raadt
@@ -173,8 +173,6 @@ clockmatch(struct device *parent, void *vcf, void *args)
* a message if it is different from what ioconf.c says.
*/
ca->ca_ipl = IPL_CLOCK;
- /* set size to 0 - see pcctwo.c:match for details */
- ca->ca_len = 0;
return (1);
}
diff --git a/sys/arch/mvme88k/dev/vme.c b/sys/arch/mvme88k/dev/vme.c
index 3cd5d7e0d2c..f9b62ed1bd2 100644
--- a/sys/arch/mvme88k/dev/vme.c
+++ b/sys/arch/mvme88k/dev/vme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.c,v 1.24 2003/12/19 22:30:18 miod Exp $ */
+/* $OpenBSD: vme.c,v 1.25 2003/12/22 11:54:48 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1995 Theo de Raadt
@@ -60,8 +60,9 @@ void vme2chip_init(struct vmesoftc *);
u_long vme2chip_map(u_long, int, int);
int vme2abort(void *);
int sysconabort(void *);
-void vmeunmap(void *, int);
int vmeprint(void *, const char *);
+void *vmemap(struct vmesoftc *sc, off_t vmeaddr, int len, int bustype);
+void vmeunmap(void *, int);
void vmesyscon_init(struct vmesoftc *);
@@ -249,6 +250,7 @@ vmescan(parent, child, args, bustype)
struct cfdata *cf = child;
struct vmesoftc *sc = (struct vmesoftc *)parent;
struct confargs oca;
+ size_t len;
if (parent->dv_cfdata->cf_driver->cd_indirect) {
printf(" indirect devices not supported\n");
@@ -264,24 +266,37 @@ vmescan(parent, child, args, bustype)
if (oca.ca_ipl > 0 && oca.ca_vec == -1)
oca.ca_vec = vme_findvec();
if (oca.ca_len == -1)
- oca.ca_len = 4096;
+ oca.ca_len = PAGE_SIZE;
+ len = oca.ca_len;
oca.ca_offset = (u_int)oca.ca_paddr;
oca.ca_vaddr = vmemap(sc, (vaddr_t)oca.ca_paddr, oca.ca_len,
oca.ca_bustype);
- if (!oca.ca_vaddr)
- oca.ca_vaddr = (void *)-1;
+ if (oca.ca_vaddr == NULL)
+ oca.ca_vaddr = (void *)-1; /* XXX */
oca.ca_master = (void *)sc;
oca.ca_name = cf->cf_driver->cd_name;
if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0) {
if (oca.ca_vaddr != (void *)-1)
- vmeunmap(oca.ca_vaddr, oca.ca_len);
+ vmeunmap(oca.ca_vaddr, len);
return (0);
}
+
/*
- * If match works, the driver is responsible for
- * vmunmap()ing if it does not need the mapping.
+ * Map the whole space the driver is interested in.
*/
+ if (len != oca.ca_len) {
+ vmeunmap(oca.ca_vaddr, len);
+ if (oca.ca_len != 0) {
+ if (vmemap(sc, (vaddr_t)oca.ca_paddr, oca.ca_len,
+ oca.ca_bustype) == NULL) {
+ printf("%s: can't map VME space\n",
+ oca.ca_name);
+ return (0);
+ }
+ }
+ }
+
config_attach(parent, cf, &oca, vmeprint);
return (1);
}
diff --git a/sys/arch/mvme88k/dev/vme.h b/sys/arch/mvme88k/dev/vme.h
index c12cf72fecb..e8286c62053 100644
--- a/sys/arch/mvme88k/dev/vme.h
+++ b/sys/arch/mvme88k/dev/vme.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.h,v 1.10 2003/10/11 22:08:57 miod Exp $ */
+/* $OpenBSD: vme.h,v 1.11 2003/12/22 11:54:48 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -368,8 +368,7 @@ struct vme2reg {
#define VME2_A16BASE 0xffff0000UL
#define VME2_A24BASE 0xff000000UL
-void * vmepmap(struct vmesoftc *sc, off_t vmeaddr, int len, int bustype);
-void * vmemap(struct vmesoftc *sc, off_t vmeaddr, int len, int bustype);
+void *vmepmap(struct vmesoftc *sc, off_t vmeaddr, int len, int bustype);
int vmerw(struct vmesoftc *sc, struct uio *uio, int flags, int bus);
int vmeintr_establish(int vec, struct intrhand *ih);
int vme_findvec(void);
diff --git a/sys/arch/mvme88k/dev/vx.c b/sys/arch/mvme88k/dev/vx.c
index 6f5d20ff0b1..2eea375d73f 100644
--- a/sys/arch/mvme88k/dev/vx.c
+++ b/sys/arch/mvme88k/dev/vx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vx.c,v 1.24 2003/11/09 00:31:59 miod Exp $ */
+/* $OpenBSD: vx.c,v 1.25 2003/12/22 11:54:48 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* All rights reserved.
@@ -161,9 +161,6 @@ struct cfdriver vx_cd = {
#define VX_UNIT(x) (int)(minor(x) / 9)
#define VX_PORT(x) (int)(minor(x) % 9)
-struct envelope *bpp_wait;
-unsigned int board_addr;
-
struct tty * vxtty(dev)
dev_t dev;
{
@@ -187,17 +184,14 @@ vxmatch(parent, self, aux)
struct vxreg *vx_reg;
struct confargs *ca = aux;
-#ifdef OLD_MAPPINGS
- ca->ca_vaddr = ca->ca_paddr;
-#endif
- ca->ca_len = 0x10000; /* we know this. */
ca->ca_ipl = 3; /* we need interrupts for this board to work */
+ ca->ca_len = 0x10000; /* we know this */
vx_reg = (struct vxreg *)ca->ca_vaddr;
- board_addr = (unsigned int)ca->ca_vaddr;
if (badvaddr((unsigned)&vx_reg->ipc_cr, 1))
return (0);
- return (1);
+
+ return (1);
}
void