320
319
* Ignore these tiny memory ranges */
321
320
if (!((window->resource.flags & IORESOURCE_MEM) &&
322
321
(window->resource.end - window->resource.start < 16)))
323
pci_add_resource(&info->resources, &window->resource);
322
pci_add_resource_offset(&info->resources, &window->resource,
398
void pcibios_resource_to_bus(struct pci_dev *dev,
399
struct pci_bus_region *region, struct resource *res)
401
struct pci_controller *controller = PCI_CONTROLLER(dev);
402
unsigned long offset = 0;
405
for (i = 0; i < controller->windows; i++) {
406
struct pci_window *window = &controller->window[i];
407
if (!(window->resource.flags & res->flags))
409
if (window->resource.start > res->start)
411
if (window->resource.end < res->end)
413
offset = window->offset;
417
region->start = res->start - offset;
418
region->end = res->end - offset;
420
EXPORT_SYMBOL(pcibios_resource_to_bus);
422
void pcibios_bus_to_resource(struct pci_dev *dev,
423
struct resource *res, struct pci_bus_region *region)
425
struct pci_controller *controller = PCI_CONTROLLER(dev);
426
unsigned long offset = 0;
429
for (i = 0; i < controller->windows; i++) {
430
struct pci_window *window = &controller->window[i];
431
if (!(window->resource.flags & res->flags))
433
if (window->resource.start - window->offset > region->start)
435
if (window->resource.end - window->offset < region->end)
437
offset = window->offset;
441
res->start = region->start + offset;
442
res->end = region->end + offset;
444
EXPORT_SYMBOL(pcibios_bus_to_resource);
446
398
static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
448
400
unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
464
416
static void __devinit
465
417
pcibios_fixup_resources(struct pci_dev *dev, int start, int limit)
467
struct pci_bus_region region;
470
421
for (i = start; i < limit; i++) {
471
422
if (!dev->resource[i].flags)
473
region.start = dev->resource[i].start;
474
region.end = dev->resource[i].end;
475
pcibios_bus_to_resource(dev, &dev->resource[i], ®ion);
476
424
if ((is_valid_resource(dev, i)))
477
425
pci_claim_resource(dev, i);