xref: /linux/arch/arm/include/asm/mach/arch.h (revision d2912cb15bdda8ba4a5dd73396ad62641af2f520)
1*d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
24baa9922SRussell King /*
34baa9922SRussell King  *  arch/arm/include/asm/mach/arch.h
44baa9922SRussell King  *
54baa9922SRussell King  *  Copyright (C) 2000 Russell King
64baa9922SRussell King  */
74baa9922SRussell King 
8b382b940SJon Medhurst #include <linux/types.h>
9b382b940SJon Medhurst 
104baa9922SRussell King #ifndef __ASSEMBLY__
1116d6d5b0SRobin Holt #include <linux/reboot.h>
124baa9922SRussell King 
134baa9922SRussell King struct tag;
141a1f2be2SFabio Estevam struct pt_regs;
15abcee5fbSMarc Zyngier struct smp_operations;
16abcee5fbSMarc Zyngier #ifdef CONFIG_SMP
17abcee5fbSMarc Zyngier #define smp_ops(ops) (&(ops))
18b382b940SJon Medhurst #define smp_init_ops(ops) (&(ops))
19abcee5fbSMarc Zyngier #else
20abcee5fbSMarc Zyngier #define smp_ops(ops) (struct smp_operations *)NULL
21b382b940SJon Medhurst #define smp_init_ops(ops) (bool (*)(void))NULL
22abcee5fbSMarc Zyngier #endif
234baa9922SRussell King 
244baa9922SRussell King struct machine_desc {
254baa9922SRussell King 	unsigned int		nr;		/* architecture number	*/
264baa9922SRussell King 	const char		*name;		/* architecture name	*/
272bb9839eSNicolas Pitre 	unsigned long		atag_offset;	/* tagged list (relative) */
287b482c83SUwe Kleine-König 	const char *const 	*dt_compat;	/* array of device tree
2993c02ab4SGrant Likely 						 * 'compatible' strings	*/
304baa9922SRussell King 
31d71e3eb5SNicolas Pitre 	unsigned int		nr_irqs;	/* number of IRQs */
32d71e3eb5SNicolas Pitre 
334fddcaebSNicolas Pitre #ifdef CONFIG_ZONE_DMA
34364230b9SRob Herring 	phys_addr_t		dma_zone_size;	/* size of DMA-able area */
354fddcaebSNicolas Pitre #endif
364fddcaebSNicolas Pitre 
374baa9922SRussell King 	unsigned int		video_start;	/* start of video RAM	*/
384baa9922SRussell King 	unsigned int		video_end;	/* end of video RAM	*/
394baa9922SRussell King 
40b44c350dSRussell King 	unsigned char		reserve_lp0 :1;	/* never has lp0	*/
41b44c350dSRussell King 	unsigned char		reserve_lp1 :1;	/* never has lp1	*/
42b44c350dSRussell King 	unsigned char		reserve_lp2 :1;	/* never has lp2	*/
4316d6d5b0SRobin Holt 	enum reboot_mode	reboot_mode;	/* default restart mode	*/
44805604efSRussell King 	unsigned		l2c_aux_val;	/* L2 cache aux value	*/
45805604efSRussell King 	unsigned		l2c_aux_mask;	/* L2 cache aux mask	*/
46805604efSRussell King 	void			(*l2c_write_sec)(unsigned long, unsigned);
47f460b6abSMasahiro Yamada 	const struct smp_operations	*smp;	/* SMP operations	*/
48b382b940SJon Medhurst 	bool			(*smp_init)(void);
491c2f87c2SLaura Abbott 	void			(*fixup)(struct tag *, char **);
505a12a597SLaura Abbott 	void			(*dt_fixup)(void);
51c0b759d8SRussell King 	long long		(*pv_fixup)(void);
5298c672cfSRussell King 	void			(*reserve)(void);/* reserve mem blocks	*/
534baa9922SRussell King 	void			(*map_io)(void);/* IO mapping function	*/
54dec12e62SRussell King 	void			(*init_early)(void);
554baa9922SRussell King 	void			(*init_irq)(void);
566bb27d73SStephen Warren 	void			(*init_time)(void);
574baa9922SRussell King 	void			(*init_machine)(void);
5890de4137SShawn Guo 	void			(*init_late)(void);
594c301f9bSPalmer Dabbelt #ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
6052108641Seric miao 	void			(*handle_irq)(struct pt_regs *);
6152108641Seric miao #endif
627b6d864bSRobin Holt 	void			(*restart)(enum reboot_mode, const char *);
634baa9922SRussell King };
644baa9922SRussell King 
654baa9922SRussell King /*
668ff1443cSRussell King  * Current machine - only accessible during boot.
678ff1443cSRussell King  */
68ff69a4c8SRussell King extern const struct machine_desc *machine_desc;
698ff1443cSRussell King 
708ff1443cSRussell King /*
716291319dSGrant Likely  * Machine type table - also only accessible during boot
726291319dSGrant Likely  */
73ff69a4c8SRussell King extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
746291319dSGrant Likely #define for_each_machine_desc(p)			\
756291319dSGrant Likely 	for (p = __arch_info_begin; p < __arch_info_end; p++)
766291319dSGrant Likely 
776291319dSGrant Likely /*
784baa9922SRussell King  * Set of macros to define architecture features.  This is built into
794baa9922SRussell King  * a table by the linker.
804baa9922SRussell King  */
814baa9922SRussell King #define MACHINE_START(_type,_name)			\
824baa9922SRussell King static const struct machine_desc __mach_desc_##_type	\
834baa9922SRussell King  __used							\
844baa9922SRussell King  __attribute__((__section__(".arch.info.init"))) = {	\
854baa9922SRussell King 	.nr		= MACH_TYPE_##_type,		\
864baa9922SRussell King 	.name		= _name,
874baa9922SRussell King 
884baa9922SRussell King #define MACHINE_END				\
894baa9922SRussell King };
904baa9922SRussell King 
9185cad1b0SGrant Likely #define DT_MACHINE_START(_name, _namestr)		\
9285cad1b0SGrant Likely static const struct machine_desc __mach_desc_##_name	\
9385cad1b0SGrant Likely  __used							\
9485cad1b0SGrant Likely  __attribute__((__section__(".arch.info.init"))) = {	\
9585cad1b0SGrant Likely 	.nr		= ~0,				\
9685cad1b0SGrant Likely 	.name		= _namestr,
9785cad1b0SGrant Likely 
984baa9922SRussell King #endif
99