Commit cadae95f334026f5089295bdd6fa8f890e0c31a7
1 parent
e68b9b2b
IER behavior change - better IRQ handling
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1453 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
15 additions
and
7 deletions
hw/cuda.c
... | ... | @@ -120,8 +120,9 @@ typedef struct CUDAState { |
120 | 120 | int data_in_index; |
121 | 121 | int data_out_index; |
122 | 122 | |
123 | + SetIRQFunc *set_irq; | |
123 | 124 | int irq; |
124 | - openpic_t *openpic; | |
125 | + void *irq_opaque; | |
125 | 126 | uint8_t autopoll; |
126 | 127 | uint8_t data_in[128]; |
127 | 128 | uint8_t data_out[16]; |
... | ... | @@ -140,9 +141,9 @@ static void cuda_timer_update(CUDAState *s, CUDATimer *ti, |
140 | 141 | static void cuda_update_irq(CUDAState *s) |
141 | 142 | { |
142 | 143 | if (s->ifr & s->ier & (SR_INT | T1_INT)) { |
143 | - openpic_set_irq(s->openpic, s->irq, 1); | |
144 | + s->set_irq(s->irq_opaque, s->irq, 1); | |
144 | 145 | } else { |
145 | - openpic_set_irq(s->openpic, s->irq, 0); | |
146 | + s->set_irq(s->irq_opaque, s->irq, 0); | |
146 | 147 | } |
147 | 148 | } |
148 | 149 | |
... | ... | @@ -356,6 +357,7 @@ static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) |
356 | 357 | cuda_update_irq(s); |
357 | 358 | break; |
358 | 359 | case 14: |
360 | +#if 0 | |
359 | 361 | if (val & IER_SET) { |
360 | 362 | /* set bits */ |
361 | 363 | s->ier |= val & 0x7f; |
... | ... | @@ -363,6 +365,10 @@ static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) |
363 | 365 | /* reset bits */ |
364 | 366 | s->ier &= ~val; |
365 | 367 | } |
368 | +#else | |
369 | + /* XXX: please explain me why the SPEC is not correct ! */ | |
370 | + s->ier = val; | |
371 | +#endif | |
366 | 372 | cuda_update_irq(s); |
367 | 373 | break; |
368 | 374 | default: |
... | ... | @@ -545,7 +551,7 @@ static void cuda_receive_packet_from_host(CUDAState *s, |
545 | 551 | #ifdef DEBUG_CUDA_PACKET |
546 | 552 | { |
547 | 553 | int i; |
548 | - printf("cuda_receive_packet_to_host:\n"); | |
554 | + printf("cuda_receive_packet_from_host:\n"); | |
549 | 555 | for(i = 0; i < len; i++) |
550 | 556 | printf(" %02x", data[i]); |
551 | 557 | printf("\n"); |
... | ... | @@ -605,19 +611,21 @@ static CPUReadMemoryFunc *cuda_read[] = { |
605 | 611 | &cuda_readl, |
606 | 612 | }; |
607 | 613 | |
608 | -int cuda_init(openpic_t *openpic, int irq) | |
614 | +int cuda_init(SetIRQFunc *set_irq, void *irq_opaque, int irq) | |
609 | 615 | { |
610 | 616 | CUDAState *s = &cuda_state; |
611 | 617 | int cuda_mem_index; |
612 | 618 | |
613 | - s->openpic = openpic; | |
619 | + s->set_irq = set_irq; | |
620 | + s->irq_opaque = irq_opaque; | |
614 | 621 | s->irq = irq; |
615 | 622 | |
616 | 623 | s->timers[0].timer = qemu_new_timer(vm_clock, cuda_timer1, s); |
617 | 624 | s->timers[0].latch = 0x10000; |
618 | 625 | set_counter(s, &s->timers[0], 0xffff); |
619 | 626 | s->timers[1].latch = 0x10000; |
620 | - s->ier = T1_INT | SR_INT; | |
627 | + // s->ier = T1_INT | SR_INT; | |
628 | + s->ier = 0; | |
621 | 629 | set_counter(s, &s->timers[1], 0xffff); |
622 | 630 | |
623 | 631 | s->adb_poll_timer = qemu_new_timer(vm_clock, cuda_adb_poll, s); | ... | ... |