msi: Guard msi/msix_write_config with msi_present
[qemu-kvm.git] / hw / hw.h
blobe5cb9bf94d45ebab8c436383e6c2a00cfd329a26
1 /* Declarations for use by hardware emulation. */
2 #ifndef QEMU_HW_H
3 #define QEMU_HW_H
5 #include "qemu-common.h"
7 #if defined(TARGET_PHYS_ADDR_BITS) && !defined(NEED_CPU_H)
8 #include "cpu-common.h"
9 #endif
11 #include "ioport.h"
12 #include "irq.h"
13 #include "qemu-file.h"
14 #include "vmstate.h"
16 #ifdef NEED_CPU_H
17 #if TARGET_LONG_BITS == 64
18 #define qemu_put_betl qemu_put_be64
19 #define qemu_get_betl qemu_get_be64
20 #define qemu_put_betls qemu_put_be64s
21 #define qemu_get_betls qemu_get_be64s
22 #define qemu_put_sbetl qemu_put_sbe64
23 #define qemu_get_sbetl qemu_get_sbe64
24 #define qemu_put_sbetls qemu_put_sbe64s
25 #define qemu_get_sbetls qemu_get_sbe64s
26 #else
27 #define qemu_put_betl qemu_put_be32
28 #define qemu_get_betl qemu_get_be32
29 #define qemu_put_betls qemu_put_be32s
30 #define qemu_get_betls qemu_get_be32s
31 #define qemu_put_sbetl qemu_put_sbe32
32 #define qemu_get_sbetl qemu_get_sbe32
33 #define qemu_put_sbetls qemu_put_sbe32s
34 #define qemu_get_sbetls qemu_get_sbe32s
35 #endif
36 #endif
38 typedef void QEMUResetHandler(void *opaque);
40 void qemu_register_reset(QEMUResetHandler *func, void *opaque);
41 void qemu_unregister_reset(QEMUResetHandler *func, void *opaque);
43 /* handler to set the boot_device order for a specific type of QEMUMachine */
44 /* return 0 if success */
45 typedef int QEMUBootSetHandler(void *opaque, const char *boot_devices);
46 void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
47 int qemu_boot_set(const char *boot_devices);
49 #ifdef NEED_CPU_H
50 #if TARGET_LONG_BITS == 64
51 #define VMSTATE_UINTTL_V(_f, _s, _v) \
52 VMSTATE_UINT64_V(_f, _s, _v)
53 #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \
54 VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
55 #else
56 #define VMSTATE_UINTTL_V(_f, _s, _v) \
57 VMSTATE_UINT32_V(_f, _s, _v)
58 #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \
59 VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
60 #endif
61 #define VMSTATE_UINTTL(_f, _s) \
62 VMSTATE_UINTTL_V(_f, _s, 0)
63 #define VMSTATE_UINTTL_ARRAY(_f, _s, _n) \
64 VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)
66 #endif
68 #endif