ata_da.c (298431) | ata_da.c (298649) |
---|---|
1/*- 2 * Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/cam/ata/ata_da.c 298431 2016-04-21 19:40:10Z pfg $"); | 28__FBSDID("$FreeBSD: head/sys/cam/ata/ata_da.c 298649 2016-04-26 15:38:17Z pfg $"); |
29 30#include "opt_ada.h" 31 32#include <sys/param.h> 33 34#ifdef _KERNEL 35#include <sys/systm.h> 36#include <sys/kernel.h> --- 1657 unchanged lines hidden (view full) --- 1694 1695 ranges = ada_dsmtrim_req_create(softc, bp, req); 1696 cam_fill_ataio(ataio, 1697 ada_retry_count, 1698 adadone, 1699 CAM_DIR_OUT, 1700 0, 1701 req->data, | 29 30#include "opt_ada.h" 31 32#include <sys/param.h> 33 34#ifdef _KERNEL 35#include <sys/systm.h> 36#include <sys/kernel.h> --- 1657 unchanged lines hidden (view full) --- 1694 1695 ranges = ada_dsmtrim_req_create(softc, bp, req); 1696 cam_fill_ataio(ataio, 1697 ada_retry_count, 1698 adadone, 1699 CAM_DIR_OUT, 1700 0, 1701 req->data, |
1702 ((ranges + ATA_DSM_BLK_RANGES - 1) / 1703 ATA_DSM_BLK_RANGES) * ATA_DSM_BLK_SIZE, | 1702 howmany(ranges, ATA_DSM_BLK_RANGES) * ATA_DSM_BLK_SIZE, |
1704 ada_default_timeout * 1000); 1705 ata_48bit_cmd(ataio, ATA_DATA_SET_MANAGEMENT, | 1703 ada_default_timeout * 1000); 1704 ata_48bit_cmd(ataio, ATA_DATA_SET_MANAGEMENT, |
1706 ATA_DSM_TRIM, 0, (ranges + ATA_DSM_BLK_RANGES - 1707 1) / ATA_DSM_BLK_RANGES); | 1705 ATA_DSM_TRIM, 0, howmany(ranges, ATA_DSM_BLK_RANGES)); |
1708} 1709 1710static void 1711ada_ncq_dsmtrim(struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio) 1712{ 1713 struct trim_request *req = &softc->trim_req; 1714 int ranges; 1715 1716 ranges = ada_dsmtrim_req_create(softc, bp, req); 1717 cam_fill_ataio(ataio, 1718 ada_retry_count, 1719 adadone, 1720 CAM_DIR_OUT, 1721 0, 1722 req->data, | 1706} 1707 1708static void 1709ada_ncq_dsmtrim(struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio) 1710{ 1711 struct trim_request *req = &softc->trim_req; 1712 int ranges; 1713 1714 ranges = ada_dsmtrim_req_create(softc, bp, req); 1715 cam_fill_ataio(ataio, 1716 ada_retry_count, 1717 adadone, 1718 CAM_DIR_OUT, 1719 0, 1720 req->data, |
1723 ((ranges + ATA_DSM_BLK_RANGES - 1) / 1724 ATA_DSM_BLK_RANGES) * ATA_DSM_BLK_SIZE, | 1721 howmany(ranges, ATA_DSM_BLK_RANGES) * ATA_DSM_BLK_SIZE, |
1725 ada_default_timeout * 1000); 1726 ata_ncq_cmd(ataio, 1727 ATA_SEND_FPDMA_QUEUED, 1728 0, | 1722 ada_default_timeout * 1000); 1723 ata_ncq_cmd(ataio, 1724 ATA_SEND_FPDMA_QUEUED, 1725 0, |
1729 (ranges + ATA_DSM_BLK_RANGES - 1) / ATA_DSM_BLK_RANGES); | 1726 howmany(ranges, ATA_DSM_BLK_RANGES)); |
1730 ataio->cmd.sector_count_exp = ATA_SFPDMA_DSM; 1731 ataio->ata_flags |= ATA_FLAG_AUX; 1732 ataio->aux = 1; 1733} 1734 1735static void 1736ada_cfaerase(struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio) 1737{ --- 694 unchanged lines hidden --- | 1727 ataio->cmd.sector_count_exp = ATA_SFPDMA_DSM; 1728 ataio->ata_flags |= ATA_FLAG_AUX; 1729 ataio->aux = 1; 1730} 1731 1732static void 1733ada_cfaerase(struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio) 1734{ --- 694 unchanged lines hidden --- |