hw/char: Convert UART and console devices to Resettable interface (part 2)
Subsystems (2)
cover hw/char: Convert UART and console devices to Resettable interface (part 2)
Convert the remaining character device models in hw/char away from the deprecated device_class_set_legacy_reset() wrapper to the ResettableClass interface (hold phase), moving towards removing the legacy_reset callback from DeviceClass once all callers are migrated (as noted in include/hw/core/qdev.h).
---
Oscar Alejandro Sánchez Lucero (10):
hw/char/mchp_pfsoc_mmuart: Convert to Resettable interface hw/char/nrf51_uart: Convert to Resettable interface hw/char/pl011: Convert to Resettable interface hw/char/renesas_sci: Convert to Resettable interface hw/char/sclpconsole-lm: Convert to Resettable interface hw/char/sclpconsole: Convert to Resettable interface hw/char/sh_serial: Convert to Resettable interface hw/char/shakti_uart: Convert to Resettable interface hw/char/stm32f2xx_usart: Convert to Resettable interface hw/char/xilinx_uartlite: Convert to Resettable interface
hw/char/mchp_pfsoc_mmuart.c | 7 ++++--- hw/char/nrf51_uart.c | 7 ++++--- hw/char/pl011.c | 7 ++++--- hw/char/renesas_sci.c | 7 ++++--- hw/char/sclpconsole-lm.c | 7 ++++--- hw/char/sclpconsole.c | 7 ++++--- hw/char/sh_serial.c | 7 ++++--- hw/char/shakti_uart.c | 8 +++++--- hw/char/stm32f2xx_usart.c | 7 ++++--- hw/char/xilinx_uartlite.c | 7 ++++--- 10 files changed, 41 insertions(+), 30 deletions(-)
---
base-commit: bbece0805c03c25f51a8cd89c39142f4f76a6567
change-id: 20261202-char-resettable-2-59d3d2bba62c
Best regards,
Signature · 1 line
Oscar Alejandro Sánchez Lucero <[email protected]>
PATCH 1/10 hw/char/mchp_pfsoc_mmuart: Convert to Resettable interface
Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in mchp_pfsoc_mmuart_reset_hold().
--- hw/char/mchp_pfsoc_mmuart.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/char/mchp_pfsoc_mmuart.c +4 -3
@@ -69,9 +69,9 @@ static const MemoryRegionOps mchp_pfsoc_mmuart_ops = { }, }; -static void mchp_pfsoc_mmuart_reset (DeviceState *dev) +static void mchp_pfsoc_mmuart_reset_hold (Object *obj,ResetType type) { -MchpPfSoCMMUartState *s =MCHP_PFSOC_UART (dev); +MchpPfSoCMMUartState *s =MCHP_PFSOC_UART (obj);memset (s->reg,0 ,sizeof (s->reg));device_cold_reset (DEVICE (&s->serial_mm));
@@ -124,9 +124,10 @@ static const VMStateDescription mchp_pfsoc_mmuart_vmstate = {static void mchp_pfsoc_mmuart_class_init (ObjectClass *oc,const void *data) {DeviceClass *dc =DEVICE_CLASS (oc); +ResettableClass *rc =RESETTABLE_CLASS (oc); dc->realize = mchp_pfsoc_mmuart_realize; -device_class_set_legacy_reset (dc, mchp_pfsoc_mmuart_reset); + rc->phases.hold = mchp_pfsoc_mmuart_reset_hold; dc->vmsd = &mchp_pfsoc_mmuart_vmstate;set_bit (DEVICE_CATEGORY_INPUT , dc->categories); }
Signature · 1 line
2.53.0
PATCH 2/10 hw/char/nrf51_uart: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in nrf51_uart_reset_hold().
--- hw/char/nrf51_uart.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/char/nrf51_uart.c +4 -3
@@ -193,9 +193,9 @@ static const MemoryRegionOps uart_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; -static void nrf51_uart_reset (DeviceState *dev) +static void nrf51_uart_reset_hold (Object *obj,ResetType type) { -NRF51UARTState *s =NRF51_UART (dev); +NRF51UARTState *s =NRF51_UART (obj); s->pending_tx_byte =0 ;
@@ -308,8 +308,9 @@ static const Property nrf51_uart_properties[] = {static void nrf51_uart_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); -device_class_set_legacy_reset (dc, nrf51_uart_reset); + rc->phases.hold = nrf51_uart_reset_hold; dc->realize = nrf51_uart_realize;device_class_set_props (dc, nrf51_uart_properties); dc->vmsd = &nrf51_uart_vmstate;
Signature · 1 line
2.53.0
PATCH 3/10 hw/char/pl011: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in pl011_reset_hold().
--- hw/char/pl011.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/char/pl011.c +4 -3
@@ -689,9 +689,9 @@ static void pl011_realize(DeviceState *dev, Error **errp)pl011_set_handlers (s); } -static void pl011_reset (DeviceState *dev) +static void pl011_reset_hold (Object *obj,ResetType type) { -PL011State *s =PL011 (dev); +PL011State *s =PL011 (obj); s->lcr =0 ; s->rsr =0 ;
@@ -713,9 +713,10 @@ static void pl011_reset(DeviceState *dev)static void pl011_class_init (ObjectClass *oc,const void *data) {DeviceClass *dc =DEVICE_CLASS (oc); +ResettableClass *rc =RESETTABLE_CLASS (oc); dc->realize = pl011_realize; -device_class_set_legacy_reset (dc, pl011_reset); + rc->phases.hold = pl011_reset_hold; dc->vmsd = &vmstate_pl011;device_class_set_props (dc, pl011_properties); }
Signature · 1 line
2.53.0
PATCH 4/10 hw/char/renesas_sci: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in rsci_reset_hold().
--- hw/char/renesas_sci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/char/renesas_sci.c +4 -3
@@ -245,9 +245,9 @@ static const MemoryRegionOps sci_ops = { .valid.max_access_size = 1, }; -static void rsci_reset (DeviceState *dev) +static void rsci_reset_hold (Object *obj,ResetType type) { -RSCIState *sci =RSCI (dev); +RSCIState *sci =RSCI (obj); sci->smr = sci->scr =0x00 ; sci->brr =0xff ; sci->tdr =0xff ;
@@ -327,10 +327,11 @@ static const Property rsci_properties[] = {static void rsci_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); dc->realize = rsci_realize; dc->vmsd = &vmstate_rsci; -device_class_set_legacy_reset (dc, rsci_reset); + rc->phases.hold = rsci_reset_hold;device_class_set_props (dc, rsci_properties); }
Signature · 1 line
2.53.0
PATCH 5/10 hw/char/sclpconsole-lm: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in console_reset_hold().
--- hw/char/sclpconsole-lm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/char/sclpconsole-lm.c +4 -3
@@ -324,9 +324,9 @@ static int console_init(SCLPEvent *event)return 0 ; } -static void console_reset (DeviceState *dev) +static void console_reset_hold (Object *obj,ResetType type) { -SCLPEvent *event =SCLP_EVENT (dev); +SCLPEvent *event =SCLP_EVENT (obj);SCLPConsoleLM *scon =SCLPLM_CONSOLE (event); event->event_pending = false;
@@ -344,9 +344,10 @@ static void console_class_init(ObjectClass *klass, const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);SCLPEventClass *ec =SCLP_EVENT_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass);device_class_set_props (dc, console_properties); -device_class_set_legacy_reset (dc, console_reset); + rc->phases.hold = console_reset_hold; dc->vmsd = &vmstate_sclplmconsole; ec->init = console_init; ec->get_send_mask = send_mask;
Signature · 1 line
2.53.0
PATCH 6/10 hw/char/sclpconsole: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in console_reset_hold().
--- hw/char/sclpconsole.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/char/sclpconsole.c +4 -3
@@ -302,9 +302,9 @@ static int console_init(SCLPEvent *event)return 0 ; } -static void console_reset (DeviceState *dev) +static void console_reset_hold (Object *obj,ResetType type) { -SCLPEvent *event =SCLP_EVENT (dev); +SCLPEvent *event =SCLP_EVENT (obj);SCLPConsole *scon =SCLP_CONSOLE (event); scon->iov_sclp =0 ;
@@ -327,9 +327,10 @@ static void console_class_init(ObjectClass *klass, const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);SCLPEventClass *ec =SCLP_EVENT_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass);device_class_set_props (dc, console_properties); -device_class_set_legacy_reset (dc, console_reset); + rc->phases.hold = console_reset_hold; dc->vmsd = &vmstate_sclpconsole; ec->init = console_init; ec->get_send_mask = send_mask;
Signature · 1 line
2.53.0
PATCH 7/10 hw/char/sh_serial: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in sh_serial_reset_hold().
--- hw/char/sh_serial.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/char/sh_serial.c +4 -3
@@ -384,9 +384,9 @@ static const MemoryRegionOps sh_serial_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static void sh_serial_reset (DeviceState *dev) +static void sh_serial_reset_hold (Object *obj,ResetType type) { -SHSerialState *s =SH_SERIAL (dev); +SHSerialState *s =SH_SERIAL (obj); s->flags =SH_SERIAL_FLAG_TEND |SH_SERIAL_FLAG_TDE ; s->rtrg =1 ;
@@ -445,11 +445,12 @@ static const Property sh_serial_properties[] = {static void sh_serial_class_init (ObjectClass *oc,const void *data) {DeviceClass *dc =DEVICE_CLASS (oc); +ResettableClass *rc =RESETTABLE_CLASS (oc);device_class_set_props (dc, sh_serial_properties); dc->realize = sh_serial_realize; dc->unrealize = sh_serial_unrealize; -device_class_set_legacy_reset (dc, sh_serial_reset); + rc->phases.hold = sh_serial_reset_hold;/* Reason: part of SuperH CPU/SoC, needs to be wired up */ dc->user_creatable = false; }
Signature · 1 line
2.53.0
PATCH 8/10 hw/char/shakti_uart: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in shakti_uart_reset_hold().
--- hw/char/shakti_uart.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
hw/char/shakti_uart.c +5 -3
@@ -108,9 +108,9 @@ static const MemoryRegionOps shakti_uart_ops = { .valid = {.min_access_size = 1, .max_access_size = 4}, }; -static void shakti_uart_reset (DeviceState *dev) +static void shakti_uart_reset_hold (Object *obj,ResetType type) { -ShaktiUartState *s =SHAKTI_UART (dev); +ShaktiUartState *s =SHAKTI_UART (obj); s->uart_baud =SHAKTI_UART_BAUD_DEFAULT ; s->uart_tx =0x0 ;
@@ -164,7 +164,9 @@ static const Property shakti_uart_properties[] = {static void shakti_uart_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -device_class_set_legacy_reset (dc, shakti_uart_reset); +ResettableClass *rc =RESETTABLE_CLASS (klass); + + rc->phases.hold = shakti_uart_reset_hold; dc->realize = shakti_uart_realize;device_class_set_props (dc, shakti_uart_properties);set_bit (DEVICE_CATEGORY_INPUT , dc->categories);
Signature · 1 line
2.53.0
PATCH 9/10 hw/char/stm32f2xx_usart: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in stm32f2xx_usart_reset_hold().
--- hw/char/stm32f2xx_usart.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/char/stm32f2xx_usart.c +4 -3
@@ -73,9 +73,9 @@ static void stm32f2xx_usart_receive(void *opaque, const uint8_t *buf, int size)trace_stm32f2xx_usart_receive (d->id, *buf); } -static void stm32f2xx_usart_reset (DeviceState *dev) +static void stm32f2xx_usart_reset_hold (Object *obj,ResetType type) { -STM32F2XXUsartState *s =STM32F2XX_USART (dev); +STM32F2XXUsartState *s =STM32F2XX_USART (obj); s->usart_sr =USART_SR_RESET ; s->usart_dr =0x00000000 ;
@@ -223,8 +223,9 @@ static void stm32f2xx_usart_realize(DeviceState *dev, Error **errp)static void stm32f2xx_usart_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); -device_class_set_legacy_reset (dc, stm32f2xx_usart_reset); + rc->phases.hold = stm32f2xx_usart_reset_hold;device_class_set_props (dc, stm32f2xx_usart_properties); dc->realize = stm32f2xx_usart_realize; }
Signature · 1 line
2.53.0
PATCH 10/10 hw/char/xilinx_uartlite: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in xilinx_uartlite_reset_hold().
--- hw/char/xilinx_uartlite.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/char/xilinx_uartlite.c +4 -3
@@ -93,9 +93,9 @@ static void uart_update_status(XilinxUARTLite *s) s->regs[R_STATUS ] = r; } -static void xilinx_uartlite_reset (DeviceState *dev) +static void xilinx_uartlite_reset_hold (Object *obj,ResetType type) { -uart_update_status (XILINX_UARTLITE (dev)); +uart_update_status (XILINX_UARTLITE (obj)); } static uint64_t
@@ -244,8 +244,9 @@ static void xilinx_uartlite_init(Object *obj)static void xilinx_uartlite_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); -device_class_set_legacy_reset (dc, xilinx_uartlite_reset); + rc->phases.hold = xilinx_uartlite_reset_hold; dc->realize = xilinx_uartlite_realize;device_class_set_props (dc, xilinx_uartlite_properties); }
Signature · 1 line
2.53.0