From patchwork Thu Feb 15 17:57:44 2024 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: 772984 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp967846wre; Thu, 15 Feb 2024 10:06:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVoLdc7Vbs9Ic3aWt+ANkM8MoaEzfpEk7LzfJBDqV/7Zjlr5VGlZvOGkFQeZJYk2VU8QacH8MS+aCmhsoY2Jizf X-Google-Smtp-Source: AGHT+IEFnRM6gEcn/Xf4fR46VgcuDn5z37QhnL77LPAhoI0lVcS4w7i04hF5oPr6o7oMaVqVaKGe X-Received: by 2002:a05:6102:c87:b0:46d:1d91:ad9b with SMTP id f7-20020a0561020c8700b0046d1d91ad9bmr6511263vst.13.1708020388623; Thu, 15 Feb 2024 10:06:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708020388; cv=none; d=google.com; s=arc-20160816; b=z7bSu055oRR8NK2UVNgJnKfZlGqDBhM9zYpNbasFJXxXjX691ZLXxAOpp8l9yuFsZO hhpsWOx1BHoZ8AKJvPaiT+RGTwCfCzvDjwEQKtdKEShpXr/a7U/HcbzkyExytNqM5PZZ gxnS/4NI/A8xx+uOyfn9AyVZeSZlljJ0yHQ8hCYl/cxADQH7DsPZFcMwzRjMJrx1euEr 9tmG+7YeqCWe44lsXfNDodldUZ+3r/NM6LsCt/a4aRIxUrVn/rOQVaJ4D1GP6TbVdtyN wMiaHELp5NkKVnViQKEekYSmdvbRm1RpmbihbdFwDVrtcd3qS/OLz7bSc9nYUgMFJRc5 JBUw== 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:cc:to :from:dkim-signature; bh=ExMtb1HNe13B1Pbdje1mxE1780Ya0+pqDVCTBcv4Coc=; fh=LskQBqbR1i+n8KHJd8DaPuebftdqxFlBFOfZBeQkfyw=; b=UyMVC0Bt5YRxPHA9+vD0Qb19qV92R2PFLrkKZW1LqBpZoumcWJHpc54J71w1iB4gBM wUQp80y/DiSsROlwK7kqHkShdqgzRsEkj+OFwgTUtbi9UBfhxHC6+t2y9wfFojHytzNA N4giwghGvM+xa5ZAe9ULBBWr0nQbPhakuNygVTjDVf5/8WCMdHx1LKKqijF0NTy/TXLj 4pPbLDgCiUzwH4PLeuT0nKFD6KYeESTRUSnytD1nPJDdbJRw9QNU9E060O3CJ8AMJbF+ 8okwJfWkSpDz5QdURzcrMTyHDouUviKrCCKZvzy/7Eu7J4V9lcYDENGumgUUwXMc2kNz 5EWg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zXBxknZM; 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 c38-20020a0561023ca600b00467fe7eb29esi424675vsv.443.2024.02.15.10.06.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2024 10:06:28 -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=zXBxknZM; 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 1rag6B-0004UR-Um; Thu, 15 Feb 2024 13:04:40 -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 1rag5A-0001qa-3h for qemu-devel@nongnu.org; Thu, 15 Feb 2024 13:03:41 -0500 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rag57-0003AC-MV for qemu-devel@nongnu.org; Thu, 15 Feb 2024 13:03:35 -0500 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5116ec49081so1395887e87.2 for ; Thu, 15 Feb 2024 10:03:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708020211; x=1708625011; darn=nongnu.org; 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=ExMtb1HNe13B1Pbdje1mxE1780Ya0+pqDVCTBcv4Coc=; b=zXBxknZMKxNOPfvmAixCzHxKAFfNOZ0mAGcBRKa81qjZQOf4o+FEX8ts7ek2qTejJ8 jxffaExn6r6ASorilO2GTv1rb1ozAVS8aWbbM5NKp0+y+H5E3AmLE7AsNajZocfcyVo1 SdXU4fVQuzgDVtO2RW4u3VKqxsrVQDfiOUTCWN3jz9fyZuND7aFbkDZb+wwOQj7r13kE xVQCdXvfUtzT5robffOe/kY1m1LN3B4AFqcJwetB7COjiG3aN41PirSpcWFKwCk4FmXI TpSVJ6DQi0jC4WD1y8EU2XSJXhDHaV9I8Mz4tioJBv6bayE8Jy/fl4xRLyYnZv8SE7NY 3fdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708020211; x=1708625011; 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=ExMtb1HNe13B1Pbdje1mxE1780Ya0+pqDVCTBcv4Coc=; b=OOPP4j6LO9e8bSkHgAm572UYYy/d0QbtyWSdUyWsE4IjYRnvtfgJSfz8mxSWXL65Pw u54QPJf30gXRzfa5Obs5LD7KQ34j3tFALD6WppR8qjjw1DUWuQzOuPepvzfDoYQtvH3x 0JECzgRKLpZl3Y0jbsWOjemSE+3SmHypDnR60cb0tZ4VuC4YtdmFl+315pxl+rIvGEMp qrbhRXAX8p9t80SL8l90/+SC4LdurbZ3eZ48OV+yfHeDkS/a4avrrMWoJ6KDSPRTKTzH CUNfZYEmuUZX+6h+iUYnw+rcxfP4rvpOTYpKOhV5/uCgfT98f7/9WTS+ZqOJKVHdZi6o SpjQ== X-Gm-Message-State: AOJu0YxNyao95yCAJpIzsIOAen7hbLw2gj1pxqAskJqiRQTbRWOg3I45 Rm7RMYbEEjDeavWoQDWDUQXJqFujfaWkSoqYRri/k5f+TcyVU0hVFBjT/xmciLQTKQHiq48ypRw O76s= X-Received: by 2002:ac2:46eb:0:b0:511:78cf:968a with SMTP id q11-20020ac246eb000000b0051178cf968amr1860646lfo.68.1708020210864; Thu, 15 Feb 2024 10:03:30 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id pk27-20020a170906d7bb00b00a3d716dde9csm786640ejb.44.2024.02.15.10.03.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 10:03:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S . Tsirkin" , Richard Henderson , Paolo Bonzini , Eduardo Habkost , Marcel Apfelbaum , John Snow , Paul Burton , Aleksandar Rikalo Subject: [PULL 50/56] hw/ide/ahci: Inline ahci_get_num_ports() Date: Thu, 15 Feb 2024 18:57:44 +0100 Message-ID: <20240215175752.82828-51-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215175752.82828-1-philmd@linaro.org> References: <20240215175752.82828-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=philmd@linaro.org; helo=mail-lf1-x12c.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, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Introduce the 'ich9' variable and inline ahci_get_num_ports(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Message-Id: <20240213081201.78951-5-philmd@linaro.org> --- include/hw/ide/ahci.h | 1 - hw/i386/pc_q35.c | 6 ++++-- hw/ide/ahci.c | 8 -------- hw/mips/boston.c | 6 ++++-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h index 6818d02063..dbef377f3d 100644 --- a/include/hw/ide/ahci.h +++ b/include/hw/ide/ahci.h @@ -52,7 +52,6 @@ typedef struct AHCIState { } AHCIState; -int32_t ahci_get_num_ports(PCIDevice *dev); void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd); #define TYPE_SYSBUS_AHCI "sysbus-ahci" diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index a89f900c4c..09e12418f9 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -292,16 +292,18 @@ static void pc_q35_init(MachineState *machine) if (pcms->sata_enabled) { PCIDevice *pdev; + AHCIPCIState *ich9; /* ahci and SATA device, for q35 1 ahci controller is built-in */ pdev = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_SATA1_DEV, ICH9_SATA1_FUNC), "ich9-ahci"); + ich9 = ICH9_AHCI(pdev); idebus[0] = qdev_get_child_bus(DEVICE(pdev), "ide.0"); idebus[1] = qdev_get_child_bus(DEVICE(pdev), "ide.1"); - g_assert(MAX_SATA_PORTS == ahci_get_num_ports(pdev)); - ide_drive_get(hd, ahci_get_num_ports(pdev)); + g_assert(MAX_SATA_PORTS == ich9->ahci.ports); + ide_drive_get(hd, ich9->ahci.ports); ahci_ide_create_devs(pdev, hd); } else { idebus[0] = idebus[1] = NULL; diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index aa9381a7b2..8b97c6b0e7 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1896,14 +1896,6 @@ static void sysbus_ahci_register_types(void) type_init(sysbus_ahci_register_types) -int32_t ahci_get_num_ports(PCIDevice *dev) -{ - AHCIPCIState *d = ICH9_AHCI(dev); - AHCIState *ahci = &d->ahci; - - return ahci->ports; -} - void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd) { AHCIPCIState *d = ICH9_AHCI(dev); diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 0ec0b98066..a6c7bc18ff 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -678,6 +678,7 @@ static void boston_mach_init(MachineState *machine) MemoryRegion *sys_mem = get_system_memory(); XilinxPCIEHost *pcie2; PCIDevice *pdev; + AHCIPCIState *ich9; DriveInfo *hd[6]; Chardev *chr; int fw_size, fit_err; @@ -771,8 +772,9 @@ static void boston_mach_init(MachineState *machine) pdev = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus, PCI_DEVFN(0, 0), TYPE_ICH9_AHCI); - g_assert(ARRAY_SIZE(hd) == ahci_get_num_ports(pdev)); - ide_drive_get(hd, ahci_get_num_ports(pdev)); + ich9 = ICH9_AHCI(pdev); + g_assert(ARRAY_SIZE(hd) == ich9->ahci.ports); + ide_drive_get(hd, ich9->ahci.ports); ahci_ide_create_devs(pdev, hd); if (machine->firmware) {