global_data.h 2.2 KB

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