[U-Boot] [PATCH v2 34/63] x86: Support global_data on x86_64
Bin Meng
bmeng.cn at gmail.com
Sat Jan 14 14:31:09 CET 2017
Hi Simon,
On Sun, Nov 20, 2016 at 4:25 AM, Simon Glass <sjg at chromium.org> wrote:
> At present this is just an ordinary variable. We may consider making it a
> fixed register in the future.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> Changes in v2: None
>
> arch/x86/cpu/x86_64/cpu.c | 13 +++++++++++++
> arch/x86/include/asm/global_data.h | 6 +++++-
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
> index c1d3788..da2ad11 100644
> --- a/arch/x86/cpu/x86_64/cpu.c
> +++ b/arch/x86/cpu/x86_64/cpu.c
> @@ -8,6 +8,19 @@
> #include <common.h>
> #include <debug_uart.h>
>
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +/* Global declaration of gd */
> +struct global_data *global_data_ptr;
> +
> +void arch_setup_gd(gd_t *new_gd)
> +{
> + global_data_ptr = new_gd;
> +
> + /* TODO(sjg at chromium.org): Why is this needed? */
What happens if this is not needed? Can you explain a little bit about the TODO?
> + printch(' ');
> +}
> +
> int cpu_has_64bit(void)
> {
> return true;
> diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
> index 7434f77..ce9e5cc 100644
> --- a/arch/x86/include/asm/global_data.h
> +++ b/arch/x86/include/asm/global_data.h
> @@ -104,7 +104,7 @@ struct arch_global_data {
> #include <asm-generic/global_data.h>
>
> #ifndef __ASSEMBLY__
> -# ifdef CONFIG_EFI_APP
> +# if defined(CONFIG_EFI_APP) || CONFIG_IS_ENABLED(X86_64)
>
> #define gd global_data_ptr
>
> @@ -114,7 +114,11 @@ static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
> {
> gd_t *gd_ptr;
>
> +#if CONFIG_IS_ENABLED(X86_64)
> + asm volatile("fs mov 0, %0\n" : "=r" (gd_ptr));
> +#else
> asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
> +#endif
Can both of them be consolidated as one: asm volatile("fs mov 0, %0\n"
: "=r" (gd_ptr));
>
> return gd_ptr;
> }
> --
Regards,
Bin
More information about the U-Boot
mailing list