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.
11 #include "qemu/osdep.h"
12 #include "hw/misc/armv7m_ras.h"
15 static MemTxResult
ras_read(void *opaque
, hwaddr addr
,
16 uint64_t *data
, unsigned size
,
24 case 0xe10: /* ERRIIDR */
25 /* architect field = Arm; product/variant/revision 0 */
28 case 0xfc8: /* ERRDEVID */
29 /* Minimal RAS: we implement 0 error record indexes */
33 qemu_log_mask(LOG_UNIMP
, "Read RAS register offset 0x%x\n",
41 static MemTxResult
ras_write(void *opaque
, hwaddr addr
,
42 uint64_t value
, unsigned size
,
51 qemu_log_mask(LOG_UNIMP
, "Write to RAS register offset 0x%x\n",
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
);