2 * cppc_msr.c: MSR Interface for CPPC
3 * Copyright (c) 2016, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 #include <acpi/cppc_acpi.h>
19 /* Refer to drivers/acpi/cppc_acpi.c for the description of functions */
21 bool cpc_ffh_supported(void)
26 int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val)
30 err = rdmsrl_safe_on_cpu(cpunum, reg->address, val);
32 u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
36 *val >>= reg->bit_offset;
41 int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val)
46 err = rdmsrl_safe_on_cpu(cpunum, reg->address, &rd_val);
48 u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
51 val <<= reg->bit_offset;
55 err = wrmsrl_safe_on_cpu(cpunum, reg->address, rd_val);