Skip to contentSkip to conversation

common: board_f: Dont relocate FDT incase of CONFIG_OF_EMBED

PATCH Superseded Michal Simek 4 participants 8 messages Nov 27, 2015 – Dec 1, 2015

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 common: board_f: Dont relocate FDT incase of CONFIG_OF_EMBED

From: Siva Durga Prasad Paladugu <[email protected]>

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is already embedded with u-boot image. Also update the fdt_blob correctly in this case

---

Changes in v2:
- Fix commit message reported by Alexey

 common/board_f.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
common/board_f.c +9 -2
index b035c90ff3b7..91bf8beea1c6 100644
@@ -508,7 +508,7 @@ static int reserve_global_data(void)
 	return 0;
 }
 
-static int reserve_fdt(void)
+static int __maybe_unused reserve_fdt(void)
 {
 	/*
 	 * If the device tree is sitting immediately above our image then we
@@ -658,7 +658,7 @@ static int setup_dram_config(void)
 	return 0;
 }
 
-static int reloc_fdt(void)
+static int __maybe_unused reloc_fdt(void)
 {
 	if (gd->flags & GD_FLG_SKIP_RELOC)
 		return 0;
@@ -687,6 +687,9 @@ static int setup_reloc(void)
 	gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
 #endif
 #endif
+#ifdef CONFIG_OF_EMBED
+	gd->fdt_blob += gd->reloc_off;
+#endif
 	memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
 
 	debug("Relocation Offset is: %08lx\n", gd->reloc_off);
@@ -938,7 +941,9 @@ static init_fnc_t init_sequence_f[] = {
 #endif
 	setup_machine,
 	reserve_global_data,
+#ifndef CONFIG_OF_EMBED
 	reserve_fdt,
+#endif
 	reserve_arch,
 	reserve_stacks,
 	setup_dram_config,
@@ -955,7 +960,9 @@ static init_fnc_t init_sequence_f[] = {
 	setup_board_extra,
 #endif
 	INIT_FUNC_WATCHDOG_RESET
+#ifndef CONFIG_OF_EMBED
 	reloc_fdt,
+#endif
 	setup_reloc,
 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
 	copy_uboot_to_ram,
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 common: board_f: Dont relocate FDT incase of CONFIG_OF_EMBED

Quoted 60 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is already embedded with u-boot image. Also update the fdt_blob correctly in this case

---

Changes in v2:
- Fix commit message reported by Alexey

 common/board_f.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
common/board_f.c +7 -2
index b035c90ff3b7..91bf8beea1c6 100644
@@ -508,7 +508,7 @@ static int reserve_global_data(void)
        return 0;
 }
 
-static int reserve_fdt(void)
+static int __maybe_unused reserve_fdt(void)
 {
        /*
         * If the device tree is sitting immediately above our image then we
@@ -658,7 +658,7 @@ static int setup_dram_config(void)
        return 0;
 }
 
-static int reloc_fdt(void)
+static int __maybe_unused reloc_fdt(void)
 {
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
@@ -687,6 +687,9 @@ static int setup_reloc(void)
        gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
 #endif
 #endif
+#ifdef CONFIG_OF_EMBED
+       gd->fdt_blob += gd->reloc_off;
+#endif
        memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
 
        debug("Relocation Offset is: %08lx\n", gd->reloc_off);
@@ -938,7 +941,9 @@ static init_fnc_t init_sequence_f[] = {
 #endif
        setup_machine,
        reserve_global_data,
+#ifndef CONFIG_OF_EMBED
        reserve_fdt,
+#endif
        reserve_arch,
        reserve_stacks,
        setup_dram_config,

common/board_f.c static init_fnc_t init_sequence_f[] = {

Quoted 10 lines
common/board_f.c +2 -1
@@ -955,7 +960,9 @@ static init_fnc_t init_sequence_f[] = {
        setup_board_extra,
 #endif
        INIT_FUNC_WATCHDOG_RESET
+#ifndef CONFIG_OF_EMBED
        reloc_fdt,
+#endif
        setup_reloc,
 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
        copy_uboot_to_ram,
--

Tested on QEMU x86

#2 lore raw

PATCH v2 1/1 common: board_f: Dont relocate FDT incase of CONFIG_OF_EMBED

In reply to Michal Simek

Hi Michal,

Quoted 9 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is already embedded with u-boot image. Also update the fdt_blob correctly in this case

Quoted 8 lines

---

Changes in v2:
- Fix commit message reported by Alexey

  common/board_f.c | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)

Tested on nios2 boards.

#3 lore raw

PATCH v2 1/1 common: board_f: Dont relocate FDT incase of CONFIG_OF_EMBED

In reply to Michal Simek

Hi Michal,

Quoted 50 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is already embedded with u-boot image. Also update the fdt_blob correctly in this case

---

Changes in v2:
- Fix commit message reported by Alexey

 common/board_f.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
common/board_f.c +5 -2
index b035c90ff3b7..91bf8beea1c6 100644
@@ -508,7 +508,7 @@ static int reserve_global_data(void)
        return 0;
 }
 
-static int reserve_fdt(void)
+static int __maybe_unused reserve_fdt(void)
 {
        /*
         * If the device tree is sitting immediately above our image then we
@@ -658,7 +658,7 @@ static int setup_dram_config(void)
        return 0;
 }
 
-static int reloc_fdt(void)
+static int __maybe_unused reloc_fdt(void)
 {
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
@@ -687,6 +687,9 @@ static int setup_reloc(void)
        gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
 #endif
 #endif
+#ifdef CONFIG_OF_EMBED
+       gd->fdt_blob += gd->reloc_off;
+#endif
        memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
 
        debug("Relocation Offset is: %08lx\n", gd->reloc_off);

common/board_f.c static init_fnc_t init_sequence_f[] = { · line 946

Quoted 6 lines
common/board_f.c +2 -0
@@ -938,7 +941,9 @@ static init_fnc_t init_sequence_f[] = {
 #endif
        setup_machine,
        reserve_global_data,
+#ifndef CONFIG_OF_EMBED
        reserve_fdt,
+#endif

Can you please put the #ifdef in the function? At some point we are hoping to get rid of all these #ifdefs.

Quoted 14 lines
common/board_f.c +2 -1
        reserve_arch,
        reserve_stacks,
        setup_dram_config,
@@ -955,7 +960,9 @@ static init_fnc_t init_sequence_f[] = {
        setup_board_extra,
 #endif
        INIT_FUNC_WATCHDOG_RESET
+#ifndef CONFIG_OF_EMBED
        reloc_fdt,
+#endif
        setup_reloc,
 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
        copy_uboot_to_ram,
--
Quoted 2 lines

1.9.1

Regards,
Simon

#4 lore raw

PATCH v2 1/1 common: board_f: Dont relocate FDT incase of CONFIG_OF_EMBED

Quoted 51 lines · Simon Glass

Hi Michal,

Quoted 48 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is already embedded with u-boot image. Also update the fdt_blob correctly in this case

---

Changes in v2:
- Fix commit message reported by Alexey

 common/board_f.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
common/board_f.c +5 -2
index b035c90ff3b7..91bf8beea1c6 100644
@@ -508,7 +508,7 @@ static int reserve_global_data(void)
        return 0;
 }
 
-static int reserve_fdt(void)
+static int __maybe_unused reserve_fdt(void)
 {
        /*
         * If the device tree is sitting immediately above our image then we
@@ -658,7 +658,7 @@ static int setup_dram_config(void)
        return 0;
 }
 
-static int reloc_fdt(void)
+static int __maybe_unused reloc_fdt(void)
 {
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
@@ -687,6 +687,9 @@ static int setup_reloc(void)
        gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
 #endif
 #endif
+#ifdef CONFIG_OF_EMBED
+       gd->fdt_blob += gd->reloc_off;
+#endif
        memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
 
Quoted 11 lines

common/board_f.c static init_fnc_t init_sequence_f[] = { · line 946

Quoted 8 lines
common/board_f.c +2 -0
        debug("Relocation Offset is: %08lx\n", gd->reloc_off);
@@ -938,7 +941,9 @@ static init_fnc_t init_sequence_f[] = {
 #endif
        setup_machine,
        reserve_global_data,
+#ifndef CONFIG_OF_EMBED
        reserve_fdt,
+#endif

Can you please put the #ifdef in the function? At some point we are hoping to get rid of all these #ifdefs.

Do you think that this is the best way how to handle this?
We are targeting small uboot running from OCM on Zynq. Moving ifdef to function itself will caused that we will waste some bytes which do nothing. Reference in table stays there and then return from that function too. It it is not huge but this way seems to me better.

But no problem to change it if you think that this is the best way how to handle this.

Thanks,
Michal

#5 lore raw

PATCH v2 1/1 common: board_f: Dont relocate FDT incase of CONFIG_OF_EMBED

Hi Michal,

Quoted 64 lines · Michal Simek
Quoted 51 lines · Simon Glass

Hi Michal,

Quoted 48 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is already embedded with u-boot image. Also update the fdt_blob correctly in this case

---

Changes in v2:
- Fix commit message reported by Alexey

 common/board_f.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
common/board_f.c +5 -2
index b035c90ff3b7..91bf8beea1c6 100644
@@ -508,7 +508,7 @@ static int reserve_global_data(void)
        return 0;
 }
 
-static int reserve_fdt(void)
+static int __maybe_unused reserve_fdt(void)
 {
        /*
         * If the device tree is sitting immediately above our image then we
@@ -658,7 +658,7 @@ static int setup_dram_config(void)
        return 0;
 }
 
-static int reloc_fdt(void)
+static int __maybe_unused reloc_fdt(void)
 {
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
@@ -687,6 +687,9 @@ static int setup_reloc(void)
        gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
 #endif
 #endif
+#ifdef CONFIG_OF_EMBED
+       gd->fdt_blob += gd->reloc_off;
+#endif
        memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
 
Quoted 11 lines

common/board_f.c static init_fnc_t init_sequence_f[] = { · line 946

Quoted 8 lines
common/board_f.c +2 -0
        debug("Relocation Offset is: %08lx\n", gd->reloc_off);
@@ -938,7 +941,9 @@ static init_fnc_t init_sequence_f[] = {
 #endif
        setup_machine,
        reserve_global_data,
+#ifndef CONFIG_OF_EMBED
        reserve_fdt,
+#endif

Can you please put the #ifdef in the function? At some point we are hoping to get rid of all these #ifdefs.

Quoted 8 lines

Do you think that this is the best way how to handle this?
We are targeting small uboot running from OCM on Zynq. Moving ifdef to function itself will caused that we will waste some bytes which do nothing. Reference in table stays there and then return from that function too. It it is not huge but this way seems to me better.

But no problem to change it if you think that this is the best way how to handle this.

You should not be using CONFIG_OF_EMBED...

I recall you were originally worried about the name change from u-boot.bin to u-boot-dtb.bin. Is that right?

Regards,
Simon

#6 lore raw

PATCH v2 1/1 common: board_f: Dont relocate FDT incase of CONFIG_OF_EMBED

Quoted 73 lines · Simon Glass

Hi Michal,

Quoted 70 lines · Michal Simek
Quoted 51 lines · Simon Glass

Hi Michal,

Quoted 48 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is already embedded with u-boot image. Also update the fdt_blob correctly in this case

---

Changes in v2:
- Fix commit message reported by Alexey

 common/board_f.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
common/board_f.c +5 -2
index b035c90ff3b7..91bf8beea1c6 100644
@@ -508,7 +508,7 @@ static int reserve_global_data(void)
        return 0;
 }
 
-static int reserve_fdt(void)
+static int __maybe_unused reserve_fdt(void)
 {
        /*
         * If the device tree is sitting immediately above our image then we
@@ -658,7 +658,7 @@ static int setup_dram_config(void)
        return 0;
 }
 
-static int reloc_fdt(void)
+static int __maybe_unused reloc_fdt(void)
 {
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
@@ -687,6 +687,9 @@ static int setup_reloc(void)
        gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
 #endif
 #endif
+#ifdef CONFIG_OF_EMBED
+       gd->fdt_blob += gd->reloc_off;
+#endif
        memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
 
Quoted 11 lines

common/board_f.c static init_fnc_t init_sequence_f[] = { · line 946

Quoted 8 lines
common/board_f.c +2 -0
        debug("Relocation Offset is: %08lx\n", gd->reloc_off);
@@ -938,7 +941,9 @@ static init_fnc_t init_sequence_f[] = {
 #endif
        setup_machine,
        reserve_global_data,
+#ifndef CONFIG_OF_EMBED
        reserve_fdt,
+#endif

Can you please put the #ifdef in the function? At some point we are hoping to get rid of all these #ifdefs.

Do you think that this is the best way how to handle this?
We are targeting small uboot running from OCM on Zynq. Moving ifdef to function itself will caused that we will waste some bytes which do nothing. Reference in table stays there and then return from that function too. It it is not huge but this way seems to me better.

Quoted 4 lines
Quoted 2 lines

But no problem to change it if you think that this is the best way how to handle this.

You should not be using CONFIG_OF_EMBED...

For production board.
Again is there really need to move to that ifdef inside reserve_fdt function?

Quoted 2 lines

I recall you were originally worried about the name change from u-boot.bin to u-boot-dtb.bin. Is that right?

No problem with this now.

Thanks,
Michal

#7 lore raw

PATCH v2 1/1 common: board_f: Dont relocate FDT incase of CONFIG_OF_EMBED

Hi Michal,

Quoted 74 lines · Michal Simek
Quoted 73 lines · Simon Glass

Hi Michal,

Quoted 70 lines · Michal Simek
Quoted 51 lines · Simon Glass

Hi Michal,

Quoted 48 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is already embedded with u-boot image. Also update the fdt_blob correctly in this case

---

Changes in v2:
- Fix commit message reported by Alexey

 common/board_f.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
common/board_f.c +5 -2
index b035c90ff3b7..91bf8beea1c6 100644
@@ -508,7 +508,7 @@ static int reserve_global_data(void)
        return 0;
 }
 
-static int reserve_fdt(void)
+static int __maybe_unused reserve_fdt(void)
 {
        /*
         * If the device tree is sitting immediately above our image then we
@@ -658,7 +658,7 @@ static int setup_dram_config(void)
        return 0;
 }
 
-static int reloc_fdt(void)
+static int __maybe_unused reloc_fdt(void)
 {
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
@@ -687,6 +687,9 @@ static int setup_reloc(void)
        gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
 #endif
 #endif
+#ifdef CONFIG_OF_EMBED
+       gd->fdt_blob += gd->reloc_off;
+#endif
        memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
 
Quoted 11 lines

common/board_f.c static init_fnc_t init_sequence_f[] = { · line 946

Quoted 8 lines
common/board_f.c +2 -0
        debug("Relocation Offset is: %08lx\n", gd->reloc_off);
@@ -938,7 +941,9 @@ static init_fnc_t init_sequence_f[] = {
 #endif
        setup_machine,
        reserve_global_data,
+#ifndef CONFIG_OF_EMBED
        reserve_fdt,
+#endif

Can you please put the #ifdef in the function? At some point we are hoping to get rid of all these #ifdefs.

Do you think that this is the best way how to handle this?
We are targeting small uboot running from OCM on Zynq. Moving ifdef to function itself will caused that we will waste some bytes which do nothing. Reference in table stays there and then return from that function too. It it is not huge but this way seems to me better.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

But no problem to change it if you think that this is the best way how to handle this.

You should not be using CONFIG_OF_EMBED...

For production board.
Again is there really need to move to that ifdef inside reserve_fdt function?

Well if we are trying to remove the #ifdefs from the list, but there is a patch that adds one, that is going in the wrong direction.

Quoted 5 lines
Quoted 3 lines

I recall you were originally worried about the name change from u-boot.bin to u-boot-dtb.bin. Is that right?

No problem with this now.

OK, so I don't really need a need to save a few bytes on code that is only ever used for debugging/testing.

Regards,
Simon