aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-10-17 22:04:44 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-10-17 22:28:50 -0400
commit5aee87c43e3a71a4aa4e72b0dc2180e4952c0848 (patch)
tree7d53d2ffd49fba8815d1986bb8f07d8b0959c605 /arch
parent7341df16a1f228be833e918cb42534a34381a37e (diff)
[SPARC64]: Fix PCI memory space root resource on Hummingbird.
For Hummingbird PCI controllers, we should create the root PCI memory space resource as the full 4GB area, and then allocate the IOMMU DMA translation window out of there. The old code just assumed that the IOMMU DMA translation base to the top of the 4GB area was unusable. This is not true on many systems such as SB100 and SB150, where the IOMMU DMA translation window sits at 0xc0000000->0xdfffffff. So what would happen is that any device mapped by the firmware at the top section 0xe0000000->0xffffffff would get remapped by Linux somewhere else leading to all kinds of problems and boot failures. While we're here, report more cases of OBP resource assignment conflicts. The only truly valid ones are ROM resource conflicts. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc64/kernel/pci_common.c29
-rw-r--r--arch/sparc64/kernel/pci_sabre.c23
2 files changed, 29 insertions, 23 deletions
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
index 7a59cc72c844..827ae30aa497 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc64/kernel/pci_common.c
@@ -330,19 +330,6 @@ __init get_device_resource(struct linux_prom_pci_registers *ap,
330 return res; 330 return res;
331} 331}
332 332
333static int __init pdev_resource_collisions_expected(struct pci_dev *pdev)
334{
335 if (pdev->vendor != PCI_VENDOR_ID_SUN)
336 return 0;
337
338 if (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS ||
339 pdev->device == PCI_DEVICE_ID_SUN_RIO_1394 ||
340 pdev->device == PCI_DEVICE_ID_SUN_RIO_USB)
341 return 1;
342
343 return 0;
344}
345
346static void __init pdev_record_assignments(struct pci_pbm_info *pbm, 333static void __init pdev_record_assignments(struct pci_pbm_info *pbm,
347 struct pci_dev *pdev) 334 struct pci_dev *pdev)
348{ 335{
@@ -400,19 +387,23 @@ static void __init pdev_record_assignments(struct pci_pbm_info *pbm,
400 pbm->parent->resource_adjust(pdev, res, root); 387 pbm->parent->resource_adjust(pdev, res, root);
401 388
402 if (request_resource(root, res) < 0) { 389 if (request_resource(root, res) < 0) {
390 int rnum;
391
403 /* OK, there is some conflict. But this is fine 392 /* OK, there is some conflict. But this is fine
404 * since we'll reassign it in the fixup pass. 393 * since we'll reassign it in the fixup pass.
405 * 394 *
406 * We notify the user that OBP made an error if it 395 * Do not print the warning for ROM resources
407 * is a case we don't expect. 396 * as such a conflict is quite common and
397 * harmless as the ROM bar is disabled.
408 */ 398 */
409 if (!pdev_resource_collisions_expected(pdev)) { 399 rnum = (res - &pdev->resource[0]);
410 printk(KERN_ERR "PCI: Address space collision on region %ld " 400 if (rnum != PCI_ROM_RESOURCE)
401 printk(KERN_ERR "PCI: Resource collision, "
402 "region %d "
411 "[%016lx:%016lx] of device %s\n", 403 "[%016lx:%016lx] of device %s\n",
412 (res - &pdev->resource[0]), 404 rnum,
413 res->start, res->end, 405 res->start, res->end,
414 pci_name(pdev)); 406 pci_name(pdev));
415 }
416 } 407 }
417 } 408 }
418} 409}
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index 6ec569828c29..de7f7850a844 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -1196,7 +1196,7 @@ static void pbm_register_toplevel_resources(struct pci_controller_info *p,
1196 &pbm->mem_space); 1196 &pbm->mem_space);
1197} 1197}
1198 1198
1199static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 dma_begin) 1199static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 dma_start, u32 dma_end)
1200{ 1200{
1201 struct pci_pbm_info *pbm; 1201 struct pci_pbm_info *pbm;
1202 struct device_node *node; 1202 struct device_node *node;
@@ -1261,6 +1261,8 @@ static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp
1261 node = node->sibling; 1261 node = node->sibling;
1262 } 1262 }
1263 if (simbas_found == 0) { 1263 if (simbas_found == 0) {
1264 struct resource *rp;
1265
1264 /* No APBs underneath, probably this is a hummingbird 1266 /* No APBs underneath, probably this is a hummingbird
1265 * system. 1267 * system.
1266 */ 1268 */
@@ -1302,8 +1304,10 @@ static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp
1302 pbm->io_space.end = pbm->io_space.start + (1UL << 24) - 1UL; 1304 pbm->io_space.end = pbm->io_space.start + (1UL << 24) - 1UL;
1303 pbm->io_space.flags = IORESOURCE_IO; 1305 pbm->io_space.flags = IORESOURCE_IO;
1304 1306
1305 pbm->mem_space.start = p->pbm_A.controller_regs + SABRE_MEMSPACE; 1307 pbm->mem_space.start =
1306 pbm->mem_space.end = pbm->mem_space.start + (unsigned long)dma_begin - 1UL; 1308 (p->pbm_A.controller_regs + SABRE_MEMSPACE);
1309 pbm->mem_space.end =
1310 (pbm->mem_space.start + ((1UL << 32UL) - 1UL));
1307 pbm->mem_space.flags = IORESOURCE_MEM; 1311 pbm->mem_space.flags = IORESOURCE_MEM;
1308 1312
1309 if (request_resource(&ioport_resource, &pbm->io_space) < 0) { 1313 if (request_resource(&ioport_resource, &pbm->io_space) < 0) {
@@ -1315,6 +1319,17 @@ static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp
1315 prom_halt(); 1319 prom_halt();
1316 } 1320 }
1317 1321
1322 rp = kmalloc(sizeof(*rp), GFP_KERNEL);
1323 if (!rp) {
1324 prom_printf("Cannot allocate IOMMU resource.\n");
1325 prom_halt();
1326 }
1327 rp->name = "IOMMU";
1328 rp->start = pbm->mem_space.start + (unsigned long) dma_start;
1329 rp->end = pbm->mem_space.start + (unsigned long) dma_end - 1UL;
1330 rp->flags = IORESOURCE_BUSY;
1331 request_resource(&pbm->mem_space, rp);
1332
1318 pci_register_legacy_regions(&pbm->io_space, 1333 pci_register_legacy_regions(&pbm->io_space,
1319 &pbm->mem_space); 1334 &pbm->mem_space);
1320 } 1335 }
@@ -1450,5 +1465,5 @@ void sabre_init(struct device_node *dp, char *model_name)
1450 /* 1465 /*
1451 * Look for APB underneath. 1466 * Look for APB underneath.
1452 */ 1467 */
1453 sabre_pbm_init(p, dp, vdma[0]); 1468 sabre_pbm_init(p, dp, vdma[0], vdma[1]);
1454} 1469}