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.
10 #include "qemu/osdep.h"
12 #include "hw/isa/isa.h"
14 #define TYPE_ISA_DEBUG_EXIT_DEVICE "isa-debug-exit"
15 #define ISA_DEBUG_EXIT_DEVICE(obj) \
16 OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
18 typedef struct ISADebugExitState
{
26 static uint64_t debug_exit_read(void *opaque
, hwaddr addr
, unsigned size
)
31 static void debug_exit_write(void *opaque
, hwaddr addr
, uint64_t val
,
37 static const MemoryRegionOps debug_exit_ops
= {
38 .read
= debug_exit_read
,
39 .write
= debug_exit_write
,
40 .valid
.min_access_size
= 1,
41 .valid
.max_access_size
= 4,
42 .endianness
= DEVICE_LITTLE_ENDIAN
,
45 static void debug_exit_realizefn(DeviceState
*d
, Error
**errp
)
47 ISADevice
*dev
= ISA_DEVICE(d
);
48 ISADebugExitState
*isa
= ISA_DEBUG_EXIT_DEVICE(d
);
50 memory_region_init_io(&isa
->io
, OBJECT(dev
), &debug_exit_ops
, isa
,
51 TYPE_ISA_DEBUG_EXIT_DEVICE
, isa
->iosize
);
52 memory_region_add_subregion(isa_address_space_io(dev
),
53 isa
->iobase
, &isa
->io
);
56 static Property debug_exit_properties
[] = {
57 DEFINE_PROP_UINT32("iobase", ISADebugExitState
, iobase
, 0x501),
58 DEFINE_PROP_UINT32("iosize", ISADebugExitState
, iosize
, 0x02),
59 DEFINE_PROP_END_OF_LIST(),
62 static void debug_exit_class_initfn(ObjectClass
*klass
, void *data
)
64 DeviceClass
*dc
= DEVICE_CLASS(klass
);
66 dc
->realize
= debug_exit_realizefn
;
67 dc
->props
= debug_exit_properties
;
68 set_bit(DEVICE_CATEGORY_MISC
, dc
->categories
);
71 static const TypeInfo debug_exit_info
= {
72 .name
= TYPE_ISA_DEBUG_EXIT_DEVICE
,
73 .parent
= TYPE_ISA_DEVICE
,
74 .instance_size
= sizeof(ISADebugExitState
),
75 .class_init
= debug_exit_class_initfn
,
78 static void debug_exit_register_types(void)
80 type_register_static(&debug_exit_info
);
83 type_init(debug_exit_register_types
)