summaryrefslogtreecommitdiff
path: root/hw/slavio_timer.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-17 18:17:17 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-17 18:17:17 +0000
commit19f8e5dd2bf6f4093988b13c424a7ba35f39071d (patch)
treeb2841f06b202bd249c76cdb0c139f41231bfc821 /hw/slavio_timer.c
parent4fddf62a74c26f8da3c5ee61600e4d61052b0610 (diff)
downloadqemu-19f8e5dd2bf6f4093988b13c424a7ba35f39071d.tar.gz
Only create as many per CPU timers as there are CPUs. (Robert Reif)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3833 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/slavio_timer.c')
-rw-r--r--hw/slavio_timer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c
index 7d9ee4b2ae..1018f70a9f 100644
--- a/hw/slavio_timer.c
+++ b/hw/slavio_timer.c
@@ -61,6 +61,7 @@ typedef struct SLAVIO_TIMERState {
struct SLAVIO_TIMERState *master;
int slave_index;
// system only
+ unsigned int num_slaves;
struct SLAVIO_TIMERState *slave[MAX_CPUS];
uint32_t slave_mode;
} SLAVIO_TIMERState;
@@ -230,7 +231,7 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr,
if (s->master == NULL) {
unsigned int i;
- for (i = 0; i < MAX_CPUS; i++) {
+ for (i = 0; i < s->num_slaves; i++) {
if (val & (1 << i)) {
qemu_irq_lower(s->slave[i]->irq);
s->slave[i]->limit = -1ULL;
@@ -244,7 +245,7 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr,
ptimer_run(s->slave[i]->timer, 0);
}
}
- s->slave_mode = val & ((1 << MAX_CPUS) - 1);
+ s->slave_mode = val & ((1 << s->num_slaves) - 1);
} else
DPRINTF("not system timer\n");
break;
@@ -352,13 +353,15 @@ static SLAVIO_TIMERState *slavio_timer_init(target_phys_addr_t addr,
}
void slavio_timer_init_all(target_phys_addr_t base, qemu_irq master_irq,
- qemu_irq *cpu_irqs)
+ qemu_irq *cpu_irqs, unsigned int num_cpus)
{
SLAVIO_TIMERState *master;
unsigned int i;
master = slavio_timer_init(base + SYS_TIMER_OFFSET, master_irq, NULL, 0);
+ master->num_slaves = num_cpus;
+
for (i = 0; i < MAX_CPUS; i++) {
master->slave[i] = slavio_timer_init(base + (target_phys_addr_t)
CPU_TIMER_OFFSET(i),