global_data.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. enum pei_boot_mode_t pei_boot_mode;
  40. const struct pch_gpio_map *gpio_map; /* board GPIO map */
  41. struct memory_info meminfo; /* Memory information */
  42. #ifdef CONFIG_HAVE_FSP
  43. void *hob_list; /* FSP HOB list */
  44. #endif
  45. };
  46. #endif
  47. #include <asm-generic/global_data.h>
  48. #ifndef __ASSEMBLY__
  49. static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
  50. {
  51. gd_t *gd_ptr;
  52. asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
  53. return gd_ptr;
  54. }
  55. #define gd get_fs_gd_ptr()
  56. #endif
  57. /*
  58. * Our private Global Data Flags
  59. */
  60. #define GD_FLG_COLD_BOOT 0x00100 /* Cold Boot */
  61. #define GD_FLG_WARM_BOOT 0x00200 /* Warm Boot */
  62. #define DECLARE_GLOBAL_DATA_PTR
  63. #endif /* __ASM_GBL_DATA_H */