gma: Refactor Hotplug_Detect() interface and usage
Checking for hotplug events should be done before any other work to
reduce load and (spurious) debug output. Therefor, use the simpler
`Port_Type` in the interface of `Hotplug_Detect()` so we don't have to
fill the whole `Port_Cfg` before checking for events.
Also, now that it's possible, factor the disabling of a single output
out of `Update_Outputs()`.
Change-Id: I2a0ba5530c8d511fa95f9cac12297ad428a40d77
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/18119
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
diff --git a/common/ironlake/hw-gfx-gma-port_detect.adb b/common/ironlake/hw-gfx-gma-port_detect.adb
index e8cb3fa..ff4ff88 100644
--- a/common/ironlake/hw-gfx-gma-port_detect.adb
+++ b/common/ironlake/hw-gfx-gma-port_detect.adb
@@ -1,5 +1,5 @@
--
--- Copyright (C) 2016 secunet Security Networks AG
+-- Copyright (C) 2016-2017 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -14,6 +14,7 @@
with HW.GFX.GMA.Config;
with HW.GFX.GMA.Registers;
+with HW.GFX.GMA.Config_Helpers;
package body HW.GFX.GMA.Port_Detect
is
@@ -125,15 +126,15 @@
end loop;
end Initialize;
- procedure Hotplug_Detect (Port_Cfg : in Port_Config; Detected : out Boolean)
+ procedure Hotplug_Detect (Port : in Active_Port_Type; Detected : out Boolean)
is
Ctl32 : Word32;
PCH_Port : constant GMA.PCH_Port :=
- (case Port_Cfg.PCH_Port is
- when PCH_DP_B => PCH_HDMI_B,
- when PCH_DP_C => PCH_HDMI_C,
- when PCH_DP_D => PCH_HDMI_D,
- when others => Port_Cfg.PCH_Port);
+ (case Port is
+ when DP1 => PCH_HDMI_B,
+ when DP2 => PCH_HDMI_C,
+ when DP3 => PCH_HDMI_D,
+ when others => Config_Helpers.To_PCH_Port (Port));
begin
case PCH_Port is
when PCH_DAC =>