Skip to contentSkip to conversation

MIPS: Add board_early_init_f() to init_sequence

PATCH New Stefan Roese 4 participants 7 messages Nov 12, 2008 – Nov 18, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Add board_early_init_f() to init_sequence

This patch adds the board_early_init_f() call to the MIPS init sequence. A weak dummy implementation is also added which can be overridden by a board specific version.

This will be used by the upcoming VCTH board support.

---
 lib_mips/board.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
lib_mips/board.c +10 -0
index 77e1cc8..01dda69 100644
@@ -70,6 +70,15 @@ static ulong mem_malloc_brk;
  */
 unsigned long mips_io_port_base = -1;
 
+int __board_early_init_f(void)
+{
+	/*
+	 * Nothing to do in this dummy implementation
+	 */
+	return 0;
+}
+int board_early_init_f(void) __attribute__((weak, alias("__board_early_init_f")));
+
 /*
  * The Malloc area is immediately below the monitor copy in DRAM
  */
@@ -167,6 +176,7 @@ static int init_baudrate (void)
 typedef int (init_fnc_t) (void);
 
 init_fnc_t *init_sequence[] = {
+	board_early_init_f,
 	timer_init,
 	env_init,		/* initialize environment */
 #ifdef CONFIG_INCA_IP
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH 1/1 MIPS: Add board_early_init_f() to init_sequence

Quoted 32 lines · Stefan Roese

This patch adds the board_early_init_f() call to the MIPS init sequence. A weak dummy implementation is also added which can be overridden by a board specific version.

This will be used by the upcoming VCTH board support.

---
 lib_mips/board.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
lib_mips/board.c +9 -0
index 77e1cc8..01dda69 100644
@@ -70,6 +70,15 @@ static ulong mem_malloc_brk;
  */
 unsigned long mips_io_port_base = -1;
 
+int __board_early_init_f(void)
+{
+	/*
+	 * Nothing to do in this dummy implementation
+	 */
+	return 0;
+}
+int board_early_init_f(void) __attribute__((weak, alias("__board_early_init_f")));
+
 /*
  * The Malloc area is immediately below the monitor copy in DRAM
  */

lib_mips/board.c static int init_baudrate (void) · line 182

Quoted 7 lines
lib_mips/board.c +1 -0
@@ -167,6 +176,7 @@ static int init_baudrate (void)
 typedef int (init_fnc_t) (void);
 
 init_fnc_t *init_sequence[] = {
+	board_early_init_f,
 	timer_init,
 	env_init,		/* initialize environment */
 #ifdef CONFIG_INCA_IP

This is ok. I don't know why people prefers alias, though :-)

#2 lore raw

PATCH 1/1 MIPS: Add board_early_init_f() to init_sequence

Quoted 15 lines · Shinya Kuribayashi
Quoted 15 lines
lib_mips/board.c +8 -0
+int __board_early_init_f(void)
+{
+	/*
+	 * Nothing to do in this dummy implementation
+	 */
+	return 0;
+}
+int board_early_init_f(void) __attribute__((weak,

alias("__board_early_init_f"))); +
/*
* The Malloc area is immediately below the monitor copy in DRAM */

lib_mips/board.c +0 -0
@@ -167,6 +176,7 @@ static int init_baudrate (void)
 typedef int (init_fnc_t) (void);
 
Quoted 7 lines

lib_mips/board.c static int init_baudrate (void) · line 182

Quoted 5 lines
lib_mips/board.c +1 -0
 init_fnc_t *init_sequence[] = {
+	board_early_init_f,
 	timer_init,
 	env_init,		/* initialize environment */
 #ifdef CONFIG_INCA_IP

This is ok. I don't know why people prefers alias, though :-)

Just because we don't need the ugly #ifdef's by using weak aliases. It has some drawbacks of course but in general the resulting source code looks "cleaner".

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#3 lore raw

PATCH 1/1 MIPS: Add board_early_init_f() to init_sequence

Quoted 5 lines · Stefan Roese
Quoted 1 line

This is ok. I don't know why people prefers alias, though :-)

Just because we don't need the ugly #ifdef's by using weak aliases. It has some drawbacks of course but in general the resulting source code looks "cleaner".

I was being vague. I prefers something like below, because I don't want to have a dummy & empty function just for the `alias'.

int __attribute__((weak)) board_early_init_f(void)

{
	return 0;
}

But that's not a big deal. Using weak function is ok, of course. Sorry for the noise.

Thanks,

Signature · 2 lines
Shinya Kuribayashi
NEC Electronics
#4 lore raw

PATCH 1/1 MIPS: Add board_early_init_f() to init_sequence

In reply to Stefan Roese
Quoted 16 lines · Stefan Roese

This patch adds the board_early_init_f() call to the MIPS init sequence. A weak dummy implementation is also added which can be overridden by a board specific version.

This will be used by the upcoming VCTH board support.

---
 lib_mips/board.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
lib_mips/board.c +0 -0
index 77e1cc8..01dda69 100644

lib_mips/board.c static ulong mem_malloc_brk; · line 79

Quoted 10 lines
lib_mips/board.c +7 -0
@@ -70,6 +70,15 @@ static ulong mem_malloc_brk;
  */
 unsigned long mips_io_port_base = -1;
 
+int __board_early_init_f(void)
+{
+	/*
+	 * Nothing to do in this dummy implementation
+	 */
+	return 0;
+}

why not remove this and create a generic dummy function

to reduce to code size impact

Best Regards,
J.

#5 lore raw

PATCH 1/1 MIPS: Add board_early_init_f() to init_sequence

Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Stefan Roese
lib_mips/board.c +0 -0
index 77e1cc8..01dda69 100644

lib_mips/board.c static ulong mem_malloc_brk; · line 79

Quoted 10 lines
lib_mips/board.c +7 -0
@@ -70,6 +70,15 @@ static ulong mem_malloc_brk;
  */
 unsigned long mips_io_port_base = -1;
 
+int __board_early_init_f(void)
+{
+	/*
+	 * Nothing to do in this dummy implementation
+	 */
+	return 0;
+}

why not remove this and create a generic dummy function

Quoted 1 line

to reduce to code size impact

+1. Such dummy function could be shared among all architectures.

Thanks,

Shinya

#6 lore raw

PATCH 1/1 MIPS: Add board_early_init_f() to init_sequence

Quoted 16 lines · Shinya Kuribayashi
Quoted 5 lines
Quoted 5 lines

+++ b/lib_mips/board.c

lib_mips/board.c +0 -0
@@ -70,6 +70,15 @@ static ulong mem_malloc_brk;
  */
 unsigned long mips_io_port_base = -1;
 
Quoted 10 lines

lib_mips/board.c static ulong mem_malloc_brk; · line 79

Quoted 7 lines
lib_mips/board.c +7 -0
+int __board_early_init_f(void)
+{
+	/*
+	 * Nothing to do in this dummy implementation
+	 */
+	return 0;
+}

why not remove this and create a generic dummy function to reduce to code size impact

Quoted 1 line

+1. Such dummy function could be shared among all architectures.

OK, makes perfect sense. We would need different dummy functions for each different parameter though, such as:

void dummy_void_void(void);
int dummy_int_void(void);
int dummy_int_int(int);
int dummy_int_pint(* int);
...

And where should those functions be placed? We could create a new file probably in lib_generic for this. I suggest we postpone this consolidation until after the next release though.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================