]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/pci/msix.h
Include qemu-common.h exactly where needed
[mirror_qemu.git] / include / hw / pci / msix.h
CommitLineData
02eb84d0
MT
1#ifndef QEMU_MSIX_H
2#define QEMU_MSIX_H
3
c759b24f 4#include "hw/pci/pci.h"
02eb84d0 5
2d9574bd
LQ
6#define MSIX_CAP_LENGTH 12
7
932d4a42 8void msix_set_message(PCIDevice *dev, int vector, MSIMessage msg);
4c93bfa9 9MSIMessage msix_get_message(PCIDevice *dev, unsigned int vector);
5a2c2029
AW
10int msix_init(PCIDevice *dev, unsigned short nentries,
11 MemoryRegion *table_bar, uint8_t table_bar_nr,
12 unsigned table_offset, MemoryRegion *pba_bar,
ee640c62
C
13 uint8_t pba_bar_nr, unsigned pba_offset, uint8_t cap_pos,
14 Error **errp);
53f94925 15int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,
ee640c62 16 uint8_t bar_nr, Error **errp);
02eb84d0 17
118f2c2b 18void msix_write_config(PCIDevice *dev, uint32_t address, uint32_t val, int len);
02eb84d0 19
572992ee
AW
20void msix_uninit(PCIDevice *dev, MemoryRegion *table_bar,
21 MemoryRegion *pba_bar);
53f94925 22void msix_uninit_exclusive_bar(PCIDevice *dev);
02eb84d0 23
cb697aaa
JK
24unsigned int msix_nr_vectors_allocated(const PCIDevice *dev);
25
02eb84d0
MT
26void msix_save(PCIDevice *dev, QEMUFile *f);
27void msix_load(PCIDevice *dev, QEMUFile *f);
28
29int msix_enabled(PCIDevice *dev);
30int msix_present(PCIDevice *dev);
31
70f8ee39
MT
32bool msix_is_masked(PCIDevice *dev, unsigned vector);
33void msix_set_pending(PCIDevice *dev, unsigned vector);
3bdfaabb 34void msix_clr_pending(PCIDevice *dev, int vector);
70f8ee39 35
02eb84d0
MT
36int msix_vector_use(PCIDevice *dev, unsigned vector);
37void msix_vector_unuse(PCIDevice *dev, unsigned vector);
b5f28bca 38void msix_unuse_all_vectors(PCIDevice *dev);
02eb84d0
MT
39
40void msix_notify(PCIDevice *dev, unsigned vector);
41
42void msix_reset(PCIDevice *dev);
43
2cdfe53c
JK
44int msix_set_vector_notifiers(PCIDevice *dev,
45 MSIVectorUseNotifier use_notifier,
bbef882c
MT
46 MSIVectorReleaseNotifier release_notifier,
47 MSIVectorPollNotifier poll_notifier);
2cdfe53c 48void msix_unset_vector_notifiers(PCIDevice *dev);
340b50c7
GH
49
50extern const VMStateDescription vmstate_msix;
51
c246a62f
MAL
52#define VMSTATE_MSIX_TEST(_field, _state, _test) { \
53 .name = (stringify(_field)), \
54 .size = sizeof(PCIDevice), \
55 .vmsd = &vmstate_msix, \
56 .flags = VMS_STRUCT, \
57 .offset = vmstate_offset_value(_state, _field, PCIDevice), \
58 .field_exists = (_test) \
340b50c7
GH
59}
60
c246a62f
MAL
61#define VMSTATE_MSIX(_f, _s) \
62 VMSTATE_MSIX_TEST(_f, _s, NULL)
63
02eb84d0 64#endif