Date: Thu, 2 Nov 2006 23:20:06 GMT From: Matt Jacob <mjacob@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 109077 for review Message-ID: <200611022320.kA2NK6lM089684@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=109077 Change 109077 by mjacob@newisp on 2006/11/02 23:20:04 Do more for the first pass of Domain Validation. Affected files ... .. //depot/projects/newisp/cam/cam_xpt.c#7 edit Differences ... ==== //depot/projects/newisp/cam/cam_xpt.c#7 (text+ko) ==== @@ -151,6 +151,7 @@ #define CAM_DEV_TAG_AFTER_COUNT 0x20 #define CAM_DEV_INQUIRY_DATA_VALID 0x40 #define CAM_DEV_IN_DV 0x80 +#define CAM_DEV_DV_HIT_BOTTOM 0x100 u_int32_t tag_delay_count; #define CAM_TAG_DELAY_COUNT 5 u_int32_t tag_saved_openings; @@ -872,7 +873,8 @@ static void probeschedule(struct cam_periph *probe_periph); static void probestart(struct cam_periph *periph, union ccb *start_ccb); static void proberequestdefaultnegotiation(struct cam_periph *periph); -static int proberequestbackoff(struct cam_periph *periph); +static int proberequestbackoff(struct cam_periph *periph, + 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); @@ -5759,7 +5761,7 @@ } if (inq_buf == NULL) { xpt_print_path(periph->path); - printf("malloc failure- skipping Domain Validation\n"); + printf("malloc failure- skipping Basic Domain Validation\n"); softc->action = PROBE_DV_EXIT; scsi_test_unit_ready(csio, /*retries*/4, @@ -5867,23 +5869,28 @@ * Backoff Negotiation Code- only pertinent for SPI devices. */ static int -proberequestbackoff(struct cam_periph *periph) +proberequestbackoff(struct cam_periph *periph, struct cam_ed *device) { struct ccb_trans_settings cts; struct ccb_trans_settings_spi *spi; + memset(&cts, 0, sizeof (cts)); xpt_setup_ccb(&cts.ccb_h, periph->path, /*priority*/1); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - xpt_print_path(periph->path); - printf("failed to get current settings\n"); + if (bootverbose) { + xpt_print_path(periph->path); + printf("failed to get current settings\n"); + } return (0); } if (cts.transport != XPORT_SPI) { - xpt_print_path(periph->path); - printf("not SPI transport\n"); + if (bootverbose) { + xpt_print_path(periph->path); + printf("not SPI transport\n"); + } return (0); } spi = &cts.xport_specific.spi; @@ -5892,8 +5899,10 @@ * We cannot renegotiate sync rate if we don't have one. */ if ((spi->valid & CTS_SPI_VALID_SYNC_RATE) == 0) { - xpt_print_path(periph->path); - printf("no sync rate known\n"); + if (bootverbose) { + xpt_print_path(periph->path); + printf("no sync rate known\n"); + } return (0); } @@ -5902,23 +5911,37 @@ */ if ((spi->valid & CTS_SPI_VALID_PPR_OPTIONS) != 0) { xpt_print_path(periph->path); - printf("PPR options not handled yet\n"); + printf("XXX PPR options not handled yet\n"); return (0); } /* * A sync rate with unknown or zero offset is nonsensical. + * A sync period of zero means Async. */ - if ((spi->valid & CTS_SPI_VALID_SYNC_RATE) != 0 - && ((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) == 0 - || ((spi->sync_offset == 0)))) { - xpt_print_path(periph->path); - printf("nonsensical sync rate/offset validity\n"); + if ((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) == 0 + || spi->sync_offset == 0 || spi->sync_period == 0) { + if (bootverbose) { + xpt_print_path(periph->path); + printf("no sync rate available\n"); + } + return (0); + } + + if (device->flags & CAM_DEV_DV_HIT_BOTTOM) { + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + ("hit async: giving up on DV\n")); return (0); } + /* * Jump sync_period up by one, but stop at 5MHz and fall back to Async. + * We don't try to remember 'last' settings to see if the SIM actually + * gets into the speed we want to set. We check on the SIM telling + * us that a requested speed is bad, but otherwise don't try and + * check the speed due to the asynchronous and handshake nature + * of speed setting. */ spi->valid = CTS_SPI_VALID_SYNC_RATE | CTS_SPI_VALID_SYNC_OFFSET; for (;;) { @@ -5926,6 +5949,17 @@ if (spi->sync_period >= 0xf) { spi->sync_period = 0; spi->sync_offset = 0; + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + ("setting to async for DV\n")); + /* + * Once we hit async, we don't want to try + * any more settings. + */ + device->flags |= CAM_DEV_DV_HIT_BOTTOM; + } else if (bootverbose) { + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + ("DV: period 0x%x\n", spi->sync_period)); + printf("setting period to 0x%x\n", spi->sync_period); } cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; @@ -5933,6 +5967,11 @@ if ((cts.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { break; } + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + ("DV: failed to set period 0x%x\n", spi->sync_period)); + if (spi->sync_period == 0) { + return (0); + } } return (1); } @@ -6206,13 +6245,20 @@ && done_ccb->ccb_h.target_lun == 0 && (path->device->inq_data.flags & SID_Sync) != 0 && (path->device->flags & CAM_DEV_IN_DV) == 0) { + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + ("Begin Domain Validation\n")); path->device->flags |= CAM_DEV_IN_DV; xpt_release_ccb(done_ccb); softc->action = PROBE_INQUIRY_BASIC_DV1; xpt_schedule(periph, priority); return; } - path->device->flags &= ~(CAM_DEV_UNCONFIGURED|CAM_DEV_IN_DV); + if (softc->action == PROBE_DV_EXIT) { + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + ("Leave Domain Validation\n")); + } + path->device->flags &= + ~(CAM_DEV_UNCONFIGURED|CAM_DEV_IN_DV|CAM_DEV_DV_HIT_BOTTOM); if ((softc->flags & PROBE_NO_ANNOUNCE) == 0) { /* Inform the XPT that a new device has been found */ done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; @@ -6238,11 +6284,13 @@ nbuf = (struct scsi_inquiry_data *)csio->data_ptr; if (bcmp(nbuf, &path->device->inq_data, iqlen) != 0) { xpt_print_path(path); - printf("inquiry data does not compare at DV%d step\n", + printf("inquiry fails comparison at DV%d step\n", softc->action == PROBE_INQUIRY_BASIC_DV1? 1 : 2); - if (proberequestbackoff(periph)) { + if (proberequestbackoff(periph, path->device)) { + path->device->flags &= ~CAM_DEV_IN_DV; softc->action = PROBE_TUR_FOR_NEGOTIATION; } else { + /* give up */ softc->action = PROBE_DV_EXIT; } free(nbuf, M_TEMP); @@ -6257,7 +6305,12 @@ xpt_schedule(periph, priority); return; } - path->device->flags &= ~CAM_DEV_UNCONFIGURED; + if (softc->action == PROBE_DV_EXIT) { + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + ("Leave Domain Validation Successfully\n")); + } + path->device->flags &= + ~(CAM_DEV_UNCONFIGURED|CAM_DEV_IN_DV|CAM_DEV_DV_HIT_BOTTOM); if ((softc->flags & PROBE_NO_ANNOUNCE) == 0) { /* Inform the XPT that a new device has been found */ done_ccb->ccb_h.func_code = XPT_GDEV_TYPE;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611022320.kA2NK6lM089684>