global_data.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. #ifndef __ASM_GBL_DATA_H
  8. #define __ASM_GBL_DATA_H
  9. #ifndef __ASSEMBLY__
  10. #include <asm/processor.h>
  11. enum pei_boot_mode_t {
  12. PEI_BOOT_NONE = 0,
  13. PEI_BOOT_SOFT_RESET,
  14. PEI_BOOT_RESUME,
  15. };
  16. struct memory_area {
  17. uint64_t start;
  18. uint64_t size;
  19. };
  20. struct memory_info {
  21. int num_areas;
  22. uint64_t total_memory;
  23. uint64_t total_32bit_memory;
  24. struct memory_area area[CONFIG_NR_DRAM_BANKS];
  25. };
  26. #define MAX_MTRR_REQUESTS 8
  27. /**
  28. * A request for a memory region to be set up in a particular way. These
  29. * requests are processed before board_init_r() is called. They are generally
  30. * optional and can be ignored with some performance impact.
  31. */
  32. struct mtrr_request {
  33. int type; /* MTRR_TYPE_... */
  34. uint64_t start;
  35. uint64_t size;
  36. };
  37. /* Architecture-specific global data */
  38. struct arch_global_data {
  39. u64 gdt[X86_GDT_NUM_ENTRIES] __aligned(16);
  40. struct global_data *gd_addr; /* Location of Global Data */
  41. uint8_t x86; /* CPU family */
  42. uint8_t x86_vendor; /* CPU vendor */
  43. uint8_t x86_model;
  44. uint8_t x86_mask;
  45. uint32_t x86_device;
  46. uint64_t tsc_base; /* Initial value returned by rdtsc() */
  47. void *new_fdt; /* Relocated FDT */
  48. uint32_t bist; /* Built-in self test value */
  49. enum pei_boot_mode_t pei_boot_mode;
  50. const struct pch_gpio_map *gpio_map; /* board GPIO map */
  51. struct memory_info meminfo; /* Memory information */
  52. #ifdef CONFIG_HAVE_FSP
  53. void *hob_list; /* FSP HOB list */
  54. #endif
  55. struct mtrr_request mtrr_req[MAX_MTRR_REQUESTS];
  56. int mtrr_req_count;
  57. int has_mtrr;
  58. /* MRC training data to save for the next boot */
  59. char *mrc_output;
  60. unsigned int mrc_output_len;
  61. ulong table; /* Table pointer from previous loader */
  62. };
  63. #endif
  64. #include <asm-generic/global_data.h>
  65. #ifndef __ASSEMBLY__
  66. # ifdef CONFIG_EFI_APP
  67. #define gd global_data_ptr
  68. #define DECLARE_GLOBAL_DATA_PTR extern struct global_data *global_data_ptr
  69. # else
  70. static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
  71. {
  72. gd_t *gd_ptr;
  73. asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
  74. return gd_ptr;
  75. }
  76. #define gd get_fs_gd_ptr()
  77. #define DECLARE_GLOBAL_DATA_PTR
  78. # endif
  79. #endif
  80. /*
  81. * Our private Global Data Flags
  82. */
  83. #define GD_FLG_COLD_BOOT 0x10000 /* Cold Boot */
  84. #define GD_FLG_WARM_BOOT 0x20000 /* Warm Boot */
  85. #endif /* __ASM_GBL_DATA_H */