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 #include <asm/processor.h> 14 15 enum pei_boot_mode_t { 16 PEI_BOOT_NONE = 0, 17 PEI_BOOT_SOFT_RESET, 18 PEI_BOOT_RESUME, 19 20 }; 21 22 struct memory_area { 23 uint64_t start; 24 uint64_t size; 25 }; 26 27 struct memory_info { 28 int num_areas; 29 uint64_t total_memory; 30 uint64_t total_32bit_memory; 31 struct memory_area area[CONFIG_NR_DRAM_BANKS]; 32 }; 33 34 #define MAX_MTRR_REQUESTS 8 35 36 /** 37 * A request for a memory region to be set up in a particular way. These 38 * requests are processed before board_init_r() is called. They are generally 39 * optional and can be ignored with some performance impact. 40 */ 41 struct mtrr_request { 42 int type; /* MTRR_TYPE_... */ 43 uint64_t start; 44 uint64_t size; 45 }; 46 47 /* Architecture-specific global data */ 48 struct arch_global_data { 49 u64 gdt[X86_GDT_NUM_ENTRIES] __aligned(16); 50 struct global_data *gd_addr; /* Location of Global Data */ 51 uint8_t x86; /* CPU family */ 52 uint8_t x86_vendor; /* CPU vendor */ 53 uint8_t x86_model; 54 uint8_t x86_mask; 55 uint32_t x86_device; 56 uint64_t tsc_base; /* Initial value returned by rdtsc() */ 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 ulong table; /* Table pointer from previous loader */ 72 }; 73 74 #endif 75 76 #include <asm-generic/global_data.h> 77 78 #ifndef __ASSEMBLY__ 79 # ifdef CONFIG_EFI_APP 80 81 #define gd global_data_ptr 82 83 #define DECLARE_GLOBAL_DATA_PTR extern struct global_data *global_data_ptr 84 # else 85 static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void) 86 { 87 gd_t *gd_ptr; 88 89 asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr)); 90 91 return gd_ptr; 92 } 93 94 #define gd get_fs_gd_ptr() 95 96 #define DECLARE_GLOBAL_DATA_PTR 97 # endif 98 99 #endif 100 101 /* 102 * Our private Global Data Flags 103 */ 104 #define GD_FLG_COLD_BOOT 0x10000 /* Cold Boot */ 105 #define GD_FLG_WARM_BOOT 0x20000 /* Warm Boot */ 106 107 #endif /* __ASM_GBL_DATA_H */ 108