aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-08-04 21:06:21 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-05 00:32:46 -0400
commit43c34735524d5b1c9b9e5d63b49dd4c1b394bde4 (patch)
treea61c11d4075f149be9c0aae6b6c0a935c94571af /arch
parentfec59a711eef002d4ef9eb8de09dd0a26986eb77 (diff)
[PATCH] pci and yenta: pcibios_bus_to_resource
In yenta_socket, we default to using the resource setting of the CardBus bridge. However, this is a PCI-bus-centric view of resources and thus needs to be converted to generic resources first. Therefore, add a call to pcibios_bus_to_resource() call in between. This function is a mere wrapper on x86 and friends, however on some others it already exists, is added in this patch (alpha, arm, ppc, ppc64) or still needs to be provided (parisc -- where is its pcibios_resource_to_bus() ?). Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/pci.c16
-rw-r--r--arch/arm/kernel/bios32.c17
-rw-r--r--arch/ppc/kernel/pci.c15
-rw-r--r--arch/ppc64/kernel/pci.c20
4 files changed, 68 insertions, 0 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 1f36bbd0ed5d..2a8b364c822e 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -350,8 +350,24 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
350 region->end = res->end - offset; 350 region->end = res->end - offset;
351} 351}
352 352
353void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
354 struct pci_bus_region *region)
355{
356 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
357 unsigned long offset = 0;
358
359 if (res->flags & IORESOURCE_IO)
360 offset = hose->io_space->start;
361 else if (res->flags & IORESOURCE_MEM)
362 offset = hose->mem_space->start;
363
364 res->start = region->start + offset;
365 res->end = region->end + offset;
366}
367
353#ifdef CONFIG_HOTPLUG 368#ifdef CONFIG_HOTPLUG
354EXPORT_SYMBOL(pcibios_resource_to_bus); 369EXPORT_SYMBOL(pcibios_resource_to_bus);
370EXPORT_SYMBOL(pcibios_bus_to_resource);
355#endif 371#endif
356 372
357int 373int
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index ad26e98f1e62..c4923fac8dff 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -447,9 +447,26 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
447 region->end = res->end - offset; 447 region->end = res->end - offset;
448} 448}
449 449
450void __devinit
451pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
452 struct pci_bus_region *region)
453{
454 struct pci_sys_data *root = dev->sysdata;
455 unsigned long offset = 0;
456
457 if (res->flags & IORESOURCE_IO)
458 offset = root->io_offset;
459 if (res->flags & IORESOURCE_MEM)
460 offset = root->mem_offset;
461
462 res->start = region->start + offset;
463 res->end = region->end + offset;
464}
465
450#ifdef CONFIG_HOTPLUG 466#ifdef CONFIG_HOTPLUG
451EXPORT_SYMBOL(pcibios_fixup_bus); 467EXPORT_SYMBOL(pcibios_fixup_bus);
452EXPORT_SYMBOL(pcibios_resource_to_bus); 468EXPORT_SYMBOL(pcibios_resource_to_bus);
469EXPORT_SYMBOL(pcibios_bus_to_resource);
453#endif 470#endif
454 471
455/* 472/*
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
index 70cfb6ffd877..7b3586a3bf30 100644
--- a/arch/ppc/kernel/pci.c
+++ b/arch/ppc/kernel/pci.c
@@ -160,6 +160,21 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
160} 160}
161EXPORT_SYMBOL(pcibios_resource_to_bus); 161EXPORT_SYMBOL(pcibios_resource_to_bus);
162 162
163void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
164 struct pci_bus_region *region)
165{
166 unsigned long offset = 0;
167 struct pci_controller *hose = dev->sysdata;
168
169 if (hose && res->flags & IORESOURCE_IO)
170 offset = (unsigned long)hose->io_base_virt - isa_io_base;
171 else if (hose && res->flags & IORESOURCE_MEM)
172 offset = hose->pci_mem_offset;
173 res->start = region->start + offset;
174 res->end = region->end + offset;
175}
176EXPORT_SYMBOL(pcibios_bus_to_resource);
177
163/* 178/*
164 * We need to avoid collisions with `mirrored' VGA ports 179 * We need to avoid collisions with `mirrored' VGA ports
165 * and other strange ISA hardware, so we always want the 180 * and other strange ISA hardware, so we always want the
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index ae6f579d3fa0..d0d55c7908ef 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -108,8 +108,28 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region
108 region->end = res->end - offset; 108 region->end = res->end - offset;
109} 109}
110 110
111void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
112 struct pci_bus_region *region)
113{
114 unsigned long offset = 0;
115 struct pci_controller *hose = pci_bus_to_host(dev->bus);
116
117 if (!hose)
118 return;
119
120 if (res->flags & IORESOURCE_IO)
121 offset = (unsigned long)hose->io_base_virt - pci_io_base;
122
123 if (res->flags & IORESOURCE_MEM)
124 offset = hose->pci_mem_offset;
125
126 res->start = region->start + offset;
127 res->end = region->end + offset;
128}
129
111#ifdef CONFIG_HOTPLUG 130#ifdef CONFIG_HOTPLUG
112EXPORT_SYMBOL(pcibios_resource_to_bus); 131EXPORT_SYMBOL(pcibios_resource_to_bus);
132EXPORT_SYMBOL(pcibios_bus_to_resource);
113#endif 133#endif
114 134
115/* 135/*