~ubuntu-branches/ubuntu/vivid/qemu-linaro/vivid

« back to all changes in this revision

Viewing changes to hw/msi.c

  • Committer: Ricardo Salveti de Araujo
  • Date: 2012-09-20 18:39:31 UTC
  • mfrom: (12922.1.2 qemu-linaro)
  • Revision ID: ricardo.salveti@linaro.org-20120920183931-sp3cg6kpdl8dmwo9
* New upstream release.
  - support emulated systems with more than 2G of memory. (LP: #1030588)
* Drop powerpc-missing-include.patch - merged upstream.
* Update debian/control:
  - drop perl build dependency.
  - add libfdt-dev build dependency.
* Update debian/qemu-keymaps.install file.
* Update debian/rules:
  - update QEMU_CPU for ARM architecture: armv4l -> armv7l.
  - update conf_audio_drv: default to PulseAudio since PA is the default on
    Ubuntu.
  - enable KVM on ARM architecture.
  - enable flat device tree support (--enable-fdt). (LP: #1030594)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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) &&
175
192
    uint16_t flags;
176
193
    uint8_t cap_size;
177
194
 
178
 
    if (!(dev->cap_present & QEMU_PCI_CAP_MSI)) {
 
195
    if (!msi_present(dev)) {
179
196
        return;
180
197
    }
181
198
    flags = pci_get_word(dev->config + msi_flags_off(dev));
191
208
    uint16_t flags;
192
209
    bool msi64bit;
193
210
 
 
211
    if (!msi_present(dev)) {
 
212
        return;
 
213
    }
 
214
 
194
215
    flags = pci_get_word(dev->config + msi_flags_off(dev));
195
216
    flags &= ~(PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE);
196
217
    msi64bit = flags & PCI_MSI_FLAGS_64BIT;
260
281
    stl_le_phys(address, data);
261
282
}
262
283
 
263
 
/* call this function after updating configs by pci_default_write_config(). */
 
284
/* Normally called by pci_default_write_config(). */
264
285
void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len)
265
286
{
266
287
    uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev));
272
293
    unsigned int vector;
273
294
    uint32_t pending;
274
295
 
275
 
    if (!ranges_overlap(addr, len, dev->msi_cap, msi_cap_sizeof(flags))) {
 
296
    if (!msi_present(dev) ||
 
297
        !ranges_overlap(addr, len, dev->msi_cap, msi_cap_sizeof(flags))) {
276
298
        return;
277
299
    }
278
300