1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 203a6d28cSVineet Gupta /* 303a6d28cSVineet Gupta * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com) 403a6d28cSVineet Gupta * 503a6d28cSVineet Gupta * based on METAG mach/arch.h (which in turn was based on ARM) 603a6d28cSVineet Gupta */ 703a6d28cSVineet Gupta 803a6d28cSVineet Gupta #ifndef _ASM_ARC_MACH_DESC_H_ 903a6d28cSVineet Gupta #define _ASM_ARC_MACH_DESC_H_ 1003a6d28cSVineet Gupta 1103a6d28cSVineet Gupta /** 1203a6d28cSVineet Gupta * struct machine_desc - Board specific callbacks, called from ARC common code 1303a6d28cSVineet Gupta * Provided by each ARC board using MACHINE_START()/MACHINE_END(), so 1403a6d28cSVineet Gupta * a multi-platform kernel builds with array of such descriptors. 1503a6d28cSVineet Gupta * We extend the early DT scan to also match the DT's "compatible" string 1603a6d28cSVineet Gupta * against the @dt_compat of all such descriptors, and one with highest 1703a6d28cSVineet Gupta * "DT score" is selected as global @machine_desc. 1803a6d28cSVineet Gupta * 1903a6d28cSVineet Gupta * @name: Board/SoC name 2003a6d28cSVineet Gupta * @dt_compat: Array of device tree 'compatible' strings 2103a6d28cSVineet Gupta * (XXX: although only 1st entry is looked at) 2203a6d28cSVineet Gupta * @init_early: Very early callback [called from setup_arch()] 23575a9d4eSVineet Gupta * @init_per_cpu: for each CPU as it is coming up (SMP as well as UP) 2403a6d28cSVineet Gupta * [(M):init_IRQ(), (o):start_kernel_secondary()] 2503a6d28cSVineet Gupta * @init_machine: arch initcall level callback (e.g. populate static 2603a6d28cSVineet Gupta * platform devices or parse Devicetree) 2703a6d28cSVineet Gupta * @init_late: Late initcall level callback 2803a6d28cSVineet Gupta * 2903a6d28cSVineet Gupta */ 3003a6d28cSVineet Gupta struct machine_desc { 3103a6d28cSVineet Gupta const char *name; 3203a6d28cSVineet Gupta const char **dt_compat; 3303a6d28cSVineet Gupta void (*init_early)(void); 34575a9d4eSVineet Gupta void (*init_per_cpu)(unsigned int); 3503a6d28cSVineet Gupta void (*init_machine)(void); 3603a6d28cSVineet Gupta void (*init_late)(void); 3703a6d28cSVineet Gupta 3803a6d28cSVineet Gupta }; 3903a6d28cSVineet Gupta 4003a6d28cSVineet Gupta /* 4103a6d28cSVineet Gupta * Current machine - only accessible during boot. 4203a6d28cSVineet Gupta */ 43880beb88SRob Herring extern const struct machine_desc *machine_desc; 4403a6d28cSVineet Gupta 4503a6d28cSVineet Gupta /* 4603a6d28cSVineet Gupta * Machine type table - also only accessible during boot 4703a6d28cSVineet Gupta */ 48880beb88SRob Herring extern const struct machine_desc __arch_info_begin[], __arch_info_end[]; 4903a6d28cSVineet Gupta 5003a6d28cSVineet Gupta /* 5103a6d28cSVineet Gupta * Set of macros to define architecture features. 5203a6d28cSVineet Gupta * This is built into a table by the linker. 5303a6d28cSVineet Gupta */ 5403a6d28cSVineet Gupta #define MACHINE_START(_type, _name) \ 5503a6d28cSVineet Gupta static const struct machine_desc __mach_desc_##_type \ 5633def849SJoe Perches __used __section(".arch.info.init") = { \ 5703a6d28cSVineet Gupta .name = _name, 5803a6d28cSVineet Gupta 5903a6d28cSVineet Gupta #define MACHINE_END \ 6003a6d28cSVineet Gupta }; 6103a6d28cSVineet Gupta 62880beb88SRob Herring extern const struct machine_desc *setup_machine_fdt(void *dt); 63eab6a08cSVineet Gupta 6403a6d28cSVineet Gupta #endif 65