xref: /rk3399_rockchip-uboot/arch/x86/include/asm/global_data.h (revision 1a4596601fd395f3afb8f82f3f840c5e00bdd57a)
1fea25720SGraeme Russ /*
2fea25720SGraeme Russ  * (C) Copyright 2002-2010
3fea25720SGraeme Russ  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4fea25720SGraeme Russ  *
5*1a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
6fea25720SGraeme Russ  */
7fea25720SGraeme Russ 
8fea25720SGraeme Russ #ifndef	__ASM_GBL_DATA_H
9fea25720SGraeme Russ #define __ASM_GBL_DATA_H
105cb48582SSimon Glass 
115cb48582SSimon Glass #ifndef __ASSEMBLY__
125cb48582SSimon Glass 
135cb48582SSimon Glass /* Architecture-specific global data */
145cb48582SSimon Glass struct arch_global_data {
155a35e6c4SSimon Glass 	struct global_data *gd_addr;		/* Location of Global Data */
16bc2df1afSSimon Glass 	uint64_t tsc_base;		/* Initial value returned by rdtsc() */
17bc2df1afSSimon Glass 	uint32_t tsc_base_kclocks;	/* Initial tsc as a kclocks value */
18bc2df1afSSimon Glass 	uint32_t tsc_prev;		/* For show_boot_progress() */
19f697d528SSimon Glass 	void *new_fdt;			/* Relocated FDT */
205cb48582SSimon Glass };
215cb48582SSimon Glass 
229558b48aSGraeme Russ #endif
23fea25720SGraeme Russ 
2443cff66eSSimon Glass #include <asm-generic/global_data.h>
2543cff66eSSimon Glass 
2643cff66eSSimon Glass #ifndef __ASSEMBLY__
27d8819f94SSimon Glass static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
289e6c572fSGraeme Russ {
299e6c572fSGraeme Russ 	gd_t *gd_ptr;
309e6c572fSGraeme Russ 
319e6c572fSGraeme Russ 	asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
329e6c572fSGraeme Russ 
339e6c572fSGraeme Russ 	return gd_ptr;
349e6c572fSGraeme Russ }
359e6c572fSGraeme Russ 
369e6c572fSGraeme Russ #define gd	get_fs_gd_ptr()
37fea25720SGraeme Russ 
38fea25720SGraeme Russ #endif
39fea25720SGraeme Russ 
4091d82a29SGabe Black /*
4191d82a29SGabe Black  * Our private Global Data Flags
4291d82a29SGabe Black  */
4391d82a29SGabe Black #define GD_FLG_COLD_BOOT	0x00100	/* Cold Boot */
4491d82a29SGabe Black #define GD_FLG_WARM_BOOT	0x00200	/* Warm Boot */
4591d82a29SGabe Black 
46fea25720SGraeme Russ #define DECLARE_GLOBAL_DATA_PTR
47fea25720SGraeme Russ 
48fea25720SGraeme Russ #endif /* __ASM_GBL_DATA_H */
49