libata updates
Subsystems (2)
PATCH 1/1 libata updates
Bug fixes, and 1/4 of Tejun's port multiplier work.
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:
drivers/ata/ahci.c | 255 +++++++++++++++++++++++++------------------ drivers/ata/libata-core.c | 79 +++++++++----- drivers/ata/libata-eh.c | 204 ++++++++++++++++++++++++++++++++--- drivers/ata/libata-scsi.c | 63 ++++++++--- drivers/ata/libata-sff.c | 4 +- drivers/ata/libata.h | 3 +- drivers/ata/pata_platform.c | 5 +- drivers/ata/pata_scc.c | 29 +++-- drivers/ata/sata_inic162x.c | 16 ++-- drivers/ata/sata_mv.c | 203 ++++++++++++++++++++-------------- drivers/ata/sata_nv.c | 38 ++++--- drivers/ata/sata_promise.c | 25 +++-- drivers/ata/sata_qstor.c | 18 ++-- drivers/ata/sata_sil.c | 25 +++-- drivers/ata/sata_sil24.c | 139 ++++++++++++++++------- drivers/ata/sata_sis.c | 22 ++-- drivers/ata/sata_svw.c | 13 +- drivers/ata/sata_uli.c | 16 ++- drivers/ata/sata_via.c | 27 +++-- drivers/ata/sata_vsc.c | 13 +- include/linux/libata.h | 35 +++--- 21 files changed, 816 insertions(+), 416 deletions(-)
Akira Iguchi (1):
pata_scc.c: small fixes (Workaround for errata A308)
Alexey Dobriyan (1):
ahci.c: fix CONFIG_PM=n compilation
Dave Jones (1):
Correct comment in libata-sff.c
Jeff Garzik (2):
[libata] sata_mv: Micro-optimization and cleanups [libata] sata_mv: minor cleanups
Magnus Damm (1):
pata_platform: Fix NULL pointer dereference
Petr Vandrovec (1):
[libata] Fix reported task file values in sense data
Tejun Heo (21):
libata: add ST9160821AS 3.CLF to NONCQ blacklist
libata: add @is_cmd to ata_tf_to_fis()
ahci: use deadline instead of fixed timeout for 1st FIS for SRST
ahci: separate out ahci_kick_engine()
ahci: separate out ahci_exec_polled_cmd()
ahci: separate out ahci_do_softreset()
sata_sil24: replace sil24_update_tf() with sil24_read_tf()
sata_sil24: separate out sil24_exec_polled_cmd()
sata_sil24: separate out sil24_do_softreset()
libata: improve EH report formatting
libata: implement AC_ERR_NCQ
libata: make ->scr_read/write callbacks return error code
ahci: make NO_NCQ handling more consistent
ahci: implement SCR_NOTIFICATION r/w
libata: improve SATA PHY speed down logic
libata: quickly trigger SATA SPD down after debouncing failed
libata: improve SCSI scan failure handling
libata: reorganize ata_ehi_hotplugged()
libata: clear HOTPLUG flag after a reset
libata: schedule probing after SError access failure during autopsy
libata: implement EH fast drain
su henry (1):
The SATA controller device ID is different according to
drivers/ata/ahci.c +149 -106
@@ -99,6 +99,7 @@ enum {HOST_CAP_SSC = (1 <<14 ),/* Slumber capable */ HOST_CAP_CLO = (1 <<24 ),/* Command List Override support */ HOST_CAP_SSS = (1 <<27 ),/* Staggered Spin-up */ +HOST_CAP_SNTF = (1 <<29 ),/* SNotification register */ HOST_CAP_NCQ = (1 <<30 ),/* Native Command Queueing */ HOST_CAP_64 = (1 << 31), /* PCI DAC (64-bit DMA) support */
@@ -113,11 +114,11 @@ enum {PORT_TFDATA =0x20 ,/* taskfile data */ PORT_SIG =0x24 ,/* device TF signature */ PORT_CMD_ISSUE =0x38 ,/* command issue */ -PORT_SCR =0x28 ,/* SATA phy register block */ PORT_SCR_STAT =0x28 ,/* SATA phy register: SStatus */ PORT_SCR_CTL =0x2c ,/* SATA phy register: SControl */ PORT_SCR_ERR =0x30 ,/* SATA phy register: SError */ PORT_SCR_ACT =0x34 ,/* SATA phy register: SActive */ +PORT_SCR_NTF =0x3c ,/* SATA phy register: SNotification */ /* PORT_IRQ_{STAT,MASK} bits */ PORT_IRQ_COLD_PRES = (1 << 31), /* cold presence detect */
@@ -216,8 +217,8 @@ struct ahci_port_priv { unsigned int ncq_saw_sdb:1; }; -static u32 ahci_scr_read (struct ata_port *ap,unsigned int sc_reg); -static void ahci_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val); +static int ahci_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val); +static int ahci_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val);static int ahci_init_one (struct pci_dev *pdev,const struct pci_device_id *ent);static unsigned int ahci_qc_issue (struct ata_queued_cmd *qc);static void ahci_irq_clear (struct ata_port *ap);
@@ -417,7 +418,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {/* ATI */ { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */ - { PCI_VDEVICE(ATI, 0x4390), board_ahci_sb600 }, /* ATI SB700 */ + { PCI_VDEVICE(ATI, 0x4390), board_ahci_sb600 }, /* ATI SB700 IDE */ + { PCI_VDEVICE(ATI, 0x4391), board_ahci_sb600 }, /* ATI SB700 AHCI */ + { PCI_VDEVICE(ATI, 0x4392), board_ahci_sb600 }, /* ATI SB700 nraid5 */ + { PCI_VDEVICE(ATI, 0x4393), board_ahci_sb600 }, /* ATI SB700 raid5 *//* VIA */ { PCI_VDEVICE(VIA, 0x3349), board_ahci_vt8251 }, /* VIA VT8251 */
@@ -545,13 +549,19 @@ static void ahci_save_initial_config(struct pci_dev *pdev, hpriv->saved_cap = cap =readl (mmio +HOST_CAP ); hpriv->saved_port_map = port_map =readl (mmio +HOST_PORTS_IMPL ); -/* some chips lie about 64bit support */ +/* some chips have errata preventing 64bit use */ if ((cap &HOST_CAP_64 ) && (pi->flags &AHCI_FLAG_32BIT_ONLY )) {dev_printk (KERN_INFO , &pdev->dev,"controller can't do 64bit DMA, forcing 32bit\n" ); cap &= ~HOST_CAP_64 ; } +if ((cap &HOST_CAP_NCQ ) && (pi->flags &AHCI_FLAG_NO_NCQ )) { +dev_printk (KERN_INFO , &pdev->dev, +"controller can't do NCQ, turning off CAP_NCQ\n" ); + cap &= ~HOST_CAP_NCQ ; + } +/* fixup zero port_map */ if (!port_map) { port_map = (1 <<ahci_nr_ports (cap)) -1 ;
@@ -625,38 +635,45 @@ static void ahci_restore_initial_config(struct ata_host *host) (void )readl (mmio +HOST_PORTS_IMPL );/* flush */ } -static u32 ahci_scr_read (struct ata_port *ap,unsigned int sc_reg_in) +static unsigned ahci_scr_offset (struct ata_port *ap,unsigned int sc_reg) { -unsigned int sc_reg; - -switch (sc_reg_in) { -case SCR_STATUS : sc_reg =0 ;break ; -case SCR_CONTROL : sc_reg =1 ;break ; -case SCR_ERROR : sc_reg =2 ;break ; -case SCR_ACTIVE : sc_reg =3 ;break ; -default : -return 0xffffffffU ; - } +static const int offset[] = { + [SCR_STATUS ] =PORT_SCR_STAT , + [SCR_CONTROL ] =PORT_SCR_CTL , + [SCR_ERROR ] =PORT_SCR_ERR , + [SCR_ACTIVE ] =PORT_SCR_ACT , + [SCR_NOTIFICATION ] =PORT_SCR_NTF , + }; +struct ahci_host_priv *hpriv = ap->host->private_data; -return readl (ap->ioaddr.scr_addr + (sc_reg *4 )); +if (sc_reg <ARRAY_SIZE (offset) && + (sc_reg !=SCR_NOTIFICATION || (hpriv->cap &HOST_CAP_SNTF ))) +return offset[sc_reg]; +return 0 ; } - -static void ahci_scr_write (struct ata_port *ap,unsigned int sc_reg_in, -u32 val) +static int ahci_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val) { -unsigned int sc_reg; - -switch (sc_reg_in) { -case SCR_STATUS : sc_reg =0 ;break ; -case SCR_CONTROL : sc_reg =1 ;break ; -case SCR_ERROR : sc_reg =2 ;break ; -case SCR_ACTIVE : sc_reg =3 ;break ; -default : -return ; +void __iomem *port_mmio =ahci_port_base (ap); +int offset =ahci_scr_offset (ap, sc_reg); + +if (offset) { + *val =readl (port_mmio + offset); +return 0 ; } +return -EINVAL ; +} -writel (val, ap->ioaddr.scr_addr + (sc_reg *4 )); +static int ahci_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) +{ +void __iomem *port_mmio =ahci_port_base (ap); +int offset =ahci_scr_offset (ap, sc_reg); + +if (offset) { +writel (val, port_mmio + offset); +return 0 ; + } +return -EINVAL ; }static void ahci_start_engine (struct ata_port *ap)
@@ -948,37 +965,87 @@ static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag, pp->cmd_slot[tag].tbl_addr_hi =cpu_to_le32 ((cmd_tbl_dma >>16 ) >>16 ); } -static int ahci_clo (struct ata_port *ap) +static int ahci_kick_engine (struct ata_port *ap,int force_restart) {void __iomem *port_mmio = ap->ioaddr.cmd_addr;struct ahci_host_priv *hpriv = ap->host->private_data;u32 tmp; +int busy, rc; + +/* do we need to kick the port? */ + busy =ahci_check_status (ap) & (ATA_BUSY |ATA_DRQ ); +if (!busy && !force_restart) +return 0 ; + +/* stop engine */ + rc =ahci_stop_engine (ap); +if (rc) + goto out_restart; -if (!(hpriv->cap &HOST_CAP_CLO )) -return -EOPNOTSUPP ; +/* need to do CLO? */ +if (!busy) { + rc =0 ; + goto out_restart; + } +if (!(hpriv->cap &HOST_CAP_CLO )) { + rc = -EOPNOTSUPP ; + goto out_restart; + } + +/* perform CLO */ tmp =readl (port_mmio +PORT_CMD ); tmp |=PORT_CMD_CLO ;writel (tmp, port_mmio +PORT_CMD ); + rc =0 ; tmp =ata_wait_register (port_mmio +PORT_CMD ,PORT_CMD_CLO ,PORT_CMD_CLO ,1 ,500 );if (tmp &PORT_CMD_CLO ) -return -EIO ; + rc = -EIO ; -return 0 ; +/* restart engine */ + out_restart: +ahci_start_engine (ap); +return rc; } -static int ahci_softreset (struct ata_port *ap,unsigned int *class, -unsigned long deadline) +static int ahci_exec_polled_cmd (struct ata_port *ap,int pmp, +struct ata_taskfile *tf,int is_cmd,u16 flags, +unsigned long timeout_msec) { +const u32 cmd_fis_len =5 ;/* five dwords */ struct ahci_port_priv *pp = ap->private_data;void __iomem *port_mmio =ahci_port_base (ap); -const u32 cmd_fis_len =5 ;/* five dwords */ +u8 *fis = pp->cmd_tbl; +u32 tmp; + +/* prep the command */ +ata_tf_to_fis (tf, pmp, is_cmd, fis); +ahci_fill_cmd_slot (pp,0 , cmd_fis_len | flags | (pmp <<12 )); + +/* issue & wait */ +writel (1 , port_mmio +PORT_CMD_ISSUE ); + +if (timeout_msec) { + tmp =ata_wait_register (port_mmio +PORT_CMD_ISSUE ,0x1 ,0x1 , +1 , timeout_msec); +if (tmp &0x1 ) { +ahci_kick_engine (ap,1 ); +return -EBUSY ; + } + }else +readl (port_mmio +PORT_CMD_ISSUE );/* flush */ + +return 0 ; +} + +static int ahci_do_softreset (struct ata_port *ap,unsigned int *class, +int pmp,unsigned long deadline) +{const char *reason =NULL ; +unsigned long now, msecs;struct ata_taskfile tf; -u32 tmp; -u8 *fis;int rc;DPRINTK ("ENTER\n" );
@@ -990,43 +1057,22 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class, }/* prepare for SRST (AHCI-1.1 10.4.1) */ - rc =ahci_stop_engine (ap); -if (rc) { - reason ="failed to stop engine" ; - goto fail_restart; - } - -/* check BUSY/DRQ, perform Command List Override if necessary */ -if (ahci_check_status (ap) & (ATA_BUSY |ATA_DRQ )) { - rc =ahci_clo (ap); - -if (rc == -EOPNOTSUPP ) { - reason ="port busy but CLO unavailable" ; - goto fail_restart; - }else if (rc) { - reason ="port busy but CLO failed" ; - goto fail_restart; - } - } - -/* restart engine */ -ahci_start_engine (ap); + rc =ahci_kick_engine (ap,1 ); +if (rc) +ata_port_printk (ap,KERN_WARNING , +"failed to reset engine (errno=%d)" , rc);ata_tf_init (ap->device, &tf); - fis = pp->cmd_tbl;/* issue the first D2H Register FIS */ -ahci_fill_cmd_slot (pp,0 , - cmd_fis_len |AHCI_CMD_RESET |AHCI_CMD_CLR_BUSY ); + msecs =0 ; + now = jiffies; +if (time_after (now, deadline)) + msecs =jiffies_to_msecs (deadline - now); tf.ctl |=ATA_SRST ; -ata_tf_to_fis (&tf, fis,0 ); - fis[1 ] &= ~(1 <<7 );/* turn off Command FIS bit */ - -writel (1 , port_mmio +PORT_CMD_ISSUE ); - - tmp =ata_wait_register (port_mmio +PORT_CMD_ISSUE ,0x1 ,0x1 ,1 ,500 ); -if (tmp &0x1 ) { +if (ahci_exec_polled_cmd (ap, pmp, &tf,0 , +AHCI_CMD_RESET |AHCI_CMD_CLR_BUSY , msecs)) { rc = -EIO ; reason ="1st FIS failed" ; goto fail;
@@ -1036,14 +1082,8 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class,msleep (1 );/* issue the second D2H Register FIS */ -ahci_fill_cmd_slot (pp,0 , cmd_fis_len); - tf.ctl &= ~ATA_SRST ; -ata_tf_to_fis (&tf, fis,0 ); - fis[1 ] &= ~(1 <<7 );/* turn off Command FIS bit */ - -writel (1 , port_mmio +PORT_CMD_ISSUE ); -readl (port_mmio +PORT_CMD_ISSUE );/* flush */ +ahci_exec_polled_cmd (ap, pmp, &tf,0 ,0 ,0 );/* spec mandates ">= 2ms" before checking status. * We wait 150ms, because that was the magic delay used for
@@ -1066,13 +1106,17 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class,DPRINTK ("EXIT, class=%u\n" , *class);return 0 ; - fail_restart: -ahci_start_engine (ap); fail:ata_port_printk (ap,KERN_ERR ,"softreset failed (%s)\n" , reason);return rc; } +static int ahci_softreset (struct ata_port *ap,unsigned int *class, +unsigned long deadline) +{ +return ahci_do_softreset (ap, class,0 , deadline); +} +static int ahci_hardreset (struct ata_port *ap,unsigned int *class,unsigned long deadline) {
@@ -1088,7 +1132,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class,/* clear D2H reception area to properly wait for D2H FIS */ ata_tf_init (ap->device, &tf); tf.command =0x80 ; -ata_tf_to_fis (&tf, d2h_fis,0 ); +ata_tf_to_fis (&tf,0 ,0 , d2h_fis); rc =sata_std_hardreset (ap, class, deadline);
@@ -1106,6 +1150,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class,static int ahci_vt8251_hardreset (struct ata_port *ap,unsigned int *class,unsigned long deadline) { +u32 serror;int rc;DPRINTK ("ENTER\n" );
@@ -1116,7 +1161,8 @@ static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class, deadline);/* vt8251 needs SError cleared for the port to operate */ -ahci_scr_write (ap,SCR_ERROR ,ahci_scr_read (ap,SCR_ERROR )); +ahci_scr_read (ap,SCR_ERROR , &serror); +ahci_scr_write (ap,SCR_ERROR , serror);ahci_start_engine (ap);
@@ -1205,7 +1251,7 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)*/ cmd_tbl = pp->cmd_tbl + qc->tag *AHCI_CMD_TBL_SZ ; -ata_tf_to_fis (&qc->tf, cmd_tbl,0 ); +ata_tf_to_fis (&qc->tf,0 ,1 , cmd_tbl);if (is_atapi) {memset (cmd_tbl +AHCI_CMD_TBL_CDB ,0 ,32 );memcpy (cmd_tbl +AHCI_CMD_TBL_CDB , qc->cdb, qc->dev->cdb_len);
@@ -1238,7 +1284,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)ata_ehi_clear_desc (ehi);/* AHCI needs SError cleared; otherwise, it might lock up */ - serror =ahci_scr_read (ap,SCR_ERROR ); +ahci_scr_read (ap,SCR_ERROR , &serror);ahci_scr_write (ap,SCR_ERROR , serror);/* analyze @irq_stat */
@@ -1262,12 +1308,12 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)if (irq_stat &PORT_IRQ_IF_ERR ) { err_mask |=AC_ERR_ATA_BUS ; action |=ATA_EH_SOFTRESET ; -ata_ehi_push_desc (ehi,", interface fatal error" ); +ata_ehi_push_desc (ehi,"interface fatal error" ); }if (irq_stat & (PORT_IRQ_CONNECT |PORT_IRQ_PHYRDY )) {ata_ehi_hotplugged (ehi); -ata_ehi_push_desc (ehi,", %s" , irq_stat &PORT_IRQ_CONNECT ? +ata_ehi_push_desc (ehi,"%s" , irq_stat &PORT_IRQ_CONNECT ?"connection status changed" :"PHY RDY changed" ); }
@@ -1276,7 +1322,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) err_mask |=AC_ERR_HSM ; action |=ATA_EH_SOFTRESET ; -ata_ehi_push_desc (ehi,", unknown FIS %08x %08x %08x %08x" , +ata_ehi_push_desc (ehi,"unknown FIS %08x %08x %08x %08x" , unk[0 ], unk[1 ], unk[2 ], unk[3 ]); }
@@ -1512,11 +1558,17 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap; -if (qc->flags &ATA_QCFLAG_FAILED ) { -/* make DMA engine forget about the failed command */ -ahci_stop_engine (ap); -ahci_start_engine (ap); - } +/* make DMA engine forget about the failed command */ +if (qc->flags &ATA_QCFLAG_FAILED ) +ahci_kick_engine (ap,1 ); +} + +static int ahci_port_resume (struct ata_port *ap) +{ +ahci_power_up (ap); +ahci_start_port (ap); + +return 0 ; }#ifdef CONFIG_PM
@@ -1536,14 +1588,6 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)return rc; } -static int ahci_port_resume (struct ata_port *ap) -{ -ahci_power_up (ap); -ahci_start_port (ap); - -return 0 ; -} -static int ahci_pci_device_suspend (struct pci_dev *pdev,pm_message_t mesg) {struct ata_host *host =dev_get_drvdata (&pdev->dev);
@@ -1734,12 +1778,13 @@ static void ahci_print_info(struct ata_host *host) dev_printk(KERN_INFO, &pdev->dev, "flags: " - "%s%s%s%s%s%s" - "%s%s%s%s%s%s%s\n" + "%s%s%s%s%s%s%s" + "%s%s%s%s%s%s%s\n" , cap & (1 << 31) ? "64bit " : "", cap & (1 << 30) ? "ncq " : "", + cap & (1 << 29) ? "sntf " : "", cap & (1 << 28) ? "ilck " : "", cap & (1 << 27) ? "stag " : "", cap & (1 << 26) ? "pm " : "",
@@ -1794,7 +1839,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)ahci_save_initial_config (pdev, &pi, hpriv);/* prepare host */ -if (!(pi.flags &AHCI_FLAG_NO_NCQ ) && (hpriv->cap &HOST_CAP_NCQ )) +if (hpriv->cap &HOST_CAP_NCQ ) pi.flags |=ATA_FLAG_NCQ ; host =ata_host_alloc_pinfo (&pdev->dev, ppi,fls (hpriv->port_map));
@@ -1808,10 +1853,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)void __iomem *port_mmio =ahci_port_base (ap);/* standard SATA port setup */ -if (hpriv->port_map & (1 << i)) { +if (hpriv->port_map & (1 << i)) ap->ioaddr.cmd_addr = port_mmio; - ap->ioaddr.scr_addr = port_mmio +PORT_SCR ; - }/* disabled/not-implemented port */ else
drivers/ata/libata-core.c +52 -27
163 lines not on this page · raw message
drivers/ata/libata-eh.c +190 -14
331 lines not on this page · raw message
drivers/ata/libata-scsi.c +47 -16
90 lines not on this page · raw message
drivers/ata/libata-sff.c +3 -1
@@ -1,5 +1,5 @@/* -* libata-bmdma.c - helper library for PCI IDE BMDMA +* libata-sff.c - helper library for PCI IDE BMDMA * * Maintained by: Jeff Garzik <[email protected]> * Please ALWAYS copy [email protected]
@@ -211,6 +211,8 @@ void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) tf->hob_lbal =ioread8 (ioaddr->lbal_addr); tf->hob_lbam =ioread8 (ioaddr->lbam_addr); tf->hob_lbah =ioread8 (ioaddr->lbah_addr); +iowrite8 (tf->ctl, ioaddr->ctl_addr); + ap->last_ctl = tf->ctl; } }
drivers/ata/libata.h +2 -1
@@ -112,7 +112,7 @@ static inline int ata_acpi_on_devcfg(struct ata_device *adev) { return 0; }/* libata-scsi.c */ extern int ata_scsi_add_hosts (struct ata_host *host,struct scsi_host_template *sht); -extern void ata_scsi_scan_host (struct ata_port *ap); +extern void ata_scsi_scan_host (struct ata_port *ap,int sync);extern int ata_scsi_offline_dev (struct ata_device *dev);extern void ata_scsi_hotplug (struct work_struct *work); extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
@@ -151,6 +151,7 @@ extern int ata_bus_probe(struct ata_port *ap);extern enum scsi_eh_timer_return ata_scsi_timed_out (struct scsi_cmnd *cmd);extern void ata_scsi_error (struct Scsi_Host *host);extern void ata_port_wait_eh (struct ata_port *ap); +extern void ata_eh_fastdrain_timerfn (unsigned long arg);extern void ata_qc_schedule_eh (struct ata_queued_cmd *qc);/* libata-sff.c */
drivers/ata/pata_platform.c +3 -2
@@ -213,8 +213,9 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)pata_platform_setup_port (&ap->ioaddr, pp_info);/* activate */ -return ata_host_activate (host,platform_get_irq (pdev,0 ), ata_interrupt, - pp_info->irq_flags, &pata_platform_sht); +return ata_host_activate (host,platform_get_irq (pdev,0 ), + ata_interrupt, pp_info ? pp_info->irq_flags + :0 , &pata_platform_sht); }/**
drivers/ata/pata_scc.c +18 -11
@@ -238,12 +238,6 @@ static void scc_set_dmamode (struct ata_port *ap, struct ata_device *adev)else offset =0 ;/* 100MHz */ -/* errata A308 workaround: limit ATAPI UDMA mode to UDMA4 */ -if (adev->class ==ATA_DEV_ATAPI && speed >XFER_UDMA_4 ) { -printk (KERN_INFO "%s: limit ATAPI UDMA to UDMA4\n" ,DRV_NAME ); - speed =XFER_UDMA_4 ; - } -if (speed >=XFER_UDMA_0 ) idx = speed -XFER_UDMA_0 ;else
@@ -264,6 +258,17 @@ static void scc_set_dmamode (struct ata_port *ap, struct ata_device *adev) JCTSStbl[offset][idx] << 16 | JCENVTtbl[offset][idx]); } +unsigned long scc_mode_filter (struct ata_device *adev,unsigned long mask) +{ +/* errata A308 workaround: limit ATAPI UDMA mode to UDMA4 */ +if (adev->class ==ATA_DEV_ATAPI && + (mask & (0xE0 <<ATA_SHIFT_UDMA ))) { +printk (KERN_INFO "%s: limit ATAPI UDMA to UDMA4\n" ,DRV_NAME ); + mask &= ~(0xE0 <<ATA_SHIFT_UDMA ); + } +return ata_pci_default_filter (adev, mask); +} +/** * scc_tf_load - send taskfile registers to host controller * @ap: Port to which output is sent
@@ -358,6 +363,8 @@ static void scc_tf_read (struct ata_port *ap, struct ata_taskfile *tf) tf->hob_lbal =in_be32 (ioaddr->lbal_addr); tf->hob_lbam =in_be32 (ioaddr->lbam_addr); tf->hob_lbah =in_be32 (ioaddr->lbah_addr); +out_be32 (ioaddr->ctl_addr, tf->ctl); + ap->last_ctl = tf->ctl; } }
@@ -741,7 +748,7 @@ static u8 scc_bmdma_status (struct ata_port *ap)return host_stat;/* errata A252,A308 workaround: Step4 */ -if (ata_altstatus (ap) &ATA_ERR && int_status &INTSTS_INTRQ ) +if ((ata_altstatus (ap) &ATA_ERR ) && (int_status &INTSTS_INTRQ ))return (host_stat |ATA_DMA_INTR );/* errata A308 workaround Step5 */
@@ -752,11 +759,11 @@ static u8 scc_bmdma_status (struct ata_port *ap)if ((qc->tf.protocol ==ATA_PROT_DMA && qc->dev->xfer_mode >XFER_UDMA_4 )) {if (!(int_status &INTSTS_ACTEINT )) { -printk (KERN_WARNING "ata%u: data lost occurred. (ACTEINT==0, retry:%d)\n" , - ap->print_id, retry); +printk (KERN_WARNING "ata%u: operation failed (transfer data loss)\n" , + ap->print_id); host_stat |=ATA_DMA_ERR ;if (retry++) - ap->udma_mask >>=1 ; + ap->udma_mask &= ~(1 << qc->dev->xfer_mode); }else retry =0 ; }
@@ -1016,7 +1023,7 @@ static const struct ata_port_operations scc_pata_ops = { .port_disable = ata_port_disable, .set_piomode = scc_set_piomode, .set_dmamode = scc_set_dmamode, - .mode_filter = ata_pci_default_filter, + .mode_filter = scc_mode_filter, .tf_load = scc_tf_load, .tf_read = scc_tf_read,
drivers/ata/sata_inic162x.c +8 -8
@@ -190,34 +190,34 @@ static void inic_reset_port(void __iomem *port_base)writew (ctl, idma_ctl); } -static u32 inic_scr_read (struct ata_port *ap,unsigned sc_reg) +static int inic_scr_read (struct ata_port *ap,unsigned sc_reg,u32 *val) {void __iomem *scr_addr = ap->ioaddr.scr_addr;void __iomem *addr; -u32 val;if (unlikely (sc_reg >=ARRAY_SIZE (scr_map))) -return 0xffffffffU ; +return -EINVAL ; addr = scr_addr + scr_map[sc_reg] *4 ; - val =readl (scr_addr + scr_map[sc_reg] *4 ); + *val =readl (scr_addr + scr_map[sc_reg] *4 );/* this controller has stuck DIAG.N, ignore it */ if (sc_reg ==SCR_ERROR ) - val &= ~SERR_PHYRDY_CHG ; -return val; + *val &= ~SERR_PHYRDY_CHG ; +return 0 ; } -static void inic_scr_write (struct ata_port *ap,unsigned sc_reg,u32 val) +static int inic_scr_write (struct ata_port *ap,unsigned sc_reg,u32 val) {void __iomem *scr_addr = ap->ioaddr.scr_addr;void __iomem *addr;if (unlikely (sc_reg >=ARRAY_SIZE (scr_map))) -return ; +return -EINVAL ; addr = scr_addr + scr_map[sc_reg] *4 ;writel (val, scr_addr + scr_map[sc_reg] *4 ); +return 0 ; }/*
drivers/ata/sata_mv.c +119 -84
406 lines not on this page · raw message
drivers/ata/sata_nv.c +21 -17
@@ -236,8 +236,8 @@ static void nv_ck804_host_stop(struct ata_host *host);static irqreturn_t nv_generic_interrupt (int irq,void *dev_instance);static irqreturn_t nv_nf2_interrupt (int irq,void *dev_instance);static irqreturn_t nv_ck804_interrupt (int irq,void *dev_instance); -static u32 nv_scr_read (struct ata_port *ap,unsigned int sc_reg); -static void nv_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val); +static int nv_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val); +static int nv_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val);static void nv_nf2_freeze (struct ata_port *ap);static void nv_nf2_thaw (struct ata_port *ap);
@@ -715,19 +715,20 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err)int freeze =0 ;ata_ehi_clear_desc (ehi); -ata_ehi_push_desc (ehi,"CPB resp_flags 0x%x" , flags ); +__ata_ehi_push_desc (ehi,"CPB resp_flags 0x%x: " , flags );if (flags &NV_CPB_RESP_ATA_ERR ) { -ata_ehi_push_desc (ehi,": ATA error" ); +ata_ehi_push_desc (ehi,"ATA error" ); ehi->err_mask |=AC_ERR_DEV ; }else if (flags &NV_CPB_RESP_CMD_ERR ) { -ata_ehi_push_desc (ehi,": CMD error" ); +ata_ehi_push_desc (ehi,"CMD error" ); ehi->err_mask |=AC_ERR_DEV ; }else if (flags &NV_CPB_RESP_CPB_ERR ) { -ata_ehi_push_desc (ehi,": CPB error" ); +ata_ehi_push_desc (ehi,"CPB error" ); ehi->err_mask |=AC_ERR_SYSTEM ; freeze =1 ; }else {/* notifier error, but no error in CPB flags? */ +ata_ehi_push_desc (ehi,"unknown" ); ehi->err_mask |=AC_ERR_OTHER ; freeze =1 ; }
@@ -854,20 +855,21 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)struct ata_eh_info *ehi = &ap->eh_info;ata_ehi_clear_desc (ehi); -ata_ehi_push_desc (ehi,"ADMA status 0x%08x" , status ); +__ata_ehi_push_desc (ehi,"ADMA status 0x%08x: " , status );if (status &NV_ADMA_STAT_TIMEOUT ) { ehi->err_mask |=AC_ERR_SYSTEM ; -ata_ehi_push_desc (ehi,": timeout" ); +ata_ehi_push_desc (ehi,"timeout" ); }else if (status &NV_ADMA_STAT_HOTPLUG ) {ata_ehi_hotplugged (ehi); -ata_ehi_push_desc (ehi,": hotplug" ); +ata_ehi_push_desc (ehi,"hotplug" ); }else if (status &NV_ADMA_STAT_HOTUNPLUG ) {ata_ehi_hotplugged (ehi); -ata_ehi_push_desc (ehi,": hot unplug" ); +ata_ehi_push_desc (ehi,"hot unplug" ); }else if (status &NV_ADMA_STAT_SERROR ) {/* let libata analyze SError and figure out the cause */ -ata_ehi_push_desc (ehi,": SError" ); - } +ata_ehi_push_desc (ehi,"SError" ); + }else +ata_ehi_push_desc (ehi,"unknown" );ata_port_freeze (ap);continue ; }
@@ -1391,20 +1393,22 @@ static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance)return ret; } -static u32 nv_scr_read (struct ata_port *ap,unsigned int sc_reg) +static int nv_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val) {if (sc_reg >SCR_CONTROL ) -return 0xffffffffU ; +return -EINVAL ; -return ioread32 (ap->ioaddr.scr_addr + (sc_reg *4 )); + *val =ioread32 (ap->ioaddr.scr_addr + (sc_reg *4 )); +return 0 ; } -static void nv_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) +static int nv_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) {if (sc_reg >SCR_CONTROL ) -return ; +return -EINVAL ;iowrite32 (val, ap->ioaddr.scr_addr + (sc_reg *4 )); +return 0 ; }static void nv_nf2_freeze (struct ata_port *ap)
drivers/ata/sata_promise.c +15 -10
@@ -128,8 +128,8 @@ struct pdc_port_priv {dma_addr_t pkt_dma; }; -static u32 pdc_sata_scr_read (struct ata_port *ap,unsigned int sc_reg); -static void pdc_sata_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val); +static int pdc_sata_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val); +static int pdc_sata_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val);static int pdc_ata_init_one (struct pci_dev *pdev,const struct pci_device_id *ent);static int pdc_common_port_start (struct ata_port *ap);static int pdc_sata_port_start (struct ata_port *ap);
@@ -427,19 +427,20 @@ static int pdc_sata_cable_detect(struct ata_port *ap)return ATA_CBL_SATA ; } -static u32 pdc_sata_scr_read (struct ata_port *ap,unsigned int sc_reg) +static int pdc_sata_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val) {if (sc_reg >SCR_CONTROL ) -return 0xffffffffU ; -return readl (ap->ioaddr.scr_addr + (sc_reg *4 )); +return -EINVAL ; + *val =readl (ap->ioaddr.scr_addr + (sc_reg *4 )); +return 0 ; } -static void pdc_sata_scr_write (struct ata_port *ap,unsigned int sc_reg, -u32 val) +static int pdc_sata_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) {if (sc_reg >SCR_CONTROL ) -return ; +return -EINVAL ;writel (val, ap->ioaddr.scr_addr + (sc_reg *4 )); +return 0 ; }static void pdc_atapi_pkt (struct ata_queued_cmd *qc)
@@ -642,8 +643,12 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc, | PDC_PCI_SYS_ERR | PDC1_PCI_PARITY_ERR)) ac_err_mask |=AC_ERR_HOST_BUS ; -if (sata_scr_valid (ap)) - ehi->serror |=pdc_sata_scr_read (ap,SCR_ERROR ); +if (sata_scr_valid (ap)) { +u32 serror; + +pdc_sata_scr_read (ap,SCR_ERROR , &serror); + ehi->serror |= serror; + } qc->err_mask |= ac_err_mask;
drivers/ata/sata_qstor.c +10 -8
@@ -111,8 +111,8 @@ struct qs_port_priv {qs_state_t state; }; -static u32 qs_scr_read (struct ata_port *ap,unsigned int sc_reg); -static void qs_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val); +static int qs_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val); +static int qs_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val);static int qs_ata_init_one (struct pci_dev *pdev,const struct pci_device_id *ent);static int qs_port_start (struct ata_port *ap);static void qs_host_stop (struct ata_host *host);
@@ -255,18 +255,20 @@ static void qs_eng_timeout(struct ata_port *ap)ata_eng_timeout (ap); } -static u32 qs_scr_read (struct ata_port *ap,unsigned int sc_reg) +static int qs_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val) {if (sc_reg >SCR_CONTROL ) -return ~0U ; -return readl (ap->ioaddr.scr_addr + (sc_reg *8 )); +return -EINVAL ; + *val =readl (ap->ioaddr.scr_addr + (sc_reg *8 )); +return 0 ; } -static void qs_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) +static int qs_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) {if (sc_reg >SCR_CONTROL ) -return ; +return -EINVAL ;writel (val, ap->ioaddr.scr_addr + (sc_reg *8 )); +return 0 ; }static unsigned int qs_fill_sg (struct ata_queued_cmd *qc)
@@ -337,7 +339,7 @@ static void qs_qc_prep(struct ata_queued_cmd *qc) buf[28 ] = dflags;/* frame information structure (FIS) */ -ata_tf_to_fis (&qc->tf, &buf[32 ],0 ); +ata_tf_to_fis (&qc->tf,0 ,1 , &buf[32 ]); }static inline void qs_packet_start (struct ata_queued_cmd *qc)
drivers/ata/sata_sil.c +16 -9
@@ -115,8 +115,8 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);static int sil_pci_device_resume (struct pci_dev *pdev);#endif static void sil_dev_config (struct ata_device *dev); -static u32 sil_scr_read (struct ata_port *ap,unsigned int sc_reg); -static void sil_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val); +static int sil_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val); +static int sil_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val);static int sil_set_mode (struct ata_port *ap,struct ata_device **r_failed);static void sil_freeze (struct ata_port *ap);static void sil_thaw (struct ata_port *ap);
@@ -350,19 +350,26 @@ static inline void __iomem *sil_scr_addr(struct ata_port *ap, unsigned int sc_rereturn NULL ; } -static u32 sil_scr_read (struct ata_port *ap,unsigned int sc_reg) +static int sil_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val) {void __iomem *mmio =sil_scr_addr (ap, sc_reg); -if (mmio) -return readl (mmio); -return 0xffffffffU ; + +if (mmio) { + *val =readl (mmio); +return 0 ; + } +return -EINVAL ; } -static void sil_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) +static int sil_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) {void __iomem *mmio =sil_scr_addr (ap, sc_reg); -if (mmio) + +if (mmio) {writel (val, mmio); +return 0 ; + } +return -EINVAL ; }static void sil_host_intr (struct ata_port *ap,u32 bmdma2)
@@ -378,7 +385,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)* controllers continue to assert IRQ as long as * SError bits are pending. Clear SError immediately. */ - serror =sil_scr_read (ap,SCR_ERROR ); +sil_scr_read (ap,SCR_ERROR , &serror);sil_scr_write (ap,SCR_ERROR , serror);/* Trigger hotplug and accumulate SError only if the
drivers/ata/sata_sil24.c +96 -43
249 lines not on this page · raw message
drivers/ata/sata_sis.c +12 -10
@@ -64,8 +64,8 @@ enum { };static int sis_init_one (struct pci_dev *pdev,const struct pci_device_id *ent); -static u32 sis_scr_read (struct ata_port *ap,unsigned int sc_reg); -static void sis_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val); +static int sis_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val); +static int sis_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val);static const struct pci_device_id sis_pci_tbl[] = { {PCI_VDEVICE (SI ,0x0180 ), sis_180 },/* SiS 964/180 */
@@ -207,36 +207,37 @@ static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 valpci_write_config_dword (pdev, cfg_addr+0x10 , val); } -static u32 sis_scr_read (struct ata_port *ap,unsigned int sc_reg) +static int sis_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val) {struct pci_dev *pdev =to_pci_dev (ap->host->dev); -u32 val, val2 =0 ;u8 pmr;if (sc_reg >SCR_CONTROL ) -return 0xffffffffU ; +return -EINVAL ;if (ap->flags &SIS_FLAG_CFGSCR )return sis_scr_cfg_read (ap, sc_reg);pci_read_config_byte (pdev,SIS_PMR , &pmr); - val =ioread32 (ap->ioaddr.scr_addr + (sc_reg *4 )); + *val =ioread32 (ap->ioaddr.scr_addr + (sc_reg *4 ));if ((pdev->device ==0x0182 ) || (pdev->device ==0x0183 ) || (pdev->device ==0x1182 ) || (pmr &SIS_PMR_COMBINED )) - val2 =ioread32 (ap->ioaddr.scr_addr + (sc_reg *4 ) +0x10 ); + *val |=ioread32 (ap->ioaddr.scr_addr + (sc_reg *4 ) +0x10 ); + + *val &=0xfffffffb ; -return (val | val2) &0xfffffffb ; +return 0 ; } -static void sis_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) +static int sis_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) {struct pci_dev *pdev =to_pci_dev (ap->host->dev);u8 pmr;if (sc_reg >SCR_CONTROL ) -return ; +return -EINVAL ;pci_read_config_byte (pdev,SIS_PMR , &pmr);
@@ -248,6 +249,7 @@ static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED))iowrite32 (val, ap->ioaddr.scr_addr + (sc_reg *4 )+0x10 ); } +return 0 ; }static int sis_init_one (struct pci_dev *pdev,const struct pci_device_id *ent)
drivers/ata/sata_svw.c +7 -6
@@ -103,20 +103,21 @@ static int k2_sata_check_atapi_dma(struct ata_queued_cmd *qc)return 0 ; } -static u32 k2_sata_scr_read (struct ata_port *ap,unsigned int sc_reg) +static int k2_sata_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val) {if (sc_reg >SCR_CONTROL ) -return 0xffffffffU ; -return readl (ap->ioaddr.scr_addr + (sc_reg *4 )); +return -EINVAL ; + *val =readl (ap->ioaddr.scr_addr + (sc_reg *4 )); +return 0 ; } -static void k2_sata_scr_write (struct ata_port *ap,unsigned int sc_reg, -u32 val) +static int k2_sata_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) {if (sc_reg >SCR_CONTROL ) -return ; +return -EINVAL ;writel (val, ap->ioaddr.scr_addr + (sc_reg *4 )); +return 0 ; }
drivers/ata/sata_uli.c +9 -7
@@ -57,8 +57,8 @@ struct uli_priv { };static int uli_init_one (struct pci_dev *pdev,const struct pci_device_id *ent); -static u32 uli_scr_read (struct ata_port *ap,unsigned int sc_reg); -static void uli_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val); +static int uli_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val); +static int uli_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val);static const struct pci_device_id uli_pci_tbl[] = { {PCI_VDEVICE (AL ,0x5289 ), uli_5289 },
@@ -164,20 +164,22 @@ static void uli_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val)pci_write_config_dword (pdev, cfg_addr, val); } -static u32 uli_scr_read (struct ata_port *ap,unsigned int sc_reg) +static int uli_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val) {if (sc_reg >SCR_CONTROL ) -return 0xffffffffU ; +return -EINVAL ; -return uli_scr_cfg_read (ap, sc_reg); + *val =uli_scr_cfg_read (ap, sc_reg); +return 0 ; } -static void uli_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) +static int uli_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) {if (sc_reg >SCR_CONTROL )//SCR_CONTROL=2, SCR_ERROR=1, SCR_STATUS=0 -return ; +return -EINVAL ;uli_scr_cfg_write (ap, sc_reg, val); +return 0 ; }static int uli_init_one (struct pci_dev *pdev,const struct pci_device_id *ent)
drivers/ata/sata_via.c +15 -12
@@ -72,8 +72,8 @@ 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 int svia_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val); +static int 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 int vt6421_pata_cable_detect (struct ata_port *ap);
@@ -249,18 +249,20 @@ MODULE_LICENSE("GPL");MODULE_DEVICE_TABLE (pci, svia_pci_tbl);MODULE_VERSION (DRV_VERSION ); -static u32 svia_scr_read (struct ata_port *ap,unsigned int sc_reg) +static int svia_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val) {if (sc_reg >SCR_CONTROL ) -return 0xffffffffU ; -return ioread32 (ap->ioaddr.scr_addr + (4 * sc_reg)); +return -EINVAL ; + *val =ioread32 (ap->ioaddr.scr_addr + (4 * sc_reg)); +return 0 ; } -static void svia_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) +static int svia_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) {if (sc_reg >SCR_CONTROL ) -return ; +return -EINVAL ;iowrite32 (val, ap->ioaddr.scr_addr + (4 * sc_reg)); +return 0 ; }static void svia_noop_freeze (struct ata_port *ap)
@@ -305,18 +307,19 @@ static int vt6420_prereset(struct ata_port *ap, unsigned long deadline)/* Resume phy. This is the old SATA resume sequence */ svia_scr_write (ap,SCR_CONTROL ,0x300 ); -svia_scr_read (ap,SCR_CONTROL );/* flush */ +svia_scr_read (ap,SCR_CONTROL , &scontrol);/* flush */ /* wait for phy to become ready, if necessary */ do {msleep (200 ); -if ((svia_scr_read (ap,SCR_STATUS ) &0xf ) !=1 ) +svia_scr_read (ap,SCR_STATUS , &sstatus); +if ((sstatus &0xf ) !=1 )break ; }while (time_before (jiffies, timeout));/* open code sata_print_link_status() */ - sstatus =svia_scr_read (ap,SCR_STATUS ); - scontrol =svia_scr_read (ap,SCR_CONTROL ); +svia_scr_read (ap,SCR_STATUS , &sstatus); +svia_scr_read (ap,SCR_CONTROL , &scontrol); online = (sstatus &0xf ) ==0x3 ;
@@ -325,7 +328,7 @@ static int vt6420_prereset(struct ata_port *ap, unsigned long deadline) online ? "up" : "down", sstatus, scontrol);/* SStatus is read one more time */ -svia_scr_read (ap,SCR_STATUS ); +svia_scr_read (ap,SCR_STATUS , &sstatus);if (!online) {/* tell EH to bail */
drivers/ata/sata_vsc.c +7 -6
@@ -98,20 +98,21 @@ enum { VSC_SATA_INT_PHY_CHANGE), }; -static u32 vsc_sata_scr_read (struct ata_port *ap,unsigned int sc_reg) +static int vsc_sata_scr_read (struct ata_port *ap,unsigned int sc_reg,u32 *val) {if (sc_reg >SCR_CONTROL ) -return 0xffffffffU ; -return readl (ap->ioaddr.scr_addr + (sc_reg *4 )); +return -EINVAL ; + *val =readl (ap->ioaddr.scr_addr + (sc_reg *4 )); +return 0 ; } -static void vsc_sata_scr_write (struct ata_port *ap,unsigned int sc_reg, -u32 val) +static int vsc_sata_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val) {if (sc_reg >SCR_CONTROL ) -return ; +return -EINVAL ;writel (val, ap->ioaddr.scr_addr + (sc_reg *4 )); +return 0 ; }
include/linux/libata.h +17 -18
@@ -323,6 +323,7 @@ enum ata_completion_errors {AC_ERR_INVALID = (1 <<7 ),/* invalid argument */ AC_ERR_OTHER = (1 <<8 ),/* unknown */ AC_ERR_NODEV_HINT = (1 <<9 ),/* polling device detection hint */ + AC_ERR_NCQ = (1 << 10), /* marker for offending NCQ qc */ };/* forward declarations */
@@ -530,6 +531,7 @@ struct ata_port {unsigned int cbl;/* cable type; ATA_CBL_xxx */ unsigned int hw_sata_spd_limit;unsigned int sata_spd_limit;/* SATA PHY speed limit */ +unsigned int sata_spd;/* current SATA PHY speed */ /* record runtime error info, protected by host lock */ struct ata_eh_info eh_info;
@@ -563,6 +565,9 @@ struct ata_port {pm_message_t pm_mesg;int *pm_result; +struct timer_list fastdrain_timer; +unsigned long fastdrain_cnt; +void *private_data;#ifdef CONFIG_ATA_ACPI
@@ -619,9 +624,8 @@ struct ata_port_operations {u8 (*irq_on) (struct ata_port *);u8 (*irq_ack) (struct ata_port *ap,unsigned int chk_drq); -u32 (*scr_read) (struct ata_port *ap,unsigned int sc_reg); -void (*scr_write) (struct ata_port *ap,unsigned int sc_reg, -u32 val); +int (*scr_read) (struct ata_port *ap,unsigned int sc_reg,u32 *val); +int (*scr_write) (struct ata_port *ap,unsigned int sc_reg,u32 val);int (*port_suspend) (struct ata_port *ap,pm_message_t mesg);int (*port_resume) (struct ata_port *ap);
@@ -764,7 +768,8 @@ extern unsigned int ata_dev_try_classify(struct ata_port *, unsigned int, u8 *);*/ extern void ata_tf_load (struct ata_port *ap,const struct ata_taskfile *tf);extern void ata_tf_read (struct ata_port *ap,struct ata_taskfile *tf); -extern void ata_tf_to_fis (const struct ata_taskfile *tf,u8 *fis,u8 pmp); +extern void ata_tf_to_fis (const struct ata_taskfile *tf, +u8 pmp,int is_cmd,u8 *fis);extern void ata_tf_from_fis (const u8 *fis,struct ata_taskfile *tf);extern void ata_noop_dev_select (struct ata_port *ap,unsigned int device);extern void ata_std_dev_select (struct ata_port *ap,unsigned int device);
@@ -909,27 +914,21 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,/* * ata_eh_info helpers */ -#define ata_ehi_push_desc(ehi, fmt, args...) do { \ - (ehi)->desc_len += scnprintf((ehi)->desc + (ehi)->desc_len, \ - ATA_EH_DESC_LEN - (ehi)->desc_len, \ - fmt , ##args); \ -} while (0) - -#define ata_ehi_clear_desc (ehi) do { \ - (ehi)->desc[0] = '\0'; \ - (ehi)->desc_len = 0; \ -} while (0) - -static inline void __ata_ehi_hotplugged (struct ata_eh_info *ehi) +extern void __ata_ehi_push_desc (struct ata_eh_info *ehi,const char *fmt, ...); +extern void ata_ehi_push_desc (struct ata_eh_info *ehi,const char *fmt, ...); +extern void ata_ehi_clear_desc (struct ata_eh_info *ehi); + +static inline void ata_ehi_schedule_probe (struct ata_eh_info *ehi) { - ehi->flags |=ATA_EHI_HOTPLUGGED |ATA_EHI_RESUME_LINK ; + ehi->flags |=ATA_EHI_RESUME_LINK ; ehi->action |=ATA_EH_SOFTRESET ; ehi->probe_mask |= (1 <<ATA_MAX_DEVICES ) -1 ; }static inline void ata_ehi_hotplugged (struct ata_eh_info *ehi) { -__ata_ehi_hotplugged (ehi); +ata_ehi_schedule_probe (ehi); + ehi->flags |=ATA_EHI_HOTPLUGGED ; ehi->err_mask |=AC_ERR_ATA_BUS ; }