xref: /openbmc/qemu/include/hw/hw.h (revision 63785678)
1 /* Declarations for use by hardware emulation.  */
2 #ifndef QEMU_HW_H
3 #define QEMU_HW_H
4 
5 
6 #if !defined(CONFIG_USER_ONLY) && !defined(NEED_CPU_H)
7 #include "exec/cpu-common.h"
8 #endif
9 
10 #include "exec/ioport.h"
11 #include "hw/irq.h"
12 #include "block/aio.h"
13 #include "migration/vmstate.h"
14 #include "qemu/log.h"
15 #include "qemu/module.h"
16 
17 #ifdef NEED_CPU_H
18 #if TARGET_LONG_BITS == 64
19 #define qemu_put_betl qemu_put_be64
20 #define qemu_get_betl qemu_get_be64
21 #define qemu_put_betls qemu_put_be64s
22 #define qemu_get_betls qemu_get_be64s
23 #define qemu_put_sbetl qemu_put_sbe64
24 #define qemu_get_sbetl qemu_get_sbe64
25 #define qemu_put_sbetls qemu_put_sbe64s
26 #define qemu_get_sbetls qemu_get_sbe64s
27 #else
28 #define qemu_put_betl qemu_put_be32
29 #define qemu_get_betl qemu_get_be32
30 #define qemu_put_betls qemu_put_be32s
31 #define qemu_get_betls qemu_get_be32s
32 #define qemu_put_sbetl qemu_put_sbe32
33 #define qemu_get_sbetl qemu_get_sbe32
34 #define qemu_put_sbetls qemu_put_sbe32s
35 #define qemu_get_sbetls qemu_get_sbe32s
36 #endif
37 #endif
38 
39 typedef void QEMUResetHandler(void *opaque);
40 
41 void qemu_register_reset(QEMUResetHandler *func, void *opaque);
42 void qemu_unregister_reset(QEMUResetHandler *func, void *opaque);
43 
44 void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
45 
46 #ifdef NEED_CPU_H
47 #if TARGET_LONG_BITS == 64
48 #define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
49     VMSTATE_UINT64_V(_f, _s, _v)
50 #define VMSTATE_UINTTL_EQUAL_V(_f, _s, _v)                            \
51     VMSTATE_UINT64_EQUAL_V(_f, _s, _v)
52 #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
53     VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
54 #define vmstate_info_uinttl vmstate_info_uint64
55 #else
56 #define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
57     VMSTATE_UINT32_V(_f, _s, _v)
58 #define VMSTATE_UINTTL_EQUAL_V(_f, _s, _v)                            \
59     VMSTATE_UINT32_EQUAL_V(_f, _s, _v)
60 #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
61     VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
62 #define vmstate_info_uinttl vmstate_info_uint32
63 #endif
64 #define VMSTATE_UINTTL(_f, _s)                                        \
65     VMSTATE_UINTTL_V(_f, _s, 0)
66 #define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
67     VMSTATE_UINTTL_EQUAL_V(_f, _s, 0)
68 #define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
69     VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)
70 
71 #endif
72 
73 #endif
74