Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/cardbus Force power off when a CardBus card is detac...



details:   https://anonhg.NetBSD.org/src/rev/103c3888e58a
branches:  trunk
changeset: 481429:103c3888e58a
user:      haya <haya%NetBSD.org@localhost>
date:      Mon Jan 31 08:49:07 2000 +0000

description:
Force power off when a CardBus card is detached.
Use tsleep when kernel thread works.

diffstat:

 sys/dev/cardbus/cardbus.c  |  17 +++++++++++++----
 sys/dev/cardbus/cardslot.c |   3 ++-
 2 files changed, 15 insertions(+), 5 deletions(-)

diffs (71 lines):

diff -r 0a2265208509 -r 103c3888e58a sys/dev/cardbus/cardbus.c
--- a/sys/dev/cardbus/cardbus.c Fri Jan 28 23:23:49 2000 +0000
+++ b/sys/dev/cardbus/cardbus.c Mon Jan 31 08:49:07 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cardbus.c,v 1.18 2000/01/26 09:04:59 haya Exp $        */
+/*     $NetBSD: cardbus.c,v 1.19 2000/01/31 08:49:07 haya Exp $        */
 
 /*
  * Copyright (c) 1997, 1998, 1999 and 2000
@@ -41,6 +41,7 @@
 #include <sys/malloc.h>
 #include <sys/kernel.h>
 #include <sys/syslog.h>
+#include <sys/proc.h>
 
 #include <machine/bus.h>
 
@@ -444,7 +445,13 @@
       if (id != 0xffffffff && id != 0) {
        break;
       }
-      delay(100*1000);         /* or tsleep */
+      if (cold) {              /* before kernel thread invoked */
+       delay(100*1000);
+      } else {                 /* thread context */
+       if (tsleep((void *)sc, PCATCH, "cardbus", hz/10) != EWOULDBLOCK) {
+         break;
+       }
+      }
     }
     if (i == 5) {
       return 0;
@@ -642,10 +649,9 @@
        struct device *fndev = ct->ct_device;
        ct_next = ct->ct_next;
 
-       printf("%s: detaching %s\n", sc->sc_dev.dv_xname, fndev->dv_xname);
+       DPRINTF(("%s: detaching %s\n", sc->sc_dev.dv_xname, fndev->dv_xname));
        /* call device detach function */
 
-
        if (0 != config_detach(fndev, 0)) {
            printf("%s: cannot detaching dev %s, function %d\n",
                   sc->sc_dev.dv_xname, fndev->dv_xname, ct->ct_func);
@@ -656,6 +662,9 @@
            free(ct, M_DEVBUF);
        }
     }
+
+    sc->sc_poweron_func = 0;
+    sc->sc_cf->cardbus_power(sc->sc_cc, CARDBUS_VCC_0V | CARDBUS_VPP_0V);
 }
 
 
diff -r 0a2265208509 -r 103c3888e58a sys/dev/cardbus/cardslot.c
--- a/sys/dev/cardbus/cardslot.c        Fri Jan 28 23:23:49 2000 +0000
+++ b/sys/dev/cardbus/cardslot.c        Mon Jan 31 08:49:07 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cardslot.c,v 1.7 2000/01/26 09:04:59 haya Exp $        */
+/*     $NetBSD: cardslot.c,v 1.8 2000/01/31 08:49:07 haya Exp $        */
 
 /*
  * Copyright (c) 1999 and 2000
@@ -428,6 +428,7 @@
        if (CARDSLOT_WORK(sc->sc_status) == CARDSLOT_STATUS_WORKING) {
          cardbus_detach_card(sc->sc_cb_softc);
          CARDSLOT_SET_WORK(sc->sc_status, CARDSLOT_STATUS_NOTWORK);
+         CARDSLOT_SET_WORK(sc->sc_status, CARDSLOT_STATUS_CARD_NONE);
        }
        CARDSLOT_SET_CARDTYPE(sc->sc_status, CARDSLOT_STATUS_CARD_NONE);
       } else if (CARDSLOT_CARDTYPE(sc->sc_status) != CARDSLOT_STATUS_CARD_16) {



Home | Main Index | Thread Index | Old Index