summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1997-10-28 17:51:25 +0000
committernate <nate@FreeBSD.org>1997-10-28 17:51:25 +0000
commit2e553bc25069eeeaf344cab2b006655cb04de92c (patch)
tree4f829903a1b524d022289ea0992e0747e13fb2b1 /sys
parent2c7ba54db583d15a410c146cd4501196e769b97c (diff)
downloadFreeBSD-src-2e553bc25069eeeaf344cab2b006655cb04de92c.zip
FreeBSD-src-2e553bc25069eeeaf344cab2b006655cb04de92c.tar.gz
- Disable cards when doing a suspend by emulating that they have been
removed. Add a new state 'suspend' so we 'fake' insertion events at resume time for the cards that have been suspended. [ The code still works if you remove the card during suspend, switch the card during suspend, or combinations of both. ] Reviewed by: frf@xocolatl.com
Diffstat (limited to 'sys')
-rw-r--r--sys/pccard/card.h2
-rw-r--r--sys/pccard/cardinfo.h2
-rw-r--r--sys/pccard/pccard.c19
3 files changed, 13 insertions, 10 deletions
diff --git a/sys/pccard/card.h b/sys/pccard/card.h
index 159a8e7..91da726 100644
--- a/sys/pccard/card.h
+++ b/sys/pccard/card.h
@@ -54,7 +54,7 @@
/*
* Slot states for PIOCGSTATE
*/
-enum cardstate { noslot, empty, filled };
+enum cardstate { noslot, empty, suspend, filled };
/*
* Descriptor structure for memory map.
diff --git a/sys/pccard/cardinfo.h b/sys/pccard/cardinfo.h
index 159a8e7..91da726 100644
--- a/sys/pccard/cardinfo.h
+++ b/sys/pccard/cardinfo.h
@@ -54,7 +54,7 @@
/*
* Slot states for PIOCGSTATE
*/
-enum cardstate { noslot, empty, filled };
+enum cardstate { noslot, empty, suspend, filled };
/*
* Descriptor structure for memory map.
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index 549f215..d0507b3 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -372,6 +372,14 @@ slot_suspend(void *arg)
{
struct slot *slt = arg;
+ /* This code stolen from pccard_event:card_removed */
+ if (slt->state == filled) {
+ int s = splhigh();
+ disable_slot(slt);
+ slt->state = suspend;
+ splx(s);
+ printf("Card disabled, slot %d\n", slt->slotnum);
+ }
slt->ctrl->disable(slt);
return (0);
}
@@ -383,16 +391,11 @@ slot_resume(void *arg)
if (pcic_resume_reset)
slt->ctrl->resume(slt);
- /* Fake card removal/insertion events */
- if (slt->state == filled) {
- int s;
-
- s = splhigh();
- disable_slot(slt);
+ /* This code stolen from pccard_event:card_inserted */
+ if (slt->state == suspend) {
slt->state = empty;
- splx(s);
slt->insert_seq = 1;
- slt->insert_ch = timeout(inserted, (void *)slt, hz);
+ slt->insert_ch = timeout(inserted, (void *)slt, hz/4);
selwakeup(&slt->selp);
}
return (0);
OpenPOWER on IntegriCloud