summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/QemuVideoDxe
diff options
context:
space:
mode:
authorChris Ruffin <chris.ruffin@intel.com>2013-12-15 20:47:39 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2013-12-15 20:47:39 +0000
commit4374c2e535edad27d8c4c6516d2f1bb68403afca (patch)
tree18b7618d3e453f1cd7f9d2115182492b54a56568 /OvmfPkg/QemuVideoDxe
parentcc31ac1e40034b631793e068d49acdfccb56e46d (diff)
downloadedk2-4374c2e535edad27d8c4c6516d2f1bb68403afca.tar.gz
edk2-4374c2e535edad27d8c4c6516d2f1bb68403afca.tar.bz2
edk2-4374c2e535edad27d8c4c6516d2f1bb68403afca.zip
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 <chris.ruffin@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14987 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/QemuVideoDxe')
-rw-r--r--OvmfPkg/QemuVideoDxe/Driver.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
index 53718e1aea..b253ec734e 100644
--- a/OvmfPkg/QemuVideoDxe/Driver.c
+++ b/OvmfPkg/QemuVideoDxe/Driver.c
@@ -209,6 +209,7 @@ QemuVideoControllerDriverStart (
PCI_TYPE00 Pci;
QEMU_VIDEO_CARD *Card;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *MmioDesc;
+ EFI_PCI_IO_PROTOCOL *ChildPciIo;
PciAttributesSaved = FALSE;
//
@@ -419,6 +420,22 @@ QemuVideoControllerDriverStart (
&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,7 +457,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 +557,13 @@ QemuVideoControllerDriverStop (
Controller
);
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Private->Handle
+ );
+
//
// Free our instance data
//