1 /** @file
2   Grant Table function declaration.
3 
4   Grant Table are used to grant access to certain page of the current
5   VM to an other VM.
6 
7   Copyright (C) 2014, Citrix Ltd.
8 
9   This program and the accompanying materials
10   are licensed and made available under the terms and conditions of the BSD License
11   which accompanies this distribution.  The full text of the license may be found at
12   http://opensource.org/licenses/bsd-license.php
13 
14   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 
17 **/
18 #ifndef __GNTTAB_H__
19 #define __GNTTAB_H__
20 
21 #include <IndustryStandard/Xen/grant_table.h>
22 
23 /**
24   Initialize the Grant Table at the address MmioAddr.
25 
26   @param Dev      A pointer to XENBUS_DEVICE.
27   @param MmioAddr An address where the grant table can be mapped into
28                   the guest.
29 **/
30 VOID
31 XenGrantTableInit (
32   IN XENBUS_DEVICE  *Dev
33   );
34 
35 /**
36   Desinitilize the Grant Table.
37 **/
38 VOID
39 XenGrantTableDeinit (
40   IN XENBUS_DEVICE  *Dev
41   );
42 
43 /**
44   Grant access to the page Frame to the domain DomainId.
45 
46   @param This       A pointer to XENBUS_PROTOCOL instance.
47   @param DomainId   ID of the domain to grant acces to.
48   @param Frame      Frame Number of the page to grant access to.
49   @param ReadOnly   Provide read-only or read-write access.
50   @param RefPtr     Reference number of the grant will be writen to this pointer.
51 **/
52 EFI_STATUS
53 EFIAPI
54 XenBusGrantAccess (
55   IN  XENBUS_PROTOCOL *This,
56   IN  domid_t         DomainId,
57   IN  UINTN           Frame, // MFN
58   IN  BOOLEAN         ReadOnly,
59   OUT grant_ref_t     *RefPtr
60   );
61 
62 /**
63   End access to grant Ref, previously return by XenBusGrantAccess.
64 
65   @param This       A pointer to XENBUS_PROTOCOL instance.
66   @param Ref        Reference numeber of a grant previously returned by
67                     XenBusGrantAccess.
68 **/
69 EFI_STATUS
70 EFIAPI
71 XenBusGrantEndAccess (
72   IN XENBUS_PROTOCOL  *This,
73   IN grant_ref_t      Ref
74   );
75 
76 #endif /* !__GNTTAB_H__ */
77