static int pci_bus_count;
-static void pcibios_fixup_resources(struct pci_dev* dev);
-
-#if 0 // FIXME
-struct pci_fixup pcibios_fixups[] = {
- { DECLARE_PCI_FIXUP_HEADER, PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources },
- { 0 }
-};
-#endif
-
-void
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
- struct resource *res, int resource)
-{
- u32 new, check, mask;
- int reg;
- struct pci_controller* pci_ctrl = dev->sysdata;
-
- new = res->start;
- if (pci_ctrl && res->flags & IORESOURCE_IO) {
- new -= pci_ctrl->io_space.base;
- }
- new |= (res->flags & PCI_REGION_FLAG_MASK);
- if (resource < 6) {
- reg = PCI_BASE_ADDRESS_0 + 4*resource;
- } else if (resource == PCI_ROM_RESOURCE) {
- res->flags |= PCI_ROM_ADDRESS_ENABLE;
- reg = dev->rom_base_reg;
- } else {
- /* Somebody might have asked allocation of a non-standard resource */
- return;
- }
-
- pci_write_config_dword(dev, reg, new);
- pci_read_config_dword(dev, reg, &check);
- mask = (new & PCI_BASE_ADDRESS_SPACE_IO) ?
- PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK;
-
- if ((new ^ check) & mask) {
- printk(KERN_ERR "PCI: Error while updating region "
- "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
- new, check);
- }
-}
-
/*
* We need to avoid collisions with `mirrored' VGA ports
* and other strange ISA hardware, so we always want the
if (size > 0x100) {
printk(KERN_ERR "PCI: I/O Region %s/%d too large"
- " (%ld bytes)\n", dev->slot_name,
+ " (%ld bytes)\n", pci_name(dev),
dev->resource - res, size);
}
r = &dev->resource[idx];
if (!r->start && r->end) {
printk (KERN_ERR "PCI: Device %s not available because "
- "of resource collisions\n", dev->slot_name);
+ "of resource collisions\n", pci_name(dev));
return -EINVAL;
}
if (r->flags & IORESOURCE_IO)
cmd |= PCI_COMMAND_MEMORY;
if (cmd != old_cmd) {
printk("PCI: Enabling device %s (%04x -> %04x)\n",
- dev->slot_name, old_cmd, cmd);
+ pci_name(dev), old_cmd, cmd);
pci_write_config_word(dev, PCI_COMMAND, cmd);
}
return 0;
r = &dev->resource[idx];
if (!r->start && r->end) {
printk(KERN_ERR "PCI: Device %s not available because "
- "of resource collisions\n", dev->slot_name);
+ "of resource collisions\n", pci_name(dev));
return -EINVAL;
}
if (r->flags & IORESOURCE_IO)
}
if (cmd != old_cmd) {
printk("PCI: Enabling device %s (%04x -> %04x)\n",
- dev->slot_name, old_cmd, cmd);
+ pci_name(dev), old_cmd, cmd);
pci_write_config_word(dev, PCI_COMMAND, cmd);
}
#endif /* CONFIG_PROC_FS */
-
-static void
-pcibios_fixup_resources(struct pci_dev *dev)
-{
- struct pci_controller* pci_ctrl = (struct pci_controller *)dev->sysdata;
- int i;
- unsigned long offset;
-
- if (!pci_ctrl) {
- printk(KERN_ERR "No pci_ctrl for PCI dev %s!\n",dev->slot_name);
- return;
- }
- for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
- struct resource *res = dev->resource + i;
- if (!res->start || !res->flags)
- continue;
- if (res->end == 0xffffffff) {
- DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n",
- dev->slot_name, i, res->start, res->end);
- res->end -= res->start;
- res->start = 0;
- continue;
- }
- offset = 0;
- if (res->flags & IORESOURCE_IO)
- offset = (unsigned long) pci_ctrl->io_space.base;
- else if (res->flags & IORESOURCE_MEM)
- offset = (unsigned long) pci_ctrl->mem_space.base;
-
- if (offset != 0) {
- res->start += offset;
- res->end += offset;
-#ifdef DEBUG
- printk("Fixup res %d (%lx) of dev %s: %lx -> %lx\n",
- i, res->flags, dev->slot_name,
- res->start - offset, res->start);
-#endif
- }
- }
-}
-
/*
* Platform support for /proc/bus/pci/X/Y mmap()s,
* modelled on the sparc64 implementation by Dave Miller.