aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/e820.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-06-02 11:49:34 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-06-02 11:49:34 +0100
commit3b35911d709e100f0855c553adcab5c37b1c02c0 (patch)
tree2354b25c2c977d1ecb4546cfeb62206309c2a42e /xen/arch/x86/e820.c
parentd2c78b31b503e88c2cde80e7f15ec62061007e71 (diff)
downloadxen-3b35911d709e100f0855c553adcab5c37b1c02c0.tar.gz
xen-3b35911d709e100f0855c553adcab5c37b1c02c0.tar.bz2
xen-3b35911d709e100f0855c553adcab5c37b1c02c0.zip
Enable pci mmcfg and ATS for x86_64
This patch enables PCI MMCONFIG in xen and turns on hooks for ATS. Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Diffstat (limited to 'xen/arch/x86/e820.c')
-rw-r--r--xen/arch/x86/e820.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index c496e377d1..db258ecc82 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -25,6 +25,40 @@ boolean_param("e820-verbose", e820_verbose);
struct e820map e820;
+/*
+ * This function checks if the entire range <start,end> is mapped with 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;
+ /* is the region (part) in overlap with the current region ?*/
+ if (ei->addr >= end || ei->addr + ei->size <= start)
+ continue;
+
+ /* if the region is at the beginning of <start,end> we move
+ * start to the end of the region since it's ok until there
+ */
+ if (ei->addr <= start)
+ start = ei->addr + ei->size;
+ /*
+ * if start is now at or beyond end, we're done, full
+ * coverage
+ */
+ if (start >= end)
+ return 1;
+ }
+ return 0;
+}
+
static void __init add_memory_region(unsigned long long start,
unsigned long long size, int type)
{