xref: /rk3399_rockchip-uboot/arch/x86/include/asm/global_data.h (revision 8e0df066ffc40fde4cf43014114f8e472b8b9bd6)
1fea25720SGraeme Russ /*
2fea25720SGraeme Russ  * (C) Copyright 2002-2010
3fea25720SGraeme Russ  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4fea25720SGraeme Russ  *
51a459660SWolfgang 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 
13*8e0df066SSimon Glass enum pei_boot_mode_t {
14*8e0df066SSimon Glass 	PEI_BOOT_NONE = 0,
15*8e0df066SSimon Glass 	PEI_BOOT_SOFT_RESET,
16*8e0df066SSimon Glass 	PEI_BOOT_RESUME,
17*8e0df066SSimon Glass 
18*8e0df066SSimon Glass };
19*8e0df066SSimon Glass 
205cb48582SSimon Glass /* Architecture-specific global data */
215cb48582SSimon Glass struct arch_global_data {
225a35e6c4SSimon Glass 	struct global_data *gd_addr;		/* Location of Global Data */
2352f952bfSBin Meng 	uint8_t  x86;			/* CPU family */
2452f952bfSBin Meng 	uint8_t  x86_vendor;		/* CPU vendor */
2552f952bfSBin Meng 	uint8_t  x86_model;
2652f952bfSBin Meng 	uint8_t  x86_mask;
2752f952bfSBin Meng 	uint32_t x86_device;
28bc2df1afSSimon Glass 	uint64_t tsc_base;		/* Initial value returned by rdtsc() */
29bc2df1afSSimon Glass 	uint32_t tsc_base_kclocks;	/* Initial tsc as a kclocks value */
30bc2df1afSSimon Glass 	uint32_t tsc_prev;		/* For show_boot_progress() */
31258b1357SBin Meng 	uint32_t tsc_mhz;		/* TSC frequency in MHz */
32f697d528SSimon Glass 	void *new_fdt;			/* Relocated FDT */
33f67cd51eSSimon Glass 	uint32_t bist;			/* Built-in self test value */
347430f108SSimon Glass 	struct pci_controller *hose;	/* PCI hose for early use */
35*8e0df066SSimon Glass 	enum pei_boot_mode_t pei_boot_mode;
365cb48582SSimon Glass };
375cb48582SSimon Glass 
389558b48aSGraeme Russ #endif
39fea25720SGraeme Russ 
4043cff66eSSimon Glass #include <asm-generic/global_data.h>
4143cff66eSSimon Glass 
4243cff66eSSimon Glass #ifndef __ASSEMBLY__
43d8819f94SSimon Glass static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
449e6c572fSGraeme Russ {
459e6c572fSGraeme Russ 	gd_t *gd_ptr;
469e6c572fSGraeme Russ 
479e6c572fSGraeme Russ 	asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
489e6c572fSGraeme Russ 
499e6c572fSGraeme Russ 	return gd_ptr;
509e6c572fSGraeme Russ }
519e6c572fSGraeme Russ 
529e6c572fSGraeme Russ #define gd	get_fs_gd_ptr()
53fea25720SGraeme Russ 
54fea25720SGraeme Russ #endif
55fea25720SGraeme Russ 
5691d82a29SGabe Black /*
5791d82a29SGabe Black  * Our private Global Data Flags
5891d82a29SGabe Black  */
5991d82a29SGabe Black #define GD_FLG_COLD_BOOT	0x00100	/* Cold Boot */
6091d82a29SGabe Black #define GD_FLG_WARM_BOOT	0x00200	/* Warm Boot */
6191d82a29SGabe Black 
62fea25720SGraeme Russ #define DECLARE_GLOBAL_DATA_PTR
63fea25720SGraeme Russ 
64fea25720SGraeme Russ #endif /* __ASM_GBL_DATA_H */
65