Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 1999 17:46:08 -0700
From:      Wes Peters <wes@softweyr.com>
To:        Mike Spengler <mks@networkcs.com>, hackers@freebsd.org, jkh@freebsd.org
Subject:   Re: fxp driver causing lockup
Message-ID:  <36F04CD0.B0D46F3B@softweyr.com>
References:  <199903172356.RAA14113@us.networkcs.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Mike Spengler wrote:
> Wes Peters said:
> > "John W. DeBoskey" wrote:
> > >
> > > Hi,
> > >
> > >    I beleive you are correct. The following code fragment from
> > > if_fxp.c is the lockup:
> > >
> > >         /*
> > >          * Start the config command/DMA.
> > >          */
> > >         fxp_scb_wait(sc);
> > >         CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, vtophys(&cbp->cb_status));
> > >         CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_CU_START);
> > >         /* ...and wait for it to complete. */
> > >         while (!(cbp->cb_status & FXP_CB_STATUS_C));
> >
> > Yup, that's it.  I initially tracked this down under 3.0, but moved the
> > machine back to 2.2.7 because I needed it to get work done.  I've now
> > stuffed two 3c905Bs into it for my main and test network, and can play
> > with the Pro 100B without losing a network connection.
>
> There was a FreeBSD 2.2.x -> 3.x change in which the driver is now responsible
> for setting the PCI busmaster enable bit.  This may (or not) be your problem.
> In the fxp_attach() function, you should insert the following before doing
> the pci_map_mem() call:
> 
>         u_long  val;
> 
>         val = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG);
>         val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
>         pci_conf_write(config_id, PCI_COMMAND_STATUS_REG, val);
> 
> Hope this helps!

It did, it's working fine now.  Here's the diff vs. 3.1-RELEASE:

*** if_fxp.c.orig       Wed Mar 17 17:06:51 1999
--- if_fxp.c    Wed Mar 17 17:23:09 1999
***************
*** 98,103 ****
--- 98,104 ----
  #include <machine/clock.h>    /* for DELAY */
  
  #include <pci/pcivar.h>
+ #include <pci/pcireg.h>               /* for PCIM_CMD_xxx */
  #include <pci/if_fxpreg.h>
  #include <pci/if_fxpvar.h>
  
***************
*** 523,528 ****
--- 524,530 ----
        vm_offset_t pbase;
        struct ifnet *ifp;
        int s;
+       u_long val;
  
        sc = malloc(sizeof(struct fxp_softc), M_DEVBUF, M_NOWAIT);
        if (sc == NULL)
***************
*** 531,536 ****
--- 533,545 ----
        callout_handle_init(&sc->stat_ch);
  
        s = splimp();
+ 
+       /*
+        * Enable bus mastering.
+        */
+       val = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG);
+       val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
+       pci_conf_write(config_id, PCI_COMMAND_STATUS_REG, val);
  
        /*
         * Map control/status registers.

Can a couple of other hackers with EEPro 100's try this out to make sure
it doesn't accidentally break anything else?  If not, I'll commit it
tomorrow.

Thanks a TON, Mike.  Now I can rip that second XL out of this machine and
upgrade my other machine to 3.1 also.

-- 
             Where am I, and what am I doing in this handbasket?

Wes Peters                                                     +1.801.915.2061
Softweyr LLC                                                  wes@softweyr.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36F04CD0.B0D46F3B>