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

« back to all changes in this revision

Viewing changes to hw/char/omap_uart.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:
24
24
#include "exec/address-spaces.h"
25
25
#include "hw/sysbus.h"
26
26
 
 
27
#define TYPE_OMAP_UART "omap_uart"
 
28
#define OMAP_UART(obj) OBJECT_CHECK(omap_uart_s, (obj), TYPE_OMAP_UART)
 
29
 
27
30
/* The OMAP UART functionality is similar to the TI16C752; it is
28
31
 * an enhanced version of the 16550A and we piggy-back on the 16550
29
32
 * model.
37
40
 *  + UASR auto-baudrate-detection
38
41
 */
39
42
 
40
 
struct omap_uart_s {
 
43
typedef struct omap_uart_s {
41
44
    SysBusDevice busdev;
42
45
    MemoryRegion iomem;
43
46
    CharDriverState *chr;
71
74
    uint8_t tcr;
72
75
    uint8_t tlr;
73
76
    uint8_t xon[2], xoff[2];
74
 
};
 
77
} omap_uart_s;
75
78
 
76
79
static int tcr_tlr_mode(struct omap_uart_s *s)
77
80
{
83
86
 
84
87
static void omap_uart_reset(DeviceState *qdev)
85
88
{
86
 
    struct omap_uart_s *s = FROM_SYSBUS(struct omap_uart_s,
87
 
                                        SYS_BUS_DEVICE(qdev));
 
89
    struct omap_uart_s *s = OMAP_UART(qdev);
 
90
 
88
91
    s->eblr = 0x00;
89
92
    s->syscontrol = 0;
90
93
    s->wkup = 0x3f;
288
291
        s->syscontrol = value & 0x1d;
289
292
        if (value & 2) {
290
293
            /* TODO: reset s->serial also. */
291
 
            omap_uart_reset(&s->busdev.qdev);
 
294
            omap_uart_reset(DEVICE(s));
292
295
        }
293
296
        break;
294
297
    case 0x58:  /* SYSS (OMAP2) */
313
316
 
314
317
static int omap_uart_init(SysBusDevice *busdev)
315
318
{
316
 
    struct omap_uart_s *s = FROM_SYSBUS(struct omap_uart_s, busdev);
 
319
    struct omap_uart_s *s = OMAP_UART(busdev);
 
320
 
317
321
    if (!s->chr) {
318
 
        s->chr = qemu_chr_new(busdev->qdev.id, "null", NULL);
 
322
        // XXX looks a bit dubious to grab id like this
 
323
        s->chr = qemu_chr_new(DEVICE(busdev)->id, "null", NULL);
319
324
    }
320
325
    /* TODO: DMA support. Current 16550A emulation does not emulate DMA mode
321
326
     * transfers via TXRDY/RXRDY pins. We create DMA irq lines here for
329
334
    sysbus_init_irq(busdev, serial_get_irq(s->serial));
330
335
    sysbus_init_irq(busdev, &s->tx_drq);
331
336
    sysbus_init_irq(busdev, &s->rx_drq);
332
 
    memory_region_init_io(&s->iomem, &omap_uart_ops, s, "omap_uart",
 
337
    memory_region_init_io(&s->iomem, NULL, &omap_uart_ops, s, "omap_uart",
333
338
                          s->mmio_size);
334
339
    sysbus_init_mmio(busdev, &s->iomem);
335
340
    return 0;
367
372
void omap_uart_attach(DeviceState *qdev, CharDriverState *chr,
368
373
                      const char *label)
369
374
{
370
 
    struct omap_uart_s *s = FROM_SYSBUS(struct omap_uart_s,
371
 
                                        SYS_BUS_DEVICE(qdev));
 
375
    struct omap_uart_s *s = OMAP_UART(qdev);
 
376
 
372
377
    s->chr = chr ?: qemu_chr_new(label, "null", NULL);
373
378
    serial_change_char_driver(s->serial, s->chr);
374
379
}