Aaron Durbin (adurbin@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5168
-gerrit
commit d0b4a1d220b706e512adfdf60090fac9b840ba93 Author: Aaron Durbin adurbin@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@chromium.org --- src/cpu/x86/mtrr/mtrr.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c index dfb9c94..ab9e5b2 100644 --- a/src/cpu/x86/mtrr/mtrr.c +++ b/src/cpu/x86/mtrr/mtrr.c @@ -154,6 +154,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(add_space, res->base, res->size, MTRR_TYPE_WRCOMB); +} + static struct memranges *get_physical_address_space(void) { static struct memranges *addr_space; @@ -181,8 +197,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