svn commit: r305196 - head/sys/dev/bhnd/cores/pmu

Michael Zhilin mizhka at FreeBSD.org
Thu Sep 1 13:38:47 UTC 2016


Author: mizhka
Date: Thu Sep  1 13:38:46 2016
New Revision: 305196
URL: https://svnweb.freebsd.org/changeset/base/305196

Log:
  [BHND/PMU] Correct shift of bits in BHND_PMU_SET_BITS macro
  
  The purpose of BHND_PMU_{GET,SET}_BITS macro is to transform values from/into
  register format. SET macro shifts value to left and applies filter mask.
  GET macro applies filter mask and then shifts value to right.
  
  Reviewed by:    landonf, adrian (mentor)
  Approved by:    adrian (mentor)
  Differential Revision: https://reviews.freebsd.org/D7721

Modified:
  head/sys/dev/bhnd/cores/pmu/bhnd_pmureg.h

Modified: head/sys/dev/bhnd/cores/pmu/bhnd_pmureg.h
==============================================================================
--- head/sys/dev/bhnd/cores/pmu/bhnd_pmureg.h	Thu Sep  1 13:29:53 2016	(r305195)
+++ head/sys/dev/bhnd/cores/pmu/bhnd_pmureg.h	Thu Sep  1 13:38:46 2016	(r305196)
@@ -30,7 +30,7 @@
 #define	BHND_PMU_GET_BITS(_value, _field)	\
 	(((_value) & _field ## _MASK) >> _field ## _SHIFT)
 #define	BHND_PMU_SET_BITS(_value, _field)	\
-	(((_value) & _field ## _MASK) >> _field ## _SHIFT)
+	(((_value) << _field ## _SHIFT) & _field ## _MASK)
 
 #define	BHND_PMU_ILP_CLOCK	32000		/**< default ILP freq */
 #define	BHND_PMU_ALP_CLOCK	20000000	/**< default ALP freq */


More information about the svn-src-all mailing list