blob: 03d491a17f786e5094a5aba016a12aac158b0f7e [file] [log] [blame]
wdenk591dda52002-11-18 00:14:45 +00001/*
Wolfgang Denkf710efd2010-07-24 20:22:02 +02002 * (C) Copyright 2002-2010
wdenk591dda52002-11-18 00:14:45 +00003 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenk591dda52002-11-18 00:14:45 +00006 */
7
8#ifndef __ASM_GBL_DATA_H
9#define __ASM_GBL_DATA_H
Simon Glass3ac47d72012-12-13 20:48:30 +000010
11#ifndef __ASSEMBLY__
12
Simon Glass30580fc2014-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 Glass268eefd2014-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 Glass3ac47d72012-12-13 20:48:30 +000032/* Architecture-specific global data */
33struct arch_global_data {
Simon Glass2e4df992012-12-13 20:48:41 +000034 struct global_data *gd_addr; /* Location of Global Data */
Bin Meng035c1d22014-11-09 22:18:56 +080035 uint8_t x86; /* CPU family */
36 uint8_t x86_vendor; /* CPU vendor */
37 uint8_t x86_model;
38 uint8_t x86_mask;
39 uint32_t x86_device;
Simon Glass6fa6e4a2013-02-28 19:26:12 +000040 uint64_t tsc_base; /* Initial value returned by rdtsc() */
41 uint32_t tsc_base_kclocks; /* Initial tsc as a kclocks value */
42 uint32_t tsc_prev; /* For show_boot_progress() */
Bin Mengaed37bf2014-11-09 22:19:35 +080043 uint32_t tsc_mhz; /* TSC frequency in MHz */
Simon Glass347c05b2013-02-28 19:26:15 +000044 void *new_fdt; /* Relocated FDT */
Simon Glass1f4476c2014-11-06 13:20:10 -070045 uint32_t bist; /* Built-in self test value */
Simon Glassa54d9812014-11-12 22:42:12 -070046 struct pci_controller *hose; /* PCI hose for early use */
Simon Glass30580fc2014-11-12 22:42:23 -070047 enum pei_boot_mode_t pei_boot_mode;
Simon Glass60af0172014-11-12 22:42:24 -070048 const struct pch_gpio_map *gpio_map; /* board GPIO map */
Simon Glass268eefd2014-11-12 22:42:28 -070049 struct memory_info meminfo; /* Memory information */
Bin Meng005f0af2014-12-12 21:05:31 +080050#ifdef CONFIG_HAVE_FSP
51 void *hob_list; /* FSP HOB list */
52#endif
Simon Glass3ac47d72012-12-13 20:48:30 +000053};
54
Graeme Russ3c28f482011-09-01 00:48:27 +000055#endif
wdenk591dda52002-11-18 00:14:45 +000056
Simon Glassd3887632012-12-13 20:49:27 +000057#include <asm-generic/global_data.h>
58
59#ifndef __ASSEMBLY__
Simon Glass42081ce2013-06-11 11:14:52 -070060static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
Graeme Russ35368962011-12-31 22:58:15 +110061{
62 gd_t *gd_ptr;
63
64 asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
65
66 return gd_ptr;
67}
68
69#define gd get_fs_gd_ptr()
Graeme Russ5fb91cc2010-10-07 20:03:29 +110070
71#endif
72
Gabe Blackef899322012-11-03 11:41:28 +000073/*
74 * Our private Global Data Flags
75 */
76#define GD_FLG_COLD_BOOT 0x00100 /* Cold Boot */
77#define GD_FLG_WARM_BOOT 0x00200 /* Warm Boot */
78
Graeme Russ2fe2a972008-09-07 07:08:42 +100079#define DECLARE_GLOBAL_DATA_PTR
wdenk591dda52002-11-18 00:14:45 +000080
81#endif /* __ASM_GBL_DATA_H */