gma panel: Introduce `Panel_Control` type

For now, `Panel_Control` only distinguishes `Panel_1` from `No_Panel`,
i.e. if a port has a panel attached or not. To ease future addition of
support for more than one panel, we already add loops and arrays around
it, though.

With the information, if a port has a panel attached, in `Port_Config`,
we can pass that on into Panel.* procedures and let those decide what
to do (e.g. do nothing if no panel is attached).

Change-Id: I83864bc86b48f65d9ba43e083b805ca09497cbb0
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/38243
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/common/hw-gfx-gma-config_helpers.adb b/common/hw-gfx-gma-config_helpers.adb
index 07fa087..2a09305 100644
--- a/common/hw-gfx-gma-config_helpers.adb
+++ b/common/hw-gfx-gma-config_helpers.adb
@@ -12,7 +12,6 @@
 -- GNU General Public License for more details.
 --
 
-with HW.GFX.GMA.Config;
 with HW.GFX.GMA.Connector_Info;
 with HW.GFX.GMA.DP_Info;
 with HW.GFX.GMA.Registers;
@@ -84,6 +83,17 @@
             when DP1 .. DP3      => DP);
    end To_Display_Type;
 
+   function To_Panel (Port : Active_Port_Type) return Panel_Control
+   is
+   begin
+      for P in Valid_Panels loop
+         if Port = Config.Panel_Ports (P) then
+            return P;
+         end if;
+      end loop;
+      return No_Panel;
+   end To_Panel;
+
    function Highest_Dotclock (Configs : Pipe_Configs) return Frequency_Type
    is
       Max : Frequency_Type := Frequency_Type'First;
@@ -171,6 +181,7 @@
            (Port     => To_GPU_Port (Pipe, Port),
             PCH_Port => To_PCH_Port (Port),
             Display  => To_Display_Type (Port),
+            Panel    => To_Panel (Port),
             Mode     => Mode,
             Is_FDI   => Config.Is_FDI_Port (Port),
             FDI      => Default_DP,
@@ -206,6 +217,7 @@
            (Port     => GPU_Port'First,
             PCH_Port => PCH_Port'First,
             Display  => Display_Type'First,
+            Panel    => No_Panel,
             Mode     => Invalid_Mode,
             Is_FDI   => False,
             FDI      => Default_DP,