Current-Users archive

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

Re: wm0 Driver



 Hello.

 I'm replying old mail...

 > When I do 'ifconfig -m wm0', I get the following list:
 > media 1000baseSX
 > media 1000baseSX mediaopt full-duplex
 > media autoselect
 > 
 > Setting ddb.commandonenter=trace gives me a page of callback
 > information, but I can't go any farther right now.  Is there any way I
 > could set the system to automatically create a core file and reboot? 
 > Perhaps that would allow generation of more information after the system
 > resets.
 > 
 > The unit runs great until I try to initialize the wm(n) device.
 > 
 > David
 > 
 > 
 > 
 > >>> Eric Haszlakiewicz <erh%nimenees.com@localhost> 9/14/2008 8:31 PM >>>
 > On Sun, Sep 14, 2008 at 08:50:57PM +0200, Havard Eidnes wrote:
 > > > Now, each of these machines has at least 1 Intel PRO/1000
 > multimode
 > > > fiber network card.  Guess what?  When I try to enable one of them,
 > I
 > > > get 'fatal page fault in supervisor mode'. Additional statements
 > are
 > > > 'trap type 6 code 0 eip c05ff9bb cs 8 eflags 10286 cr 2 0 ilevel
 > 6'
 > > > 'kernel: supervisor trap page fault, code=0'
 > > > 'Stopped in pid 1368.1 (ifconfig) at netbsd:wm_tbi_mediachange+0xb
 > 
 > > > movl 0(%eax),%esi'
 > > 
 > > Disassembly of the first part of wm_tbi_mediachange follows(0xb
 > > is 11):
 > > 
 > > (gdb) x/20i wm_tbi_mediachange
 > > 0x6c0 <wm_tbi_mediachange>:     push   %ebp
 > > 0x6c1 <wm_tbi_mediachange+1>:   mov    %esp,%ebp
 > > 0x6c3 <wm_tbi_mediachange+3>:   push   %esi
 > > 0x6c4 <wm_tbi_mediachange+4>:   push   %ebx
 > > 0x6c5 <wm_tbi_mediachange+5>:   sub    $0x10,%esp
 > > 0x6c8 <wm_tbi_mediachange+8>:   mov    0x8(%ebp),%eax
 > > 0x6cb <wm_tbi_mediachange+11>:  mov    (%eax),%esi
 > > 0x6cd <wm_tbi_mediachange+13>:  mov    0x26c(%esi),%ebx
 > > 
 > > This is early in wm_tbi_mediachange(), which starts with:
 > > 
 > > static int 
 > > wm_tbi_mediachange(struct ifnet *ifp)
 > > {        
 > >         struct wm_softc *sc = ifp->if_softc;
 > >         struct ifmedia_entry *ife = sc->sc_mii.mii_media.ifm_cur;
 > >         uint32_t status;
 > >         int i;
 > > 
 > > I'm guessing ifp is null.  How that can be I don't know, though.
 > > You could try setting ddb.commandonenter to "trace" using sysctl,
 > > perhaps, and thereby gather some more info (if you can't follow
 > > up on the serial console idea).
 > 
 > Actually, 0xb looks like it's the second line: it's the second memory
 > op in the disassembled code, and it has no offset which matches up
 > with if_softc being the first field in the structure.  So, I'm
 > guessing
 > it's ifp->if_softc that is null.
 > 
 > eric

 I want someone to test the followin patch to fix the bug.
Please report me whether the link is up or not.

 This patch includes PR#32009, too.

Index: if_wm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wm.c,v
retrieving revision 1.172
diff -u -r1.172 if_wm.c
--- if_wm.c     31 Mar 2009 06:58:55 -0000      1.172
+++ if_wm.c     2 Apr 2009 12:27:05 -0000
@@ -4095,6 +4095,7 @@
 static void
 wm_tbi_mediainit(struct wm_softc *sc)
 {
+       struct ifnet *ifp = &sc->sc_ethercom.ec_if;
        const char *sep = "";
 
        if (sc->sc_type < WM_T_82543)
@@ -4102,6 +4103,10 @@
        else
                sc->sc_tipg = TIPG_LG_DFLT;
 
+       /* Initialize our media structures */
+       sc->sc_mii.mii_ifp = ifp;
+
+       sc->sc_ethercom.ec_mii = &sc->sc_mii;
        ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, wm_tbi_mediachange,
            wm_tbi_mediastatus);
 
@@ -4177,14 +4182,18 @@
        uint32_t status;
        int i;
 
+#if 0 /* XXX ??? */
        sc->sc_txcw = ife->ifm_data;
+#else
+       sc->sc_txcw = 0;
+#endif
        DPRINTF(WM_DEBUG_LINK,("%s: sc_txcw = 0x%x on entry\n",
                    device_xname(sc->sc_dev),sc->sc_txcw));
        if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO ||
            (sc->sc_mii.mii_media.ifm_media & IFM_FLOW) != 0)
-               sc->sc_txcw |= ANAR_X_PAUSE_SYM | ANAR_X_PAUSE_ASYM;
+               sc->sc_txcw |= TXCW_SYM_PAUSE | TXCW_ASYM_PAUSE;
        if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { 
-               sc->sc_txcw |= TXCW_ANE; 
+               sc->sc_txcw |= TXCW_ANE;
        } else {
                /*If autonegotiation is turned off, force link up and turn on 
full duplex*/
                sc->sc_txcw &= ~TXCW_ANE;
Index: if_wmreg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wmreg.h,v
retrieving revision 1.26
diff -u -r1.26 if_wmreg.h
--- if_wmreg.h  20 Mar 2009 07:29:15 -0000      1.26
+++ if_wmreg.h  2 Apr 2009 12:27:05 -0000
@@ -482,6 +482,8 @@
 
 #define        WMREG_TXCW      0x0178  /* Transmit Configuration Word (TBI 
mode) */
        /* See MII ANAR_X bits. */
+#define        TXCW_SYM_PAUSE  (1U << 7)       /* sym pause request */
+#define        TXCW_ASYM_PAUSE (1U << 8)       /* asym pause request */
 #define        TXCW_TxConfig   (1U << 30)      /* Tx Config */
 #define        TXCW_ANE        (1U << 31)      /* Autonegotiate */
 

----------------------------------------------------------
                SAITOH Masanobu (masanobu%iij.ad.jp@localhost
                                  msaitoh%netbsd.org@localhost)


Home | Main Index | Thread Index | Old Index