Skip to contentSkip to conversation

ftd_support: Fix regression causes by "fdt: Try to use fdt_address_cells()/fdt_size_cells()"

PATCH New Hans de Goede 5 participants 6 messages Nov 27, 2014 – Nov 30, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ftd_support: Fix regression causes by "fdt: Try to use fdt_address_cells()/fdt_size_cells()"

After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()" I noticed that allwinner boards would no longer boot.

Switching to fdt_address_cells / fdt_size_cells changes the result from bytes to 32 bit words, so when we increment pointers into the blob, we must do so by 32 bit words now.

This commit makes allwinner boards boot again.

---
 common/fdt_support.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/fdt_support.c +2 -2
index ea42c63..9e84937 100644
@@ -379,13 +379,13 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
 			*(fdt64_t *)p = cpu_to_fdt64(address[i]);
 		else
 			*(fdt32_t *)p = cpu_to_fdt32(address[i]);
-		p += address_len;
+		p += 4 * address_len;
 
 		if (size_len == 2)
 			*(fdt64_t *)p = cpu_to_fdt64(size[i]);
 		else
 			*(fdt32_t *)p = cpu_to_fdt32(size[i]);
-		p += size_len;
+		p += 4 * size_len;
 	}
 
 	return p - (char *)buf;
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 ftd_support: Fix regression causes by "fdt: Try to use fdt_address_cells()/fdt_size_cells()"

Hi Hans,

Quoted 10 lines · Hans de Goede

After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()" I noticed that allwinner boards would no longer boot.

Switching to fdt_address_cells / fdt_size_cells changes the result from bytes to 32 bit words, so when we increment pointers into the blob, we must do so by 32 bit words now.

This commit makes allwinner boards boot again.

Thanks for the patch.

Nit time - can you please tweak the patch subject? Should be fdt: for the tag and try to keep under 60 chars, so something like "fdt: Fix regression in fdt_pack_reg()"

Regards,
Simon

#2 lore raw

PATCH 1/1 ftd_support: Fix regression causes by "fdt: Try to use fdt_address_cells()/fdt_size_cells()"

Quoted 12 lines · Simon Glass

Hi Hans,

Quoted 9 lines · Hans de Goede

After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()" I noticed that allwinner boards would no longer boot.

Switching to fdt_address_cells / fdt_size_cells changes the result from bytes to 32 bit words, so when we increment pointers into the blob, we must do so by 32 bit words now.

This commit makes allwinner boards boot again.

Quoted 7 lines
Quoted 1 line

Thanks for the patch.

Nit time - can you please tweak the patch subject? Should be fdt: for the tag and try to keep under 60 chars, so something like "fdt: Fix regression in fdt_pack_reg()"

Should have said I'm happy to do then when I apply it if you prefer.

- Simon

#3 lore raw

PATCH 1/1 ftd_support: Fix regression causes by "fdt: Try to use fdt_address_cells()/fdt_size_cells()"

In reply to Hans de Goede
Quoted 25 lines · Hans de Goede

After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()" I noticed that allwinner boards would no longer boot.

Switching to fdt_address_cells / fdt_size_cells changes the result from bytes to 32 bit words, so when we increment pointers into the blob, we must do so by 32 bit words now.

This commit makes allwinner boards boot again.

---
 common/fdt_support.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/fdt_support.c +1 -1
index ea42c63..9e84937 100644
@@ -379,13 +379,13 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
 			*(fdt64_t *)p = cpu_to_fdt64(address[i]);
 		else
 			*(fdt32_t *)p = cpu_to_fdt32(address[i]);
-		p += address_len;
+		p += 4 * address_len;

common/fdt_support.c static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size, · line 391

Quoted 10 lines
common/fdt_support.c +1 -1
 
 		if (size_len == 2)
 			*(fdt64_t *)p = cpu_to_fdt64(size[i]);
 		else
 			*(fdt32_t *)p = cpu_to_fdt32(size[i]);
-		p += size_len;
+		p += 4 * size_len;
 	}
 
 	return p - (char *)buf;

Just debugged this as well...

I would suggest to fix the variable names, too: address_cells and size_cells.

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141128/90e6294d/attachment.pgp>

#4 lore raw

PATCH 1/1 ftd_support: Fix regression causes by "fdt: Try to use fdt_address_cells()/fdt_size_cells()"

Hi.

Quoted 11 lines · Hans de Goede
Quoted 10 lines

After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()" I noticed that allwinner boards would no longer boot.

Switching to fdt_address_cells / fdt_size_cells changes the result from bytes to 32 bit words, so when we increment pointers into the blob, we must do so by 32 bit words now.

This commit makes allwinner boards boot again.

This patch solved my Linux-boot problem as well.

Quoted 3 lines

I would suggest to fix the variable names, too: address_cells and size_cells.

Agreed.

Best Regards
Masahiro Yamada

#5 lore raw

PATCH 1/1 ftd_support: Fix regression causes by "fdt: Try to use fdt_address_cells()/fdt_size_cells()"

In reply to Hans de Goede
Quoted 8 lines · Hans de Goede

After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()" I noticed that allwinner boards would no longer boot.

Switching to fdt_address_cells / fdt_size_cells changes the result from bytes to 32 bit words, so when we increment pointers into the blob, we must do so by 32 bit words now.

This commit makes allwinner boards boot again.

This fixes kernel booting on the RPi too.