Add basic support for DMA-capable ATA disks on DMA-incapable controller.

This is really rare situation these days, but still may happen in embedded.
This commit is contained in:
Alexander Motin 2011-04-20 13:27:50 +00:00
parent 70df4233cd
commit cf2b9a5f0f
3 changed files with 10 additions and 2 deletions

View File

@ -35,6 +35,8 @@ struct ccb_ataio;
struct cam_periph;
union ccb;
#define SID_DMA 0x10 /* Abuse inq_flags bit to track enabled DMA. */
struct ata_cmd {
u_int8_t flags; /* ATA command flags */
#define CAM_ATAIO_48BIT 0x01 /* Command has 48-bit format */

View File

@ -751,7 +751,8 @@ adaregister(struct cam_periph *periph, void *arg)
bioq_init(&softc->bio_queue);
bioq_init(&softc->trim_queue);
if (cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA)
if (cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA &&
(cgd->inq_flags & SID_DMA))
softc->flags |= ADA_FLAG_CAN_DMA;
if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48)
softc->flags |= ADA_FLAG_CAN_48BIT;
@ -760,7 +761,7 @@ adaregister(struct cam_periph *periph, void *arg)
if (cgd->ident_data.support.command1 & ATA_SUPPORT_POWERMGT)
softc->flags |= ADA_FLAG_CAN_POWERMGT;
if (cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ &&
cgd->inq_flags & SID_CmdQue)
(cgd->inq_flags & SID_DMA) && (cgd->inq_flags & SID_CmdQue))
softc->flags |= ADA_FLAG_CAN_NCQ;
if (cgd->ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) {
softc->flags |= ADA_FLAG_CAN_TRIM;

View File

@ -388,6 +388,11 @@ probestart(struct cam_periph *periph, union ccb *start_ccb)
/* If SIM disagree - renegotiate. */
if (mode != wantmode)
goto negotiate;
/* Remember what transport thinks about DMA. */
if (mode < ATA_DMA)
path->device->inq_flags &= ~SID_DMA;
else
path->device->inq_flags |= SID_DMA;
cam_fill_ataio(ataio,
1,
probedone,