|
@@ -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)
|
|
|
{
|