Lines Matching +full:rom +full:-
4 * Copyright (C) 2013-2014 Red Hat Inc
10 * See the COPYING file in the top-level directory.
15 #include "qemu/error-report.h"
22 #include "qapi/qapi-visit-common.h"
36 OnOffAuto rom; member
51 if (!backend->size) { in file_backend_memory_alloc()
55 if (!fb->mem_path) { in file_backend_memory_alloc()
56 error_setg(errp, "mem-path property not set"); in file_backend_memory_alloc()
60 switch (fb->rom) { in file_backend_memory_alloc()
62 /* Traditionally, opening the file readonly always resulted in ROM. */ in file_backend_memory_alloc()
63 fb->rom = fb->readonly ? ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF; in file_backend_memory_alloc()
66 if (!fb->readonly) { in file_backend_memory_alloc()
67 error_setg(errp, "property 'rom' = 'on' is not supported with" in file_backend_memory_alloc()
73 if (fb->readonly && backend->share) { in file_backend_memory_alloc()
74 error_setg(errp, "property 'rom' = 'off' is incompatible with" in file_backend_memory_alloc()
83 backend->aligned = true; in file_backend_memory_alloc()
85 ram_flags = backend->share ? RAM_SHARED : 0; in file_backend_memory_alloc()
86 ram_flags |= fb->readonly ? RAM_READONLY_FD : 0; in file_backend_memory_alloc()
87 ram_flags |= fb->rom == ON_OFF_AUTO_ON ? RAM_READONLY : 0; in file_backend_memory_alloc()
88 ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; in file_backend_memory_alloc()
89 ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0; in file_backend_memory_alloc()
90 ram_flags |= fb->is_pmem ? RAM_PMEM : 0; in file_backend_memory_alloc()
92 return memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), name, in file_backend_memory_alloc()
93 backend->size, fb->align, ram_flags, in file_backend_memory_alloc()
94 fb->mem_path, fb->offset, errp); in file_backend_memory_alloc()
102 return g_strdup(fb->mem_path); in get_mem_path()
111 error_setg(errp, "cannot change property 'mem-path' of %s", in set_mem_path()
115 g_free(fb->mem_path); in set_mem_path()
116 fb->mem_path = g_strdup(str); in set_mem_path()
121 return MEMORY_BACKEND_FILE(o)->discard_data; in file_memory_backend_get_discard_data()
127 MEMORY_BACKEND_FILE(o)->discard_data = value; in file_memory_backend_set_discard_data()
135 uint64_t val = fb->align; in file_memory_backend_get_align()
157 fb->align = val; in file_memory_backend_set_align()
165 uint64_t val = fb->offset; in file_memory_backend_get_offset()
187 fb->offset = val; in file_memory_backend_set_offset()
193 return MEMORY_BACKEND_FILE(o)->is_pmem; in file_memory_backend_get_pmem()
207 fb->is_pmem = value; in file_memory_backend_set_pmem()
215 return fb->readonly; in file_memory_backend_get_readonly()
230 fb->readonly = value; in file_memory_backend_set_readonly()
238 OnOffAuto rom = fb->rom; in file_memory_backend_get_rom() local
240 visit_type_OnOffAuto(v, name, &rom, errp); in file_memory_backend_get_rom()
256 visit_type_OnOffAuto(v, name, &fb->rom, errp); in file_memory_backend_set_rom()
264 if (host_memory_backend_mr_inited(backend) && fb->discard_data) { in file_backend_unparent()
265 void *ptr = memory_region_get_ram_ptr(&backend->mr); in file_backend_unparent()
266 uint64_t sz = memory_region_size(&backend->mr); in file_backend_unparent()
277 bc->alloc = file_backend_memory_alloc; in file_backend_class_init()
278 oc->unparent = file_backend_unparent; in file_backend_class_init()
280 object_class_property_add_bool(oc, "discard-data", in file_backend_class_init()
282 object_class_property_add_str(oc, "mem-path", in file_backend_class_init()
301 object_class_property_add(oc, "rom", "OnOffAuto", in file_backend_class_init()
303 object_class_property_set_description(oc, "rom", in file_backend_class_init()
304 "Whether to create Read Only Memory (ROM)"); in file_backend_class_init()
311 g_free(fb->mem_path); in file_backend_instance_finalize()