From 22726f69823a465916a320f3689f671bcd6180e7 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 5 Feb 2010 10:08:37 -0800 Subject: [PATCH] AHCI - Fix minor bug. Also AHCI/SILI - use ATA_F_EXCLUSIVE for pass-thru * The AHCI driver could sometimes queue multiple ATA_F_EXCLUSIVE commands. This case never actually occurred but fix it anyway. * Flag CAM pass-through commands as exclusive for safety. --- sys/dev/disk/ahci/ahci.c | 5 ++++- sys/dev/disk/ahci/ahci_cam.c | 4 ++-- sys/dev/disk/sili/sili_cam.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/dev/disk/ahci/ahci.c b/sys/dev/disk/ahci/ahci.c index a612c33a75..54e097d64d 100644 --- a/sys/dev/disk/ahci/ahci.c +++ b/sys/dev/disk/ahci/ahci.c @@ -2034,7 +2034,6 @@ ahci_issue_pending_commands(struct ahci_port *ap, struct ahci_ccb *ccb) } } - if (ccb->ccb_xa.flags & ATA_F_NCQ) { /* * The next command is a NCQ command and can be issued as @@ -2096,6 +2095,10 @@ ahci_issue_pending_commands(struct ahci_port *ap, struct ahci_ccb *ccb) ccb->ccb_xa.state = ATA_S_ONCHIP; ahci_pwrite(ap, AHCI_PREG_CI, 1 << ccb->ccb_slot); ahci_start_timeout(ccb); + if ((ap->ap_run_flags & + (ATA_F_EXCLUSIVE | ATA_F_AUTOSENSE)) == 0) { + break; + } ccb = TAILQ_FIRST(&ap->ap_ccb_pending); if (ccb && (ccb->ccb_xa.flags & (ATA_F_EXCLUSIVE | ATA_F_AUTOSENSE))) { diff --git a/sys/dev/disk/ahci/ahci_cam.c b/sys/dev/disk/ahci/ahci_cam.c index e4783e1f19..e7bcc07e46 100644 --- a/sys/dev/disk/ahci/ahci_cam.c +++ b/sys/dev/disk/ahci/ahci_cam.c @@ -1132,7 +1132,7 @@ ahci_xpt_scsi_disk_io(struct ahci_port *ap, struct ata_port *atx, default: xa->flags = 0; } - xa->flags |= ATA_F_POLL; + xa->flags |= ATA_F_POLL | ATA_F_EXCLUSIVE; xa->data = csio->data_ptr; xa->datalen = csio->dxfer_len; xa->complete = ahci_ata_complete_disk_rw; @@ -1174,7 +1174,7 @@ ahci_xpt_scsi_disk_io(struct ahci_port *ap, struct ata_port *atx, default: xa->flags = 0; } - xa->flags |= ATA_F_POLL; + xa->flags |= ATA_F_POLL | ATA_F_EXCLUSIVE; xa->data = csio->data_ptr; xa->datalen = csio->dxfer_len; xa->complete = ahci_ata_complete_disk_rw; diff --git a/sys/dev/disk/sili/sili_cam.c b/sys/dev/disk/sili/sili_cam.c index 4210bff2f0..1b9d619024 100644 --- a/sys/dev/disk/sili/sili_cam.c +++ b/sys/dev/disk/sili/sili_cam.c @@ -1140,7 +1140,7 @@ sili_xpt_scsi_disk_io(struct sili_port *ap, struct ata_port *atx, default: xa->flags = 0; } - xa->flags |= ATA_F_POLL; + xa->flags |= ATA_F_POLL | ATA_F_EXCLUSIVE; xa->data = csio->data_ptr; xa->datalen = csio->dxfer_len; xa->complete = sili_ata_complete_disk_rw; @@ -1182,7 +1182,7 @@ sili_xpt_scsi_disk_io(struct sili_port *ap, struct ata_port *atx, default: xa->flags = 0; } - xa->flags |= ATA_F_POLL; + xa->flags |= ATA_F_POLL | ATA_F_EXCLUSIVE; xa->data = csio->data_ptr; xa->datalen = csio->dxfer_len; xa->complete = sili_ata_complete_disk_rw; -- 2.11.4.GIT