Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Sep 2016 13:38:46 +0000 (UTC)
From:      Michael Zhilin <mizhka@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r305196 - head/sys/dev/bhnd/cores/pmu
Message-ID:  <201609011338.u81Dckc0085583@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609011338.u81Dckc0085583>