Commit 3a0eb192 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-5.7/libata-2020-03-29' of git://git.kernel.dk/linux-block

Pull libata updates from Jens Axboe:

 - Series from Bart, making the libata code smaller on PATA only setups.
   This is useful for smaller/embedded use cases, and will help us move
   some of those off drivers/ide.

 - Kill unused BPRINTK() (Hannes)

 - Add various Comet Lake ahci PCI ids (Kai-Heng, Mika)

 - Fix for a double scsi_host_put() in error handling (John)

 - Use scnprintf (Takashi)

 - Assign OF node to the SCSI device (Linus Walleij)

* tag 'for-5.7/libata-2020-03-29' of git://git.kernel.dk/linux-block: (36 commits)
  ata: make "libata.force" kernel parameter optional
  ata: move ata_eh_analyze_ncq_error() & co. to libata-sata.c
  ata: start separating SATA specific code from libata-eh.c
  ata: move ata_sas_*() to libata-sata.c
  ata: start separating SATA specific code from libata-scsi.c
  ata: move sata_deb_timing_*() to libata-sata.c
  ata: move ata_qc_complete_multiple() to libata-sata.c
  ata: move sata_link_hardreset() to libata-sata.c
  ata: move sata_link_{debounce,resume}() to libata-sata.c
  ata: move *sata_set_spd*() to libata-sata.c
  ata: move sata_scr_*() to libata-sata.c
  ata: start separating SATA specific code from libata-core.c
  ata: let compiler optimize out ata_eh_set_lpm() on non-SATA hosts
  ata: let compiler optimize out ata_dev_config_ncq() on non-SATA hosts
  ata: add CONFIG_SATA_HOST=n version of ata_ncq_enabled()
  ata: separate PATA timings code from libata-core.c
  ata: fix CodingStyle issues in PATA timings code
  ata: remove EXPORT_SYMBOL_GPL()s not used by modules
  ata: move EXPORT_SYMBOL_GPL()s close to exported code
  ata: optimize ata_scsi_rbuf[] size
  ...
parents c03cb664 bf89b0bf
Loading
Loading
Loading
Loading
+77 −0
Original line number Diff line number Diff line
@@ -34,6 +34,12 @@ if ATA
config ATA_NONSTANDARD
       bool

config SATA_HOST
	bool

config PATA_TIMINGS
	bool

config ATA_VERBOSE_ERROR
	bool "Verbose ATA error reporting"
	default y
@@ -45,9 +51,26 @@ config ATA_VERBOSE_ERROR

	  If unsure, say Y.

config ATA_FORCE
	bool "\"libata.force=\" kernel parameter support" if EXPERT
	default y
	help
	  This option adds support for "libata.force=" kernel parameter for
	  forcing configuration settings.

	  For further information, please read
	  <file:Documentation/admin-guide/kernel-parameters.txt>.

	  This option will enlarge the kernel by approx. 3KB. Disable it if
	  kernel size is more important than ability to override the default
	  configuration settings.

	  If unsure, say Y.

config ATA_ACPI
	bool "ATA ACPI Support"
	depends on ACPI
	select PATA_TIMINGS
	default y
	help
	  This option adds support for ATA-related ACPI objects.
@@ -73,6 +96,7 @@ config SATA_ZPODD

config SATA_PMP
	bool "SATA Port Multiplier support"
	depends on SATA_HOST
	default y
	help
	  This option adds support for SATA Port Multipliers
@@ -85,6 +109,7 @@ comment "Controllers with non-SFF native interface"
config SATA_AHCI
	tristate "AHCI SATA support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for AHCI Serial ATA.

@@ -111,6 +136,7 @@ config SATA_MOBILE_LPM_POLICY

config SATA_AHCI_PLATFORM
	tristate "Platform AHCI SATA support"
	select SATA_HOST
	help
	  This option enables support for Platform AHCI Serial ATA
	  controllers.
@@ -121,6 +147,7 @@ config AHCI_BRCM
	tristate "Broadcom AHCI SATA support"
	depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_NSP || \
		   ARCH_BCM_63XX
	select SATA_HOST
	help
	  This option enables support for the AHCI SATA3 controller found on
	  Broadcom SoC's.
@@ -130,6 +157,7 @@ config AHCI_BRCM
config AHCI_DA850
	tristate "DaVinci DA850 AHCI SATA support"
	depends on ARCH_DAVINCI_DA850
	select SATA_HOST
	help
	  This option enables support for the DaVinci DA850 SoC's
	  onboard AHCI SATA.
@@ -139,6 +167,7 @@ config AHCI_DA850
config AHCI_DM816
	tristate "DaVinci DM816 AHCI SATA support"
	depends on ARCH_OMAP2PLUS
	select SATA_HOST
	help
	  This option enables support for the DaVinci DM816 SoC's
	  onboard AHCI SATA controller.
@@ -148,6 +177,7 @@ config AHCI_DM816
config AHCI_ST
	tristate "ST AHCI SATA support"
	depends on ARCH_STI
	select SATA_HOST
	help
	  This option enables support for ST AHCI SATA controller.

@@ -157,6 +187,7 @@ config AHCI_IMX
	tristate "Freescale i.MX AHCI SATA support"
	depends on MFD_SYSCON && (ARCH_MXC || COMPILE_TEST)
	depends on (HWMON && (THERMAL || !THERMAL_OF)) || !HWMON
	select SATA_HOST
	help
	  This option enables support for the Freescale i.MX SoC's
	  onboard AHCI SATA.
@@ -166,6 +197,7 @@ config AHCI_IMX
config AHCI_CEVA
	tristate "CEVA AHCI SATA support"
	depends on OF
	select SATA_HOST
	help
	  This option enables support for the CEVA AHCI SATA.
	  It can be found on the Xilinx Zynq UltraScale+ MPSoC.
@@ -176,6 +208,7 @@ config AHCI_MTK
	tristate "MediaTek AHCI SATA support"
	depends on ARCH_MEDIATEK
	select MFD_SYSCON
	select SATA_HOST
	help
	  This option enables support for the MediaTek SoC's
	  onboard AHCI SATA controller.
@@ -185,6 +218,7 @@ config AHCI_MTK
config AHCI_MVEBU
	tristate "Marvell EBU AHCI SATA support"
	depends on ARCH_MVEBU
	select SATA_HOST
	help
	  This option enables support for the Marvebu EBU SoC's
	  onboard AHCI SATA.
@@ -203,6 +237,7 @@ config AHCI_OCTEON
config AHCI_SUNXI
	tristate "Allwinner sunxi AHCI SATA support"
	depends on ARCH_SUNXI
	select SATA_HOST
	help
	  This option enables support for the Allwinner sunxi SoC's
	  onboard AHCI SATA.
@@ -212,6 +247,7 @@ config AHCI_SUNXI
config AHCI_TEGRA
	tristate "NVIDIA Tegra AHCI SATA support"
	depends on ARCH_TEGRA
	select SATA_HOST
	help
	  This option enables support for the NVIDIA Tegra SoC's
	  onboard AHCI SATA.
@@ -221,12 +257,14 @@ config AHCI_TEGRA
config AHCI_XGENE
	tristate "APM X-Gene 6.0Gbps AHCI SATA host controller support"
	depends on PHY_XGENE
	select SATA_HOST
	help
	 This option enables support for APM X-Gene SoC SATA host controller.

config AHCI_QORIQ
	tristate "Freescale QorIQ AHCI SATA support"
	depends on OF
	select SATA_HOST
	help
	  This option enables support for the Freescale QorIQ AHCI SoC's
	  onboard AHCI SATA.
@@ -236,6 +274,7 @@ config AHCI_QORIQ
config SATA_FSL
	tristate "Freescale 3.0Gbps SATA support"
	depends on FSL_SOC
	select SATA_HOST
	help
	  This option enables support for Freescale 3.0Gbps SATA controller.
	  It can be found on MPC837x and MPC8315.
@@ -245,6 +284,7 @@ config SATA_FSL
config SATA_GEMINI
	tristate "Gemini SATA bridge support"
	depends on ARCH_GEMINI || COMPILE_TEST
	select SATA_HOST
	default ARCH_GEMINI
	help
	  This enabled support for the FTIDE010 to SATA bridge
@@ -255,6 +295,7 @@ config SATA_GEMINI
config SATA_AHCI_SEATTLE
	tristate "AMD Seattle 6.0Gbps AHCI SATA host controller support"
	depends on ARCH_SEATTLE
	select SATA_HOST
	help
	 This option enables support for AMD Seattle SATA host controller.

@@ -263,12 +304,14 @@ config SATA_AHCI_SEATTLE
config SATA_INIC162X
	tristate "Initio 162x SATA support (Very Experimental)"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for Initio 162x Serial ATA.

config SATA_ACARD_AHCI
	tristate "ACard AHCI variant (ATP 8620)"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for Acard.

@@ -277,6 +320,7 @@ config SATA_ACARD_AHCI
config SATA_SIL24
	tristate "Silicon Image 3124/3132 SATA support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for Silicon Image 3124/3132 Serial ATA.

@@ -317,6 +361,7 @@ config PDC_ADMA
config PATA_OCTEON_CF
	tristate "OCTEON Boot Bus Compact Flash support"
	depends on CAVIUM_OCTEON_SOC
	select PATA_TIMINGS
	help
	  This option enables a polled compact flash driver for use with
	  compact flash cards attached to the OCTEON boot bus.
@@ -326,6 +371,7 @@ config PATA_OCTEON_CF
config SATA_QSTOR
	tristate "Pacific Digital SATA QStor support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for Pacific Digital Serial ATA QStor.

@@ -334,6 +380,7 @@ config SATA_QSTOR
config SATA_SX4
	tristate "Promise SATA SX4 support (Experimental)"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for Promise Serial ATA SX4.

@@ -357,6 +404,7 @@ comment "SATA SFF controllers with BMDMA"
config ATA_PIIX
	tristate "Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for ICH5/6/7/8 Serial ATA
	  and support for PATA on the Intel ESB/ICH/PIIX3/PIIX4 series
@@ -368,6 +416,7 @@ config SATA_DWC
	tristate "DesignWare Cores SATA support"
	depends on DMADEVICES
	select GENERIC_PHY
	select SATA_HOST
	help
	  This option enables support for the on-chip SATA controller of the
	  AppliedMicro processor 460EX.
@@ -398,6 +447,7 @@ config SATA_DWC_VDEBUG
config SATA_HIGHBANK
	tristate "Calxeda Highbank SATA support"
	depends on ARCH_HIGHBANK || COMPILE_TEST
	select SATA_HOST
	help
	  This option enables support for the Calxeda Highbank SoC's
	  onboard SATA.
@@ -409,6 +459,7 @@ config SATA_MV
	depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \
		   ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST
	select GENERIC_PHY
	select SATA_HOST
	help
	  This option enables support for the Marvell Serial ATA family.
	  Currently supports 88SX[56]0[48][01] PCI(-X) chips,
@@ -419,6 +470,7 @@ config SATA_MV
config SATA_NV
	tristate "NVIDIA SATA support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for NVIDIA Serial ATA.

@@ -427,6 +479,7 @@ config SATA_NV
config SATA_PROMISE
	tristate "Promise SATA TX2/TX4 support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for Promise Serial ATA TX2/TX4.

@@ -435,6 +488,7 @@ config SATA_PROMISE
config SATA_RCAR
	tristate "Renesas R-Car SATA support"
	depends on ARCH_RENESAS || COMPILE_TEST
	select SATA_HOST
	help
	  This option enables support for Renesas R-Car Serial ATA.

@@ -443,6 +497,7 @@ config SATA_RCAR
config SATA_SIL
	tristate "Silicon Image SATA support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for Silicon Image Serial ATA.

@@ -452,6 +507,7 @@ config SATA_SIS
	tristate "SiS 964/965/966/180 SATA support"
	depends on PCI
	select PATA_SIS
	select SATA_HOST
	help
	  This option enables support for SiS Serial ATA on
	  SiS 964/965/966/180 and Parallel ATA on SiS 180.
@@ -462,6 +518,7 @@ config SATA_SIS
config SATA_SVW
	tristate "ServerWorks Frodo / Apple K2 SATA support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for Broadcom/Serverworks/Apple K2
	  SATA support.
@@ -471,6 +528,7 @@ config SATA_SVW
config SATA_ULI
	tristate "ULi Electronics SATA support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for ULi Electronics SATA.

@@ -479,6 +537,7 @@ config SATA_ULI
config SATA_VIA
	tristate "VIA SATA support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for VIA Serial ATA.

@@ -487,6 +546,7 @@ config SATA_VIA
config SATA_VITESSE
	tristate "VITESSE VSC-7174 / INTEL 31244 SATA support"
	depends on PCI
	select SATA_HOST
	help
	  This option enables support for Vitesse VSC7174 and Intel 31244 Serial ATA.

@@ -497,6 +557,7 @@ comment "PATA SFF controllers with BMDMA"
config PATA_ALI
	tristate "ALi PATA support"
	depends on PCI
	select PATA_TIMINGS
	help
	  This option enables support for the ALi ATA interfaces
	  found on the many ALi chipsets.
@@ -506,6 +567,7 @@ config PATA_ALI
config PATA_AMD
	tristate "AMD/NVidia PATA support"
	depends on PCI
	select PATA_TIMINGS
	help
	  This option enables support for the AMD and NVidia PATA
	  interfaces found on the chipsets for Athlon/Athlon64.
@@ -540,6 +602,7 @@ config PATA_ATIIXP
config PATA_ATP867X
	tristate "ARTOP/Acard ATP867X PATA support"
	depends on PCI
	select PATA_TIMINGS
	help
	  This option enables support for ARTOP/Acard ATP867X PATA
	  controllers.
@@ -549,6 +612,7 @@ config PATA_ATP867X
config PATA_BK3710
	tristate "Palmchip BK3710 PATA support"
	depends on ARCH_DAVINCI
	select PATA_TIMINGS
	help
	  This option enables support for the integrated IDE controller on
	  the TI DaVinci SoC.
@@ -558,6 +622,7 @@ config PATA_BK3710
config PATA_CMD64X
	tristate "CMD64x PATA support"
	depends on PCI
	select PATA_TIMINGS
	help
	  This option enables support for the CMD64x series chips
	  except for the CMD640.
@@ -603,6 +668,7 @@ config PATA_CS5536
config PATA_CYPRESS
	tristate "Cypress CY82C693 PATA support (Very Experimental)"
	depends on PCI
	select PATA_TIMINGS
	help
	  This option enables support for the Cypress/Contaq CY82C693
	  chipset found in some Alpha systems
@@ -621,6 +687,7 @@ config PATA_EFAR
config PATA_EP93XX
	tristate "Cirrus Logic EP93xx PATA support"
	depends on ARCH_EP93XX
	select PATA_TIMINGS
	help
	  This option enables support for the PATA controller in
	  the Cirrus Logic EP9312 and EP9315 ARM CPU.
@@ -685,6 +752,7 @@ config PATA_HPT3X3_DMA
config PATA_ICSIDE
	tristate "Acorn ICS PATA support"
	depends on ARM && ARCH_ACORN
	select PATA_TIMINGS
	help
	  On Acorn systems, say Y here if you wish to use the ICS PATA
	  interface card.  This is not required for ICS partition support.
@@ -693,6 +761,7 @@ config PATA_ICSIDE
config PATA_IMX
	tristate "PATA support for Freescale iMX"
	depends on ARCH_MXC
	select PATA_TIMINGS
	help
	  This option enables support for the PATA host available on Freescale
          iMX SoCs.
@@ -778,6 +847,7 @@ config PATA_NINJA32
config PATA_NS87415
	tristate "Nat Semi NS87415 PATA support"
	depends on PCI
	select PATA_TIMINGS
	help
	  This option enables support for the National Semiconductor
	  NS87415 PCI-IDE controller.
@@ -902,6 +972,7 @@ config PATA_TRIFLEX
config PATA_VIA
	tristate "VIA PATA support"
	depends on PCI
	select PATA_TIMINGS
	help
	  This option enables support for the VIA PATA interfaces
	  found on the many VIA chipsets.
@@ -935,6 +1006,7 @@ comment "PIO-only SFF controllers"
config PATA_CMD640_PCI
	tristate "CMD640 PCI PATA support (Experimental)"
	depends on PCI
	select PATA_TIMINGS
	help
	  This option enables support for the CMD640 PCI IDE
	  interface chip. Only the primary channel is currently
@@ -1005,6 +1077,7 @@ config PATA_MPIIX
config PATA_NS87410
	tristate "Nat Semi NS87410 PATA support"
	depends on PCI
	select PATA_TIMINGS
	help
	  This option enables support for the National Semiconductor
	  NS87410 PCI-IDE controller.
@@ -1085,6 +1158,7 @@ config PATA_RZ1000
config PATA_SAMSUNG_CF
	tristate "Samsung SoC PATA support"
	depends on SAMSUNG_DEV_IDE
	select PATA_TIMINGS
	help
	  This option enables basic support for Samsung's S3C/S5P board
	  PATA controllers via the new ATA layer
@@ -1104,6 +1178,7 @@ comment "Generic fallback / legacy drivers"
config PATA_ACPI
	tristate "ACPI firmware driver for PATA"
	depends on ATA_ACPI && ATA_BMDMA && PCI
	select PATA_TIMINGS
	help
	  This option enables an ACPI method driver which drives
	  motherboard PATA controller interfaces through the ACPI
@@ -1113,6 +1188,7 @@ config PATA_ACPI
config ATA_GENERIC
	tristate "Generic ATA support"
	depends on PCI && ATA_BMDMA
	select SATA_HOST
	help
	  This option enables support for generic BIOS configured
	  ATA controllers via the new ATA layer
@@ -1122,6 +1198,7 @@ config ATA_GENERIC
config PATA_LEGACY
	tristate "Legacy ISA PATA support (Experimental)"
	depends on (ISA || PCI)
	select PATA_TIMINGS
	help
	  This option enables support for ISA/VLB/PCI bus legacy PATA
	  ports and allows them to be accessed via the new ATA layer.
+2 −0
Original line number Diff line number Diff line
@@ -123,7 +123,9 @@ obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o

libata-y	:= libata-core.o libata-scsi.o libata-eh.o \
	libata-transport.o libata-trace.o
libata-$(CONFIG_SATA_HOST)	+= libata-sata.o
libata-$(CONFIG_ATA_SFF)	+= libata-sff.o
libata-$(CONFIG_SATA_PMP)	+= libata-pmp.o
libata-$(CONFIG_ATA_ACPI)	+= libata-acpi.o
libata-$(CONFIG_SATA_ZPODD)	+= libata-zpodd.o
libata-$(CONFIG_PATA_TIMINGS)	+= libata-pata-timings.o
+10 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
enum {
	AHCI_PCI_BAR_STA2X11	= 0,
	AHCI_PCI_BAR_CAVIUM	= 0,
	AHCI_PCI_BAR_LOONGSON	= 0,
	AHCI_PCI_BAR_ENMOTUS	= 2,
	AHCI_PCI_BAR_CAVIUM_GEN5	= 4,
	AHCI_PCI_BAR_STANDARD	= 5,
@@ -245,6 +246,7 @@ static const struct ata_port_info ahci_port_info[] = {

static const struct pci_device_id ahci_pci_tbl[] = {
	/* Intel */
	{ PCI_VDEVICE(INTEL, 0x06d6), board_ahci }, /* Comet Lake PCH-H RAID */
	{ PCI_VDEVICE(INTEL, 0x2652), board_ahci }, /* ICH6 */
	{ PCI_VDEVICE(INTEL, 0x2653), board_ahci }, /* ICH6M */
	{ PCI_VDEVICE(INTEL, 0x27c1), board_ahci }, /* ICH7 */
@@ -401,6 +403,8 @@ static const struct pci_device_id ahci_pci_tbl[] = {
	{ PCI_VDEVICE(INTEL, 0xa252), board_ahci }, /* Lewisburg RAID*/
	{ PCI_VDEVICE(INTEL, 0xa256), board_ahci }, /* Lewisburg RAID*/
	{ PCI_VDEVICE(INTEL, 0xa356), board_ahci }, /* Cannon Lake PCH-H RAID */
	{ PCI_VDEVICE(INTEL, 0x06d7), board_ahci }, /* Comet Lake-H RAID */
	{ PCI_VDEVICE(INTEL, 0xa386), board_ahci }, /* Comet Lake PCH-V RAID */
	{ PCI_VDEVICE(INTEL, 0x0f22), board_ahci_mobile }, /* Bay Trail AHCI */
	{ PCI_VDEVICE(INTEL, 0x0f23), board_ahci_mobile }, /* Bay Trail AHCI */
	{ PCI_VDEVICE(INTEL, 0x22a3), board_ahci_mobile }, /* Cherry Tr. AHCI */
@@ -589,6 +593,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
	/* Enmotus */
	{ PCI_DEVICE(0x1c44, 0x8000), board_ahci },

	/* Loongson */
	{ PCI_VDEVICE(LOONGSON, 0x7a08), board_ahci },

	/* Generic, PCI class code for AHCI */
	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
	  PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
@@ -1680,6 +1687,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
			ahci_pci_bar = AHCI_PCI_BAR_CAVIUM;
		if (pdev->device == 0xa084)
			ahci_pci_bar = AHCI_PCI_BAR_CAVIUM_GEN5;
	} else if (pdev->vendor == PCI_VENDOR_ID_LOONGSON) {
		if (pdev->device == 0x7a08)
			ahci_pci_bar = AHCI_PCI_BAR_LOONGSON;
	}

	/* acquire resources */
+88 −1038

File changed.

Preview size limit exceeded, changes collapsed.

+14 −210
Original line number Diff line number Diff line
@@ -2,10 +2,6 @@
/*
 *  libata-eh.c - libata error handling
 *
 *  Maintained by:  Tejun Heo <tj@kernel.org>
 *    		    Please ALWAYS copy linux-ide@vger.kernel.org
 *		    on emails.
 *
 *  Copyright 2006 Tejun Heo <htejun@gmail.com>
 *
 *  libata documentation is available via 'make {ps|pdf}docs',
@@ -184,6 +180,7 @@ void __ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
	__ata_ehi_pushv_desc(ehi, fmt, args);
	va_end(args);
}
EXPORT_SYMBOL_GPL(__ata_ehi_push_desc);

/**
 *	ata_ehi_push_desc - push error description with separator
@@ -207,6 +204,7 @@ void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
	__ata_ehi_pushv_desc(ehi, fmt, args);
	va_end(args);
}
EXPORT_SYMBOL_GPL(ata_ehi_push_desc);

/**
 *	ata_ehi_clear_desc - clean error description
@@ -222,6 +220,7 @@ void ata_ehi_clear_desc(struct ata_eh_info *ehi)
	ehi->desc[0] = '\0';
	ehi->desc_len = 0;
}
EXPORT_SYMBOL_GPL(ata_ehi_clear_desc);

/**
 *	ata_port_desc - append port description
@@ -249,9 +248,9 @@ void ata_port_desc(struct ata_port *ap, const char *fmt, ...)
	__ata_ehi_pushv_desc(&ap->link.eh_info, fmt, args);
	va_end(args);
}
EXPORT_SYMBOL_GPL(ata_port_desc);

#ifdef CONFIG_PCI

/**
 *	ata_port_pbar_desc - append PCI BAR description
 *	@ap: target ATA port
@@ -288,7 +287,7 @@ void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
		ata_port_desc(ap, "%s 0x%llx", name,
				start + (unsigned long long)offset);
}

EXPORT_SYMBOL_GPL(ata_port_pbar_desc);
#endif /* CONFIG_PCI */

static int ata_lookup_timeout_table(u8 cmd)
@@ -973,6 +972,7 @@ void ata_port_schedule_eh(struct ata_port *ap)
	/* see: ata_std_sched_eh, unless you know better */
	ap->ops->sched_eh(ap);
}
EXPORT_SYMBOL_GPL(ata_port_schedule_eh);

static int ata_do_link_abort(struct ata_port *ap, struct ata_link *link)
{
@@ -1015,6 +1015,7 @@ int ata_link_abort(struct ata_link *link)
{
	return ata_do_link_abort(link->ap, link);
}
EXPORT_SYMBOL_GPL(ata_link_abort);

/**
 *	ata_port_abort - abort all qc's on the port
@@ -1032,6 +1033,7 @@ int ata_port_abort(struct ata_port *ap)
{
	return ata_do_link_abort(ap, NULL);
}
EXPORT_SYMBOL_GPL(ata_port_abort);

/**
 *	__ata_port_freeze - freeze port
@@ -1088,79 +1090,7 @@ int ata_port_freeze(struct ata_port *ap)

	return nr_aborted;
}

/**
 *	sata_async_notification - SATA async notification handler
 *	@ap: ATA port where async notification is received
 *
 *	Handler to be called when async notification via SDB FIS is
 *	received.  This function schedules EH if necessary.
 *
 *	LOCKING:
 *	spin_lock_irqsave(host lock)
 *
 *	RETURNS:
 *	1 if EH is scheduled, 0 otherwise.
 */
int sata_async_notification(struct ata_port *ap)
{
	u32 sntf;
	int rc;

	if (!(ap->flags & ATA_FLAG_AN))
		return 0;

	rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf);
	if (rc == 0)
		sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf);

	if (!sata_pmp_attached(ap) || rc) {
		/* PMP is not attached or SNTF is not available */
		if (!sata_pmp_attached(ap)) {
			/* PMP is not attached.  Check whether ATAPI
			 * AN is configured.  If so, notify media
			 * change.
			 */
			struct ata_device *dev = ap->link.device;

			if ((dev->class == ATA_DEV_ATAPI) &&
			    (dev->flags & ATA_DFLAG_AN))
				ata_scsi_media_change_notify(dev);
			return 0;
		} else {
			/* PMP is attached but SNTF is not available.
			 * ATAPI async media change notification is
			 * not used.  The PMP must be reporting PHY
			 * status change, schedule EH.
			 */
			ata_port_schedule_eh(ap);
			return 1;
		}
	} else {
		/* PMP is attached and SNTF is available */
		struct ata_link *link;

		/* check and notify ATAPI AN */
		ata_for_each_link(link, ap, EDGE) {
			if (!(sntf & (1 << link->pmp)))
				continue;

			if ((link->device->class == ATA_DEV_ATAPI) &&
			    (link->device->flags & ATA_DFLAG_AN))
				ata_scsi_media_change_notify(link->device);
		}

		/* If PMP is reporting that PHY status of some
		 * downstream ports has changed, schedule EH.
		 */
		if (sntf & (1 << SATA_PMP_CTRL_PORT)) {
			ata_port_schedule_eh(ap);
			return 1;
		}

		return 0;
	}
}
EXPORT_SYMBOL_GPL(ata_port_freeze);

/**
 *	ata_eh_freeze_port - EH helper to freeze port
@@ -1182,6 +1112,7 @@ void ata_eh_freeze_port(struct ata_port *ap)
	__ata_port_freeze(ap);
	spin_unlock_irqrestore(ap->lock, flags);
}
EXPORT_SYMBOL_GPL(ata_eh_freeze_port);

/**
 *	ata_port_thaw_port - EH helper to thaw port
@@ -1289,6 +1220,7 @@ void ata_dev_disable(struct ata_device *dev)
	 */
	ata_ering_clear(&dev->ering);
}
EXPORT_SYMBOL_GPL(ata_dev_disable);

/**
 *	ata_eh_detach_dev - detach ATA device
@@ -1419,62 +1351,6 @@ static const char *ata_err_string(unsigned int err_mask)
	return "unknown error";
}

/**
 *	ata_eh_read_log_10h - Read log page 10h for NCQ error details
 *	@dev: Device to read log page 10h from
 *	@tag: Resulting tag of the failed command
 *	@tf: Resulting taskfile registers of the failed command
 *
 *	Read log page 10h to obtain NCQ error details and clear error
 *	condition.
 *
 *	LOCKING:
 *	Kernel thread context (may sleep).
 *
 *	RETURNS:
 *	0 on success, -errno otherwise.
 */
static int ata_eh_read_log_10h(struct ata_device *dev,
			       int *tag, struct ata_taskfile *tf)
{
	u8 *buf = dev->link->ap->sector_buf;
	unsigned int err_mask;
	u8 csum;
	int i;

	err_mask = ata_read_log_page(dev, ATA_LOG_SATA_NCQ, 0, buf, 1);
	if (err_mask)
		return -EIO;

	csum = 0;
	for (i = 0; i < ATA_SECT_SIZE; i++)
		csum += buf[i];
	if (csum)
		ata_dev_warn(dev, "invalid checksum 0x%x on log page 10h\n",
			     csum);

	if (buf[0] & 0x80)
		return -ENOENT;

	*tag = buf[0] & 0x1f;

	tf->command = buf[2];
	tf->feature = buf[3];
	tf->lbal = buf[4];
	tf->lbam = buf[5];
	tf->lbah = buf[6];
	tf->device = buf[7];
	tf->hob_lbal = buf[8];
	tf->hob_lbam = buf[9];
	tf->hob_lbah = buf[10];
	tf->nsect = buf[12];
	tf->hob_nsect = buf[13];
	if (dev->class == ATA_DEV_ZAC && ata_id_has_ncq_autosense(dev->id))
		tf->auxiliary = buf[14] << 16 | buf[15] << 8 | buf[16];

	return 0;
}

/**
 *	atapi_eh_tur - perform ATAPI TEST_UNIT_READY
 *	@dev: target ATAPI device
@@ -1658,80 +1534,6 @@ static void ata_eh_analyze_serror(struct ata_link *link)
	ehc->i.action |= action;
}

/**
 *	ata_eh_analyze_ncq_error - analyze NCQ error
 *	@link: ATA link to analyze NCQ error for
 *
 *	Read log page 10h, determine the offending qc and acquire
 *	error status TF.  For NCQ device errors, all LLDDs have to do
 *	is setting AC_ERR_DEV in ehi->err_mask.  This function takes
 *	care of the rest.
 *
 *	LOCKING:
 *	Kernel thread context (may sleep).
 */
void ata_eh_analyze_ncq_error(struct ata_link *link)
{
	struct ata_port *ap = link->ap;
	struct ata_eh_context *ehc = &link->eh_context;
	struct ata_device *dev = link->device;
	struct ata_queued_cmd *qc;
	struct ata_taskfile tf;
	int tag, rc;

	/* if frozen, we can't do much */
	if (ap->pflags & ATA_PFLAG_FROZEN)
		return;

	/* is it NCQ device error? */
	if (!link->sactive || !(ehc->i.err_mask & AC_ERR_DEV))
		return;

	/* has LLDD analyzed already? */
	ata_qc_for_each_raw(ap, qc, tag) {
		if (!(qc->flags & ATA_QCFLAG_FAILED))
			continue;

		if (qc->err_mask)
			return;
	}

	/* okay, this error is ours */
	memset(&tf, 0, sizeof(tf));
	rc = ata_eh_read_log_10h(dev, &tag, &tf);
	if (rc) {
		ata_link_err(link, "failed to read log page 10h (errno=%d)\n",
			     rc);
		return;
	}

	if (!(link->sactive & (1 << tag))) {
		ata_link_err(link, "log page 10h reported inactive tag %d\n",
			     tag);
		return;
	}

	/* we've got the perpetrator, condemn it */
	qc = __ata_qc_from_tag(ap, tag);
	memcpy(&qc->result_tf, &tf, sizeof(tf));
	qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
	qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ;
	if (dev->class == ATA_DEV_ZAC &&
	    ((qc->result_tf.command & ATA_SENSE) || qc->result_tf.auxiliary)) {
		char sense_key, asc, ascq;

		sense_key = (qc->result_tf.auxiliary >> 16) & 0xff;
		asc = (qc->result_tf.auxiliary >> 8) & 0xff;
		ascq = qc->result_tf.auxiliary & 0xff;
		ata_scsi_set_sense(dev, qc->scsicmd, sense_key, asc, ascq);
		ata_scsi_set_sense_information(dev, qc->scsicmd,
					       &qc->result_tf);
		qc->flags |= ATA_QCFLAG_SENSE_VALID;
	}

	ehc->i.err_mask &= ~AC_ERR_DEV;
}

/**
 *	ata_eh_analyze_tf - analyze taskfile of a failed qc
 *	@qc: qc to analyze
@@ -3436,7 +3238,8 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
	int rc;

	/* if the link or host doesn't do LPM, noop */
	if ((link->flags & ATA_LFLAG_NO_LPM) || (ap && !ap->ops->set_lpm))
	if (!IS_ENABLED(CONFIG_SATA_HOST) ||
	    (link->flags & ATA_LFLAG_NO_LPM) || (ap && !ap->ops->set_lpm))
		return 0;

	/*
@@ -4052,6 +3855,7 @@ void ata_std_error_handler(struct ata_port *ap)

	ata_do_eh(ap, ops->prereset, ops->softreset, hardreset, ops->postreset);
}
EXPORT_SYMBOL_GPL(ata_std_error_handler);

#ifdef CONFIG_PM
/**
Loading