From nobody Mon Feb 9 20:35:33 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1670181420; cv=none; d=zohomail.com; s=zohoarc; b=NSKM0309HPeIkUt+v/SNvTrXiLu1/5qSArxeVCg32Lg00UW3cC3rbhAX+RUuNsO5sj9HZdGTB6vLWsPpIocKGcVVDKJu9jH23qsNbwT3WNMwFxZSBa2otOfpPHZtHF0EhVcOQBU4BAh8WlzF0D2EtVEDoUBVFwzyJC8+BhTdxKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670181420; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2Sf4Wtu5GBuR4J4Fi88VTTj1DtROnzUn+AjwK2FJWqE=; b=jJ8xnbjb/Qw/2lBkgqK6oVQp1I7ZJd+tzq+9n4zYeGS/IEUF0npITjORszKfiB7MYmvd3YnlhtKcdVhJ5Sw0ZWr7zPmoRaegX4gjqTcGQxhLALurytNsiyMSgULAKsZjajqDGCtLo20EeUOlBtX4hvS9tm82GqBwg3kCMygFVTY= 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 1670181420361480.31143108634546; Sun, 4 Dec 2022 11:17:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1uLR-0002C3-25; Sun, 04 Dec 2022 14:08:09 -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 1p1uLO-0002AK-Th; Sun, 04 Dec 2022 14:08:06 -0500 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p1uLI-0001c1-Ll; Sun, 04 Dec 2022 14:08:06 -0500 Received: by mail-ej1-x62e.google.com with SMTP id fc4so16121273ejc.12; Sun, 04 Dec 2022 11:07:59 -0800 (PST) Received: from localhost.localdomain (dynamic-089-012-182-051.89.12.pool.telefonica.de. [89.12.182.51]) by smtp.gmail.com with ESMTPSA id j10-20020a17090623ea00b00782ee6b34f2sm5359835ejg.183.2022.12.04.11.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Dec 2022 11:07:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2Sf4Wtu5GBuR4J4Fi88VTTj1DtROnzUn+AjwK2FJWqE=; b=J4VeFXsFNbL6j/iyAhlGrFnjbZl9GAmJ82NRupozII6EENGGdKtUUL70wJioFsX5GV kT0+U4vdpuVtu/VWIOam82wNVxcHxDz6SEluYMBEJ1W+k0yphpb/w0rHzwyMI8aklmhs gySrrcHmGc83IMJil8fRImGEPvKa5UlRG5B1yxjcpRPZNl3R94sCcc2bHAcuBIBm5cGr E3k4dYkT5oSpaFVjyt9HWRNgbhLaRS4W7g6vRXBkXxohuI2h/bUHEhzi75gtAwE3jZoR nOZwMsmKsRroZFiP+MXJ6YZ+Ji1EbuUst5IMgzKTBp8TIuS3voWB8z/5H1FWQlJjTKas wfnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Sf4Wtu5GBuR4J4Fi88VTTj1DtROnzUn+AjwK2FJWqE=; b=1CNnHtj5tJGiHBD9r+s2xFT/zQkJx0NB2WtqWlw5qaj9BvIKvkynbxFWqaVrUS+Na2 zWlHx/cTDvAG5wCRHA2ETYAzFtBqW0XVH0WCEKzUt2cqpI30gUhqnhsNYCE3n78gtPjK V39jDxvtcBvz9arEK4GtRqSOIAY0tcYh0tom+SOub0O4gw8xoDuscp1sHMhUlQI2PyRU h9dXBR6fgVf1OerC4Cm+Ho33rQZaQEhNtzeO549XGT84rkDJzFY2V6OEZlripF960DaS qRrv02EgqK4tUUPI3wK7+zmPQKHTER3yELBun02P1l0XF/R2z1jVyb9H/p0Sowa2SSdi CJ6w== X-Gm-Message-State: ANoB5pmYsfwKxOxCH7OvPJDpabCqANMiK6muGIUCG22P4rVqRhPzGbUb FyEi4oteLvA0zVgqjrikGUTsjNl5qng= X-Google-Smtp-Source: AA0mqf6ZtBjESCPC2SFArwrFdFF2WzJvx1WcnpwwT1dzJHHq4bBdNDCDBM2PiIdfC6/aQUiLRpTXlQ== X-Received: by 2002:a17:906:9bfa:b0:7c0:fa81:4a6f with SMTP id de58-20020a1709069bfa00b007c0fa814a6fmr115101ejc.691.1670180879161; Sun, 04 Dec 2022 11:07:59 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Marcel Apfelbaum , John Snow , qemu-block@nongnu.org, Igor Mammedov , Gerd Hoffmann , Aurelien Jarno , Richard Henderson , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Ani Sinha , Jiaxun Yang , Bernhard Beschow Subject: [PATCH 23/32] hw/isa/piix4: Reuse struct PIIXState from PIIX3 Date: Sun, 4 Dec 2022 20:05:44 +0100 Message-Id: <20221204190553.3274-24-shentey@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221204190553.3274-1-shentey@gmail.com> References: <20221204190553.3274-1-shentey@gmail.com> MIME-Version: 1.0 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=2a00:1450:4864:20::62e; envelope-from=shentey@gmail.com; helo=mail-ej1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @gmail.com) X-ZM-MESSAGEID: 1670181421237100005 Content-Type: text/plain; charset="utf-8" Now that PIIX4 also uses the "proxy-pic", both implementations can share the same struct. Signed-off-by: Bernhard Beschow Message-Id: <20221022150508.26830-34-shentey@gmail.com> --- hw/isa/piix4.c | 51 +++++++++++++++----------------------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 0c34e3717c..c12388ddac 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -42,32 +42,10 @@ #include "sysemu/runstate.h" #include "qom/object.h" =20 -struct PIIX4State { - PCIDevice dev; - - ProxyPICState pic; - RTCState rtc; - PCIIDEState ide; - UHCIState uhci; - PIIX4PMState pm; - - uint32_t smb_io_base; - - /* Reset Control Register */ - MemoryRegion rcr_mem; - uint8_t rcr; - - bool has_acpi; - bool has_usb; - bool smm_enabled; -}; - -OBJECT_DECLARE_SIMPLE_TYPE(PIIX4State, PIIX4_PCI_DEVICE) - static void piix4_set_irq(void *opaque, int irq_num, int level) { int i, pic_irq, pic_level; - PIIX4State *s =3D opaque; + PIIXState *s =3D opaque; PCIBus *bus =3D pci_get_bus(&s->dev); =20 /* now we change the pic irq level according to the piix irq mappings = */ @@ -112,7 +90,7 @@ static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq= _num) =20 static void piix4_isa_reset(DeviceState *dev) { - PIIX4State *d =3D PIIX4_PCI_DEVICE(dev); + PIIXState *d =3D PIIX_PCI_DEVICE(dev); uint8_t *pci_conf =3D d->dev.config; =20 pci_conf[0x04] =3D 0x07; // master, memory and I/O @@ -147,12 +125,13 @@ static void piix4_isa_reset(DeviceState *dev) pci_conf[0xac] =3D 0x00; pci_conf[0xae] =3D 0x00; =20 + d->pic_levels =3D 0; /* not used in PIIX4 */ d->rcr =3D 0; } =20 static int piix4_post_load(void *opaque, int version_id) { - PIIX4State *s =3D opaque; + PIIXState *s =3D opaque; =20 if (version_id =3D=3D 2) { s->rcr =3D 0; @@ -167,8 +146,8 @@ static const VMStateDescription vmstate_piix4 =3D { .minimum_version_id =3D 2, .post_load =3D piix4_post_load, .fields =3D (VMStateField[]) { - VMSTATE_PCI_DEVICE(dev, PIIX4State), - VMSTATE_UINT8_V(rcr, PIIX4State, 3), + VMSTATE_PCI_DEVICE(dev, PIIXState), + VMSTATE_UINT8_V(rcr, PIIXState, 3), VMSTATE_END_OF_LIST() } }; @@ -176,7 +155,7 @@ static const VMStateDescription vmstate_piix4 =3D { static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned int len) { - PIIX4State *s =3D opaque; + PIIXState *s =3D opaque; =20 if (val & 4) { qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); @@ -188,7 +167,7 @@ static void piix4_rcr_write(void *opaque, hwaddr addr, = uint64_t val, =20 static uint64_t piix4_rcr_read(void *opaque, hwaddr addr, unsigned int len) { - PIIX4State *s =3D opaque; + PIIXState *s =3D opaque; =20 return s->rcr; } @@ -205,7 +184,7 @@ static const MemoryRegionOps piix4_rcr_ops =3D { =20 static void piix4_realize(PCIDevice *dev, Error **errp) { - PIIX4State *s =3D PIIX4_PCI_DEVICE(dev); + PIIXState *s =3D PIIX_PCI_DEVICE(dev); PCIBus *pci_bus =3D pci_get_bus(dev); ISABus *isa_bus; =20 @@ -275,7 +254,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp) =20 static void piix4_init(Object *obj) { - PIIX4State *s =3D PIIX4_PCI_DEVICE(obj); + PIIXState *s =3D PIIX_PCI_DEVICE(obj); =20 object_initialize_child(obj, "pic", &s->pic, TYPE_PROXY_PIC); object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); @@ -283,10 +262,10 @@ static void piix4_init(Object *obj) } =20 static Property piix4_props[] =3D { - DEFINE_PROP_UINT32("smb_io_base", PIIX4State, smb_io_base, 0), - DEFINE_PROP_BOOL("has-acpi", PIIX4State, has_acpi, true), - DEFINE_PROP_BOOL("has-usb", PIIX4State, has_usb, true), - DEFINE_PROP_BOOL("smm-enabled", PIIX4State, smm_enabled, false), + DEFINE_PROP_UINT32("smb_io_base", PIIXState, smb_io_base, 0), + DEFINE_PROP_BOOL("has-acpi", PIIXState, has_acpi, true), + DEFINE_PROP_BOOL("has-usb", PIIXState, has_usb, true), + DEFINE_PROP_BOOL("smm-enabled", PIIXState, smm_enabled, false), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -314,7 +293,7 @@ static void piix4_class_init(ObjectClass *klass, void *= data) static const TypeInfo piix4_info =3D { .name =3D TYPE_PIIX4_PCI_DEVICE, .parent =3D TYPE_PCI_DEVICE, - .instance_size =3D sizeof(PIIX4State), + .instance_size =3D sizeof(PIIXState), .instance_init =3D piix4_init, .class_init =3D piix4_class_init, .interfaces =3D (InterfaceInfo[]) { --=20 2.38.1