gma ironlake: Don't enable FDI C if FDI B uses all the lanes

FDI B and FDI C share lanes. We already restricted FDI B to 2 lanes
when FDI C is enabled. However we should also handle the other case,
when FDI B already uses all 4 lanes, we can't use FDI C.

Change-Id: I4396741575fbe07aeaaf4c23f4b8a742b300d817
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/471
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/common/ironlake/hw-gfx-gma-connectors.adb b/common/ironlake/hw-gfx-gma-connectors.adb
index d813fe4..f90b7ba 100644
--- a/common/ironlake/hw-gfx-gma-connectors.adb
+++ b/common/ironlake/hw-gfx-gma-connectors.adb
@@ -46,9 +46,23 @@
       with
          Post => Port_Cfg.Mode = Port_Cfg'Old.Mode
       is
-         FDI_TX_CTL_FDI_TX_ENABLE : constant := 1 * 2 ** 31;
+         FDI_TX_CTL_FDI_TX_ENABLE      : constant := 1 * 2 ** 31;
+         FDI_TX_CTL_PORT_WIDTH_SEL_4   : constant := 3 * 2 ** 19;
          Enabled : Boolean;
       begin
+         if Config.Has_FDI_C and then Port_Cfg.Port = DIGI_D then
+            -- if DIGI_C (FDI_B) is enabled w/ 4 lanes, DIGI_D can't be used:
+            Registers.Is_Set_Mask
+              (Register => Registers.FDI_TX_CTL_B,
+               Mask     => FDI_TX_CTL_FDI_TX_ENABLE or
+                           FDI_TX_CTL_PORT_WIDTH_SEL_4,
+               Result   => Enabled);
+            if Enabled then
+               Success := False;
+               return;
+            end if;
+         end if;
+
          if Config.Has_FDI_C and then Port_Cfg.Port = DIGI_C then
             -- if DIGI_D enabled: (FDI names are off by one)
             Registers.Is_Set_Mask