PERFORCE change 165787 for review

Alexander Motin mav at FreeBSD.org
Tue Jul 7 20:33:03 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=165787

Change 165787 by mav at mav_mavbook on 2009/07/07 20:32:27

	Add cpi.maxio support to ahci and atapicam modules.
	Teach ada driver to use it.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#18 edit
.. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#44 edit
.. //depot/projects/scottl-camlock/src/sys/dev/ata/atapi-cam.c#17 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#18 (text+ko) ====

@@ -632,6 +632,7 @@
 	char   announce_buf[80];
 	struct disk_params *dp;
 	caddr_t match;
+	u_int maxio;
 
 	cgd = (struct ccb_getdev *)arg;
 	if (periph == NULL) {
@@ -684,6 +685,7 @@
 		softc->quirks = ADA_Q_NONE;
 
 	/* Check if the SIM does not want queued commands */
+	bzero(&cpi, sizeof(cpi));
 	xpt_setup_ccb(&cpi.ccb_h, periph->path, /*priority*/1);
 	cpi.ccb_h.func_code = XPT_PATH_INQ;
 	xpt_action((union ccb *)&cpi);
@@ -704,10 +706,16 @@
 	softc->disk->d_dump = adadump;
 	softc->disk->d_name = "ada";
 	softc->disk->d_drv1 = periph;
+	maxio = cpi.maxio;		/* Honor max I/O size of SIM */
+	if (maxio == 0)
+		maxio = DFLTPHYS;	/* traditional default */
+	else if (maxio > MAXPHYS)
+		maxio = MAXPHYS;	/* for safety */
 	if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48)
-		softc->disk->d_maxsize = min(MAXPHYS, 65535 * 512);
+		maxio = min(maxio, 65535 * 512);
 	else					/* 28bit ATA command limit */
-		softc->disk->d_maxsize = min(MAXPHYS, 255 * 512);
+		maxio = min(maxio, 255 * 512);
+	softc->disk->d_maxsize = maxio;
 	softc->disk->d_unit = periph->unit_number;
 	softc->disk->d_flags = 0;
 	if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE)

==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#44 (text+ko) ====

@@ -1837,6 +1837,7 @@
 		cpi->transport_version = 2;
 		cpi->protocol = PROTO_ATA;
 		cpi->protocol_version = SCSI_REV_2;
+		cpi->maxio = MAXPHYS;
 		cpi->ccb_h.status = CAM_REQ_CMP;
 		xpt_done(ccb);
 		break;

==== //depot/projects/scottl-camlock/src/sys/dev/ata/atapi-cam.c#17 (text+ko) ====

@@ -418,6 +418,8 @@
 		break;
 	    }
 	}
+	cpi->maxio = softc->ata_ch->dma.max_iosize ?
+	    softc->ata_ch->dma.max_iosize : DFLTPHYS;
 	ccb->ccb_h.status = CAM_REQ_CMP;
 	xpt_done(ccb);
 	return;


More information about the p4-projects mailing list