From 692609bdacd8434f57a93b5c32a0f0a6d20bd5c9 Mon Sep 17 00:00:00 2001 From: imp Date: Sun, 17 Apr 2016 05:24:36 +0000 Subject: 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 --- sys/cam/ata/ata_all.h | 1 - sys/cam/ata/ata_da.c | 5 +++-- sys/cam/cam_ccb.h | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'sys/cam') diff --git a/sys/cam/ata/ata_all.h b/sys/cam/ata/ata_all.h index 0eda4f4..433c61c 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 b308065..31750ea 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 7d3974d..8b6f9e2 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 { -- cgit v1.1