cpu_func.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2000-2009
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. * Copyright 2019 Google LLC
  6. */
  7. #ifndef __CPU_LEGACY_H
  8. #define __CPU_LEGACY_H
  9. #include <linux/types.h>
  10. /*
  11. * Multicore arch functions
  12. *
  13. * These should be moved to use the CPU uclass.
  14. */
  15. int cpu_status(u32 nr);
  16. int cpu_reset(u32 nr);
  17. int cpu_disable(u32 nr);
  18. int cpu_release(u32 nr, int argc, char * const argv[]);
  19. static inline int cpumask_next(int cpu, unsigned int mask)
  20. {
  21. for (cpu++; !((1 << cpu) & mask); cpu++)
  22. ;
  23. return cpu;
  24. }
  25. #define for_each_cpu(iter, cpu, num_cpus, mask) \
  26. for (iter = 0, cpu = cpumask_next(-1, mask); \
  27. iter < num_cpus; \
  28. iter++, cpu = cpumask_next(cpu, mask)) \
  29. int cpu_numcores(void);
  30. int cpu_num_dspcores(void);
  31. u32 cpu_mask(void);
  32. u32 cpu_dsp_mask(void);
  33. int is_core_valid(unsigned int core);
  34. /**
  35. * checkcpu() - perform an early check of the CPU
  36. *
  37. * This is used on PowerPC, SH and X86 machines as a CPU init mechanism. It is
  38. * called during the pre-relocation init sequence in board_init_f().
  39. *
  40. * @return 0 if oK, -ve on error
  41. */
  42. int checkcpu(void);
  43. void smp_set_core_boot_addr(unsigned long addr, int corenr);
  44. void smp_kick_all_cpus(void);
  45. int icache_status(void);
  46. void icache_enable(void);
  47. void icache_disable(void);
  48. int dcache_status(void);
  49. void dcache_enable(void);
  50. void dcache_disable(void);
  51. void mmu_disable(void);
  52. #endif