summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-02-08 15:41:52 -0600
committerAaron Durbin <adurbin@google.com>2014-02-09 22:08:53 +0100
commitca4f4b8c9eef77fbcad0af3b21885a337a1f2c83 (patch)
treed6d185b7a25c9a1f8c0e6105f34178cb0658ba71 /src/include
parent892728c65fcd82cab43e334396b86fc257ecf256 (diff)
downloadcoreboot-ca4f4b8c9eef77fbcad0af3b21885a337a1f2c83.tar.xz
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. Previously all prefetchable memory was added as a write-combining memory type. Some hardware incorrectly advertises its BAR as prefetchable when it shouldn't be. A new memranges_add_resources_filter() function is added to provide additional filtering on device and resource. Change-Id: I3fc55b90d8c5b694c5aa9e2f34db1b4ef845ce10 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/5169 Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/memrange.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/include/memrange.h b/src/include/memrange.h
index 4f094f593e..ba85bef4d9 100644
--- a/src/include/memrange.h
+++ b/src/include/memrange.h
@@ -94,6 +94,19 @@ void memranges_add_resources(struct memranges *ranges,
unsigned long mask, unsigned long match,
unsigned long tag);
+/* Add memory resources that match with the corresponding mask and match but
+ * also provide filter as additional check. The filter will return non-zero
+ * to add the resource or zero to not add the resource. Each entry will be
+ * tagged with the provided tag. e.g. To populate all cacheable memory
+ * resources in the range with a filter:
+ * memranges_add_resources_filter(range, IORESOURCE_CACHEABLE,
+ * IORESROUCE_CACHEABLE, my_cacheable_tag, filter); */
+typedef int (*memrange_filter_t)(struct device *dev, struct resource *res);
+void memranges_add_resources_filter(struct memranges *ranges,
+ unsigned long mask, unsigned long match,
+ unsigned long tag,
+ memrange_filter_t filter);
+
/* Fill all address ranges up to limit (exclusive) not covered by an entry by
* inserting new entries with the provided tag. */
void memranges_fill_holes_up_to(struct memranges *ranges,