Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp637886ybt; Fri, 19 Jun 2020 09:54:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUQHsoZgrLkI1tyZIGQCHij+4S8Wa3RUG5ssUt8FDl5gpZACVpT+LqWFziTcoOc0hRzTgt X-Received: by 2002:a17:906:7813:: with SMTP id u19mr846403ejm.471.1592585679843; Fri, 19 Jun 2020 09:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592585679; cv=none; d=google.com; s=arc-20160816; b=rD0bbydEff6vIpTxbgyiDCX+tmxUBI4QTo0IwRgtEYrU5BynnUcDe5CxqL+1hVHdrn gca5lUWZ7ofCyZ/+iPF7NwlhJz3EMpGF0Dfc3+xxa8bg33rATfiWNsJYTMLE3kxvfevX 3CoTC4FNwUFYDZdkqW6zuJmMfAyOnvouY+7aQYJpRY6hFuGvf8ULePqfWGZAb2h8YnWj xqgonsoUUDvR9x07pjVWu17FIPZ75jwaoC64OL3IYHb9HOqLrWOOYWK6Hkp5aX4LI7bw oJCEmbwj5lrQa4GP6D5nMa7EgVqPTl6D7RWiNQn3geFhbCr18QnLDc+d4h5UsZ6NwHWo ONbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=r6IiaLiEqreaNcYI36JrBXT7EgWGTBZjgSUNAyc4+9Q=; b=DYPqDmzX6sOxGgOMwYNS20Sei26jzsQQcAvsrstZEeM7HQS8ofTRCvJynT3yEDtr1p Xtj9FwxUb4R8pYaocIQBXmPSpCUacqwTVttrq7yFDegqv1jdChuMLkS2DNY05ioKkhHO PlApWc0ZE0mwRVqUpphzFGIcIEihbBNWzTMACZorE8lBSeZzCozs9IvXM+lGmO1u6tV9 bAkFQepEAJyE0652gi6QNUBYIz3SFmIKHzk2EwHA3ICXBQ+U0AQ2YaRG+Yhm0T0mweQp MrQXEM99Z/IogTQqPJGyNGpraTYWueMy1yYtjCaJe3gcW5QWzCETcS/z4bLdq8r53fb7 lWrQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m21si4480068eds.234.2020.06.19.09.54.16; Fri, 19 Jun 2020 09:54:39 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405902AbgFSQvd (ORCPT + 99 others); Fri, 19 Jun 2020 12:51:33 -0400 Received: from mga18.intel.com ([134.134.136.126]:45046 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405893AbgFSQva (ORCPT ); Fri, 19 Jun 2020 12:51:30 -0400 IronPort-SDR: avhy3UrXdccRIw4UXF463hl29XWJLiW6/BIb1vM/wF3w50ZauXr2R24OzgmV1ZkJt0ARRb9MIn G91r09A2Xttw== X-IronPort-AV: E=McAfee;i="6000,8403,9657"; a="130381936" X-IronPort-AV: E=Sophos;i="5.75,256,1589266800"; d="scan'208";a="130381936" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2020 09:51:29 -0700 IronPort-SDR: vDx/9AjKNDTgQSiYOJgpv7hgdtW+fU1at2UA2BIJsfZy2JGHoip1gqaT4ZT24fRtN4XWMAwSya 5vnxcFr1a2Vg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,256,1589266800"; d="scan'208";a="318165134" Received: from twinkler-lnx.jer.intel.com ([10.12.91.138]) by FMSMGA003.fm.intel.com with ESMTP; 19 Jun 2020 09:51:28 -0700 From: Tomas Winkler To: Greg Kroah-Hartman Cc: Alexander Usyskin , linux-kernel@vger.kernel.org, Tomas Winkler Subject: [char-misc-next 3/7] mei: me: make mei_me_fw_sku_sps_4() less cryptic Date: Fri, 19 Jun 2020 19:51:17 +0300 Message-Id: <20200619165121.2145330-3-tomas.winkler@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200619165121.2145330-1-tomas.winkler@intel.com> References: <20200619165121.2145330-1-tomas.winkler@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Last add mei_me_fw_sku_sps_4() kdoc and add descriptive defines for register name and values. Signed-off-by: Tomas Winkler --- drivers/misc/mei/hw-me-regs.h | 2 ++ drivers/misc/mei/hw-me.c | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h index 01b1bf74f262..64823bdde6af 100644 --- a/drivers/misc/mei/hw-me-regs.h +++ b/drivers/misc/mei/hw-me-regs.h @@ -105,6 +105,8 @@ /* Host Firmware Status Registers in PCI Config Space */ #define PCI_CFG_HFS_1 0x40 # define PCI_CFG_HFS_1_D0I3_MSK 0x80000000 +# define PCI_CFG_HFS_1_OPMODE_MSK 0xf0000 /* OP MODE Mask: SPS <= 4.0 */ +# define PCI_CFG_HFS_1_OPMODE_SPS 0xf0000 /* SPS SKU : SPS <= 4.0 */ #define PCI_CFG_HFS_2 0x48 #define PCI_CFG_HFS_3 0x60 # define PCI_CFG_HFS_3_FW_SKU_MSK 0x00000070 diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index b45143510912..6aa522c0d910 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c @@ -1366,20 +1366,26 @@ static bool mei_me_fw_type_nm(const struct pci_dev *pdev) #define MEI_CFG_FW_NM \ .quirk_probe = mei_me_fw_type_nm +/** + * mei_me_fw_sku_sps_4() - check for sps 4.0 sku + * + * Read ME FW Status register to check for SPS Firmware. + * The SPS FW is only signaled in the PCI function 0. + * __Note__: Deprecated by SPS 5.0 and newer. + * + * @pdev: pci device + * + * Return: true in case of SPS firmware + */ static bool mei_me_fw_type_sps_4(const struct pci_dev *pdev) { u32 reg; unsigned int devfn; - /* - * Read ME FW Status register to check for SPS Firmware - * The SPS FW is only signaled in pci function 0 - */ devfn = PCI_DEVFN(PCI_SLOT(pdev->devfn), 0); pci_bus_read_config_dword(pdev->bus, devfn, PCI_CFG_HFS_1, ®); trace_mei_pci_cfg_read(&pdev->dev, "PCI_CFG_HFS_1", PCI_CFG_HFS_1, reg); - /* if bits [19:16] = 15, running SPS Firmware */ - return (reg & 0xf0000) == 0xf0000; + return (reg & PCI_CFG_HFS_1_OPMODE_MSK) == PCI_CFG_HFS_1_OPMODE_SPS; } #define MEI_CFG_FW_SPS_4 \ -- 2.25.4