e820.c (1a1270349a0710162a160eef4f2e360845e0f47d) e820.c (81b3e090fa1f237d49c8feb2fa4afe2aabd3a4ff)
1/*
2 * Low level x86 E820 memory map handling functions.
3 *
4 * The firmware and bootloader passes us the "E820 table", which is the primary
5 * physical memory layout description available about x86 systems.
6 *
7 * The kernel takes the E820 memory layout and optionally modifies it with
8 * quirks and other tweaks, and feeds that into the generic Linux memory

--- 54 unchanged lines hidden (view full) ---

63#ifdef CONFIG_PCI
64EXPORT_SYMBOL(pci_mem_start);
65#endif
66
67/*
68 * This function checks if any part of the range <start,end> is mapped
69 * with type.
70 */
1/*
2 * Low level x86 E820 memory map handling functions.
3 *
4 * The firmware and bootloader passes us the "E820 table", which is the primary
5 * physical memory layout description available about x86 systems.
6 *
7 * The kernel takes the E820 memory layout and optionally modifies it with
8 * quirks and other tweaks, and feeds that into the generic Linux memory

--- 54 unchanged lines hidden (view full) ---

63#ifdef CONFIG_PCI
64EXPORT_SYMBOL(pci_mem_start);
65#endif
66
67/*
68 * This function checks if any part of the range <start,end> is mapped
69 * with type.
70 */
71int e820__mapped_any(u64 start, u64 end, enum e820_type type)
71bool e820__mapped_any(u64 start, u64 end, enum e820_type type)
72{
73 int i;
74
75 for (i = 0; i < e820_table->nr_entries; i++) {
76 struct e820_entry *entry = &e820_table->entries[i];
77
78 if (type && entry->type != type)
79 continue;

--- 6 unchanged lines hidden (view full) ---

86EXPORT_SYMBOL_GPL(e820__mapped_any);
87
88/*
89 * This function checks if the entire <start,end> range is mapped with 'type'.
90 *
91 * Note: this function only works correctly once the E820 table is sorted and
92 * not-overlapping (at least for the range specified), which is the case normally.
93 */
72{
73 int i;
74
75 for (i = 0; i < e820_table->nr_entries; i++) {
76 struct e820_entry *entry = &e820_table->entries[i];
77
78 if (type && entry->type != type)
79 continue;

--- 6 unchanged lines hidden (view full) ---

86EXPORT_SYMBOL_GPL(e820__mapped_any);
87
88/*
89 * This function checks if the entire <start,end> range is mapped with 'type'.
90 *
91 * Note: this function only works correctly once the E820 table is sorted and
92 * not-overlapping (at least for the range specified), which is the case normally.
93 */
94int __init e820__mapped_all(u64 start, u64 end, enum e820_type type)
94bool __init e820__mapped_all(u64 start, u64 end, enum e820_type type)
95{
96 int i;
97
98 for (i = 0; i < e820_table->nr_entries; i++) {
99 struct e820_entry *entry = &e820_table->entries[i];
100
101 if (type && entry->type != type)
102 continue;

--- 384 unchanged lines hidden (view full) ---

487}
488
489static u64 __init e820__range_update_firmware(u64 start, u64 size, enum e820_type old_type, enum e820_type new_type)
490{
491 return __e820__range_update(e820_table_firmware, start, size, old_type, new_type);
492}
493
494/* Remove a range of memory from the E820 table: */
95{
96 int i;
97
98 for (i = 0; i < e820_table->nr_entries; i++) {
99 struct e820_entry *entry = &e820_table->entries[i];
100
101 if (type && entry->type != type)
102 continue;

--- 384 unchanged lines hidden (view full) ---

487}
488
489static u64 __init e820__range_update_firmware(u64 start, u64 size, enum e820_type old_type, enum e820_type new_type)
490{
491 return __e820__range_update(e820_table_firmware, start, size, old_type, new_type);
492}
493
494/* Remove a range of memory from the E820 table: */
495u64 __init e820__range_remove(u64 start, u64 size, enum e820_type old_type, int checktype)
495u64 __init e820__range_remove(u64 start, u64 size, enum e820_type old_type, bool check_type)
496{
497 int i;
498 u64 end;
499 u64 real_removed_size = 0;
500
501 if (size > (ULLONG_MAX - start))
502 size = ULLONG_MAX - start;
503
504 end = start + size;
505 pr_debug("e820: remove [mem %#010Lx-%#010Lx] ", start, end - 1);
496{
497 int i;
498 u64 end;
499 u64 real_removed_size = 0;
500
501 if (size > (ULLONG_MAX - start))
502 size = ULLONG_MAX - start;
503
504 end = start + size;
505 pr_debug("e820: remove [mem %#010Lx-%#010Lx] ", start, end - 1);
506 if (checktype)
506 if (check_type)
507 e820_print_type(old_type);
508 pr_cont("\n");
509
510 for (i = 0; i < e820_table->nr_entries; i++) {
511 struct e820_entry *entry = &e820_table->entries[i];
512 u64 final_start, final_end;
513 u64 entry_end;
514
507 e820_print_type(old_type);
508 pr_cont("\n");
509
510 for (i = 0; i < e820_table->nr_entries; i++) {
511 struct e820_entry *entry = &e820_table->entries[i];
512 u64 final_start, final_end;
513 u64 entry_end;
514
515 if (checktype && entry->type != old_type)
515 if (check_type && entry->type != old_type)
516 continue;
517
518 entry_end = entry->addr + entry->size;
519
520 /* Completely covered? */
521 if (entry->addr >= start && entry_end <= end) {
522 real_removed_size += entry->size;
523 memset(entry, 0, sizeof(*entry));

--- 702 unchanged lines hidden ---
516 continue;
517
518 entry_end = entry->addr + entry->size;
519
520 /* Completely covered? */
521 if (entry->addr >= start && entry_end <= end) {
522 real_removed_size += entry->size;
523 memset(entry, 0, sizeof(*entry));

--- 702 unchanged lines hidden ---