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