summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/XenBusDxe/GrantTable.h
diff options
context:
space:
mode:
authorSteven Smith <sos22@cam.ac.uk>2014-10-29 06:50:14 +0000
committerjljusten <jljusten@Edk2>2014-10-29 06:50:14 +0000
commit0fd142464fc5b0fcb8b7fdfac379c1054ec81654 (patch)
tree5976cdb6b46225cc1c57b6bf264e55f067e2fc51 /OvmfPkg/XenBusDxe/GrantTable.h
parentbba9d16231fe9f7d67e0530e720530d91a88ad73 (diff)
downloadedk2-0fd142464fc5b0fcb8b7fdfac379c1054ec81654.tar.gz
OvmfPkg/XenBusDxe: Add Grant Table functions.
There are used to grant access of pages to other Xen domains. This code originaly comes from the Xen Project, and more precisely from MiniOS. Change in V4: - Add license to GrantTable.h Change in V3: - Add a comment about the use of the BAR of the device. Change in V2: - Adding locks - Redo the file header - Add functions comment - Add license Signed-off-by: Steven Smith <sos22@cam.ac.uk> Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16264 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/XenBusDxe/GrantTable.h')
-rw-r--r--OvmfPkg/XenBusDxe/GrantTable.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/OvmfPkg/XenBusDxe/GrantTable.h b/OvmfPkg/XenBusDxe/GrantTable.h
new file mode 100644
index 0000000000..5772c56662
--- /dev/null
+++ b/OvmfPkg/XenBusDxe/GrantTable.h
@@ -0,0 +1,77 @@
+/** @file
+ Grant Table function declaration.
+
+ Grant Table are used to grant access to certain page of the current
+ VM to an other VM.
+
+ Copyright (C) 2014, Citrix Ltd.
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+#ifndef __GNTTAB_H__
+#define __GNTTAB_H__
+
+#include <IndustryStandard/Xen/grant_table.h>
+
+/**
+ Initialize the Grant Table at the address MmioAddr.
+
+ @param Dev A pointer to XENBUS_DEVICE.
+ @param MmioAddr An address where the grant table can be mapped into
+ the guest.
+**/
+VOID
+XenGrantTableInit (
+ IN XENBUS_DEVICE *Dev,
+ IN UINT64 MmioAddr
+ );
+
+/**
+ Desinitilize the Grant Table.
+**/
+VOID
+XenGrantTableDeinit (
+ IN XENBUS_DEVICE *Dev
+ );
+
+/**
+ Grant access to the page Frame to the domain DomainId.
+
+ @param This A pointer to XENBUS_PROTOCOL instance.
+ @param DomainId ID of the domain to grant acces to.
+ @param Frame Frame Number of the page to grant access to.
+ @param ReadOnly Provide read-only or read-write access.
+ @param RefPtr Reference number of the grant will be writen to this pointer.
+**/
+EFI_STATUS
+EFIAPI
+XenBusGrantAccess (
+ IN XENBUS_PROTOCOL *This,
+ IN domid_t DomainId,
+ IN UINTN Frame, // MFN
+ IN BOOLEAN ReadOnly,
+ OUT grant_ref_t *RefPtr
+ );
+
+/**
+ End access to grant Ref, previously return by XenBusGrantAccess.
+
+ @param This A pointer to XENBUS_PROTOCOL instance.
+ @param Ref Reference numeber of a grant previously returned by
+ XenBusGrantAccess.
+**/
+EFI_STATUS
+EFIAPI
+XenBusGrantEndAccess (
+ IN XENBUS_PROTOCOL *This,
+ IN grant_ref_t Ref
+ );
+
+#endif /* !__GNTTAB_H__ */