iomap.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * arch/sh64/lib/iomap.c
  3. *
  4. * Generic sh64 iomap interface
  5. *
  6. * Copyright (C) 2004 Paul Mundt
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/config.h>
  13. #include <linux/pci.h>
  14. #include <asm/io.h>
  15. void __iomem *__attribute__ ((weak))
  16. ioport_map(unsigned long port, unsigned int len)
  17. {
  18. return (void __iomem *)port;
  19. }
  20. void ioport_unmap(void __iomem *addr)
  21. {
  22. /* Nothing .. */
  23. }
  24. void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
  25. {
  26. unsigned long start = pci_resource_start(dev, bar);
  27. unsigned long len = pci_resource_len(dev, bar);
  28. unsigned long flags = pci_resource_flags(dev, bar);
  29. if (!len)
  30. return NULL;
  31. if (max && len > max)
  32. len = max;
  33. if (flags & IORESOURCE_IO)
  34. return ioport_map(start + pciio_virt, len);
  35. if (flags & IORESOURCE_MEM)
  36. return (void __iomem *)start;
  37. /* What? */
  38. return NULL;
  39. }
  40. void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
  41. {
  42. /* Nothing .. */
  43. }
  44. EXPORT_SYMBOL(ioport_map);
  45. EXPORT_SYMBOL(ioport_unmap);
  46. EXPORT_SYMBOL(pci_iomap);
  47. EXPORT_SYMBOL(pci_iounmap);