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