aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/pcic
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>1999-12-21 08:32:15 +0000
committerWarner Losh <imp@FreeBSD.org>1999-12-21 08:32:15 +0000
commit5882e70cb6af2f926e133554cfc484e1884cb61c (patch)
tree5a3b15e4e7bd61e7f386a525e14f816ba486dd83 /sys/dev/pcic
parent6835a896e2217cbab0d88ec573470cbd9d2f0eb0 (diff)
downloadsrc-5882e70cb6af2f926e133554cfc484e1884cb61c.tar.gz
src-5882e70cb6af2f926e133554cfc484e1884cb61c.zip
Delay creation of threads until after the idle thread is created, more
or less. This is a kludge because there is no support for delayed creation of threads early in the boot process. NEWCARD new boots and the thread process starts and is visible from ps. Now, on to dev/pccard.
Notes
Notes: svn path=/head/; revision=54938
Diffstat (limited to 'sys/dev/pcic')
-rw-r--r--sys/dev/pcic/i82365.c37
-rw-r--r--sys/dev/pcic/i82365var.h3
2 files changed, 18 insertions, 22 deletions
diff --git a/sys/dev/pcic/i82365.c b/sys/dev/pcic/i82365.c
index 8c0ed3a0238e..4bb534a9fae2 100644
--- a/sys/dev/pcic/i82365.c
+++ b/sys/dev/pcic/i82365.c
@@ -65,7 +65,6 @@ int pcic_debug = 0;
#define DETACH_FORCE 0x1
-
#define PCIC_VENDOR_UNKNOWN 0
#define PCIC_VENDOR_I82365SLR0 1
#define PCIC_VENDOR_I82365SLR1 2
@@ -100,6 +99,10 @@ static void pcic_wait_ready(struct pcic_handle *);
static u_int8_t st_pcic_read(struct pcic_handle *, int);
static void st_pcic_write(struct pcic_handle *, int, u_int8_t);
+/* XXX Should really be dynamic XXX */
+static struct pcic_handle *handles[20];
+static struct pcic_handle **lasthandle = handles;
+
int
pcic_ident_ok(int ident)
{
@@ -377,9 +380,6 @@ pcic_create_event_thread(void *arg)
"cannot create event thread for sock 0x%02x\n", h->sock);
panic("pcic_create_event_thread");
}
- config_intrhook_disestablish(h->hook);
- free(h->hook, M_TEMP);
- h->hook = 0;
}
void
@@ -474,26 +474,11 @@ pcic_init_socket(struct pcic_handle *h)
{
int reg;
struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
- struct intr_config_hook *hook;
/*
* queue creation of a kernel thread to handle insert/removal events.
*/
-#ifdef DIAGNOSTIC
- if (h->event_thread != NULL)
- panic("pcic_init_socket: event thread");
-#endif
- hook =
- (struct intr_config_hook *)malloc(sizeof(struct intr_config_hook),
- M_TEMP, M_NOWAIT);
- if (!hook) {
- printf("ini socket failed\n");
- return;
- }
- hook->ich_func = pcic_create_event_thread;
- hook->ich_arg = h;
- h->hook = hook;
- config_intrhook_establish(hook);
+ *lasthandle++ = h;
/* set up the card to interrupt on card detect */
@@ -1391,3 +1376,15 @@ pcic_release_resource(device_t dev, device_t child, int type, int rid,
}
return bus_generic_release_resource(dev, child, type, rid, r);
}
+
+static void
+pcic_start_threads(void *arg)
+{
+ struct pcic_handle **walker;
+ walker = handles;
+ while (*walker) {
+ pcic_create_event_thread(*walker++);
+ }
+}
+
+SYSINIT(pcic, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, pcic_start_threads, 0);
diff --git a/sys/dev/pcic/i82365var.h b/sys/dev/pcic/i82365var.h
index ed014943ff5b..01b501026011 100644
--- a/sys/dev/pcic/i82365var.h
+++ b/sys/dev/pcic/i82365var.h
@@ -49,8 +49,7 @@ struct pcic_event {
struct pcic_handle {
struct pcic_softc *sc;
struct device *ph_parent;
- device_t *dev;
- struct intr_config_hook *hook;
+ device_t dev;
bus_space_tag_t ph_bus_t; /* I/O or MEM? I don't mind */
bus_space_handle_t ph_bus_h;
u_int8_t (* ph_read)(struct pcic_handle*, int);