aboutsummaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-05-15 13:23:49 -0500
committerPatrick Georgi <pgeorgi@google.com>2015-05-19 10:36:43 +0200
commite645bcae7ccf1d7e4e75aa7d9149df5dae1d19c4 (patch)
tree333f4df246ad5ce0026e9d7879c300cc2f5d5791 /src/include
parentc877149e9d46b0de4bc709faf3cfb4f0a23c9cc5 (diff)
downloadcoreboot-e645bcae7ccf1d7e4e75aa7d9149df5dae1d19c4.tar.gz
coreboot-e645bcae7ccf1d7e4e75aa7d9149df5dae1d19c4.tar.xz
coreboot-e645bcae7ccf1d7e4e75aa7d9149df5dae1d19c4.zip
regions: add more helpers
Fill out functions to get the offset and size for both regions and region_devices. Additionally add a helper for memory mapping an entire region_device. Change-Id: I8896eaf5b29e4a67470f4adc6f5b541566cb93b5 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/10215 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/region.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/include/region.h b/src/include/region.h
index 99ea488cc..82db85499 100644
--- a/src/include/region.h
+++ b/src/include/region.h
@@ -93,11 +93,32 @@ struct region_device {
}, \
}
+static inline size_t region_offset(const struct region *r)
+{
+ return r->offset;
+}
+
static inline size_t region_sz(const struct region *r)
{
return r->size;
}
+static inline size_t region_device_sz(const struct region_device *rdev)
+{
+ return region_sz(&rdev->region);
+}
+
+static inline size_t region_device_offset(const struct region_device *rdev)
+{
+ return region_offset(&rdev->region);
+}
+
+/* Memory map entire region device. Same semantics as rdev_mmap() above. */
+static inline void *rdev_mmap_full(const struct region_device *rd)
+{
+ return rdev_mmap(rd, 0, region_device_sz(rd));
+}
+
struct mem_region_device {
char *base;
struct region_device rdev;