aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64/pci-bridge.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-ppc64/pci-bridge.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-ppc64/pci-bridge.h')
-rw-r--r--include/asm-ppc64/pci-bridge.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h
new file mode 100644
index 000000000000..c4f9023ea5ed
--- /dev/null
+++ b/include/asm-ppc64/pci-bridge.h
@@ -0,0 +1,90 @@
1#ifdef __KERNEL__
2#ifndef _ASM_PCI_BRIDGE_H
3#define _ASM_PCI_BRIDGE_H
4
5#include <linux/pci.h>
6
7/*
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14/*
15 * Structure of a PCI controller (host bridge)
16 */
17struct pci_controller {
18 struct pci_bus *bus;
19 char is_dynamic;
20 void *arch_data;
21 struct list_head list_node;
22
23 int first_busno;
24 int last_busno;
25
26 void __iomem *io_base_virt;
27 unsigned long io_base_phys;
28
29 /* Some machines have a non 1:1 mapping of
30 * the PCI memory space in the CPU bus space
31 */
32 unsigned long pci_mem_offset;
33 unsigned long pci_io_size;
34
35 struct pci_ops *ops;
36 volatile unsigned int __iomem *cfg_addr;
37 volatile unsigned char __iomem *cfg_data;
38
39 /* Currently, we limit ourselves to 1 IO range and 3 mem
40 * ranges since the common pci_bus structure can't handle more
41 */
42 struct resource io_resource;
43 struct resource mem_resources[3];
44 int global_number;
45 int local_number;
46 unsigned long buid;
47 unsigned long dma_window_base_cur;
48 unsigned long dma_window_size;
49};
50
51struct device_node *fetch_dev_dn(struct pci_dev *dev);
52
53/* Get a device_node from a pci_dev. This code must be fast except in the case
54 * where the sysdata is incorrect and needs to be fixed up (hopefully just once)
55 */
56static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
57{
58 struct device_node *dn = dev->sysdata;
59
60 if (dn->devfn == dev->devfn && dn->busno == dev->bus->number)
61 return dn; /* fast path. sysdata is good */
62 else
63 return fetch_dev_dn(dev);
64}
65
66static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
67{
68 if (bus->self)
69 return pci_device_to_OF_node(bus->self);
70 else
71 return bus->sysdata; /* Must be root bus (PHB) */
72}
73
74extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
75 struct device_node *dev);
76
77extern int pcibios_remove_root_bus(struct pci_controller *phb);
78
79extern void phbs_remap_io(void);
80
81static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
82{
83 struct device_node *busdn = bus->sysdata;
84
85 BUG_ON(busdn == NULL);
86 return busdn->phb;
87}
88
89#endif
90#endif /* __KERNEL__ */