The PciIo interface will be used in "OvmfPkg/XenBusDxe: Add Grant Table functions" to get the memory address of the BAR 1 and use the space to map shared memory.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Anthony PERARD <[email protected]> --- Change in V3: - add a commit description. Change in V2: - Coding style - Error handler --- OvmfPkg/XenBusDxe/XenBusDxe.c | 19 +++++++++++++++++++ OvmfPkg/XenBusDxe/XenBusDxe.h | 1 + 2 files changed, 20 insertions(+) diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.c b/OvmfPkg/XenBusDxe/XenBusDxe.c index d764365..b8766fe 100644 --- a/OvmfPkg/XenBusDxe/XenBusDxe.c +++ b/OvmfPkg/XenBusDxe/XenBusDxe.c @@ -297,11 +297,25 @@ XenBusDxeDriverBindingStart ( { EFI_STATUS Status; XENBUS_DEVICE *Dev; + EFI_PCI_IO_PROTOCOL *PciIo; + + Status = gBS->OpenProtocol ( + ControllerHandle, + &gEfiPciIoProtocolGuid, + (VOID **) &PciIo, + This->DriverBindingHandle, + ControllerHandle, + EFI_OPEN_PROTOCOL_BY_DRIVER + ); + if (EFI_ERROR (Status)) { + return Status; + } Dev = AllocateZeroPool (sizeof (*Dev)); Dev->Signature = XENBUS_DEVICE_SIGNATURE; Dev->This = This; Dev->ControllerHandle = ControllerHandle; + Dev->PciIo = PciIo; EfiAcquireLock (&mMyDeviceLock); if (mMyDevice != NULL) { @@ -339,6 +353,8 @@ XenBusDxeDriverBindingStart ( ErrorAllocated: FreePool (Dev); + gBS->CloseProtocol (ControllerHandle, &gEfiPciIoProtocolGuid, + This->DriverBindingHandle, ControllerHandle); return Status; } @@ -381,6 +397,9 @@ XenBusDxeDriverBindingStop ( gBS->CloseEvent (Dev->ExitBootEvent); + gBS->CloseProtocol (ControllerHandle, &gEfiPciIoProtocolGuid, + This->DriverBindingHandle, ControllerHandle); + mMyDevice = NULL; FreePool (Dev); return EFI_SUCCESS; diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.h b/OvmfPkg/XenBusDxe/XenBusDxe.h index 0b27699..56453ad 100644 --- a/OvmfPkg/XenBusDxe/XenBusDxe.h +++ b/OvmfPkg/XenBusDxe/XenBusDxe.h @@ -100,6 +100,7 @@ struct _XENBUS_DEVICE { UINT32 Signature; EFI_DRIVER_BINDING_PROTOCOL *This; EFI_HANDLE ControllerHandle; + EFI_PCI_IO_PROTOCOL *PciIo; EFI_EVENT ExitBootEvent; VOID *Hyperpage; -- Anthony PERARD ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
