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

Re: [Xen-devel] [PATCH RFC 06/18] OvmfPkg: Introduce Xenbus Protocol.



On Wed, Jul 16, 2014 at 04:15:35PM +0100, Anthony PERARD wrote:
> 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>
> ---
>  OvmfPkg/Include/Protocol/Xenbus.h | 62 
> +++++++++++++++++++++++++++++++++++++++
>  OvmfPkg/OvmfPkg.dec               |  2 ++
>  OvmfPkg/XenbusDxe/ComponentName.c | 12 ++++++++
>  OvmfPkg/XenbusDxe/XenbusDxe.h     |  3 ++
>  OvmfPkg/XenbusDxe/XenbusDxe.inf   |  1 +
>  5 files changed, 80 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..191cee1
> --- /dev/null
> +++ b/OvmfPkg/Include/Protocol/Xenbus.h
> @@ -0,0 +1,62 @@
> +
> +/** @file
> +  TODO: Brief Description of Protocol Xenbus
> +
> +  TODO: Detailed Description of Protocol Xenbus
> +
> +  TODO: Copyright for Protocol Xenbus
> +
> +  TODO: License for Protocol Xenbus
> +
> +**/
> +
> +#ifndef __PROTOCOL_XENBUS_H__
> +#define __PROTOCOL_XENBUS_H__
> +
> +#define XENBUS_PROTOCOL_GUID \
> +  {0x3d3ca290, 0xb9a5, 0x11e3, {0xb7, 0x5d, 0xb8, 0xac, 0x6f, 0x7d, 0x65, 
> 0xe6}}

For those who are not familiar with these GUIDs and live in the Linux world - 
how
are they constructed? Is there a chance for collision ?

> +
> +///
> +/// 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;
> +  //
> +  // Place protocol data fields here
> +  //
> +};
> +
> +extern EFI_GUID gXenbusProtocolGuid;
> +
> +#endif
> diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
> index f829247..095d40a 100644
> --- a/OvmfPkg/OvmfPkg.dec
> +++ b/OvmfPkg/OvmfPkg.dec
> @@ -47,6 +47,8 @@
>  [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}}
> +  ## Include/Protocol/Xenbus.h
> +  gXenbusProtocolGuid = {0x3d3ca290, 0xb9a5, 0x11e3, {0xb7, 0x5d, 0xb8, 
> 0xac, 0x6f, 0x7d, 0x65, 0xe6}}

Formatting? Looks like the others use tabs?

>  
>  [PcdsFixedAtBuild]
>    gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|0x0|UINT32|0
> diff --git a/OvmfPkg/XenbusDxe/ComponentName.c 
> b/OvmfPkg/XenbusDxe/ComponentName.c
> index 2cf11b5..fd46cc8 100644
> --- a/OvmfPkg/XenbusDxe/ComponentName.c
> +++ b/OvmfPkg/XenbusDxe/ComponentName.c
> @@ -140,6 +140,18 @@ XenbusDxeComponentNameGetControllerName (
>    }
>  
>    //
> +  // Make sure this driver is currently managing ControllerHandle
> +  //
> +  Status = EfiTestManagedDevice (
> +             ControllerHandle,
> +             gXenbusDxeDriverBinding.DriverBindingHandle,
> +             &gXenbusProtocolGuid
> +             );
> +  if (EFI_ERROR (Status)) {
> +    return Status;
> +  }
> +
> +  //
>    // Lookup name of controller specified by ControllerHandle
>    //
>    Status = EFI_UNSUPPORTED;
> diff --git a/OvmfPkg/XenbusDxe/XenbusDxe.h b/OvmfPkg/XenbusDxe/XenbusDxe.h
> index d57e3c8..975fb6b 100644
> --- a/OvmfPkg/XenbusDxe/XenbusDxe.h
> +++ b/OvmfPkg/XenbusDxe/XenbusDxe.h
> @@ -42,6 +42,9 @@
>  //
>  // Produced Protocols
>  //
> +// Xen interface version used:
> +#define  __XEN_INTERFACE_VERSION__ 0x00040400
> +#include <Protocol/Xenbus.h>
>  
>  
>  //
> diff --git a/OvmfPkg/XenbusDxe/XenbusDxe.inf b/OvmfPkg/XenbusDxe/XenbusDxe.inf
> index 8b69f93..1a6b131 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

_______________________________________________
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®.