migration: remove the QEMUFileOps 'shut_down' callback
[qemu/armbru.git] / hw / misc / armv7m_ras.c
blobde24922c9442e3a607ab51a9f6ab706407b6ca8e
1 /*
2 * Arm M-profile RAS (Reliability, Availability and Serviceability) block
4 * Copyright (c) 2021 Linaro Limited
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 or
8 * (at your option) any later version.
9 */
11 #include "qemu/osdep.h"
12 #include "hw/misc/armv7m_ras.h"
13 #include "qemu/log.h"
15 static MemTxResult ras_read(void *opaque, hwaddr addr,
16 uint64_t *data, unsigned size,
17 MemTxAttrs attrs)
19 if (attrs.user) {
20 return MEMTX_ERROR;
23 switch (addr) {
24 case 0xe10: /* ERRIIDR */
25 /* architect field = Arm; product/variant/revision 0 */
26 *data = 0x43b;
27 break;
28 case 0xfc8: /* ERRDEVID */
29 /* Minimal RAS: we implement 0 error record indexes */
30 *data = 0;
31 break;
32 default:
33 qemu_log_mask(LOG_UNIMP, "Read RAS register offset 0x%x\n",
34 (uint32_t)addr);
35 *data = 0;
36 break;
38 return MEMTX_OK;
41 static MemTxResult ras_write(void *opaque, hwaddr addr,
42 uint64_t value, unsigned size,
43 MemTxAttrs attrs)
45 if (attrs.user) {
46 return MEMTX_ERROR;
49 switch (addr) {
50 default:
51 qemu_log_mask(LOG_UNIMP, "Write to RAS register offset 0x%x\n",
52 (uint32_t)addr);
53 break;
55 return MEMTX_OK;
58 static const MemoryRegionOps ras_ops = {
59 .read_with_attrs = ras_read,
60 .write_with_attrs = ras_write,
61 .endianness = DEVICE_NATIVE_ENDIAN,
65 static void armv7m_ras_init(Object *obj)
67 SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
68 ARMv7MRAS *s = ARMV7M_RAS(obj);
70 memory_region_init_io(&s->iomem, obj, &ras_ops,
71 s, "armv7m-ras", 0x1000);
72 sysbus_init_mmio(sbd, &s->iomem);
75 static void armv7m_ras_class_init(ObjectClass *klass, void *data)
77 /* This device has no state: no need for vmstate or reset */
80 static const TypeInfo armv7m_ras_info = {
81 .name = TYPE_ARMV7M_RAS,
82 .parent = TYPE_SYS_BUS_DEVICE,
83 .instance_size = sizeof(ARMv7MRAS),
84 .instance_init = armv7m_ras_init,
85 .class_init = armv7m_ras_class_init,
88 static void armv7m_ras_register_types(void)
90 type_register_static(&armv7m_ras_info);
93 type_init(armv7m_ras_register_types);