aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci_64.c
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2007-06-27 14:09:43 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-06-29 02:58:45 -0400
commita4c9e328279d55622d56507629d6b8942e8cc9c9 (patch)
tree6e1791cfdfd6c0b9e56f1b154fca715b9aed9fbd /arch/powerpc/kernel/pci_64.c
parent58083dade53cd434e134cd26ae5e89061f6de1ff (diff)
[POWERPC] Use ppc64 style list management for pci_controller on ppc32
Use the ppc64 style list management and allocation functions for pci_controllers. This makes the pci_controller structs just a bit more common between ppc32 & ppc64. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/pci_64.c')
-rw-r--r--arch/powerpc/kernel/pci_64.c66
1 files changed, 0 insertions, 66 deletions
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 384d2752fe60..3b0f49ea4756 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -59,9 +59,6 @@ LIST_HEAD(hose_list);
59 59
60static struct dma_mapping_ops *pci_dma_ops; 60static struct dma_mapping_ops *pci_dma_ops;
61 61
62/* XXX kill that some day ... */
63int global_phb_number; /* Global phb counter */
64
65void set_pci_dma_ops(struct dma_mapping_ops *dma_ops) 62void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
66{ 63{
67 pci_dma_ops = dma_ops; 64 pci_dma_ops = dma_ops;
@@ -172,55 +169,6 @@ void pcibios_align_resource(void *data, struct resource *res,
172 res->start = start; 169 res->start = start;
173} 170}
174 171
175static DEFINE_SPINLOCK(hose_spinlock);
176
177/*
178 * pci_controller(phb) initialized common variables.
179 */
180static void __devinit pci_setup_pci_controller(struct pci_controller *hose)
181{
182 memset(hose, 0, sizeof(struct pci_controller));
183
184 spin_lock(&hose_spinlock);
185 hose->global_number = global_phb_number++;
186 list_add_tail(&hose->list_node, &hose_list);
187 spin_unlock(&hose_spinlock);
188}
189
190struct pci_controller * pcibios_alloc_controller(struct device_node *dev)
191{
192 struct pci_controller *phb;
193
194 if (mem_init_done)
195 phb = kmalloc(sizeof(struct pci_controller), GFP_KERNEL);
196 else
197 phb = alloc_bootmem(sizeof (struct pci_controller));
198 if (phb == NULL)
199 return NULL;
200 pci_setup_pci_controller(phb);
201 phb->arch_data = dev;
202 phb->is_dynamic = mem_init_done;
203 if (dev) {
204 int nid = of_node_to_nid(dev);
205
206 if (nid < 0 || !node_online(nid))
207 nid = -1;
208
209 PHB_SET_NODE(phb, nid);
210 }
211 return phb;
212}
213
214void pcibios_free_controller(struct pci_controller *phb)
215{
216 spin_lock(&hose_spinlock);
217 list_del(&phb->list_node);
218 spin_unlock(&hose_spinlock);
219
220 if (phb->is_dynamic)
221 kfree(phb);
222}
223
224void __devinit pcibios_claim_one_bus(struct pci_bus *b) 172void __devinit pcibios_claim_one_bus(struct pci_bus *b)
225{ 173{
226 struct pci_dev *dev; 174 struct pci_dev *dev;
@@ -957,20 +905,6 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
957} 905}
958EXPORT_SYMBOL(pcibios_fixup_bus); 906EXPORT_SYMBOL(pcibios_fixup_bus);
959 907
960struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
961{
962 if (!have_of)
963 return NULL;
964 while(node) {
965 struct pci_controller *hose, *tmp;
966 list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
967 if (hose->arch_data == node)
968 return hose;
969 node = node->parent;
970 }
971 return NULL;
972}
973
974unsigned long pci_address_to_pio(phys_addr_t address) 908unsigned long pci_address_to_pio(phys_addr_t address)
975{ 909{
976 struct pci_controller *hose, *tmp; 910 struct pci_controller *hose, *tmp;