Date: Sun, 17 Oct 1999 16:41:14 -0400 (EDT) From: wghicks@bellsouth.net To: FreeBSD-gnats-submit@freebsd.org Subject: kern/14380: [PATCH] if_de workaround for when BIOS doesn't set busmaster Message-ID: <199910172041.QAA01111@bellsouth.net>
next in thread | raw e-mail | index | archive | help
>Number: 14380 >Category: kern >Synopsis: [PATCH] if_de workaround for when BIOS doesn't set busmaster >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Oct 17 13:40:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: W Gerald Hicks >Release: FreeBSD 4.0-CURRENT i386 >Organization: Fair Play, Uninc. >Environment: Ziatech CompactPCI ZT5510/ZT6650 FreeBSD zilch.bellsouth.net 4.0-CURRENT FreeBSD 4.0-CURRENT \ #0: Sun Oct 17 17:23:34 GMT 1999 \ root@zilch.bellsouth.net:/usr/src/sys/compile/ZILCH i386 >Description: Apparently the Ziatech BIOS doesn't enable busmastering for their Dec/Intel 21X4X devices, causing the cards to fail initialization with the message: 'deX: autosense failed: cable problem?' After investigating the problem for some time, Mike Smith suggested setting the PCI configuration busmaster bit. Thanks Mike! This solved the problem and makes FreeBSD work for several models of Ziatech CompactPCI systems here. I'm not sure if this should be dealt with at a higher level but this driver specific patch got me going here :-) >How-To-Repeat: 100% reproducible. >Fix: --- src/sys/pci/if_de.c.orig Sat Sep 25 12:06:00 1999 +++ src/sys/pci/if_de.c Sun Oct 17 18:33:32 1999 @@ -81,6 +81,7 @@ #include <net/if_var.h> #include <vm/pmap.h> +#include <pci/pcireg.h> #include <pci/pcivar.h> #include <pci/dc21040reg.h> @@ -5136,6 +5137,7 @@ #endif int retval, idx; u_int32_t revinfo, cfdainfo, id; + u_int32_t cfcsinfo; #if !defined(TULIP_IOMAPPED) vm_offset_t pa_csrs; #endif @@ -5154,6 +5156,37 @@ revinfo = pci_conf_read(config_id, PCI_CFRV) & 0xFF; id = pci_conf_read(config_id, PCI_CFID); cfdainfo = pci_conf_read(config_id, PCI_CFDA); + cfcsinfo = pci_conf_read(config_id, PCI_CFCS); + +#if defined(TULIP_DEBUG) + printf(" revinfo = 0x%02x\n", revinfo); + printf(" id = 0x%08x\n", id); + printf(" cfdainfo = 0x%08x\n", cfdainfo); + printf(" cfcsinfo = 0x%08x\n", cfcsinfo); +#endif + + /* turn busmaster on in case BIOS doesn't set it */ + if(!(cfcsinfo & PCIM_CMD_BUSMASTEREN)) { + printf("de%d: enabling busmaster operation\n", unit); + cfcsinfo |= PCIM_CMD_BUSMASTEREN; + pci_conf_write(config_id, PCI_CFCS, cfcsinfo); + } + +#if 0 +#if defined(TULIP_IOMAPPED) + /* XXX - "other operating systems" set this bit too */ + if(!(cfcsinfo & PCIM_CMD_PORTEN)) { + printf("de%d: enabling port mapped operation\n", unit); + cfcsinfo |= PCIM_CMD_PORTEN; + pci_conf_write(config_id, PCI_CFCS, cfcsinfo); + } +#endif +#endif + +#if defined(TULIP_DEBUG) + printf(" cfcsinfo = 0x%08x\n", + (unsigned) pci_conf_read(config_id, PCI_CFCS)); +#endif if (PCI_VENDORID(id) == DEC_VENDORID) { if (PCI_CHIPID(id) == CHIPID_21040) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199910172041.QAA01111>