~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to hw/pl031.c

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio, Josh Triplett, Riku Voipio
  • Date: 2009-07-29 13:28:05 UTC
  • mfrom: (1.4.1 upstream)
  • mto: (12.1.1 sid) (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090729132805-cau7rfexh7dawyb8
Tags: 0.10.50+git20090729-1
[ Josh Triplett ]
* Remove myself from Uploaders.

[ Riku Voipio ]
* new upstream RC version
* nuke all linux-user patches (applied upstream)
  06_exit_segfault
  12_signal_powerpc_support
  21_net_soopts
  30_syscall_ipc
  32_syscall_sysctl
  35_syscall_sockaddr
  48_signal_terminate
  55_unmux_socketcall
* nuke all other applied-upstream patches
  01_nostrip (better version upstream)
  07_i386_exec_name (can be reintroduced in debian/rules)
  50_linuxbios_isa_bios_ram (shouldn't be needed anymore)
  51_linuxbios_piix_ram_size (applied)
  56_dhcp (crap)
  60_ppc_ld (reintroduce if needed)
  64_ppc_asm_constraints (ditto)
  66_tls_ld.patch (ditto)
  81_compile_dtb.patch (applied upstream)
  82_qemu-img_decimal (ditto)
* move to git
* simplify build rules
* Correct my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 *
10
10
 */
11
11
 
12
 
#include "hw.h"
13
 
#include "primecell.h"
 
12
#include "sysbus.h"
14
13
#include "qemu-timer.h"
15
 
#include "sysemu.h"
16
14
 
17
15
//#define DEBUG_PL031
18
16
 
19
17
#ifdef DEBUG_PL031
20
 
#define DPRINTF(fmt, args...) \
21
 
do { printf("pl031: " fmt , ##args); } while (0)
 
18
#define DPRINTF(fmt, ...) \
 
19
do { printf("pl031: " fmt , ## __VA_ARGS__); } while (0)
22
20
#else
23
 
#define DPRINTF(fmt, args...) do {} while(0)
 
21
#define DPRINTF(fmt, ...) do {} while(0)
24
22
#endif
25
23
 
26
24
#define RTC_DR      0x00    /* Data read register */
33
31
#define RTC_ICR     0x1c    /* Interrupt clear register */
34
32
 
35
33
typedef struct {
 
34
    SysBusDevice busdev;
36
35
    QEMUTimer *timer;
37
36
    qemu_irq irq;
38
37
 
119
118
                (int)offset);
120
119
        break;
121
120
    default:
122
 
        cpu_abort(cpu_single_env, "pl031_read: Bad offset 0x%x\n",
123
 
                  (int)offset);
 
121
        hw_error("pl031_read: Bad offset 0x%x\n", (int)offset);
124
122
        break;
125
123
    }
126
124
 
168
166
        break;
169
167
 
170
168
    default:
171
 
        cpu_abort(cpu_single_env, "pl031_write: Bad offset 0x%x\n",
172
 
                  (int)offset);
 
169
        hw_error("pl031_write: Bad offset 0x%x\n", (int)offset);
173
170
        break;
174
171
    }
175
172
}
186
183
    pl031_read
187
184
};
188
185
 
189
 
void pl031_init(uint32_t base, qemu_irq irq)
 
186
static void pl031_init(SysBusDevice *dev)
190
187
{
191
188
    int iomemtype;
192
 
    pl031_state *s;
 
189
    pl031_state *s = FROM_SYSBUS(pl031_state, dev);
193
190
    struct tm tm;
194
191
 
195
 
    s = qemu_mallocz(sizeof(pl031_state));
196
 
 
197
 
    iomemtype = cpu_register_io_memory(0, pl031_readfn, pl031_writefn, s);
198
 
    if (iomemtype == -1)
199
 
        cpu_abort(cpu_single_env, "pl031_init: Can't register I/O memory\n");
200
 
 
201
 
    cpu_register_physical_memory(base, 0x00001000, iomemtype);
202
 
 
203
 
    s->irq  = irq;
 
192
    iomemtype = cpu_register_io_memory(pl031_readfn, pl031_writefn, s);
 
193
    if (iomemtype == -1) {
 
194
        hw_error("pl031_init: Can't register I/O memory\n");
 
195
    }
 
196
 
 
197
    sysbus_init_mmio(dev, 0x1000, iomemtype);
 
198
 
 
199
    sysbus_init_irq(dev, &s->irq);
204
200
    /* ??? We assume vm_clock is zero at this point.  */
205
201
    qemu_get_timedate(&tm, 0);
206
202
    s->tick_offset = mktimegm(&tm);
207
203
 
208
204
    s->timer = qemu_new_timer(vm_clock, pl031_interrupt, s);
209
205
}
 
206
 
 
207
static void pl031_register_devices(void)
 
208
{
 
209
    sysbus_register_dev("pl031", sizeof(pl031_state), pl031_init);
 
210
}
 
211
 
 
212
device_init(pl031_register_devices)