global_data.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2002-2010
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. */
  6. #ifndef __ASM_GBL_DATA_H
  7. #define __ASM_GBL_DATA_H
  8. /* Architecture-specific global data */
  9. struct arch_global_data {
  10. #if defined(CONFIG_FSL_ESDHC) || defined(CONFIG_FSL_ESDHC_IMX)
  11. u32 sdhc_clk;
  12. #endif
  13. #if defined(CONFIG_U_QE)
  14. u32 qe_clk;
  15. u32 brg_clk;
  16. uint mp_alloc_base;
  17. uint mp_alloc_top;
  18. #endif /* CONFIG_U_QE */
  19. #ifdef CONFIG_AT91FAMILY
  20. /* "static data" needed by at91's clock.c */
  21. unsigned long cpu_clk_rate_hz;
  22. unsigned long main_clk_rate_hz;
  23. unsigned long mck_rate_hz;
  24. unsigned long plla_rate_hz;
  25. unsigned long pllb_rate_hz;
  26. unsigned long at91_pllb_usb_init;
  27. #endif
  28. /* "static data" needed by most of timer.c on ARM platforms */
  29. unsigned long timer_rate_hz;
  30. unsigned int tbu;
  31. unsigned int tbl;
  32. unsigned long lastinc;
  33. unsigned long long timer_reset_value;
  34. #if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
  35. unsigned long tlb_addr;
  36. unsigned long tlb_size;
  37. #if defined(CONFIG_ARM64)
  38. unsigned long tlb_fillptr;
  39. unsigned long tlb_emerg;
  40. #endif
  41. #endif
  42. #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
  43. #define MEM_RESERVE_SECURE_SECURED 0x1
  44. #define MEM_RESERVE_SECURE_MAINTAINED 0x2
  45. #define MEM_RESERVE_SECURE_ADDR_MASK (~0x3)
  46. /*
  47. * Secure memory addr
  48. * This variable needs maintenance if the RAM base is not zero,
  49. * or if RAM splits into non-consecutive banks. It also has a
  50. * flag indicating the secure memory is marked as secure by MMU.
  51. * Flags used: 0x1 secured
  52. * 0x2 maintained
  53. */
  54. phys_addr_t secure_ram;
  55. unsigned long tlb_allocated;
  56. #endif
  57. #ifdef CONFIG_RESV_RAM
  58. /*
  59. * Reserved RAM for memory resident, eg. Management Complex (MC)
  60. * driver which continues to run after U-Boot exits.
  61. */
  62. phys_addr_t resv_ram;
  63. #endif
  64. #ifdef CONFIG_ARCH_OMAP2PLUS
  65. u32 omap_boot_device;
  66. u32 omap_boot_mode;
  67. u8 omap_ch_flags;
  68. #endif
  69. #if defined(CONFIG_FSL_LSCH3) && defined(CONFIG_SYS_FSL_HAS_DP_DDR)
  70. unsigned long mem2_clk;
  71. #endif
  72. #ifdef CONFIG_ARCH_IMX8
  73. struct udevice *scu_dev;
  74. #endif
  75. };
  76. #include <asm-generic/global_data.h>
  77. #ifdef __clang__
  78. #define DECLARE_GLOBAL_DATA_PTR
  79. #define gd get_gd()
  80. static inline gd_t *get_gd(void)
  81. {
  82. gd_t *gd_ptr;
  83. #ifdef CONFIG_ARM64
  84. /*
  85. * Make will already error that reserving x18 is not supported at the
  86. * time of writing, clang: error: unknown argument: '-ffixed-x18'
  87. */
  88. __asm__ volatile("mov %0, x18\n" : "=r" (gd_ptr));
  89. #else
  90. __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr));
  91. #endif
  92. return gd_ptr;
  93. }
  94. #else
  95. #ifdef CONFIG_ARM64
  96. #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
  97. #else
  98. #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9")
  99. #endif
  100. #endif
  101. #endif /* __ASM_GBL_DATA_H */