Received: by 10.223.176.5 with SMTP id f5csp765485wra; Fri, 2 Feb 2018 05:51:41 -0800 (PST) X-Google-Smtp-Source: AH8x227kMeZDfA9bi1QfM8yeDFmPtmHl4lqauwgCDnMOVdN2pvjEsgK/el8USOMa//pKGqzasONE X-Received: by 10.98.93.65 with SMTP id r62mr40122968pfb.55.1517579501408; Fri, 02 Feb 2018 05:51:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517579501; cv=none; d=google.com; s=arc-20160816; b=KbfACic61gb53qHuurqAVqkB96Ylk94LrvDJkMMPUGooQlIKAxL8aA5ukmJGtf46+G VOhc4CPMHtqnonVqIZ5bSTILOEv/gH1eWCRmyAtbQ0SSegRnPsEsJBdKpvVPdPgxynnw pZ3XSYI8tHmyNT8rYNAH6cXAHk9+Y32o5J5siswxWtYqQQOfYCFJ8O9/0hLAQEvSjgYT V6THSqGQOthrjgBpQdAJP5AXT/djgNvAENRhQKgrLihozXr82/iIkUU6xbdXAUxQE2cf eSIYI61cgaSS5iC69R/I6jRF8mohd7fjTiTTs74iF1HOUpWQqmOto1YUlmzEqpIuSf3Q nocg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=pNQHbpdQq8Hs9RE9JaZD23rS1cFATTlFz6uPZLw9Udc=; b=dQgybK2R9UJyCNZoSEt/uqCMsNNhBqbR0VcGir75zdXw7nh2jgYRLcAywh/OkceQRY M4xNWOfkbEK6V7xp2PnPikJPq7GnRGKd84G1eERmzeHJQfpWmM4ZfAbZtBRqQYnzUhnN nyscppIfTAPzBQjvlL7DOhy4JM/VxNy0VPgG0TOrBeiXnBmNCB6uJc2mNJxylmYcIa1a UIM2rfR23d9Svzpa6sOXCzDhQKMq/PMWDXU7lJ+0fXjA3qfOj0lOnkrTjv98Q5iPo1W9 trU8odH+6a8KRiCYjXMIugOkFYJYugRUtcb3EQ5Z55y+mAMzpfUJH36JS8HUdxzhAVHM 5a9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si1862319pfa.58.2018.02.02.05.51.26; Fri, 02 Feb 2018 05:51:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752077AbeBBNt0 (ORCPT + 99 others); Fri, 2 Feb 2018 08:49:26 -0500 Received: from mga07.intel.com ([134.134.136.100]:38331 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751931AbeBBNtC (ORCPT ); Fri, 2 Feb 2018 08:49:02 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 05:49:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,448,1511856000"; d="scan'208";a="14968329" Received: from raj-desk2.iind.intel.com ([10.223.107.30]) by orsmga008.jf.intel.com with ESMTP; 02 Feb 2018 05:48:59 -0800 From: Rajneesh Bhardwaj To: platform-driver-x86@vger.kernel.org Cc: dvhart@infradead.org, andy@infradead.org, linux-kernel@vger.kernel.org, vishwanath.somayaji@intel.com, srinivas.pandruvada@linux.intel.com, Rajneesh Bhardwaj Subject: [Patch v2 2/5] platform/x86: intel_pmc_core: Read base address from LPIT Date: Fri, 2 Feb 2018 19:13:34 +0530 Message-Id: <1517579017-19935-3-git-send-email-rajneesh.bhardwaj@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517579017-19935-1-git-send-email-rajneesh.bhardwaj@intel.com> References: <1517579017-19935-1-git-send-email-rajneesh.bhardwaj@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Pandruvada Read SLP_S0 address from ACPI LPIT table when present and use PMC specific SLP_S0 offset to get the base address of PMC MMIO. Signed-off-by: Rajneesh Bhardwaj Signed-off-by: Srinivas Pandruvada --- drivers/platform/x86/intel_pmc_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index 5c401e17cfb6..bb80aed4c3c1 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -20,6 +20,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -455,6 +456,7 @@ static int __init pmc_core_probe(void) { struct pmc_dev *pmcdev = &pmc; const struct x86_cpu_id *cpu_id; + u64 slp_s0_addr; int err; cpu_id = x86_match_cpu(intel_pmc_core_ids); @@ -462,7 +464,12 @@ static int __init pmc_core_probe(void) return -ENODEV; pmcdev->map = (struct pmc_reg_map *)cpu_id->driver_data; - pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT; + + if (lpit_read_residency_count_address(&slp_s0_addr)) + pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT; + else + pmcdev->base_addr = slp_s0_addr - pmcdev->map->slp_s0_offset; + pmcdev->regbase = ioremap(pmcdev->base_addr, pmcdev->map->regmap_length); if (!pmcdev->regbase) -- 2.7.4