Skip to content

Commit

Permalink
platform/x86: intel_pmc_core: Read base address from LPIT
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
Srinivas Pandruvada authored and Andy Shevchenko committed Feb 4, 2018
1 parent 9383bba commit 745698c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/platform/x86/intel_pmc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -455,14 +456,20 @@ 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);
if (!cpu_id)
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)
Expand Down

0 comments on commit 745698c

Please sign in to comment.