Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/driver...
[linux-2.6/verdex.git] / include / asm-ppc64 / pci-bridge.h
blobc4f9023ea5ed8a64e0a6f15f2c8c441f49312929
1 #ifdef __KERNEL__
2 #ifndef _ASM_PCI_BRIDGE_H
3 #define _ASM_PCI_BRIDGE_H
5 #include <linux/pci.h>
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.
15 * Structure of a PCI controller (host bridge)
17 struct pci_controller {
18 struct pci_bus *bus;
19 char is_dynamic;
20 void *arch_data;
21 struct list_head list_node;
23 int first_busno;
24 int last_busno;
26 void __iomem *io_base_virt;
27 unsigned long io_base_phys;
29 /* Some machines have a non 1:1 mapping of
30 * the PCI memory space in the CPU bus space
32 unsigned long pci_mem_offset;
33 unsigned long pci_io_size;
35 struct pci_ops *ops;
36 volatile unsigned int __iomem *cfg_addr;
37 volatile unsigned char __iomem *cfg_data;
39 /* Currently, we limit ourselves to 1 IO range and 3 mem
40 * ranges since the common pci_bus structure can't handle more
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;
51 struct device_node *fetch_dev_dn(struct pci_dev *dev);
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)
56 static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
58 struct device_node *dn = dev->sysdata;
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);
66 static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
68 if (bus->self)
69 return pci_device_to_OF_node(bus->self);
70 else
71 return bus->sysdata; /* Must be root bus (PHB) */
74 extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
75 struct device_node *dev);
77 extern int pcibios_remove_root_bus(struct pci_controller *phb);
79 extern void phbs_remap_io(void);
81 static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
83 struct device_node *busdn = bus->sysdata;
85 BUG_ON(busdn == NULL);
86 return busdn->phb;
89 #endif
90 #endif /* __KERNEL__ */