diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2007-07-26 00:07:13 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-07-26 02:17:47 -0400 |
commit | 6dfbde209171cd15407e7540d363a434a489aaca (patch) | |
tree | 0db7a89f32b3b61d3334085b67c276945dd6560f /arch/powerpc/kernel/pci-common.c | |
parent | f5d834fc34e61f1a40435981062000e5d2b2baa8 (diff) |
[POWERPC] Add function to check if address is an IO port
This adds a function that tells you if a given kernel virtual address
is hitting a PCI or ISA IO port permanent mapping or not. This is to
be used in the next patch to fix iomap APIs to properly unmap things.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/pci-common.c')
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index fe7d1255e11e..74a8fd450f67 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -101,6 +101,29 @@ void pcibios_free_controller(struct pci_controller *phb) | |||
101 | kfree(phb); | 101 | kfree(phb); |
102 | } | 102 | } |
103 | 103 | ||
104 | int pcibios_vaddr_is_ioport(void __iomem *address) | ||
105 | { | ||
106 | int ret = 0; | ||
107 | struct pci_controller *hose; | ||
108 | unsigned long size; | ||
109 | |||
110 | spin_lock(&hose_spinlock); | ||
111 | list_for_each_entry(hose, &hose_list, list_node) { | ||
112 | #ifdef CONFIG_PPC64 | ||
113 | size = hose->pci_io_size; | ||
114 | #else | ||
115 | size = hose->io_resource.end - hose->io_resource.start + 1; | ||
116 | #endif | ||
117 | if (address >= hose->io_base_virt && | ||
118 | address < (hose->io_base_virt + size)) { | ||
119 | ret = 1; | ||
120 | break; | ||
121 | } | ||
122 | } | ||
123 | spin_unlock(&hose_spinlock); | ||
124 | return ret; | ||
125 | } | ||
126 | |||
104 | /* | 127 | /* |
105 | * Return the domain number for this bus. | 128 | * Return the domain number for this bus. |
106 | */ | 129 | */ |