diff options
author | Eiji Ota <Eiji.Ota@Sun.COM> | 2009-05-08 12:55:15 -0700 |
---|---|---|
committer | Eiji Ota <Eiji.Ota@Sun.COM> | 2009-05-08 12:55:15 -0700 |
commit | e99353559fac68ede91471daee91660d64cc7894 (patch) | |
tree | d7b4f81fd8acdea6499a17b9da46c63b7825587d /usr/src | |
parent | 67630a58010cadac58370eef9d7b5dde9e2ab3e4 (diff) | |
download | illumos-joyent-e99353559fac68ede91471daee91660d64cc7894.tar.gz |
6836479 assertion failed: handlep != NULL, file: ../../common/io/ib/adapters/hermon/herm on_fm.c, line: 1163
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/io/ib/adapters/hermon/hermon.c | 107 | ||||
-rw-r--r-- | usr/src/uts/common/io/ib/adapters/tavor/tavor.c | 39 |
2 files changed, 82 insertions, 64 deletions
diff --git a/usr/src/uts/common/io/ib/adapters/hermon/hermon.c b/usr/src/uts/common/io/ib/adapters/hermon/hermon.c index 47b73bbe89..effda2371d 100644 --- a/usr/src/uts/common/io/ib/adapters/hermon/hermon.c +++ b/usr/src/uts/common/io/ib/adapters/hermon/hermon.c @@ -720,6 +720,7 @@ fail_attach: if (hermon_get_state(state) & HCA_EREPORT_FM) { hermon_fm_ereport(state, HCA_SYS_ERR, HCA_ERR_SRV_LOST); } + hermon_drv_fini2(state); hermon_fm_fini(state); ddi_soft_state_free(hermon_statep, instance); @@ -1247,7 +1248,7 @@ hermon_drv_fini(hermon_state_t *state) /* * hermon_drv_fini2() - * Context: Only called from or detach() path context + * Context: Only called from attach() and/or detach() path contexts */ static void hermon_drv_fini2(hermon_state_t *state) @@ -1256,14 +1257,60 @@ hermon_drv_fini2(hermon_state_t *state) ddi_periodic_delete(state->hs_fm_poll_thread); state->hs_fm_poll_thread = NULL; } + + /* HERMON_DRV_CLEANUP_LEVEL1 */ if (state->hs_fm_cmdhdl) { hermon_regs_map_free(state, &state->hs_fm_cmdhdl); state->hs_fm_cmdhdl = NULL; } + if (state->hs_reg_cmdhdl) { ddi_regs_map_free(&state->hs_reg_cmdhdl); state->hs_reg_cmdhdl = NULL; } + + /* HERMON_DRV_CLEANUP_LEVEL0 */ + if (state->hs_msix_tbl_entries) { + kmem_free(state->hs_msix_tbl_entries, + state->hs_msix_tbl_size); + state->hs_msix_tbl_entries = NULL; + } + + if (state->hs_msix_pba_entries) { + kmem_free(state->hs_msix_pba_entries, + state->hs_msix_pba_size); + state->hs_msix_pba_entries = NULL; + } + + if (state->hs_fm_msix_tblhdl) { + hermon_regs_map_free(state, &state->hs_fm_msix_tblhdl); + state->hs_fm_msix_tblhdl = NULL; + } + + if (state->hs_reg_msix_tblhdl) { + ddi_regs_map_free(&state->hs_reg_msix_tblhdl); + state->hs_reg_msix_tblhdl = NULL; + } + + if (state->hs_fm_msix_pbahdl) { + hermon_regs_map_free(state, &state->hs_fm_msix_pbahdl); + state->hs_fm_msix_pbahdl = NULL; + } + + if (state->hs_reg_msix_pbahdl) { + ddi_regs_map_free(&state->hs_reg_msix_pbahdl); + state->hs_reg_msix_pbahdl = NULL; + } + + if (state->hs_fm_pcihdl) { + hermon_pci_config_teardown(state, &state->hs_fm_pcihdl); + state->hs_fm_pcihdl = NULL; + } + + if (state->hs_reg_pcihdl) { + pci_config_teardown(&state->hs_reg_pcihdl); + state->hs_reg_pcihdl = NULL; + } } @@ -2203,61 +2250,11 @@ hermon_hw_fini(hermon_state_t *state, hermon_drv_cleanup_level_t cleanup) /* FALLTHROUGH */ #endif case HERMON_DRV_CLEANUP_LEVEL1: - if (HERMON_IS_OPERATIONAL(state->hs_operational_mode) && - state->hs_fm_cmdhdl) { - hermon_regs_map_free(state, &state->hs_fm_cmdhdl); - state->hs_fm_cmdhdl = NULL; - } - - if (HERMON_IS_OPERATIONAL(state->hs_operational_mode) && - state->hs_reg_cmdhdl) { - ddi_regs_map_free(&state->hs_reg_cmdhdl); - state->hs_reg_cmdhdl = NULL; - } - /* FALLTHROUGH */ - case HERMON_DRV_CLEANUP_LEVEL0: - if (state->hs_msix_tbl_entries) { - kmem_free(state->hs_msix_tbl_entries, - state->hs_msix_tbl_size); - state->hs_msix_tbl_entries = NULL; - } - - if (state->hs_msix_pba_entries) { - kmem_free(state->hs_msix_pba_entries, - state->hs_msix_pba_size); - state->hs_msix_pba_entries = NULL; - } - - if (state->hs_fm_msix_tblhdl) { - hermon_regs_map_free(state, &state->hs_fm_msix_tblhdl); - state->hs_fm_msix_tblhdl = NULL; - } - - if (state->hs_reg_msix_tblhdl) { - ddi_regs_map_free(&state->hs_reg_msix_tblhdl); - state->hs_reg_msix_tblhdl = NULL; - } - - if (state->hs_fm_msix_pbahdl) { - hermon_regs_map_free(state, &state->hs_fm_msix_pbahdl); - state->hs_fm_msix_pbahdl = NULL; - } - - if (state->hs_reg_msix_pbahdl) { - ddi_regs_map_free(&state->hs_reg_msix_pbahdl); - state->hs_reg_msix_pbahdl = NULL; - } - - if (state->hs_fm_pcihdl) { - hermon_regs_map_free(state, &state->hs_fm_pcihdl); - state->hs_fm_pcihdl = NULL; - } - - if (state->hs_reg_pcihdl) { - ddi_regs_map_free(&state->hs_reg_pcihdl); - state->hs_reg_pcihdl = NULL; - } + /* + * LEVEL1 and LEVEL0 resources are freed in + * hermon_drv_fini2(). + */ break; default: diff --git a/usr/src/uts/common/io/ib/adapters/tavor/tavor.c b/usr/src/uts/common/io/ib/adapters/tavor/tavor.c index 8dc8eefae1..5c6570d194 100644 --- a/usr/src/uts/common/io/ib/adapters/tavor/tavor.c +++ b/usr/src/uts/common/io/ib/adapters/tavor/tavor.c @@ -66,6 +66,7 @@ static int tavor_close(dev_t, int, int, cred_t *); static int tavor_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); static int tavor_drv_init(tavor_state_t *state, dev_info_t *dip, int instance); static void tavor_drv_fini(tavor_state_t *state); +static void tavor_drv_fini2(tavor_state_t *state); static int tavor_isr_init(tavor_state_t *state); static void tavor_isr_fini(tavor_state_t *state); static int tavor_hw_init(tavor_state_t *state); @@ -722,6 +723,7 @@ tavor_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) fail_attach: cmn_err(CE_NOTE, "tavor%d: driver failed to attach: %s", instance, state->ts_attach_buf); + tavor_drv_fini2(state); ddi_soft_state_free(tavor_statep, instance); fail_attach_nomsg: TAVOR_TNF_EXIT(tavor_attach); @@ -827,6 +829,7 @@ tavor_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) "detached\n"); } + tavor_drv_fini2(state); ddi_soft_state_free(tavor_statep, instance); TAVOR_TNF_EXIT(tavor_detach); @@ -891,7 +894,6 @@ tavor_drv_init(tavor_state_t *state, dev_info_t *dip, int instance) /* * Initialize the Tavor hardware. - * * Note: If this routine returns an error, it is often an reasonably * good indication that something Tavor firmware-related has caused * the failure. In order to give the user an opportunity (if desired) @@ -954,6 +956,29 @@ tavor_drv_fini(tavor_state_t *state) TAVOR_TNF_EXIT(tavor_drv_fini); } +/* + * tavor_drv_fini2() + * Context: Only called from attach() and/or detach() path contexts + */ +static void +tavor_drv_fini2(tavor_state_t *state) +{ + TAVOR_TNF_ENTER(tavor_drv_fini2); + + /* TAVOR_DRV_CLEANUP_LEVEL1 */ + if (state->ts_reg_cmdhdl) { + ddi_regs_map_free(&state->ts_reg_cmdhdl); + state->ts_reg_cmdhdl = NULL; + } + + /* TAVOR_DRV_CLEANUP_LEVEL0 */ + if (state->ts_pci_cfghdl) { + pci_config_teardown(&state->ts_pci_cfghdl); + state->ts_pci_cfghdl = NULL; + } + + TAVOR_TNF_EXIT(tavor_drv_fini2); +} /* * tavor_isr_init() @@ -1343,7 +1368,6 @@ tavor_hw_init(tavor_state_t *state) state->ts_fw.fw_rev_minor, state->ts_fw.fw_rev_subminor); } - tavor_hw_fini(state, cleanup); TNF_PROBE_0(tavor_hw_init_checkfwver_fail, TAVOR_TNF_ERROR, ""); @@ -1749,14 +1773,11 @@ tavor_hw_fini(tavor_state_t *state, tavor_drv_cleanup_level_t cleanup) /* FALLTHROUGH */ case TAVOR_DRV_CLEANUP_LEVEL1: - ddi_regs_map_free(&state->ts_reg_cmdhdl); - /* FALLTHROUGH */ - case TAVOR_DRV_CLEANUP_LEVEL0: - if (state->ts_pci_cfghdl) { - ddi_regs_map_free(&state->ts_pci_cfghdl); - state->ts_pci_cfghdl = NULL; - } + /* + * LEVEL1 and LEVEL0 resources are freed in + * tavor_drv_fini2(). + */ break; default: |