diff options
| author | drochner <drochner@NetBSD.org> | 1999-06-30 15:07:45 +0000 |
|---|---|---|
| committer | drochner <drochner@NetBSD.org> | 1999-06-30 15:07:45 +0000 |
| commit | 83eb712e3cb7a67af752fcdd0e1639e9e8989216 (patch) | |
| tree | bbb361a3162ef09ed72c133eff93545bce1e2516 /sys/dev | |
| parent | 44418fdf70bb5522a229c589a405cb5ccc49dc6d (diff) | |
update for new VME framework
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/vme/if_ie_vme.c | 217 | ||||
| -rw-r--r-- | sys/dev/vme/xd.c | 77 | ||||
| -rw-r--r-- | sys/dev/vme/xy.c | 77 | ||||
| -rw-r--r-- | sys/dev/vme/xyvar.h | 3 |
4 files changed, 253 insertions, 121 deletions
diff --git a/sys/dev/vme/if_ie_vme.c b/sys/dev/vme/if_ie_vme.c index e9564b5af51..caa93fed09d 100644 --- a/sys/dev/vme/if_ie_vme.c +++ b/sys/dev/vme/if_ie_vme.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie_vme.c,v 1.6 1999/03/23 12:01:45 pk Exp $ */ +/* $NetBSD: if_ie_vme.c,v 1.7 1999/06/30 15:07:45 drochner Exp $ */ /*- * Copyright (c) 1995 Charles D. Cranor @@ -160,11 +160,13 @@ #include <vm/vm.h> #include <machine/bus.h> +#include <machine/intr.h> #include <dev/vme/vmevar.h> #include <dev/ic/i82586reg.h> #include <dev/ic/i82586var.h> +#include "locators.h" /* * VME/multibus definitions @@ -235,10 +237,20 @@ static int ie_vmeintr __P((struct ie_softc *, int)); int ie_vme_match __P((struct device *, struct cfdata *, void *)); void ie_vme_attach __P((struct device *, struct device *, void *)); +struct ie_vme_softc { + struct ie_softc ie; + bus_space_tag_t ievt; + bus_space_handle_t ievh; +}; + struct cfattach ie_vme_ca = { - sizeof(struct ie_softc), ie_vme_match, ie_vme_attach + sizeof(struct ie_vme_softc), ie_vme_match, ie_vme_attach }; +#define read_iev(sc, reg) \ + bus_space_read_2(sc->ievt, sc->ievh, offsetof(struct ievme, reg)) +#define write_iev(sc, reg, val) \ + bus_space_write_2(sc->ievt, sc->ievh, offsetof(struct ievme, reg), val) /* * MULTIBUS/VME support routines @@ -248,29 +260,32 @@ ie_vmereset(sc, what) struct ie_softc *sc; int what; { - volatile struct ievme *iev = (struct ievme *) sc->sc_reg; - iev->status = IEVME_RESET; + struct ie_vme_softc *vsc = (struct ie_vme_softc *)sc; + write_iev(vsc, status, IEVME_RESET); delay(100); /* XXX could be shorter? */ - iev->status = 0; + write_iev(vsc, status, 0); } void ie_vmeattend(sc) struct ie_softc *sc; { - volatile struct ievme *iev = (struct ievme *) sc->sc_reg; + struct ie_vme_softc *vsc = (struct ie_vme_softc *)sc; - iev->status |= IEVME_ATTEN; /* flag! */ - iev->status &= ~IEVME_ATTEN; /* down. */ + /* flag! */ + write_iev(vsc, status, read_iev(vsc, status) | IEVME_ATTEN); + /* down. */ + write_iev(vsc, status, read_iev(vsc, status) & ~IEVME_ATTEN); } void ie_vmerun(sc) struct ie_softc *sc; { - volatile struct ievme *iev = (struct ievme *) sc->sc_reg; + struct ie_vme_softc *vsc = (struct ie_vme_softc *)sc; - iev->status |= (IEVME_ONAIR | IEVME_IENAB | IEVME_PEINT); + write_iev(vsc, status, read_iev(vsc, status) + | IEVME_ONAIR | IEVME_IENAB | IEVME_PEINT); } int @@ -278,7 +293,7 @@ ie_vmeintr(sc, where) struct ie_softc *sc; int where; { - volatile struct ievme *iev = (volatile struct ievme *)sc->sc_reg; + struct ie_vme_softc *vsc = (struct ie_vme_softc *)sc; if (where != INTR_ENTER) return (0); @@ -286,11 +301,12 @@ ie_vmeintr(sc, where) /* * check for parity error */ - if (iev->status & IEVME_PERR) { + if (read_iev(vsc, status) & IEVME_PERR) { printf("%s: parity error (ctrl 0x%x @ 0x%02x%04x)\n", - sc->sc_dev.dv_xname, iev->pectrl, - iev->pectrl & IEVME_HADDR, iev->peaddr); - iev->pectrl = iev->pectrl | IEVME_PARACK; + sc->sc_dev.dv_xname, read_iev(vsc, pectrl), + read_iev(vsc, pectrl) & IEVME_HADDR, + read_iev(vsc, peaddr)); + write_iev(vsc, pectrl, read_iev(vsc, pectrl) | IEVME_PARACK); } return (0); } @@ -308,12 +324,32 @@ ie_memcopyin(sc, p, offset, size) int offset; size_t size; { - void *addr = (void *)((u_long)sc->bh + offset);/*XXX - not MI!*/ - wcopy(addr, p, size); + size_t help; + + if ((offset & 1) && ((u_long)p & 1) && size > 0) { + *(u_int8_t *)p = bus_space_read_1(sc->bt, sc->bh, offset); + offset++; + p = (u_int8_t *)p + 1; + size--; + } + + if ((offset & 1) || ((u_long)p & 1)) { + bus_space_read_region_1(sc->bt, sc->bh, offset, p, size); + return; + } + + help = size / 2; + bus_space_read_region_2(sc->bt, sc->bh, offset, p, help); + if (2 * help == size) + return; + + offset += 2 * help; + p = (u_int16_t *)p + help; + *(u_int8_t *)p = bus_space_read_1(sc->bt, sc->bh, offset); } /* - * Copy from kernel space to naord memory. + * Copy from kernel space to board memory. */ void ie_memcopyout(sc, p, offset, size) @@ -322,8 +358,28 @@ ie_memcopyout(sc, p, offset, size) int offset; size_t size; { - void *addr = (void *)((u_long)sc->bh + offset);/*XXX - not MI!*/ - wcopy(p, addr, size); + size_t help; + + if ((offset & 1) && ((u_long)p & 1) && size > 0) { + bus_space_write_1(sc->bt, sc->bh, offset, *(u_int8_t *)p); + offset++; + p = (u_int8_t *)p + 1; + size--; + } + + if ((offset & 1) || ((u_long)p & 1)) { + bus_space_write_region_1(sc->bt, sc->bh, offset, p, size); + return; + } + + help = size / 2; + bus_space_write_region_2(sc->bt, sc->bh, offset, p, help); + if (2 * help == size) + return; + + offset += 2 * help; + p = (u_int16_t *)p + help; + bus_space_write_1(sc->bt, sc->bh, offset, *(u_int8_t *)p); } /* read a 16-bit value at BH offset */ @@ -383,12 +439,50 @@ ie_vme_match(parent, cf, aux) void *aux; { struct vme_attach_args *va = aux; - vme_chipset_tag_t ct = va->vma_chipset_tag; - bus_space_tag_t bt = va->vma_bustag; - int mod; + vme_chipset_tag_t ct = va->va_vct; + vme_am_t mod; + int error; - mod = VMEMOD_A24 | VMEMOD_S | VMEMOD_D; - return (vme_bus_probe(ct, bt, va->vma_reg[0], 0, 2, mod, 0, 0)); + if (va->numcfranges < 2) { + printf("ie_vme_match: need 2 ranges\n"); + return (0); + } + if ((va->r[1].offset & 0xff0fffff) || + ((va->r[0].offset & 0xfff00000) + != (va->r[1].offset & 0xfff00000))) { + printf("ie_vme_match: base address mismatch\n"); + return (0); + } + if (va->r[0].size != VMECF_LEN_DEFAULT && + va->r[0].size != sizeof(sizeof(struct ievme))) { + printf("ie_vme_match: bad csr size\n"); + return (0); + } + if (va->r[1].size == VMECF_LEN_DEFAULT) { + printf("ie_vme_match: must specify memory size\n"); + return (0); + } + + mod = 0x3d; /* VME_AM_A24|VME_AM_MBO|VME_AM_SUPER|VME_AM_DATA */ + + if (va->r[0].am != VMECF_AM_DEFAULT && + va->r[0].am != mod) + return (0); + + if (vme_space_alloc(va->va_vct, va->r[0].offset, + sizeof(struct ievme), mod)) + return (0); + if (vme_space_alloc(va->va_vct, va->r[1].offset, + va->r[1].size, mod)) { + vme_space_free(va->va_vct, va->r[0].offset, + sizeof(struct ievme), mod); + return (0); + } + error = vme_probe(ct, va->r[0].offset, 2, mod, VME_D16, 0, 0); + vme_space_free(va->va_vct, va->r[0].offset, sizeof(struct ievme), mod); + vme_space_free(va->va_vct, va->r[1].offset, va->r[1].size, mod); + + return (error == 0); } void @@ -398,28 +492,34 @@ ie_vme_attach(parent, self, aux) void *aux; { u_int8_t myaddr[ETHER_ADDR_LEN]; +#ifdef sparc extern void myetheraddr(u_char *); /* should be elsewhere */ - struct ie_softc *sc = (void *) self; +#endif + struct ie_vme_softc *vsc = (void *) self; struct vme_attach_args *va = aux; - vme_chipset_tag_t ct = va->vma_chipset_tag; - bus_space_tag_t bt = va->vma_bustag; - bus_space_handle_t bh; + vme_chipset_tag_t ct = va->va_vct; + struct ie_softc *sc; vme_intr_handle_t ih; - volatile struct ievme *iev; - u_long rampaddr; - int lcv; - vme_size_t sz; + vme_addr_t rampaddr; + vme_size_t memsize; + vme_mapresc_t resc; + int lcv; - int mod; + vme_am_t mod; /* * *note*: we don't detect the difference between a VME3E and * a multibus/vme card. if you want to use a 3E you'll have * to fix this. */ - mod = VMEMOD_A24 | VMEMOD_S | VMEMOD_D; + mod = 0x3d; /* VME_AM_A24|VME_AM_MBO|VME_AM_SUPER|VME_AM_DATA */ + if (vme_space_alloc(va->va_vct, va->r[0].offset, + sizeof(struct ievme), mod) || + vme_space_alloc(va->va_vct, va->r[1].offset, + va->r[1].size, mod)) + panic("if_ie: vme alloc"); - sc->bt = bt; + sc = &vsc->ie; sc->hwreset = ie_vmereset; sc->hwinit = ie_vmerun; @@ -430,37 +530,34 @@ ie_vme_attach(parent, self, aux) sc->ie_bus_read16 = ie_vme_read16; sc->ie_bus_write16 = ie_vme_write16; sc->ie_bus_write24 = ie_vme_write24; - sc->sc_msize = 4*65536; /* XXX */ - sz = sizeof(struct ievme); - if (vme_bus_map(ct, va->vma_reg[0], sz, mod, bt, &bh) != 0) - panic("if_ie: vme_map"); - sc->sc_reg = (caddr_t)bh; + memsize = va->r[1].size; - iev = (volatile struct ievme *) sc->sc_reg; - /* top 12 bits */ - rampaddr = (u_long)va->vma_reg[0] & 0xfff00000; + if (vme_space_map(ct, va->r[0].offset, sizeof(struct ievme), mod, + VME_D16 | VME_D8, 0, + &vsc->ievt, &vsc->ievh, &resc) != 0) + panic("if_ie: vme map csr"); - /* 4 more */ - rampaddr = rampaddr | ((iev->status & IEVME_HADDR) << 16); - sz = sc->sc_msize; - if (vme_bus_map(ct, rampaddr, sz, mod, bt, &bh) != 0) - panic("if_ie: vme_map"); + rampaddr = va->r[1].offset; - sc->bh = bh; + /* 4 more */ + rampaddr = rampaddr | ((read_iev(vsc, status) & IEVME_HADDR) << 16); + if (vme_space_map(ct, rampaddr, memsize, mod, VME_D16 | VME_D8, 0, + &sc->bt, &sc->bh, &resc) != 0) + panic("if_ie: vme map mem"); - iev->pectrl = iev->pectrl | IEVME_PARACK; /* clear to start */ + write_iev(vsc, pectrl, read_iev(vsc, pectrl) | IEVME_PARACK); /* * Set up mappings, direct map except for last page * which is mapped at zero and at high address (for scp) */ for (lcv = 0; lcv < IEVME_MAPSZ - 1; lcv++) - iev->pgmap[lcv] = IEVME_SBORDR | IEVME_OBMEM | lcv; - iev->pgmap[IEVME_MAPSZ - 1] = IEVME_SBORDR | IEVME_OBMEM | 0; + write_iev(vsc, pgmap[lcv], IEVME_SBORDR | IEVME_OBMEM | lcv); + write_iev(vsc, pgmap[IEVME_MAPSZ - 1], IEVME_SBORDR | IEVME_OBMEM | 0); /* Clear all ram */ - bus_space_set_region_2(sc->bt, sc->bh, 0, 0, sc->sc_msize/2); + bus_space_set_region_2(sc->bt, sc->bh, 0, 0, memsize/2); /* * We use the first page to set up SCP, ICSP and SCB data @@ -490,15 +587,17 @@ ie_vme_attach(parent, self, aux) * Rest of first page is unused; rest of ram for buffers. */ sc->buf_area = IEVME_PAGESIZE; - sc->buf_area_sz = sc->sc_msize - IEVME_PAGESIZE; + sc->buf_area_sz = memsize - IEVME_PAGESIZE; sc->do_xmitnopchain = 0; + printf("\n%s:", self->dv_xname); + +#ifdef sparc myetheraddr(myaddr); +#endif i82586_attach(sc, "multibus/vme", myaddr, media, NMEDIA, media[0]); - vme_intr_map(ct, va->vma_vec, va->vma_pri, &ih); - vme_intr_establish(ct, ih, i82586_intr, sc); - - vme_bus_establish(ct, &sc->sc_dev); + vme_intr_map(ct, va->ilevel, va->ivector, &ih); + vme_intr_establish(ct, ih, IPL_NET, i82586_intr, sc); } diff --git a/sys/dev/vme/xd.c b/sys/dev/vme/xd.c index 15800ddd82a..950b3dda8b1 100644 --- a/sys/dev/vme/xd.c +++ b/sys/dev/vme/xd.c @@ -1,4 +1,4 @@ -/* $NetBSD: xd.c,v 1.14 1999/03/05 10:38:16 pk Exp $ */ +/* $NetBSD: xd.c,v 1.15 1999/06/30 15:07:45 drochner Exp $ */ /* * @@ -76,9 +76,8 @@ #include <vm/vm.h> #include <vm/vm_kern.h> -#include <machine/autoconf.h> #include <machine/bus.h> -#include <machine/conf.h> +#include <machine/intr.h> #if defined(__sparc__) || defined(__sun3__) #include <dev/sun/disklabel.h> @@ -238,11 +237,14 @@ int xdcmatch __P((struct device *, struct cfdata *, void *)); void xdcattach __P((struct device *, struct device *, void *)); int xdmatch __P((struct device *, struct cfdata *, void *)); void xdattach __P((struct device *, struct device *, void *)); -static int xdc_probe __P((void *, void *)); +static int xdc_probe __P((void *, bus_space_tag_t, bus_space_handle_t)); static void xddummystrat __P((struct buf *)); int xdgetdisklabel __P((struct xd_softc *, void *)); +bdev_decl(xd); +cdev_decl(xd); + /* XXX - think about this more.. xd_machdep? */ void md_setup __P((void)); int XDC_DELAY; @@ -346,6 +348,7 @@ xdgetdisklabel(xd, b) printf("%s: WARNING: guessing pcyl=%d (ncyl+acyl)\n", xd->sc_dev.dv_xname, xd->pcyl); } +#endif xd->ncyl = xd->sc_dk.dk_label->d_ncylinders; xd->acyl = xd->sc_dk.dk_label->d_acylinders; @@ -371,16 +374,17 @@ xdgetdisklabel(xd, b) */ int -xdc_probe(vaddr, arg) - void *vaddr; +xdc_probe(arg, tag, handle) void *arg; + bus_space_tag_t tag; + bus_space_handle_t handle; { - struct xdc *xdc = vaddr; + struct xdc *xdc = (void *)handle; /* XXX */ int del = 0; xdc->xdc_csr = XDC_RESET; XDC_WAIT(xdc, del, XDC_RESETUSEC, XDC_RESET); - return (del > 0); + return (del > 0 ? 0 : EIO); } int xdcmatch(parent, cf, aux) @@ -389,14 +393,19 @@ int xdcmatch(parent, cf, aux) void *aux; { struct vme_attach_args *va = aux; - vme_chipset_tag_t ct = va->vma_chipset_tag; - bus_space_tag_t bt = va->vma_bustag; - vme_mod_t mod; - - mod = VMEMOD_A16 | VMEMOD_S | VMEMOD_D | VMEMOD_D32; - return (vme_bus_probe(ct, bt, va->vma_reg[0], - offsetof(struct xdc, xdc_csr), 1, - mod, xdc_probe, 0)); + vme_chipset_tag_t ct = va->va_vct; + vme_am_t mod; + int error; + + mod = 0x2d; /* VME_AM_A16 | VME_AM_MBO | VME_AM_SUPER | VME_AM_DATA */ + if (vme_space_alloc(va->va_vct, va->r[0].offset, sizeof(struct xdc), + mod)) + return (0); + error = vme_probe(ct, va->r[0].offset, sizeof(struct xdc), + mod, VME_D32, xdc_probe, 0); + vme_space_free(va->va_vct, va->r[0].offset, sizeof(struct xdc), mod); + + return (error == 0); } /* @@ -409,33 +418,37 @@ xdcattach(parent, self, aux) { struct vme_attach_args *va = aux; - vme_chipset_tag_t ct = va->vma_chipset_tag; - bus_space_tag_t bt = va->vma_bustag; + vme_chipset_tag_t ct = va->va_vct; + bus_space_tag_t bt; bus_space_handle_t bh; vme_intr_handle_t ih; - vme_mod_t mod; + vme_am_t mod; struct xdc_softc *xdc = (void *) self; struct xdc_attach_args xa; int lcv, rqno, error; struct xd_iopb_ctrl *ctl; bus_dma_segment_t seg; int rseg; + vme_mapresc_t resc; md_setup(); /* get addressing and intr level stuff from autoconfig and load it * into our xdc_softc. */ - xdc->dmatag = va->vma_dmatag; - mod = VMEMOD_A16 | VMEMOD_S | VMEMOD_D | VMEMOD_D32; + xdc->dmatag = va->va_bdt; + mod = 0x2d; /* VME_AM_A16 | VME_AM_MBO | VME_AM_SUPER | VME_AM_DATA */ - if (vme_bus_map(ct, va->vma_reg[0], sizeof(struct xdc), - mod, bt, &bh) != 0) + if (vme_space_alloc(va->va_vct, va->r[0].offset, sizeof(struct xdc), + mod)) + panic("xdc: vme alloc"); + if (vme_space_map(ct, va->r[0].offset, sizeof(struct xdc), + mod, VME_D32, 0, &bt, &bh, &resc) != 0) panic("xdc: vme_map"); - xdc->xdc = (struct xdc *) bh; - xdc->ipl = va->vma_pri; - xdc->vector = va->vma_vec; + xdc->xdc = (struct xdc *) bh; /* XXX */ + xdc->ipl = va->ilevel; + xdc->vector = va->ivector; for (lcv = 0; lcv < XDC_MAXDEV; lcv++) xdc->sc_drives[lcv] = (struct xd_softc *) 0; @@ -547,10 +560,9 @@ xdcattach(parent, self, aux) } /* link in interrupt with higher level software */ - vme_intr_map(ct, va->vma_vec, va->vma_pri, &ih); - vme_intr_establish(ct, ih, xdcintr, xdc); + vme_intr_map(ct, va->ivector, va->ilevel, &ih); + vme_intr_establish(ct, ih, IPL_BIO, xdcintr, xdc); evcnt_attach(&xdc->sc_dev, "intr", &xdc->sc_intrcnt); - vme_bus_establish(ct, &xdc->sc_dev); /* now we must look for disks using autoconfig */ @@ -2089,7 +2101,10 @@ xdc_error(xdcsc, iorq, iopb, rqno, comm) { int errno = iorq->errno; int erract = errno & XD_ERA_MASK; - int oldmode, advance, i; + int oldmode, advance; +#ifdef sparc + int i; +#endif if (erract == XD_ERA_RSET) { /* some errors require a reset */ oldmode = iorq->mode; @@ -2107,6 +2122,7 @@ xdc_error(xdcsc, iorq, iopb, rqno, comm) (iorq->mode & XD_MODE_B144) == 0) { advance = iorq->sectcnt - iopb->sectcnt; XDC_ADVANCE(iorq, advance); +#ifdef sparc if ((i = isbad(&iorq->xd->dkb, iorq->blockno / iorq->xd->sectpercyl, (iorq->blockno / iorq->xd->nsect) % iorq->xd->nhead, iorq->blockno % iorq->xd->nsect)) != -1) { @@ -2124,6 +2140,7 @@ xdc_error(xdcsc, iorq, iopb, rqno, comm) xdc_start(xdcsc, 1); /* resubmit */ return (XD_ERR_AOK); /* recovered! */ } +#endif } /* diff --git a/sys/dev/vme/xy.c b/sys/dev/vme/xy.c index 30420ca774d..84dd045a65c 100644 --- a/sys/dev/vme/xy.c +++ b/sys/dev/vme/xy.c @@ -1,4 +1,4 @@ -/* $NetBSD: xy.c,v 1.11 1999/03/05 10:38:16 pk Exp $ */ +/* $NetBSD: xy.c,v 1.12 1999/06/30 15:07:45 drochner Exp $ */ /* * @@ -76,15 +76,15 @@ #include <vm/vm.h> #include <vm/vm_kern.h> -#include <machine/autoconf.h> #include <machine/bus.h> -#include <machine/conf.h> +#include <machine/intr.h> #if defined(__sparc__) || defined(__sun3__) #include <dev/sun/disklabel.h> #endif #include <dev/vme/vmevar.h> + #include <dev/vme/xyreg.h> #include <dev/vme/xyvar.h> #include <dev/vme/xio.h> @@ -179,11 +179,14 @@ int xycmatch __P((struct device *, struct cfdata *, void *)); void xycattach __P((struct device *, struct device *, void *)); int xymatch __P((struct device *, struct cfdata *, void *)); void xyattach __P((struct device *, struct device *, void *)); -static int xyc_probe __P((void *, void *)); +static int xyc_probe __P((void *, bus_space_tag_t, bus_space_handle_t)); static void xydummystrat __P((struct buf *)); int xygetdisklabel __P((struct xy_softc *, void *)); +bdev_decl(xy); +cdev_decl(xy); + /* * cfattach's: device driver interface to autoconfig */ @@ -266,6 +269,7 @@ xygetdisklabel(xy, b) printf("%s: WARNING: guessing pcyl=%d (ncyl+acyl)\n", xy->sc_dev.dv_xname, xy->pcyl); } +#endif xy->ncyl = xy->sc_dk.dk_label->d_ncylinders; xy->acyl = xy->sc_dk.dk_label->d_acylinders; @@ -290,13 +294,14 @@ xygetdisklabel(xy, b) * soft reset to detect the xyc. */ int -xyc_probe(vaddr, arg) - void *vaddr; +xyc_probe(arg, tag, handle) void *arg; + bus_space_tag_t tag; + bus_space_handle_t handle; { - struct xyc *xyc = vaddr; + struct xyc *xyc = (void *)handle; /* XXX */ - return (xyc_unbusy(xyc, XYC_RESETUSEC) != XY_ERR_FAIL); + return ((xyc_unbusy(xyc, XYC_RESETUSEC) != XY_ERR_FAIL) ? 0 : EIO); } int xycmatch(parent, cf, aux) @@ -305,15 +310,19 @@ int xycmatch(parent, cf, aux) void *aux; { struct vme_attach_args *va = aux; - vme_chipset_tag_t ct = va->vma_chipset_tag; - bus_space_tag_t bt = va->vma_bustag; - vme_mod_t mod; - - mod = VMEMOD_A16 | VMEMOD_S | VMEMOD_D; - - return (vme_bus_probe(ct, bt, va->vma_reg[0], - offsetof(struct xyc, xyc_rsetup), 1, - mod, xyc_probe, 0)); + vme_chipset_tag_t ct = va->va_vct; + vme_am_t mod; + int error; + + mod = 0x2d; /* VME_AM_A16 | VME_AM_MBO | VME_AM_SUPER | VME_AM_DATA */ + if (vme_space_alloc(va->va_vct, va->r[0].offset, sizeof(struct xyc), + mod)) + return (0); + error = vme_probe(ct, va->r[0].offset, sizeof(struct xyc), + mod, VME_D32, xyc_probe, 0); + vme_space_free(va->va_vct, va->r[0].offset, sizeof(struct xyc), mod); + + return (error == 0); } /* @@ -326,29 +335,33 @@ xycattach(parent, self, aux) { struct vme_attach_args *va = aux; - vme_chipset_tag_t ct = va->vma_chipset_tag; - bus_space_tag_t bt = va->vma_bustag; + vme_chipset_tag_t ct = va->va_vct; + bus_space_tag_t bt; bus_space_handle_t bh; vme_intr_handle_t ih; - vme_mod_t mod; + vme_am_t mod; struct xyc_softc *xyc = (void *) self; struct xyc_attach_args xa; int lcv, res, pbsz, error; bus_dma_segment_t seg; int rseg; + vme_mapresc_t resc; /* get addressing and intr level stuff from autoconfig and load it * into our xyc_softc. */ - mod = VMEMOD_A16 | VMEMOD_S | VMEMOD_D; + mod = 0x2d; /* VME_AM_A16 | VME_AM_MBO | VME_AM_SUPER | VME_AM_DATA */ - if (vme_bus_map(ct, va->vma_reg[0], sizeof(struct xyc), - mod, bt, &bh) != 0) + if (vme_space_alloc(va->va_vct, va->r[0].offset, sizeof(struct xyc), + mod)) + panic("xyc: vme alloc"); + if (vme_space_map(ct, va->r[0].offset, sizeof(struct xyc), + mod, VME_D32, 0, &bt, &bh, &resc) != 0) panic("xyc: vme_map"); - xyc->xyc = (struct xyc *) bh; - xyc->ipl = va->vma_pri; - xyc->vector = va->vma_vec; + xyc->xyc = (struct xyc *) bh; /* XXX */ + xyc->ipl = va->ilevel; + xyc->vector = va->ivector; xyc->no_ols = 0; /* XXX should be from config */ for (lcv = 0; lcv < XYC_MAXDEV; lcv++) @@ -462,10 +475,9 @@ xycattach(parent, self, aux) } /* link in interrupt with higher level software */ - vme_intr_map(ct, va->vma_vec, va->vma_pri, &ih); - vme_intr_establish(ct, ih, xycintr, xyc); + vme_intr_map(ct, va->ivector, va->ilevel, &ih); + vme_intr_establish(ct, ih, IPL_BIO, xycintr, xyc); evcnt_attach(&xyc->sc_dev, "intr", &xyc->sc_intrcnt); - vme_bus_establish(ct, &xyc->sc_dev); /* now we must look for disks using autoconfig */ @@ -1959,7 +1971,10 @@ xyc_error(xycsc, iorq, iopb, comm) { int errno = iorq->errno; int erract = xyc_entoact(errno); - int oldmode, advance, i; + int oldmode, advance; +#ifdef sparc + int i; +#endif if (erract == XY_ERA_RSET) { /* some errors require a reset */ oldmode = iorq->mode; @@ -1975,6 +1990,7 @@ xyc_error(xycsc, iorq, iopb, comm) (iorq->mode & XY_MODE_B144) == 0) { advance = iorq->sectcnt - iopb->scnt; XYC_ADVANCE(iorq, advance); +#ifdef sparc if ((i = isbad(&iorq->xy->dkb, iorq->blockno / iorq->xy->sectpercyl, (iorq->blockno / iorq->xy->nsect) % iorq->xy->nhead, iorq->blockno % iorq->xy->nsect)) != -1) { @@ -1991,6 +2007,7 @@ xyc_error(xycsc, iorq, iopb, comm) /* will resubmit when we come out of remove_iorq */ return (XY_ERR_AOK); /* recovered! */ } +#endif } /* diff --git a/sys/dev/vme/xyvar.h b/sys/dev/vme/xyvar.h index 1080f0f717b..ecd5a524996 100644 --- a/sys/dev/vme/xyvar.h +++ b/sys/dev/vme/xyvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: xyvar.h,v 1.3 1998/08/22 11:47:46 pk Exp $ */ +/* $NetBSD: xyvar.h,v 1.4 1999/06/30 15:07:45 drochner Exp $ */ /* * @@ -136,7 +136,6 @@ struct xy_softc { struct xyc_softc { struct device sc_dev; /* device struct, reqd by autoconf */ - struct intrhand sc_ih; /* interrupt info */ struct evcnt sc_intrcnt; /* event counter (for vmstat -i) */ struct xyc *xyc; /* vaddr of vme registers */ |
