Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Adjust the logic for enabling the 64-bit data pa...



details:   https://anonhg.NetBSD.org/src/rev/2fe6ef67d9b1
branches:  trunk
changeset: 745801:2fe6ef67d9b1
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Mar 13 00:45:59 2020 +0000

description:
Adjust the logic for enabling the 64-bit data path when a 64-bit slot
is detected:
- If DATA64_EN isn't set in CFG after a reset, don't use 64-bit data path
  at all (it's been disabled by an EEPROM setting).
- Provide a hook for force-disabling the 64-bit data path.
- Otherwise, perform the "known 64-bit cards" check as done previously
  (because dodgy-vendor-EEPROM-settings still applies).

diffstat:

 sys/dev/pci/if_sip.c |  48 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 32 insertions(+), 16 deletions(-)

diffs (77 lines):

diff -r ae43b102fa0f -r 2fe6ef67d9b1 sys/dev/pci/if_sip.c
--- a/sys/dev/pci/if_sip.c      Fri Mar 13 00:41:24 2020 +0000
+++ b/sys/dev/pci/if_sip.c      Fri Mar 13 00:45:59 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sip.c,v 1.179 2020/03/08 02:44:12 thorpej Exp $     */
+/*     $NetBSD: if_sip.c,v 1.180 2020/03/13 00:45:59 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.179 2020/03/08 02:44:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.180 2020/03/13 00:45:59 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -138,6 +138,12 @@
 #define        MAX_SIP_NRXDESC MAX(GSIP_NRXDESC, SIP_NRXDESC)
 
 /*
+ * Set this to 1 to force-disable using the 64-bit data path
+ * on DP83820.
+ */
+static int gsip_disable_data64 = 0;
+
+/*
  * Control structures are DMA'd to the SiS900 chip.  We allocate them in
  * a single clump that maps to a single DMA segment to make several things
  * easier.
@@ -860,21 +866,31 @@
 
        reg = bus_space_read_4(sc->sc_st, sc->sc_sh, SIP_CFG);
        if (reg & CFG_PCI64_DET) {
-               printf("%s: 64-bit PCI slot detected", device_xname(sc->sc_dev));
-               /*
-                * Check to see if this card is 64-bit.  If so, enable 64-bit
-                * data transfers.
-                *
-                * We can't use the DATA64_EN bit in the EEPROM, because
-                * vendors of 32-bit cards fail to clear that bit in many
-                * cases (yet the card still detects that it's in a 64-bit
-                * slot; go figure).
-                */
-               if (sipcom_check_64bit(pa)) {
-                       sc->sc_cfg |= CFG_DATA64_EN;
-                       printf(", using 64-bit data transfers");
+               const char *using64 = NULL;
+
+               if (reg & CFG_DATA64_EN) {
+                       /*
+                        * Check to see if this card is 64-bit.  If so,
+                        * enable 64-bit data transfers.
+                        *
+                        * We can't trust the DATA64_EN bit in the EEPROM,
+                        * because vendors of 32-bit cards fail to clear
+                        * that bit in many cases (yet the card still detects
+                        * that it's in a 64-bit slot because I guess they
+                        * wired up ACK64# and REQ64#).
+                        */
+                       if (gsip_disable_data64)
+                               using64 = "force-disabled";
+                       else if (sipcom_check_64bit(pa)) {
+                               sc->sc_cfg |= CFG_DATA64_EN;
+                               using64 = "enabled";
+                       } else
+                               using64 = "disabled (32-bit card)";
+               } else {
+                       using64 = "disabled in EEPROM";
                }
-               printf("\n");
+               printf("%s: 64-bit slot detected, 64-bit tranfers %s\n",
+                   device_xname(sc->sc_dev), using64);
        }
        
        /*



Home | Main Index | Thread Index | Old Index