Patchwork [U-Boot,V2,3/4] ARM: Warn when the machine ID isn't set.

login
register
mail settings
Submitter Christopher Harvey
Date July 7, 2011, 2:34 p.m.
Message ID <20110707143424.GD5438@harvey-pc.matrox.com>
Download mbox | patch
Permalink /patch/103674/
State Superseded
Headers show

Comments

Christopher Harvey - July 7, 2011, 2:34 p.m.
Linux cannot boot without it.

Signed-off-by: Christopher Harvey <charvey@matrox.com>
---

V2:
Used a #define instead of a constant. 
Used a printf instead of a debug.

 arch/arm/include/asm/u-boot.h |    2 ++
 arch/arm/lib/board.c          |    1 +
 arch/arm/lib/bootm.c          |    6 ++++++
 3 files changed, 9 insertions(+), 0 deletions(-)
Igor Grinberg - July 7, 2011, 4:55 p.m.
On 07/07/11 17:34, Christopher Harvey wrote:

> Linux cannot boot without it.
>
> Signed-off-by: Christopher Harvey <charvey@matrox.com>
> ---
>
> V2:
> Used a #define instead of a constant. 
> Used a printf instead of a debug.
>
>  arch/arm/include/asm/u-boot.h |    2 ++
>  arch/arm/lib/board.c          |    1 +
>  arch/arm/lib/bootm.c          |    6 ++++++
>  3 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/include/asm/u-boot.h b/arch/arm/include/asm/u-boot.h
> index ed33327..81735de 100644
> --- a/arch/arm/include/asm/u-boot.h
> +++ b/arch/arm/include/asm/u-boot.h
> @@ -48,4 +48,6 @@ typedef struct bd_info {
>      }			bi_dram[CONFIG_NR_DRAM_BANKS];
>  } bd_t;
>  
> +#define BI_ARCH_NUMBER_INVALID  0xffffffff
> +
>  #endif	/* _U_BOOT_H_ */
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index fc52a26..4923397 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -404,6 +404,7 @@ void board_init_f (ulong bootflag)
>  	post_bootmode_init();
>  	post_run (NULL, POST_ROM | post_bootmode_get(0));
>  #endif
> +	gd->bd->bi_arch_number = BI_ARCH_NUMBER_INVALID; 
>  
>  	gd->bd->bi_baudrate = gd->baudrate;
>  	/* Ram ist board specific, so move it to board code ... */
> diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
> index 802e833..ea9bf17 100644
> --- a/arch/arm/lib/bootm.c
> +++ b/arch/arm/lib/bootm.c
> @@ -113,6 +113,12 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
>  		printf ("Using machid 0x%x from environment\n", machid);
>  	}
>  
> +#ifdef DEBUG
> +	if (machid == BI_ARCH_NUMBER_INVALID) {
> +	        printf("Warning: machid not set.\n");
> +	}
> +#endif

You don't need the curly brackets.

Again, is it essential to enclose that check in ifdef DEBUG?
Igor Grinberg - July 7, 2011, 9:02 p.m.
On 07/07/11 19:55, Igor Grinberg wrote:

> On 07/07/11 17:34, Christopher Harvey wrote:
>
>> Linux cannot boot without it.
>>
>> Signed-off-by: Christopher Harvey <charvey@matrox.com>
>> ---
>>
>> V2:
>> Used a #define instead of a constant. 
>> Used a printf instead of a debug.
>>
>>  arch/arm/include/asm/u-boot.h |    2 ++
>>  arch/arm/lib/board.c          |    1 +
>>  arch/arm/lib/bootm.c          |    6 ++++++
>>  3 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/u-boot.h b/arch/arm/include/asm/u-boot.h
>> index ed33327..81735de 100644
>> --- a/arch/arm/include/asm/u-boot.h
>> +++ b/arch/arm/include/asm/u-boot.h
>> @@ -48,4 +48,6 @@ typedef struct bd_info {
>>      }			bi_dram[CONFIG_NR_DRAM_BANKS];
>>  } bd_t;
>>  
>> +#define BI_ARCH_NUMBER_INVALID  0xffffffff
>> +
>>  #endif	/* _U_BOOT_H_ */
>> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
>> index fc52a26..4923397 100644
>> --- a/arch/arm/lib/board.c
>> +++ b/arch/arm/lib/board.c
>> @@ -404,6 +404,7 @@ void board_init_f (ulong bootflag)
>>  	post_bootmode_init();
>>  	post_run (NULL, POST_ROM | post_bootmode_get(0));
>>  #endif
>> +	gd->bd->bi_arch_number = BI_ARCH_NUMBER_INVALID; 

I went through the board files and found that several boards set the
bi_arch_number in board_early_init_f() and checkboard() functions.
This means, that by adding the above, you will break them (override the setting).

IMO, you should move this up just before the init_sequence[] array is executed.

And a small nitpick: there is a trailing white space...

>>  
>>  	gd->bd->bi_baudrate = gd->baudrate;
>>  	/* Ram ist board specific, so move it to board code ... */
>> diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
>> index 802e833..ea9bf17 100644
>> --- a/arch/arm/lib/bootm.c
>> +++ b/arch/arm/lib/bootm.c
>> @@ -113,6 +113,12 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
>>  		printf ("Using machid 0x%x from environment\n", machid);
>>  	}
>>  
>> +#ifdef DEBUG
>> +	if (machid == BI_ARCH_NUMBER_INVALID) {
>> +	        printf("Warning: machid not set.\n");
>> +	}
>> +#endif
> You don't need the curly brackets.
>
> Again, is it essential to enclose that check in ifdef DEBUG?
>
>

Patch

diff --git a/arch/arm/include/asm/u-boot.h b/arch/arm/include/asm/u-boot.h
index ed33327..81735de 100644
--- a/arch/arm/include/asm/u-boot.h
+++ b/arch/arm/include/asm/u-boot.h
@@ -48,4 +48,6 @@  typedef struct bd_info {
     }			bi_dram[CONFIG_NR_DRAM_BANKS];
 } bd_t;
 
+#define BI_ARCH_NUMBER_INVALID  0xffffffff
+
 #endif	/* _U_BOOT_H_ */
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index fc52a26..4923397 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -404,6 +404,7 @@  void board_init_f (ulong bootflag)
 	post_bootmode_init();
 	post_run (NULL, POST_ROM | post_bootmode_get(0));
 #endif
+	gd->bd->bi_arch_number = BI_ARCH_NUMBER_INVALID; 
 
 	gd->bd->bi_baudrate = gd->baudrate;
 	/* Ram ist board specific, so move it to board code ... */
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 802e833..ea9bf17 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -113,6 +113,12 @@  int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 		printf ("Using machid 0x%x from environment\n", machid);
 	}
 
+#ifdef DEBUG
+	if (machid == BI_ARCH_NUMBER_INVALID) {
+	        printf("Warning: machid not set.\n");
+	}
+#endif
+
 	show_boot_progress (15);
 
 #ifdef CONFIG_OF_LIBFDT