Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'ata-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata

Pull ata updates from Damien Le Moal:

- Fix OF include file for ata platform drivers (Rob)

- Simplify various ahci, sata and pata platform drivers using the
function devm_platform_ioremap_resource() (Yangtao)

- Cleanup libata time related argument types (e.g. timeouts values)
(Sergey)

- Cleanup libata code around error handling as all ata drivers now
define a error_handler operation (Hannes and Niklas)

- Remove functions intended for libsas that are in fact unused (Niklas)

- Change the remove device callback of platform drivers to a null
function (Uwe)

- Simplify the pata_imx driver using devm_clk_get_enabled() (Li)

- Remove old and uinused remnants of the ide code in arm, parisc,
powerpc, sparc and m68k architectures and associated drivers
(pata_buddha, pata_falcon and pata_gayle) (Geert)

- Add missing MODULE_DESCRIPTION() in the sata_gemini and pata_ftide010
drivers (me)

- Several fixes for the pata_ep93xx and pata_falcon drivers (Nikita,
Michael)

- Add Elkhart Lake AHCI controller support to the ahci driver (Werner)

- Disable NCQ trim on Micron 1100 drives (Pawel)

* tag 'ata-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata: (60 commits)
ata: libata-core: Disable NCQ_TRIM on Micron 1100 drives
ata: ahci: Add Elkhart Lake AHCI controller
ata: pata_falcon: add data_swab option to byte-swap disk data
ata: pata_falcon: fix IO base selection for Q40
ata: pata_ep93xx: use soc_device_match for UDMA modes
ata: pata_ep93xx: fix error return code in probe
ata: sata_gemini: Add missing MODULE_DESCRIPTION
ata: pata_ftide010: Add missing MODULE_DESCRIPTION
m68k: Remove <asm/ide.h>
ata: pata_gayle: Remove #include <asm/ide.h>
ata: pata_falcon: Remove #include <asm/ide.h>
ata: pata_buddha: Remove #include <asm/ide.h>
asm-generic: Remove ide_iops.h
sparc: Remove <asm/ide.h>
powerpc: Remove <asm/ide.h>
parisc: Remove <asm/ide.h>
ARM: Remove <asm/ide.h>
ata: pata_imx: Use helper function devm_clk_get_enabled()
ata: sata_rcar: Convert to platform remove callback returning void
ata: sata_mv: Convert to platform remove callback returning void
...

+374 -1210
+6 -32
Documentation/driver-api/libata.rst
··· 32 32 :c:type:`struct ata_port_operations <ata_port_operations>` 33 33 ---------------------------------------------------------- 34 34 35 - Disable ATA port 36 - ~~~~~~~~~~~~~~~~ 37 - 38 - :: 39 - 40 - void (*port_disable) (struct ata_port *); 41 - 42 - 43 - Called from :c:func:`ata_bus_probe` error path, as well as when unregistering 44 - from the SCSI module (rmmod, hot unplug). This function should do 45 - whatever needs to be done to take the port out of use. In most cases, 46 - :c:func:`ata_port_disable` can be used as this hook. 47 - 48 - Called from :c:func:`ata_bus_probe` on a failed probe. Called from 49 - :c:func:`ata_scsi_release`. 50 - 51 35 Post-IDENTIFY device configuration 52 36 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 53 37 ··· 258 274 259 275 :: 260 276 261 - void (*eng_timeout) (struct ata_port *ap); 262 - void (*phy_reset) (struct ata_port *ap); 263 - 264 - 265 - Deprecated. Use ``->error_handler()`` instead. 266 - 267 - :: 268 - 269 277 void (*freeze) (struct ata_port *ap); 270 278 void (*thaw) (struct ata_port *ap); 271 279 ··· 340 364 u32 val); 341 365 342 366 343 - Read and write standard SATA phy registers. Currently only used if 344 - ``->phy_reset`` hook called the :c:func:`sata_phy_reset` helper function. 367 + Read and write standard SATA phy registers. 345 368 sc_reg is one of SCR_STATUS, SCR_CONTROL, SCR_ERROR, or SCR_ACTIVE. 346 369 347 370 Init and shutdown ··· 511 536 512 537 :c:func:`ata_scsi_error` is the current ``transportt->eh_strategy_handler()`` 513 538 for libata. As discussed above, this will be entered in two cases - 514 - timeout and ATAPI error completion. This function calls low level libata 515 - driver's :c:func:`eng_timeout` callback, the standard callback for which is 516 - :c:func:`ata_eng_timeout`. It checks if a qc is active and calls 517 - :c:func:`ata_qc_timeout` on the qc if so. Actual error handling occurs in 518 - :c:func:`ata_qc_timeout`. 539 + timeout and ATAPI error completion. This function will check if a qc is active 540 + and has not failed yet. Such a qc will be marked with AC_ERR_TIMEOUT such that 541 + EH will know to handle it later. Then it calls low level libata driver's 542 + :c:func:`error_handler` callback. 519 543 520 - If EH is invoked for timeout, :c:func:`ata_qc_timeout` stops BMDMA and 544 + When the :c:func:`error_handler` callback is invoked it stops BMDMA and 521 545 completes the qc. Note that as we're currently in EH, we cannot call 522 546 scsi_done. As described in SCSI EH doc, a recovered scmd should be 523 547 either retried with :c:func:`scsi_queue_insert` or finished with
-24
arch/arm/include/asm/ide.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * arch/arm/include/asm/ide.h 4 - * 5 - * Copyright (C) 1994-1996 Linus Torvalds & authors 6 - */ 7 - 8 - /* 9 - * This file contains the ARM architecture specific IDE code. 10 - */ 11 - 12 - #ifndef __ASMARM_IDE_H 13 - #define __ASMARM_IDE_H 14 - 15 - #ifdef __KERNEL__ 16 - 17 - #define __ide_mm_insw(port,addr,len) readsw(port,addr,len) 18 - #define __ide_mm_insl(port,addr,len) readsl(port,addr,len) 19 - #define __ide_mm_outsw(port,addr,len) writesw(port,addr,len) 20 - #define __ide_mm_outsl(port,addr,len) writesl(port,addr,len) 21 - 22 - #endif /* __KERNEL__ */ 23 - 24 - #endif /* __ASMARM_IDE_H */
-67
arch/m68k/include/asm/ide.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Copyright (C) 1994-1996 Linus Torvalds & authors 4 - */ 5 - 6 - /* Copyright(c) 1996 Kars de Jong */ 7 - /* Based on the ide driver from 1.2.13pl8 */ 8 - 9 - /* 10 - * Credits (alphabetical): 11 - * 12 - * - Bjoern Brauel 13 - * - Kars de Jong 14 - * - Torsten Ebeling 15 - * - Dwight Engen 16 - * - Thorsten Floeck 17 - * - Roman Hodek 18 - * - Guenther Kelleter 19 - * - Chris Lawrence 20 - * - Michael Rausch 21 - * - Christian Sauer 22 - * - Michael Schmitz 23 - * - Jes Soerensen 24 - * - Michael Thurm 25 - * - Geert Uytterhoeven 26 - */ 27 - 28 - #ifndef _M68K_IDE_H 29 - #define _M68K_IDE_H 30 - 31 - #ifdef __KERNEL__ 32 - #include <asm/setup.h> 33 - #include <asm/io.h> 34 - #include <asm/irq.h> 35 - 36 - #ifdef CONFIG_MMU 37 - 38 - /* 39 - * Get rid of defs from io.h - ide has its private and conflicting versions 40 - * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we 41 - * always use the `raw' MMIO versions 42 - */ 43 - #undef readb 44 - #undef readw 45 - #undef writeb 46 - #undef writew 47 - 48 - #define readb in_8 49 - #define readw in_be16 50 - #define __ide_mm_insw(port, addr, n) raw_insw((u16 *)port, addr, n) 51 - #define __ide_mm_insl(port, addr, n) raw_insl((u32 *)port, addr, n) 52 - #define writeb(val, port) out_8(port, val) 53 - #define writew(val, port) out_be16(port, val) 54 - #define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n) 55 - #define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n) 56 - 57 - #else 58 - 59 - #define __ide_mm_insw(port, addr, n) io_insw((unsigned int)port, addr, n) 60 - #define __ide_mm_insl(port, addr, n) io_insl((unsigned int)port, addr, n) 61 - #define __ide_mm_outsw(port, addr, n) io_outsw((unsigned int)port, addr, n) 62 - #define __ide_mm_outsl(port, addr, n) io_outsl((unsigned int)port, addr, n) 63 - 64 - #endif /* CONFIG_MMU */ 65 - 66 - #endif /* __KERNEL__ */ 67 - #endif /* _M68K_IDE_H */
-54
arch/parisc/include/asm/ide.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * linux/include/asm-parisc/ide.h 4 - * 5 - * Copyright (C) 1994-1996 Linus Torvalds & authors 6 - */ 7 - 8 - /* 9 - * This file contains the PARISC architecture specific IDE code. 10 - */ 11 - 12 - #ifndef __ASM_PARISC_IDE_H 13 - #define __ASM_PARISC_IDE_H 14 - 15 - /* Generic I/O and MEMIO string operations. */ 16 - 17 - #define __ide_insw insw 18 - #define __ide_insl insl 19 - #define __ide_outsw outsw 20 - #define __ide_outsl outsl 21 - 22 - static __inline__ void __ide_mm_insw(void __iomem *port, void *addr, u32 count) 23 - { 24 - while (count--) { 25 - *(u16 *)addr = __raw_readw(port); 26 - addr += 2; 27 - } 28 - } 29 - 30 - static __inline__ void __ide_mm_insl(void __iomem *port, void *addr, u32 count) 31 - { 32 - while (count--) { 33 - *(u32 *)addr = __raw_readl(port); 34 - addr += 4; 35 - } 36 - } 37 - 38 - static __inline__ void __ide_mm_outsw(void __iomem *port, void *addr, u32 count) 39 - { 40 - while (count--) { 41 - __raw_writew(*(u16 *)addr, port); 42 - addr += 2; 43 - } 44 - } 45 - 46 - static __inline__ void __ide_mm_outsl(void __iomem *port, void *addr, u32 count) 47 - { 48 - while (count--) { 49 - __raw_writel(*(u32 *)addr, port); 50 - addr += 4; 51 - } 52 - } 53 - 54 - #endif /* __ASM_PARISC_IDE_H */
-18
arch/powerpc/include/asm/ide.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Copyright (C) 1994-1996 Linus Torvalds & authors 4 - * 5 - * This file contains the powerpc architecture specific IDE code. 6 - */ 7 - #ifndef _ASM_POWERPC_IDE_H 8 - #define _ASM_POWERPC_IDE_H 9 - 10 - #include <linux/compiler.h> 11 - #include <asm/io.h> 12 - 13 - #define __ide_mm_insw(p, a, c) readsw((void __iomem *)(p), (a), (c)) 14 - #define __ide_mm_insl(p, a, c) readsl((void __iomem *)(p), (a), (c)) 15 - #define __ide_mm_outsw(p, a, c) writesw((void __iomem *)(p), (a), (c)) 16 - #define __ide_mm_outsl(p, a, c) writesl((void __iomem *)(p), (a), (c)) 17 - 18 - #endif /* _ASM_POWERPC_IDE_H */
-97
arch/sparc/include/asm/ide.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* ide.h: SPARC PCI specific IDE glue. 3 - * 4 - * Copyright (C) 1997 David S. Miller (davem@davemloft.net) 5 - * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) 6 - * Adaptation from sparc64 version to sparc by Pete Zaitcev. 7 - */ 8 - 9 - #ifndef _SPARC_IDE_H 10 - #define _SPARC_IDE_H 11 - 12 - #ifdef __KERNEL__ 13 - 14 - #include <asm/io.h> 15 - #ifdef CONFIG_SPARC64 16 - #include <asm/spitfire.h> 17 - #include <asm/cacheflush.h> 18 - #include <asm/page.h> 19 - #else 20 - #include <linux/pgtable.h> 21 - #include <asm/psr.h> 22 - #endif 23 - 24 - #define __ide_insl(data_reg, buffer, wcount) \ 25 - __ide_insw(data_reg, buffer, (wcount)<<1) 26 - #define __ide_outsl(data_reg, buffer, wcount) \ 27 - __ide_outsw(data_reg, buffer, (wcount)<<1) 28 - 29 - /* On sparc, I/O ports and MMIO registers are accessed identically. */ 30 - #define __ide_mm_insw __ide_insw 31 - #define __ide_mm_insl __ide_insl 32 - #define __ide_mm_outsw __ide_outsw 33 - #define __ide_mm_outsl __ide_outsl 34 - 35 - static inline void __ide_insw(void __iomem *port, void *dst, u32 count) 36 - { 37 - #if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE) 38 - unsigned long end = (unsigned long)dst + (count << 1); 39 - #endif 40 - u16 *ps = dst; 41 - u32 *pi; 42 - 43 - if(((unsigned long)ps) & 0x2) { 44 - *ps++ = __raw_readw(port); 45 - count--; 46 - } 47 - pi = (u32 *)ps; 48 - while(count >= 2) { 49 - u32 w; 50 - 51 - w = __raw_readw(port) << 16; 52 - w |= __raw_readw(port); 53 - *pi++ = w; 54 - count -= 2; 55 - } 56 - ps = (u16 *)pi; 57 - if(count) 58 - *ps++ = __raw_readw(port); 59 - 60 - #if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE) 61 - __flush_dcache_range((unsigned long)dst, end); 62 - #endif 63 - } 64 - 65 - static inline void __ide_outsw(void __iomem *port, const void *src, u32 count) 66 - { 67 - #if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE) 68 - unsigned long end = (unsigned long)src + (count << 1); 69 - #endif 70 - const u16 *ps = src; 71 - const u32 *pi; 72 - 73 - if(((unsigned long)src) & 0x2) { 74 - __raw_writew(*ps++, port); 75 - count--; 76 - } 77 - pi = (const u32 *)ps; 78 - while(count >= 2) { 79 - u32 w; 80 - 81 - w = *pi++; 82 - __raw_writew((w >> 16), port); 83 - __raw_writew(w, port); 84 - count -= 2; 85 - } 86 - ps = (const u16 *)pi; 87 - if(count) 88 - __raw_writew(*ps, port); 89 - 90 - #if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE) 91 - __flush_dcache_range((unsigned long)src, end); 92 - #endif 93 - } 94 - 95 - #endif /* __KERNEL__ */ 96 - 97 - #endif /* _SPARC_IDE_H */
+3 -1
drivers/ata/ahci.c
··· 421 421 { PCI_VDEVICE(INTEL, 0x34d3), board_ahci_low_power }, /* Ice Lake LP AHCI */ 422 422 { PCI_VDEVICE(INTEL, 0x02d3), board_ahci_low_power }, /* Comet Lake PCH-U AHCI */ 423 423 { PCI_VDEVICE(INTEL, 0x02d7), board_ahci_low_power }, /* Comet Lake PCH RAID */ 424 + /* Elkhart Lake IDs 0x4b60 & 0x4b62 https://sata-io.org/product/8803 not tested yet */ 425 + { PCI_VDEVICE(INTEL, 0x4b63), board_ahci_low_power }, /* Elkhart Lake AHCI */ 424 426 425 427 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 426 428 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, ··· 809 807 static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class, 810 808 unsigned long deadline) 811 809 { 812 - const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); 810 + const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context); 813 811 struct ata_port *ap = link->ap; 814 812 struct ahci_port_priv *pp = ap->private_data; 815 813 struct ahci_host_priv *hpriv = ap->host->private_data;
+1 -1
drivers/ata/ahci_ceva.c
··· 10 10 #include <linux/kernel.h> 11 11 #include <linux/libata.h> 12 12 #include <linux/module.h> 13 - #include <linux/of_device.h> 13 + #include <linux/of.h> 14 14 #include <linux/platform_device.h> 15 15 #include <linux/reset.h> 16 16 #include "ahci.h"
+1 -1
drivers/ata/ahci_dwc.c
··· 15 15 #include <linux/log2.h> 16 16 #include <linux/mfd/syscon.h> 17 17 #include <linux/module.h> 18 - #include <linux/of_device.h> 18 + #include <linux/of.h> 19 19 #include <linux/platform_device.h> 20 20 #include <linux/pm.h> 21 21 #include <linux/regmap.h>
+1
drivers/ata/ahci_mtk.c
··· 11 11 #include <linux/libata.h> 12 12 #include <linux/mfd/syscon.h> 13 13 #include <linux/module.h> 14 + #include <linux/of.h> 14 15 #include <linux/platform_device.h> 15 16 #include <linux/pm.h> 16 17 #include <linux/regmap.h>
+1 -1
drivers/ata/ahci_mvebu.c
··· 15 15 #include <linux/kernel.h> 16 16 #include <linux/mbus.h> 17 17 #include <linux/module.h> 18 - #include <linux/of_device.h> 18 + #include <linux/of.h> 19 19 #include <linux/platform_device.h> 20 20 #include "ahci.h" 21 21
+1 -3
drivers/ata/ahci_octeon.c
··· 31 31 { 32 32 struct device *dev = &pdev->dev; 33 33 struct device_node *node = dev->of_node; 34 - struct resource *res; 35 34 void __iomem *base; 36 35 u64 cfg; 37 36 int ret; 38 37 39 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 40 - base = devm_ioremap_resource(&pdev->dev, res); 38 + base = devm_platform_ioremap_resource(pdev, 0); 41 39 if (IS_ERR(base)) 42 40 return PTR_ERR(base); 43 41
+1 -3
drivers/ata/ahci_qoriq.c
··· 12 12 #include <linux/pm.h> 13 13 #include <linux/ahci_platform.h> 14 14 #include <linux/device.h> 15 - #include <linux/of_address.h> 16 15 #include <linux/of.h> 17 - #include <linux/of_device.h> 18 16 #include <linux/platform_device.h> 19 17 #include <linux/libata.h> 20 18 #include "ahci.h" ··· 88 90 static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class, 89 91 unsigned long deadline) 90 92 { 91 - const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); 93 + const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context); 92 94 void __iomem *port_mmio = ahci_port_base(link->ap); 93 95 u32 px_cmd, px_is, px_val; 94 96 struct ata_port *ap = link->ap;
+1 -3
drivers/ata/ahci_seattle.c
··· 12 12 #include <linux/module.h> 13 13 #include <linux/pm.h> 14 14 #include <linux/device.h> 15 - #include <linux/of_device.h> 16 15 #include <linux/platform_device.h> 17 16 #include <linux/libata.h> 18 17 #include <linux/ahci_platform.h> ··· 131 132 if (!plat_data) 132 133 return &ahci_port_info; 133 134 134 - plat_data->sgpio_ctrl = devm_ioremap_resource(dev, 135 - platform_get_resource(pdev, IORESOURCE_MEM, 1)); 135 + plat_data->sgpio_ctrl = devm_platform_ioremap_resource(pdev, 1); 136 136 if (IS_ERR(plat_data->sgpio_ctrl)) 137 137 return &ahci_port_info; 138 138
+1 -1
drivers/ata/ahci_sunxi.c
··· 13 13 #include <linux/clk.h> 14 14 #include <linux/errno.h> 15 15 #include <linux/kernel.h> 16 + #include <linux/mod_devicetable.h> 16 17 #include <linux/module.h> 17 - #include <linux/of_device.h> 18 18 #include <linux/platform_device.h> 19 19 #include <linux/regulator/consumer.h> 20 20 #include "ahci.h"
+2 -3
drivers/ata/ahci_tegra.c
··· 12 12 #include <linux/errno.h> 13 13 #include <linux/kernel.h> 14 14 #include <linux/module.h> 15 - #include <linux/of_device.h> 15 + #include <linux/of.h> 16 16 #include <linux/platform_device.h> 17 17 #include <linux/regulator/consumer.h> 18 18 #include <linux/reset.h> ··· 530 530 tegra->pdev = pdev; 531 531 tegra->soc = of_device_get_match_data(&pdev->dev); 532 532 533 - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 534 - tegra->sata_regs = devm_ioremap_resource(&pdev->dev, res); 533 + tegra->sata_regs = devm_platform_ioremap_resource(pdev, 1); 535 534 if (IS_ERR(tegra->sata_regs)) 536 535 return PTR_ERR(tegra->sata_regs); 537 536
+6 -10
drivers/ata/ahci_xgene.c
··· 110 110 * @timeout : timeout for achieving the value. 111 111 */ 112 112 static int xgene_ahci_poll_reg_val(struct ata_port *ap, 113 - void __iomem *reg, unsigned 114 - int val, unsigned long interval, 115 - unsigned long timeout) 113 + void __iomem *reg, unsigned int val, 114 + unsigned int interval, unsigned int timeout) 116 115 { 117 116 unsigned long deadline; 118 117 unsigned int tmp; ··· 349 350 static int xgene_ahci_do_hardreset(struct ata_link *link, 350 351 unsigned long deadline, bool *online) 351 352 { 352 - const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); 353 + const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context); 353 354 struct ata_port *ap = link->ap; 354 355 struct ahci_host_priv *hpriv = ap->host->private_data; 355 356 struct xgene_ahci_context *ctx = hpriv->plat_data; ··· 754 755 ctx->dev = dev; 755 756 756 757 /* Retrieve the IP core resource */ 757 - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 758 - ctx->csr_core = devm_ioremap_resource(dev, res); 758 + ctx->csr_core = devm_platform_ioremap_resource(pdev, 1); 759 759 if (IS_ERR(ctx->csr_core)) 760 760 return PTR_ERR(ctx->csr_core); 761 761 762 762 /* Retrieve the IP diagnostic resource */ 763 - res = platform_get_resource(pdev, IORESOURCE_MEM, 2); 764 - ctx->csr_diag = devm_ioremap_resource(dev, res); 763 + ctx->csr_diag = devm_platform_ioremap_resource(pdev, 2); 765 764 if (IS_ERR(ctx->csr_diag)) 766 765 return PTR_ERR(ctx->csr_diag); 767 766 768 767 /* Retrieve the IP AXI resource */ 769 - res = platform_get_resource(pdev, IORESOURCE_MEM, 3); 770 - ctx->csr_axi = devm_ioremap_resource(dev, res); 768 + ctx->csr_axi = devm_platform_ioremap_resource(pdev, 3); 771 769 if (IS_ERR(ctx->csr_axi)) 772 770 return PTR_ERR(ctx->csr_axi); 773 771
+4 -3
drivers/ata/libahci.c
··· 1403 1403 1404 1404 static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, 1405 1405 struct ata_taskfile *tf, int is_cmd, u16 flags, 1406 - unsigned long timeout_msec) 1406 + unsigned int timeout_msec) 1407 1407 { 1408 1408 const u32 cmd_fis_len = 5; /* five dwords */ 1409 1409 struct ahci_port_priv *pp = ap->private_data; ··· 1448 1448 struct ahci_host_priv *hpriv = ap->host->private_data; 1449 1449 struct ahci_port_priv *pp = ap->private_data; 1450 1450 const char *reason = NULL; 1451 - unsigned long now, msecs; 1451 + unsigned long now; 1452 + unsigned int msecs; 1452 1453 struct ata_taskfile tf; 1453 1454 bool fbs_disabled = false; 1454 1455 int rc; ··· 1588 1587 int ahci_do_hardreset(struct ata_link *link, unsigned int *class, 1589 1588 unsigned long deadline, bool *online) 1590 1589 { 1591 - const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); 1590 + const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context); 1592 1591 struct ata_port *ap = link->ap; 1593 1592 struct ahci_port_priv *pp = ap->private_data; 1594 1593 struct ahci_host_priv *hpriv = ap->host->private_data;
+1
drivers/ata/libahci_platform.c
··· 20 20 #include <linux/ahci_platform.h> 21 21 #include <linux/phy/phy.h> 22 22 #include <linux/pm_runtime.h> 23 + #include <linux/of.h> 23 24 #include <linux/of_platform.h> 24 25 #include <linux/reset.h> 25 26 #include "ahci.h"
+104 -287
drivers/ata/libata-core.c
··· 1586 1586 } 1587 1587 } 1588 1588 1589 - if (ap->ops->error_handler) 1590 - ata_eh_release(ap); 1589 + ata_eh_release(ap); 1591 1590 1592 1591 rc = wait_for_completion_timeout(&wait, msecs_to_jiffies(timeout)); 1593 1592 1594 - if (ap->ops->error_handler) 1595 - ata_eh_acquire(ap); 1593 + ata_eh_acquire(ap); 1596 1594 1597 1595 ata_sff_flush_pio_task(ap); 1598 1596 ··· 1605 1607 if (qc->flags & ATA_QCFLAG_ACTIVE) { 1606 1608 qc->err_mask |= AC_ERR_TIMEOUT; 1607 1609 1608 - if (ap->ops->error_handler) 1609 - ata_port_freeze(ap); 1610 - else 1611 - ata_qc_complete(qc); 1610 + ata_port_freeze(ap); 1612 1611 1613 1612 ata_dev_warn(dev, "qc timeout after %u msecs (cmd 0x%x)\n", 1614 1613 timeout, command); ··· 3058 3063 EXPORT_SYMBOL_GPL(ata_cable_sata); 3059 3064 3060 3065 /** 3061 - * ata_bus_probe - Reset and probe ATA bus 3062 - * @ap: Bus to probe 3063 - * 3064 - * Master ATA bus probing function. Initiates a hardware-dependent 3065 - * bus reset, then attempts to identify any devices found on 3066 - * the bus. 3067 - * 3068 - * LOCKING: 3069 - * PCI/etc. bus probe sem. 3070 - * 3071 - * RETURNS: 3072 - * Zero on success, negative errno otherwise. 3073 - */ 3074 - 3075 - int ata_bus_probe(struct ata_port *ap) 3076 - { 3077 - unsigned int classes[ATA_MAX_DEVICES]; 3078 - int tries[ATA_MAX_DEVICES]; 3079 - int rc; 3080 - struct ata_device *dev; 3081 - 3082 - ata_for_each_dev(dev, &ap->link, ALL) 3083 - tries[dev->devno] = ATA_PROBE_MAX_TRIES; 3084 - 3085 - retry: 3086 - ata_for_each_dev(dev, &ap->link, ALL) { 3087 - /* If we issue an SRST then an ATA drive (not ATAPI) 3088 - * may change configuration and be in PIO0 timing. If 3089 - * we do a hard reset (or are coming from power on) 3090 - * this is true for ATA or ATAPI. Until we've set a 3091 - * suitable controller mode we should not touch the 3092 - * bus as we may be talking too fast. 3093 - */ 3094 - dev->pio_mode = XFER_PIO_0; 3095 - dev->dma_mode = 0xff; 3096 - 3097 - /* If the controller has a pio mode setup function 3098 - * then use it to set the chipset to rights. Don't 3099 - * touch the DMA setup as that will be dealt with when 3100 - * configuring devices. 3101 - */ 3102 - if (ap->ops->set_piomode) 3103 - ap->ops->set_piomode(ap, dev); 3104 - } 3105 - 3106 - /* reset and determine device classes */ 3107 - ap->ops->phy_reset(ap); 3108 - 3109 - ata_for_each_dev(dev, &ap->link, ALL) { 3110 - if (dev->class != ATA_DEV_UNKNOWN) 3111 - classes[dev->devno] = dev->class; 3112 - else 3113 - classes[dev->devno] = ATA_DEV_NONE; 3114 - 3115 - dev->class = ATA_DEV_UNKNOWN; 3116 - } 3117 - 3118 - /* read IDENTIFY page and configure devices. We have to do the identify 3119 - specific sequence bass-ackwards so that PDIAG- is released by 3120 - the slave device */ 3121 - 3122 - ata_for_each_dev(dev, &ap->link, ALL_REVERSE) { 3123 - if (tries[dev->devno]) 3124 - dev->class = classes[dev->devno]; 3125 - 3126 - if (!ata_dev_enabled(dev)) 3127 - continue; 3128 - 3129 - rc = ata_dev_read_id(dev, &dev->class, ATA_READID_POSTRESET, 3130 - dev->id); 3131 - if (rc) 3132 - goto fail; 3133 - } 3134 - 3135 - /* Now ask for the cable type as PDIAG- should have been released */ 3136 - if (ap->ops->cable_detect) 3137 - ap->cbl = ap->ops->cable_detect(ap); 3138 - 3139 - /* We may have SATA bridge glue hiding here irrespective of 3140 - * the reported cable types and sensed types. When SATA 3141 - * drives indicate we have a bridge, we don't know which end 3142 - * of the link the bridge is which is a problem. 3143 - */ 3144 - ata_for_each_dev(dev, &ap->link, ENABLED) 3145 - if (ata_id_is_sata(dev->id)) 3146 - ap->cbl = ATA_CBL_SATA; 3147 - 3148 - /* After the identify sequence we can now set up the devices. We do 3149 - this in the normal order so that the user doesn't get confused */ 3150 - 3151 - ata_for_each_dev(dev, &ap->link, ENABLED) { 3152 - ap->link.eh_context.i.flags |= ATA_EHI_PRINTINFO; 3153 - rc = ata_dev_configure(dev); 3154 - ap->link.eh_context.i.flags &= ~ATA_EHI_PRINTINFO; 3155 - if (rc) 3156 - goto fail; 3157 - } 3158 - 3159 - /* configure transfer mode */ 3160 - rc = ata_set_mode(&ap->link, &dev); 3161 - if (rc) 3162 - goto fail; 3163 - 3164 - ata_for_each_dev(dev, &ap->link, ENABLED) 3165 - return 0; 3166 - 3167 - return -ENODEV; 3168 - 3169 - fail: 3170 - tries[dev->devno]--; 3171 - 3172 - switch (rc) { 3173 - case -EINVAL: 3174 - /* eeek, something went very wrong, give up */ 3175 - tries[dev->devno] = 0; 3176 - break; 3177 - 3178 - case -ENODEV: 3179 - /* give it just one more chance */ 3180 - tries[dev->devno] = min(tries[dev->devno], 1); 3181 - fallthrough; 3182 - case -EIO: 3183 - if (tries[dev->devno] == 1) { 3184 - /* This is the last chance, better to slow 3185 - * down than lose it. 3186 - */ 3187 - sata_down_spd_limit(&ap->link, 0); 3188 - ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); 3189 - } 3190 - } 3191 - 3192 - if (!tries[dev->devno]) 3193 - ata_dev_disable(dev); 3194 - 3195 - goto retry; 3196 - } 3197 - 3198 - /** 3199 3066 * sata_print_link_status - Print SATA link status 3200 3067 * @link: SATA link to printk link status about 3201 3068 * ··· 3639 3782 { 3640 3783 struct ata_port *ap = link->ap; 3641 3784 struct ata_eh_context *ehc = &link->eh_context; 3642 - const unsigned long *timing = sata_ehc_deb_timing(ehc); 3785 + const unsigned int *timing = sata_ehc_deb_timing(ehc); 3643 3786 int rc; 3644 3787 3645 3788 /* if we're about to do hardreset, nothing more to do */ ··· 3681 3824 int sata_std_hardreset(struct ata_link *link, unsigned int *class, 3682 3825 unsigned long deadline) 3683 3826 { 3684 - const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); 3827 + const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context); 3685 3828 bool online; 3686 3829 int rc; 3687 3830 ··· 4070 4213 ATA_HORKAGE_ZERO_AFTER_TRIM }, 4071 4214 { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | 4072 4215 ATA_HORKAGE_ZERO_AFTER_TRIM }, 4073 - { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | 4074 - ATA_HORKAGE_ZERO_AFTER_TRIM }, 4075 4216 { "Micron_M5[15]0_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | 4217 + ATA_HORKAGE_ZERO_AFTER_TRIM }, 4218 + { "Micron_1100_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | 4219 + ATA_HORKAGE_ZERO_AFTER_TRIM, }, 4220 + { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | 4076 4221 ATA_HORKAGE_ZERO_AFTER_TRIM }, 4077 4222 { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | 4078 4223 ATA_HORKAGE_ZERO_AFTER_TRIM }, ··· 4733 4874 void ata_qc_complete(struct ata_queued_cmd *qc) 4734 4875 { 4735 4876 struct ata_port *ap = qc->ap; 4877 + struct ata_device *dev = qc->dev; 4878 + struct ata_eh_info *ehi = &dev->link->eh_info; 4736 4879 4737 4880 /* Trigger the LED (if available) */ 4738 4881 ledtrig_disk_activity(!!(qc->tf.flags & ATA_TFLAG_WRITE)); 4739 4882 4740 - /* XXX: New EH and old EH use different mechanisms to 4741 - * synchronize EH with regular execution path. 4883 + /* 4884 + * In order to synchronize EH with the regular execution path, a qc that 4885 + * is owned by EH is marked with ATA_QCFLAG_EH. 4742 4886 * 4743 - * In new EH, a qc owned by EH is marked with ATA_QCFLAG_EH. 4744 - * Normal execution path is responsible for not accessing a 4745 - * qc owned by EH. libata core enforces the rule by returning NULL 4746 - * from ata_qc_from_tag() for qcs owned by EH. 4747 - * 4748 - * Old EH depends on ata_qc_complete() nullifying completion 4749 - * requests if ATA_QCFLAG_EH_SCHEDULED is set. Old EH does 4750 - * not synchronize with interrupt handler. Only PIO task is 4751 - * taken care of. 4887 + * The normal execution path is responsible for not accessing a qc owned 4888 + * by EH. libata core enforces the rule by returning NULL from 4889 + * ata_qc_from_tag() for qcs owned by EH. 4752 4890 */ 4753 - if (ap->ops->error_handler) { 4754 - struct ata_device *dev = qc->dev; 4755 - struct ata_eh_info *ehi = &dev->link->eh_info; 4891 + if (unlikely(qc->err_mask)) 4892 + qc->flags |= ATA_QCFLAG_EH; 4756 4893 4757 - if (unlikely(qc->err_mask)) 4758 - qc->flags |= ATA_QCFLAG_EH; 4759 - 4760 - /* 4761 - * Finish internal commands without any further processing 4762 - * and always with the result TF filled. 4763 - */ 4764 - if (unlikely(ata_tag_internal(qc->tag))) { 4765 - fill_result_tf(qc); 4766 - trace_ata_qc_complete_internal(qc); 4767 - __ata_qc_complete(qc); 4768 - return; 4769 - } 4770 - 4771 - /* 4772 - * Non-internal qc has failed. Fill the result TF and 4773 - * summon EH. 4774 - */ 4775 - if (unlikely(qc->flags & ATA_QCFLAG_EH)) { 4776 - fill_result_tf(qc); 4777 - trace_ata_qc_complete_failed(qc); 4778 - ata_qc_schedule_eh(qc); 4779 - return; 4780 - } 4781 - 4782 - WARN_ON_ONCE(ata_port_is_frozen(ap)); 4783 - 4784 - /* read result TF if requested */ 4785 - if (qc->flags & ATA_QCFLAG_RESULT_TF) 4786 - fill_result_tf(qc); 4787 - 4788 - trace_ata_qc_complete_done(qc); 4789 - 4790 - /* 4791 - * For CDL commands that completed without an error, check if 4792 - * we have sense data (ATA_SENSE is set). If we do, then the 4793 - * command may have been aborted by the device due to a limit 4794 - * timeout using the policy 0xD. For these commands, invoke EH 4795 - * to get the command sense data. 4796 - */ 4797 - if (qc->result_tf.status & ATA_SENSE && 4798 - ((ata_is_ncq(qc->tf.protocol) && 4799 - dev->flags & ATA_DFLAG_CDL_ENABLED) || 4800 - (!ata_is_ncq(qc->tf.protocol) && 4801 - ata_id_sense_reporting_enabled(dev->id)))) { 4802 - /* 4803 - * Tell SCSI EH to not overwrite scmd->result even if 4804 - * this command is finished with result SAM_STAT_GOOD. 4805 - */ 4806 - qc->scsicmd->flags |= SCMD_FORCE_EH_SUCCESS; 4807 - qc->flags |= ATA_QCFLAG_EH_SUCCESS_CMD; 4808 - ehi->dev_action[dev->devno] |= ATA_EH_GET_SUCCESS_SENSE; 4809 - 4810 - /* 4811 - * set pending so that ata_qc_schedule_eh() does not 4812 - * trigger fast drain, and freeze the port. 4813 - */ 4814 - ap->pflags |= ATA_PFLAG_EH_PENDING; 4815 - ata_qc_schedule_eh(qc); 4816 - return; 4817 - } 4818 - 4819 - /* Some commands need post-processing after successful 4820 - * completion. 4821 - */ 4822 - switch (qc->tf.command) { 4823 - case ATA_CMD_SET_FEATURES: 4824 - if (qc->tf.feature != SETFEATURES_WC_ON && 4825 - qc->tf.feature != SETFEATURES_WC_OFF && 4826 - qc->tf.feature != SETFEATURES_RA_ON && 4827 - qc->tf.feature != SETFEATURES_RA_OFF) 4828 - break; 4829 - fallthrough; 4830 - case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */ 4831 - case ATA_CMD_SET_MULTI: /* multi_count changed */ 4832 - /* revalidate device */ 4833 - ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE; 4834 - ata_port_schedule_eh(ap); 4835 - break; 4836 - 4837 - case ATA_CMD_SLEEP: 4838 - dev->flags |= ATA_DFLAG_SLEEPING; 4839 - break; 4840 - } 4841 - 4842 - if (unlikely(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) 4843 - ata_verify_xfer(qc); 4844 - 4894 + /* 4895 + * Finish internal commands without any further processing and always 4896 + * with the result TF filled. 4897 + */ 4898 + if (unlikely(ata_tag_internal(qc->tag))) { 4899 + fill_result_tf(qc); 4900 + trace_ata_qc_complete_internal(qc); 4845 4901 __ata_qc_complete(qc); 4846 - } else { 4847 - if (qc->flags & ATA_QCFLAG_EH_SCHEDULED) 4848 - return; 4849 - 4850 - /* read result TF if failed or requested */ 4851 - if (qc->err_mask || qc->flags & ATA_QCFLAG_RESULT_TF) 4852 - fill_result_tf(qc); 4853 - 4854 - __ata_qc_complete(qc); 4902 + return; 4855 4903 } 4904 + 4905 + /* Non-internal qc has failed. Fill the result TF and summon EH. */ 4906 + if (unlikely(qc->flags & ATA_QCFLAG_EH)) { 4907 + fill_result_tf(qc); 4908 + trace_ata_qc_complete_failed(qc); 4909 + ata_qc_schedule_eh(qc); 4910 + return; 4911 + } 4912 + 4913 + WARN_ON_ONCE(ata_port_is_frozen(ap)); 4914 + 4915 + /* read result TF if requested */ 4916 + if (qc->flags & ATA_QCFLAG_RESULT_TF) 4917 + fill_result_tf(qc); 4918 + 4919 + trace_ata_qc_complete_done(qc); 4920 + 4921 + /* 4922 + * For CDL commands that completed without an error, check if we have 4923 + * sense data (ATA_SENSE is set). If we do, then the command may have 4924 + * been aborted by the device due to a limit timeout using the policy 4925 + * 0xD. For these commands, invoke EH to get the command sense data. 4926 + */ 4927 + if (qc->result_tf.status & ATA_SENSE && 4928 + ((ata_is_ncq(qc->tf.protocol) && 4929 + dev->flags & ATA_DFLAG_CDL_ENABLED) || 4930 + (!ata_is_ncq(qc->tf.protocol) && 4931 + ata_id_sense_reporting_enabled(dev->id)))) { 4932 + /* 4933 + * Tell SCSI EH to not overwrite scmd->result even if this 4934 + * command is finished with result SAM_STAT_GOOD. 4935 + */ 4936 + qc->scsicmd->flags |= SCMD_FORCE_EH_SUCCESS; 4937 + qc->flags |= ATA_QCFLAG_EH_SUCCESS_CMD; 4938 + ehi->dev_action[dev->devno] |= ATA_EH_GET_SUCCESS_SENSE; 4939 + 4940 + /* 4941 + * set pending so that ata_qc_schedule_eh() does not trigger 4942 + * fast drain, and freeze the port. 4943 + */ 4944 + ap->pflags |= ATA_PFLAG_EH_PENDING; 4945 + ata_qc_schedule_eh(qc); 4946 + return; 4947 + } 4948 + 4949 + /* Some commands need post-processing after successful completion. */ 4950 + switch (qc->tf.command) { 4951 + case ATA_CMD_SET_FEATURES: 4952 + if (qc->tf.feature != SETFEATURES_WC_ON && 4953 + qc->tf.feature != SETFEATURES_WC_OFF && 4954 + qc->tf.feature != SETFEATURES_RA_ON && 4955 + qc->tf.feature != SETFEATURES_RA_OFF) 4956 + break; 4957 + fallthrough; 4958 + case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */ 4959 + case ATA_CMD_SET_MULTI: /* multi_count changed */ 4960 + /* revalidate device */ 4961 + ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE; 4962 + ata_port_schedule_eh(ap); 4963 + break; 4964 + 4965 + case ATA_CMD_SLEEP: 4966 + dev->flags |= ATA_DFLAG_SLEEPING; 4967 + break; 4968 + } 4969 + 4970 + if (unlikely(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) 4971 + ata_verify_xfer(qc); 4972 + 4973 + __ata_qc_complete(qc); 4856 4974 } 4857 4975 EXPORT_SYMBOL_GPL(ata_qc_complete); 4858 4976 ··· 4875 5039 struct ata_link *link = qc->dev->link; 4876 5040 u8 prot = qc->tf.protocol; 4877 5041 4878 - /* Make sure only one non-NCQ command is outstanding. The 4879 - * check is skipped for old EH because it reuses active qc to 4880 - * request ATAPI sense. 4881 - */ 4882 - WARN_ON_ONCE(ap->ops->error_handler && ata_tag_valid(link->active_tag)); 5042 + /* Make sure only one non-NCQ command is outstanding. */ 5043 + WARN_ON_ONCE(ata_tag_valid(link->active_tag)); 4883 5044 4884 5045 if (ata_is_ncq(prot)) { 4885 5046 WARN_ON_ONCE(link->sactive & (1 << qc->hw_tag)); ··· 5729 5896 } 5730 5897 EXPORT_SYMBOL_GPL(ata_host_init); 5731 5898 5732 - void __ata_port_probe(struct ata_port *ap) 5899 + void ata_port_probe(struct ata_port *ap) 5733 5900 { 5734 5901 struct ata_eh_info *ehi = &ap->link.eh_info; 5735 5902 unsigned long flags; ··· 5747 5914 5748 5915 spin_unlock_irqrestore(ap->lock, flags); 5749 5916 } 5750 - 5751 - int ata_port_probe(struct ata_port *ap) 5752 - { 5753 - int rc = 0; 5754 - 5755 - if (ap->ops->error_handler) { 5756 - __ata_port_probe(ap); 5757 - ata_port_wait_eh(ap); 5758 - } else { 5759 - rc = ata_bus_probe(ap); 5760 - } 5761 - return rc; 5762 - } 5763 - 5917 + EXPORT_SYMBOL_GPL(ata_port_probe); 5764 5918 5765 5919 static void async_port_probe(void *data, async_cookie_t cookie) 5766 5920 { ··· 5763 5943 if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0) 5764 5944 async_synchronize_cookie(cookie); 5765 5945 5766 - (void)ata_port_probe(ap); 5946 + ata_port_probe(ap); 5947 + ata_port_wait_eh(ap); 5767 5948 5768 5949 /* in order to keep device order, we need to synchronize at this point */ 5769 5950 async_synchronize_cookie(cookie); ··· 5951 6130 struct ata_link *link; 5952 6131 struct ata_device *dev; 5953 6132 5954 - if (!ap->ops->error_handler) 5955 - goto skip_eh; 5956 - 5957 6133 /* tell EH we're leaving & flush EH */ 5958 6134 spin_lock_irqsave(ap->lock, flags); 5959 6135 ap->pflags |= ATA_PFLAG_UNLOADING; ··· 5966 6148 cancel_delayed_work_sync(&ap->hotplug_task); 5967 6149 cancel_delayed_work_sync(&ap->scsi_rescan_task); 5968 6150 5969 - skip_eh: 5970 6151 /* clean up zpodd on port removal */ 5971 6152 ata_for_each_link(link, ap, HOST_FIRST) { 5972 6153 ata_for_each_dev(dev, link, ALL) { ··· 6501 6684 * The final register value. 6502 6685 */ 6503 6686 u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, 6504 - unsigned long interval, unsigned long timeout) 6687 + unsigned int interval, unsigned int timeout) 6505 6688 { 6506 6689 unsigned long deadline; 6507 6690 u32 tmp;
+75 -101
drivers/ata/libata-eh.c
··· 78 78 * are mostly for error handling, hotplug and those outlier devices that 79 79 * take an exceptionally long time to recover from reset. 80 80 */ 81 - static const unsigned long ata_eh_reset_timeouts[] = { 81 + static const unsigned int ata_eh_reset_timeouts[] = { 82 82 10000, /* most drives spin up by 10sec */ 83 83 10000, /* > 99% working drives spin up before 20sec */ 84 84 35000, /* give > 30 secs of idleness for outlier devices */ 85 85 5000, /* and sweet one last chance */ 86 - ULONG_MAX, /* > 1 min has elapsed, give up */ 86 + UINT_MAX, /* > 1 min has elapsed, give up */ 87 87 }; 88 88 89 89 static const unsigned int ata_eh_identify_timeouts[] = { ··· 571 571 /* make sure sff pio task is not running */ 572 572 ata_sff_flush_pio_task(ap); 573 573 574 - if (!ap->ops->error_handler) 575 - return; 576 - 577 574 /* synchronize with host lock and sort out timeouts */ 578 575 579 576 /* 580 - * For new EH, all qcs are finished in one of three ways - 577 + * For EH, all qcs are finished in one of three ways - 581 578 * normal completion, error completion, and SCSI timeout. 582 579 * Both completions can race against SCSI timeout. When normal 583 580 * completion wins, the qc never reaches EH. When error ··· 656 659 void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) 657 660 { 658 661 unsigned long flags; 662 + struct ata_link *link; 659 663 660 - /* invoke error handler */ 661 - if (ap->ops->error_handler) { 662 - struct ata_link *link; 663 - 664 - /* acquire EH ownership */ 665 - ata_eh_acquire(ap); 664 + /* acquire EH ownership */ 665 + ata_eh_acquire(ap); 666 666 repeat: 667 - /* kill fast drain timer */ 668 - del_timer_sync(&ap->fastdrain_timer); 667 + /* kill fast drain timer */ 668 + del_timer_sync(&ap->fastdrain_timer); 669 669 670 - /* process port resume request */ 671 - ata_eh_handle_port_resume(ap); 670 + /* process port resume request */ 671 + ata_eh_handle_port_resume(ap); 672 672 673 - /* fetch & clear EH info */ 674 - spin_lock_irqsave(ap->lock, flags); 673 + /* fetch & clear EH info */ 674 + spin_lock_irqsave(ap->lock, flags); 675 675 676 - ata_for_each_link(link, ap, HOST_FIRST) { 677 - struct ata_eh_context *ehc = &link->eh_context; 678 - struct ata_device *dev; 676 + ata_for_each_link(link, ap, HOST_FIRST) { 677 + struct ata_eh_context *ehc = &link->eh_context; 678 + struct ata_device *dev; 679 679 680 - memset(&link->eh_context, 0, sizeof(link->eh_context)); 681 - link->eh_context.i = link->eh_info; 682 - memset(&link->eh_info, 0, sizeof(link->eh_info)); 680 + memset(&link->eh_context, 0, sizeof(link->eh_context)); 681 + link->eh_context.i = link->eh_info; 682 + memset(&link->eh_info, 0, sizeof(link->eh_info)); 683 683 684 - ata_for_each_dev(dev, link, ENABLED) { 685 - int devno = dev->devno; 684 + ata_for_each_dev(dev, link, ENABLED) { 685 + int devno = dev->devno; 686 686 687 - ehc->saved_xfer_mode[devno] = dev->xfer_mode; 688 - if (ata_ncq_enabled(dev)) 689 - ehc->saved_ncq_enabled |= 1 << devno; 690 - } 687 + ehc->saved_xfer_mode[devno] = dev->xfer_mode; 688 + if (ata_ncq_enabled(dev)) 689 + ehc->saved_ncq_enabled |= 1 << devno; 691 690 } 692 - 693 - ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; 694 - ap->pflags &= ~ATA_PFLAG_EH_PENDING; 695 - ap->excl_link = NULL; /* don't maintain exclusion over EH */ 696 - 697 - spin_unlock_irqrestore(ap->lock, flags); 698 - 699 - /* invoke EH, skip if unloading or suspended */ 700 - if (!(ap->pflags & (ATA_PFLAG_UNLOADING | ATA_PFLAG_SUSPENDED))) 701 - ap->ops->error_handler(ap); 702 - else { 703 - /* if unloading, commence suicide */ 704 - if ((ap->pflags & ATA_PFLAG_UNLOADING) && 705 - !(ap->pflags & ATA_PFLAG_UNLOADED)) 706 - ata_eh_unload(ap); 707 - ata_eh_finish(ap); 708 - } 709 - 710 - /* process port suspend request */ 711 - ata_eh_handle_port_suspend(ap); 712 - 713 - /* Exception might have happened after ->error_handler 714 - * recovered the port but before this point. Repeat 715 - * EH in such case. 716 - */ 717 - spin_lock_irqsave(ap->lock, flags); 718 - 719 - if (ap->pflags & ATA_PFLAG_EH_PENDING) { 720 - if (--ap->eh_tries) { 721 - spin_unlock_irqrestore(ap->lock, flags); 722 - goto repeat; 723 - } 724 - ata_port_err(ap, 725 - "EH pending after %d tries, giving up\n", 726 - ATA_EH_MAX_TRIES); 727 - ap->pflags &= ~ATA_PFLAG_EH_PENDING; 728 - } 729 - 730 - /* this run is complete, make sure EH info is clear */ 731 - ata_for_each_link(link, ap, HOST_FIRST) 732 - memset(&link->eh_info, 0, sizeof(link->eh_info)); 733 - 734 - /* end eh (clear host_eh_scheduled) while holding 735 - * ap->lock such that if exception occurs after this 736 - * point but before EH completion, SCSI midlayer will 737 - * re-initiate EH. 738 - */ 739 - ap->ops->end_eh(ap); 740 - 741 - spin_unlock_irqrestore(ap->lock, flags); 742 - ata_eh_release(ap); 743 - } else { 744 - WARN_ON(ata_qc_from_tag(ap, ap->link.active_tag) == NULL); 745 - ap->ops->eng_timeout(ap); 746 691 } 692 + 693 + ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; 694 + ap->pflags &= ~ATA_PFLAG_EH_PENDING; 695 + ap->excl_link = NULL; /* don't maintain exclusion over EH */ 696 + 697 + spin_unlock_irqrestore(ap->lock, flags); 698 + 699 + /* invoke EH, skip if unloading or suspended */ 700 + if (!(ap->pflags & (ATA_PFLAG_UNLOADING | ATA_PFLAG_SUSPENDED))) 701 + ap->ops->error_handler(ap); 702 + else { 703 + /* if unloading, commence suicide */ 704 + if ((ap->pflags & ATA_PFLAG_UNLOADING) && 705 + !(ap->pflags & ATA_PFLAG_UNLOADED)) 706 + ata_eh_unload(ap); 707 + ata_eh_finish(ap); 708 + } 709 + 710 + /* process port suspend request */ 711 + ata_eh_handle_port_suspend(ap); 712 + 713 + /* 714 + * Exception might have happened after ->error_handler recovered the 715 + * port but before this point. Repeat EH in such case. 716 + */ 717 + spin_lock_irqsave(ap->lock, flags); 718 + 719 + if (ap->pflags & ATA_PFLAG_EH_PENDING) { 720 + if (--ap->eh_tries) { 721 + spin_unlock_irqrestore(ap->lock, flags); 722 + goto repeat; 723 + } 724 + ata_port_err(ap, 725 + "EH pending after %d tries, giving up\n", 726 + ATA_EH_MAX_TRIES); 727 + ap->pflags &= ~ATA_PFLAG_EH_PENDING; 728 + } 729 + 730 + /* this run is complete, make sure EH info is clear */ 731 + ata_for_each_link(link, ap, HOST_FIRST) 732 + memset(&link->eh_info, 0, sizeof(link->eh_info)); 733 + 734 + /* 735 + * end eh (clear host_eh_scheduled) while holding ap->lock such that if 736 + * exception occurs after this point but before EH completion, SCSI 737 + * midlayer will re-initiate EH. 738 + */ 739 + ap->ops->end_eh(ap); 740 + 741 + spin_unlock_irqrestore(ap->lock, flags); 742 + ata_eh_release(ap); 747 743 748 744 scsi_eh_flush_done_q(&ap->eh_done_q); 749 745 ··· 902 912 { 903 913 struct ata_port *ap = qc->ap; 904 914 905 - WARN_ON(!ap->ops->error_handler); 906 - 907 915 qc->flags |= ATA_QCFLAG_EH; 908 916 ata_eh_set_pending(ap, 1); 909 917 ··· 922 934 */ 923 935 void ata_std_sched_eh(struct ata_port *ap) 924 936 { 925 - WARN_ON(!ap->ops->error_handler); 926 - 927 937 if (ap->pflags & ATA_PFLAG_INITIALIZING) 928 938 return; 929 939 ··· 974 988 { 975 989 struct ata_queued_cmd *qc; 976 990 int tag, nr_aborted = 0; 977 - 978 - WARN_ON(!ap->ops->error_handler); 979 991 980 992 /* we're gonna abort all commands, no need for fast drain */ 981 993 ata_eh_set_pending(ap, 0); ··· 1049 1065 */ 1050 1066 static void __ata_port_freeze(struct ata_port *ap) 1051 1067 { 1052 - WARN_ON(!ap->ops->error_handler); 1053 - 1054 1068 if (ap->ops->freeze) 1055 1069 ap->ops->freeze(ap); 1056 1070 ··· 1073 1091 */ 1074 1092 int ata_port_freeze(struct ata_port *ap) 1075 1093 { 1076 - WARN_ON(!ap->ops->error_handler); 1077 - 1078 1094 __ata_port_freeze(ap); 1079 1095 1080 1096 return ata_port_abort(ap); ··· 1092 1112 { 1093 1113 unsigned long flags; 1094 1114 1095 - if (!ap->ops->error_handler) 1096 - return; 1097 - 1098 1115 spin_lock_irqsave(ap->lock, flags); 1099 1116 __ata_port_freeze(ap); 1100 1117 spin_unlock_irqrestore(ap->lock, flags); ··· 1110 1133 void ata_eh_thaw_port(struct ata_port *ap) 1111 1134 { 1112 1135 unsigned long flags; 1113 - 1114 - if (!ap->ops->error_handler) 1115 - return; 1116 1136 1117 1137 spin_lock_irqsave(ap->lock, flags); 1118 1138 ··· 2549 2575 /* 2550 2576 * Prepare to reset 2551 2577 */ 2552 - while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) 2578 + while (ata_eh_reset_timeouts[max_tries] != UINT_MAX) 2553 2579 max_tries++; 2554 2580 if (link->flags & ATA_LFLAG_RST_ONCE) 2555 2581 max_tries = 1;
+9 -103
drivers/ata/libata-sata.c
··· 19 19 #include "libata-transport.h" 20 20 21 21 /* debounce timing parameters in msecs { interval, duration, timeout } */ 22 - const unsigned long sata_deb_timing_normal[] = { 5, 100, 2000 }; 22 + const unsigned int sata_deb_timing_normal[] = { 5, 100, 2000 }; 23 23 EXPORT_SYMBOL_GPL(sata_deb_timing_normal); 24 - const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 }; 24 + const unsigned int sata_deb_timing_hotplug[] = { 25, 500, 2000 }; 25 25 EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug); 26 - const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 }; 26 + const unsigned int sata_deb_timing_long[] = { 100, 2000, 5000 }; 27 27 EXPORT_SYMBOL_GPL(sata_deb_timing_long); 28 28 29 29 /** ··· 232 232 * RETURNS: 233 233 * 0 on success, -errno on failure. 234 234 */ 235 - int sata_link_debounce(struct ata_link *link, const unsigned long *params, 235 + int sata_link_debounce(struct ata_link *link, const unsigned int *params, 236 236 unsigned long deadline) 237 237 { 238 - unsigned long interval = params[0]; 239 - unsigned long duration = params[1]; 238 + unsigned int interval = params[0]; 239 + unsigned int duration = params[1]; 240 240 unsigned long last_jiffies, t; 241 241 u32 last, cur; 242 242 int rc; ··· 295 295 * RETURNS: 296 296 * 0 on success, -errno on failure. 297 297 */ 298 - int sata_link_resume(struct ata_link *link, const unsigned long *params, 298 + int sata_link_resume(struct ata_link *link, const unsigned int *params, 299 299 unsigned long deadline) 300 300 { 301 301 int tries = ATA_LINK_RESUME_TRIES; ··· 528 528 * RETURNS: 529 529 * 0 on success, -errno otherwise. 530 530 */ 531 - int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, 531 + int sata_link_hardreset(struct ata_link *link, const unsigned int *timing, 532 532 unsigned long deadline, 533 533 bool *online, int (*check_ready)(struct ata_link *)) 534 534 { ··· 1139 1139 ap->flags |= port_info->flags; 1140 1140 ap->ops = port_info->port_ops; 1141 1141 ap->cbl = ATA_CBL_SATA; 1142 + ap->print_id = atomic_inc_return(&ata_print_id); 1142 1143 1143 1144 return ap; 1144 1145 } 1145 1146 EXPORT_SYMBOL_GPL(ata_sas_port_alloc); 1146 - 1147 - /** 1148 - * ata_sas_port_start - Set port up for dma. 1149 - * @ap: Port to initialize 1150 - * 1151 - * Called just after data structures for each port are 1152 - * initialized. 1153 - * 1154 - * May be used as the port_start() entry in ata_port_operations. 1155 - * 1156 - * LOCKING: 1157 - * Inherited from caller. 1158 - */ 1159 - int ata_sas_port_start(struct ata_port *ap) 1160 - { 1161 - /* 1162 - * the port is marked as frozen at allocation time, but if we don't 1163 - * have new eh, we won't thaw it 1164 - */ 1165 - if (!ap->ops->error_handler) 1166 - ap->pflags &= ~ATA_PFLAG_FROZEN; 1167 - return 0; 1168 - } 1169 - EXPORT_SYMBOL_GPL(ata_sas_port_start); 1170 - 1171 - /** 1172 - * ata_sas_port_stop - Undo ata_sas_port_start() 1173 - * @ap: Port to shut down 1174 - * 1175 - * May be used as the port_stop() entry in ata_port_operations. 1176 - * 1177 - * LOCKING: 1178 - * Inherited from caller. 1179 - */ 1180 - 1181 - void ata_sas_port_stop(struct ata_port *ap) 1182 - { 1183 - } 1184 - EXPORT_SYMBOL_GPL(ata_sas_port_stop); 1185 - 1186 - /** 1187 - * ata_sas_async_probe - simply schedule probing and return 1188 - * @ap: Port to probe 1189 - * 1190 - * For batch scheduling of probe for sas attached ata devices, assumes 1191 - * the port has already been through ata_sas_port_init() 1192 - */ 1193 - void ata_sas_async_probe(struct ata_port *ap) 1194 - { 1195 - __ata_port_probe(ap); 1196 - } 1197 - EXPORT_SYMBOL_GPL(ata_sas_async_probe); 1198 - 1199 - int ata_sas_sync_probe(struct ata_port *ap) 1200 - { 1201 - return ata_port_probe(ap); 1202 - } 1203 - EXPORT_SYMBOL_GPL(ata_sas_sync_probe); 1204 - 1205 - 1206 - /** 1207 - * ata_sas_port_init - Initialize a SATA device 1208 - * @ap: SATA port to initialize 1209 - * 1210 - * LOCKING: 1211 - * PCI/etc. bus probe sem. 1212 - * 1213 - * RETURNS: 1214 - * Zero on success, non-zero on error. 1215 - */ 1216 - 1217 - int ata_sas_port_init(struct ata_port *ap) 1218 - { 1219 - int rc = ap->ops->port_start(ap); 1220 - 1221 - if (rc) 1222 - return rc; 1223 - ap->print_id = atomic_inc_return(&ata_print_id); 1224 - return 0; 1225 - } 1226 - EXPORT_SYMBOL_GPL(ata_sas_port_init); 1227 1147 1228 1148 int ata_sas_tport_add(struct device *parent, struct ata_port *ap) 1229 1149 { ··· 1156 1236 ata_tport_delete(ap); 1157 1237 } 1158 1238 EXPORT_SYMBOL_GPL(ata_sas_tport_delete); 1159 - 1160 - /** 1161 - * ata_sas_port_destroy - Destroy a SATA port allocated by ata_sas_port_alloc 1162 - * @ap: SATA port to destroy 1163 - * 1164 - */ 1165 - 1166 - void ata_sas_port_destroy(struct ata_port *ap) 1167 - { 1168 - if (ap->ops->port_stop) 1169 - ap->ops->port_stop(ap); 1170 - kfree(ap); 1171 - } 1172 - EXPORT_SYMBOL_GPL(ata_sas_port_destroy); 1173 1239 1174 1240 /** 1175 1241 * ata_sas_slave_configure - Default slave_config routine for libata devices
+13 -152
drivers/ata/libata-scsi.c
··· 135 135 struct scsi_device *sdev = to_scsi_device(device); 136 136 struct ata_port *ap; 137 137 struct ata_device *dev; 138 - long int input; 138 + int input; 139 139 unsigned long flags; 140 140 int rc; 141 141 142 - rc = kstrtol(buf, 10, &input); 142 + rc = kstrtoint(buf, 10, &input); 143 143 if (rc) 144 144 return rc; 145 145 if (input < -2) ··· 710 710 } 711 711 712 712 /** 713 - * ata_dump_status - user friendly display of error info 714 - * @ap: the port in question 715 - * @tf: ptr to filled out taskfile 716 - * 717 - * Decode and dump the ATA error/status registers for the user so 718 - * that they have some idea what really happened at the non 719 - * make-believe layer. 720 - * 721 - * LOCKING: 722 - * inherited from caller 723 - */ 724 - static void ata_dump_status(struct ata_port *ap, struct ata_taskfile *tf) 725 - { 726 - u8 stat = tf->status, err = tf->error; 727 - 728 - if (stat & ATA_BUSY) { 729 - ata_port_warn(ap, "status=0x%02x {Busy} ", stat); 730 - } else { 731 - ata_port_warn(ap, "status=0x%02x { %s%s%s%s%s%s%s} ", stat, 732 - stat & ATA_DRDY ? "DriveReady " : "", 733 - stat & ATA_DF ? "DeviceFault " : "", 734 - stat & ATA_DSC ? "SeekComplete " : "", 735 - stat & ATA_DRQ ? "DataRequest " : "", 736 - stat & ATA_CORR ? "CorrectedError " : "", 737 - stat & ATA_SENSE ? "Sense " : "", 738 - stat & ATA_ERR ? "Error " : ""); 739 - if (err) 740 - ata_port_warn(ap, "error=0x%02x {%s%s%s%s%s%s", err, 741 - err & ATA_ABORTED ? 742 - "DriveStatusError " : "", 743 - err & ATA_ICRC ? 744 - (err & ATA_ABORTED ? 745 - "BadCRC " : "Sector ") : "", 746 - err & ATA_UNC ? "UncorrectableError " : "", 747 - err & ATA_IDNF ? "SectorIdNotFound " : "", 748 - err & ATA_TRK0NF ? "TrackZeroNotFound " : "", 749 - err & ATA_AMNF ? "AddrMarkNotFound " : ""); 750 - } 751 - } 752 - 753 - /** 754 713 * ata_to_sense_error - convert ATA error to SCSI error 755 714 * @id: ATA device number 756 715 * @drv_stat: value contained in ATA status register ··· 717 758 * @sk: the sense key we'll fill out 718 759 * @asc: the additional sense code we'll fill out 719 760 * @ascq: the additional sense code qualifier we'll fill out 720 - * @verbose: be verbose 721 761 * 722 762 * Converts an ATA error into a SCSI error. Fill out pointers to 723 763 * SK, ASC, and ASCQ bytes for later use in fixed or descriptor ··· 726 768 * spin_lock_irqsave(host lock) 727 769 */ 728 770 static void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, 729 - u8 *asc, u8 *ascq, int verbose) 771 + u8 *asc, u8 *ascq) 730 772 { 731 773 int i; 732 774 ··· 805 847 *sk = sense_table[i][1]; 806 848 *asc = sense_table[i][2]; 807 849 *ascq = sense_table[i][3]; 808 - goto translate_done; 850 + return; 809 851 } 810 852 } 811 853 } ··· 820 862 *sk = stat_table[i][1]; 821 863 *asc = stat_table[i][2]; 822 864 *ascq = stat_table[i][3]; 823 - goto translate_done; 865 + return; 824 866 } 825 867 } 826 868 ··· 831 873 *sk = ABORTED_COMMAND; 832 874 *asc = 0x00; 833 875 *ascq = 0x00; 834 - 835 - translate_done: 836 - if (verbose) 837 - pr_err("ata%u: translated ATA stat/err 0x%02x/%02x to SCSI SK/ASC/ASCQ 0x%x/%02x/%02x\n", 838 - id, drv_stat, drv_err, *sk, *asc, *ascq); 839 - return; 840 876 } 841 877 842 878 /* ··· 856 904 struct ata_taskfile *tf = &qc->result_tf; 857 905 unsigned char *sb = cmd->sense_buffer; 858 906 unsigned char *desc = sb + 8; 859 - int verbose = qc->ap->ops->error_handler == NULL; 860 907 u8 sense_key, asc, ascq; 861 908 862 909 memset(sb, 0, SCSI_SENSE_BUFFERSIZE); ··· 867 916 if (qc->err_mask || 868 917 tf->status & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { 869 918 ata_to_sense_error(qc->ap->print_id, tf->status, tf->error, 870 - &sense_key, &asc, &ascq, verbose); 919 + &sense_key, &asc, &ascq); 871 920 ata_scsi_set_sense(qc->dev, cmd, sense_key, asc, ascq); 872 921 } else { 873 922 /* ··· 950 999 struct scsi_cmnd *cmd = qc->scsicmd; 951 1000 struct ata_taskfile *tf = &qc->result_tf; 952 1001 unsigned char *sb = cmd->sense_buffer; 953 - int verbose = qc->ap->ops->error_handler == NULL; 954 1002 u64 block; 955 1003 u8 sense_key, asc, ascq; 956 1004 ··· 967 1017 if (qc->err_mask || 968 1018 tf->status & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { 969 1019 ata_to_sense_error(qc->ap->print_id, tf->status, tf->error, 970 - &sense_key, &asc, &ascq, verbose); 1020 + &sense_key, &asc, &ascq); 971 1021 ata_scsi_set_sense(dev, cmd, sense_key, asc, ascq); 972 1022 } else { 973 1023 /* Could not decode error */ ··· 1135 1185 struct ata_port *ap = ata_shost_to_port(sdev->host); 1136 1186 unsigned long flags; 1137 1187 struct ata_device *dev; 1138 - 1139 - if (!ap->ops->error_handler) 1140 - return; 1141 1188 1142 1189 spin_lock_irqsave(ap->lock, flags); 1143 1190 dev = __ata_scsi_find_dev(ap, sdev); ··· 1622 1675 1623 1676 static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) 1624 1677 { 1625 - struct ata_port *ap = qc->ap; 1626 1678 struct scsi_cmnd *cmd = qc->scsicmd; 1627 1679 u8 *cdb = cmd->cmnd; 1628 1680 int need_sense = (qc->err_mask != 0) && ··· 1644 1698 else 1645 1699 /* Keep the SCSI ML and status byte, clear host byte. */ 1646 1700 cmd->result &= 0x0000ffff; 1647 - 1648 - if (need_sense && !ap->ops->error_handler) 1649 - ata_dump_status(ap, &qc->result_tf); 1650 1701 1651 1702 ata_qc_done(qc); 1652 1703 } ··· 2551 2608 return 0; 2552 2609 } 2553 2610 2554 - static void atapi_sense_complete(struct ata_queued_cmd *qc) 2555 - { 2556 - if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) { 2557 - /* FIXME: not quite right; we don't want the 2558 - * translation of taskfile registers into 2559 - * a sense descriptors, since that's only 2560 - * correct for ATA, not ATAPI 2561 - */ 2562 - ata_gen_passthru_sense(qc); 2563 - } 2564 - 2565 - ata_qc_done(qc); 2566 - } 2567 - 2568 - /* is it pointless to prefer PIO for "safety reasons"? */ 2569 - static inline int ata_pio_use_silly(struct ata_port *ap) 2570 - { 2571 - return (ap->flags & ATA_FLAG_PIO_DMA); 2572 - } 2573 - 2574 - static void atapi_request_sense(struct ata_queued_cmd *qc) 2575 - { 2576 - struct ata_port *ap = qc->ap; 2577 - struct scsi_cmnd *cmd = qc->scsicmd; 2578 - 2579 - memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); 2580 - 2581 - #ifdef CONFIG_ATA_SFF 2582 - if (ap->ops->sff_tf_read) 2583 - ap->ops->sff_tf_read(ap, &qc->tf); 2584 - #endif 2585 - 2586 - /* fill these in, for the case where they are -not- overwritten */ 2587 - cmd->sense_buffer[0] = 0x70; 2588 - cmd->sense_buffer[2] = qc->tf.error >> 4; 2589 - 2590 - ata_qc_reinit(qc); 2591 - 2592 - /* setup sg table and init transfer direction */ 2593 - sg_init_one(&qc->sgent, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); 2594 - ata_sg_init(qc, &qc->sgent, 1); 2595 - qc->dma_dir = DMA_FROM_DEVICE; 2596 - 2597 - memset(&qc->cdb, 0, qc->dev->cdb_len); 2598 - qc->cdb[0] = REQUEST_SENSE; 2599 - qc->cdb[4] = SCSI_SENSE_BUFFERSIZE; 2600 - 2601 - qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 2602 - qc->tf.command = ATA_CMD_PACKET; 2603 - 2604 - if (ata_pio_use_silly(ap)) { 2605 - qc->tf.protocol = ATAPI_PROT_DMA; 2606 - qc->tf.feature |= ATAPI_PKT_DMA; 2607 - } else { 2608 - qc->tf.protocol = ATAPI_PROT_PIO; 2609 - qc->tf.lbam = SCSI_SENSE_BUFFERSIZE; 2610 - qc->tf.lbah = 0; 2611 - } 2612 - qc->nbytes = SCSI_SENSE_BUFFERSIZE; 2613 - 2614 - qc->complete_fn = atapi_sense_complete; 2615 - 2616 - ata_qc_issue(qc); 2617 - } 2618 - 2619 2611 /* 2620 2612 * ATAPI devices typically report zero for their SCSI version, and sometimes 2621 2613 * deviate from the spec WRT response data format. If SCSI version is ··· 2576 2698 struct scsi_cmnd *cmd = qc->scsicmd; 2577 2699 unsigned int err_mask = qc->err_mask; 2578 2700 2579 - /* handle completion from new EH */ 2580 - if (unlikely(qc->ap->ops->error_handler && 2581 - (err_mask || qc->flags & ATA_QCFLAG_SENSE_VALID))) { 2701 + /* handle completion from EH */ 2702 + if (unlikely(err_mask || qc->flags & ATA_QCFLAG_SENSE_VALID)) { 2582 2703 2583 2704 if (!(qc->flags & ATA_QCFLAG_SENSE_VALID)) { 2584 2705 /* FIXME: not quite right; we don't want the ··· 2609 2732 return; 2610 2733 } 2611 2734 2612 - /* successful completion or old EH failure path */ 2613 - if (unlikely(err_mask & AC_ERR_DEV)) { 2614 - cmd->result = SAM_STAT_CHECK_CONDITION; 2615 - atapi_request_sense(qc); 2616 - return; 2617 - } else if (unlikely(err_mask)) { 2618 - /* FIXME: not quite right; we don't want the 2619 - * translation of taskfile registers into 2620 - * a sense descriptors, since that's only 2621 - * correct for ATA, not ATAPI 2622 - */ 2623 - ata_gen_passthru_sense(qc); 2624 - } else { 2625 - if (cmd->cmnd[0] == INQUIRY && (cmd->cmnd[1] & 0x03) == 0) 2626 - atapi_fixup_inquiry(cmd); 2627 - cmd->result = SAM_STAT_GOOD; 2628 - } 2735 + /* successful completion path */ 2736 + if (cmd->cmnd[0] == INQUIRY && (cmd->cmnd[1] & 0x03) == 0) 2737 + atapi_fixup_inquiry(cmd); 2738 + cmd->result = SAM_STAT_GOOD; 2629 2739 2630 2740 ata_qc_done(qc); 2631 2741 } ··· 4660 4796 struct ata_port *ap = ata_shost_to_port(shost); 4661 4797 unsigned long flags; 4662 4798 int devno, rc = 0; 4663 - 4664 - if (!ap->ops->error_handler) 4665 - return -EOPNOTSUPP; 4666 4799 4667 4800 if (lun != SCAN_WILD_CARD && lun) 4668 4801 return -EINVAL;
+11 -21
drivers/ata/libata-sff.c
··· 883 883 { 884 884 struct ata_port *ap = qc->ap; 885 885 886 - if (ap->ops->error_handler) { 887 - if (in_wq) { 888 - /* EH might have kicked in while host lock is 889 - * released. 890 - */ 891 - qc = ata_qc_from_tag(ap, qc->tag); 892 - if (qc) { 893 - if (likely(!(qc->err_mask & AC_ERR_HSM))) { 894 - ata_sff_irq_on(ap); 895 - ata_qc_complete(qc); 896 - } else 897 - ata_port_freeze(ap); 898 - } 899 - } else { 900 - if (likely(!(qc->err_mask & AC_ERR_HSM))) 886 + if (in_wq) { 887 + /* EH might have kicked in while host lock is released. */ 888 + qc = ata_qc_from_tag(ap, qc->tag); 889 + if (qc) { 890 + if (likely(!(qc->err_mask & AC_ERR_HSM))) { 891 + ata_sff_irq_on(ap); 901 892 ata_qc_complete(qc); 902 - else 893 + } else 903 894 ata_port_freeze(ap); 904 895 } 905 896 } else { 906 - if (in_wq) { 907 - ata_sff_irq_on(ap); 897 + if (likely(!(qc->err_mask & AC_ERR_HSM))) 908 898 ata_qc_complete(qc); 909 - } else 910 - ata_qc_complete(qc); 899 + else 900 + ata_port_freeze(ap); 911 901 } 912 902 } 913 903 ··· 1961 1971 unsigned long deadline) 1962 1972 { 1963 1973 struct ata_eh_context *ehc = &link->eh_context; 1964 - const unsigned long *timing = sata_ehc_deb_timing(ehc); 1974 + const unsigned int *timing = sata_ehc_deb_timing(ehc); 1965 1975 bool online; 1966 1976 int rc; 1967 1977
-3
drivers/ata/libata.h
··· 78 78 extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); 79 79 extern struct ata_port *ata_port_alloc(struct ata_host *host); 80 80 extern const char *sata_spd_string(unsigned int spd); 81 - extern int ata_port_probe(struct ata_port *ap); 82 - extern void __ata_port_probe(struct ata_port *ap); 83 81 extern unsigned int ata_read_log_page(struct ata_device *dev, u8 log, 84 82 u8 page, void *buf, unsigned int sectors); 85 83 ··· 122 124 extern void ata_scsi_hotplug(struct work_struct *work); 123 125 extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); 124 126 extern void ata_scsi_dev_rescan(struct work_struct *work); 125 - extern int ata_bus_probe(struct ata_port *ap); 126 127 extern int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, 127 128 unsigned int id, u64 lun); 128 129 void ata_scsi_sdev_config(struct scsi_device *sdev);
+2 -4
drivers/ata/pata_arasan_cf.c
··· 917 917 return ret; 918 918 } 919 919 920 - static int arasan_cf_remove(struct platform_device *pdev) 920 + static void arasan_cf_remove(struct platform_device *pdev) 921 921 { 922 922 struct ata_host *host = platform_get_drvdata(pdev); 923 923 struct arasan_cf_dev *acdev = host->ports[0]->private_data; 924 924 925 925 ata_host_detach(host); 926 926 cf_exit(acdev); 927 - 928 - return 0; 929 927 } 930 928 931 929 #ifdef CONFIG_PM_SLEEP ··· 964 966 965 967 static struct platform_driver arasan_cf_driver = { 966 968 .probe = arasan_cf_probe, 967 - .remove = arasan_cf_remove, 969 + .remove_new = arasan_cf_remove, 968 970 .driver = { 969 971 .name = DRIVER_NAME, 970 972 .pm = &arasan_cf_pm_ops,
-1
drivers/ata/pata_buddha.c
··· 27 27 28 28 #include <asm/amigahw.h> 29 29 #include <asm/amigaints.h> 30 - #include <asm/ide.h> 31 30 #include <asm/setup.h> 32 31 33 32 #define DRV_NAME "pata_buddha"
+15 -10
drivers/ata/pata_ep93xx.c
··· 40 40 #include <linux/ata.h> 41 41 #include <linux/libata.h> 42 42 #include <linux/platform_device.h> 43 + #include <linux/sys_soc.h> 43 44 #include <linux/delay.h> 44 45 #include <linux/dmaengine.h> 45 46 #include <linux/ktime.h> ··· 911 910 .port_start = ep93xx_pata_port_start, 912 911 }; 913 912 913 + static const struct soc_device_attribute ep93xx_soc_table[] = { 914 + { .revision = "E1", .data = (void *)ATA_UDMA3 }, 915 + { .revision = "E2", .data = (void *)ATA_UDMA4 }, 916 + { /* sentinel */ } 917 + }; 918 + 914 919 static int ep93xx_pata_probe(struct platform_device *pdev) 915 920 { 916 921 struct ep93xx_pata_data *drv_data; ··· 946 939 947 940 drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL); 948 941 if (!drv_data) { 949 - err = -ENXIO; 942 + err = -ENOMEM; 950 943 goto err_rel_gpio; 951 944 } 952 945 ··· 959 952 /* allocate host */ 960 953 host = ata_host_alloc(&pdev->dev, 1); 961 954 if (!host) { 962 - err = -ENXIO; 955 + err = -ENOMEM; 963 956 goto err_rel_dma; 964 957 } 965 958 ··· 983 976 * so this driver supports only UDMA modes. 984 977 */ 985 978 if (drv_data->dma_rx_channel && drv_data->dma_tx_channel) { 986 - int chip_rev = ep93xx_chip_revision(); 979 + const struct soc_device_attribute *match; 987 980 988 - if (chip_rev == EP93XX_CHIP_REV_E1) 989 - ap->udma_mask = ATA_UDMA3; 990 - else if (chip_rev == EP93XX_CHIP_REV_E2) 991 - ap->udma_mask = ATA_UDMA4; 981 + match = soc_device_match(ep93xx_soc_table); 982 + if (match) 983 + ap->udma_mask = (unsigned int) match->data; 992 984 else 993 985 ap->udma_mask = ATA_UDMA2; 994 986 } ··· 1010 1004 return err; 1011 1005 } 1012 1006 1013 - static int ep93xx_pata_remove(struct platform_device *pdev) 1007 + static void ep93xx_pata_remove(struct platform_device *pdev) 1014 1008 { 1015 1009 struct ata_host *host = platform_get_drvdata(pdev); 1016 1010 struct ep93xx_pata_data *drv_data = host->private_data; ··· 1019 1013 ep93xx_pata_release_dma(drv_data); 1020 1014 ep93xx_pata_clear_regs(drv_data->ide_base); 1021 1015 ep93xx_ide_release_gpio(pdev); 1022 - return 0; 1023 1016 } 1024 1017 1025 1018 static struct platform_driver ep93xx_pata_platform_driver = { ··· 1026 1021 .name = DRV_NAME, 1027 1022 }, 1028 1023 .probe = ep93xx_pata_probe, 1029 - .remove = ep93xx_pata_remove, 1024 + .remove_new = ep93xx_pata_remove, 1030 1025 }; 1031 1026 1032 1027 module_platform_driver(ep93xx_pata_platform_driver);
+38 -21
drivers/ata/pata_falcon.c
··· 28 28 #include <asm/atarihw.h> 29 29 #include <asm/atariints.h> 30 30 #include <asm/atari_stdma.h> 31 - #include <asm/ide.h> 32 31 33 32 #define DRV_NAME "pata_falcon" 34 33 #define DRV_VERSION "0.1.0" 34 + 35 + static int pata_falcon_swap_mask; 36 + 37 + module_param_named(data_swab, pata_falcon_swap_mask, int, 0444); 38 + MODULE_PARM_DESC(data_swab, "Data byte swap enable/disable bitmap (0x1==drive1, 0x2==drive2, 0x4==drive3, 0x8==drive4, default==0)"); 35 39 36 40 static const struct scsi_host_template pata_falcon_sht = { 37 41 ATA_PIO_SHT(DRV_NAME), ··· 54 50 55 51 if (dev->class == ATA_DEV_ATA && cmd && 56 52 !blk_rq_is_passthrough(scsi_cmd_to_rq(cmd))) 57 - swap = 0; 53 + swap = (uintptr_t)ap->private_data & BIT(dev->devno); 58 54 59 55 /* Transfer multiple of 2 bytes */ 60 56 if (rw == READ) { ··· 127 123 struct resource *base_res, *ctl_res, *irq_res; 128 124 struct ata_host *host; 129 125 struct ata_port *ap; 130 - void __iomem *base; 131 - int irq = 0; 126 + void __iomem *base, *ctl_base; 127 + int mask_shift = 0; /* Q40 & Falcon default */ 128 + int irq = 0, io_offset = 1, reg_shift = 2; /* Falcon defaults */ 132 129 133 130 dev_info(&pdev->dev, "Atari Falcon and Q40/Q60 PATA controller\n"); 134 131 ··· 170 165 ap->pio_mask = ATA_PIO4; 171 166 ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY; 172 167 173 - base = (void __iomem *)base_mem_res->start; 174 168 /* N.B. this assumes data_addr will be used for word-sized I/O only */ 175 - ap->ioaddr.data_addr = base + 0 + 0 * 4; 176 - ap->ioaddr.error_addr = base + 1 + 1 * 4; 177 - ap->ioaddr.feature_addr = base + 1 + 1 * 4; 178 - ap->ioaddr.nsect_addr = base + 1 + 2 * 4; 179 - ap->ioaddr.lbal_addr = base + 1 + 3 * 4; 180 - ap->ioaddr.lbam_addr = base + 1 + 4 * 4; 181 - ap->ioaddr.lbah_addr = base + 1 + 5 * 4; 182 - ap->ioaddr.device_addr = base + 1 + 6 * 4; 183 - ap->ioaddr.status_addr = base + 1 + 7 * 4; 184 - ap->ioaddr.command_addr = base + 1 + 7 * 4; 169 + ap->ioaddr.data_addr = (void __iomem *)base_mem_res->start; 185 170 186 - base = (void __iomem *)ctl_mem_res->start; 187 - ap->ioaddr.altstatus_addr = base + 1; 188 - ap->ioaddr.ctl_addr = base + 1; 171 + if (base_res) { /* only Q40 has IO resources */ 172 + io_offset = 0x10000; 173 + reg_shift = 0; 174 + base = (void __iomem *)base_res->start; 175 + ctl_base = (void __iomem *)ctl_res->start; 176 + } else { 177 + base = (void __iomem *)base_mem_res->start; 178 + ctl_base = (void __iomem *)ctl_mem_res->start; 179 + } 189 180 190 - ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", 191 - (unsigned long)base_mem_res->start, 192 - (unsigned long)ctl_mem_res->start); 181 + ap->ioaddr.error_addr = base + io_offset + (1 << reg_shift); 182 + ap->ioaddr.feature_addr = base + io_offset + (1 << reg_shift); 183 + ap->ioaddr.nsect_addr = base + io_offset + (2 << reg_shift); 184 + ap->ioaddr.lbal_addr = base + io_offset + (3 << reg_shift); 185 + ap->ioaddr.lbam_addr = base + io_offset + (4 << reg_shift); 186 + ap->ioaddr.lbah_addr = base + io_offset + (5 << reg_shift); 187 + ap->ioaddr.device_addr = base + io_offset + (6 << reg_shift); 188 + ap->ioaddr.status_addr = base + io_offset + (7 << reg_shift); 189 + ap->ioaddr.command_addr = base + io_offset + (7 << reg_shift); 190 + 191 + ap->ioaddr.altstatus_addr = ctl_base + io_offset; 192 + ap->ioaddr.ctl_addr = ctl_base + io_offset; 193 + 194 + ata_port_desc(ap, "cmd %px ctl %px data %px", 195 + base, ctl_base, ap->ioaddr.data_addr); 196 + 197 + if (pdev->id > 0) 198 + mask_shift = 2; 199 + ap->private_data = (void *)(uintptr_t)(pata_falcon_swap_mask >> mask_shift); 193 200 194 201 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 195 202 if (irq_res && irq_res->start > 0) {
+5 -11
drivers/ata/pata_ftide010.c
··· 14 14 #include <linux/module.h> 15 15 #include <linux/libata.h> 16 16 #include <linux/bitops.h> 17 - #include <linux/of_address.h> 18 - #include <linux/of_device.h> 17 + #include <linux/of.h> 19 18 #include <linux/clk.h> 20 19 #include "sata_gemini.h" 21 20 ··· 469 470 if (irq < 0) 470 471 return irq; 471 472 472 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 473 - if (!res) 474 - return -ENODEV; 475 - 476 - ftide->base = devm_ioremap_resource(dev, res); 473 + ftide->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 477 474 if (IS_ERR(ftide->base)) 478 475 return PTR_ERR(ftide->base); 479 476 ··· 536 541 return ret; 537 542 } 538 543 539 - static int pata_ftide010_remove(struct platform_device *pdev) 544 + static void pata_ftide010_remove(struct platform_device *pdev) 540 545 { 541 546 struct ata_host *host = platform_get_drvdata(pdev); 542 547 struct ftide010 *ftide = host->private_data; 543 548 544 549 ata_host_detach(ftide->host); 545 550 clk_disable_unprepare(ftide->pclk); 546 - 547 - return 0; 548 551 } 549 552 550 553 static const struct of_device_id pata_ftide010_of_match[] = { ··· 556 563 .of_match_table = pata_ftide010_of_match, 557 564 }, 558 565 .probe = pata_ftide010_probe, 559 - .remove = pata_ftide010_remove, 566 + .remove_new = pata_ftide010_remove, 560 567 }; 561 568 module_platform_driver(pata_ftide010_driver); 562 569 570 + MODULE_DESCRIPTION("low level driver for Faraday Technology FTIDE010"); 563 571 MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>"); 564 572 MODULE_LICENSE("GPL"); 565 573 MODULE_ALIAS("platform:" DRV_NAME);
-1
drivers/ata/pata_gayle.c
··· 27 27 #include <asm/amigahw.h> 28 28 #include <asm/amigaints.h> 29 29 #include <asm/amigayle.h> 30 - #include <asm/ide.h> 31 30 #include <asm/setup.h> 32 31 33 32 #define DRV_NAME "pata_gayle"
+10 -27
drivers/ata/pata_imx.c
··· 141 141 if (!priv) 142 142 return -ENOMEM; 143 143 144 - priv->clk = devm_clk_get(&pdev->dev, NULL); 144 + priv->clk = devm_clk_get_enabled(&pdev->dev, NULL); 145 145 if (IS_ERR(priv->clk)) { 146 - dev_err(&pdev->dev, "Failed to get clock\n"); 146 + dev_err(&pdev->dev, "Failed to get and enable clock\n"); 147 147 return PTR_ERR(priv->clk); 148 148 } 149 149 150 - ret = clk_prepare_enable(priv->clk); 151 - if (ret) 152 - return ret; 153 - 154 150 host = ata_host_alloc(&pdev->dev, 1); 155 - if (!host) { 156 - ret = -ENOMEM; 157 - goto err; 158 - } 151 + if (!host) 152 + return -ENOMEM; 159 153 160 154 host->private_data = priv; 161 155 ap = host->ports[0]; ··· 158 164 ap->pio_mask = ATA_PIO4; 159 165 ap->flags |= ATA_FLAG_SLAVE_POSS; 160 166 161 - io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 162 - priv->host_regs = devm_ioremap_resource(&pdev->dev, io_res); 163 - if (IS_ERR(priv->host_regs)) { 164 - ret = PTR_ERR(priv->host_regs); 165 - goto err; 166 - } 167 + priv->host_regs = devm_platform_get_and_ioremap_resource(pdev, 0, &io_res); 168 + if (IS_ERR(priv->host_regs)) 169 + return PTR_ERR(priv->host_regs); 167 170 168 171 ap->ioaddr.cmd_addr = priv->host_regs + PATA_IMX_DRIVE_DATA; 169 172 ap->ioaddr.ctl_addr = priv->host_regs + PATA_IMX_DRIVE_CONTROL; ··· 186 195 &pata_imx_sht); 187 196 188 197 if (ret) 189 - goto err; 198 + return ret; 190 199 191 200 return 0; 192 - err: 193 - clk_disable_unprepare(priv->clk); 194 - 195 - return ret; 196 201 } 197 202 198 - static int pata_imx_remove(struct platform_device *pdev) 203 + static void pata_imx_remove(struct platform_device *pdev) 199 204 { 200 205 struct ata_host *host = platform_get_drvdata(pdev); 201 206 struct pata_imx_priv *priv = host->private_data; ··· 199 212 ata_host_detach(host); 200 213 201 214 __raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN); 202 - 203 - clk_disable_unprepare(priv->clk); 204 - 205 - return 0; 206 215 } 207 216 208 217 #ifdef CONFIG_PM_SLEEP ··· 249 266 250 267 static struct platform_driver pata_imx_driver = { 251 268 .probe = pata_imx_probe, 252 - .remove = pata_imx_remove, 269 + .remove_new = pata_imx_remove, 253 270 .driver = { 254 271 .name = DRV_NAME, 255 272 .of_match_table = imx_pata_dt_ids,
+9 -15
drivers/ata/pata_ixp4xx_cf.c
··· 242 242 int ret; 243 243 int irq; 244 244 245 - cmd = platform_get_resource(pdev, IORESOURCE_MEM, 0); 246 - ctl = platform_get_resource(pdev, IORESOURCE_MEM, 1); 247 - 248 - if (!cmd || !ctl) 249 - return -EINVAL; 250 - 251 245 ixpp = devm_kzalloc(dev, sizeof(*ixpp), GFP_KERNEL); 252 246 if (!ixpp) 253 247 return -ENOMEM; ··· 265 271 if (ret) 266 272 return ret; 267 273 268 - ixpp->cmd = devm_ioremap_resource(dev, cmd); 269 - ixpp->ctl = devm_ioremap_resource(dev, ctl); 270 - if (IS_ERR(ixpp->cmd) || IS_ERR(ixpp->ctl)) 271 - return -ENOMEM; 274 + ixpp->cmd = devm_platform_get_and_ioremap_resource(pdev, 0, &cmd); 275 + if (IS_ERR(ixpp->cmd)) 276 + return PTR_ERR(ixpp->cmd); 277 + 278 + ixpp->ctl = devm_platform_get_and_ioremap_resource(pdev, 1, &ctl); 279 + if (IS_ERR(ixpp->ctl)) 280 + return PTR_ERR(ixpp->ctl); 272 281 273 282 irq = platform_get_irq(pdev, 0); 274 - if (irq > 0) 275 - irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING); 276 - else if (irq < 0) 283 + if (irq < 0) 277 284 return irq; 278 - else 279 - return -EINVAL; 285 + irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING); 280 286 281 287 /* Just one port to set up */ 282 288 ixp4xx_setup_port(ixpp->host->ports[0], ixpp, cmd->start, ctl->start);
+4 -6
drivers/ata/pata_mpc52xx.c
··· 19 19 #include <linux/gfp.h> 20 20 #include <linux/delay.h> 21 21 #include <linux/libata.h> 22 + #include <linux/of.h> 22 23 #include <linux/of_address.h> 23 24 #include <linux/of_irq.h> 24 - #include <linux/of_platform.h> 25 + #include <linux/platform_device.h> 25 26 #include <linux/types.h> 26 27 27 28 #include <asm/cacheflush.h> ··· 801 800 return rv; 802 801 } 803 802 804 - static int 805 - mpc52xx_ata_remove(struct platform_device *op) 803 + static void mpc52xx_ata_remove(struct platform_device *op) 806 804 { 807 805 struct ata_host *host = platform_get_drvdata(op); 808 806 struct mpc52xx_ata_priv *priv = host->private_data; ··· 815 815 irq_dispose_mapping(task_irq); 816 816 bcom_ata_release(priv->dmatsk); 817 817 irq_dispose_mapping(priv->ata_irq); 818 - 819 - return 0; 820 818 } 821 819 822 820 #ifdef CONFIG_PM_SLEEP ··· 855 857 856 858 static struct platform_driver mpc52xx_ata_of_platform_driver = { 857 859 .probe = mpc52xx_ata_probe, 858 - .remove = mpc52xx_ata_remove, 860 + .remove_new = mpc52xx_ata_remove, 859 861 #ifdef CONFIG_PM_SLEEP 860 862 .suspend = mpc52xx_ata_suspend, 861 863 .resume = mpc52xx_ata_resume,
+2 -4
drivers/ata/pata_pxa.c
··· 295 295 return ret; 296 296 } 297 297 298 - static int pxa_ata_remove(struct platform_device *pdev) 298 + static void pxa_ata_remove(struct platform_device *pdev) 299 299 { 300 300 struct ata_host *host = platform_get_drvdata(pdev); 301 301 struct pata_pxa_data *data = host->ports[0]->private_data; ··· 303 303 dma_release_channel(data->dma_chan); 304 304 305 305 ata_host_detach(host); 306 - 307 - return 0; 308 306 } 309 307 310 308 static struct platform_driver pxa_ata_driver = { 311 309 .probe = pxa_ata_probe, 312 - .remove = pxa_ata_remove, 310 + .remove_new = pxa_ata_remove, 313 311 .driver = { 314 312 .name = DRV_NAME, 315 313 },
+2 -4
drivers/ata/pata_rb532_cf.c
··· 155 155 return 0; 156 156 } 157 157 158 - static int rb532_pata_driver_remove(struct platform_device *pdev) 158 + static void rb532_pata_driver_remove(struct platform_device *pdev) 159 159 { 160 160 struct ata_host *ah = platform_get_drvdata(pdev); 161 161 162 162 ata_host_detach(ah); 163 - 164 - return 0; 165 163 } 166 164 167 165 static struct platform_driver rb532_pata_platform_driver = { 168 166 .probe = rb532_pata_driver_probe, 169 - .remove = rb532_pata_driver_remove, 167 + .remove_new = rb532_pata_driver_remove, 170 168 .driver = { 171 169 .name = DRV_NAME, 172 170 },
+1 -2
drivers/ata/pata_sl82c105.c
··· 180 180 * document. 181 181 * 182 182 * This function is also called to turn off DMA when a timeout occurs 183 - * during DMA operation. In both cases we need to reset the engine, 184 - * so no actual eng_timeout handler is required. 183 + * during DMA operation. In both cases we need to reset the engine. 185 184 * 186 185 * We assume bmdma_stop is always called if bmdma_start as called. If 187 186 * not then we may need to wrap qc_issue.
+3 -5
drivers/ata/sata_dwc_460ex.c
··· 18 18 #include <linux/module.h> 19 19 #include <linux/device.h> 20 20 #include <linux/dmaengine.h> 21 - #include <linux/of_address.h> 21 + #include <linux/of.h> 22 22 #include <linux/of_irq.h> 23 - #include <linux/of_platform.h> 24 23 #include <linux/platform_device.h> 25 24 #include <linux/phy/phy.h> 26 25 #include <linux/libata.h> ··· 1210 1211 return err; 1211 1212 } 1212 1213 1213 - static int sata_dwc_remove(struct platform_device *ofdev) 1214 + static void sata_dwc_remove(struct platform_device *ofdev) 1214 1215 { 1215 1216 struct device *dev = &ofdev->dev; 1216 1217 struct ata_host *host = dev_get_drvdata(dev); ··· 1226 1227 #endif 1227 1228 1228 1229 dev_dbg(dev, "done\n"); 1229 - return 0; 1230 1230 } 1231 1231 1232 1232 static const struct of_device_id sata_dwc_match[] = { ··· 1240 1242 .of_match_table = sata_dwc_match, 1241 1243 }, 1242 1244 .probe = sata_dwc_probe, 1243 - .remove = sata_dwc_remove, 1245 + .remove_new = sata_dwc_remove, 1244 1246 }; 1245 1247 1246 1248 module_platform_driver(sata_dwc_driver);
+5 -7
drivers/ata/sata_fsl.c
··· 12 12 13 13 #include <linux/kernel.h> 14 14 #include <linux/module.h> 15 + #include <linux/of.h> 16 + #include <linux/of_address.h> 17 + #include <linux/of_irq.h> 15 18 #include <linux/platform_device.h> 16 19 #include <linux/slab.h> 17 20 ··· 22 19 #include <scsi/scsi_cmnd.h> 23 20 #include <linux/libata.h> 24 21 #include <asm/io.h> 25 - #include <linux/of_address.h> 26 - #include <linux/of_irq.h> 27 - #include <linux/of_platform.h> 28 22 29 23 static unsigned int intr_coalescing_count; 30 24 module_param(intr_coalescing_count, int, S_IRUGO); ··· 1526 1526 return retval; 1527 1527 } 1528 1528 1529 - static int sata_fsl_remove(struct platform_device *ofdev) 1529 + static void sata_fsl_remove(struct platform_device *ofdev) 1530 1530 { 1531 1531 struct ata_host *host = platform_get_drvdata(ofdev); 1532 1532 struct sata_fsl_host_priv *host_priv = host->private_data; ··· 1535 1535 device_remove_file(&ofdev->dev, &host_priv->rx_watermark); 1536 1536 1537 1537 ata_host_detach(host); 1538 - 1539 - return 0; 1540 1538 } 1541 1539 1542 1540 #ifdef CONFIG_PM_SLEEP ··· 1589 1591 .of_match_table = fsl_sata_match, 1590 1592 }, 1591 1593 .probe = sata_fsl_probe, 1592 - .remove = sata_fsl_remove, 1594 + .remove_new = sata_fsl_remove, 1593 1595 #ifdef CONFIG_PM_SLEEP 1594 1596 .suspend = sata_fsl_suspend, 1595 1597 .resume = sata_fsl_resume,
+4 -6
drivers/ata/sata_gemini.c
··· 12 12 #include <linux/regmap.h> 13 13 #include <linux/delay.h> 14 14 #include <linux/reset.h> 15 - #include <linux/of_address.h> 16 - #include <linux/of_device.h> 15 + #include <linux/of.h> 17 16 #include <linux/clk.h> 18 17 #include <linux/io.h> 19 18 #include <linux/pinctrl/consumer.h> ··· 399 400 return ret; 400 401 } 401 402 402 - static int gemini_sata_remove(struct platform_device *pdev) 403 + static void gemini_sata_remove(struct platform_device *pdev) 403 404 { 404 405 struct sata_gemini *sg = platform_get_drvdata(pdev); 405 406 ··· 408 409 clk_unprepare(sg->sata0_pclk); 409 410 } 410 411 sg_singleton = NULL; 411 - 412 - return 0; 413 412 } 414 413 415 414 static const struct of_device_id gemini_sata_of_match[] = { ··· 421 424 .of_match_table = gemini_sata_of_match, 422 425 }, 423 426 .probe = gemini_sata_probe, 424 - .remove = gemini_sata_remove, 427 + .remove_new = gemini_sata_remove, 425 428 }; 426 429 module_platform_driver(gemini_sata_driver); 427 430 431 + MODULE_DESCRIPTION("low level driver for Cortina Systems Gemini SATA bridge"); 428 432 MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>"); 429 433 MODULE_LICENSE("GPL"); 430 434 MODULE_ALIAS("platform:" DRV_NAME);
+2 -2
drivers/ata/sata_highbank.c
··· 13 13 #include <linux/io.h> 14 14 #include <linux/spinlock.h> 15 15 #include <linux/device.h> 16 - #include <linux/of_device.h> 16 + #include <linux/of.h> 17 17 #include <linux/of_address.h> 18 18 #include <linux/platform_device.h> 19 19 #include <linux/libata.h> ··· 385 385 static int ahci_highbank_hardreset(struct ata_link *link, unsigned int *class, 386 386 unsigned long deadline) 387 387 { 388 - static const unsigned long timing[] = { 5, 100, 500}; 388 + static const unsigned int timing[] = { 5, 100, 500}; 389 389 struct ata_port *ap = link->ap; 390 390 struct ahci_port_priv *pp = ap->private_data; 391 391 struct ahci_host_priv *hpriv = ap->host->private_data;
+1 -1
drivers/ata/sata_inic162x.c
··· 619 619 struct ata_port *ap = link->ap; 620 620 void __iomem *port_base = inic_port_base(ap); 621 621 void __iomem *idma_ctl = port_base + PORT_IDMA_CTL; 622 - const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); 622 + const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context); 623 623 int rc; 624 624 625 625 /* hammer it into sane state */
+3 -4
drivers/ata/sata_mv.c
··· 3633 3633 3634 3634 /* Workaround for errata FEr SATA#10 (part 2) */ 3635 3635 do { 3636 - const unsigned long *timing = 3636 + const unsigned int *timing = 3637 3637 sata_ehc_deb_timing(&link->eh_context); 3638 3638 3639 3639 rc = sata_link_hardreset(link, timing, deadline + extra, ··· 4210 4210 * A platform bus SATA device has been unplugged. Perform the needed 4211 4211 * cleanup. Also called on module unload for any active devices. 4212 4212 */ 4213 - static int mv_platform_remove(struct platform_device *pdev) 4213 + static void mv_platform_remove(struct platform_device *pdev) 4214 4214 { 4215 4215 struct ata_host *host = platform_get_drvdata(pdev); 4216 4216 struct mv_host_priv *hpriv = host->private_data; ··· 4228 4228 } 4229 4229 phy_power_off(hpriv->port_phys[port]); 4230 4230 } 4231 - return 0; 4232 4231 } 4233 4232 4234 4233 #ifdef CONFIG_PM_SLEEP ··· 4283 4284 4284 4285 static struct platform_driver mv_platform_driver = { 4285 4286 .probe = mv_platform_probe, 4286 - .remove = mv_platform_remove, 4287 + .remove_new = mv_platform_remove, 4287 4288 .suspend = mv_platform_suspend, 4288 4289 .resume = mv_platform_resume, 4289 4290 .driver = {
+1 -1
drivers/ata/sata_nv.c
··· 1529 1529 sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, 1530 1530 NULL, NULL); 1531 1531 else { 1532 - const unsigned long *timing = sata_ehc_deb_timing(ehc); 1532 + const unsigned int *timing = sata_ehc_deb_timing(ehc); 1533 1533 int rc; 1534 1534 1535 1535 if (!(ehc->i.flags & ATA_EHI_QUIET))
+5 -12
drivers/ata/sata_rcar.c
··· 11 11 #include <linux/module.h> 12 12 #include <linux/ata.h> 13 13 #include <linux/libata.h> 14 - #include <linux/of_device.h> 14 + #include <linux/of.h> 15 15 #include <linux/platform_device.h> 16 16 #include <linux/pm_runtime.h> 17 17 #include <linux/err.h> ··· 861 861 struct device *dev = &pdev->dev; 862 862 struct ata_host *host; 863 863 struct sata_rcar_priv *priv; 864 - struct resource *mem; 865 - int irq; 866 - int ret = 0; 864 + int irq, ret; 867 865 868 866 irq = platform_get_irq(pdev, 0); 869 867 if (irq < 0) 870 868 return irq; 871 - if (!irq) 872 - return -EINVAL; 873 869 874 870 priv = devm_kzalloc(dev, sizeof(struct sata_rcar_priv), GFP_KERNEL); 875 871 if (!priv) ··· 886 890 887 891 host->private_data = priv; 888 892 889 - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 890 - priv->base = devm_ioremap_resource(dev, mem); 893 + priv->base = devm_platform_ioremap_resource(pdev, 0); 891 894 if (IS_ERR(priv->base)) { 892 895 ret = PTR_ERR(priv->base); 893 896 goto err_pm_put; ··· 909 914 return ret; 910 915 } 911 916 912 - static int sata_rcar_remove(struct platform_device *pdev) 917 + static void sata_rcar_remove(struct platform_device *pdev) 913 918 { 914 919 struct ata_host *host = platform_get_drvdata(pdev); 915 920 struct sata_rcar_priv *priv = host->private_data; ··· 925 930 926 931 pm_runtime_put(&pdev->dev); 927 932 pm_runtime_disable(&pdev->dev); 928 - 929 - return 0; 930 933 } 931 934 932 935 #ifdef CONFIG_PM_SLEEP ··· 1009 1016 1010 1017 static struct platform_driver sata_rcar_driver = { 1011 1018 .probe = sata_rcar_probe, 1012 - .remove = sata_rcar_remove, 1019 + .remove_new = sata_rcar_remove, 1013 1020 .driver = { 1014 1021 .name = DRV_NAME, 1015 1022 .of_match_table = sata_rcar_match,
+2 -2
drivers/ata/sata_sil24.c
··· 597 597 static int sil24_exec_polled_cmd(struct ata_port *ap, int pmp, 598 598 const struct ata_taskfile *tf, 599 599 int is_cmd, u32 ctrl, 600 - unsigned long timeout_msec) 600 + unsigned int timeout_msec) 601 601 { 602 602 void __iomem *port = sil24_port_base(ap); 603 603 struct sil24_port_priv *pp = ap->private_data; ··· 651 651 { 652 652 struct ata_port *ap = link->ap; 653 653 int pmp = sata_srst_pmp(link); 654 - unsigned long timeout_msec = 0; 654 + unsigned int timeout_msec = 0; 655 655 struct ata_taskfile tf; 656 656 const char *reason; 657 657 int rc;
-1
drivers/ata/sata_sx4.c
··· 232 232 .dma_boundary = ATA_DMA_BOUNDARY, 233 233 }; 234 234 235 - /* TODO: inherit from base port_ops after converting to new EH */ 236 235 static struct ata_port_operations pdc_20621_ops = { 237 236 .inherits = &ata_sff_port_ops, 238 237
+1 -1
drivers/scsi/hisi_sas/hisi_sas_main.c
··· 787 787 * However we don't need to issue a hard reset here for these 788 788 * reasons: 789 789 * a. When probing the device, libsas/libata already issues a 790 - * hard reset in sas_probe_sata() -> ata_sas_async_probe(). 790 + * hard reset in sas_probe_sata() -> ata_port_probe(). 791 791 * Note that in hisi_sas_debug_I_T_nexus_reset() we take care 792 792 * to issue a hard reset by checking the dev status (== INIT). 793 793 * b. When resetting the controller, this is simply unnecessary.
+2 -7
drivers/scsi/libsas/sas_ata.c
··· 567 567 .qc_prep = ata_noop_qc_prep, 568 568 .qc_issue = sas_ata_qc_issue, 569 569 .qc_fill_rtf = sas_ata_qc_fill_rtf, 570 - .port_start = ata_sas_port_start, 571 - .port_stop = ata_sas_port_stop, 572 570 .set_dmamode = sas_ata_set_dmamode, 573 571 .sched_eh = sas_ata_sched_eh, 574 572 .end_eh = sas_ata_end_eh, ··· 607 609 ap->private_data = found_dev; 608 610 ap->cbl = ATA_CBL_SATA; 609 611 ap->scsi_host = shost; 610 - rc = ata_sas_port_init(ap); 611 - if (rc) 612 - goto destroy_port; 613 612 614 613 rc = ata_sas_tport_add(ata_host->dev, ap); 615 614 if (rc) ··· 618 623 return 0; 619 624 620 625 destroy_port: 621 - ata_sas_port_destroy(ap); 626 + kfree(ap); 622 627 free_host: 623 628 ata_host_put(ata_host); 624 629 return rc; ··· 652 657 if (!dev_is_sata(dev)) 653 658 continue; 654 659 655 - ata_sas_async_probe(dev->sata_dev.ap); 660 + ata_port_probe(dev->sata_dev.ap); 656 661 } 657 662 mutex_unlock(&port->ha->disco_mutex); 658 663
+1 -1
drivers/scsi/libsas/sas_discover.c
··· 301 301 302 302 if (dev_is_sata(dev) && dev->sata_dev.ap) { 303 303 ata_sas_tport_delete(dev->sata_dev.ap); 304 - ata_sas_port_destroy(dev->sata_dev.ap); 304 + kfree(dev->sata_dev.ap); 305 305 ata_host_put(dev->sata_dev.ata_host); 306 306 dev->sata_dev.ata_host = NULL; 307 307 dev->sata_dev.ap = NULL;
-39
include/asm-generic/ide_iops.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* Generic I/O and MEMIO string operations. */ 3 - 4 - #define __ide_insw insw 5 - #define __ide_insl insl 6 - #define __ide_outsw outsw 7 - #define __ide_outsl outsl 8 - 9 - static __inline__ void __ide_mm_insw(void __iomem *port, void *addr, u32 count) 10 - { 11 - while (count--) { 12 - *(u16 *)addr = readw(port); 13 - addr += 2; 14 - } 15 - } 16 - 17 - static __inline__ void __ide_mm_insl(void __iomem *port, void *addr, u32 count) 18 - { 19 - while (count--) { 20 - *(u32 *)addr = readl(port); 21 - addr += 4; 22 - } 23 - } 24 - 25 - static __inline__ void __ide_mm_outsw(void __iomem *port, void *addr, u32 count) 26 - { 27 - while (count--) { 28 - writew(*(u16 *)addr, port); 29 - addr += 2; 30 - } 31 - } 32 - 33 - static __inline__ void __ide_mm_outsl(void __iomem * port, void *addr, u32 count) 34 - { 35 - while (count--) { 36 - writel(*(u32 *)addr, port); 37 - addr += 4; 38 - } 39 - }
+14 -26
include/linux/libata.h
··· 344 344 ATA_LINK_RESUME_TRIES = 5, 345 345 346 346 /* how hard are we gonna try to probe/recover devices */ 347 - ATA_PROBE_MAX_TRIES = 3, 348 347 ATA_EH_DEV_TRIES = 3, 349 348 ATA_EH_PMP_TRIES = 5, 350 349 ATA_EH_PMP_LINK_TRIES = 3, ··· 976 977 ssize_t size); 977 978 978 979 /* 979 - * Obsolete 980 - */ 981 - void (*phy_reset)(struct ata_port *ap); 982 - void (*eng_timeout)(struct ata_port *ap); 983 - 984 - /* 985 980 * ->inherits must be the last field and all the preceding 986 981 * fields must be pointers. 987 982 */ ··· 1109 1116 extern int ata_ratelimit(void); 1110 1117 extern void ata_msleep(struct ata_port *ap, unsigned int msecs); 1111 1118 extern u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, 1112 - u32 val, unsigned long interval, unsigned long timeout); 1119 + u32 val, unsigned int interval, unsigned int timeout); 1113 1120 extern int atapi_cmd_type(u8 opcode); 1114 1121 extern unsigned int ata_pack_xfermask(unsigned int pio_mask, 1115 1122 unsigned int mwdma_mask, ··· 1159 1166 * SATA specific code - drivers/ata/libata-sata.c 1160 1167 */ 1161 1168 #ifdef CONFIG_SATA_HOST 1162 - extern const unsigned long sata_deb_timing_normal[]; 1163 - extern const unsigned long sata_deb_timing_hotplug[]; 1164 - extern const unsigned long sata_deb_timing_long[]; 1169 + extern const unsigned int sata_deb_timing_normal[]; 1170 + extern const unsigned int sata_deb_timing_hotplug[]; 1171 + extern const unsigned int sata_deb_timing_long[]; 1165 1172 1166 - static inline const unsigned long * 1173 + static inline const unsigned int * 1167 1174 sata_ehc_deb_timing(struct ata_eh_context *ehc) 1168 1175 { 1169 1176 if (ehc->i.flags & ATA_EHI_HOTPLUGGED) ··· 1178 1185 extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); 1179 1186 extern int sata_set_spd(struct ata_link *link); 1180 1187 extern int sata_link_hardreset(struct ata_link *link, 1181 - const unsigned long *timing, unsigned long deadline, 1188 + const unsigned int *timing, unsigned long deadline, 1182 1189 bool *online, int (*check_ready)(struct ata_link *)); 1183 - extern int sata_link_resume(struct ata_link *link, const unsigned long *params, 1190 + extern int sata_link_resume(struct ata_link *link, const unsigned int *params, 1184 1191 unsigned long deadline); 1185 1192 extern int ata_eh_read_sense_success_ncq_log(struct ata_link *link); 1186 1193 extern void ata_eh_analyze_ncq_error(struct ata_link *link); 1187 1194 #else 1188 - static inline const unsigned long * 1195 + static inline const unsigned int * 1189 1196 sata_ehc_deb_timing(struct ata_eh_context *ehc) 1190 1197 { 1191 1198 return NULL; ··· 1205 1212 } 1206 1213 static inline int sata_set_spd(struct ata_link *link) { return -EOPNOTSUPP; } 1207 1214 static inline int sata_link_hardreset(struct ata_link *link, 1208 - const unsigned long *timing, 1215 + const unsigned int *timing, 1209 1216 unsigned long deadline, 1210 1217 bool *online, 1211 1218 int (*check_ready)(struct ata_link *)) ··· 1215 1222 return -EOPNOTSUPP; 1216 1223 } 1217 1224 static inline int sata_link_resume(struct ata_link *link, 1218 - const unsigned long *params, 1225 + const unsigned int *params, 1219 1226 unsigned long deadline) 1220 1227 { 1221 1228 return -EOPNOTSUPP; ··· 1227 1234 static inline void ata_eh_analyze_ncq_error(struct ata_link *link) { } 1228 1235 #endif 1229 1236 extern int sata_link_debounce(struct ata_link *link, 1230 - const unsigned long *params, unsigned long deadline); 1237 + const unsigned int *params, unsigned long deadline); 1231 1238 extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, 1232 1239 bool spm_wakeup); 1233 1240 extern int ata_slave_link_init(struct ata_port *ap); 1234 - extern void ata_sas_port_destroy(struct ata_port *); 1235 1241 extern struct ata_port *ata_sas_port_alloc(struct ata_host *, 1236 1242 struct ata_port_info *, struct Scsi_Host *); 1237 - extern void ata_sas_async_probe(struct ata_port *ap); 1238 - extern int ata_sas_sync_probe(struct ata_port *ap); 1239 - extern int ata_sas_port_init(struct ata_port *); 1240 - extern int ata_sas_port_start(struct ata_port *ap); 1243 + extern void ata_port_probe(struct ata_port *ap); 1241 1244 extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap); 1242 1245 extern void ata_sas_tport_delete(struct ata_port *ap); 1243 - extern void ata_sas_port_stop(struct ata_port *ap); 1244 1246 extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); 1245 1247 extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap); 1246 1248 extern void ata_tf_to_fis(const struct ata_taskfile *tf, ··· 1773 1785 { 1774 1786 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); 1775 1787 1776 - if (unlikely(!qc) || !ap->ops->error_handler) 1788 + if (unlikely(!qc)) 1777 1789 return qc; 1778 1790 1779 1791 if ((qc->flags & (ATA_QCFLAG_ACTIVE | ··· 1864 1876 } 1865 1877 1866 1878 static inline unsigned long ata_deadline(unsigned long from_jiffies, 1867 - unsigned long timeout_msecs) 1879 + unsigned int timeout_msecs) 1868 1880 { 1869 1881 return from_jiffies + msecs_to_jiffies(timeout_msecs); 1870 1882 }