Commit 8168b540 authored by David Howells's avatar David Howells Committed by Paul Mackerras

powerpc: Rename struct vm_region to avoid conflict with NOMMU

Rename PowerPC's struct vm_region so that I can introduce my own
global version for NOMMU.  It's feasible that the PowerPC version may
wish to use my global one instead.

The NOMMU vm_region struct defines areas of the physical memory map
that are under mmap.  This may include chunks of RAM or regions of
memory mapped devices, such as flash.  It is also used to retain
copies of file content so that shareable private memory mappings of
files can be made.  As such, it may be compatible with what is
described in the banner comment for PowerPC's vm_region struct.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 13ba3c00
...@@ -77,26 +77,26 @@ static DEFINE_SPINLOCK(consistent_lock); ...@@ -77,26 +77,26 @@ static DEFINE_SPINLOCK(consistent_lock);
* the amount of RAM found at boot time.) I would imagine that get_vm_area() * the amount of RAM found at boot time.) I would imagine that get_vm_area()
* would have to initialise this each time prior to calling vm_region_alloc(). * would have to initialise this each time prior to calling vm_region_alloc().
*/ */
struct vm_region { struct ppc_vm_region {
struct list_head vm_list; struct list_head vm_list;
unsigned long vm_start; unsigned long vm_start;
unsigned long vm_end; unsigned long vm_end;
}; };
static struct vm_region consistent_head = { static struct ppc_vm_region consistent_head = {
.vm_list = LIST_HEAD_INIT(consistent_head.vm_list), .vm_list = LIST_HEAD_INIT(consistent_head.vm_list),
.vm_start = CONSISTENT_BASE, .vm_start = CONSISTENT_BASE,
.vm_end = CONSISTENT_END, .vm_end = CONSISTENT_END,
}; };
static struct vm_region * static struct ppc_vm_region *
vm_region_alloc(struct vm_region *head, size_t size, gfp_t gfp) ppc_vm_region_alloc(struct ppc_vm_region *head, size_t size, gfp_t gfp)
{ {
unsigned long addr = head->vm_start, end = head->vm_end - size; unsigned long addr = head->vm_start, end = head->vm_end - size;
unsigned long flags; unsigned long flags;
struct vm_region *c, *new; struct ppc_vm_region *c, *new;
new = kmalloc(sizeof(struct vm_region), gfp); new = kmalloc(sizeof(struct ppc_vm_region), gfp);
if (!new) if (!new)
goto out; goto out;
...@@ -130,9 +130,9 @@ vm_region_alloc(struct vm_region *head, size_t size, gfp_t gfp) ...@@ -130,9 +130,9 @@ vm_region_alloc(struct vm_region *head, size_t size, gfp_t gfp)
return NULL; return NULL;
} }
static struct vm_region *vm_region_find(struct vm_region *head, unsigned long addr) static struct ppc_vm_region *ppc_vm_region_find(struct ppc_vm_region *head, unsigned long addr)
{ {
struct vm_region *c; struct ppc_vm_region *c;
list_for_each_entry(c, &head->vm_list, vm_list) { list_for_each_entry(c, &head->vm_list, vm_list) {
if (c->vm_start == addr) if (c->vm_start == addr)
...@@ -151,7 +151,7 @@ void * ...@@ -151,7 +151,7 @@ void *
__dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp) __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp)
{ {
struct page *page; struct page *page;
struct vm_region *c; struct ppc_vm_region *c;
unsigned long order; unsigned long order;
u64 mask = 0x00ffffff, limit; /* ISA default */ u64 mask = 0x00ffffff, limit; /* ISA default */
...@@ -191,7 +191,7 @@ __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp) ...@@ -191,7 +191,7 @@ __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp)
/* /*
* Allocate a virtual address in the consistent mapping region. * Allocate a virtual address in the consistent mapping region.
*/ */
c = vm_region_alloc(&consistent_head, size, c = ppc_vm_region_alloc(&consistent_head, size,
gfp & ~(__GFP_DMA | __GFP_HIGHMEM)); gfp & ~(__GFP_DMA | __GFP_HIGHMEM));
if (c) { if (c) {
unsigned long vaddr = c->vm_start; unsigned long vaddr = c->vm_start;
...@@ -239,7 +239,7 @@ EXPORT_SYMBOL(__dma_alloc_coherent); ...@@ -239,7 +239,7 @@ EXPORT_SYMBOL(__dma_alloc_coherent);
*/ */
void __dma_free_coherent(size_t size, void *vaddr) void __dma_free_coherent(size_t size, void *vaddr)
{ {
struct vm_region *c; struct ppc_vm_region *c;
unsigned long flags, addr; unsigned long flags, addr;
pte_t *ptep; pte_t *ptep;
...@@ -247,7 +247,7 @@ void __dma_free_coherent(size_t size, void *vaddr) ...@@ -247,7 +247,7 @@ void __dma_free_coherent(size_t size, void *vaddr)
spin_lock_irqsave(&consistent_lock, flags); spin_lock_irqsave(&consistent_lock, flags);
c = vm_region_find(&consistent_head, (unsigned long)vaddr); c = ppc_vm_region_find(&consistent_head, (unsigned long)vaddr);
if (!c) if (!c)
goto no_area; goto no_area;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment