diff options
author | Tejun Heo <htejun@gmail.com> | 2007-02-20 06:01:53 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-21 04:58:19 -0500 |
commit | e1be5d73e07dd6015b6ea255a36aae3b61b7b054 (patch) | |
tree | bb76780ea9cb95845460690b30d08ac4e5f34937 /drivers/ata/sata_via.c | |
parent | c3c70c443c2ef1fce31f201a93780c884b903993 (diff) |
sata_via: fix resource-managed iomap conversion
Conversion to resource-managed iomap was buggy causing init failures
on both vt6420 and 6421 - BAR5 wasn't mapped for both controllers
while on vt6420 sata_via tried to map BAR0-4 twice. Fix it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_via.c')
-rw-r--r-- | drivers/ata/sata_via.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index baca6d79bb0..fe9101a1dad 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -423,16 +423,21 @@ static struct ata_probe_ent *vt6420_init_probe_ent(struct pci_dev *pdev) | |||
423 | { | 423 | { |
424 | struct ata_probe_ent *probe_ent; | 424 | struct ata_probe_ent *probe_ent; |
425 | struct ata_port_info *ppi[2]; | 425 | struct ata_port_info *ppi[2]; |
426 | void __iomem * const *iomap; | 426 | void __iomem *bar5; |
427 | 427 | ||
428 | ppi[0] = ppi[1] = &vt6420_port_info; | 428 | ppi[0] = ppi[1] = &vt6420_port_info; |
429 | probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); | 429 | probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); |
430 | if (!probe_ent) | 430 | if (!probe_ent) |
431 | return NULL; | 431 | return NULL; |
432 | 432 | ||
433 | iomap = pcim_iomap_table(pdev); | 433 | bar5 = pcim_iomap(pdev, 5, 0); |
434 | probe_ent->port[0].scr_addr = svia_scr_addr(iomap[5], 0); | 434 | if (!bar5) { |
435 | probe_ent->port[1].scr_addr = svia_scr_addr(iomap[5], 1); | 435 | dev_printk(KERN_ERR, &pdev->dev, "failed to iomap PCI BAR 5\n"); |
436 | return NULL; | ||
437 | } | ||
438 | |||
439 | probe_ent->port[0].scr_addr = svia_scr_addr(bar5, 0); | ||
440 | probe_ent->port[1].scr_addr = svia_scr_addr(bar5, 1); | ||
436 | 441 | ||
437 | return probe_ent; | 442 | return probe_ent; |
438 | } | 443 | } |
@@ -460,6 +465,13 @@ static struct ata_probe_ent *vt6421_init_probe_ent(struct pci_dev *pdev) | |||
460 | probe_ent->mwdma_mask = 0x07; | 465 | probe_ent->mwdma_mask = 0x07; |
461 | probe_ent->udma_mask = 0x7f; | 466 | probe_ent->udma_mask = 0x7f; |
462 | 467 | ||
468 | for (i = 0; i < 6; i++) | ||
469 | if (!pcim_iomap(pdev, i, 0)) { | ||
470 | dev_printk(KERN_ERR, &pdev->dev, | ||
471 | "failed to iomap PCI BAR %d\n", i); | ||
472 | return NULL; | ||
473 | } | ||
474 | |||
463 | for (i = 0; i < N_PORTS; i++) | 475 | for (i = 0; i < N_PORTS; i++) |
464 | vt6421_init_addrs(probe_ent, pcim_iomap_table(pdev), i); | 476 | vt6421_init_addrs(probe_ent, pcim_iomap_table(pdev), i); |
465 | 477 | ||
@@ -522,7 +534,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
522 | if (rc) | 534 | if (rc) |
523 | return rc; | 535 | return rc; |
524 | 536 | ||
525 | rc = pcim_iomap_regions(pdev, 0x1f, DRV_NAME); | 537 | rc = pci_request_regions(pdev, DRV_NAME); |
526 | if (rc) { | 538 | if (rc) { |
527 | pcim_pin_device(pdev); | 539 | pcim_pin_device(pdev); |
528 | return rc; | 540 | return rc; |