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

« back to all changes in this revision

Viewing changes to debian/patches/linaro/0021-omap_i2c.c-Support-byte-reads-to-registers.patch

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2014-02-04 12:13:08 UTC
  • mfrom: (10.1.45 sid)
  • Revision ID: package-import@ubuntu.com-20140204121308-1xq92lrfs75agw2g
Tags: 1.7.0+dfsg-3ubuntu1~ppa1
* Merge 1.7.0+dfsg-3 from debian.  Remaining changes:
  - debian/patches/ubuntu:
    * expose-vmx_qemu64cpu.patch
    * linaro (omap3) and arm64 patches
    * ubuntu/target-ppc-add-stubs-for-kvm-breakpoints: fix FTBFS
      on ppc
    * ubuntu/CVE-2013-4377.patch: fix denial of service via virtio
  - debian/qemu-system-x86.modprobe: set kvm_intel nested=1 options
  - debian/control:
    * add arm64 to Architectures
    * add qemu-common and qemu-system-aarch64 packages
  - debian/qemu-system-common.install: add debian/tmp/usr/lib
  - debian/qemu-system-common.preinst: add kvm group
  - debian/qemu-system-common.postinst: remove acl placed by udev,
    and add udevadm trigger.
  - qemu-system-x86.links: add eepro100.rom, remove pxe-virtio,
    pxe-e1000 and pxe-rtl8139.
  - add qemu-system-x86.qemu-kvm.upstart and .default
  - qemu-user-static.postinst-in: remove arm64 binfmt
  - debian/rules:
    * allow parallel build
    * add aarch64 to system_targets and sys_systems
    * add qemu-kvm-spice links
    * install qemu-system-x86.modprobe
  - add debian/qemu-system-common.links for OVMF.fd link
* Remove kvm-img, kvm-nbd, kvm-ifup and kvm-ifdown symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 093f316f0db143475efeec7ed06debb2c87495a9 Mon Sep 17 00:00:00 2001
2
 
From: Matt Waddel <matt.waddel@ubuntu.com>
3
 
Date: Mon, 18 Feb 2013 16:58:26 +0000
4
 
Subject: [PATCH 21/70] omap_i2c.c: Support byte reads to registers
5
 
 
6
 
Added support for the byte read of the omap i2c system.
7
 
Handling is similar to the way i2c_write and i2c_writeb work.
8
 
---
9
 
 hw/i2c/omap_i2c.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
10
 
 1 file changed, 56 insertions(+), 1 deletion(-)
11
 
 
12
 
diff --git a/hw/i2c/omap_i2c.c b/hw/i2c/omap_i2c.c
13
 
index 9a1b0d2..0278390 100644
14
 
--- a/hw/i2c/omap_i2c.c
15
 
+++ b/hw/i2c/omap_i2c.c
16
 
@@ -326,6 +326,61 @@ static uint32_t omap_i2c_read(void *opaque, hwaddr addr)
17
 
     return 0;
18
 
 }
19
 
 
20
 
+static uint32_t omap_i2c_readb(void *opaque, hwaddr addr)
21
 
+{
22
 
+    OMAPI2CState *s = opaque;
23
 
+    int offset = addr & OMAP_MPUI_REG_MASK;
24
 
+    uint8_t ret;
25
 
+
26
 
+    switch (offset) {
27
 
+    case 0x1c: /* I2C_DATA */
28
 
+        ret = 0;
29
 
+        if (s->fifolen) {
30
 
+            if (s->revision < OMAP3_INTR_REV) {
31
 
+                if (s->control & (1 << 14)) /* BE */
32
 
+                    ret = (((uint8_t)s->fifo[s->fifostart]) << 8)
33
 
+                        | s->fifo[(s->fifostart + 1) & I2C_FIFO_SIZE_MASK];
34
 
+                else
35
 
+                    ret = (((uint8_t)s->fifo[(s->fifostart + 1) & I2C_FIFO_SIZE_MASK]) << 8)
36
 
+                        | s->fifo[s->fifostart];
37
 
+                s->fifostart = (s->fifostart + 2) & I2C_FIFO_SIZE_MASK;
38
 
+                if (s->fifolen == 1) {
39
 
+                    s->stat |= 1 << 15; /* SBD */
40
 
+                    s->fifolen = 0;
41
 
+                } else
42
 
+                    s->fifolen -= 2;
43
 
+                if (!s->fifolen) {
44
 
+                    s->stat &= ~(1 << 3); /* RRDY */
45
 
+                    s->stat |= 1 << 2;    /* ARDY */
46
 
+                }
47
 
+            } else {
48
 
+                s->stat &= ~(1 << 7); /* AERR */
49
 
+                ret = (uint8_t)s->fifo[s->fifostart++];
50
 
+                s->fifostart &= I2C_FIFO_SIZE_MASK;
51
 
+                if (--s->fifolen) {
52
 
+                    if (s->fifolen <= ((s->dma >> 8) & 0x3f)) {
53
 
+                        s->stat &= ~(1 << 3); /* RRDY */
54
 
+                        s->stat |= 1 << 13;   /* RDR */
55
 
+                    }
56
 
+                } else {
57
 
+                    s->stat &= ~((1 << 3) | (1 << 13)); /* RRDY | RDR */
58
 
+                    s->stat |= 1 << 2;                  /* ARDY */
59
 
+                }
60
 
+            }
61
 
+            s->stat &= ~(1 << 11); /* ROVR */
62
 
+        } else if (s->revision >= OMAP3_INTR_REV)
63
 
+            s->stat |= (1 << 7); /* AERR */
64
 
+        omap_i2c_fifo_run(s);
65
 
+        omap_i2c_interrupts_update(s);
66
 
+        return ret;
67
 
+    default:
68
 
+        break;
69
 
+    }
70
 
+
71
 
+    OMAP_BAD_REG(addr);
72
 
+    return 0;
73
 
+}
74
 
+
75
 
 static void omap_i2c_write(void *opaque, hwaddr addr,
76
 
                 uint32_t value)
77
 
 {
78
 
@@ -589,7 +644,7 @@ static void omap_i2c_writeb(void *opaque, hwaddr addr,
79
 
 static const MemoryRegionOps omap_i2c_ops = {
80
 
     .old_mmio = {
81
 
         .read = {
82
 
-            omap_badwidth_read16,
83
 
+            omap_i2c_readb,
84
 
             omap_i2c_read,
85
 
             omap_badwidth_read16,
86
 
         },
87
 
1.8.5.2
88