aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/quirks.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2005-08-08 16:19:08 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-08 17:57:25 -0400
commit085ae41f66657a9655ce832b0a61832a06f0e1dc (patch)
tree215690b947b14fa18cbb2810db1a4082ad607e7a /drivers/pci/quirks.c
parent064b53dbcc977dbf2753a67c2b8fc1c061d74f21 (diff)
[PATCH] Make sparc64 use setup-res.c
There were three changes necessary in order to allow sparc64 to use setup-res.c: 1) Sparc64 roots the PCI I/O and MEM address space using parent resources contained in the PCI controller structure. I'm actually surprised no other platforms do this, especially ones like Alpha and PPC{,64}. These resources get linked into the iomem/ioport tree when PCI controllers are probed. So the hierarchy looks like this: iomem --| PCI controller 1 MEM space --| device 1 device 2 etc. PCI controller 2 MEM space --| ... ioport --| PCI controller 1 IO space --| ... PCI controller 2 IO space --| ... You get the idea. The drivers/pci/setup-res.c code allocates using plain iomem_space and ioport_space as the root, so that wouldn't work with the above setup. So I added a pcibios_select_root() that is used to handle this. It uses the PCI controller struct's io_space and mem_space on sparc64, and io{port,mem}_resource on every other platform to keep current behavior. 2) quirk_io_region() is buggy. It takes in raw BUS view addresses and tries to use them as a PCI resource. pci_claim_resource() expects the resource to be fully formed when it gets called. The sparc64 implementation would do the translation but that's absolutely wrong, because if the same resource gets released then re-claimed we'll adjust things twice. So I fixed up quirk_io_region() to do the proper pcibios_bus_to_resource() conversion before passing it on to pci_claim_resource(). 3) I was mistakedly __init'ing the function methods the PCI controller drivers provide on sparc64 to implement some parts of these routines. This was, of course, easy to fix. So we end up with the following, and that nasty SPARC64 makefile ifdef in drivers/pci/Makefile is finally zapped. Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r--drivers/pci/quirks.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 140354a2aa72..4f0c1bd3674a 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -245,12 +245,19 @@ static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region, unsi
245{ 245{
246 region &= ~(size-1); 246 region &= ~(size-1);
247 if (region) { 247 if (region) {
248 struct pci_bus_region bus_region;
248 struct resource *res = dev->resource + nr; 249 struct resource *res = dev->resource + nr;
249 250
250 res->name = pci_name(dev); 251 res->name = pci_name(dev);
251 res->start = region; 252 res->start = region;
252 res->end = region + size - 1; 253 res->end = region + size - 1;
253 res->flags = IORESOURCE_IO; 254 res->flags = IORESOURCE_IO;
255
256 /* Convert from PCI bus to resource space. */
257 bus_region.start = res->start;
258 bus_region.end = res->end;
259 pcibios_bus_to_resource(dev, res, &bus_region);
260
254 pci_claim_resource(dev, nr); 261 pci_claim_resource(dev, nr);
255 } 262 }
256} 263}