]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/Protocol/XenBus.h
OvmfPkg/XenBusDxe: Add XenStore client implementation
[mirror_edk2.git] / OvmfPkg / Include / Protocol / XenBus.h
1
2 /** @file
3 XenBus protocol to be used between the XenBus bus driver and Xen PV devices.
4
5 DISCLAIMER: the XENBUS_PROTOCOL introduced here is a work in progress, and
6 should not be used outside of the EDK II tree.
7
8 This protocol provide the necessary for a Xen PV driver frontend to
9 communicate with the bus driver, and perform several task to
10 initialize/shutdown a PV device and perform IO with a PV backend.
11
12 Copyright (C) 2014, Citrix Ltd.
13
14 This program and the accompanying materials
15 are licensed and made available under the terms and conditions of the BSD License
16 which accompanies this distribution. The full text of the license may be found at
17 http://opensource.org/licenses/bsd-license.php
18
19 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
20 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21
22 **/
23
24 #ifndef __PROTOCOL_XENBUS_H__
25 #define __PROTOCOL_XENBUS_H__
26
27 #define XENBUS_PROTOCOL_GUID \
28 {0x3d3ca290, 0xb9a5, 0x11e3, {0xb7, 0x5d, 0xb8, 0xac, 0x6f, 0x7d, 0x65, 0xe6}}
29
30 ///
31 /// Forward declaration
32 ///
33 typedef struct _XENBUS_PROTOCOL XENBUS_PROTOCOL;
34
35 typedef enum xenbus_state XenBusState;
36
37 typedef struct
38 {
39 UINT32 Id;
40 } XENSTORE_TRANSACTION;
41
42 #define XST_NIL ((XENSTORE_TRANSACTION) { 0 })
43
44 typedef enum {
45 XENSTORE_STATUS_SUCCESS = 0,
46 XENSTORE_STATUS_FAIL,
47 XENSTORE_STATUS_EINVAL,
48 XENSTORE_STATUS_EACCES,
49 XENSTORE_STATUS_EEXIST,
50 XENSTORE_STATUS_EISDIR,
51 XENSTORE_STATUS_ENOENT,
52 XENSTORE_STATUS_ENOMEM,
53 XENSTORE_STATUS_ENOSPC,
54 XENSTORE_STATUS_EIO,
55 XENSTORE_STATUS_ENOTEMPTY,
56 XENSTORE_STATUS_ENOSYS,
57 XENSTORE_STATUS_EROFS,
58 XENSTORE_STATUS_EBUSY,
59 XENSTORE_STATUS_EAGAIN,
60 XENSTORE_STATUS_EISCONN,
61 XENSTORE_STATUS_E2BIG
62 } XENSTORE_STATUS;
63
64
65 #include <IndustryStandard/Xen/grant_table.h>
66
67 ///
68 /// Function prototypes
69 ///
70
71 /**
72 Grant access to the page Frame to the domain DomainId.
73
74 @param This A pointer to XENBUS_PROTOCOL instance.
75 @param DomainId ID of the domain to grant acces to.
76 @param Frame Frame Number of the page to grant access to.
77 @param ReadOnly Provide read-only or read-write access.
78 @param RefPtr Reference number of the grant will be writen to this pointer.
79 **/
80 typedef
81 EFI_STATUS
82 (EFIAPI *XENBUS_GRANT_ACCESS)(
83 IN XENBUS_PROTOCOL *This,
84 IN domid_t DomainId,
85 IN UINTN Frame,
86 IN BOOLEAN ReadOnly,
87 OUT grant_ref_t *refp
88 );
89
90 /**
91 End access to grant Ref, previously return by XenBusGrantAccess.
92
93 @param This A pointer to XENBUS_PROTOCOL instance.
94 @param Ref Reference numeber of a grant previously returned by
95 XenBusGrantAccess.
96 **/
97 typedef
98 EFI_STATUS
99 (EFIAPI *XENBUS_GRANT_END_ACCESS)(
100 IN XENBUS_PROTOCOL *This,
101 IN grant_ref_t Ref
102 );
103
104
105 ///
106 /// Protocol structure
107 ///
108 /// DISCLAIMER: the XENBUS_PROTOCOL introduced here is a work in progress, and
109 /// should not be used outside of the EDK II tree.
110 ///
111 struct _XENBUS_PROTOCOL {
112 XENBUS_GRANT_ACCESS GrantAccess;
113 XENBUS_GRANT_END_ACCESS GrantEndAccess;
114 //
115 // Protocol data fields
116 //
117 };
118
119 extern EFI_GUID gXenBusProtocolGuid;
120
121 #endif