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