iomap-pci.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Implement the default iomap interfaces
  3. *
  4. * (C) Copyright 2004 Linus Torvalds
  5. * (C) Copyright 2006 Ralf Baechle <ralf@linux-mips.org>
  6. * (C) Copyright 2007 MIPS Technologies, Inc.
  7. * written by Ralf Baechle <ralf@linux-mips.org>
  8. */
  9. #include <linux/pci.h>
  10. #include <linux/export.h>
  11. #include <asm/io.h>
  12. #ifdef CONFIG_PCI_DRIVERS_LEGACY
  13. void __iomem *__pci_ioport_map(struct pci_dev *dev,
  14. unsigned long port, unsigned int nr)
  15. {
  16. struct pci_controller *ctrl = dev->bus->sysdata;
  17. unsigned long base = ctrl->io_map_base;
  18. /* This will eventually become a BUG_ON but for now be gentle */
  19. if (unlikely(!ctrl->io_map_base)) {
  20. struct pci_bus *bus = dev->bus;
  21. char name[8];
  22. while (bus->parent)
  23. bus = bus->parent;
  24. ctrl->io_map_base = base = mips_io_port_base;
  25. sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number);
  26. printk(KERN_WARNING "io_map_base of root PCI bus %s unset. "
  27. "Trying to continue but you better\nfix this issue or "
  28. "report it to linux-mips@linux-mips.org or your "
  29. "vendor.\n", name);
  30. #ifdef CONFIG_PCI_DOMAINS
  31. panic("To avoid data corruption io_map_base MUST be set with "
  32. "multiple PCI domains.");
  33. #endif
  34. }
  35. return (void __iomem *) (ctrl->io_map_base + port);
  36. }
  37. #endif /* CONFIG_PCI_DRIVERS_LEGACY */
  38. void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
  39. {
  40. iounmap(addr);
  41. }
  42. EXPORT_SYMBOL(pci_iounmap);