PERFORCE change 162838 for review
Alexander Motin
mav at FreeBSD.org
Wed May 27 06:09:36 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=162838
Change 162838 by mav at mav_mavbook on 2009/05/27 06:08:55
For ATAPI return errors more suitable for SCSI.
Affected files ...
.. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#4 edit
Differences ...
==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#4 (text+ko) ====
@@ -854,20 +854,22 @@
device_t dev = slot->dev;
struct ahci_channel *ch = device_get_softc(dev);
struct ahci_cmd_list *clp;
-// u_int32_t tf_data;
+ u_int32_t tf_data;
//device_printf(dev, "%s slot %d\n", __func__, slot->slot);
/* kill the timeout */
// callout_stop(&request->callout);
/* get status */
-// tf_data = ATA_INL(ch->r_mem, AHCI_P_TFD);
-// slot->ccb->ccb_h.status = tf_data;
-
- /* if error status get details */
-// if (request->status & ATA_S_ERROR)
-// request->error = tf_data >> 8;
-
+ tf_data = ATA_INL(ch->r_mem, AHCI_P_TFD);
+#if 0
+ if (err && slot->ccb->ccb_h.func_code == XPT_ATA_IO) {
+ slot->ccb->ataio.status = tf_data;
+ /* if error status get details */
+ if (tf_data & ATA_S_ERROR)
+ request->error = tf_data >> 8;
+ }
+#endif
/* on control commands read back registers to the request struct */
/* if (request->flags & ATA_R_CONTROL) {
struct ata_device *atadev = device_get_softc(request->dev);
@@ -899,10 +901,19 @@
bus_dmamap_unload(ch->dma.data_tag, slot->dma.data_map);
}
- if (err == 0)
+ if (err == 0) {
slot->ccb->ccb_h.status = CAM_REQ_CMP;
- else
- slot->ccb->ccb_h.status = CAM_REQ_CMP_ERR;
+ if (slot->ccb->ccb_h.func_code == XPT_SCSI_IO)
+ slot->ccb->csio.scsi_status = SCSI_STATUS_OK;
+ } else {
+ if (slot->ccb->ccb_h.func_code == XPT_SCSI_IO) {
+ slot->ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR;
+ slot->ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND;
+ } else {
+ slot->ccb->ccb_h.status = CAM_REQ_CMP_ERR;
+ slot->ccb->ataio.status = tf_data;
+ }
+ }
xpt_done(slot->ccb);
ch->rslots &= ~(1 << slot->slot);
More information about the p4-projects
mailing list