libata fixes
Subsystems (3)
PATCH RESEND 1/1 libata fixes
90% resend from yesterday. Added a few more fixes.
If you pulled the previous submission, that's ok, git history will still be correct (it's appended, not rebased).
Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-linus
to receive the following updates:
arch/powerpc/Kconfig | 1 + drivers/ata/Kconfig | 4 ++ drivers/ata/ahci.c | 60 ++++++++++++++++++++++++++++----- drivers/ata/ata_generic.c | 6 ++- drivers/ata/libata-core.c | 14 +------- drivers/ata/libata-sff.c | 21 +++++++---- drivers/ata/pata_cmd64x.c | 23 +++++++++---- drivers/ata/pata_hpt3x2n.c | 6 ++-- drivers/ata/pata_it821x.c | 4 ++- drivers/ata/pata_ixp4xx_cf.c | 5 ++- drivers/ata/pata_legacy.c | 4 ++- drivers/ata/pata_rz1000.c | 6 ++- drivers/ata/sata_uli.c | 3 +- drivers/ata/sata_via.c | 12 ++++++- include/asm-generic/libata-portmap.h | 4 +- include/asm-powerpc/libata-portmap.h | 12 +++++++ include/linux/libata.h | 5 ++- 17 files changed, 137 insertions(+), 53 deletions(-) create mode 100644 include/asm-powerpc/libata-portmap.h
Alan (4):
libata cmd64x: whack into a shape that looks like the documentation libata hpt3xn: Hopefully sort out the DPLL logic versus the vendor code
libata: set_mode, Fix the FIXME
libata-sff: Don't call bmdma_stop on non DMA capable controllers
David Woodhouse (1):
Fix Maple PATA IRQ assignment.
Tejun Heo (6):
sata_via: don't diddle with ATA_NIEN in ->freeze
ahci: improve and limit spurious interrupt messages, take#3
libata: implement ATA_FLAG_IGN_SIMPLEX and use it in sata_uli
ahci: fix endianness in spurious interrupt message
sata_via: style clean up, no indirect method call in LLD
ahci: use 0x80 as wait stat value instead of 0xff
arch/powerpc/Kconfig +1 -0
@@ -484,6 +484,7 @@ config PPC_MAPLE select PPC_970_NAP select PPC_NATIVE select PPC_RTAS + select ATA_NONSTANDARD if ATA default n help This option enables support for the Maple 970FX Evaluation Board.
drivers/ata/Kconfig +4 -0
@@ -19,6 +19,10 @@ config ATA if ATA +config ATA_NONSTANDARD + bool + default n + config SATA_AHCI tristate "AHCI SATA support" depends on PCI
drivers/ata/ahci.c +51 -9
95 lines not on this page · raw message
drivers/ata/ata_generic.c +4 -2
@@ -64,6 +64,7 @@ static void generic_error_handler(struct ata_port *ap)/** * generic_set_mode - mode setting * @ap: interface to set up +* @unused: returned device on error * * Use a non standard set_mode function. We don't want to be tuned. * The BIOS configured everything. Our job is not to fiddle. We
@@ -71,7 +72,7 @@ static void generic_error_handler(struct ata_port *ap)* and respect them. */ -static void generic_set_mode (struct ata_port *ap) +static int generic_set_mode (struct ata_port *ap,struct ata_device **unused) {int dma_enabled =0 ;int i;
@@ -82,7 +83,7 @@ static void generic_set_mode(struct ata_port *ap)for (i =0 ; i <ATA_MAX_DEVICES ; i++) {struct ata_device *dev = &ap->device[i]; -if (ata_dev_enabled (dev)) { +if (ata_dev_ready (dev)) {/* We don't really care */ dev->pio_mode =XFER_PIO_0 ; dev->dma_mode =XFER_MW_DMA_0 ;
@@ -99,6 +100,7 @@ static void generic_set_mode(struct ata_port *ap) } } } +return 0 ; }static struct scsi_host_template generic_sht = {
drivers/ata/libata-core.c +2 -12
@@ -2431,18 +2431,8 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)int i, rc =0 , used_dma =0 , found =0 ;/* has private set_mode? */ -if (ap->ops->set_mode) { -/* FIXME: make ->set_mode handle no device case and -* return error code and failing device on failure. -*/ -for (i =0 ; i <ATA_MAX_DEVICES ; i++) { -if (ata_dev_ready (&ap->device[i])) { - ap->ops->set_mode (ap); -break ; - } - } -return 0 ; - } +if (ap->ops->set_mode) +return ap->ops->set_mode (ap, r_failed_dev);/* step 1: calculate xfer_mask */ for (i =0 ; i <ATA_MAX_DEVICES ; i++) {
drivers/ata/libata-sff.c +13 -8
@@ -827,7 +827,8 @@ void ata_bmdma_error_handler(struct ata_port *ap)*/ void ata_bmdma_post_internal_cmd (struct ata_queued_cmd *qc) { -ata_bmdma_stop (qc); +if (qc->ap->ioaddr.bmdma_addr) +ata_bmdma_stop (qc); }#ifdef CONFIG_PCI
@@ -870,7 +871,8 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, intpci_resource_start (pdev,1 ) |ATA_PCI_CTL_OFS ; bmdma =pci_resource_start (pdev,4 );if (bmdma) { -if (inb (bmdma +2 ) &0x80 ) +if ((!(port[p]->flags &ATA_FLAG_IGN_SIMPLEX )) && + (inb (bmdma +2 ) &0x80 )) probe_ent->_host_flags |=ATA_HOST_SIMPLEX ; probe_ent->port[p].bmdma_addr = bmdma; }
@@ -886,7 +888,8 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int bmdma =pci_resource_start (pdev,4 );if (bmdma) { bmdma +=8 ; -if (inb (bmdma +2 ) &0x80 ) +if ((!(port[p]->flags &ATA_FLAG_IGN_SIMPLEX )) && + (inb (bmdma +2 ) &0x80 )) probe_ent->_host_flags |=ATA_HOST_SIMPLEX ; probe_ent->port[p].bmdma_addr = bmdma; }
@@ -914,13 +917,14 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, probe_ent->irq_flags =IRQF_SHARED ;if (port_mask &ATA_PORT_PRIMARY ) { - probe_ent->irq =ATA_PRIMARY_IRQ ; + probe_ent->irq =ATA_PRIMARY_IRQ (pdev); probe_ent->port[0 ].cmd_addr =ATA_PRIMARY_CMD ; probe_ent->port[0 ].altstatus_addr = probe_ent->port[0 ].ctl_addr =ATA_PRIMARY_CTL ;if (bmdma) { probe_ent->port[0 ].bmdma_addr = bmdma; -if (inb (bmdma +2 ) &0x80 ) +if ((!(port[0 ]->flags &ATA_FLAG_IGN_SIMPLEX )) && + (inb (bmdma +2 ) &0x80 )) probe_ent->_host_flags |=ATA_HOST_SIMPLEX ; }ata_std_ports (&probe_ent->port[0 ]);
@@ -929,15 +933,16 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,if (port_mask &ATA_PORT_SECONDARY ) {if (probe_ent->irq) - probe_ent->irq2 =ATA_SECONDARY_IRQ ; + probe_ent->irq2 =ATA_SECONDARY_IRQ (pdev);else - probe_ent->irq =ATA_SECONDARY_IRQ ; + probe_ent->irq =ATA_SECONDARY_IRQ (pdev); probe_ent->port[1 ].cmd_addr =ATA_SECONDARY_CMD ; probe_ent->port[1 ].altstatus_addr = probe_ent->port[1 ].ctl_addr =ATA_SECONDARY_CTL ;if (bmdma) { probe_ent->port[1 ].bmdma_addr = bmdma +8 ; -if (inb (bmdma +10 ) &0x80 ) +if ((!(port[1 ]->flags &ATA_FLAG_IGN_SIMPLEX )) && + (inb (bmdma +10 ) &0x80 )) probe_ent->_host_flags |=ATA_HOST_SIMPLEX ; }ata_std_ports (&probe_ent->port[1 ]);
drivers/ata/pata_cmd64x.c +16 -7
@@ -197,7 +197,7 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev)static void cmd64x_set_dmamode (struct ata_port *ap,struct ata_device *adev) {static const u8 udma_data[] = { -0x31 ,0x21 ,0x11 ,0x25 ,0x15 ,0x05 +0x30 ,0x20 ,0x10 ,0x20 ,0x10 ,0x00 };static const u8 mwdma_data[] = {0x30 ,0x20 ,0x10
@@ -213,12 +213,21 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)pci_read_config_byte (pdev, pciD, ®D);pci_read_config_byte (pdev, pciU, ®U); - regD &= ~(0x20 << shift); - regU &= ~(0x35 << shift); +/* DMA bits off */ + regD &= ~(0x20 << adev->devno); +/* DMA control bits */ + regU &= ~(0x30 << shift); +/* DMA timing bits */ + regU &= ~(0x05 << adev->devno); -if (adev->dma_mode >=XFER_UDMA_0 ) +if (adev->dma_mode >=XFER_UDMA_0 ) { +/* Merge thge timing value */ regU |= udma_data[adev->dma_mode -XFER_UDMA_0 ] << shift; -else +/* Merge the control bits */ + regU |=1 << adev->devno;/* UDMA on */ +if (adev->dma_mode >2 )/* 15nS timing */ + regU |=4 << adev->devno; + }else regD |= mwdma_data[adev->dma_mode -XFER_MW_DMA_0 ] << shift; regD |=0x20 << adev->devno;
@@ -239,8 +248,8 @@ static void cmd648_bmdma_stop(struct ata_queued_cmd *qc)struct ata_port *ap = qc->ap;struct pci_dev *pdev =to_pci_dev (ap->host->dev);u8 dma_intr; -int dma_reg = ap->port_no ?ARTTIM23_INTR_CH1 :CFR_INTR_CH0 ; -int dma_mask = ap->port_no ?ARTTIM2 :CFR ; +int dma_mask = ap->port_no ?ARTTIM23_INTR_CH1 :CFR_INTR_CH0 ; +int dma_reg = ap->port_no ?ARTTIM2 :CFR ;ata_bmdma_stop (qc);
drivers/ata/pata_hpt3x2n.c +3 -3
@@ -25,7 +25,7 @@#include <linux/libata.h> #define DRV_NAME "pata_hpt3x2n" -#define DRV_VERSION "0.3" +#define DRV_VERSION "0.3.2"enum {HPT_PCI_FAST = (1 <<31 ),
@@ -297,11 +297,11 @@ static int hpt3x2n_pair_idle(struct ata_port *ap)return 0 ; } -static int hpt3x2n_use_dpll (struct ata_port *ap,int reading) +static int hpt3x2n_use_dpll (struct ata_port *ap,int writing) {long flags = (long )ap->host->private_data;/* See if we should use the DPLL */ -if (reading ==0 ) +if (writing)return USE_DPLL ;/* Needed for write */ if (flags &PCI66 )return USE_DPLL ;/* Needed at 66Mhz */
drivers/ata/pata_it821x.c +3 -1
@@ -476,6 +476,7 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)/** * it821x_smart_set_mode - mode setting * @ap: interface to set up +* @unused: device that failed (error only) * * Use a non standard set_mode function. We don't want to be tuned. * The BIOS configured everything. Our job is not to fiddle. We
@@ -483,7 +484,7 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)* and respect them. */ -static void it821x_smart_set_mode (struct ata_port *ap) +static int it821x_smart_set_mode (struct ata_port *ap,struct ata_device **unused) {int dma_enabled =0 ;int i;
@@ -512,6 +513,7 @@ static void it821x_smart_set_mode(struct ata_port *ap) } } } +return 0 ; }/**
drivers/ata/pata_ixp4xx_cf.c +3 -2
@@ -23,9 +23,9 @@#include <scsi/scsi_host.h> #define DRV_NAME "pata_ixp4xx_cf" -#define DRV_VERSION "0.1.1" +#define DRV_VERSION "0.1.1ac1" -static void ixp4xx_set_mode (struct ata_port *ap) +static int ixp4xx_set_mode (struct ata_port *ap,struct ata_device *adev) {int i;
@@ -38,6 +38,7 @@ static void ixp4xx_set_mode(struct ata_port *ap) dev->flags |=ATA_DFLAG_PIO ; } } +return 0 ; }static void ixp4xx_phy_reset (struct ata_port *ap)
drivers/ata/pata_legacy.c +3 -1
@@ -96,6 +96,7 @@ static int pio_mask = 0x1F; /* PIO range for autospeed devices *//** * legacy_set_mode - mode setting * @ap: IDE interface +* @unused: Device that failed when error is returned * * Use a non standard set_mode function. We don't want to be tuned. *
@@ -105,7 +106,7 @@ static int pio_mask = 0x1F; /* PIO range for autospeed devices */* expand on this as per hdparm in the base kernel. */ -static void legacy_set_mode (struct ata_port *ap) +static int legacy_set_mode (struct ata_port *ap,struct ata_device **unused) {int i;
@@ -118,6 +119,7 @@ static void legacy_set_mode(struct ata_port *ap) dev->flags |=ATA_DFLAG_PIO ; } } +return 0 ; }static struct scsi_host_template legacy_sht = {
drivers/ata/pata_rz1000.c +4 -2
@@ -52,19 +52,20 @@ static void rz1000_error_handler(struct ata_port *ap)/** * rz1000_set_mode - mode setting function * @ap: ATA interface +* @unused: returned device on set_mode failure * * Use a non standard set_mode function. We don't want to be tuned. We * would prefer to be BIOS generic but for the fact our hardware is * whacked out. */ -static void rz1000_set_mode (struct ata_port *ap) +static int rz1000_set_mode (struct ata_port *ap,struct ata_device **unused) {int i;for (i =0 ; i <ATA_MAX_DEVICES ; i++) {struct ata_device *dev = &ap->device[i]; -if (ata_dev_enabled (dev)) { +if (ata_dev_ready (dev)) {/* We don't really care */ dev->pio_mode =XFER_PIO_0 ; dev->xfer_mode =XFER_PIO_0 ;
@@ -72,6 +73,7 @@ static void rz1000_set_mode(struct ata_port *ap) dev->flags |=ATA_DFLAG_PIO ; } } +return 0 ; }
drivers/ata/sata_uli.c +2 -1
@@ -128,7 +128,8 @@ static const struct ata_port_operations uli_ops = {static struct ata_port_info uli_port_info = { .sht = &uli_sht, - .flags =ATA_FLAG_SATA |ATA_FLAG_NO_LEGACY , + .flags =ATA_FLAG_SATA |ATA_FLAG_NO_LEGACY | +ATA_FLAG_IGN_SIMPLEX , .pio_mask =0x1f ,/* pio0-4 */ .udma_mask =0x7f ,/* udma0-6 */ .port_ops = &uli_ops,
drivers/ata/sata_via.c +11 -1
@@ -74,6 +74,7 @@ enum {static int svia_init_one (struct pci_dev *pdev,const struct pci_device_id *ent);static u32 svia_scr_read (struct ata_port *ap,unsigned int sc_reg);static void svia_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val); +static void svia_noop_freeze (struct ata_port *ap);static void vt6420_error_handler (struct ata_port *ap);static const struct pci_device_id svia_pci_tbl[] = {
@@ -128,7 +129,7 @@ static const struct ata_port_operations vt6420_sata_ops = { .qc_issue = ata_qc_issue_prot, .data_xfer = ata_pio_data_xfer, - .freeze = ata_bmdma_freeze, + .freeze = svia_noop_freeze, .thaw = ata_bmdma_thaw, .error_handler = vt6420_error_handler, .post_internal_cmd = ata_bmdma_post_internal_cmd,
@@ -204,6 +205,15 @@ static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)outl (val, ap->ioaddr.scr_addr + (4 * sc_reg)); } +static void svia_noop_freeze (struct ata_port *ap) +{ +/* Some VIA controllers choke if ATA_NIEN is manipulated in +* certain way. Leave it alone and just clear pending IRQ. +*/ +ata_chk_status (ap); +ata_bmdma_irq_clear (ap); +} +/** * vt6420_prereset - prereset for vt6420 * @ap: target ATA port
include/asm-generic/libata-portmap.h +2 -2
@@ -3,10 +3,10 @@#define ATA_PRIMARY_CMD 0x1F0#define ATA_PRIMARY_CTL 0x3F6 -#define ATA_PRIMARY_IRQ 14 +#define ATA_PRIMARY_IRQ (dev) 14#define ATA_SECONDARY_CMD 0x170#define ATA_SECONDARY_CTL 0x376 -#define ATA_SECONDARY_IRQ 15 +#define ATA_SECONDARY_IRQ (dev) 15#endif
include/asm-powerpc/libata-portmap.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef __ASM_POWERPC_LIBATA_PORTMAP_H +#define __ASM_POWERPC_LIBATA_PORTMAP_H + +#define ATA_PRIMARY_CMD 0x1F0 +#define ATA_PRIMARY_CTL 0x3F6 +#define ATA_PRIMARY_IRQ (dev) pci_get_legacy_ide_irq(dev, 0) + +#define ATA_SECONDARY_CMD 0x170 +#define ATA_SECONDARY_CTL 0x376 +#define ATA_SECONDARY_IRQ (dev) pci_get_legacy_ide_irq(dev, 1) + +#endif
include/linux/libata.h +3 -2
@@ -177,6 +177,7 @@ enum {* Register FIS clearing BSY */ ATA_FLAG_DEBUGMSG = (1 <<13 ),ATA_FLAG_SETXFER_POLLING = (1 <<14 ),/* use polling for SETXFER */ + ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX *//* The following flag belongs to ap->pflags but is kept in * ap->flags because it's referenced in many LLDs and will be
@@ -612,11 +613,11 @@ struct ata_port_operations {void (*dev_select)(struct ata_port *ap,unsigned int device);void (*phy_reset) (struct ata_port *ap);/* obsolete */ -void (*set_mode) (struct ata_port *ap); +int (*set_mode) (struct ata_port *ap,struct ata_device **r_failed_dev);void (*post_set_mode) (struct ata_port *ap); -int (*check_atapi_dma) (struct ata_queued_cmd *qc); +int (*check_atapi_dma) (struct ata_queued_cmd *qc);void (*bmdma_setup) (struct ata_queued_cmd *qc);void (*bmdma_start) (struct ata_queued_cmd *qc);