Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2686881pxb; Tue, 24 Aug 2021 05:23:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyfrj2P2w4cBusDDeJmxvRLE9UoVY3kMv4y4mKgZ0Wt21iunHwaEUNmnYmxp0KL3g+bCfF X-Received: by 2002:a6b:8d8a:: with SMTP id p132mr30547087iod.81.1629807828977; Tue, 24 Aug 2021 05:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629807828; cv=none; d=google.com; s=arc-20160816; b=Gp26GRnvi0B/MWq0AXXmpIRLHJdaMEWSOitgTmah1pA2LhhSoFjSqdnCbpupYlBywm rF+z/k0z5MjWXDyIKNnsCC88l0U4Yj33iGYqWRzXro8ZT6atoPAxqN+q+866C8P9pZcw 3bYO4IrprxR0y6hDcssDnNoNcwujz9Bl4DdXpHF83EYTQHE8OodqGcVz69IxO/LliG79 NQdX829Th0NaY3rME5IheMMRA5IJev+Fzx2BTBS4YOMAVZh8je0U/eM9bKb/QyI+szd2 4UdOlXRLo6lpO7FPfyblnkaGj8d6kVDE3SYUdp9SetJN4miT2Yj04pWwWgc/zeAbgR0h GjRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=uizjegxFHkuj8iRBWUkHz7yomY8ed84brgnr0+tIJvQ=; b=lGa7UBt+3v6euZO+D+HA5s2N7LLhaRIRrOXtdiT1dIPenhTTeNBNv4TCjk3h0IIuon O6DujsZTrSggHzhVRuugFwxAH6PgAfQCyUpxMekvawIPQE7B/9gCb3Z+5oW+RAXtt3bW JaU6hwrOTsdbLeZVWzSUxjZUJVMhPj3t2VmZAD6O19rnoQn87Tawh92l9uAs4OiiUNpq eBddQn5IwZF9GnffGZ32BVoh6eqSAXyLaoayB14d9P0DiVvwYirhr1qKVhGBE56zkySj +Mhafmsmykw8k7Ond6SpC/DHuej78yU/F3poU6Q0NtO6SYtUWn66f+Lb+m/qHTJqdU46 AH4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si17948355ilu.143.2021.08.24.05.23.37; Tue, 24 Aug 2021 05:23:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237289AbhHXMV4 (ORCPT + 99 others); Tue, 24 Aug 2021 08:21:56 -0400 Received: from 8bytes.org ([81.169.241.247]:40902 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236676AbhHXMVr (ORCPT ); Tue, 24 Aug 2021 08:21:47 -0400 Received: from cap.home.8bytes.org (p4ff2b1ea.dip0.t-ipconnect.de [79.242.177.234]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id 73781898; Tue, 24 Aug 2021 14:21:00 +0200 (CEST) From: Joerg Roedel To: Bjorn Helgaas , "Rafael J . Wysocki" , Len Brown Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, joro@8bytes.org, jroedel@suse.de Subject: [PATCH v3 3/4] PCI/ACPI: Move _OSC query checks to separate function Date: Tue, 24 Aug 2021 14:20:53 +0200 Message-Id: <20210824122054.29481-4-joro@8bytes.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210824122054.29481-1-joro@8bytes.org> References: <20210824122054.29481-1-joro@8bytes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel Move the checks about whether the _OSC controls are requested from the firmware to a separate function. Signed-off-by: Joerg Roedel --- drivers/acpi/pci_root.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index ed4e6b55e9bc..f12e512bcddc 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -449,6 +449,24 @@ static u32 calculate_control(void) return control; } +static bool os_control_query_checks(struct acpi_pci_root *root, u32 support) +{ + struct acpi_device *device = root->device; + + if (pcie_ports_disabled) { + dev_info(&device->dev, "PCIe port services disabled; not requesting _OSC control\n"); + return false; + } + + if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) { + decode_osc_support(root, "not requesting OS control; OS requires", + ACPI_PCIE_REQ_SUPPORT); + return false; + } + + return true; +} + static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm, bool is_pcie) { @@ -485,16 +503,8 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm, return; } - if (pcie_ports_disabled) { - dev_info(&device->dev, "PCIe port services disabled; not requesting _OSC control\n"); + if (!os_control_query_checks(root, support)) return; - } - - if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) { - decode_osc_support(root, "not requesting OS control; OS requires", - ACPI_PCIE_REQ_SUPPORT); - return; - } requested = control = calculate_control(); -- 2.32.0