Date: Wed, 8 Apr 2009 17:33:34 GMT From: Scott Long <scottl@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 160385 for review Message-ID: <200904081733.n38HXYYq004751@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=160385 Change 160385 by scottl@scottl-deimos on 2009/04/08 17:32:48 Change scsi xpt function names as needed. Add quirk accessor macros Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_xpt.c#10 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_xpt.c#10 (text+ko) ==== @@ -78,6 +78,7 @@ u_int mintags; u_int maxtags; }; +#define SCSI_QUIRK(dev) ((struct scsi_quirk_entry *)((dev)->quirk)) static int cam_srch_hi = 0; TUNABLE_INT("kern.cam.cam_srch_hi", &cam_srch_hi); @@ -94,14 +95,14 @@ * or we're > SCSI-2 and the last lun was a success, * we can look for luns above lun 8. */ -#define CAN_SRCH_HI_SPARSE(dv) \ - (((dv->quirk->quirks & CAM_QUIRK_NOHILUNS) == 0) \ - && ((dv->quirk->quirks & CAM_QUIRK_HILUNS) \ +#define CAN_SRCH_HI_SPARSE(dv) \ + (((SCSI_QUIRK(dv)->quirks & CAM_QUIRK_NOHILUNS) == 0) \ + && ((SCSI_QUIRK(dv)->quirks & CAM_QUIRK_HILUNS) \ || (SID_ANSI_REV(&dv->inq_data) > SCSI_REV_2 && cam_srch_hi))) -#define CAN_SRCH_HI_DENSE(dv) \ - (((dv->quirk->quirks & CAM_QUIRK_NOHILUNS) == 0) \ - && ((dv->quirk->quirks & CAM_QUIRK_HILUNS) \ +#define CAN_SRCH_HI_DENSE(dv) \ + (((SCSI_QUIRK(dv)->quirks & CAM_QUIRK_NOHILUNS) == 0) \ + && ((SCSI_QUIRK(dv)->quirks & CAM_QUIRK_HILUNS) \ || (SID_ANSI_REV(&dv->inq_data) > SCSI_REV_2))) static periph_init_t probe_periph_init; @@ -530,25 +531,25 @@ struct cam_ed *device); static void probedone(struct cam_periph *periph, union ccb *done_ccb); static void probecleanup(struct cam_periph *periph); -static void xpt_find_quirk(struct cam_ed *device); -static void xpt_scan_bus(struct cam_periph *periph, union ccb *ccb); -static void xpt_scan_lun(struct cam_periph *periph, - struct cam_path *path, cam_flags flags, - union ccb *ccb); +static void scsi_find_quirk(struct cam_ed *device); +static void scsi_scan_bus(struct cam_periph *periph, union ccb *ccb); +static void scsi_scan_lun(struct cam_periph *periph, + struct cam_path *path, cam_flags flags, + union ccb *ccb); static void xptscandone(struct cam_periph *periph, union ccb *done_ccb); static struct cam_ed * scsi_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id); static void scsi_devise_transport(struct cam_path *path); -static void xpt_set_transfer_settings(struct ccb_trans_settings *cts, - struct cam_ed *device, - int async_update); -static void xpt_toggle_tags(struct cam_path *path); -static void xpt_dev_async(u_int32_t async_code, - struct cam_eb *bus, - struct cam_et *target, - struct cam_ed *device, - void *async_arg); +static void scsi_set_transfer_settings(struct ccb_trans_settings *cts, + struct cam_ed *device, + int async_update); +static void scsi_toggle_tags(struct cam_path *path); +static void scsi_dev_async(u_int32_t async_code, + struct cam_eb *bus, + struct cam_et *target, + struct cam_ed *device, + void *async_arg); static void probe_periph_init() @@ -789,7 +790,7 @@ struct cam_ed *device; device = periph->path->device; - if ((device->quirk->quirks & CAM_QUIRK_NOSERIAL) == 0) { + if ((SCSI_QUIRK(device)->quirks & CAM_QUIRK_NOSERIAL) == 0) { vpd_list = malloc(sizeof(*vpd_list), M_CAMXPT, M_NOWAIT | M_ZERO); } @@ -1050,9 +1051,9 @@ return; } - xpt_find_quirk(path->device); + scsi_find_quirk(path->device); - xpt_devise_transport(path); + scsi_devise_transport(path); if (INQ_DATA_TQ_ENABLED(inq_buf)) PROBE_SET_ACTION(softc, PROBE_MODE_SENSE); else @@ -1406,20 +1407,21 @@ } static void -xpt_find_quirk(struct cam_ed *device) +scsi_find_quirk(struct cam_ed *device) { struct scsi_quirk_entry *quirk; caddr_t match; match = cam_quirkmatch((caddr_t)&device->inq_data, (caddr_t)scsi_quirk_table, - sizeof(scsi_quirk_table)/sizeof(*scsi__quirk_table), + sizeof(scsi_quirk_table) / + sizeof(*scsi_quirk_table), sizeof(*scsi_quirk_table), scsi_inquiry_match); if (match == NULL) panic("xpt_find_quirk: device didn't match wildcard entry!!"); - quirk = (strut scsi_quirk_entry *)match; + quirk = (struct scsi_quirk_entry *)match; device->quirk = quirk; device->mintags = quirk->mintags; device->maxtags = quirk->maxtags; @@ -1446,7 +1448,7 @@ union ccb *request_ccb; struct ccb_pathinq *cpi; int counter; -} xpt_scan_bus_info; +} scsi_scan_bus_info; /* * To start a scan, request_ccb is an XPT_SCAN_BUS ccb. @@ -1454,14 +1456,14 @@ * callback on completion function. */ static void -xpt_scan_bus(struct cam_periph *periph, union ccb *request_ccb) +scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb) { CAM_DEBUG(request_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_scan_bus\n")); switch (request_ccb->ccb_h.func_code) { case XPT_SCAN_BUS: { - xpt_scan_bus_info *scan_info; + scsi_scan_bus_info *scan_info; union ccb *work_ccb; struct cam_path *path; u_int i; @@ -1498,8 +1500,8 @@ } /* Save some state for use while we probe for devices */ - scan_info = (xpt_scan_bus_info *) - malloc(sizeof(xpt_scan_bus_info), M_CAMXPT, M_NOWAIT); + scan_info = (scsi_scan_bus_info *) + malloc(sizeof(scsi_scan_bus_info), M_CAMXPT, M_NOWAIT); if (scan_info == NULL) { request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; xpt_done(request_ccb); @@ -1555,7 +1557,7 @@ xpt_setup_ccb(&work_ccb->ccb_h, path, request_ccb->ccb_h.pinfo.priority); work_ccb->ccb_h.func_code = XPT_SCAN_LUN; - work_ccb->ccb_h.cbfcnp = xpt_scan_bus; + work_ccb->ccb_h.cbfcnp = scsi_scan_bus; work_ccb->ccb_h.ppriv_ptr0 = scan_info; work_ccb->crcn.flags = request_ccb->crcn.flags; xpt_action(work_ccb); @@ -1566,13 +1568,13 @@ { cam_status status; struct cam_path *path; - xpt_scan_bus_info *scan_info; + scsi_scan_bus_info *scan_info; path_id_t path_id; target_id_t target_id; lun_id_t lun_id; /* Reuse the same CCB to query if a device was really found */ - scan_info = (xpt_scan_bus_info *)request_ccb->ccb_h.ppriv_ptr0; + scan_info = (scsi_scan_bus_info *)request_ccb->ccb_h.ppriv_ptr0; xpt_setup_ccb(&request_ccb->ccb_h, request_ccb->ccb_h.path, request_ccb->ccb_h.pinfo.priority); request_ccb->ccb_h.func_code = XPT_GDEV_TYPE; @@ -1617,7 +1619,8 @@ device = request_ccb->ccb_h.path->device; - if ((device->quirk->quirks & CAM_QUIRK_NOLUNS) == 0) { + if ((SCSI_QUIRK(device)->quirks & + CAM_QUIRK_NOLUNS) == 0) { /* Try the next lun */ if (lun_id < (CAM_SCSI2_MAXLUN-1) || CAN_SRCH_HI_DENSE(device)) @@ -1686,7 +1689,7 @@ xpt_setup_ccb(&request_ccb->ccb_h, path, request_ccb->ccb_h.pinfo.priority); request_ccb->ccb_h.func_code = XPT_SCAN_LUN; - request_ccb->ccb_h.cbfcnp = xpt_scan_bus; + request_ccb->ccb_h.cbfcnp = scsi_scan_bus; request_ccb->ccb_h.ppriv_ptr0 = scan_info; request_ccb->crcn.flags = scan_info->request_ccb->crcn.flags; @@ -1702,7 +1705,7 @@ xpt_setup_ccb(&request_ccb->ccb_h, path, request_ccb->ccb_h.pinfo.priority); request_ccb->ccb_h.func_code = XPT_SCAN_LUN; - request_ccb->ccb_h.cbfcnp = xpt_scan_bus; + request_ccb->ccb_h.cbfcnp = scsi_scan_bus; request_ccb->ccb_h.ppriv_ptr0 = scan_info; request_ccb->crcn.flags = scan_info->request_ccb->crcn.flags; @@ -1716,7 +1719,7 @@ } static void -xpt_scan_lun(struct cam_periph *periph, struct cam_path *path, +scsi_scan_lun(struct cam_periph *periph, struct cam_path *path, cam_flags flags, union ccb *request_ccb) { struct ccb_pathinq cpi; @@ -2010,18 +2013,18 @@ } case XPT_SET_TRAN_SETTINGS: { - xpt_set_transfer_settings(&start_ccb->cts, - start_ccb->ccb_h.path->device, - /*async_update*/FALSE); + scsi_set_transfer_settings(&start_ccb->cts, + start_ccb->ccb_h.path->device, + /*async_update*/FALSE); break; } case XPT_SCAN_BUS: - xpt_scan_bus(start_ccb->ccb_h.path->periph, start_ccb); + scsi_scan_bus(start_ccb->ccb_h.path->periph, start_ccb); break; case XPT_SCAN_LUN: - xpt_scan_lun(start_ccb->ccb_h.path->periph, - start_ccb->ccb_h.path, start_ccb->crcn.flags, - start_ccb); + scsi_scan_lun(start_ccb->ccb_h.path->periph, + start_ccb->ccb_h.path, start_ccb->crcn.flags, + start_ccb); break; case XPT_GET_TRAN_SETTINGS: { @@ -2038,8 +2041,8 @@ } static void -xpt_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device, - int async_update) +scsi_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device, + int async_update) { struct ccb_pathinq cpi; struct ccb_trans_settings cur_cts; @@ -2261,7 +2264,7 @@ && (spi->flags & (CTS_SPI_VALID_SYNC_RATE| CTS_SPI_VALID_SYNC_OFFSET| CTS_SPI_VALID_BUS_WIDTH)) != 0) - xpt_toggle_tags(cts->ccb_h.path); + scsi_toggle_tags(cts->ccb_h.path); } if (cts->type == CTS_TYPE_CURRENT_SETTINGS @@ -2324,7 +2327,7 @@ } static void -xpt_toggle_tags(struct cam_path *path) +scsi_toggle_tags(struct cam_path *path) { struct cam_ed *dev; @@ -2348,10 +2351,10 @@ cts.transport_version = XPORT_VERSION_UNSPECIFIED; cts.proto_specific.scsi.flags = 0; cts.proto_specific.scsi.valid = CTS_SCSI_VALID_TQ; - xpt_set_transfer_settings(&cts, path->device, + scsi_set_transfer_settings(&cts, path->device, /*async_update*/TRUE); cts.proto_specific.scsi.flags = CTS_SCSI_FLAGS_TAG_ENB; - xpt_set_transfer_settings(&cts, path->device, + scsi_set_transfer_settings(&cts, path->device, /*async_update*/TRUE); } } @@ -2360,7 +2363,7 @@ * Handle any per-device event notifications that require action by the XPT. */ static void -xpt_dev_async(u_int32_t async_code, struct cam_eb *bus, struct cam_et *target, +scsi_dev_async(u_int32_t async_code, struct cam_eb *bus, struct cam_et *target, struct cam_ed *device, void *async_arg) { cam_status status; @@ -2395,7 +2398,7 @@ */ if (async_code == AC_SENT_BDR || async_code == AC_BUS_RESET) - xpt_toggle_tags(&newpath); + scsi_toggle_tags(&newpath); if (async_code == AC_INQ_CHANGED) { /* @@ -2405,7 +2408,7 @@ * change. So we re-scan the device to * refresh the inquiry data for it. */ - xpt_scan_lun(newpath.periph, &newpath, + scsi_scan_lun(newpath.periph, &newpath, CAM_EXPECT_INQ_CHANGE, NULL); } xpt_release_path(&newpath); @@ -2415,7 +2418,7 @@ struct ccb_trans_settings *settings; settings = (struct ccb_trans_settings *)async_arg; - xpt_set_transfer_settings(settings, device, + scsi_set_transfer_settings(settings, device, /*async_update*/TRUE); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904081733.n38HXYYq004751>