global_data.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2002
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. *
  6. * Copyright (c) 2017 Microsemi Corporation.
  7. * Padmarao Begari, Microsemi Corporation <padmarao.begari@microsemi.com>
  8. */
  9. #ifndef __ASM_GBL_DATA_H
  10. #define __ASM_GBL_DATA_H
  11. #include <asm/smp.h>
  12. #include <asm/u-boot.h>
  13. #include <compiler.h>
  14. /* Architecture-specific global data */
  15. struct arch_global_data {
  16. long boot_hart; /* boot hart id */
  17. phys_addr_t firmware_fdt_addr;
  18. #if CONFIG_IS_ENABLED(RISCV_ACLINT)
  19. void __iomem *aclint; /* aclint base address */
  20. #endif
  21. #ifdef CONFIG_ANDES_PLICSW
  22. void __iomem *plicsw; /* andes plicsw base address */
  23. #endif
  24. #if CONFIG_IS_ENABLED(SMP)
  25. struct ipi_data ipi[CONFIG_NR_CPUS];
  26. #endif
  27. #if !CONFIG_IS_ENABLED(XIP)
  28. #ifdef CONFIG_AVAILABLE_HARTS
  29. ulong available_harts;
  30. #endif
  31. #endif
  32. };
  33. #include <asm-generic/global_data.h>
  34. #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("gp")
  35. static inline void set_gd(volatile gd_t *gd_ptr)
  36. {
  37. #ifdef CONFIG_64BIT
  38. asm volatile("ld gp, %0\n" : : "m"(gd_ptr));
  39. #else
  40. asm volatile("lw gp, %0\n" : : "m"(gd_ptr));
  41. #endif
  42. }
  43. #endif /* __ASM_GBL_DATA_H */