All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
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 <rajneesh.bhardwaj@intel.com>
Subject: [Patch v2 2/5] platform/x86: intel_pmc_core: Read base address from LPIT
Date: Fri,  2 Feb 2018 19:13:34 +0530	[thread overview]
Message-ID: <1517579017-19935-3-git-send-email-rajneesh.bhardwaj@intel.com> (raw)
In-Reply-To: <1517579017-19935-1-git-send-email-rajneesh.bhardwaj@intel.com>

From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

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 <rajneesh.bhardwaj@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 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 <linux/acpi.h>
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/io.h>
@@ -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

  parent reply	other threads:[~2018-02-02 13:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 13:43 [Patch v2 0/5] platform/x86: intel_pmc_core: Add CFL/CNL Support Rajneesh Bhardwaj
2018-02-02 13:43 ` [Patch v2 1/5] ACPI / LPIT: Export lpit_read_residency_count_address() Rajneesh Bhardwaj
2018-02-02 13:43 ` Rajneesh Bhardwaj [this message]
2018-02-02 13:43 ` [Patch v2 3/5] x86/cpu: Add Cannonlake to Intel family Rajneesh Bhardwaj
2018-02-02 13:43 ` [Patch v2 4/5] platform/x86: intel_pmc_core: Add CannonLake PCH support Rajneesh Bhardwaj
2018-02-02 13:43 ` [Patch v2 5/5] platform/x86: intel_pmc_core: Special case for Coffeelake Rajneesh Bhardwaj
2018-02-02 20:14 ` [Patch v2 0/5] platform/x86: intel_pmc_core: Add CFL/CNL Support Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517579017-19935-3-git-send-email-rajneesh.bhardwaj@intel.com \
    --to=rajneesh.bhardwaj@intel.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=vishwanath.somayaji@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.