hw/misc/a9scu: Report unimplemented accesses with qemu_log_mask(UNIMP)
[qemu/ar7.git] / hw / misc / debugexit.c
blobc6b0cffd77aa60f8eac6ac899148f68ff4ebe8cb
1 /*
2 * debug exit port emulation
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 or
7 * (at your option) any later version.
8 */
10 #include "qemu/osdep.h"
11 #include "hw/isa/isa.h"
12 #include "hw/qdev-properties.h"
13 #include "qemu/module.h"
14 #include "qom/object.h"
16 #define TYPE_ISA_DEBUG_EXIT_DEVICE "isa-debug-exit"
17 typedef struct ISADebugExitState ISADebugExitState;
18 DECLARE_INSTANCE_CHECKER(ISADebugExitState, ISA_DEBUG_EXIT_DEVICE,
19 TYPE_ISA_DEBUG_EXIT_DEVICE)
21 struct ISADebugExitState {
22 ISADevice parent_obj;
24 uint32_t iobase;
25 uint32_t iosize;
26 MemoryRegion io;
29 static uint64_t debug_exit_read(void *opaque, hwaddr addr, unsigned size)
31 return 0;
34 static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
35 unsigned width)
37 exit((val << 1) | 1);
40 static const MemoryRegionOps debug_exit_ops = {
41 .read = debug_exit_read,
42 .write = debug_exit_write,
43 .valid.min_access_size = 1,
44 .valid.max_access_size = 4,
45 .endianness = DEVICE_LITTLE_ENDIAN,
48 static void debug_exit_realizefn(DeviceState *d, Error **errp)
50 ISADevice *dev = ISA_DEVICE(d);
51 ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(d);
53 memory_region_init_io(&isa->io, OBJECT(dev), &debug_exit_ops, isa,
54 TYPE_ISA_DEBUG_EXIT_DEVICE, isa->iosize);
55 memory_region_add_subregion(isa_address_space_io(dev),
56 isa->iobase, &isa->io);
59 static Property debug_exit_properties[] = {
60 DEFINE_PROP_UINT32("iobase", ISADebugExitState, iobase, 0x501),
61 DEFINE_PROP_UINT32("iosize", ISADebugExitState, iosize, 0x02),
62 DEFINE_PROP_END_OF_LIST(),
65 static void debug_exit_class_initfn(ObjectClass *klass, void *data)
67 DeviceClass *dc = DEVICE_CLASS(klass);
69 dc->realize = debug_exit_realizefn;
70 device_class_set_props(dc, debug_exit_properties);
71 set_bit(DEVICE_CATEGORY_MISC, dc->categories);
74 static const TypeInfo debug_exit_info = {
75 .name = TYPE_ISA_DEBUG_EXIT_DEVICE,
76 .parent = TYPE_ISA_DEVICE,
77 .instance_size = sizeof(ISADebugExitState),
78 .class_init = debug_exit_class_initfn,
81 static void debug_exit_register_types(void)
83 type_register_static(&debug_exit_info);
86 type_init(debug_exit_register_types)