global_data.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #ifdef CONFIG_OMAP
  10. #include <asm/omap_boot.h>
  11. #endif
  12. /* Architecture-specific global data */
  13. struct arch_global_data {
  14. #if defined(CONFIG_FSL_ESDHC)
  15. u32 sdhc_clk;
  16. #endif
  17. #ifdef CONFIG_AT91FAMILY
  18. /* "static data" needed by at91's clock.c */
  19. unsigned long cpu_clk_rate_hz;
  20. unsigned long main_clk_rate_hz;
  21. unsigned long mck_rate_hz;
  22. unsigned long plla_rate_hz;
  23. unsigned long pllb_rate_hz;
  24. unsigned long at91_pllb_usb_init;
  25. #endif
  26. /* "static data" needed by most of timer.c on ARM platforms */
  27. unsigned long timer_rate_hz;
  28. unsigned long tbu;
  29. unsigned long tbl;
  30. unsigned long lastinc;
  31. unsigned long long timer_reset_value;
  32. #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
  33. unsigned long tlb_addr;
  34. unsigned long tlb_size;
  35. #endif
  36. #ifdef CONFIG_OMAP
  37. struct omap_boot_parameters omap_boot_params;
  38. #endif
  39. };
  40. #include <asm-generic/global_data.h>
  41. #ifdef __clang__
  42. #define DECLARE_GLOBAL_DATA_PTR
  43. #define gd get_gd()
  44. static inline gd_t *get_gd(void)
  45. {
  46. gd_t *gd_ptr;
  47. #ifdef CONFIG_ARM64
  48. /*
  49. * Make will already error that reserving x18 is not supported at the
  50. * time of writing, clang: error: unknown argument: '-ffixed-x18'
  51. */
  52. __asm__ volatile("mov %0, x18\n" : "=r" (gd_ptr));
  53. #else
  54. __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr));
  55. #endif
  56. return gd_ptr;
  57. }
  58. #else
  59. #ifdef CONFIG_ARM64
  60. #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
  61. #else
  62. #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9")
  63. #endif
  64. #endif
  65. #endif /* __ASM_GBL_DATA_H */