[coreboot-gerrit] Patch set updated for coreboot: fe423d5 mtrr: only add prefetchable resources as WRCOMB for VGA devices

Aaron Durbin (adurbin@google.com) gerrit at coreboot.org
Sat Feb 8 22:49:14 CET 2014


Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5168

-gerrit

commit fe423d57f9f87696d3bc0e2f387e02b85771a734
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Sat Feb 8 15:41:52 2014 -0600

    mtrr: only add prefetchable resources as WRCOMB for VGA devices
    
    Be more conservative and only add VGA devices' prefetchable
    resources as write-combining in the address space.
    
    Change-Id: Id3d54a573a75b883286ef47759fbffa922b4a791
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 src/cpu/x86/mtrr/mtrr.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c
index dfb9c94..6835d9a 100644
--- a/src/cpu/x86/mtrr/mtrr.c
+++ b/src/cpu/x86/mtrr/mtrr.c
@@ -30,6 +30,7 @@
 #include <bootstate.h>
 #include <console/console.h>
 #include <device/device.h>
+#include <device/pci_ids.h>
 #include <cpu/cpu.h>
 #include <cpu/x86/msr.h>
 #include <cpu/x86/mtrr.h>
@@ -154,6 +155,22 @@ static inline int range_entry_mtrr_type(struct range_entry *r)
 	return range_entry_tag(r) & MTRR_TAG_MASK;
 }
 
+static void add_vga_wrcomb(void *gp, struct device *dev, struct resource *res)
+{
+	struct memranges *addr_space = gp;
+
+	/* Only handle PCI devices. */
+	if (dev->path.type != DEVICE_PATH_PCI)
+		return;
+
+	/* Only handle VGA class devices. */
+	if (((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA))
+		return;
+
+	/* Add resource as write-combining in the address space. */
+	memranges_insert(addr_space, res->base, res->size, MTRR_TYPE_WRCOMB);
+}
+
 static struct memranges *get_physical_address_space(void)
 {
 	static struct memranges *addr_space;
@@ -181,8 +198,7 @@ static struct memranges *get_physical_address_space(void)
 		 * resources are appropriate for this MTRR type. */
 		match = IORESOURCE_PREFETCH;
 		mask |= match;
-		memranges_add_resources(addr_space, mask, match,
-		                        MTRR_TYPE_WRCOMB);
+		search_global_resources(mask, match, add_vga_wrcomb, addr_space);
 
 #if CONFIG_CACHE_ROM
 		/* Add a write-protect region covering the ROM size



More information about the coreboot-gerrit mailing list