From ca4f4b8c9eef77fbcad0af3b21885a337a1f2c83 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Sat, 8 Feb 2014 15:41:52 -0600 Subject: 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 Reviewed-on: http://review.coreboot.org/5169 Reviewed-by: Vladimir Serbinenko Tested-by: build bot (Jenkins) --- src/include/memrange.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/include/memrange.h') 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, -- cgit v1.2.3