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,8 +120,9 @@ typedef struct CUDAState { | ||
120 | int data_in_index; | 120 | int data_in_index; |
121 | int data_out_index; | 121 | int data_out_index; |
122 | 122 | ||
123 | + SetIRQFunc *set_irq; | ||
123 | int irq; | 124 | int irq; |
124 | - openpic_t *openpic; | 125 | + void *irq_opaque; |
125 | uint8_t autopoll; | 126 | uint8_t autopoll; |
126 | uint8_t data_in[128]; | 127 | uint8_t data_in[128]; |
127 | uint8_t data_out[16]; | 128 | uint8_t data_out[16]; |
@@ -140,9 +141,9 @@ static void cuda_timer_update(CUDAState *s, CUDATimer *ti, | @@ -140,9 +141,9 @@ static void cuda_timer_update(CUDAState *s, CUDATimer *ti, | ||
140 | static void cuda_update_irq(CUDAState *s) | 141 | static void cuda_update_irq(CUDAState *s) |
141 | { | 142 | { |
142 | if (s->ifr & s->ier & (SR_INT | T1_INT)) { | 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 | } else { | 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,6 +357,7 @@ static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) | ||
356 | cuda_update_irq(s); | 357 | cuda_update_irq(s); |
357 | break; | 358 | break; |
358 | case 14: | 359 | case 14: |
360 | +#if 0 | ||
359 | if (val & IER_SET) { | 361 | if (val & IER_SET) { |
360 | /* set bits */ | 362 | /* set bits */ |
361 | s->ier |= val & 0x7f; | 363 | s->ier |= val & 0x7f; |
@@ -363,6 +365,10 @@ static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) | @@ -363,6 +365,10 @@ static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) | ||
363 | /* reset bits */ | 365 | /* reset bits */ |
364 | s->ier &= ~val; | 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 | cuda_update_irq(s); | 372 | cuda_update_irq(s); |
367 | break; | 373 | break; |
368 | default: | 374 | default: |
@@ -545,7 +551,7 @@ static void cuda_receive_packet_from_host(CUDAState *s, | @@ -545,7 +551,7 @@ static void cuda_receive_packet_from_host(CUDAState *s, | ||
545 | #ifdef DEBUG_CUDA_PACKET | 551 | #ifdef DEBUG_CUDA_PACKET |
546 | { | 552 | { |
547 | int i; | 553 | int i; |
548 | - printf("cuda_receive_packet_to_host:\n"); | 554 | + printf("cuda_receive_packet_from_host:\n"); |
549 | for(i = 0; i < len; i++) | 555 | for(i = 0; i < len; i++) |
550 | printf(" %02x", data[i]); | 556 | printf(" %02x", data[i]); |
551 | printf("\n"); | 557 | printf("\n"); |
@@ -605,19 +611,21 @@ static CPUReadMemoryFunc *cuda_read[] = { | @@ -605,19 +611,21 @@ static CPUReadMemoryFunc *cuda_read[] = { | ||
605 | &cuda_readl, | 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 | CUDAState *s = &cuda_state; | 616 | CUDAState *s = &cuda_state; |
611 | int cuda_mem_index; | 617 | int cuda_mem_index; |
612 | 618 | ||
613 | - s->openpic = openpic; | 619 | + s->set_irq = set_irq; |
620 | + s->irq_opaque = irq_opaque; | ||
614 | s->irq = irq; | 621 | s->irq = irq; |
615 | 622 | ||
616 | s->timers[0].timer = qemu_new_timer(vm_clock, cuda_timer1, s); | 623 | s->timers[0].timer = qemu_new_timer(vm_clock, cuda_timer1, s); |
617 | s->timers[0].latch = 0x10000; | 624 | s->timers[0].latch = 0x10000; |
618 | set_counter(s, &s->timers[0], 0xffff); | 625 | set_counter(s, &s->timers[0], 0xffff); |
619 | s->timers[1].latch = 0x10000; | 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 | set_counter(s, &s->timers[1], 0xffff); | 629 | set_counter(s, &s->timers[1], 0xffff); |
622 | 630 | ||
623 | s->adb_poll_timer = qemu_new_timer(vm_clock, cuda_adb_poll, s); | 631 | s->adb_poll_timer = qemu_new_timer(vm_clock, cuda_adb_poll, s); |