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

Re: [Xen-devel] [PATCH RFC 03/18] OvmfPkg/XenbusDxe: Add device state struct and create an ExitBoot services event.



On Wed, Jul 16, 2014 at 04:15:32PM +0100, Anthony PERARD wrote:
> The ExitBoot event is used to disconnect from the device before the
> next operating system start using them.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> ---
>  OvmfPkg/XenbusDxe/XenbusDxe.c | 39 ++++++++++++++++++++++++++++++++++++---
>  OvmfPkg/XenbusDxe/XenbusDxe.h | 10 ++++++++++
>  2 files changed, 46 insertions(+), 3 deletions(-)
> 
> diff --git a/OvmfPkg/XenbusDxe/XenbusDxe.c b/OvmfPkg/XenbusDxe/XenbusDxe.c
> index 14113ad..2c3d9b8 100644
> --- a/OvmfPkg/XenbusDxe/XenbusDxe.c
> +++ b/OvmfPkg/XenbusDxe/XenbusDxe.c
> @@ -16,7 +16,6 @@
>  
>  #include "XenbusDxe.h"
>  
> -
>  ///
>  /// Driver Binding Protocol instance
>  ///
> @@ -30,6 +29,8 @@ EFI_DRIVER_BINDING_PROTOCOL gXenbusDxeDriverBinding = {
>  };
>  
>  
> +XENBUS_DEVICE *mMyDevice;
> +
>  /**
>    Unloads an image.
>  
> @@ -229,6 +230,19 @@ XenbusDxeDriverBindingSupported (
>    return Status;
>  }
>  
> +VOID
> +EFIAPI
> +NotifyExitBoot (
> +  IN EFI_EVENT Event,
> +  IN VOID *Context
> +  )
> +{
> +  XENBUS_DEVICE *Dev = Context;
> +
> +  gBS->DisconnectController(Dev->ControllerHandle,
> +                            Dev->This->DriverBindingHandle, NULL);
> +}
> +
>  /**
>    Starts a device controller or a bus controller.
>  
> @@ -272,7 +286,22 @@ XenbusDxeDriverBindingStart (
>    IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL
>    )
>  {
> -  return EFI_UNSUPPORTED;
> +  EFI_STATUS Status;
> +  XENBUS_DEVICE *Dev;
> +
> +  Dev = AllocateZeroPool (sizeof (*Dev));
> +  Dev->Signature = XENBUS_DEVICE_SIGNATURE;
> +  Dev->This = This;
> +  Dev->ControllerHandle = ControllerHandle;
> +
> +  Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_CALLBACK,
> +                             NotifyExitBoot,
> +                             (VOID*) Dev,
> +                             &Dev->ExitBootEvent);
> +  ASSERT_EFI_ERROR (Status);
> +
> +  mMyDevice = Dev;
> +  return EFI_SUCCESS;
>  }
>  
>  /**
> @@ -310,5 +339,9 @@ XenbusDxeDriverBindingStop (
>    IN EFI_HANDLE                   *ChildHandleBuffer OPTIONAL
>    )
>  {
> -  return EFI_UNSUPPORTED;
> +  XENBUS_DEVICE *Dev = mMyDevice;
> +
> +  gBS->CloseEvent (Dev->ExitBootEvent);
> +
> +  return EFI_SUCCESS;
>  }
> diff --git a/OvmfPkg/XenbusDxe/XenbusDxe.h b/OvmfPkg/XenbusDxe/XenbusDxe.h
> index 6f22732..c1ca87a 100644
> --- a/OvmfPkg/XenbusDxe/XenbusDxe.h
> +++ b/OvmfPkg/XenbusDxe/XenbusDxe.h
> @@ -75,4 +75,14 @@ extern EFI_COMPONENT_NAME_PROTOCOL  
> gXenbusDxeComponentName;
>  #define PCI_DEVICE_ID_XEN_PLATFORM       0x0001
>  
>  
> +typedef struct _XENBUS_DEVICE XENBUS_DEVICE;
> +
> +#define XENBUS_DEVICE_SIGNATURE SIGNATURE_32 ('X','B','b','d')

I get the 'XB', but 'bd' ? Should it be 'XenB' ? Or perhaps
'XBus' ?

> +struct _XENBUS_DEVICE {
> +  UINT32                        Signature;
> +  EFI_DRIVER_BINDING_PROTOCOL   *This;
> +  EFI_HANDLE                    ControllerHandle;
> +  EFI_EVENT                     ExitBootEvent;
> +};
> +
>  #endif
> -- 
> 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®.