mach_desc.h 2.1 KB

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