/* Note: this function only works correct if the e820 table is sorted and not-overlapping, which is the case  */
int __init e820_all_mapped(u64 start, u64 end, unsigned type)
/* Note: this function only works correct if the e820 table is sorted and not-overlapping, which is the case  */
int __init e820_all_mapped(u64 start, u64 end, unsigned type)
{
	int i;
	for (i = 0; i < e820.nr_map; i++) {
		struct e820entry *ei = &e820.map[i];
		if (type && ei->type != type)
			continue;
		if (ei->addr >= end || ei->addr + ei->size <= start)
			continue;
		if (ei->addr <= start)
			start = ei->addr + ei->size;
		if (start >= end)
			return 1;
	}
	return 0;
}