Loading...
1/*
2 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published
6 * by the Free Software Foundation.
7 *
8 */
9
10#ifndef __ASM_MIPS_MACHINE_H
11#define __ASM_MIPS_MACHINE_H
12
13#include <linux/init.h>
14#include <linux/stddef.h>
15
16#include <asm/bootinfo.h>
17
18struct mips_machine {
19 unsigned long mach_type;
20 const char *mach_id;
21 const char *mach_name;
22 void (*mach_setup)(void);
23};
24
25#define MIPS_MACHINE(_type, _id, _name, _setup) \
26static const char machine_name_##_type[] __initconst \
27 __aligned(1) = _name; \
28static const char machine_id_##_type[] __initconst \
29 __aligned(1) = _id; \
30static struct mips_machine machine_##_type \
31 __used __section(.mips.machines.init) = \
32{ \
33 .mach_type = _type, \
34 .mach_id = machine_id_##_type, \
35 .mach_name = machine_name_##_type, \
36 .mach_setup = _setup, \
37};
38
39extern long __mips_machines_start;
40extern long __mips_machines_end;
41
42#ifdef CONFIG_MIPS_MACHINE
43int mips_machtype_setup(char *id) __init;
44void mips_machine_setup(void) __init;
45#else
46static inline int mips_machtype_setup(char *id) { return 1; }
47static inline void mips_machine_setup(void) { }
48#endif /* CONFIG_MIPS_MACHINE */
49
50#endif /* __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
14struct 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) \
22static const char machine_name_##_type[] __initconst \
23 __aligned(1) = _name; \
24static const char machine_id_##_type[] __initconst \
25 __aligned(1) = _id; \
26static 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
35extern long __mips_machines_start;
36extern long __mips_machines_end;
37
38#ifdef CONFIG_MIPS_MACHINE
39int mips_machtype_setup(char *id) __init;
40void mips_machine_setup(void) __init;
41#else
42static inline int mips_machtype_setup(char *id) { return 1; }
43static inline void mips_machine_setup(void) { }
44#endif /* CONFIG_MIPS_MACHINE */
45
46#endif /* __ASM_MIPS_MACHINE_H */