diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1998-08-08 23:01:18 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1998-08-08 23:01:18 +0000 |
commit | 0679cc48be413867f5cb01bdf4166bd53c71dd29 (patch) | |
tree | dfa5400cadbe02cb9ab3fe5daf5e537f913aed9b /sys/dev | |
parent | 7b7d3bf5446882748838cffa95723ee58500c695 (diff) |
Split ioh allocations so that the devices no longer overlap.
Also disable the diag return check in wdc.c for now.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/isa/fd.c | 5 | ||||
-rw-r--r-- | sys/dev/isa/fdc.c | 13 | ||||
-rw-r--r-- | sys/dev/isa/fdlink.h | 3 | ||||
-rw-r--r-- | sys/dev/isa/fdreg.h | 10 | ||||
-rw-r--r-- | sys/dev/isa/wdc.c | 37 | ||||
-rw-r--r-- | sys/dev/isa/wdlink.h | 3 | ||||
-rw-r--r-- | sys/dev/isa/wdreg.h | 15 |
7 files changed, 62 insertions, 24 deletions
diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c index 9f432b2a704..53a5fc92566 100644 --- a/sys/dev/isa/fd.c +++ b/sys/dev/isa/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.37 1998/01/18 18:48:41 niklas Exp $ */ +/* $OpenBSD: fd.c,v 1.38 1998/08/08 23:01:13 downsj Exp $ */ /* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */ /*- @@ -591,6 +591,7 @@ fdintr(fdc) struct buf *bp; bus_space_tag_t iot = fdc->sc_iot; bus_space_handle_t ioh = fdc->sc_ioh; + bus_space_handle_t ioh_ctl = fdc->sc_ioh_ctl; int read, head, sec, i, nblks; struct fd_type *type; struct fd_formb *finfo = NULL; @@ -701,7 +702,7 @@ loop: isadma_start(bp->b_data + fd->sc_skip, fd->sc_nbytes, fdc->sc_drq, read); #endif - bus_space_write_1(iot, ioh, fdctl, type->rate); + bus_space_write_1(iot, ioh_ctl, fdctl, type->rate); #ifdef FD_DEBUG printf("fdintr: %s drive %d track %d head %d sec %d nblks %d\n", read ? "read" : "write", fd->sc_drive, fd->sc_cylin, head, diff --git a/sys/dev/isa/fdc.c b/sys/dev/isa/fdc.c index 141eb4efe0a..05529686ace 100644 --- a/sys/dev/isa/fdc.c +++ b/sys/dev/isa/fdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdc.c,v 1.10 1998/08/08 22:39:10 millert Exp $ */ +/* $OpenBSD: fdc.c,v 1.11 1998/08/08 23:01:15 downsj Exp $ */ /* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */ /*- @@ -107,6 +107,7 @@ fdcprobe(parent, match, aux) register struct isa_attach_args *ia = aux; bus_space_tag_t iot; bus_space_handle_t ioh; + bus_space_handle_t ioh_ctl; int rv; iot = ia->ia_iot; @@ -120,6 +121,9 @@ fdcprobe(parent, match, aux) /* Map the i/o space. */ if (bus_space_map(iot, ia->ia_iobase, FDC_NPORT, 0, &ioh)) return 0; + if (bus_space_map(iot, ia->ia_iobase + FDCTL_OFFSET, + FDCTL_NPORT, 0, &ioh_ctl)) + return 0; /* reset */ bus_space_write_1(iot, ioh, fdout, 0); @@ -151,6 +155,7 @@ fdcprobe(parent, match, aux) out: bus_space_unmap(iot, ioh, FDC_NPORT); + bus_space_unmap(iot, ioh_ctl, FDCTL_NPORT); return rv; } @@ -182,6 +187,7 @@ fdcattach(parent, self, aux) struct fdc_softc *fdc = (void *)self; bus_space_tag_t iot; bus_space_handle_t ioh; + bus_space_handle_t ioh_ctl; struct isa_attach_args *ia = aux; struct fdc_attach_args fa; int type; @@ -189,11 +195,14 @@ fdcattach(parent, self, aux) iot = ia->ia_iot; /* Re-map the I/O space. */ - if (bus_space_map(iot, ia->ia_iobase, FDC_NPORT, 0, &ioh)) + if (bus_space_map(iot, ia->ia_iobase, FDC_NPORT, 0, &ioh) || + bus_space_map(iot, ia->ia_iobase + FDCTL_OFFSET, + FDCTL_NPORT, 0, &ioh_ctl)) panic("fdcattach: couldn't map I/O ports"); fdc->sc_iot = iot; fdc->sc_ioh = ioh; + fdc->sc_ioh_ctl = ioh_ctl; fdc->sc_drq = ia->ia_drq; fdc->sc_state = DEVIDLE; diff --git a/sys/dev/isa/fdlink.h b/sys/dev/isa/fdlink.h index b04b2007c31..134c3884f14 100644 --- a/sys/dev/isa/fdlink.h +++ b/sys/dev/isa/fdlink.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fdlink.h,v 1.3 1996/11/29 22:54:56 niklas Exp $ */ +/* $OpenBSD: fdlink.h,v 1.4 1998/08/08 23:01:16 downsj Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. @@ -92,6 +92,7 @@ struct fdc_softc { bus_space_tag_t sc_iot; /* ISA chipset identifier */ bus_space_handle_t sc_ioh; /* ISA io handle */ + bus_space_handle_t sc_ioh_ctl; /* ISA io handle */ int sc_drq; diff --git a/sys/dev/isa/fdreg.h b/sys/dev/isa/fdreg.h index d914b1f1175..0c58ce9daba 100644 --- a/sys/dev/isa/fdreg.h +++ b/sys/dev/isa/fdreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fdreg.h,v 1.9 1996/12/05 13:13:21 deraadt Exp $ */ +/* $OpenBSD: fdreg.h,v 1.10 1998/08/08 23:01:17 downsj Exp $ */ /* $NetBSD: fdreg.h,v 1.8 1995/06/28 04:30:57 cgd Exp $ */ /*- @@ -53,17 +53,19 @@ #define fdsts 4 /* NEC 765 Main Status Register (R) */ #define fddata 5 /* NEC 765 Data Register (R/W) */ -#define fdctl 7 /* Control Register (W) */ +#define FDCTL_OFFSET 7 /* Offset from the other registers. */ +#define fdctl 0 /* Control Register (W) */ #define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */ #define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */ #define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */ #define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */ -#define fdin 7 /* Digital Input Register (R) */ +#define fdin 0 /* Digital Input Register (R) */ #define FDI_DCHG 0x80 /* diskette has been changed */ #define FDC_BSIZE 512 -#define FDC_NPORT 8 +#define FDC_NPORT 6 +#define FDCTL_NPORT 1 #define FDC_MAXIOSIZE NBPG /* XXX should be MAXBSIZE */ #define FDUNIT(dev) ((dev & 0x80) >> 7) /* XXX two drives max, sorry */ diff --git a/sys/dev/isa/wdc.c b/sys/dev/isa/wdc.c index 437fa91965d..886d87ddc67 100644 --- a/sys/dev/isa/wdc.c +++ b/sys/dev/isa/wdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc.c,v 1.32 1998/07/23 04:40:12 csapuntz Exp $ */ +/* $OpenBSD: wdc.c,v 1.33 1998/08/08 23:01:06 downsj Exp $ */ /* $NetBSD: wd.c,v 1.150 1996/05/12 23:54:03 mycroft Exp $ */ /* @@ -162,9 +162,12 @@ wdcprobe(parent, match, aux) { bus_space_tag_t iot; bus_space_handle_t ioh; + bus_space_handle_t ioh_ctl; struct wdc_softc *wdc = match; struct isa_attach_args *ia = aux; +#ifdef notyet int err; +#endif #if NISADMA == 0 if (ia->ia_drq != DRQUNK) { @@ -175,12 +178,17 @@ wdcprobe(parent, match, aux) wdc->sc_iot = iot = ia->ia_iot; if (IS_ISAPNP(parent)) { - ioh = ia->ia_ioh; + ioh = ia->ipa_io[0].h; + ioh_ctl = ia->ipa_io[1].h; } else { if (bus_space_map(iot, ia->ia_iobase, 8, 0, &ioh)) return 0; + if (bus_space_map(iot, ia->ia_iobase + WDCTL_OFFSET, + 1, 0, &ioh_ctl)) + return 0; } wdc->sc_ioh = ioh; + wdc->sc_ioh_ctl = ioh_ctl; /* Check if we have registers that work. */ /* Error register not writable, */ @@ -235,6 +243,7 @@ wdcprobe(parent, match, aux) if (wait_for_unbusy(wdc) < 0) goto nomatch; +#ifdef notyet /* See if the drive(s) are alive. */ err = bus_space_read_1(iot, ioh, wd_error); if (err && (err != 0x01)) { @@ -249,14 +258,17 @@ wdcprobe(parent, match, aux) } else goto nomatch; } +#endif ia->ia_iosize = 8; ia->ia_msize = 0; return 1; nomatch: - if (!IS_ISAPNP(parent)) + if (!IS_ISAPNP(parent)) { bus_space_unmap(iot, ioh, 8); + bus_space_unmap(iot, ioh_ctl, 1); + } return 0; } @@ -430,6 +442,9 @@ wdc_ata_start(wdc, xfer) { bus_space_tag_t iot = wdc->sc_iot; bus_space_handle_t ioh = wdc->sc_ioh; +#ifdef WDDEBUG + bus_space_handle_t ioh_ctl = wdc->sc_ioh_ctl; +#endif struct wd_link *d_link = xfer->d_link; struct buf *bp = xfer->c_bp; int nblks; @@ -480,7 +495,7 @@ wdc_ata_start(wdc, xfer) xfer->c_bcount, xfer->c_blkno)); } else { WDDEBUG_PRINT((" %d)0x%x", xfer->c_skip, - bus_space_read_1(iot, ioh, wd_altsts))); + bus_space_read_1(iot, ioh_ctl, wd_altsts))); } /* @@ -610,7 +625,7 @@ wdc_ata_start(wdc, xfer) WDDEBUG_PRINT(("sector %d cylin %d head %d addr %x sts %x\n", sector, cylin, head, xfer->databuf, - bus_space_read_1(iot, ioh, wd_altsts))); + bus_space_read_1(iot, ioh_ctl, wd_altsts))); } else if (xfer->c_nblks > 1) { /* The number of blocks in the last stretch may be smaller. */ @@ -1240,6 +1255,7 @@ wdc_atapi_send_command_packet(ab_link, acp) struct wdc_softc *wdc = (void*)ab_link->wdc_softc; bus_space_tag_t iot = wdc->sc_iot; bus_space_handle_t ioh = wdc->sc_ioh; + bus_space_handle_t ioh_ctl = wdc->sc_ioh_ctl; struct wdc_xfer *xfer; u_int8_t flags = acp->flags & 0xff; @@ -1272,7 +1288,7 @@ wdc_atapi_send_command_packet(ab_link, acp) } /* Turn off interrupts. */ - bus_space_write_1(iot, ioh, wd_ctlr, WDCTL_4BIT | WDCTL_IDS); + bus_space_write_1(iot, ioh_ctl, wd_ctlr, WDCTL_4BIT|WDCTL_IDS); delay(1000); if (wdccommand((struct wd_link*)ab_link, @@ -1313,7 +1329,7 @@ wdc_atapi_send_command_packet(ab_link, acp) } /* Turn on interrupts again. */ - bus_space_write_1(iot, ioh, wd_ctlr, WDCTL_4BIT); + bus_space_write_1(iot, ioh_ctl, wd_ctlr, WDCTL_4BIT); delay(1000); wdc->sc_flags &= ~(WDCF_IRQ_WAIT | WDCF_SINGLE | WDCF_ERROR); @@ -1598,14 +1614,15 @@ wdcreset(wdc, mode) { bus_space_tag_t iot = wdc->sc_iot; bus_space_handle_t ioh = wdc->sc_ioh; + bus_space_handle_t ioh_ctl = wdc->sc_ioh_ctl; /* Reset the device. */ - bus_space_write_1(iot, ioh, wd_ctlr, WDCTL_RST|WDCTL_IDS); + bus_space_write_1(iot, ioh_ctl, wd_ctlr, WDCTL_RST|WDCTL_IDS); delay(1000); - bus_space_write_1(iot, ioh, wd_ctlr, WDCTL_IDS); + bus_space_write_1(iot, ioh_ctl, wd_ctlr, WDCTL_IDS); delay(1000); (void) bus_space_read_1(iot, ioh, wd_error); - bus_space_write_1(iot, ioh, wd_ctlr, WDCTL_4BIT); + bus_space_write_1(iot, ioh_ctl, wd_ctlr, WDCTL_4BIT); if (wait_for_unbusy(wdc) < 0) { if (mode != WDCRESET_SILENT) diff --git a/sys/dev/isa/wdlink.h b/sys/dev/isa/wdlink.h index a8ebb6aa495..7f69a2d5cf9 100644 --- a/sys/dev/isa/wdlink.h +++ b/sys/dev/isa/wdlink.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wdlink.h,v 1.9 1997/12/10 23:11:13 rees Exp $ */ +/* $OpenBSD: wdlink.h,v 1.10 1998/08/08 23:01:11 downsj Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -52,6 +52,7 @@ struct wdc_softc { struct wdc_link ctlr_link; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; + bus_space_handle_t sc_ioh_ctl; int sc_drq; /* DMA channel */ TAILQ_HEAD(xferhead, wdc_xfer) sc_xfer; diff --git a/sys/dev/isa/wdreg.h b/sys/dev/isa/wdreg.h index a44110de3d8..9def532b136 100644 --- a/sys/dev/isa/wdreg.h +++ b/sys/dev/isa/wdreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wdreg.h,v 1.7 1998/07/23 04:40:14 csapuntz Exp $ */ +/* $OpenBSD: wdreg.h,v 1.8 1998/08/08 23:01:12 downsj Exp $ */ /* $NetBSD: wdreg.h,v 1.13 1995/03/29 21:56:46 briggs Exp $ */ /*- @@ -55,12 +55,19 @@ #define wd_command 0x007 /* command register (W) */ #define wd_status 0x007 /* immediate status (R) */ -#define wd_altsts 0x206 /* alternate fixed disk status (via 1015) (R) */ -#define wd_ctlr 0x206 /* fixed disk controller control (via 1015) (W) */ +/* + * Control register definiations. + */ +#define WDCTL_OFFSET 0x206 /* offset from the first set. */ + +#define wd_altsts 0x000 /* alternate fixed disk status (via 1015) (R) */ +#define wd_ctlr 0x000 /* fixed disk controller control (via 1015) (W) */ #define WDCTL_4BIT 0x08 /* use four head bits (wd1003) */ #define WDCTL_RST 0x04 /* reset the controller */ #define WDCTL_IDS 0x02 /* disable controller interrupts */ -#define wd_digin 0x207 /* disk controller input (via 1015) (R) */ +#if 0 +#define wd_digin 0x001 /* disk controller input (via 1015) (R) */ +#endif /* * Status bits. |