]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/VirtioGpuDxe/DriverBinding.c
OvmfPkg/VirtioGpuDxe: implement EFI_GRAPHICS_OUTPUT_PROTOCOL
[mirror_edk2.git] / OvmfPkg / VirtioGpuDxe / DriverBinding.c
index bdea55ef7dbf4b69edc38968a32a77154c8b26ec..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