From nobody Thu Nov 14 06:51:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1708339850; cv=none; d=zohomail.com; s=zohoarc; b=hw4ug/vzdLtNqlqyFqiqCDbCPBbftyK4C/CDyaefQHSUd3R0RAJB2ZQ0mJxB13AXfGryD0WTYP0u5bUBCccJOFX2CzyJ86voNUd7lluNueLwHtciVE9E8mbHw4LWNuZDW9kSHrQWi0Fz9nRseJ+IYXDyMQLr9S4HZfvJzWxdiLo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708339850; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uMyzpYmBfZWFh0ciRs954q+ufPaBFCFn1fya/ZkaycU=; b=SdY6fy0bmXNsHNwof0deay4MQf6xqLarjW/e869zqqOnE3BQITpNVeWFfG4mFTmPBJ8cXEETH2+eLdvuMNzcDQ3lWZKGl78YeyGWxlEUC9nqWhAJEdEa3jheo5XSRrxkNsj1U/Jfb22gBSXO3CFkEh8cDQoxs6G0Qs792SVYMEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708339850172628.430269706369; Mon, 19 Feb 2024 02:50:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc1DA-0003s6-Hz; Mon, 19 Feb 2024 05:49:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1D8-0003rM-OS for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:22 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1D6-00016d-Ra for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:22 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-539-skJEmgxpNqyQdJv1EYy3nw-1; Mon, 19 Feb 2024 05:49:18 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E1FAD383E122; Mon, 19 Feb 2024 10:49:17 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E8E31C02ECD; Mon, 19 Feb 2024 10:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708339760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uMyzpYmBfZWFh0ciRs954q+ufPaBFCFn1fya/ZkaycU=; b=eXePMez7Rs86GxyfI+jChTa9bZzD/Zjl4YA0qc0VxS0K0DWK3oVjFc5wn8Wxh2OdF4IB+9 CgAn0Z+g5WRUc2lo2UvNuwQlDsFGw7BvU3/rY7NPC6cj0L7c8DzAPXFfGvMjPvLMzJXrC7 /e1KTvq4QZawneBheaeymr2oK/I/h50= X-MC-Unique: skJEmgxpNqyQdJv1EYy3nw-1 From: Thomas Huth To: John Snow , qemu-devel@nongnu.org Cc: BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Subject: [PATCH 1/7] hw/ide: Add the possibility to disable the CompactFlash device in the build Date: Mon, 19 Feb 2024 11:49:06 +0100 Message-ID: <20240219104912.378211-2-thuth@redhat.com> In-Reply-To: <20240219104912.378211-1-thuth@redhat.com> References: <20240219104912.378211-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.077, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1708339850578100005 Content-Type: text/plain; charset="utf-8" For distros like downstream RHEL, it would be helpful to allow to disable the CompactFlash device. For making this possible, we need a separate Kconfig switch for this device, and the code should reside in a separate file. Let's also introduce a new header ide-dev.h which can be used to collect definitions related to IDE devices. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide/ide-dev.h | 41 ++++++++++++++++++++++++++++ hw/ide/cf.c | 58 ++++++++++++++++++++++++++++++++++++++++ hw/ide/qdev.c | 51 ++--------------------------------- hw/ide/Kconfig | 4 +++ hw/ide/meson.build | 1 + 5 files changed, 106 insertions(+), 49 deletions(-) create mode 100644 include/hw/ide/ide-dev.h create mode 100644 hw/ide/cf.c diff --git a/include/hw/ide/ide-dev.h b/include/hw/ide/ide-dev.h new file mode 100644 index 0000000000..7e9663cda9 --- /dev/null +++ b/include/hw/ide/ide-dev.h @@ -0,0 +1,41 @@ +/* + * ide device definitions + * + * Copyright (c) 2009 Gerd Hoffmann + * + * This code is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef IDE_DEV_H +#define IDE_DEV_H + +#include "hw/qdev-properties.h" +#include "hw/block/block.h" +#include "hw/ide/internal.h" + +typedef struct IDEDrive { + IDEDevice dev; +} IDEDrive; + +#define DEFINE_IDE_DEV_PROPERTIES() \ + DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf), \ + DEFINE_BLOCK_ERROR_PROPERTIES(IDEDrive, dev.conf), \ + DEFINE_PROP_STRING("ver", IDEDrive, dev.version), \ + DEFINE_PROP_UINT64("wwn", IDEDrive, dev.wwn, 0), \ + DEFINE_PROP_STRING("serial", IDEDrive, dev.serial),\ + DEFINE_PROP_STRING("model", IDEDrive, dev.model) + +void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp); + +#endif diff --git a/hw/ide/cf.c b/hw/ide/cf.c new file mode 100644 index 0000000000..2a425cb0f2 --- /dev/null +++ b/hw/ide/cf.c @@ -0,0 +1,58 @@ +/* + * ide CompactFlash support + * + * This code is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "hw/ide/ide-dev.h" +#include "qapi/qapi-types-block.h" + +static void ide_cf_realize(IDEDevice *dev, Error **errp) +{ + ide_dev_initfn(dev, IDE_CFATA, errp); +} + +static Property ide_cf_properties[] =3D { + DEFINE_IDE_DEV_PROPERTIES(), + DEFINE_BLOCK_CHS_PROPERTIES(IDEDrive, dev.conf), + DEFINE_PROP_BIOS_CHS_TRANS("bios-chs-trans", + IDEDrive, dev.chs_trans, BIOS_ATA_TRANSLATION_AUTO), + DEFINE_PROP_END_OF_LIST(), +}; + +static void ide_cf_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + IDEDeviceClass *k =3D IDE_DEVICE_CLASS(klass); + + k->realize =3D ide_cf_realize; + dc->fw_name =3D "drive"; + dc->desc =3D "virtual CompactFlash card"; + device_class_set_props(dc, ide_cf_properties); +} + +static const TypeInfo ide_cf_info =3D { + .name =3D "ide-cf", + .parent =3D TYPE_IDE_DEVICE, + .instance_size =3D sizeof(IDEDrive), + .class_init =3D ide_cf_class_init, +}; + +static void ide_cf_register_type(void) +{ + type_register_static(&ide_cf_info); +} + +type_init(ide_cf_register_type) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 1b3b4da01d..4189313d30 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -24,12 +24,9 @@ #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/module.h" -#include "hw/ide/internal.h" -#include "hw/qdev-properties.h" -#include "hw/qdev-properties-system.h" +#include "hw/ide/ide-dev.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" -#include "hw/block/block.h" #include "sysemu/sysemu.h" #include "sysemu/runstate.h" #include "qapi/visitor.h" @@ -158,11 +155,7 @@ int ide_get_bios_chs_trans(BusState *bus, int unit) =20 /* --------------------------------- */ =20 -typedef struct IDEDrive { - IDEDevice dev; -} IDEDrive; - -static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp) +void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp) { IDEBus *bus =3D DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus); IDEState *s =3D bus->ifs + dev->unit; @@ -283,19 +276,6 @@ static void ide_cd_realize(IDEDevice *dev, Error **err= p) ide_dev_initfn(dev, IDE_CD, errp); } =20 -static void ide_cf_realize(IDEDevice *dev, Error **errp) -{ - ide_dev_initfn(dev, IDE_CFATA, errp); -} - -#define DEFINE_IDE_DEV_PROPERTIES() \ - DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf), \ - DEFINE_BLOCK_ERROR_PROPERTIES(IDEDrive, dev.conf), \ - DEFINE_PROP_STRING("ver", IDEDrive, dev.version), \ - DEFINE_PROP_UINT64("wwn", IDEDrive, dev.wwn, 0), \ - DEFINE_PROP_STRING("serial", IDEDrive, dev.serial),\ - DEFINE_PROP_STRING("model", IDEDrive, dev.model) - static Property ide_hd_properties[] =3D { DEFINE_IDE_DEV_PROPERTIES(), DEFINE_BLOCK_CHS_PROPERTIES(IDEDrive, dev.conf), @@ -346,32 +326,6 @@ static const TypeInfo ide_cd_info =3D { .class_init =3D ide_cd_class_init, }; =20 -static Property ide_cf_properties[] =3D { - DEFINE_IDE_DEV_PROPERTIES(), - DEFINE_BLOCK_CHS_PROPERTIES(IDEDrive, dev.conf), - DEFINE_PROP_BIOS_CHS_TRANS("bios-chs-trans", - IDEDrive, dev.chs_trans, BIOS_ATA_TRANSLATION_AUTO), - DEFINE_PROP_END_OF_LIST(), -}; - -static void ide_cf_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - IDEDeviceClass *k =3D IDE_DEVICE_CLASS(klass); - - k->realize =3D ide_cf_realize; - dc->fw_name =3D "drive"; - dc->desc =3D "virtual CompactFlash card"; - device_class_set_props(dc, ide_cf_properties); -} - -static const TypeInfo ide_cf_info =3D { - .name =3D "ide-cf", - .parent =3D TYPE_IDE_DEVICE, - .instance_size =3D sizeof(IDEDrive), - .class_init =3D ide_cf_class_init, -}; - static void ide_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k =3D DEVICE_CLASS(klass); @@ -396,7 +350,6 @@ static void ide_register_types(void) type_register_static(&ide_bus_info); type_register_static(&ide_hd_info); type_register_static(&ide_cd_info); - type_register_static(&ide_cf_info); type_register_static(&ide_device_type_info); } =20 diff --git a/hw/ide/Kconfig b/hw/ide/Kconfig index dd85fa3619..b93d6743d5 100644 --- a/hw/ide/Kconfig +++ b/hw/ide/Kconfig @@ -57,3 +57,7 @@ config IDE_SII3112 bool select IDE_PCI select IDE_QDEV + +config IDE_CF + bool + default y if IDE_QDEV diff --git a/hw/ide/meson.build b/hw/ide/meson.build index e050eef942..d2e5b45c9e 100644 --- a/hw/ide/meson.build +++ b/hw/ide/meson.build @@ -1,6 +1,7 @@ system_ss.add(when: 'CONFIG_AHCI', if_true: files('ahci.c')) system_ss.add(when: 'CONFIG_AHCI_ICH9', if_true: files('ich.c')) system_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('ahci-allwinner= .c')) +system_ss.add(when: 'CONFIG_IDE_CF', if_true: files('cf.c')) system_ss.add(when: 'CONFIG_IDE_CMD646', if_true: files('cmd646.c')) system_ss.add(when: 'CONFIG_IDE_CORE', if_true: files('core.c', 'atapi.c')) system_ss.add(when: 'CONFIG_IDE_ISA', if_true: files('isa.c', 'ioport.c')) --=20 2.43.2 From nobody Thu Nov 14 06:51:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1708339781; cv=none; d=zohomail.com; s=zohoarc; b=BdBTwpRIdmY/ci3ZvMJbQiBMjPOl1R3B+Jpj6A+X8Y2d29hfIhESRCCAXv83283ImonVhzCwt9rEMK1FsjT1eRGwA8r3ynKyU0L2KN0qh6D0Oz6aeVBUJvQCEkBozCS/l3A7TrXp6eUK+iMuhgRHuE3p6Ip+ZOpjSQeWzGttahI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708339781; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=frInq5lYNhgswM3qhuQ1Q1cEDEC6RAK86KLi0mpbFYU=; b=hUA/gjOV32ST4XrPpM9PnewfStvzrGDHBLexfAMJW0dY/t5GV+F6WJfv68RxP5AMyVa5y0TWOHhb7IqvDBu4jhPn7bry2WpKGtUDULAGCNMk9KBWGCm4ZkHROqVNh1zk9aW3c40CS2rHdHVfO5K4t5dvK/PscKIkORvieRH7u+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708339781603630.8495231497858; Mon, 19 Feb 2024 02:49:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc1DG-0003tP-Kb; Mon, 19 Feb 2024 05:49:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DC-0003sz-Nf for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DA-00017H-Gw for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:26 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-257-JWktU7JGOpyDQXZDTc1XRQ-1; Mon, 19 Feb 2024 05:49:20 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C20C81C41A0A; Mon, 19 Feb 2024 10:49:19 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47B321C10C19; Mon, 19 Feb 2024 10:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708339763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=frInq5lYNhgswM3qhuQ1Q1cEDEC6RAK86KLi0mpbFYU=; b=GD+9WHAH++Rp4oH7xj87EFHmUX5WqmkFvCJnC96M7dmuhnZvP42TWrXF55tMuKNEYAGKrL QKoVH5SE9uun+uipzTMuLSOjOVwfXix2tQcQxX6hxIJ2XGWJavBvZDs/1VUJEgFVrnQw5W DHA/OtXQ3uS3la7ahK0JSkvoNjfVOT8= X-MC-Unique: JWktU7JGOpyDQXZDTc1XRQ-1 From: Thomas Huth To: John Snow , qemu-devel@nongnu.org Cc: BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Subject: [PATCH 2/7] hw/ide: Split qdev.c into ide-bus.c and ide-dev.c Date: Mon, 19 Feb 2024 11:49:07 +0100 Message-ID: <20240219104912.378211-3-thuth@redhat.com> In-Reply-To: <20240219104912.378211-1-thuth@redhat.com> References: <20240219104912.378211-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.077, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1708339782530100001 Content-Type: text/plain; charset="utf-8" qdev.c is a mixture between IDE bus specific functions and IDE device functions. Let's split it up to make it more obvious which part is related to bus handling and which part is related to device handling. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/ide/ide-bus.c | 111 +++++++++++++++++++++++++++++++++++ hw/ide/{qdev.c =3D> ide-dev.c} | 87 +-------------------------- hw/arm/Kconfig | 2 + hw/ide/Kconfig | 30 ++++++---- hw/ide/meson.build | 3 +- 5 files changed, 134 insertions(+), 99 deletions(-) create mode 100644 hw/ide/ide-bus.c rename hw/ide/{qdev.c =3D> ide-dev.c} (78%) diff --git a/hw/ide/ide-bus.c b/hw/ide/ide-bus.c new file mode 100644 index 0000000000..57fe67b29c --- /dev/null +++ b/hw/ide/ide-bus.c @@ -0,0 +1,111 @@ +/* + * ide bus support for qdev. + * + * Copyright (c) 2009 Gerd Hoffmann + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "qemu/module.h" +#include "hw/ide/internal.h" +#include "sysemu/block-backend.h" +#include "sysemu/blockdev.h" +#include "sysemu/runstate.h" + +static char *idebus_get_fw_dev_path(DeviceState *dev); +static void idebus_unrealize(BusState *qdev); + +static void ide_bus_class_init(ObjectClass *klass, void *data) +{ + BusClass *k =3D BUS_CLASS(klass); + + k->get_fw_dev_path =3D idebus_get_fw_dev_path; + k->unrealize =3D idebus_unrealize; +} + +static void idebus_unrealize(BusState *bus) +{ + IDEBus *ibus =3D IDE_BUS(bus); + + if (ibus->vmstate) { + qemu_del_vm_change_state_handler(ibus->vmstate); + } +} + +static const TypeInfo ide_bus_info =3D { + .name =3D TYPE_IDE_BUS, + .parent =3D TYPE_BUS, + .instance_size =3D sizeof(IDEBus), + .class_init =3D ide_bus_class_init, +}; + +void ide_bus_init(IDEBus *idebus, size_t idebus_size, DeviceState *dev, + int bus_id, int max_units) +{ + qbus_init(idebus, idebus_size, TYPE_IDE_BUS, dev, NULL); + idebus->bus_id =3D bus_id; + idebus->max_units =3D max_units; +} + +static char *idebus_get_fw_dev_path(DeviceState *dev) +{ + char path[30]; + + snprintf(path, sizeof(path), "%s@%x", qdev_fw_name(dev), + ((IDEBus *)dev->parent_bus)->bus_id); + + return g_strdup(path); +} + +IDEDevice *ide_bus_create_drive(IDEBus *bus, int unit, DriveInfo *drive) +{ + DeviceState *dev; + + dev =3D qdev_new(drive->media_cd ? "ide-cd" : "ide-hd"); + qdev_prop_set_uint32(dev, "unit", unit); + qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(drive), + &error_fatal); + qdev_realize_and_unref(dev, &bus->qbus, &error_fatal); + return DO_UPCAST(IDEDevice, qdev, dev); +} + +int ide_get_geometry(BusState *bus, int unit, + int16_t *cyls, int8_t *heads, int8_t *secs) +{ + IDEState *s =3D &DO_UPCAST(IDEBus, qbus, bus)->ifs[unit]; + + if (s->drive_kind !=3D IDE_HD || !s->blk) { + return -1; + } + + *cyls =3D s->cylinders; + *heads =3D s->heads; + *secs =3D s->sectors; + return 0; +} + +int ide_get_bios_chs_trans(BusState *bus, int unit) +{ + return DO_UPCAST(IDEBus, qbus, bus)->ifs[unit].chs_trans; +} + +static void ide_bus_register_type(void) +{ + type_register_static(&ide_bus_info); +} + +type_init(ide_bus_register_type) diff --git a/hw/ide/qdev.c b/hw/ide/ide-dev.c similarity index 78% rename from hw/ide/qdev.c rename to hw/ide/ide-dev.c index 4189313d30..15d088fd06 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/ide-dev.c @@ -1,5 +1,5 @@ /* - * ide bus support for qdev. + * IDE device functions * * Copyright (c) 2009 Gerd Hoffmann * @@ -18,71 +18,21 @@ */ =20 #include "qemu/osdep.h" -#include "sysemu/dma.h" #include "qapi/error.h" #include "qapi/qapi-types-block.h" #include "qemu/error-report.h" -#include "qemu/main-loop.h" #include "qemu/module.h" #include "hw/ide/ide-dev.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "sysemu/sysemu.h" -#include "sysemu/runstate.h" #include "qapi/visitor.h" =20 -/* --------------------------------- */ - -static char *idebus_get_fw_dev_path(DeviceState *dev); -static void idebus_unrealize(BusState *qdev); - static Property ide_props[] =3D { DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1), DEFINE_PROP_END_OF_LIST(), }; =20 -static void ide_bus_class_init(ObjectClass *klass, void *data) -{ - BusClass *k =3D BUS_CLASS(klass); - - k->get_fw_dev_path =3D idebus_get_fw_dev_path; - k->unrealize =3D idebus_unrealize; -} - -static void idebus_unrealize(BusState *bus) -{ - IDEBus *ibus =3D IDE_BUS(bus); - - if (ibus->vmstate) { - qemu_del_vm_change_state_handler(ibus->vmstate); - } -} - -static const TypeInfo ide_bus_info =3D { - .name =3D TYPE_IDE_BUS, - .parent =3D TYPE_BUS, - .instance_size =3D sizeof(IDEBus), - .class_init =3D ide_bus_class_init, -}; - -void ide_bus_init(IDEBus *idebus, size_t idebus_size, DeviceState *dev, - int bus_id, int max_units) -{ - qbus_init(idebus, idebus_size, TYPE_IDE_BUS, dev, NULL); - idebus->bus_id =3D bus_id; - idebus->max_units =3D max_units; -} - -static char *idebus_get_fw_dev_path(DeviceState *dev) -{ - char path[30]; - - snprintf(path, sizeof(path), "%s@%x", qdev_fw_name(dev), - ((IDEBus*)dev->parent_bus)->bus_id); - - return g_strdup(path); -} - static void ide_qdev_realize(DeviceState *qdev, Error **errp) { IDEDevice *dev =3D IDE_DEVICE(qdev); @@ -121,40 +71,6 @@ static void ide_qdev_realize(DeviceState *qdev, Error *= *errp) dc->realize(dev, errp); } =20 -IDEDevice *ide_bus_create_drive(IDEBus *bus, int unit, DriveInfo *drive) -{ - DeviceState *dev; - - dev =3D qdev_new(drive->media_cd ? "ide-cd" : "ide-hd"); - qdev_prop_set_uint32(dev, "unit", unit); - qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(drive), - &error_fatal); - qdev_realize_and_unref(dev, &bus->qbus, &error_fatal); - return DO_UPCAST(IDEDevice, qdev, dev); -} - -int ide_get_geometry(BusState *bus, int unit, - int16_t *cyls, int8_t *heads, int8_t *secs) -{ - IDEState *s =3D &DO_UPCAST(IDEBus, qbus, bus)->ifs[unit]; - - if (s->drive_kind !=3D IDE_HD || !s->blk) { - return -1; - } - - *cyls =3D s->cylinders; - *heads =3D s->heads; - *secs =3D s->sectors; - return 0; -} - -int ide_get_bios_chs_trans(BusState *bus, int unit) -{ - return DO_UPCAST(IDEBus, qbus, bus)->ifs[unit].chs_trans; -} - -/* --------------------------------- */ - void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp) { IDEBus *bus =3D DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus); @@ -347,7 +263,6 @@ static const TypeInfo ide_device_type_info =3D { =20 static void ide_register_types(void) { - type_register_static(&ide_bus_info); type_register_static(&ide_hd_info); type_register_static(&ide_cd_info); type_register_static(&ide_device_type_info); diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 29abe1da29..b372b819a4 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -275,6 +275,8 @@ config SBSA_REF select USB_XHCI_SYSBUS select WDT_SBSA select BOCHS_DISPLAY + select IDE_BUS + select IDE_DEV =20 config SABRELITE bool diff --git a/hw/ide/Kconfig b/hw/ide/Kconfig index b93d6743d5..6dfc5a2129 100644 --- a/hw/ide/Kconfig +++ b/hw/ide/Kconfig @@ -1,51 +1,58 @@ config IDE_CORE bool =20 -config IDE_QDEV +config IDE_BUS bool select IDE_CORE =20 +config IDE_DEV + bool + depends on IDE_BUS + config IDE_PCI bool depends on PCI - select IDE_QDEV + select IDE_BUS + select IDE_DEV =20 config IDE_ISA bool depends on ISA_BUS - select IDE_QDEV + select IDE_BUS + select IDE_DEV =20 config IDE_PIIX bool select IDE_PCI - select IDE_QDEV =20 config IDE_CMD646 bool select IDE_PCI - select IDE_QDEV =20 config IDE_MACIO bool - select IDE_QDEV + select IDE_BUS + select IDE_DEV =20 config IDE_MMIO bool - select IDE_QDEV + select IDE_BUS + select IDE_DEV =20 config IDE_VIA bool select IDE_PCI - select IDE_QDEV =20 config MICRODRIVE bool - select IDE_QDEV + select IDE_BUS + select IDE_DEV depends on PCMCIA =20 config AHCI bool - select IDE_QDEV + select IDE_BUS + select IDE_DEV =20 config AHCI_ICH9 bool @@ -56,8 +63,7 @@ config AHCI_ICH9 config IDE_SII3112 bool select IDE_PCI - select IDE_QDEV =20 config IDE_CF bool - default y if IDE_QDEV + default y if IDE_BUS diff --git a/hw/ide/meson.build b/hw/ide/meson.build index d2e5b45c9e..d09705cac0 100644 --- a/hw/ide/meson.build +++ b/hw/ide/meson.build @@ -1,15 +1,16 @@ system_ss.add(when: 'CONFIG_AHCI', if_true: files('ahci.c')) system_ss.add(when: 'CONFIG_AHCI_ICH9', if_true: files('ich.c')) system_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('ahci-allwinner= .c')) +system_ss.add(when: 'CONFIG_IDE_BUS', if_true: files('ide-bus.c')) system_ss.add(when: 'CONFIG_IDE_CF', if_true: files('cf.c')) system_ss.add(when: 'CONFIG_IDE_CMD646', if_true: files('cmd646.c')) system_ss.add(when: 'CONFIG_IDE_CORE', if_true: files('core.c', 'atapi.c')) +system_ss.add(when: 'CONFIG_IDE_DEV', if_true: files('ide-dev.c')) system_ss.add(when: 'CONFIG_IDE_ISA', if_true: files('isa.c', 'ioport.c')) system_ss.add(when: 'CONFIG_IDE_MACIO', if_true: files('macio.c')) system_ss.add(when: 'CONFIG_IDE_MMIO', if_true: files('mmio.c')) system_ss.add(when: 'CONFIG_IDE_PCI', if_true: files('pci.c')) system_ss.add(when: 'CONFIG_IDE_PIIX', if_true: files('piix.c', 'ioport.c'= )) -system_ss.add(when: 'CONFIG_IDE_QDEV', if_true: files('qdev.c')) system_ss.add(when: 'CONFIG_IDE_SII3112', if_true: files('sii3112.c')) system_ss.add(when: 'CONFIG_IDE_VIA', if_true: files('via.c')) system_ss.add(when: 'CONFIG_MICRODRIVE', if_true: files('microdrive.c')) --=20 2.43.2 From nobody Thu Nov 14 06:51:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1708339808; cv=none; d=zohomail.com; s=zohoarc; b=bbXAnOXYtsA+hIAI7buW3RBCxnOWiO7hAJwayr1/+6wzbDgM3jzpM1ZbejVPL6UKsP1bRADbupViujm9VEnjCjHX52WY4HeCjM6/QBYtRi4ZMDLkvbf73HVps7LpLq9UHQKbpYsKWGfwpzh7GqUFFJZrvCkYdKvxvNWcRX/vIPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708339808; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qzo4v6fCKfQ/jWydL37MxupLQN9udl7GMivX/kfG0Nw=; b=BucIVdTVS/KbA9KKYRxLCQEqKrgsyYsMlFw6Uow/U5v89NANkol1XhSuMzKkmCD0S5EOKmuUedR8Nvj6eaGMOSnC9BG09/neI6cnAFs3Sw/xnXFNStGzndKErn+dqxxhYoZF+rVfddRQENNPOkH8vVai4jeuDC9cWu2gVD1y6/Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17083398088301015.2985242759186; Mon, 19 Feb 2024 02:50:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc1DU-00041n-Sr; Mon, 19 Feb 2024 05:49:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DE-0003tG-1Q for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DC-00017e-62 for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:27 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-392-pJ3Z13mHO4Ssv-hXNTSp7w-1; Mon, 19 Feb 2024 05:49:21 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 64BF4848D60; Mon, 19 Feb 2024 10:49:21 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 115DE1C060BC; Mon, 19 Feb 2024 10:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708339765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qzo4v6fCKfQ/jWydL37MxupLQN9udl7GMivX/kfG0Nw=; b=QIwJQjkTDm3Wxrxgs8Bjel8JMdXdIvNcC9XCDbbnHnJTpgrji5v9hKCklJu6+dNiMGIB2P aWEMOjn4Q8qvpNKBn0cv429t7FepNfSNoCZv7hRt1pNlyVtaXOPz7epFxCQsTKmg7Zk36y GDfII6mLRDPYgz0+AImmU0FFxMHCN1U= X-MC-Unique: pJ3Z13mHO4Ssv-hXNTSp7w-1 From: Thomas Huth To: John Snow , qemu-devel@nongnu.org Cc: BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Subject: [PATCH 3/7] hw/ide: Move IDE device related definitions to ide-dev.h Date: Mon, 19 Feb 2024 11:49:08 +0100 Message-ID: <20240219104912.378211-4-thuth@redhat.com> In-Reply-To: <20240219104912.378211-1-thuth@redhat.com> References: <20240219104912.378211-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.077, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1708339810411100007 Content-Type: text/plain; charset="utf-8" Let's start to unentangle internal.h by moving public IDE device related definitions to ide-dev.h. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide/ide-dev.h | 145 +++++++++++++++++++++++++++++++++++++- include/hw/ide/internal.h | 145 +------------------------------------- hw/ide/ide-dev.c | 1 + 3 files changed, 146 insertions(+), 145 deletions(-) diff --git a/include/hw/ide/ide-dev.h b/include/hw/ide/ide-dev.h index 7e9663cda9..de88784a25 100644 --- a/include/hw/ide/ide-dev.h +++ b/include/hw/ide/ide-dev.h @@ -20,9 +20,152 @@ #ifndef IDE_DEV_H #define IDE_DEV_H =20 +#include "sysemu/dma.h" #include "hw/qdev-properties.h" #include "hw/block/block.h" -#include "hw/ide/internal.h" + +typedef struct IDEDevice IDEDevice; +typedef struct IDEState IDEState; +typedef struct IDEDMA IDEDMA; +typedef struct IDEDMAOps IDEDMAOps; +typedef struct IDEBus IDEBus; + +typedef void EndTransferFunc(IDEState *); + +#define MAX_IDE_DEVS 2 + +#define TYPE_IDE_DEVICE "ide-device" +OBJECT_DECLARE_TYPE(IDEDevice, IDEDeviceClass, IDE_DEVICE) + +typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind; + +struct unreported_events { + bool eject_request; + bool new_media; +}; + +enum ide_dma_cmd { + IDE_DMA_READ =3D 0, + IDE_DMA_WRITE, + IDE_DMA_TRIM, + IDE_DMA_ATAPI, + IDE_DMA__COUNT +}; + +/* NOTE: IDEState represents in fact one drive */ +struct IDEState { + IDEBus *bus; + uint8_t unit; + /* ide config */ + IDEDriveKind drive_kind; + int drive_heads, drive_sectors; + int cylinders, heads, sectors, chs_trans; + int64_t nb_sectors; + int mult_sectors; + int identify_set; + uint8_t identify_data[512]; + int drive_serial; + char drive_serial_str[21]; + char drive_model_str[41]; + uint64_t wwn; + /* ide regs */ + uint8_t feature; + uint8_t error; + uint32_t nsector; + uint8_t sector; + uint8_t lcyl; + uint8_t hcyl; + /* other part of tf for lba48 support */ + uint8_t hob_feature; + uint8_t hob_nsector; + uint8_t hob_sector; + uint8_t hob_lcyl; + uint8_t hob_hcyl; + + uint8_t select; + uint8_t status; + + bool io8; + bool reset_reverts; + + /* set for lba48 access */ + uint8_t lba48; + BlockBackend *blk; + char version[9]; + /* ATAPI specific */ + struct unreported_events events; + uint8_t sense_key; + uint8_t asc; + bool tray_open; + bool tray_locked; + uint8_t cdrom_changed; + int packet_transfer_size; + int elementary_transfer_size; + int32_t io_buffer_index; + int lba; + int cd_sector_size; + int atapi_dma; /* true if dma is requested for the packet cmd */ + BlockAcctCookie acct; + BlockAIOCB *pio_aiocb; + QEMUIOVector qiov; + QLIST_HEAD(, IDEBufferedRequest) buffered_requests; + /* ATA DMA state */ + uint64_t io_buffer_offset; + int32_t io_buffer_size; + QEMUSGList sg; + /* PIO transfer handling */ + int req_nb_sectors; /* number of sectors per interrupt */ + EndTransferFunc *end_transfer_func; + uint8_t *data_ptr; + uint8_t *data_end; + uint8_t *io_buffer; + /* PIO save/restore */ + int32_t io_buffer_total_len; + int32_t cur_io_buffer_offset; + int32_t cur_io_buffer_len; + uint8_t end_transfer_fn_idx; + QEMUTimer *sector_write_timer; /* only used for win2k install hack */ + uint32_t irq_count; /* counts IRQs when using win2k install hack */ + /* CF-ATA extended error */ + uint8_t ext_error; + /* CF-ATA metadata storage */ + uint32_t mdata_size; + uint8_t *mdata_storage; + int media_changed; + enum ide_dma_cmd dma_cmd; + /* SMART */ + uint8_t smart_enabled; + uint8_t smart_autosave; + int smart_errors; + uint8_t smart_selftest_count; + uint8_t *smart_selftest_data; + /* AHCI */ + int ncq_queues; +}; + +struct IDEDeviceClass { + DeviceClass parent_class; + void (*realize)(IDEDevice *dev, Error **errp); +}; + +struct IDEDevice { + DeviceState qdev; + uint32_t unit; + BlockConf conf; + int chs_trans; + char *version; + char *serial; + char *model; + uint64_t wwn; + /* + * 0x0000 - rotation rate not reported + * 0x0001 - non-rotating medium (SSD) + * 0x0002-0x0400 - reserved + * 0x0401-0xffe - rotations per minute + * 0xffff - reserved + */ + uint16_t rotation_rate; +}; =20 typedef struct IDEDrive { IDEDevice dev; diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 3bdcc75597..5cc109fe82 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -8,24 +8,16 @@ */ =20 #include "hw/ide.h" -#include "sysemu/dma.h" -#include "hw/block/block.h" #include "exec/ioport.h" +#include "hw/ide/ide-dev.h" =20 /* debug IDE devices */ #define USE_DMA_CDROM #include "qom/object.h" =20 -typedef struct IDEDevice IDEDevice; -typedef struct IDEState IDEState; -typedef struct IDEDMA IDEDMA; -typedef struct IDEDMAOps IDEDMAOps; - #define TYPE_IDE_BUS "IDE" OBJECT_DECLARE_SIMPLE_TYPE(IDEBus, IDE_BUS) =20 -#define MAX_IDE_DEVS 2 - /* Device/Head ("select") Register */ #define ATA_DEV_SELECT 0x10 /* ATA1,3: Defined as '1'. @@ -328,10 +320,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(IDEBus, IDE_BUS) #define SMART_DISABLE 0xd9 #define SMART_STATUS 0xda =20 -typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind; - -typedef void EndTransferFunc(IDEState *); - typedef void DMAStartFunc(const IDEDMA *, IDEState *, BlockCompletionFunc = *); typedef void DMAVoidFunc(const IDEDMA *); typedef int DMAIntFunc(const IDEDMA *, bool); @@ -339,19 +327,6 @@ typedef int32_t DMAInt32Func(const IDEDMA *, int32_t l= en); typedef void DMAu32Func(const IDEDMA *, uint32_t); typedef void DMAStopFunc(const IDEDMA *, bool); =20 -struct unreported_events { - bool eject_request; - bool new_media; -}; - -enum ide_dma_cmd { - IDE_DMA_READ =3D 0, - IDE_DMA_WRITE, - IDE_DMA_TRIM, - IDE_DMA_ATAPI, - IDE_DMA__COUNT -}; - extern const char *IDE_DMA_CMD_lookup[IDE_DMA__COUNT]; =20 extern const MemoryRegionPortio ide_portio_list[]; @@ -369,97 +344,6 @@ typedef struct IDEBufferedRequest { bool orphaned; } IDEBufferedRequest; =20 -/* NOTE: IDEState represents in fact one drive */ -struct IDEState { - IDEBus *bus; - uint8_t unit; - /* ide config */ - IDEDriveKind drive_kind; - int drive_heads, drive_sectors; - int cylinders, heads, sectors, chs_trans; - int64_t nb_sectors; - int mult_sectors; - int identify_set; - uint8_t identify_data[512]; - int drive_serial; - char drive_serial_str[21]; - char drive_model_str[41]; - uint64_t wwn; - /* ide regs */ - uint8_t feature; - uint8_t error; - uint32_t nsector; - uint8_t sector; - uint8_t lcyl; - uint8_t hcyl; - /* other part of tf for lba48 support */ - uint8_t hob_feature; - uint8_t hob_nsector; - uint8_t hob_sector; - uint8_t hob_lcyl; - uint8_t hob_hcyl; - - uint8_t select; - uint8_t status; - - bool io8; - bool reset_reverts; - - /* set for lba48 access */ - uint8_t lba48; - BlockBackend *blk; - char version[9]; - /* ATAPI specific */ - struct unreported_events events; - uint8_t sense_key; - uint8_t asc; - bool tray_open; - bool tray_locked; - uint8_t cdrom_changed; - int packet_transfer_size; - int elementary_transfer_size; - int32_t io_buffer_index; - int lba; - int cd_sector_size; - int atapi_dma; /* true if dma is requested for the packet cmd */ - BlockAcctCookie acct; - BlockAIOCB *pio_aiocb; - QEMUIOVector qiov; - QLIST_HEAD(, IDEBufferedRequest) buffered_requests; - /* ATA DMA state */ - uint64_t io_buffer_offset; - int32_t io_buffer_size; - QEMUSGList sg; - /* PIO transfer handling */ - int req_nb_sectors; /* number of sectors per interrupt */ - EndTransferFunc *end_transfer_func; - uint8_t *data_ptr; - uint8_t *data_end; - uint8_t *io_buffer; - /* PIO save/restore */ - int32_t io_buffer_total_len; - int32_t cur_io_buffer_offset; - int32_t cur_io_buffer_len; - uint8_t end_transfer_fn_idx; - QEMUTimer *sector_write_timer; /* only used for win2k install hack */ - uint32_t irq_count; /* counts IRQs when using win2k install hack */ - /* CF-ATA extended error */ - uint8_t ext_error; - /* CF-ATA metadata storage */ - uint32_t mdata_size; - uint8_t *mdata_storage; - int media_changed; - enum ide_dma_cmd dma_cmd; - /* SMART */ - uint8_t smart_enabled; - uint8_t smart_autosave; - int smart_errors; - uint8_t smart_selftest_count; - uint8_t *smart_selftest_data; - /* AHCI */ - int ncq_queues; -}; - struct IDEDMAOps { DMAStartFunc *start_dma; DMAVoidFunc *pio_transfer; @@ -502,33 +386,6 @@ struct IDEBus { VMChangeStateEntry *vmstate; }; =20 -#define TYPE_IDE_DEVICE "ide-device" -OBJECT_DECLARE_TYPE(IDEDevice, IDEDeviceClass, IDE_DEVICE) - -struct IDEDeviceClass { - DeviceClass parent_class; - void (*realize)(IDEDevice *dev, Error **errp); -}; - -struct IDEDevice { - DeviceState qdev; - uint32_t unit; - BlockConf conf; - int chs_trans; - char *version; - char *serial; - char *model; - uint64_t wwn; - /* - * 0x0000 - rotation rate not reported - * 0x0001 - non-rotating medium (SSD) - * 0x0002-0x0400 - reserved - * 0x0401-0xffe - rotations per minute - * 0xffff - reserved - */ - uint16_t rotation_rate; -}; - /* These are used for the error_status field of IDEBus */ #define IDE_RETRY_MASK 0xf8 #define IDE_RETRY_DMA 0x08 diff --git a/hw/ide/ide-dev.c b/hw/ide/ide-dev.c index 15d088fd06..c8e2033469 100644 --- a/hw/ide/ide-dev.c +++ b/hw/ide/ide-dev.c @@ -23,6 +23,7 @@ #include "qemu/error-report.h" #include "qemu/module.h" #include "hw/ide/ide-dev.h" +#include "hw/ide/internal.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "sysemu/sysemu.h" --=20 2.43.2 From nobody Thu Nov 14 06:51:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1708339861; cv=none; d=zohomail.com; s=zohoarc; b=EpRdmZjHMO1AxyKmM/pLLjU49ARZoVCpFhWNBBrPDSivcpCRS6dT3Ji5IcbXk2ICSI8p8sr90GLWBduL1q32btd4bGA5xQbsGjUYIfFfWxWvmEPkbz8c/5fA3ImjtU6znCWnzZ8fmXgmygWvy1xJldxZWKoDiUmwF04KvBKR9U0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708339861; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=46MJKVG4lFfi48pM2XpmZOL9TnrnKkQoRvC4jQU7qcw=; b=ZS3Q3Y4yEli4qOtDohgzK2h3W30/Gnn6vFWY0lKxrOBmzW1eHco1EmetqiXQHtuagv777T9C6TDr/yIqay9LnuiZx63D8/QoLQlH2WRDbE/5Izc8kc4W+WdGLflY/btflKVO/lEEKDM91m8KjoAI2uCducj9rU23o3MNxLCgSDo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708339861575137.22559153038048; Mon, 19 Feb 2024 02:51:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc1DX-00043H-Jw; Mon, 19 Feb 2024 05:49:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DG-0003td-IC for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DC-00017c-0w for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:30 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-4p7HGZLJNm6gWd1ERnJxyw-1; Mon, 19 Feb 2024 05:49:23 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 173D81C41A03; Mon, 19 Feb 2024 10:49:23 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id A522D1C060BC; Mon, 19 Feb 2024 10:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708339765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=46MJKVG4lFfi48pM2XpmZOL9TnrnKkQoRvC4jQU7qcw=; b=Eyd1sKmjKGDZASEG1RhN83fjerbAPl8sK1TfdOI57sz5qXfx7Frc3ewzSOx6JvsVOP6Oi8 BG1xGTXj4HOHLMAxT+IIJ35YGND7AB/EhuYIGJ6FR2h62escsLtOv+v/M9kjTHZPla6jp9 JFlYbIT6PwqDwh17cMFpn/nQN4tMafA= X-MC-Unique: 4p7HGZLJNm6gWd1ERnJxyw-1 From: Thomas Huth To: John Snow , qemu-devel@nongnu.org Cc: BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Subject: [PATCH 4/7] hw/ide: Move IDE bus related definitions to a new header ide-bus.h Date: Mon, 19 Feb 2024 11:49:09 +0100 Message-ID: <20240219104912.378211-5-thuth@redhat.com> In-Reply-To: <20240219104912.378211-1-thuth@redhat.com> References: <20240219104912.378211-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.077, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1708339862580100001 Content-Type: text/plain; charset="utf-8" Let's consolidate the public IDE bus related functions in a separate header. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide/ide-bus.h | 41 +++++++++++++++++++++++++++++++++++++++ include/hw/ide/internal.h | 38 +----------------------------------- 2 files changed, 42 insertions(+), 37 deletions(-) create mode 100644 include/hw/ide/ide-bus.h diff --git a/include/hw/ide/ide-bus.h b/include/hw/ide/ide-bus.h new file mode 100644 index 0000000000..e0460700ed --- /dev/null +++ b/include/hw/ide/ide-bus.h @@ -0,0 +1,41 @@ +#ifndef HW_IDE_BUS_H +#define HW_IDE_BUS_H + +#include "exec/ioport.h" +#include "hw/ide/ide-dev.h" + +struct IDEBus { + BusState qbus; + IDEDevice *master; + IDEDevice *slave; + IDEState ifs[2]; + QEMUBH *bh; + + int bus_id; + int max_units; + IDEDMA *dma; + uint8_t unit; + uint8_t cmd; + qemu_irq irq; /* bus output */ + + int error_status; + uint8_t retry_unit; + int64_t retry_sector_num; + uint32_t retry_nsector; + PortioList portio_list; + PortioList portio2_list; + VMChangeStateEntry *vmstate; +}; + +#define TYPE_IDE_BUS "IDE" +OBJECT_DECLARE_SIMPLE_TYPE(IDEBus, IDE_BUS) + +void ide_bus_init(IDEBus *idebus, size_t idebus_size, DeviceState *dev, + int bus_id, int max_units); +IDEDevice *ide_bus_create_drive(IDEBus *bus, int unit, DriveInfo *drive); + +int ide_get_geometry(BusState *bus, int unit, + int16_t *cyls, int8_t *heads, int8_t *secs); +int ide_get_bios_chs_trans(BusState *bus, int unit); + +#endif diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 5cc109fe82..642bd1a979 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -8,16 +8,12 @@ */ =20 #include "hw/ide.h" -#include "exec/ioport.h" -#include "hw/ide/ide-dev.h" +#include "hw/ide/ide-bus.h" =20 /* debug IDE devices */ #define USE_DMA_CDROM #include "qom/object.h" =20 -#define TYPE_IDE_BUS "IDE" -OBJECT_DECLARE_SIMPLE_TYPE(IDEBus, IDE_BUS) - /* Device/Head ("select") Register */ #define ATA_DEV_SELECT 0x10 /* ATA1,3: Defined as '1'. @@ -363,29 +359,6 @@ struct IDEDMA { BlockAIOCB *aiocb; }; =20 -struct IDEBus { - BusState qbus; - IDEDevice *master; - IDEDevice *slave; - IDEState ifs[2]; - QEMUBH *bh; - - int bus_id; - int max_units; - IDEDMA *dma; - uint8_t unit; - uint8_t cmd; - qemu_irq irq; /* bus output */ - - int error_status; - uint8_t retry_unit; - int64_t retry_sector_num; - uint32_t retry_nsector; - PortioList portio_list; - PortioList portio2_list; - VMChangeStateEntry *vmstate; -}; - /* These are used for the error_status field of IDEBus */ #define IDE_RETRY_MASK 0xf8 #define IDE_RETRY_DMA 0x08 @@ -502,15 +475,6 @@ void ide_cancel_dma_sync(IDEState *s); void ide_atapi_cmd(IDEState *s); void ide_atapi_cmd_reply_end(IDEState *s); =20 -/* hw/ide/qdev.c */ -void ide_bus_init(IDEBus *idebus, size_t idebus_size, DeviceState *dev, - int bus_id, int max_units); -IDEDevice *ide_bus_create_drive(IDEBus *bus, int unit, DriveInfo *drive); - -int ide_get_geometry(BusState *bus, int unit, - int16_t *cyls, int8_t *heads, int8_t *secs); -int ide_get_bios_chs_trans(BusState *bus, int unit); - int ide_handle_rw_error(IDEState *s, int error, int op); =20 #endif /* HW_IDE_INTERNAL_H */ --=20 2.43.2 From nobody Thu Nov 14 06:51:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1708339808; cv=none; d=zohomail.com; s=zohoarc; b=B7vIkWkAtFMJ8z00oWgvqqhk1YT/AQTaFlMB8mGQKlP8xERidZhxS/wYnLU+ndu/TYL/Cmm3k8TBQvgMDahzm/W39C7r0g/tnhOslvCCgsTjT2Bk1YQRTfY19i6oloZ5Q+qiyDhfpZH+aUt4uBtijTSyDhgCNpQXC0wMM/riPp8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708339808; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=b4hgN8u5AfvKHOm7gKyk98vXq08LrzvUSx2gRkPZ6vE=; b=RBKjKV16hbDgxvlIyO34bfAyhGyAK85So0HCYTdB2WNksC6V4Y4SsNcyZEHhDEW+w+yWsWHyjuwk+SugvSWpMUmi/FQkh8TtWHSeBP8qiF8140cE5dkaZWVotSLVXIIU1yvDt14INSx/AiIUqyyCSwdCEGVEm310l8LBaqIGFLM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708339808191870.1334690914576; Mon, 19 Feb 2024 02:50:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc1DU-00042B-Ue; Mon, 19 Feb 2024 05:49:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DG-0003uA-Pw for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DF-00018M-77 for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:30 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-502-kklzypBpOAiWfL-4mTUKgA-1; Mon, 19 Feb 2024 05:49:25 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1630885A588; Mon, 19 Feb 2024 10:49:25 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64F371C060B3; Mon, 19 Feb 2024 10:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708339768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b4hgN8u5AfvKHOm7gKyk98vXq08LrzvUSx2gRkPZ6vE=; b=Lau1fhzzSPLRUXiljN6RkD9TLmMvsdBkzS29ypFE9zTdLDlk9T3bwnKSQ8ize4YhN0ZQjt A1p3RmYRrcGZLz0f6LXUQ06RHqwnIBlnr8+omvgnI5ugLRpUV5Rirf5bSludPthPrYsb5u Mp4zp5oTWDlzMDKMh+sToK1y6+OttpY= X-MC-Unique: kklzypBpOAiWfL-4mTUKgA-1 From: Thomas Huth To: John Snow , qemu-devel@nongnu.org Cc: BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Subject: [PATCH 5/7] hw/ide: Move IDE DMA related definitions to a separate header ide-dma.h Date: Mon, 19 Feb 2024 11:49:10 +0100 Message-ID: <20240219104912.378211-6-thuth@redhat.com> In-Reply-To: <20240219104912.378211-1-thuth@redhat.com> References: <20240219104912.378211-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.077, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1708339810366100005 Content-Type: text/plain; charset="utf-8" These definitions are required outside of the hw/ide/ code, too, so lets's move them from internal.h to a new header called ide-dma.h. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide/ide-dma.h | 30 ++++++++++++++++++++++++++++++ include/hw/ide/internal.h | 27 +-------------------------- 2 files changed, 31 insertions(+), 26 deletions(-) create mode 100644 include/hw/ide/ide-dma.h diff --git a/include/hw/ide/ide-dma.h b/include/hw/ide/ide-dma.h new file mode 100644 index 0000000000..fb82966bdd --- /dev/null +++ b/include/hw/ide/ide-dma.h @@ -0,0 +1,30 @@ +#ifndef HW_IDE_DMA_H +#define HW_IDE_DMA_H + +typedef void DMAStartFunc(const IDEDMA *, IDEState *, BlockCompletionFunc = *); +typedef void DMAVoidFunc(const IDEDMA *); +typedef int DMAIntFunc(const IDEDMA *, bool); +typedef int32_t DMAInt32Func(const IDEDMA *, int32_t len); +typedef void DMAu32Func(const IDEDMA *, uint32_t); +typedef void DMAStopFunc(const IDEDMA *, bool); + +struct IDEDMAOps { + DMAStartFunc *start_dma; + DMAVoidFunc *pio_transfer; + DMAInt32Func *prepare_buf; + DMAu32Func *commit_buf; + DMAIntFunc *rw_buf; + DMAVoidFunc *restart; + DMAVoidFunc *restart_dma; + DMAStopFunc *set_inactive; + DMAVoidFunc *cmd_done; + DMAVoidFunc *reset; +}; + +struct IDEDMA { + const struct IDEDMAOps *ops; + QEMUIOVector qiov; + BlockAIOCB *aiocb; +}; + +#endif diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 642bd1a979..d1d3fcd23a 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -9,6 +9,7 @@ =20 #include "hw/ide.h" #include "hw/ide/ide-bus.h" +#include "hw/ide/ide-dma.h" =20 /* debug IDE devices */ #define USE_DMA_CDROM @@ -316,13 +317,6 @@ #define SMART_DISABLE 0xd9 #define SMART_STATUS 0xda =20 -typedef void DMAStartFunc(const IDEDMA *, IDEState *, BlockCompletionFunc = *); -typedef void DMAVoidFunc(const IDEDMA *); -typedef int DMAIntFunc(const IDEDMA *, bool); -typedef int32_t DMAInt32Func(const IDEDMA *, int32_t len); -typedef void DMAu32Func(const IDEDMA *, uint32_t); -typedef void DMAStopFunc(const IDEDMA *, bool); - extern const char *IDE_DMA_CMD_lookup[IDE_DMA__COUNT]; =20 extern const MemoryRegionPortio ide_portio_list[]; @@ -340,25 +334,6 @@ typedef struct IDEBufferedRequest { bool orphaned; } IDEBufferedRequest; =20 -struct IDEDMAOps { - DMAStartFunc *start_dma; - DMAVoidFunc *pio_transfer; - DMAInt32Func *prepare_buf; - DMAu32Func *commit_buf; - DMAIntFunc *rw_buf; - DMAVoidFunc *restart; - DMAVoidFunc *restart_dma; - DMAStopFunc *set_inactive; - DMAVoidFunc *cmd_done; - DMAVoidFunc *reset; -}; - -struct IDEDMA { - const struct IDEDMAOps *ops; - QEMUIOVector qiov; - BlockAIOCB *aiocb; -}; - /* These are used for the error_status field of IDEBus */ #define IDE_RETRY_MASK 0xf8 #define IDE_RETRY_DMA 0x08 --=20 2.43.2 From nobody Thu Nov 14 06:51:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1708339864; cv=none; d=zohomail.com; s=zohoarc; b=JhgvUCPIldCGkcnHpYoOgU78hyHxo9GWz3vuxhi31EOrbQaMw0iYQ0jiUEnauqSg1IBzQO9JDiEflHJHh8wqR96Gp6qjsPVw1/c83WgL0sI/bWb7Z4b6bVTcCuVaQjcrc7ZyjONUZxK0RhSdEBGb6qd5yPX4aNKFh8Y1TNWoGwg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708339864; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fWr2OAgZT98LmxsyAvoqnKXhk0XeEInN7pMEmIbCipc=; b=cJHNEEzhr1Fy+3dtrCrqXdl/bK/UtXgbwL4+irD5rivePhKQshXshAXx04YSv3qvnEJjeBZ3nFPEnzJ3qoLeEyD58xeWISFwElXLzPdyLpxukoK7lHiQ5to7IWfUA+3OSp1vYMp6wvWfGwfYtB5bymYlvSKrpgcU4JAnS8IebdM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170833986449788.82621600664993; Mon, 19 Feb 2024 02:51:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc1DZ-00047r-Rp; Mon, 19 Feb 2024 05:49:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DK-0003uP-DT for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DH-00018u-O9 for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:33 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-659-M6wSZLlrPOus2ekn_eAgpg-1; Mon, 19 Feb 2024 05:49:27 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 477FD3C025B0; Mon, 19 Feb 2024 10:49:27 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7196F1C060B3; Mon, 19 Feb 2024 10:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708339771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fWr2OAgZT98LmxsyAvoqnKXhk0XeEInN7pMEmIbCipc=; b=N3dZs+fVl+DXDUjs3JTNWyOu13hNId9iyLfsWZlvi3/eoi1v3mpxXwYkVgh+1qqKVQTLNK Usg2PGVdg0XJEnVsfUazk96a/QcCzbPkXW4DrTU0u+b+gcK/oYfR3aVrqNgVRETCHYJqlj VL4NnzFEuG22kDbLPqkA1o+SaL8b7Zo= X-MC-Unique: M6wSZLlrPOus2ekn_eAgpg-1 From: Thomas Huth To: John Snow , qemu-devel@nongnu.org Cc: BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Subject: [PATCH 6/7] hw/ide: Remove the include/hw/ide.h legacy file Date: Mon, 19 Feb 2024 11:49:11 +0100 Message-ID: <20240219104912.378211-7-thuth@redhat.com> In-Reply-To: <20240219104912.378211-1-thuth@redhat.com> References: <20240219104912.378211-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.077, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1708339866575100009 Content-Type: text/plain; charset="utf-8" There was only one prototype left in this legacy file. Move it to ide-dev.h to finally get rid of it. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide.h | 9 --------- include/hw/ide/ide-dev.h | 2 ++ include/hw/ide/internal.h | 1 - 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 include/hw/ide.h diff --git a/include/hw/ide.h b/include/hw/ide.h deleted file mode 100644 index db963bdb77..0000000000 --- a/include/hw/ide.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef HW_IDE_H -#define HW_IDE_H - -#include "exec/memory.h" - -/* ide/core.c */ -void ide_drive_get(DriveInfo **hd, int max_bus); - -#endif /* HW_IDE_H */ diff --git a/include/hw/ide/ide-dev.h b/include/hw/ide/ide-dev.h index de88784a25..ad55997442 100644 --- a/include/hw/ide/ide-dev.h +++ b/include/hw/ide/ide-dev.h @@ -181,4 +181,6 @@ typedef struct IDEDrive { =20 void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp); =20 +void ide_drive_get(DriveInfo **hd, int max_bus); + #endif diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index d1d3fcd23a..0fc2013374 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -7,7 +7,6 @@ * non-internal declarations are in hw/ide.h */ =20 -#include "hw/ide.h" #include "hw/ide/ide-bus.h" #include "hw/ide/ide-dma.h" =20 --=20 2.43.2 From nobody Thu Nov 14 06:51:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1708339864; cv=none; d=zohomail.com; s=zohoarc; b=govFyJWB21QuoskNSoN+v7RFbQcU6mwK+tdZ/szhJMXxFOKLsNBSoWX/nBM7rAqyycZbYjpub0IwkwlKY4vkVPBtyxxeRBFPp2Ki0D5gmXG857ErcumUK9uxr0S2BgaH2CR/guuUI+CK0Z9haVAlILkYInEp4FyhqY2ZjQV9n10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708339864; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RUcpp7ud7qWgwM0HegwhwVq7hiSy12MfogOqKhGEj/Q=; b=Mok1GnQPwv+wOhXZHoOED0FwbVlpZACjJ3R7zA6tZNoUa8HvtPiY9XAxk7+VbGkLKXLyIjsN0v5q4R7PnBrrPpIA0WB/9eec2d0NMQW43iBps0bHNmhXz0XD6eEH815eyqugp12De9Z3fTAi4qRk3yjX1cn73iH3KfI3oxL+N5E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708339864808264.2115104948241; Mon, 19 Feb 2024 02:51:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc1DZ-00047Q-N2; Mon, 19 Feb 2024 05:49:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DM-0003vZ-ET for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1DL-00019Q-0F for qemu-devel@nongnu.org; Mon, 19 Feb 2024 05:49:36 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-39-6agA2LLRNH--e3ulVDQ0vA-1; Mon, 19 Feb 2024 05:49:30 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8FA961C41A04; Mon, 19 Feb 2024 10:49:29 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id BBDE61C060B3; Mon, 19 Feb 2024 10:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708339774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RUcpp7ud7qWgwM0HegwhwVq7hiSy12MfogOqKhGEj/Q=; b=ElJGzbblqUkh+0tWpvyC+mWlS0CBhLc2RvZnxtX9q/y+6gEuACRJQ6AROL7WbAeyT9hrHD cQdgCNDGGoguN+YNex22j76JyrmBibwVLCEiIgEvUUaUYn4ILpr26IuZV0voLCYFsQDv/b 3a1TSxKMpEeR7UPQxeS5PYoDx+yIq0o= X-MC-Unique: 6agA2LLRNH--e3ulVDQ0vA-1 From: Thomas Huth To: John Snow , qemu-devel@nongnu.org Cc: BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Subject: [PATCH 7/7] hw/ide: Stop exposing internal.h to non-IDE files Date: Mon, 19 Feb 2024 11:49:12 +0100 Message-ID: <20240219104912.378211-8-thuth@redhat.com> In-Reply-To: <20240219104912.378211-1-thuth@redhat.com> References: <20240219104912.378211-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.077, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1708339866590100010 Content-Type: text/plain; charset="utf-8" include/hw/ide/internal.h is currently included by include/hw/ide/pci.h and thus exposed to a lot of files that are not part of the IDE subsystem. Stop including internal.h there and use the appropriate new headers ide-bus.h and ide-dma.h instead. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide/pci.h | 3 ++- hw/i386/pc.c | 2 +- hw/ide/cmd646.c | 1 + hw/ide/pci.c | 1 + hw/ide/piix.c | 1 + hw/ide/sii3112.c | 1 + hw/ide/via.c | 1 + 7 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h index a814a0a7c3..e1e012c387 100644 --- a/include/hw/ide/pci.h +++ b/include/hw/ide/pci.h @@ -1,7 +1,8 @@ #ifndef HW_IDE_PCI_H #define HW_IDE_PCI_H =20 -#include "hw/ide/internal.h" +#include "hw/ide/ide-bus.h" +#include "hw/ide/ide-dma.h" #include "hw/pci/pci_device.h" #include "qom/object.h" =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 196827531a..22d0c29575 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -31,7 +31,7 @@ #include "hw/i386/fw_cfg.h" #include "hw/i386/vmport.h" #include "sysemu/cpus.h" -#include "hw/ide/internal.h" +#include "hw/ide/ide-bus.h" #include "hw/timer/hpet.h" #include "hw/loader.h" #include "hw/rtc/mc146818rtc.h" diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index c0bcfa4414..23d213ff01 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -33,6 +33,7 @@ #include "sysemu/reset.h" =20 #include "hw/ide/pci.h" +#include "hw/ide/internal.h" #include "trace.h" =20 /* CMD646 specific */ diff --git a/hw/ide/pci.c b/hw/ide/pci.c index ca85d8474c..73efeec7f4 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -30,6 +30,7 @@ #include "sysemu/dma.h" #include "qemu/error-report.h" #include "qemu/module.h" +#include "hw/ide/internal.h" #include "hw/ide/pci.h" #include "trace.h" =20 diff --git a/hw/ide/piix.c b/hw/ide/piix.c index 4e5e12935f..1773a068c3 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -30,6 +30,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/pci/pci.h" +#include "hw/ide/internal.h" #include "hw/ide/piix.h" #include "hw/ide/pci.h" #include "trace.h" diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c index 63dc4a0494..321b9e46a1 100644 --- a/hw/ide/sii3112.c +++ b/hw/ide/sii3112.c @@ -13,6 +13,7 @@ */ =20 #include "qemu/osdep.h" +#include "hw/ide/internal.h" #include "hw/ide/pci.h" #include "qemu/module.h" #include "trace.h" diff --git a/hw/ide/via.c b/hw/ide/via.c index 3f3c484253..cf151e70ec 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -25,6 +25,7 @@ */ =20 #include "qemu/osdep.h" +#include "hw/ide/internal.h" #include "hw/pci/pci.h" #include "migration/vmstate.h" #include "qemu/module.h" --=20 2.43.2