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

« back to all changes in this revision

Viewing changes to hw/char/serial-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:
27
27
 
28
28
#include "hw/char/serial.h"
29
29
#include "hw/pci/pci.h"
 
30
#include "qapi/qmp/qerror.h"
30
31
 
31
32
#define PCI_SERIAL_MAX_PORTS 4
32
33
 
49
50
{
50
51
    PCISerialState *pci = DO_UPCAST(PCISerialState, dev, dev);
51
52
    SerialState *s = &pci->state;
 
53
    Error *err = NULL;
52
54
 
53
55
    s->baudbase = 115200;
54
 
    serial_init_core(s);
 
56
    serial_realize_core(s, &err);
 
57
    if (err != NULL) {
 
58
        qerror_report_err(err);
 
59
        error_free(err);
 
60
        return -1;
 
61
    }
55
62
 
56
63
    pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
57
64
    s->irq = pci->dev.irq[0];
58
65
 
59
 
    memory_region_init_io(&s->io, &serial_io_ops, s, "serial", 8);
 
66
    memory_region_init_io(&s->io, OBJECT(pci), &serial_io_ops, s, "serial", 8);
60
67
    pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io);
61
68
    return 0;
62
69
}
80
87
    PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
81
88
    PCIMultiSerialState *pci = DO_UPCAST(PCIMultiSerialState, dev, dev);
82
89
    SerialState *s;
 
90
    Error *err = NULL;
83
91
    int i;
84
92
 
85
93
    switch (pc->device_id) {
94
102
    assert(pci->ports <= PCI_SERIAL_MAX_PORTS);
95
103
 
96
104
    pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
97
 
    memory_region_init(&pci->iobar, "multiserial", 8 * pci->ports);
 
105
    memory_region_init(&pci->iobar, OBJECT(pci), "multiserial", 8 * pci->ports);
98
106
    pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->iobar);
99
107
    pci->irqs = qemu_allocate_irqs(multi_serial_irq_mux, pci,
100
108
                                   pci->ports);
102
110
    for (i = 0; i < pci->ports; i++) {
103
111
        s = pci->state + i;
104
112
        s->baudbase = 115200;
105
 
        serial_init_core(s);
 
113
        serial_realize_core(s, &err);
 
114
        if (err != NULL) {
 
115
            qerror_report_err(err);
 
116
            error_free(err);
 
117
            return -1;
 
118
        }
106
119
        s->irq = pci->irqs[i];
107
120
        pci->name[i] = g_strdup_printf("uart #%d", i+1);
108
 
        memory_region_init_io(&s->io, &serial_io_ops, s, pci->name[i], 8);
 
121
        memory_region_init_io(&s->io, OBJECT(pci), &serial_io_ops, s,
 
122
                              pci->name[i], 8);
109
123
        memory_region_add_subregion(&pci->iobar, 8 * i, &s->io);
110
124
    }
111
125
    return 0;
191
205
    pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL;
192
206
    dc->vmsd = &vmstate_pci_serial;
193
207
    dc->props = serial_pci_properties;
 
208
    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
194
209
}
195
210
 
196
211
static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data)
205
220
    pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL;
206
221
    dc->vmsd = &vmstate_pci_multi_serial;
207
222
    dc->props = multi_2x_serial_pci_properties;
 
223
    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
208
224
}
209
225
 
210
226
static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data)
219
235
    pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL;
220
236
    dc->vmsd = &vmstate_pci_multi_serial;
221
237
    dc->props = multi_4x_serial_pci_properties;
 
238
    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
222
239
}
223
240
 
224
241
static const TypeInfo serial_pci_info = {