From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LsOFX-0004I7-0N for qemu-devel@nongnu.org; Fri, 10 Apr 2009 17:26:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LsOFV-0004Fv-HJ for qemu-devel@nongnu.org; Fri, 10 Apr 2009 17:26:57 -0400 Received: from [199.232.76.173] (port=34454 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LsOFV-0004Fm-EB for qemu-devel@nongnu.org; Fri, 10 Apr 2009 17:26:57 -0400 Received: from savannah.gnu.org ([199.232.41.3]:53660 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LsOFV-00089F-3Y for qemu-devel@nongnu.org; Fri, 10 Apr 2009 17:26:57 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LsOFU-0005rt-HO for qemu-devel@nongnu.org; Fri, 10 Apr 2009 21:26:56 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LsOFU-0005rp-89 for qemu-devel@nongnu.org; Fri, 10 Apr 2009 21:26:56 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Fri, 10 Apr 2009 21:26:56 +0000 Subject: [Qemu-devel] [7072] Clean up rc4030 init function Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 7072 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7072 Author: aurel32 Date: 2009-04-10 21:26:55 +0000 (Fri, 10 Apr 2009) Log Message: ----------- 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?\195?\169 Poussineau Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/hw/mips.h trunk/hw/mips_jazz.c trunk/hw/rc4030.c Modified: trunk/hw/mips.h =================================================================== --- trunk/hw/mips.h 2009-04-10 20:49:44 UTC (rev 7071) +++ trunk/hw/mips.h 2009-04-10 21:26:55 UTC (rev 7072) @@ -28,9 +28,11 @@ /* rc4030.c */ typedef struct rc4030DMAState *rc4030_dma; -typedef void (*rc4030_dma_function)(void *dma, uint8_t *buf, int len); -qemu_irq *rc4030_init(qemu_irq timer, qemu_irq jazz_bus, - rc4030_dma **dmas, - rc4030_dma_function *dma_read, rc4030_dma_function *dma_write); +void rc4030_dma_memory_rw(void *opaque, target_phys_addr_t addr, uint8_t *buf, int len, int is_write); +void rc4030_dma_read(void *dma, uint8_t *buf, int len); +void rc4030_dma_write(void *dma, uint8_t *buf, int len); +void *rc4030_init(qemu_irq timer, qemu_irq jazz_bus, + qemu_irq **irqs, rc4030_dma **dmas); + #endif Modified: trunk/hw/mips_jazz.c =================================================================== --- trunk/hw/mips_jazz.c 2009-04-10 20:49:44 UTC (rev 7071) +++ trunk/hw/mips_jazz.c 2009-04-10 21:26:55 UTC (rev 7072) @@ -133,7 +133,7 @@ CPUState *env; qemu_irq *rc4030, *i8259; rc4030_dma *dmas; - rc4030_dma_function dma_read, dma_write; + void* rc4030_opaque; void *scsi_hba; int hd; int s_rtc, s_dma_dummy; @@ -185,8 +185,7 @@ cpu_mips_clock_init(env); /* Chipset */ - rc4030 = rc4030_init(env->irq[6], env->irq[3], - &dmas, &dma_read, &dma_write); + rc4030_opaque = rc4030_init(env->irq[6], env->irq[3], &rc4030, &dmas); s_dma_dummy = cpu_register_io_memory(0, dma_dummy_read, dma_dummy_write, NULL); cpu_register_physical_memory(0x8000d000, 0x00001000, s_dma_dummy); @@ -217,7 +216,7 @@ /* SCSI adapter */ scsi_hba = esp_init(0x80002000, 0, - dma_read, dma_write, dmas[0], + rc4030_dma_read, rc4030_dma_write, dmas[0], rc4030[5], &esp_reset); for (n = 0; n < ESP_MAX_DEVS; n++) { hd = drive_get_index(IF_SCSI, 0, n); Modified: trunk/hw/rc4030.c =================================================================== --- trunk/hw/rc4030.c 2009-04-10 20:49:44 UTC (rev 7071) +++ trunk/hw/rc4030.c 2009-04-10 21:26:55 UTC (rev 7072) @@ -675,7 +675,7 @@ qemu_put_be32(f, s->itr); } -static void rc4030_dma_memory_rw(void *opaque, target_phys_addr_t addr, uint8_t *buf, int len, int is_write) +void rc4030_dma_memory_rw(void *opaque, target_phys_addr_t addr, uint8_t *buf, int len, int is_write) { rc4030State *s = opaque; target_phys_addr_t entry_addr; @@ -766,13 +766,13 @@ int n; }; -static void rc4030_dma_read(void *dma, uint8_t *buf, int len) +void rc4030_dma_read(void *dma, uint8_t *buf, int len) { rc4030_dma s = dma; rc4030_do_dma(s->opaque, s->n, buf, len, 0); } -static void rc4030_dma_write(void *dma, uint8_t *buf, int len) +void rc4030_dma_write(void *dma, uint8_t *buf, int len) { rc4030_dma s = dma; rc4030_do_dma(s->opaque, s->n, buf, len, 1); @@ -795,18 +795,16 @@ return s; } -qemu_irq *rc4030_init(qemu_irq timer, qemu_irq jazz_bus, - rc4030_dma **dmas, - rc4030_dma_function *dma_read, rc4030_dma_function *dma_write) +void *rc4030_init(qemu_irq timer, qemu_irq jazz_bus, + qemu_irq **irqs, rc4030_dma **dmas) { rc4030State *s; int s_chipset, s_jazzio; s = qemu_mallocz(sizeof(rc4030State)); + *irqs = qemu_allocate_irqs(rc4030_irq_jazz_request, s, 16); *dmas = rc4030_allocate_dmas(s, 4); - *dma_read = rc4030_dma_read; - *dma_write = rc4030_dma_write; s->periodic_timer = qemu_new_timer(vm_clock, rc4030_periodic_timer, s); s->timer_irq = timer; @@ -821,5 +819,5 @@ s_jazzio = cpu_register_io_memory(0, jazzio_read, jazzio_write, s); cpu_register_physical_memory(0xf0000000, 0x00001000, s_jazzio); - return qemu_allocate_irqs(rc4030_irq_jazz_request, s, 16); + return s; }