Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci add suspend/resume support



details:   https://anonhg.NetBSD.org/src/rev/230fe13da623
branches:  trunk
changeset: 747669:230fe13da623
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Sep 26 19:58:53 2009 +0000

description:
add suspend/resume support

diffstat:

 sys/dev/pci/if_vr.c |  20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diffs (66 lines):

diff -r 83cee2618f65 -r 230fe13da623 sys/dev/pci/if_vr.c
--- a/sys/dev/pci/if_vr.c       Sat Sep 26 19:43:04 2009 +0000
+++ b/sys/dev/pci/if_vr.c       Sat Sep 26 19:58:53 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vr.c,v 1.98 2009/09/06 14:10:42 tsutsui Exp $       */
+/*     $NetBSD: if_vr.c,v 1.99 2009/09/26 19:58:53 jmcneill Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.98 2009/09/06 14:10:42 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.99 2009/09/26 19:58:53 jmcneill Exp $");
 
 #include "rnd.h"
 
@@ -209,6 +209,7 @@
        uint8_t                 vr_enaddr[ETHER_ADDR_LEN];
        struct mii_data         vr_mii;         /* MII/media info */
 
+       pcireg_t                vr_id;          /* vendor/product ID */
        uint8_t                 vr_revid;       /* Rhine chip revision */
 
        callout_t               vr_tick_ch;     /* tick callout */
@@ -317,6 +318,7 @@
 static void    vr_reset(struct vr_softc *);
 static int     vr_restore_state(pci_chipset_tag_t, pcitag_t, device_t,
     pcireg_t);
+static bool    vr_resume(device_t PMF_FN_PROTO);
 
 int    vr_copy_small = 0;
 
@@ -1457,6 +1459,7 @@
        sc->vr_dev = self;
        sc->vr_pc = pa->pa_pc;
        sc->vr_tag = pa->pa_tag;
+       sc->vr_id = pa->pa_id;
        callout_init(&sc->vr_tick_ch, 0);
 
        pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo));
@@ -1705,7 +1708,7 @@
            RND_TYPE_NET, 0);
 #endif
 
-       if (pmf_device_register1(self, NULL, NULL, vr_shutdown))
+       if (pmf_device_register1(self, NULL, vr_resume, vr_shutdown))
                pmf_class_network_register(self, ifp);
        else
                aprint_error_dev(self, "couldn't establish power handler\n");
@@ -1754,3 +1757,14 @@
        PCI_CONF_WRITE(PCI_INTERRUPT_REG, sc->vr_save_irq);
        return 0;
 }
+
+static bool
+vr_resume(device_t self PMF_FN_ARGS)
+{
+       struct vr_softc *sc = device_private(self);
+
+       if (PCI_PRODUCT(sc->vr_id) != PCI_PRODUCT_VIATECH_VT3043)
+               VR_CLRBIT(sc, VR_STICKHW, (VR_STICKHW_DS0|VR_STICKHW_DS1));
+
+       return true;
+}



Home | Main Index | Thread Index | Old Index