blob: 253d1e351d49af3385c1fdfc297cd03cc0622d75 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/pci.h>
13#include <asm/io.h>
14
15void __iomem *__attribute__ ((weak))
16ioport_map(unsigned long port, unsigned int len)
17{
18 return (void __iomem *)port;
19}
Paul Mundt749c8492007-10-01 17:36:47 +090020EXPORT_SYMBOL(ioport_map);
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
22void ioport_unmap(void __iomem *addr)
23{
24 /* Nothing .. */
25}
Paul Mundt749c8492007-10-01 17:36:47 +090026EXPORT_SYMBOL(ioport_unmap);
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Paul Mundt749c8492007-10-01 17:36:47 +090028#ifdef CONFIG_PCI
Linus Torvalds1da177e2005-04-16 15:20:36 -070029void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
30{
31 unsigned long start = pci_resource_start(dev, bar);
32 unsigned long len = pci_resource_len(dev, bar);
33 unsigned long flags = pci_resource_flags(dev, bar);
34
35 if (!len)
36 return NULL;
37 if (max && len > max)
38 len = max;
39 if (flags & IORESOURCE_IO)
40 return ioport_map(start + pciio_virt, len);
41 if (flags & IORESOURCE_MEM)
42 return (void __iomem *)start;
43
44 /* What? */
45 return NULL;
46}
Paul Mundt749c8492007-10-01 17:36:47 +090047EXPORT_SYMBOL(pci_iomap);
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
49void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
50{
51 /* Nothing .. */
52}
Linus Torvalds1da177e2005-04-16 15:20:36 -070053EXPORT_SYMBOL(pci_iounmap);
Paul Mundt749c8492007-10-01 17:36:47 +090054#endif