drivers/intel/gma: Hook up libgfxinit in romstage
A mainboard port needs to: - select `CONFIG_MAINBOARD_HAS_EARLY_LIBGFXINIT' - implement the Ada package `GMA.Mainboard' with a single function `ports' that returns a list of ports to be probed for displays. - set the desired `GFX_GMA_DEFAULT_MMIO' IO memory address to use in romstage (and ramstage) for the graphic device. BUG=b:252792591 BRANCH=firmware-brya-14505.B TEST=libgfxinit compiles in romstage. libgfxinit successfully executes in romstage and ramstage using the requested MMIO setting on skolas. Change-Id: I3c2101de10dc5df54fe873e43bbe0f1c4dccff44 Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/70276 Reviewed-by: Tarun Tuli <taruntuli@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
committed by
Subrata Banik
parent
ea2dbdba2e
commit
765e5df0dd
@@ -72,6 +72,13 @@
|
|||||||
* runtime. Therefore, they can be placed in the _bss region. */
|
* runtime. Therefore, they can be placed in the _bss region. */
|
||||||
#if CONFIG(ROMSTAGE_LIBHWBASE)
|
#if CONFIG(ROMSTAGE_LIBHWBASE)
|
||||||
*(.data.hw__*_E)
|
*(.data.hw__*_E)
|
||||||
|
#endif
|
||||||
|
#if CONFIG(EARLY_GFX_GMA)
|
||||||
|
*(.data.gma*_E)
|
||||||
|
/* libgfxinit uses a boolean variable to track its initialization
|
||||||
|
* state. Since the initial value is False it can safely be placed in
|
||||||
|
* the _bss region. */
|
||||||
|
*(.data.hw__gfx__gma__initialized)
|
||||||
#endif
|
#endif
|
||||||
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
|
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
|
@@ -4,7 +4,7 @@ menu "Devices"
|
|||||||
|
|
||||||
config HAVE_VGA_TEXT_FRAMEBUFFER
|
config HAVE_VGA_TEXT_FRAMEBUFFER
|
||||||
bool
|
bool
|
||||||
depends on !NO_GFX_INIT
|
depends on !(NO_GFX_INIT && NO_EARLY_GFX_INIT)
|
||||||
help
|
help
|
||||||
Selected by graphics drivers that support legacy VGA text mode.
|
Selected by graphics drivers that support legacy VGA text mode.
|
||||||
|
|
||||||
@@ -58,6 +58,13 @@ config MAINBOARD_HAS_LIBGFXINIT
|
|||||||
Selected by mainboards that implement support for `libgfxinit`.
|
Selected by mainboards that implement support for `libgfxinit`.
|
||||||
Usually this requires a list of ports to be probed for displays.
|
Usually this requires a list of ports to be probed for displays.
|
||||||
|
|
||||||
|
config MAINBOARD_HAS_EARLY_LIBGFXINIT
|
||||||
|
def_bool n
|
||||||
|
help
|
||||||
|
Selected by mainboards that implement early (cache-as-ram
|
||||||
|
stage) support of `libgfxinit`. Usually this requires a list
|
||||||
|
of ports to be probed for displays.
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Graphics initialization"
|
prompt "Graphics initialization"
|
||||||
default NO_GFX_INIT if VGA_ROM_RUN_DEFAULT && PAYLOAD_SEABIOS
|
default NO_GFX_INIT if VGA_ROM_RUN_DEFAULT && PAYLOAD_SEABIOS
|
||||||
@@ -117,6 +124,28 @@ config NO_GFX_INIT
|
|||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Early (romstage) graphics initialization"
|
||||||
|
default MAINBOARD_USE_EARLY_LIBGFXINIT if MAINBOARD_HAS_EARLY_LIBGFXINIT
|
||||||
|
default NO_EARLY_GFX_INIT
|
||||||
|
|
||||||
|
config NO_EARLY_GFX_INIT
|
||||||
|
bool "None"
|
||||||
|
help
|
||||||
|
Select this to not perform any graphics initialization at
|
||||||
|
romstage.
|
||||||
|
|
||||||
|
config MAINBOARD_USE_EARLY_LIBGFXINIT
|
||||||
|
bool "Use libgfxinit"
|
||||||
|
depends on MAINBOARD_HAS_EARLY_LIBGFXINIT
|
||||||
|
select ROMSTAGE_VGA
|
||||||
|
help
|
||||||
|
Use the SPARK library `libgfxinit` for the romstage native
|
||||||
|
graphics initialization. This requires an Ada
|
||||||
|
toolchain. Graphics at romstage is limited to VGA text mode.
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
config PRE_GRAPHICS_DELAY_MS
|
config PRE_GRAPHICS_DELAY_MS
|
||||||
int "Graphics initialization delay in ms"
|
int "Graphics initialization delay in ms"
|
||||||
default 0
|
default 0
|
||||||
|
@@ -90,15 +90,31 @@ config GFX_GMA
|
|||||||
depends on MAINBOARD_USE_LIBGFXINIT || INTEL_GMA_LIBGFXINIT_EDID
|
depends on MAINBOARD_USE_LIBGFXINIT || INTEL_GMA_LIBGFXINIT_EDID
|
||||||
select RAMSTAGE_LIBHWBASE
|
select RAMSTAGE_LIBHWBASE
|
||||||
|
|
||||||
|
config EARLY_GFX_GMA
|
||||||
|
def_bool y
|
||||||
|
depends on SOC_INTEL_ALDERLAKE
|
||||||
|
depends on MAINBOARD_USE_EARLY_LIBGFXINIT
|
||||||
|
select ROMSTAGE_LIBHWBASE
|
||||||
|
|
||||||
|
config GFX_GMA_DEFAULT_MMIO
|
||||||
|
hex
|
||||||
|
depends on HWBASE_STATIC_MMIO && (GFX_GMA || EARLY_GFX_GMA)
|
||||||
|
help
|
||||||
|
Graphics device MMIO address. This is typically an unused
|
||||||
|
memory mapping region which can be allocated to the MMIO
|
||||||
|
region as graphics PCI device Base Address Range zero.
|
||||||
|
|
||||||
config GFX_GMA_PANEL_1_ON_EDP
|
config GFX_GMA_PANEL_1_ON_EDP
|
||||||
bool
|
bool
|
||||||
depends on GFX_GMA || MAINBOARD_HAS_LIBGFXINIT
|
depends on GFX_GMA || MAINBOARD_HAS_LIBGFXINIT \
|
||||||
|
|| MAINBOARD_HAS_EARLY_LIBGFXINIT
|
||||||
default n if GFX_GMA_PANEL_1_ON_LVDS
|
default n if GFX_GMA_PANEL_1_ON_LVDS
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config GFX_GMA_PANEL_1_ON_LVDS
|
config GFX_GMA_PANEL_1_ON_LVDS
|
||||||
bool
|
bool
|
||||||
depends on GFX_GMA || MAINBOARD_HAS_LIBGFXINIT
|
depends on GFX_GMA || MAINBOARD_HAS_LIBGFXINIT \
|
||||||
|
|| MAINBOARD_HAS_EARLY_LIBGFXINIT
|
||||||
default y if NORTHBRIDGE_INTEL_GM45 || NORTHBRIDGE_INTEL_IRONLAKE
|
default y if NORTHBRIDGE_INTEL_GM45 || NORTHBRIDGE_INTEL_IRONLAKE
|
||||||
default n
|
default n
|
||||||
|
|
||||||
@@ -111,7 +127,7 @@ config INTEL_GMA_OPREGION_2_1
|
|||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
||||||
if GFX_GMA
|
if GFX_GMA || EARLY_GFX_GMA
|
||||||
|
|
||||||
config GFX_GMA_DYN_CPU
|
config GFX_GMA_DYN_CPU
|
||||||
def_bool y
|
def_bool y
|
||||||
|
@@ -20,24 +20,39 @@ endif
|
|||||||
|
|
||||||
$(call add_vbt_to_cbfs, vbt.bin, $(call strip_quotes,$(CONFIG_INTEL_GMA_VBT_FILE)))
|
$(call add_vbt_to_cbfs, vbt.bin, $(call strip_quotes,$(CONFIG_INTEL_GMA_VBT_FILE)))
|
||||||
|
|
||||||
ifeq ($(CONFIG_GFX_GMA),y)
|
ifneq (,$(filter y, $(CONFIG_GFX_GMA) $(CONFIG_EARLY_GFX_GMA)))
|
||||||
|
|
||||||
|
gfx-gma-stages = \
|
||||||
|
$(if $(filter y,$(CONFIG_EARLY_GFX_GMA)),romstage) \
|
||||||
|
$(if $(filter y,$(CONFIG_GFX_GMA)),ramstage) \
|
||||||
|
|
||||||
$(call add-special-class,gfxinit)
|
$(call add-special-class,gfxinit)
|
||||||
gfxinit-handler = $(eval ramstage-srcs += $(1)$(2))
|
gfxinit-handler +=$(foreach stage, $(gfx-gma-stages), \
|
||||||
|
$(eval $(stage)-srcs += $$(addprefix $(1),$(2))))
|
||||||
|
|
||||||
$(call add-special-class,gfxinit-gen)
|
$(call add-special-class,gfxinit-gen)
|
||||||
gfxinit-gen-handler = \
|
gfxinit-gen-handler += \
|
||||||
$(eval additional-dirs += $(dir $(2))) \
|
$(eval additional-dirs += $(dir $(2))) \
|
||||||
$(eval ramstage-srcs += $(2)) \
|
$(foreach stage, $(gfx-gma-stages), \
|
||||||
$(eval ramstage-ads-deps += $(2)) \
|
$(eval $(stage)-srcs += $(2)) \
|
||||||
$(eval ramstage-adb-deps += $(2)) \
|
$(eval $(stage)-ads-deps += $(2)) \
|
||||||
|
$(eval $(stage)-adb-deps += $(2))) \
|
||||||
$(eval $(2): $(obj)/config.h)
|
$(eval $(2): $(obj)/config.h)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_GFX_GMA_DEFAULT_MMIO),)
|
||||||
CONFIG_GFX_GMA_DEFAULT_MMIO := 0 # dummy, will be overwritten at runtime
|
CONFIG_GFX_GMA_DEFAULT_MMIO := 0 # dummy, will be overwritten at runtime
|
||||||
|
else
|
||||||
|
$(call to-ada-hex,CONFIG_GFX_GMA_DEFAULT_MMIO)
|
||||||
|
endif
|
||||||
|
|
||||||
subdirs-y += ../../../../3rdparty/libgfxinit
|
subdirs-y += ../../../../3rdparty/libgfxinit
|
||||||
|
|
||||||
ramstage-y += gma.ads gma.adb
|
$(foreach stage,$(gfx-gma-stages), \
|
||||||
|
$(eval $(stage)-y += gma.ads gma.adb))
|
||||||
|
|
||||||
|
endif # CONFIG_GFX_GMA || CONFIG_EARLY_GFX_GMA
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_GFX_GMA),y)
|
||||||
|
|
||||||
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-gfx_init.ads
|
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-gfx_init.ads
|
||||||
ifeq ($(CONFIG_LINEAR_FRAMEBUFFER),y)
|
ifeq ($(CONFIG_LINEAR_FRAMEBUFFER),y)
|
||||||
@@ -47,3 +62,11 @@ ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += text_fb/gma-gfx_init.adb
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
endif # CONFIG_GFX_GMA
|
endif # CONFIG_GFX_GMA
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_EARLY_GFX_GMA),y)
|
||||||
|
|
||||||
|
romstage-$(CONFIG_MAINBOARD_USE_EARLY_LIBGFXINIT) += \
|
||||||
|
gma-gfx_init.ads \
|
||||||
|
text_fb/gma-gfx_init.adb
|
||||||
|
|
||||||
|
endif # CONFIG_EARLY_GFX_GMA
|
||||||
|
@@ -173,6 +173,18 @@ static void graphics_dev_read_resources(struct device *dev)
|
|||||||
if (res_bar0->flags & IORESOURCE_PREFETCH)
|
if (res_bar0->flags & IORESOURCE_PREFETCH)
|
||||||
res_bar0->flags &= ~IORESOURCE_PREFETCH;
|
res_bar0->flags &= ~IORESOURCE_PREFETCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If libhwbase static MMIO driver is used, IGD BAR 0 has to be set to
|
||||||
|
* CONFIG_GFX_GMA_DEFAULT_MMIO for the libgfxinit to operate properly.
|
||||||
|
*/
|
||||||
|
if (CONFIG(MAINBOARD_USE_LIBGFXINIT) && CONFIG(HWBASE_STATIC_MMIO)) {
|
||||||
|
struct resource *res_bar0 = find_resource(dev, PCI_BASE_ADDRESS_0);
|
||||||
|
res_bar0->base = CONFIG_GFX_GMA_DEFAULT_MMIO;
|
||||||
|
res_bar0->flags |= IORESOURCE_ASSIGNED;
|
||||||
|
pci_dev_set_resources(dev);
|
||||||
|
res_bar0->flags |= IORESOURCE_FIXED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct device_operations graphics_ops = {
|
const struct device_operations graphics_ops = {
|
||||||
|
Reference in New Issue
Block a user