Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351142
b: refs/heads/master
c: ed8fd21
h: refs/heads/master
v: v3
  • Loading branch information
Joonsoo Kim authored and Russell King committed Feb 16, 2013
1 parent 7f840fc commit 0cf7132
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 48dc369d21b41f6400d15cdaf9411e2e6fd62323
refs/heads/master: ed8fd2186a4e4f3b98434093b56f9b793d48443e
64 changes: 64 additions & 0 deletions trunk/arch/arm/mm/ioremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,70 @@
#include <asm/mach/pci.h>
#include "mm.h"


LIST_HEAD(static_vmlist);

static struct static_vm *find_static_vm_paddr(phys_addr_t paddr,
size_t size, unsigned int mtype)
{
struct static_vm *svm;
struct vm_struct *vm;

list_for_each_entry(svm, &static_vmlist, list) {
vm = &svm->vm;
if (!(vm->flags & VM_ARM_STATIC_MAPPING))
continue;
if ((vm->flags & VM_ARM_MTYPE_MASK) != VM_ARM_MTYPE(mtype))
continue;

if (vm->phys_addr > paddr ||
paddr + size - 1 > vm->phys_addr + vm->size - 1)
continue;

return svm;
}

return NULL;
}

struct static_vm *find_static_vm_vaddr(void *vaddr)
{
struct static_vm *svm;
struct vm_struct *vm;

list_for_each_entry(svm, &static_vmlist, list) {
vm = &svm->vm;

/* static_vmlist is ascending order */
if (vm->addr > vaddr)
break;

if (vm->addr <= vaddr && vm->addr + vm->size > vaddr)
return svm;
}

return NULL;
}

void __init add_static_vm_early(struct static_vm *svm)
{
struct static_vm *curr_svm;
struct vm_struct *vm;
void *vaddr;

vm = &svm->vm;
vm_area_add_early(vm);
vaddr = vm->addr;

list_for_each_entry(curr_svm, &static_vmlist, list) {
vm = &curr_svm->vm;

if (vm->addr > vaddr)
break;
}
list_add_tail(&svm->list, &curr_svm->list);
}

int ioremap_page(unsigned long virt, unsigned long phys,
const struct mem_type *mtype)
{
Expand Down
12 changes: 12 additions & 0 deletions trunk/arch/arm/mm/mm.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#ifdef CONFIG_MMU
#include <linux/list.h>
#include <linux/vmalloc.h>

/* the upper-most page table pointer */
extern pmd_t *top_pmd;
Expand Down Expand Up @@ -65,6 +67,16 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
/* consistent regions used by dma_alloc_attrs() */
#define VM_ARM_DMA_CONSISTENT 0x20000000


struct static_vm {
struct vm_struct vm;
struct list_head list;
};

extern struct list_head static_vmlist;
extern struct static_vm *find_static_vm_vaddr(void *vaddr);
extern __init void add_static_vm_early(struct static_vm *svm);

#endif

#ifdef CONFIG_ZONE_DMA
Expand Down

0 comments on commit 0cf7132

Please sign in to comment.