wdenk | 591dda5 | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 1 | /* |
Wolfgang Denk | f710efd | 2010-07-24 20:22:02 +0200 | [diff] [blame] | 2 | * (C) Copyright 2002-2010 |
wdenk | 591dda5 | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 591dda5 | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef __ASM_GBL_DATA_H |
| 9 | #define __ASM_GBL_DATA_H |
Simon Glass | 3ac47d7 | 2012-12-13 20:48:30 +0000 | [diff] [blame] | 10 | |
| 11 | #ifndef __ASSEMBLY__ |
| 12 | |
Simon Glass | 9909bf3 | 2015-08-10 20:44:31 -0600 | [diff] [blame] | 13 | #include <asm/processor.h> |
| 14 | |
Simon Glass | 30580fc | 2014-11-12 22:42:23 -0700 | [diff] [blame] | 15 | enum pei_boot_mode_t { |
| 16 | PEI_BOOT_NONE = 0, |
| 17 | PEI_BOOT_SOFT_RESET, |
| 18 | PEI_BOOT_RESUME, |
| 19 | |
| 20 | }; |
| 21 | |
Simon Glass | 268eefd | 2014-11-12 22:42:28 -0700 | [diff] [blame] | 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 | |
Simon Glass | 7bf5b9e | 2015-01-01 16:18:07 -0700 | [diff] [blame] | 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 | |
Simon Glass | 3ac47d7 | 2012-12-13 20:48:30 +0000 | [diff] [blame] | 47 | /* Architecture-specific global data */ |
| 48 | struct arch_global_data { |
Simon Glass | 9909bf3 | 2015-08-10 20:44:31 -0600 | [diff] [blame] | 49 | u64 gdt[X86_GDT_NUM_ENTRIES] __aligned(16); |
Bin Meng | 47eac04 | 2015-01-22 11:29:40 +0800 | [diff] [blame] | 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; |
Bin Meng | 035c1d2 | 2014-11-09 22:18:56 +0800 | [diff] [blame] | 55 | uint32_t x86_device; |
Simon Glass | 6fa6e4a | 2013-02-28 19:26:12 +0000 | [diff] [blame] | 56 | uint64_t tsc_base; /* Initial value returned by rdtsc() */ |
| 57 | uint32_t tsc_base_kclocks; /* Initial tsc as a kclocks value */ |
| 58 | uint32_t tsc_prev; /* For show_boot_progress() */ |
Bin Meng | aed37bf | 2014-11-09 22:19:35 +0800 | [diff] [blame] | 59 | uint32_t tsc_mhz; /* TSC frequency in MHz */ |
Simon Glass | 347c05b | 2013-02-28 19:26:15 +0000 | [diff] [blame] | 60 | void *new_fdt; /* Relocated FDT */ |
Simon Glass | 1f4476c | 2014-11-06 13:20:10 -0700 | [diff] [blame] | 61 | uint32_t bist; /* Built-in self test value */ |
Simon Glass | 30580fc | 2014-11-12 22:42:23 -0700 | [diff] [blame] | 62 | enum pei_boot_mode_t pei_boot_mode; |
Simon Glass | 60af017 | 2014-11-12 22:42:24 -0700 | [diff] [blame] | 63 | const struct pch_gpio_map *gpio_map; /* board GPIO map */ |
Simon Glass | 268eefd | 2014-11-12 22:42:28 -0700 | [diff] [blame] | 64 | struct memory_info meminfo; /* Memory information */ |
Bin Meng | 005f0af | 2014-12-12 21:05:31 +0800 | [diff] [blame] | 65 | #ifdef CONFIG_HAVE_FSP |
Bin Meng | 47eac04 | 2015-01-22 11:29:40 +0800 | [diff] [blame] | 66 | void *hob_list; /* FSP HOB list */ |
Bin Meng | 005f0af | 2014-12-12 21:05:31 +0800 | [diff] [blame] | 67 | #endif |
Simon Glass | 7bf5b9e | 2015-01-01 16:18:07 -0700 | [diff] [blame] | 68 | struct mtrr_request mtrr_req[MAX_MTRR_REQUESTS]; |
| 69 | int mtrr_req_count; |
Bin Meng | 47eac04 | 2015-01-22 11:29:40 +0800 | [diff] [blame] | 70 | int has_mtrr; |
Simon Glass | 428dfa4 | 2015-01-19 22:16:14 -0700 | [diff] [blame] | 71 | /* MRC training data to save for the next boot */ |
| 72 | char *mrc_output; |
| 73 | unsigned int mrc_output_len; |
Simon Glass | f95ad8c | 2015-08-04 12:33:57 -0600 | [diff] [blame] | 74 | ulong table; /* Table pointer from previous loader */ |
Simon Glass | 3ac47d7 | 2012-12-13 20:48:30 +0000 | [diff] [blame] | 75 | }; |
| 76 | |
Graeme Russ | 3c28f48 | 2011-09-01 00:48:27 +0000 | [diff] [blame] | 77 | #endif |
wdenk | 591dda5 | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 78 | |
Simon Glass | d388763 | 2012-12-13 20:49:27 +0000 | [diff] [blame] | 79 | #include <asm-generic/global_data.h> |
| 80 | |
| 81 | #ifndef __ASSEMBLY__ |
Simon Glass | 7f65c09 | 2015-07-31 09:31:35 -0600 | [diff] [blame] | 82 | # ifdef CONFIG_EFI_APP |
| 83 | |
| 84 | #define gd global_data_ptr |
| 85 | |
| 86 | #define DECLARE_GLOBAL_DATA_PTR extern struct global_data *global_data_ptr |
| 87 | # else |
Simon Glass | 42081ce | 2013-06-11 11:14:52 -0700 | [diff] [blame] | 88 | static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void) |
Graeme Russ | 3536896 | 2011-12-31 22:58:15 +1100 | [diff] [blame] | 89 | { |
| 90 | gd_t *gd_ptr; |
| 91 | |
| 92 | asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr)); |
| 93 | |
| 94 | return gd_ptr; |
| 95 | } |
| 96 | |
| 97 | #define gd get_fs_gd_ptr() |
Graeme Russ | 5fb91cc | 2010-10-07 20:03:29 +1100 | [diff] [blame] | 98 | |
Simon Glass | 5d18dc9 | 2015-07-31 09:31:28 -0600 | [diff] [blame] | 99 | #define DECLARE_GLOBAL_DATA_PTR |
Simon Glass | 7f65c09 | 2015-07-31 09:31:35 -0600 | [diff] [blame] | 100 | # endif |
Simon Glass | 5d18dc9 | 2015-07-31 09:31:28 -0600 | [diff] [blame] | 101 | |
Graeme Russ | 5fb91cc | 2010-10-07 20:03:29 +1100 | [diff] [blame] | 102 | #endif |
| 103 | |
Gabe Black | ef89932 | 2012-11-03 11:41:28 +0000 | [diff] [blame] | 104 | /* |
| 105 | * Our private Global Data Flags |
| 106 | */ |
Simon Glass | 5d18dc9 | 2015-07-31 09:31:28 -0600 | [diff] [blame] | 107 | #define GD_FLG_COLD_BOOT 0x10000 /* Cold Boot */ |
| 108 | #define GD_FLG_WARM_BOOT 0x20000 /* Warm Boot */ |
wdenk | 591dda5 | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 109 | |
| 110 | #endif /* __ASM_GBL_DATA_H */ |