mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-11 22:06:43 +07:00
475339684e
This patch turns e820 and e820_saved into pointers to e820 tables, of the same size as before. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/r/20160917213927.1787-2-dvlasenk@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
51 lines
1.1 KiB
C
51 lines
1.1 KiB
C
#include <linux/ioport.h>
|
|
#include <asm/e820.h>
|
|
|
|
static void resource_clip(struct resource *res, resource_size_t start,
|
|
resource_size_t end)
|
|
{
|
|
resource_size_t low = 0, high = 0;
|
|
|
|
if (res->end < start || res->start > end)
|
|
return; /* no conflict */
|
|
|
|
if (res->start < start)
|
|
low = start - res->start;
|
|
|
|
if (res->end > end)
|
|
high = res->end - end;
|
|
|
|
/* Keep the area above or below the conflict, whichever is larger */
|
|
if (low > high)
|
|
res->end = start - 1;
|
|
else
|
|
res->start = end + 1;
|
|
}
|
|
|
|
static void remove_e820_regions(struct resource *avail)
|
|
{
|
|
int i;
|
|
struct e820entry *entry;
|
|
|
|
for (i = 0; i < e820->nr_map; i++) {
|
|
entry = &e820->map[i];
|
|
|
|
resource_clip(avail, entry->addr,
|
|
entry->addr + entry->size - 1);
|
|
}
|
|
}
|
|
|
|
void arch_remove_reservations(struct resource *avail)
|
|
{
|
|
/*
|
|
* Trim out BIOS area (high 2MB) and E820 regions. We do not remove
|
|
* the low 1MB unconditionally, as this area is needed for some ISA
|
|
* cards requiring a memory range, e.g. the i82365 PCMCIA controller.
|
|
*/
|
|
if (avail->flags & IORESOURCE_MEM) {
|
|
resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END);
|
|
|
|
remove_e820_regions(avail);
|
|
}
|
|
}
|