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

« back to all changes in this revision

Viewing changes to hw/timer/etraxfs_timer.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:
42
42
#define R_INTR        0x50
43
43
#define R_MASKED_INTR 0x54
44
44
 
45
 
struct etrax_timer {
46
 
    SysBusDevice busdev;
 
45
#define TYPE_ETRAX_FS_TIMER "etraxfs,timer"
 
46
#define ETRAX_TIMER(obj) \
 
47
    OBJECT_CHECK(ETRAXTimerState, (obj), TYPE_ETRAX_FS_TIMER)
 
48
 
 
49
typedef struct ETRAXTimerState {
 
50
    SysBusDevice parent_obj;
 
51
 
47
52
    MemoryRegion mmio;
48
53
    qemu_irq irq;
49
54
    qemu_irq nmi;
72
77
    uint32_t rw_ack_intr;
73
78
    uint32_t r_intr;
74
79
    uint32_t r_masked_intr;
75
 
};
 
80
} ETRAXTimerState;
76
81
 
77
82
static uint64_t
78
83
timer_read(void *opaque, hwaddr addr, unsigned int size)
79
84
{
80
 
    struct etrax_timer *t = opaque;
 
85
    ETRAXTimerState *t = opaque;
81
86
    uint32_t r = 0;
82
87
 
83
88
    switch (addr) {
103
108
    return r;
104
109
}
105
110
 
106
 
static void update_ctrl(struct etrax_timer *t, int tnum)
 
111
static void update_ctrl(ETRAXTimerState *t, int tnum)
107
112
{
108
113
    unsigned int op;
109
114
    unsigned int freq;
167
172
    }
168
173
}
169
174
 
170
 
static void timer_update_irq(struct etrax_timer *t)
 
175
static void timer_update_irq(ETRAXTimerState *t)
171
176
{
172
177
    t->r_intr &= ~(t->rw_ack_intr);
173
178
    t->r_masked_intr = t->r_intr & t->rw_intr_mask;
178
183
 
179
184
static void timer0_hit(void *opaque)
180
185
{
181
 
    struct etrax_timer *t = opaque;
 
186
    ETRAXTimerState *t = opaque;
182
187
    t->r_intr |= 1;
183
188
    timer_update_irq(t);
184
189
}
185
190
 
186
191
static void timer1_hit(void *opaque)
187
192
{
188
 
    struct etrax_timer *t = opaque;
 
193
    ETRAXTimerState *t = opaque;
189
194
    t->r_intr |= 2;
190
195
    timer_update_irq(t);
191
196
}
192
197
 
193
198
static void watchdog_hit(void *opaque)
194
199
{
195
 
    struct etrax_timer *t = opaque;
 
200
    ETRAXTimerState *t = opaque;
196
201
    if (t->wd_hits == 0) {
197
202
        /* real hw gives a single tick before reseting but we are
198
203
           a bit friendlier to compensate for our slower execution.  */
206
211
    t->wd_hits++;
207
212
}
208
213
 
209
 
static inline void timer_watchdog_update(struct etrax_timer *t, uint32_t value)
 
214
static inline void timer_watchdog_update(ETRAXTimerState *t, uint32_t value)
210
215
{
211
216
    unsigned int wd_en = t->rw_wd_ctrl & (1 << 8);
212
217
    unsigned int wd_key = t->rw_wd_ctrl >> 9;
245
250
timer_write(void *opaque, hwaddr addr,
246
251
            uint64_t val64, unsigned int size)
247
252
{
248
 
    struct etrax_timer *t = opaque;
 
253
    ETRAXTimerState *t = opaque;
249
254
    uint32_t value = val64;
250
255
 
251
256
    switch (addr)
298
303
 
299
304
static void etraxfs_timer_reset(void *opaque)
300
305
{
301
 
    struct etrax_timer *t = opaque;
 
306
    ETRAXTimerState *t = opaque;
302
307
 
303
308
    ptimer_stop(t->ptimer_t0);
304
309
    ptimer_stop(t->ptimer_t1);
311
316
 
312
317
static int etraxfs_timer_init(SysBusDevice *dev)
313
318
{
314
 
    struct etrax_timer *t = FROM_SYSBUS(typeof (*t), dev);
 
319
    ETRAXTimerState *t = ETRAX_TIMER(dev);
315
320
 
316
321
    t->bh_t0 = qemu_bh_new(timer0_hit, t);
317
322
    t->bh_t1 = qemu_bh_new(timer1_hit, t);
323
328
    sysbus_init_irq(dev, &t->irq);
324
329
    sysbus_init_irq(dev, &t->nmi);
325
330
 
326
 
    memory_region_init_io(&t->mmio, &timer_ops, t, "etraxfs-timer", 0x5c);
 
331
    memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t,
 
332
                          "etraxfs-timer", 0x5c);
327
333
    sysbus_init_mmio(dev, &t->mmio);
328
334
    qemu_register_reset(etraxfs_timer_reset, t);
329
335
    return 0;
337
343
}
338
344
 
339
345
static const TypeInfo etraxfs_timer_info = {
340
 
    .name          = "etraxfs,timer",
 
346
    .name          = TYPE_ETRAX_FS_TIMER,
341
347
    .parent        = TYPE_SYS_BUS_DEVICE,
342
 
    .instance_size = sizeof (struct etrax_timer),
 
348
    .instance_size = sizeof(ETRAXTimerState),
343
349
    .class_init    = etraxfs_timer_class_init,
344
350
};
345
351