Skip to contentSkip to conversation

Powperpc:u-boot: Fix bug created due to use of __ffs64() in place of custom ffs64()

PATCH New Ashish Kumar 3 participants 3 messages Jan 22, 2016 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Powperpc:u-boot: Fix bug created due to use of __ffs64() in place of custom ffs64()

* Return value of ffs64() different to that of __ffs64(),

    ffs64(0x80000000) = 0x20
    __ffs64(0x80000000) = 0x1f,

as result of this change -1 from start_align needs to be removed.
* Incorrect DDR law was created in case of B4860qds
* Tested on B4860qds and T1040

---
 arch/powerpc/cpu/mpc83xx/law.c |    4 ++--
 arch/powerpc/cpu/mpc8xxx/law.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/cpu/mpc83xx/law.c +2 -2
index 262ae7f..ae9cba8 100644
@@ -21,7 +21,7 @@ int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id)
 	if (start == 0)
 		start_align = 1ull << (LAW_SIZE_2G + 1);
 	else
-		start_align = 1ull << (__ffs64(start) - 1);
+		start_align = 1ull << (__ffs64(start));
 	law_sz = min(start_align, sz);
 	law_sz_enc = __ilog2_u64(law_sz) - 1;
 
@@ -41,7 +41,7 @@ int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id)
 	if (sz) {
 		start += law_sz;
 
-		start_align = 1ull << (__ffs64(start) - 1);
+		start_align = 1ull << (__ffs64(start));
 		law_sz = min(start_align, sz);
 		law_sz_enc = __ilog2_u64(law_sz) - 1;
 		ecm = &immap->sysconf.ddrlaw[1];
arch/powerpc/cpu/mpc8xxx/law.c +2 -2
index 24baad4..bd79297 100644
@@ -188,7 +188,7 @@ int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id)
 	if (start == 0)
 		start_align = 1ull << (LAW_SIZE_32G + 1);
 	else
-		start_align = 1ull << (__ffs64(start) - 1);
+		start_align = 1ull << (__ffs64(start));
 	law_sz = min(start_align, sz);
 	law_sz_enc = __ilog2_u64(law_sz) - 1;
 
@@ -203,7 +203,7 @@ int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id)
 	if (sz) {
 		start += law_sz;
 
-		start_align = 1ull << (__ffs64(start) - 1);
+		start_align = 1ull << (__ffs64(start));
 		law_sz = min(start_align, sz);
 		law_sz_enc = __ilog2_u64(law_sz) - 1;
 
Signature · 1 line
1.7.6.GIT
#1 lore raw

PATCH 1/1 Powperpc:u-boot: Fix bug created due to use of __ffs64() in place of custom ffs64()

Quoted 8 lines

-----Original Message-----
From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Ashish Kumar
Sent: Friday, January 22, 2016 1:42 PM
To: u-boot at lists.denx.de; york sun <[email protected]>
Subject: [U-Boot] [PATCH] Powperpc:u-boot: Fix bug created due to use of __ffs64() in place of custom ffs64()

Please rephrase the subject

Quoted 8 lines

* Return value of ffs64() different to that of __ffs64(),

    ffs64(0x80000000) = 0x20
    __ffs64(0x80000000) = 0x1f,

as result of this change -1 from start_align needs to be removed.
* Incorrect DDR law was created in case of B4860qds
* Tested on B4860qds and T1040

Please move TEST info after "---"

--prabhakar

#2 lore raw

PATCH 1/1 Powperpc:u-boot: Fix bug created due to use of __ffs64() in place of custom ffs64()

In reply to Ashish Kumar
Quoted 9 lines · Ashish Kumar

* Return value of ffs64() different to that of __ffs64(),

    ffs64(0x80000000) = 0x20
    __ffs64(0x80000000) = 0x1f,

as result of this change -1 from start_align needs to be removed.
* Incorrect DDR law was created in case of B4860qds
* Tested on B4860qds and T1040

---

Please fix the subject line and reference the original commit changing ffs64.

York