Revision 932d4a42

b/hw/msi.c
105 105
    return dev->msi_cap + (msi64bit ? PCI_MSI_PENDING_64 : PCI_MSI_PENDING_32);
106 106
}
107 107

  
108
/*
109
 * Special API for POWER to configure the vectors through
110
 * a side channel. Should never be used by devices.
111
 */
112
void msi_set_message(PCIDevice *dev, MSIMessage msg)
113
{
114
    uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev));
115
    bool msi64bit = flags & PCI_MSI_FLAGS_64BIT;
116

  
117
    if (msi64bit) {
118
        pci_set_quad(dev->config + msi_address_lo_off(dev), msg.address);
119
    } else {
120
        pci_set_long(dev->config + msi_address_lo_off(dev), msg.address);
121
    }
122
    pci_set_word(dev->config + msi_data_off(dev, msi64bit), msg.data);
123
}
124

  
108 125
bool msi_enabled(const PCIDevice *dev)
109 126
{
110 127
    return msi_present(dev) &&
b/hw/msi.h
31 31

  
32 32
extern bool msi_supported;
33 33

  
34
void msi_set_message(PCIDevice *dev, MSIMessage msg);
34 35
bool msi_enabled(const PCIDevice *dev);
35 36
int msi_init(struct PCIDevice *dev, uint8_t offset,
36 37
             unsigned int nr_vectors, bool msi64bit, bool msi_per_vector_mask);
b/hw/msix.c
37 37
    return msg;
38 38
}
39 39

  
40
/*
41
 * Special API for POWER to configure the vectors through
42
 * a side channel. Should never be used by devices.
43
 */
44
void msix_set_message(PCIDevice *dev, int vector, struct MSIMessage msg)
45
{
46
    uint8_t *table_entry = dev->msix_table + vector * PCI_MSIX_ENTRY_SIZE;
47

  
48
    pci_set_quad(table_entry + PCI_MSIX_ENTRY_LOWER_ADDR, msg.address);
49
    pci_set_long(table_entry + PCI_MSIX_ENTRY_DATA, msg.data);
50
    table_entry[PCI_MSIX_ENTRY_VECTOR_CTRL] &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT;
51
}
52

  
40 53
static uint8_t msix_pending_mask(int vector)
41 54
{
42 55
    return 1 << (vector % 8);
b/hw/msix.h
4 4
#include "qemu-common.h"
5 5
#include "pci.h"
6 6

  
7
void msix_set_message(PCIDevice *dev, int vector, MSIMessage msg);
7 8
int msix_init(PCIDevice *dev, unsigned short nentries,
8 9
              MemoryRegion *table_bar, uint8_t table_bar_nr,
9 10
              unsigned table_offset, MemoryRegion *pba_bar,

Also available in: Unified diff