All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hervé Poussineau" <hpoussin@reactos.org>
To: Aurelien Jarno <aurelien@aurel32.net>,
	Yongbok Kim <yongbok.kim@mips.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>
Subject: [Qemu-devel] [PATCH v2 12/15] piix4: add a mc146818rtc controller as specified in datasheet
Date: Sat, 16 Dec 2017 22:30:01 +0100	[thread overview]
Message-ID: <20171216213004.30393-13-hpoussin@reactos.org> (raw)
In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org>

Remove mc146818rtc instanciated in malta board, to not have it twice.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/isa/piix4.c       | 12 ++++++++++++
 hw/mips/mips_malta.c |  4 ----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index ada8c12979..637bec9b3a 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -31,6 +31,7 @@
 #include "hw/char/isa.h"
 #include "hw/sysbus.h"
 #include "hw/timer/i8254.h"
+#include "hw/timer/mc146818rtc.h"
 #include "qapi/error.h"
 
 PCIDevice *piix4_dev;
@@ -43,6 +44,7 @@ typedef struct PIIX4State {
     FDCtrlISABus floppy;
     ISASerialState serial[2];
     ISAParallelState parallel;
+    RTCState rtc;
 
     /* Reset Control Register */
     MemoryRegion rcr_mem;
@@ -213,6 +215,15 @@ static void piix4_realize(PCIDevice *pci, Error **errp)
         return;
     }
 
+    /* timer */
+    qdev_set_parent_bus(DEVICE(&s->rtc), BUS(isa_bus));
+    object_property_set_bool(OBJECT(&s->rtc), true, "realized", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
+    isa_init_irq(ISA_DEVICE(&s->rtc), &s->rtc.irq, RTC_ISA_IRQ);
+
     piix4_dev = pci;
     qemu_register_reset(piix4_reset, s);
 }
@@ -227,6 +238,7 @@ static void piix4_init(Object *obj)
         object_initialize(&s->serial[i], sizeof(s->serial[i]), TYPE_ISA_SERIAL);
     }
     object_initialize(&s->parallel, sizeof(s->parallel), TYPE_ISA_PARALLEL);
+    object_initialize(&s->rtc, sizeof(s->rtc), TYPE_MC146818_RTC);
 
     object_property_add_alias(obj, "floppy", OBJECT(&s->floppy), "driveA",
                               &error_abort);
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 6a2d8a5c0d..3d304a6e0a 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -995,7 +995,6 @@ void mips_malta_init(MachineState *machine)
     uint8_t *smbus_eeprom_buf = g_malloc0(smbus_eeprom_size);
     int64_t kernel_entry, bootloader_run_addr;
     PCIBus *pci_bus;
-    ISABus *isa_bus;
     qemu_irq cbus_irq, i8259_irq;
     PCIDevice *pci;
     int piix4_devfn;
@@ -1197,7 +1196,6 @@ void mips_malta_init(MachineState *machine)
     qdev_prop_set_chr(dev, "parallel", parallel_hds[0]);
 
     qdev_init_nofail(dev);
-    isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0"));
     piix4_devfn = pci->devfn;
 
     /* Interrupt controller */
@@ -1213,8 +1211,6 @@ void mips_malta_init(MachineState *machine)
     smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size);
     g_free(smbus_eeprom_buf);
 
-    rtc_init(isa_bus, 2000, NULL);
-
     /* Network card */
     network_init(pci_bus);
 
-- 
2.11.0

  parent reply	other threads:[~2017-12-16 21:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-16 21:29 [Qemu-devel] [PATCH 00/15] piix4: cleanup and improvements Hervé Poussineau
2017-12-16 21:29 ` [Qemu-devel] [PATCH v2 01/15] fdc: move object structures to header file Hervé Poussineau
2017-12-16 21:29 ` [Qemu-devel] [PATCH v2 02/15] serial/parallel: " Hervé Poussineau
2017-12-16 21:29 ` [Qemu-devel] [PATCH v2 03/15] mc146818rtc: move structure " Hervé Poussineau
2017-12-16 21:29 ` [Qemu-devel] [PATCH v2 04/15] mc146818rtc: always register rtc to rtc list Hervé Poussineau
2017-12-16 21:29 ` [Qemu-devel] [PATCH v2 05/15] piix4: rename some variables in realize function Hervé Poussineau
2017-12-16 21:29 ` [Qemu-devel] [PATCH v2 06/15] piix4: add Reset Control Register Hervé Poussineau
2017-12-16 21:29 ` [Qemu-devel] [PATCH v2 07/15] piix4: add a i8259 interrupt controller as specified in datasheet Hervé Poussineau
2017-12-16 21:29 ` [Qemu-devel] [PATCH v2 08/15] piix4: add a i8257 dma " Hervé Poussineau
2017-12-16 21:29 ` [Qemu-devel] [PATCH v2 09/15] piix4: add a i8254 pit " Hervé Poussineau
2017-12-16 21:29 ` [Qemu-devel] [PATCH v2 10/15] piix4: add a i8042 keyboard/mouse " Hervé Poussineau
2017-12-16 21:30 ` [Qemu-devel] [PATCH v2 11/15] piix4: add a floppy controller, 1 parallel port and 2 serial ports Hervé Poussineau
2017-12-16 21:30 ` Hervé Poussineau [this message]
2017-12-16 21:30 ` [Qemu-devel] [PATCH v2 13/15] piix4: add a speaker as specified in datasheet Hervé Poussineau
2017-12-16 21:30 ` [Qemu-devel] [PATCH v2 14/15] piix4: rename PIIX4 object to piix4-isa Hervé Poussineau
2017-12-17  1:14   ` Philippe Mathieu-Daudé
2017-12-16 21:30 ` [Qemu-devel] [PATCH v2 15/15] piix4: we can now instanciate a PIIX4 with -device Hervé Poussineau

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=20171216213004.30393-13-hpoussin@reactos.org \
    --to=hpoussin@reactos.org \
    --cc=aurelien@aurel32.net \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yongbok.kim@mips.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.