diff mbox

[U-Boot,v2,11/47] x86: Tidy up global_data flags

Message ID 1438356724-6561-12-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass July 31, 2015, 3:31 p.m. UTC
These flags now overlap some global ones. Adjust the x86-specific flags to
avoid this. Since this requires a change to the start.S code, add a way for
tools to find the 32-bit cold reset entry point. Previously this was at a
fixed offset.

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

Changes in v2:
- Add a marker for the cold reset entry point
- Use the now-defined top 16-bits of the global_data flags

 arch/x86/cpu/start.S               | 8 ++++++--
 arch/x86/include/asm/global_data.h | 8 ++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

Comments

Bin Meng Aug. 2, 2015, 1:17 p.m. UTC | #1
Hi Simon,

On Fri, Jul 31, 2015 at 11:31 PM, Simon Glass <sjg@chromium.org> wrote:
> These flags now overlap some global ones. Adjust the x86-specific flags to
> avoid this. Since this requires a change to the start.S code, add a way for
> tools to find the 32-bit cold reset entry point. Previously this was at a
> fixed offset.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

But please see nits below.

>
> Changes in v2:
> - Add a marker for the cold reset entry point
> - Use the now-defined top 16-bits of the global_data flags
>
>  arch/x86/cpu/start.S               | 8 ++++++--
>  arch/x86/include/asm/global_data.h | 8 ++++----
>  2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
> index 7ef8b88..9b2584d 100644
> --- a/arch/x86/cpu/start.S
> +++ b/arch/x86/cpu/start.S
> @@ -41,14 +41,18 @@ _x86boot_start:
>         wbinvd
>
>         /* Tell 32-bit code it is being entered from an in-RAM copy */
> -       movw    $GD_FLG_WARM_BOOT, %bx
> +       movl    $GD_FLG_WARM_BOOT, %ebx
>         jmp     1f
> +
> +       /* Add a way for tools to discover the _start entry point */
> +       .align  4
> +       .long   0x12345678
>  _start:
>         /*
>          * This is the 32-bit cold-reset entry point, coming from start16.
>          * Set %bx to 0 to indicate this.

Nits: the comment is not correct. (%bx -> %ebx, 0 -> GD_FLG_COLD_BOOT)

>          */
> -       movw    $GD_FLG_COLD_BOOT, %bx
> +       movl    $GD_FLG_COLD_BOOT, %ebx
>  1:
>         /* Save BIST */
>         movl    %eax, %ebp
> diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
> index 4d9eac6..3db9a4c 100644
> --- a/arch/x86/include/asm/global_data.h
> +++ b/arch/x86/include/asm/global_data.h
> @@ -87,14 +87,14 @@ static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
>
>  #define gd     get_fs_gd_ptr()
>
> +#define DECLARE_GLOBAL_DATA_PTR
> +
>  #endif
>
>  /*
>   * Our private Global Data Flags
>   */
> -#define GD_FLG_COLD_BOOT       0x00100 /* Cold Boot */
> -#define GD_FLG_WARM_BOOT       0x00200 /* Warm Boot */
> -
> -#define DECLARE_GLOBAL_DATA_PTR
> +#define GD_FLG_COLD_BOOT       0x10000 /* Cold Boot */
> +#define GD_FLG_WARM_BOOT       0x20000 /* Warm Boot */
>
>  #endif /* __ASM_GBL_DATA_H */
> --

Regards,
Bin
Simon Glass Aug. 2, 2015, 11:37 p.m. UTC | #2
On 2 August 2015 at 07:17, Bin Meng <bmeng.cn@gmail.com> wrote:
> Hi Simon,
>
> On Fri, Jul 31, 2015 at 11:31 PM, Simon Glass <sjg@chromium.org> wrote:
>> These flags now overlap some global ones. Adjust the x86-specific flags to
>> avoid this. Since this requires a change to the start.S code, add a way for
>> tools to find the 32-bit cold reset entry point. Previously this was at a
>> fixed offset.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>
> But please see nits below.
>

Fixed nits and

Applied to u-boot-x86.
diff mbox

Patch

diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index 7ef8b88..9b2584d 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -41,14 +41,18 @@  _x86boot_start:
 	wbinvd
 
 	/* Tell 32-bit code it is being entered from an in-RAM copy */
-	movw	$GD_FLG_WARM_BOOT, %bx
+	movl	$GD_FLG_WARM_BOOT, %ebx
 	jmp	1f
+
+	/* Add a way for tools to discover the _start entry point */
+	.align	4
+	.long	0x12345678
 _start:
 	/*
 	 * This is the 32-bit cold-reset entry point, coming from start16.
 	 * Set %bx to 0 to indicate this.
 	 */
-	movw	$GD_FLG_COLD_BOOT, %bx
+	movl	$GD_FLG_COLD_BOOT, %ebx
 1:
 	/* Save BIST */
 	movl	%eax, %ebp
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 4d9eac6..3db9a4c 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -87,14 +87,14 @@  static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
 
 #define gd	get_fs_gd_ptr()
 
+#define DECLARE_GLOBAL_DATA_PTR
+
 #endif
 
 /*
  * Our private Global Data Flags
  */
-#define GD_FLG_COLD_BOOT	0x00100	/* Cold Boot */
-#define GD_FLG_WARM_BOOT	0x00200	/* Warm Boot */
-
-#define DECLARE_GLOBAL_DATA_PTR
+#define GD_FLG_COLD_BOOT	0x10000	/* Cold Boot */
+#define GD_FLG_WARM_BOOT	0x20000	/* Warm Boot */
 
 #endif /* __ASM_GBL_DATA_H */