Put a lock on the pcic, to serialize access to the chip during event
handling. This is important when multiple cards are present when the system boots, as we use tsleep now instead of delay in various places (delay used to provide serialization by virtue of not causing a context switch).
This commit is contained in:
parent
13fc260296
commit
6f1701b01c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: i82365.c,v 1.52 2000/02/25 20:45:43 mycroft Exp $ */
|
||||
/* $NetBSD: i82365.c,v 1.53 2000/02/26 17:24:44 thorpej Exp $ */
|
||||
|
||||
#define PCICDEBUG
|
||||
|
||||
|
@ -175,6 +175,8 @@ pcic_attach(sc)
|
|||
|
||||
DPRINTF(("pcic ident regs:"));
|
||||
|
||||
lockinit(&sc->sc_pcic_lock, PWAIT, "pciclk", 0, 0);
|
||||
|
||||
/* find and configure for the available sockets */
|
||||
count = 0;
|
||||
for (i = 0; i < PCIC_NSLOTS; i++) {
|
||||
|
@ -463,6 +465,12 @@ pcic_event_thread(arg)
|
|||
struct pcic_softc *sc = (struct pcic_softc *)h->ph_parent;
|
||||
|
||||
while (h->shutdown == 0) {
|
||||
/*
|
||||
* Serialize event processing on the PCIC. We may
|
||||
* sleep while we hold this lock.
|
||||
*/
|
||||
(void) lockmgr(&sc->sc_pcic_lock, LK_EXCLUSIVE, NULL);
|
||||
|
||||
s = splhigh();
|
||||
if ((pe = SIMPLEQ_FIRST(&h->events)) == NULL) {
|
||||
splx(s);
|
||||
|
@ -470,6 +478,10 @@ pcic_event_thread(arg)
|
|||
first = 0;
|
||||
config_pending_decr();
|
||||
}
|
||||
/*
|
||||
* No events to process; release the PCIC lock.
|
||||
*/
|
||||
(void) lockmgr(&sc->sc_pcic_lock, LK_RELEASE, NULL);
|
||||
(void) tsleep(&h->events, PWAIT, "pcicev", 0);
|
||||
continue;
|
||||
} else {
|
||||
|
@ -542,6 +554,8 @@ pcic_event_thread(arg)
|
|||
pe->pe_type);
|
||||
}
|
||||
free(pe, M_TEMP);
|
||||
|
||||
(void) lockmgr(&sc->sc_pcic_lock, LK_RELEASE, NULL);
|
||||
}
|
||||
|
||||
h->event_thread = NULL;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: i82365var.h,v 1.13 2000/02/22 16:04:46 thorpej Exp $ */
|
||||
/* $NetBSD: i82365var.h,v 1.14 2000/02/26 17:24:44 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
|
||||
|
@ -30,6 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/device.h>
|
||||
#include <sys/lock.h>
|
||||
|
||||
#include <dev/pcmcia/pcmciareg.h>
|
||||
#include <dev/pcmcia/pcmciachip.h>
|
||||
|
@ -119,6 +120,8 @@ struct pcic_softc {
|
|||
|
||||
pcmcia_chipset_tag_t pct;
|
||||
|
||||
struct lock sc_pcic_lock;
|
||||
|
||||
/* this needs to be large enough to hold PCIC_MEM_PAGES bits */
|
||||
int subregionmask;
|
||||
#define PCIC_MAX_MEM_PAGES (8 * sizeof(int))
|
||||
|
|
Loading…
Reference in New Issue