From patchwork Sat Dec 16 21:29:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849559 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="qTx7mwqi"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgYn1RR3z9t1t for ; Sun, 17 Dec 2017 08:34:53 +1100 (AEDT) Received: from localhost ([::1]:52212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK6d-0000oy-BA for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:34:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK4l-0008OK-Ui for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:32:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK4k-00036j-KU for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:32:55 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK4k-00036H-B8; Sat, 16 Dec 2017 16:32:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=h0wL85Qa5ojnP5y6YRV2Nm0sT/sn1s5Y2Z8Jt6MB/oQ=; b=qTx7mwqiFTJMlU7oz6hTuuHQXAEHwBxcDgXYB+aVrko3r7pDN1DiSO6sjyb4BooRVycBY6kWMLAQlF4pdDKH7WyKnC+K4ORjF9gAtxGYLw0afsTtDHmbHRWNuhzY2xLPU5OIPSzXL13nj/e76qtTWUG5jPbZDop1vl1CInrmzJ8=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK3L-0002si-UV; Sat, 16 Dec 2017 21:31:33 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:29:50 +0100 Message-Id: <20171216213004.30393-2-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 01/15] fdc: move object structures to header file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , =?utf-8?q?Herv=C3=A9_Poussineau?= , "open list:Floppy" , Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We are now able to embed floppy controllers in another object. Signed-off-by: Hervé Poussineau --- hw/block/fdc.c | 102 ------------------------------------------------ include/hw/block/fdc.h | 103 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 102 deletions(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 67f78ac702..502345c4d2 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -60,15 +60,8 @@ #define TYPE_FLOPPY_BUS "floppy-bus" #define FLOPPY_BUS(obj) OBJECT_CHECK(FloppyBus, (obj), TYPE_FLOPPY_BUS) -typedef struct FDCtrl FDCtrl; -typedef struct FDrive FDrive; static FDrive *get_drv(FDCtrl *fdctrl, int unit); -typedef struct FloppyBus { - BusState bus; - FDCtrl *fdc; -} FloppyBus; - static const TypeInfo floppy_bus_info = { .name = TYPE_FLOPPY_BUS, .parent = TYPE_BUS, @@ -178,36 +171,6 @@ static FDriveSize drive_size(FloppyDriveType drive) #define FD_SECTOR_SC 2 /* Sector size code */ #define FD_RESET_SENSEI_COUNT 4 /* Number of sense interrupts on RESET */ -/* Floppy disk drive emulation */ -typedef enum FDiskFlags { - FDISK_DBL_SIDES = 0x01, -} FDiskFlags; - -struct FDrive { - FDCtrl *fdctrl; - BlockBackend *blk; - BlockConf *conf; - /* Drive status */ - FloppyDriveType drive; /* CMOS drive type */ - uint8_t perpendicular; /* 2.88 MB access mode */ - /* Position */ - uint8_t head; - uint8_t track; - uint8_t sect; - /* Media */ - FloppyDriveType disk; /* Current disk type */ - FDiskFlags flags; - uint8_t last_sect; /* Nb sector per track */ - uint8_t max_track; /* Nb of tracks */ - uint16_t bps; /* Bytes per sector */ - uint8_t ro; /* Is read-only */ - uint8_t media_changed; /* Is media changed */ - uint8_t media_rate; /* Data rate of medium */ - - bool media_validated; /* Have we validated the media? */ -}; - - static FloppyDriveType get_fallback_drive_type(FDrive *drv); /* Hack: FD_SEEK is expected to work on empty drives. However, QEMU @@ -824,60 +787,6 @@ enum { #define FD_MULTI_TRACK(state) ((state) & FD_STATE_MULTI) #define FD_FORMAT_CMD(state) ((state) & FD_STATE_FORMAT) -struct FDCtrl { - MemoryRegion iomem; - qemu_irq irq; - /* Controller state */ - QEMUTimer *result_timer; - int dma_chann; - uint8_t phase; - IsaDma *dma; - /* Controller's identification */ - uint8_t version; - /* HW */ - uint8_t sra; - uint8_t srb; - uint8_t dor; - uint8_t dor_vmstate; /* only used as temp during vmstate */ - uint8_t tdr; - uint8_t dsr; - uint8_t msr; - uint8_t cur_drv; - uint8_t status0; - uint8_t status1; - uint8_t status2; - /* Command FIFO */ - uint8_t *fifo; - int32_t fifo_size; - uint32_t data_pos; - uint32_t data_len; - uint8_t data_state; - uint8_t data_dir; - uint8_t eot; /* last wanted sector */ - /* States kept only to be returned back */ - /* precompensation */ - uint8_t precomp_trk; - uint8_t config; - uint8_t lock; - /* Power down config (also with status regB access mode */ - uint8_t pwrd; - /* Floppy drives */ - FloppyBus bus; - uint8_t num_floppies; - FDrive drives[MAX_FD]; - struct { - BlockBackend *blk; - FloppyDriveType type; - } qdev_for_drives[MAX_FD]; - int reset_sensei; - uint32_t check_media_rate; - FloppyDriveType fallback; /* type=auto failure fallback */ - /* Timers state */ - uint8_t timer0; - uint8_t timer1; - PortioList portio_list; -}; - static FloppyDriveType get_fallback_drive_type(FDrive *drv) { return drv->fdctrl->fallback; @@ -896,17 +805,6 @@ typedef struct FDCtrlSysBus { #define ISA_FDC(obj) OBJECT_CHECK(FDCtrlISABus, (obj), TYPE_ISA_FDC) -typedef struct FDCtrlISABus { - ISADevice parent_obj; - - uint32_t iobase; - uint32_t irq; - uint32_t dma; - struct FDCtrl state; - int32_t bootindexA; - int32_t bootindexB; -} FDCtrlISABus; - static uint32_t fdctrl_read (void *opaque, uint32_t reg) { FDCtrl *fdctrl = opaque; diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h index 1749dabf25..d076b2fc1a 100644 --- a/include/hw/block/fdc.h +++ b/include/hw/block/fdc.h @@ -2,12 +2,115 @@ #define HW_FDC_H #include "qemu-common.h" +#include "hw/block/block.h" +#include "hw/isa/isa.h" /* fdc.c */ #define MAX_FD 2 +typedef struct FDCtrl FDCtrl; + +/* Floppy disk drive emulation */ +typedef enum FDiskFlags { + FDISK_DBL_SIDES = 0x01, +} FDiskFlags; + +typedef struct FDrive { + FDCtrl *fdctrl; + BlockBackend *blk; + BlockConf *conf; + /* Drive status */ + FloppyDriveType drive; /* CMOS drive type */ + uint8_t perpendicular; /* 2.88 MB access mode */ + /* Position */ + uint8_t head; + uint8_t track; + uint8_t sect; + /* Media */ + FloppyDriveType disk; /* Current disk type */ + FDiskFlags flags; + uint8_t last_sect; /* Nb sector per track */ + uint8_t max_track; /* Nb of tracks */ + uint16_t bps; /* Bytes per sector */ + uint8_t ro; /* Is read-only */ + uint8_t media_changed; /* Is media changed */ + uint8_t media_rate; /* Data rate of medium */ + + bool media_validated; /* Have we validated the media? */ +} FDrive; + +typedef struct FloppyBus { + BusState bus; + FDCtrl *fdc; +} FloppyBus; + +struct FDCtrl { + MemoryRegion iomem; + qemu_irq irq; + /* Controller state */ + QEMUTimer *result_timer; + int dma_chann; + uint8_t phase; + IsaDma *dma; + /* Controller's identification */ + uint8_t version; + /* HW */ + uint8_t sra; + uint8_t srb; + uint8_t dor; + uint8_t dor_vmstate; /* only used as temp during vmstate */ + uint8_t tdr; + uint8_t dsr; + uint8_t msr; + uint8_t cur_drv; + uint8_t status0; + uint8_t status1; + uint8_t status2; + /* Command FIFO */ + uint8_t *fifo; + int32_t fifo_size; + uint32_t data_pos; + uint32_t data_len; + uint8_t data_state; + uint8_t data_dir; + uint8_t eot; /* last wanted sector */ + /* States kept only to be returned back */ + /* precompensation */ + uint8_t precomp_trk; + uint8_t config; + uint8_t lock; + /* Power down config (also with status regB access mode */ + uint8_t pwrd; + /* Floppy drives */ + FloppyBus bus; + uint8_t num_floppies; + FDrive drives[MAX_FD]; + struct { + BlockBackend *blk; + FloppyDriveType type; + } qdev_for_drives[MAX_FD]; + int reset_sensei; + uint32_t check_media_rate; + FloppyDriveType fallback; /* type=auto failure fallback */ + /* Timers state */ + uint8_t timer0; + uint8_t timer1; + PortioList portio_list; +}; + #define TYPE_ISA_FDC "isa-fdc" +typedef struct FDCtrlISABus { + ISADevice parent_obj; + + uint32_t iobase; + uint32_t irq; + uint32_t dma; + struct FDCtrl state; + int32_t bootindexA; + int32_t bootindexB; +} FDCtrlISABus; + ISADevice *fdctrl_init_isa(ISABus *bus, DriveInfo **fds); void fdctrl_init_sysbus(qemu_irq irq, int dma_chann, hwaddr mmio_base, DriveInfo **fds); From patchwork Sat Dec 16 21:29:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849562 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="EFthO4vl"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgcJ10x8z9t1t for ; Sun, 17 Dec 2017 08:37:04 +1100 (AEDT) Received: from localhost ([::1]:52227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK8k-0002D8-5K for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:37:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK6C-0000kf-VH for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:34:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK6B-0003nk-TC for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:34:24 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40021) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK6B-0003nO-FC; Sat, 16 Dec 2017 16:34:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=v5ITkP4LYDjuSFZ+1Tbir8sf2qHgjxn6E4nUfh2WzoY=; b=EFthO4vljwXjwSHMEKl06fh5KaA5T/exWdvhQzpytdWUSQNpAtjCJxtfTXyCoxHqXnB+NEqn0Khi7kTsQ5OL8BKRvWnlJSr9tb7SzD2jaYH9HqibcqiHjqCYmNOtnYyWD3j/VQ+DSbegXQ/2ay0Md95A2LrNpay5q8Gk51YfK+c=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK4g-0002si-Jp; Sat, 16 Dec 2017 21:32:52 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:29:51 +0100 Message-Id: <20171216213004.30393-3-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 02/15] serial/parallel: move object structures to header file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:PowerPC" , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We are now able to embed serial/parallel ports in another object. Signed-off-by: Hervé Poussineau --- hw/char/parallel.c | 31 +----------------------------- hw/char/serial-isa.c | 13 +------------ hw/ppc/pnv.c | 2 +- include/hw/char/isa.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ include/hw/char/serial.h | 1 - 5 files changed, 53 insertions(+), 44 deletions(-) create mode 100644 include/hw/char/isa.h diff --git a/hw/char/parallel.c b/hw/char/parallel.c index f79dc76543..6b36d425ff 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -28,6 +28,7 @@ #include "chardev/char-parallel.h" #include "chardev/char-fe.h" #include "hw/isa/isa.h" +#include "hw/char/isa.h" #include "hw/i386/pc.h" #include "sysemu/sysemu.h" @@ -67,36 +68,6 @@ #define PARA_CTR_SIGNAL (PARA_CTR_SELECT|PARA_CTR_INIT|PARA_CTR_AUTOLF|PARA_CTR_STROBE) -typedef struct ParallelState { - MemoryRegion iomem; - uint8_t dataw; - uint8_t datar; - uint8_t status; - uint8_t control; - qemu_irq irq; - int irq_pending; - CharBackend chr; - int hw_driver; - int epp_timeout; - uint32_t last_read_offset; /* For debugging */ - /* Memory-mapped interface */ - int it_shift; - PortioList portio_list; -} ParallelState; - -#define TYPE_ISA_PARALLEL "isa-parallel" -#define ISA_PARALLEL(obj) \ - OBJECT_CHECK(ISAParallelState, (obj), TYPE_ISA_PARALLEL) - -typedef struct ISAParallelState { - ISADevice parent_obj; - - uint32_t index; - uint32_t iobase; - uint32_t isairq; - ParallelState state; -} ISAParallelState; - static void parallel_update_irq(ParallelState *s) { if (s->irq_pending) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index d7c5cc11fe..2c6cf81790 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -26,18 +26,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/char/serial.h" -#include "hw/isa/isa.h" - -#define ISA_SERIAL(obj) OBJECT_CHECK(ISASerialState, (obj), TYPE_ISA_SERIAL) - -typedef struct ISASerialState { - ISADevice parent_obj; - - uint32_t index; - uint32_t iobase; - uint32_t isairq; - SerialState state; -} ISASerialState; +#include "hw/char/isa.h" static const int isa_serial_io[MAX_SERIAL_PORTS] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index c35c439d81..91d8e36cac 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -41,7 +41,7 @@ #include "hw/ppc/pnv_xscom.h" #include "hw/isa/isa.h" -#include "hw/char/serial.h" +#include "hw/char/isa.h" #include "hw/timer/mc146818rtc.h" #include diff --git a/include/hw/char/isa.h b/include/hw/char/isa.h new file mode 100644 index 0000000000..39f7be41c5 --- /dev/null +++ b/include/hw/char/isa.h @@ -0,0 +1,50 @@ +#ifndef HW_CHAR_ISA_H +#define HW_CHAR_ISA_H + +#include "qemu-common.h" +#include "hw/char/serial.h" +#include "hw/isa/isa.h" + +typedef struct ParallelState { + MemoryRegion iomem; + uint8_t dataw; + uint8_t datar; + uint8_t status; + uint8_t control; + qemu_irq irq; + int irq_pending; + CharBackend chr; + int hw_driver; + int epp_timeout; + uint32_t last_read_offset; /* For debugging */ + /* Memory-mapped interface */ + int it_shift; + PortioList portio_list; +} ParallelState; + +typedef struct ISAParallelState { + ISADevice parent_obj; + + uint32_t index; + uint32_t iobase; + uint32_t isairq; + ParallelState state; +} ISAParallelState; + +#define TYPE_ISA_PARALLEL "isa-parallel" +#define ISA_PARALLEL(obj) \ + OBJECT_CHECK(ISAParallelState, (obj), TYPE_ISA_PARALLEL) + +typedef struct ISASerialState { + ISADevice parent_obj; + + uint32_t index; + uint32_t iobase; + uint32_t isairq; + SerialState state; +} ISASerialState; + +#define TYPE_ISA_SERIAL "isa-serial" +#define ISA_SERIAL(obj) OBJECT_CHECK(ISASerialState, (obj), TYPE_ISA_SERIAL) + +#endif diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index c4daf11a14..ec7da3d7f6 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -95,7 +95,6 @@ SerialState *serial_mm_init(MemoryRegion *address_space, Chardev *chr, enum device_endian end); /* serial-isa.c */ -#define TYPE_ISA_SERIAL "isa-serial" void serial_hds_isa_init(ISABus *bus, int from, int to); #endif From patchwork Sat Dec 16 21:29:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849560 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="cdfllWuC"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgZP0tZ9z9t1t for ; Sun, 17 Dec 2017 08:35:25 +1100 (AEDT) Received: from localhost ([::1]:52213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK78-00011I-Gx for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:35:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK6a-0000zi-UE for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:34:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK6Z-0003wn-Vf for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:34:48 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40052) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK6Z-0003wN-Oq for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:34:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=ZuiG++M8ZMO4+sAjonT5suljuqfcph6vYbkCu+jhf4w=; b=cdfllWuCr/MlesLlUuFDDy4wTIdZez8lfGAio11KxZsc2pIlNIbtluJlY2Ghz8ee5U9+jYYSIfM4Y+DN+gds/FwnBm1qrqdcz6zcnctCliKPNWY84zuRPUhMKOyDx6da1XRJ7mnXZ6qCP/zeSpsbI5sOa9HFa76wAHgjb74eZzo=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK4s-0002si-4H; Sat, 16 Dec 2017 21:34:21 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:29:52 +0100 Message-Id: <20171216213004.30393-4-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 03/15] mc146818rtc: move structure to header file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We are now able to embed a timer in another object. Signed-off-by: Hervé Poussineau --- hw/timer/mc146818rtc.c | 30 ------------------------------ include/hw/timer/mc146818rtc.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 7764be25ec..73d1ce21de 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -62,36 +62,6 @@ #define RTC_CLOCK_RATE 32768 #define UIP_HOLD_LENGTH (8 * NANOSECONDS_PER_SECOND / 32768) -#define MC146818_RTC(obj) OBJECT_CHECK(RTCState, (obj), TYPE_MC146818_RTC) - -typedef struct RTCState { - ISADevice parent_obj; - - MemoryRegion io; - uint8_t cmos_data[128]; - uint8_t cmos_index; - int32_t base_year; - uint64_t base_rtc; - uint64_t last_update; - int64_t offset; - qemu_irq irq; - int it_shift; - /* periodic timer */ - QEMUTimer *periodic_timer; - int64_t next_periodic_time; - /* update-ended timer */ - QEMUTimer *update_timer; - uint64_t next_alarm_time; - uint16_t irq_reinject_on_ack_count; - uint32_t irq_coalesced; - uint32_t period; - QEMUTimer *coalesced_timer; - Notifier clock_reset_notifier; - LostTickPolicy lost_tick_policy; - Notifier suspend_notifier; - QLIST_ENTRY(RTCState) link; -} RTCState; - static void rtc_set_time(RTCState *s); static void rtc_update_time(RTCState *s); static void rtc_set_cmos(RTCState *s, const struct tm *tm); diff --git a/include/hw/timer/mc146818rtc.h b/include/hw/timer/mc146818rtc.h index 7c8e64b203..d7b2aa6b13 100644 --- a/include/hw/timer/mc146818rtc.h +++ b/include/hw/timer/mc146818rtc.h @@ -5,6 +5,35 @@ #include "hw/timer/mc146818rtc_regs.h" #define TYPE_MC146818_RTC "mc146818rtc" +#define MC146818_RTC(obj) OBJECT_CHECK(RTCState, (obj), TYPE_MC146818_RTC) + +typedef struct RTCState { + ISADevice parent_obj; + + MemoryRegion io; + uint8_t cmos_data[128]; + uint8_t cmos_index; + int32_t base_year; + uint64_t base_rtc; + uint64_t last_update; + int64_t offset; + qemu_irq irq; + int it_shift; + /* periodic timer */ + QEMUTimer *periodic_timer; + int64_t next_periodic_time; + /* update-ended timer */ + QEMUTimer *update_timer; + uint64_t next_alarm_time; + uint16_t irq_reinject_on_ack_count; + uint32_t irq_coalesced; + uint32_t period; + QEMUTimer *coalesced_timer; + Notifier clock_reset_notifier; + LostTickPolicy lost_tick_policy; + Notifier suspend_notifier; + QLIST_ENTRY(RTCState) link; +} RTCState; ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq); void rtc_set_memory(ISADevice *dev, int addr, int val); From patchwork Sat Dec 16 21:29:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849563 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="jDx7/v4w"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgd450ylz9t1t for ; Sun, 17 Dec 2017 08:37:44 +1100 (AEDT) Received: from localhost ([::1]:52231 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK9O-0002ir-N8 for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:37:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK73-0001MU-4B for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:35:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK71-0004Tm-TK for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:35:16 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40072) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK71-0004Sn-Gm for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:35:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=UjBm/h35a2LuN06tq0EnmiEe+O+RAHl40enhIVjdwfU=; b=jDx7/v4wGOO3mujIOzDI5AunElYfLmVbguOqJ+u76kq1Lclryoe3QKyIMQxk8rT600i9A52EAdT22YsR9uNgXOocUTidrY1/9P2KcsjmgOhbsykJQiqlv7vFDU+PPbQiUY1bb0n2uEP26dvRh6WJNB/5CM75TGojI3vqyXZgvzs=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK6V-0002si-9b; Sat, 16 Dec 2017 21:34:43 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:29:53 +0100 Message-Id: <20171216213004.30393-5-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 04/15] mc146818rtc: always register rtc to rtc list X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We are not required anymore to use rtc_init() function. Signed-off-by: Hervé Poussineau --- hw/timer/mc146818rtc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 73d1ce21de..1b6847b803 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -905,6 +905,13 @@ static void rtc_get_date(Object *obj, struct tm *current_tm, Error **errp) rtc_get_time(s, current_tm); } +static int rtc_initfn(DeviceState *dev) +{ + RTCState *s = MC146818_RTC(dev); + QLIST_INSERT_HEAD(&rtc_devices, s, link); + return 0; +} + static void rtc_realizefn(DeviceState *dev, Error **errp) { ISADevice *isadev = ISA_DEVICE(dev); @@ -973,11 +980,9 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq) { DeviceState *dev; ISADevice *isadev; - RTCState *s; isadev = isa_create(bus, TYPE_MC146818_RTC); dev = DEVICE(isadev); - s = MC146818_RTC(isadev); qdev_prop_set_int32(dev, "base_year", base_year); qdev_init_nofail(dev); if (intercept_irq) { @@ -985,7 +990,6 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq) } else { isa_connect_gpio_out(isadev, 0, RTC_ISA_IRQ); } - QLIST_INSERT_HEAD(&rtc_devices, s, link); return isadev; } @@ -1012,12 +1016,11 @@ static void rtc_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->init = rtc_initfn; dc->realize = rtc_realizefn; dc->reset = rtc_resetdev; dc->vmsd = &vmstate_rtc; dc->props = mc146818rtc_properties; - /* Reason: needs to be wired up by rtc_init() */ - dc->user_creatable = false; } static void rtc_finalize(Object *obj) From patchwork Sat Dec 16 21:29:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="LMfOflLQ"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgb420Gmz9t1t for ; Sun, 17 Dec 2017 08:36:00 +1100 (AEDT) Received: from localhost ([::1]:52220 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK7i-0001Ol-BI for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:35:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK72-0001MO-WF for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:35:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK71-0004Th-SN for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:35:16 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40070) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK71-0004Sm-Gi for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:35:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=H/yGPLDPxbRf1DlFAqyN9US4ZhkviM5jRnLur89hS7c=; b=LMfOflLQWymQ5VwdgJVgoNyx/XoAvKAZqzXOFBAPg6+SpkDyun0xv9XG/4U0FOobr+jiNkgWX0j9+caPfK/1eDIuYdhlBqYx6Y+SF+2/En7nkR6XgxJ+9e2QuLFNdQsU2HTmmaLmh73FPHTJDo6oroIdJ9L6X5IiPyZJ8tk1JkE=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK6a-0002si-4R; Sat, 16 Dec 2017 21:34:48 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:29:54 +0100 Message-Id: <20171216213004.30393-6-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 05/15] piix4: rename some variables in realize function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" PIIX4 structure is now 's' PCI device is now 'pci' DeviceState is now 'dev' Signed-off-by: Hervé Poussineau --- hw/isa/piix4.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 6b8bc3faf0..4f476dc7e6 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -87,16 +87,17 @@ static const VMStateDescription vmstate_piix4 = { } }; -static void piix4_realize(PCIDevice *dev, Error **errp) +static void piix4_realize(PCIDevice *pci, Error **errp) { - PIIX4State *d = PIIX4_PCI_DEVICE(dev); + DeviceState *dev = DEVICE(pci); + PIIX4State *s = DO_UPCAST(PIIX4State, dev, pci); - if (!isa_bus_new(DEVICE(d), pci_address_space(dev), - pci_address_space_io(dev), errp)) { + if (!isa_bus_new(dev, pci_address_space(pci), + pci_address_space_io(pci), errp)) { return; } - piix4_dev = &d->dev; - qemu_register_reset(piix4_reset, d); + piix4_dev = pci; + qemu_register_reset(piix4_reset, s); } int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn) From patchwork Sat Dec 16 21:29:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849567 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="ufyvINvM"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzghZ4JMnz9t1t for ; Sun, 17 Dec 2017 08:40:46 +1100 (AEDT) Received: from localhost ([::1]:52252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQKCK-0005KC-Ir for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:40:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK7C-0001Rq-Ja for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:35:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK7B-0004kc-8s for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:35:26 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK7B-0004is-13 for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:35:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=AoyjMdDDBbyTv/52IB1ODZzrLNtf/SJpuVK79P4u8Ws=; b=ufyvINvMI102KgFRKNTxZuF1SGc2xo04CcfVHiK+yxg9YtQfcVl9VT9hx/tuXJIdqLnHanwfYXhlFr0yfFtrza1IZKACXWt0UeXH0COSVm8M88BU0ijj4edY01ONNT076YtnWsQdzzEptaUC1/PFi9VPRtoMZwUTdYt4EfI4ny4=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK6c-0002si-8g; Sat, 16 Dec 2017 21:35:07 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:29:55 +0100 Message-Id: <20171216213004.30393-7-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 06/15] piix4: add Reset Control Register X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The RCR I/O port (0xcf9) is used to generate a hard reset or a soft reset. Signed-off-by: Hervé Poussineau --- hw/isa/piix4.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 4f476dc7e6..7c83e7c23d 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -2,6 +2,7 @@ * QEMU PIIX4 PCI Bridge Emulation * * Copyright (c) 2006 Fabrice Bellard + * Copyright (c) 2016 Hervé Poussineau * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,6 +34,10 @@ PCIDevice *piix4_dev; typedef struct PIIX4State { PCIDevice dev; + + /* Reset Control Register */ + MemoryRegion rcr_mem; + uint8_t rcr; } PIIX4State; #define TYPE_PIIX4_PCI_DEVICE "PIIX4" @@ -87,6 +92,30 @@ static const VMStateDescription vmstate_piix4 = { } }; +static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val, + unsigned int len) +{ + PIIX4State *s = opaque; + + if (val & 4) { + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + return; + } + s->rcr = val & 2; /* keep System Reset type only */ +} + +static uint64_t piix4_rcr_read(void *opaque, hwaddr addr, unsigned int len) +{ + PIIX4State *s = opaque; + return s->rcr; +} + +static const MemoryRegionOps piix4_rcr_ops = { + .read = piix4_rcr_read, + .write = piix4_rcr_write, + .endianness = DEVICE_LITTLE_ENDIAN +}; + static void piix4_realize(PCIDevice *pci, Error **errp) { DeviceState *dev = DEVICE(pci); @@ -96,6 +125,12 @@ static void piix4_realize(PCIDevice *pci, Error **errp) pci_address_space_io(pci), errp)) { return; } + + memory_region_init_io(&s->rcr_mem, OBJECT(dev), &piix4_rcr_ops, s, + "reset-control", 1); + memory_region_add_subregion_overlap(pci_address_space_io(pci), 0xcf9, + &s->rcr_mem, 1); + piix4_dev = pci; qemu_register_reset(piix4_reset, s); } From patchwork Sat Dec 16 21:29:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849569 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="a6twYdEU"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgkf2SJFz9t1t for ; Sun, 17 Dec 2017 08:42:34 +1100 (AEDT) Received: from localhost ([::1]:52263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQKE4-0006pD-GQ for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:42:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK8G-0002Iv-5M for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:36:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK8E-0006NW-Vr for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:36:32 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40114) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK8B-0006Gr-3U for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:36:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=uYz2YnN1dKVPxqKXTqXRWC4LwUyuMSoxVS4wDa9JwwE=; b=a6twYdEUnoByJRtJIu6oppq1zvm9URu+3CPx7yeEWsHH49v00fHSEQSpUk3OWrVKZzZcy0mmrBkzeITFy1UmnKxoNgbo7Vffalsq2eQ549HZ53uGFBlbUoCyiz+AbdNZWcN/WjRvmOVuKGaJzaUZWikAIy1lMjacXYA7xo1YtBs=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK74-0002si-Ol; Sat, 16 Dec 2017 21:35:19 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:29:56 +0100 Message-Id: <20171216213004.30393-8-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 07/15] piix4: add a i8259 interrupt controller as specified in datasheet X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add ISA irqs as piix4 gpio in, and CPU interrupt request as piix4 gpio out. Remove i8259 instanciated in malta board, to not have it twice. We can also remove the now unused piix4_init() function. Signed-off-by: Hervé Poussineau --- hw/isa/piix4.c | 40 +++++++++++++++++++++++++++++----------- hw/mips/mips_malta.c | 28 ++++++++++++---------------- include/hw/i386/pc.h | 1 - 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 7c83e7c23d..eb2f730fff 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -34,6 +34,8 @@ PCIDevice *piix4_dev; typedef struct PIIX4State { PCIDevice dev; + qemu_irq cpu_intr; + qemu_irq *isa; /* Reset Control Register */ MemoryRegion rcr_mem; @@ -92,6 +94,18 @@ static const VMStateDescription vmstate_piix4 = { } }; +static void piix4_request_i8259_irq(void *opaque, int irq, int level) +{ + PIIX4State *s = opaque; + qemu_set_irq(s->cpu_intr, level); +} + +static void piix4_set_i8259_irq(void *opaque, int irq, int level) +{ + PIIX4State *s = opaque; + qemu_set_irq(s->isa[irq], level); +} + static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned int len) { @@ -120,28 +134,32 @@ static void piix4_realize(PCIDevice *pci, Error **errp) { DeviceState *dev = DEVICE(pci); PIIX4State *s = DO_UPCAST(PIIX4State, dev, pci); + ISABus *isa_bus; + qemu_irq *i8259_out_irq; - if (!isa_bus_new(dev, pci_address_space(pci), - pci_address_space_io(pci), errp)) { + isa_bus = isa_bus_new(dev, pci_address_space(pci), + pci_address_space_io(pci), errp); + if (!isa_bus) { return; } + qdev_init_gpio_in_named(dev, piix4_set_i8259_irq, "isa", ISA_NUM_IRQS); + qdev_init_gpio_out_named(dev, &s->cpu_intr, "intr", 1); + memory_region_init_io(&s->rcr_mem, OBJECT(dev), &piix4_rcr_ops, s, "reset-control", 1); memory_region_add_subregion_overlap(pci_address_space_io(pci), 0xcf9, &s->rcr_mem, 1); - piix4_dev = pci; - qemu_register_reset(piix4_reset, s); -} + /* initialize i8259 pic */ + i8259_out_irq = qemu_allocate_irqs(piix4_request_i8259_irq, s, 1); + s->isa = i8259_init(isa_bus, *i8259_out_irq); -int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn) -{ - PCIDevice *d; + /* initialize ISA irqs */ + isa_bus_irqs(isa_bus, s->isa); - d = pci_create_simple_multifunction(bus, devfn, true, "PIIX4"); - *isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0")); - return d->devfn; + piix4_dev = pci; + qemu_register_reset(piix4_reset, s); } static void piix4_class_init(ObjectClass *klass, void *data) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index ec6af4a277..a1397c3304 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -96,7 +96,7 @@ typedef struct { SysBusDevice parent_obj; MIPSCPSState *cps; - qemu_irq *i8259; + qemu_irq i8259[16]; } MaltaState; static ISADevice *pit; @@ -998,8 +998,8 @@ void mips_malta_init(MachineState *machine) int64_t kernel_entry, bootloader_run_addr; PCIBus *pci_bus; ISABus *isa_bus; - qemu_irq *isa_irq; qemu_irq cbus_irq, i8259_irq; + PCIDevice *pci; int piix4_devfn; I2CBus *smbus; int i; @@ -1180,28 +1180,24 @@ void mips_malta_init(MachineState *machine) /* Board ID = 0x420 (Malta Board with CoreLV) */ stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420); - /* - * We have a circular dependency problem: pci_bus depends on isa_irq, - * isa_irq is provided by i8259, i8259 depends on ISA, ISA depends - * on piix4, and piix4 depends on pci_bus. To stop the cycle we have - * qemu_irq_proxy() adds an extra bit of indirection, allowing us - * to resolve the isa_irq -> i8259 dependency after i8259 is initialized. - */ - isa_irq = qemu_irq_proxy(&s->i8259, 16); - /* Northbridge */ - pci_bus = gt64120_register(isa_irq); + pci_bus = gt64120_register(s->i8259); /* Southbridge */ ide_drive_get(hd, ARRAY_SIZE(hd)); - piix4_devfn = piix4_init(pci_bus, &isa_bus, 80); + pci = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), + true, "PIIX4"); + dev = DEVICE(pci); + isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); + piix4_devfn = pci->devfn; /* Interrupt controller */ - /* The 8259 is attached to the MIPS CPU INT0 pin, ie interrupt 2 */ - s->i8259 = i8259_init(isa_bus, i8259_irq); + qdev_connect_gpio_out_named(dev, "intr", 0, i8259_irq); + for (i = 0; i < 16; i++) { + s->i8259[i] = qdev_get_gpio_in_named(dev, "isa", i); + } - isa_bus_irqs(isa_bus, s->i8259); pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1); pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci"); smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index ef438bd765..9e449a08cb 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -313,7 +313,6 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type, PCIBus *find_i440fx(void); /* piix4.c */ extern PCIDevice *piix4_dev; -int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); /* vga.c */ enum vga_retrace_method { From patchwork Sat Dec 16 21:29:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="MKrbdBfs"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgmf692Cz9t1t for ; Sun, 17 Dec 2017 08:44:18 +1100 (AEDT) Received: from localhost ([::1]:52269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQKFl-00085W-0L for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:44:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK8M-0002Pc-4c for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:36:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK8L-0006Wb-B8 for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:36:38 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40130) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK8L-0006V6-4o for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:36:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=G/4Ui+N0yMqOPvHN7OScsdtq277Ikq8QM0TFAzFZwo4=; b=MKrbdBfsfeGRxQvvLe/dzHK4q/se6AtMgelLBF57COk+Pgp/rJ3i8/wzUGUxZ3XWNk04NbQ0SfU+vDsqdJxW9nVL9UqPi45CzTDDDVOd8WTpX7nykS7BfVAih07mwPSP/kMl/zCVKh5kZo/Fpaj6MGWJlI/BY8nSjKlVhsF0GMk=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK7C-0002si-Ae; Sat, 16 Dec 2017 21:35:27 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:29:57 +0100 Message-Id: <20171216213004.30393-9-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 08/15] piix4: add a i8257 dma controller as specified in datasheet X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Remove i8257 instanciated in malta board, to not have it twice. Signed-off-by: Hervé Poussineau --- hw/isa/piix4.c | 3 +++ hw/mips/mips_malta.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index eb2f730fff..66fdfe25e2 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -158,6 +158,9 @@ static void piix4_realize(PCIDevice *pci, Error **errp) /* initialize ISA irqs */ isa_bus_irqs(isa_bus, s->isa); + /* DMA */ + DMA_init(isa_bus, 0); + piix4_dev = pci; qemu_register_reset(piix4_reset, s); } diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index a1397c3304..8b2a574673 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1205,7 +1205,6 @@ void mips_malta_init(MachineState *machine) smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); g_free(smbus_eeprom_buf); pit = pit_init(isa_bus, 0x40, 0, NULL); - DMA_init(isa_bus, 0); /* Super I/O */ isa_create_simple(isa_bus, "i8042"); From patchwork Sat Dec 16 21:29:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849572 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="tn5FVD+m"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgpf5gy2z9t1t for ; Sun, 17 Dec 2017 08:46:02 +1100 (AEDT) Received: from localhost ([::1]:52283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQKHQ-0000zl-VA for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:46:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK8e-0002dk-N0 for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:36:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK8d-00073A-UO for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:36:56 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40159) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK8d-0006zx-Nm for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:36:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=qpYE2518e4qVKzFap+CrHevFdPuIv2eeCMG3vlS+G00=; b=tn5FVD+moBcE9Vm+sxt4WfrLHkzL1Ok1IvJ+4/LpPWQZqRdSG3HQHnJJvA6Q2n2yz18y83iUj6PIQwkp/yeV2573A9LdjoGVd3oDRcJCCrYg5C4SQ05odPrV5wbEp6SM+oKoxFoVak7g0uWpefBf0uchgio3t+hg3vGqrGdB/0U=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK8I-0002si-7Z; Sat, 16 Dec 2017 21:36:35 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:29:58 +0100 Message-Id: <20171216213004.30393-10-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 09/15] piix4: add a i8254 pit controller as specified in datasheet X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Remove i8254 instanciated in malta board, to not have it twice. Signed-off-by: Hervé Poussineau --- hw/isa/piix4.c | 4 ++++ hw/mips/mips_malta.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 66fdfe25e2..c215bee1ff 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -29,6 +29,7 @@ #include "hw/pci/pci.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" +#include "hw/timer/i8254.h" PCIDevice *piix4_dev; @@ -158,6 +159,9 @@ static void piix4_realize(PCIDevice *pci, Error **errp) /* initialize ISA irqs */ isa_bus_irqs(isa_bus, s->isa); + /* initialize pit */ + pit_init(isa_bus, 0x40, 0, NULL); + /* DMA */ DMA_init(isa_bus, 0); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 8b2a574673..5a087fa75d 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -99,8 +99,6 @@ typedef struct { qemu_irq i8259[16]; } MaltaState; -static ISADevice *pit; - static struct _loaderparams { int ram_size, ram_low_size; const char *kernel_filename; @@ -1204,7 +1202,6 @@ void mips_malta_init(MachineState *machine) isa_get_irq(NULL, 9), NULL, 0, NULL); smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); g_free(smbus_eeprom_buf); - pit = pit_init(isa_bus, 0x40, 0, NULL); /* Super I/O */ isa_create_simple(isa_bus, "i8042"); From patchwork Sat Dec 16 21:29:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849564 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="iVM+XOL0"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgdR4QLHz9t2M for ; Sun, 17 Dec 2017 08:38:03 +1100 (AEDT) Received: from localhost ([::1]:52232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK9h-0002sQ-Kd for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:38:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK8t-0002qI-9w for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK8s-0007ZR-Ft for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:11 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40183) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK8s-0007YI-90 for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=ziI+rVh/bkQnDwftorX34G0udI6xlwUSXlhVzn1UOyk=; b=iVM+XOL0jvptx10vbO6rmW0Aw9MxeArpTAvtURlopty5FpS0POOUI4i8aI+sVIHwLgAvAOCRKmHb1AAa8L/OIFlJvdtDIQTbKFHVofYYw2GHwr8fhPR0SqmyoOPdXIipSdGjxWlJ8QZc4MWTsuXKk+3vI/Nd1Bj3qQsUgksUcEs=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK8b-0002si-5E; Sat, 16 Dec 2017 21:36:53 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:29:59 +0100 Message-Id: <20171216213004.30393-11-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 10/15] piix4: add a i8042 keyboard/mouse controller as specified in datasheet X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Remove i8042 instanciated in malta board, to not have it twice. Signed-off-by: Hervé Poussineau --- hw/isa/piix4.c | 3 +++ hw/mips/mips_malta.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index c215bee1ff..cf134b01ee 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -165,6 +165,9 @@ static void piix4_realize(PCIDevice *pci, Error **errp) /* DMA */ DMA_init(isa_bus, 0); + /* Super I/O */ + isa_create_simple(isa_bus, "i8042"); + piix4_dev = pci; qemu_register_reset(piix4_reset, s); } diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 5a087fa75d..78049ccf86 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1203,9 +1203,6 @@ void mips_malta_init(MachineState *machine) smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); g_free(smbus_eeprom_buf); - /* Super I/O */ - isa_create_simple(isa_bus, "i8042"); - rtc_init(isa_bus, 2000, NULL); serial_hds_isa_init(isa_bus, 0, 2); parallel_hds_isa_init(isa_bus, 1); From patchwork Sat Dec 16 21:30:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849566 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="N+PzdH/w"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzghF0qP3z9t1t for ; Sun, 17 Dec 2017 08:40:29 +1100 (AEDT) Received: from localhost ([::1]:52245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQKC3-000531-7i for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:40:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK8w-0002tX-Q1 for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK8v-0007fi-ET for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:14 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40189) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK8u-0007cg-NB for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=quzwV2Y5dUMotgVQQ/I0VsHnlYsI4WR2pvDmTWVEDjQ=; b=N+PzdH/wVS944AcRcywch/M0dOpCQrJtV6TUU2rRTQWTaphy3PS+/iJkUbwYHRlRjRtN7HVkv3f0NvGXsHo2Go29sxVgoxj7RXBz8nw+aPXNlH38nBtz5fkJpuFB2228l19WdhhrnCNhExFA76g4F2U5ZgIJjbNDjPpxEZRDpPU=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK8f-0002si-Vy; Sat, 16 Dec 2017 21:36:58 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:30:00 +0100 Message-Id: <20171216213004.30393-12-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 11/15] piix4: add a floppy controller, 1 parallel port and 2 serial ports X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Remove their instanciation from malta board, to not have them twice. Automatically create serial/parallel ports in PIIX4 if not provided. Signed-off-by: Hervé Poussineau --- hw/isa/piix4.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/mips/mips_malta.c | 41 +++++++++++++++++--------------- 2 files changed, 89 insertions(+), 19 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index cf134b01ee..ada8c12979 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -28,8 +28,10 @@ #include "hw/i386/pc.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" +#include "hw/char/isa.h" #include "hw/sysbus.h" #include "hw/timer/i8254.h" +#include "qapi/error.h" PCIDevice *piix4_dev; @@ -38,6 +40,10 @@ typedef struct PIIX4State { qemu_irq cpu_intr; qemu_irq *isa; + FDCtrlISABus floppy; + ISASerialState serial[2]; + ISAParallelState parallel; + /* Reset Control Register */ MemoryRegion rcr_mem; uint8_t rcr; @@ -137,6 +143,8 @@ static void piix4_realize(PCIDevice *pci, Error **errp) PIIX4State *s = DO_UPCAST(PIIX4State, dev, pci); ISABus *isa_bus; qemu_irq *i8259_out_irq; + int i; + Error *err = NULL; isa_bus = isa_bus_new(dev, pci_address_space(pci), pci_address_space_io(pci), errp); @@ -168,10 +176,68 @@ static void piix4_realize(PCIDevice *pci, Error **errp) /* Super I/O */ isa_create_simple(isa_bus, "i8042"); + /* floppy */ + qdev_set_parent_bus(DEVICE(&s->floppy), BUS(isa_bus)); + object_property_set_bool(OBJECT(&s->floppy), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + + /* serial ports */ + for (i = 0; i < 2; i++) { + qdev_set_parent_bus(DEVICE(&s->serial[i]), BUS(isa_bus)); + if (!qemu_chr_fe_backend_connected(&s->serial[i].state.chr)) { + char prop[] = "serial?"; + char label[] = "piix4.serial?"; + prop[6] = i + '0'; + label[12] = i + '0'; + qdev_prop_set_chr(dev, prop, qemu_chr_new(label, "null")); + } + object_property_set_bool(OBJECT(&s->serial[i]), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + } + + /* parallel port */ + qdev_set_parent_bus(DEVICE(&s->parallel), BUS(isa_bus)); + if (!qemu_chr_fe_backend_connected(&s->parallel.state.chr)) { + qdev_prop_set_chr(dev, "parallel", + qemu_chr_new("pii4x.parallel", "null")); + } + object_property_set_bool(OBJECT(&s->parallel), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + piix4_dev = pci; qemu_register_reset(piix4_reset, s); } +static void piix4_init(Object *obj) +{ + PIIX4State *s = PIIX4_PCI_DEVICE(obj); + int i; + + object_initialize(&s->floppy, sizeof(s->floppy), TYPE_ISA_FDC); + for (i = 0; i < 2; i++) { + object_initialize(&s->serial[i], sizeof(s->serial[i]), TYPE_ISA_SERIAL); + } + object_initialize(&s->parallel, sizeof(s->parallel), TYPE_ISA_PARALLEL); + + object_property_add_alias(obj, "floppy", OBJECT(&s->floppy), "driveA", + &error_abort); + object_property_add_alias(obj, "serial0", OBJECT(&s->serial[0]), "chardev", + &error_abort); + object_property_add_alias(obj, "serial1", OBJECT(&s->serial[1]), "chardev", + &error_abort); + object_property_add_alias(obj, "parallel", OBJECT(&s->parallel), "chardev", + &error_abort); +} + static void piix4_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -195,6 +261,7 @@ static const TypeInfo piix4_info = { .name = TYPE_PIIX4_PCI_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PIIX4State), + .instance_init = piix4_init, .class_init = piix4_class_init, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 78049ccf86..6a2d8a5c0d 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1003,7 +1003,7 @@ void mips_malta_init(MachineState *machine) int i; DriveInfo *dinfo; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; - DriveInfo *fd[MAX_FD]; + DriveInfo *fd; int fl_idx = 0; int fl_sectors = bios_size >> 16; int be; @@ -1018,15 +1018,6 @@ void mips_malta_init(MachineState *machine) qdev_init_nofail(dev); - /* Make sure the first 3 serial ports are associated with a device. */ - for(i = 0; i < 3; i++) { - if (!serial_hds[i]) { - char label[32]; - snprintf(label, sizeof(label), "serial%d", i); - serial_hds[i] = qemu_chr_new(label, "null"); - } - } - /* create CPU */ mips_create_cpu(s, machine->cpu_type, &cbus_irq, &i8259_irq); @@ -1069,6 +1060,9 @@ void mips_malta_init(MachineState *machine) #endif /* FPGA */ /* The CBUS UART is attached to the MIPS CPU INT2 pin, ie interrupt 4 */ + if (!serial_hds[2]) { + serial_hds[2] = qemu_chr_new("serial2", "null"); + } malta_fpga_init(system_memory, FPGA_ADDRESS, cbus_irq, serial_hds[2]); /* Load firmware in flash / BIOS. */ @@ -1184,9 +1178,25 @@ void mips_malta_init(MachineState *machine) /* Southbridge */ ide_drive_get(hd, ARRAY_SIZE(hd)); - pci = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), - true, "PIIX4"); + pci = pci_create_multifunction(pci_bus, PCI_DEVFN(10, 0), + true, "PIIX4"); dev = DEVICE(pci); + + /* Floppy */ + fd = drive_get(IF_FLOPPY, 0, 0); + if (fd) { + qdev_prop_set_drive(dev, "floppy", blk_by_legacy_dinfo(fd), + &error_fatal); + } + + /* Serial ports */ + qdev_prop_set_chr(dev, "serial0", serial_hds[0]); + qdev_prop_set_chr(dev, "serial1", serial_hds[1]); + + /* Parallel port */ + 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; @@ -1204,13 +1214,6 @@ void mips_malta_init(MachineState *machine) g_free(smbus_eeprom_buf); rtc_init(isa_bus, 2000, NULL); - serial_hds_isa_init(isa_bus, 0, 2); - parallel_hds_isa_init(isa_bus, 1); - - for(i = 0; i < MAX_FD; i++) { - fd[i] = drive_get(IF_FLOPPY, 0, i); - } - fdctrl_init_isa(isa_bus, fd); /* Network card */ network_init(pci_bus); From patchwork Sat Dec 16 21:30:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849573 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="RciOy9g0"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgr30y7hz9t1t for ; Sun, 17 Dec 2017 08:47:15 +1100 (AEDT) Received: from localhost ([::1]:52286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQKIa-0001Zv-Oc for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:47:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK91-0002wQ-RB for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK90-0007tS-Sb for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:19 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40206) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK90-0007qn-MK for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=4bBYvwGr8TPygb4REjnKad8YlD6iXp4FFVZOnyw2Prc=; b=RciOy9g0Xi+XWNp6lRL/u2nsX9aZa20if0WvWJbN13ZuVu4N3gZb3GX0sc+3YkCkccxWIkGUTEu+iujOUbN57puIrtHMjbOgcof4yQ9fXi59xgXi0n5IauidKGGEV64Rgprsd2SEqRheTYqlidYuaNAe126khs5a0njfCPb6AAA=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK8q-0002si-Gu; Sat, 16 Dec 2017 21:37:09 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:30:01 +0100 Message-Id: <20171216213004.30393-13-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 12/15] piix4: add a mc146818rtc controller as specified in datasheet X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Remove mc146818rtc instanciated in malta board, to not have it twice. Signed-off-by: Hervé Poussineau --- 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); From patchwork Sat Dec 16 21:30:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849565 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="HlF91hHL"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgf567dnz9t2Z for ; Sun, 17 Dec 2017 08:38:37 +1100 (AEDT) Received: from localhost ([::1]:52236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQKAF-0003N1-LS for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:38:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK95-0002ze-Ex for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK94-00083A-Iw for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:23 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40220) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK94-00081k-BV for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=Hgab4SYEnw/+rDoCiIIU8Qj1dplqF4YuhIpieaAH7hE=; b=HlF91hHL1poM4hQkriXpe/58MZF77+H/B4OTH3RGhhE9xzweurYo6/jJombiR97zq+2FPRAE3uEhCW6PPFXmeLkU7uKNgzYhMaAH0TEbTMzLiIjjNmwv7Ug1FYcgtAy/oiscpscQ88LWin2DDurHluCygkb+7prvHXIoCk9FcuM=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK8u-0002si-4W; Sat, 16 Dec 2017 21:37:13 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:30:02 +0100 Message-Id: <20171216213004.30393-14-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 13/15] piix4: add a speaker as specified in datasheet X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Hervé Poussineau --- hw/isa/piix4.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 637bec9b3a..dc7146ee14 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -30,6 +30,7 @@ #include "hw/isa/isa.h" #include "hw/char/isa.h" #include "hw/sysbus.h" +#include "hw/audio/pcspk.h" #include "hw/timer/i8254.h" #include "hw/timer/mc146818rtc.h" #include "qapi/error.h" @@ -144,6 +145,7 @@ static void piix4_realize(PCIDevice *pci, Error **errp) DeviceState *dev = DEVICE(pci); PIIX4State *s = DO_UPCAST(PIIX4State, dev, pci); ISABus *isa_bus; + ISADevice *pit; qemu_irq *i8259_out_irq; int i; Error *err = NULL; @@ -170,7 +172,10 @@ static void piix4_realize(PCIDevice *pci, Error **errp) isa_bus_irqs(isa_bus, s->isa); /* initialize pit */ - pit_init(isa_bus, 0x40, 0, NULL); + pit = pit_init(isa_bus, 0x40, 0, NULL); + + /* speaker */ + pcspk_init(isa_bus, pit); /* DMA */ DMA_init(isa_bus, 0); From patchwork Sat Dec 16 21:30:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849568 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="GxGYuqDt"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgkN4n8Dz9t1t for ; Sun, 17 Dec 2017 08:42:20 +1100 (AEDT) Received: from localhost ([::1]:52259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQKDq-0006fT-Pk for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:42:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK9E-000382-7E for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK9D-0008Qh-D1 for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:32 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40228) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK98-0008AN-7n for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=X7JSpwcb+ThvYLyvOqXgM9DcISAf6MGonEFOifvgatQ=; b=GxGYuqDtyh1CcGwfsKnUMWtV/H2UditNjbB0XNwPGPDyLjn9X/D/XFWpPY8cvOS1UC0fuYTIL/1VvR+kUInm/AFPLR5rGpcMyQJGqZ4DPGY6J2WBEXRxuip+94rN2eGO79Tn4XIDIED6oEgzg3wTmXVNdhKLx+fs+eZqBwcIW+4=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK8z-0002si-2S; Sat, 16 Dec 2017 21:37:17 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:30:03 +0100 Message-Id: <20171216213004.30393-15-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 14/15] piix4: rename PIIX4 object to piix4-isa X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Other piix4 parts are already named piix4-ide and piix4-usb-uhci. Signed-off-by: Hervé Poussineau Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/piix4.c | 2 +- hw/mips/mips_malta.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index dc7146ee14..8bf260594f 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -52,7 +52,7 @@ typedef struct PIIX4State { uint8_t rcr; } PIIX4State; -#define TYPE_PIIX4_PCI_DEVICE "PIIX4" +#define TYPE_PIIX4_PCI_DEVICE "piix4-isa" #define PIIX4_PCI_DEVICE(obj) \ OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 3d304a6e0a..28d91c9668 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1178,7 +1178,7 @@ void mips_malta_init(MachineState *machine) ide_drive_get(hd, ARRAY_SIZE(hd)); pci = pci_create_multifunction(pci_bus, PCI_DEVFN(10, 0), - true, "PIIX4"); + true, "piix4-isa"); dev = DEVICE(pci); /* Floppy */ From patchwork Sat Dec 16 21:30:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 849570 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="HCcBXJam"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yzgmR0C2xz9t1t for ; Sun, 17 Dec 2017 08:44:05 +1100 (AEDT) Received: from localhost ([::1]:52267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQKFW-0007tb-30 for incoming@patchwork.ozlabs.org; Sat, 16 Dec 2017 16:44:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK9F-00039d-Ru for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK9F-0008TS-2a for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:33 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40237) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK9E-0008S8-ST for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:37:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=ztFNv8CstQxHtKwsA1JP9kXrWwpjqS9Op0+sLkN033o=; b=HCcBXJamzX5OiOveRYcbB5/ZwaKy58b5eTwumTVDlvaaBqnU86TKPA+Jv0PkrYTofmFNOTAh/PSKyzLvm/8ggLBBVLC24gUnoKvQEKWM23q6YOpp9bOL2jG36tbreMuDUy75OhGnTsQpfGzptM3F6GlNBudz+4pSNZPIX/RUCP8=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eQK92-0002si-VB; Sat, 16 Dec 2017 21:37:21 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 22:30:04 +0100 Message-Id: <20171216213004.30393-16-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v2 15/15] piix4: we can now instanciate a PIIX4 with -device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Note that the PIC master can't be connected to CPU using the command line, but it's not necessary to have a working ISA bus (for I/O, memory and DMA). Signed-off-by: Hervé Poussineau --- hw/isa/piix4.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 8bf260594f..2aaa2425ac 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -266,12 +266,6 @@ static void piix4_class_init(ObjectClass *klass, void *data) k->class_id = PCI_CLASS_BRIDGE_ISA; dc->desc = "ISA bridge"; dc->vmsd = &vmstate_piix4; - /* - * Reason: part of PIIX4 southbridge, needs to be wired up, - * e.g. by mips_malta_init() - */ - dc->user_creatable = false; - dc->hotpluggable = false; } static const TypeInfo piix4_info = {