PERFORCE change 167740 for review
Alexander Motin
mav at FreeBSD.org
Mon Aug 24 17:26:12 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=167740
Change 167740 by mav at mav_mavbook on 2009/08/24 17:26:00
Fix device->XXX_version setting for ATA.
Affected files ...
.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#34 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_internal.h#5 edit
Differences ...
==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#34 (text+ko) ====
@@ -666,11 +666,8 @@
strlen(path->device->serial_num);
}
- path->device->flags |= CAM_DEV_INQUIRY_DATA_VALID;
-
- scsi_find_quirk(path->device);
+ path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID;
ata_device_transport(path);
-
PROBE_SET_ACTION(softc, PROBE_SETMODE);
xpt_release_ccb(done_ccb);
xpt_schedule(periph, priority);
@@ -764,8 +761,7 @@
}
scsi_find_quirk(path->device);
-
-// scsi_devise_transport(path);
+ ata_device_transport(path);
path->device->flags &= ~CAM_DEV_UNCONFIGURED;
done_ccb->ccb_h.func_code = XPT_GDEV_TYPE;
xpt_action(done_ccb);
@@ -786,7 +782,7 @@
}
case PROBE_PM_PID:
if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
- if ((path->device->flags & CAM_DEV_INQUIRY_DATA_VALID) == 0)
+ if ((path->device->flags & CAM_DEV_IDENTIFY_DATA_VALID) == 0)
bzero(ident_buf, sizeof(*ident_buf));
softc->pm_pid = (done_ccb->ataio.res.lba_high << 24) +
(done_ccb->ataio.res.lba_mid << 16) +
@@ -819,7 +815,7 @@
printf("PM Revision: %08x\n", softc->pm_prv);
snprintf(ident_buf->revision, sizeof(ident_buf->revision),
"%04x", softc->pm_prv);
- path->device->flags |= CAM_DEV_INQUIRY_DATA_VALID;
+ path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID;
if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) {
path->device->flags &= ~CAM_DEV_UNCONFIGURED;
done_ccb->ccb_h.func_code = XPT_GDEV_TYPE;
@@ -1170,68 +1166,29 @@
ata_device_transport(struct cam_path *path)
{
struct ccb_pathinq cpi;
-// struct ccb_trans_settings cts;
- struct scsi_inquiry_data *inq_buf;
+ struct ccb_trans_settings cts;
+ struct scsi_inquiry_data *inq_buf = NULL;
+ struct ata_params *ident_buf = NULL;
/* Get transport information from the SIM */
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL);
cpi.ccb_h.func_code = XPT_PATH_INQ;
xpt_action((union ccb *)&cpi);
- inq_buf = NULL;
-// if ((path->device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0)
-// inq_buf = &path->device->inq_data;
-// path->device->protocol = cpi.protocol;
-// path->device->protocol_version =
-// inq_buf != NULL ? SID_ANSI_REV(inq_buf) : cpi.protocol_version;
path->device->transport = cpi.transport;
- path->device->transport_version = cpi.transport_version;
-#if 0
- /*
- * Any device not using SPI3 features should
- * be considered SPI2 or lower.
- */
- if (inq_buf != NULL) {
- if (path->device->transport == XPORT_SPI
- && (inq_buf->spi3data & SID_SPI_MASK) == 0
- && path->device->transport_version > 2)
- path->device->transport_version = 2;
- } else {
- struct cam_ed* otherdev;
-
- for (otherdev = TAILQ_FIRST(&path->target->ed_entries);
- otherdev != NULL;
- otherdev = TAILQ_NEXT(otherdev, links)) {
- if (otherdev != path->device)
- break;
- }
-
- if (otherdev != NULL) {
- /*
- * Initially assume the same versioning as
- * prior luns for this target.
- */
- path->device->protocol_version =
- otherdev->protocol_version;
- path->device->transport_version =
- otherdev->transport_version;
- } else {
- /* Until we know better, opt for safty */
- path->device->protocol_version = 2;
- if (path->device->transport == XPORT_SPI)
- path->device->transport_version = 2;
- else
- path->device->transport_version = 0;
- }
+ if ((path->device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0)
+ inq_buf = &path->device->inq_data;
+ if ((path->device->flags & CAM_DEV_IDENTIFY_DATA_VALID) != 0)
+ ident_buf = &path->device->ident_data;
+ if (path->device->protocol == PROTO_ATA) {
+ path->device->protocol_version = ident_buf ?
+ ata_version(ident_buf->version_major) : cpi.protocol_version;
+ } else if (path->device->protocol == PROTO_SCSI) {
+ path->device->protocol_version = inq_buf ?
+ SID_ANSI_REV(inq_buf) : cpi.protocol_version;
}
-
- /*
- * XXX
- * For a device compliant with SPC-2 we should be able
- * to determine the transport version supported by
- * scrutinizing the version descriptors in the
- * inquiry buffer.
- */
+ path->device->transport_version = ident_buf ?
+ ata_version(ident_buf->version_major) : cpi.transport_version;
/* Tell the controller what we think */
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL);
@@ -1244,7 +1201,6 @@
cts.proto_specific.valid = 0;
cts.xport_specific.valid = 0;
xpt_action((union ccb *)&cts);
-#endif
}
static void
==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_internal.h#5 (text+ko) ====
@@ -117,6 +117,7 @@
#define CAM_DEV_INQUIRY_DATA_VALID 0x40
#define CAM_DEV_IN_DV 0x80
#define CAM_DEV_DV_HIT_BOTTOM 0x100
+#define CAM_DEV_IDENTIFY_DATA_VALID 0x200
u_int32_t tag_delay_count;
#define CAM_TAG_DELAY_COUNT 5
u_int32_t tag_saved_openings;
More information about the p4-projects
mailing list