svn commit: r336476 - in head/sys/arm: arm include

Emmanuel Vadot manu at FreeBSD.org
Thu Jul 19 11:27:12 UTC 2018


Author: manu
Date: Thu Jul 19 11:27:11 2018
New Revision: 336476
URL: https://svnweb.freebsd.org/changeset/base/336476

Log:
  arm: Implement cpu_est_clockrate for armv[67]

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/include/pcpu.h

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c	Thu Jul 19 10:14:52 2018	(r336475)
+++ head/sys/arm/arm/machdep.c	Thu Jul 19 11:27:11 2018	(r336476)
@@ -272,8 +272,22 @@ cpu_flush_dcache(void *ptr, size_t len)
 int
 cpu_est_clockrate(int cpu_id, uint64_t *rate)
 {
+#if __ARM_ARCH >= 6
+	struct pcpu *pc;
 
+	pc = pcpu_find(cpu_id);
+	if (pc == NULL || rate == NULL)
+		return (EINVAL);
+
+	if (pc->pc_clock == 0)
+		return (EOPNOTSUPP);
+
+	*rate = pc->pc_clock;
+
+	return (0);
+#else
 	return (ENXIO);
+#endif
 }
 
 void

Modified: head/sys/arm/include/pcpu.h
==============================================================================
--- head/sys/arm/include/pcpu.h	Thu Jul 19 10:14:52 2018	(r336475)
+++ head/sys/arm/include/pcpu.h	Thu Jul 19 11:27:11 2018	(r336476)
@@ -65,7 +65,8 @@ struct vmspace;
 	int pc_dbreg_cmd;						\
 	int pc_bp_harden_kind;						\
 	uint32_t pc_original_actlr;					\
-	char __pad[147]
+	uint64_t pc_clock;						\
+	char __pad[139]
 #else
 #define PCPU_MD_FIELDS							\
 	char __pad[93]


More information about the svn-src-all mailing list