[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 06/18] OvmfPkg: Introduce XenBus Protocol.



This protocol will be used for communication between a PV driver (like a
PV block driver) and the XenBus/XenStore.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

--
Change in V2:
- Comment, file header
- Protocol License
- Declare xen interface version earlier
- Rename protocol from Xenbus to XenBus
---
 OvmfPkg/Include/Protocol/XenBus.h | 86 +++++++++++++++++++++++++++++++++++++++
 OvmfPkg/OvmfPkg.dec               |  1 +
 OvmfPkg/XenBusDxe/XenBusDxe.h     |  6 +++
 OvmfPkg/XenBusDxe/XenBusDxe.inf   |  1 +
 4 files changed, 94 insertions(+)
 create mode 100644 OvmfPkg/Include/Protocol/XenBus.h

diff --git a/OvmfPkg/Include/Protocol/XenBus.h 
b/OvmfPkg/Include/Protocol/XenBus.h
new file mode 100644
index 0000000..bf4a69f
--- /dev/null
+++ b/OvmfPkg/Include/Protocol/XenBus.h
@@ -0,0 +1,86 @@
+
+/** @file
+  XenBus protocol to be used between the XenBus bus driver and Xen PV devices.
+
+  This protocol provide the necessary for a Xen PV driver frontend to
+  communicate with the bus driver, and perform several task to
+  initialize/shutdown a PV device and perform IO with a PV backend.
+
+  Copyright (C) 2014, Citrix Ltd.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __PROTOCOL_XENBUS_H__
+#define __PROTOCOL_XENBUS_H__
+
+#define XENBUS_PROTOCOL_GUID \
+  {0x3d3ca290, 0xb9a5, 0x11e3, {0xb7, 0x5d, 0xb8, 0xac, 0x6f, 0x7d, 0x65, 
0xe6}}
+
+///
+/// Forward declaration
+///
+typedef struct _XENBUS_PROTOCOL XENBUS_PROTOCOL;
+
+
+#include <IndustryStandard/Xen/grant_table.h>
+
+///
+/// Function prototypes
+///
+
+typedef
+EFI_STATUS
+(EFIAPI *XENBUS_GRANT_ACCESS)(
+  IN  XENBUS_PROTOCOL *This,
+  IN  domid_t         DomainId,
+  IN  UINTN           Frame,
+  IN  BOOLEAN         ReadOnly,
+  OUT grant_ref_t     *refp
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *XENBUS_GRANT_END_ACCESS)(
+  IN XENBUS_PROTOCOL  *This,
+  IN grant_ref_t      Ref
+  );
+
+
+///
+/// Protocol structure
+///
+struct _XENBUS_PROTOCOL {
+  XENBUS_GRANT_ACCESS           GrantAccess;
+  XENBUS_GRANT_END_ACCESS       GrantEndAccess;
+  //
+  // Protocol data fields
+  //
+};
+
+extern EFI_GUID gXenBusProtocolGuid;
+
+#endif
diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index f829247..104a7b2 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -47,6 +47,7 @@
 [Protocols]
   gVirtioDeviceProtocolGuid       = {0xfa920010, 0x6785, 0x4941, {0xb6, 0xec, 
0x49, 0x8c, 0x57, 0x9f, 0x16, 0x0a}}
   gBlockMmioProtocolGuid          = {0x6b558ce3, 0x69e5, 0x4c67, {0xa6, 0x34, 
0xf7, 0xfe, 0x72, 0xad, 0xbe, 0x84}}
+  gXenBusProtocolGuid             = {0x3d3ca290, 0xb9a5, 0x11e3, {0xb7, 0x5d, 
0xb8, 0xac, 0x6f, 0x7d, 0x65, 0xe6}}
 
 [PcdsFixedAtBuild]
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|0x0|UINT32|0
diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.h b/OvmfPkg/XenBusDxe/XenBusDxe.h
index c16ad95..878e7c5 100644
--- a/OvmfPkg/XenBusDxe/XenBusDxe.h
+++ b/OvmfPkg/XenBusDxe/XenBusDxe.h
@@ -35,6 +35,11 @@
 #include <Uefi.h>
 
 //
+// Xen interface version used
+//
+#define  __XEN_INTERFACE_VERSION__ 0x00040400
+
+//
 // Libraries
 //
 #include <Library/UefiBootServicesTableLib.h>
@@ -61,6 +66,7 @@
 //
 // Produced Protocols
 //
+#include <Protocol/XenBus.h>
 
 
 //
diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.inf b/OvmfPkg/XenBusDxe/XenBusDxe.inf
index edc3e51..aed2359 100644
--- a/OvmfPkg/XenBusDxe/XenBusDxe.inf
+++ b/OvmfPkg/XenBusDxe/XenBusDxe.inf
@@ -55,6 +55,7 @@
   gEfiPciIoProtocolGuid
   gEfiComponentName2ProtocolGuid
   gEfiComponentNameProtocolGuid
+  gXenBusProtocolGuid
 
 
 [Guids]
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.