]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/VirtioGpuDxe/DriverBinding.c
ArmVirtPkg: resolve OpensslLib to OpensslLibCrypto
[mirror_edk2.git] / OvmfPkg / VirtioGpuDxe / DriverBinding.c
index b902a07871e0226703573286658e756ed4bc2bb2..33c1ad3b31100dd445da502b48facc579980ac93 100644 (file)
 \r
 #include "VirtioGpu.h"\r
 \r
-//\r
-// Dummy Graphics Output Protocol GUID: a temporary placeholder for the EFI\r
-// counterpart. It will be replaced with the real thing as soon as we implement\r
-// the EFI GOP. Refer to VGPU_GOP.Gop.\r
-//\r
-STATIC EFI_GUID mDummyGraphicsOutputProtocolGuid = {\r
-  0x4983f8dc, 0x2782, 0x415b,\r
-  { 0x91, 0xf5, 0x2c, 0xeb, 0x48, 0x4a, 0x0f, 0xe9 }\r
-};\r
-\r
 //\r
 // The device path node that describes the Video Output Device Attributes for\r
 // the single head (UEFI child handle) that we support.\r
@@ -356,9 +346,11 @@ InitVgpuGop (
   //\r
   // Initialize our Graphics Output Protocol.\r
   //\r
-  // This means "nothing" for now.\r
+  // Fill in the function members of VgpuGop->Gop from the template, then set\r
+  // up the rest of the GOP infrastructure by calling SetMode() right now.\r
   //\r
-  Status = EFI_SUCCESS;\r
+  CopyMem (&VgpuGop->Gop, &mGopTemplate, sizeof mGopTemplate);\r
+  Status = VgpuGop->Gop.SetMode (&VgpuGop->Gop, 0);\r
   if (EFI_ERROR (Status)) {\r
     goto CloseVirtIoByChild;\r
   }\r
@@ -367,7 +359,7 @@ InitVgpuGop (
   // Install the Graphics Output Protocol on the child handle.\r
   //\r
   Status = gBS->InstallProtocolInterface (&VgpuGop->GopHandle,\r
-                  &mDummyGraphicsOutputProtocolGuid, EFI_NATIVE_INTERFACE,\r
+                  &gEfiGraphicsOutputProtocolGuid, EFI_NATIVE_INTERFACE,\r
                   &VgpuGop->Gop);\r
   if (EFI_ERROR (Status)) {\r
     goto UninitGop;\r
@@ -381,9 +373,7 @@ InitVgpuGop (
   return EFI_SUCCESS;\r
 \r
 UninitGop:\r
-  //\r
-  // Nothing, for now.\r
-  //\r
+  ReleaseGopResources (VgpuGop, TRUE /* DisableHead */);\r
 \r
 CloseVirtIoByChild:\r
   gBS->CloseProtocol (ParentBusController, &gVirtioDeviceProtocolGuid,\r
@@ -439,16 +429,13 @@ UninitVgpuGop (
 \r
   VgpuGop = ParentBus->Child;\r
   Status = gBS->UninstallProtocolInterface (VgpuGop->GopHandle,\r
-                  &mDummyGraphicsOutputProtocolGuid, &VgpuGop->Gop);\r
+                  &gEfiGraphicsOutputProtocolGuid, &VgpuGop->Gop);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
   // Uninitialize VgpuGop->Gop.\r
   //\r
-  // Nothing, for now.\r
-  //\r
-  Status = EFI_SUCCESS;\r
-  ASSERT_EFI_ERROR (Status);\r
+  ReleaseGopResources (VgpuGop, TRUE /* DisableHead */);\r
 \r
   Status = gBS->CloseProtocol (ParentBusController, &gVirtioDeviceProtocolGuid,\r
                   DriverBindingHandle, VgpuGop->GopHandle);\r
@@ -646,13 +633,25 @@ VirtioGpuDriverBindingStart (
       goto FreeVgpuDev;\r
     }\r
 \r
+    Status = VirtioGpuInit (VgpuDev);\r
+    if (EFI_ERROR (Status)) {\r
+      goto FreeVgpuDevBusName;\r
+    }\r
+\r
+    Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_CALLBACK,\r
+                    VirtioGpuExitBoot, VgpuDev /* NotifyContext */,\r
+                    &VgpuDev->ExitBoot);\r
+    if (EFI_ERROR (Status)) {\r
+      goto UninitGpu;\r
+    }\r
+\r
     //\r
     // Install the VGPU_DEV "protocol interface" on ControllerHandle.\r
     //\r
     Status = gBS->InstallProtocolInterface (&ControllerHandle,\r
                     &gEfiCallerIdGuid, EFI_NATIVE_INTERFACE, VgpuDev);\r
     if (EFI_ERROR (Status)) {\r
-      goto FreeVgpuDevBusName;\r
+      goto CloseExitBoot;\r
     }\r
 \r
     if (RemainingDevicePath != NULL && IsDevicePathEnd (RemainingDevicePath)) {\r
@@ -693,6 +692,16 @@ UninstallVgpuDev:
            VgpuDev);\r
   }\r
 \r
+CloseExitBoot:\r
+  if (VirtIoBoundJustNow) {\r
+    gBS->CloseEvent (VgpuDev->ExitBoot);\r
+  }\r
+\r
+UninitGpu:\r
+  if (VirtIoBoundJustNow) {\r
+    VirtioGpuUninit (VgpuDev);\r
+  }\r
+\r
 FreeVgpuDevBusName:\r
   if (VirtIoBoundJustNow) {\r
     FreeUnicodeStringTable (VgpuDev->BusName);\r
@@ -761,6 +770,10 @@ VirtioGpuDriverBindingStop (
                     &gEfiCallerIdGuid, VgpuDev);\r
     ASSERT_EFI_ERROR (Status);\r
 \r
+    Status = gBS->CloseEvent (VgpuDev->ExitBoot);\r
+    ASSERT_EFI_ERROR (Status);\r
+\r
+    VirtioGpuUninit (VgpuDev);\r
     FreeUnicodeStringTable (VgpuDev->BusName);\r
     FreePool (VgpuDev);\r
 \r