aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci-common.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-01 11:30:04 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-06 23:26:21 -0400
commit7c12d906f4ef690c65e60111375856640f63a545 (patch)
tree94316181a86959bc97fb2bd3b962c4a6c9289ef1 /arch/powerpc/kernel/pci-common.c
parent76c31f239ea221a6c84bd26141262a43bfe8b7f4 (diff)
powerpc: Fix sysfs pci mmap on 32-bit machines with 64-bit PCI
When manipulating 64-bit PCI addresses, the code would lose the top 32-bit in a couple of places when shifting a pfn due to missing type casting from the 32-bit pfn to a 64-bit resource before the shift. This breaks using newer X servers for example on 440 machines with the PCI bus above 32-bit. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/pci-common.c')
-rw-r--r--arch/powerpc/kernel/pci-common.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 52ccfed416ad..8c0270929cc0 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -419,7 +419,7 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
419 struct pci_dev *pdev = NULL; 419 struct pci_dev *pdev = NULL;
420 struct resource *found = NULL; 420 struct resource *found = NULL;
421 unsigned long prot = pgprot_val(protection); 421 unsigned long prot = pgprot_val(protection);
422 unsigned long offset = pfn << PAGE_SHIFT; 422 resource_size_t offset = ((resource_size_t)pfn) << PAGE_SHIFT;
423 int i; 423 int i;
424 424
425 if (page_is_ram(pfn)) 425 if (page_is_ram(pfn))
@@ -470,7 +470,8 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
470int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 470int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
471 enum pci_mmap_state mmap_state, int write_combine) 471 enum pci_mmap_state mmap_state, int write_combine)
472{ 472{
473 resource_size_t offset = vma->vm_pgoff << PAGE_SHIFT; 473 resource_size_t offset =
474 ((resource_size_t)vma->vm_pgoff) << PAGE_SHIFT;
474 struct resource *rp; 475 struct resource *rp;
475 int ret; 476 int ret;
476 477