Lines Matching +full:cpu +full:- +full:read
1 // SPDX-License-Identifier: GPL-2.0
19 * Will return 0 on success and -1 on failure.
21 * EFAULT -If the read/write did not fully complete
22 * EIO -If the CPU does not support MSRs
23 * ENXIO -If the CPU does not exist
26 int read_msr(int cpu, unsigned int idx, unsigned long long *val) in read_msr() argument
31 sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu); in read_msr()
34 return -1; in read_msr()
35 if (lseek(fd, idx, SEEK_CUR) == -1) in read_msr()
37 if (read(fd, val, sizeof *val) != sizeof *val) in read_msr()
43 return -1; in read_msr()
49 * Will return 0 on success and -1 on failure.
51 * EFAULT -If the read/write did not fully complete
52 * EIO -If the CPU does not support MSRs
53 * ENXIO -If the CPU does not exist
55 int write_msr(int cpu, unsigned int idx, unsigned long long val) in write_msr() argument
60 sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu); in write_msr()
63 return -1; in write_msr()
64 if (lseek(fd, idx, SEEK_CUR) == -1) in write_msr()
72 return -1; in write_msr()
75 unsigned long long msr_intel_get_turbo_ratio(unsigned int cpu) in msr_intel_get_turbo_ratio() argument
81 return -1; in msr_intel_get_turbo_ratio()
83 ret = read_msr(cpu, MSR_NEHALEM_TURBO_RATIO_LIMIT, &val); in msr_intel_get_turbo_ratio()