diff options
author | David S. Miller <davem@davemloft.net> | 2005-08-08 16:19:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-08 17:57:25 -0400 |
commit | 085ae41f66657a9655ce832b0a61832a06f0e1dc (patch) | |
tree | 215690b947b14fa18cbb2810db1a4082ad607e7a /arch/sparc64/kernel/pci_sabre.c | |
parent | 064b53dbcc977dbf2753a67c2b8fc1c061d74f21 (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 'arch/sparc64/kernel/pci_sabre.c')
-rw-r--r-- | arch/sparc64/kernel/pci_sabre.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index 52bf3431a422..0ee6bd5b9ac6 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c | |||
@@ -554,7 +554,7 @@ static unsigned char sabre_pil_table[] = { | |||
554 | /*0x32*/15, /* Power Management */ | 554 | /*0x32*/15, /* Power Management */ |
555 | }; | 555 | }; |
556 | 556 | ||
557 | static int __init sabre_ino_to_pil(struct pci_dev *pdev, unsigned int ino) | 557 | static int sabre_ino_to_pil(struct pci_dev *pdev, unsigned int ino) |
558 | { | 558 | { |
559 | int ret; | 559 | int ret; |
560 | 560 | ||
@@ -612,9 +612,9 @@ static void sabre_wsync_handler(struct ino_bucket *bucket, void *_arg1, void *_a | |||
612 | sabre_read(sync_reg); | 612 | sabre_read(sync_reg); |
613 | } | 613 | } |
614 | 614 | ||
615 | static unsigned int __init sabre_irq_build(struct pci_pbm_info *pbm, | 615 | static unsigned int sabre_irq_build(struct pci_pbm_info *pbm, |
616 | struct pci_dev *pdev, | 616 | struct pci_dev *pdev, |
617 | unsigned int ino) | 617 | unsigned int ino) |
618 | { | 618 | { |
619 | struct ino_bucket *bucket; | 619 | struct ino_bucket *bucket; |
620 | unsigned long imap, iclr; | 620 | unsigned long imap, iclr; |
@@ -1009,7 +1009,7 @@ static irqreturn_t sabre_pcierr_intr(int irq, void *dev_id, struct pt_regs *regs | |||
1009 | #define SABRE_UE_INO 0x2e | 1009 | #define SABRE_UE_INO 0x2e |
1010 | #define SABRE_CE_INO 0x2f | 1010 | #define SABRE_CE_INO 0x2f |
1011 | #define SABRE_PCIERR_INO 0x30 | 1011 | #define SABRE_PCIERR_INO 0x30 |
1012 | static void __init sabre_register_error_handlers(struct pci_controller_info *p) | 1012 | static void sabre_register_error_handlers(struct pci_controller_info *p) |
1013 | { | 1013 | { |
1014 | struct pci_pbm_info *pbm = &p->pbm_A; /* arbitrary */ | 1014 | struct pci_pbm_info *pbm = &p->pbm_A; /* arbitrary */ |
1015 | unsigned long base = pbm->controller_regs; | 1015 | unsigned long base = pbm->controller_regs; |
@@ -1056,9 +1056,9 @@ static void __init sabre_register_error_handlers(struct pci_controller_info *p) | |||
1056 | sabre_write(base + SABRE_PCICTRL, tmp); | 1056 | sabre_write(base + SABRE_PCICTRL, tmp); |
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | static void __init sabre_resource_adjust(struct pci_dev *pdev, | 1059 | static void sabre_resource_adjust(struct pci_dev *pdev, |
1060 | struct resource *res, | 1060 | struct resource *res, |
1061 | struct resource *root) | 1061 | struct resource *root) |
1062 | { | 1062 | { |
1063 | struct pci_pbm_info *pbm = pdev->bus->sysdata; | 1063 | struct pci_pbm_info *pbm = pdev->bus->sysdata; |
1064 | unsigned long base; | 1064 | unsigned long base; |
@@ -1072,7 +1072,7 @@ static void __init sabre_resource_adjust(struct pci_dev *pdev, | |||
1072 | res->end += base; | 1072 | res->end += base; |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | static void __init sabre_base_address_update(struct pci_dev *pdev, int resource) | 1075 | static void sabre_base_address_update(struct pci_dev *pdev, int resource) |
1076 | { | 1076 | { |
1077 | struct pcidev_cookie *pcp = pdev->sysdata; | 1077 | struct pcidev_cookie *pcp = pdev->sysdata; |
1078 | struct pci_pbm_info *pbm = pcp->pbm; | 1078 | struct pci_pbm_info *pbm = pcp->pbm; |
@@ -1118,7 +1118,7 @@ static void __init sabre_base_address_update(struct pci_dev *pdev, int resource) | |||
1118 | pci_write_config_dword(pdev, where + 4, 0); | 1118 | pci_write_config_dword(pdev, where + 4, 0); |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | static void __init apb_init(struct pci_controller_info *p, struct pci_bus *sabre_bus) | 1121 | static void apb_init(struct pci_controller_info *p, struct pci_bus *sabre_bus) |
1122 | { | 1122 | { |
1123 | struct pci_dev *pdev; | 1123 | struct pci_dev *pdev; |
1124 | 1124 | ||
@@ -1181,7 +1181,7 @@ static struct pcidev_cookie *alloc_bridge_cookie(struct pci_pbm_info *pbm) | |||
1181 | return cookie; | 1181 | return cookie; |
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | static void __init sabre_scan_bus(struct pci_controller_info *p) | 1184 | static void sabre_scan_bus(struct pci_controller_info *p) |
1185 | { | 1185 | { |
1186 | static int once; | 1186 | static int once; |
1187 | struct pci_bus *sabre_bus, *pbus; | 1187 | struct pci_bus *sabre_bus, *pbus; |
@@ -1262,9 +1262,9 @@ static void __init sabre_scan_bus(struct pci_controller_info *p) | |||
1262 | sabre_register_error_handlers(p); | 1262 | sabre_register_error_handlers(p); |
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | static void __init sabre_iommu_init(struct pci_controller_info *p, | 1265 | static void sabre_iommu_init(struct pci_controller_info *p, |
1266 | int tsbsize, unsigned long dvma_offset, | 1266 | int tsbsize, unsigned long dvma_offset, |
1267 | u32 dma_mask) | 1267 | u32 dma_mask) |
1268 | { | 1268 | { |
1269 | struct pci_iommu *iommu = p->pbm_A.iommu; | 1269 | struct pci_iommu *iommu = p->pbm_A.iommu; |
1270 | unsigned long tsbbase, i, order; | 1270 | unsigned long tsbbase, i, order; |
@@ -1345,8 +1345,8 @@ static void __init sabre_iommu_init(struct pci_controller_info *p, | |||
1345 | } | 1345 | } |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | static void __init pbm_register_toplevel_resources(struct pci_controller_info *p, | 1348 | static void pbm_register_toplevel_resources(struct pci_controller_info *p, |
1349 | struct pci_pbm_info *pbm) | 1349 | struct pci_pbm_info *pbm) |
1350 | { | 1350 | { |
1351 | char *name = pbm->name; | 1351 | char *name = pbm->name; |
1352 | unsigned long ibase = p->pbm_A.controller_regs + SABRE_IOSPACE; | 1352 | unsigned long ibase = p->pbm_A.controller_regs + SABRE_IOSPACE; |
@@ -1415,7 +1415,7 @@ static void __init pbm_register_toplevel_resources(struct pci_controller_info *p | |||
1415 | &pbm->mem_space); | 1415 | &pbm->mem_space); |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | static void __init sabre_pbm_init(struct pci_controller_info *p, int sabre_node, u32 dma_begin) | 1418 | static void sabre_pbm_init(struct pci_controller_info *p, int sabre_node, u32 dma_begin) |
1419 | { | 1419 | { |
1420 | struct pci_pbm_info *pbm; | 1420 | struct pci_pbm_info *pbm; |
1421 | char namebuf[128]; | 1421 | char namebuf[128]; |
@@ -1552,7 +1552,7 @@ static void __init sabre_pbm_init(struct pci_controller_info *p, int sabre_node, | |||
1552 | } | 1552 | } |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | void __init sabre_init(int pnode, char *model_name) | 1555 | void sabre_init(int pnode, char *model_name) |
1556 | { | 1556 | { |
1557 | struct linux_prom64_registers pr_regs[2]; | 1557 | struct linux_prom64_registers pr_regs[2]; |
1558 | struct pci_controller_info *p; | 1558 | struct pci_controller_info *p; |