Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux Provide cpufreq.h



details:   https://anonhg.NetBSD.org/src/rev/473e3cea0e8f
branches:  trunk
changeset: 1028690:473e3cea0e8f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:46:30 2021 +0000

description:
Provide cpufreq.h


Author: Maya Rashish <maya%NetBSD.org@localhost>
Committer: Taylor R Campbell <riastradh%NetBSD.org@localhost>

diffstat:

 sys/external/bsd/drm2/include/linux/cpufreq.h |  29 ++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diffs (41 lines):

diff -r c145dbe5c101 -r 473e3cea0e8f sys/external/bsd/drm2/include/linux/cpufreq.h
--- a/sys/external/bsd/drm2/include/linux/cpufreq.h     Sun Dec 19 11:46:19 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/cpufreq.h     Sun Dec 19 11:46:30 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufreq.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $    */
+/*     $NetBSD: cpufreq.h,v 1.3 2021/12/19 11:46:30 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,31 @@
 #ifndef _LINUX_CPUFREQ_H_
 #define _LINUX_CPUFREQ_H_
 
+#include <sys/cpufreq.h>
+#include <sys/kmem.h>
+#include <machine/cpu.h>
+#include <machine/cpu_counter.h>
+
+struct cpufreq_policy {
+       struct {
+               unsigned int max_freq;
+       } cpuinfo;
+};
+
+static inline struct cpufreq_policy *
+cpufreq_cpu_get(int x)
+{
+       struct cpufreq_policy *policy = kmem_alloc(sizeof(*policy), KM_SLEEP);
+       policy->cpuinfo.max_freq = cpufreq_get(curcpu());
+       return policy;
+}
+
+static inline void
+cpufreq_cpu_put(struct cpufreq_policy *policy)
+{
+       kmem_free(policy, sizeof(*policy));
+}
+
+#define tsc_khz cpu_frequency(curcpu())
+
 #endif  /* _LINUX_CPUFREQ_H_ */



Home | Main Index | Thread Index | Old Index