diff options
author | mav <mav@FreeBSD.org> | 2010-02-02 11:09:28 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2010-02-02 11:09:28 +0000 |
commit | b5b6d6b0e0e8523be005d532c4327061249c2a84 (patch) | |
tree | 37197ad5ae0872a11e1bc6a7828374ebc3770e16 /sys/dev | |
parent | 2c76d0e26f4843ec857eaeade022a391227acb85 (diff) | |
download | FreeBSD-src-b5b6d6b0e0e8523be005d532c4327061249c2a84.zip FreeBSD-src-b5b6d6b0e0e8523be005d532c4327061249c2a84.tar.gz |
- Give ATA/SATA SIMs info about ATAPI packet size, supported by device.
- Make ATA XPT to reject longer SCSI CDBs then supported by device, or
any SCSI CDBs, if device doesn't support ATAPI.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ahci/ahci.c | 4 | ||||
-rw-r--r-- | sys/dev/ahci/ahci.h | 1 | ||||
-rw-r--r-- | sys/dev/ata/ata-all.c | 15 | ||||
-rw-r--r-- | sys/dev/ata/ata-all.h | 1 | ||||
-rw-r--r-- | sys/dev/siis/siis.c | 4 | ||||
-rw-r--r-- | sys/dev/siis/siis.h | 1 |
6 files changed, 23 insertions, 3 deletions
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c index 8492725..fe3ce09 100644 --- a/sys/dev/ahci/ahci.c +++ b/sys/dev/ahci/ahci.c @@ -2358,6 +2358,8 @@ ahciaction(struct cam_sim *sim, union ccb *ccb) d->tags = min(ch->numslots, cts->xport_specific.sata.tags); if (cts->xport_specific.sata.valid & CTS_SATA_VALID_PM) ch->pm_present = cts->xport_specific.sata.pm_present; + if (cts->xport_specific.sata.valid & CTS_SATA_VALID_ATAPI) + d->atapi = cts->xport_specific.sata.atapi; ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; @@ -2401,6 +2403,8 @@ ahciaction(struct cam_sim *sim, union ccb *ccb) cts->xport_specific.sata.valid |= CTS_SATA_VALID_PM; cts->xport_specific.sata.tags = d->tags; cts->xport_specific.sata.valid |= CTS_SATA_VALID_TAGS; + cts->xport_specific.sata.atapi = d->atapi; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_ATAPI; ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; diff --git a/sys/dev/ahci/ahci.h b/sys/dev/ahci/ahci.h index 5b524ab..a2cc5a0 100644 --- a/sys/dev/ahci/ahci.h +++ b/sys/dev/ahci/ahci.h @@ -370,6 +370,7 @@ struct ahci_device { int revision; int mode; u_int bytecount; + u_int atapi; u_int tags; }; diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 1ad3c51..6de8fda 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -1348,6 +1348,8 @@ ata_cam_begin_transaction(device_t dev, union ccb *ccb) 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 (ch->curr[ccb->ccb_h.target_id].atapi == 16) + request->flags |= ATA_R_ATAPI16; 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; @@ -1358,7 +1360,6 @@ ata_cam_begin_transaction(device_t dev, union ccb *ccb) } request->transfersize = min(request->bytecount, ch->curr[ccb->ccb_h.target_id].bytecount); -// request->callback = ad_done; request->retries = 0; request->timeout = (ccb->ccb_h.timeout + 999) / 1000; callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED); @@ -1491,7 +1492,7 @@ ataaction(struct cam_sim *sim, union ccb *ccb) if (ch->flags & ATA_SATA) { if (cts->xport_specific.sata.valid & CTS_SATA_VALID_REVISION) d->revision = cts->xport_specific.sata.revision; - if (cts->xport_specific.ata.valid & CTS_SATA_VALID_MODE) { + if (cts->xport_specific.sata.valid & CTS_SATA_VALID_MODE) { if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { d->mode = ATA_SETMODE(ch->dev, ccb->ccb_h.target_id, @@ -1499,8 +1500,10 @@ ataaction(struct cam_sim *sim, union ccb *ccb) } else d->mode = cts->xport_specific.sata.mode; } - if (cts->xport_specific.ata.valid & CTS_SATA_VALID_BYTECOUNT) + if (cts->xport_specific.sata.valid & CTS_SATA_VALID_BYTECOUNT) d->bytecount = min(8192, cts->xport_specific.sata.bytecount); + if (cts->xport_specific.sata.valid & CTS_SATA_VALID_ATAPI) + d->atapi = cts->xport_specific.sata.atapi; } else { if (cts->xport_specific.ata.valid & CTS_ATA_VALID_MODE) { if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { @@ -1512,6 +1515,8 @@ ataaction(struct cam_sim *sim, union ccb *ccb) } if (cts->xport_specific.ata.valid & CTS_ATA_VALID_BYTECOUNT) d->bytecount = cts->xport_specific.ata.bytecount; + if (cts->xport_specific.ata.valid & CTS_ATA_VALID_ATAPI) + d->atapi = cts->xport_specific.ata.atapi; } ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); @@ -1541,6 +1546,8 @@ ataaction(struct cam_sim *sim, union ccb *ccb) } else cts->xport_specific.sata.revision = d->revision; cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; + cts->xport_specific.sata.atapi = d->atapi; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_ATAPI; } else { cts->transport = XPORT_ATA; cts->transport_version = XPORT_VERSION_UNSPECIFIED; @@ -1548,6 +1555,8 @@ ataaction(struct cam_sim *sim, union ccb *ccb) cts->xport_specific.ata.valid |= CTS_ATA_VALID_MODE; cts->xport_specific.ata.bytecount = d->bytecount; cts->xport_specific.ata.valid |= CTS_ATA_VALID_BYTECOUNT; + cts->xport_specific.ata.atapi = d->atapi; + cts->xport_specific.ata.valid |= CTS_ATA_VALID_ATAPI; } ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index 23dc458..3d5d36e 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -539,6 +539,7 @@ struct ata_cam_device { u_int revision; int mode; u_int bytecount; + u_int atapi; }; #endif diff --git a/sys/dev/siis/siis.c b/sys/dev/siis/siis.c index 5298c18..dc24c6c 100644 --- a/sys/dev/siis/siis.c +++ b/sys/dev/siis/siis.c @@ -1659,6 +1659,8 @@ siisaction(struct cam_sim *sim, union ccb *ccb) else ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_PME); } + if (cts->xport_specific.sata.valid & CTS_SATA_VALID_TAGS) + d->atapi = cts->xport_specific.sata.atapi; ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; @@ -1702,6 +1704,8 @@ siisaction(struct cam_sim *sim, union ccb *ccb) cts->xport_specific.sata.valid |= CTS_SATA_VALID_PM; cts->xport_specific.sata.tags = d->tags; cts->xport_specific.sata.valid |= CTS_SATA_VALID_TAGS; + cts->xport_specific.sata.atapi = d->atapi; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_ATAPI; ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; diff --git a/sys/dev/siis/siis.h b/sys/dev/siis/siis.h index f98d204..92b4e26 100644 --- a/sys/dev/siis/siis.h +++ b/sys/dev/siis/siis.h @@ -356,6 +356,7 @@ struct siis_device { int revision; int mode; u_int bytecount; + u_int atapi; u_int tags; }; |