printk(KERN_INFO "modified physical RAM map:\n");
e820_print_map("modified");
}
-
+#define MAX_GAP_END 0x100000000ull
/*
- * Search for a gap in the e820 memory space from start_addr to 2^32.
+ * Search for a gap in the e820 memory space from start_addr to end_addr.
*/
__init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
- unsigned long start_addr)
+ unsigned long start_addr, unsigned long long end_addr)
{
- unsigned long long last = 0x100000000ull;
+ unsigned long long last;
int i = e820.nr_map;
int found = 0;
+ last = (end_addr && end_addr < MAX_GAP_END) ? end_addr : MAX_GAP_END;
+
while (--i >= 0) {
unsigned long long start = e820.map[i].addr;
unsigned long long end = start + e820.map[i].size;
gapstart = 0x10000000;
gapsize = 0x400000;
- found = e820_search_gap(&gapstart, &gapsize, 0);
+ found = e820_search_gap(&gapstart, &gapsize, 0, MAX_GAP_END);
#ifdef CONFIG_X86_64
if (!found) {
extern void update_e820(void);
extern void e820_setup_gap(void);
extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
- unsigned long start_addr);
+ unsigned long start_addr, unsigned long long end_addr);
struct setup_data;
extern void parse_e820_ext(struct setup_data *data, unsigned long pa_data);