Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com)
0004  *
0005  * based on METAG mach/arch.h (which in turn was based on ARM)
0006  */
0007 
0008 #ifndef _ASM_ARC_MACH_DESC_H_
0009 #define _ASM_ARC_MACH_DESC_H_
0010 
0011 /**
0012  * struct machine_desc - Board specific callbacks, called from ARC common code
0013  *  Provided by each ARC board using MACHINE_START()/MACHINE_END(), so
0014  *  a multi-platform kernel builds with array of such descriptors.
0015  *  We extend the early DT scan to also match the DT's "compatible" string
0016  *  against the @dt_compat of all such descriptors, and one with highest
0017  *  "DT score" is selected as global @machine_desc.
0018  *
0019  * @name:       Board/SoC name
0020  * @dt_compat:      Array of device tree 'compatible' strings
0021  *          (XXX: although only 1st entry is looked at)
0022  * @init_early:     Very early callback [called from setup_arch()]
0023  * @init_per_cpu:   for each CPU as it is coming up (SMP as well as UP)
0024  *          [(M):init_IRQ(), (o):start_kernel_secondary()]
0025  * @init_machine:   arch initcall level callback (e.g. populate static
0026  *          platform devices or parse Devicetree)
0027  * @init_late:      Late initcall level callback
0028  *
0029  */
0030 struct machine_desc {
0031     const char      *name;
0032     const char      **dt_compat;
0033     void            (*init_early)(void);
0034     void            (*init_per_cpu)(unsigned int);
0035     void            (*init_machine)(void);
0036     void            (*init_late)(void);
0037 
0038 };
0039 
0040 /*
0041  * Current machine - only accessible during boot.
0042  */
0043 extern const struct machine_desc *machine_desc;
0044 
0045 /*
0046  * Machine type table - also only accessible during boot
0047  */
0048 extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
0049 
0050 /*
0051  * Set of macros to define architecture features.
0052  * This is built into a table by the linker.
0053  */
0054 #define MACHINE_START(_type, _name)         \
0055 static const struct machine_desc __mach_desc_##_type    \
0056 __used __section(".arch.info.init") = {         \
0057     .name       = _name,
0058 
0059 #define MACHINE_END             \
0060 };
0061 
0062 extern const struct machine_desc *setup_machine_fdt(void *dt);
0063 
0064 #endif