iomap.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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/pci.h>
  13. #include <asm/io.h>
  14. void __iomem *__attribute__ ((weak))
  15. ioport_map(unsigned long port, unsigned int len)
  16. {
  17. return (void __iomem *)port;
  18. }
  19. void ioport_unmap(void __iomem *addr)
  20. {
  21. /* Nothing .. */
  22. }
  23. void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
  24. {
  25. unsigned long start = pci_resource_start(dev, bar);
  26. unsigned long len = pci_resource_len(dev, bar);
  27. unsigned long flags = pci_resource_flags(dev, bar);
  28. if (!len)
  29. return NULL;
  30. if (max && len > max)
  31. len = max;
  32. if (flags & IORESOURCE_IO)
  33. return ioport_map(start + pciio_virt, len);
  34. if (flags & IORESOURCE_MEM)
  35. return (void __iomem *)start;
  36. /* What? */
  37. return NULL;
  38. }
  39. void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
  40. {
  41. /* Nothing .. */
  42. }
  43. EXPORT_SYMBOL(ioport_map);
  44. EXPORT_SYMBOL(ioport_unmap);
  45. EXPORT_SYMBOL(pci_iomap);
  46. EXPORT_SYMBOL(pci_iounmap);