From nobody Mon Feb 9 02:07:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1628087358321340.42541776430335; Wed, 4 Aug 2021 07:29:18 -0700 (PDT) Received: from localhost ([::1]:47794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBHtU-0005SD-T1 for importer@patchew.org; Wed, 04 Aug 2021 10:29:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHs8-0002jZ-CX for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:27:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHs6-0003IX-14 for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:27:51 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-187-ci4YAcR5NSKGBut6CEdc2g-1; Wed, 04 Aug 2021 10:27:47 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3FB8A193F56F; Wed, 4 Aug 2021 14:27:46 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0120A66FFF; Wed, 4 Aug 2021 14:27:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 46EF11800986; Wed, 4 Aug 2021 16:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628087268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=01Lrm7Hu40fKJBGSWca3/XVRk5CdtRF6jd4pCnVGVxs=; b=Hv/lut8LhVIC31hF4b1K3HBw1zPna7bO4cOv90WnydlGCfpnJswa5dio6f7zMR0IecApXb Ed97xLezJfzXxQf4E4kybXb/leh0uwc2OSbKGlNW2QWy9KDgNh+xaYX29yIup+BFfTGf29 gDbXP4sBhMMictd0l5GzgZnWPiKuot0= X-MC-Unique: ci4YAcR5NSKGBut6CEdc2g-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 1/7] floppy: move isa_fdc_get_drive_type to separate source file. Date: Wed, 4 Aug 2021 16:27:31 +0200 Message-Id: <20210804142737.3366441-2-kraxel@redhat.com> In-Reply-To: <20210804142737.3366441-1-kraxel@redhat.com> References: <20210804142737.3366441-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Richard Henderson , Max Reitz , Gerd Hoffmann , Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1628087359074100002 isa_fdc_get_drive_type() is needed by pc machine types when setting up the cmos. Move to separate source file so we can keep it in core qemu when building floppy as module. Signed-off-by: Gerd Hoffmann --- hw/block/fdc-internal.h | 16 ++++++++++++++++ hw/block/fdc-isa.c | 22 ---------------------- hw/block/fdc-module.c | 39 +++++++++++++++++++++++++++++++++++++++ hw/block/meson.build | 1 + 4 files changed, 56 insertions(+), 22 deletions(-) create mode 100644 hw/block/fdc-module.c diff --git a/hw/block/fdc-internal.h b/hw/block/fdc-internal.h index 036392e9fc10..a74cd5e4b9f2 100644 --- a/hw/block/fdc-internal.h +++ b/hw/block/fdc-internal.h @@ -29,6 +29,7 @@ #include "exec/ioport.h" #include "hw/block/block.h" #include "hw/block/fdc.h" +#include "hw/isa/isa.h" #include "qapi/qapi-types-block.h" =20 typedef struct FDCtrl FDCtrl; @@ -143,6 +144,21 @@ struct FDCtrl { PortioList portio_list; }; =20 +OBJECT_DECLARE_SIMPLE_TYPE(FDCtrlISABus, ISA_FDC) + +struct FDCtrlISABus { + /*< private >*/ + ISADevice parent_obj; + /*< public >*/ + + uint32_t iobase; + uint32_t irq; + uint32_t dma; + struct FDCtrl state; + int32_t bootindexA; + int32_t bootindexB; +}; + extern const FDFormat fd_formats[]; extern const VMStateDescription vmstate_fdc; =20 diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c index 3bf64e06657b..dd7e1669f862 100644 --- a/hw/block/fdc-isa.c +++ b/hw/block/fdc-isa.c @@ -49,21 +49,6 @@ #include "qom/object.h" #include "fdc-internal.h" =20 -OBJECT_DECLARE_SIMPLE_TYPE(FDCtrlISABus, ISA_FDC) - -struct FDCtrlISABus { - /*< private >*/ - ISADevice parent_obj; - /*< public >*/ - - uint32_t iobase; - uint32_t irq; - uint32_t dma; - struct FDCtrl state; - int32_t bootindexA; - int32_t bootindexB; -}; - static void fdctrl_external_reset_isa(DeviceState *d) { FDCtrlISABus *isa =3D ISA_FDC(d); @@ -117,13 +102,6 @@ static void isabus_fdc_realize(DeviceState *dev, Error= **errp) } } =20 -FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i) -{ - FDCtrlISABus *isa =3D ISA_FDC(fdc); - - return isa->state.drives[i].drive; -} - static void isa_fdc_get_drive_max_chs(FloppyDriveType type, uint8_t *maxc, uint8_t *maxh, uint8_t *maxs) { diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c new file mode 100644 index 000000000000..93953bf0aa57 --- /dev/null +++ b/hw/block/fdc-module.c @@ -0,0 +1,39 @@ +/* + * QEMU Floppy disk emulator (Intel 82078) + * + * Some small helper functions which must be built into core qemu when + * building floppy as module. + * + * Copyright (c) 2003, 2007 Jocelyn Mayer + * Copyright (c) 2008 Herv=C3=A9 Poussineau + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "hw/isa/isa.h" +#include "hw/block/fdc.h" +#include "fdc-internal.h" + +FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i) +{ + FDCtrlISABus *isa =3D ISA_FDC(fdc); + + return isa->state.drives[i].drive; +} diff --git a/hw/block/meson.build b/hw/block/meson.build index 2389326112ae..8460042fe320 100644 --- a/hw/block/meson.build +++ b/hw/block/meson.build @@ -4,6 +4,7 @@ softmmu_ss.add(files( 'hd-geometry.c' )) softmmu_ss.add(when: 'CONFIG_ECC', if_true: files('ecc.c')) +softmmu_ss.add(when: 'CONFIG_FDC', if_true: files('fdc-module.c')) softmmu_ss.add(when: 'CONFIG_FDC', if_true: files('fdc.c')) softmmu_ss.add(when: 'CONFIG_FDC_ISA', if_true: files('fdc-isa.c')) softmmu_ss.add(when: 'CONFIG_FDC_SYSBUS', if_true: files('fdc-sysbus.c')) --=20 2.31.1 From nobody Mon Feb 9 02:07:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1628087489998776.6309489365923; Wed, 4 Aug 2021 07:31:29 -0700 (PDT) Received: from localhost ([::1]:54746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBHvc-0001bT-QY for importer@patchew.org; Wed, 04 Aug 2021 10:31:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsA-0002kY-9Y for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:27:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHs6-0003KU-S9 for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:27:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-Yuxt_W_bNo2k_r7rEv2LyA-1; Wed, 04 Aug 2021 10:27:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 232ED1026209; Wed, 4 Aug 2021 14:27:48 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4ECA60BF4; Wed, 4 Aug 2021 14:27:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 55A821800987; Wed, 4 Aug 2021 16:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628087270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s8fn+CHbP6vdoLeFpXBzR9+y5YgSiK+WUd/xfJkUkpA=; b=CBurjGYPDsBzaU7oTTmrpyMSYlRXz/9ww90qXfv3iQ1gsn9LsCRy1NRiRcuVYFNpMPXFCM SQDpaOpejC2ZihrlD6VesDWc9Z/dkfXygaeuntnDZXRigYzzYmSFNOkuTJJTadYXRX+bEm 3FzTJzvexAM/rVsgqavheJuf63HAKzw= X-MC-Unique: Yuxt_W_bNo2k_r7rEv2LyA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 2/7] floppy: move isa_fdc_init_drives + fdctrl_init_drives Date: Wed, 4 Aug 2021 16:27:32 +0200 Message-Id: <20210804142737.3366441-3-kraxel@redhat.com> In-Reply-To: <20210804142737.3366441-1-kraxel@redhat.com> References: <20210804142737.3366441-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Richard Henderson , Max Reitz , Gerd Hoffmann , Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1628087490952100001 Content-Type: text/plain; charset="utf-8" isa_fdc_init_drives() is called by pc machine setup, and it depends on fdctrl_init_drives(). Move both functions to separate source file so we can keep them in core qemu when building floppy as module. Signed-off-by: Gerd Hoffmann --- hw/block/fdc-isa.c | 5 ----- hw/block/fdc-module.c | 24 ++++++++++++++++++++++++ hw/block/fdc.c | 17 ----------------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c index dd7e1669f862..36c246efa822 100644 --- a/hw/block/fdc-isa.c +++ b/hw/block/fdc-isa.c @@ -57,11 +57,6 @@ static void fdctrl_external_reset_isa(DeviceState *d) fdctrl_reset(s, 0); } =20 -void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds) -{ - fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds); -} - static const MemoryRegionPortio fdc_portio_list[] =3D { { 1, 5, 1, .read =3D fdctrl_read, .write =3D fdctrl_write }, { 7, 1, 1, .read =3D fdctrl_read, .write =3D fdctrl_write }, diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c index 93953bf0aa57..8309e99361bc 100644 --- a/hw/block/fdc-module.c +++ b/hw/block/fdc-module.c @@ -29,8 +29,32 @@ #include "qemu/osdep.h" #include "hw/isa/isa.h" #include "hw/block/fdc.h" +#include "qapi/error.h" +#include "sysemu/blockdev.h" #include "fdc-internal.h" =20 +void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds) +{ + DeviceState *dev; + int i; + + for (i =3D 0; i < MAX_FD; i++) { + if (fds[i]) { + dev =3D qdev_new("floppy"); + qdev_prop_set_uint32(dev, "unit", i); + qdev_prop_set_enum(dev, "drive-type", FLOPPY_DRIVE_TYPE_AUTO); + qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(fds[= i]), + &error_fatal); + qdev_realize_and_unref(dev, &bus->bus, &error_fatal); + } + } +} + +void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds) +{ + fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds); +} + FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i) { FDCtrlISABus *isa =3D ISA_FDC(fdc); diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 9014cd30b3ab..ba42537e8d26 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2297,23 +2297,6 @@ static void fdctrl_result_timer(void *opaque) =20 /* Init functions */ =20 -void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds) -{ - DeviceState *dev; - int i; - - for (i =3D 0; i < MAX_FD; i++) { - if (fds[i]) { - dev =3D qdev_new("floppy"); - qdev_prop_set_uint32(dev, "unit", i); - qdev_prop_set_enum(dev, "drive-type", FLOPPY_DRIVE_TYPE_AUTO); - qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(fds[= i]), - &error_fatal); - qdev_realize_and_unref(dev, &bus->bus, &error_fatal); - } - } -} - void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl, Error **errp) { int i, j; --=20 2.31.1 From nobody Mon Feb 9 02:07:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1628087631570490.83989833303474; Wed, 4 Aug 2021 07:33:51 -0700 (PDT) Received: from localhost ([::1]:33776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBHxu-0006d8-8x for importer@patchew.org; Wed, 04 Aug 2021 10:33:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsH-00038S-9V for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:28:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32768) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsE-0003Qc-FC for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:28:01 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-451-gJPUBdY5M8iLN7YweBwRpA-1; Wed, 04 Aug 2021 10:27:56 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 702A5106F8DE; Wed, 4 Aug 2021 14:27:55 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D38F3226E9; Wed, 4 Aug 2021 14:27:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 64EF81800989; Wed, 4 Aug 2021 16:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628087277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FUtcPKkcpAvixTwhou1hQK/9qEHfpZ/obicDdxAHEEc=; b=LbxwTHbtqyxyMJpEoSJzVdsvg4G2uJ06BTRpr7gSn5EqKFSW88MSegS6qwYmbOFhm2ebry qnxJHVlQqrMvtHjU1aPQkgBWS3kgISPZdzVu1OIl/XtoP3bm1zwMuO+v17vbTdo+8zjZca mm/3kyA7o/sjz2ZUQY9mHKfsoFbDZ6k= X-MC-Unique: gJPUBdY5M8iLN7YweBwRpA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 3/7] floppy: move fdctrl_init_sysbus Date: Wed, 4 Aug 2021 16:27:33 +0200 Message-Id: <20210804142737.3366441-4-kraxel@redhat.com> In-Reply-To: <20210804142737.3366441-1-kraxel@redhat.com> References: <20210804142737.3366441-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Richard Henderson , Max Reitz , Gerd Hoffmann , Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1628087633264100001 Content-Type: text/plain; charset="utf-8" Needed by mips machine init. Move to separate source file so we can keep it in core qemu when building floppy as module. Signed-off-by: Gerd Hoffmann --- hw/block/fdc-internal.h | 15 +++++++++++++++ hw/block/fdc-module.c | 21 +++++++++++++++++++++ hw/block/fdc-sysbus.c | 34 ---------------------------------- 3 files changed, 36 insertions(+), 34 deletions(-) diff --git a/hw/block/fdc-internal.h b/hw/block/fdc-internal.h index a74cd5e4b9f2..f6c56f6e827f 100644 --- a/hw/block/fdc-internal.h +++ b/hw/block/fdc-internal.h @@ -30,6 +30,7 @@ #include "hw/block/block.h" #include "hw/block/fdc.h" #include "hw/isa/isa.h" +#include "hw/sysbus.h" #include "qapi/qapi-types-block.h" =20 typedef struct FDCtrl FDCtrl; @@ -159,6 +160,20 @@ struct FDCtrlISABus { int32_t bootindexB; }; =20 +#define TYPE_SYSBUS_FDC "base-sysbus-fdc" +typedef struct FDCtrlSysBusClass FDCtrlSysBusClass; +typedef struct FDCtrlSysBus FDCtrlSysBus; +DECLARE_OBJ_CHECKERS(FDCtrlSysBus, FDCtrlSysBusClass, + SYSBUS_FDC, TYPE_SYSBUS_FDC) + +struct FDCtrlSysBus { + /*< private >*/ + SysBusDevice parent_obj; + /*< public >*/ + + struct FDCtrl state; +}; + extern const FDFormat fd_formats[]; extern const VMStateDescription vmstate_fdc; =20 diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c index 8309e99361bc..11e6ae7c0cb9 100644 --- a/hw/block/fdc-module.c +++ b/hw/block/fdc-module.c @@ -29,10 +29,31 @@ #include "qemu/osdep.h" #include "hw/isa/isa.h" #include "hw/block/fdc.h" +#include "hw/sysbus.h" #include "qapi/error.h" #include "sysemu/blockdev.h" #include "fdc-internal.h" =20 +void fdctrl_init_sysbus(qemu_irq irq, int dma_chann, + hwaddr mmio_base, DriveInfo **fds) +{ + FDCtrl *fdctrl; + DeviceState *dev; + SysBusDevice *sbd; + FDCtrlSysBus *sys; + + dev =3D qdev_new("sysbus-fdc"); + sys =3D SYSBUS_FDC(dev); + fdctrl =3D &sys->state; + fdctrl->dma_chann =3D dma_chann; /* FIXME */ + sbd =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(sbd, &error_fatal); + sysbus_connect_irq(sbd, 0, irq); + sysbus_mmio_map(sbd, 0, mmio_base); + + fdctrl_init_drives(&sys->state.bus, fds); +} + void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds) { DeviceState *dev; diff --git a/hw/block/fdc-sysbus.c b/hw/block/fdc-sysbus.c index 57fc8773f124..5a8d393d31c2 100644 --- a/hw/block/fdc-sysbus.c +++ b/hw/block/fdc-sysbus.c @@ -32,12 +32,6 @@ #include "fdc-internal.h" #include "trace.h" =20 -#define TYPE_SYSBUS_FDC "base-sysbus-fdc" -typedef struct FDCtrlSysBusClass FDCtrlSysBusClass; -typedef struct FDCtrlSysBus FDCtrlSysBus; -DECLARE_OBJ_CHECKERS(FDCtrlSysBus, FDCtrlSysBusClass, - SYSBUS_FDC, TYPE_SYSBUS_FDC) - struct FDCtrlSysBusClass { /*< private >*/ SysBusDeviceClass parent_class; @@ -46,14 +40,6 @@ struct FDCtrlSysBusClass { bool use_strict_io; }; =20 -struct FDCtrlSysBus { - /*< private >*/ - SysBusDevice parent_obj; - /*< public >*/ - - struct FDCtrl state; -}; - static uint64_t fdctrl_read_mem(void *opaque, hwaddr reg, unsigned ize) { return fdctrl_read(opaque, (uint32_t)reg); @@ -94,26 +80,6 @@ static void fdctrl_handle_tc(void *opaque, int irq, int = level) trace_fdctrl_tc_pulse(level); } =20 -void fdctrl_init_sysbus(qemu_irq irq, int dma_chann, - hwaddr mmio_base, DriveInfo **fds) -{ - FDCtrl *fdctrl; - DeviceState *dev; - SysBusDevice *sbd; - FDCtrlSysBus *sys; - - dev =3D qdev_new("sysbus-fdc"); - sys =3D SYSBUS_FDC(dev); - fdctrl =3D &sys->state; - fdctrl->dma_chann =3D dma_chann; /* FIXME */ - sbd =3D SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(sbd, &error_fatal); - sysbus_connect_irq(sbd, 0, irq); - sysbus_mmio_map(sbd, 0, mmio_base); - - fdctrl_init_drives(&sys->state.bus, fds); -} - void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base, DriveInfo **fds, qemu_irq *fdc_tc) { --=20 2.31.1 From nobody Mon Feb 9 02:07:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1628087364097852.1862535561045; Wed, 4 Aug 2021 07:29:24 -0700 (PDT) Received: from localhost ([::1]:48340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBHtb-0005o1-1e for importer@patchew.org; Wed, 04 Aug 2021 10:29:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsE-0002w6-EN for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:27:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsA-0003OK-Pe for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:27:56 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-575-xqhrEpGWP06jOabukpIAjg-1; Wed, 04 Aug 2021 10:27:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED540801B3D; Wed, 4 Aug 2021 14:27:49 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ABDA560BF4; Wed, 4 Aug 2021 14:27:49 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 71F19180098A; Wed, 4 Aug 2021 16:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628087274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KFXTVs+sC+WW8MRDSK2vVKiIDqTn49cLiD4FYlXIYog=; b=D5KDRV+/rGwhuYO6L2gaaRO5keg/eTbtXPVyTFKNPqtQXAzNjgiDBtAK4Z36ZeATeApHa+ kPs+ghykAriznB/UlRBtNBe1DzDSwmdffJQyVK8dE5rDbkGukpsPGSwwVfRqsja/3C4L5E XLGc8d/2jBiCCaUcwzipbx14CEZ/h68= X-MC-Unique: xqhrEpGWP06jOabukpIAjg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 4/7] floppy: move sun4m_fdctrl_init Date: Wed, 4 Aug 2021 16:27:34 +0200 Message-Id: <20210804142737.3366441-5-kraxel@redhat.com> In-Reply-To: <20210804142737.3366441-1-kraxel@redhat.com> References: <20210804142737.3366441-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Richard Henderson , Max Reitz , Gerd Hoffmann , Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1628087365814100001 Content-Type: text/plain; charset="utf-8" Needed by sparc machine init. Move to separate source file so we can keep it in core qemu when building floppy as module. Signed-off-by: Gerd Hoffmann --- hw/block/fdc-module.c | 16 ++++++++++++++++ hw/block/fdc-sysbus.c | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c index 11e6ae7c0cb9..3682b5c1ebd1 100644 --- a/hw/block/fdc-module.c +++ b/hw/block/fdc-module.c @@ -54,6 +54,22 @@ void fdctrl_init_sysbus(qemu_irq irq, int dma_chann, fdctrl_init_drives(&sys->state.bus, fds); } =20 +void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base, + DriveInfo **fds, qemu_irq *fdc_tc) +{ + DeviceState *dev; + FDCtrlSysBus *sys; + + dev =3D qdev_new("sun-fdtwo"); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sys =3D SYSBUS_FDC(dev); + sysbus_connect_irq(SYS_BUS_DEVICE(sys), 0, irq); + sysbus_mmio_map(SYS_BUS_DEVICE(sys), 0, io_base); + *fdc_tc =3D qdev_get_gpio_in(dev, 0); + + fdctrl_init_drives(&sys->state.bus, fds); +} + void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds) { DeviceState *dev; diff --git a/hw/block/fdc-sysbus.c b/hw/block/fdc-sysbus.c index 5a8d393d31c2..b358b6467ef5 100644 --- a/hw/block/fdc-sysbus.c +++ b/hw/block/fdc-sysbus.c @@ -80,22 +80,6 @@ static void fdctrl_handle_tc(void *opaque, int irq, int = level) trace_fdctrl_tc_pulse(level); } =20 -void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base, - DriveInfo **fds, qemu_irq *fdc_tc) -{ - DeviceState *dev; - FDCtrlSysBus *sys; - - dev =3D qdev_new("sun-fdtwo"); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sys =3D SYSBUS_FDC(dev); - sysbus_connect_irq(SYS_BUS_DEVICE(sys), 0, irq); - sysbus_mmio_map(SYS_BUS_DEVICE(sys), 0, io_base); - *fdc_tc =3D qdev_get_gpio_in(dev, 0); - - fdctrl_init_drives(&sys->state.bus, fds); -} - static void sysbus_fdc_common_instance_init(Object *obj) { DeviceState *dev =3D DEVICE(obj); --=20 2.31.1 From nobody Mon Feb 9 02:07:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1628087494355739.6294681181363; Wed, 4 Aug 2021 07:31:34 -0700 (PDT) Received: from localhost ([::1]:54812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBHvg-0001e7-CB for importer@patchew.org; Wed, 04 Aug 2021 10:31:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsE-0002w7-E0 for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:27:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsA-0003OG-Pl for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:27:57 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-349-ID5AoXBSNvavclWve5q84A-1; Wed, 04 Aug 2021 10:27:53 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E3A9892504; Wed, 4 Aug 2021 14:27:51 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A072060BF4; Wed, 4 Aug 2021 14:27:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 83185180098B; Wed, 4 Aug 2021 16:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628087274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Lz3yAVLZsB+UKURKnYlyYxvL4JQUqXeNOsa1h5pg/Og=; b=cZfgLy3xvWHVf4xULTudR9HEVS01VxeHlJXYpB1kQfPpuIDM4F48REMjZy1lUpXsu8LTLQ YSf0HDcaUKI0srJXyQV8MTnpTtmSO0ElwdREGW/vHOnetaRQAKUVHc3SSQerU/Ua53HEx+ kzTvPfHkoWF25YoFzopxBJMrvqTLdyQ= X-MC-Unique: ID5AoXBSNvavclWve5q84A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 5/7] floppy: move cmos_get_fd_drive_type Date: Wed, 4 Aug 2021 16:27:35 +0200 Message-Id: <20210804142737.3366441-6-kraxel@redhat.com> In-Reply-To: <20210804142737.3366441-1-kraxel@redhat.com> References: <20210804142737.3366441-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Richard Henderson , Max Reitz , Gerd Hoffmann , Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1628087495778100001 Content-Type: text/plain; charset="utf-8" Needed by pc machine init. Move to separate source file so we can keep it in core qemu when building floppy as module. Signed-off-by: Gerd Hoffmann --- hw/block/fdc-isa.c | 25 ------------------------- hw/block/fdc-module.c | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c index 36c246efa822..a5a124fb9236 100644 --- a/hw/block/fdc-isa.c +++ b/hw/block/fdc-isa.c @@ -162,31 +162,6 @@ static Aml *build_fdinfo_aml(int idx, FloppyDriveType = type) return dev; } =20 -int cmos_get_fd_drive_type(FloppyDriveType fd0) -{ - int val; - - switch (fd0) { - case FLOPPY_DRIVE_TYPE_144: - /* 1.44 Mb 3"5 drive */ - val =3D 4; - break; - case FLOPPY_DRIVE_TYPE_288: - /* 2.88 Mb 3"5 drive */ - val =3D 5; - break; - case FLOPPY_DRIVE_TYPE_120: - /* 1.2 Mb 5"5 drive */ - val =3D 2; - break; - case FLOPPY_DRIVE_TYPE_NONE: - default: - val =3D 0; - break; - } - return val; -} - static void fdc_isa_build_aml(ISADevice *isadev, Aml *scope) { Aml *dev; diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c index 3682b5c1ebd1..7e2aaf86a0c0 100644 --- a/hw/block/fdc-module.c +++ b/hw/block/fdc-module.c @@ -98,3 +98,28 @@ FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, i= nt i) =20 return isa->state.drives[i].drive; } + +int cmos_get_fd_drive_type(FloppyDriveType fd0) +{ + int val; + + switch (fd0) { + case FLOPPY_DRIVE_TYPE_144: + /* 1.44 Mb 3"5 drive */ + val =3D 4; + break; + case FLOPPY_DRIVE_TYPE_288: + /* 2.88 Mb 3"5 drive */ + val =3D 5; + break; + case FLOPPY_DRIVE_TYPE_120: + /* 1.2 Mb 5"5 drive */ + val =3D 2; + break; + case FLOPPY_DRIVE_TYPE_NONE: + default: + val =3D 0; + break; + } + return val; +} --=20 2.31.1 From nobody Mon Feb 9 02:07:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1628087647243686.7902083498217; Wed, 4 Aug 2021 07:34:07 -0700 (PDT) Received: from localhost ([::1]:34418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBHy9-00072s-Mu for importer@patchew.org; Wed, 04 Aug 2021 10:34:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsO-0003YD-3y for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:28:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsM-0003Xf-EN for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:28:07 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-454-RX3Asm3xOoyxONfJDskZgg-1; Wed, 04 Aug 2021 10:28:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7480880292B; Wed, 4 Aug 2021 14:28:01 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C40AB5F724; Wed, 4 Aug 2021 14:27:53 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9435D180098C; Wed, 4 Aug 2021 16:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628087285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y5iury3rvhB+SWrtNuW5D7gCQ979PrFSPMcUa5g8Cq8=; b=RKzZW6f4TCZ9oit/NMHFZO6aLaIo2b9jIqo0ak6/ZPE4MxrtRHKrLEIXzlKq5O/4SQl73y uCnZ2SU/Iwwg5d6sV+yyB8kVNy+lI4nY8Umc6YgL0rtUgDktDa0/ORk1jUEqcNxfCz4SBl KMjGNir1BoJfI88/PAb13zu+2UZpobQ= X-MC-Unique: RX3Asm3xOoyxONfJDskZgg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 6/7] floppy: build as modules. Date: Wed, 4 Aug 2021 16:27:36 +0200 Message-Id: <20210804142737.3366441-7-kraxel@redhat.com> In-Reply-To: <20210804142737.3366441-1-kraxel@redhat.com> References: <20210804142737.3366441-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Richard Henderson , Max Reitz , Gerd Hoffmann , Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1628087649299100001 Content-Type: text/plain; charset="utf-8" Add module_obj() annotations, update meson build rules. Signed-off-by: Gerd Hoffmann --- hw/block/fdc-isa.c | 2 ++ hw/block/fdc-sysbus.c | 4 ++++ hw/block/fdc.c | 2 ++ hw/block/meson.build | 17 ++++++++++++++--- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c index a5a124fb9236..fb2139760f8c 100644 --- a/hw/block/fdc-isa.c +++ b/hw/block/fdc-isa.c @@ -259,6 +259,7 @@ static const TypeInfo isa_fdc_info =3D { .class_init =3D isabus_fdc_class_init, .instance_init =3D isabus_fdc_instance_init, }; +module_obj(TYPE_ISA_FDC); =20 static void isa_fdc_register_types(void) { @@ -266,3 +267,4 @@ static void isa_fdc_register_types(void) } =20 type_init(isa_fdc_register_types) +module_dep("hw-block-fdc"); diff --git a/hw/block/fdc-sysbus.c b/hw/block/fdc-sysbus.c index b358b6467ef5..8cc65cd92642 100644 --- a/hw/block/fdc-sysbus.c +++ b/hw/block/fdc-sysbus.c @@ -137,6 +137,7 @@ static const TypeInfo sysbus_fdc_common_typeinfo =3D { .class_init =3D sysbus_fdc_common_class_init, .class_size =3D sizeof(FDCtrlSysBusClass), }; +module_obj(TYPE_SYSBUS_FDC); =20 static Property sysbus_fdc_properties[] =3D { DEFINE_PROP_SIGNED("fdtypeA", FDCtrlSysBus, state.qdev_for_drives[0].t= ype, @@ -164,6 +165,7 @@ static const TypeInfo sysbus_fdc_typeinfo =3D { .parent =3D TYPE_SYSBUS_FDC, .class_init =3D sysbus_fdc_class_init, }; +module_obj("sysbus-fdc"); =20 static Property sun4m_fdc_properties[] =3D { DEFINE_PROP_SIGNED("fdtype", FDCtrlSysBus, state.qdev_for_drives[0].ty= pe, @@ -190,6 +192,7 @@ static const TypeInfo sun4m_fdc_typeinfo =3D { .parent =3D TYPE_SYSBUS_FDC, .class_init =3D sun4m_fdc_class_init, }; +module_obj("sun-fdtwo"); =20 static void sysbus_fdc_register_types(void) { @@ -199,3 +202,4 @@ static void sysbus_fdc_register_types(void) } =20 type_init(sysbus_fdc_register_types) +module_dep("hw-block-fdc"); diff --git a/hw/block/fdc.c b/hw/block/fdc.c index ba42537e8d26..95a1467f3faf 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -74,6 +74,7 @@ static const TypeInfo floppy_bus_info =3D { .parent =3D TYPE_BUS, .instance_size =3D sizeof(FloppyBus), }; +module_obj(TYPE_FLOPPY_BUS); =20 static void floppy_bus_create(FDCtrl *fdc, FloppyBus *bus, DeviceState *de= v) { @@ -564,6 +565,7 @@ static const TypeInfo floppy_drive_info =3D { .instance_size =3D sizeof(FloppyDrive), .class_init =3D floppy_drive_class_init, }; +module_obj(TYPE_FLOPPY_DRIVE); =20 /********************************************************/ /* Intel 82078 floppy disk controller emulation */ diff --git a/hw/block/meson.build b/hw/block/meson.build index 8460042fe320..b336773ac591 100644 --- a/hw/block/meson.build +++ b/hw/block/meson.build @@ -1,3 +1,5 @@ +hw_block_modules =3D {} + softmmu_ss.add(files( 'block.c', 'cdrom.c', @@ -5,9 +7,6 @@ softmmu_ss.add(files( )) softmmu_ss.add(when: 'CONFIG_ECC', if_true: files('ecc.c')) softmmu_ss.add(when: 'CONFIG_FDC', if_true: files('fdc-module.c')) -softmmu_ss.add(when: 'CONFIG_FDC', if_true: files('fdc.c')) -softmmu_ss.add(when: 'CONFIG_FDC_ISA', if_true: files('fdc-isa.c')) -softmmu_ss.add(when: 'CONFIG_FDC_SYSBUS', if_true: files('fdc-sysbus.c')) softmmu_ss.add(when: 'CONFIG_NAND', if_true: files('nand.c')) softmmu_ss.add(when: 'CONFIG_ONENAND', if_true: files('onenand.c')) softmmu_ss.add(when: 'CONFIG_PFLASH_CFI01', if_true: files('pflash_cfi01.c= ')) @@ -20,4 +19,16 @@ softmmu_ss.add(when: 'CONFIG_TC58128', if_true: files('t= c58128.c')) specific_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk.c')) specific_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-= blk.c')) =20 +fdc_ss =3D ss.source_set() +fdc_isa_ss =3D ss.source_set() +fdc_sysbus_ss =3D ss.source_set() +fdc_ss.add(when: 'CONFIG_FDC', if_true: files('fdc.c')) +fdc_isa_ss.add(when: 'CONFIG_FDC_ISA', if_true: files('fdc-isa.c')) +fdc_sysbus_ss.add(when: 'CONFIG_FDC_SYSBUS', if_true: files('fdc-sysbus.c'= )) +hw_block_modules +=3D {'fdc': fdc_ss, + 'fdc-isa' : fdc_isa_ss, + 'fdc-sysbus' : fdc_sysbus_ss } + subdir('dataplane') + +modules +=3D { 'hw-block': hw_block_modules } --=20 2.31.1 From nobody Mon Feb 9 02:07:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1628087507261590.9993489273827; Wed, 4 Aug 2021 07:31:47 -0700 (PDT) Received: from localhost ([::1]:55394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBHvu-00029c-6H for importer@patchew.org; Wed, 04 Aug 2021 10:31:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsI-0003C5-26 for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:28:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50347) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsG-0003Si-8H for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:28:01 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-587-f6CYmisjN86LhHHhc3a6Tw-1; Wed, 04 Aug 2021 10:27:58 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6761D1026203; Wed, 4 Aug 2021 14:27:57 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 215B460BF4; Wed, 4 Aug 2021 14:27:57 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A39D0180098D; Wed, 4 Aug 2021 16:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628087279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JNl5Inw4Iwn9igzgBiU2/mXAXG2+LCCpC7PEv1O0wIE=; b=K3qoI3Yr1rsRxiX9lkPBpg3/7LweDCHk57dlLvtZKY/nPKsMHipCIybaCYO9Uoc+p/Lj+V WNMqB04dPkcmPZytVnEN3ZtRDIgug+Aqh9WxpwI8qm8n6UGfSGmDu9p565dHR2B3dIHc0q oX+ILx5WyoH+3zcZ59g9oxlkBt8SnIk= X-MC-Unique: f6CYmisjN86LhHHhc3a6Tw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 7/7] pc: add floppy=OnOffAuto Date: Wed, 4 Aug 2021 16:27:37 +0200 Message-Id: <20210804142737.3366441-8-kraxel@redhat.com> In-Reply-To: <20210804142737.3366441-1-kraxel@redhat.com> References: <20210804142737.3366441-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Richard Henderson , Max Reitz , Gerd Hoffmann , Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1628087510072100003 Content-Type: text/plain; charset="utf-8" Allows to enable/disable the floppy controller. Default depends on MachineClass->no_floppy. It's ON for now, but we can flip the default for 6.2+ machine types. NOTE: This requires -nodefaults or no_floppy=3D1 to actually have an effect. Otherwise the default floppy drive created by qemu will auto-enable the floppy controller. Not sure how to deal with that best. IMHO we should simply stop creating a default floppy, unfortunaly that will break live migration. Signed-off-by: Gerd Hoffmann --- include/hw/i386/pc.h | 2 ++ hw/i386/pc.c | 23 +++++++++++++++++++++++ hw/i386/pc_piix.c | 8 +++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 88dffe751724..b418ead6c260 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -38,6 +38,7 @@ typedef struct PCMachineState { /* Configuration options: */ uint64_t max_ram_below_4g; OnOffAuto vmport; + OnOffAuto floppy; =20 bool acpi_build_enabled; bool smbus_enabled; @@ -59,6 +60,7 @@ typedef struct PCMachineState { #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" #define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size" #define PC_MACHINE_VMPORT "vmport" +#define PC_MACHINE_FLOPPY "floppy" #define PC_MACHINE_SMBUS "smbus" #define PC_MACHINE_SATA "sata" #define PC_MACHINE_PIT "pit" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c2b9d62a358f..832ea9cc8ef8 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1468,6 +1468,23 @@ static void pc_machine_set_vmport(Object *obj, Visit= or *v, const char *name, visit_type_OnOffAuto(v, name, &pcms->vmport, errp); } =20 +static void pc_machine_get_floppy(Object *obj, Visitor *v, const char *nam= e, + void *opaque, Error **errp) +{ + PCMachineState *pcms =3D PC_MACHINE(obj); + OnOffAuto floppy =3D pcms->floppy; + + visit_type_OnOffAuto(v, name, &floppy, errp); +} + +static void pc_machine_set_floppy(Object *obj, Visitor *v, const char *nam= e, + void *opaque, Error **errp) +{ + PCMachineState *pcms =3D PC_MACHINE(obj); + + visit_type_OnOffAuto(v, name, &pcms->floppy, errp); +} + static bool pc_machine_get_smbus(Object *obj, Error **errp) { PCMachineState *pcms =3D PC_MACHINE(obj); @@ -1751,6 +1768,12 @@ static void pc_machine_class_init(ObjectClass *oc, v= oid *data) object_class_property_set_description(oc, PC_MACHINE_VMPORT, "Enable vmport (pc & q35)"); =20 + object_class_property_add(oc, PC_MACHINE_FLOPPY, "OnOffAuto", + pc_machine_get_floppy, pc_machine_set_floppy, + NULL, NULL); + object_class_property_set_description(oc, PC_MACHINE_FLOPPY, + "Enable floppy (pc only)"); + object_class_property_add_bool(oc, PC_MACHINE_SMBUS, pc_machine_get_smbus, pc_machine_set_smbus); =20 diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 30b8bd6ea92d..7f81729e42cd 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -235,8 +235,14 @@ static void pc_init1(MachineState *machine, pcms->vmport =3D xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; } =20 + if (pcms->floppy =3D=3D ON_OFF_AUTO_AUTO) { + pcms->floppy =3D MACHINE_CLASS(pcmc)->no_floppy + ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; + } + /* init basic PC hardware */ - pc_basic_device_init(pcms, isa_bus, x86ms->gsi, &rtc_state, true, + pc_basic_device_init(pcms, isa_bus, x86ms->gsi, &rtc_state, + pcms->floppy =3D=3D ON_OFF_AUTO_ON, 0x4); =20 pc_nic_init(pcmc, isa_bus, pci_bus); --=20 2.31.1