This source file includes following definitions.
- cpc_ffh_supported
- cpc_read_ffh
- cpc_write_ffh
1
2
3
4
5
6
7 #include <acpi/cppc_acpi.h>
8 #include <asm/msr.h>
9
10
11
12 bool cpc_ffh_supported(void)
13 {
14 return true;
15 }
16
17 int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val)
18 {
19 int err;
20
21 err = rdmsrl_safe_on_cpu(cpunum, reg->address, val);
22 if (!err) {
23 u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
24 reg->bit_offset);
25
26 *val &= mask;
27 *val >>= reg->bit_offset;
28 }
29 return err;
30 }
31
32 int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val)
33 {
34 u64 rd_val;
35 int err;
36
37 err = rdmsrl_safe_on_cpu(cpunum, reg->address, &rd_val);
38 if (!err) {
39 u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
40 reg->bit_offset);
41
42 val <<= reg->bit_offset;
43 val &= mask;
44 rd_val &= ~mask;
45 rd_val |= val;
46 err = wrmsrl_safe_on_cpu(cpunum, reg->address, rd_val);
47 }
48 return err;
49 }