From: Thomas Huth <huth@tuxfamily.org>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 27/36] next-cube: QOMify NeXTRTC
Date: Sat, 9 Nov 2024 09:14:26 +0100 [thread overview]
Message-ID: <20241109091426.0f636645@tpx1> (raw)
In-Reply-To: <20241023085852.1061031-28-mark.cave-ayland@ilande.co.uk>
Am Wed, 23 Oct 2024 09:58:43 +0100
schrieb Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>:
> This is to allow the RTC functionality to be maintained within its own separate
> device.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
> hw/m68k/next-cube.c | 66 ++++++++++++++++++++++++++++++++-------------
> 1 file changed, 48 insertions(+), 18 deletions(-)
>
> diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
> index e4d0083eb0..6b574d39cf 100644
> --- a/hw/m68k/next-cube.c
> +++ b/hw/m68k/next-cube.c
> @@ -42,7 +42,13 @@
> #define RAM_SIZE 0x4000000
> #define ROM_FILE "Rev_2.5_v66.bin"
>
> -typedef struct NeXTRTC {
> +
> +#define TYPE_NEXT_RTC "next-rtc"
> +OBJECT_DECLARE_SIMPLE_TYPE(NeXTRTC, NEXT_RTC)
> +
> +struct NeXTRTC {
> + SysBusDevice parent_obj;
> +
> int8_t phase;
> uint8_t ram[32];
> uint8_t command;
> @@ -50,7 +56,7 @@ typedef struct NeXTRTC {
> uint8_t status;
> uint8_t control;
> uint8_t retval;
> -} NeXTRTC;
> +};
>
> #define TYPE_NEXT_SCSI "next-scsi"
> OBJECT_DECLARE_SIMPLE_TYPE(NeXTSCSI, NEXT_SCSI)
> @@ -1012,6 +1018,37 @@ static const MemoryRegionOps next_dummy_en_ops = {
> .endianness = DEVICE_BIG_ENDIAN,
> };
>
> +static const VMStateDescription next_rtc_vmstate = {
> + .name = "next-rtc",
> + .version_id = 3,
> + .minimum_version_id = 3,
> + .fields = (const VMStateField[]) {
> + VMSTATE_INT8(phase, NeXTRTC),
> + VMSTATE_UINT8_ARRAY(ram, NeXTRTC, 32),
> + VMSTATE_UINT8(command, NeXTRTC),
> + VMSTATE_UINT8(value, NeXTRTC),
> + VMSTATE_UINT8(status, NeXTRTC),
> + VMSTATE_UINT8(control, NeXTRTC),
> + VMSTATE_UINT8(retval, NeXTRTC),
> + VMSTATE_END_OF_LIST()
> + },
> +};
> +
> +static void next_rtc_class_init(ObjectClass *klass, void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(klass);
> +
> + dc->desc = "NeXT RTC";
> + dc->vmsd = &next_rtc_vmstate;
> +}
> +
> +static const TypeInfo next_rtc_info = {
> + .name = TYPE_NEXT_RTC,
> + .parent = TYPE_SYS_BUS_DEVICE,
> + .instance_size = sizeof(NeXTRTC),
> + .class_init = next_rtc_class_init,
> +};
> +
> static void next_pc_rtc_data_in_irq(void *opaque, int n, int level)
> {
> NeXTPC *s = NEXT_PC(opaque);
> @@ -1078,6 +1115,12 @@ static void next_pc_realize(DeviceState *dev, Error **errp)
> }
> sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(dev, NEXT_SCC_I));
> sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(dev, NEXT_SCC_DMA_I));
> +
> + /* RTC */
> + d = DEVICE(object_resolve_path_component(OBJECT(dev), "rtc"));
> + if (!sysbus_realize(SYS_BUS_DEVICE(d), errp)) {
> + return;
> + }
> }
>
> static void next_pc_init(Object *obj)
> @@ -1111,6 +1154,8 @@ static void next_pc_init(Object *obj)
> "next.timer", 4);
> sysbus_init_mmio(sbd, &s->timer_mem);
>
> + object_initialize_child(obj, "rtc", &s->rtc, TYPE_NEXT_RTC);
> +
> s->rtc_power_irq = qdev_get_gpio_in(DEVICE(obj), NEXT_PWR_I);
> qdev_init_gpio_in_named(DEVICE(obj), next_pc_rtc_data_in_irq,
> "pc-rtc-data-in", 1);
> @@ -1129,22 +1174,6 @@ static Property next_pc_properties[] = {
> DEFINE_PROP_END_OF_LIST(),
> };
>
> -static const VMStateDescription next_rtc_vmstate = {
> - .name = "next-rtc",
> - .version_id = 2,
> - .minimum_version_id = 2,
> - .fields = (const VMStateField[]) {
> - VMSTATE_INT8(phase, NeXTRTC),
> - VMSTATE_UINT8_ARRAY(ram, NeXTRTC, 32),
> - VMSTATE_UINT8(command, NeXTRTC),
> - VMSTATE_UINT8(value, NeXTRTC),
> - VMSTATE_UINT8(status, NeXTRTC),
> - VMSTATE_UINT8(control, NeXTRTC),
> - VMSTATE_UINT8(retval, NeXTRTC),
> - VMSTATE_END_OF_LIST()
> - },
> -};
> -
> static const VMStateDescription next_pc_vmstate = {
> .name = "next-pc",
> .version_id = 3,
> @@ -1297,6 +1326,7 @@ static void next_register_type(void)
> type_register_static(&next_typeinfo);
> type_register_static(&next_pc_info);
> type_register_static(&next_scsi_info);
> + type_register_static(&next_rtc_info);
> }
>
> type_init(next_register_type)
Shouldn't the next_rtc_vmstate get removed from next_pc_vmstate now?
Also, should we finally move the RTC code to a separate file?
Thomas
next prev parent reply other threads:[~2024-11-09 8:15 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 8:58 [PATCH 00/36] next-cube: more tidy-ups and improvements Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 01/36] next-cube: fix up compilation when DEBUG_NEXT is enabled Mark Cave-Ayland
2024-10-26 6:30 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 02/36] next-cube: remove 0x14020 dummy value from next_mmio_read() Mark Cave-Ayland
2024-10-26 7:44 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 03/36] next-cube: remove overlap between next.dma and next.mmio memory regions Mark Cave-Ayland
2024-10-24 2:42 ` Philippe Mathieu-Daudé
2024-10-24 8:31 ` Mark Cave-Ayland
2024-10-26 7:56 ` Thomas Huth
2024-10-26 21:13 ` Mark Cave-Ayland
2024-10-27 11:24 ` Thomas Huth
2024-10-28 22:06 ` Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 04/36] next-cube: remove cpu parameter from next_scsi_init() Mark Cave-Ayland
2024-10-26 7:59 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 05/36] next-cube: create new next.scsi container memory region Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 06/36] next-cube: move next_scsi_init() to next_pc_realize() Mark Cave-Ayland
2024-10-27 10:07 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 07/36] next-cube: introduce next_pc_init() object init function Mark Cave-Ayland
2024-10-27 10:25 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 08/36] next-cube: introduce next-scsi device Mark Cave-Ayland
2024-10-27 11:58 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 09/36] next-cube: move SCSI CSRs from next-pc to the " Mark Cave-Ayland
2024-10-28 16:21 ` Thomas Huth
2024-10-28 22:21 ` Mark Cave-Ayland
2024-11-01 16:37 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 10/36] next-cube: move SCSI 4020 logic from next-pc device to " Mark Cave-Ayland
2024-10-28 16:22 ` Thomas Huth
2024-10-28 22:23 ` Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 11/36] next-cube: move floppy disk MMIO to separate memory region in next-pc Mark Cave-Ayland
2024-10-28 16:31 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 12/36] next-cube: map ESCC registers as a subregion of the next.scr memory region Mark Cave-Ayland
2024-10-28 16:36 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 13/36] next-cube: move ESCC to be QOM child of next-pc device Mark Cave-Ayland
2024-10-28 16:39 ` Thomas Huth
2024-10-28 22:28 ` Mark Cave-Ayland
2024-11-01 16:34 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 14/36] next-cube: move timer MMIO to separate memory region on " Mark Cave-Ayland
2024-11-01 16:46 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 15/36] next-cube: move en ethernet " Mark Cave-Ayland
2024-11-02 7:26 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 16/36] next-cube: add empty slots for unknown accesses to next.scr memory region Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 17/36] next-cube: remove unused " Mark Cave-Ayland
2024-11-02 9:40 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 18/36] next-cube: rearrange NeXTState declarations to improve readability Mark Cave-Ayland
2024-11-02 9:41 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 19/36] next-cube: convert next-pc device to use Resettable interface Mark Cave-Ayland
2024-11-02 9:48 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 20/36] next-cube: rename typedef struct NextRtc to NeXTRTC Mark Cave-Ayland
2024-11-02 9:49 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 21/36] next-cube: use qemu_irq to drive int_status in next_scr2_rtc_update() Mark Cave-Ayland
2024-11-03 18:31 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 22/36] next-cube: separate rtc read and write shift logic Mark Cave-Ayland
2024-11-03 18:52 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 23/36] next-cube: always use retval to return rtc read values Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 24/36] next-cube: use named gpio to set RTC data bit in scr2 Mark Cave-Ayland
2024-11-09 7:51 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 25/36] next-cube: use named gpio to read " Mark Cave-Ayland
2024-11-09 7:55 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 26/36] next-cube: don't use rtc phase value of -1 Mark Cave-Ayland
2024-10-23 10:37 ` BALATON Zoltan
2024-10-24 8:28 ` Mark Cave-Ayland
2024-11-09 7:57 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 27/36] next-cube: QOMify NeXTRTC Mark Cave-Ayland
2024-10-24 2:44 ` Philippe Mathieu-Daudé
2024-10-24 8:41 ` Mark Cave-Ayland
2024-11-09 8:14 ` Thomas Huth [this message]
2024-11-11 21:30 ` Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 28/36] next-cube: move reset of next-rtc fields from next-pc to next-rtc Mark Cave-Ayland
2024-11-09 8:19 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 29/36] next-cube: move rtc-data-in gpio from next-pc to next-rtc device Mark Cave-Ayland
2024-11-09 8:21 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 30/36] next-cube: use named gpio output for next-rtc data Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 31/36] next-cube: add rtc-cmd-reset named gpio to reset the rtc state machine Mark Cave-Ayland
2024-11-09 8:24 ` Thomas Huth
2024-11-11 21:37 ` Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 32/36] next-cube: add rtc-power-out " Mark Cave-Ayland
2024-10-24 8:45 ` Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 33/36] next-cube: move next_rtc_cmd_is_write() and next_rtc_data_in_irq() functions Mark Cave-Ayland
2024-11-09 8:25 ` Thomas Huth
2024-11-11 21:39 ` Mark Cave-Ayland
2024-10-23 8:58 ` [PATCH 34/36] next-cube: rename old_scr2 and scr2_2 in next_scr2_rtc_update() Mark Cave-Ayland
2024-11-09 8:25 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 35/36] next-cube: add my copyright to the top of the file Mark Cave-Ayland
2024-11-09 8:26 ` Thomas Huth
2024-10-23 8:58 ` [PATCH 36/36] next-cube: replace boiler-plate GPL 2.0 or later license text with SPDX identifier Mark Cave-Ayland
2024-10-23 9:30 ` Daniel P. Berrangé
2024-10-23 9:42 ` Mark Cave-Ayland
2024-10-29 11:22 ` [PATCH 00/36] next-cube: more tidy-ups and improvements Peter Maydell
2024-10-29 12:51 ` Mark Cave-Ayland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241109091426.0f636645@tpx1 \
--to=huth@tuxfamily.org \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).