gma: Make cleaning the hardware state optional

In Initialize(), the state of the graphics hardware is reset to a
known state (i.e. everything is turned off first). That's unnecessary
in the coreboot case where we just came out of reset. Thus, make the
state cleaning optional with a `Clean_State` parameter that defaults
to `False`.

Change-Id: Ifee6ec9e9876fca8a715684718014917a3e35879
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/17758
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index 0a5b1b5..60a7a74 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -331,6 +331,7 @@
    procedure Initialize
      (MMIO_Base   : in     Word64 := 0;
       Write_Delay : in     Word64 := 0;
+      Clean_State : in     Boolean := False;
       Success     :    out Boolean)
    with
       Refined_Global =>
@@ -406,16 +407,17 @@
       Panel.Setup_PP_Sequencer;
       Port_Detect.Initialize;
 
-      Power_And_Clocks.Pre_All_Off;
+      Legacy_VGA_Off;   -- According to PRMs, VGA plane is the only
+                        -- thing that's enabled by default after reset.
 
-      Legacy_VGA_Off;
-
-      Connectors.Pre_All_Off;
-      Display_Controller.All_Off;
-      Connectors.Post_All_Off;
-      PLLs.All_Off;
-
-      Power_And_Clocks.Post_All_Off;
+      if Clean_State then
+         Power_And_Clocks.Pre_All_Off;
+         Connectors.Pre_All_Off;
+         Display_Controller.All_Off;
+         Connectors.Post_All_Off;
+         PLLs.All_Off;
+         Power_And_Clocks.Post_All_Off;
+      end if;
 
       -------------------- Now restart from a clean state ---------------------
       Power_And_Clocks.Initialize;