Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 11709
b: refs/heads/master
c: 8b15047
h: refs/heads/master
i:
  11707: d268c33
v: v3
  • Loading branch information
Roland Dreier authored and Paul Mackerras committed Oct 29, 2005
1 parent c6ea460 commit db7718d
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d49b340124a34fcb8bceda472558ccef7232c16f
refs/heads/master: 8b150478aeb1a8edb9015c2f7ac4da637ff65c45
6 changes: 3 additions & 3 deletions trunk/arch/powerpc/mm/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ int page_is_ram(unsigned long pfn)
}
EXPORT_SYMBOL(page_is_ram);

pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr,
pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t vma_prot)
{
if (ppc_md.phys_mem_access_prot)
return ppc_md.phys_mem_access_prot(file, addr, size, vma_prot);
return ppc_md.phys_mem_access_prot(file, pfn, size, vma_prot);

if (!page_is_ram(addr >> PAGE_SHIFT))
if (!page_is_ram(pfn))
vma_prot = __pgprot(pgprot_val(vma_prot)
| _PAGE_GUARDED | _PAGE_NO_CACHE);
return vma_prot;
Expand Down
5 changes: 3 additions & 2 deletions trunk/arch/ppc/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1594,16 +1594,17 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
* above routine
*/
pgprot_t pci_phys_mem_access_prot(struct file *file,
unsigned long offset,
unsigned long pfn,
unsigned long size,
pgprot_t protection)
{
struct pci_dev *pdev = NULL;
struct resource *found = NULL;
unsigned long prot = pgprot_val(protection);
unsigned long offset = pfn << PAGE_SHIFT;
int i;

if (page_is_ram(offset >> PAGE_SHIFT))
if (page_is_ram(pfn))
return prot;

prot |= _PAGE_NO_CACHE | _PAGE_GUARDED;
Expand Down
10 changes: 4 additions & 6 deletions trunk/arch/ppc/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,18 +637,16 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
*/
int page_is_ram(unsigned long pfn)
{
unsigned long paddr = (pfn << PAGE_SHIFT);

return paddr < __pa(high_memory);
return pfn < max_pfn;
}

pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr,
pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t vma_prot)
{
if (ppc_md.phys_mem_access_prot)
return ppc_md.phys_mem_access_prot(file, addr, size, vma_prot);
return ppc_md.phys_mem_access_prot(file, pfn, size, vma_prot);

if (!page_is_ram(addr >> PAGE_SHIFT))
if (!page_is_ram(pfn))
vma_prot = __pgprot(pgprot_val(vma_prot)
| _PAGE_GUARDED | _PAGE_NO_CACHE);
return vma_prot;
Expand Down
5 changes: 3 additions & 2 deletions trunk/arch/ppc64/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,16 +726,17 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
* above routine
*/
pgprot_t pci_phys_mem_access_prot(struct file *file,
unsigned long offset,
unsigned long pfn,
unsigned long size,
pgprot_t protection)
{
struct pci_dev *pdev = NULL;
struct resource *found = NULL;
unsigned long prot = pgprot_val(protection);
unsigned long offset = pfn << PAGE_SHIFT;
int i;

if (page_is_ram(offset >> PAGE_SHIFT))
if (page_is_ram(pfn))
return __pgprot(prot);

prot |= _PAGE_NO_CACHE | _PAGE_GUARDED;
Expand Down
4 changes: 1 addition & 3 deletions trunk/drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,7 @@ static ssize_t write_mem(struct file * file, const char __user * buf,
static int mmap_mem(struct file * file, struct vm_area_struct * vma)
{
#if defined(__HAVE_PHYS_MEM_ACCESS_PROT)
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;

vma->vm_page_prot = phys_mem_access_prot(file, offset,
vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff,
vma->vm_end - vma->vm_start,
vma->vm_page_prot);
#elif defined(pgprot_noncached)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/video/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
}
#endif
#elif defined(__powerpc__)
vma->vm_page_prot = phys_mem_access_prot(file, off,
vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT,
vma->vm_end - vma->vm_start,
vma->vm_page_prot);
#elif defined(__alpha__)
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/asm-powerpc/machdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ struct machdep_calls {

/* Get access protection for /dev/mem */
pgprot_t (*phys_mem_access_prot)(struct file *file,
unsigned long offset,
unsigned long pfn,
unsigned long size,
pgprot_t vma_prot);

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/asm-ppc/machdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct machdep_calls {

/* Get access protection for /dev/mem */
pgprot_t (*phys_mem_access_prot)(struct file *file,
unsigned long offset,
unsigned long pfn,
unsigned long size,
pgprot_t vma_prot);

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/asm-ppc/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ extern void pcibios_add_platform_entries(struct pci_dev *dev);

struct file;
extern pgprot_t pci_phys_mem_access_prot(struct file *file,
unsigned long offset,
unsigned long pfn,
unsigned long size,
pgprot_t prot);

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/asm-ppc/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED))

struct file;
extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr,
extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t vma_prot);
#define __HAVE_PHYS_MEM_ACCESS_PROT

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/asm-ppc64/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ extern void pcibios_add_platform_entries(struct pci_dev *dev);

struct file;
extern pgprot_t pci_phys_mem_access_prot(struct file *file,
unsigned long offset,
unsigned long pfn,
unsigned long size,
pgprot_t prot);

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/asm-ppc64/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED))

struct file;
extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr,
extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t vma_prot);
#define __HAVE_PHYS_MEM_ACCESS_PROT

Expand Down

0 comments on commit db7718d

Please sign in to comment.