arch.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * arch/arm/include/asm/mach/arch.h
  4. *
  5. * Copyright (C) 2000 Russell King
  6. */
  7. #include <linux/types.h>
  8. #ifndef __ASSEMBLY__
  9. #include <linux/reboot.h>
  10. struct tag;
  11. struct pt_regs;
  12. struct smp_operations;
  13. #ifdef CONFIG_SMP
  14. #define smp_ops(ops) (&(ops))
  15. #define smp_init_ops(ops) (&(ops))
  16. #else
  17. #define smp_ops(ops) (struct smp_operations *)NULL
  18. #define smp_init_ops(ops) (bool (*)(void))NULL
  19. #endif
  20. struct machine_desc {
  21. unsigned int nr; /* architecture number */
  22. const char *name; /* architecture name */
  23. unsigned long atag_offset; /* tagged list (relative) */
  24. const char *const *dt_compat; /* array of device tree
  25. * 'compatible' strings */
  26. unsigned int nr_irqs; /* number of IRQs */
  27. #ifdef CONFIG_ZONE_DMA
  28. phys_addr_t dma_zone_size; /* size of DMA-able area */
  29. #endif
  30. unsigned int video_start; /* start of video RAM */
  31. unsigned int video_end; /* end of video RAM */
  32. unsigned char reserve_lp0 :1; /* never has lp0 */
  33. unsigned char reserve_lp1 :1; /* never has lp1 */
  34. unsigned char reserve_lp2 :1; /* never has lp2 */
  35. enum reboot_mode reboot_mode; /* default restart mode */
  36. unsigned l2c_aux_val; /* L2 cache aux value */
  37. unsigned l2c_aux_mask; /* L2 cache aux mask */
  38. void (*l2c_write_sec)(unsigned long, unsigned);
  39. const struct smp_operations *smp; /* SMP operations */
  40. bool (*smp_init)(void);
  41. void (*fixup)(struct tag *, char **);
  42. void (*dt_fixup)(void);
  43. long long (*pv_fixup)(void);
  44. void (*reserve)(void);/* reserve mem blocks */
  45. void (*map_io)(void);/* IO mapping function */
  46. void (*init_early)(void);
  47. void (*init_irq)(void);
  48. void (*init_time)(void);
  49. void (*init_machine)(void);
  50. void (*init_late)(void);
  51. void (*handle_irq)(struct pt_regs *);
  52. void (*restart)(enum reboot_mode, const char *);
  53. };
  54. /*
  55. * Current machine - only accessible during boot.
  56. */
  57. extern const struct machine_desc *machine_desc;
  58. /*
  59. * Machine type table - also only accessible during boot
  60. */
  61. extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
  62. #define for_each_machine_desc(p) \
  63. for (p = __arch_info_begin; p < __arch_info_end; p++)
  64. /*
  65. * Set of macros to define architecture features. This is built into
  66. * a table by the linker.
  67. */
  68. #define MACHINE_START(_type,_name) \
  69. static const struct machine_desc __mach_desc_##_type \
  70. __used \
  71. __section(".arch.info.init") = { \
  72. .nr = MACH_TYPE_##_type, \
  73. .name = _name,
  74. #define MACHINE_END \
  75. };
  76. #define DT_MACHINE_START(_name, _namestr) \
  77. static const struct machine_desc __mach_desc_##_name \
  78. __used \
  79. __section(".arch.info.init") = { \
  80. .nr = ~0, \
  81. .name = _namestr,
  82. #endif