From a1777f7f6462c66e1ee6e98f0d5c431bfe988aa5 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Mon, 4 Jul 2016 13:06:35 +0100 Subject: memory: Provide memory_region_init_rom() Provide a new helper function memory_region_init_rom() for memory regions which are read-only (and unlike those created by memory_region_init_rom_device() don't have special behaviour for writes). This has the same behaviour as calling memory_region_init_ram() and then memory_region_set_readonly() (which is what we do today in boards with pure ROMs) but is a more easily discoverable API for the purpose. Signed-off-by: Peter Maydell Message-id: 1467122287-24974-2-git-send-email-peter.maydell@linaro.org --- include/exec/memory.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/exec/memory.h') diff --git a/include/exec/memory.h b/include/exec/memory.h index 23c7399131..2d9ea3c088 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -444,6 +444,25 @@ void memory_region_init_alias(MemoryRegion *mr, hwaddr offset, uint64_t size); +/** + * memory_region_init_rom: Initialize a ROM memory region. + * + * This has the same effect as calling memory_region_init_ram() + * and then marking the resulting region read-only with + * memory_region_set_readonly(). + * + * @mr: the #MemoryRegion to be initialized. + * @owner: the object that tracks the region's reference count + * @name: the name of the region. + * @size: size of the region. + * @errp: pointer to Error*, to store an error if it happens. + */ +void memory_region_init_rom(MemoryRegion *mr, + struct Object *owner, + const char *name, + uint64_t size, + Error **errp); + /** * memory_region_init_rom_device: Initialize a ROM memory region. Writes are * handled via callbacks. -- cgit v1.2.3