Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/sys Apply patch (requested by bouyer):



details:   https://anonhg.NetBSD.org/src/rev/e411559564ef
branches:  netbsd-1-4
changeset: 470752:e411559564ef
user:      he <he%NetBSD.org@localhost>
date:      Fri Jul 07 17:33:46 2000 +0000

description:
Apply patch (requested by bouyer):
  Add support for the following PCIIDE controllers:
   o AMD 756
   o CMD PCI0648 and PCI0649
   o Hightpoint HPT366
   o OPTi 82c621 (and a few of its derivatives)
   o Promise Ultra/33 and Ultra/66
   o Intel 82801 (ICH/ICH0)
  Also fix PR#10437 (detect more ATAPI devices).

diffstat:

 sys/arch/macppc/dev/wdc_obio.c    |     6 +-
 sys/dev/ata/ata.c                 |    19 +-
 sys/dev/ata/ata_wdc.c             |    63 +-
 sys/dev/ata/atareg.h              |     6 +-
 sys/dev/ata/atavar.h              |    46 +-
 sys/dev/ata/wd.c                  |    10 +-
 sys/dev/ata/wdvar.h               |    36 +-
 sys/dev/ic/wdc.c                  |   135 +-
 sys/dev/ic/wdcvar.h               |    33 +-
 sys/dev/isa/wdc_isa.c             |     6 +-
 sys/dev/pci/pciide.c              |  2781 +++++++++++++++++++++++++-----------
 sys/dev/pci/pciide_acer_reg.h     |    28 +-
 sys/dev/pci/pciide_amd_reg.h      |    81 +
 sys/dev/pci/pciide_apollo_reg.h   |    26 +-
 sys/dev/pci/pciide_cmd_reg.h      |    63 +-
 sys/dev/pci/pciide_cy693_reg.h    |    41 +-
 sys/dev/pci/pciide_hpt_reg.h      |   125 +
 sys/dev/pci/pciide_opti_reg.h     |   182 ++
 sys/dev/pci/pciide_pdc202xx_reg.h |   114 +
 sys/dev/pci/pciide_piix_reg.h     |    42 +-
 sys/dev/pci/pciide_sis_reg.h      |    23 +-
 sys/dev/pci/pciidereg.h           |     4 +-
 sys/dev/pci/pciidevar.h           |    41 +-
 sys/dev/scsipi/atapi_wdc.c        |    42 +-
 sys/dev/scsipi/atapiconf.h        |     9 +-
 25 files changed, 2874 insertions(+), 1088 deletions(-)

diffs (truncated from 5478 to 300 lines):

diff -r d65d136a18b4 -r e411559564ef sys/arch/macppc/dev/wdc_obio.c
--- a/sys/arch/macppc/dev/wdc_obio.c    Fri Jul 07 17:13:50 2000 +0000
+++ b/sys/arch/macppc/dev/wdc_obio.c    Fri Jul 07 17:33:46 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_obio.c,v 1.2.2.1 1999/05/06 02:02:36 perry Exp $   */
+/*     $NetBSD: wdc_obio.c,v 1.2.2.2 2000/07/07 17:33:46 he Exp $      */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
 };
 
 static int     wdc_obio_dma_init __P((void *, int, int, void *, size_t, int));
-static void    wdc_obio_dma_start __P((void *, int, int, int));
+static void    wdc_obio_dma_start __P((void *, int, int));
 static int     wdc_obio_dma_finish __P((void *, int, int, int));
 
 int
@@ -240,7 +240,7 @@
 }
 
 static void
-wdc_obio_dma_start(v, channel, drive, read)
+wdc_obio_dma_start(v, channel, drive)
        void *v;
        int channel, drive;
 {
diff -r d65d136a18b4 -r e411559564ef sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Fri Jul 07 17:13:50 2000 +0000
+++ b/sys/dev/ata/ata.c Fri Jul 07 17:33:46 2000 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: ata.c,v 1.7.2.2 2000/01/23 12:25:32 he Exp $      */
+/*      $NetBSD: ata.c,v 1.7.2.3 2000/07/07 17:33:46 he Exp $      */
 /*
  * Copyright (c) 1998 Manuel Bouyer.  All rights reserved.
  *
@@ -19,7 +19,7 @@
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,     
  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
@@ -88,14 +88,21 @@
                wdc_c.r_st_pmask = WDCS_DRQ;
                wdc_c.timeout = 10000; /* 10s */
        } else {
+               WDCDEBUG_PRINT(("wdc_ata_get_parms: no disks\n"),
+                   DEBUG_FUNCS|DEBUG_PROBE);
                return CMD_ERR;
        }
        wdc_c.flags = AT_READ | flags;
        wdc_c.data = tb;
        wdc_c.bcount = DEV_BSIZE;
-       if (wdc_exec_command(drvp, &wdc_c) != WDC_COMPLETE)
+       if (wdc_exec_command(drvp, &wdc_c) != WDC_COMPLETE) {
+               WDCDEBUG_PRINT(("wdc_ata_get_parms: wdc_exec_command failed\n"),
+                   DEBUG_FUNCS|DEBUG_PROBE);
                return CMD_AGAIN;
+       }
        if (wdc_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) {
+               WDCDEBUG_PRINT(("wdc_ata_get_parms: wdc_c.flags=0x%x\n",
+                   wdc_c.flags), DEBUG_FUNCS|DEBUG_PROBE);
                return CMD_ERR;
        } else {
                /* Read in parameter block. */
@@ -189,7 +196,7 @@
            "track 0 not found", "aborted command", "media change requested",
            "id not found", "media changed", "uncorrectable data error",
            "bad block detected"};
-       static char *errstr4_5[] = {"",
+       static char *errstr4_5[] = {"obsolete (address mark not found)",
            "no media/write protected", "aborted command",
            "media change requested", "id not found", "media changed",
            "uncorrectable data error", "interface CRC error"};
@@ -208,8 +215,8 @@
 
        for (i = 0; i < 8; i++) {
                if (errno & (1 << i)) {
-                       buf += sprintf(buf, "%s %s", sep, errstr[i]);
-                       sep = ",";
+                       buf += sprintf(buf, "%s%s", sep, errstr[i]);
+                       sep = ", ";
                }
        }
 }
diff -r d65d136a18b4 -r e411559564ef sys/dev/ata/ata_wdc.c
--- a/sys/dev/ata/ata_wdc.c     Fri Jul 07 17:13:50 2000 +0000
+++ b/sys/dev/ata/ata_wdc.c     Fri Jul 07 17:33:46 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ata_wdc.c,v 1.19.2.2 2000/01/23 12:26:01 he Exp $      */
+/*     $NetBSD: ata_wdc.c,v 1.19.2.3 2000/07/07 17:33:46 he Exp $      */
 
 /*
  * Copyright (c) 1998 Manuel Bouyer.
@@ -19,17 +19,16 @@
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,     
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  */
 
@@ -196,12 +195,13 @@
                 * that we never get to this point if that's the case.
                 */
                /* at this point, we should only be in RECAL state */
-               if (drvp->state != RECAL) {
+               if (drvp->state != RESET) {
                        printf("%s:%d:%d: bad state %d in _wdc_ata_bio_start\n",
                            chp->wdc->sc_dev.dv_xname, chp->channel,
                            xfer->drive, drvp->state);
                        panic("_wdc_ata_bio_start: bad state");
                }
+               drvp->state = RECAL;
                xfer->c_intr = wdc_ata_ctrl_intr;
                bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_sdh,
                    WDSD_IBM | (xfer->drive << 4));
@@ -223,7 +223,6 @@
                if (drvp->n_xfers <= NXFER)
                        drvp->n_xfers++;
                dma_flags = (ata_bio->flags & ATA_READ) ?  WDC_DMA_READ : 0;
-               dma_flags |= (ata_bio->flags & ATA_POLL) ?  WDC_DMA_POLL : 0;
        }
        if (ata_bio->flags & ATA_SINGLE)
                ata_delay = ATA_DELAY;
@@ -284,7 +283,6 @@
                        ata_bio->nbytes = xfer->c_bcount;
                        cmd = (ata_bio->flags & ATA_READ) ?
                            WDCC_READDMA : WDCC_WRITEDMA;
-                       nblks = ata_bio->nblks;
                        /* Init the DMA channel. */
                        if ((*chp->wdc->dma_init)(chp->wdc->dma_arg,
                            chp->channel, xfer->drive,
@@ -304,7 +302,8 @@
                            head, sect, nblks, 0);
                        /* start the DMA channel */
                        (*chp->wdc->dma_start)(chp->wdc->dma_arg,
-                           chp->channel, xfer->drive, dma_flags);
+                           chp->channel, xfer->drive);
+                       chp->ch_flags |= WDCF_DMA_WAIT;
                        /* wait for irq */
                        goto intr;
                } /* else not DMA */
@@ -387,6 +386,10 @@
        } else {
                /* Wait for at last 400ns for status bit to be valid */
                delay(1);
+               if (chp->ch_flags & WDCF_DMA_WAIT) {
+                       wdc_dmawait(chp, xfer, ATA_DELAY);
+                       chp->ch_flags &= ~WDCF_DMA_WAIT;
+               }
                wdc_ata_bio_intr(chp, xfer, 0);
                if ((ata_bio->flags & ATA_ITSDONE) == 0)
                        goto again;
@@ -411,7 +414,6 @@
        struct ata_bio *ata_bio = xfer->cmd;
        struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive];
        int drv_err;
-       int dma_flags = 0;
 
        WDCDEBUG_PRINT(("wdc_ata_bio_intr %s:%d:%d\n",
            chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive),
@@ -426,11 +428,6 @@
                panic("wdc_ata_bio_intr: bad state\n");
        }
 
-       if (xfer->c_flags & C_DMA) {
-               dma_flags = (ata_bio->flags & ATA_READ) ?  WDC_DMA_READ : 0;
-               dma_flags |= (ata_bio->flags & ATA_POLL) ?  WDC_DMA_POLL : 0;
-       }
-
        /*
         * if we missed an interrupt in a PIO transfer, reset and restart.
         * Don't try to continue transfer, we may have missed cycles.
@@ -449,16 +446,16 @@
                printf("%s:%d:%d: device timeout, c_bcount=%d, c_skip%d\n",
                    chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive,
                    xfer->c_bcount, xfer->c_skip);
-               /* if we were using DMA, turn off DMA channel */
+               /* if we were using DMA, flag a DMA error */
                if (xfer->c_flags & C_DMA) {
-                       (*chp->wdc->dma_finish)(chp->wdc->dma_arg,
-                           chp->channel, xfer->drive, dma_flags);
                        ata_dmaerr(drvp);
                }
                ata_bio->error = TIMEOUT;
                wdc_ata_bio_done(chp, xfer);
                return 1;
        }
+       if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
+               chp->wdc->irqack(chp);
        
        drv_err = wdc_ata_err(drvp, ata_bio);
 
@@ -480,8 +477,7 @@
                                drv_err = WDC_ATA_ERR;
                        }
                }
-               if ((*chp->wdc->dma_finish)(chp->wdc->dma_arg,
-                   chp->channel, xfer->drive, dma_flags) != 0) {
+               if (chp->wdc->dma_status != 0) {
                        if (drv_err != WDC_ATA_ERR) {
                                ata_bio->error = ERR_DMA;
                                drv_err = WDC_ATA_ERR;
@@ -575,7 +571,6 @@
        struct wdc_xfer *xfer;
 {
        struct ata_bio *ata_bio = xfer->cmd;
-       int need_done = xfer->c_flags & C_NEEDDONE;
        int drive = xfer->drive;
 
        WDCDEBUG_PRINT(("wdc_ata_bio_done %s:%d:%d: flags 0x%x\n",
@@ -592,7 +587,7 @@
        wdc_free_xfer(chp, xfer);
 
        ata_bio->flags |= ATA_ITSDONE;
-       if (need_done) {
+       if ((ata_bio->flags & ATA_POLL) == 0) {
                WDCDEBUG_PRINT(("wdc_ata_done: wddone\n"), DEBUG_XFERS);
                wddone(chp->ch_drive[drive].drv_softc);
        }
@@ -628,6 +623,8 @@
                errstring = "recal";
                if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay))
                        goto timeout;
+               if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
+                       chp->wdc->irqack(chp);
                if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
                        goto error;
        /* fall through */
@@ -648,6 +645,8 @@
                errstring = "piomode";
                if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay))
                        goto timeout;
+               if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
+                       chp->wdc->irqack(chp);
                if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
                        goto error;
        /* fall through */
@@ -668,6 +667,8 @@
                errstring = "dmamode";
                if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay))
                        goto timeout;
+               if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
+                       chp->wdc->irqack(chp);
                if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
                        goto error;
        /* fall through */
@@ -688,6 +689,8 @@
                errstring = "geometry";
                if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay))
                        goto timeout;
+               if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
+                       chp->wdc->irqack(chp);
                if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
                        goto error;
                /* fall through */
@@ -705,6 +708,8 @@
                errstring = "setmulti";
                if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay))
                        goto timeout;
+               if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
+                       chp->wdc->irqack(chp);
                if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
                        goto error;
                /* fall through */
diff -r d65d136a18b4 -r e411559564ef sys/dev/ata/atareg.h
--- a/sys/dev/ata/atareg.h      Fri Jul 07 17:13:50 2000 +0000
+++ b/sys/dev/ata/atareg.h      Fri Jul 07 17:33:46 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atareg.h,v 1.5 1999/01/18 20:06:24 bouyer Exp $        */
+/*     $NetBSD: atareg.h,v 1.5.2.1 2000/07/07 17:33:47 he Exp $        */
 
 /*
  * Drive parameter structure for ATA/ATAPI.
@@ -104,7 +104,7 @@
 #define        WDC_VER_ATA4    0x0010



Home | Main Index | Thread Index | Old Index