On 12/15/13 05:15, Chris Ruffin wrote:
> The QemuVideoDxe driver creates child controller handles, so it is acting
> as a hybrid bus driver. The child handles should open the parent's bus
> protocol BY_CHILD_CONTROLLER to properly maintain the protocol usage count.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chris Ruffin <[email protected]>
> ---
> 
> patch version 4 per review:
> 1) Adds a private pointer for the PciIo interface for the child controller
> 2) Populates this pointer instead of incorrectly overwriting unrelated 
> private data
> 
> 
>  OvmfPkg/QemuVideoDxe/Driver.c | 32 +++++++++++++++++++++++++++++++-
>  OvmfPkg/QemuVideoDxe/Qemu.h   |  1 +
>  2 files changed, 32 insertions(+), 1 deletion(-)
> 
> diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
> index 53718e1..3fdcd21 100644
> --- a/OvmfPkg/QemuVideoDxe/Driver.c
> +++ b/OvmfPkg/QemuVideoDxe/Driver.c
> @@ -419,6 +419,22 @@ QemuVideoControllerDriverStart (
>                      &Private->GraphicsOutput,
>                      NULL
>                      );
> +    if (EFI_ERROR (Status)) {
> +      goto Error;
> +    }
> +
> +    Status = gBS->OpenProtocol (
> +                  Controller,
> +                  &gEfiPciIoProtocolGuid,
> +                  (VOID **) &Private->ChildPciIo,
> +                  This->DriverBindingHandle,
> +                  Private->Handle,
> +                  EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
> +                  );
> +
> +    if (EFI_ERROR (Status)) {
> +      goto Error;
> +    }
>    }
>  
>  Error:
> @@ -440,7 +456,14 @@ Error:
>          // Close the PCI I/O Protocol
>          //
>          gBS->CloseProtocol (
> -              Private->Handle,
> +              Controller,
> +              &gEfiPciIoProtocolGuid,
> +              This->DriverBindingHandle,
> +              Controller
> +              );
> +
> +        gBS->CloseProtocol (
> +              Controller,
>                &gEfiPciIoProtocolGuid,
>                This->DriverBindingHandle,
>                Private->Handle
> @@ -533,6 +556,13 @@ QemuVideoControllerDriverStop (
>          Controller
>          );
>  
> +  gBS->CloseProtocol (
> +        Controller,
> +        &gEfiPciIoProtocolGuid,
> +        This->DriverBindingHandle,
> +        Private->Handle
> +        );
> +
>    //
>    // Free our instance data
>    //
> diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
> index 38d6872..5e4f169 100644
> --- a/OvmfPkg/QemuVideoDxe/Qemu.h
> +++ b/OvmfPkg/QemuVideoDxe/Qemu.h
> @@ -104,6 +104,7 @@ typedef struct {
>    UINT64                                Signature;
>    EFI_HANDLE                            Handle;
>    EFI_PCI_IO_PROTOCOL                   *PciIo;
> +  EFI_PCI_IO_PROTOCOL                   *ChildPciIo;
>    UINT64                                OriginalPciAttributes;
>    EFI_GRAPHICS_OUTPUT_PROTOCOL          GraphicsOutput;
>    EFI_DEVICE_PATH_PROTOCOL              *GopDevicePath;
> 

I think it wouldn't have been necessary to carry this new pointer around
in the private data struct (a local variable would have sufficed), but
I've been splitting hairs long enough :)

Reviewed-by: Laszlo Ersek <[email protected]>

Thanks!
Laszlo

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to