All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Splitting vl.h
Date: Sun, 11 Nov 2007 04:22:23 +0000	[thread overview]
Message-ID: <200711110422.24440.paul@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

The attached patch starts splitting vl.h up a bit.
I've pulled out the i2c, disk and irq code.

Because I picked some of the easier ones, they can also be built once, rather 
than for every target.

Obviously there's a lot left to do, but my grand plan is to get rid of vl.h 
altogether.  A few files will probably end up effectively including 
everything, but hopefully most files should disentangle reasonably well. The 
more gets split out, the better things should get. e.g. scsi-disk.c doesn't 
need vl.h because I already split out the block API.

I want to check this seems a reasonable approach before I go too much further.
Comments?

Paul

[-- Attachment #2: patch.qemu_common_i2c --]
[-- Type: text/x-diff, Size: 24579 bytes --]

Index: Makefile
===================================================================
RCS file: /sources/qemu/qemu/Makefile,v
retrieving revision 1.130
diff -u -p -r1.130 Makefile
--- Makefile	11 Nov 2007 02:51:15 -0000	1.130
+++ Makefile	11 Nov 2007 04:18:14 -0000
@@ -1,5 +1,7 @@
 # Makefile for QEMU.
 
+VPATH=$(SRC_PATH):$(SRC_PATH)/hw
+
 include config-host.mak
 
 .PHONY: all clean distclean dvi info install install-doc tar tarbin \
@@ -50,6 +52,10 @@ OBJS=$(BLOCK_OBJS)
 OBJS+=readline.o console.o 
 OBJS+=block.o
 
+OBJS+=irq.o
+OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
+OBJS+=scsi-disk.o cdrom.o
+
 ifdef CONFIG_WIN32
 OBJS+=tap-win32.o
 endif
Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.222
diff -u -p -r1.222 Makefile.target
--- Makefile.target	11 Nov 2007 02:51:15 -0000	1.222
+++ Makefile.target	11 Nov 2007 04:18:14 -0000
@@ -399,7 +399,6 @@ endif
 VL_OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o
 # XXX: suppress QEMU_TOOL tests
 VL_OBJS+=block-raw.o
-VL_OBJS+=irq.o
 
 ifdef CONFIG_ALSA
 LIBS += -lasound
@@ -421,10 +420,8 @@ CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
 LIBS += $(CONFIG_VNC_TLS_LIBS)
 endif
 
-VL_OBJS += i2c.o smbus.o
-
 # SCSI layer
-VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
+VL_OBJS+= lsi53c895a.o
 
 # USB layer
 VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
@@ -444,7 +441,7 @@ ifeq ($(TARGET_BASE_ARCH), i386)
 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
-VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmport.o vmware_vga.o
+VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
@@ -468,7 +465,7 @@ VL_OBJS+= mips_r4k.o mips_malta.o mips_p
 VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
 VL_OBJS+= jazz_led.o
 VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
-VL_OBJS+= piix_pci.o smbus_eeprom.o parallel.o cirrus_vga.o $(SOUND_HW)
+VL_OBJS+= piix_pci.o parallel.o cirrus_vga.o $(SOUND_HW)
 VL_OBJS+= mipsnet.o
 CPPFLAGS += -DHAS_AUDIO
 endif
@@ -498,8 +495,8 @@ VL_OBJS+= armv7m.o armv7m_nvic.o stellar
 VL_OBJS+= ssd0323.o pl061.o
 VL_OBJS+= arm-semi.o
 VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
-VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o max111x.o max7310.o
-VL_OBJS+= spitz.o ads7846.o ide.o serial.o nand.o ecc.o wm8750.o
+VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o
+VL_OBJS+= spitz.o ads7846.o ide.o serial.o nand.o ecc.o
 VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o omap_i2c.o
 VL_OBJS+= palm.o tsc210x.o
 CPPFLAGS += -DHAS_AUDIO
Index: exec.c
===================================================================
RCS file: /sources/qemu/qemu/exec.c,v
retrieving revision 1.113
diff -u -p -r1.113 exec.c
--- exec.c	10 Nov 2007 15:15:50 -0000	1.113
+++ exec.c	11 Nov 2007 04:18:15 -0000
@@ -1278,11 +1278,9 @@ int cpu_str_to_log_mask(const char *str)
     return mask;
 }
 
-void cpu_abort(CPUState *env, const char *fmt, ...)
+static void __attribute__((noreturn))
+cpu_abortv(CPUState *env, const char *fmt, va_list ap)
 {
-    va_list ap;
-
-    va_start(ap, fmt);
     fprintf(stderr, "qemu: fatal: ");
     vfprintf(stderr, fmt, ap);
     fprintf(stderr, "\n");
@@ -1308,10 +1306,27 @@ void cpu_abort(CPUState *env, const char
         fflush(logfile);
         fclose(logfile);
     }
-    va_end(ap);
     abort();
 }
 
+void cpu_abort(CPUState *env, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    cpu_abortv(env, fmt, ap);
+    va_end(ap);
+}
+
+void qemu_abort(CPUState *env, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    cpu_abortv(env, fmt, ap);
+    va_end(ap);
+}
+
 CPUState *cpu_copy(CPUState *env)
 {
 #if 0
Index: qemu-common.h
===================================================================
RCS file: /sources/qemu/qemu/qemu-common.h,v
retrieving revision 1.1
diff -u -p -r1.1 qemu-common.h
--- qemu-common.h	11 Nov 2007 02:51:16 -0000	1.1
+++ qemu-common.h	11 Nov 2007 04:18:15 -0000
@@ -80,4 +80,10 @@ int strstart(const char *str, const char
 int stristart(const char *str, const char *val, const char **ptr);
 time_t mktimegm(struct tm *tm);
 
+/* Error handling.  */
+
+void qemu_abort(const char *fmt, ...)
+    __attribute__ ((__format__ (__printf__, 1, 2)))
+    __attribute__ ((__noreturn__));
+
 #endif
Index: vl.h
===================================================================
RCS file: /sources/qemu/qemu/vl.h,v
retrieving revision 1.294
diff -u -p -r1.294 vl.h
--- vl.h	11 Nov 2007 02:51:17 -0000	1.294
+++ vl.h	11 Nov 2007 04:18:15 -0000
@@ -1,3 +1,4 @@
+/* FIXME: This header should disappear eventually.  */
 /*
  * QEMU System Emulator header
  *
@@ -26,8 +27,9 @@
 
 #include "qemu-common.h"
 
-/* FIXME: Remove this.  */
+/* FIXME: Remove these.  */
 #include "block.h"
+#include "hw/hw.h"
 
 #ifndef glue
 #define xglue(x, y) x ## y
@@ -446,88 +448,6 @@ int64_t cpu_get_ticks(void);
 void cpu_enable_ticks(void);
 void cpu_disable_ticks(void);
 
-/* VM Load/Save */
-
-typedef struct QEMUFile QEMUFile;
-
-QEMUFile *qemu_fopen(const char *filename, const char *mode);
-void qemu_fflush(QEMUFile *f);
-void qemu_fclose(QEMUFile *f);
-void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size);
-void qemu_put_byte(QEMUFile *f, int v);
-void qemu_put_be16(QEMUFile *f, unsigned int v);
-void qemu_put_be32(QEMUFile *f, unsigned int v);
-void qemu_put_be64(QEMUFile *f, uint64_t v);
-int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size);
-int qemu_get_byte(QEMUFile *f);
-unsigned int qemu_get_be16(QEMUFile *f);
-unsigned int qemu_get_be32(QEMUFile *f);
-uint64_t qemu_get_be64(QEMUFile *f);
-
-static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
-{
-    qemu_put_be64(f, *pv);
-}
-
-static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv)
-{
-    qemu_put_be32(f, *pv);
-}
-
-static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv)
-{
-    qemu_put_be16(f, *pv);
-}
-
-static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv)
-{
-    qemu_put_byte(f, *pv);
-}
-
-static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv)
-{
-    *pv = qemu_get_be64(f);
-}
-
-static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv)
-{
-    *pv = qemu_get_be32(f);
-}
-
-static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv)
-{
-    *pv = qemu_get_be16(f);
-}
-
-static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv)
-{
-    *pv = qemu_get_byte(f);
-}
-
-#if TARGET_LONG_BITS == 64
-#define qemu_put_betl qemu_put_be64
-#define qemu_get_betl qemu_get_be64
-#define qemu_put_betls qemu_put_be64s
-#define qemu_get_betls qemu_get_be64s
-#else
-#define qemu_put_betl qemu_put_be32
-#define qemu_get_betl qemu_get_be32
-#define qemu_put_betls qemu_put_be32s
-#define qemu_get_betls qemu_get_be32s
-#endif
-
-int64_t qemu_ftell(QEMUFile *f);
-int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
-
-typedef void SaveStateHandler(QEMUFile *f, void *opaque);
-typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
-
-int register_savevm(const char *idstr,
-                    int instance_id,
-                    int version_id,
-                    SaveStateHandler *save_state,
-                    LoadStateHandler *load_state,
-                    void *opaque);
 void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
 void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
 
@@ -802,10 +722,6 @@ void pci_piix3_ide_init(PCIBus *bus, Blo
 void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
                         qemu_irq *pic);
 
-/* cdrom.c */
-int cdrom_read_toc(int nb_sectors, uint8_t *buf, int msf, int start_track);
-int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num);
-
 /* ds1225y.c */
 typedef struct ds1225y_t ds1225y_t;
 ds1225y_t *ds1225y_init(target_phys_addr_t mem_base, const char *filename);
@@ -963,7 +879,8 @@ int pcspk_audio_init(AudioState *, qemu_
 #include "hw/i2c.h"
 
 #include "hw/smbus.h"
-
+/* FIXME: remove this.  */
+#include "hw/board.h"
 /* acpi.c */
 extern int acpi_enabled;
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base);
@@ -1209,30 +1126,7 @@ void do_usb_add(const char *devname);
 void do_usb_del(const char *devname);
 void usb_info(void);
 
-/* scsi-disk.c */
-enum scsi_reason {
-    SCSI_REASON_DONE, /* Command complete.  */
-    SCSI_REASON_DATA  /* Transfer complete, more data required.  */
-};
-
-typedef struct SCSIDevice SCSIDevice;
-typedef void (*scsi_completionfn)(void *opaque, int reason, uint32_t tag,
-                                  uint32_t arg);
-
-SCSIDevice *scsi_disk_init(BlockDriverState *bdrv,
-                           int tcq,
-                           scsi_completionfn completion,
-                           void *opaque);
-void scsi_disk_destroy(SCSIDevice *s);
-
-int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun);
-/* SCSI data transfers are asynchrnonous.  However, unlike the block IO
-   layer the completion routine may be called directly by
-   scsi_{read,write}_data.  */
-void scsi_read_data(SCSIDevice *s, uint32_t tag);
-int scsi_write_data(SCSIDevice *s, uint32_t tag);
-void scsi_cancel_io(SCSIDevice *s, uint32_t tag);
-uint8_t *scsi_get_buf(SCSIDevice *s, uint32_t tag);
+#include "hw/scsi-disk.h"
 
 /* lsi53c895a.c */
 void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id);
@@ -1426,14 +1320,6 @@ uint32_t ads7846_read(void *opaque);
 void ads7846_write(void *opaque, uint32_t value);
 struct ads7846_state_s *ads7846_init(qemu_irq penirq);
 
-/* max111x.c */
-struct max111x_s;
-uint32_t max111x_read(void *opaque);
-void max111x_write(void *opaque, uint32_t value);
-struct max111x_s *max1110_init(qemu_irq cb);
-struct max111x_s *max1111_init(qemu_irq cb);
-void max111x_set_input(struct max111x_s *s, int line, uint8_t value);
-
 /* PCMCIA/Cardbus */
 
 struct pcmcia_socket_s {
Index: hw/board.h
===================================================================
RCS file: hw/board.h
diff -N hw/board.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hw/board.h	11 Nov 2007 04:18:15 -0000
@@ -0,0 +1,12 @@
+/* Declarations for use by board files for creating devices.  */
+
+#ifndef HW_BOARD_H
+#define HW_BOARD_H
+
+#include "max7310.h"
+
+#include "max111x.h"
+
+#include "wm8750.h"
+
+#endif
Index: hw/cdrom.c
===================================================================
RCS file: /sources/qemu/qemu/hw/cdrom.c,v
retrieving revision 1.3
diff -u -p -r1.3 cdrom.c
--- hw/cdrom.c	17 Sep 2007 08:09:46 -0000	1.3
+++ hw/cdrom.c	11 Nov 2007 04:18:15 -0000
@@ -25,7 +25,8 @@
 /* ??? Most of the ATAPI emulation is still in ide.c.  It should be moved
    here.  */
 
-#include <vl.h>
+#include "qemu-common.h"
+#include "cdrom.h"
 
 static void lba_to_msf(uint8_t *buf, int lba)
 {
Index: hw/cdrom.h
===================================================================
RCS file: hw/cdrom.h
diff -N hw/cdrom.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hw/cdrom.h	11 Nov 2007 04:18:15 -0000
@@ -0,0 +1,4 @@
+/* cdrom.c */
+int cdrom_read_toc(int nb_sectors, uint8_t *buf, int msf, int start_track);
+int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num);
+
Index: hw/esp.c
===================================================================
RCS file: /sources/qemu/qemu/hw/esp.c,v
retrieving revision 1.27
diff -u -p -r1.27 esp.c
--- hw/esp.c	6 Oct 2007 11:28:21 -0000	1.27
+++ hw/esp.c	11 Nov 2007 04:18:15 -0000
@@ -22,6 +22,7 @@
  * THE SOFTWARE.
  */
 #include "vl.h"
+#include "scsi-disk.h"
 
 /* debug ESP card */
 //#define DEBUG_ESP
Index: hw/hw.h
===================================================================
RCS file: hw/hw.h
diff -N hw/hw.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hw/hw.h	11 Nov 2007 04:18:15 -0000
@@ -0,0 +1,92 @@
+/* Declarations for use by hardware emulation.  */
+#ifndef QEMU_HW_H
+#define QEMU_HW_H
+
+#include "qemu-common.h"
+
+/* VM Load/Save */
+
+typedef struct QEMUFile QEMUFile;
+
+QEMUFile *qemu_fopen(const char *filename, const char *mode);
+void qemu_fflush(QEMUFile *f);
+void qemu_fclose(QEMUFile *f);
+void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size);
+void qemu_put_byte(QEMUFile *f, int v);
+void qemu_put_be16(QEMUFile *f, unsigned int v);
+void qemu_put_be32(QEMUFile *f, unsigned int v);
+void qemu_put_be64(QEMUFile *f, uint64_t v);
+int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size);
+int qemu_get_byte(QEMUFile *f);
+unsigned int qemu_get_be16(QEMUFile *f);
+unsigned int qemu_get_be32(QEMUFile *f);
+uint64_t qemu_get_be64(QEMUFile *f);
+
+static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
+{
+    qemu_put_be64(f, *pv);
+}
+
+static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv)
+{
+    qemu_put_be32(f, *pv);
+}
+
+static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv)
+{
+    qemu_put_be16(f, *pv);
+}
+
+static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv)
+{
+    qemu_put_byte(f, *pv);
+}
+
+static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv)
+{
+    *pv = qemu_get_be64(f);
+}
+
+static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv)
+{
+    *pv = qemu_get_be32(f);
+}
+
+static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv)
+{
+    *pv = qemu_get_be16(f);
+}
+
+static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv)
+{
+    *pv = qemu_get_byte(f);
+}
+
+#ifdef NEED_CPU_H
+#if TARGET_LONG_BITS == 64
+#define qemu_put_betl qemu_put_be64
+#define qemu_get_betl qemu_get_be64
+#define qemu_put_betls qemu_put_be64s
+#define qemu_get_betls qemu_get_be64s
+#else
+#define qemu_put_betl qemu_put_be32
+#define qemu_get_betl qemu_get_be32
+#define qemu_put_betls qemu_put_be32s
+#define qemu_get_betls qemu_get_be32s
+#endif
+#endif
+
+int64_t qemu_ftell(QEMUFile *f);
+int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
+
+typedef void SaveStateHandler(QEMUFile *f, void *opaque);
+typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
+
+int register_savevm(const char *idstr,
+                    int instance_id,
+                    int version_id,
+                    SaveStateHandler *save_state,
+                    LoadStateHandler *load_state,
+                    void *opaque);
+
+#endif
Index: hw/i2c.c
===================================================================
RCS file: /sources/qemu/qemu/hw/i2c.c,v
retrieving revision 1.4
diff -u -p -r1.4 i2c.c
--- hw/i2c.c	3 Nov 2007 00:51:03 -0000	1.4
+++ hw/i2c.c	11 Nov 2007 04:18:15 -0000
@@ -7,7 +7,8 @@
  * This code is licenced under the LGPL.
  */
 
-#include "vl.h"
+#include "hw.h"
+#include "i2c.h"
 
 struct i2c_bus
 {
@@ -30,7 +31,7 @@ i2c_slave *i2c_slave_init(i2c_bus *bus, 
     i2c_slave *dev;
 
     if (size < sizeof(i2c_slave))
-        cpu_abort(cpu_single_env, "I2C struct too small");
+        qemu_abort("I2C struct too small");
 
     dev = (i2c_slave *)qemu_mallocz(size);
     dev->address = address;
Index: hw/i2c.h
===================================================================
RCS file: /sources/qemu/qemu/hw/i2c.h,v
retrieving revision 1.4
diff -u -p -r1.4 i2c.h
--- hw/i2c.h	11 Jul 2007 22:48:58 -0000	1.4
+++ hw/i2c.h	11 Nov 2007 04:18:15 -0000
@@ -50,18 +50,4 @@ void i2c_bus_load(QEMUFile *f, i2c_bus *
 void i2c_slave_save(QEMUFile *f, i2c_slave *dev);
 void i2c_slave_load(QEMUFile *f, i2c_slave *dev);
 
-/* max7310.c */
-i2c_slave *max7310_init(i2c_bus *bus);
-void max7310_reset(i2c_slave *i2c);
-qemu_irq *max7310_gpio_in_get(i2c_slave *i2c);
-void max7310_gpio_out_set(i2c_slave *i2c, int line, qemu_irq handler);
-
-/* wm8750.c */
-i2c_slave *wm8750_init(i2c_bus *bus, AudioState *audio);
-void wm8750_reset(i2c_slave *i2c);
-void wm8750_data_req_set(i2c_slave *i2c,
-                void (*data_req)(void *, int, int), void *opaque);
-void wm8750_dac_dat(void *opaque, uint32_t sample);
-uint32_t wm8750_adc_dat(void *opaque);
-
 #endif
Index: hw/ide.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ide.c,v
retrieving revision 1.70
diff -u -p -r1.70 ide.c
--- hw/ide.c	8 Nov 2007 16:38:17 -0000	1.70
+++ hw/ide.c	11 Nov 2007 04:18:16 -0000
@@ -23,6 +23,7 @@
  * THE SOFTWARE.
  */
 #include "vl.h"
+#include "cdrom.h"
 
 /* debug IDE devices */
 //#define DEBUG_IDE
Index: hw/irq.c
===================================================================
RCS file: /sources/qemu/qemu/hw/irq.c,v
retrieving revision 1.3
diff -u -p -r1.3 irq.c
--- hw/irq.c	29 Oct 2007 10:59:29 -0000	1.3
+++ hw/irq.c	11 Nov 2007 04:18:16 -0000
@@ -21,7 +21,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "vl.h"
+#include "qemu-common.h"
+#include "irq.h"
 
 struct IRQState {
     qemu_irq_handler handler;
Index: hw/lsi53c895a.c
===================================================================
RCS file: /sources/qemu/qemu/hw/lsi53c895a.c,v
retrieving revision 1.10
diff -u -p -r1.10 lsi53c895a.c
--- hw/lsi53c895a.c	16 Sep 2007 21:07:53 -0000	1.10
+++ hw/lsi53c895a.c	11 Nov 2007 04:18:16 -0000
@@ -11,6 +11,7 @@
    big-endian targets.  */
 
 #include "vl.h"
+#include "scsi-disk.h"
 
 //#define DEBUG_LSI
 //#define DEBUG_LSI_REG
Index: hw/max111x.c
===================================================================
RCS file: /sources/qemu/qemu/hw/max111x.c,v
retrieving revision 1.2
diff -u -p -r1.2 max111x.c
--- hw/max111x.c	24 May 2007 18:50:08 -0000	1.2
+++ hw/max111x.c	11 Nov 2007 04:18:16 -0000
@@ -7,7 +7,10 @@
  * This code is licensed under the GNU GPLv2.
  */
 
-#include <vl.h>
+#include "hw.h"
+#include "i2c.h"
+#include "irq.h"
+#include "max111x.h"
 
 struct max111x_s {
     qemu_irq interrupt;
Index: hw/max111x.h
===================================================================
RCS file: hw/max111x.h
diff -N hw/max111x.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hw/max111x.h	11 Nov 2007 04:18:16 -0000
@@ -0,0 +1,8 @@
+/* max111x.c */
+struct max111x_s;
+uint32_t max111x_read(void *opaque);
+void max111x_write(void *opaque, uint32_t value);
+struct max111x_s *max1110_init(qemu_irq cb);
+struct max111x_s *max1111_init(qemu_irq cb);
+void max111x_set_input(struct max111x_s *s, int line, uint8_t value);
+
Index: hw/max7310.c
===================================================================
RCS file: /sources/qemu/qemu/hw/max7310.c,v
retrieving revision 1.2
diff -u -p -r1.2 max7310.c
--- hw/max7310.c	24 May 2007 18:50:08 -0000	1.2
+++ hw/max7310.c	11 Nov 2007 04:18:16 -0000
@@ -7,7 +7,10 @@
  * This file is licensed under GNU GPL.
  */
 
-#include "vl.h"
+#include "hw.h"
+#include "i2c.h"
+#include "irq.h"
+#include "max7310.h"
 
 struct max7310_s {
     i2c_slave i2c;
@@ -182,7 +185,7 @@ static void max7310_gpio_set(void *opaqu
 {
     struct max7310_s *s = (struct max7310_s *) opaque;
     if (line >= sizeof(s->handler) / sizeof(*s->handler) || line  < 0)
-        cpu_abort(cpu_single_env, "bad GPIO line");
+        qemu_abort("bad GPIO line");
 
     if (level)
         s->level |= s->direction & (1 << line);
@@ -220,7 +223,7 @@ void max7310_gpio_out_set(i2c_slave *i2c
 {
     struct max7310_s *s = (struct max7310_s *) i2c;
     if (line >= sizeof(s->handler) / sizeof(*s->handler) || line  < 0)
-        cpu_abort(cpu_single_env, "bad GPIO line");
+        qemu_abort("bad GPIO line");
 
     s->handler[line] = handler;
 }
Index: hw/max7310.h
===================================================================
RCS file: hw/max7310.h
diff -N hw/max7310.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hw/max7310.h	11 Nov 2007 04:18:16 -0000
@@ -0,0 +1,5 @@
+/* max7310.c */
+i2c_slave *max7310_init(i2c_bus *bus);
+void max7310_reset(i2c_slave *i2c);
+qemu_irq *max7310_gpio_in_get(i2c_slave *i2c);
+void max7310_gpio_out_set(i2c_slave *i2c, int line, qemu_irq handler);
Index: hw/scsi-disk.c
===================================================================
RCS file: /sources/qemu/qemu/hw/scsi-disk.c,v
retrieving revision 1.15
diff -u -p -r1.15 scsi-disk.c
--- hw/scsi-disk.c	3 Jun 2007 13:35:16 -0000	1.15
+++ hw/scsi-disk.c	11 Nov 2007 04:18:17 -0000
@@ -25,7 +25,10 @@ do { printf("scsi-disk: " fmt , ##args);
 #define BADF(fmt, args...) \
 do { fprintf(stderr, "scsi-disk: " fmt , ##args); } while (0)
 
-#include "vl.h"
+#include "qemu-common.h"
+#include "block.h"
+#include "scsi-disk.h"
+#include "cdrom.h"
 
 #define SENSE_NO_SENSE        0
 #define SENSE_NOT_READY       2
Index: hw/scsi-disk.h
===================================================================
RCS file: hw/scsi-disk.h
diff -N hw/scsi-disk.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hw/scsi-disk.h	11 Nov 2007 04:18:17 -0000
@@ -0,0 +1,28 @@
+#ifndef SCSI_DISK_H
+#define SCSI_DISK_H
+
+enum scsi_reason {
+    SCSI_REASON_DONE, /* Command complete.  */
+    SCSI_REASON_DATA  /* Transfer complete, more data required.  */
+};
+
+typedef struct SCSIDevice SCSIDevice;
+typedef void (*scsi_completionfn)(void *opaque, int reason, uint32_t tag,
+                                  uint32_t arg);
+
+SCSIDevice *scsi_disk_init(BlockDriverState *bdrv,
+                           int tcq,
+                           scsi_completionfn completion,
+                           void *opaque);
+void scsi_disk_destroy(SCSIDevice *s);
+
+int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun);
+/* SCSI data transfers are asynchrnonous.  However, unlike the block IO
+   layer the completion routine may be called directly by
+   scsi_{read,write}_data.  */
+void scsi_read_data(SCSIDevice *s, uint32_t tag);
+int scsi_write_data(SCSIDevice *s, uint32_t tag);
+void scsi_cancel_io(SCSIDevice *s, uint32_t tag);
+uint8_t *scsi_get_buf(SCSIDevice *s, uint32_t tag);
+
+#endif
Index: hw/smbus.c
===================================================================
RCS file: /sources/qemu/qemu/hw/smbus.c,v
retrieving revision 1.3
diff -u -p -r1.3 smbus.c
--- hw/smbus.c	16 Sep 2007 21:07:56 -0000	1.3
+++ hw/smbus.c	11 Nov 2007 04:18:17 -0000
@@ -9,7 +9,9 @@
 
 /* TODO: Implement PEC.  */
 
-#include "vl.h"
+#include "hw.h"
+#include "i2c.h"
+#include "smbus.h"
 
 //#define DEBUG_SMBUS 1
 
@@ -194,7 +196,7 @@ SMBusDevice *smbus_device_init(i2c_bus *
     SMBusDevice *dev;
 
     if (size < sizeof(SMBusDevice))
-        cpu_abort(cpu_single_env, "SMBus struct too small");
+        qemu_abort("SMBus struct too small");
 
     dev = (SMBusDevice *)i2c_slave_init(bus, address, size);
     dev->i2c.event = smbus_i2c_event;
Index: hw/smbus_eeprom.c
===================================================================
RCS file: /sources/qemu/qemu/hw/smbus_eeprom.c,v
retrieving revision 1.4
diff -u -p -r1.4 smbus_eeprom.c
--- hw/smbus_eeprom.c	17 Sep 2007 08:09:48 -0000	1.4
+++ hw/smbus_eeprom.c	11 Nov 2007 04:18:17 -0000
@@ -22,7 +22,9 @@
  * THE SOFTWARE.
  */
 
-#include "vl.h"
+#include "hw.h"
+#include "i2c.h"
+#include "smbus.h"
 
 //#define DEBUG
 
Index: hw/usb-msd.c
===================================================================
RCS file: /sources/qemu/qemu/hw/usb-msd.c,v
retrieving revision 1.11
diff -u -p -r1.11 usb-msd.c
--- hw/usb-msd.c	17 Sep 2007 08:09:49 -0000	1.11
+++ hw/usb-msd.c	11 Nov 2007 04:18:17 -0000
@@ -8,6 +8,7 @@
  */
 
 #include "vl.h"
+#include "scsi-disk.h"
 
 //#define DEBUG_MSD
 
Index: hw/wm8750.c
===================================================================
RCS file: /sources/qemu/qemu/hw/wm8750.c,v
retrieving revision 1.2
diff -u -p -r1.2 wm8750.c
--- hw/wm8750.c	24 May 2007 18:50:09 -0000	1.2
+++ hw/wm8750.c	11 Nov 2007 04:18:17 -0000
@@ -7,7 +7,10 @@
  * This file is licensed under GNU GPL.
  */
 
-#include "vl.h"
+#include "hw.h"
+#include "i2c.h"
+#include "audio/audio.h"
+#include "wm8750.h"
 
 #define IN_PORT_N	3
 #define OUT_PORT_N	3
Index: hw/wm8750.h
===================================================================
RCS file: hw/wm8750.h
diff -N hw/wm8750.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hw/wm8750.h	11 Nov 2007 04:18:17 -0000
@@ -0,0 +1,7 @@
+/* wm8750.c */
+i2c_slave *wm8750_init(i2c_bus *bus, AudioState *audio);
+void wm8750_reset(i2c_slave *i2c);
+void wm8750_data_req_set(i2c_slave *i2c,
+                void (*data_req)(void *, int, int), void *opaque);
+void wm8750_dac_dat(void *opaque, uint32_t sample);
+uint32_t wm8750_adc_dat(void *opaque);

             reply	other threads:[~2007-11-11  4:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-11  4:22 Paul Brook [this message]
2007-11-11  8:59 ` [Qemu-devel] Splitting vl.h Blue Swirl
2007-11-11 11:03   ` Paul Brook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711110422.24440.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.