xref: /rk3399_rockchip-uboot/arch/x86/include/asm/global_data.h (revision 437c2b7cd04f017cf79dcde63e7d9035f8cd99e5)
1 /*
2  * (C) Copyright 2002-2010
3  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #ifndef	__ASM_GBL_DATA_H
9 #define __ASM_GBL_DATA_H
10 
11 #ifndef __ASSEMBLY__
12 
13 enum pei_boot_mode_t {
14 	PEI_BOOT_NONE = 0,
15 	PEI_BOOT_SOFT_RESET,
16 	PEI_BOOT_RESUME,
17 
18 };
19 
20 /* Architecture-specific global data */
21 struct arch_global_data {
22 	struct global_data *gd_addr;		/* Location of Global Data */
23 	uint8_t  x86;			/* CPU family */
24 	uint8_t  x86_vendor;		/* CPU vendor */
25 	uint8_t  x86_model;
26 	uint8_t  x86_mask;
27 	uint32_t x86_device;
28 	uint64_t tsc_base;		/* Initial value returned by rdtsc() */
29 	uint32_t tsc_base_kclocks;	/* Initial tsc as a kclocks value */
30 	uint32_t tsc_prev;		/* For show_boot_progress() */
31 	uint32_t tsc_mhz;		/* TSC frequency in MHz */
32 	void *new_fdt;			/* Relocated FDT */
33 	uint32_t bist;			/* Built-in self test value */
34 	struct pci_controller *hose;	/* PCI hose for early use */
35 	enum pei_boot_mode_t pei_boot_mode;
36 	const struct pch_gpio_map *gpio_map;	/* board GPIO map */
37 };
38 
39 #endif
40 
41 #include <asm-generic/global_data.h>
42 
43 #ifndef __ASSEMBLY__
44 static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
45 {
46 	gd_t *gd_ptr;
47 
48 	asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
49 
50 	return gd_ptr;
51 }
52 
53 #define gd	get_fs_gd_ptr()
54 
55 #endif
56 
57 /*
58  * Our private Global Data Flags
59  */
60 #define GD_FLG_COLD_BOOT	0x00100	/* Cold Boot */
61 #define GD_FLG_WARM_BOOT	0x00200	/* Warm Boot */
62 
63 #define DECLARE_GLOBAL_DATA_PTR
64 
65 #endif /* __ASM_GBL_DATA_H */
66