summaryrefslogtreecommitdiff
path: root/sys/dev/cardbus
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2005-09-19 19:05:40 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2005-09-19 19:05:40 +0000
commitadd2bba0f2a206ffbc201c7992ccdef4fd1ecbc3 (patch)
treed79069dc8bc33d7c02344497d4aec187299c78e6 /sys/dev/cardbus
parentb8fe2c4ffb5939a9dc2522e4d795d9c3208c910c (diff)
knf.
Diffstat (limited to 'sys/dev/cardbus')
-rw-r--r--sys/dev/cardbus/cardslot.c554
-rw-r--r--sys/dev/cardbus/cardslotvar.h44
2 files changed, 299 insertions, 299 deletions
diff --git a/sys/dev/cardbus/cardslot.c b/sys/dev/cardbus/cardslot.c
index 8bfd2e707f4..1d7b6f00c9c 100644
--- a/sys/dev/cardbus/cardslot.c
+++ b/sys/dev/cardbus/cardslot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cardslot.c,v 1.6 2004/07/25 00:13:29 brad Exp $ */
+/* $OpenBSD: cardslot.c,v 1.7 2005/09/19 19:05:39 fgsch Exp $ */
/* $NetBSD: cardslot.c,v 1.9 2000/03/22 09:35:06 haya Exp $ */
/*
@@ -57,8 +57,6 @@
#define DPRINTF(a)
#endif
-
-
STATIC void cardslotattach(struct device *, struct device *, void *);
STATIC int cardslotmatch(struct device *, void *, void *);
@@ -73,162 +71,133 @@ struct cfattach cardslot_ca = {
sizeof(struct cardslot_softc), cardslotmatch, cardslotattach
};
-#ifndef __NetBSD_Version__
struct cfdriver cardslot_cd = {
NULL, "cardslot", DV_DULL
};
-#endif
-
STATIC int
-cardslotmatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
+cardslotmatch(struct device *parent, void *match, void *aux)
{
- struct cardslot_attach_args *caa = aux;
+ struct cardslot_attach_args *caa = aux;
- if (caa->caa_cb_attach == NULL && caa->caa_16_attach == NULL) {
- /* Neither CardBus nor 16-bit PCMCIA are defined. */
- return 0;
- }
+ if (caa->caa_cb_attach == NULL && caa->caa_16_attach == NULL) {
+ /* Neither CardBus nor 16-bit PCMCIA are defined. */
+ return (0);
+ }
- return 1;
+ return (1);
}
-
-
STATIC void
-cardslotattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
+cardslotattach(struct device *parent, struct device *self, void *aux)
{
- struct cardslot_softc *sc = (struct cardslot_softc *)self;
- struct cardslot_attach_args *caa = aux;
-
- struct cbslot_attach_args *cba = caa->caa_cb_attach;
- struct pcmciabus_attach_args *pa = caa->caa_16_attach;
-
- struct cardbus_softc *csc;
- struct pcmcia_softc *psc;
-
- sc->sc_slot = sc->sc_dev.dv_unit;
- sc->sc_cb_softc = NULL;
- sc->sc_16_softc = NULL;
- SIMPLEQ_INIT(&sc->sc_events);
- sc->sc_th_enable = 0;
-
- printf(" slot %d flags %x\n", sc->sc_slot, sc->sc_dev.dv_cfdata->cf_flags);
-
- DPRINTF(("%s attaching CardBus bus...\n", sc->sc_dev.dv_xname));
- if (cba != NULL) {
- if (NULL != (csc = (void *)config_found(self, cba, cardslot_cb_print))) {
- /* cardbus found */
- DPRINTF(("cardslotattach: found cardbus on %s\n", sc->sc_dev.dv_xname));
- sc->sc_cb_softc = csc;
- }
- }
-
- if (pa != NULL) {
- if (NULL != (psc = (void *)config_found_sm(self, pa, cardslot_16_print,
- cardslot_16_submatch))) {
- /* pcmcia 16-bit bus found */
- DPRINTF(("cardslotattach: found 16-bit pcmcia bus\n"));
- sc->sc_16_softc = psc;
- /* XXX: dirty. This code should be removed to achieve MI */
- caa->caa_ph->pcmcia = (struct device *)psc;
- }
- }
-
- if (csc != NULL || psc != NULL)
- kthread_create_deferred(create_slot_manager, (void *)sc);
-
- if (csc && (csc->sc_cf->cardbus_ctrl)(csc->sc_cc, CARDBUS_CD)) {
- DPRINTF(("cardslotattach: CardBus card found\n"));
- /* attach deferred */
- cardslot_event_throw(sc, CARDSLOT_EVENT_INSERTION_CB);
- }
-
- if (psc && (psc->pct->card_detect)(psc->pch)) {
- DPRINTF(("cardbusattach: 16-bit card found\n"));
- /* attach deferred */
- cardslot_event_throw(sc, CARDSLOT_EVENT_INSERTION_16);
- }
-}
+ struct cardslot_softc *sc = (struct cardslot_softc *)self;
+ struct cardslot_attach_args *caa = aux;
+
+ struct cbslot_attach_args *cba = caa->caa_cb_attach;
+ struct pcmciabus_attach_args *pa = caa->caa_16_attach;
+
+ struct cardbus_softc *csc;
+ struct pcmcia_softc *psc;
+
+ sc->sc_slot = sc->sc_dev.dv_unit;
+ sc->sc_cb_softc = NULL;
+ sc->sc_16_softc = NULL;
+ SIMPLEQ_INIT(&sc->sc_events);
+ sc->sc_th_enable = 0;
+
+ printf(" slot %d flags %x\n", sc->sc_slot,
+ sc->sc_dev.dv_cfdata->cf_flags);
+
+ DPRINTF(("%s attaching CardBus bus...\n", sc->sc_dev.dv_xname));
+ if (cba != NULL) {
+ if ((csc = (void *)config_found(self, cba,
+ cardslot_cb_print)) != NULL) {
+ /* cardbus found */
+ DPRINTF(("cardslotattach: found cardbus on %s\n",
+ sc->sc_dev.dv_xname));
+ sc->sc_cb_softc = csc;
+ }
+ }
+ if (pa != NULL) {
+ if ((psc = (void *)config_found_sm(self, pa, cardslot_16_print,
+ cardslot_16_submatch)) != NULL) {
+ /* pcmcia 16-bit bus found */
+ DPRINTF(("cardslotattach: found 16-bit pcmcia bus\n"));
+ sc->sc_16_softc = psc;
+ /* XXX: dirty. This code should be removed
+ * to achieve MI
+ */
+ caa->caa_ph->pcmcia = (struct device *)psc;
+ }
+ }
+ if (csc != NULL || psc != NULL)
+ kthread_create_deferred(create_slot_manager, (void *)sc);
+
+ if (csc && (csc->sc_cf->cardbus_ctrl)(csc->sc_cc, CARDBUS_CD)) {
+ DPRINTF(("cardslotattach: CardBus card found\n"));
+ /* attach deferred */
+ cardslot_event_throw(sc, CARDSLOT_EVENT_INSERTION_CB);
+ }
+
+ if (psc && (psc->pct->card_detect)(psc->pch)) {
+ DPRINTF(("cardbusattach: 16-bit card found\n"));
+ /* attach deferred */
+ cardslot_event_throw(sc, CARDSLOT_EVENT_INSERTION_16);
+ }
+}
STATIC int
-cardslot_cb_print(aux, pnp)
- void *aux;
- const char *pnp;
+cardslot_cb_print(void *aux, const char *pnp)
{
struct cbslot_attach_args *cba = aux;
- if (pnp) {
+ if (pnp)
printf("cardbus at %s subordinate bus %d", pnp, cba->cba_bus);
- }
- return UNCONF;
+ return (UNCONF);
}
-
static int
-cardslot_16_submatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
+cardslot_16_submatch(struct device *parent, void *match, void *aux)
{
- struct cfdata *cf = match;
+ struct cfdata *cf = match;
- if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != 0)
- return 0;
+ if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != 0)
+ return (0);
- if (cf->cf_loc[0] == -1) {
- return ((*cf->cf_attach->ca_match)(parent, cf, aux));
- }
+ if (cf->cf_loc[0] == -1)
+ return ((*cf->cf_attach->ca_match)(parent, cf, aux));
- return 0;
+ return (0);
}
-
-
static int
-cardslot_16_print(arg, pnp)
- void *arg;
- const char *pnp;
+cardslot_16_print(void *arg, const char *pnp)
{
+ if (pnp)
+ printf("pcmciabus at %s", pnp);
- if (pnp) {
- printf("pcmciabus at %s", pnp);
- }
-
- return UNCONF;
+ return (UNCONF);
}
-
-
-
static void
-create_slot_manager(arg)
- void *arg;
+create_slot_manager(void *arg)
{
- struct cardslot_softc *sc = (struct cardslot_softc *)arg;
+ struct cardslot_softc *sc = (struct cardslot_softc *)arg;
- sc->sc_th_enable = 1;
+ sc->sc_th_enable = 1;
- if (kthread_create(cardslot_event_thread, sc, &sc->sc_event_thread, "%s",
- sc->sc_dev.dv_xname)) {
- printf("%s: unable to create event thread for slot %d\n",
- sc->sc_dev.dv_xname, sc->sc_slot);
- panic("create_slot_manager");
- }
+ if (kthread_create(cardslot_event_thread, sc, &sc->sc_event_thread,
+ "%s", sc->sc_dev.dv_xname)) {
+ printf("%s: unable to create event thread for slot %d\n",
+ sc->sc_dev.dv_xname, sc->sc_slot);
+ panic("create_slot_manager");
+ }
}
-
-
-
/*
* void cardslot_event_throw(struct cardslot_softc *sc, int ev)
*
@@ -236,36 +205,32 @@ create_slot_manager(arg)
* of a slot is changed, it should be noticed using this function.
*/
void
-cardslot_event_throw(sc, ev)
- struct cardslot_softc *sc;
- int ev;
+cardslot_event_throw(struct cardslot_softc *sc, int ev)
{
- struct cardslot_event *ce;
+ struct cardslot_event *ce;
- DPRINTF(("cardslot_event_throw: an event %s comes\n",
- ev == CARDSLOT_EVENT_INSERTION_CB ? "CardBus Card inserted" :
- ev == CARDSLOT_EVENT_INSERTION_16 ? "16-bit Card inserted" :
- ev == CARDSLOT_EVENT_REMOVAL_CB ? "CardBus Card removed" :
- ev == CARDSLOT_EVENT_REMOVAL_16 ? "16-bit Card removed" : "???"));
+ DPRINTF(("cardslot_event_throw: an event %s comes\n",
+ ev == CARDSLOT_EVENT_INSERTION_CB ? "CardBus Card inserted" :
+ ev == CARDSLOT_EVENT_INSERTION_16 ? "16-bit Card inserted" :
+ ev == CARDSLOT_EVENT_REMOVAL_CB ? "CardBus Card removed" :
+ ev == CARDSLOT_EVENT_REMOVAL_16 ? "16-bit Card removed" : "???"));
- if (NULL == (ce = (struct cardslot_event *)malloc(sizeof (struct cardslot_event), M_TEMP, M_NOWAIT))) {
- panic("cardslot_event");
- }
-
- ce->ce_type = ev;
+ if ((ce = (struct cardslot_event *)malloc(sizeof(struct cardslot_event),
+ M_TEMP, M_NOWAIT)) == NULL) {
+ panic("cardslot_event");
+ }
- {
- int s = spltty();
- SIMPLEQ_INSERT_TAIL(&sc->sc_events, ce, ce_q);
- splx(s);
- }
+ ce->ce_type = ev;
- wakeup(&sc->sc_events);
+ {
+ int s = spltty();
+ SIMPLEQ_INSERT_TAIL(&sc->sc_events, ce, ce_q);
+ splx(s);
+ }
- return;
+ wakeup(&sc->sc_events);
}
-
/*
* static void cardslot_event_thread(void *arg)
*
@@ -274,144 +239,177 @@ cardslot_event_throw(sc, ev)
*
*/
static void
-cardslot_event_thread(arg)
- void *arg;
+cardslot_event_thread(void *arg)
{
- struct cardslot_softc *sc = arg;
- struct cardslot_event *ce;
- int s;
- static int antonym_ev[4] = {
- CARDSLOT_EVENT_REMOVAL_16, CARDSLOT_EVENT_INSERTION_16,
- CARDSLOT_EVENT_REMOVAL_CB, CARDSLOT_EVENT_INSERTION_CB
- };
-
- while (sc->sc_th_enable) {
- s = spltty();
- if ((ce = SIMPLEQ_FIRST(&sc->sc_events)) == NULL) {
- splx(s);
- (void) tsleep(&sc->sc_events, PWAIT, "cardslotev", 0);
- continue;
- }
- SIMPLEQ_REMOVE_HEAD(&sc->sc_events, ce_q);
- splx(s);
-
- if (IS_CARDSLOT_INSERT_REMOVE_EV(ce->ce_type)) {
- /* Chattering suppression */
- s = spltty();
- while (1) {
- struct cardslot_event *ce1, *ce2;
-
- if ((ce1 = SIMPLEQ_FIRST(&sc->sc_events)) == NULL) {
- break;
- }
- if (ce1->ce_type != antonym_ev[ce->ce_type]) {
- break;
+ struct cardslot_softc *sc = arg;
+ struct cardslot_event *ce;
+ int s;
+ static int antonym_ev[4] = {
+ CARDSLOT_EVENT_REMOVAL_16, CARDSLOT_EVENT_INSERTION_16,
+ CARDSLOT_EVENT_REMOVAL_CB, CARDSLOT_EVENT_INSERTION_CB
+ };
+
+ while (sc->sc_th_enable) {
+ s = spltty();
+ if ((ce = SIMPLEQ_FIRST(&sc->sc_events)) == NULL) {
+ splx(s);
+ (void) tsleep(&sc->sc_events, PWAIT, "cardslotev", 0);
+ continue;
+ }
+ SIMPLEQ_REMOVE_HEAD(&sc->sc_events, ce_q);
+ splx(s);
+
+ if (IS_CARDSLOT_INSERT_REMOVE_EV(ce->ce_type)) {
+ /* Chattering suppression */
+ s = spltty();
+ while (1) {
+ struct cardslot_event *ce1, *ce2;
+
+ if ((ce1 = SIMPLEQ_FIRST(&sc->sc_events)) ==
+ NULL)
+ break;
+ if (ce1->ce_type != antonym_ev[ce->ce_type])
+ break;
+ if ((ce2 = SIMPLEQ_NEXT(ce1, ce_q)) == NULL)
+ break;
+ if (ce2->ce_type == ce->ce_type) {
+ SIMPLEQ_REMOVE_HEAD(&sc->sc_events,
+ ce_q);
+ free(ce1, M_TEMP);
+ SIMPLEQ_REMOVE_HEAD(&sc->sc_events,
+ ce_q);
+ free(ce2, M_TEMP);
+ }
+ }
+ splx(s);
+ }
+
+ switch (ce->ce_type) {
+ case CARDSLOT_EVENT_INSERTION_CB:
+ if ((CARDSLOT_CARDTYPE(sc->sc_status) ==
+ CARDSLOT_STATUS_CARD_CB) ||
+ (CARDSLOT_CARDTYPE(sc->sc_status) ==
+ CARDSLOT_STATUS_CARD_16)) {
+ if (CARDSLOT_WORK(sc->sc_status) ==
+ CARDSLOT_STATUS_WORKING) {
+ /* A card has already been inserted
+ * and works.
+ */
+ break;
+ }
+ }
+
+ if (sc->sc_cb_softc) {
+ CARDSLOT_SET_CARDTYPE(sc->sc_status,
+ CARDSLOT_STATUS_CARD_CB);
+ if (cardbus_attach_card(sc->sc_cb_softc) > 0) {
+ /* At least one function works */
+ CARDSLOT_SET_WORK(sc->sc_status,
+ CARDSLOT_STATUS_WORKING);
+ } else {
+ /* No functions work or this card is
+ * not known
+ */
+ CARDSLOT_SET_WORK(sc->sc_status,
+ CARDSLOT_STATUS_NOTWORK);
+ }
+ } else {
+ panic("no cardbus on %s", sc->sc_dev.dv_xname);
+ }
+
+ break;
+
+ case CARDSLOT_EVENT_INSERTION_16:
+ if ((CARDSLOT_CARDTYPE(sc->sc_status) ==
+ CARDSLOT_STATUS_CARD_CB) ||
+ (CARDSLOT_CARDTYPE(sc->sc_status) ==
+ CARDSLOT_STATUS_CARD_16)) {
+ if (CARDSLOT_WORK(sc->sc_status) ==
+ CARDSLOT_STATUS_WORKING) {
+ /* A card has already been inserted
+ * and works.
+ */
+ break;
+ }
+ }
+ if (sc->sc_16_softc) {
+ CARDSLOT_SET_CARDTYPE(sc->sc_status,
+ CARDSLOT_STATUS_CARD_16);
+ if (pcmcia_card_attach(
+ (struct device *)sc->sc_16_softc)) {
+ /* Do not attach */
+ CARDSLOT_SET_WORK(sc->sc_status,
+ CARDSLOT_STATUS_NOTWORK);
+ } else {
+ /* working */
+ CARDSLOT_SET_WORK(sc->sc_status,
+ CARDSLOT_STATUS_WORKING);
+ }
+ } else {
+ panic("no 16-bit pcmcia on %s",
+ sc->sc_dev.dv_xname);
+ }
+
+ break;
+
+ case CARDSLOT_EVENT_REMOVAL_CB:
+ if (CARDSLOT_CARDTYPE(sc->sc_status) ==
+ CARDSLOT_STATUS_CARD_CB) {
+ /* CardBus card has not been inserted. */
+ 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) {
+ /* Unknown card... */
+ CARDSLOT_SET_CARDTYPE(sc->sc_status,
+ CARDSLOT_STATUS_CARD_NONE);
+ }
+ CARDSLOT_SET_WORK(sc->sc_status,
+ CARDSLOT_STATUS_NOTWORK);
+ break;
+
+ case CARDSLOT_EVENT_REMOVAL_16:
+ DPRINTF(("%s: removal event\n", sc->sc_dev.dv_xname));
+ if (CARDSLOT_CARDTYPE(sc->sc_status) !=
+ CARDSLOT_STATUS_CARD_16) {
+ /* 16-bit card has not been inserted. */
+ break;
+ }
+ if ((sc->sc_16_softc != NULL) &&
+ (CARDSLOT_WORK(sc->sc_status) ==
+ CARDSLOT_STATUS_WORKING)) {
+ struct pcmcia_softc *psc = sc->sc_16_softc;
+
+ pcmcia_card_deactivate((struct device *)psc);
+ pcmcia_chip_socket_disable(psc->pct, psc->pch);
+ pcmcia_card_detach((struct device *)psc,
+ DETACH_FORCE);
+ }
+ CARDSLOT_SET_CARDTYPE(sc->sc_status,
+ CARDSLOT_STATUS_CARD_NONE);
+ CARDSLOT_SET_WORK(sc->sc_status,
+ CARDSLOT_STATUS_NOTWORK);
+ break;
+
+ default:
+ panic("cardslot_event_thread: unknown event %d",
+ ce->ce_type);
+ }
+ free(ce, M_TEMP);
}
- if ((ce2 = SIMPLEQ_NEXT(ce1, ce_q)) == NULL) {
- break;
- }
- if (ce2->ce_type == ce->ce_type) {
- SIMPLEQ_REMOVE_HEAD(&sc->sc_events, ce_q);
- free(ce1, M_TEMP);
- SIMPLEQ_REMOVE_HEAD(&sc->sc_events, ce_q);
- free(ce2, M_TEMP);
- }
- }
- splx(s);
- }
-
- switch (ce->ce_type) {
- case CARDSLOT_EVENT_INSERTION_CB:
- if ((CARDSLOT_CARDTYPE(sc->sc_status) == CARDSLOT_STATUS_CARD_CB)
- || (CARDSLOT_CARDTYPE(sc->sc_status) == CARDSLOT_STATUS_CARD_16)) {
- if (CARDSLOT_WORK(sc->sc_status) == CARDSLOT_STATUS_WORKING) {
- /* A card has already been inserted and works. */
- break;
- }
- }
-
- if (sc->sc_cb_softc) {
- CARDSLOT_SET_CARDTYPE(sc->sc_status, CARDSLOT_STATUS_CARD_CB);
- if (cardbus_attach_card(sc->sc_cb_softc) > 0) {
- /* at least one function works */
- CARDSLOT_SET_WORK(sc->sc_status, CARDSLOT_STATUS_WORKING);
- } else {
- /* no functions work or this card is not known */
- CARDSLOT_SET_WORK(sc->sc_status, CARDSLOT_STATUS_NOTWORK);
- }
- } else {
- panic("no cardbus on %s", sc->sc_dev.dv_xname);
- }
-
- break;
-
- case CARDSLOT_EVENT_INSERTION_16:
- if ((CARDSLOT_CARDTYPE(sc->sc_status) == CARDSLOT_STATUS_CARD_CB)
- || (CARDSLOT_CARDTYPE(sc->sc_status) == CARDSLOT_STATUS_CARD_16)) {
- if (CARDSLOT_WORK(sc->sc_status) == CARDSLOT_STATUS_WORKING) {
- /* A card has already been inserted and works. */
- break;
- }
- }
- if (sc->sc_16_softc) {
- CARDSLOT_SET_CARDTYPE(sc->sc_status, CARDSLOT_STATUS_CARD_16);
- if (pcmcia_card_attach((struct device *)sc->sc_16_softc)) {
- /* Do not attach */
- CARDSLOT_SET_WORK(sc->sc_status, CARDSLOT_STATUS_NOTWORK);
- } else {
- /* working */
- CARDSLOT_SET_WORK(sc->sc_status, CARDSLOT_STATUS_WORKING);
- }
- } else {
- panic("no 16-bit pcmcia on %s", sc->sc_dev.dv_xname);
- }
-
- break;
-
- case CARDSLOT_EVENT_REMOVAL_CB:
- if (CARDSLOT_CARDTYPE(sc->sc_status) == CARDSLOT_STATUS_CARD_CB) {
- /* CardBus card has not been inserted. */
- 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) {
- /* Unknown card... */
- CARDSLOT_SET_CARDTYPE(sc->sc_status, CARDSLOT_STATUS_CARD_NONE);
- }
- CARDSLOT_SET_WORK(sc->sc_status, CARDSLOT_STATUS_NOTWORK);
- break;
-
- case CARDSLOT_EVENT_REMOVAL_16:
- DPRINTF(("%s: removal event\n", sc->sc_dev.dv_xname));
- if (CARDSLOT_CARDTYPE(sc->sc_status) != CARDSLOT_STATUS_CARD_16) {
- /* 16-bit card has not been inserted. */
- break;
- }
- if ((sc->sc_16_softc != NULL)
- && (CARDSLOT_WORK(sc->sc_status) == CARDSLOT_STATUS_WORKING)) {
- struct pcmcia_softc *psc = sc->sc_16_softc;
-
- pcmcia_card_deactivate((struct device *)psc);
- pcmcia_chip_socket_disable(psc->pct, psc->pch);
- pcmcia_card_detach((struct device *)psc, DETACH_FORCE);
- }
- CARDSLOT_SET_CARDTYPE(sc->sc_status, CARDSLOT_STATUS_CARD_NONE);
- CARDSLOT_SET_WORK(sc->sc_status, CARDSLOT_STATUS_NOTWORK);
- break;
-
- default:
- panic("cardslot_event_thread: unknown event %d", ce->ce_type);
- }
- free(ce, M_TEMP);
- }
-
- sc->sc_event_thread = NULL;
-
- /* In case the parent device is waiting for us to exit. */
- wakeup(sc);
-
- kthread_exit(0);
+
+ sc->sc_event_thread = NULL;
+
+ /* In case the parent device is waiting for us to exit. */
+ wakeup(sc);
+
+ kthread_exit(0);
}
diff --git a/sys/dev/cardbus/cardslotvar.h b/sys/dev/cardbus/cardslotvar.h
index 70cd123ce44..04b9c7f0763 100644
--- a/sys/dev/cardbus/cardslotvar.h
+++ b/sys/dev/cardbus/cardslotvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cardslotvar.h,v 1.2 2002/03/14 01:26:53 millert Exp $ */
+/* $OpenBSD: cardslotvar.h,v 1.3 2005/09/19 19:05:39 fgsch Exp $ */
/* $NetBSD: cardslotvar.h,v 1.5 2000/03/13 23:52:38 soren Exp $ */
/*
@@ -46,18 +46,20 @@ struct cardslot_event;
* PCMCIA (including CardBus and 16-bit card) slot.
*/
struct cardslot_attach_args {
- char *caa_busname;
+ char *caa_busname;
- int caa_slot;
+ int caa_slot;
- /* for cardbus... */
- struct cbslot_attach_args *caa_cb_attach;
+ /* for cardbus... */
+ struct cbslot_attach_args *caa_cb_attach;
- /* for 16-bit pcmcia */
- struct pcmciabus_attach_args *caa_16_attach;
+ /* for 16-bit pcmcia */
+ struct pcmciabus_attach_args *caa_16_attach;
- /* XXX: for 16-bit pcmcia. dirty! This should be removed to achieve MI. */
- struct pcic_handle *caa_ph;
+ /* XXX: for 16-bit pcmcia. dirty!
+ * This should be removed to achieve MI.
+ */
+ struct pcic_handle *caa_ph;
};
@@ -66,20 +68,20 @@ struct cardslot_attach_args {
* PCMCIA (including CardBus and 16-bit card) slot.
*/
struct cardslot_softc {
- struct device sc_dev;
+ struct device sc_dev;
- int sc_slot; /* slot number */
- int sc_status; /* the status of slot */
+ int sc_slot; /* slot number */
+ int sc_status; /* the status of slot */
- struct cardbus_softc *sc_cb_softc;
- struct pcmcia_softc *sc_16_softc;
+ struct cardbus_softc *sc_cb_softc;
+ struct pcmcia_softc *sc_16_softc;
- struct proc *sc_event_thread;
- int sc_th_enable; /* true if the thread is enabled */
+ struct proc *sc_event_thread;
+ int sc_th_enable; /* true if the thread is enabled */
- /* An event queue for the thread which processes slot state events. */
+ /* An event queue for the thread which processes slot state events. */
- SIMPLEQ_HEAD(, cardslot_event) sc_events;
+ SIMPLEQ_HEAD(, cardslot_event) sc_events;
};
#define CARDSLOT_STATUS_CARD_MASK 0x07
@@ -104,9 +106,9 @@ struct cardslot_softc {
struct cardslot_event {
- SIMPLEQ_ENTRY(cardslot_event) ce_q;
+ SIMPLEQ_ENTRY(cardslot_event) ce_q;
- int ce_type;
+ int ce_type;
};
typedef struct cardslot_softc *cardslot_t;
@@ -120,6 +122,6 @@ typedef struct cardslot_softc *cardslot_t;
#define IS_CARDSLOT_INSERT_REMOVE_EV(x) (0 <= (x) && (x) <= 3)
-void cardslot_event_throw(cardslot_t cs, int ev);
+void cardslot_event_throw(cardslot_t, int);
#endif /* !_DEV_CARDBUS_CARDSLOTVAR_H_ */