Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6edad161 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev: (258 commits)
  [libata] conversion to new debug scheme, part 1 of $N
  [PATCH] libata: Add ata_scsi_dev_disabled
  [libata] Add host lock to struct ata_port
  [PATCH] libata: implement per-dev EH action mask eh_info->dev_action[]
  [PATCH] libata-dev: move the CDB-intr DMA blacklisting
  [PATCH] ahci: disable NCQ support on vt8251
  [libata] ahci: add JMicron PCI IDs
  [libata] sata_nv: add PCI IDs
  [libata] ahci: Add NVIDIA PCI IDs.
  [PATCH] libata: convert several bmdma-style controllers to new EH, take #3
  [PATCH] sata_via: convert to new EH, take #3
  [libata] sata_nv: s/spin_lock_irqsave/spin_lock/ in irq handler
  [PATCH] sata_nv: add hotplug support
  [PATCH] sata_nv: convert to new EH
  [PATCH] sata_nv: better irq handlers
  [PATCH] sata_nv: simplify constants
  [PATCH] sata_nv: kill struct nv_host_desc and nv_host
  [PATCH] sata_nv: kill not-working hotplug code
  [libata] Update docs to reflect current driver API
  [PATCH] libata: add host_set->next for legacy two host_sets case, take #3
  ...
parents 236ee8c3 0dd4b21f
Loading
Loading
Loading
Loading
+80 −24
Original line number Diff line number Diff line
@@ -169,6 +169,22 @@ void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);

	</sect2>

	<sect2><title>PIO data read/write</title>
	<programlisting>
void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int);
	</programlisting>

	<para>
All bmdma-style drivers must implement this hook.  This is the low-level
operation that actually copies the data bytes during a PIO data
transfer.
Typically the driver
will choose one of ata_pio_data_xfer_noirq(), ata_pio_data_xfer(), or
ata_mmio_data_xfer().
	</para>

	</sect2>

	<sect2><title>ATA command execute</title>
	<programlisting>
void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf);
@@ -204,11 +220,10 @@ command.
	<programlisting>
u8   (*check_status)(struct ata_port *ap);
u8   (*check_altstatus)(struct ata_port *ap);
u8   (*check_err)(struct ata_port *ap);
	</programlisting>

	<para>
	Reads the Status/AltStatus/Error ATA shadow register from
	Reads the Status/AltStatus ATA shadow register from
	hardware.  On some hardware, reading the Status register has
	the side effect of clearing the interrupt condition.
	Most drivers for taskfile-based hardware use
@@ -269,23 +284,6 @@ void (*set_mode) (struct ata_port *ap);

	</sect2>

	<sect2><title>Reset ATA bus</title>
	<programlisting>
void (*phy_reset) (struct ata_port *ap);
	</programlisting>

	<para>
	The very first step in the probe phase.  Actions vary depending
	on the bus type, typically.  After waking up the device and probing
	for device presence (PATA and SATA), typically a soft reset
	(SRST) will be performed.  Drivers typically use the helper
	functions ata_bus_reset() or sata_phy_reset() for this hook.
	Many SATA drivers use sata_phy_reset() or call it from within
	their own phy_reset() functions.
	</para>

	</sect2>

	<sect2><title>Control PCI IDE BMDMA engine</title>
	<programlisting>
void (*bmdma_setup) (struct ata_queued_cmd *qc);
@@ -354,16 +352,74 @@ int (*qc_issue) (struct ata_queued_cmd *qc);

	</sect2>

	<sect2><title>Timeout (error) handling</title>
	<sect2><title>Exception and probe handling (EH)</title>
	<programlisting>
void (*eng_timeout) (struct ata_port *ap);
void (*phy_reset) (struct ata_port *ap);
	</programlisting>

	<para>
Deprecated.  Use ->error_handler() instead.
	</para>

	<programlisting>
void (*freeze) (struct ata_port *ap);
void (*thaw) (struct ata_port *ap);
	</programlisting>

	<para>
ata_port_freeze() is called when HSM violations or some other
condition disrupts normal operation of the port.  A frozen port
is not allowed to perform any operation until the port is
thawed, which usually follows a successful reset.
	</para>

	<para>
The optional ->freeze() callback can be used for freezing the port
hardware-wise (e.g. mask interrupt and stop DMA engine).  If a
port cannot be frozen hardware-wise, the interrupt handler
must ack and clear interrupts unconditionally while the port
is frozen.
	</para>
	<para>
The optional ->thaw() callback is called to perform the opposite of ->freeze():
prepare the port for normal operation once again.  Unmask interrupts,
start DMA engine, etc.
	</para>

	<programlisting>
void (*error_handler) (struct ata_port *ap);
	</programlisting>

	<para>
->error_handler() is a driver's hook into probe, hotplug, and recovery
and other exceptional conditions.  The primary responsibility of an
implementation is to call ata_do_eh() or ata_bmdma_drive_eh() with a set
of EH hooks as arguments:
	</para>

	<para>
'prereset' hook (may be NULL) is called during an EH reset, before any other actions
are taken.
	</para>

	<para>
'postreset' hook (may be NULL) is called after the EH reset is performed.  Based on
existing conditions, severity of the problem, and hardware capabilities,
	</para>

	<para>
Either 'softreset' (may be NULL) or 'hardreset' (may be NULL) will be
called to perform the low-level EH reset.
	</para>

	<programlisting>
void (*post_internal_cmd) (struct ata_queued_cmd *qc);
	</programlisting>

	<para>
This is a high level error handling function, called from the
error handling thread, when a command times out.  Most newer
hardware will implement its own error handling code here.  IDE BMDMA
drivers may use the helper function ata_eng_timeout().
Perform any hardware-specific actions necessary to finish processing
after executing a probe-time or EH-time command via ata_exec_internal().
	</para>

	</sect2>
+5 −2
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ static struct amd_ide_chip {
	{ PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE,	0x50, AMD_UDMA_133 },
	{ PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE,	0x50, AMD_UDMA_133 },
	{ PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE,	0x50, AMD_UDMA_133 },
	{ PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE,	0x50, AMD_UDMA_133 },
	{ PCI_DEVICE_ID_AMD_CS5536_IDE,			0x40, AMD_UDMA_100 },
	{ 0 }
};
@@ -488,7 +489,8 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
	/* 14 */ DECLARE_NV_DEV("NFORCE-MCP04"),
	/* 15 */ DECLARE_NV_DEV("NFORCE-MCP51"),
	/* 16 */ DECLARE_NV_DEV("NFORCE-MCP55"),
	/* 17 */ DECLARE_AMD_DEV("AMD5536"),
	/* 17 */ DECLARE_NV_DEV("NFORCE-MCP61"),
	/* 18 */ DECLARE_AMD_DEV("AMD5536"),
};

static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
@@ -525,7 +527,8 @@ static struct pci_device_id amd74xx_pci_tbl[] = {
	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14 },
	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15 },
	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 16 },
	{ PCI_VENDOR_ID_AMD,	PCI_DEVICE_ID_AMD_CS5536_IDE,		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17 },
	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17 },
	{ PCI_VENDOR_ID_AMD,	PCI_DEVICE_ID_AMD_CS5536_IDE,		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18 },
	{ 0, },
};
MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ ncr53c8xx-flags-$(CONFIG_SCSI_ZALON) \
CFLAGS_ncr53c8xx.o	:= $(ncr53c8xx-flags-y) $(ncr53c8xx-flags-m)
zalon7xx-objs	:= zalon.o ncr53c8xx.o
NCR_Q720_mod-objs	:= NCR_Q720.o ncr53c8xx.o
libata-objs	:= libata-core.o libata-scsi.o libata-bmdma.o
libata-objs	:= libata-core.o libata-scsi.o libata-bmdma.o libata-eh.o
oktagon_esp_mod-objs	:= oktagon_esp.o oktagon_io.o

# Files generated that shall be removed upon make clean
+313 −190

File changed.

Preview size limit exceeded, changes collapsed.

+50 −62
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@
#include <linux/libata.h>

#define DRV_NAME	"ata_piix"
#define DRV_VERSION	"1.05"
#define DRV_VERSION	"1.10"

enum {
	PIIX_IOCFG		= 0x54, /* IDE I/O configuration register */
@@ -146,11 +146,10 @@ struct piix_map_db {

static int piix_init_one (struct pci_dev *pdev,
				    const struct pci_device_id *ent);

static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes);
static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes);
static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev);
static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev);
static void piix_pata_error_handler(struct ata_port *ap);
static void piix_sata_error_handler(struct ata_port *ap);

static unsigned int in_module_init = 1;

@@ -159,6 +158,7 @@ static const struct pci_device_id piix_pci_tbl[] = {
	{ 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix4_pata },
	{ 0x8086, 0x24db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata },
	{ 0x8086, 0x25a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata },
	{ 0x8086, 0x27df, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata },
#endif

	/* NOTE: The following PCI ids must be kept in sync with the
@@ -218,6 +218,7 @@ static struct scsi_host_template piix_sht = {
	.proc_name		= DRV_NAME,
	.dma_boundary		= ATA_DMA_BOUNDARY,
	.slave_configure	= ata_scsi_slave_config,
	.slave_destroy		= ata_scsi_slave_destroy,
	.bios_param		= ata_std_bios_param,
	.resume			= ata_scsi_device_resume,
	.suspend		= ata_scsi_device_suspend,
@@ -227,6 +228,7 @@ static const struct ata_port_operations piix_pata_ops = {
	.port_disable		= ata_port_disable,
	.set_piomode		= piix_set_piomode,
	.set_dmamode		= piix_set_dmamode,
	.mode_filter		= ata_pci_default_filter,

	.tf_load		= ata_tf_load,
	.tf_read		= ata_tf_read,
@@ -234,16 +236,18 @@ static const struct ata_port_operations piix_pata_ops = {
	.exec_command		= ata_exec_command,
	.dev_select		= ata_std_dev_select,

	.probe_reset		= piix_pata_probe_reset,

	.bmdma_setup		= ata_bmdma_setup,
	.bmdma_start		= ata_bmdma_start,
	.bmdma_stop		= ata_bmdma_stop,
	.bmdma_status		= ata_bmdma_status,
	.qc_prep		= ata_qc_prep,
	.qc_issue		= ata_qc_issue_prot,
	.data_xfer		= ata_pio_data_xfer,

	.eng_timeout		= ata_eng_timeout,
	.freeze			= ata_bmdma_freeze,
	.thaw			= ata_bmdma_thaw,
	.error_handler		= piix_pata_error_handler,
	.post_internal_cmd	= ata_bmdma_post_internal_cmd,

	.irq_handler		= ata_interrupt,
	.irq_clear		= ata_bmdma_irq_clear,
@@ -262,16 +266,18 @@ static const struct ata_port_operations piix_sata_ops = {
	.exec_command		= ata_exec_command,
	.dev_select		= ata_std_dev_select,

	.probe_reset		= piix_sata_probe_reset,

	.bmdma_setup		= ata_bmdma_setup,
	.bmdma_start		= ata_bmdma_start,
	.bmdma_stop		= ata_bmdma_stop,
	.bmdma_status		= ata_bmdma_status,
	.qc_prep		= ata_qc_prep,
	.qc_issue		= ata_qc_issue_prot,
	.data_xfer		= ata_pio_data_xfer,

	.eng_timeout		= ata_eng_timeout,
	.freeze			= ata_bmdma_freeze,
	.thaw			= ata_bmdma_thaw,
	.error_handler		= piix_sata_error_handler,
	.post_internal_cmd	= ata_bmdma_post_internal_cmd,

	.irq_handler		= ata_interrupt,
	.irq_clear		= ata_bmdma_irq_clear,
@@ -455,59 +461,51 @@ cbl40:
}

/**
 *	piix_pata_probeinit - probeinit for PATA host controller
 *	piix_pata_prereset - prereset for PATA host controller
 *	@ap: Target port
 *
 *	Probeinit including cable detection.
 *	Prereset including cable detection.
 *
 *	LOCKING:
 *	None (inherited from caller).
 */
static void piix_pata_probeinit(struct ata_port *ap)
{
	piix_pata_cbl_detect(ap);
	ata_std_probeinit(ap);
}

/**
 *	piix_pata_probe_reset - Perform reset on PATA port and classify
 *	@ap: Port to reset
 *	@classes: Resulting classes of attached devices
 *
 *	Reset PATA phy and classify attached devices.
 *
 *	LOCKING:
 *	None (inherited from caller).
 */
static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes)
static int piix_pata_prereset(struct ata_port *ap)
{
	struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);

	if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) {
		printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
		ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n");
		ap->eh_context.i.action &= ~ATA_EH_RESET_MASK;
		return 0;
	}

	return ata_drive_probe_reset(ap, piix_pata_probeinit,
				     ata_std_softreset, NULL,
				     ata_std_postreset, classes);
	piix_pata_cbl_detect(ap);

	return ata_std_prereset(ap);
}

static void piix_pata_error_handler(struct ata_port *ap)
{
	ata_bmdma_drive_eh(ap, piix_pata_prereset, ata_std_softreset, NULL,
			   ata_std_postreset);
}

/**
 *	piix_sata_probe - Probe PCI device for present SATA devices
 *	@ap: Port associated with the PCI device we wish to probe
 *	piix_sata_prereset - prereset for SATA host controller
 *	@ap: Target port
 *
 *	Reads and configures SATA PCI device's PCI config register
 *	Port Configuration and Status (PCS) to determine port and
 *	device availability.
 *	device availability.  Return -ENODEV to skip reset if no
 *	device is present.
 *
 *	LOCKING:
 *	None (inherited from caller).
 *
 *	RETURNS:
 *	Mask of avaliable devices on the port.
 *	0 if device is present, -ENODEV otherwise.
 */
static unsigned int piix_sata_probe (struct ata_port *ap)
static int piix_sata_prereset(struct ata_port *ap)
{
	struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
	const unsigned int *map = ap->host_set->private_data;
@@ -549,29 +547,19 @@ static unsigned int piix_sata_probe (struct ata_port *ap)
	DPRINTK("ata%u: LEAVE, pcs=0x%x present_mask=0x%x\n",
		ap->id, pcs, present_mask);

	return present_mask;
	if (!present_mask) {
		ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n");
		ap->eh_context.i.action &= ~ATA_EH_RESET_MASK;
		return 0;
	}

/**
 *	piix_sata_probe_reset - Perform reset on SATA port and classify
 *	@ap: Port to reset
 *	@classes: Resulting classes of attached devices
 *
 *	Reset SATA phy and classify attached devices.
 *
 *	LOCKING:
 *	None (inherited from caller).
 */
static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes)
{
	if (!piix_sata_probe(ap)) {
		printk(KERN_INFO "ata%u: SATA port has no device.\n", ap->id);
		return 0;
	return ata_std_prereset(ap);
}

	return ata_drive_probe_reset(ap, ata_std_probeinit,
				     ata_std_softreset, NULL,
				     ata_std_postreset, classes);
static void piix_sata_error_handler(struct ata_port *ap)
{
	ata_bmdma_drive_eh(ap, piix_sata_prereset, ata_std_softreset, NULL,
			   ata_std_postreset);
}

/**
Loading