mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-24 02:34:59 +00:00
- 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
This commit is contained in:
parent
af8eceb3f6
commit
ec510cabb0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=30815
|
@ -54,7 +54,7 @@
|
||||||
/*
|
/*
|
||||||
* Slot states for PIOCGSTATE
|
* Slot states for PIOCGSTATE
|
||||||
*/
|
*/
|
||||||
enum cardstate { noslot, empty, filled };
|
enum cardstate { noslot, empty, suspend, filled };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Descriptor structure for memory map.
|
* Descriptor structure for memory map.
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
/*
|
/*
|
||||||
* Slot states for PIOCGSTATE
|
* Slot states for PIOCGSTATE
|
||||||
*/
|
*/
|
||||||
enum cardstate { noslot, empty, filled };
|
enum cardstate { noslot, empty, suspend, filled };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Descriptor structure for memory map.
|
* Descriptor structure for memory map.
|
||||||
|
|
|
@ -372,6 +372,14 @@ slot_suspend(void *arg)
|
||||||
{
|
{
|
||||||
struct slot *slt = 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);
|
slt->ctrl->disable(slt);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -383,16 +391,11 @@ slot_resume(void *arg)
|
||||||
|
|
||||||
if (pcic_resume_reset)
|
if (pcic_resume_reset)
|
||||||
slt->ctrl->resume(slt);
|
slt->ctrl->resume(slt);
|
||||||
/* Fake card removal/insertion events */
|
/* This code stolen from pccard_event:card_inserted */
|
||||||
if (slt->state == filled) {
|
if (slt->state == suspend) {
|
||||||
int s;
|
|
||||||
|
|
||||||
s = splhigh();
|
|
||||||
disable_slot(slt);
|
|
||||||
slt->state = empty;
|
slt->state = empty;
|
||||||
splx(s);
|
|
||||||
slt->insert_seq = 1;
|
slt->insert_seq = 1;
|
||||||
slt->insert_ch = timeout(inserted, (void *)slt, hz);
|
slt->insert_ch = timeout(inserted, (void *)slt, hz/4);
|
||||||
selwakeup(&slt->selp);
|
selwakeup(&slt->selp);
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id: cardd.c,v 1.18 1997/10/06 11:36:06 charnier Exp $";
|
"$Id: cardd.c,v 1.19 1997/10/26 04:36:24 nate Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -227,6 +227,9 @@ slot_change(struct slot *sp)
|
||||||
case filled:
|
case filled:
|
||||||
card_inserted(sp);
|
card_inserted(sp);
|
||||||
break;
|
break;
|
||||||
|
case suspend:
|
||||||
|
/* ignored */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue