Skip to content

Commit

Permalink
mm: move __phys_to_pfn and __pfn_to_phys to asm/generic/memory_model.h
Browse files Browse the repository at this point in the history
Three architectures already define these, and we'll need them genericly
soon.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
Christoph Hellwig authored and Dan Williams committed Aug 27, 2015
1 parent cb389b9 commit 012dcef
Showing 4 changed files with 6 additions and 18 deletions.
6 changes: 0 additions & 6 deletions arch/arm/include/asm/memory.h
Original file line number Diff line number Diff line change
@@ -118,12 +118,6 @@
#define DTCM_OFFSET UL(0xfffe8000)
#endif

/*
* Convert a physical address to a Page Frame Number and back
*/
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
#define __pfn_to_phys(pfn) ((phys_addr_t)(pfn) << PAGE_SHIFT)

/*
* Convert a page to/from a physical address
*/
6 changes: 0 additions & 6 deletions arch/arm64/include/asm/memory.h
Original file line number Diff line number Diff line change
@@ -80,12 +80,6 @@
#define __virt_to_phys(x) (((phys_addr_t)(x) - PAGE_OFFSET + PHYS_OFFSET))
#define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET + PAGE_OFFSET))

/*
* Convert a physical address to a Page Frame Number and back
*/
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
#define __pfn_to_phys(pfn) ((phys_addr_t)(pfn) << PAGE_SHIFT)

/*
* Convert a page to/from a physical address
*/
6 changes: 0 additions & 6 deletions arch/unicore32/include/asm/memory.h
Original file line number Diff line number Diff line change
@@ -60,12 +60,6 @@
#define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET)
#endif

/*
* Convert a physical address to a Page Frame Number and back
*/
#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)

/*
* Convert a page to/from a physical address
*/
6 changes: 6 additions & 0 deletions include/asm-generic/memory_model.h
Original file line number Diff line number Diff line change
@@ -69,6 +69,12 @@
})
#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */

/*
* Convert a physical address to a Page Frame Number and back
*/
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)

#define page_to_pfn __page_to_pfn
#define pfn_to_page __pfn_to_page

0 comments on commit 012dcef

Please sign in to comment.