Jérémy Compostella has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/70299 )
Change subject: soc/intel/common/block: Add Intel VGA early graphics support ......................................................................
soc/intel/common/block: Add Intel VGA early graphics support
This patch introduces an early graphics driver which can be used in romstage in cache-as-ram mode. The implementation relies on `libgfxinit' and provide VGA text mode support.
SoCs wanting to take advantage of this driver must implement the following functions:
- `void early_graphics_soc_device_init(void)' to set the graphic device MMIO to the `CONFIG_GFX_GMA_DEFAULT_MMIO' value (typically PCI graphic device Base Address Register 0).
- `void early_graphics_soc_panel_init(void)' to set the panel power sequence timing parameters.
BUG=b:252792591 BRANCH=firmware-brya-14505.B TEST=TO-BE-COMPLETED
Change-Id: Ie4ad1215e5fadd0adc1271b6bd6ddb0ea258cb5b Signed-off-by: Jeremy Compostella jeremy.compostella@intel.com --- M src/drivers/intel/gma/gma-gfx_init.ads M src/drivers/intel/gma/hires_fb/gma-gfx_init.adb M src/drivers/intel/gma/libgfxinit.h M src/drivers/intel/gma/text_fb/gma-gfx_init.adb M src/soc/intel/common/block/graphics/Kconfig M src/soc/intel/common/block/graphics/Makefile.inc A src/soc/intel/common/block/graphics/early_graphics.c A src/soc/intel/common/block/include/intelblocks/early_graphics.h 8 files changed, 149 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/70299/1
diff --git a/src/drivers/intel/gma/gma-gfx_init.ads b/src/drivers/intel/gma/gma-gfx_init.ads index 4998d33..fc45672 100644 --- a/src/drivers/intel/gma/gma-gfx_init.ads +++ b/src/drivers/intel/gma/gma-gfx_init.ads @@ -11,6 +11,9 @@ procedure gfxinit (lightup_ok : out Interfaces.C.int); pragma Export (C, gfxinit, "gma_gfxinit");
+ procedure gfxstop (stop_ok : out Interfaces.C.int); + pragma Export (C, gfxstop, "gma_gfxstop"); + ----------------------------------------------------------------------------
function c_fb_add_framebuffer_info diff --git a/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb b/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb index b213030..83516af 100644 --- a/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb +++ b/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb @@ -97,4 +97,17 @@ end if; end gfxinit;
+ procedure gfxstop (stop_ok : out Interfaces.C.int) + is + success : boolean; + begin + HW.GFX.GMA.Initialize (Clean_State => True, + Success => success); + if success then + stop_ok := 1; + else + stop_ok := 0; + end if; + end gfxstop; + end GMA.GFX_Init; diff --git a/src/drivers/intel/gma/libgfxinit.h b/src/drivers/intel/gma/libgfxinit.h index 9a7e1c6..3270b91 100644 --- a/src/drivers/intel/gma/libgfxinit.h +++ b/src/drivers/intel/gma/libgfxinit.h @@ -17,6 +17,7 @@ };
void gma_gfxinit(int *lightup_ok); +void gma_gfxstop(int *stop_ok); int gma_read_edid(unsigned char edid[], int port);
#endif diff --git a/src/drivers/intel/gma/text_fb/gma-gfx_init.adb b/src/drivers/intel/gma/text_fb/gma-gfx_init.adb index d273852..da1e609 100644 --- a/src/drivers/intel/gma/text_fb/gma-gfx_init.adb +++ b/src/drivers/intel/gma/text_fb/gma-gfx_init.adb @@ -56,4 +56,17 @@ end if; end gfxinit;
+ procedure gfxstop (stop_ok : out Interfaces.C.int) + is + success : boolean; + begin + HW.GFX.GMA.Initialize (Clean_State => True, + Success => success); + if success then + stop_ok := 1; + else + stop_ok := 0; + end if; + end gfxstop; + end GMA.GFX_Init; diff --git a/src/soc/intel/common/block/graphics/Kconfig b/src/soc/intel/common/block/graphics/Kconfig index 8520e53..c63f5c2 100644 --- a/src/soc/intel/common/block/graphics/Kconfig +++ b/src/soc/intel/common/block/graphics/Kconfig @@ -1,5 +1,6 @@ config SOC_INTEL_COMMON_BLOCK_GRAPHICS bool + select ROMSTAGE_VGA if MAINBOARD_USE_ROMSTAGE_LIBGFXINIT help Intel Processor common Graphics support
diff --git a/src/soc/intel/common/block/graphics/Makefile.inc b/src/soc/intel/common/block/graphics/Makefile.inc index ac7df44..9c8cad9 100644 --- a/src/soc/intel/common/block/graphics/Makefile.inc +++ b/src/soc/intel/common/block/graphics/Makefile.inc @@ -1,2 +1,3 @@ ## SPDX-License-Identifier: GPL-2.0-only ramstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_GRAPHICS) += graphics.c +romstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_GRAPHICS) += early_graphics.c diff --git a/src/soc/intel/common/block/graphics/early_graphics.c b/src/soc/intel/common/block/graphics/early_graphics.c new file mode 100644 index 0000000..d2092db --- /dev/null +++ b/src/soc/intel/common/block/graphics/early_graphics.c @@ -0,0 +1,58 @@ +#include <acpi/acpi.h> +#include <console/console.h> +#include <drivers/intel/gma/libgfxinit.h> +#include <intelblocks/early_graphics.h> + +static bool initialized; + +/* SoC Overrides */ +__weak void early_graphics_soc_device_init(void) +{ + /* + * User needs to implement SoC override. + */ +} + +__weak void early_graphics_soc_panel_init(void) +{ + /* + * User needs to implement SoC override. + */ +} + +bool early_graphics_init(void) +{ + static bool attempted; + int ret; + + if (attempted) + return initialized; + + attempted = true; + + if (!CONFIG(MAINBOARD_USE_ROMSTAGE_LIBGFXINIT)) + return false; + + early_graphics_soc_device_init(); + early_graphics_soc_panel_init(); + + gma_gfxinit(&ret); + initialized = !!ret; + + return initialized; +} + +void early_graphics_stop(void) +{ + int ret; + + if (!initialized) + return; + + /* Graphics MMIO device configuration may have been corrupted since it + * has been initialized. The execution of a binary block such as FSP may + * indeed have reset the PCI BAR0 address of the graphic device. */ + early_graphics_soc_device_init(); + + gma_gfxstop(&ret); +} diff --git a/src/soc/intel/common/block/include/intelblocks/early_graphics.h b/src/soc/intel/common/block/include/intelblocks/early_graphics.h new file mode 100644 index 0000000..275c17c --- /dev/null +++ b/src/soc/intel/common/block/include/intelblocks/early_graphics.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef SOC_INTEL_COMMON_BLOCK_GRAPHICS_EARLY_H +#define SOC_INTEL_COMMON_BLOCK_GRAPHICS_EARLY_H + +#include <stdbool.h> + +/* + * SoC overrides + * + * All new SoC must implement below functionality. + */ + +/* Perform minimal graphic MMIO configuration. */ +void early_graphics_soc_device_init(void); + +/* Configure display panel */ +void early_graphics_soc_panel_init(void); + +/* + * Early graphics module API + * Graphics at this stage is limited to VGA text mode. + */ + +/* Initialize graphics. Return true if VGA text mode is ready to use. */ +bool early_graphics_init(void); + +/* Clear graphics configuration, turn off the displays. */ +void early_graphics_stop(void); + +#endif /* SOC_INTEL_COMMON_BLOCK_GRAPHICS_EARLY_H */