mirror of
https://github.com/cyring/CoreFreq.git
synced 2025-07-23 12:13:07 +02:00
[Kernel][6.15] Fix missing cpufreq_get_policy
and asm/amd/nb.h
This commit is contained in:
@@ -2298,6 +2298,26 @@ static PROCESSOR_SPECIFIC *LookupProcessor(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_CPU_FREQ
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
|
||||||
|
static int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
|
||||||
|
{
|
||||||
|
struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
|
||||||
|
|
||||||
|
if (!policy)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
cpu_policy = cpufreq_cpu_get(cpu);
|
||||||
|
if (!cpu_policy)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
memcpy(policy, cpu_policy, sizeof(*policy));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* CONFIG_CPU_FREQ */
|
||||||
|
|
||||||
static void Query_DeviceTree(unsigned int cpu)
|
static void Query_DeviceTree(unsigned int cpu)
|
||||||
{
|
{
|
||||||
CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
|
CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
|
||||||
@@ -2308,7 +2328,7 @@ static void Query_DeviceTree(unsigned int cpu)
|
|||||||
unsigned int max_freq = 0, min_freq = 0, cur_freq = 0;
|
unsigned int max_freq = 0, min_freq = 0, cur_freq = 0;
|
||||||
COF_ST COF;
|
COF_ST COF;
|
||||||
#ifdef CONFIG_CPU_FREQ
|
#ifdef CONFIG_CPU_FREQ
|
||||||
if (cpufreq_get_policy(pFreqPolicy,cpu) == 0)
|
if (cpufreq_get_policy(pFreqPolicy, cpu) == 0)
|
||||||
{
|
{
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
||||||
struct cpufreq_frequency_table *table;
|
struct cpufreq_frequency_table *table;
|
||||||
@@ -3933,7 +3953,7 @@ static long Sys_OS_Driver_Query(void)
|
|||||||
StrCopy(PUBLIC(RO(Proc))->OS.FreqDriver.Name,
|
StrCopy(PUBLIC(RO(Proc))->OS.FreqDriver.Name,
|
||||||
pFreqDriver, CPUFREQ_NAME_LEN);
|
pFreqDriver, CPUFREQ_NAME_LEN);
|
||||||
}
|
}
|
||||||
if ((rc=cpufreq_get_policy(pFreqPolicy,PUBLIC(RO(Proc))->Service.Core)) == 0)
|
if ((rc=cpufreq_get_policy(pFreqPolicy, PUBLIC(RO(Proc))->Service.Core)) == 0)
|
||||||
{
|
{
|
||||||
struct cpufreq_governor *pGovernor = pFreqPolicy->governor;
|
struct cpufreq_governor *pGovernor = pFreqPolicy->governor;
|
||||||
if (pGovernor != NULL) {
|
if (pGovernor != NULL) {
|
||||||
|
@@ -958,6 +958,26 @@ static PROCESSOR_SPECIFIC *LookupProcessor(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_CPU_FREQ
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
|
||||||
|
static int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
|
||||||
|
{
|
||||||
|
struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
|
||||||
|
|
||||||
|
if (!policy)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
cpu_policy = cpufreq_cpu_get(cpu);
|
||||||
|
if (!cpu_policy)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
memcpy(policy, cpu_policy, sizeof(*policy));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* CONFIG_CPU_FREQ */
|
||||||
|
|
||||||
static void Query_DeviceTree(unsigned int cpu)
|
static void Query_DeviceTree(unsigned int cpu)
|
||||||
{
|
{
|
||||||
CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
|
CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
|
||||||
@@ -968,7 +988,7 @@ static void Query_DeviceTree(unsigned int cpu)
|
|||||||
unsigned int max_freq = 0, min_freq = 0, cur_freq = 0;
|
unsigned int max_freq = 0, min_freq = 0, cur_freq = 0;
|
||||||
COF_ST COF;
|
COF_ST COF;
|
||||||
#ifdef CONFIG_CPU_FREQ
|
#ifdef CONFIG_CPU_FREQ
|
||||||
if (cpufreq_get_policy(pFreqPolicy,cpu) == 0)
|
if (cpufreq_get_policy(pFreqPolicy, cpu) == 0)
|
||||||
{
|
{
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
||||||
struct cpufreq_frequency_table *table;
|
struct cpufreq_frequency_table *table;
|
||||||
@@ -2290,7 +2310,7 @@ static long Sys_OS_Driver_Query(void)
|
|||||||
StrCopy(PUBLIC(RO(Proc))->OS.FreqDriver.Name,
|
StrCopy(PUBLIC(RO(Proc))->OS.FreqDriver.Name,
|
||||||
pFreqDriver, CPUFREQ_NAME_LEN);
|
pFreqDriver, CPUFREQ_NAME_LEN);
|
||||||
}
|
}
|
||||||
if ((rc=cpufreq_get_policy(pFreqPolicy,PUBLIC(RO(Proc))->Service.Core)) == 0)
|
if ((rc=cpufreq_get_policy(pFreqPolicy, PUBLIC(RO(Proc))->Service.Core)) == 0)
|
||||||
{
|
{
|
||||||
struct cpufreq_governor *pGovernor = pFreqPolicy->governor;
|
struct cpufreq_governor *pGovernor = pFreqPolicy->governor;
|
||||||
if (pGovernor != NULL) {
|
if (pGovernor != NULL) {
|
||||||
|
@@ -942,6 +942,26 @@ static PROCESSOR_SPECIFIC *LookupProcessor(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_CPU_FREQ
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
|
||||||
|
static int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
|
||||||
|
{
|
||||||
|
struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
|
||||||
|
|
||||||
|
if (!policy)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
cpu_policy = cpufreq_cpu_get(cpu);
|
||||||
|
if (!cpu_policy)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
memcpy(policy, cpu_policy, sizeof(*policy));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* CONFIG_CPU_FREQ */
|
||||||
|
|
||||||
static void Query_DeviceTree(unsigned int cpu)
|
static void Query_DeviceTree(unsigned int cpu)
|
||||||
{
|
{
|
||||||
CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
|
CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
|
||||||
@@ -952,7 +972,7 @@ static void Query_DeviceTree(unsigned int cpu)
|
|||||||
unsigned int max_freq = 0, min_freq = 0, cur_freq = 0;
|
unsigned int max_freq = 0, min_freq = 0, cur_freq = 0;
|
||||||
COF_ST COF;
|
COF_ST COF;
|
||||||
#ifdef CONFIG_CPU_FREQ
|
#ifdef CONFIG_CPU_FREQ
|
||||||
if (cpufreq_get_policy(pFreqPolicy,cpu) == 0)
|
if (cpufreq_get_policy(pFreqPolicy, cpu) == 0)
|
||||||
{
|
{
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
||||||
struct cpufreq_frequency_table *table;
|
struct cpufreq_frequency_table *table;
|
||||||
@@ -2277,7 +2297,7 @@ static long Sys_OS_Driver_Query(void)
|
|||||||
StrCopy(PUBLIC(RO(Proc))->OS.FreqDriver.Name,
|
StrCopy(PUBLIC(RO(Proc))->OS.FreqDriver.Name,
|
||||||
pFreqDriver, CPUFREQ_NAME_LEN);
|
pFreqDriver, CPUFREQ_NAME_LEN);
|
||||||
}
|
}
|
||||||
if ((rc=cpufreq_get_policy(pFreqPolicy,PUBLIC(RO(Proc))->Service.Core)) == 0)
|
if ((rc=cpufreq_get_policy(pFreqPolicy, PUBLIC(RO(Proc))->Service.Core)) == 0)
|
||||||
{
|
{
|
||||||
struct cpufreq_governor *pGovernor = pFreqPolicy->governor;
|
struct cpufreq_governor *pGovernor = pFreqPolicy->governor;
|
||||||
if (pGovernor != NULL) {
|
if (pGovernor != NULL) {
|
||||||
|
@@ -53,8 +53,12 @@
|
|||||||
#endif /* CONFIG_XEN */
|
#endif /* CONFIG_XEN */
|
||||||
#include <asm/mwait.h>
|
#include <asm/mwait.h>
|
||||||
#ifdef CONFIG_AMD_NB
|
#ifdef CONFIG_AMD_NB
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
|
||||||
|
#include <asm/amd/nb.h>
|
||||||
|
#else
|
||||||
#include <asm/amd_nb.h>
|
#include <asm/amd_nb.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* CONFIG_AMD_NB */
|
||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
#include <linux/acpi.h>
|
#include <linux/acpi.h>
|
||||||
#include <acpi/processor.h>
|
#include <acpi/processor.h>
|
||||||
@@ -20826,6 +20830,26 @@ static void Stop_Uncore_AMD_Family_17h(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_CPU_FREQ
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
|
||||||
|
static int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
|
||||||
|
{
|
||||||
|
struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
|
||||||
|
|
||||||
|
if (!policy)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
cpu_policy = cpufreq_cpu_get(cpu);
|
||||||
|
if (!cpu_policy)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
memcpy(policy, cpu_policy, sizeof(*policy));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* CONFIG_CPU_FREQ */
|
||||||
|
|
||||||
static long Sys_OS_Driver_Query(void)
|
static long Sys_OS_Driver_Query(void)
|
||||||
{
|
{
|
||||||
int rc = RC_SUCCESS;
|
int rc = RC_SUCCESS;
|
||||||
|
Reference in New Issue
Block a user