drivers/intel/gma: Use libgfxinit Update_Output to turn off graphics

We were using the libgfxinit `Initialize' function with the
`Clean_State' parameter because the more appropriate `Update_Output'
function was not performing all the necessary clean up operations for
the PEIM driver to be successful when libgfxinit was used in romstage.

Thanks to a lot of experiments and some log analysis efforts, we were
able to identify the missing operation and fix the `Update_Output'
function (cf. https://review.coreboot.org/c/libgfxinit/+/72123).

The `initialized' global variable is now unnecessary as we track the
initialization in the Ada code instead.

Since the `Update_Output' function does not return any value, this
patch modifies the `gma_gfxstop' prototype accordingly. This does not
have any impact as the return value was not used anyway.

BUG=b:264526798
BRANCH=firmware-brya-14505.B
TEST=Developer screen is visible

Change-Id: I53d6fadf65dc09bd984de96edb4c1f15b64aeed0
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/72125
Reviewed-by: Tarun Tuli <taruntuli@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
This commit is contained in:
Jeremy Compostella
2023-01-19 18:58:30 -07:00
committed by Nick Vaccaro
parent e02e918eba
commit b628beca34
5 changed files with 19 additions and 29 deletions

View File

@@ -11,7 +11,7 @@ is
procedure gfxinit (lightup_ok : out Interfaces.C.int); procedure gfxinit (lightup_ok : out Interfaces.C.int);
pragma Export (C, gfxinit, "gma_gfxinit"); pragma Export (C, gfxinit, "gma_gfxinit");
procedure gfxstop (stop_ok : out Interfaces.C.int); procedure gfxstop;
pragma Export (C, gfxstop, "gma_gfxstop"); pragma Export (C, gfxstop, "gma_gfxstop");
---------------------------------------------------------------------------- ----------------------------------------------------------------------------

View File

@@ -18,6 +18,7 @@ with GMA.Mainboard;
package body GMA.GFX_Init package body GMA.GFX_Init
is is
configs : Pipe_Configs;
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
procedure gfxinit (lightup_ok : out Interfaces.C.int) procedure gfxinit (lightup_ok : out Interfaces.C.int)
@@ -28,7 +29,6 @@ is
use type Interfaces.C.size_t; use type Interfaces.C.size_t;
ports : Port_List; ports : Port_List;
configs : Pipe_Configs;
success : boolean; success : boolean;
@@ -97,16 +97,14 @@ is
end if; end if;
end gfxinit; end gfxinit;
procedure gfxstop (stop_ok : out Interfaces.C.int) procedure gfxstop
is is
success : boolean;
begin begin
HW.GFX.GMA.Initialize (Clean_State => True, if configs (Primary).Port /= Disabled then
Success => success); for i in Pipe_Index loop
if success then configs (i).Port := Disabled;
stop_ok := 1; end loop;
else HW.GFX.GMA.Update_Outputs (configs);
stop_ok := 0;
end if; end if;
end gfxstop; end gfxstop;

View File

@@ -17,7 +17,7 @@ enum {
}; };
void gma_gfxinit(int *lightup_ok); void gma_gfxinit(int *lightup_ok);
void gma_gfxstop(int *stop_ok); void gma_gfxstop(void);
int gma_read_edid(unsigned char edid[], int port); int gma_read_edid(unsigned char edid[], int port);
#endif #endif

View File

@@ -12,11 +12,11 @@ with GMA.Mainboard;
package body GMA.GFX_Init package body GMA.GFX_Init
is is
configs : Pipe_Configs;
procedure gfxinit (lightup_ok : out Interfaces.C.int) procedure gfxinit (lightup_ok : out Interfaces.C.int)
is is
ports : Port_List; ports : Port_List;
configs : Pipe_Configs;
success : boolean; success : boolean;
@@ -56,16 +56,14 @@ is
end if; end if;
end gfxinit; end gfxinit;
procedure gfxstop (stop_ok : out Interfaces.C.int) procedure gfxstop
is is
success : boolean;
begin begin
HW.GFX.GMA.Initialize (Clean_State => True, if configs (Primary).Port /= Disabled then
Success => success); for i in Pipe_Index loop
if success then configs (i).Port := Disabled;
stop_ok := 1; end loop;
else HW.GFX.GMA.Update_Outputs (configs);
stop_ok := 0;
end if; end if;
end gfxstop; end gfxstop;

View File

@@ -6,8 +6,6 @@
#include <intelblocks/early_graphics.h> #include <intelblocks/early_graphics.h>
#include <soc/pci_devs.h> #include <soc/pci_devs.h>
static bool initialized;
static void device_init(void) static void device_init(void)
{ {
/* Disable response in IO and MMIO space. */ /* Disable response in IO and MMIO space. */
@@ -37,19 +35,15 @@ bool early_graphics_init(void)
early_graphics_soc_panel_init(); early_graphics_soc_panel_init();
gma_gfxinit(&ret); gma_gfxinit(&ret);
initialized = !!ret; return !!ret;
return initialized;
} }
void early_graphics_stop(void) void early_graphics_stop(void)
{ {
int ret; if (!CONFIG(MAINBOARD_USE_EARLY_LIBGFXINIT))
if (!initialized)
return; return;
gma_gfxstop(&ret); gma_gfxstop();
/* /*
* Temporary workaround * Temporary workaround