Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ocs_fc/ocs_pci.c
Show First 20 Lines • Show All 571 Lines • ▼ Show 20 Lines | ocs_device_detach(ocs_t *ocs) | ||||
ocs_io_t *io = NULL; | ocs_io_t *io = NULL; | ||||
if (ocs != NULL) { | if (ocs != NULL) { | ||||
if (!ocs->attached) { | if (!ocs->attached) { | ||||
ocs_log_warn(ocs, "%s: Device is not attached\n", __func__); | ocs_log_warn(ocs, "%s: Device is not attached\n", __func__); | ||||
return -1; | return -1; | ||||
} | } | ||||
ocs->attached = FALSE; | |||||
rc = ocs_xport_control(ocs->xport, OCS_XPORT_SHUTDOWN); | rc = ocs_xport_control(ocs->xport, OCS_XPORT_SHUTDOWN); | ||||
if (rc) { | if (rc) { | ||||
ocs_log_err(ocs, "%s: Transport Shutdown timed out\n", __func__); | ocs_log_err(ocs, "%s: Transport Shutdown timed out\n", __func__); | ||||
} | } | ||||
ocs_intr_teardown(ocs); | ocs_intr_teardown(ocs); | ||||
if (ocs_xport_detach(ocs->xport) != 0) { | if (ocs_xport_detach(ocs->xport) != 0) { | ||||
ocs_log_err(ocs, "%s: Transport detach failed\n", __func__); | ocs_log_err(ocs, "%s: Transport detach failed\n", __func__); | ||||
} | } | ||||
ocs_cam_detach(ocs); | ocs_cam_detach(ocs); | ||||
ocs_free(ocs, ocs->fcports, sizeof(ocs->fcports)); | ocs_free(ocs, ocs->fcports, sizeof(ocs->fcports)); | ||||
for (i = 0; (io = ocs_io_get_instance(ocs, i)); i++) { | for (i = 0; (io = ocs_io_get_instance(ocs, i)); i++) { | ||||
if (bus_dmamap_destroy(ocs->buf_dmat, io->tgt_io.dmap)) { | if (bus_dmamap_destroy(ocs->buf_dmat, io->tgt_io.dmap)) { | ||||
device_printf(ocs->dev, "%s: bad dma map destroy\n", __func__); | device_printf(ocs->dev, "%s: bad dma map destroy\n", __func__); | ||||
} | } | ||||
} | } | ||||
bus_dma_tag_destroy(ocs->dmat); | bus_dma_tag_destroy(ocs->dmat); | ||||
ocs_xport_free(ocs->xport); | ocs_xport_free(ocs->xport); | ||||
ocs->xport = NULL; | ocs->xport = NULL; | ||||
ocs->attached = FALSE; | |||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 352 Lines • Show Last 20 Lines |