pci-common.c (d02e30c31c57683a66ed68a1bcff900ca78f6d56) | pci-common.c (89a74ecccd1f78e51faf6287e5c0e93a92ac096e) |
---|---|
1/* 2 * Contains common pci routines for ALL ppc platform 3 * (based on pci_32.c and pci_64.c) 4 * 5 * Port for PPC64 David Engebretsen, IBM Corp. 6 * Contains common pci routines for ppc64 platform, pSeries and iSeries brands. 7 * 8 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM --- 1033 unchanged lines hidden (view full) --- 1042/* Fixup resources of a PCI<->PCI bridge */ 1043static void __devinit pcibios_fixup_bridge(struct pci_bus *bus) 1044{ 1045 struct resource *res; 1046 int i; 1047 1048 struct pci_dev *dev = bus->self; 1049 | 1/* 2 * Contains common pci routines for ALL ppc platform 3 * (based on pci_32.c and pci_64.c) 4 * 5 * Port for PPC64 David Engebretsen, IBM Corp. 6 * Contains common pci routines for ppc64 platform, pSeries and iSeries brands. 7 * 8 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM --- 1033 unchanged lines hidden (view full) --- 1042/* Fixup resources of a PCI<->PCI bridge */ 1043static void __devinit pcibios_fixup_bridge(struct pci_bus *bus) 1044{ 1045 struct resource *res; 1046 int i; 1047 1048 struct pci_dev *dev = bus->self; 1049 |
1050 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) { 1051 if ((res = bus->resource[i]) == NULL) | 1050 pci_bus_for_each_resource(bus, res, i) { 1051 if (!res || !res->flags) |
1052 continue; | 1052 continue; |
1053 if (!res->flags) 1054 continue; | |
1055 if (i >= 3 && bus->self->transparent) 1056 continue; 1057 1058 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n", 1059 pci_name(dev), i, 1060 (unsigned long long)res->start,\ 1061 (unsigned long long)res->end, 1062 (unsigned int)res->flags); --- 113 unchanged lines hidden (view full) --- 1176 * 1177 * Why? Because some silly external IO cards only decode 1178 * the low 10 bits of the IO address. The 0x00-0xff region 1179 * is reserved for motherboard devices that decode all 16 1180 * bits, so it's ok to allocate at, say, 0x2800-0x28ff, 1181 * but we want to try to avoid allocating at 0x2900-0x2bff 1182 * which might have be mirrored at 0x0100-0x03ff.. 1183 */ | 1053 if (i >= 3 && bus->self->transparent) 1054 continue; 1055 1056 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n", 1057 pci_name(dev), i, 1058 (unsigned long long)res->start,\ 1059 (unsigned long long)res->end, 1060 (unsigned int)res->flags); --- 113 unchanged lines hidden (view full) --- 1174 * 1175 * Why? Because some silly external IO cards only decode 1176 * the low 10 bits of the IO address. The 0x00-0xff region 1177 * is reserved for motherboard devices that decode all 16 1178 * bits, so it's ok to allocate at, say, 0x2800-0x28ff, 1179 * but we want to try to avoid allocating at 0x2900-0x2bff 1180 * which might have be mirrored at 0x0100-0x03ff.. 1181 */ |
1184void pcibios_align_resource(void *data, struct resource *res, | 1182resource_size_t pcibios_align_resource(void *data, const struct resource *res, |
1185 resource_size_t size, resource_size_t align) 1186{ 1187 struct pci_dev *dev = data; | 1183 resource_size_t size, resource_size_t align) 1184{ 1185 struct pci_dev *dev = data; |
1186 resource_size_t start = res->start; |
|
1188 1189 if (res->flags & IORESOURCE_IO) { | 1187 1188 if (res->flags & IORESOURCE_IO) { |
1190 resource_size_t start = res->start; 1191 | |
1192 if (skip_isa_ioresource_align(dev)) | 1189 if (skip_isa_ioresource_align(dev)) |
1193 return; 1194 if (start & 0x300) { | 1190 return start; 1191 if (start & 0x300) |
1195 start = (start + 0x3ff) & ~0x3ff; | 1192 start = (start + 0x3ff) & ~0x3ff; |
1196 res->start = start; 1197 } | |
1198 } | 1193 } |
1194 1195 return start; |
|
1199} 1200EXPORT_SYMBOL(pcibios_align_resource); 1201 1202/* 1203 * Reparent resource children of pr that conflict with res 1204 * under res, and make res replace those children. 1205 */ 1206static int reparent_resources(struct resource *parent, --- 66 unchanged lines hidden (view full) --- 1273{ 1274 struct pci_bus *b; 1275 int i; 1276 struct resource *res, *pr; 1277 1278 pr_debug("PCI: Allocating bus resources for %04x:%02x...\n", 1279 pci_domain_nr(bus), bus->number); 1280 | 1196} 1197EXPORT_SYMBOL(pcibios_align_resource); 1198 1199/* 1200 * Reparent resource children of pr that conflict with res 1201 * under res, and make res replace those children. 1202 */ 1203static int reparent_resources(struct resource *parent, --- 66 unchanged lines hidden (view full) --- 1270{ 1271 struct pci_bus *b; 1272 int i; 1273 struct resource *res, *pr; 1274 1275 pr_debug("PCI: Allocating bus resources for %04x:%02x...\n", 1276 pci_domain_nr(bus), bus->number); 1277 |
1281 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) { 1282 if ((res = bus->resource[i]) == NULL || !res->flags 1283 || res->start > res->end || res->parent) | 1278 pci_bus_for_each_resource(bus, res, i) { 1279 if (!res || !res->flags || res->start > res->end || res->parent) |
1284 continue; 1285 if (bus->parent == NULL) 1286 pr = (res->flags & IORESOURCE_IO) ? 1287 &ioport_resource : &iomem_resource; 1288 else { 1289 /* Don't bother with non-root busses when 1290 * re-assigning all resources. We clear the 1291 * resource flags as if they were colliding --- 461 unchanged lines hidden --- | 1280 continue; 1281 if (bus->parent == NULL) 1282 pr = (res->flags & IORESOURCE_IO) ? 1283 &ioport_resource : &iomem_resource; 1284 else { 1285 /* Don't bother with non-root busses when 1286 * re-assigning all resources. We clear the 1287 * resource flags as if they were colliding --- 461 unchanged lines hidden --- |