aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2016-04-17 05:24:36 +0000
committerWarner Losh <imp@FreeBSD.org>2016-04-17 05:24:36 +0000
commit916d57dfc540681468c6093f2cb027c46be9444e (patch)
tree297d25e9d15f253f92052155636bee075b15735c /sys
parente4cc6558b35004d43b25a538849161d24fd1db7c (diff)
downloadsrc-916d57dfc540681468c6093f2cb027c46be9444e.tar.gz
src-916d57dfc540681468c6093f2cb027c46be9444e.zip
Implement Auxiliary register. Add PIM_ATA_EXT flag to flag that a SIM
can handle it, and add the code to add it to the FIS that's sent to the drive. The mvs driver is the only other ATA driver in the system, and its hardware doesn't appear to support setting the Auxiliary register. Differential Revision: https://reviews.freebsd.org/D5598
Notes
Notes: svn path=/head/; revision=298143
Diffstat (limited to 'sys')
-rw-r--r--sys/cam/ata/ata_all.h1
-rw-r--r--sys/cam/ata/ata_da.c5
-rw-r--r--sys/cam/cam_ccb.h6
-rw-r--r--sys/dev/ahci/ahci.c11
-rw-r--r--sys/dev/ata/ata-all.c6
-rw-r--r--sys/dev/mvs/mvs.c6
-rw-r--r--sys/dev/siis/siis.c8
7 files changed, 33 insertions, 10 deletions
diff --git a/sys/cam/ata/ata_all.h b/sys/cam/ata/ata_all.h
index 0eda4f4d5051..433c61c5a6c1 100644
--- a/sys/cam/ata/ata_all.h
+++ b/sys/cam/ata/ata_all.h
@@ -46,7 +46,6 @@ struct ata_cmd {
#define CAM_ATAIO_CONTROL 0x04 /* Control, not a command */
#define CAM_ATAIO_NEEDRESULT 0x08 /* Request requires result. */
#define CAM_ATAIO_DMA 0x10 /* DMA command */
-#define CAM_ATAIO_AUX_HACK 0x20 /* Kludge to make FPDMA DSM TRIM work */
u_int8_t command;
u_int8_t features;
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index b30806580e1a..31750eabec75 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -1522,7 +1522,7 @@ adaregister(struct cam_periph *periph, void *arg)
* the sim do do things properly. Perhaps we should look at log 13
* dword 0 bit 0 and dword 1 bit 0 are set too...
*/
- if (cpi.hba_misc & PIM_NCQ_KLUDGE)
+ if (cpi.hba_misc & PIM_ATA_EXT)
softc->flags |= ADA_FLAG_PIM_CAN_NCQ_TRIM;
if ((softc->quirks & ADA_Q_NCQ_TRIM_BROKEN) == 0 &&
(softc->flags & ADA_FLAG_PIM_CAN_NCQ_TRIM) != 0 &&
@@ -1728,7 +1728,8 @@ ada_ncq_dsmtrim(struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio
0,
(ranges + ATA_DSM_BLK_RANGES - 1) / ATA_DSM_BLK_RANGES);
ataio->cmd.sector_count_exp = ATA_SFPDMA_DSM;
- ataio->cmd.flags |= CAM_ATAIO_AUX_HACK;
+ ataio->ata_flags |= ATA_FLAG_AUX;
+ ataio->aux = 1;
}
static void
diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h
index 7d3974deb8a9..8b6f9e2ac3fa 100644
--- a/sys/cam/cam_ccb.h
+++ b/sys/cam/cam_ccb.h
@@ -581,7 +581,7 @@ typedef enum {
} pi_tmflag;
typedef enum {
- PIM_NCQ_KLUDGE = 0x200, /* Supports the sata ncq trim kludge */
+ PIM_ATA_EXT = 0x200,/* ATA requests can understand ata_ext requests */
PIM_EXTLUNS = 0x100,/* 64bit extended LUNs supported */
PIM_SCANHILO = 0x80, /* Bus scans from high ID to low ID */
PIM_NOREMOVE = 0x40, /* Removeable devices not included in scan */
@@ -745,7 +745,9 @@ struct ccb_ataio {
u_int32_t dxfer_len; /* Data transfer length */
u_int32_t resid; /* Transfer residual length: 2's comp */
u_int8_t ata_flags; /* Flags for the rest of the buffer */
- uint32_t unused[2]; /* Keep the same size */
+#define ATA_FLAG_AUX 0x1
+ uint32_t aux;
+ uint32_t unused;
};
struct ccb_accept_tio {
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c
index b27e30df5252..9a47f3b46871 100644
--- a/sys/dev/ahci/ahci.c
+++ b/sys/dev/ahci/ahci.c
@@ -2417,12 +2417,15 @@ ahci_setup_fis(struct ahci_channel *ch, struct ahci_cmd_tab *ctp, union ccb *ccb
fis[13] = ccb->ataio.cmd.sector_count_exp;
}
fis[15] = ATA_A_4BIT;
- /* Gross and vile hack -- makes ncq trim work w/o changing ataio size */
- if (ccb->ataio.cmd.flags & CAM_ATAIO_AUX_HACK)
- fis[16] = 1;
} else {
fis[15] = ccb->ataio.cmd.control;
}
+ if (ccb->ataio.ata_flags & ATA_FLAG_AUX) {
+ fis[16] = ccb->ataio.aux & 0xff;
+ fis[17] = (ccb->ataio.aux >> 8) & 0xff;
+ fis[18] = (ccb->ataio.aux >> 16) & 0xff;
+ fis[19] = (ccb->ataio.aux >> 24) & 0xff;
+ }
return (20);
}
@@ -2677,7 +2680,7 @@ ahciaction(struct cam_sim *sim, union ccb *ccb)
if (ch->caps & AHCI_CAP_SPM)
cpi->hba_inquiry |= PI_SATAPM;
cpi->target_sprt = 0;
- cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED | PIM_NCQ_KLUDGE;
+ cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED | PIM_ATA_EXT;
cpi->hba_eng_cnt = 0;
if (ch->caps & AHCI_CAP_SPM)
cpi->max_target = 15;
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 8cefa9e09cd1..8e7ca081d82f 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -962,6 +962,12 @@ ata_check_ids(device_t dev, union ccb *ccb)
xpt_done(ccb);
return (-1);
}
+ /*
+ * It's a programming error to see AUXILIARY register requests.
+ */
+ KASSERT(ccb->ccb_h.func_code != XPT_ATA_IO ||
+ ((ccb->ataio.ata_flags & ATA_FLAG_AUX) == 0),
+ ("AUX register unsupported"));
return (0);
}
diff --git a/sys/dev/mvs/mvs.c b/sys/dev/mvs/mvs.c
index bdadf39e2af2..699c22f3d097 100644
--- a/sys/dev/mvs/mvs.c
+++ b/sys/dev/mvs/mvs.c
@@ -2245,6 +2245,12 @@ mvs_check_ids(device_t dev, union ccb *ccb)
xpt_done(ccb);
return (-1);
}
+ /*
+ * It's a programming error to see AUXILIARY register requests.
+ */
+ KASSERT(ccb->ccb_h.func_code != XPT_ATA_IO ||
+ ((ccb->ataio.ata_flags & ATA_FLAG_AUX) == 0),
+ ("AUX register unsupported"));
return (0);
}
diff --git a/sys/dev/siis/siis.c b/sys/dev/siis/siis.c
index cb9d800646af..0841471393a7 100644
--- a/sys/dev/siis/siis.c
+++ b/sys/dev/siis/siis.c
@@ -1728,6 +1728,12 @@ siis_setup_fis(device_t dev, struct siis_cmd *ctp, union ccb *ccb, int tag)
fis[13] = ccb->ataio.cmd.sector_count_exp;
}
fis[15] = ATA_A_4BIT;
+ if (ccb->ataio.ata_flags & ATA_FLAG_AUX) {
+ fis[16] = ccb->ataio.aux & 0xff;
+ fis[17] = (ccb->ataio.aux >> 8) & 0xff;
+ fis[18] = (ccb->ataio.aux >> 16) & 0xff;
+ fis[19] = (ccb->ataio.aux >> 24) & 0xff;
+ }
} else {
/* Soft reset. */
}
@@ -1946,7 +1952,7 @@ siisaction(struct cam_sim *sim, union ccb *ccb)
cpi->hba_inquiry = PI_SDTR_ABLE | PI_TAG_ABLE;
cpi->hba_inquiry |= PI_SATAPM;
cpi->target_sprt = 0;
- cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED;
+ cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED | PIM_ATA_EXT;
cpi->hba_eng_cnt = 0;
cpi->max_target = 15;
cpi->max_lun = 0;