aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 210292cd8ad1..e044d6477a0f 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -216,8 +216,8 @@ struct ahci_port_priv {
216 unsigned int ncq_saw_sdb:1; 216 unsigned int ncq_saw_sdb:1;
217}; 217};
218 218
219static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg); 219static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
220static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 220static int ahci_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
221static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 221static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
222static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); 222static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc);
223static void ahci_irq_clear(struct ata_port *ap); 223static void ahci_irq_clear(struct ata_port *ap);
@@ -625,7 +625,7 @@ static void ahci_restore_initial_config(struct ata_host *host)
625 (void) readl(mmio + HOST_PORTS_IMPL); /* flush */ 625 (void) readl(mmio + HOST_PORTS_IMPL); /* flush */
626} 626}
627 627
628static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in) 628static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val)
629{ 629{
630 unsigned int sc_reg; 630 unsigned int sc_reg;
631 631
@@ -635,15 +635,15 @@ static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in)
635 case SCR_ERROR: sc_reg = 2; break; 635 case SCR_ERROR: sc_reg = 2; break;
636 case SCR_ACTIVE: sc_reg = 3; break; 636 case SCR_ACTIVE: sc_reg = 3; break;
637 default: 637 default:
638 return 0xffffffffU; 638 return -EINVAL;
639 } 639 }
640 640
641 return readl(ap->ioaddr.scr_addr + (sc_reg * 4)); 641 *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4));
642 return 0;
642} 643}
643 644
644 645
645static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg_in, 646static int ahci_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
646 u32 val)
647{ 647{
648 unsigned int sc_reg; 648 unsigned int sc_reg;
649 649
@@ -653,10 +653,11 @@ static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg_in,
653 case SCR_ERROR: sc_reg = 2; break; 653 case SCR_ERROR: sc_reg = 2; break;
654 case SCR_ACTIVE: sc_reg = 3; break; 654 case SCR_ACTIVE: sc_reg = 3; break;
655 default: 655 default:
656 return; 656 return -EINVAL;
657 } 657 }
658 658
659 writel(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 659 writel(val, ap->ioaddr.scr_addr + (sc_reg * 4));
660 return 0;
660} 661}
661 662
662static void ahci_start_engine(struct ata_port *ap) 663static void ahci_start_engine(struct ata_port *ap)
@@ -1133,6 +1134,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class,
1133static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class, 1134static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class,
1134 unsigned long deadline) 1135 unsigned long deadline)
1135{ 1136{
1137 u32 serror;
1136 int rc; 1138 int rc;
1137 1139
1138 DPRINTK("ENTER\n"); 1140 DPRINTK("ENTER\n");
@@ -1143,7 +1145,8 @@ static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class,
1143 deadline); 1145 deadline);
1144 1146
1145 /* vt8251 needs SError cleared for the port to operate */ 1147 /* vt8251 needs SError cleared for the port to operate */
1146 ahci_scr_write(ap, SCR_ERROR, ahci_scr_read(ap, SCR_ERROR)); 1148 ahci_scr_read(ap, SCR_ERROR, &serror);
1149 ahci_scr_write(ap, SCR_ERROR, serror);
1147 1150
1148 ahci_start_engine(ap); 1151 ahci_start_engine(ap);
1149 1152
@@ -1265,7 +1268,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
1265 ata_ehi_clear_desc(ehi); 1268 ata_ehi_clear_desc(ehi);
1266 1269
1267 /* AHCI needs SError cleared; otherwise, it might lock up */ 1270 /* AHCI needs SError cleared; otherwise, it might lock up */
1268 serror = ahci_scr_read(ap, SCR_ERROR); 1271 ahci_scr_read(ap, SCR_ERROR, &serror);
1269 ahci_scr_write(ap, SCR_ERROR, serror); 1272 ahci_scr_write(ap, SCR_ERROR, serror);
1270 1273
1271 /* analyze @irq_stat */ 1274 /* analyze @irq_stat */