xref: /qemu/include/hw/pci/msi.h (revision 60ba3cc231d6bc7b802ad4fe6b6fc159ecb112e2)
1e4c7d2aeSIsaku Yamahata /*
2e4c7d2aeSIsaku Yamahata  * msi.h
3e4c7d2aeSIsaku Yamahata  *
4e4c7d2aeSIsaku Yamahata  * Copyright (c) 2010 Isaku Yamahata <yamahata at valinux co jp>
5e4c7d2aeSIsaku Yamahata  *                    VA Linux Systems Japan K.K.
6e4c7d2aeSIsaku Yamahata  *
7e4c7d2aeSIsaku Yamahata  * This program is free software; you can redistribute it and/or modify
8e4c7d2aeSIsaku Yamahata  * it under the terms of the GNU General Public License as published by
9e4c7d2aeSIsaku Yamahata  * the Free Software Foundation; either version 2 of the License, or
10e4c7d2aeSIsaku Yamahata  * (at your option) any later version.
11e4c7d2aeSIsaku Yamahata 
12e4c7d2aeSIsaku Yamahata  * This program is distributed in the hope that it will be useful,
13e4c7d2aeSIsaku Yamahata  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14e4c7d2aeSIsaku Yamahata  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15e4c7d2aeSIsaku Yamahata  * GNU General Public License for more details.
16e4c7d2aeSIsaku Yamahata 
17e4c7d2aeSIsaku Yamahata  * You should have received a copy of the GNU General Public License along
18e4c7d2aeSIsaku Yamahata  * with this program; if not, see <http://www.gnu.org/licenses/>.
19e4c7d2aeSIsaku Yamahata  */
20e4c7d2aeSIsaku Yamahata 
21e4c7d2aeSIsaku Yamahata #ifndef QEMU_MSI_H
22e4c7d2aeSIsaku Yamahata #define QEMU_MSI_H
23e4c7d2aeSIsaku Yamahata 
24e4c7d2aeSIsaku Yamahata #include "qemu-common.h"
25e4c7d2aeSIsaku Yamahata #include "pci.h"
26e4c7d2aeSIsaku Yamahata 
27*60ba3cc2SJan Kiszka extern bool msi_supported;
28*60ba3cc2SJan Kiszka 
29e4c7d2aeSIsaku Yamahata bool msi_enabled(const PCIDevice *dev);
30e4c7d2aeSIsaku Yamahata int msi_init(struct PCIDevice *dev, uint8_t offset,
31e4c7d2aeSIsaku Yamahata              unsigned int nr_vectors, bool msi64bit, bool msi_per_vector_mask);
32e4c7d2aeSIsaku Yamahata void msi_uninit(struct PCIDevice *dev);
33e4c7d2aeSIsaku Yamahata void msi_reset(PCIDevice *dev);
34e4c7d2aeSIsaku Yamahata void msi_notify(PCIDevice *dev, unsigned int vector);
35e4c7d2aeSIsaku Yamahata void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len);
36e4c7d2aeSIsaku Yamahata unsigned int msi_nr_vectors_allocated(const PCIDevice *dev);
37e4c7d2aeSIsaku Yamahata 
38e4c7d2aeSIsaku Yamahata static inline bool msi_present(const PCIDevice *dev)
39e4c7d2aeSIsaku Yamahata {
40e4c7d2aeSIsaku Yamahata     return dev->cap_present & QEMU_PCI_CAP_MSI;
41e4c7d2aeSIsaku Yamahata }
42e4c7d2aeSIsaku Yamahata 
43e4c7d2aeSIsaku Yamahata #endif /* QEMU_MSI_H */
44