Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / xenmem.h
diff --git a/qemu/roms/ipxe/src/include/ipxe/xenmem.h b/qemu/roms/ipxe/src/include/ipxe/xenmem.h
new file mode 100644 (file)
index 0000000..9b9aeda
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef _IPXE_XENMEM_H
+#define _IPXE_XENMEM_H
+
+/** @file
+ *
+ * Xen memory operations
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+#include <ipxe/xen.h>
+#include <xen/memory.h>
+
+/**
+ * Add page to physical address space
+ *
+ * @v xen              Xen hypervisor
+ * @v add              Page mapping descriptor
+ * @ret xenrc          Xen status code
+ */
+static inline __attribute__ (( always_inline )) int
+xenmem_add_to_physmap ( struct xen_hypervisor *xen,
+                       struct xen_add_to_physmap *add ) {
+
+       return xen_hypercall_2 ( xen, __HYPERVISOR_memory_op,
+                                XENMEM_add_to_physmap, virt_to_phys ( add ) );
+}
+
+/**
+ * Remove page from physical address space
+ *
+ * @v xen              Xen hypervisor
+ * @v remove           Page mapping descriptor
+ * @ret xenrc          Xen status code
+ */
+static inline __attribute__ (( always_inline )) int
+xenmem_remove_from_physmap ( struct xen_hypervisor *xen,
+                            struct xen_remove_from_physmap *remove ) {
+
+       return xen_hypercall_2 ( xen, __HYPERVISOR_memory_op,
+                                XENMEM_remove_from_physmap,
+                                virt_to_phys ( remove ) );
+}
+
+#endif /* _IPXE_XENMEM_H */