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 struct memory_area {
21 	uint64_t start;
22 	uint64_t size;
23 };
24 
25 struct memory_info {
26 	int num_areas;
27 	uint64_t total_memory;
28 	uint64_t total_32bit_memory;
29 	struct memory_area area[CONFIG_NR_DRAM_BANKS];
30 };
31 
32 #define MAX_MTRR_REQUESTS	8
33 
34 /**
35  * A request for a memory region to be set up in a particular way. These
36  * requests are processed before board_init_r() is called. They are generally
37  * optional and can be ignored with some performance impact.
38  */
39 struct mtrr_request {
40 	int type;		/* MTRR_TYPE_... */
41 	uint64_t start;
42 	uint64_t size;
43 };
44 
45 /* Architecture-specific global data */
46 struct arch_global_data {
47 	struct global_data *gd_addr;	/* Location of Global Data */
48 	uint8_t x86;			/* CPU family */
49 	uint8_t x86_vendor;		/* CPU vendor */
50 	uint8_t x86_model;
51 	uint8_t x86_mask;
52 	uint32_t x86_device;
53 	uint64_t tsc_base;		/* Initial value returned by rdtsc() */
54 	uint32_t tsc_base_kclocks;	/* Initial tsc as a kclocks value */
55 	uint32_t tsc_prev;		/* For show_boot_progress() */
56 	uint32_t tsc_mhz;		/* TSC frequency in MHz */
57 	void *new_fdt;			/* Relocated FDT */
58 	uint32_t bist;			/* Built-in self test value */
59 	enum pei_boot_mode_t pei_boot_mode;
60 	const struct pch_gpio_map *gpio_map;	/* board GPIO map */
61 	struct memory_info meminfo;	/* Memory information */
62 #ifdef CONFIG_HAVE_FSP
63 	void *hob_list;			/* FSP HOB list */
64 #endif
65 	struct mtrr_request mtrr_req[MAX_MTRR_REQUESTS];
66 	int mtrr_req_count;
67 	int has_mtrr;
68 	/* MRC training data to save for the next boot */
69 	char *mrc_output;
70 	unsigned int mrc_output_len;
71 };
72 
73 #endif
74 
75 #include <asm-generic/global_data.h>
76 
77 #ifndef __ASSEMBLY__
78 static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
79 {
80 	gd_t *gd_ptr;
81 
82 	asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
83 
84 	return gd_ptr;
85 }
86 
87 #define gd	get_fs_gd_ptr()
88 
89 #endif
90 
91 /*
92  * Our private Global Data Flags
93  */
94 #define GD_FLG_COLD_BOOT	0x00100	/* Cold Boot */
95 #define GD_FLG_WARM_BOOT	0x00200	/* Warm Boot */
96 
97 #define DECLARE_GLOBAL_DATA_PTR
98 
99 #endif /* __ASM_GBL_DATA_H */
100