From: Paolo Bonzini Date: Mon, 8 Apr 2013 14:55:25 +0000 (+0200) Subject: sysemu: avoid proliferation of include/ subdirectories X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~900^2~59^2~385^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dccfcd0e5f8f37360ebda11ccc4dab164c04d5a3;p=sdk%2Femulator%2Fqemu.git sysemu: avoid proliferation of include/ subdirectories Signed-off-by: Paolo Bonzini --- diff --git a/backends/baum.c b/backends/baum.c index ea9ffe88fb..4cba79fc7d 100644 --- a/backends/baum.c +++ b/backends/baum.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ #include "qemu-common.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/timer.h" #include "hw/usb.h" #include diff --git a/backends/msmouse.c b/backends/msmouse.c index 61052fe783..0ac05a0d10 100644 --- a/backends/msmouse.c +++ b/backends/msmouse.c @@ -23,7 +23,7 @@ */ #include #include "qemu-common.h" -#include "char/char.h" +#include "sysemu/char.h" #include "ui/console.h" #define MSMOUSE_LO6(n) ((n) & 0x3f) diff --git a/backends/rng-egd.c b/backends/rng-egd.c index cc6f5ee28e..9e5a5366f7 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -10,8 +10,8 @@ * See the COPYING file in the top-level directory. */ -#include "qemu/rng.h" -#include "char/char.h" +#include "sysemu/rng.h" +#include "sysemu/char.h" #include "qapi/qmp/qerror.h" #include "hw/qdev.h" /* just for DEFINE_PROP_CHR */ diff --git a/backends/rng-random.c b/backends/rng-random.c index acd20afad2..d5761f2cce 100644 --- a/backends/rng-random.c +++ b/backends/rng-random.c @@ -10,8 +10,8 @@ * See the COPYING file in the top-level directory. */ -#include "qemu/rng-random.h" -#include "qemu/rng.h" +#include "sysemu/rng-random.h" +#include "sysemu/rng.h" #include "qapi/qmp/qerror.h" #include "qemu/main-loop.h" diff --git a/backends/rng.c b/backends/rng.c index 3d3389802e..85cb83f5e1 100644 --- a/backends/rng.c +++ b/backends/rng.c @@ -10,7 +10,7 @@ * See the COPYING file in the top-level directory. */ -#include "qemu/rng.h" +#include "sysemu/rng.h" #include "qapi/qmp/qerror.h" void rng_backend_request_entropy(RngBackend *s, size_t size, diff --git a/backends/tpm.c b/backends/tpm.c index 0580108c5f..b73580134c 100644 --- a/backends/tpm.c +++ b/backends/tpm.c @@ -12,7 +12,7 @@ * Based on backends/rng.c by Anthony Liguori */ -#include "backends/tpm.h" +#include "sysemu/tpm_backend.h" #include "qapi/qmp/qerror.h" #include "sysemu/tpm.h" #include "qemu/thread.h" diff --git a/bt-host.c b/bt-host.c index 2da3c32204..49205bf288 100644 --- a/bt-host.c +++ b/bt-host.c @@ -18,7 +18,7 @@ */ #include "qemu-common.h" -#include "bt/bt.h" +#include "sysemu/bt.h" #include "qemu/main-loop.h" #ifndef _WIN32 diff --git a/bt-vhci.c b/bt-vhci.c index a6a7ab0329..e267c8ad15 100644 --- a/bt-vhci.c +++ b/bt-vhci.c @@ -18,7 +18,7 @@ */ #include "qemu-common.h" -#include "bt/bt.h" +#include "sysemu/bt.h" #include "hw/bt.h" #include "qemu/main-loop.h" diff --git a/gdbstub.c b/gdbstub.c index 22ab12c68c..e80e1d32b1 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -30,7 +30,7 @@ #include "qemu.h" #else #include "monitor/monitor.h" -#include "char/char.h" +#include "sysemu/char.h" #include "sysemu/sysemu.h" #include "exec/gdbstub.h" #endif diff --git a/hmp.c b/hmp.c index dbe9b9043e..1675e77cf0 100644 --- a/hmp.c +++ b/hmp.c @@ -15,7 +15,7 @@ #include "hmp.h" #include "net/net.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/option.h" #include "qemu/timer.h" #include "qmp-commands.h" diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index a4b414621d..2ff43710e4 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -24,7 +24,7 @@ #include "hw/arm/omap.h" #include "sysemu/sysemu.h" #include "qemu/timer.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/block/flash.h" #include "hw/arm/soc_dma.h" #include "hw/sysbus.h" diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index bbecc770ed..24b03a0d29 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -13,7 +13,7 @@ #include "hw/char/serial.h" #include "hw/i2c/i2c.h" #include "hw/ssi.h" -#include "char/char.h" +#include "sysemu/char.h" #include "sysemu/blockdev.h" static struct { diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 75a813e618..4d49306dd0 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -30,7 +30,7 @@ #include "strongarm.h" #include "qemu/error-report.h" #include "hw/arm/arm.h" -#include "char/char.h" +#include "sysemu/char.h" #include "sysemu/sysemu.h" #include "hw/ssi.h" diff --git a/hw/bt/core.c b/hw/bt/core.c index 24ef4de49d..49012e028c 100644 --- a/hw/bt/core.c +++ b/hw/bt/core.c @@ -18,7 +18,7 @@ */ #include "qemu-common.h" -#include "bt/bt.h" +#include "sysemu/bt.h" #include "hw/bt.h" /* Slave implementations can ignore this */ diff --git a/hw/bt/hci-csr.c b/hw/bt/hci-csr.c index 55c819b085..16a25cb349 100644 --- a/hw/bt/hci-csr.c +++ b/hw/bt/hci-csr.c @@ -19,10 +19,10 @@ */ #include "qemu-common.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/timer.h" #include "hw/irq.h" -#include "bt/bt.h" +#include "sysemu/bt.h" #include "hw/bt.h" struct csrhci_s { diff --git a/hw/bt/hci.c b/hw/bt/hci.c index a76edea2c9..b53cd5dea2 100644 --- a/hw/bt/hci.c +++ b/hw/bt/hci.c @@ -21,7 +21,7 @@ #include "qemu-common.h" #include "qemu/timer.h" #include "hw/usb.h" -#include "bt/bt.h" +#include "sysemu/bt.h" #include "hw/bt.h" struct bt_hci_s { diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index 421ec998d6..c2a783430b 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -17,7 +17,7 @@ */ #include "hw/sysbus.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/timer.h" #ifdef CADENCE_UART_ERR_DEBUG diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index 0588eebb77..02c9577024 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -25,7 +25,7 @@ */ #include "hw/hw.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/isa/isa.h" #include "hw/i386/pc.h" diff --git a/hw/char/escc.c b/hw/char/escc.c index 067b055fee..c2cb07f3bd 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -25,7 +25,7 @@ #include "hw/hw.h" #include "hw/sysbus.h" #include "hw/char/escc.h" -#include "char/char.h" +#include "sysemu/char.h" #include "ui/console.h" #include "trace.h" diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c index b7499d775b..11820f5864 100644 --- a/hw/char/etraxfs_ser.c +++ b/hw/char/etraxfs_ser.c @@ -23,7 +23,7 @@ */ #include "hw/sysbus.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/log.h" #define D(x) diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index 8b4e72ca11..5751816c62 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -21,7 +21,7 @@ #include "hw/sysbus.h" #include "sysemu/sysemu.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/arm/exynos4210.h" diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c index 62f799083c..a64453fb18 100644 --- a/hw/char/grlib_apbuart.c +++ b/hw/char/grlib_apbuart.c @@ -23,7 +23,7 @@ */ #include "hw/sysbus.h" -#include "char/char.h" +#include "sysemu/char.h" #include "trace.h" diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index d7ec2090fd..2a2c230c55 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -20,7 +20,7 @@ #include "hw/hw.h" #include "hw/sysbus.h" #include "sysemu/sysemu.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/arm/imx.h" //#define DEBUG_SERIAL 1 diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index fcd0af31b4..c9698a6bc4 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -10,7 +10,7 @@ #include "ipack.h" #include "qemu/bitops.h" -#include "char/char.h" +#include "sysemu/char.h" /* #define DEBUG_IPOCTAL */ diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c index 93f0d1534e..839f3ebfe7 100644 --- a/hw/char/lm32_juart.c +++ b/hw/char/lm32_juart.c @@ -20,7 +20,7 @@ #include "hw/hw.h" #include "hw/sysbus.h" #include "trace.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/lm32/lm32_juart.h" diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c index 32bc37ac96..99721ab78d 100644 --- a/hw/char/lm32_uart.c +++ b/hw/char/lm32_uart.c @@ -25,7 +25,7 @@ #include "hw/hw.h" #include "hw/sysbus.h" #include "trace.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/error-report.h" enum { diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index 6724b1b718..3ec4705867 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -7,7 +7,7 @@ */ #include "hw/hw.h" #include "hw/m68k/mcf.h" -#include "char/char.h" +#include "sysemu/char.h" #include "exec/address-spaces.h" typedef struct { diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c index f3bdf6991a..cbc7d73a6e 100644 --- a/hw/char/milkymist-uart.c +++ b/hw/char/milkymist-uart.c @@ -24,7 +24,7 @@ #include "hw/hw.h" #include "hw/sysbus.h" #include "trace.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/error-report.h" enum { diff --git a/hw/char/omap_uart.c b/hw/char/omap_uart.c index 26c14266fc..5bb36ed2c1 100644 --- a/hw/char/omap_uart.c +++ b/hw/char/omap_uart.c @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, see . */ -#include "char/char.h" +#include "sysemu/char.h" #include "hw/hw.h" #include "hw/arm/omap.h" #include "hw/char/serial.h" diff --git a/hw/char/parallel.c b/hw/char/parallel.c index 863a6fb4a9..b5e867f21c 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -23,7 +23,7 @@ * THE SOFTWARE. */ #include "hw/hw.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/isa/isa.h" #include "hw/i386/pc.h" #include "sysemu/sysemu.h" diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 332d5b970c..7079ef6be1 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -8,7 +8,7 @@ */ #include "hw/sysbus.h" -#include "char/char.h" +#include "sysemu/char.h" typedef struct { SysBusDevice busdev; diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index 42ed54c9ab..bcc7893230 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -18,7 +18,7 @@ #include "hw/s390x/sclp.h" #include "hw/s390x/event-facility.h" -#include "char/char.h" +#include "sysemu/char.h" typedef struct ASCIIConsoleData { EventBufferHeader ebh; diff --git a/hw/char/serial.c b/hw/char/serial.c index 1151bf1bab..66b6348867 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -24,7 +24,7 @@ */ #include "hw/char/serial.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/timer.h" #include "exec/address-spaces.h" diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c index 450c7d8551..b3286438ca 100644 --- a/hw/char/sh_serial.c +++ b/hw/char/sh_serial.c @@ -26,7 +26,7 @@ */ #include "hw/hw.h" #include "hw/sh4/sh.h" -#include "char/char.h" +#include "sysemu/char.h" #include "exec/address-spaces.h" //#define DEBUG_SERIAL diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index 9df018a230..afcec1f182 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -1,5 +1,5 @@ #include "hw/qdev.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 31f672c9a3..50350303cd 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -10,7 +10,7 @@ * the COPYING file in the top-level directory. */ -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/error-report.h" #include "trace.h" #include "hw/virtio/virtio-serial.h" diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index efc32320fa..eb7f450aba 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -30,7 +30,7 @@ #include #include "hw/hw.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/xen/xen_backend.h" #include diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index 079f4d4e1a..3f7e989f35 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -23,7 +23,7 @@ */ #include "hw/sysbus.h" -#include "char/char.h" +#include "sysemu/char.h" #define DUART(x) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 8c2e15205c..0eada32dcf 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -17,7 +17,7 @@ #include "hw/block/block.h" #include "net/hub.h" #include "qapi/visitor.h" -#include "char/char.h" +#include "sysemu/char.h" static void get_pointer(Object *obj, Visitor *v, Property *prop, const char *(*print)(void *ptr), diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 9a0872d3b9..ddde18e6b4 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -5,7 +5,7 @@ #include "hw/block/block.h" #include "net/hub.h" #include "qapi/visitor.h" -#include "char/char.h" +#include "sysemu/char.h" void qdev_prop_set_after_realize(DeviceState *dev, const char *name, Error **errp) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index 8e4266142d..e371569585 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -37,7 +37,7 @@ #include "hw/hw.h" #include "ui/console.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/xen/xen_backend.h" #include diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 9f5e185685..82f7c80f9c 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -27,7 +27,7 @@ #include "qemu/error-report.h" #include "sysemu/blockdev.h" #include "sysemu/sysemu.h" -#include "char/char.h" +#include "sysemu/char.h" #include "trace.h" diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 3cf27fa822..1aac93a414 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -30,7 +30,7 @@ #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/pci/pci.h" -#include "char/char.h" +#include "sysemu/char.h" #include "sysemu/sysemu.h" #include "audio/audio.h" #include "qemu/log.h" diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index a3e936b77f..86f42b2ede 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -34,7 +34,7 @@ #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/pci/pci.h" -#include "char/char.h" +#include "sysemu/char.h" #include "sysemu/sysemu.h" #include "sysemu/arch_init.h" #include "hw/boards.h" diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index f92ce19dde..a19a6d6d8c 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -24,7 +24,7 @@ #include "migration/migration.h" #include "qapi/qmp/qerror.h" #include "qemu/event_notifier.h" -#include "char/char.h" +#include "sysemu/char.h" #include #include diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c index 5275f4810d..1d9074a1d0 100644 --- a/hw/net/xgmac.c +++ b/hw/net/xgmac.c @@ -25,7 +25,7 @@ */ #include "hw/sysbus.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/log.h" #include "net/net.h" #include "net/checksum.h" diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index ff87ac31d1..c0d7e62f32 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -26,7 +26,7 @@ */ #include "cpu.h" #include "sysemu/sysemu.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index b71b59c5cf..8ecaa5f8ec 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -26,7 +26,7 @@ */ #include "cpu.h" #include "sysemu/sysemu.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index 3b27d4019a..78c77eff46 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -24,7 +24,7 @@ #include "hw/hw.h" #include "qemu/timer.h" #include "hw/ptimer.h" -#include "char/char.h" +#include "sysemu/char.h" #include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/loader.h" diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c index 578127723f..416b9b65c7 100644 --- a/hw/tpm/tpm_passthrough.c +++ b/hw/tpm/tpm_passthrough.c @@ -27,7 +27,7 @@ #include "qemu-common.h" #include "qapi/error.h" #include "qemu/sockets.h" -#include "backends/tpm.h" +#include "sysemu/tpm_backend.h" #include "tpm_int.h" #include "hw/hw.h" #include "hw/i386/pc.h" diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index faa3cecafe..d4d8152875 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -19,7 +19,7 @@ * specification. */ -#include "backends/tpm.h" +#include "sysemu/tpm_backend.h" #include "tpm_int.h" #include "block/block.h" #include "exec/address-spaces.h" diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 29dcd7acbf..d534c94c1a 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -32,7 +32,7 @@ #include #include "qemu/thread.h" -#include "char/char.h" +#include "sysemu/char.h" #include "monitor/monitor.h" #include "ccid.h" diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index 5e017ae0ca..71a45f674f 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -8,7 +8,7 @@ * See the COPYING file in the top-level directory. */ -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/sockets.h" #include "monitor/monitor.h" #include "ccid.h" diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c index 0f8aa48c85..68cc1d4fab 100644 --- a/hw/usb/dev-bluetooth.c +++ b/hw/usb/dev-bluetooth.c @@ -21,7 +21,7 @@ #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/desc.h" -#include "bt/bt.h" +#include "sysemu/bt.h" #include "hw/bt.h" struct USBBtState { diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 7c314dc59d..dd0a608bff 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -12,7 +12,7 @@ #include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h" -#include "char/char.h" +#include "sysemu/char.h" //#define DEBUG_Serial diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 0ddb0818d8..a594e954e4 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -30,7 +30,7 @@ #include "monitor/monitor.h" #include "sysemu/sysemu.h" #include "qemu/iov.h" -#include "char/char.h" +#include "sysemu/char.h" #include #include diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 6079b2a3a9..fcc223af06 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -14,7 +14,7 @@ #include "qapi/qmp/qerror.h" #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-rng.h" -#include "qemu/rng.h" +#include "sysemu/rng.h" static bool is_guest_ready(VirtIORNG *vrng) { diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c index 2a8c9f5d1a..d82ce5d8a6 100644 --- a/hw/xen/xen_backend.c +++ b/hw/xen/xen_backend.c @@ -35,7 +35,7 @@ #include #include "hw/hw.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/log.h" #include "hw/xen/xen_backend.h" diff --git a/hw/xtensa/xtensa_lx60.c b/hw/xtensa/xtensa_lx60.c index 2682eda2ad..650dd31c98 100644 --- a/hw/xtensa/xtensa_lx60.c +++ b/hw/xtensa/xtensa_lx60.c @@ -36,7 +36,7 @@ #include "hw/sysbus.h" #include "hw/block/flash.h" #include "sysemu/blockdev.h" -#include "char/char.h" +#include "sysemu/char.h" #include "xtensa_bootparam.h" typedef struct LxBoardDesc { diff --git a/include/backends/tpm.h b/include/backends/tpm.h deleted file mode 100644 index 466787453d..0000000000 --- a/include/backends/tpm.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - * QEMU TPM Backend - * - * Copyright IBM, Corp. 2013 - * - * Authors: - * Stefan Berger - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef _QEMU_TPM_H -#define _QEMU_TPM_H - -#include "qom/object.h" -#include "qemu-common.h" -#include "qapi/error.h" -#include "qapi-types.h" -#include "qemu/option.h" -#include "sysemu/tpm.h" - -#define TYPE_TPM_BACKEND "tpm-backend" -#define TPM_BACKEND(obj) \ - OBJECT_CHECK(TPMBackend, (obj), TYPE_TPM_BACKEND) -#define TPM_BACKEND_GET_CLASS(obj) \ - OBJECT_GET_CLASS(TPMBackendClass, (obj), TYPE_TPM_BACKEND) -#define TPM_BACKEND_CLASS(klass) \ - OBJECT_CLASS_CHECK(TPMBackendClass, (klass), TYPE_TPM_BACKEND) - -typedef struct TPMBackendClass TPMBackendClass; -typedef struct TPMBackend TPMBackend; - -typedef struct TPMDriverOps TPMDriverOps; - -struct TPMBackendClass { - ObjectClass parent_class; - - const TPMDriverOps *ops; - - void (*opened)(TPMBackend *s, Error **errp); -}; - -struct TPMBackend { - Object parent; - - /*< protected >*/ - bool opened; - - char *id; - enum TpmModel fe_model; - char *path; - char *cancel_path; - const TPMDriverOps *ops; - - QLIST_ENTRY(TPMBackend) list; -}; - -typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty); - -typedef struct TPMSizedBuffer { - uint32_t size; - uint8_t *buffer; -} TPMSizedBuffer; - -struct TPMDriverOps { - enum TpmType type; - /* get a descriptive text of the backend to display to the user */ - const char *(*desc)(void); - - TPMBackend *(*create)(QemuOpts *opts, const char *id); - void (*destroy)(TPMBackend *t); - - /* initialize the backend */ - int (*init)(TPMBackend *t, TPMState *s, TPMRecvDataCB *datacb); - /* start up the TPM on the backend */ - int (*startup_tpm)(TPMBackend *t); - /* returns true if nothing will ever answer TPM requests */ - bool (*had_startup_error)(TPMBackend *t); - - size_t (*realloc_buffer)(TPMSizedBuffer *sb); - - void (*deliver_request)(TPMBackend *t); - - void (*reset)(TPMBackend *t); - - void (*cancel_cmd)(TPMBackend *t); - - bool (*get_tpm_established_flag)(TPMBackend *t); -}; - - -/** - * tpm_backend_get_type: - * @s: the backend - * - * Returns the TpmType of the backend. - */ -enum TpmType tpm_backend_get_type(TPMBackend *s); - -/** - * tpm_backend_get_desc: - * @s: the backend - * - * Returns a human readable description of the backend. - */ -const char *tpm_backend_get_desc(TPMBackend *s); - -/** - * tpm_backend_destroy: - * @s: the backend to destroy - */ -void tpm_backend_destroy(TPMBackend *s); - -/** - * tpm_backend_init: - * @s: the backend to initialized - * @state: TPMState - * @datacb: callback for sending data to frontend - * - * Initialize the backend with the given variables. - * - * Returns 0 on success. - */ -int tpm_backend_init(TPMBackend *s, TPMState *state, - TPMRecvDataCB *datacb); - -/** - * tpm_backend_startup_tpm: - * @s: the backend whose TPM support is to be started - * - * Returns 0 on success. - */ -int tpm_backend_startup_tpm(TPMBackend *s); - -/** - * tpm_backend_had_startup_error: - * @s: the backend to query for a statup error - * - * Check whether the backend had an error during startup. Returns - * false if no error occurred and the backend can be used, true - * otherwise. - */ -bool tpm_backend_had_startup_error(TPMBackend *s); - -/** - * tpm_backend_realloc_buffer: - * @s: the backend - * @sb: the TPMSizedBuffer to re-allocated to the size suitable for the - * backend. - * - * This function returns the size of the allocated buffer - */ -size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb); - -/** - * tpm_backend_deliver_request: - * @s: the backend to send the request to - * - * Send a request to the backend. The backend will then send the request - * to the TPM implementation. - */ -void tpm_backend_deliver_request(TPMBackend *s); - -/** - * tpm_backend_reset: - * @s: the backend to reset - * - * Reset the backend into a well defined state with all previous errors - * reset. - */ -void tpm_backend_reset(TPMBackend *s); - -/** - * tpm_backend_cancel_cmd: - * @s: the backend - * - * Cancel any ongoing command being processed by the TPM implementation - * on behalf of the QEMU guest. - */ -void tpm_backend_cancel_cmd(TPMBackend *s); - -/** - * tpm_backend_get_tpm_established_flag: - * @s: the backend - * - * Get the TPM establishment flag. This function may be called very - * frequently by the frontend since for example in the TIS implementation - * this flag is part of a register. - */ -bool tpm_backend_get_tpm_established_flag(TPMBackend *s); - -/** - * tpm_backend_open: - * @s: the backend to open - * @errp: a pointer to return the #Error object if an error occurs. - * - * This function will open the backend if it is not already open. Calling this - * function on an already opened backend will not result in an error. - */ -void tpm_backend_open(TPMBackend *s, Error **errp); - -TPMBackend *qemu_find_tpm(const char *id); - -const TPMDriverOps *tpm_get_backend_driver(const char *type); -int tpm_register_model(enum TpmModel model); -int tpm_register_driver(const TPMDriverOps *tdo); - -#endif diff --git a/include/bt/bt.h b/include/bt/bt.h deleted file mode 100644 index 2bc6d53cca..0000000000 --- a/include/bt/bt.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef BT_HOST_H -#define BT_HOST_H - -/* BT HCI info */ - -struct HCIInfo { - int (*bdaddr_set)(struct HCIInfo *hci, const uint8_t *bd_addr); - void (*cmd_send)(struct HCIInfo *hci, const uint8_t *data, int len); - void (*sco_send)(struct HCIInfo *hci, const uint8_t *data, int len); - void (*acl_send)(struct HCIInfo *hci, const uint8_t *data, int len); - void *opaque; - void (*evt_recv)(void *opaque, const uint8_t *data, int len); - void (*acl_recv)(void *opaque, const uint8_t *data, int len); -}; - -/* bt-host.c */ -struct HCIInfo *bt_host_hci(const char *id); -struct HCIInfo *qemu_next_hci(void); - -#endif diff --git a/include/char/char.h b/include/char/char.h deleted file mode 100644 index 9d1ea46117..0000000000 --- a/include/char/char.h +++ /dev/null @@ -1,306 +0,0 @@ -#ifndef QEMU_CHAR_H -#define QEMU_CHAR_H - -#include "qemu-common.h" -#include "qemu/queue.h" -#include "qemu/option.h" -#include "qemu/config-file.h" -#include "block/aio.h" -#include "qapi/qmp/qobject.h" -#include "qapi/qmp/qstring.h" -#include "qemu/main-loop.h" - -/* character device */ - -#define CHR_EVENT_BREAK 0 /* serial break char */ -#define CHR_EVENT_FOCUS 1 /* focus to this terminal (modal input needed) */ -#define CHR_EVENT_OPENED 2 /* new connection established */ -#define CHR_EVENT_MUX_IN 3 /* mux-focus was set to this terminal */ -#define CHR_EVENT_MUX_OUT 4 /* mux-focus will move on */ -#define CHR_EVENT_CLOSED 5 /* connection closed */ - - -#define CHR_IOCTL_SERIAL_SET_PARAMS 1 -typedef struct { - int speed; - int parity; - int data_bits; - int stop_bits; -} QEMUSerialSetParams; - -#define CHR_IOCTL_SERIAL_SET_BREAK 2 - -#define CHR_IOCTL_PP_READ_DATA 3 -#define CHR_IOCTL_PP_WRITE_DATA 4 -#define CHR_IOCTL_PP_READ_CONTROL 5 -#define CHR_IOCTL_PP_WRITE_CONTROL 6 -#define CHR_IOCTL_PP_READ_STATUS 7 -#define CHR_IOCTL_PP_EPP_READ_ADDR 8 -#define CHR_IOCTL_PP_EPP_READ 9 -#define CHR_IOCTL_PP_EPP_WRITE_ADDR 10 -#define CHR_IOCTL_PP_EPP_WRITE 11 -#define CHR_IOCTL_PP_DATA_DIR 12 - -#define CHR_IOCTL_SERIAL_SET_TIOCM 13 -#define CHR_IOCTL_SERIAL_GET_TIOCM 14 - -#define CHR_TIOCM_CTS 0x020 -#define CHR_TIOCM_CAR 0x040 -#define CHR_TIOCM_DSR 0x100 -#define CHR_TIOCM_RI 0x080 -#define CHR_TIOCM_DTR 0x002 -#define CHR_TIOCM_RTS 0x004 - -typedef void IOEventHandler(void *opaque, int event); - -struct CharDriverState { - void (*init)(struct CharDriverState *s); - int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len); - GSource *(*chr_add_watch)(struct CharDriverState *s, GIOCondition cond); - void (*chr_update_read_handler)(struct CharDriverState *s); - int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg); - int (*get_msgfd)(struct CharDriverState *s); - int (*chr_add_client)(struct CharDriverState *chr, int fd); - IOEventHandler *chr_event; - IOCanReadHandler *chr_can_read; - IOReadHandler *chr_read; - void *handler_opaque; - void (*chr_close)(struct CharDriverState *chr); - void (*chr_accept_input)(struct CharDriverState *chr); - void (*chr_set_echo)(struct CharDriverState *chr, bool echo); - void (*chr_set_fe_open)(struct CharDriverState *chr, int fe_open); - void *opaque; - int idle_tag; - char *label; - char *filename; - int be_open; - int fe_open; - int explicit_fe_open; - int avail_connections; - QemuOpts *opts; - QTAILQ_ENTRY(CharDriverState) next; -}; - -/** - * @qemu_chr_new_from_opts: - * - * Create a new character backend from a QemuOpts list. - * - * @opts see qemu-config.c for a list of valid options - * @init not sure.. - * - * Returns: a new character backend - */ -CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, - void (*init)(struct CharDriverState *s), - Error **errp); - -/** - * @qemu_chr_new: - * - * Create a new character backend from a URI. - * - * @label the name of the backend - * @filename the URI - * @init not sure.. - * - * Returns: a new character backend - */ -CharDriverState *qemu_chr_new(const char *label, const char *filename, - void (*init)(struct CharDriverState *s)); - -/** - * @qemu_chr_delete: - * - * Destroy a character backend. - */ -void qemu_chr_delete(CharDriverState *chr); - -/** - * @qemu_chr_fe_set_echo: - * - * Ask the backend to override its normal echo setting. This only really - * applies to the stdio backend and is used by the QMP server such that you - * can see what you type if you try to type QMP commands. - * - * @echo true to enable echo, false to disable echo - */ -void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo); - -/** - * @qemu_chr_fe_set_open: - * - * Set character frontend open status. This is an indication that the - * front end is ready (or not) to begin doing I/O. - */ -void qemu_chr_fe_set_open(struct CharDriverState *chr, int fe_open); - -/** - * @qemu_chr_fe_printf: - * - * Write to a character backend using a printf style interface. - * - * @fmt see #printf - */ -void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...) - GCC_FMT_ATTR(2, 3); - -int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, - GIOFunc func, void *user_data); - -/** - * @qemu_chr_fe_write: - * - * Write data to a character backend from the front end. This function will - * send data from the front end to the back end. - * - * @buf the data - * @len the number of bytes to send - * - * Returns: the number of bytes consumed - */ -int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len); - -/** - * @qemu_chr_fe_write_all: - * - * Write data to a character backend from the front end. This function will - * send data from the front end to the back end. Unlike @qemu_chr_fe_write, - * this function will block if the back end cannot consume all of the data - * attempted to be written. - * - * @buf the data - * @len the number of bytes to send - * - * Returns: the number of bytes consumed - */ -int qemu_chr_fe_write_all(CharDriverState *s, const uint8_t *buf, int len); - -/** - * @qemu_chr_fe_ioctl: - * - * Issue a device specific ioctl to a backend. - * - * @cmd see CHR_IOCTL_* - * @arg the data associated with @cmd - * - * Returns: if @cmd is not supported by the backend, -ENOTSUP, otherwise the - * return value depends on the semantics of @cmd - */ -int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg); - -/** - * @qemu_chr_fe_get_msgfd: - * - * For backends capable of fd passing, return the latest file descriptor passed - * by a client. - * - * Returns: -1 if fd passing isn't supported or there is no pending file - * descriptor. If a file descriptor is returned, subsequent calls to - * this function will return -1 until a client sends a new file - * descriptor. - */ -int qemu_chr_fe_get_msgfd(CharDriverState *s); - -/** - * @qemu_chr_fe_claim: - * - * Claim a backend before using it, should be called before calling - * qemu_chr_add_handlers(). - * - * Returns: -1 if the backend is already in use by another frontend, 0 on - * success. - */ -int qemu_chr_fe_claim(CharDriverState *s); - -/** - * @qemu_chr_fe_claim_no_fail: - * - * Like qemu_chr_fe_claim, but will exit qemu with an error when the - * backend is already in use. - */ -void qemu_chr_fe_claim_no_fail(CharDriverState *s); - -/** - * @qemu_chr_fe_claim: - * - * Release a backend for use by another frontend. - * - * Returns: -1 if the backend is already in use by another frontend, 0 on - * success. - */ -void qemu_chr_fe_release(CharDriverState *s); - -/** - * @qemu_chr_be_can_write: - * - * Determine how much data the front end can currently accept. This function - * returns the number of bytes the front end can accept. If it returns 0, the - * front end cannot receive data at the moment. The function must be polled - * to determine when data can be received. - * - * Returns: the number of bytes the front end can receive via @qemu_chr_be_write - */ -int qemu_chr_be_can_write(CharDriverState *s); - -/** - * @qemu_chr_be_write: - * - * Write data from the back end to the front end. Before issuing this call, - * the caller should call @qemu_chr_be_can_write to determine how much data - * the front end can currently accept. - * - * @buf a buffer to receive data from the front end - * @len the number of bytes to receive from the front end - */ -void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len); - - -/** - * @qemu_chr_be_event: - * - * Send an event from the back end to the front end. - * - * @event the event to send - */ -void qemu_chr_be_event(CharDriverState *s, int event); - -void qemu_chr_add_handlers(CharDriverState *s, - IOCanReadHandler *fd_can_read, - IOReadHandler *fd_read, - IOEventHandler *fd_event, - void *opaque); - -void qemu_chr_be_generic_open(CharDriverState *s); -void qemu_chr_accept_input(CharDriverState *s); -int qemu_chr_add_client(CharDriverState *s, int fd); -void qemu_chr_info_print(Monitor *mon, const QObject *ret_data); -void qemu_chr_info(Monitor *mon, QObject **ret_data); -CharDriverState *qemu_chr_find(const char *name); - -QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename); - -void register_char_driver(const char *name, CharDriverState *(*open)(QemuOpts *)); -void register_char_driver_qapi(const char *name, int kind, - void (*parse)(QemuOpts *opts, ChardevBackend *backend, Error **errp)); - -/* add an eventfd to the qemu devices that are polled */ -CharDriverState *qemu_chr_open_eventfd(int eventfd); - -extern int term_escape_char; - -/* memory chardev */ -void qemu_chr_init_mem(CharDriverState *chr); -void qemu_chr_close_mem(CharDriverState *chr); -QString *qemu_chr_mem_to_qs(CharDriverState *chr); -size_t qemu_chr_mem_osize(const CharDriverState *chr); - -CharDriverState *qemu_char_get_next_serial(void); - -/* msmouse */ -CharDriverState *qemu_chr_open_msmouse(void); - -/* baum.c */ -CharDriverState *chr_baum_init(void); - -#endif diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h index 3711c97a70..c9cadc24b6 100644 --- a/include/hw/virtio/virtio-rng.h +++ b/include/hw/virtio/virtio-rng.h @@ -12,8 +12,8 @@ #ifndef _QEMU_VIRTIO_RNG_H #define _QEMU_VIRTIO_RNG_H -#include "qemu/rng.h" -#include "qemu/rng-random.h" +#include "sysemu/rng.h" +#include "sysemu/rng-random.h" /* The Virtio ID for the virtio rng device */ #define VIRTIO_ID_RNG 4 diff --git a/include/qemu/rng-random.h b/include/qemu/rng-random.h deleted file mode 100644 index 4332772a24..0000000000 --- a/include/qemu/rng-random.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * QEMU Random Number Generator Backend - * - * Copyright IBM, Corp. 2012 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ -#ifndef QEMU_RNG_RANDOM_H -#define QEMU_RNG_RANDOM_H - -#include "qom/object.h" - -#define TYPE_RNG_RANDOM "rng-random" -#define RNG_RANDOM(obj) OBJECT_CHECK(RndRandom, (obj), TYPE_RNG_RANDOM) - -typedef struct RndRandom RndRandom; - -#endif diff --git a/include/qemu/rng.h b/include/qemu/rng.h deleted file mode 100644 index 509abd023d..0000000000 --- a/include/qemu/rng.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * QEMU Random Number Generator Backend - * - * Copyright IBM, Corp. 2012 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef QEMU_RNG_H -#define QEMU_RNG_H - -#include "qom/object.h" -#include "qemu-common.h" -#include "qapi/error.h" - -#define TYPE_RNG_BACKEND "rng-backend" -#define RNG_BACKEND(obj) \ - OBJECT_CHECK(RngBackend, (obj), TYPE_RNG_BACKEND) -#define RNG_BACKEND_GET_CLASS(obj) \ - OBJECT_GET_CLASS(RngBackendClass, (obj), TYPE_RNG_BACKEND) -#define RNG_BACKEND_CLASS(klass) \ - OBJECT_CLASS_CHECK(RngBackendClass, (klass), TYPE_RNG_BACKEND) - -typedef struct RngBackendClass RngBackendClass; -typedef struct RngBackend RngBackend; - -typedef void (EntropyReceiveFunc)(void *opaque, - const void *data, - size_t size); - -struct RngBackendClass -{ - ObjectClass parent_class; - - void (*request_entropy)(RngBackend *s, size_t size, - EntropyReceiveFunc *recieve_entropy, void *opaque); - void (*cancel_requests)(RngBackend *s); - - void (*opened)(RngBackend *s, Error **errp); -}; - -struct RngBackend -{ - Object parent; - - /*< protected >*/ - bool opened; -}; - -/** - * rng_backend_request_entropy: - * @s: the backend to request entropy from - * @size: the number of bytes of data to request - * @receive_entropy: a function to be invoked when entropy is available - * @opaque: data that should be passed to @receive_entropy - * - * This function is used by the front-end to request entropy from an entropy - * source. This function can be called multiple times before @receive_entropy - * is invoked with different values of @receive_entropy and @opaque. The - * backend will queue each request and handle appropriately. - * - * The backend does not need to pass the full amount of data to @receive_entropy - * but will pass a value greater than 0. - */ -void rng_backend_request_entropy(RngBackend *s, size_t size, - EntropyReceiveFunc *receive_entropy, - void *opaque); - -/** - * rng_backend_cancel_requests: - * @s: the backend to cancel all pending requests in - * - * Cancels all pending requests submitted by @rng_backend_request_entropy. This - * should be used by a device during reset or in preparation for live migration - * to stop tracking any request. - */ -void rng_backend_cancel_requests(RngBackend *s); - -/** - * rng_backend_open: - * @s: the backend to open - * @errp: a pointer to return the #Error object if an error occurs. - * - * This function will open the backend if it is not already open. Calling this - * function on an already opened backend will not result in an error. - */ -void rng_backend_open(RngBackend *s, Error **errp); - -#endif diff --git a/include/sysemu/bt.h b/include/sysemu/bt.h new file mode 100644 index 0000000000..2bc6d53cca --- /dev/null +++ b/include/sysemu/bt.h @@ -0,0 +1,20 @@ +#ifndef BT_HOST_H +#define BT_HOST_H + +/* BT HCI info */ + +struct HCIInfo { + int (*bdaddr_set)(struct HCIInfo *hci, const uint8_t *bd_addr); + void (*cmd_send)(struct HCIInfo *hci, const uint8_t *data, int len); + void (*sco_send)(struct HCIInfo *hci, const uint8_t *data, int len); + void (*acl_send)(struct HCIInfo *hci, const uint8_t *data, int len); + void *opaque; + void (*evt_recv)(void *opaque, const uint8_t *data, int len); + void (*acl_recv)(void *opaque, const uint8_t *data, int len); +}; + +/* bt-host.c */ +struct HCIInfo *bt_host_hci(const char *id); +struct HCIInfo *qemu_next_hci(void); + +#endif diff --git a/include/sysemu/char.h b/include/sysemu/char.h new file mode 100644 index 0000000000..9d1ea46117 --- /dev/null +++ b/include/sysemu/char.h @@ -0,0 +1,306 @@ +#ifndef QEMU_CHAR_H +#define QEMU_CHAR_H + +#include "qemu-common.h" +#include "qemu/queue.h" +#include "qemu/option.h" +#include "qemu/config-file.h" +#include "block/aio.h" +#include "qapi/qmp/qobject.h" +#include "qapi/qmp/qstring.h" +#include "qemu/main-loop.h" + +/* character device */ + +#define CHR_EVENT_BREAK 0 /* serial break char */ +#define CHR_EVENT_FOCUS 1 /* focus to this terminal (modal input needed) */ +#define CHR_EVENT_OPENED 2 /* new connection established */ +#define CHR_EVENT_MUX_IN 3 /* mux-focus was set to this terminal */ +#define CHR_EVENT_MUX_OUT 4 /* mux-focus will move on */ +#define CHR_EVENT_CLOSED 5 /* connection closed */ + + +#define CHR_IOCTL_SERIAL_SET_PARAMS 1 +typedef struct { + int speed; + int parity; + int data_bits; + int stop_bits; +} QEMUSerialSetParams; + +#define CHR_IOCTL_SERIAL_SET_BREAK 2 + +#define CHR_IOCTL_PP_READ_DATA 3 +#define CHR_IOCTL_PP_WRITE_DATA 4 +#define CHR_IOCTL_PP_READ_CONTROL 5 +#define CHR_IOCTL_PP_WRITE_CONTROL 6 +#define CHR_IOCTL_PP_READ_STATUS 7 +#define CHR_IOCTL_PP_EPP_READ_ADDR 8 +#define CHR_IOCTL_PP_EPP_READ 9 +#define CHR_IOCTL_PP_EPP_WRITE_ADDR 10 +#define CHR_IOCTL_PP_EPP_WRITE 11 +#define CHR_IOCTL_PP_DATA_DIR 12 + +#define CHR_IOCTL_SERIAL_SET_TIOCM 13 +#define CHR_IOCTL_SERIAL_GET_TIOCM 14 + +#define CHR_TIOCM_CTS 0x020 +#define CHR_TIOCM_CAR 0x040 +#define CHR_TIOCM_DSR 0x100 +#define CHR_TIOCM_RI 0x080 +#define CHR_TIOCM_DTR 0x002 +#define CHR_TIOCM_RTS 0x004 + +typedef void IOEventHandler(void *opaque, int event); + +struct CharDriverState { + void (*init)(struct CharDriverState *s); + int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len); + GSource *(*chr_add_watch)(struct CharDriverState *s, GIOCondition cond); + void (*chr_update_read_handler)(struct CharDriverState *s); + int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg); + int (*get_msgfd)(struct CharDriverState *s); + int (*chr_add_client)(struct CharDriverState *chr, int fd); + IOEventHandler *chr_event; + IOCanReadHandler *chr_can_read; + IOReadHandler *chr_read; + void *handler_opaque; + void (*chr_close)(struct CharDriverState *chr); + void (*chr_accept_input)(struct CharDriverState *chr); + void (*chr_set_echo)(struct CharDriverState *chr, bool echo); + void (*chr_set_fe_open)(struct CharDriverState *chr, int fe_open); + void *opaque; + int idle_tag; + char *label; + char *filename; + int be_open; + int fe_open; + int explicit_fe_open; + int avail_connections; + QemuOpts *opts; + QTAILQ_ENTRY(CharDriverState) next; +}; + +/** + * @qemu_chr_new_from_opts: + * + * Create a new character backend from a QemuOpts list. + * + * @opts see qemu-config.c for a list of valid options + * @init not sure.. + * + * Returns: a new character backend + */ +CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, + void (*init)(struct CharDriverState *s), + Error **errp); + +/** + * @qemu_chr_new: + * + * Create a new character backend from a URI. + * + * @label the name of the backend + * @filename the URI + * @init not sure.. + * + * Returns: a new character backend + */ +CharDriverState *qemu_chr_new(const char *label, const char *filename, + void (*init)(struct CharDriverState *s)); + +/** + * @qemu_chr_delete: + * + * Destroy a character backend. + */ +void qemu_chr_delete(CharDriverState *chr); + +/** + * @qemu_chr_fe_set_echo: + * + * Ask the backend to override its normal echo setting. This only really + * applies to the stdio backend and is used by the QMP server such that you + * can see what you type if you try to type QMP commands. + * + * @echo true to enable echo, false to disable echo + */ +void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo); + +/** + * @qemu_chr_fe_set_open: + * + * Set character frontend open status. This is an indication that the + * front end is ready (or not) to begin doing I/O. + */ +void qemu_chr_fe_set_open(struct CharDriverState *chr, int fe_open); + +/** + * @qemu_chr_fe_printf: + * + * Write to a character backend using a printf style interface. + * + * @fmt see #printf + */ +void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...) + GCC_FMT_ATTR(2, 3); + +int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, + GIOFunc func, void *user_data); + +/** + * @qemu_chr_fe_write: + * + * Write data to a character backend from the front end. This function will + * send data from the front end to the back end. + * + * @buf the data + * @len the number of bytes to send + * + * Returns: the number of bytes consumed + */ +int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len); + +/** + * @qemu_chr_fe_write_all: + * + * Write data to a character backend from the front end. This function will + * send data from the front end to the back end. Unlike @qemu_chr_fe_write, + * this function will block if the back end cannot consume all of the data + * attempted to be written. + * + * @buf the data + * @len the number of bytes to send + * + * Returns: the number of bytes consumed + */ +int qemu_chr_fe_write_all(CharDriverState *s, const uint8_t *buf, int len); + +/** + * @qemu_chr_fe_ioctl: + * + * Issue a device specific ioctl to a backend. + * + * @cmd see CHR_IOCTL_* + * @arg the data associated with @cmd + * + * Returns: if @cmd is not supported by the backend, -ENOTSUP, otherwise the + * return value depends on the semantics of @cmd + */ +int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg); + +/** + * @qemu_chr_fe_get_msgfd: + * + * For backends capable of fd passing, return the latest file descriptor passed + * by a client. + * + * Returns: -1 if fd passing isn't supported or there is no pending file + * descriptor. If a file descriptor is returned, subsequent calls to + * this function will return -1 until a client sends a new file + * descriptor. + */ +int qemu_chr_fe_get_msgfd(CharDriverState *s); + +/** + * @qemu_chr_fe_claim: + * + * Claim a backend before using it, should be called before calling + * qemu_chr_add_handlers(). + * + * Returns: -1 if the backend is already in use by another frontend, 0 on + * success. + */ +int qemu_chr_fe_claim(CharDriverState *s); + +/** + * @qemu_chr_fe_claim_no_fail: + * + * Like qemu_chr_fe_claim, but will exit qemu with an error when the + * backend is already in use. + */ +void qemu_chr_fe_claim_no_fail(CharDriverState *s); + +/** + * @qemu_chr_fe_claim: + * + * Release a backend for use by another frontend. + * + * Returns: -1 if the backend is already in use by another frontend, 0 on + * success. + */ +void qemu_chr_fe_release(CharDriverState *s); + +/** + * @qemu_chr_be_can_write: + * + * Determine how much data the front end can currently accept. This function + * returns the number of bytes the front end can accept. If it returns 0, the + * front end cannot receive data at the moment. The function must be polled + * to determine when data can be received. + * + * Returns: the number of bytes the front end can receive via @qemu_chr_be_write + */ +int qemu_chr_be_can_write(CharDriverState *s); + +/** + * @qemu_chr_be_write: + * + * Write data from the back end to the front end. Before issuing this call, + * the caller should call @qemu_chr_be_can_write to determine how much data + * the front end can currently accept. + * + * @buf a buffer to receive data from the front end + * @len the number of bytes to receive from the front end + */ +void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len); + + +/** + * @qemu_chr_be_event: + * + * Send an event from the back end to the front end. + * + * @event the event to send + */ +void qemu_chr_be_event(CharDriverState *s, int event); + +void qemu_chr_add_handlers(CharDriverState *s, + IOCanReadHandler *fd_can_read, + IOReadHandler *fd_read, + IOEventHandler *fd_event, + void *opaque); + +void qemu_chr_be_generic_open(CharDriverState *s); +void qemu_chr_accept_input(CharDriverState *s); +int qemu_chr_add_client(CharDriverState *s, int fd); +void qemu_chr_info_print(Monitor *mon, const QObject *ret_data); +void qemu_chr_info(Monitor *mon, QObject **ret_data); +CharDriverState *qemu_chr_find(const char *name); + +QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename); + +void register_char_driver(const char *name, CharDriverState *(*open)(QemuOpts *)); +void register_char_driver_qapi(const char *name, int kind, + void (*parse)(QemuOpts *opts, ChardevBackend *backend, Error **errp)); + +/* add an eventfd to the qemu devices that are polled */ +CharDriverState *qemu_chr_open_eventfd(int eventfd); + +extern int term_escape_char; + +/* memory chardev */ +void qemu_chr_init_mem(CharDriverState *chr); +void qemu_chr_close_mem(CharDriverState *chr); +QString *qemu_chr_mem_to_qs(CharDriverState *chr); +size_t qemu_chr_mem_osize(const CharDriverState *chr); + +CharDriverState *qemu_char_get_next_serial(void); + +/* msmouse */ +CharDriverState *qemu_chr_open_msmouse(void); + +/* baum.c */ +CharDriverState *chr_baum_init(void); + +#endif diff --git a/include/sysemu/rng-random.h b/include/sysemu/rng-random.h new file mode 100644 index 0000000000..4332772a24 --- /dev/null +++ b/include/sysemu/rng-random.h @@ -0,0 +1,22 @@ +/* + * QEMU Random Number Generator Backend + * + * Copyright IBM, Corp. 2012 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#ifndef QEMU_RNG_RANDOM_H +#define QEMU_RNG_RANDOM_H + +#include "qom/object.h" + +#define TYPE_RNG_RANDOM "rng-random" +#define RNG_RANDOM(obj) OBJECT_CHECK(RndRandom, (obj), TYPE_RNG_RANDOM) + +typedef struct RndRandom RndRandom; + +#endif diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h new file mode 100644 index 0000000000..509abd023d --- /dev/null +++ b/include/sysemu/rng.h @@ -0,0 +1,93 @@ +/* + * QEMU Random Number Generator Backend + * + * Copyright IBM, Corp. 2012 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef QEMU_RNG_H +#define QEMU_RNG_H + +#include "qom/object.h" +#include "qemu-common.h" +#include "qapi/error.h" + +#define TYPE_RNG_BACKEND "rng-backend" +#define RNG_BACKEND(obj) \ + OBJECT_CHECK(RngBackend, (obj), TYPE_RNG_BACKEND) +#define RNG_BACKEND_GET_CLASS(obj) \ + OBJECT_GET_CLASS(RngBackendClass, (obj), TYPE_RNG_BACKEND) +#define RNG_BACKEND_CLASS(klass) \ + OBJECT_CLASS_CHECK(RngBackendClass, (klass), TYPE_RNG_BACKEND) + +typedef struct RngBackendClass RngBackendClass; +typedef struct RngBackend RngBackend; + +typedef void (EntropyReceiveFunc)(void *opaque, + const void *data, + size_t size); + +struct RngBackendClass +{ + ObjectClass parent_class; + + void (*request_entropy)(RngBackend *s, size_t size, + EntropyReceiveFunc *recieve_entropy, void *opaque); + void (*cancel_requests)(RngBackend *s); + + void (*opened)(RngBackend *s, Error **errp); +}; + +struct RngBackend +{ + Object parent; + + /*< protected >*/ + bool opened; +}; + +/** + * rng_backend_request_entropy: + * @s: the backend to request entropy from + * @size: the number of bytes of data to request + * @receive_entropy: a function to be invoked when entropy is available + * @opaque: data that should be passed to @receive_entropy + * + * This function is used by the front-end to request entropy from an entropy + * source. This function can be called multiple times before @receive_entropy + * is invoked with different values of @receive_entropy and @opaque. The + * backend will queue each request and handle appropriately. + * + * The backend does not need to pass the full amount of data to @receive_entropy + * but will pass a value greater than 0. + */ +void rng_backend_request_entropy(RngBackend *s, size_t size, + EntropyReceiveFunc *receive_entropy, + void *opaque); + +/** + * rng_backend_cancel_requests: + * @s: the backend to cancel all pending requests in + * + * Cancels all pending requests submitted by @rng_backend_request_entropy. This + * should be used by a device during reset or in preparation for live migration + * to stop tracking any request. + */ +void rng_backend_cancel_requests(RngBackend *s); + +/** + * rng_backend_open: + * @s: the backend to open + * @errp: a pointer to return the #Error object if an error occurs. + * + * This function will open the backend if it is not already open. Calling this + * function on an already opened backend will not result in an error. + */ +void rng_backend_open(RngBackend *s, Error **errp); + +#endif diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h new file mode 100644 index 0000000000..466787453d --- /dev/null +++ b/include/sysemu/tpm_backend.h @@ -0,0 +1,209 @@ +/* + * QEMU TPM Backend + * + * Copyright IBM, Corp. 2013 + * + * Authors: + * Stefan Berger + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef _QEMU_TPM_H +#define _QEMU_TPM_H + +#include "qom/object.h" +#include "qemu-common.h" +#include "qapi/error.h" +#include "qapi-types.h" +#include "qemu/option.h" +#include "sysemu/tpm.h" + +#define TYPE_TPM_BACKEND "tpm-backend" +#define TPM_BACKEND(obj) \ + OBJECT_CHECK(TPMBackend, (obj), TYPE_TPM_BACKEND) +#define TPM_BACKEND_GET_CLASS(obj) \ + OBJECT_GET_CLASS(TPMBackendClass, (obj), TYPE_TPM_BACKEND) +#define TPM_BACKEND_CLASS(klass) \ + OBJECT_CLASS_CHECK(TPMBackendClass, (klass), TYPE_TPM_BACKEND) + +typedef struct TPMBackendClass TPMBackendClass; +typedef struct TPMBackend TPMBackend; + +typedef struct TPMDriverOps TPMDriverOps; + +struct TPMBackendClass { + ObjectClass parent_class; + + const TPMDriverOps *ops; + + void (*opened)(TPMBackend *s, Error **errp); +}; + +struct TPMBackend { + Object parent; + + /*< protected >*/ + bool opened; + + char *id; + enum TpmModel fe_model; + char *path; + char *cancel_path; + const TPMDriverOps *ops; + + QLIST_ENTRY(TPMBackend) list; +}; + +typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty); + +typedef struct TPMSizedBuffer { + uint32_t size; + uint8_t *buffer; +} TPMSizedBuffer; + +struct TPMDriverOps { + enum TpmType type; + /* get a descriptive text of the backend to display to the user */ + const char *(*desc)(void); + + TPMBackend *(*create)(QemuOpts *opts, const char *id); + void (*destroy)(TPMBackend *t); + + /* initialize the backend */ + int (*init)(TPMBackend *t, TPMState *s, TPMRecvDataCB *datacb); + /* start up the TPM on the backend */ + int (*startup_tpm)(TPMBackend *t); + /* returns true if nothing will ever answer TPM requests */ + bool (*had_startup_error)(TPMBackend *t); + + size_t (*realloc_buffer)(TPMSizedBuffer *sb); + + void (*deliver_request)(TPMBackend *t); + + void (*reset)(TPMBackend *t); + + void (*cancel_cmd)(TPMBackend *t); + + bool (*get_tpm_established_flag)(TPMBackend *t); +}; + + +/** + * tpm_backend_get_type: + * @s: the backend + * + * Returns the TpmType of the backend. + */ +enum TpmType tpm_backend_get_type(TPMBackend *s); + +/** + * tpm_backend_get_desc: + * @s: the backend + * + * Returns a human readable description of the backend. + */ +const char *tpm_backend_get_desc(TPMBackend *s); + +/** + * tpm_backend_destroy: + * @s: the backend to destroy + */ +void tpm_backend_destroy(TPMBackend *s); + +/** + * tpm_backend_init: + * @s: the backend to initialized + * @state: TPMState + * @datacb: callback for sending data to frontend + * + * Initialize the backend with the given variables. + * + * Returns 0 on success. + */ +int tpm_backend_init(TPMBackend *s, TPMState *state, + TPMRecvDataCB *datacb); + +/** + * tpm_backend_startup_tpm: + * @s: the backend whose TPM support is to be started + * + * Returns 0 on success. + */ +int tpm_backend_startup_tpm(TPMBackend *s); + +/** + * tpm_backend_had_startup_error: + * @s: the backend to query for a statup error + * + * Check whether the backend had an error during startup. Returns + * false if no error occurred and the backend can be used, true + * otherwise. + */ +bool tpm_backend_had_startup_error(TPMBackend *s); + +/** + * tpm_backend_realloc_buffer: + * @s: the backend + * @sb: the TPMSizedBuffer to re-allocated to the size suitable for the + * backend. + * + * This function returns the size of the allocated buffer + */ +size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb); + +/** + * tpm_backend_deliver_request: + * @s: the backend to send the request to + * + * Send a request to the backend. The backend will then send the request + * to the TPM implementation. + */ +void tpm_backend_deliver_request(TPMBackend *s); + +/** + * tpm_backend_reset: + * @s: the backend to reset + * + * Reset the backend into a well defined state with all previous errors + * reset. + */ +void tpm_backend_reset(TPMBackend *s); + +/** + * tpm_backend_cancel_cmd: + * @s: the backend + * + * Cancel any ongoing command being processed by the TPM implementation + * on behalf of the QEMU guest. + */ +void tpm_backend_cancel_cmd(TPMBackend *s); + +/** + * tpm_backend_get_tpm_established_flag: + * @s: the backend + * + * Get the TPM establishment flag. This function may be called very + * frequently by the frontend since for example in the TIS implementation + * this flag is part of a register. + */ +bool tpm_backend_get_tpm_established_flag(TPMBackend *s); + +/** + * tpm_backend_open: + * @s: the backend to open + * @errp: a pointer to return the #Error object if an error occurs. + * + * This function will open the backend if it is not already open. Calling this + * function on an already opened backend will not result in an error. + */ +void tpm_backend_open(TPMBackend *s, Error **errp); + +TPMBackend *qemu_find_tpm(const char *id); + +const TPMDriverOps *tpm_get_backend_driver(const char *type); +int tpm_register_model(enum TpmModel model); +int tpm_register_driver(const TPMDriverOps *tdo); + +#endif diff --git a/monitor.c b/monitor.c index e605822445..2909ca1985 100644 --- a/monitor.c +++ b/monitor.c @@ -33,7 +33,7 @@ #include "exec/gdbstub.h" #include "net/net.h" #include "net/slirp.h" -#include "char/char.h" +#include "sysemu/char.h" #include "ui/qemu-spice.h" #include "sysemu/sysemu.h" #include "monitor/monitor.h" diff --git a/net/slirp.c b/net/slirp.c index eabfee6d4f..b3f35d5861 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -35,7 +35,7 @@ #include "monitor/monitor.h" #include "qemu/sockets.h" #include "slirp/libslirp.h" -#include "char/char.h" +#include "sysemu/char.h" static int get_str_sep(char *buf, int buf_size, const char **pp, int sep) { diff --git a/qemu-char.c b/qemu-char.c index eae17fc61c..14707eac68 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -26,7 +26,7 @@ #include "ui/console.h" #include "sysemu/sysemu.h" #include "qemu/timer.h" -#include "char/char.h" +#include "sysemu/char.h" #include "hw/usb.h" #include "qmp-commands.h" diff --git a/qmp.c b/qmp.c index 55b056b558..ed6c7ef3ae 100644 --- a/qmp.c +++ b/qmp.c @@ -16,7 +16,7 @@ #include "qemu-common.h" #include "sysemu/sysemu.h" #include "qmp-commands.h" -#include "char/char.h" +#include "sysemu/char.h" #include "ui/qemu-spice.h" #include "ui/vnc.h" #include "sysemu/kvm.h" diff --git a/qtest.c b/qtest.c index b03b68adb3..3bba3e5751 100644 --- a/qtest.c +++ b/qtest.c @@ -13,7 +13,7 @@ #include "sysemu/qtest.h" #include "hw/qdev.h" -#include "char/char.h" +#include "sysemu/char.h" #include "exec/ioport.h" #include "exec/memory.h" #include "hw/irq.h" diff --git a/slirp/slirp.c b/slirp/slirp.c index bd9b7cb644..80b28ea89e 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -23,7 +23,7 @@ */ #include "qemu-common.h" #include "qemu/timer.h" -#include "char/char.h" +#include "sysemu/char.h" #include "slirp.h" #include "hw/hw.h" diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 535f955ca8..c9403de8af 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -1,7 +1,7 @@ #include "config-host.h" #include "trace.h" #include "ui/qemu-spice.h" -#include "char/char.h" +#include "sysemu/char.h" #include #include #include diff --git a/tpm.c b/tpm.c index 1e943148d2..c91da43cf1 100644 --- a/tpm.c +++ b/tpm.c @@ -15,7 +15,7 @@ #include "monitor/monitor.h" #include "qapi/qmp/qerror.h" -#include "backends/tpm.h" +#include "sysemu/tpm_backend.h" #include "sysemu/tpm.h" #include "qemu/config-file.h" #include "qmp-commands.h" diff --git a/ui/console.c b/ui/console.c index e84ba8b40a..0ed4211986 100644 --- a/ui/console.c +++ b/ui/console.c @@ -25,7 +25,7 @@ #include "ui/console.h" #include "qemu/timer.h" #include "qmp-commands.h" -#include "char/char.h" +#include "sysemu/char.h" //#define DEBUG_CONSOLE #define DEFAULT_BACKSCROLL 512 diff --git a/ui/gtk.c b/ui/gtk.c index 1a6bee616a..1e105e2fc7 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -62,7 +62,7 @@ #include "qmp-commands.h" #include "x_keymap.h" #include "keymaps.h" -#include "char/char.h" +#include "sysemu/char.h" //#define DEBUG_GTK diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c index 713d7560d0..8442c6e63c 100644 --- a/util/event_notifier-posix.c +++ b/util/event_notifier-posix.c @@ -12,7 +12,7 @@ #include "qemu-common.h" #include "qemu/event_notifier.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/main-loop.h" #ifdef CONFIG_EVENTFD diff --git a/vl.c b/vl.c index ce7bed7141..cdadad09ec 100644 --- a/vl.c +++ b/vl.c @@ -126,7 +126,7 @@ int main(int argc, char **argv) #include "hw/qdev.h" #include "hw/loader.h" #include "monitor/qdev.h" -#include "bt/bt.h" +#include "sysemu/bt.h" #include "net/net.h" #include "net/slirp.h" #include "monitor/monitor.h" @@ -134,7 +134,7 @@ int main(int argc, char **argv) #include "sysemu/sysemu.h" #include "exec/gdbstub.h" #include "qemu/timer.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/cache-utils.h" #include "sysemu/blockdev.h" #include "hw/block/block.h" diff --git a/xen-all.c b/xen-all.c index 31f28fc1ae..539a1549a5 100644 --- a/xen-all.c +++ b/xen-all.c @@ -16,7 +16,7 @@ #include "hw/xen/xen_backend.h" #include "qmp-commands.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/range.h" #include "sysemu/xen-mapcache.h" #include "trace.h"