wdenk | 2262cfe | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 1 | /* |
Wolfgang Denk | 91a7675 | 2010-07-24 20:22:02 +0200 | [diff] [blame] | 2 | * (C) Copyright 2002-2010 |
wdenk | 2262cfe | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 2262cfe | 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 | 5cb4858 | 2012-12-13 20:48:30 +0000 | [diff] [blame] | 10 | |
| 11 | #ifndef __ASSEMBLY__ |
| 12 | |
Simon Glass | 8e0df06 | 2014-11-12 22:42:23 -0700 | [diff] [blame] | 13 | enum pei_boot_mode_t { |
| 14 | PEI_BOOT_NONE = 0, |
| 15 | PEI_BOOT_SOFT_RESET, |
| 16 | PEI_BOOT_RESUME, |
| 17 | |
| 18 | }; |
| 19 | |
Simon Glass | 65dd74a | 2014-11-12 22:42:28 -0700 | [diff] [blame] | 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 | |
Simon Glass | aff2523 | 2015-01-01 16:18:07 -0700 | [diff] [blame] | 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 | |
Simon Glass | 5cb4858 | 2012-12-13 20:48:30 +0000 | [diff] [blame] | 45 | /* Architecture-specific global data */ |
| 46 | struct arch_global_data { |
Simon Glass | 5a35e6c | 2012-12-13 20:48:41 +0000 | [diff] [blame] | 47 | struct global_data *gd_addr; /* Location of Global Data */ |
Bin Meng | 52f952b | 2014-11-09 22:18:56 +0800 | [diff] [blame] | 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; |
Simon Glass | bc2df1a | 2013-02-28 19:26:12 +0000 | [diff] [blame] | 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() */ |
Bin Meng | 258b135 | 2014-11-09 22:19:35 +0800 | [diff] [blame] | 56 | uint32_t tsc_mhz; /* TSC frequency in MHz */ |
Simon Glass | f697d52 | 2013-02-28 19:26:15 +0000 | [diff] [blame] | 57 | void *new_fdt; /* Relocated FDT */ |
Simon Glass | f67cd51 | 2014-11-06 13:20:10 -0700 | [diff] [blame] | 58 | uint32_t bist; /* Built-in self test value */ |
Simon Glass | 8e0df06 | 2014-11-12 22:42:23 -0700 | [diff] [blame] | 59 | enum pei_boot_mode_t pei_boot_mode; |
Simon Glass | 1b4f25f | 2014-11-12 22:42:24 -0700 | [diff] [blame] | 60 | const struct pch_gpio_map *gpio_map; /* board GPIO map */ |
Simon Glass | 65dd74a | 2014-11-12 22:42:28 -0700 | [diff] [blame] | 61 | struct memory_info meminfo; /* Memory information */ |
Bin Meng | bceb9f0 | 2014-12-12 21:05:31 +0800 | [diff] [blame] | 62 | #ifdef CONFIG_HAVE_FSP |
| 63 | void *hob_list; /* FSP HOB list */ |
| 64 | #endif |
Simon Glass | aff2523 | 2015-01-01 16:18:07 -0700 | [diff] [blame] | 65 | struct mtrr_request mtrr_req[MAX_MTRR_REQUESTS]; |
| 66 | int mtrr_req_count; |
Simon Glass | 5cb4858 | 2012-12-13 20:48:30 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
Graeme Russ | 9558b48 | 2011-09-01 00:48:27 +0000 | [diff] [blame] | 69 | #endif |
wdenk | 2262cfe | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 70 | |
Simon Glass | 43cff66 | 2012-12-13 20:49:27 +0000 | [diff] [blame] | 71 | #include <asm-generic/global_data.h> |
| 72 | |
| 73 | #ifndef __ASSEMBLY__ |
Simon Glass | d8819f9 | 2013-06-11 11:14:52 -0700 | [diff] [blame] | 74 | static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void) |
Graeme Russ | 9e6c572 | 2011-12-31 22:58:15 +1100 | [diff] [blame] | 75 | { |
| 76 | gd_t *gd_ptr; |
| 77 | |
| 78 | asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr)); |
| 79 | |
| 80 | return gd_ptr; |
| 81 | } |
| 82 | |
| 83 | #define gd get_fs_gd_ptr() |
Graeme Russ | 161b358 | 2010-10-07 20:03:29 +1100 | [diff] [blame] | 84 | |
| 85 | #endif |
| 86 | |
Gabe Black | 91d82a2 | 2012-11-03 11:41:28 +0000 | [diff] [blame] | 87 | /* |
| 88 | * Our private Global Data Flags |
| 89 | */ |
| 90 | #define GD_FLG_COLD_BOOT 0x00100 /* Cold Boot */ |
| 91 | #define GD_FLG_WARM_BOOT 0x00200 /* Warm Boot */ |
| 92 | |
Graeme Russ | 3ef96de | 2008-09-07 07:08:42 +1000 | [diff] [blame] | 93 | #define DECLARE_GLOBAL_DATA_PTR |
wdenk | 2262cfe | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 94 | |
| 95 | #endif /* __ASM_GBL_DATA_H */ |