Skip to contentSkip to conversation

MIPS: DMA support for RC4030 chipset [v2]

PATCH In review Hervé Poussineau 1 participant 2 messages Nov 8, 2008 – Nov 9, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: DMA support for RC4030 chipset [v2]

Hi,

Attached patch implements DMA support to RC4030 chipset and simplifies jazz IO part (at 0xf0000000), where registers contain 16 bit values. The patch also wires DMA transfers for the SCSI adapter in the Jazz emulation (Mips Magnum 4000 and Acer Pica 61).

Blue Swirl's comments have been taken into account in this version:

Changes since v1:
- Support reuse of esp callback functions up to DMA engine
- Don't keep in memory the DMA table, but read it when needed

Hervé

mips.h +4 -1
Index: hw/mips.h
===================================================================
@@ -27,6 +27,9 @@
 extern void cpu_mips_clock_init(CPUState *);
 
 /* rc4030.c */
-qemu_irq *rc4030_init(qemu_irq timer, qemu_irq jazz_bus);
+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);
 
 #endif
mips_jazz.c +7 -12
Index: hw/mips_jazz.c
===================================================================
@@ -102,16 +102,6 @@
 }
 #endif
 
-void espdma_memory_read(void *opaque, uint8_t *buf, int len)
-{
-    printf("espdma_memory_read(buf %p, len %d) not implemented\n", buf, len);
-}
-
-void espdma_memory_write(void *opaque, uint8_t *buf, int len)
-{
-    printf("espdma_memory_write(buf %p, len %d) not implemented\n", buf, len);
-}
-
 #define MAGNUM_BIOS_SIZE_MAX 0x7e000
 #define MAGNUM_BIOS_SIZE (BIOS_SIZE < MAGNUM_BIOS_SIZE_MAX ? BIOS_SIZE : MAGNUM_BIOS_SIZE_MAX)
 
@@ -125,6 +115,8 @@
     int bios_size, n;
     CPUState *env;
     qemu_irq *rc4030, *i8259;
+    rc4030_dma *dmas;
+    rc4030_dma_function dma_read, dma_write;
     void *scsi_hba;
     int hd;
     int s_rtc;
@@ -171,7 +163,8 @@
     cpu_mips_clock_init(env);
 
     /* Chipset */
-    rc4030 = rc4030_init(env->irq[6], env->irq[3]);
+    rc4030 = rc4030_init(env->irq[6], env->irq[3],
+                         &dmas, &dma_read, &dma_write);
 
     /* ISA devices */
     i8259 = i8259_init(env->irq[4]);
@@ -200,7 +193,7 @@
 
     /* SCSI adapter */
     scsi_hba = esp_init(0x80002000, 0,
-                        espdma_memory_read, espdma_memory_write, NULL,
+                        dma_read, dma_write, dmas[0],
                         rc4030[5], &esp_reset);
     for (n = 0; n < ESP_MAX_DEVS; n++) {
         hd = drive_get_index(IF_SCSI, 0, n);
@@ -278,6 +271,7 @@
     .init = mips_magnum_init,
     .ram_require = MAGNUM_BIOS_SIZE + VGA_RAM_SIZE,
     .nodisk_ok = 1,
+    .use_scsi = 1,
 };
 
 QEMUMachine mips_pica61_machine = {
@@ -286,4 +280,5 @@
     .init = mips_pica61_init,
     .ram_require = MAGNUM_BIOS_SIZE + VGA_RAM_SIZE,
     .nodisk_ok = 1,
+    .use_scsi = 1,
 };
rc4030.c +178 -80

460 lines not on this page · raw message

#1 lore raw

Forget that, DMA transfer function can be called in aio path, and cpu_single_env will be NULL in that case

Hervé

Quoted 12 lines · Hervé Poussineau

Hi,

Attached patch implements DMA support to RC4030 chipset and simplifies jazz IO part (at 0xf0000000), where registers contain 16 bit values. The patch also wires DMA transfers for the SCSI adapter in the Jazz emulation (Mips Magnum 4000 and Acer Pica 61).

Blue Swirl's comments have been taken into account in this version:

Changes since v1:
- Support reuse of esp callback functions up to DMA engine
- Don't keep in memory the DMA table, but read it when needed

Hervé