From 1a4496e79f21bef12efc8c6748264a8770266a27 Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Sat, 20 Jun 2020 17:26:21 +0300 Subject: [PATCH] soc/{apl,glk}: Allow to select the primary graphics device Allow to select the primary graphics device between the IGD and the external PCIe GPU depending on the ONBOARD_VGA_IS_PRIMARY config. The option sets the priority only. This means that if a high priority is set for an external PCI device and it is not connected/not enabled, then the device with a lower priority will be used, in our case it is IGD. TEST = Set PRIMARY_PCI and boot Linux on the Kontron mAL10 [1] with the miniPCIe video adapter on the Silicon Motion SM750 controller. As a result, the display connected to an external GPU device shows the Tianocore logo + setup menu and the desktop. [1] https://review.coreboot.org/c/coreboot/+/39133 Change-Id: Idcd117217cf412ee0722aff52db4b3c8ec2a226c Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/39374 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber Reviewed-by: Mario Scheithauer --- src/soc/intel/apollolake/romstage.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/soc/intel/apollolake/romstage.c b/src/soc/intel/apollolake/romstage.c index 13a55dc3b5..1c92b89347 100644 --- a/src/soc/intel/apollolake/romstage.c +++ b/src/soc/intel/apollolake/romstage.c @@ -229,6 +229,19 @@ static void check_full_retrain(const FSPM_UPD *mupd) } } +static void soc_gpu_init_params(FSPM_UPD *mupd) +{ + enum { + GPU_PRIMARY_IGD = 2, + GPU_PRIMARY_PCI = 3, + }; + /* Select primary GPU device */ + if (CONFIG(ONBOARD_VGA_IS_PRIMARY) && is_devfn_enabled(SA_DEVFN_IGD)) + mupd->FspmConfig.PrimaryVideoAdaptor = GPU_PRIMARY_IGD; + else + mupd->FspmConfig.PrimaryVideoAdaptor = GPU_PRIMARY_PCI; +} + static void soc_memory_init_params(FSPM_UPD *mupd) { #if CONFIG(SOC_INTEL_GEMINILAKE) @@ -268,6 +281,7 @@ void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version) check_full_retrain(mupd); fill_console_params(mupd); + soc_gpu_init_params(mupd); if (CONFIG(SOC_INTEL_GEMINILAKE)) soc_memory_init_params(mupd);