X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fmacintosh%2Fmacio_asic.c;h=2a545ceb523b05cfb57fdf20b8c79e1ca1f5ca2e;hb=6150c32589d1976ca8a5c987df951088c05a7542;hp=f14c744a94efafad5e8f73e2a8d5ad60d055ba8b;hpb=2c5bd01f8f5d7c655d9d1aa60b696d980947e3be;p=linux-2.6 diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index f14c744a94..2a545ceb52 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -256,42 +256,42 @@ static int macio_resource_quirks(struct device_node *np, struct resource *res, { if (res->flags & IORESOURCE_MEM) { /* Grand Central has too large resource 0 on some machines */ - if (index == 0 && !strcmp(np->name, "gc")) { - np->addrs[0].size = 0x20000; + if (index == 0 && !strcmp(np->name, "gc")) res->end = res->start + 0x1ffff; - } + /* Airport has bogus resource 2 */ if (index >= 2 && !strcmp(np->name, "radio")) return 1; + +#ifndef CONFIG_PPC64 /* DBDMAs may have bogus sizes */ - if ((res->start & 0x0001f000) == 0x00008000) { - np->addrs[index].size = 0x100; + if ((res->start & 0x0001f000) == 0x00008000) res->end = res->start + 0xff; - } +#endif /* CONFIG_PPC64 */ + /* ESCC parent eats child resources. We could have added a * level of hierarchy, but I don't really feel the need * for it */ if (!strcmp(np->name, "escc")) return 1; + /* ESCC has bogus resources >= 3 */ if (index >= 3 && !(strcmp(np->name, "ch-a") && strcmp(np->name, "ch-b"))) return 1; + /* Media bay has too many resources, keep only first one */ if (index > 0 && !strcmp(np->name, "media-bay")) return 1; + /* Some older IDE resources have bogus sizes */ if (!(strcmp(np->name, "IDE") && strcmp(np->name, "ATA") && strcmp(np->type, "ide") && strcmp(np->type, "ata"))) { - if (index == 0 && np->addrs[0].size > 0x1000) { - np->addrs[0].size = 0x1000; + if (index == 0 && (res->end - res->start) > 0xfff) res->end = res->start + 0xfff; - } - if (index == 1 && np->addrs[1].size > 0x100) { - np->addrs[1].size = 0x100; + if (index == 1 && (res->end - res->start) > 0xff) res->end = res->start + 0xff; - } } } return 0; @@ -332,18 +332,14 @@ static void macio_setup_resources(struct macio_dev *dev, struct resource *parent_res) { struct device_node *np = dev->ofdev.node; - u32 *addr; - u64 size; + struct resource r; int index; - for (index = 0; (addr = of_get_address(np, index, &size)) != NULL; - index++) { + for (index = 0; of_address_to_resource(np, index, &r) == 0; index++) { struct resource *res = &dev->resource[index]; if (index >= MACIO_DEV_COUNT_RESOURCES) break; - res->start = of_translate_address(np, addr); - res->end = res->start + (unsigned long)size - 1; - res->flags = IORESOURCE_MEM; + *res = r; res->name = dev->ofdev.dev.bus_id; if (macio_resource_quirks(np, res, index)) {