View | Details | Raw Unified | Return to bug 202712
Collapse All | Expand All

(-)sys/cam/ata/ata_xpt.c (-9 / +37 lines)
Lines 146-151 typedef struct { Link Here
146
	int		restart;
146
	int		restart;
147
	int		spinup;
147
	int		spinup;
148
	int		faults;
148
	int		faults;
149
	int		setmode_failed;
150
	int		wantmode;
149
	u_int		caps;
151
	u_int		caps;
150
	struct cam_periph *periph;
152
	struct cam_periph *periph;
151
} probe_softc;
153
} probe_softc;
Lines 464-469 negotiate: Link Here
464
		else
466
		else
465
			path->device->inq_flags |= SID_DMA;
467
			path->device->inq_flags |= SID_DMA;
466
		xpt_async(AC_GETDEV_CHANGED, path, NULL);
468
		xpt_async(AC_GETDEV_CHANGED, path, NULL);
469
		softc->wantmode = mode;
467
		cam_fill_ataio(ataio,
470
		cam_fill_ataio(ataio,
468
		      1,
471
		      1,
469
		      probedone,
472
		      probedone,
Lines 782-794 out: Link Here
782
			else
785
			else
783
				softc->restart = 0;
786
				softc->restart = 0;
784
787
785
		/* Old PIO2 devices may not support mode setting. */
788
		/* Handle SETMODE quirks. */
786
		} else if (softc->action == PROBE_SETMODE &&
789
		} else if (softc->action == PROBE_SETMODE &&
787
		    status == CAM_ATA_STATUS_ERROR &&
790
		    status == CAM_ATA_STATUS_ERROR) {
788
		    ata_max_pmode(ident_buf) <= ATA_PIO2 &&
791
			/* Old PIO2 devices may not support mode setting. */
789
		    (ident_buf->capabilities1 & ATA_SUPPORT_IORDY) == 0) {
792
			if (ata_max_pmode(ident_buf) <= ATA_PIO2 &&
790
			goto noerror;
793
			    (ident_buf->capabilities1 & ATA_SUPPORT_IORDY) == 0)
794
				goto noerror;
791
795
796
			/*
797
			 * If SETMODE failed, do IDENTIFY again and see if
798
			 * the disk has the mode we wanted to set.
799
			 */
800
			softc->setmode_failed = 1;
801
			PROBE_SET_ACTION(softc, PROBE_IDENTIFY);
802
			xpt_release_ccb(done_ccb);
803
			xpt_schedule(periph, priority);
804
			goto out;
805
792
		/*
806
		/*
793
		 * Some old WD SATA disks report supported and enabled
807
		 * Some old WD SATA disks report supported and enabled
794
		 * device-initiated interface power management, but return
808
		 * device-initiated interface power management, but return
Lines 1019-1028 noerror: Link Here
1019
		ata_device_transport(path);
1033
		ata_device_transport(path);
1020
		if (changed)
1034
		if (changed)
1021
			proberequestdefaultnegotiation(periph);
1035
			proberequestdefaultnegotiation(periph);
1022
		PROBE_SET_ACTION(softc, PROBE_SETMODE);
1036
		if (!softc->setmode_failed) {
1023
		xpt_release_ccb(done_ccb);
1037
			/* Normal IDENTIFY, proceed to SETMODE. */
1024
		xpt_schedule(periph, priority);
1038
			PROBE_SET_ACTION(softc, PROBE_SETMODE);
1025
		goto out;
1039
			xpt_release_ccb(done_ccb);
1040
			xpt_schedule(periph, priority);
1041
			goto out;
1042
		} else if (ata_max_mode(ident_buf, 0) == softc->wantmode) {
1043
			/*
1044
			 * IDENTIFY after a failed SETMODE and the actual mode
1045
			 * is what we requested.  So, pretend that SETMODE
1046
			 * succeeded.
1047
			 */
1048
			softc->action = PROBE_SETMODE;
1049
			goto noerror;
1050
		} else {
1051
			/* The mode is wrong, the probe failed. */
1052
			goto device_fail;
1053
		}
1026
	}
1054
	}
1027
	case PROBE_SPINUP:
1055
	case PROBE_SPINUP:
1028
		if (bootverbose)
1056
		if (bootverbose)

Return to bug 202712