From 7e83a77f96ee18cb891f309dc617caa5e07ff51e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 22 Oct 2019 19:18:12 +0200 Subject: sysbus: remove unused sysbus_try_create* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- include/hw/sysbus.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'include/hw') diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 27e8088..2eb0484 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -117,8 +117,7 @@ void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc *func, void *opaque); /* Legacy helper function for creating devices. */ DeviceState *sysbus_create_varargs(const char *name, hwaddr addr, ...); -DeviceState *sysbus_try_create_varargs(const char *name, - hwaddr addr, ...); + static inline DeviceState *sysbus_create_simple(const char *name, hwaddr addr, qemu_irq irq) @@ -126,11 +125,5 @@ static inline DeviceState *sysbus_create_simple(const char *name, return sysbus_create_varargs(name, addr, irq, NULL); } -static inline DeviceState *sysbus_try_create_simple(const char *name, - hwaddr addr, - qemu_irq irq) -{ - return sysbus_try_create_varargs(name, addr, irq, NULL); -} #endif /* HW_SYSBUS_H */ -- cgit v1.1 From a35c6ccc06536e076d5a23c51d67458e3546672c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 23 Oct 2019 12:56:31 +0200 Subject: sysbus: remove outdated comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The init callback is no more since commit 817a17fc60f44e29a1944b60d32f45ea127f0cf9 ("core/sysbus: remove the SysBusDeviceClass::init path") Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé --- include/hw/sysbus.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include/hw') diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 2eb0484..c4a1c0a 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -24,10 +24,6 @@ typedef struct SysBusDevice SysBusDevice; /** * SysBusDeviceClass: - * @init: Callback function invoked when the #DeviceState.realized property - * is changed to %true. Deprecated, new types inheriting directly from - * TYPE_SYS_BUS_DEVICE should use #DeviceClass.realize instead, new leaf - * types should consult their respective parent type. * * SysBusDeviceClass is not overriding #DeviceClass.realize, so derived * classes overriding it are not required to invoke its implementation. -- cgit v1.1 From 7781b88ee458ff933459503ade0b0a6ddaad08de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 21 Oct 2019 23:32:12 +0200 Subject: serial: initial qom-ification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make SerialState a device (the following patches will introduce IO/MM sysbus serial devices) None of the serial_{,mm}_init() callers actually free the returned value (even if they did, it would be quite harmless), so we can change the object allocation at will. However, the devices that embed SerialState must now have their field QOM-initialized manually (isa, pci, pci-multi). Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell --- include/hw/char/serial.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/hw') diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 8be3d8a..180cc7c 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -30,10 +30,13 @@ #include "exec/memory.h" #include "qemu/fifo8.h" #include "chardev/char.h" +#include "hw/sysbus.h" #define UART_FIFO_LENGTH 16 /* 16550A Fifo Length */ typedef struct SerialState { + DeviceState parent; + uint16_t divider; uint8_t rbr; /* receive register */ uint8_t thr; /* transmit holding register */ @@ -84,7 +87,9 @@ void serial_realize_core(SerialState *s, Error **errp); void serial_exit_core(SerialState *s); void serial_set_frequency(SerialState *s, uint32_t frequency); -/* legacy pre qom */ +#define TYPE_SERIAL "serial" +#define SERIAL(s) OBJECT_CHECK(SerialState, (s), TYPE_SERIAL) + SerialState *serial_init(int base, qemu_irq irq, int baudbase, Chardev *chr, MemoryRegion *system_io); SerialState *serial_mm_init(MemoryRegion *address_space, -- cgit v1.1 From 96651db423a0a25466629d35c775531f5145a66a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 22 Oct 2019 00:35:36 +0200 Subject: serial: add "baudbase" property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- include/hw/char/serial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/hw') diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 180cc7c..3dc6185 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -58,7 +58,7 @@ typedef struct SerialState { CharBackend chr; int last_break_enable; int it_shift; - int baudbase; + uint32_t baudbase; uint32_t tsr_retry; guint watch_tag; uint32_t wakeup; -- cgit v1.1 From c9808d602813bce4fada7bf9ecc463aa779b73f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 22 Oct 2019 01:02:50 +0200 Subject: serial: realize the serial device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of calling serial_realize_core(), use the QDev realize callback. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé --- include/hw/char/serial.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/hw') diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 3dc6185..571aab9 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -83,7 +83,6 @@ typedef struct SerialState { extern const VMStateDescription vmstate_serial; extern const MemoryRegionOps serial_io_ops; -void serial_realize_core(SerialState *s, Error **errp); void serial_exit_core(SerialState *s); void serial_set_frequency(SerialState *s, uint32_t frequency); -- cgit v1.1 From b9975000a008c5b0801e3d24ed113a1bd2767ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 22 Oct 2019 01:14:43 +0200 Subject: serial: replace serial_exit_core() with unrealize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of calling serial_exit_core() directly, use the QDev unrealize callback. Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- include/hw/char/serial.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/hw') diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 571aab9..548944b 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -83,7 +83,6 @@ typedef struct SerialState { extern const VMStateDescription vmstate_serial; extern const MemoryRegionOps serial_io_ops; -void serial_exit_core(SerialState *s); void serial_set_frequency(SerialState *s, uint32_t frequency); #define TYPE_SERIAL "serial" -- cgit v1.1 From 490a9d9b36bfa22a6b46b27e6e9e84e1bac44c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 23 Oct 2019 17:50:06 +0200 Subject: serial: start making SerialMM a sysbus device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Memory mapped serial device is in fact a sysbus device. The following patches will make use of sysbus facilities for resource and registration. In particular, "serial-mm: use sysbus facilities" will move internal serial realization to serial_mm_realize callback to follow qdev best practices. Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell --- include/hw/char/serial.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'include/hw') diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 548944b..7301653 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -57,7 +57,6 @@ typedef struct SerialState { qemu_irq irq; CharBackend chr; int last_break_enable; - int it_shift; uint32_t baudbase; uint32_t tsr_retry; guint watch_tag; @@ -80,6 +79,14 @@ typedef struct SerialState { MemoryRegion io; } SerialState; +typedef struct SerialMM { + SysBusDevice parent; + + SerialState serial; + + int it_shift; +} SerialMM; + extern const VMStateDescription vmstate_serial; extern const MemoryRegionOps serial_io_ops; @@ -88,12 +95,15 @@ void serial_set_frequency(SerialState *s, uint32_t frequency); #define TYPE_SERIAL "serial" #define SERIAL(s) OBJECT_CHECK(SerialState, (s), TYPE_SERIAL) +#define TYPE_SERIAL_MM "serial-mm" +#define SERIAL_MM(s) OBJECT_CHECK(SerialMM, (s), TYPE_SERIAL_MM) + SerialState *serial_init(int base, qemu_irq irq, int baudbase, Chardev *chr, MemoryRegion *system_io); -SerialState *serial_mm_init(MemoryRegion *address_space, - hwaddr base, int it_shift, - qemu_irq irq, int baudbase, - Chardev *chr, enum device_endian end); +SerialMM *serial_mm_init(MemoryRegion *address_space, + hwaddr base, int it_shift, + qemu_irq irq, int baudbase, + Chardev *chr, enum device_endian end); /* serial-isa.c */ -- cgit v1.1 From 17fd1a6490b1d66cdfa60c67060e63da71a43a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 21 Oct 2019 20:14:02 +0200 Subject: serial-mm: add "regshift" property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And a property and rename "it_shift" field to "regshift", as it seems to be more popular (and I don't know what "it" stands for). Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell --- include/hw/char/serial.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/hw') diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 7301653..eaeda62 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -84,7 +84,7 @@ typedef struct SerialMM { SerialState serial; - int it_shift; + uint8_t regshift; } SerialMM; extern const VMStateDescription vmstate_serial; @@ -101,7 +101,7 @@ void serial_set_frequency(SerialState *s, uint32_t frequency); SerialState *serial_init(int base, qemu_irq irq, int baudbase, Chardev *chr, MemoryRegion *system_io); SerialMM *serial_mm_init(MemoryRegion *address_space, - hwaddr base, int it_shift, + hwaddr base, int regshift, qemu_irq irq, int baudbase, Chardev *chr, enum device_endian end); -- cgit v1.1 From 80b2eed95dd6397541cc4d7ec36db0e182a8f402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 23 Oct 2019 18:07:03 +0200 Subject: serial-mm: add endianness property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a qdev property for endianness, so memory region setup can be done in realize. Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- include/hw/char/serial.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/hw') diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index eaeda62..d586924 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -85,6 +85,7 @@ typedef struct SerialMM { SerialState serial; uint8_t regshift; + uint8_t endianness; } SerialMM; extern const VMStateDescription vmstate_serial; -- cgit v1.1 From 10315a70896fb82000cc4b2a1198b70c775c7a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 23 Oct 2019 18:37:33 +0200 Subject: serial: make SerialIO a sysbus device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make serial IO a proper sysbus device, similar to serial MM. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé --- include/hw/char/serial.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'include/hw') diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index d586924..d356ba8 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -88,6 +88,12 @@ typedef struct SerialMM { uint8_t endianness; } SerialMM; +typedef struct SerialIO { + SysBusDevice parent; + + SerialState serial; +} SerialIO; + extern const VMStateDescription vmstate_serial; extern const MemoryRegionOps serial_io_ops; @@ -99,8 +105,11 @@ void serial_set_frequency(SerialState *s, uint32_t frequency); #define TYPE_SERIAL_MM "serial-mm" #define SERIAL_MM(s) OBJECT_CHECK(SerialMM, (s), TYPE_SERIAL_MM) -SerialState *serial_init(int base, qemu_irq irq, int baudbase, - Chardev *chr, MemoryRegion *system_io); +#define TYPE_SERIAL_IO "serial-io" +#define SERIAL_IO(s) OBJECT_CHECK(SerialIO, (s), TYPE_SERIAL_IO) + +SerialIO *serial_init(int base, qemu_irq irq, int baudbase, + Chardev *chr, MemoryRegion *system_io); SerialMM *serial_mm_init(MemoryRegion *address_space, hwaddr base, int regshift, qemu_irq irq, int baudbase, -- cgit v1.1 From 9fac5d88ee1a81dca643a62bfce5a2364b437bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 23 Oct 2019 15:29:55 +0200 Subject: mips: inline serial_init() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function is specific to mipssim, let's inline it. (when inlining, we use a DeviceState variable instead of SerialIO, as it is the most common type used, and avoids having too many casts) Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Aleksandar Markovic --- include/hw/char/serial.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/hw') diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index d356ba8..535fa23 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -108,8 +108,6 @@ void serial_set_frequency(SerialState *s, uint32_t frequency); #define TYPE_SERIAL_IO "serial-io" #define SERIAL_IO(s) OBJECT_CHECK(SerialIO, (s), TYPE_SERIAL_IO) -SerialIO *serial_init(int base, qemu_irq irq, int baudbase, - Chardev *chr, MemoryRegion *system_io); SerialMM *serial_mm_init(MemoryRegion *address_space, hwaddr base, int regshift, qemu_irq irq, int baudbase, -- cgit v1.1 From 0fe4bb3241110fc9fbd1c5c457d58191fcdca5d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 17 Oct 2019 17:06:05 +0200 Subject: vmmouse: replace PROP_PTR with PROP_LINK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While at it, use the expected type. Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- include/hw/input/i8042.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/hw') diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 246e6f3..8eaebf5 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -14,10 +14,12 @@ #define I8042_A20_LINE "a20" +typedef struct ISAKBDState ISAKBDState; + void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, MemoryRegion *region, ram_addr_t size, hwaddr mask); -void i8042_isa_mouse_fake_event(void *opaque); +void i8042_isa_mouse_fake_event(ISAKBDState *isa); void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); #endif /* HW_INPUT_I8042_H */ -- cgit v1.1 From 3af6eb8f9b489c72a1f540e752d8d5f1503b9a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 17 Oct 2019 17:49:22 +0200 Subject: etraxfs: remove PROP_PTR usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit etraxfs_dma_client are not Object, so can't be exposed to user with QOM path. Let's remove property usage and move the constructor to the .c unit, simplifying some code on the way. Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell --- include/hw/cris/etraxfs.h | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'include/hw') diff --git a/include/hw/cris/etraxfs.h b/include/hw/cris/etraxfs.h index aa146a2..403e7f9 100644 --- a/include/hw/cris/etraxfs.h +++ b/include/hw/cris/etraxfs.h @@ -30,23 +30,9 @@ #include "hw/qdev-properties.h" #include "hw/sysbus.h" -/* Instantiate an ETRAXFS Ethernet MAC. */ -static inline DeviceState * -etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr, - void *dma_out, void *dma_in) -{ - DeviceState *dev; - qemu_check_nic_model(nd, "fseth"); - - dev = qdev_create(NULL, "etraxfs-eth"); - qdev_set_nic_properties(dev, nd); - qdev_prop_set_uint32(dev, "phyaddr", phyaddr); - qdev_prop_set_ptr(dev, "dma_out", dma_out); - qdev_prop_set_ptr(dev, "dma_in", dma_in); - qdev_init_nofail(dev); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - return dev; -} +DeviceState *etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr, + struct etraxfs_dma_client *dma_out, + struct etraxfs_dma_client *dma_in); static inline DeviceState *etraxfs_ser_create(hwaddr addr, qemu_irq irq, -- cgit v1.1 From bab592a259a6603922a4f54caedb6e52da692e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 18 Oct 2019 14:42:57 +0200 Subject: omap-intc: remove PROP_PTR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since clocks are not QOM objects, replace PROP_PTR of clocks with setters methods. (in theory there should probably be different methods for omap1 & omap2 intc, but this is left as a future improvement) Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- include/hw/arm/omap.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/hw') diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h index f3aa670..bcecf19 100644 --- a/include/hw/arm/omap.h +++ b/include/hw/arm/omap.h @@ -67,6 +67,20 @@ void omap_clk_setrate(omap_clk clk, int divide, int multiply); int64_t omap_clk_getrate(omap_clk clk); void omap_clk_reparent(omap_clk clk, omap_clk parent); +/* omap_intc.c */ +#define TYPE_OMAP_INTC "common-omap-intc" +#define OMAP_INTC(obj) \ + OBJECT_CHECK(omap_intr_handler, (obj), TYPE_OMAP_INTC) + +typedef struct omap_intr_handler_s omap_intr_handler; + +/* + * TODO: Ideally we should have a clock framework that + * let us wire these clocks up with QOM properties or links. + */ +void omap_intc_set_iclk(omap_intr_handler *intc, omap_clk clk); +void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk); + /* OMAP2 l4 Interconnect */ struct omap_l4_s; struct omap_l4_region_s { -- cgit v1.1 From 0fd20c532faa6d5ebed8a43763f96a4829b33be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 18 Oct 2019 14:56:44 +0200 Subject: omap-i2c: remove PROP_PTR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since clocks are not QOM objects, replace PROP_PTR of clocks with setters methods. Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell Reviewed-by: Corey Minyard Reviewed-by: Philippe Mathieu-Daudé --- include/hw/arm/omap.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/hw') diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h index bcecf19..39a295b 100644 --- a/include/hw/arm/omap.h +++ b/include/hw/arm/omap.h @@ -81,6 +81,19 @@ typedef struct omap_intr_handler_s omap_intr_handler; void omap_intc_set_iclk(omap_intr_handler *intc, omap_clk clk); void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk); +/* omap_i2c.c */ +#define TYPE_OMAP_I2C "omap_i2c" +#define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C) + +typedef struct OMAPI2CState OMAPI2CState; + +/* + * TODO: Ideally we should have a clock framework that + * let us wire these clocks up with QOM properties or links. + */ +void omap_i2c_set_iclk(OMAPI2CState *i2c, omap_clk clk); +void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk); + /* OMAP2 l4 Interconnect */ struct omap_l4_s; struct omap_l4_region_s { -- cgit v1.1 From ba2aba8370e33a44ff5619844b90bb7119c5cebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 18 Oct 2019 15:26:19 +0200 Subject: omap-gpio: remove PROP_PTR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since clocks are not QOM objects, replace PROP_PTR of clocks with setters methods. Move/adapt the existing TODO comment about a clock framework. Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- include/hw/arm/omap.h | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'include/hw') diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h index 39a295b..6be386d 100644 --- a/include/hw/arm/omap.h +++ b/include/hw/arm/omap.h @@ -77,6 +77,16 @@ typedef struct omap_intr_handler_s omap_intr_handler; /* * TODO: Ideally we should have a clock framework that * let us wire these clocks up with QOM properties or links. + * + * qdev should support a generic means of defining a 'port' with + * an arbitrary interface for connecting two devices. Then we + * could reframe the omap clock API in terms of clock ports, + * and get some type safety. For now the best qdev provides is + * passing an arbitrary pointer. + * (It's not possible to pass in the string which is the clock + * name, because this device does not have the necessary information + * (ie the struct omap_mpu_state_s*) to do the clockname to pointer + * translation.) */ void omap_intc_set_iclk(omap_intr_handler *intc, omap_clk clk); void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk); @@ -87,13 +97,28 @@ void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk); typedef struct OMAPI2CState OMAPI2CState; -/* - * TODO: Ideally we should have a clock framework that - * let us wire these clocks up with QOM properties or links. - */ +/* TODO: clock framework (see above) */ void omap_i2c_set_iclk(OMAPI2CState *i2c, omap_clk clk); void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk); +/* omap_gpio.c */ +#define TYPE_OMAP1_GPIO "omap-gpio" +#define OMAP1_GPIO(obj) \ + OBJECT_CHECK(struct omap_gpif_s, (obj), TYPE_OMAP1_GPIO) + +#define TYPE_OMAP2_GPIO "omap2-gpio" +#define OMAP2_GPIO(obj) \ + OBJECT_CHECK(struct omap2_gpif_s, (obj), TYPE_OMAP2_GPIO) + +typedef struct omap_gpif_s omap_gpif; +typedef struct omap2_gpif_s omap2_gpif; + +/* TODO: clock framework (see above) */ +void omap_gpio_set_clk(omap_gpif *gpio, omap_clk clk); + +void omap2_gpio_set_iclk(omap2_gpif *gpio, omap_clk clk); +void omap2_gpio_set_fclk(omap2_gpif *gpio, uint8_t i, omap_clk clk); + /* OMAP2 l4 Interconnect */ struct omap_l4_s; struct omap_l4_region_s { -- cgit v1.1 From 5c4d910f2d5bbf28c44e0f4dad1857c2cd9f77f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 18 Oct 2019 15:52:40 +0200 Subject: qdev: remove PROP_MEMORY_REGION MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PROP_MEMORY_REGION was a derivative of PROP_PTR, added in commit ed03d749f3f513b8fb0287757cfda2cb6825f063 (qdev: add MemoryRegion property) and thankfully no longer needed since commit 3eff40dbf44896a8180c86c84dbdefb2eb173fbe (hw/misc: Remove mmio_interface device). Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- include/hw/qdev-properties.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/hw') diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index c6a8cb5..16837ab 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -216,8 +216,6 @@ extern const PropertyInfo qdev_prop_pcie_link_width; DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint16_t) #define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddress) -#define DEFINE_PROP_MEMORY_REGION(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_ptr, MemoryRegion *) #define DEFINE_PROP_OFF_AUTO_PCIBAR(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_off_auto_pcibar, \ OffAutoPCIBAR) -- cgit v1.1 From 70f3d674bc2daac865fb75878030c063697fd16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 18 Oct 2019 15:50:10 +0200 Subject: qdev: remove QDEV_PROP_PTR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No longer used in the tree. The comment about user_creatable is still quite relevant, but there is already a similar comment in qdev-core.h. Reviewed-by: Peter Maydell Signed-off-by: Marc-André Lureau --- include/hw/qdev-properties.h | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'include/hw') diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 16837ab..a90a9ce 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -18,7 +18,6 @@ extern const PropertyInfo qdev_prop_size; extern const PropertyInfo qdev_prop_string; extern const PropertyInfo qdev_prop_chr; extern const PropertyInfo qdev_prop_tpm; -extern const PropertyInfo qdev_prop_ptr; extern const PropertyInfo qdev_prop_macaddr; extern const PropertyInfo qdev_prop_on_off_auto; extern const PropertyInfo qdev_prop_losttickpolicy; @@ -171,25 +170,6 @@ extern const PropertyInfo qdev_prop_pcie_link_width; #define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t) -/* - * Please avoid pointer properties. If you must use them, you must - * cover them in their device's class init function as follows: - * - * - If the property must be set, the device cannot be used with - * device_add, so add code like this: - * |* Reason: pointer property "NAME-OF-YOUR-PROP" *| - * DeviceClass *dc = DEVICE_CLASS(class); - * dc->user_creatable = false; - * - * - If the property may safely remain null, document it like this: - * |* - * * Note: pointer property "interrupt_vector" may remain null, thus - * * no need for dc->user_creatable = false; - * *| - */ -#define DEFINE_PROP_PTR(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_ptr, void*) - #define DEFINE_PROP_CHR(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharBackend) #define DEFINE_PROP_STRING(_n, _s, _f) \ @@ -262,8 +242,6 @@ void qdev_prop_set_drive(DeviceState *dev, const char *name, void qdev_prop_set_macaddr(DeviceState *dev, const char *name, const uint8_t *value); void qdev_prop_set_enum(DeviceState *dev, const char *name, int value); -/* FIXME: Remove opaque pointer properties. */ -void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value); void qdev_prop_register_global(GlobalProperty *prop); int qdev_prop_check_globals(void); -- cgit v1.1