Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci replace the chek for the shared channel of cmdid...



details:   https://anonhg.NetBSD.org/src/rev/7c55a2ee8ad8
branches:  trunk
changeset: 827195:7c55a2ee8ad8
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Thu Oct 19 20:11:38 2017 +0000

description:
replace the chek for the shared channel of cmdide(4) a flag of the
product array, rather than switch inside attach routine

XXX judging from product name, Silicon Image 0680 might be newer than 0649
XXX and hence have actually independant channels, but I don't have the hw
XXX so keeping as-is

no functional change, just to improve visibility in course of fixing
PR kern/52606

diffstat:

 sys/dev/pci/cmdide.c    |  35 +++++++++++++----------------------
 sys/dev/pci/pciidevar.h |   3 ++-
 2 files changed, 15 insertions(+), 23 deletions(-)

diffs (118 lines):

diff -r 5af8ea9178da -r 7c55a2ee8ad8 sys/dev/pci/cmdide.c
--- a/sys/dev/pci/cmdide.c      Thu Oct 19 19:05:53 2017 +0000
+++ b/sys/dev/pci/cmdide.c      Thu Oct 19 20:11:38 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmdide.c,v 1.39 2017/10/07 16:05:33 jdolecek Exp $     */
+/*     $NetBSD: cmdide.c,v 1.40 2017/10/19 20:11:38 jdolecek Exp $     */
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.39 2017/10/07 16:05:33 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.40 2017/10/19 20:11:38 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -57,24 +57,25 @@
 static void cmd680_channel_map(const struct pci_attach_args *,
                               struct pciide_softc *, int);
 
+/* Older CMD64X doesn't have independent channels */
 static const struct pciide_product_desc pciide_cmd_products[] =  {
        { PCI_PRODUCT_CMDTECH_640,
-         0,
+         IDE_SHARED_CHANNELS,
          "CMD Technology PCI0640",
          cmd_chip_map
        },
        { PCI_PRODUCT_CMDTECH_643,
-         0,
+         IDE_SHARED_CHANNELS,
          "CMD Technology PCI0643",
          cmd0643_9_chip_map,
        },
        { PCI_PRODUCT_CMDTECH_646,
-         0,
+         IDE_SHARED_CHANNELS,
          "CMD Technology PCI0646",
          cmd0643_9_chip_map,
        },
        { PCI_PRODUCT_CMDTECH_648,
-         0,
+         IDE_SHARED_CHANNELS,
          "CMD Technology PCI0648",
          cmd0643_9_chip_map,
        },
@@ -84,7 +85,7 @@
          cmd0643_9_chip_map,
        },
        { PCI_PRODUCT_CMDTECH_680,
-         0,
+         IDE_SHARED_CHANNELS,
          "Silicon Image 0680",
          cmd680_chip_map,
        },
@@ -126,7 +127,8 @@
 {
        struct pciide_channel *cp = &sc->pciide_channels[channel];
        u_int8_t ctrl = pciide_pci_read(sc->sc_pc, sc->sc_tag, CMD_CTRL);
-       int interface, one_channel;
+       int interface;
+       bool one_channel = ISSET(sc->sc_pp->ide_flags, IDE_SHARED_CHANNELS);
 
        /*
         * The 0648/0649 can be told to identify as a RAID controller.
@@ -148,18 +150,6 @@
        cp->ata_channel.ch_channel = channel;
        cp->ata_channel.ch_atac = &sc->sc_wdcdev.sc_atac;
 
-       /*
-        * Older CMD64X doesn't have independent channels
-        */
-       switch (sc->sc_pp->ide_product) {
-       case PCI_PRODUCT_CMDTECH_649:
-               one_channel = 0;
-               break;
-       default:
-               one_channel = 1;
-               break;
-       }
-
        if (channel > 0 && one_channel) {
                cp->ata_channel.ch_queue =
                    sc->pciide_channels[0].ata_channel.ch_queue;
@@ -174,11 +164,12 @@
        }
 
        aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev,
-           "%s channel %s to %s mode\n", cp->name,
+           "%s channel %s to %s mode%s\n", cp->name,
            (interface & PCIIDE_INTERFACE_SETTABLE(channel)) ?
            "configured" : "wired",
            (interface & PCIIDE_INTERFACE_PCI(channel)) ?
-           "native-PCI" : "compatibility");
+           "native-PCI" : "compatibility",
+           one_channel ? ", channel non-independant" : "");
 
        /*
         * with a CMD PCI64x, if we get here, the first channel is enabled:
diff -r 5af8ea9178da -r 7c55a2ee8ad8 sys/dev/pci/pciidevar.h
--- a/sys/dev/pci/pciidevar.h   Thu Oct 19 19:05:53 2017 +0000
+++ b/sys/dev/pci/pciidevar.h   Thu Oct 19 20:11:38 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pciidevar.h,v 1.47 2015/08/24 23:55:04 pooka Exp $     */
+/*     $NetBSD: pciidevar.h,v 1.48 2017/10/19 20:11:38 jdolecek Exp $  */
 
 /*
  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
@@ -176,6 +176,7 @@
 
 /* Flags for ide_flags */
 #define        IDE_16BIT_IOSPACE       0x0002 /* I/O space BARS ignore upper word */
+#define        IDE_SHARED_CHANNELS     0x0004 /* channels are not independant */
 
 
 /* inlines for reading/writing 8-bit PCI registers */



Home | Main Index | Thread Index | Old Index