gma: Begin Tiger Lake (TGL) integration

Tiger Lake's integrated graphics engine is built off an entirely new
igfx architecture named "Iris Xe". This patch adds just enough support
to compile for Tiger Lake. Fortunately, the backlight programming
hasn't changed since SKL, so with a little bit of hacking, one can
also have libgfxinit turn on the backlight to verify something is
working and running.

The first pass through the support will focus mostly on the eDP panel,
then Type-C ports (both in fixed/native mode [DP/HDMI] and in Type-C
DP Alt Mode). TBT will not be mostly ignored in this first pass, as
it is not as widely used (yet?) as the other protocols.

This patch includes changes to fix ironlake gnatprove errors caused by
the new PCH_HDMI_A port definition.

Tested on google/voxel, with DEBUG_ADA_CODE enabled.
Tested on google/skolas, with DEBUG_ADA_CODE enabled.

This patch leaves the following unresolved gnatprove errors:
- hw-gfx-gma-port_detect.ads:17:14:
     warning: subprogram "Initialize" has no effect
- hw-gfx-gma-port_detect.ads:20:07:
     warning: unused variable "Port"
- hw-gfx-gma-port_detect.ads:23:14:
     warning: subprogram "Clear_Hotplug_Detect" has no effect
- hw-gfx-gma-connectors.ads:39:14:
     warning: subprogram "Post_Off" has no effect
- hw-gfx-gma-connectors.ads:42:14:
     warning: subprogram "Post_All_Off" has no effect

These errors will by addressed by the proper implementation of these
procedures.

Change-Id: I84f15837856ecc5ec8df18b39d3989885cd550d4
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/70887
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/common/ironlake/hw-gfx-gma-connectors.adb b/common/ironlake/hw-gfx-gma-connectors.adb
index 5970ea5..1c3a243 100644
--- a/common/ironlake/hw-gfx-gma-connectors.adb
+++ b/common/ironlake/hw-gfx-gma-connectors.adb
@@ -85,7 +85,7 @@
                   PCH.VGA.On (FDI_Port, Port_Cfg.Mode);
                elsif Port_Cfg.PCH_Port = PCH_LVDS then
                   PCH.LVDS.On (Port_Cfg, FDI_Port);
-               elsif Port_Cfg.PCH_Port in PCH_HDMI_Port then
+               elsif Port_Cfg.PCH_Port in PCH.HDMI.IRL_PCH_HDMI_Port then
                   PCH.HDMI.On (Port_Cfg, FDI_Port);
                elsif Port_Cfg.PCH_Port in PCH_DP_Port then
                   PCH.DP.On (Port_Cfg, FDI_Port, Success);
@@ -137,7 +137,7 @@
                PCH.VGA.Off;
             elsif Port_Cfg.PCH_Port = PCH_LVDS then
                PCH.LVDS.Off;
-            elsif Port_Cfg.PCH_Port in PCH_HDMI_Port then
+            elsif Port_Cfg.PCH_Port in PCH.HDMI.IRL_PCH_HDMI_Port then
                PCH.HDMI.Off (Port_Cfg.PCH_Port);
             end if;
             PCH.Transcoder.Off (FDI_Port);
diff --git a/common/ironlake/hw-gfx-gma-pch-hdmi.adb b/common/ironlake/hw-gfx-gma-pch-hdmi.adb
index 15d4e9f..47a500c 100644
--- a/common/ironlake/hw-gfx-gma-pch-hdmi.adb
+++ b/common/ironlake/hw-gfx-gma-pch-hdmi.adb
@@ -39,7 +39,7 @@
       PCH_HDMI_HSYNC_ACTIVE_HIGH or
       PCH_HDMI_VSYNC_ACTIVE_HIGH);
 
-   type PCH_HDMI_Array is array (PCH_HDMI_Port) of Registers.Registers_Index;
+   type PCH_HDMI_Array is array (IRL_PCH_HDMI_Port) of Registers.Registers_Index;
    PCH_HDMI : constant PCH_HDMI_Array := PCH_HDMI_Array'
      (PCH_HDMI_B => Registers.PCH_HDMIB,
       PCH_HDMI_C => Registers.PCH_HDMIC,
@@ -74,7 +74,7 @@
 
    ----------------------------------------------------------------------------
 
-   procedure Off (Port : PCH_HDMI_Port)
+   procedure Off (Port : IRL_PCH_HDMI_Port)
    is
       With_Transcoder_B_Enabled : Boolean := False;
    begin
@@ -115,7 +115,7 @@
    begin
       pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
 
-      for Port in PCH_HDMI_Port loop
+      for Port in IRL_PCH_HDMI_Port loop
          Off (Port);
       end loop;
    end All_Off;
diff --git a/common/ironlake/hw-gfx-gma-pch-hdmi.ads b/common/ironlake/hw-gfx-gma-pch-hdmi.ads
index 31d9564..1193711 100644
--- a/common/ironlake/hw-gfx-gma-pch-hdmi.ads
+++ b/common/ironlake/hw-gfx-gma-pch-hdmi.ads
@@ -14,12 +14,13 @@
 
 package HW.GFX.GMA.PCH.HDMI
 is
+   subtype IRL_PCH_HDMI_Port is PCH_HDMI_Port range PCH_HDMI_B .. PCH_HDMI_D;
 
    procedure On (Port_Cfg : Port_Config; FDI_Port : FDI_Port_Type)
    with
-      Pre => Port_Cfg.PCH_Port in PCH_HDMI_Port;
+      Pre => Port_Cfg.PCH_Port in IRL_PCH_HDMI_Port;
 
-   procedure Off (Port : PCH_HDMI_Port);
+   procedure Off (Port : IRL_PCH_HDMI_Port);
    procedure All_Off;
 
 end HW.GFX.GMA.PCH.HDMI;
diff --git a/common/ironlake/hw-gfx-gma-port_detect.adb b/common/ironlake/hw-gfx-gma-port_detect.adb
index 7efadeb..599c2cd 100644
--- a/common/ironlake/hw-gfx-gma-port_detect.adb
+++ b/common/ironlake/hw-gfx-gma-port_detect.adb
@@ -15,6 +15,7 @@
 with HW.GFX.GMA.Config;
 with HW.GFX.GMA.Registers;
 with HW.GFX.GMA.Config_Helpers;
+with HW.GFX.GMA.PCH.HDMI;
 
 package body HW.GFX.GMA.Port_Detect
 is
@@ -25,7 +26,7 @@
 
    SHOTPLUG_CTL_DETECT_MASK            : constant := 16#0003_0303#;
 
-   type PCH_Digital_Port_Value is array (PCH_HDMI_Port) of Word32;
+   type PCH_Digital_Port_Value is array (PCH.HDMI.IRL_PCH_HDMI_Port) of Word32;
    SHOTPLUG_CTL_HPD_INPUT_ENABLE : constant PCH_Digital_Port_Value :=
      (PCH_HDMI_B => 1 * 2 **  4,
       PCH_HDMI_C => 1 * 2 ** 12,
@@ -43,7 +44,7 @@
       PCH_HDMI_C => 1 * 2 **  9,
       PCH_HDMI_D => 1 * 2 ** 17);
 
-   type PCH_Digital_Regs is array (PCH_HDMI_Port) of Registers.Registers_Index;
+   type PCH_Digital_Regs is array (PCH.HDMI.IRL_PCH_HDMI_Port) of Registers.Registers_Index;
    PCH_HDMI : constant PCH_Digital_Regs :=
      (PCH_HDMI_B => Registers.PCH_HDMIB,
       PCH_HDMI_C => Registers.PCH_HDMIC,
@@ -60,7 +61,7 @@
       HDMI_Detected,
       DP_Detected : Boolean;
 
-      type PCH_Port_To_GMA_Port is array (PCH_HDMI_Port) of Port_Type;
+      type PCH_Port_To_GMA_Port is array (PCH.HDMI.IRL_PCH_HDMI_Port) of Port_Type;
       To_Digital_Port : constant PCH_Port_To_GMA_Port :=
         (PCH_HDMI_B => HDMI1,
          PCH_HDMI_C => HDMI2,
@@ -87,7 +88,7 @@
       Config.Valid_Port (eDP) := eDP_Detected;
 
       -- PCH_HDMI_[BCD], PCH_DP_[BCD] share hotplug registers
-      for PCH_Port in PCH_HDMI_Port loop
+      for PCH_Port in PCH.HDMI.IRL_PCH_HDMI_Port loop
          Registers.Is_Set_Mask
            (Register => PCH_HDMI (PCH_Port),
             Mask     => PCH_DIGI_PORT_DETECTED,