diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-03-09 00:55:49 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 04:55:11 -0400 |
commit | 9fd8b64761d3fe7e4ef567161be57e4234af5c1c (patch) | |
tree | 39eb4744d6f36c003bb4e9fea77c7c9921bbef2b /arch/sparc64/kernel/pci_sabre.c | |
parent | 01f94c4a6ced476ce69b895426fc29bfc48c69bd (diff) |
[SPARC64]: Consolidate PCI mem/io resource determination.
It can be done for every PCI configuration using OF properties.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/pci_sabre.c')
-rw-r--r-- | arch/sparc64/kernel/pci_sabre.c | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index f4e346092a53..2dad171b54e2 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c | |||
@@ -1045,10 +1045,9 @@ static void sabre_iommu_init(struct pci_controller_info *p, | |||
1045 | sabre_write(p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL, control); | 1045 | sabre_write(p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL, control); |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 dma_start, u32 dma_end) | 1048 | static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp) |
1049 | { | 1049 | { |
1050 | struct pci_pbm_info *pbm; | 1050 | struct pci_pbm_info *pbm; |
1051 | struct resource *rp; | ||
1052 | 1051 | ||
1053 | pbm = &p->pbm_A; | 1052 | pbm = &p->pbm_A; |
1054 | pbm->name = dp->full_name; | 1053 | pbm->name = dp->full_name; |
@@ -1061,38 +1060,7 @@ static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp | |||
1061 | pbm->pci_first_busno = p->pci_first_busno; | 1060 | pbm->pci_first_busno = p->pci_first_busno; |
1062 | pbm->pci_last_busno = p->pci_last_busno; | 1061 | pbm->pci_last_busno = p->pci_last_busno; |
1063 | 1062 | ||
1064 | pbm->io_space.name = pbm->mem_space.name = pbm->name; | 1063 | pci_determine_mem_io_space(pbm); |
1065 | |||
1066 | pbm->io_space.start = p->pbm_A.controller_regs + SABRE_IOSPACE; | ||
1067 | pbm->io_space.end = pbm->io_space.start + (1UL << 24) - 1UL; | ||
1068 | pbm->io_space.flags = IORESOURCE_IO; | ||
1069 | |||
1070 | pbm->mem_space.start = (p->pbm_A.controller_regs + SABRE_MEMSPACE); | ||
1071 | pbm->mem_space.end = (pbm->mem_space.start + ((1UL << 32UL) - 1UL)); | ||
1072 | pbm->mem_space.flags = IORESOURCE_MEM; | ||
1073 | |||
1074 | if (request_resource(&ioport_resource, &pbm->io_space) < 0) { | ||
1075 | prom_printf("Cannot register Sabre's IO space.\n"); | ||
1076 | prom_halt(); | ||
1077 | } | ||
1078 | if (request_resource(&iomem_resource, &pbm->mem_space) < 0) { | ||
1079 | prom_printf("Cannot register Sabre's MEM space.\n"); | ||
1080 | prom_halt(); | ||
1081 | } | ||
1082 | |||
1083 | rp = kmalloc(sizeof(*rp), GFP_KERNEL); | ||
1084 | if (!rp) { | ||
1085 | prom_printf("Cannot allocate IOMMU resource.\n"); | ||
1086 | prom_halt(); | ||
1087 | } | ||
1088 | rp->name = "IOMMU"; | ||
1089 | rp->start = pbm->mem_space.start + (unsigned long) dma_start; | ||
1090 | rp->end = pbm->mem_space.start + (unsigned long) dma_end - 1UL; | ||
1091 | rp->flags = IORESOURCE_BUSY; | ||
1092 | request_resource(&pbm->mem_space, rp); | ||
1093 | |||
1094 | pci_register_legacy_regions(&pbm->io_space, | ||
1095 | &pbm->mem_space); | ||
1096 | } | 1064 | } |
1097 | 1065 | ||
1098 | void sabre_init(struct device_node *dp, char *model_name) | 1066 | void sabre_init(struct device_node *dp, char *model_name) |
@@ -1212,5 +1180,5 @@ void sabre_init(struct device_node *dp, char *model_name) | |||
1212 | /* | 1180 | /* |
1213 | * Look for APB underneath. | 1181 | * Look for APB underneath. |
1214 | */ | 1182 | */ |
1215 | sabre_pbm_init(p, dp, vdma[0], vdma[0] + vdma[1]); | 1183 | sabre_pbm_init(p, dp); |
1216 | } | 1184 | } |