gma: Add GPU_Port types that are convenient for GMCH to use

Change-Id: I9120d084637d36a7e2276fcf3f630b3f7ed32509
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/25407
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/common/haswell_shared/hw-gfx-gma-connectors-ddi.ads b/common/haswell_shared/hw-gfx-gma-connectors-ddi.ads
index ec1fce2..d43db97 100644
--- a/common/haswell_shared/hw-gfx-gma-connectors-ddi.ads
+++ b/common/haswell_shared/hw-gfx-gma-connectors-ddi.ads
@@ -22,9 +22,14 @@
    procedure Pre_On
      (Port_Cfg : in     Port_Config;
       PLL_Hint : in     Word32;
-      Success  :    out Boolean);
+      Success  :    out Boolean)
+   with
+     Pre => Port_Cfg.Port in Digital_Port;
 
-   procedure Post_On (Port_Cfg : Port_Config);
+   procedure Post_On (Port_Cfg : Port_Config)
+   with
+     Pre => Port_Cfg.Port in Digital_Port;
+
 
    procedure Off (Port : Digital_Port);
 
diff --git a/common/haswell_shared/hw-gfx-gma-connectors.adb b/common/haswell_shared/hw-gfx-gma-connectors.adb
index 0d0ed71..2b29f99 100644
--- a/common/haswell_shared/hw-gfx-gma-connectors.adb
+++ b/common/haswell_shared/hw-gfx-gma-connectors.adb
@@ -41,8 +41,11 @@
    is
    begin
       pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
-
-      DDI.Pre_On (Port_Cfg, PLL_Hint, Success);
+      if Port_Cfg.Port in Digital_Port then
+         DDI.Pre_On (Port_Cfg, PLL_Hint, Success);
+      else
+         Success := False; -- Should not happen
+      end if;
    end Pre_On;
 
    procedure Post_On
@@ -53,13 +56,16 @@
    begin
       pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
 
-      DDI.Post_On (Port_Cfg);
+      if Port_Cfg.Port in Digital_Port then
+         DDI.Post_On (Port_Cfg);
 
-      if Port_Cfg.Port = DIGI_A then
-         Panel.Backlight_On;
+         if Port_Cfg.Port = DIGI_A then
+            Panel.Backlight_On;
+         end if;
+         Success := True;
+      else
+         Success := False; -- Should not happen
       end if;
-
-      Success := True;
    end Post_On;
 
    ----------------------------------------------------------------------------
@@ -79,8 +85,9 @@
    is
    begin
       pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
-
-      DDI.Off (Port_Cfg.Port);
+      if Port_Cfg.Port in Digital_Port then
+         DDI.Off (Port_Cfg.Port);
+      end if;
    end Post_Off;
 
    ----------------------------------------------------------------------------
diff --git a/common/hw-gfx-gma-connector_info.adb b/common/hw-gfx-gma-connector_info.adb
index 798e61c..e8357be 100644
--- a/common/hw-gfx-gma-connector_info.adb
+++ b/common/hw-gfx-gma-connector_info.adb
@@ -87,7 +87,8 @@
    begin
       return
         (if Port_Cfg.Port = DIGI_A or
-            (Port_Cfg.Is_FDI and Port_Cfg.PCH_Port = PCH_LVDS)
+           (Port_Cfg.Is_FDI and Port_Cfg.PCH_Port = PCH_LVDS) or
+           Port_Cfg.Port = LVDS
          then 6
          else 8);
    end Default_BPC;
diff --git a/common/hw-gfx-gma-transcoder.adb b/common/hw-gfx-gma-transcoder.adb
index 5990fcf..97ad069 100644
--- a/common/hw-gfx-gma-transcoder.adb
+++ b/common/hw-gfx-gma-transcoder.adb
@@ -218,7 +218,8 @@
       pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
 
       if Config.Has_Trans_Clk_Sel and then
-         Trans.CLK_SEL /= Registers.Invalid_Register
+         Trans.CLK_SEL /= Registers.Invalid_Register and then
+         Port_Cfg.Port in Digital_Port
       then
          Registers.Write
            (Register => Trans.CLK_SEL,
@@ -249,7 +250,7 @@
       Trans : Transcoder_Regs renames
                Transcoders (Get_Idx (Pipe, Port_Cfg.Port));
    begin
-      if Config.Has_Pipe_DDI_Func then
+      if Config.Has_Pipe_DDI_Func and Port_Cfg.Port in Digital_Port then
          Registers.Write
            (Register => Trans.DDI_FUNC_CTL,
             Value    => DDI_FUNC_CTL_ENABLE or
diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads
index 50a76a0..fadf437 100644
--- a/common/hw-gfx-gma.ads
+++ b/common/hw-gfx-gma.ads
@@ -126,9 +126,11 @@
    subtype Active_Port_Type is Port_Type
       range Port_Type'Succ (Disabled) .. Port_Type'Last;
 
-   type GPU_Port is (DIGI_A, DIGI_B, DIGI_C, DIGI_D, DIGI_E);
+   type GPU_Port is (DIGI_A, DIGI_B, DIGI_C, DIGI_D, DIGI_E, LVDS, VGA);
 
    subtype Digital_Port is GPU_Port range DIGI_A .. DIGI_E;
+   subtype GMCH_DP_Port is GPU_Port range DIGI_B .. DIGI_D;
+   subtype GMCH_HDMI_Port is GPU_Port range DIGI_B .. DIGI_C;
 
    type PCH_Port is
      (PCH_DAC, PCH_LVDS,