[edk2-devel] [edk2-platforms Patch 3/3] OptionRomPkg: Remove all UGA support

Ni, Ray ray.ni at intel.com
Fri Mar 11 07:29:29 UTC 2022


Can you avoid changing the spaces?

-----Original Message-----
From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Guomin Jiang
Sent: Friday, March 11, 2022 9:01 AM
To: devel at edk2.groups.io
Cc: Ni, Ray <ray.ni at intel.com>
Subject: [edk2-devel] [edk2-platforms Patch 3/3] OptionRomPkg: Remove all UGA support

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368

Remove all UGA support

Cc: Ray Ni <ray.ni at intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang at intel.com>
---
 .../CirrusLogic5430Dxe/CirrusLogic5430.c      | 522 +++++++-----------
 .../CirrusLogic5430Dxe/CirrusLogic5430.h      | 136 ++---
 .../CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf |   9 +-
 .../CirrusLogic5430UgaDraw.c                  | 412 --------------
 Drivers/OptionRomPkg/OptionRomPkg.dec         |   3 -
 5 files changed, 271 insertions(+), 811 deletions(-)
 delete mode 100644 Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c

diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
index 4e7830ea94b3..a2f2c2ff60f4 100644
--- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
+++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
@@ -11,7 +11,7 @@
   documentation on UGA for details on how to write a UGA driver that is able
   to function both in the EFI pre-boot environment and from the OS runtime.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -21,7 +21,7 @@
 //
 #include "CirrusLogic5430.h"
 
-EFI_DRIVER_BINDING_PROTOCOL gCirrusLogic5430DriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL  gCirrusLogic5430DriverBinding = {
   CirrusLogic5430ControllerDriverSupported,
   CirrusLogic5430ControllerDriverStart,
   CirrusLogic5430ControllerDriverStop,
@@ -42,21 +42,21 @@ UINT8  AttributeController[21] = {
 ///
 /// Generic Graphics Controller Register Settings
 ///
-UINT8 GraphicsController[9] = {
+UINT8  GraphicsController[9] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, 0xFF
 };
 
 //
 // 640 x 480 x 256 color @ 60 Hertz
 //
-UINT8 Crtc_640_480_256_60[28] = {
+UINT8  Crtc_640_480_256_60[28] = {
   0x5d, 0x4f, 0x50, 0x82, 0x53, 0x9f, 0x00, 0x3e,
   0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0xe1, 0x83, 0xdf, 0x50, 0x00, 0xe7, 0x04, 0xe3,
   0xff, 0x00, 0x00, 0x22
 };
 
-UINT16 Seq_640_480_256_60[15] = {
+UINT16  Seq_640_480_256_60[15] = {
   0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
   0x5b0c, 0x450d, 0x7e0e, 0x2b1b, 0x2f1c, 0x301d, 0x331e
 };
@@ -64,14 +64,14 @@ UINT16 Seq_640_480_256_60[15] = {
 //
 // 800 x 600 x 256 color @ 60 Hertz
 //
-UINT8 Crtc_800_600_256_60[28] = {
+UINT8  Crtc_800_600_256_60[28] = {
   0x7F, 0x63, 0x64, 0x80, 0x6B, 0x1B, 0x72, 0xF0,
   0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x58, 0x8C, 0x57, 0x64, 0x00, 0x5F, 0x91, 0xE3,
   0xFF, 0x00, 0x00, 0x22
 };
 
-UINT16 Seq_800_600_256_60[15] = {
+UINT16  Seq_800_600_256_60[15] = {
   0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
   0x5b0c, 0x450d, 0x510e, 0x2b1b, 0x2f1c, 0x301d, 0x3a1e
 };
@@ -79,14 +79,14 @@ UINT16 Seq_800_600_256_60[15] = {
 //
 // 1024 x 768 x 256 color @ 60 Hertz
 //
-UINT8 Crtc_1024_768_256_60[28] = {
+UINT8  Crtc_1024_768_256_60[28] = {
   0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xFD,
   0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x02, 0x88, 0xFF, 0x80, 0x00, 0x00, 0x24, 0xE3,
   0xFF, 0x4A, 0x00, 0x22
 };
 
-UINT16 Seq_1024_768_256_60[15] = {
+UINT16  Seq_1024_768_256_60[15] = {
   0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
   0x5b0c, 0x450d, 0x760e, 0x2b1b, 0x2f1c, 0x301d, 0x341e
 };
@@ -95,12 +95,11 @@ UINT16 Seq_1024_768_256_60[15] = {
 /// Table of supported video modes
 ///
 CIRRUS_LOGIC_5430_VIDEO_MODES  CirrusLogic5430VideoModes[] = {
-  {  640, 480, 8, 60, Crtc_640_480_256_60,  Seq_640_480_256_60,  0xe3 },
-  {  800, 600, 8, 60, Crtc_800_600_256_60,  Seq_800_600_256_60,  0xef },
+  { 640,  480, 8, 60, Crtc_640_480_256_60,  Seq_640_480_256_60,  0xe3 },
+  { 800,  600, 8, 60, Crtc_800_600_256_60,  Seq_800_600_256_60,  0xef },
   { 1024, 768, 8, 60, Crtc_1024_768_256_60, Seq_1024_768_256_60, 0xef }
 };
 
-
 /**
   CirrusLogic5430ControllerDriverSupported
 
@@ -111,15 +110,15 @@ CIRRUS_LOGIC_5430_VIDEO_MODES  CirrusLogic5430VideoModes[] = {
 EFI_STATUS
 EFIAPI
 CirrusLogic5430ControllerDriverSupported (
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,
-  IN EFI_HANDLE                     Controller,
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
+  IN EFI_HANDLE                   Controller,
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
   )
 {
-  EFI_STATUS          Status;
-  EFI_PCI_IO_PROTOCOL *PciIo;
-  PCI_TYPE00          Pci;
-  EFI_DEV_PATH        *Node;
+  EFI_STATUS           Status;
+  EFI_PCI_IO_PROTOCOL  *PciIo;
+  PCI_TYPE00           Pci;
+  EFI_DEV_PATH         *Node;
 
   //
   // Open the PCI I/O Protocol
@@ -127,7 +126,7 @@ CirrusLogic5430ControllerDriverSupported (
   Status = gBS->OpenProtocol (
                   Controller,
                   &gEfiPciIoProtocolGuid,
-                  (VOID **) &PciIo,
+                  (VOID **)&PciIo,
                   This->DriverBindingHandle,
                   Controller,
                   EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -163,19 +162,19 @@ CirrusLogic5430ControllerDriverSupported (
     //
     // See if this is a 5430 or a 5446 PCI controller
     //
-    if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_DEVICE_ID || 
-        Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID ||
-        Pci.Hdr.DeviceId == CIRRUS_LOGIC_5446_DEVICE_ID) {
-        
+    if ((Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_DEVICE_ID) ||
+        (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID) ||
+        (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5446_DEVICE_ID))
+    {
       Status = EFI_SUCCESS;
       //
       // If this is an Intel 945 graphics controller,
       // go further check RemainingDevicePath validation
       //
       if (RemainingDevicePath != NULL) {
-        Node = (EFI_DEV_PATH *) RemainingDevicePath;
+        Node = (EFI_DEV_PATH *)RemainingDevicePath;
         //
-        // Check if RemainingDevicePath is the End of Device Path Node, 
+        // Check if RemainingDevicePath is the End of Device Path Node,
         // if yes, return EFI_SUCCESS
         //
         if (!IsDevicePathEnd (Node)) {
@@ -183,9 +182,10 @@ CirrusLogic5430ControllerDriverSupported (
           // If RemainingDevicePath isn't the End of Device Path Node,
           // check its validation
           //
-          if (Node->DevPath.Type != ACPI_DEVICE_PATH ||
-              Node->DevPath.SubType != ACPI_ADR_DP ||
-              DevicePathNodeLength(&Node->DevPath) != sizeof(ACPI_ADR_DEVICE_PATH)) {
+          if ((Node->DevPath.Type != ACPI_DEVICE_PATH) ||
+              (Node->DevPath.SubType != ACPI_ADR_DP) ||
+              (DevicePathNodeLength (&Node->DevPath) != sizeof (ACPI_ADR_DEVICE_PATH)))
+          {
             Status = EFI_UNSUPPORTED;
           }
         }
@@ -198,11 +198,11 @@ Done:
   // Close the PCI I/O Protocol
   //
   gBS->CloseProtocol (
-        Controller,
-        &gEfiPciIoProtocolGuid,
-        This->DriverBindingHandle,
-        Controller
-        );
+         Controller,
+         &gEfiPciIoProtocolGuid,
+         This->DriverBindingHandle,
+         Controller
+         );
 
   return Status;
 }
@@ -217,9 +217,9 @@ Done:
 EFI_STATUS
 EFIAPI
 CirrusLogic5430ControllerDriverStart (
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,
-  IN EFI_HANDLE                     Controller,
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
+  IN EFI_HANDLE                   Controller,
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
   )
 {
   EFI_STATUS                      Status;
@@ -242,8 +242,8 @@ CirrusLogic5430ControllerDriverStart (
   //
   // Set up context record
   //
-  Private->Signature  = CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE;
-  Private->Handle     = NULL;
+  Private->Signature = CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE;
+  Private->Handle    = NULL;
 
   //
   // Open PCI I/O Protocol
@@ -251,7 +251,7 @@ CirrusLogic5430ControllerDriverStart (
   Status = gBS->OpenProtocol (
                   Controller,
                   &gEfiPciIoProtocolGuid,
-                  (VOID **) &Private->PciIo,
+                  (VOID **)&Private->PciIo,
                   This->DriverBindingHandle,
                   Controller,
                   EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -274,24 +274,25 @@ CirrusLogic5430ControllerDriverStart (
   }
 
   Supports &= (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16);
-  if (Supports == 0 || Supports == (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) {
+  if ((Supports == 0) || (Supports == (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16))) {
     Status = EFI_UNSUPPORTED;
     goto Error;
-  }  
+  }
 
   //
   // Save original PCI attributes
   //
   Status = Private->PciIo->Attributes (
-                    Private->PciIo,
-                    EfiPciIoAttributeOperationGet,
-                    0,
-                    &Private->OriginalPciAttributes
-                    );
+                             Private->PciIo,
+                             EfiPciIoAttributeOperationGet,
+                             0,
+                             &Private->OriginalPciAttributes
+                             );
 
   if (EFI_ERROR (Status)) {
     goto Error;
   }
+
   PciAttributesSaved = TRUE;
 
   Status = Private->PciIo->Attributes (
@@ -310,53 +311,51 @@ CirrusLogic5430ControllerDriverStart (
   Status = gBS->HandleProtocol (
                   Controller,
                   &gEfiDevicePathProtocolGuid,
-                  (VOID **) &ParentDevicePath
+                  (VOID **)&ParentDevicePath
                   );
   if (EFI_ERROR (Status)) {
     goto Error;
   }
 
-  if (FeaturePcdGet (PcdSupportGop)) {
+  //
+  // Set Gop Device Path
+  //
+  if (RemainingDevicePath == NULL) {
+    ZeroMem (&AcpiDeviceNode, sizeof (ACPI_ADR_DEVICE_PATH));
+    AcpiDeviceNode.Header.Type    = ACPI_DEVICE_PATH;
+    AcpiDeviceNode.Header.SubType = ACPI_ADR_DP;
+    AcpiDeviceNode.ADR            = ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0);
+    SetDevicePathNodeLength (&AcpiDeviceNode.Header, sizeof (ACPI_ADR_DEVICE_PATH));
+
+    Private->GopDevicePath = AppendDevicePathNode (
+                               ParentDevicePath,
+                               (EFI_DEVICE_PATH_PROTOCOL *)&AcpiDeviceNode
+                               );
+  } else if (!IsDevicePathEnd (RemainingDevicePath)) {
+    //
+    // If RemainingDevicePath isn't the End of Device Path Node,
+    // only scan the specified device by RemainingDevicePath
+    //
+    Private->GopDevicePath = AppendDevicePathNode (ParentDevicePath, RemainingDevicePath);
+  } else {
     //
-    // Set Gop Device Path
+    // If RemainingDevicePath is the End of Device Path Node,
+    // don't create child device and return EFI_SUCCESS
     //
-    if (RemainingDevicePath == NULL) {
-      ZeroMem (&AcpiDeviceNode, sizeof (ACPI_ADR_DEVICE_PATH));
-      AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH;
-      AcpiDeviceNode.Header.SubType = ACPI_ADR_DP;
-      AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0);
-      SetDevicePathNodeLength (&AcpiDeviceNode.Header, sizeof (ACPI_ADR_DEVICE_PATH));
+    Private->GopDevicePath = NULL;
+  }
 
-      Private->GopDevicePath = AppendDevicePathNode (
-                                          ParentDevicePath,
-                                          (EFI_DEVICE_PATH_PROTOCOL *) &AcpiDeviceNode
-                                          );
-    } else if (!IsDevicePathEnd (RemainingDevicePath)) {
-      //
-      // If RemainingDevicePath isn't the End of Device Path Node, 
-      // only scan the specified device by RemainingDevicePath
-      //
-      Private->GopDevicePath = AppendDevicePathNode (ParentDevicePath, RemainingDevicePath);
-    } else {
-      //
-      // If RemainingDevicePath is the End of Device Path Node, 
-      // don't create child device and return EFI_SUCCESS
-      //
-      Private->GopDevicePath = NULL;
-    }
-      
-    if (Private->GopDevicePath != NULL) {
-      //
-      // Creat child handle and device path protocol firstly
-      //
-      Private->Handle = NULL;
-      Status = gBS->InstallMultipleProtocolInterfaces (
-                      &Private->Handle,
-                      &gEfiDevicePathProtocolGuid,
-                      Private->GopDevicePath,
-                      NULL
-                      );
-    }
+  if (Private->GopDevicePath != NULL) {
+    //
+    // Creat child handle and device path protocol firstly
+    //
+    Private->Handle = NULL;
+    Status          = gBS->InstallMultipleProtocolInterfaces (
+                             &Private->Handle,
+                             &gEfiDevicePathProtocolGuid,
+                             Private->GopDevicePath,
+                             NULL
+                             );
   }
 
   //
@@ -367,57 +366,22 @@ CirrusLogic5430ControllerDriverStart (
     goto Error;
   }
 
-  if (FeaturePcdGet (PcdSupportUga)) {
-    //
-    // Start the UGA Draw software stack.
-    //
-    Status = CirrusLogic5430UgaDrawConstructor (Private);
-    ASSERT_EFI_ERROR (Status);
-
-    Private->UgaDevicePath = ParentDevicePath;
-    Status = gBS->InstallMultipleProtocolInterfaces (
-                    &Controller,
-                    &gEfiUgaDrawProtocolGuid,
-                    &Private->UgaDraw,
-                    &gEfiDevicePathProtocolGuid,
-                    Private->UgaDevicePath,
-                    NULL
-                    );
-
-  } else if (FeaturePcdGet (PcdSupportGop)) {
-    if (Private->GopDevicePath == NULL) {
-      //
-      // If RemainingDevicePath is the End of Device Path Node, 
-      // don't create child device and return EFI_SUCCESS
-      //
-      Status = EFI_SUCCESS;
-    } else {
-  
-      //
-      // Start the GOP software stack.
-      //
-      Status = CirrusLogic5430GraphicsOutputConstructor (Private);
-      ASSERT_EFI_ERROR (Status);
-  
-      Status = gBS->InstallMultipleProtocolInterfaces (
-                      &Private->Handle,
-                      &gEfiGraphicsOutputProtocolGuid,
-                      &Private->GraphicsOutput,
-                      &gEfiEdidDiscoveredProtocolGuid,
-                      &Private->EdidDiscovered,
-                      &gEfiEdidActiveProtocolGuid,
-                      &Private->EdidActive,
-                      NULL
-                      );
-    }
-  } else {
-    //
-    // This driver must support eithor GOP or UGA or both.
-    //
-    ASSERT (FALSE);
-    Status = EFI_UNSUPPORTED;
-  }
+  //
+  // Start the GOP software stack.
+  //
+  Status = CirrusLogic5430GraphicsOutputConstructor (Private);
+  ASSERT_EFI_ERROR (Status);
 
+  Status = gBS->InstallMultipleProtocolInterfaces (
+                  &Private->Handle,
+                  &gEfiGraphicsOutputProtocolGuid,
+                  &Private->GraphicsOutput,
+                  &gEfiEdidDiscoveredProtocolGuid,
+                  &Private->EdidDiscovered,
+                  &gEfiEdidActiveProtocolGuid,
+                  &Private->EdidActive,
+                  NULL
+                  );
 
 Error:
   if (EFI_ERROR (Status)) {
@@ -428,21 +392,22 @@ Error:
           // Restore original PCI attributes
           //
           Private->PciIo->Attributes (
-                          Private->PciIo,
-                          EfiPciIoAttributeOperationSet,
-                          Private->OriginalPciAttributes,
-                          NULL
-                          );
+                            Private->PciIo,
+                            EfiPciIoAttributeOperationSet,
+                            Private->OriginalPciAttributes,
+                            NULL
+                            );
         }
+
         //
         // Close the PCI I/O Protocol
         //
         gBS->CloseProtocol (
-              Private->Handle,
-              &gEfiPciIoProtocolGuid,
-              This->DriverBindingHandle,
-              Private->Handle
-              );
+               Private->Handle,
+               &gEfiPciIoProtocolGuid,
+               This->DriverBindingHandle,
+               Private->Handle
+               );
       }
 
       gBS->FreePool (Private);
@@ -464,92 +429,45 @@ Error:
 EFI_STATUS
 EFIAPI
 CirrusLogic5430ControllerDriverStop (
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,
-  IN EFI_HANDLE                     Controller,
-  IN UINTN                          NumberOfChildren,
-  IN EFI_HANDLE                     *ChildHandleBuffer
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
+  IN EFI_HANDLE                   Controller,
+  IN UINTN                        NumberOfChildren,
+  IN EFI_HANDLE                   *ChildHandleBuffer
   )
 {
-  EFI_UGA_DRAW_PROTOCOL           *UgaDraw;
-  EFI_GRAPHICS_OUTPUT_PROTOCOL    *GraphicsOutput;
+  EFI_GRAPHICS_OUTPUT_PROTOCOL  *GraphicsOutput;
 
   EFI_STATUS                      Status;
   CIRRUS_LOGIC_5430_PRIVATE_DATA  *Private;
 
-  if (FeaturePcdGet (PcdSupportUga)) {
-    Status = gBS->OpenProtocol (
-                    Controller,
-                    &gEfiUgaDrawProtocolGuid,
-                    (VOID **) &UgaDraw,
-                    This->DriverBindingHandle,
-                    Controller,
-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL
-                    );
-    if (EFI_ERROR (Status)) {
-      return Status;
-    }
-    //
-    // Get our private context information
-    //
-    Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (UgaDraw);
-    CirrusLogic5430UgaDrawDestructor (Private);
-
-    if (FeaturePcdGet (PcdSupportGop)) {
-      CirrusLogic5430GraphicsOutputDestructor (Private);
-      //
-      // Remove the UGA and GOP protocol interface from the system
-      //
-      Status = gBS->UninstallMultipleProtocolInterfaces (
-                      Private->Handle,
-                      &gEfiUgaDrawProtocolGuid,
-                      &Private->UgaDraw,
-                      &gEfiGraphicsOutputProtocolGuid,
-                      &Private->GraphicsOutput,
-                      NULL
-                      );
-    } else {
-      //
-      // Remove the UGA Draw interface from the system
-      //
-      Status = gBS->UninstallMultipleProtocolInterfaces (
-                      Private->Handle,
-                      &gEfiUgaDrawProtocolGuid,
-                      &Private->UgaDraw,
-                      NULL
-                      );
-    }
-  } else {
-    Status = gBS->OpenProtocol (
-                    Controller,
-                    &gEfiGraphicsOutputProtocolGuid,
-                    (VOID **) &GraphicsOutput,
-                    This->DriverBindingHandle,
-                    Controller,
-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL
-                    );
-    if (EFI_ERROR (Status)) {
-      return Status;
-    }
-
-    //
-    // Get our private context information
-    //
-    Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (GraphicsOutput);
-
-    CirrusLogic5430GraphicsOutputDestructor (Private);
-    //
-    // Remove the GOP protocol interface from the system
-    //
-    Status = gBS->UninstallMultipleProtocolInterfaces (
-                    Private->Handle,
-                    &gEfiUgaDrawProtocolGuid,
-                    &Private->UgaDraw,
-                    &gEfiGraphicsOutputProtocolGuid,
-                    &Private->GraphicsOutput,
-                    NULL
-                    );
+  Status = gBS->OpenProtocol (
+                  Controller,
+                  &gEfiGraphicsOutputProtocolGuid,
+                  (VOID **)&GraphicsOutput,
+                  This->DriverBindingHandle,
+                  Controller,
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                  );
+  if (EFI_ERROR (Status)) {
+    return Status;
   }
 
+  //
+  // Get our private context information
+  //
+  Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (GraphicsOutput);
+
+  CirrusLogic5430GraphicsOutputDestructor (Private);
+  //
+  // Remove the GOP protocol interface from the system
+  //
+  Status = gBS->UninstallMultipleProtocolInterfaces (
+                  Private->Handle,
+                  &gEfiGraphicsOutputProtocolGuid,
+                  &Private->GraphicsOutput,
+                  NULL
+                  );
+
   if (EFI_ERROR (Status)) {
     return Status;
   }
@@ -558,21 +476,21 @@ CirrusLogic5430ControllerDriverStop (
   // Restore original PCI attributes
   //
   Private->PciIo->Attributes (
-                  Private->PciIo,
-                  EfiPciIoAttributeOperationSet,
-                  Private->OriginalPciAttributes,
-                  NULL
-                  );
+                    Private->PciIo,
+                    EfiPciIoAttributeOperationSet,
+                    Private->OriginalPciAttributes,
+                    NULL
+                    );
 
   //
   // Close the PCI I/O Protocol
   //
   gBS->CloseProtocol (
-        Controller,
-        &gEfiPciIoProtocolGuid,
-        This->DriverBindingHandle,
-        Controller
-        );
+         Controller,
+         &gEfiPciIoProtocolGuid,
+         This->DriverBindingHandle,
+         Controller
+         );
 
   //
   // Free our instance data
@@ -582,20 +500,6 @@ CirrusLogic5430ControllerDriverStop (
   return EFI_SUCCESS;
 }
 
-/**
-  CirrusLogic5430UgaDrawDestructor
-
-  TODO:    Private - add argument and description to function comment
-  TODO:    EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-CirrusLogic5430UgaDrawDestructor (
-  CIRRUS_LOGIC_5430_PRIVATE_DATA  *Private
-  )
-{
-  return EFI_SUCCESS;
-}
-
 /**
   TODO: Add function description
 
@@ -614,13 +518,13 @@ outb (
   )
 {
   Private->PciIo->Io.Write (
-                      Private->PciIo,
-                      EfiPciIoWidthUint8,
-                      EFI_PCI_IO_PASS_THROUGH_BAR,
-                      Address,
-                      1,
-                      &Data
-                      );
+                       Private->PciIo,
+                       EfiPciIoWidthUint8,
+                       EFI_PCI_IO_PASS_THROUGH_BAR,
+                       Address,
+                       1,
+                       &Data
+                       );
 }
 
 /**
@@ -641,13 +545,13 @@ outw (
   )
 {
   Private->PciIo->Io.Write (
-                      Private->PciIo,
-                      EfiPciIoWidthUint16,
-                      EFI_PCI_IO_PASS_THROUGH_BAR,
-                      Address,
-                      1,
-                      &Data
-                      );
+                       Private->PciIo,
+                       EfiPciIoWidthUint16,
+                       EFI_PCI_IO_PASS_THROUGH_BAR,
+                       Address,
+                       1,
+                       &Data
+                       );
 }
 
 /**
@@ -665,16 +569,16 @@ inb (
   UINTN                           Address
   )
 {
-  UINT8 Data;
+  UINT8  Data;
 
   Private->PciIo->Io.Read (
-                      Private->PciIo,
-                      EfiPciIoWidthUint8,
-                      EFI_PCI_IO_PASS_THROUGH_BAR,
-                      Address,
-                      1,
-                      &Data
-                      );
+                       Private->PciIo,
+                       EfiPciIoWidthUint8,
+                       EFI_PCI_IO_PASS_THROUGH_BAR,
+                       Address,
+                       1,
+                       &Data
+                       );
   return Data;
 }
 
@@ -696,13 +600,13 @@ inw (
   UINT16  Data;
 
   Private->PciIo->Io.Read (
-                      Private->PciIo,
-                      EfiPciIoWidthUint16,
-                      EFI_PCI_IO_PASS_THROUGH_BAR,
-                      Address,
-                      1,
-                      &Data
-                      );
+                       Private->PciIo,
+                       EfiPciIoWidthUint16,
+                       EFI_PCI_IO_PASS_THROUGH_BAR,
+                       Address,
+                       1,
+                       &Data
+                       );
   return Data;
 }
 
@@ -727,10 +631,10 @@ SetPaletteColor (
   UINT8                           Blue
   )
 {
-  outb (Private, PALETTE_INDEX_REGISTER, (UINT8) Index);
-  outb (Private, PALETTE_DATA_REGISTER, (UINT8) (Red >> 2));
-  outb (Private, PALETTE_DATA_REGISTER, (UINT8) (Green >> 2));
-  outb (Private, PALETTE_DATA_REGISTER, (UINT8) (Blue >> 2));
+  outb (Private, PALETTE_INDEX_REGISTER, (UINT8)Index);
+  outb (Private, PALETTE_DATA_REGISTER, (UINT8)(Red >> 2));
+  outb (Private, PALETTE_DATA_REGISTER, (UINT8)(Green >> 2));
+  outb (Private, PALETTE_DATA_REGISTER, (UINT8)(Blue >> 2));
 }
 
 /**
@@ -746,16 +650,16 @@ SetDefaultPalette (
   CIRRUS_LOGIC_5430_PRIVATE_DATA  *Private
   )
 {
-  UINTN Index;
-  UINTN RedIndex;
-  UINTN GreenIndex;
-  UINTN BlueIndex;
+  UINTN  Index;
+  UINTN  RedIndex;
+  UINTN  GreenIndex;
+  UINTN  BlueIndex;
 
   Index = 0;
   for (RedIndex = 0; RedIndex < 8; RedIndex++) {
     for (GreenIndex = 0; GreenIndex < 8; GreenIndex++) {
       for (BlueIndex = 0; BlueIndex < 4; BlueIndex++) {
-        SetPaletteColor (Private, Index, (UINT8) (RedIndex << 5), (UINT8) (GreenIndex << 5), (UINT8) (BlueIndex << 6));
+        SetPaletteColor (Private, Index, (UINT8)(RedIndex << 5), (UINT8)(GreenIndex << 5), (UINT8)(BlueIndex << 6));
         Index++;
       }
     }
@@ -820,18 +724,18 @@ InitializeGraphicsMode (
   CIRRUS_LOGIC_5430_VIDEO_MODES   *ModeData
   )
 {
-  UINT8 Byte;
-  UINTN Index;
-  UINT16 DeviceId;
-  EFI_STATUS Status;
+  UINT8       Byte;
+  UINTN       Index;
+  UINT16      DeviceId;
+  EFI_STATUS  Status;
 
   Status = Private->PciIo->Pci.Read (
-             Private->PciIo,
-             EfiPciIoWidthUint16,
-             PCI_DEVICE_ID_OFFSET,
-             1,
-             &DeviceId
-             );
+                                 Private->PciIo,
+                                 EfiPciIoWidthUint16,
+                                 PCI_DEVICE_ID_OFFSET,
+                                 1,
+                                 &DeviceId
+                                 );
   //
   // Read the PCI Configuration Header from the PCI Device
   //
@@ -846,7 +750,7 @@ InitializeGraphicsMode (
 
   if (DeviceId != CIRRUS_LOGIC_5446_DEVICE_ID) {
     outb (Private, SEQ_ADDRESS_REGISTER, 0x0f);
-    Byte = (UINT8) ((inb (Private, SEQ_DATA_REGISTER) & 0xc7) ^ 0x30);
+    Byte = (UINT8)((inb (Private, SEQ_DATA_REGISTER) & 0xc7) ^ 0x30);
     outb (Private, SEQ_DATA_REGISTER, Byte);
   }
 
@@ -856,17 +760,17 @@ InitializeGraphicsMode (
   outw (Private, CRTC_ADDRESS_REGISTER, 0x2011);
 
   for (Index = 0; Index < 28; Index++) {
-    outw (Private, CRTC_ADDRESS_REGISTER, (UINT16) ((ModeData->CrtcSettings[Index] << 8) | Index));
+    outw (Private, CRTC_ADDRESS_REGISTER, (UINT16)((ModeData->CrtcSettings[Index] << 8) | Index));
   }
 
   for (Index = 0; Index < 9; Index++) {
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((GraphicsController[Index] << 8) | Index));
+    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16)((GraphicsController[Index] << 8) | Index));
   }
 
   inb (Private, INPUT_STATUS_1_REGISTER);
 
   for (Index = 0; Index < 21; Index++) {
-    outb (Private, ATT_ADDRESS_REGISTER, (UINT8) Index);
+    outb (Private, ATT_ADDRESS_REGISTER, (UINT8)Index);
     outb (Private, ATT_ADDRESS_REGISTER, AttributeController[Index]);
   }
 
@@ -884,11 +788,11 @@ InitializeGraphicsMode (
 EFI_STATUS
 EFIAPI
 InitializeCirrusLogic5430 (
-  IN EFI_HANDLE           ImageHandle,
-  IN EFI_SYSTEM_TABLE     *SystemTable
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
-  EFI_STATUS              Status;
+  EFI_STATUS  Status;
 
   Status = EfiLibInstallDriverBindingComponentName2 (
              ImageHandle,
@@ -905,12 +809,12 @@ InitializeCirrusLogic5430 (
   // EFI drivers that are on PCI and other plug in cards.
   //
   gCirrusLogic5430DriverSupportedEfiVersion.FirmwareVersion = PcdGet32 (PcdDriverSupportedEfiVersion);
-  Status = gBS->InstallMultipleProtocolInterfaces (
-                  &ImageHandle,
-                  &gEfiDriverSupportedEfiVersionProtocolGuid,
-                  &gCirrusLogic5430DriverSupportedEfiVersion,
-                  NULL
-                  );
+  Status                                                    = gBS->InstallMultipleProtocolInterfaces (
+                                                                     &ImageHandle,
+                                                                     &gEfiDriverSupportedEfiVersionProtocolGuid,
+                                                                     &gCirrusLogic5430DriverSupportedEfiVersion,
+                                                                     NULL
+                                                                     );
   ASSERT_EFI_ERROR (Status);
 
   return Status;
diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h
index 355f0418b3b5..13ecc72caa31 100644
--- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h
+++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h
@@ -1,7 +1,7 @@
 /** @file
   Cirrus Logic 5430 Controller Driver
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -13,9 +13,7 @@
 #ifndef _CIRRUS_LOGIC_5430_H_
 #define _CIRRUS_LOGIC_5430_H_
 
-
 #include <Uefi.h>
-#include <Protocol/UgaDraw.h>
 #include <Protocol/GraphicsOutput.h>
 #include <Protocol/PciIo.h>
 #include <Protocol/DriverSupportedEfiVersion.h>
@@ -38,36 +36,36 @@
 //
 // Cirrus Logic 5430 PCI Configuration Header values
 //
-#define CIRRUS_LOGIC_VENDOR_ID                0x1013
-#define CIRRUS_LOGIC_5430_DEVICE_ID           0x00a8
-#define CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID 0x00a0
-#define CIRRUS_LOGIC_5446_DEVICE_ID           0x00b8
+#define CIRRUS_LOGIC_VENDOR_ID                 0x1013
+#define CIRRUS_LOGIC_5430_DEVICE_ID            0x00a8
+#define CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID  0x00a0
+#define CIRRUS_LOGIC_5446_DEVICE_ID            0x00b8
 
 //
 // Cirrus Logic Graphical Mode Data
 //
-#define CIRRUS_LOGIC_5430_MODE_COUNT         3
+#define CIRRUS_LOGIC_5430_MODE_COUNT  3
 
 typedef struct {
-  UINT32  ModeNumber;
-  UINT32  HorizontalResolution;
-  UINT32  VerticalResolution;
-  UINT32  ColorDepth;
-  UINT32  RefreshRate;
+  UINT32    ModeNumber;
+  UINT32    HorizontalResolution;
+  UINT32    VerticalResolution;
+  UINT32    ColorDepth;
+  UINT32    RefreshRate;
 } CIRRUS_LOGIC_5430_MODE_DATA;
 
-#define PIXEL_RED_SHIFT   0
-#define PIXEL_GREEN_SHIFT 3
-#define PIXEL_BLUE_SHIFT  6
+#define PIXEL_RED_SHIFT    0
+#define PIXEL_GREEN_SHIFT  3
+#define PIXEL_BLUE_SHIFT   6
 
 #define PIXEL_RED_MASK    (BIT7 | BIT6 | BIT5)
 #define PIXEL_GREEN_MASK  (BIT4 | BIT3 | BIT2)
 #define PIXEL_BLUE_MASK   (BIT1 | BIT0)
 
-#define PIXEL_TO_COLOR_BYTE(pixel, mask, shift) ((UINT8) ((pixel & mask) << shift))
-#define PIXEL_TO_RED_BYTE(pixel) PIXEL_TO_COLOR_BYTE(pixel, PIXEL_RED_MASK, PIXEL_RED_SHIFT)
-#define PIXEL_TO_GREEN_BYTE(pixel) PIXEL_TO_COLOR_BYTE(pixel, PIXEL_GREEN_MASK, PIXEL_GREEN_SHIFT)
-#define PIXEL_TO_BLUE_BYTE(pixel) PIXEL_TO_COLOR_BYTE(pixel, PIXEL_BLUE_MASK, PIXEL_BLUE_SHIFT)
+#define PIXEL_TO_COLOR_BYTE(pixel, mask, shift)  ((UINT8) ((pixel & mask) << shift))
+#define PIXEL_TO_RED_BYTE(pixel)                 PIXEL_TO_COLOR_BYTE(pixel, PIXEL_RED_MASK, PIXEL_RED_SHIFT)
+#define PIXEL_TO_GREEN_BYTE(pixel)               PIXEL_TO_COLOR_BYTE(pixel, PIXEL_GREEN_MASK, PIXEL_GREEN_SHIFT)
+#define PIXEL_TO_BLUE_BYTE(pixel)                PIXEL_TO_COLOR_BYTE(pixel, PIXEL_BLUE_MASK, PIXEL_BLUE_SHIFT)
 
 #define RGB_BYTES_TO_PIXEL(Red, Green, Blue) \
   (UINT8) ( (((Red) >> PIXEL_RED_SHIFT) & PIXEL_RED_MASK) | \
@@ -82,43 +80,37 @@ typedef struct {
 #define CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('C', 'L', '5', '4')
 
 typedef struct {
-  UINT64                                Signature;
-  EFI_HANDLE                            Handle;
-  EFI_PCI_IO_PROTOCOL                   *PciIo;
-  UINT64                                OriginalPciAttributes;
-  EFI_UGA_DRAW_PROTOCOL                 UgaDraw;
-  EFI_GRAPHICS_OUTPUT_PROTOCOL          GraphicsOutput;
-  EFI_EDID_DISCOVERED_PROTOCOL          EdidDiscovered;
-  EFI_EDID_ACTIVE_PROTOCOL              EdidActive;
-  EFI_DEVICE_PATH_PROTOCOL              *GopDevicePath;
-  EFI_DEVICE_PATH_PROTOCOL              *UgaDevicePath;
-  UINTN                                 CurrentMode;
-  UINTN                                 MaxMode;
-  CIRRUS_LOGIC_5430_MODE_DATA           ModeData[CIRRUS_LOGIC_5430_MODE_COUNT];
-  UINT8                                 *LineBuffer;
-  BOOLEAN                               HardwareNeedsStarting;
+  UINT64                          Signature;
+  EFI_HANDLE                      Handle;
+  EFI_PCI_IO_PROTOCOL             *PciIo;
+  UINT64                          OriginalPciAttributes;
+  EFI_GRAPHICS_OUTPUT_PROTOCOL    GraphicsOutput;
+  EFI_EDID_DISCOVERED_PROTOCOL    EdidDiscovered;
+  EFI_EDID_ACTIVE_PROTOCOL        EdidActive;
+  EFI_DEVICE_PATH_PROTOCOL        *GopDevicePath;
+  UINTN                           CurrentMode;
+  UINTN                           MaxMode;
+  CIRRUS_LOGIC_5430_MODE_DATA     ModeData[CIRRUS_LOGIC_5430_MODE_COUNT];
+  UINT8                           *LineBuffer;
+  BOOLEAN                         HardwareNeedsStarting;
 } CIRRUS_LOGIC_5430_PRIVATE_DATA;
 
 ///
 /// Video Mode structure
 ///
 typedef struct {
-  UINT32  Width;
-  UINT32  Height;
-  UINT32  ColorDepth;
-  UINT32  RefreshRate;
-  UINT8   *CrtcSettings;
-  UINT16  *SeqSettings;
-  UINT8   MiscSetting;
+  UINT32    Width;
+  UINT32    Height;
+  UINT32    ColorDepth;
+  UINT32    RefreshRate;
+  UINT8     *CrtcSettings;
+  UINT16    *SeqSettings;
+  UINT8     MiscSetting;
 } CIRRUS_LOGIC_5430_VIDEO_MODES;
 
-#define CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS(a) \
-  CR(a, CIRRUS_LOGIC_5430_PRIVATE_DATA, UgaDraw, CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE)
-
 #define CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS(a) \
   CR(a, CIRRUS_LOGIC_5430_PRIVATE_DATA, GraphicsOutput, CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE)
 
-
 //
 // Global Variables
 //
@@ -139,31 +131,18 @@ extern EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL  gCirrusLogic5430DriverSupporte
 //
 // Io Registers defined by VGA
 //
-#define CRTC_ADDRESS_REGISTER   0x3d4
-#define CRTC_DATA_REGISTER      0x3d5
-#define SEQ_ADDRESS_REGISTER    0x3c4
-#define SEQ_DATA_REGISTER       0x3c5
-#define GRAPH_ADDRESS_REGISTER  0x3ce
-#define GRAPH_DATA_REGISTER     0x3cf
-#define ATT_ADDRESS_REGISTER    0x3c0
-#define MISC_OUTPUT_REGISTER    0x3c2
-#define INPUT_STATUS_1_REGISTER 0x3da
-#define DAC_PIXEL_MASK_REGISTER 0x3c6
-#define PALETTE_INDEX_REGISTER  0x3c8
-#define PALETTE_DATA_REGISTER   0x3c9
-
-//
-// UGA Draw Hardware abstraction internal worker functions
-//
-EFI_STATUS
-CirrusLogic5430UgaDrawConstructor (
-  CIRRUS_LOGIC_5430_PRIVATE_DATA  *Private
-  );
-
-EFI_STATUS
-CirrusLogic5430UgaDrawDestructor (
-  CIRRUS_LOGIC_5430_PRIVATE_DATA  *Private
-  );
+#define CRTC_ADDRESS_REGISTER    0x3d4
+#define CRTC_DATA_REGISTER       0x3d5
+#define SEQ_ADDRESS_REGISTER     0x3c4
+#define SEQ_DATA_REGISTER        0x3c5
+#define GRAPH_ADDRESS_REGISTER   0x3ce
+#define GRAPH_DATA_REGISTER      0x3cf
+#define ATT_ADDRESS_REGISTER     0x3c0
+#define MISC_OUTPUT_REGISTER     0x3c2
+#define INPUT_STATUS_1_REGISTER  0x3da
+#define DAC_PIXEL_MASK_REGISTER  0x3c6
+#define PALETTE_INDEX_REGISTER   0x3c8
+#define PALETTE_DATA_REGISTER    0x3c9
 
 //
 // Graphics Output Hardware abstraction internal worker functions
@@ -178,10 +157,10 @@ CirrusLogic5430GraphicsOutputDestructor (
   CIRRUS_LOGIC_5430_PRIVATE_DATA  *Private
   );
 
-
 //
 // EFI_DRIVER_BINDING_PROTOCOL Protocol Interface
 //
+
 /**
   TODO: Add function description
 
@@ -241,6 +220,7 @@ CirrusLogic5430ControllerDriverStop (
 //
 // EFI Component Name Functions
 //
+
 /**
   Retrieves a Unicode string that is the user readable name of the driver.
 
@@ -288,7 +268,6 @@ CirrusLogic5430ComponentNameGetDriverName (
   OUT CHAR16                       **DriverName
   );
 
-
 /**
   Retrieves a Unicode string that is the user readable name of the controller
   that is being managed by a driver.
@@ -360,14 +339,13 @@ CirrusLogic5430ComponentNameGetDriverName (
 EFI_STATUS
 EFIAPI
 CirrusLogic5430ComponentNameGetControllerName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
-  IN  EFI_HANDLE                                      ControllerHandle,
-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
-  IN  CHAR8                                           *Language,
-  OUT CHAR16                                          **ControllerName
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  EFI_HANDLE                   ControllerHandle,
+  IN  EFI_HANDLE                   ChildHandle        OPTIONAL,
+  IN  CHAR8                        *Language,
+  OUT CHAR16                       **ControllerName
   );
 
-
 //
 // Local Function Prototypes
 //
diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf
index 3e8b7b087f11..359ce486e5ba 100644
--- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf
+++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf
@@ -9,7 +9,7 @@
 #  requires both the UGA Draw and the UGA I/O Protocol. Please refer to Microsoft's
 #  documentation on UGA for details on how to write a UGA driver that is able
 #  to function both in the EFI pre-boot environment and from the OS runtime.
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -43,7 +43,6 @@
 [Sources]
   ComponentName.c
   DriverSupportedEfiVersion.c
-  CirrusLogic5430UgaDraw.c
   CirrusLogic5430GraphicsOutput.c
   CirrusLogic5430.c
   CirrusLogic5430.h
@@ -67,7 +66,6 @@
 
 [Protocols]
   gEfiDriverSupportedEfiVersionProtocolGuid     # PROTOCOL ALWAYS_PRODUCED
-  gEfiUgaDrawProtocolGuid                       # PROTOCOL BY_START
   gEfiGraphicsOutputProtocolGuid                # PROTOCOL BY_START
   gEfiEdidDiscoveredProtocolGuid                # PROTOCOL BY_START
   gEfiEdidActiveProtocolGuid                    # PROTOCOL BY_START
@@ -75,10 +73,5 @@
   gEfiPciIoProtocolGuid                         # PROTOCOL TO_START
   gEfiEdidOverrideProtocolGuid                  # PROTOCOL TO_START
 
-
-[FeaturePcd]
-  gOptionRomPkgTokenSpaceGuid.PcdSupportGop
-  gOptionRomPkgTokenSpaceGuid.PcdSupportUga
-
 [Pcd]
   gOptionRomPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion
diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c
deleted file mode 100644
index bdcbd3450c5f..000000000000
--- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/** @file
-  This file produces the graphics abstration of UGA Draw. It is called by
-  CirrusLogic5430.c file which deals with the EFI 1.1 driver model.
-  This file just does graphics.
-
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "CirrusLogic5430.h"
-
-//
-// UGA Draw Protocol Member Functions
-//
-EFI_STATUS
-EFIAPI
-CirrusLogic5430UgaDrawGetMode (
-  IN  EFI_UGA_DRAW_PROTOCOL *This,
-  OUT UINT32                *HorizontalResolution,
-  OUT UINT32                *VerticalResolution,
-  OUT UINT32                *ColorDepth,
-  OUT UINT32                *RefreshRate
-  )
-{
-  CIRRUS_LOGIC_5430_PRIVATE_DATA  *Private;
-
-  Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This);
-
-  if (Private->HardwareNeedsStarting) {
-    return EFI_NOT_STARTED;
-  }
-
-  if ((HorizontalResolution == NULL) ||
-      (VerticalResolution == NULL)   ||
-      (ColorDepth == NULL)           ||
-      (RefreshRate == NULL)) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  *HorizontalResolution = Private->ModeData[Private->CurrentMode].HorizontalResolution;
-  *VerticalResolution   = Private->ModeData[Private->CurrentMode].VerticalResolution;
-  *ColorDepth           = Private->ModeData[Private->CurrentMode].ColorDepth;
-  *RefreshRate          = Private->ModeData[Private->CurrentMode].RefreshRate;
-
-  return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-CirrusLogic5430UgaDrawSetMode (
-  IN  EFI_UGA_DRAW_PROTOCOL *This,
-  IN  UINT32                HorizontalResolution,
-  IN  UINT32                VerticalResolution,
-  IN  UINT32                ColorDepth,
-  IN  UINT32                RefreshRate
-  )
-{
-  CIRRUS_LOGIC_5430_PRIVATE_DATA  *Private;
-  UINTN                           Index;
-
-  Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This);
-
-  for (Index = 0; Index < Private->MaxMode; Index++) {
-
-    if (HorizontalResolution != Private->ModeData[Index].HorizontalResolution) {
-      continue;
-    }
-
-    if (VerticalResolution != Private->ModeData[Index].VerticalResolution) {
-      continue;
-    }
-
-    if (ColorDepth != Private->ModeData[Index].ColorDepth) {
-      continue;
-    }
-
-    if (RefreshRate != Private->ModeData[Index].RefreshRate) {
-      continue;
-    }
-
-    if (Private->LineBuffer) {
-      gBS->FreePool (Private->LineBuffer);
-    }
-
-    Private->LineBuffer = NULL;
-    Private->LineBuffer = AllocatePool (HorizontalResolution);
-    if (Private->LineBuffer == NULL) {
-      return EFI_OUT_OF_RESOURCES;
-    }
-
-    InitializeGraphicsMode (Private, &CirrusLogic5430VideoModes[Private->ModeData[Index].ModeNumber]);
-
-    Private->CurrentMode            = Index;
-
-    Private->HardwareNeedsStarting  = FALSE;
-
-    return EFI_SUCCESS;
-  }
-
-  return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-EFIAPI
-CirrusLogic5430UgaDrawBlt (
-  IN  EFI_UGA_DRAW_PROTOCOL     *This,
-  IN  EFI_UGA_PIXEL             *BltBuffer, OPTIONAL
-  IN  EFI_UGA_BLT_OPERATION     BltOperation,
-  IN  UINTN                     SourceX,
-  IN  UINTN                     SourceY,
-  IN  UINTN                     DestinationX,
-  IN  UINTN                     DestinationY,
-  IN  UINTN                     Width,
-  IN  UINTN                     Height,
-  IN  UINTN                     Delta
-  )
-{
-  CIRRUS_LOGIC_5430_PRIVATE_DATA  *Private;
-  EFI_TPL                         OriginalTPL;
-  UINTN                           DstY;
-  UINTN                           SrcY;
-  EFI_UGA_PIXEL                   *Blt;
-  UINTN                           X;
-  UINT8                           Pixel;
-  UINT32                          WidePixel;
-  UINTN                           ScreenWidth;
-  UINTN                           Offset;
-  UINTN                           SourceOffset;
-
-  Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This);
-
-  if ((UINT32)BltOperation >= EfiUgaBltMax) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  if (Width == 0 || Height == 0) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  //
-  // If Delta is zero, then the entire BltBuffer is being used, so Delta
-  // is the number of bytes in each row of BltBuffer.  Since BltBuffer is Width pixels size,
-  // the number of bytes in each row can be computed.
-  //
-  if (Delta == 0) {
-    Delta = Width * sizeof (EFI_UGA_PIXEL);
-  }
-
-  //
-  // We need to fill the Virtual Screen buffer with the blt data.
-  // The virtual screen is upside down, as the first row is the bootom row of
-  // the image.
-  //
-
-  //
-  // Make sure the SourceX, SourceY, DestinationX, DestinationY, Width, and Height parameters
-  // are valid for the operation and the current screen geometry.
-  //
-  if (BltOperation == EfiUgaVideoToBltBuffer) {
-    //
-    // Video to BltBuffer: Source is Video, destination is BltBuffer
-    //
-    if (SourceY + Height > Private->ModeData[Private->CurrentMode].VerticalResolution) {
-      return EFI_INVALID_PARAMETER;
-    }
-
-    if (SourceX + Width > Private->ModeData[Private->CurrentMode].HorizontalResolution) {
-      return EFI_INVALID_PARAMETER;
-    }
-  } else {
-    //
-    // BltBuffer to Video: Source is BltBuffer, destination is Video
-    //
-    if (DestinationY + Height > Private->ModeData[Private->CurrentMode].VerticalResolution) {
-      return EFI_INVALID_PARAMETER;
-    }
-
-    if (DestinationX + Width > Private->ModeData[Private->CurrentMode].HorizontalResolution) {
-      return EFI_INVALID_PARAMETER;
-    }
-  }
-  //
-  // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
-  // We would not want a timer based event (Cursor, ...) to come in while we are
-  // doing this operation.
-  //
-  OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
-
-  switch (BltOperation) {
-  case EfiUgaVideoToBltBuffer:
-    //
-    // Video to BltBuffer: Source is Video, destination is BltBuffer
-    //
-    for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) {
-
-      Offset = (SrcY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + SourceX;
-      if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) {
-        Private->PciIo->Mem.Read (
-                              Private->PciIo,
-                              EfiPciIoWidthUint32,
-                              0,
-                              Offset,
-                              Width >> 2,
-                              Private->LineBuffer
-                              );
-      } else {
-        Private->PciIo->Mem.Read (
-                              Private->PciIo,
-                              EfiPciIoWidthUint8,
-                              0,
-                              Offset,
-                              Width,
-                              Private->LineBuffer
-                              );
-      }
-
-      for (X = 0; X < Width; X++) {
-        Blt         = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (DstY * Delta) + (DestinationX + X) * sizeof (EFI_UGA_PIXEL));
-
-        Blt->Red    = (UINT8) (Private->LineBuffer[X] & 0xe0);
-        Blt->Green  = (UINT8) ((Private->LineBuffer[X] & 0x1c) << 3);
-        Blt->Blue   = (UINT8) ((Private->LineBuffer[X] & 0x03) << 6);
-      }
-    }
-    break;
-
-  case EfiUgaVideoToVideo:
-    //
-    // Perform hardware acceleration for Video to Video operations
-    //
-    ScreenWidth   = Private->ModeData[Private->CurrentMode].HorizontalResolution;
-    SourceOffset  = (SourceY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (SourceX);
-    Offset        = (DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (DestinationX);
-
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0000);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0010);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0012);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0014);
-
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0001);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0011);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0013);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0015);
-
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((Width << 8) & 0xff00) | 0x20));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((Width & 0xff00) | 0x21));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((Height << 8) & 0xff00) | 0x22));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((Height & 0xff00) | 0x23));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((ScreenWidth << 8) & 0xff00) | 0x24));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((ScreenWidth & 0xff00) | 0x25));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((ScreenWidth << 8) & 0xff00) | 0x26));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((ScreenWidth & 0xff00) | 0x27));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) << 8) & 0xff00) | 0x28));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) >> 0) & 0xff00) | 0x29));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) >> 8) & 0xff00) | 0x2a));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) << 8) & 0xff00) | 0x2c));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) >> 0) & 0xff00) | 0x2d));
-    outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) >> 8) & 0xff00) | 0x2e));
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x002f);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0030);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0d32);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0033);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0034);
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0035);
-
-    outw (Private, GRAPH_ADDRESS_REGISTER, 0x0231);
-
-    outb (Private, GRAPH_ADDRESS_REGISTER, 0x31);
-    while ((inb (Private, GRAPH_DATA_REGISTER) & 0x01) == 0x01)
-      ;
-    break;
-
-  case EfiUgaVideoFill:
-    Blt       = BltBuffer;
-    Pixel     = (UINT8) ((Blt->Red & 0xe0) | ((Blt->Green >> 3) & 0x1c) | ((Blt->Blue >> 6) & 0x03));
-    WidePixel = (Pixel << 8) | Pixel;
-    WidePixel = (WidePixel << 16) | WidePixel;
-
-    if (DestinationX == 0 && Width == Private->ModeData[Private->CurrentMode].HorizontalResolution) {
-      Offset = DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution;
-      if (((Offset & 0x03) == 0) && (((Width * Height) & 0x03) == 0)) {
-        Private->PciIo->Mem.Write (
-                              Private->PciIo,
-                              EfiPciIoWidthFillUint32,
-                              0,
-                              Offset,
-                              (Width * Height) >> 2,
-                              &WidePixel
-                              );
-      } else {
-        Private->PciIo->Mem.Write (
-                              Private->PciIo,
-                              EfiPciIoWidthFillUint8,
-                              0,
-                              Offset,
-                              Width * Height,
-                              &Pixel
-                              );
-      }
-    } else {
-      for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) {
-        Offset = (DstY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + DestinationX;
-        if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) {
-          Private->PciIo->Mem.Write (
-                                Private->PciIo,
-                                EfiPciIoWidthFillUint32,
-                                0,
-                                Offset,
-                                Width >> 2,
-                                &WidePixel
-                                );
-        } else {
-          Private->PciIo->Mem.Write (
-                                Private->PciIo,
-                                EfiPciIoWidthFillUint8,
-                                0,
-                                Offset,
-                                Width,
-                                &Pixel
-                                );
-        }
-      }
-    }
-    break;
-
-  case EfiUgaBltBufferToVideo:
-    for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) {
-
-      for (X = 0; X < Width; X++) {
-        Blt                     = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (SrcY * Delta) + (SourceX + X) * sizeof (EFI_UGA_PIXEL));
-        Private->LineBuffer[X]  = (UINT8) ((Blt->Red & 0xe0) | ((Blt->Green >> 3) & 0x1c) | ((Blt->Blue >> 6) & 0x03));
-      }
-
-      Offset = (DstY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + DestinationX;
-
-      if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) {
-        Private->PciIo->Mem.Write (
-                              Private->PciIo,
-                              EfiPciIoWidthUint32,
-                              0,
-                              Offset,
-                              Width >> 2,
-                              Private->LineBuffer
-                              );
-      } else {
-        Private->PciIo->Mem.Write (
-                              Private->PciIo,
-                              EfiPciIoWidthUint8,
-                              0,
-                              Offset,
-                              Width,
-                              Private->LineBuffer
-                              );
-      }
-    }
-    break;
-
-  default:
-    break;
-  }
-
-  gBS->RestoreTPL (OriginalTPL);
-
-  return EFI_SUCCESS;
-}
-
-//
-// Construction and Destruction functions
-//
-EFI_STATUS
-CirrusLogic5430UgaDrawConstructor (
-  CIRRUS_LOGIC_5430_PRIVATE_DATA  *Private
-  )
-{
-  EFI_UGA_DRAW_PROTOCOL *UgaDraw;
-
-  //
-  // Fill in Private->UgaDraw protocol
-  //
-  UgaDraw           = &Private->UgaDraw;
-
-  UgaDraw->GetMode  = CirrusLogic5430UgaDrawGetMode;
-  UgaDraw->SetMode  = CirrusLogic5430UgaDrawSetMode;
-  UgaDraw->Blt      = CirrusLogic5430UgaDrawBlt;
-
-  //
-  // Initialize the private data
-  //
-  Private->CurrentMode            = 0;
-  Private->HardwareNeedsStarting  = TRUE;
-  Private->LineBuffer             = NULL;
-
-  //
-  // Initialize the hardware
-  //
-  UgaDraw->SetMode (
-            UgaDraw,
-            Private->ModeData[Private->CurrentMode].HorizontalResolution,
-            Private->ModeData[Private->CurrentMode].VerticalResolution,
-            Private->ModeData[Private->CurrentMode].ColorDepth,
-            Private->ModeData[Private->CurrentMode].RefreshRate
-            );
-  DrawLogo (
-    Private,
-    Private->ModeData[Private->CurrentMode].HorizontalResolution,
-    Private->ModeData[Private->CurrentMode].VerticalResolution
-    );
-
-  return EFI_SUCCESS;
-}
-
diff --git a/Drivers/OptionRomPkg/OptionRomPkg.dec b/Drivers/OptionRomPkg/OptionRomPkg.dec
index 6881f3648ede..14957349aab7 100644
--- a/Drivers/OptionRomPkg/OptionRomPkg.dec
+++ b/Drivers/OptionRomPkg/OptionRomPkg.dec
@@ -33,9 +33,6 @@
 [PcdsFeatureFlag]
   gOptionRomPkgTokenSpaceGuid.PcdSupportScsiPassThru|TRUE|BOOLEAN|0x00010001
   gOptionRomPkgTokenSpaceGuid.PcdSupportExtScsiPassThru|TRUE|BOOLEAN|0x00010002
-  gOptionRomPkgTokenSpaceGuid.PcdSupportGop|TRUE|BOOLEAN|0x00010004
-  gOptionRomPkgTokenSpaceGuid.PcdSupportUga|TRUE|BOOLEAN|0x00010005
 
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   gOptionRomPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion|0x0002000a|UINT32|0x00010003
-
-- 
2.35.1.windows.2








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87459): https://edk2.groups.io/g/devel/message/87459
Mute This Topic: https://groups.io/mt/89701485/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list