qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <huth@tuxfamily.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>
Subject: Re: [PATCH 08/11] hw/m68k/next-cube: Move rtc into NeXTPC struct
Date: Sat, 16 Jan 2021 11:35:10 +0100	[thread overview]
Message-ID: <20210116113510.4c414402@tuxfamily.org> (raw)
In-Reply-To: <20210115201206.17347-9-peter.maydell@linaro.org>

Am Fri, 15 Jan 2021 20:12:03 +0000
schrieb Peter Maydell <peter.maydell@linaro.org>:

> Move the rtc into the NeXTPC struct. Since this is the last
> use of the 'backdoor' NextState pointer we can now remove that.
> 
> Probably the RTC should be its own device at some point: in hardware
> there is a separate MCS1850 RTC chip connected to the Peripheral
> Controller via a 1-bit serial interface.  That goes beyond the remit
> of the current refactoring, though.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/m68k/next-cube.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
> index 5a8fc24ed35..3c83b874c56 100644
> --- a/hw/m68k/next-cube.c
> +++ b/hw/m68k/next-cube.c
> @@ -78,8 +78,6 @@ struct NeXTState {
>      qemu_irq scsi_dma;
>      qemu_irq scsi_reset;
>      qemu_irq *fd_irq;
> -
> -    NextRtc rtc;
>  };
>  
>  #define TYPE_NEXT_PC "next-pc"
> @@ -88,9 +86,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(NeXTPC, NEXT_PC)
>  struct NeXTPC {
>      SysBusDevice parent_obj;
>  
> -    /* Temporary until all functionality has been moved into this
> device */
> -    NeXTState *ns;
> -
>      M68kCPU *cpu;
>  
>      MemoryRegion mmiomem;
> @@ -102,6 +97,8 @@ struct NeXTPC {
>      uint8_t scsi_csr_2;
>      uint32_t int_mask;
>      uint32_t int_status;
> +
> +    NextRtc rtc;
>  };
>  
>  /* Thanks to NeXT forums for this */
> @@ -130,7 +127,7 @@ static void nextscr2_write(NeXTPC *s, uint32_t
> val, int size) static int phase;
>      static uint8_t old_scr2;
>      uint8_t scr2_2;
> -    NextRtc *rtc = &s->ns->rtc;
> +    NextRtc *rtc = &s->rtc;
>  
>      if (size == 4) {
>          scr2_2 = (val >> 8) & 0xFF;
> @@ -864,6 +861,11 @@ static void next_pc_reset(DeviceState *dev)
>      /*     0x0000XX00 << vital bits */
>      s->scr1 = 0x00011102;
>      s->scr2 = 0x00ff0c80;
> +
> +    s->rtc.status = 0x90;
> +
> +    /* Load RTC RAM - TODO: provide possibility to load contents
> from file */
> +    memcpy(s->rtc.ram, rtc_ram2, 32);
>  }
>  
>  static void next_pc_realize(DeviceState *dev, Error **errp)
> @@ -920,7 +922,6 @@ static void next_cube_init(MachineState *machine)
>      MemoryRegion *bmapm2 = g_new(MemoryRegion, 1);
>      MemoryRegion *sysmem = get_system_memory();
>      const char *bios_name = machine->firmware ?: ROM_FILE;
> -    NeXTState *ns = NEXT_MACHINE(machine);
>      DeviceState *dev;
>      DeviceState *pcdev;
>  
> @@ -940,13 +941,6 @@ static void next_cube_init(MachineState *machine)
>      pcdev = qdev_new(TYPE_NEXT_PC);
>      object_property_set_link(OBJECT(pcdev), "cpu", OBJECT(cpu),
> &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(pcdev),
> &error_fatal);
> -    /* Temporary while we refactor this code */
> -    NEXT_PC(pcdev)->ns = ns;
> -
> -    ns->rtc.status = 0x90;
> -
> -    /* Load RTC RAM - TODO: provide possibility to load contents
> from file */
> -    memcpy(ns->rtc.ram, rtc_ram2, 32);
>  
>      /* 64MB RAM starting at 0x04000000  */
>      memory_region_add_subregion(sysmem, 0x04000000, machine->ram);

Reviewed-by: Thomas Huth <huth@tuxfamily.org>



  reply	other threads:[~2021-01-16 10:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 20:11 [PATCH 00/11] hw/m68k/next-cube: refactor to fix Coverity issue Peter Maydell
2021-01-15 20:11 ` [PATCH 01/11] hw/m68k/next-cube: Make next_irq() function static Peter Maydell
2021-01-16  6:46   ` Thomas Huth
2021-01-15 20:11 ` [PATCH 02/11] hw/m68k/next-cube: Move register/interrupt functionality into a device Peter Maydell
2021-01-15 20:11 ` [PATCH 03/11] hw/m68k/next-cube: Move mmio_ops into NeXTPC device Peter Maydell
2021-01-16  7:09   ` Thomas Huth
2021-01-15 20:11 ` [PATCH 04/11] hw/m68k/next-cube: Move scr_ops " Peter Maydell
2021-01-16  8:18   ` Thomas Huth
2021-01-15 20:12 ` [PATCH 05/11] hw/m68k/next-cube: Make next_irq take NeXTPC* as its opaque Peter Maydell
2021-01-16  8:39   ` Thomas Huth
2021-01-15 20:12 ` [PATCH 06/11] hw/m68k/next-cube: Move int_status and int_mask to NeXTPC struct Peter Maydell
2021-01-16  8:40   ` Thomas Huth
2021-01-15 20:12 ` [PATCH 07/11] hw/m68k/next-cube: Make next_irq GPIO inputs to NEXT_PC device Peter Maydell
2021-01-16 10:24   ` Thomas Huth
2021-01-15 20:12 ` [PATCH 08/11] hw/m68k/next-cube: Move rtc into NeXTPC struct Peter Maydell
2021-01-16 10:35   ` Thomas Huth [this message]
2021-01-15 20:12 ` [PATCH 09/11] hw/m68k/next-cube: Remove unused fields from NeXTState Peter Maydell
2021-01-16 10:43   ` Thomas Huth
2021-01-15 20:12 ` [PATCH 10/11] hw/m68k/next-cube: Add vmstate for NeXTPC device Peter Maydell
2021-01-16 10:44   ` Thomas Huth
2021-01-15 20:12 ` [PATCH 11/11] hw/m68k/next-cube: Add missing header comment to next-cube.h Peter Maydell
2021-01-16  7:36   ` Thomas Huth

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=20210116113510.4c414402@tuxfamily.org \
    --to=huth@tuxfamily.org \
    --cc=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --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).