NetBSD-Bugs archive

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

Re: kern/38675 (mskc(4)/msk(4) dosen't support ACPI suspend)



The following reply was made to PR kern/38675; it has been noted by GNATS.

From: Joerg Sonnenberger <joerg%britannica.bec.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/38675 (mskc(4)/msk(4) dosen't support ACPI suspend)
Date: Tue, 27 May 2008 22:42:06 +0200

 --/04w6evG8XlLl3ft
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Sun, May 25, 2008 at 11:25:02PM +0000, Takahiro Kambe wrote:
 >  msk0: phy failed to come ready
 >  msk0: phy failed to come ready
 >  msk0: phy failed to come ready
 >  msk0: phy failed to come ready
 
 OK, try the attached version. It might need some explicit kicking of the
 PHY first.
 
 Joerg
 
 --/04w6evG8XlLl3ft
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="if_msk.c.diff"
 
 Index: if_msk.c
 ===================================================================
 RCS file: /data/repo/netbsd/src/sys/dev/pci/if_msk.c,v
 retrieving revision 1.18
 diff -u -p -r1.18 if_msk.c
 --- if_msk.c   10 Apr 2008 19:13:37 -0000      1.18
 +++ if_msk.c   27 May 2008 20:40:40 -0000
 @@ -100,7 +100,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1
  
  int mskc_probe(struct device *, struct cfdata *, void *);
  void mskc_attach(struct device *, struct device *self, void *aux);
 -void mskc_shutdown(void *);
 +static bool mskc_powerdown(device_t PMF_FN_PROTO);
 +static bool mskc_resume(device_t PMF_FN_PROTO);
  int msk_probe(struct device *, struct cfdata *, void *);
  void msk_attach(struct device *, struct device *self, void *aux);
  int mskcprint(void *, const char *);
 @@ -950,6 +951,15 @@ msk_probe(struct device *parent, struct 
        return (0);
  }
  
 +static bool
 +msk_resume(device_t dv PMF_FN_ARGS)
 +{
 +      struct sk_if_softc *sc_if = device_private(dv);
 +      
 +      msk_init_yukon(sc_if);
 +      return true;
 +}
 +
  /*
   * Each XMAC chip is attached as a separate logical IP interface.
   * Single port cards will have only one logical interface of course.
 @@ -1096,7 +1106,10 @@ msk_attach(struct device *parent, struct
        if_attach(ifp);
        ether_ifattach(ifp, sc_if->sk_enaddr);
  
 -      shutdownhook_establish(mskc_shutdown, sc);
 +      if (!pmf_device_register(self, NULL, msk_resume))
 +              aprint_error_dev(self, "couldn't establish power handler\n");
 +      else
 +              pmf_class_network_register(self, ifp);
  
  #if NRND > 0
        rnd_attach_source(&sc->rnd_source, device_xname(&sc->sk_dev),
 @@ -1424,6 +1437,9 @@ mskc_attach(struct device *parent, struc
                goto fail_6;
        }
  
 +      if (!pmf_device_register(self, mskc_powerdown, mskc_resume))
 +              aprint_error_dev(self, "couldn't establish power handler\n");
 +
        return;
  
   fail_6:
 @@ -1621,17 +1637,30 @@ msk_watchdog(struct ifnet *ifp)
        }
  }
  
 -void
 -mskc_shutdown(void *v)
 +static bool
 +mskc_powerdown(device_t dv PMF_FN_ARGS)
  {
 -      struct sk_softc         *sc = v;
 +      struct sk_softc *sc = device_private(dv);
  
 -      DPRINTFN(2, ("msk_shutdown\n"));
 +      DPRINTFN(2, ("mskc_powerdown\n"));
  
        /* Turn off the 'driver is loaded' LED. */
        CSR_WRITE_2(sc, SK_LED, SK_LED_GREEN_OFF);
  
 +      return true;
 +}
 +
 +static bool
 +mskc_resume(device_t dv PMF_FN_ARGS)
 +{
 +      struct sk_softc *sc = device_private(dv);
 +
 +      DPRINTFN(2, ("mskc_resume\n"));
 +
        msk_reset(sc);
 +      CSR_WRITE_2(sc, SK_LED, SK_LED_GREEN_ON);
 +
 +      return true;
  }
  
  __inline int
 
 --/04w6evG8XlLl3ft--
 


Home | Main Index | Thread Index | Old Index