global_data.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. /* Architecture-specific global data */
  26. struct arch_global_data {
  27. struct global_data *gd_addr; /* Location of Global Data */
  28. uint8_t x86; /* CPU family */
  29. uint8_t x86_vendor; /* CPU vendor */
  30. uint8_t x86_model;
  31. uint8_t x86_mask;
  32. uint32_t x86_device;
  33. uint64_t tsc_base; /* Initial value returned by rdtsc() */
  34. uint32_t tsc_base_kclocks; /* Initial tsc as a kclocks value */
  35. uint32_t tsc_prev; /* For show_boot_progress() */
  36. uint32_t tsc_mhz; /* TSC frequency in MHz */
  37. void *new_fdt; /* Relocated FDT */
  38. uint32_t bist; /* Built-in self test value */
  39. struct pci_controller *hose; /* PCI hose for early use */
  40. enum pei_boot_mode_t pei_boot_mode;
  41. const struct pch_gpio_map *gpio_map; /* board GPIO map */
  42. struct memory_info meminfo; /* Memory information */
  43. #ifdef CONFIG_HAVE_FSP
  44. void *hob_list; /* FSP HOB list */
  45. #endif
  46. };
  47. #endif
  48. #include <asm-generic/global_data.h>
  49. #ifndef __ASSEMBLY__
  50. static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
  51. {
  52. gd_t *gd_ptr;
  53. asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
  54. return gd_ptr;
  55. }
  56. #define gd get_fs_gd_ptr()
  57. #endif
  58. /*
  59. * Our private Global Data Flags
  60. */
  61. #define GD_FLG_COLD_BOOT 0x00100 /* Cold Boot */
  62. #define GD_FLG_WARM_BOOT 0x00200 /* Warm Boot */
  63. #define DECLARE_GLOBAL_DATA_PTR
  64. #endif /* __ASM_GBL_DATA_H */