Commit 68238a9e90708740200e652631ee1356dd55147d
1 parent
c2c5104b
Clean up rc4030 init function
At the moment, rc4030 init function is returning some function pointers. Mark them non-static and define them in header file instead. Export also a function to read/write DMA memory, it will be required by the netcard. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7072 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
16 additions
and
17 deletions
hw/mips.h
... | ... | @@ -28,9 +28,11 @@ extern void cpu_mips_clock_init(CPUState *); |
28 | 28 | |
29 | 29 | /* rc4030.c */ |
30 | 30 | typedef struct rc4030DMAState *rc4030_dma; |
31 | -typedef void (*rc4030_dma_function)(void *dma, uint8_t *buf, int len); | |
32 | -qemu_irq *rc4030_init(qemu_irq timer, qemu_irq jazz_bus, | |
33 | - rc4030_dma **dmas, | |
34 | - rc4030_dma_function *dma_read, rc4030_dma_function *dma_write); | |
31 | +void rc4030_dma_memory_rw(void *opaque, target_phys_addr_t addr, uint8_t *buf, int len, int is_write); | |
32 | +void rc4030_dma_read(void *dma, uint8_t *buf, int len); | |
33 | +void rc4030_dma_write(void *dma, uint8_t *buf, int len); | |
34 | + | |
35 | +void *rc4030_init(qemu_irq timer, qemu_irq jazz_bus, | |
36 | + qemu_irq **irqs, rc4030_dma **dmas); | |
35 | 37 | |
36 | 38 | #endif | ... | ... |
hw/mips_jazz.c
... | ... | @@ -133,7 +133,7 @@ void mips_jazz_init (ram_addr_t ram_size, int vga_ram_size, |
133 | 133 | CPUState *env; |
134 | 134 | qemu_irq *rc4030, *i8259; |
135 | 135 | rc4030_dma *dmas; |
136 | - rc4030_dma_function dma_read, dma_write; | |
136 | + void* rc4030_opaque; | |
137 | 137 | void *scsi_hba; |
138 | 138 | int hd; |
139 | 139 | int s_rtc, s_dma_dummy; |
... | ... | @@ -185,8 +185,7 @@ void mips_jazz_init (ram_addr_t ram_size, int vga_ram_size, |
185 | 185 | cpu_mips_clock_init(env); |
186 | 186 | |
187 | 187 | /* Chipset */ |
188 | - rc4030 = rc4030_init(env->irq[6], env->irq[3], | |
189 | - &dmas, &dma_read, &dma_write); | |
188 | + rc4030_opaque = rc4030_init(env->irq[6], env->irq[3], &rc4030, &dmas); | |
190 | 189 | s_dma_dummy = cpu_register_io_memory(0, dma_dummy_read, dma_dummy_write, NULL); |
191 | 190 | cpu_register_physical_memory(0x8000d000, 0x00001000, s_dma_dummy); |
192 | 191 | |
... | ... | @@ -217,7 +216,7 @@ void mips_jazz_init (ram_addr_t ram_size, int vga_ram_size, |
217 | 216 | |
218 | 217 | /* SCSI adapter */ |
219 | 218 | scsi_hba = esp_init(0x80002000, 0, |
220 | - dma_read, dma_write, dmas[0], | |
219 | + rc4030_dma_read, rc4030_dma_write, dmas[0], | |
221 | 220 | rc4030[5], &esp_reset); |
222 | 221 | for (n = 0; n < ESP_MAX_DEVS; n++) { |
223 | 222 | hd = drive_get_index(IF_SCSI, 0, n); | ... | ... |
hw/rc4030.c
... | ... | @@ -675,7 +675,7 @@ static void rc4030_save(QEMUFile *f, void *opaque) |
675 | 675 | qemu_put_be32(f, s->itr); |
676 | 676 | } |
677 | 677 | |
678 | -static void rc4030_dma_memory_rw(void *opaque, target_phys_addr_t addr, uint8_t *buf, int len, int is_write) | |
678 | +void rc4030_dma_memory_rw(void *opaque, target_phys_addr_t addr, uint8_t *buf, int len, int is_write) | |
679 | 679 | { |
680 | 680 | rc4030State *s = opaque; |
681 | 681 | target_phys_addr_t entry_addr; |
... | ... | @@ -766,13 +766,13 @@ struct rc4030DMAState { |
766 | 766 | int n; |
767 | 767 | }; |
768 | 768 | |
769 | -static void rc4030_dma_read(void *dma, uint8_t *buf, int len) | |
769 | +void rc4030_dma_read(void *dma, uint8_t *buf, int len) | |
770 | 770 | { |
771 | 771 | rc4030_dma s = dma; |
772 | 772 | rc4030_do_dma(s->opaque, s->n, buf, len, 0); |
773 | 773 | } |
774 | 774 | |
775 | -static void rc4030_dma_write(void *dma, uint8_t *buf, int len) | |
775 | +void rc4030_dma_write(void *dma, uint8_t *buf, int len) | |
776 | 776 | { |
777 | 777 | rc4030_dma s = dma; |
778 | 778 | rc4030_do_dma(s->opaque, s->n, buf, len, 1); |
... | ... | @@ -795,18 +795,16 @@ static rc4030_dma *rc4030_allocate_dmas(void *opaque, int n) |
795 | 795 | return s; |
796 | 796 | } |
797 | 797 | |
798 | -qemu_irq *rc4030_init(qemu_irq timer, qemu_irq jazz_bus, | |
799 | - rc4030_dma **dmas, | |
800 | - rc4030_dma_function *dma_read, rc4030_dma_function *dma_write) | |
798 | +void *rc4030_init(qemu_irq timer, qemu_irq jazz_bus, | |
799 | + qemu_irq **irqs, rc4030_dma **dmas) | |
801 | 800 | { |
802 | 801 | rc4030State *s; |
803 | 802 | int s_chipset, s_jazzio; |
804 | 803 | |
805 | 804 | s = qemu_mallocz(sizeof(rc4030State)); |
806 | 805 | |
806 | + *irqs = qemu_allocate_irqs(rc4030_irq_jazz_request, s, 16); | |
807 | 807 | *dmas = rc4030_allocate_dmas(s, 4); |
808 | - *dma_read = rc4030_dma_read; | |
809 | - *dma_write = rc4030_dma_write; | |
810 | 808 | |
811 | 809 | s->periodic_timer = qemu_new_timer(vm_clock, rc4030_periodic_timer, s); |
812 | 810 | s->timer_irq = timer; |
... | ... | @@ -821,5 +819,5 @@ qemu_irq *rc4030_init(qemu_irq timer, qemu_irq jazz_bus, |
821 | 819 | s_jazzio = cpu_register_io_memory(0, jazzio_read, jazzio_write, s); |
822 | 820 | cpu_register_physical_memory(0xf0000000, 0x00001000, s_jazzio); |
823 | 821 | |
824 | - return qemu_allocate_irqs(rc4030_irq_jazz_request, s, 16); | |
822 | + return s; | |
825 | 823 | } | ... | ... |