diff mbox series

[U-Boot,v2,11/16] Define board_quiesce_devices() in a shared location

Message ID 20171204212832.130100-12-sjg@chromium.org
State Superseded
Delegated to: Alexander Graf
Headers show
Series efi: Enable basic sandbox support for EFI loader | expand

Commit Message

Simon Glass Dec. 4, 2017, 9:28 p.m. UTC
This undocumented function relies on arch-specific code to declare a nop
weak version. Add the weak function in common code instead to avoid having
to duplicate the same function in each arch.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/arm/include/asm/u-boot-arm.h | 1 -
 arch/x86/include/asm/u-boot-x86.h | 1 -
 arch/x86/lib/bootm.c              | 4 ----
 common/bootm.c                    | 4 ++++
 include/bootm.h                   | 2 ++
 5 files changed, 6 insertions(+), 6 deletions(-)

Comments

Heinrich Schuchardt Dec. 4, 2017, 10:41 p.m. UTC | #1
On 12/04/2017 10:28 PM, Simon Glass wrote:
> This undocumented function relies on arch-specific code to declare a nop

Undocumented code is unsatisfactory. Please, add a comment to the function.

Best regards

Heinrich

> weak version. Add the weak function in common code instead to avoid having
> to duplicate the same function in each arch.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v2: None
> 
>   arch/arm/include/asm/u-boot-arm.h | 1 -
>   arch/x86/include/asm/u-boot-x86.h | 1 -
>   arch/x86/lib/bootm.c              | 4 ----
>   common/bootm.c                    | 4 ++++
>   include/bootm.h                   | 2 ++
>   5 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/include/asm/u-boot-arm.h b/arch/arm/include/asm/u-boot-arm.h
> index ef4fca68ee..73ccf41f8c 100644
> --- a/arch/arm/include/asm/u-boot-arm.h
> +++ b/arch/arm/include/asm/u-boot-arm.h
> @@ -38,7 +38,6 @@ int	arch_early_init_r(void);
>   
>   /* board/.../... */
>   int	board_init(void);
> -void	board_quiesce_devices(void);
>   
>   /* cpu/.../interrupt.c */
>   int	arch_interrupt_init	(void);
> diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h
> index 187fe5fd8c..d2e1426042 100644
> --- a/arch/x86/include/asm/u-boot-x86.h
> +++ b/arch/x86/include/asm/u-boot-x86.h
> @@ -85,7 +85,6 @@ static inline __attribute__((no_instrument_function)) uint64_t rdtsc(void)
>   /* board/... */
>   void timer_set_tsc_base(uint64_t new_base);
>   uint64_t timer_get_tsc(void);
> -void board_quiesce_devices(void);
>   
>   void quick_ram_check(void);
>   
> diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
> index e548cdbed5..60ae043f24 100644
> --- a/arch/x86/lib/bootm.c
> +++ b/arch/x86/lib/bootm.c
> @@ -33,10 +33,6 @@ int arch_fixup_fdt(void *blob)
>   	return 0;
>   }
>   
> -__weak void board_quiesce_devices(void)
> -{
> -}
> -
>   void bootm_announce_and_cleanup(void)
>   {
>   	printf("\nStarting kernel ...\n\n");
> diff --git a/common/bootm.c b/common/bootm.c
> index 9493a306cd..9fba0472ac 100644
> --- a/common/bootm.c
> +++ b/common/bootm.c
> @@ -47,6 +47,10 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
>   				   char * const argv[], bootm_headers_t *images,
>   				   ulong *os_data, ulong *os_len);
>   
> +__weak void board_quiesce_devices(void)
> +{
> +}
> +
>   #ifdef CONFIG_LMB
>   static void boot_start_lmb(bootm_headers_t *images)
>   {
> diff --git a/include/bootm.h b/include/bootm.h
> index 49813772ce..76b6ab42e6 100644
> --- a/include/bootm.h
> +++ b/include/bootm.h
> @@ -73,4 +73,6 @@ int bootm_decomp_image(int comp, ulong load, ulong image_start, int type,
>   		       void *load_buf, void *image_buf, ulong image_len,
>   		       uint unc_len, ulong *load_end);
>   
> +void board_quiesce_devices(void);
> +
>   #endif
>
Heinrich Schuchardt Dec. 4, 2017, 10:42 p.m. UTC | #2
On 12/04/2017 11:41 PM, Heinrich Schuchardt wrote:
> 
> 
> On 12/04/2017 10:28 PM, Simon Glass wrote:
>> This undocumented function relies on arch-specific code to declare a nop
> 
> Undocumented code is unsatisfactory. Please, add a comment to the function.

Sorry I missed you put that in a separate patch (12/16).

BR

> 
> Best regards
> 
> Heinrich
> 
>> weak version. Add the weak function in common code instead to avoid 
>> having
>> to duplicate the same function in each arch.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>> Changes in v2: None
>>
>>   arch/arm/include/asm/u-boot-arm.h | 1 -
>>   arch/x86/include/asm/u-boot-x86.h | 1 -
>>   arch/x86/lib/bootm.c              | 4 ----
>>   common/bootm.c                    | 4 ++++
>>   include/bootm.h                   | 2 ++
>>   5 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/u-boot-arm.h 
>> b/arch/arm/include/asm/u-boot-arm.h
>> index ef4fca68ee..73ccf41f8c 100644
>> --- a/arch/arm/include/asm/u-boot-arm.h
>> +++ b/arch/arm/include/asm/u-boot-arm.h
>> @@ -38,7 +38,6 @@ int    arch_early_init_r(void);
>>   /* board/.../... */
>>   int    board_init(void);
>> -void    board_quiesce_devices(void);
>>   /* cpu/.../interrupt.c */
>>   int    arch_interrupt_init    (void);
>> diff --git a/arch/x86/include/asm/u-boot-x86.h 
>> b/arch/x86/include/asm/u-boot-x86.h
>> index 187fe5fd8c..d2e1426042 100644
>> --- a/arch/x86/include/asm/u-boot-x86.h
>> +++ b/arch/x86/include/asm/u-boot-x86.h
>> @@ -85,7 +85,6 @@ static inline 
>> __attribute__((no_instrument_function)) uint64_t rdtsc(void)
>>   /* board/... */
>>   void timer_set_tsc_base(uint64_t new_base);
>>   uint64_t timer_get_tsc(void);
>> -void board_quiesce_devices(void);
>>   void quick_ram_check(void);
>> diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
>> index e548cdbed5..60ae043f24 100644
>> --- a/arch/x86/lib/bootm.c
>> +++ b/arch/x86/lib/bootm.c
>> @@ -33,10 +33,6 @@ int arch_fixup_fdt(void *blob)
>>       return 0;
>>   }
>> -__weak void board_quiesce_devices(void)
>> -{
>> -}
>> -
>>   void bootm_announce_and_cleanup(void)
>>   {
>>       printf("\nStarting kernel ...\n\n");
>> diff --git a/common/bootm.c b/common/bootm.c
>> index 9493a306cd..9fba0472ac 100644
>> --- a/common/bootm.c
>> +++ b/common/bootm.c
>> @@ -47,6 +47,10 @@ static const void *boot_get_kernel(cmd_tbl_t 
>> *cmdtp, int flag, int argc,
>>                      char * const argv[], bootm_headers_t *images,
>>                      ulong *os_data, ulong *os_len);
>> +__weak void board_quiesce_devices(void)
>> +{
>> +}
>> +
>>   #ifdef CONFIG_LMB
>>   static void boot_start_lmb(bootm_headers_t *images)
>>   {
>> diff --git a/include/bootm.h b/include/bootm.h
>> index 49813772ce..76b6ab42e6 100644
>> --- a/include/bootm.h
>> +++ b/include/bootm.h
>> @@ -73,4 +73,6 @@ int bootm_decomp_image(int comp, ulong load, ulong 
>> image_start, int type,
>>                  void *load_buf, void *image_buf, ulong image_len,
>>                  uint unc_len, ulong *load_end);
>> +void board_quiesce_devices(void);
>> +
>>   #endif
>>
>
diff mbox series

Patch

diff --git a/arch/arm/include/asm/u-boot-arm.h b/arch/arm/include/asm/u-boot-arm.h
index ef4fca68ee..73ccf41f8c 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -38,7 +38,6 @@  int	arch_early_init_r(void);
 
 /* board/.../... */
 int	board_init(void);
-void	board_quiesce_devices(void);
 
 /* cpu/.../interrupt.c */
 int	arch_interrupt_init	(void);
diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h
index 187fe5fd8c..d2e1426042 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -85,7 +85,6 @@  static inline __attribute__((no_instrument_function)) uint64_t rdtsc(void)
 /* board/... */
 void timer_set_tsc_base(uint64_t new_base);
 uint64_t timer_get_tsc(void);
-void board_quiesce_devices(void);
 
 void quick_ram_check(void);
 
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index e548cdbed5..60ae043f24 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -33,10 +33,6 @@  int arch_fixup_fdt(void *blob)
 	return 0;
 }
 
-__weak void board_quiesce_devices(void)
-{
-}
-
 void bootm_announce_and_cleanup(void)
 {
 	printf("\nStarting kernel ...\n\n");
diff --git a/common/bootm.c b/common/bootm.c
index 9493a306cd..9fba0472ac 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -47,6 +47,10 @@  static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 				   char * const argv[], bootm_headers_t *images,
 				   ulong *os_data, ulong *os_len);
 
+__weak void board_quiesce_devices(void)
+{
+}
+
 #ifdef CONFIG_LMB
 static void boot_start_lmb(bootm_headers_t *images)
 {
diff --git a/include/bootm.h b/include/bootm.h
index 49813772ce..76b6ab42e6 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -73,4 +73,6 @@  int bootm_decomp_image(int comp, ulong load, ulong image_start, int type,
 		       void *load_buf, void *image_buf, ulong image_len,
 		       uint unc_len, ulong *load_end);
 
+void board_quiesce_devices(void);
+
 #endif