iomap-pci.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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/module.h>
  11. #include <asm/io.h>
  12. void __iomem *__pci_ioport_map(struct pci_dev *dev,
  13. unsigned long port, unsigned int nr)
  14. {
  15. struct pci_controller *ctrl = dev->bus->sysdata;
  16. unsigned long base = ctrl->io_map_base;
  17. /* This will eventually become a BUG_ON but for now be gentle */
  18. if (unlikely(!ctrl->io_map_base)) {
  19. struct pci_bus *bus = dev->bus;
  20. char name[8];
  21. while (bus->parent)
  22. bus = bus->parent;
  23. ctrl->io_map_base = base = mips_io_port_base;
  24. sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number);
  25. printk(KERN_WARNING "io_map_base of root PCI bus %s unset. "
  26. "Trying to continue but you better\nfix this issue or "
  27. "report it to linux-mips@linux-mips.org or your "
  28. "vendor.\n", name);
  29. #ifdef CONFIG_PCI_DOMAINS
  30. panic("To avoid data corruption io_map_base MUST be set with "
  31. "multiple PCI domains.");
  32. #endif
  33. }
  34. return (void __iomem *) (ctrl->io_map_base + port);
  35. }
  36. void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
  37. {
  38. iounmap(addr);
  39. }
  40. EXPORT_SYMBOL(pci_iounmap);