]> Git Repo - qemu.git/blame - hw/misc/debugexit.c
hw/misc/edu: add msi_uninit() for pci_edu_uninit()
[qemu.git] / hw / misc / debugexit.c
CommitLineData
bb355b18
GH
1/*
2 * debug exit port emulation
3 *
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 */
9
b6a0aa05 10#include "qemu/osdep.h"
83c9f4ca 11#include "hw/hw.h"
0d09e41a 12#include "hw/isa/isa.h"
bb355b18
GH
13
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)
17
18typedef struct ISADebugExitState {
19 ISADevice parent_obj;
20
21 uint32_t iobase;
22 uint32_t iosize;
23 MemoryRegion io;
24} ISADebugExitState;
25
af71743a
LQ
26static uint64_t debug_exit_read(void *opaque, hwaddr addr, unsigned size)
27{
28 return 0;
29}
30
bb355b18
GH
31static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
32 unsigned width)
33{
34 exit((val << 1) | 1);
35}
36
37static const MemoryRegionOps debug_exit_ops = {
af71743a 38 .read = debug_exit_read,
bb355b18
GH
39 .write = debug_exit_write,
40 .valid.min_access_size = 1,
41 .valid.max_access_size = 4,
42 .endianness = DEVICE_LITTLE_ENDIAN,
43};
44
db895a1e 45static void debug_exit_realizefn(DeviceState *d, Error **errp)
bb355b18 46{
db895a1e
AF
47 ISADevice *dev = ISA_DEVICE(d);
48 ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(d);
bb355b18 49
3c161542 50 memory_region_init_io(&isa->io, OBJECT(dev), &debug_exit_ops, isa,
bb355b18
GH
51 TYPE_ISA_DEBUG_EXIT_DEVICE, isa->iosize);
52 memory_region_add_subregion(isa_address_space_io(dev),
53 isa->iobase, &isa->io);
bb355b18
GH
54}
55
56static Property debug_exit_properties[] = {
c7bcc85d
PB
57 DEFINE_PROP_UINT32("iobase", ISADebugExitState, iobase, 0x501),
58 DEFINE_PROP_UINT32("iosize", ISADebugExitState, iosize, 0x02),
bb355b18
GH
59 DEFINE_PROP_END_OF_LIST(),
60};
61
62static void debug_exit_class_initfn(ObjectClass *klass, void *data)
63{
64 DeviceClass *dc = DEVICE_CLASS(klass);
db895a1e
AF
65
66 dc->realize = debug_exit_realizefn;
bb355b18 67 dc->props = debug_exit_properties;
125ee0ed 68 set_bit(DEVICE_CATEGORY_MISC, dc->categories);
bb355b18
GH
69}
70
8c43a6f0 71static const TypeInfo debug_exit_info = {
bb355b18
GH
72 .name = TYPE_ISA_DEBUG_EXIT_DEVICE,
73 .parent = TYPE_ISA_DEVICE,
74 .instance_size = sizeof(ISADebugExitState),
75 .class_init = debug_exit_class_initfn,
76};
77
78static void debug_exit_register_types(void)
79{
80 type_register_static(&debug_exit_info);
81}
82
83type_init(debug_exit_register_types)
This page took 0.29057 seconds and 4 git commands to generate.