summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/XenBusDxe/GrantTable.h
blob: 28195b6e59c4ebacc287c6e886cad410c73896bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/** @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
  );

/**
  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 written 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__ */