Lines Matching +full:reg +full:- +full:data
23 static inline void register_write_val(RegisterInfo *reg, uint64_t val) in register_write_val() argument
25 g_assert(reg->data); in register_write_val()
27 switch (reg->data_size) { in register_write_val()
29 *(uint8_t *)reg->data = val; in register_write_val()
32 *(uint16_t *)reg->data = val; in register_write_val()
35 *(uint32_t *)reg->data = val; in register_write_val()
38 *(uint64_t *)reg->data = val; in register_write_val()
45 static inline uint64_t register_read_val(RegisterInfo *reg) in register_read_val() argument
47 switch (reg->data_size) { in register_read_val()
49 return *(uint8_t *)reg->data; in register_read_val()
51 return *(uint16_t *)reg->data; in register_read_val()
53 return *(uint32_t *)reg->data; in register_read_val()
55 return *(uint64_t *)reg->data; in register_read_val()
71 void register_write(RegisterInfo *reg, uint64_t val, uint64_t we, in register_write() argument
77 assert(reg); in register_write()
79 ac = reg->access; in register_write()
81 if (!ac || !ac->name) { in register_write()
87 old_val = reg->data ? register_read_val(reg) : ac->reset; in register_write()
89 test = (old_val ^ val) & ac->rsvd; in register_write()
95 test = val & ac->unimp; in register_write()
100 prefix, reg->access->name, val, ac->unimp); in register_write()
106 no_w_mask = ac->ro | ac->w1c | ac->rsvd | ~we; in register_write()
108 new_val &= ~(val & ac->w1c); in register_write()
110 if (ac->pre_write) { in register_write()
111 new_val = ac->pre_write(reg, new_val); in register_write()
115 qemu_log("%s:%s: write of value 0x%" PRIx64 "\n", prefix, ac->name, in register_write()
119 register_write_val(reg, new_val); in register_write()
121 if (ac->post_write) { in register_write()
122 ac->post_write(reg, new_val); in register_write()
126 uint64_t register_read(RegisterInfo *reg, uint64_t re, const char* prefix, in register_read() argument
132 assert(reg); in register_read()
134 ac = reg->access; in register_read()
135 if (!ac || !ac->name) { in register_read()
141 ret = reg->data ? register_read_val(reg) : ac->reset; in register_read()
143 register_write_val(reg, ret & ~(ac->cor & re)); in register_read()
148 if (ac->post_read) { in register_read()
149 ret = ac->post_read(reg, ret); in register_read()
154 ac->name, ret); in register_read()
160 void register_reset(RegisterInfo *reg) in register_reset() argument
164 g_assert(reg); in register_reset()
166 if (!reg->data || !reg->access) { in register_reset()
170 ac = reg->access; in register_reset()
172 register_write_val(reg, reg->access->reset); in register_reset()
174 if (ac->post_write) { in register_reset()
175 ac->post_write(reg, reg->access->reset); in register_reset()
183 RegisterInfo *reg = NULL; in register_write_memory() local
187 for (i = 0; i < reg_array->num_elements; i++) { in register_write_memory()
188 if (reg_array->r[i]->access->addr == addr) { in register_write_memory()
189 reg = reg_array->r[i]; in register_write_memory()
194 if (!reg) { in register_write_memory()
196 "at address: 0x%" PRIx64 "\n", reg_array->prefix, addr); in register_write_memory()
201 we = register_enabled_mask(reg->data_size, size); in register_write_memory()
203 register_write(reg, value, we, reg_array->prefix, in register_write_memory()
204 reg_array->debug); in register_write_memory()
211 RegisterInfo *reg = NULL; in register_read_memory() local
216 for (i = 0; i < reg_array->num_elements; i++) { in register_read_memory()
217 if (reg_array->r[i]->access->addr == addr) { in register_read_memory()
218 reg = reg_array->r[i]; in register_read_memory()
223 if (!reg) { in register_read_memory()
225 "at address: 0x%" PRIx64 "\n", reg_array->prefix, addr); in register_read_memory()
230 re = register_enabled_mask(reg->data_size, size); in register_read_memory()
232 read_val = register_read(reg, re, reg_array->prefix, in register_read_memory()
233 reg_array->debug); in register_read_memory()
241 void *data, in register_init_block() argument
252 r_array->r = g_new0(RegisterInfo *, num); in register_init_block()
253 r_array->num_elements = num; in register_init_block()
254 r_array->debug = debug_enabled; in register_init_block()
255 r_array->prefix = device_prefix; in register_init_block()
265 r->data = data + data_size * index; in register_init_block()
266 r->data_size = data_size; in register_init_block()
267 r->access = &rae[i]; in register_init_block()
268 r->opaque = owner; in register_init_block()
270 r_array->r[i] = r; in register_init_block()
273 memory_region_init_io(&r_array->mem, OBJECT(owner), ops, r_array, in register_init_block()
282 uint8_t *data, in register_init_block8() argument
288 data, ops, debug_enabled, memory_size, 8); in register_init_block8()
294 uint32_t *data, in register_init_block32() argument
300 data, ops, debug_enabled, memory_size, 32); in register_init_block32()
306 uint64_t *data, in register_init_block64() argument
312 data, ops, debug_enabled, memory_size, 64); in register_init_block64()
317 object_unparent(OBJECT(&r_array->mem)); in register_finalize_block()
318 g_free(r_array->r); in register_finalize_block()
322 static void register_class_init(ObjectClass *oc, void *data) in register_class_init() argument
327 dc->user_creatable = false; in register_class_init()