GNU Linux-libre 5.4.274-gnu1
[releases.git] / arch / mips / include / asm / mips_machine.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
4  */
5
6 #ifndef __ASM_MIPS_MACHINE_H
7 #define __ASM_MIPS_MACHINE_H
8
9 #include <linux/init.h>
10 #include <linux/stddef.h>
11
12 #include <asm/bootinfo.h>
13
14 struct mips_machine {
15         unsigned long           mach_type;
16         const char              *mach_id;
17         const char              *mach_name;
18         void                    (*mach_setup)(void);
19 };
20
21 #define MIPS_MACHINE(_type, _id, _name, _setup)                 \
22 static const char machine_name_##_type[] __initconst            \
23                         __aligned(1) = _name;                   \
24 static const char machine_id_##_type[] __initconst              \
25                         __aligned(1) = _id;                     \
26 static struct mips_machine machine_##_type                      \
27                 __used __section(.mips.machines.init) =         \
28 {                                                               \
29         .mach_type      = _type,                                \
30         .mach_id        = machine_id_##_type,                   \
31         .mach_name      = machine_name_##_type,                 \
32         .mach_setup     = _setup,                               \
33 };
34
35 extern long __mips_machines_start;
36 extern long __mips_machines_end;
37
38 #ifdef CONFIG_MIPS_MACHINE
39 int  mips_machtype_setup(char *id) __init;
40 void mips_machine_setup(void) __init;
41 #else
42 static inline int mips_machtype_setup(char *id) { return 1; }
43 static inline void mips_machine_setup(void) { }
44 #endif /* CONFIG_MIPS_MACHINE */
45
46 #endif /* __ASM_MIPS_MACHINE_H */