Revision: 14987
          http://sourceforge.net/p/edk2/code/14987
Author:   jljusten
Date:     2013-12-15 20:47:39 +0000 (Sun, 15 Dec 2013)
Log Message:
-----------
OvmfPkg/QemuVideoDxe: child handles should have open parent protocol 
BY_CHILD_CONTROLLER

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]>
Reviewed-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>

Modified Paths:
--------------
    trunk/edk2/OvmfPkg/QemuVideoDxe/Driver.c

Modified: trunk/edk2/OvmfPkg/QemuVideoDxe/Driver.c
===================================================================
--- trunk/edk2/OvmfPkg/QemuVideoDxe/Driver.c    2013-12-13 23:53:59 UTC (rev 
14986)
+++ trunk/edk2/OvmfPkg/QemuVideoDxe/Driver.c    2013-12-15 20:47:39 UTC (rev 
14987)
@@ -209,6 +209,7 @@
   PCI_TYPE00                        Pci;
   QEMU_VIDEO_CARD                   *Card;
   EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *MmioDesc;
+  EFI_PCI_IO_PROTOCOL               *ChildPciIo;
 
   PciAttributesSaved = FALSE;
   //
@@ -419,6 +420,22 @@
                     &Private->GraphicsOutput,
                     NULL
                     );
+    if (EFI_ERROR (Status)) {
+      goto Error;
+    }
+
+    Status = gBS->OpenProtocol (
+                  Controller,
+                  &gEfiPciIoProtocolGuid,
+                  (VOID **) &ChildPciIo,
+                  This->DriverBindingHandle,
+                  Private->Handle,
+                  EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+                  );
+
+    if (EFI_ERROR (Status)) {
+      goto Error;
+    }
   }
 
 Error:
@@ -440,9 +457,16 @@
         // 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 +557,13 @@
         Controller
         );
 
+  gBS->CloseProtocol (
+        Controller,
+        &gEfiPciIoProtocolGuid,
+        This->DriverBindingHandle,
+        Private->Handle
+        );
+
   //
   // Free our instance data
   //

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
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-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to