Patchwork number of core of AMD fam10

login
register
about
Submitter Bao, Zheng
Date 2011-04-18 07:02:09
Message ID <DD1CC71B621B004FA76856E5129D6B1704D7C86D@sbjgexmb1.amd.com>
Download mbox | patch
Permalink /patch/2885/
State Accepted
Headers show

Comments

Bao, Zheng - 2011-04-18 07:02:09
The "temp" will be used later. So it has to be calculated correctly.
 
Signed-off-by: Zheng Bao <zheng.bao@amd.com>
The "temp" will be used later. So it has to be calculated correctly.

Signed-off-by: Zheng Bao <zheng.bao@amd.com>
Acked-by: 

Index: src/northbridge/amd/amdht/h3ncmn.c
===================================================================
--- src/northbridge/amd/amdht/h3ncmn.c	(revision 6512)
+++ src/northbridge/amd/amdht/h3ncmn.c	(working copy)
@@ -565,7 +565,8 @@
 
 	/* bits[15,13,12] specify the cores */
 	/* Support Downcoring */
-	cores = ((temp & 8) >> 1) + (temp & 3) + 1;
+	temp = ((temp & 8) >> 1) + (temp & 3);
+	cores = temp + 1;
 	AmdPCIReadBits (MAKE_SBDFO(makePCISegmentFromNode(node),
 					makePCIBusFromNode(node),
 					makePCIDeviceFromNode(node),
Marc Jones - 2011-04-18 18:26:19
On Mon, Apr 18, 2011 at 1:02 AM, Bao, Zheng <Zheng.Bao@amd.com> wrote:
> The "temp" will be used later. So it has to be calculated correctly.
>
> Signed-off-by: Zheng Bao <zheng.bao@amd.com>
>
>
>
> Index: src/northbridge/amd/amdht/h3ncmn.c
> ===================================================================
> --- src/northbridge/amd/amdht/h3ncmn.c (revision 6512)
> +++ src/northbridge/amd/amdht/h3ncmn.c (working copy)
> @@ -565,7 +565,8 @@
>
>   /* bits[15,13,12] specify the cores */
>   /* Support Downcoring */
> - cores = ((temp & 8) >> 1) + (temp & 3) + 1;
> + temp = ((temp & 8) >> 1) + (temp & 3);
> + cores = temp + 1;
>   AmdPCIReadBits (MAKE_SBDFO(makePCISegmentFromNode(node),
>       makePCIBusFromNode(node),
>       makePCIDeviceFromNode(node),

Acked-by: Marc Jones <marcj303@gmail.com>
Peter Stuge - 2011-04-18 23:06:07
Bao, Zheng wrote:
> The "temp" will be used later. So it has to be calculated correctly.
..
> +++ src/northbridge/amd/amdht/h3ncmn.c	(working copy)
> @@ -565,7 +565,8 @@
>  
>  	/* bits[15,13,12] specify the cores */
>  	/* Support Downcoring */
> -	cores = ((temp & 8) >> 1) + (temp & 3) + 1;
> +	temp = ((temp & 8) >> 1) + (temp & 3);
> +	cores = temp + 1;

The variable name "temp" unfortunately does not explain what the
value is. The commit message also does not have hints.

Hopefully in the future it's possible to also use a brief moment to
improve the clarity of the code, while it is already being fixed for
some other reason. Ie. fixing up variable names, writing particularly
informative commit messages, or of course both at the same time! :)


//Peter

Patch

Index: src/northbridge/amd/amdht/h3ncmn.c
===================================================================
--- src/northbridge/amd/amdht/h3ncmn.c (revision 6512)
+++ src/northbridge/amd/amdht/h3ncmn.c (working copy)
@@ -565,7 +565,8 @@ 
 
  /* bits[15,13,12] specify the cores */
  /* Support Downcoring */
- cores = ((temp & 8) >> 1) + (temp & 3) + 1;
+ temp = ((temp & 8) >> 1) + (temp & 3);
+ cores = temp + 1;
  AmdPCIReadBits (MAKE_SBDFO(makePCISegmentFromNode(node),
      makePCIBusFromNode(node),
      makePCIDeviceFromNode(node),