diff options
Diffstat (limited to 'drivers/parisc/lba_pci.c')
| -rw-r--r-- | drivers/parisc/lba_pci.c | 90 |
1 files changed, 49 insertions, 41 deletions
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index ba6769934c77..21c4c299b3d6 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
| @@ -168,7 +168,8 @@ lba_dump_res(struct resource *r, int d) | |||
| 168 | 168 | ||
| 169 | printk(KERN_DEBUG "(%p)", r->parent); | 169 | printk(KERN_DEBUG "(%p)", r->parent); |
| 170 | for (i = d; i ; --i) printk(" "); | 170 | for (i = d; i ; --i) printk(" "); |
| 171 | printk(KERN_DEBUG "%p [%lx,%lx]/%lx\n", r, r->start, r->end, r->flags); | 171 | printk(KERN_DEBUG "%p [%lx,%lx]/%lx\n", r, |
| 172 | (long)r->start, (long)r->end, r->flags); | ||
| 172 | lba_dump_res(r->child, d+2); | 173 | lba_dump_res(r->child, d+2); |
| 173 | lba_dump_res(r->sibling, d); | 174 | lba_dump_res(r->sibling, d); |
| 174 | } | 175 | } |
| @@ -647,7 +648,7 @@ truncate_pat_collision(struct resource *root, struct resource *new) | |||
| 647 | printk(KERN_WARNING "LBA: Truncating lmmio_space [%lx/%lx] " | 648 | printk(KERN_WARNING "LBA: Truncating lmmio_space [%lx/%lx] " |
| 648 | "to [%lx,%lx]\n", | 649 | "to [%lx,%lx]\n", |
| 649 | start, end, | 650 | start, end, |
| 650 | new->start, new->end ); | 651 | (long)new->start, (long)new->end ); |
| 651 | 652 | ||
| 652 | return 0; /* truncation successful */ | 653 | return 0; /* truncation successful */ |
| 653 | } | 654 | } |
| @@ -715,8 +716,8 @@ lba_fixup_bus(struct pci_bus *bus) | |||
| 715 | 716 | ||
| 716 | printk("FAILED: lba_fixup_bus() request for " | 717 | printk("FAILED: lba_fixup_bus() request for " |
| 717 | "elmmio_space [%lx/%lx]\n", | 718 | "elmmio_space [%lx/%lx]\n", |
| 718 | ldev->hba.elmmio_space.start, | 719 | (long)ldev->hba.elmmio_space.start, |
| 719 | ldev->hba.elmmio_space.end); | 720 | (long)ldev->hba.elmmio_space.end); |
| 720 | 721 | ||
| 721 | /* lba_dump_res(&iomem_resource, 2); */ | 722 | /* lba_dump_res(&iomem_resource, 2); */ |
| 722 | /* BUG(); */ | 723 | /* BUG(); */ |
| @@ -738,15 +739,15 @@ lba_fixup_bus(struct pci_bus *bus) | |||
| 738 | &(ldev->hba.lmmio_space))) { | 739 | &(ldev->hba.lmmio_space))) { |
| 739 | 740 | ||
| 740 | printk(KERN_WARNING "LBA: lmmio_space [%lx/%lx] duplicate!\n", | 741 | printk(KERN_WARNING "LBA: lmmio_space [%lx/%lx] duplicate!\n", |
| 741 | ldev->hba.lmmio_space.start, | 742 | (long)ldev->hba.lmmio_space.start, |
| 742 | ldev->hba.lmmio_space.end); | 743 | (long)ldev->hba.lmmio_space.end); |
| 743 | } else { | 744 | } else { |
| 744 | err = request_resource(&iomem_resource, &(ldev->hba.lmmio_space)); | 745 | err = request_resource(&iomem_resource, &(ldev->hba.lmmio_space)); |
| 745 | if (err < 0) { | 746 | if (err < 0) { |
| 746 | printk(KERN_ERR "FAILED: lba_fixup_bus() request for " | 747 | printk(KERN_ERR "FAILED: lba_fixup_bus() request for " |
| 747 | "lmmio_space [%lx/%lx]\n", | 748 | "lmmio_space [%lx/%lx]\n", |
| 748 | ldev->hba.lmmio_space.start, | 749 | (long)ldev->hba.lmmio_space.start, |
| 749 | ldev->hba.lmmio_space.end); | 750 | (long)ldev->hba.lmmio_space.end); |
| 750 | } else | 751 | } else |
| 751 | bus->resource[i++] = &(ldev->hba.lmmio_space); | 752 | bus->resource[i++] = &(ldev->hba.lmmio_space); |
| 752 | } | 753 | } |
| @@ -758,8 +759,8 @@ lba_fixup_bus(struct pci_bus *bus) | |||
| 758 | if (err < 0) { | 759 | if (err < 0) { |
| 759 | printk("FAILED: lba_fixup_bus() request for " | 760 | printk("FAILED: lba_fixup_bus() request for " |
| 760 | "gmmio_space [%lx/%lx]\n", | 761 | "gmmio_space [%lx/%lx]\n", |
| 761 | ldev->hba.gmmio_space.start, | 762 | (long)ldev->hba.gmmio_space.start, |
| 762 | ldev->hba.gmmio_space.end); | 763 | (long)ldev->hba.gmmio_space.end); |
| 763 | lba_dump_res(&iomem_resource, 2); | 764 | lba_dump_res(&iomem_resource, 2); |
| 764 | BUG(); | 765 | BUG(); |
| 765 | } | 766 | } |
| @@ -980,7 +981,7 @@ LBA_PORT_IN(32, 0) | |||
| 980 | #define LBA_PORT_OUT(size, mask) \ | 981 | #define LBA_PORT_OUT(size, mask) \ |
| 981 | static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ | 982 | static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ |
| 982 | { \ | 983 | { \ |
| 983 | void *where = (void *) PIOP_TO_GMMIO(LBA_DEV(l), addr); \ | 984 | void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \ |
| 984 | DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \ | 985 | DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \ |
| 985 | WRITE_REG##size(val, where); \ | 986 | WRITE_REG##size(val, where); \ |
| 986 | /* flush the I/O down to the elroy at least */ \ | 987 | /* flush the I/O down to the elroy at least */ \ |
| @@ -1063,16 +1064,16 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) | |||
| 1063 | /* used to fix up pre-initialized MEM BARs */ | 1064 | /* used to fix up pre-initialized MEM BARs */ |
| 1064 | if (!lba_dev->hba.lmmio_space.start) { | 1065 | if (!lba_dev->hba.lmmio_space.start) { |
| 1065 | sprintf(lba_dev->hba.lmmio_name, | 1066 | sprintf(lba_dev->hba.lmmio_name, |
| 1066 | "PCI%02lx LMMIO", | 1067 | "PCI%02x LMMIO", |
| 1067 | lba_dev->hba.bus_num.start); | 1068 | (int)lba_dev->hba.bus_num.start); |
| 1068 | lba_dev->hba.lmmio_space_offset = p->start - | 1069 | lba_dev->hba.lmmio_space_offset = p->start - |
| 1069 | io->start; | 1070 | io->start; |
| 1070 | r = &lba_dev->hba.lmmio_space; | 1071 | r = &lba_dev->hba.lmmio_space; |
| 1071 | r->name = lba_dev->hba.lmmio_name; | 1072 | r->name = lba_dev->hba.lmmio_name; |
| 1072 | } else if (!lba_dev->hba.elmmio_space.start) { | 1073 | } else if (!lba_dev->hba.elmmio_space.start) { |
| 1073 | sprintf(lba_dev->hba.elmmio_name, | 1074 | sprintf(lba_dev->hba.elmmio_name, |
| 1074 | "PCI%02lx ELMMIO", | 1075 | "PCI%02x ELMMIO", |
| 1075 | lba_dev->hba.bus_num.start); | 1076 | (int)lba_dev->hba.bus_num.start); |
| 1076 | r = &lba_dev->hba.elmmio_space; | 1077 | r = &lba_dev->hba.elmmio_space; |
| 1077 | r->name = lba_dev->hba.elmmio_name; | 1078 | r->name = lba_dev->hba.elmmio_name; |
| 1078 | } else { | 1079 | } else { |
| @@ -1089,8 +1090,8 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) | |||
| 1089 | 1090 | ||
| 1090 | case PAT_GMMIO: | 1091 | case PAT_GMMIO: |
| 1091 | /* MMIO space > 4GB phys addr; for 64-bit BAR */ | 1092 | /* MMIO space > 4GB phys addr; for 64-bit BAR */ |
| 1092 | sprintf(lba_dev->hba.gmmio_name, "PCI%02lx GMMIO", | 1093 | sprintf(lba_dev->hba.gmmio_name, "PCI%02x GMMIO", |
| 1093 | lba_dev->hba.bus_num.start); | 1094 | (int)lba_dev->hba.bus_num.start); |
| 1094 | r = &lba_dev->hba.gmmio_space; | 1095 | r = &lba_dev->hba.gmmio_space; |
| 1095 | r->name = lba_dev->hba.gmmio_name; | 1096 | r->name = lba_dev->hba.gmmio_name; |
| 1096 | r->start = p->start; | 1097 | r->start = p->start; |
| @@ -1112,8 +1113,8 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) | |||
| 1112 | */ | 1113 | */ |
| 1113 | lba_dev->iop_base = ioremap_nocache(p->start, 64 * 1024 * 1024); | 1114 | lba_dev->iop_base = ioremap_nocache(p->start, 64 * 1024 * 1024); |
| 1114 | 1115 | ||
| 1115 | sprintf(lba_dev->hba.io_name, "PCI%02lx Ports", | 1116 | sprintf(lba_dev->hba.io_name, "PCI%02x Ports", |
| 1116 | lba_dev->hba.bus_num.start); | 1117 | (int)lba_dev->hba.bus_num.start); |
| 1117 | r = &lba_dev->hba.io_space; | 1118 | r = &lba_dev->hba.io_space; |
| 1118 | r->name = lba_dev->hba.io_name; | 1119 | r->name = lba_dev->hba.io_name; |
| 1119 | r->start = HBA_PORT_BASE(lba_dev->hba.hba_num); | 1120 | r->start = HBA_PORT_BASE(lba_dev->hba.hba_num); |
| @@ -1166,8 +1167,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) | |||
| 1166 | ** Legacy boxes but it's nice to see in /proc/iomem. | 1167 | ** Legacy boxes but it's nice to see in /proc/iomem. |
| 1167 | */ | 1168 | */ |
| 1168 | r = &(lba_dev->hba.lmmio_space); | 1169 | r = &(lba_dev->hba.lmmio_space); |
| 1169 | sprintf(lba_dev->hba.lmmio_name, "PCI%02lx LMMIO", | 1170 | sprintf(lba_dev->hba.lmmio_name, "PCI%02x LMMIO", |
| 1170 | lba_dev->hba.bus_num.start); | 1171 | (int)lba_dev->hba.bus_num.start); |
| 1171 | r->name = lba_dev->hba.lmmio_name; | 1172 | r->name = lba_dev->hba.lmmio_name; |
| 1172 | 1173 | ||
| 1173 | #if 1 | 1174 | #if 1 |
| @@ -1275,8 +1276,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) | |||
| 1275 | ** an existing (but unused portion of) distributed range. | 1276 | ** an existing (but unused portion of) distributed range. |
| 1276 | */ | 1277 | */ |
| 1277 | r = &(lba_dev->hba.elmmio_space); | 1278 | r = &(lba_dev->hba.elmmio_space); |
| 1278 | sprintf(lba_dev->hba.elmmio_name, "PCI%02lx ELMMIO", | 1279 | sprintf(lba_dev->hba.elmmio_name, "PCI%02x ELMMIO", |
| 1279 | lba_dev->hba.bus_num.start); | 1280 | (int)lba_dev->hba.bus_num.start); |
| 1280 | r->name = lba_dev->hba.elmmio_name; | 1281 | r->name = lba_dev->hba.elmmio_name; |
| 1281 | 1282 | ||
| 1282 | #if 1 | 1283 | #if 1 |
| @@ -1297,8 +1298,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) | |||
| 1297 | #endif | 1298 | #endif |
| 1298 | 1299 | ||
| 1299 | r = &(lba_dev->hba.io_space); | 1300 | r = &(lba_dev->hba.io_space); |
| 1300 | sprintf(lba_dev->hba.io_name, "PCI%02lx Ports", | 1301 | sprintf(lba_dev->hba.io_name, "PCI%02x Ports", |
| 1301 | lba_dev->hba.bus_num.start); | 1302 | (int)lba_dev->hba.bus_num.start); |
| 1302 | r->name = lba_dev->hba.io_name; | 1303 | r->name = lba_dev->hba.io_name; |
| 1303 | r->flags = IORESOURCE_IO; | 1304 | r->flags = IORESOURCE_IO; |
| 1304 | r->start = READ_REG32(lba_dev->hba.base_addr + LBA_IOS_BASE) & ~1L; | 1305 | r->start = READ_REG32(lba_dev->hba.base_addr + LBA_IOS_BASE) & ~1L; |
| @@ -1406,13 +1407,20 @@ lba_hw_init(struct lba_device *d) | |||
| 1406 | return 0; | 1407 | return 0; |
| 1407 | } | 1408 | } |
| 1408 | 1409 | ||
| 1409 | 1410 | /* | |
| 1411 | * Unfortunately, when firmware numbers busses, it doesn't take into account | ||
| 1412 | * Cardbus bridges. So we have to renumber the busses to suit ourselves. | ||
| 1413 | * Elroy/Mercury don't actually know what bus number they're attached to; | ||
| 1414 | * we use bus 0 to indicate the directly attached bus and any other bus | ||
| 1415 | * number will be taken care of by the PCI-PCI bridge. | ||
| 1416 | */ | ||
| 1417 | static unsigned int lba_next_bus = 0; | ||
| 1410 | 1418 | ||
| 1411 | /* | 1419 | /* |
| 1412 | ** Determine if lba should claim this chip (return 0) or not (return 1). | 1420 | * Determine if lba should claim this chip (return 0) or not (return 1). |
| 1413 | ** If so, initialize the chip and tell other partners in crime they | 1421 | * If so, initialize the chip and tell other partners in crime they |
| 1414 | ** have work to do. | 1422 | * have work to do. |
| 1415 | */ | 1423 | */ |
| 1416 | static int __init | 1424 | static int __init |
| 1417 | lba_driver_probe(struct parisc_device *dev) | 1425 | lba_driver_probe(struct parisc_device *dev) |
| 1418 | { | 1426 | { |
| @@ -1440,7 +1448,7 @@ lba_driver_probe(struct parisc_device *dev) | |||
| 1440 | } | 1448 | } |
| 1441 | 1449 | ||
| 1442 | printk(KERN_INFO "Elroy version %s (0x%x) found at 0x%lx\n", | 1450 | printk(KERN_INFO "Elroy version %s (0x%x) found at 0x%lx\n", |
| 1443 | version, func_class & 0xf, dev->hpa.start); | 1451 | version, func_class & 0xf, (long)dev->hpa.start); |
| 1444 | 1452 | ||
| 1445 | if (func_class < 2) { | 1453 | if (func_class < 2) { |
| 1446 | printk(KERN_WARNING "Can't support LBA older than " | 1454 | printk(KERN_WARNING "Can't support LBA older than " |
| @@ -1470,17 +1478,16 @@ lba_driver_probe(struct parisc_device *dev) | |||
| 1470 | */ | 1478 | */ |
| 1471 | printk(KERN_INFO "%s version TR%d.%d (0x%x) found at 0x%lx\n", | 1479 | printk(KERN_INFO "%s version TR%d.%d (0x%x) found at 0x%lx\n", |
| 1472 | IS_MERCURY(dev) ? "Mercury" : "Quicksilver", major, | 1480 | IS_MERCURY(dev) ? "Mercury" : "Quicksilver", major, |
| 1473 | minor, func_class, dev->hpa.start); | 1481 | minor, func_class, (long)dev->hpa.start); |
| 1474 | 1482 | ||
| 1475 | cfg_ops = &mercury_cfg_ops; | 1483 | cfg_ops = &mercury_cfg_ops; |
| 1476 | } else { | 1484 | } else { |
| 1477 | printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa.start); | 1485 | printk(KERN_ERR "Unknown LBA found at 0x%lx\n", |
| 1486 | (long)dev->hpa.start); | ||
| 1478 | return -ENODEV; | 1487 | return -ENODEV; |
| 1479 | } | 1488 | } |
| 1480 | 1489 | ||
| 1481 | /* | 1490 | /* Tell I/O SAPIC driver we have a IRQ handler/region. */ |
| 1482 | ** Tell I/O SAPIC driver we have a IRQ handler/region. | ||
| 1483 | */ | ||
| 1484 | tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE); | 1491 | tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE); |
| 1485 | 1492 | ||
| 1486 | /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't | 1493 | /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't |
| @@ -1529,16 +1536,17 @@ lba_driver_probe(struct parisc_device *dev) | |||
| 1529 | lba_legacy_resources(dev, lba_dev); | 1536 | lba_legacy_resources(dev, lba_dev); |
| 1530 | } | 1537 | } |
| 1531 | 1538 | ||
| 1532 | /* | 1539 | if (lba_dev->hba.bus_num.start < lba_next_bus) |
| 1533 | ** Tell PCI support another PCI bus was found. | 1540 | lba_dev->hba.bus_num.start = lba_next_bus; |
| 1534 | ** Walks PCI bus for us too. | 1541 | |
| 1535 | */ | ||
| 1536 | dev->dev.platform_data = lba_dev; | 1542 | dev->dev.platform_data = lba_dev; |
| 1537 | lba_bus = lba_dev->hba.hba_bus = | 1543 | lba_bus = lba_dev->hba.hba_bus = |
| 1538 | pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start, | 1544 | pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start, |
| 1539 | cfg_ops, NULL); | 1545 | cfg_ops, NULL); |
| 1540 | if (lba_bus) | 1546 | if (lba_bus) { |
| 1547 | lba_next_bus = lba_bus->subordinate + 1; | ||
| 1541 | pci_bus_add_devices(lba_bus); | 1548 | pci_bus_add_devices(lba_bus); |
| 1549 | } | ||
| 1542 | 1550 | ||
| 1543 | /* This is in lieu of calling pci_assign_unassigned_resources() */ | 1551 | /* This is in lieu of calling pci_assign_unassigned_resources() */ |
| 1544 | if (is_pdc_pat()) { | 1552 | if (is_pdc_pat()) { |
