Skip to contentSkip to conversation

Let ESP SCSI adapter to be usable outside sun4m

PATCH In review Hervé Poussineau 2 participants 2 messages Feb 24, 2008 – Feb 29, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Let ESP SCSI adapter to be usable outside sun4m

Hi,

At the moment, ESP SCSI adapter can only be used inside sun4m machines.
Attached patch moves the declaration outside sun4m.h, so other machines can also use it.
I've moved the declaration to devices.h because I found no better place to put it. If you know a better place, please tell me :)

Hervé

Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.245

Makefile.target +2 -2
diff -u -r1.245 Makefile.target
@@ -511,7 +511,7 @@
 endif
 
 # SCSI layer
-OBJS+= lsi53c895a.o
+OBJS+= lsi53c895a.o esp.o
 
 # USB layer
 OBJS+= usb-ohci.o
@@ -573,7 +573,7 @@
 OBJS+= cirrus_vga.o parallel.o ptimer.o
 else
 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
-OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
+OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o sparc32_dma.o
 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
 endif
 endif

Index: hw/devices.h
===================================================================
RCS file: /sources/qemu/qemu/hw/devices.h,v
retrieving revision 1.2

devices.h +10 -0
diff -u -r1.2 devices.h
@@ -16,6 +16,16 @@
 void ads7846_write(void *opaque, uint32_t value);
 struct ads7846_state_s *ads7846_init(qemu_irq penirq);
 
+/* esp.c */
+#ifdef CPU_DEFS_H
+#define ESP_MAX_DEVS 7
+void esp_scsi_attach(void *opaque, BlockDriverState *bd, int id);
+void *esp_init(target_phys_addr_t espaddr,
+               void *dma_opaque, qemu_irq irq, qemu_irq *reset);
+void espdma_memory_read(void *opaque, uint8_t *buf, int len);
+void espdma_memory_write(void *opaque, uint8_t *buf, int len);
+#endif
+
 /* stellaris_input.c */
 void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode);
 

Index: hw/esp.c
===================================================================
RCS file: /sources/qemu/qemu/hw/esp.c,v
retrieving revision 1.33

esp.c +1 -3
diff -u -r1.33 esp.c
@@ -24,9 +24,7 @@
 #include "hw.h"
 #include "block.h"
 #include "scsi-disk.h"
-#include "sun4m.h"
-/* FIXME: Only needed for MAX_DISKS, which is probably wrong.  */
-#include "sysemu.h"
+#include "devices.h"
 
 /* debug ESP card */
 //#define DEBUG_ESP

Index: hw/sun4m.c
===================================================================
RCS file: /sources/qemu/qemu/hw/sun4m.c,v
retrieving revision 1.84

sun4m.c +1 -0
diff -u -r1.84 sun4m.c
@@ -31,6 +31,7 @@
 #include "net.h"
 #include "boards.h"
 #include "firmware_abi.h"
+#include "devices.h"
 
 //#define DEBUG_IRQ
 

Index: hw/sun4m.h
===================================================================
RCS file: /sources/qemu/qemu/hw/sun4m.h,v
retrieving revision 1.10

sun4m.h +0 -6
diff -u -r1.10 sun4m.h
@@ -59,12 +59,6 @@
                        CPUState *env);
 void slavio_set_power_fail(void *opaque, int power_failing);
 
-/* esp.c */
-#define ESP_MAX_DEVS 7
-void esp_scsi_attach(void *opaque, BlockDriverState *bd, int id);
-void *esp_init(target_phys_addr_t espaddr,
-               void *dma_opaque, qemu_irq irq, qemu_irq *reset);
-
 /* cs4231.c */
 void cs_init(target_phys_addr_t base, int irq, void *intctl);
 
#1 lore raw
Quoted 7 lines · Hervé Poussineau

Hi,

At the moment, ESP SCSI adapter can only be used inside sun4m machines. Attached patch moves the declaration outside sun4m.h, so other machines can also use it.
I've moved the declaration to devices.h because I found no better place to put it. If you know a better place, please tell me :)

Good idea, but the patch breaks compiling other targets than Sparc32, because the DMA functions are not defined. Before we have the generic DMA, it may be possible to add #defines to use other DMA controllers' functions. Or the correct access functions could be registered at init time for small performance penalty.