diff options
Diffstat (limited to 'drivers/scsi/ahci.c')
-rw-r--r-- | drivers/scsi/ahci.c | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 179c95c878ac..320df6cd3def 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -189,7 +189,6 @@ static void ahci_irq_clear(struct ata_port *ap); | |||
189 | static void ahci_eng_timeout(struct ata_port *ap); | 189 | static void ahci_eng_timeout(struct ata_port *ap); |
190 | static int ahci_port_start(struct ata_port *ap); | 190 | static int ahci_port_start(struct ata_port *ap); |
191 | static void ahci_port_stop(struct ata_port *ap); | 191 | static void ahci_port_stop(struct ata_port *ap); |
192 | static void ahci_host_stop(struct ata_host_set *host_set); | ||
193 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | 192 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf); |
194 | static void ahci_qc_prep(struct ata_queued_cmd *qc); | 193 | static void ahci_qc_prep(struct ata_queued_cmd *qc); |
195 | static u8 ahci_check_status(struct ata_port *ap); | 194 | static u8 ahci_check_status(struct ata_port *ap); |
@@ -242,7 +241,6 @@ static struct ata_port_operations ahci_ops = { | |||
242 | 241 | ||
243 | .port_start = ahci_port_start, | 242 | .port_start = ahci_port_start, |
244 | .port_stop = ahci_port_stop, | 243 | .port_stop = ahci_port_stop, |
245 | .host_stop = ahci_host_stop, | ||
246 | }; | 244 | }; |
247 | 245 | ||
248 | static struct ata_port_info ahci_port_info[] = { | 246 | static struct ata_port_info ahci_port_info[] = { |
@@ -252,7 +250,7 @@ static struct ata_port_info ahci_port_info[] = { | |||
252 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 250 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
253 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | | 251 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | |
254 | ATA_FLAG_PIO_DMA, | 252 | ATA_FLAG_PIO_DMA, |
255 | .pio_mask = 0x03, /* pio3-4 */ | 253 | .pio_mask = 0x1f, /* pio0-4 */ |
256 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 254 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
257 | .port_ops = &ahci_ops, | 255 | .port_ops = &ahci_ops, |
258 | }, | 256 | }, |
@@ -296,17 +294,9 @@ static inline unsigned long ahci_port_base_ul (unsigned long base, unsigned int | |||
296 | return base + 0x100 + (port * 0x80); | 294 | return base + 0x100 + (port * 0x80); |
297 | } | 295 | } |
298 | 296 | ||
299 | static inline void *ahci_port_base (void *base, unsigned int port) | 297 | static inline void __iomem *ahci_port_base (void __iomem *base, unsigned int port) |
300 | { | 298 | { |
301 | return (void *) ahci_port_base_ul((unsigned long)base, port); | 299 | return (void __iomem *) ahci_port_base_ul((unsigned long)base, port); |
302 | } | ||
303 | |||
304 | static void ahci_host_stop(struct ata_host_set *host_set) | ||
305 | { | ||
306 | struct ahci_host_priv *hpriv = host_set->private_data; | ||
307 | kfree(hpriv); | ||
308 | |||
309 | ata_host_stop(host_set); | ||
310 | } | 300 | } |
311 | 301 | ||
312 | static int ahci_port_start(struct ata_port *ap) | 302 | static int ahci_port_start(struct ata_port *ap) |
@@ -314,8 +304,9 @@ static int ahci_port_start(struct ata_port *ap) | |||
314 | struct device *dev = ap->host_set->dev; | 304 | struct device *dev = ap->host_set->dev; |
315 | struct ahci_host_priv *hpriv = ap->host_set->private_data; | 305 | struct ahci_host_priv *hpriv = ap->host_set->private_data; |
316 | struct ahci_port_priv *pp; | 306 | struct ahci_port_priv *pp; |
317 | void *mem, *mmio = ap->host_set->mmio_base; | 307 | void __iomem *mmio = ap->host_set->mmio_base; |
318 | void *port_mmio = ahci_port_base(mmio, ap->port_no); | 308 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
309 | void *mem; | ||
319 | dma_addr_t mem_dma; | 310 | dma_addr_t mem_dma; |
320 | 311 | ||
321 | pp = kmalloc(sizeof(*pp), GFP_KERNEL); | 312 | pp = kmalloc(sizeof(*pp), GFP_KERNEL); |
@@ -383,8 +374,8 @@ static void ahci_port_stop(struct ata_port *ap) | |||
383 | { | 374 | { |
384 | struct device *dev = ap->host_set->dev; | 375 | struct device *dev = ap->host_set->dev; |
385 | struct ahci_port_priv *pp = ap->private_data; | 376 | struct ahci_port_priv *pp = ap->private_data; |
386 | void *mmio = ap->host_set->mmio_base; | 377 | void __iomem *mmio = ap->host_set->mmio_base; |
387 | void *port_mmio = ahci_port_base(mmio, ap->port_no); | 378 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
388 | u32 tmp; | 379 | u32 tmp; |
389 | 380 | ||
390 | tmp = readl(port_mmio + PORT_CMD); | 381 | tmp = readl(port_mmio + PORT_CMD); |
@@ -546,8 +537,8 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc) | |||
546 | 537 | ||
547 | static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) | 538 | static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) |
548 | { | 539 | { |
549 | void *mmio = ap->host_set->mmio_base; | 540 | void __iomem *mmio = ap->host_set->mmio_base; |
550 | void *port_mmio = ahci_port_base(mmio, ap->port_no); | 541 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
551 | u32 tmp; | 542 | u32 tmp; |
552 | int work; | 543 | int work; |
553 | 544 | ||
@@ -595,8 +586,8 @@ static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) | |||
595 | static void ahci_eng_timeout(struct ata_port *ap) | 586 | static void ahci_eng_timeout(struct ata_port *ap) |
596 | { | 587 | { |
597 | struct ata_host_set *host_set = ap->host_set; | 588 | struct ata_host_set *host_set = ap->host_set; |
598 | void *mmio = host_set->mmio_base; | 589 | void __iomem *mmio = host_set->mmio_base; |
599 | void *port_mmio = ahci_port_base(mmio, ap->port_no); | 590 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
600 | struct ata_queued_cmd *qc; | 591 | struct ata_queued_cmd *qc; |
601 | unsigned long flags; | 592 | unsigned long flags; |
602 | 593 | ||
@@ -626,8 +617,8 @@ static void ahci_eng_timeout(struct ata_port *ap) | |||
626 | 617 | ||
627 | static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | 618 | static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) |
628 | { | 619 | { |
629 | void *mmio = ap->host_set->mmio_base; | 620 | void __iomem *mmio = ap->host_set->mmio_base; |
630 | void *port_mmio = ahci_port_base(mmio, ap->port_no); | 621 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
631 | u32 status, serr, ci; | 622 | u32 status, serr, ci; |
632 | 623 | ||
633 | serr = readl(port_mmio + PORT_SCR_ERR); | 624 | serr = readl(port_mmio + PORT_SCR_ERR); |
@@ -663,7 +654,7 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs * | |||
663 | struct ata_host_set *host_set = dev_instance; | 654 | struct ata_host_set *host_set = dev_instance; |
664 | struct ahci_host_priv *hpriv; | 655 | struct ahci_host_priv *hpriv; |
665 | unsigned int i, handled = 0; | 656 | unsigned int i, handled = 0; |
666 | void *mmio; | 657 | void __iomem *mmio; |
667 | u32 irq_stat, irq_ack = 0; | 658 | u32 irq_stat, irq_ack = 0; |
668 | 659 | ||
669 | VPRINTK("ENTER\n"); | 660 | VPRINTK("ENTER\n"); |
@@ -709,7 +700,7 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs * | |||
709 | static int ahci_qc_issue(struct ata_queued_cmd *qc) | 700 | static int ahci_qc_issue(struct ata_queued_cmd *qc) |
710 | { | 701 | { |
711 | struct ata_port *ap = qc->ap; | 702 | struct ata_port *ap = qc->ap; |
712 | void *port_mmio = (void *) ap->ioaddr.cmd_addr; | 703 | void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; |
713 | 704 | ||
714 | writel(1, port_mmio + PORT_CMD_ISSUE); | 705 | writel(1, port_mmio + PORT_CMD_ISSUE); |
715 | readl(port_mmio + PORT_CMD_ISSUE); /* flush */ | 706 | readl(port_mmio + PORT_CMD_ISSUE); /* flush */ |
@@ -894,7 +885,7 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent) | |||
894 | { | 885 | { |
895 | struct ahci_host_priv *hpriv = probe_ent->private_data; | 886 | struct ahci_host_priv *hpriv = probe_ent->private_data; |
896 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); | 887 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); |
897 | void *mmio = probe_ent->mmio_base; | 888 | void __iomem *mmio = probe_ent->mmio_base; |
898 | u32 vers, cap, impl, speed; | 889 | u32 vers, cap, impl, speed; |
899 | const char *speed_s; | 890 | const char *speed_s; |
900 | u16 cc; | 891 | u16 cc; |
@@ -967,7 +958,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
967 | struct ata_probe_ent *probe_ent = NULL; | 958 | struct ata_probe_ent *probe_ent = NULL; |
968 | struct ahci_host_priv *hpriv; | 959 | struct ahci_host_priv *hpriv; |
969 | unsigned long base; | 960 | unsigned long base; |
970 | void *mmio_base; | 961 | void __iomem *mmio_base; |
971 | unsigned int board_idx = (unsigned int) ent->driver_data; | 962 | unsigned int board_idx = (unsigned int) ent->driver_data; |
972 | int have_msi, pci_dev_busy = 0; | 963 | int have_msi, pci_dev_busy = 0; |
973 | int rc; | 964 | int rc; |
@@ -1004,8 +995,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1004 | probe_ent->dev = pci_dev_to_dev(pdev); | 995 | probe_ent->dev = pci_dev_to_dev(pdev); |
1005 | INIT_LIST_HEAD(&probe_ent->node); | 996 | INIT_LIST_HEAD(&probe_ent->node); |
1006 | 997 | ||
1007 | mmio_base = ioremap(pci_resource_start(pdev, AHCI_PCI_BAR), | 998 | mmio_base = pci_iomap(pdev, AHCI_PCI_BAR, 0); |
1008 | pci_resource_len(pdev, AHCI_PCI_BAR)); | ||
1009 | if (mmio_base == NULL) { | 999 | if (mmio_base == NULL) { |
1010 | rc = -ENOMEM; | 1000 | rc = -ENOMEM; |
1011 | goto err_out_free_ent; | 1001 | goto err_out_free_ent; |
@@ -1049,7 +1039,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1049 | err_out_hpriv: | 1039 | err_out_hpriv: |
1050 | kfree(hpriv); | 1040 | kfree(hpriv); |
1051 | err_out_iounmap: | 1041 | err_out_iounmap: |
1052 | iounmap(mmio_base); | 1042 | pci_iounmap(pdev, mmio_base); |
1053 | err_out_free_ent: | 1043 | err_out_free_ent: |
1054 | kfree(probe_ent); | 1044 | kfree(probe_ent); |
1055 | err_out_msi: | 1045 | err_out_msi: |
@@ -1089,7 +1079,8 @@ static void ahci_remove_one (struct pci_dev *pdev) | |||
1089 | scsi_host_put(ap->host); | 1079 | scsi_host_put(ap->host); |
1090 | } | 1080 | } |
1091 | 1081 | ||
1092 | host_set->ops->host_stop(host_set); | 1082 | kfree(hpriv); |
1083 | pci_iounmap(pdev, host_set->mmio_base); | ||
1093 | kfree(host_set); | 1084 | kfree(host_set); |
1094 | 1085 | ||
1095 | if (have_msi) | 1086 | if (have_msi) |
@@ -1106,7 +1097,6 @@ static int __init ahci_init(void) | |||
1106 | return pci_module_init(&ahci_pci_driver); | 1097 | return pci_module_init(&ahci_pci_driver); |
1107 | } | 1098 | } |
1108 | 1099 | ||
1109 | |||
1110 | static void __exit ahci_exit(void) | 1100 | static void __exit ahci_exit(void) |
1111 | { | 1101 | { |
1112 | pci_unregister_driver(&ahci_pci_driver); | 1102 | pci_unregister_driver(&ahci_pci_driver); |