From 33912aa2a409416451e5e2d8eee05dc17212004d Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Tue, 6 Dec 2016 20:36:23 +0100 Subject: [PATCH] gma: Move Legacy_VGA_Off() into Pipe_Setup It's about the VGA plane and thus belongs into Pipe_Setup. Change-Id: I2f59b027c47c06b01f36695c517ed0847617a472 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/17762 Tested-by: Nico Huber Reviewed-by: Patrick Georgi --- common/hw-gfx-gma-pipe_setup.adb | 19 ++++++++++++++++++- common/hw-gfx-gma-pipe_setup.ads | 2 ++ common/hw-gfx-gma.adb | 22 ++++------------------ common/hw-gfx-gma.ads | 8 -------- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/common/hw-gfx-gma-pipe_setup.adb b/common/hw-gfx-gma-pipe_setup.adb index ca578554a3..6293f206e6 100644 --- a/common/hw-gfx-gma-pipe_setup.adb +++ b/common/hw-gfx-gma-pipe_setup.adb @@ -70,7 +70,10 @@ package body HW.GFX.GMA.Pipe_Setup is SPCNTR_ENABLE : constant := 1 * 2 ** 31; - VGA_SR01_SCREEN_OFF : constant := 1 * 2 ** 5; + VGA_SR_INDEX : constant := 16#03c4#; + VGA_SR_DATA : constant := 16#03c5#; + VGA_SR01 : constant := 16#01#; + VGA_SR01_SCREEN_OFF : constant := 1 * 2 ** 5; VGA_CONTROL_VGA_DISPLAY_DISABLE : constant := 1 * 2 ** 31; VGA_CONTROL_BLINK_DUTY_CYCLE_MASK : constant := 16#0003# * 2 ** 6; @@ -773,6 +776,18 @@ package body HW.GFX.GMA.Pipe_Setup is Trans_Clk_Off (Controllers (Pipe)); end Off; + procedure Legacy_VGA_Off + is + use type HW.Word8; + Reg8 : Word8; + begin + Port_IO.OutB (VGA_SR_INDEX, VGA_SR01); + Port_IO.InB (Reg8, VGA_SR_DATA); + Port_IO.OutB (VGA_SR_DATA, Reg8 or VGA_SR01_SCREEN_OFF); + Time.U_Delay (100); -- PRM says 100us, Linux does 300 + Registers.Set_Mask (Registers.VGACNTRL, VGA_CONTROL_VGA_DISPLAY_DISABLE); + end Legacy_VGA_Off; + procedure All_Off is EDP_Enabled, EDP_Piped : Boolean; @@ -793,6 +808,8 @@ package body HW.GFX.GMA.Pipe_Setup is begin pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); + Legacy_VGA_Off; + if Config.Has_EDP_Pipe then Registers.Is_Set_Mask (Registers.PIPE_EDP_CONF, PIPECONF_ENABLE, EDP_Enabled); diff --git a/common/hw-gfx-gma-pipe_setup.ads b/common/hw-gfx-gma-pipe_setup.ads index 01560ab126..a57ca18d3f 100644 --- a/common/hw-gfx-gma-pipe_setup.ads +++ b/common/hw-gfx-gma-pipe_setup.ads @@ -30,6 +30,8 @@ is procedure Off (Pipe : Pipe_Index; Port_Cfg : Port_Config); + procedure Legacy_VGA_Off; + procedure All_Off; function Get_Pipe_Hint (Pipe : Pipe_Index) return Word32; diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb index 379421c618..0fb4e5d997 100644 --- a/common/hw-gfx-gma.adb +++ b/common/hw-gfx-gma.adb @@ -28,7 +28,6 @@ with System; with HW.Debug; with GNAT.Source_Info; -use type HW.Word8; use type HW.Int32; package body HW.GFX.GMA @@ -84,20 +83,6 @@ is ---------------------------------------------------------------------------- - procedure Legacy_VGA_Off - is - Reg8 : Word8; - begin - -- disable legacy VGA plane, taking over control now - Port_IO.OutB (VGA_SR_INDEX, VGA_SR01); - Port_IO.InB (Reg8, VGA_SR_DATA); - Port_IO.OutB (VGA_SR_DATA, Reg8 or 1 * 2 ** 5); - Time.U_Delay (100); -- PRM says 100us, Linux does 300 - Registers.Set_Mask (Registers.VGACNTRL, 1 * 2 ** 31); - end Legacy_VGA_Off; - - ---------------------------------------------------------------------------- - procedure Update_Outputs (Configs : Pipe_Configs) is Did_Power_Up : Boolean := False; @@ -354,9 +339,6 @@ is Panel.Setup_PP_Sequencer; Port_Detect.Initialize; - Legacy_VGA_Off; -- According to PRMs, VGA plane is the only - -- thing that's enabled by default after reset. - if Clean_State then Power_And_Clocks.Pre_All_Off; Connectors.Pre_All_Off; @@ -364,6 +346,10 @@ is Connectors.Post_All_Off; PLLs.All_Off; Power_And_Clocks.Post_All_Off; + else + -- According to PRMs, VGA plane is the only thing + -- that's enabled by default after reset. + Display_Controller.Legacy_VGA_Off; end if; -------------------- Now restart from a clean state --------------------- diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads index 87b464a7f7..45f57f4a5e 100644 --- a/common/hw-gfx-gma.ads +++ b/common/hw-gfx-gma.ads @@ -75,8 +75,6 @@ is with Global => (Input => Init_State); - procedure Legacy_VGA_Off; - procedure Update_Outputs (Configs : Pipe_Configs); pragma Warnings (GNATprove, Off, "subprogram ""Dump_Configs"" has no effect", @@ -134,10 +132,4 @@ private type DP_Port is (DP_A, DP_B, DP_C, DP_D); - ---------------------------------------------------------------------------- - - VGA_SR_INDEX : constant Port_IO.Port_Type := 16#03c4#; - VGA_SR_DATA : constant Port_IO.Port_Type := 16#03c5#; - VGA_SR01 : constant Word8 := 16#01#; - end HW.GFX.GMA;