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)
This commit is contained in:
Aaron Durbin
2014-02-08 15:41:52 -06:00
committed by Aaron Durbin
parent 892728c65f
commit ca4f4b8c9e
3 changed files with 45 additions and 6 deletions

View File

@@ -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,