gma: Get rid of Get_Pipe_Hint()

Now that we call it `Pipe_Index` passing that around makes more sense.

Change-Id: I59460274860dc5d135662aa978acc1603b510eb6
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/17932
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
diff --git a/common/haswell_shared/hw-gfx-gma-connectors.adb b/common/haswell_shared/hw-gfx-gma-connectors.adb
index 7e8f133..15b3c12 100644
--- a/common/haswell_shared/hw-gfx-gma-connectors.adb
+++ b/common/haswell_shared/hw-gfx-gma-connectors.adb
@@ -22,10 +22,10 @@
 package body HW.GFX.GMA.Connectors is
 
    procedure Pre_On
-     (Port_Cfg    : in     Port_Config;
-      PLL_Hint    : in     Word32;
-      Pipe_Hint   : in     Word32;
-      Success     :    out Boolean)
+     (Pipe     : in     Pipe_Index;
+      Port_Cfg : in     Port_Config;
+      PLL_Hint : in     Word32;
+      Success  :    out Boolean)
    is
    begin
       pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
diff --git a/common/hw-gfx-gma-connectors.ads b/common/hw-gfx-gma-connectors.ads
index 02f5fb1..ccb9666 100644
--- a/common/hw-gfx-gma-connectors.ads
+++ b/common/hw-gfx-gma-connectors.ads
@@ -17,9 +17,9 @@
    pragma Warnings (GNATprove, Off, "unused variable ""P*""",
                     Reason => "Needed for a common interface");
    procedure Pre_On
-     (Port_Cfg    : in     Port_Config;
+     (Pipe        : in     Pipe_Index;
+      Port_Cfg    : in     Port_Config;
       PLL_Hint    : in     Word32;
-      Pipe_Hint   : in     Word32;
       Success     :    out Boolean);
 
    procedure Post_On
diff --git a/common/hw-gfx-gma-pipe_setup.adb b/common/hw-gfx-gma-pipe_setup.adb
index 3525ea3..57344e4 100644
--- a/common/hw-gfx-gma-pipe_setup.adb
+++ b/common/hw-gfx-gma-pipe_setup.adb
@@ -506,16 +506,4 @@
         (Controllers (Pipe).DSPSURF, Framebuffer.Offset and 16#ffff_f000#);
    end Update_Offset;
 
-   ----------------------------------------------------------------------------
-
-   function Get_Pipe_Hint (Pipe : Pipe_Index) return Word32
-   is
-   begin
-      return
-        (case Pipe is
-            when Primary      => 0,
-            when Secondary    => 1,
-            when Tertiary     => 2);
-   end Get_Pipe_Hint;
-
 end HW.GFX.GMA.Pipe_Setup;
diff --git a/common/hw-gfx-gma-pipe_setup.ads b/common/hw-gfx-gma-pipe_setup.ads
index 5a85c7e..725bc08 100644
--- a/common/hw-gfx-gma-pipe_setup.ads
+++ b/common/hw-gfx-gma-pipe_setup.ads
@@ -34,8 +34,6 @@
 
    procedure All_Off;
 
-   function Get_Pipe_Hint (Pipe : Pipe_Index) return Word32;
-
    procedure Update_Offset (Pipe : Pipe_Index; Framebuffer : Framebuffer_Type);
 
 private
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index 8d304b6..898ce56 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -193,11 +193,10 @@
                           (New_Config.Port in Active_Port_Type);
 
                         Connectors.Pre_On
-                          (Port_Cfg    => Port_Cfg,
-                           PLL_Hint    => PLLs.Register_Value
-                                            (Allocated_PLLs (I)),
-                           Pipe_Hint   => Display_Controller.Get_Pipe_Hint (I),
-                           Success     => Success);
+                          (Pipe     => I,
+                           Port_Cfg => Port_Cfg,
+                           PLL_Hint => PLLs.Register_Value (Allocated_PLLs (I)),
+                           Success  => Success);
 
                         if Success then
                            Display_Controller.On
diff --git a/common/ironlake/hw-gfx-gma-connectors-edp.adb b/common/ironlake/hw-gfx-gma-connectors-edp.adb
index b6443fe..49c4039 100644
--- a/common/ironlake/hw-gfx-gma-connectors-edp.adb
+++ b/common/ironlake/hw-gfx-gma-connectors-edp.adb
@@ -25,8 +25,6 @@
 is
 
    DP_CTL_DISPLAYPORT_ENABLE        : constant :=  1 * 2 ** 31;
-   DP_CTL_PIPE_SELECT_MASK          : constant :=  3 * 2 ** 29;
-   DP_CTL_PIPE_SELECT_SHIFT         : constant :=           29;
    DP_CTL_VSWING_EMPH_SET_MASK      : constant := 63 * 2 ** 22;
    DP_CTL_PORT_WIDTH_MASK           : constant :=  7 * 2 ** 19;
    DP_CTL_PORT_WIDTH_1_LANE         : constant :=  0 * 2 ** 19;
@@ -48,6 +46,12 @@
    DP_CTL_HSYNC_ACTIVE_HIGH         : constant :=  1 * 2 **  3;
    DP_CTL_PORT_DETECT               : constant :=  1 * 2 **  2;
 
+   type Pipe_Value_Array is array (Pipe_Index) of Word32;
+   DP_CTL_PIPE_SELECT : constant Pipe_Value_Array :=
+     (Primary     => 0 * 2 ** 29,
+      Secondary   => 1 * 2 ** 29,
+      Tertiary    => 2 * 2 ** 29);
+
    -- TODO? Values are for Ivy Bridge only
    DP_CTL_VSWING_0_EMPH_0 : constant := 1 * 2 ** 27 + 1 * 2 ** 24 + 0 * 2 ** 22;
    DP_CTL_VSWING_0_EMPH_1 : constant := 1 * 2 ** 27 + 2 * 2 ** 24 + 2 * 2 ** 22;
@@ -176,16 +180,14 @@
 
    ----------------------------------------------------------------------------
 
-   procedure Pre_On
-     (Port_Cfg    : Port_Config;
-      Pipe_Hint   : Word32)
+   procedure Pre_On (Pipe : Pipe_Index; Port_Cfg : Port_Config)
    is
       DP_CTL_Set : Word32;
    begin
       pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
 
       DP_CTL_Set :=
-         Shift_Left (Pipe_Hint, DP_CTL_PIPE_SELECT_SHIFT) or
+         DP_CTL_PIPE_SELECT (Pipe) or
          DP_CTL_PORT_WIDTH (Port_Cfg.DP.Lane_Count);
 
       if Port_Cfg.DP.Enhanced_Framing then
diff --git a/common/ironlake/hw-gfx-gma-connectors-edp.ads b/common/ironlake/hw-gfx-gma-connectors-edp.ads
index c74a9cc..c43d586 100644
--- a/common/ironlake/hw-gfx-gma-connectors-edp.ads
+++ b/common/ironlake/hw-gfx-gma-connectors-edp.ads
@@ -15,9 +15,7 @@
 private package HW.GFX.GMA.Connectors.EDP
 is
 
-   procedure Pre_On
-     (Port_Cfg    : Port_Config;
-      Pipe_Hint   : Word32);
+   procedure Pre_On (Pipe : Pipe_Index; Port_Cfg : Port_Config);
 
    procedure Post_On
      (Link     : in     DP_Link;
diff --git a/common/ironlake/hw-gfx-gma-connectors.adb b/common/ironlake/hw-gfx-gma-connectors.adb
index e94ae2e..7d00fa6 100644
--- a/common/ironlake/hw-gfx-gma-connectors.adb
+++ b/common/ironlake/hw-gfx-gma-connectors.adb
@@ -40,16 +40,16 @@
    ----------------------------------------------------------------------------
 
    procedure Pre_On
-     (Port_Cfg    : in     Port_Config;
+     (Pipe        : in     Pipe_Index;
+      Port_Cfg    : in     Port_Config;
       PLL_Hint    : in     Word32;
-      Pipe_Hint   : in     Word32;
       Success     :    out Boolean)
    is
    begin
       pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
 
       if Port_Cfg.Port = DIGI_A then
-         EDP.Pre_On (Port_Cfg, Pipe_Hint);
+         EDP.Pre_On (Pipe, Port_Cfg);
       elsif Port_Cfg.Port in FDI.GPU_FDI_Port then
          FDI.Pre_On (Port_Cfg);
       end if;