blob: 4d9eac676ee91030221533c7a63131cd80d8ffdb [file] [log] [blame]
wdenk2262cfe2002-11-18 00:14:45 +00001/*
Wolfgang Denk91a76752010-07-24 20:22:02 +02002 * (C) Copyright 2002-2010
wdenk2262cfe2002-11-18 00:14:45 +00003 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenk2262cfe2002-11-18 00:14:45 +00006 */
7
8#ifndef __ASM_GBL_DATA_H
9#define __ASM_GBL_DATA_H
Simon Glass5cb48582012-12-13 20:48:30 +000010
11#ifndef __ASSEMBLY__
12
Simon Glass8e0df062014-11-12 22:42:23 -070013enum pei_boot_mode_t {
14 PEI_BOOT_NONE = 0,
15 PEI_BOOT_SOFT_RESET,
16 PEI_BOOT_RESUME,
17
18};
19
Simon Glass65dd74a2014-11-12 22:42:28 -070020struct memory_area {
21 uint64_t start;
22 uint64_t size;
23};
24
25struct 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 Glassaff25232015-01-01 16:18:07 -070032#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 */
39struct mtrr_request {
40 int type; /* MTRR_TYPE_... */
41 uint64_t start;
42 uint64_t size;
43};
44
Simon Glass5cb48582012-12-13 20:48:30 +000045/* Architecture-specific global data */
46struct arch_global_data {
Bin Meng49491662015-01-22 11:29:40 +080047 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;
Bin Meng52f952b2014-11-09 22:18:56 +080052 uint32_t x86_device;
Simon Glassbc2df1a2013-02-28 19:26:12 +000053 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 Meng258b1352014-11-09 22:19:35 +080056 uint32_t tsc_mhz; /* TSC frequency in MHz */
Simon Glassf697d522013-02-28 19:26:15 +000057 void *new_fdt; /* Relocated FDT */
Simon Glassf67cd512014-11-06 13:20:10 -070058 uint32_t bist; /* Built-in self test value */
Simon Glass8e0df062014-11-12 22:42:23 -070059 enum pei_boot_mode_t pei_boot_mode;
Simon Glass1b4f25f2014-11-12 22:42:24 -070060 const struct pch_gpio_map *gpio_map; /* board GPIO map */
Simon Glass65dd74a2014-11-12 22:42:28 -070061 struct memory_info meminfo; /* Memory information */
Bin Mengbceb9f02014-12-12 21:05:31 +080062#ifdef CONFIG_HAVE_FSP
Bin Meng49491662015-01-22 11:29:40 +080063 void *hob_list; /* FSP HOB list */
Bin Mengbceb9f02014-12-12 21:05:31 +080064#endif
Simon Glassaff25232015-01-01 16:18:07 -070065 struct mtrr_request mtrr_req[MAX_MTRR_REQUESTS];
66 int mtrr_req_count;
Bin Meng49491662015-01-22 11:29:40 +080067 int has_mtrr;
Simon Glass191c0082015-01-19 22:16:14 -070068 /* MRC training data to save for the next boot */
69 char *mrc_output;
70 unsigned int mrc_output_len;
Simon Glass52845292015-04-28 20:25:15 -060071 void *gdt; /* Global descriptor table */
Simon Glass5cb48582012-12-13 20:48:30 +000072};
73
Graeme Russ9558b482011-09-01 00:48:27 +000074#endif
wdenk2262cfe2002-11-18 00:14:45 +000075
Simon Glass43cff662012-12-13 20:49:27 +000076#include <asm-generic/global_data.h>
77
78#ifndef __ASSEMBLY__
Simon Glassd8819f92013-06-11 11:14:52 -070079static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
Graeme Russ9e6c5722011-12-31 22:58:15 +110080{
81 gd_t *gd_ptr;
82
83 asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
84
85 return gd_ptr;
86}
87
88#define gd get_fs_gd_ptr()
Graeme Russ161b3582010-10-07 20:03:29 +110089
90#endif
91
Gabe Black91d82a22012-11-03 11:41:28 +000092/*
93 * Our private Global Data Flags
94 */
95#define GD_FLG_COLD_BOOT 0x00100 /* Cold Boot */
96#define GD_FLG_WARM_BOOT 0x00200 /* Warm Boot */
97
Graeme Russ3ef96de2008-09-07 07:08:42 +100098#define DECLARE_GLOBAL_DATA_PTR
wdenk2262cfe2002-11-18 00:14:45 +000099
100#endif /* __ASM_GBL_DATA_H */