summaryrefslogtreecommitdiff
path: root/src/soc/intel/skylake
diff options
context:
space:
mode:
authorFelix Singer <felixsinger@posteo.net>2020-08-11 07:49:55 +0200
committerMichael Niewöhner <c0d3z3r0@review.coreboot.org>2020-08-14 21:00:33 +0000
commit736de9f2466a08d563cc9ed29c76d9d5f0cc2440 (patch)
tree5a6b0c4eac6b24cc5b4bc65f5df5130e392984ce /src/soc/intel/skylake
parent4e9687c4162257f52e1b19283e6f5bbe3244b9ed (diff)
downloadcoreboot-736de9f2466a08d563cc9ed29c76d9d5f0cc2440.tar.xz
soc/intel/skylake: Factor out unnecessary if-else-block
Move InternalGfx config option out of the if-else-block and replace the left over config option IgdDvmt50PreAlloc by a ternary expression. Also, adjust related code comments to fit the new logic of this code. This changes the logic of the code, since InternalGfx is configured first and IgdDvmt50PreAlloc depends on its value. The negation in the ternary expression is removed to improve the readability. Change-Id: I89ff17f4574a7ade228c1791f17ea072fb731775 Signed-off-by: Felix Singer <felixsinger@posteo.net> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44369 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michael Niewöhner
Diffstat (limited to 'src/soc/intel/skylake')
-rw-r--r--src/soc/intel/skylake/romstage/romstage.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/soc/intel/skylake/romstage/romstage.c b/src/soc/intel/skylake/romstage/romstage.c
index 7410925a1f..9add1e688f 100644
--- a/src/soc/intel/skylake/romstage/romstage.c
+++ b/src/soc/intel/skylake/romstage/romstage.c
@@ -247,25 +247,20 @@ static void soc_primary_gfx_config_params(FSP_M_CONFIG *m_cfg,
const struct device *dev;
dev = pcidev_path_on_root(SA_DEVFN_IGD);
- if (!dev || !dev->enabled) {
- /*
- * If iGPU is disabled or not defined in the devicetree.cb,
- * the FSP does not initialize this device
- */
- m_cfg->InternalGfx = 0;
- m_cfg->IgdDvmt50PreAlloc = 0;
- } else {
- m_cfg->InternalGfx = 1;
- /*
- * Set IGD stolen size to 64MB. The FBC hardware for skylake
- * does not have access to the bios_reserved range so it always
- * assumes 8MB is used and so the kernel will avoid the last
- * 8MB of the stolen window. With the default stolen size of
- * 32MB(-8MB) there is not enough space for FBC to work with
- * a high resolution panel
- */
- m_cfg->IgdDvmt50PreAlloc = 2;
- }
+ m_cfg->InternalGfx = dev && dev->enabled;
+
+ /*
+ * If iGPU is enabled, set IGD stolen size to 64MB. The FBC
+ * hardware for skylake does not have access to the bios
+ * reserved range so it always assumes 8MB is used and so the
+ * kernel will avoid the last 8MB of the stolen window. With
+ * the default stolen size of 32MB(-8MB) there is not enough
+ * space for FBC to work with a high resolution panel.
+ *
+ * If disabled, don't reserve memory for it.
+ */
+ m_cfg->IgdDvmt50PreAlloc = m_cfg->InternalGfx ? 2 : 0;
+
m_cfg->PrimaryDisplay = config->PrimaryDisplay;
}