Date: Mon, 20 Nov 2006 12:12:06 -0500 From: John Baldwin <jhb@freebsd.org> To: Stepan Zastupov <redchrom@gmail.com> Cc: acpi@freebsd.org Subject: Re: Add suspend/resume support for the bfe driver Message-ID: <200611201212.07578.jhb@freebsd.org> In-Reply-To: <20061118033649.GA870@stepan.ispsystem.net> References: <20061117172102.GA836@stepan.ispsystem.net> <200611171412.35214.john@baldwin.cx> <20061118033649.GA870@stepan.ispsystem.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 17 November 2006 22:42, Stepan Zastupov wrote:
> On Fri, Nov 17, 2006 at 02:12:34PM -0500, John Baldwin wrote:
> > Usually drivers don't detach on suspend. How about this patch instead:
> >
> > Index: if_bfe.c
> > ===================================================================
> > RCS file: /usr/cvs/src/sys/dev/bfe/if_bfe.c,v
> > retrieving revision 1.40
> > diff -u -r1.40 if_bfe.c
> > --- if_bfe.c 28 May 2006 20:35:39 -0000 1.40
> > +++ if_bfe.c 17 Nov 2006 19:11:47 -0000
> > @@ -87,6 +87,8 @@
> > static int bfe_probe (device_t);
> > static int bfe_attach (device_t);
> > static int bfe_detach (device_t);
> > +static int bfe_suspend (device_t);
> > +static int bfe_resume (device_t);
> > static void bfe_release_resources (struct bfe_softc *);
> > static void bfe_intr (void *);
> > static void bfe_start (struct ifnet *);
> > @@ -136,6 +138,8 @@
> > DEVMETHOD(device_attach, bfe_attach),
> > DEVMETHOD(device_detach, bfe_detach),
> > DEVMETHOD(device_shutdown, bfe_shutdown),
> > + DEVMETHOD(device_suspend, bfe_suspend),
> > + DEVMETHOD(device_resume, bfe_resume),
> >
> > /* bus interface */
> > DEVMETHOD(bus_print_child, bus_generic_print_child),
> > @@ -480,6 +484,39 @@
> > }
> >
> > static int
> > +bfe_suspend(device_t dev)
> > +{
> > + struct bfe_softc *sc;
> > +
> > + sc = device_get_softc(dev);
> > + BFE_LOCK(sc);
> > + bfe_stop(sc);
> > + BFE_UNLOCK(sc);
> > +
> > + return (0);
> > +}
> > +
> > +static int
> > +bfe_resume(device_t dev)
> > +{
> > + struct bfe_softc *sc;
> > + struct ifnet *ifp;
> > +
> > + sc = device_get_softc(dev);
> > + ifp = sc->bfe_ifp;
> > + BFE_LOCK(sc);
> > + if (ifp->if_flags & IFF_UP) {
> > + bfe_init_locked(sc);
> > + if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
> > + !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
> > + bfe_start_locked(ifp);
> > + }
> > + BFE_UNLOCK(sc);
> > +
> > + return (0);
> > +}
> > +
> > +static int
> > bfe_miibus_readreg(device_t dev, int phy, int reg)
> > {
> > struct bfe_softc *sc;
> >
> > --
> > John Baldwin
> No, system don't want to resume with it. I've tried the same variant
> before I looked into the Linux kernel.
How does it not work? If you do 'ifconfig bfe0 down ; ifconfig bfe0 up' after
resume with the above patch does it then start working?
--
John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611201212.07578.jhb>
