From patchwork Mon Feb 27 14:00:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 657059 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2378874wrb; Mon, 27 Feb 2023 06:23:43 -0800 (PST) X-Google-Smtp-Source: AK7set9sPHF+fBu/Z7rykegmI2J9DNUFCqmo3JJQM1wsJZoD9s2i0cwq1vOD1NTcnh23pEnpx1iP X-Received: by 2002:a05:6214:19cf:b0:56b:eb9d:4342 with SMTP id j15-20020a05621419cf00b0056beb9d4342mr45050547qvc.49.1677507823773; Mon, 27 Feb 2023 06:23:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677507823; cv=none; d=google.com; s=arc-20160816; b=ScsgSLHJ7wKqSYQbeL/KYj9E8KByCUFtfaI6A816yZ3COQyih5Ui7s5dnyEbLRxgkr fymLucaAjpL8eTUu/dtXxYC8tnDwtcnuMM2HevZ2C7qbcZIbaHb7ovYboFjOoLIogYrG P/OaaoFStlsBDHEiFETdtzvpES70u3y7psKZT9btou1eTT2YlIoAoTDAm+iWJ7KHCNCq PizCEX+zsWdU5newqmuVhrYGPmtcscVB+RN9FJONT8yhW4e5lxbDfH0gdqyzH1bkDYUT KAmPJzmVWtavlzMXYC9eeVbTKojNXJTN8/rlv4tyJvprMS7zWrf6n0I2q1j0S/O65ZNm TP0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=YtYDhCyGHt282L/1vIUrdhgyJAf4ZI3L5X+30y37+H8=; b=kyFNGRC3stcYZralDMVeuED/B6RtiFhFzlz4s9UwmThEKmJeJ2eON7hi/t6RVxwEIB Ej6BdTpqrI7TiF3TnkTrmjUb3JedNob63EHcd/SrYbKM/zwpYzTtrtqss+Da+geXuQkW HYv98l2AR6jy7BmATfKkbdn07XHUoWELMnv5HGJ+ufZnU53kaH/JBMWSj2QLAeKK09WS JXSlBa6eny4Ymlv0yEnRtVWgrbFKZ8pPA9fwTmDXu+R4H5DWrkHIl+H4MqVCk5MUGfQa PJbwmOXqZPHpFrZspvMsDUdVtV31bYIIEA1Y7vyNYidVt4qYZyMzG6JbdLQ5g1qTRTz4 +tdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GY2QOl8h; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c16-20020a0ce150000000b0057116a70032si6378392qvl.495.2023.02.27.06.23.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2023 06:23:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GY2QOl8h; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWe8A-0004Su-E0; Mon, 27 Feb 2023 09:05: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 1pWe84-0004M7-FZ for qemu-devel@nongnu.org; Mon, 27 Feb 2023 09:05:24 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWe82-0008IS-R4 for qemu-devel@nongnu.org; Mon, 27 Feb 2023 09:05:24 -0500 Received: by mail-wr1-x432.google.com with SMTP id bt28so6343992wrb.8 for ; Mon, 27 Feb 2023 06:05:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=YtYDhCyGHt282L/1vIUrdhgyJAf4ZI3L5X+30y37+H8=; b=GY2QOl8hzK8Dh5rZ4XXkPnzYUnKF1XUuwr9aMVY8DPV5/21uZf49+bCyGY5qlY3SUx C60PFBcA+hiTb20NEHM7ZZMM13iwtj1jjJ9ENQLCpo8cX83WKjV7zAs1KP21w5rELYLd doL0IfTy+38pDK/HeZ0LREv6THrJkYIN0zC3yGdw2Ra3WbgJ6IcenV020ljE0ZmJMnVT p18SIxbayJfeMx6L0WThJpx7AvP5aUoRkNHju3ukiPs4QhJtx/BwxzDtXU3HpL6fBox/ xNhf13dzvr6EXyZZCjuPuzKUxkNGXUPF/tFipQ7iA+uQqqezEXNCpYVzKUGU+SDdYM9E 3cQg== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YtYDhCyGHt282L/1vIUrdhgyJAf4ZI3L5X+30y37+H8=; b=oX2Sc2ZUFvrbjRJueNHgfA7qe/UTXmexf/h0BUmnF02glL2AIUm+Of0nDeZX/b+Ufh s4KsIHIroDnptkE4ahxd543KNjoMJsWU5ON6zP/a/djEgFSnIYojMHQCaJDctMNIKgAX cO7M0q1AQZ+Mu+P+lNvZDl4I7ZMGU5JGcC3A82S+8yEkVB6AQP0t2qdycF6S2T74o2Zh /z+nLLK7dPCIhAQKd/Z19iVlSYWJHV0PIjW7m5K1zuHAaJgUJ/MXVVB/wPU8MKDpMU6P rjFIzDHlx/+ih9sOjaF9mWaXOIYznc2cjr4C1bOFYnFjhykTwJTHkdTAXkYJVSO2wVjr Ew+Q== X-Gm-Message-State: AO0yUKWkhkzHod+pfgs8WGOvC8d1rv5OuFWEWyl1mu66N9IMLFpgRUB7 plB/rwTTDsMxhLzXlUVK4pP4clCpdPiPgUe/ X-Received: by 2002:adf:eacd:0:b0:2c7:107c:e172 with SMTP id o13-20020adfeacd000000b002c7107ce172mr12177639wrn.41.1677506720555; Mon, 27 Feb 2023 06:05:20 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id t1-20020a5d6a41000000b002c70a68111asm7320333wrw.83.2023.02.27.06.05.19 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 27 Feb 2023 06:05:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 044/126] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it Date: Mon, 27 Feb 2023 15:00:51 +0100 Message-Id: <20230227140213.35084-35-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230227140213.35084-1-philmd@linaro.org> References: <20230227140213.35084-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bernhard Beschow ich9_smb_init() is a legacy init function, so modernize the code. Note that the smb_io_base parameter was unused. Signed-off-by: Bernhard Beschow Acked-by: Corey Minyard Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230213173033.98762-6-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/i2c/smbus_ich9.c | 13 +++---------- hw/i386/pc_q35.c | 11 ++++++++--- include/hw/i386/ich9.h | 1 - 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c index d29c0f6ffa..f0dd3cb147 100644 --- a/hw/i2c/smbus_ich9.c +++ b/hw/i2c/smbus_ich9.c @@ -105,6 +105,9 @@ static void ich9_smbus_realize(PCIDevice *d, Error **errp) pm_smbus_init(&d->qdev, &s->smb, false); pci_register_bar(d, ICH9_SMB_SMB_BASE_BAR, PCI_BASE_ADDRESS_SPACE_IO, &s->smb.io); + + s->smb.set_irq = ich9_smb_set_irq; + s->smb.opaque = s; } static void build_ich9_smb_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -137,16 +140,6 @@ static void ich9_smb_class_init(ObjectClass *klass, void *data) adevc->build_dev_aml = build_ich9_smb_aml; } -I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base) -{ - PCIDevice *d = - pci_create_simple_multifunction(bus, devfn, true, TYPE_ICH9_SMB_DEVICE); - ICH9SMBState *s = ICH9_SMB_DEVICE(d); - s->smb.set_irq = ich9_smb_set_irq; - s->smb.opaque = s; - return s->smb.smbus; -} - static const TypeInfo ich9_smb_info = { .name = TYPE_ICH9_SMB_DEVICE, .parent = TYPE_PCI_DEVICE, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 5e3f7c7e86..7137c38846 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -315,10 +315,15 @@ static void pc_q35_init(MachineState *machine) } if (pcms->smbus_enabled) { + PCIDevice *smb; + /* TODO: Populate SPD eeprom data. */ - pcms->smbus = ich9_smb_init(host_bus, - PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), - 0xb100); + smb = pci_create_simple_multifunction(host_bus, + PCI_DEVFN(ICH9_SMB_DEV, + ICH9_SMB_FUNC), + true, TYPE_ICH9_SMB_DEVICE); + pcms->smbus = I2C_BUS(qdev_get_child_bus(DEVICE(smb), "i2c")); + smbus_eeprom_init(pcms->smbus, 8, NULL, 0); } diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index 05464f6965..52ea116f44 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -9,7 +9,6 @@ #include "qom/object.h" void ich9_lpc_pm_init(PCIDevice *pci_lpc, bool smm_enabled); -I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base); void ich9_generate_smi(void);