aboutsummaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-03-27 01:58:06 -0500
committerAaron Durbin <adurbin@chromium.org>2015-05-14 17:27:36 +0200
commite62cf5210c0c4b51bab803c7a3c8134da866da2b (patch)
tree00af06cce5d475755cd3a9f98ec80911654d2eb3 /src/include
parentb419c1a87ccb2037a88ffb533b5b4a11cfa387c0 (diff)
downloadcoreboot-e62cf5210c0c4b51bab803c7a3c8134da866da2b.tar.gz
coreboot-e62cf5210c0c4b51bab803c7a3c8134da866da2b.tar.xz
coreboot-e62cf5210c0c4b51bab803c7a3c8134da866da2b.zip
regions: add mmap helper device
In order to facilitate platforms which need a buffer cache for performing boot device operations provide infrastructure to share the logic in managing the buffer and operations. Change-Id: I45dd9f213029706ff92a3e5a2c9edd5e8b541e27 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9132 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/region.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/include/region.h b/src/include/region.h
index ed0ad57a2..99ea488cc 100644
--- a/src/include/region.h
+++ b/src/include/region.h
@@ -22,6 +22,7 @@
#include <stdint.h>
#include <stddef.h>
+#include <mem_pool.h>
/*
* Region support.
@@ -116,4 +117,20 @@ extern const struct region_device_ops mem_rdev_ops;
.rdev = REGION_DEV_INIT(&mem_rdev_ops, 0, (size_)), \
}
+struct mmap_helper_region_device {
+ struct mem_pool pool;
+ struct region_device rdev;
+};
+
+#define MMAP_HELPER_REGION_INIT(ops_, offset_, size_) \
+ { \
+ .rdev = REGION_DEV_INIT((ops_), (offset_), (size_)), \
+ }
+
+void mmap_helper_device_init(struct mmap_helper_region_device *mdev,
+ void *cache, size_t cache_size);
+
+void *mmap_helper_rdev_mmap(const struct region_device *, size_t, size_t);
+int mmap_helper_rdev_munmap(const struct region_device *, void *);
+
#endif /* _REGION_H_ */