There are some issues with linux-geode not accepting messages with multiple recipients so I'm having to forward these to the list... Please add back the original recipients when replying.
==== Original message follows ==== From: Philip Prindeville <[email protected]> Date: Sun, 18 Dec 2011 12:05:32 -0700 Subject: [PATCH 1/4] resource.c: find the end of a E820 memory region To: Ed Wildgoose <[email protected]>, Andrew Morton <[email protected]>, [email protected], Andres Salomon <[email protected]> Cc: Nathan Williams <[email protected]>, Guy Ellis <[email protected]>, David Woodhouse <[email protected]>, Patrick Georgi <[email protected]>, Carl-Daniel Hailfinger <[email protected]>, [email protected] Add support for finding the end-boundary of an E820 region given an address falling in one such region. This is precursory functionality for Coreboot loader support. Signed-off-by: Philip Prindeville <[email protected]> Reviewed-by: Ed Wildgoose <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Andres Salomon <[email protected]> Cc: Nathan Williams <[email protected]> Cc: Guy Ellis <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Patrick Georgi <[email protected]> Cc: Carl-Daniel Hailfinger <[email protected]> Cc: [email protected] Cc: [email protected] --- include/linux/ioport.h | 1 + kernel/resource.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 9d57a71..962d5a5 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -223,6 +223,7 @@ extern struct resource * __devm_request_region(struct device *dev, extern void __devm_release_region(struct device *dev, struct resource *parent, resource_size_t start, resource_size_t n); extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size); +extern resource_size_t iomem_map_find_boundary(resource_size_t addr, int *mapped); extern int iomem_is_exclusive(u64 addr); extern int diff --git a/kernel/resource.c b/kernel/resource.c index 7640b3a..58e4fce 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -1057,6 +1057,35 @@ static int __init reserve_setup(char *str) __setup("reserve=", reserve_setup); /* + * Find the upper boundary for the region that this address falls in, and + * whether it's currently mapped or not. + */ + +resource_size_t iomem_map_find_boundary(resource_size_t addr, int *mapped) +{ + struct resource *p = &iomem_resource; + resource_size_t upper = 0; + loff_t l; + + read_lock(&resource_lock); + for (p = p->child; p ; p = r_next(NULL, p, &l)) { + if (p->start > addr) + continue; + if (p->end < addr) + continue; + upper = p->end; + *mapped = ((p->flags & IORESOURCE_BUSY) != 0); + break; + } + read_unlock(&resource_lock); + + return upper; +} + +EXPORT_SYMBOL(iomem_map_find_boundary); + + +/* * Check if the requested addr and size spans more than any slot in the * iomem resource tree. */ -- 1.7.7.4 _______________________________________________ Linux-geode mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-geode
