summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1998-04-20 15:21:02 +0000
committernate <nate@FreeBSD.org>1998-04-20 15:21:02 +0000
commit56d762105bf1b81cf9a7dfdb3bd4b56e5e04942e (patch)
treeb02afe6a8b5f7425f2a782cd861665a677456bd7 /sys
parent26ef0a3053225f5a76aec92b63eeec20d22d5eaf (diff)
downloadFreeBSD-src-56d762105bf1b81cf9a7dfdb3bd4b56e5e04942e.zip
FreeBSD-src-56d762105bf1b81cf9a7dfdb3bd4b56e5e04942e.tar.gz
- Give up trying for a simple solution for correctly recognizing if a card
was really removed, or simply 'faked' by a suspend/resume. Keep track of both current and previous state, and send that information to the userland programs. [ XXX - This breaks binary compatability with older pccardd programs, but they don't work reliably. :( ]
Diffstat (limited to 'sys')
-rw-r--r--sys/pccard/cardinfo.h1
-rw-r--r--sys/pccard/pccard.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/sys/pccard/cardinfo.h b/sys/pccard/cardinfo.h
index 3fef4f4..ba98283 100644
--- a/sys/pccard/cardinfo.h
+++ b/sys/pccard/cardinfo.h
@@ -115,6 +115,7 @@ struct pcic_reg {
*/
struct slotstate {
enum cardstate state; /* Current state of slot */
+ enum cardstate laststate; /* Previous state of slot */
int maxmem; /* Max allowed memory windows */
int maxio; /* Max allowed I/O windows */
int irqs; /* Bitmap of IRQs allowed */
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index 7b1fdc1..eeec4b1 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -28,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: pccard.c,v 1.57 1998/04/08 15:00:02 nate Exp $
+ * $Id: pccard.c,v 1.58 1998/04/09 14:01:13 nate Exp $
*/
#include "opt_devfs.h"
@@ -379,6 +379,7 @@ slot_suspend(void *arg)
if (slt->state == filled) {
int s = splhigh();
disable_slot(slt);
+ slt->laststate = filled;
slt->state = suspend;
splx(s);
printf("Card disabled, slot %d\n", slt->slotnum);
@@ -396,6 +397,7 @@ slot_resume(void *arg)
slt->ctrl->resume(slt);
/* This code stolen from pccard_event:card_inserted */
if (slt->state == suspend) {
+ slt->laststate = suspend;
slt->state = empty;
slt->insert_seq = 1;
slt->insert_ch = timeout(inserted, (void *)slt, hz/4);
@@ -881,6 +883,7 @@ crdioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)
case PIOCGSTATE:
s = splhigh();
((struct slotstate *)data)->state = slt->state;
+ ((struct slotstate *)data)->laststate = slt->laststate;
slt->laststate = slt->state;
splx(s);
((struct slotstate *)data)->maxmem = slt->ctrl->maxmem;
OpenPOWER on IntegriCloud