summaryrefslogtreecommitdiff
path: root/src/northbridge/intel/gm45/igd.c
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2017-06-13 20:57:05 +0200
committerNico Huber <nico.h@gmx.de>2017-06-15 00:35:35 +0200
commitd65ff229882ef0e3dad27867125cab681c7b7aec (patch)
tree13ec0c6574d6ccee4b958c52d924487a6e1cd542 /src/northbridge/intel/gm45/igd.c
parent660de34bbf0c9843120ffa2e861d26718e3205e3 (diff)
downloadcoreboot-d65ff229882ef0e3dad27867125cab681c7b7aec.tar.xz
nb/intel/gm45: Don't allow too low values for gfx_uma_size
Too low gfx_uma_size can result in problems if the framebuffer does not fit. This partially reverts: 7afcfe0 "gm45: enable setting all vram sizes from cmos" Change-Id: I485d24198cb784db5d2cfce0a8646e861a4a1695 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/20194 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/northbridge/intel/gm45/igd.c')
-rw-r--r--src/northbridge/intel/gm45/igd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/northbridge/intel/gm45/igd.c b/src/northbridge/intel/gm45/igd.c
index 1164339c8a..45144aae2e 100644
--- a/src/northbridge/intel/gm45/igd.c
+++ b/src/northbridge/intel/gm45/igd.c
@@ -153,17 +153,16 @@ void igd_compute_ggc(sysinfo_t *const sysinfo)
if (!sysinfo->enable_igd || (capid & (1 << (33 - 32))))
sysinfo->ggc = 0x0002;
else {
- u8 gfxsize;
+ /* 4 for 32MB, default if not set in cmos */
+ u8 gfxsize = 4;
/* Graphics Stolen Memory: 2MB GTT (0x0300) when VT-d disabled,
2MB GTT + 2MB shadow GTT (0x0b00) else. */
- if (get_option(&gfxsize, "gfx_uma_size") != CB_SUCCESS) {
- /* 4 for 32MB, default if not set in cmos */
- gfxsize = 4;
- }
+ get_option(&gfxsize, "gfx_uma_size");
/* Handle invalid cmos settings */
- if (gfxsize > 12)
- gfxsize = 4;
+ /* Only allow settings between 32MB and 352MB */
+ gfxsize = MIN(MAX(gfxsize, 4), 12);
+
sysinfo->ggc = 0x0300 | ((gfxsize + 1) << 4);
if (!(capid & (1 << (48 - 32))))
sysinfo->ggc |= 0x0800;