Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Nov 2009 14:29:08 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 171013 for review
Message-ID:  <200911251429.nAPET8F4084314@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=171013

Change 171013 by mav@mav_mavbook on 2009/11/25 14:28:51

	Honor current ATA mode (PIO/DMA) when issuing PACKET command.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#86 edit
.. //depot/projects/scottl-camlock/src/sys/dev/ata/ata-all.c#40 edit
.. //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#24 edit

Differences ...

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

@@ -72,7 +72,7 @@
 static void ahci_execute_transaction(struct ahci_slot *slot);
 static void ahci_timeout(struct ahci_slot *slot);
 static void ahci_end_transaction(struct ahci_slot *slot, enum ahci_err_type et);
-static int ahci_setup_fis(struct ahci_cmd_tab *ctp, union ccb *ccb, int tag);
+static int ahci_setup_fis(device_t dev, struct ahci_cmd_tab *ctp, union ccb *ccb, int tag);
 static void ahci_dmainit(device_t dev);
 static void ahci_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error);
 static void ahci_dmafini(device_t dev);
@@ -1410,7 +1410,7 @@
 	ctp = (struct ahci_cmd_tab *)
 		(ch->dma.work + AHCI_CT_OFFSET + (AHCI_CT_SIZE * slot->slot));
 	/* Setup the FIS for this request */
-	if (!(fis_size = ahci_setup_fis(ctp, ccb, slot->slot))) {
+	if (!(fis_size = ahci_setup_fis(dev, ctp, ccb, slot->slot))) {
 		device_printf(ch->dev, "Setting up SATA FIS failed\n");
 		ahci_end_transaction(slot, AHCI_ERR_INVALID);
 		return;
@@ -1983,8 +1983,9 @@
 }
 
 static int
-ahci_setup_fis(struct ahci_cmd_tab *ctp, union ccb *ccb, int tag)
+ahci_setup_fis(device_t dev, struct ahci_cmd_tab *ctp, union ccb *ccb, int tag)
 {
+	struct ahci_channel *ch = device_get_softc(dev);
 	u_int8_t *fis = &ctp->cfis[0];
 
 	bzero(ctp->cfis, 64);
@@ -1993,7 +1994,8 @@
 	if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
 		fis[1] |= 0x80;
 		fis[2] = ATA_PACKET_CMD;
-		if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE)
+		if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE &&
+		    ch->curr[ccb->ccb_h.target_id].mode >= ATA_DMA)
 			fis[3] = ATA_F_DMA;
 		else {
 			fis[5] = ccb->csio.dxfer_len;

==== //depot/projects/scottl-camlock/src/sys/dev/ata/ata-all.c#40 (text+ko) ====

@@ -1334,8 +1334,8 @@
 		    ccb->csio.cdb_io.cdb_ptr : ccb->csio.cdb_io.cdb_bytes,
 		    request->u.atapi.ccb, ccb->csio.cdb_len);
 		request->flags |= ATA_R_ATAPI;
-		if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE /*&&
-		    ccb->ataio.cmd.flags & CAM_ATAIO_DMA*/)
+		if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE &&
+		    ch->curr[ccb->ccb_h.target_id].mode >= ATA_DMA)
 			request->flags |= ATA_R_DMA;
 		if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)
 			request->flags |= ATA_R_READ;
@@ -1595,7 +1595,10 @@
 		cpi->max_lun = 0;
 		cpi->initiator_id = 0;
 		cpi->bus_id = cam_sim_bus(sim);
-		cpi->base_transfer_speed = 3300;
+		if (ch->flags & ATA_SATA)
+			cpi->base_transfer_speed = 150000;
+		else
+			cpi->base_transfer_speed = 3300;
 		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
 		strncpy(cpi->hba_vid, "ATA", HBA_IDLEN);
 		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);

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

@@ -69,7 +69,7 @@
 static void siis_execute_transaction(struct siis_slot *slot);
 static void siis_timeout(struct siis_slot *slot);
 static void siis_end_transaction(struct siis_slot *slot, enum siis_err_type et);
-static int siis_setup_fis(struct siis_cmd *ctp, union ccb *ccb, int tag);
+static int siis_setup_fis(device_t dev, struct siis_cmd *ctp, union ccb *ccb, int tag);
 static void siis_dmainit(device_t dev);
 static void siis_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error);
 static void siis_dmafini(device_t dev);
@@ -974,7 +974,7 @@
 			ctp->control |= htole16(SIIS_PRB_PACKET_WRITE);
 	}
 	/* Setup the FIS for this request */
-	if (!siis_setup_fis(ctp, ccb, slot->slot)) {
+	if (!siis_setup_fis(dev, ctp, ccb, slot->slot)) {
 		device_printf(ch->dev, "Setting up SATA FIS failed\n");
 		if (!ch->readlog)
 			xpt_freeze_simq(ch->sim, 1);
@@ -1446,8 +1446,9 @@
 }
 
 static int
-siis_setup_fis(struct siis_cmd *ctp, union ccb *ccb, int tag)
+siis_setup_fis(device_t dev, struct siis_cmd *ctp, union ccb *ccb, int tag)
 {
+	struct siis_channel *ch = device_get_softc(dev);
 	u_int8_t *fis = &ctp->fis[0];
 
 	bzero(fis, 24);
@@ -1456,7 +1457,8 @@
 	if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
 		fis[1] |= 0x80;
 		fis[2] = ATA_PACKET_CMD;
-		if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE)
+		if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE &&
+		    ch->curr[ccb->ccb_h.target_id].mode >= ATA_DMA)
 			fis[3] = ATA_F_DMA;
 		else {
 			fis[5] = ccb->csio.dxfer_len;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911251429.nAPET8F4084314>