mach_desc.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com)
  4. *
  5. * based on METAG mach/arch.h (which in turn was based on ARM)
  6. */
  7. #ifndef _ASM_ARC_MACH_DESC_H_
  8. #define _ASM_ARC_MACH_DESC_H_
  9. /**
  10. * struct machine_desc - Board specific callbacks, called from ARC common code
  11. * Provided by each ARC board using MACHINE_START()/MACHINE_END(), so
  12. * a multi-platform kernel builds with array of such descriptors.
  13. * We extend the early DT scan to also match the DT's "compatible" string
  14. * against the @dt_compat of all such descriptors, and one with highest
  15. * "DT score" is selected as global @machine_desc.
  16. *
  17. * @name: Board/SoC name
  18. * @dt_compat: Array of device tree 'compatible' strings
  19. * (XXX: although only 1st entry is looked at)
  20. * @init_early: Very early callback [called from setup_arch()]
  21. * @init_per_cpu: for each CPU as it is coming up (SMP as well as UP)
  22. * [(M):init_IRQ(), (o):start_kernel_secondary()]
  23. * @init_machine: arch initcall level callback (e.g. populate static
  24. * platform devices or parse Devicetree)
  25. * @init_late: Late initcall level callback
  26. *
  27. */
  28. struct machine_desc {
  29. const char *name;
  30. const char **dt_compat;
  31. void (*init_early)(void);
  32. void (*init_per_cpu)(unsigned int);
  33. void (*init_machine)(void);
  34. void (*init_late)(void);
  35. };
  36. /*
  37. * Current machine - only accessible during boot.
  38. */
  39. extern const struct machine_desc *machine_desc;
  40. /*
  41. * Machine type table - also only accessible during boot
  42. */
  43. extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
  44. /*
  45. * Set of macros to define architecture features.
  46. * This is built into a table by the linker.
  47. */
  48. #define MACHINE_START(_type, _name) \
  49. static const struct machine_desc __mach_desc_##_type \
  50. __used __section(".arch.info.init") = { \
  51. .name = _name,
  52. #define MACHINE_END \
  53. };
  54. extern const struct machine_desc *setup_machine_fdt(void *dt);
  55. #endif