Message ID | 20190624220056.25861-2-f4bug@amsat.org |
---|---|
State | New |
Headers | show |
Series | hw/misc: Clean the empty_slot device | expand |
On Tue, Jun 25, 2019 at 12:01 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com> > --- > include/hw/empty_slot.h | 7 ------- > include/hw/misc/empty_slot.h | 32 ++++++++++++++++++++++++++++++++ > hw/mips/mips_malta.c | 2 +- > hw/{core => misc}/empty_slot.c | 2 +- > hw/sparc/sun4m.c | 2 +- > hw/core/Makefile.objs | 1 - > hw/misc/Makefile.objs | 1 + > 7 files changed, 36 insertions(+), 11 deletions(-) > delete mode 100644 include/hw/empty_slot.h > create mode 100644 include/hw/misc/empty_slot.h > rename hw/{core => misc}/empty_slot.c (98%) > > diff --git a/include/hw/empty_slot.h b/include/hw/empty_slot.h > deleted file mode 100644 > index 123a9f8989..0000000000 > --- a/include/hw/empty_slot.h > +++ /dev/null > @@ -1,7 +0,0 @@ > -#ifndef HW_EMPTY_SLOT_H > -#define HW_EMPTY_SLOT_H > - > -/* empty_slot.c */ > -void empty_slot_init(hwaddr addr, uint64_t slot_size); > - > -#endif > diff --git a/include/hw/misc/empty_slot.h b/include/hw/misc/empty_slot.h > new file mode 100644 > index 0000000000..46483f24c3 > --- /dev/null > +++ b/include/hw/misc/empty_slot.h > @@ -0,0 +1,32 @@ > +/* > + * QEMU Empty Slot > + * > + * The empty_slot device emulates known to a bus but not connected devices. > + * > + * Copyright (c) 2010 Artyom Tarasenko > + * > + * This code is licensed under the GNU GPL v2 or (at your option) any later > + * version. > + */ > + > +#ifndef HW_EMPTY_SLOT_H > +#define HW_EMPTY_SLOT_H > + > +/** > + * empty_slot_init: create and map a RAZ/WI device > + * @base: base address of the device's MMIO region > + * @size: size of the device's MMIO region > + * > + * This utility function creates and maps an instance of empty slot, > + * which is a dummy device which simply read as zero, and ignore writes. > + * An empty slot sit on a bus, and no bus errors are generated when it is > + * accessed. > + * Guest accesses can be traced, using the '-trace empty_slot\*' command > + * line argument. > + * The device is mapped at priority -10000, which means that you can > + * use it to cover a large region and then map other devices on top of it > + * if necessary. > + */ > +void empty_slot_init(hwaddr addr, uint64_t slot_size); > + > +#endif > diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c > index 37ec89b07e..7008be2e5b 100644 > --- a/hw/mips/mips_malta.c > +++ b/hw/mips/mips_malta.c > @@ -53,7 +53,7 @@ > #include "sysemu/qtest.h" > #include "qapi/error.h" > #include "qemu/error-report.h" > -#include "hw/empty_slot.h" > +#include "hw/misc/empty_slot.h" > #include "sysemu/kvm.h" > #include "hw/semihosting/semihost.h" > #include "hw/mips/cps.h" > diff --git a/hw/core/empty_slot.c b/hw/misc/empty_slot.c > similarity index 98% > rename from hw/core/empty_slot.c > rename to hw/misc/empty_slot.c > index c694532046..0adf7a26dc 100644 > --- a/hw/core/empty_slot.c > +++ b/hw/misc/empty_slot.c > @@ -13,7 +13,7 @@ > #include "hw/hw.h" > #include "hw/sysbus.h" > #include "qemu/module.h" > -#include "hw/empty_slot.h" > +#include "hw/misc/empty_slot.h" > > //#define DEBUG_EMPTY_SLOT > > diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c > index 7e4f61fc3e..cc85598d5b 100644 > --- a/hw/sparc/sun4m.c > +++ b/hw/sparc/sun4m.c > @@ -41,7 +41,7 @@ > #include "hw/nvram/chrp_nvram.h" > #include "hw/nvram/fw_cfg.h" > #include "hw/char/escc.h" > -#include "hw/empty_slot.h" > +#include "hw/misc/empty_slot.h" > #include "hw/loader.h" > #include "elf.h" > #include "trace.h" > diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs > index a799c83815..5122a28a3b 100644 > --- a/hw/core/Makefile.objs > +++ b/hw/core/Makefile.objs > @@ -8,7 +8,6 @@ common-obj-y += irq.o > common-obj-y += hotplug.o > common-obj-$(CONFIG_SOFTMMU) += nmi.o > > -common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o > common-obj-$(CONFIG_XILINX_AXI) += stream.o > common-obj-$(CONFIG_PTIMER) += ptimer.o > common-obj-$(CONFIG_SOFTMMU) += sysbus.o > diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs > index 77b9df9796..8ed900f9f5 100644 > --- a/hw/misc/Makefile.objs > +++ b/hw/misc/Makefile.objs > @@ -10,6 +10,7 @@ common-obj-$(CONFIG_EDU) += edu.o > common-obj-$(CONFIG_PCA9552) += pca9552.o > > common-obj-y += unimp.o > +common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o > common-obj-$(CONFIG_FW_CFG_DMA) += vmcoreinfo.o > > # ARM devices > -- > 2.19.1 >
diff --git a/include/hw/empty_slot.h b/include/hw/empty_slot.h deleted file mode 100644 index 123a9f8989..0000000000 --- a/include/hw/empty_slot.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef HW_EMPTY_SLOT_H -#define HW_EMPTY_SLOT_H - -/* empty_slot.c */ -void empty_slot_init(hwaddr addr, uint64_t slot_size); - -#endif diff --git a/include/hw/misc/empty_slot.h b/include/hw/misc/empty_slot.h new file mode 100644 index 0000000000..46483f24c3 --- /dev/null +++ b/include/hw/misc/empty_slot.h @@ -0,0 +1,32 @@ +/* + * QEMU Empty Slot + * + * The empty_slot device emulates known to a bus but not connected devices. + * + * Copyright (c) 2010 Artyom Tarasenko + * + * This code is licensed under the GNU GPL v2 or (at your option) any later + * version. + */ + +#ifndef HW_EMPTY_SLOT_H +#define HW_EMPTY_SLOT_H + +/** + * empty_slot_init: create and map a RAZ/WI device + * @base: base address of the device's MMIO region + * @size: size of the device's MMIO region + * + * This utility function creates and maps an instance of empty slot, + * which is a dummy device which simply read as zero, and ignore writes. + * An empty slot sit on a bus, and no bus errors are generated when it is + * accessed. + * Guest accesses can be traced, using the '-trace empty_slot\*' command + * line argument. + * The device is mapped at priority -10000, which means that you can + * use it to cover a large region and then map other devices on top of it + * if necessary. + */ +void empty_slot_init(hwaddr addr, uint64_t slot_size); + +#endif diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 37ec89b07e..7008be2e5b 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -53,7 +53,7 @@ #include "sysemu/qtest.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "hw/empty_slot.h" +#include "hw/misc/empty_slot.h" #include "sysemu/kvm.h" #include "hw/semihosting/semihost.h" #include "hw/mips/cps.h" diff --git a/hw/core/empty_slot.c b/hw/misc/empty_slot.c similarity index 98% rename from hw/core/empty_slot.c rename to hw/misc/empty_slot.c index c694532046..0adf7a26dc 100644 --- a/hw/core/empty_slot.c +++ b/hw/misc/empty_slot.c @@ -13,7 +13,7 @@ #include "hw/hw.h" #include "hw/sysbus.h" #include "qemu/module.h" -#include "hw/empty_slot.h" +#include "hw/misc/empty_slot.h" //#define DEBUG_EMPTY_SLOT diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 7e4f61fc3e..cc85598d5b 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -41,7 +41,7 @@ #include "hw/nvram/chrp_nvram.h" #include "hw/nvram/fw_cfg.h" #include "hw/char/escc.h" -#include "hw/empty_slot.h" +#include "hw/misc/empty_slot.h" #include "hw/loader.h" #include "elf.h" #include "trace.h" diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs index a799c83815..5122a28a3b 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -8,7 +8,6 @@ common-obj-y += irq.o common-obj-y += hotplug.o common-obj-$(CONFIG_SOFTMMU) += nmi.o -common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o common-obj-$(CONFIG_XILINX_AXI) += stream.o common-obj-$(CONFIG_PTIMER) += ptimer.o common-obj-$(CONFIG_SOFTMMU) += sysbus.o diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs index 77b9df9796..8ed900f9f5 100644 --- a/hw/misc/Makefile.objs +++ b/hw/misc/Makefile.objs @@ -10,6 +10,7 @@ common-obj-$(CONFIG_EDU) += edu.o common-obj-$(CONFIG_PCA9552) += pca9552.o common-obj-y += unimp.o +common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o common-obj-$(CONFIG_FW_CFG_DMA) += vmcoreinfo.o # ARM devices
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- include/hw/empty_slot.h | 7 ------- include/hw/misc/empty_slot.h | 32 ++++++++++++++++++++++++++++++++ hw/mips/mips_malta.c | 2 +- hw/{core => misc}/empty_slot.c | 2 +- hw/sparc/sun4m.c | 2 +- hw/core/Makefile.objs | 1 - hw/misc/Makefile.objs | 1 + 7 files changed, 36 insertions(+), 11 deletions(-) delete mode 100644 include/hw/empty_slot.h create mode 100644 include/hw/misc/empty_slot.h rename hw/{core => misc}/empty_slot.c (98%)