~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to hw/scsi/esp-pci.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
#define TYPE_AM53C974_DEVICE "am53c974"
33
33
 
 
34
#define PCI_ESP(obj) \
 
35
    OBJECT_CHECK(PCIESPState, (obj), TYPE_AM53C974_DEVICE)
 
36
 
34
37
#define DMA_CMD   0x0
35
38
#define DMA_STC   0x1
36
39
#define DMA_SPA   0x2
57
60
#define SBAC_STATUS 0x1000
58
61
 
59
62
typedef struct PCIESPState {
60
 
    PCIDevice dev;
 
63
    /*< private >*/
 
64
    PCIDevice parent_obj;
 
65
    /*< public >*/
 
66
 
61
67
    MemoryRegion io;
62
68
    uint32_t dma_regs[8];
63
69
    uint32_t sbac;
257
263
        len = pci->dma_regs[DMA_WBC];
258
264
    }
259
265
 
260
 
    pci_dma_rw(&pci->dev, addr, buf, len, dir);
 
266
    pci_dma_rw(PCI_DEVICE(pci), addr, buf, len, dir);
261
267
 
262
268
    /* update status registers */
263
269
    pci->dma_regs[DMA_WBC] -= len;
288
294
 
289
295
static void esp_pci_hard_reset(DeviceState *dev)
290
296
{
291
 
    PCIESPState *pci = DO_UPCAST(PCIESPState, dev.qdev, dev);
 
297
    PCIESPState *pci = PCI_ESP(dev);
292
298
    esp_hard_reset(&pci->esp);
293
299
    pci->dma_regs[DMA_CMD] &= ~(DMA_CMD_DIR | DMA_CMD_INTE_D | DMA_CMD_INTE_P
294
300
                              | DMA_CMD_MDL | DMA_CMD_DIAG | DMA_CMD_MASK);
306
312
    .minimum_version_id = 0,
307
313
    .minimum_version_id_old = 0,
308
314
    .fields = (VMStateField[]) {
309
 
        VMSTATE_PCI_DEVICE(dev, PCIESPState),
 
315
        VMSTATE_PCI_DEVICE(parent_obj, PCIESPState),
310
316
        VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)),
311
317
        VMSTATE_STRUCT(esp, PCIESPState, 0, vmstate_esp, ESPState),
312
318
        VMSTATE_END_OF_LIST()
336
342
 
337
343
static int esp_pci_scsi_init(PCIDevice *dev)
338
344
{
339
 
    PCIESPState *pci = DO_UPCAST(PCIESPState, dev, dev);
 
345
    PCIESPState *pci = PCI_ESP(dev);
 
346
    DeviceState *d = DEVICE(dev);
340
347
    ESPState *s = &pci->esp;
341
348
    uint8_t *pci_conf;
 
349
    Error *err = NULL;
342
350
 
343
 
    pci_conf = pci->dev.config;
 
351
    pci_conf = dev->config;
344
352
 
345
353
    /* Interrupt pin A */
346
354
    pci_conf[PCI_INTERRUPT_PIN] = 0x01;
349
357
    s->dma_memory_write = esp_pci_dma_memory_write;
350
358
    s->dma_opaque = pci;
351
359
    s->chip_id = TCHI_AM53C974;
352
 
    memory_region_init_io(&pci->io, &esp_pci_io_ops, pci, "esp-io", 0x80);
353
 
 
354
 
    pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->io);
355
 
    s->irq = pci->dev.irq[0];
356
 
 
357
 
    scsi_bus_new(&s->bus, &dev->qdev, &esp_pci_scsi_info, NULL);
358
 
    if (!dev->qdev.hotplugged) {
359
 
        return scsi_bus_legacy_handle_cmdline(&s->bus);
 
360
    memory_region_init_io(&pci->io, OBJECT(pci), &esp_pci_io_ops, pci,
 
361
                          "esp-io", 0x80);
 
362
 
 
363
    pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->io);
 
364
    s->irq = dev->irq[0];
 
365
 
 
366
    scsi_bus_new(&s->bus, d, &esp_pci_scsi_info, NULL);
 
367
    if (!d->hotplugged) {
 
368
        scsi_bus_legacy_handle_cmdline(&s->bus, &err);
 
369
        if (err != NULL) {
 
370
            error_free(err);
 
371
            return -1;
 
372
        }
360
373
    }
361
374
    return 0;
362
375
}
363
376
 
364
377
static void esp_pci_scsi_uninit(PCIDevice *d)
365
378
{
366
 
    PCIESPState *pci = DO_UPCAST(PCIESPState, dev, d);
 
379
    PCIESPState *pci = PCI_ESP(d);
367
380
 
368
381
    memory_region_destroy(&pci->io);
369
382
}
379
392
    k->device_id = PCI_DEVICE_ID_AMD_SCSI;
380
393
    k->revision = 0x10;
381
394
    k->class_id = PCI_CLASS_STORAGE_SCSI;
 
395
    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
382
396
    dc->desc = "AMD Am53c974 PCscsi-PCI SCSI adapter";
383
397
    dc->reset = esp_pci_hard_reset;
384
398
    dc->vmsd = &vmstate_esp_pci_scsi;
499
513
    k->init = dc390_scsi_init;
500
514
    k->config_read = dc390_read_config;
501
515
    k->config_write = dc390_write_config;
 
516
    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
502
517
    dc->desc = "Tekram DC-390 SCSI adapter";
503
518
}
504
519