From 5bc41694118829c30fe87fbfb8223943007f735e Mon Sep 17 00:00:00 2001 From: Vinod Kashyap Date: Mon, 17 May 2004 17:16:58 +0000 Subject: [PATCH] Undid scottl's recent changes. --- sys/dev/twa/twa.h | 1 + sys/dev/twa/twa_cam.c | 2 +- sys/dev/twa/twa_freebsd.c | 40 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/sys/dev/twa/twa.h b/sys/dev/twa/twa.h index 0fee37ecdb9..5f49b496c0c 100644 --- a/sys/dev/twa/twa.h +++ b/sys/dev/twa/twa.h @@ -183,6 +183,7 @@ struct twa_softc { bus_addr_t twa_cmd_pkt_phys;/* phys addr of first of array of cmd pkts */ struct resource *twa_irq_res; /* interrupt resource*/ void *twa_intr_handle;/* interrupt handle */ + struct intr_config_hook twa_ich; /* delayed-startup hook */ struct sysctl_ctx_list twa_sysctl_ctx; struct sysctl_oid *twa_sysctl_tree; diff --git a/sys/dev/twa/twa_cam.c b/sys/dev/twa/twa_cam.c index b0caafe65fd..b8505e988e4 100644 --- a/sys/dev/twa/twa_cam.c +++ b/sys/dev/twa/twa_cam.c @@ -405,7 +405,7 @@ twa_action(struct cam_sim *sim, union ccb *ccb) twa_dbg_dprint(3, sc, "XPT_PATH_INQ request"); path_inq->version_num = 1; - path_inq->hba_inquiry = PI_WIDE_16; + path_inq->hba_inquiry = 0; path_inq->target_sprt = 0; path_inq->hba_misc = 0; path_inq->hba_eng_cnt = 0; diff --git a/sys/dev/twa/twa_freebsd.c b/sys/dev/twa/twa_freebsd.c index b1138aff879..9879448f944 100644 --- a/sys/dev/twa/twa_freebsd.c +++ b/sys/dev/twa/twa_freebsd.c @@ -146,6 +146,7 @@ static int twa_shutdown (device_t dev); static int twa_suspend (device_t dev); static int twa_resume (device_t dev); static void twa_pci_intr(void *arg); +static void twa_intrhook (void *arg); static device_method_t twa_methods[] = { /* Device interface */ @@ -291,7 +292,20 @@ twa_attach(device_t dev) UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, "twa%d", device_get_unit(sc->twa_bus_dev)); sc->twa_ctrl_dev->si_drv1 = sc; - twa_enable_interrupts(sc); + + /* + * Schedule ourselves to bring the controller up once interrupts are + * available. This isn't strictly necessary, since we disable + * interrupts while probing the controller, but it is more in keeping + * with common practice for other disk devices. + */ + sc->twa_ich.ich_func = twa_intrhook; + sc->twa_ich.ich_arg = sc; + if (config_intrhook_establish(&sc->twa_ich) != 0) { + twa_printf(sc, "Can't establish configuration hook.\n"); + twa_free(sc); + return(ENXIO); + } if ((error = twa_cam_setup(sc))) { twa_free(sc); @@ -502,6 +516,30 @@ twa_pci_intr(void *arg) +/* + * Function name: twa_intrhook + * Description: Callback for us to enable interrupts. + * + * Input: arg -- ptr to per ctlr structure + * Output: None + * Return value: None + */ +static void +twa_intrhook(void *arg) +{ + struct twa_softc *sc = (struct twa_softc *)arg; + + twa_dbg_dprint(4, sc, "twa_intrhook Entered"); + + /* Pull ourselves off the intrhook chain. */ + config_intrhook_disestablish(&sc->twa_ich); + + /* Enable interrupts. */ + twa_enable_interrupts(sc); +} + + + /* * Function name: twa_write_pci_config * Description: Writes to the PCI config space.