[U-Boot] [PATCH v2 18/47] x86: Allow use of global_data with EFI

Bin Meng bmeng.cn at gmail.com
Sun Aug 2 16:32:33 CEST 2015


Hi Simon,

On Fri, Jul 31, 2015 at 11:31 PM, Simon Glass <sjg at chromium.org> wrote:
> On x86 the global_data pointer is provided through a somewhat-bizarre and
> x86-specific mechanism: the F segment register is set to a pointer to the
> start of global_data, so that accesses can use this build-in register.
>
> When running as an EFI payload we don't want to mess with the Global

Nits: running as an EFI application

> Descriptor Table (GDT) and there is little advantage (in terms of code size)
> to doing so.
>
> Allow global_data to be a simple variable in this case.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---

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

>
> Changes in v2:
> - Move this patch to before the EFI start-up code patch
> - Refer to FS as F segment register instead of frame segment register
> - Rename CONFIG_ARCH_EFI to CONFIG_EFI_APP
>
>  arch/x86/include/asm/global_data.h | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
> index 3db9a4c..80ebe3e 100644
> --- a/arch/x86/include/asm/global_data.h
> +++ b/arch/x86/include/asm/global_data.h
> @@ -76,6 +76,12 @@ struct arch_global_data {
>  #include <asm-generic/global_data.h>
>
>  #ifndef __ASSEMBLY__
> +# ifdef CONFIG_EFI_APP
> +
> +#define gd global_data_ptr
> +
> +#define DECLARE_GLOBAL_DATA_PTR   extern struct global_data *global_data_ptr
> +# else
>  static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
>  {
>         gd_t *gd_ptr;
> @@ -88,6 +94,7 @@ 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
>
>  #endif
>
> --

Regards,
Bin


More information about the U-Boot mailing list