From 12a16f2d1c610942a3420c86e7a3c6bcc7a6eedf Mon Sep 17 00:00:00 2001 From: Anthony PERARD Date: Wed, 29 Oct 2014 06:49:38 +0000 Subject: [PATCH] OvmfPkg: Introduce XenBus Protocol. This protocol will be used for communication between a PV driver (like a PV block driver) and the XenBus/XenStore. Change in V5: - Replace the license by the commonly used file header text. Change in V3: - Add disclaimer about the volatile nature of the protocol. - Add a description on the two introduced members to the protocol. Change in V2: - Comment, file header - Protocol License - Declare xen interface version earlier - Rename protocol from Xenbus to XenBus Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Anthony PERARD Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16262 6f19259b-4bc3-4df7-8a09-765794883524 --- OvmfPkg/Include/Protocol/XenBus.h | 92 +++++++++++++++++++++++++++++++ OvmfPkg/OvmfPkg.dec | 1 + OvmfPkg/XenBusDxe/XenBusDxe.h | 6 ++ OvmfPkg/XenBusDxe/XenBusDxe.inf | 1 + 4 files changed, 100 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 0000000000..89bf74fbc5 --- /dev/null +++ b/OvmfPkg/Include/Protocol/XenBus.h @@ -0,0 +1,92 @@ + +/** @file + XenBus protocol to be used between the XenBus bus driver and Xen PV devices. + + DISCLAIMER: the XENBUS_PROTOCOL introduced here is a work in progress, and + should not be used outside of the EDK II tree. + + 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. + + 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 __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 + +/// +/// Function prototypes +/// + +/** + 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 writen to this pointer. +**/ +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 + ); + +/** + 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. +**/ +typedef +EFI_STATUS +(EFIAPI *XENBUS_GRANT_END_ACCESS)( + IN XENBUS_PROTOCOL *This, + IN grant_ref_t Ref + ); + + +/// +/// Protocol structure +/// +/// DISCLAIMER: the XENBUS_PROTOCOL introduced here is a work in progress, and +/// should not be used outside of the EDK II tree. +/// +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 c10948dc3b..3765ac8f8a 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 388d299695..64579bb832 100644 --- a/OvmfPkg/XenBusDxe/XenBusDxe.h +++ b/OvmfPkg/XenBusDxe/XenBusDxe.h @@ -18,6 +18,11 @@ #include +// +// Xen interface version used +// +#define __XEN_INTERFACE_VERSION__ 0x00040400 + // // Libraries // @@ -45,6 +50,7 @@ // // Produced Protocols // +#include // diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.inf b/OvmfPkg/XenBusDxe/XenBusDxe.inf index 6da3d2d670..add85213c6 100644 --- a/OvmfPkg/XenBusDxe/XenBusDxe.inf +++ b/OvmfPkg/XenBusDxe/XenBusDxe.inf @@ -62,6 +62,7 @@ gEfiPciIoProtocolGuid gEfiComponentName2ProtocolGuid gEfiComponentNameProtocolGuid + gXenBusProtocolGuid [Guids] -- 2.39.2