/* * Handle the memory map. * The functions here do the job until bootmem takes over. * * Getting sanitize_e820_map() in sync with i386 version by applying change: * - Provisions for empty E820 memory regions (reported by certain BIOSes). * Alex Achenbach <xela@slit.de>, December 2002. * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> * */#include<linux/kernel.h>#include<linux/types.h>#include<linux/init.h>#include<linux/bootmem.h>#include<linux/ioport.h>#include<linux/string.h>#include<linux/kexec.h>#include<linux/module.h>#include<linux/mm.h>#include<linux/pfn.h>#include<linux/suspend.h>#include<linux/firmware-map.h>#include<asm/pgtable.h>#include<asm/page.h>#include<asm/e820.h>#include<asm/proto.h>#include<asm/setup.h>#include<asm/trampoline.h>/* * The e820 map is the map that gets modified e.g. with command line parameters * and that is also registered with modifications in the kernel resource tree * with the iomem_resource as parent. * * The e820_saved is directly saved after the BIOS-provided memory map is * copied. It doesn't get modified afterwards. It's registered for the * /sys/firmware/memmap interface. * * That memory map is not modified and is used as base for kexec. The kexec'd * kernel should get the same memory map as the firmware provides. Then the * user can e.g. boot the original kernel with mem=1G while still booting the * next kernel with full memory. */structe820mape820;structe820mape820_saved;/* For PCI or other memory-mapped resources */unsignedlongpci_mem_start=0xaeedbabe;#ifdef CONFIG_PCIEXPORT_SYMBOL(pci_mem_start);#endif/* * This function checks if any part of the range <start,end> is mapped * with type. */inte820_any_mapped(u64start,u64end,unsignedtype){inti;for(i=0;i<e820.nr_map;i++){structe820entry*ei=&e820.map[i];if(type&&ei->type!=type)continue;if(ei->addr>=end||ei->addr+ei->size<=start)continue;return1;}return0;}EXPORT_SYMBOL_GPL(e820_any_mapped);