diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/mm/mem.c | 6 | ||||
-rw-r--r-- | arch/ppc/kernel/pci.c | 5 | ||||
-rw-r--r-- | arch/ppc/mm/init.c | 10 | ||||
-rw-r--r-- | arch/ppc64/kernel/pci.c | 5 |
4 files changed, 13 insertions, 13 deletions
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 695db6a588ce..3ca331728d21 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c | |||
@@ -88,13 +88,13 @@ int page_is_ram(unsigned long pfn) | |||
88 | } | 88 | } |
89 | EXPORT_SYMBOL(page_is_ram); | 89 | EXPORT_SYMBOL(page_is_ram); |
90 | 90 | ||
91 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr, | 91 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, |
92 | unsigned long size, pgprot_t vma_prot) | 92 | unsigned long size, pgprot_t vma_prot) |
93 | { | 93 | { |
94 | if (ppc_md.phys_mem_access_prot) | 94 | if (ppc_md.phys_mem_access_prot) |
95 | return ppc_md.phys_mem_access_prot(file, addr, size, vma_prot); | 95 | return ppc_md.phys_mem_access_prot(file, pfn, size, vma_prot); |
96 | 96 | ||
97 | if (!page_is_ram(addr >> PAGE_SHIFT)) | 97 | if (!page_is_ram(pfn)) |
98 | vma_prot = __pgprot(pgprot_val(vma_prot) | 98 | vma_prot = __pgprot(pgprot_val(vma_prot) |
99 | | _PAGE_GUARDED | _PAGE_NO_CACHE); | 99 | | _PAGE_GUARDED | _PAGE_NO_CACHE); |
100 | return vma_prot; | 100 | return vma_prot; |
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c index ad4ef2aaa6ab..e8f4e576750a 100644 --- a/arch/ppc/kernel/pci.c +++ b/arch/ppc/kernel/pci.c | |||
@@ -1594,16 +1594,17 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp, | |||
1594 | * above routine | 1594 | * above routine |
1595 | */ | 1595 | */ |
1596 | pgprot_t pci_phys_mem_access_prot(struct file *file, | 1596 | pgprot_t pci_phys_mem_access_prot(struct file *file, |
1597 | unsigned long offset, | 1597 | unsigned long pfn, |
1598 | unsigned long size, | 1598 | unsigned long size, |
1599 | pgprot_t protection) | 1599 | pgprot_t protection) |
1600 | { | 1600 | { |
1601 | struct pci_dev *pdev = NULL; | 1601 | struct pci_dev *pdev = NULL; |
1602 | struct resource *found = NULL; | 1602 | struct resource *found = NULL; |
1603 | unsigned long prot = pgprot_val(protection); | 1603 | unsigned long prot = pgprot_val(protection); |
1604 | unsigned long offset = pfn << PAGE_SHIFT; | ||
1604 | int i; | 1605 | int i; |
1605 | 1606 | ||
1606 | if (page_is_ram(offset >> PAGE_SHIFT)) | 1607 | if (page_is_ram(pfn)) |
1607 | return prot; | 1608 | return prot; |
1608 | 1609 | ||
1609 | prot |= _PAGE_NO_CACHE | _PAGE_GUARDED; | 1610 | prot |= _PAGE_NO_CACHE | _PAGE_GUARDED; |
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c index db94efd25369..99b48abd3296 100644 --- a/arch/ppc/mm/init.c +++ b/arch/ppc/mm/init.c | |||
@@ -637,18 +637,16 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, | |||
637 | */ | 637 | */ |
638 | int page_is_ram(unsigned long pfn) | 638 | int page_is_ram(unsigned long pfn) |
639 | { | 639 | { |
640 | unsigned long paddr = (pfn << PAGE_SHIFT); | 640 | return pfn < max_pfn; |
641 | |||
642 | return paddr < __pa(high_memory); | ||
643 | } | 641 | } |
644 | 642 | ||
645 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr, | 643 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, |
646 | unsigned long size, pgprot_t vma_prot) | 644 | unsigned long size, pgprot_t vma_prot) |
647 | { | 645 | { |
648 | if (ppc_md.phys_mem_access_prot) | 646 | if (ppc_md.phys_mem_access_prot) |
649 | return ppc_md.phys_mem_access_prot(file, addr, size, vma_prot); | 647 | return ppc_md.phys_mem_access_prot(file, pfn, size, vma_prot); |
650 | 648 | ||
651 | if (!page_is_ram(addr >> PAGE_SHIFT)) | 649 | if (!page_is_ram(pfn)) |
652 | vma_prot = __pgprot(pgprot_val(vma_prot) | 650 | vma_prot = __pgprot(pgprot_val(vma_prot) |
653 | | _PAGE_GUARDED | _PAGE_NO_CACHE); | 651 | | _PAGE_GUARDED | _PAGE_NO_CACHE); |
654 | return vma_prot; | 652 | return vma_prot; |
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c index b2fb6746f00b..3d2106b022a1 100644 --- a/arch/ppc64/kernel/pci.c +++ b/arch/ppc64/kernel/pci.c | |||
@@ -726,16 +726,17 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp, | |||
726 | * above routine | 726 | * above routine |
727 | */ | 727 | */ |
728 | pgprot_t pci_phys_mem_access_prot(struct file *file, | 728 | pgprot_t pci_phys_mem_access_prot(struct file *file, |
729 | unsigned long offset, | 729 | unsigned long pfn, |
730 | unsigned long size, | 730 | unsigned long size, |
731 | pgprot_t protection) | 731 | pgprot_t protection) |
732 | { | 732 | { |
733 | struct pci_dev *pdev = NULL; | 733 | struct pci_dev *pdev = NULL; |
734 | struct resource *found = NULL; | 734 | struct resource *found = NULL; |
735 | unsigned long prot = pgprot_val(protection); | 735 | unsigned long prot = pgprot_val(protection); |
736 | unsigned long offset = pfn << PAGE_SHIFT; | ||
736 | int i; | 737 | int i; |
737 | 738 | ||
738 | if (page_is_ram(offset >> PAGE_SHIFT)) | 739 | if (page_is_ram(pfn)) |
739 | return __pgprot(prot); | 740 | return __pgprot(prot); |
740 | 741 | ||
741 | prot |= _PAGE_NO_CACHE | _PAGE_GUARDED; | 742 | prot |= _PAGE_NO_CACHE | _PAGE_GUARDED; |