[coreboot-gerrit] New patch to review for coreboot: nb/x4x/nortbridge.c: Fix resource allocation when IGD is disabled

Arthur Heymans (arthur@aheymans.xyz) gerrit at coreboot.org
Mon Feb 27 13:50:11 CET 2017


Arthur Heymans (arthur at aheymans.xyz) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18511

-gerrit

commit 372084bfb48d9354edbe8e1b358d05fb349f18d4
Author: Arthur Heymans <arthur at aheymans.xyz>
Date:   Mon Feb 27 13:46:11 2017 +0100

    nb/x4x/nortbridge.c: Fix resource allocation when IGD is disabled
    
    Shamelessly copied from gm45
    
    Change-Id: I0e6898c06a2bc1016eeaa3f002ff6c39657018ae
    Signed-off-by: Arthur Heymans <arthur at aheymans.xyz>
---
 src/northbridge/intel/x4x/northbridge.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/northbridge/intel/x4x/northbridge.c b/src/northbridge/intel/x4x/northbridge.c
index 1c220b2..760e875 100644
--- a/src/northbridge/intel/x4x/northbridge.c
+++ b/src/northbridge/intel/x4x/northbridge.c
@@ -64,18 +64,25 @@ static void mch_domain_read_resources(device_t dev)
 
 	/* Graphics memory comes next */
 	const u16 ggc = pci_read_config16(dev, D0F0_GGC);
-	printk(BIOS_DEBUG, "IGD decoded, subtracting ");
+	if (!(ggc & 2)) {
+		printk(BIOS_DEBUG, "IGD decoded, subtracting ");
 
-	/* Graphics memory */
-	const u32 gms_sizek = decode_igd_memory_size((ggc >> 4) & 0xf);
-	printk(BIOS_DEBUG, "%uM UMA", gms_sizek >> 10);
+		/* Graphics memory */
+		const u32 gms_sizek = decode_igd_memory_size((ggc >> 4) & 0xf);
+		printk(BIOS_DEBUG, "%uM UMA", gms_sizek >> 10);
+		tomk -= gms_sizek;
 
-	/* GTT Graphics Stolen Memory Size (GGMS) */
-	const u32 gsm_sizek = decode_igd_gtt_size((ggc >> 8) & 0xf);
-	printk(BIOS_DEBUG, " and %uM GTT\n", gsm_sizek >> 10);
+		/* GTT Graphics Stolen Memory Size (GGMS) */
+		const u32 gsm_sizek = decode_igd_gtt_size((ggc >> 8) & 0xf);
+		printk(BIOS_DEBUG, " and %uM GTT\n", gsm_sizek >> 10);
+		tomk -= gms_sizek;
 
-	uma_sizek = gms_sizek + gsm_sizek + tseg_sizek;
-	usable_tomk = tomk - uma_sizek;
+		uma_sizek = gms_sizek + gsm_sizek + tseg_sizek;
+	}
+
+	usable_tomk = ALIGN_DOWN(tomk, 64 << 10);
+	if (tomk - usable_tomk > (16 << 10))
+		usable_tomk = tomk;
 
 	printk(BIOS_INFO, "Available memory below 4GB: %uM\n", usable_tomk >> 10);
 



More information about the coreboot-gerrit mailing list