1 #include <linux/vmalloc.h>
2 #include <asm/pgalloc.h>
3 #include <asm/cacheflush.h>
5 /* called with the page_table_lock held */
7 remap_area_pte(pte_t
* pte
, unsigned long address
, unsigned long size
,
8 unsigned long phys_addr
, unsigned long flags
)
19 pfn
= phys_addr
>> PAGE_SHIFT
;
21 if (!pte_none(*pte
)) {
22 printk("remap_area_pte: page already exists\n");
25 set_pte(pte
, pfn_pte(pfn
,
26 __pgprot(_PAGE_VALID
| _PAGE_ASM
|
27 _PAGE_KRE
| _PAGE_KWE
| flags
)));
31 } while (address
&& (address
< end
));
34 /* called with the page_table_lock held */
36 remap_area_pmd(pmd_t
* pmd
, unsigned long address
, unsigned long size
,
37 unsigned long phys_addr
, unsigned long flags
)
41 address
&= ~PGDIR_MASK
;
49 pte_t
* pte
= pte_alloc_kernel(&init_mm
, pmd
, address
);
52 remap_area_pte(pte
, address
, end
- address
,
53 address
+ phys_addr
, flags
);
54 address
= (address
+ PMD_SIZE
) & PMD_MASK
;
56 } while (address
&& (address
< end
));
61 __alpha_remap_area_pages(unsigned long address
, unsigned long phys_addr
,
62 unsigned long size
, unsigned long flags
)
66 unsigned long end
= address
+ size
;
69 dir
= pgd_offset(&init_mm
, address
);
73 spin_lock(&init_mm
.page_table_lock
);
76 pmd
= pmd_alloc(&init_mm
, dir
, address
);
80 if (remap_area_pmd(pmd
, address
, end
- address
,
81 phys_addr
+ address
, flags
))
84 address
= (address
+ PGDIR_SIZE
) & PGDIR_MASK
;
86 } while (address
&& (address
< end
));
87 spin_unlock(&init_mm
.page_table_lock
);