aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-12-08 01:14:33 -0500
committerPaul Mackerras <paulus@samba.org>2006-12-08 01:21:06 -0500
commit396a1a5832ae28ce2c4150f98827873cbef554f5 (patch)
tree26d72bdf3765184f64e6231e7962152272584401 /include
parentf09b5ce0184da6a83bac7fafda4e624629272b37 (diff)
[POWERPC] Fix mmap of PCI resource with hack for X
The powerpc version of pci_resource_to_user() and associated hooks used by /proc/bus/pci and /sys/bus/pci mmap have been broken for some time on machines that don't have a 1:1 mapping of devices (basically on non-PowerMacs) and have PCI devices above 32 bits. This attempts to fix it as well as possible. The rule is supposed to be that pci_resource_to_user() always converts the resources back into a BAR values since that's what the /proc interface was supposed to deal with. However, for X to work on platforms where PCI MMIO is not mapped 1:1, it became a habit of platforms like powerpc to pass "fixed up" values there since X expects to be able to use values from /proc/bus/pci/devices as offsets to mmap of /dev/mem... So we keep that contraption here, causing also /sys/*/resource to expose fully absolute MMIO addresses instead of BAR values, which is ugly, but should still work as long as those are only used to calculate alignment within a page. X is still broken when built 32 bits on machines where PCI MMIO can be above 32-bit space unfortunately. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-powerpc/pci-bridge.h4
-rw-r--r--include/asm-ppc/pci-bridge.h8
2 files changed, 6 insertions, 6 deletions
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index 7bb7f9009806..cb02c9d1ef93 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -31,12 +31,12 @@ struct pci_controller {
31 int last_busno; 31 int last_busno;
32 32
33 void __iomem *io_base_virt; 33 void __iomem *io_base_virt;
34 unsigned long io_base_phys; 34 resource_size_t io_base_phys;
35 35
36 /* Some machines have a non 1:1 mapping of 36 /* Some machines have a non 1:1 mapping of
37 * the PCI memory space in the CPU bus space 37 * the PCI memory space in the CPU bus space
38 */ 38 */
39 unsigned long pci_mem_offset; 39 resource_size_t pci_mem_offset;
40 unsigned long pci_io_size; 40 unsigned long pci_io_size;
41 41
42 struct pci_ops *ops; 42 struct pci_ops *ops;
diff --git a/include/asm-ppc/pci-bridge.h b/include/asm-ppc/pci-bridge.h
index 6c955d0c1ef0..4d35b844bc58 100644
--- a/include/asm-ppc/pci-bridge.h
+++ b/include/asm-ppc/pci-bridge.h
@@ -20,8 +20,8 @@ extern unsigned long pci_bus_mem_base_phys(unsigned int bus);
20extern struct pci_controller* pcibios_alloc_controller(void); 20extern struct pci_controller* pcibios_alloc_controller(void);
21 21
22/* Helper function for setting up resources */ 22/* Helper function for setting up resources */
23extern void pci_init_resource(struct resource *res, unsigned long start, 23extern void pci_init_resource(struct resource *res, resource_size_t start,
24 unsigned long end, int flags, char *name); 24 resource_size_t end, int flags, char *name);
25 25
26/* Get the PCI host controller for a bus */ 26/* Get the PCI host controller for a bus */
27extern struct pci_controller* pci_bus_to_hose(int bus); 27extern struct pci_controller* pci_bus_to_hose(int bus);
@@ -50,12 +50,12 @@ struct pci_controller {
50 int bus_offset; 50 int bus_offset;
51 51
52 void __iomem *io_base_virt; 52 void __iomem *io_base_virt;
53 unsigned long io_base_phys; 53 resource_size_t io_base_phys;
54 54
55 /* Some machines (PReP) have a non 1:1 mapping of 55 /* Some machines (PReP) have a non 1:1 mapping of
56 * the PCI memory space in the CPU bus space 56 * the PCI memory space in the CPU bus space
57 */ 57 */
58 unsigned long pci_mem_offset; 58 resource_size_t pci_mem_offset;
59 59
60 struct pci_ops *ops; 60 struct pci_ops *ops;
61 volatile unsigned int __iomem *cfg_addr; 61 volatile unsigned int __iomem *cfg_addr;