Author: mav
Date: Wed Jun  6 06:52:51 2012
New Revision: 236666
URL: http://svn.freebsd.org/changeset/base/236666

Log:
  ATA/SATA controllers have no idea about protocol of the connected device
  until transport will do some probe actions (at least soft reset).
  Make ATA/SATA SIMs to not report bogus and confusing PROTO_ATA protocol.
  Make ATA/SATA transport to fill that gap by reporting protocol to SIM with
  XPT_SET_TRAN_SETTINGS and patching XPT_GET_TRAN_SETTINGS results if needed.

Modified:
  head/sys/cam/ata/ata_xpt.c
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ata/ata-all.c
  head/sys/dev/mvs/mvs.c
  head/sys/dev/siis/siis.c

Modified: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c  Wed Jun  6 06:39:34 2012        (r236665)
+++ head/sys/cam/ata/ata_xpt.c  Wed Jun  6 06:52:51 2012        (r236666)
@@ -942,9 +942,9 @@ noerror:
                                xpt_action((union ccb *)&cts);
                        }
                }
+               ata_device_transport(path);
                if (changed)
                        proberequestdefaultnegotiation(periph);
-               ata_device_transport(path);
                PROBE_SET_ACTION(softc, PROBE_SETMODE);
                xpt_release_ccb(done_ccb);
                xpt_schedule(periph, priority);
@@ -1123,6 +1123,9 @@ notsata:
                snprintf(ident_buf->revision, sizeof(ident_buf->revision),
                    "%04x", softc->pm_prv);
                path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID;
+               ata_device_transport(path);
+               if (periph->path->device->flags & CAM_DEV_UNCONFIGURED)
+                       proberequestdefaultnegotiation(periph);
                /* Set supported bits. */
                bzero(&cts, sizeof(cts));
                xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
@@ -1200,6 +1203,9 @@ notsata:
 
                        path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID;
                }
+               ata_device_transport(path);
+               if (changed)
+                       proberequestdefaultnegotiation(periph);
 
                if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) {
                        path->device->flags &= ~CAM_DEV_UNCONFIGURED;
@@ -1777,6 +1783,12 @@ ata_get_transfer_settings(struct ccb_tra
        sim = cts->ccb_h.path->bus->sim;
        (*(sim->sim_action))(sim, (union ccb *)cts);
 
+       if (cts->protocol == PROTO_UNKNOWN ||
+           cts->protocol == PROTO_UNSPECIFIED) {
+               cts->protocol = device->protocol;
+               cts->protocol_version = device->protocol_version;
+       }
+
        if (cts->protocol == PROTO_ATA) {
                ata = &cts->proto_specific.ata;
                if ((ata->valid & CTS_ATA_VALID_TQ) == 0) {
@@ -1797,6 +1809,12 @@ ata_get_transfer_settings(struct ccb_tra
                                scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB;
                }
        }
+
+       if (cts->transport == XPORT_UNKNOWN ||
+           cts->transport == XPORT_UNSPECIFIED) {
+               cts->transport = device->transport;
+               cts->transport_version = device->transport_version;
+       }
 }
 
 static void

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c    Wed Jun  6 06:39:34 2012        (r236665)
+++ head/sys/dev/ahci/ahci.c    Wed Jun  6 06:52:51 2012        (r236666)
@@ -2881,7 +2881,7 @@ ahciaction(struct cam_sim *sim, union cc
                        d = &ch->curr[ccb->ccb_h.target_id];
                else
                        d = &ch->user[ccb->ccb_h.target_id];
-               cts->protocol = PROTO_ATA;
+               cts->protocol = PROTO_UNSPECIFIED;
                cts->protocol_version = PROTO_VERSION_UNSPECIFIED;
                cts->transport = XPORT_SATA;
                cts->transport_version = XPORT_VERSION_UNSPECIFIED;
@@ -2967,7 +2967,7 @@ ahciaction(struct cam_sim *sim, union cc
                cpi->unit_number = cam_sim_unit(sim);
                cpi->transport = XPORT_SATA;
                cpi->transport_version = XPORT_VERSION_UNSPECIFIED;
-               cpi->protocol = PROTO_ATA;
+               cpi->protocol = PROTO_UNSPECIFIED;
                cpi->protocol_version = PROTO_VERSION_UNSPECIFIED;
                cpi->maxio = MAXPHYS;
                /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */

Modified: head/sys/dev/ata/ata-all.c
==============================================================================
--- head/sys/dev/ata/ata-all.c  Wed Jun  6 06:39:34 2012        (r236665)
+++ head/sys/dev/ata/ata-all.c  Wed Jun  6 06:52:51 2012        (r236666)
@@ -1787,7 +1787,7 @@ ataaction(struct cam_sim *sim, union ccb
                        d = &ch->curr[ccb->ccb_h.target_id];
                else
                        d = &ch->user[ccb->ccb_h.target_id];
-               cts->protocol = PROTO_ATA;
+               cts->protocol = PROTO_UNSPECIFIED;
                cts->protocol_version = PROTO_VERSION_UNSPECIFIED;
                if (ch->flags & ATA_SATA) {
                        cts->transport = XPORT_SATA;
@@ -1875,7 +1875,7 @@ ataaction(struct cam_sim *sim, union ccb
                else
                        cpi->transport = XPORT_ATA;
                cpi->transport_version = XPORT_VERSION_UNSPECIFIED;
-               cpi->protocol = PROTO_ATA;
+               cpi->protocol = PROTO_UNSPECIFIED;
                cpi->protocol_version = PROTO_VERSION_UNSPECIFIED;
                cpi->maxio = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS;
                if (device_get_devclass(device_get_parent(parent)) ==

Modified: head/sys/dev/mvs/mvs.c
==============================================================================
--- head/sys/dev/mvs/mvs.c      Wed Jun  6 06:39:34 2012        (r236665)
+++ head/sys/dev/mvs/mvs.c      Wed Jun  6 06:52:51 2012        (r236666)
@@ -2301,7 +2301,7 @@ mvsaction(struct cam_sim *sim, union ccb
                        d = &ch->curr[ccb->ccb_h.target_id];
                else
                        d = &ch->user[ccb->ccb_h.target_id];
-               cts->protocol = PROTO_ATA;
+               cts->protocol = PROTO_UNSPECIFIED;
                cts->protocol_version = PROTO_VERSION_UNSPECIFIED;
                cts->transport = XPORT_SATA;
                cts->transport_version = XPORT_VERSION_UNSPECIFIED;
@@ -2385,7 +2385,7 @@ mvsaction(struct cam_sim *sim, union ccb
                cpi->unit_number = cam_sim_unit(sim);
                cpi->transport = XPORT_SATA;
                cpi->transport_version = XPORT_VERSION_UNSPECIFIED;
-               cpi->protocol = PROTO_ATA;
+               cpi->protocol = PROTO_UNSPECIFIED;
                cpi->protocol_version = PROTO_VERSION_UNSPECIFIED;
                cpi->maxio = MAXPHYS;
                if ((ch->quirks & MVS_Q_SOC) == 0) {

Modified: head/sys/dev/siis/siis.c
==============================================================================
--- head/sys/dev/siis/siis.c    Wed Jun  6 06:39:34 2012        (r236665)
+++ head/sys/dev/siis/siis.c    Wed Jun  6 06:52:51 2012        (r236666)
@@ -1884,7 +1884,7 @@ siisaction(struct cam_sim *sim, union cc
                        d = &ch->curr[ccb->ccb_h.target_id];
                else
                        d = &ch->user[ccb->ccb_h.target_id];
-               cts->protocol = PROTO_ATA;
+               cts->protocol = PROTO_UNSPECIFIED;
                cts->protocol_version = PROTO_VERSION_UNSPECIFIED;
                cts->transport = XPORT_SATA;
                cts->transport_version = XPORT_VERSION_UNSPECIFIED;
@@ -1960,7 +1960,7 @@ siisaction(struct cam_sim *sim, union cc
                cpi->unit_number = cam_sim_unit(sim);
                cpi->transport = XPORT_SATA;
                cpi->transport_version = XPORT_VERSION_UNSPECIFIED;
-               cpi->protocol = PROTO_ATA;
+               cpi->protocol = PROTO_UNSPECIFIED;
                cpi->protocol_version = PROTO_VERSION_UNSPECIFIED;
                cpi->maxio = MAXPHYS;
                cpi->hba_vendor = pci_get_vendor(parent);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to