diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-03-27 01:03:45 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2015-05-14 17:27:25 +0200 |
commit | b419c1a87ccb2037a88ffb533b5b4a11cfa387c0 (patch) | |
tree | 35fc1d38aa3827a9e154a650353a702cf2c8e907 /src/include/region.h | |
parent | 127525c772f82a214a13899a344c5fa24f4f10a8 (diff) | |
download | coreboot-b419c1a87ccb2037a88ffb533b5b4a11cfa387c0.tar.xz |
regions: add memory region device support
Provide common code for using memory-backed region devices.
This allows in-memory buffers to act as a region device.
Change-Id: I266cd07bbfa16a427c2b31c512e7c87b77f47718
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9131
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/include/region.h')
-rw-r--r-- | src/include/region.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/include/region.h b/src/include/region.h index cb911023b3..ed0ad57a28 100644 --- a/src/include/region.h +++ b/src/include/region.h @@ -97,4 +97,23 @@ static inline size_t region_sz(const struct region *r) return r->size; } +struct mem_region_device { + char *base; + struct region_device rdev; +}; + +/* Iniitalize at runtime a mem_region_device. This would be used when + * the base and size are dynamic or can't be known during linking. */ +void mem_region_device_init(struct mem_region_device *mdev, void *base, + size_t size); + +extern const struct region_device_ops mem_rdev_ops; + +/* Statically initialize mem_region_device. */ +#define MEM_REGION_DEV_INIT(base_, size_) \ + { \ + .base = (void *)(base_), \ + .rdev = REGION_DEV_INIT(&mem_rdev_ops, 0, (size_)), \ + } + #endif /* _REGION_H_ */ |