From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: <linuxppc-dev@ozlabs.org>
Subject: [PATCH 7/13] [POWERPC] Merge pcibios_resource_to_bus/bus_to_resource
Date: Wed, 12 Dec 2007 16:22:59 +1100 [thread overview]
Message-ID: <20071212052303.ADAF2DDF67@ozlabs.org> (raw)
In-Reply-To: <1197436973.110379.888292904645.qpush@grosgo>
This merges the PowerPC 32 and 64 bits version of pcibios_resource_to_bus
and pcibios_bus_to_resource().
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/kernel/pci-common.c | 36 ++++++++++++++++++++++++++++++++
arch/powerpc/kernel/pci_32.c | 32 -----------------------------
arch/powerpc/kernel/pci_64.c | 43 ---------------------------------------
3 files changed, 36 insertions(+), 75 deletions(-)
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index b2a5395..b666954 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -655,3 +655,39 @@ int pci_proc_domain(struct pci_bus *bus)
#endif
}
+void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
+ struct resource *res)
+{
+ resource_size_t offset = 0, mask = (resource_size_t)-1;
+ struct pci_controller *hose = pci_bus_to_host(dev->bus);
+
+ if (!hose)
+ return;
+ if (res->flags & IORESOURCE_IO) {
+ offset = (unsigned long)hose->io_base_virt - _IO_BASE;
+ mask = 0xffffffffu;
+ } else if (res->flags & IORESOURCE_MEM)
+ offset = hose->pci_mem_offset;
+
+ region->start = (res->start - offset) & mask;
+ region->end = (res->end - offset) & mask;
+}
+EXPORT_SYMBOL(pcibios_resource_to_bus);
+
+void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+ struct pci_bus_region *region)
+{
+ resource_size_t offset = 0, mask = (resource_size_t)-1;
+ struct pci_controller *hose = pci_bus_to_host(dev->bus);
+
+ if (!hose)
+ return;
+ if (res->flags & IORESOURCE_IO) {
+ offset = (unsigned long)hose->io_base_virt - _IO_BASE;
+ mask = 0xffffffffu;
+ } else if (res->flags & IORESOURCE_MEM)
+ offset = hose->pci_mem_offset;
+ res->start = (region->start + offset) & mask;
+ res->end = (region->end + offset) & mask;
+}
+EXPORT_SYMBOL(pcibios_bus_to_resource);
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 9a79a3d..f05ef5b 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -145,38 +145,6 @@ pcibios_fixup_resources(struct pci_dev *dev)
}
DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
-void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
- struct resource *res)
-{
- resource_size_t offset = 0, mask = (resource_size_t)-1;
- struct pci_controller *hose = dev->sysdata;
-
- if (hose && res->flags & IORESOURCE_IO) {
- offset = (unsigned long)hose->io_base_virt - isa_io_base;
- mask = 0xffffffffu;
- } else if (hose && res->flags & IORESOURCE_MEM)
- offset = hose->pci_mem_offset;
- region->start = (res->start - offset) & mask;
- region->end = (res->end - offset) & mask;
-}
-EXPORT_SYMBOL(pcibios_resource_to_bus);
-
-void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
- struct pci_bus_region *region)
-{
- resource_size_t offset = 0, mask = (resource_size_t)-1;
- struct pci_controller *hose = dev->sysdata;
-
- if (hose && res->flags & IORESOURCE_IO) {
- offset = (unsigned long)hose->io_base_virt - isa_io_base;
- mask = 0xffffffffu;
- } else if (hose && res->flags & IORESOURCE_MEM)
- offset = hose->pci_mem_offset;
- res->start = (region->start + offset) & mask;
- res->end = (region->end + offset) & mask;
-}
-EXPORT_SYMBOL(pcibios_bus_to_resource);
-
static int skip_isa_ioresource_align(struct pci_dev *dev)
{
if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) &&
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 1b7c810..26c7df2 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -77,48 +77,6 @@ static void fixup_broken_pcnet32(struct pci_dev* dev)
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32);
-void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
- struct resource *res)
-{
- unsigned long offset = 0;
- struct pci_controller *hose = pci_bus_to_host(dev->bus);
-
- if (!hose)
- return;
-
- if (res->flags & IORESOURCE_IO)
- offset = (unsigned long)hose->io_base_virt - _IO_BASE;
-
- if (res->flags & IORESOURCE_MEM)
- offset = hose->pci_mem_offset;
-
- region->start = res->start - offset;
- region->end = res->end - offset;
-}
-
-void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
- struct pci_bus_region *region)
-{
- unsigned long offset = 0;
- struct pci_controller *hose = pci_bus_to_host(dev->bus);
-
- if (!hose)
- return;
-
- if (res->flags & IORESOURCE_IO)
- offset = (unsigned long)hose->io_base_virt - _IO_BASE;
-
- if (res->flags & IORESOURCE_MEM)
- offset = hose->pci_mem_offset;
-
- res->start = region->start + offset;
- res->end = region->end + offset;
-}
-
-#ifdef CONFIG_HOTPLUG
-EXPORT_SYMBOL(pcibios_resource_to_bus);
-EXPORT_SYMBOL(pcibios_bus_to_resource);
-#endif
/*
* We need to avoid collisions with `mirrored' VGA ports
--
1.5.3.7
next prev parent reply other threads:[~2007-12-12 5:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-12 5:22 [PATCH 0/13] [POWERPC] PCI updates & merges Benjamin Herrenschmidt
2007-12-12 5:22 ` [PATCH 1/13] [POWERPC] pci32: remove bogus alignment message Benjamin Herrenschmidt
2007-12-12 5:22 ` [PATCH 2/13] [POWERPC] pci32: use generic pci_assign_unassign_resources Benjamin Herrenschmidt
2007-12-12 5:22 ` [PATCH 3/13] [POWERPC] pci32: Remove PowerMac P2P bridge IO hack Benjamin Herrenschmidt
2007-12-12 5:22 ` [PATCH 4/13] [POWERPC] pci32: Add flags modifying the PCI code behaviour Benjamin Herrenschmidt
2007-12-12 5:22 ` [PATCH 5/13] [POWERPC] pci32: Remove obsolete PowerMac bus number hack Benjamin Herrenschmidt
2007-12-12 5:22 ` [PATCH 6/13] [POWERPC] pci32: Add platform option to enable /proc PCI domains Benjamin Herrenschmidt
2007-12-12 5:22 ` Benjamin Herrenschmidt [this message]
2007-12-12 5:23 ` [PATCH 8/13] [POWERPC] Merge PCI resource fixups Benjamin Herrenschmidt
2007-12-12 5:23 ` [PATCH 9/13] [POWERPC] Merge PCI resource allocation & assignment Benjamin Herrenschmidt
2007-12-12 5:23 ` [PATCH 10/13] [POWERPC] Updates/fixes to 32 bits pcibios_enable_device() Benjamin Herrenschmidt
2007-12-12 5:23 ` [PATCH 11/13] [POWERPC] Merge 32 and 64 bits pcibios_enable_device Benjamin Herrenschmidt
2007-12-12 5:23 ` [PATCH 12/13] [POWERPC] Fixup powermac enable device hook Benjamin Herrenschmidt
2007-12-12 5:23 ` [PATCH 13/13] [POWERPC] Clear pci_probe_only on 64 bits PowerMac Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071212052303.ADAF2DDF67@ozlabs.org \
--to=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).