8 #include <asm/cacheflush.h>
13 #include <asm/sections.h>
14 #include <asm/setup.h>
15 #include <asm/tlbflush.h>
27 #ifdef CONFIG_DIRECT_GBPAGES
43 static void __init find_early_table_space(
struct map_range *mr,
int nr_range)
46 unsigned long puds = 0, pmds = 0, ptes = 0,
tables;
47 unsigned long start = 0, good_end;
50 for (i = 0; i < nr_range; i++) {
86 panic(
"Cannot find space for the kernel page tables");
92 printk(
KERN_DEBUG "kernel direct mapping tables up to %#lx @ [mem %#010lx-%#010lx]\n",
103 #define NR_RANGE_MR 3
105 #define NR_RANGE_MR 5
109 unsigned long start_pfn,
unsigned long end_pfn,
110 unsigned long page_size_mask)
112 if (start_pfn < end_pfn) {
114 panic(
"run out of range for init_memory_mapping\n");
132 unsigned long page_size_mask = 0;
133 unsigned long start_pfn, end_pfn;
134 unsigned long ret = 0;
139 int use_pse, use_gbpages;
144 #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
150 use_pse = use_gbpages = 0;
152 use_pse = cpu_has_pse;
171 memset(mr, 0,
sizeof(mr));
193 if (end_pfn > (end >> PAGE_SHIFT))
194 end_pfn = end >> PAGE_SHIFT;
195 if (start_pfn < end_pfn) {
196 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
212 if (start_pfn < end_pfn) {
213 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
223 if (start_pfn < end_pfn) {
224 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
234 if (start_pfn < end_pfn) {
235 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
244 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
247 for (i = 0; nr_range > 1 && i < nr_range - 1; i++) {
248 unsigned long old_start;
249 if (mr[i].end != mr[i+1].start ||
250 mr[i].page_size_mask != mr[i+1].page_size_mask)
255 (nr_range - 1 - i) *
sizeof(
struct map_range));
256 mr[i--].
start = old_start;
260 for (i = 0; i < nr_range; i++)
262 mr[i].start, mr[i].end - 1,
264 (mr[i].page_size_mask & (1<<
PG_LEVEL_2M))?
"2M":
"4k"));
274 find_early_table_space(mr, nr_range);
276 for (i = 0; i < nr_range; i++)
278 mr[i].page_size_mask);
338 unsigned long begin_aligned, end_aligned;
344 if (
WARN_ON(begin_aligned != begin || end_aligned != end)) {
345 begin = begin_aligned;
359 #ifdef CONFIG_DEBUG_PAGEALLOC
372 printk(
KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
391 #ifdef CONFIG_BLK_DEV_INITRD
409 unsigned long max_zone_pfns[MAX_NR_ZONES];
411 memset(max_zone_pfns, 0,
sizeof(max_zone_pfns));
413 #ifdef CONFIG_ZONE_DMA
416 #ifdef CONFIG_ZONE_DMA32
420 #ifdef CONFIG_HIGHMEM
421 max_zone_pfns[ZONE_HIGHMEM] =
max_pfn;
424 free_area_init_nodes(max_zone_pfns);