global_data.h 2.6 KB

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