gma hsw+: Don't use DDI E if DDI A uses all lanes

DDI E shares its two lanes with DDI A. If DDI A is configured to use
all four lanes, DDI E is disabled. As DDI E is the only DDI that can
be configured in FDI mode to feed the PCH DAC, treat `Analog` as in-
valid in this configuration.

Change-Id: I94e9537c9f30d0cbf757b816f38d44e1b43805b3
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/20821
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/common/haswell_shared/hw-gfx-gma-port_detect.adb b/common/haswell_shared/hw-gfx-gma-port_detect.adb
index d8a1d07..1302cf0 100644
--- a/common/haswell_shared/hw-gfx-gma-port_detect.adb
+++ b/common/haswell_shared/hw-gfx-gma-port_detect.adb
@@ -19,6 +19,8 @@
 package body HW.GFX.GMA.Port_Detect
 is
 
+   DDI_BUF_CTL_A_LANE_CAPABILITY_X4    : constant := 1 * 2 **  4;
+
    SFUSE_STRAP_CRT_DAC_CAP_DISABLE     : constant := 1 * 2 **  6;
 
    HOTPLUG_CTL_DDI_A_HPD_INPUT_ENABLE  : constant := 1 * 2 **  4;
@@ -55,6 +57,7 @@
 
    procedure Initialize
    is
+      DDI_A_X4,
       DAC_Disabled,
       Internal_Detected,
       DDI_Detected : Boolean;
@@ -71,13 +74,17 @@
          DIGI_C => DP2,
          DIGI_D => DP3);
    begin
-      if Config.Has_PCH_DAC then
+      if Config.Has_DDI_E and Config.Has_PCH_DAC then
          -- PCH_DAC (_A)
          Registers.Is_Set_Mask
+           (Register => Registers.DDI_BUF_CTL_A,
+            Mask     => DDI_BUF_CTL_A_LANE_CAPABILITY_X4,
+            Result   => DDI_A_X4);
+         Registers.Is_Set_Mask
            (Register => Registers.SFUSE_STRAP,
             Mask     => SFUSE_STRAP_CRT_DAC_CAP_DISABLE,
             Result   => DAC_Disabled);
-         Config.Valid_Port (Analog) := not DAC_Disabled;
+         Config.Valid_Port (Analog) := not (DDI_A_X4 or DAC_Disabled);
       end if;
 
       if Config.Internal_Is_EDP then