global_data.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. uint32_t tsc_base_kclocks; /* Initial tsc as a kclocks value */
  48. uint32_t tsc_prev; /* For show_boot_progress() */
  49. uint32_t tsc_mhz; /* TSC frequency in MHz */
  50. void *new_fdt; /* Relocated FDT */
  51. uint32_t bist; /* Built-in self test value */
  52. enum pei_boot_mode_t pei_boot_mode;
  53. const struct pch_gpio_map *gpio_map; /* board GPIO map */
  54. struct memory_info meminfo; /* Memory information */
  55. #ifdef CONFIG_HAVE_FSP
  56. void *hob_list; /* FSP HOB list */
  57. #endif
  58. struct mtrr_request mtrr_req[MAX_MTRR_REQUESTS];
  59. int mtrr_req_count;
  60. int has_mtrr;
  61. /* MRC training data to save for the next boot */
  62. char *mrc_output;
  63. unsigned int mrc_output_len;
  64. ulong table; /* Table pointer from previous loader */
  65. };
  66. #endif
  67. #include <asm-generic/global_data.h>
  68. #ifndef __ASSEMBLY__
  69. # ifdef CONFIG_EFI_APP
  70. #define gd global_data_ptr
  71. #define DECLARE_GLOBAL_DATA_PTR extern struct global_data *global_data_ptr
  72. # else
  73. static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
  74. {
  75. gd_t *gd_ptr;
  76. asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
  77. return gd_ptr;
  78. }
  79. #define gd get_fs_gd_ptr()
  80. #define DECLARE_GLOBAL_DATA_PTR
  81. # endif
  82. #endif
  83. /*
  84. * Our private Global Data Flags
  85. */
  86. #define GD_FLG_COLD_BOOT 0x10000 /* Cold Boot */
  87. #define GD_FLG_WARM_BOOT 0x20000 /* Warm Boot */
  88. #endif /* __ASM_GBL_DATA_H */