1384740dcSRalf Baechle /*
2384740dcSRalf Baechle * This file is subject to the terms and conditions of the GNU General Public
3384740dcSRalf Baechle * License. See the file COPYING in the main directory of this archive
4384740dcSRalf Baechle * for more details.
5384740dcSRalf Baechle *
6384740dcSRalf Baechle * Copyright (C) 1995, 1996, 2003 by Ralf Baechle
7384740dcSRalf Baechle * Copyright (C) 1995, 1996 Andreas Busse
8384740dcSRalf Baechle * Copyright (C) 1995, 1996 Stoned Elipot
9384740dcSRalf Baechle * Copyright (C) 1995, 1996 Paul M. Antoine.
103209e70eSWu Zhangjin * Copyright (C) 2009 Zhang Le
11384740dcSRalf Baechle */
12384740dcSRalf Baechle #ifndef _ASM_BOOTINFO_H
13384740dcSRalf Baechle #define _ASM_BOOTINFO_H
14384740dcSRalf Baechle
15384740dcSRalf Baechle #include <linux/types.h>
16384740dcSRalf Baechle #include <asm/setup.h>
17384740dcSRalf Baechle
18384740dcSRalf Baechle /*
19384740dcSRalf Baechle * The MACH_ IDs are sort of equivalent to PCI product IDs. As such the
20384740dcSRalf Baechle * numbers do not necessarily reflect technical relations or similarities
21384740dcSRalf Baechle * between systems.
22384740dcSRalf Baechle */
23384740dcSRalf Baechle
24384740dcSRalf Baechle /*
25384740dcSRalf Baechle * Valid machtype values for group unknown
26384740dcSRalf Baechle */
27384740dcSRalf Baechle #define MACH_UNKNOWN 0 /* whatever... */
28384740dcSRalf Baechle
29384740dcSRalf Baechle /*
30384740dcSRalf Baechle * Valid machtype for group DEC
31384740dcSRalf Baechle */
32384740dcSRalf Baechle #define MACH_DSUNKNOWN 0
33384740dcSRalf Baechle #define MACH_DS23100 1 /* DECstation 2100 or 3100 */
34384740dcSRalf Baechle #define MACH_DS5100 2 /* DECsystem 5100 */
35384740dcSRalf Baechle #define MACH_DS5000_200 3 /* DECstation 5000/200 */
36384740dcSRalf Baechle #define MACH_DS5000_1XX 4 /* DECstation 5000/120, 125, 133, 150 */
37384740dcSRalf Baechle #define MACH_DS5000_XX 5 /* DECstation 5000/20, 25, 33, 50 */
38384740dcSRalf Baechle #define MACH_DS5000_2X0 6 /* DECstation 5000/240, 260 */
39384740dcSRalf Baechle #define MACH_DS5400 7 /* DECsystem 5400 */
40384740dcSRalf Baechle #define MACH_DS5500 8 /* DECsystem 5500 */
41384740dcSRalf Baechle #define MACH_DS5800 9 /* DECsystem 5800 */
42384740dcSRalf Baechle #define MACH_DS5900 10 /* DECsystem 5900 */
43384740dcSRalf Baechle
44384740dcSRalf Baechle /*
45384740dcSRalf Baechle * Valid machtype for group Mikrotik
46384740dcSRalf Baechle */
47384740dcSRalf Baechle #define MACH_MIKROTIK_RB532 0 /* Mikrotik RouterBoard 532 */
48384740dcSRalf Baechle #define MACH_MIKROTIK_RB532A 1 /* Mikrotik RouterBoard 532A */
49384740dcSRalf Baechle
503209e70eSWu Zhangjin /*
513209e70eSWu Zhangjin * Valid machtype for Loongson family
523209e70eSWu Zhangjin */
531bdb7b76SJiaxun Yang enum loongson2ef_machine_type {
545f6d693eSHuacai Chen MACH_LOONGSON_UNKNOWN,
555f6d693eSHuacai Chen MACH_LEMOTE_FL2E,
565f6d693eSHuacai Chen MACH_LEMOTE_FL2F,
575f6d693eSHuacai Chen MACH_LEMOTE_ML2F7,
585f6d693eSHuacai Chen MACH_LEMOTE_YL2F89,
595f6d693eSHuacai Chen MACH_DEXXON_GDIUM2F10,
605f6d693eSHuacai Chen MACH_LEMOTE_NAS,
615f6d693eSHuacai Chen MACH_LEMOTE_LL2F,
625f6d693eSHuacai Chen MACH_LOONGSON_END
635f6d693eSHuacai Chen };
643209e70eSWu Zhangjin
6583ccf69dSLars-Peter Clausen /*
6683ccf69dSLars-Peter Clausen * Valid machtype for group INGENIC
6783ccf69dSLars-Peter Clausen */
6868c48f7cSPaul Cercueil enum ingenic_machine_type {
6968c48f7cSPaul Cercueil MACH_INGENIC_UNKNOWN,
7068c48f7cSPaul Cercueil MACH_INGENIC_JZ4720,
7168c48f7cSPaul Cercueil MACH_INGENIC_JZ4725,
7268c48f7cSPaul Cercueil MACH_INGENIC_JZ4725B,
7368c48f7cSPaul Cercueil MACH_INGENIC_JZ4730,
7468c48f7cSPaul Cercueil MACH_INGENIC_JZ4740,
7568c48f7cSPaul Cercueil MACH_INGENIC_JZ4750,
7668c48f7cSPaul Cercueil MACH_INGENIC_JZ4755,
7768c48f7cSPaul Cercueil MACH_INGENIC_JZ4760,
78*14d72af7S周琰杰 (Zhou Yanjie) MACH_INGENIC_JZ4760B,
7968c48f7cSPaul Cercueil MACH_INGENIC_JZ4770,
8068c48f7cSPaul Cercueil MACH_INGENIC_JZ4775,
8168c48f7cSPaul Cercueil MACH_INGENIC_JZ4780,
8268c48f7cSPaul Cercueil MACH_INGENIC_X1000,
83a9fee3a5S周琰杰 (Zhou Yanjie) MACH_INGENIC_X1000E,
8468c48f7cSPaul Cercueil MACH_INGENIC_X1830,
850d10d17bS周琰杰 (Zhou Yanjie) MACH_INGENIC_X2000,
86a9fee3a5S周琰杰 (Zhou Yanjie) MACH_INGENIC_X2000E,
87*14d72af7S周琰杰 (Zhou Yanjie) MACH_INGENIC_X2000H,
88*14d72af7S周琰杰 (Zhou Yanjie) MACH_INGENIC_X2100,
8968c48f7cSPaul Cercueil };
9083ccf69dSLars-Peter Clausen
91384740dcSRalf Baechle extern char *system_type;
92384740dcSRalf Baechle const char *get_system_type(void);
93384740dcSRalf Baechle
94384740dcSRalf Baechle extern unsigned long mips_machtype;
95384740dcSRalf Baechle
9615d45cceSRalf Baechle extern void detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_addr_t sz_max);
97384740dcSRalf Baechle
98384740dcSRalf Baechle extern void prom_init(void);
99384740dcSRalf Baechle extern void prom_free_prom_memory(void);
100c0de00b2SThomas Bogendoerfer extern void prom_cleanup(void);
101384740dcSRalf Baechle
102384740dcSRalf Baechle extern void free_init_pages(const char *what,
103384740dcSRalf Baechle unsigned long begin, unsigned long end);
104384740dcSRalf Baechle
1050893d3fbSMarkos Chandras extern void (*free_init_pages_eva)(void *begin, void *end);
1060893d3fbSMarkos Chandras
107384740dcSRalf Baechle /*
108384740dcSRalf Baechle * Initial kernel command line, usually setup by prom_init()
109384740dcSRalf Baechle */
1107580c9c3SDmitri Vorobiev extern char arcs_cmdline[COMMAND_LINE_SIZE];
111384740dcSRalf Baechle
112384740dcSRalf Baechle /*
1136f3377bcSxiaochuan mao * Registers a0, a1, a2 and a3 as passed to the kernel entry by firmware
114384740dcSRalf Baechle */
115384740dcSRalf Baechle extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
116384740dcSRalf Baechle
11715f37e15SJonas Gorski #ifdef CONFIG_USE_OF
118b83ba0b9SThomas Bogendoerfer #include <linux/libfdt.h>
119b83ba0b9SThomas Bogendoerfer #include <linux/of_fdt.h>
120b83ba0b9SThomas Bogendoerfer
121b83ba0b9SThomas Bogendoerfer extern char __appended_dtb[];
122b83ba0b9SThomas Bogendoerfer
get_fdt(void)123b83ba0b9SThomas Bogendoerfer static inline void *get_fdt(void)
124b83ba0b9SThomas Bogendoerfer {
125b83ba0b9SThomas Bogendoerfer if (IS_ENABLED(CONFIG_MIPS_RAW_APPENDED_DTB) ||
126b83ba0b9SThomas Bogendoerfer IS_ENABLED(CONFIG_MIPS_ELF_APPENDED_DTB))
127b83ba0b9SThomas Bogendoerfer if (fdt_magic(&__appended_dtb) == FDT_MAGIC)
128b83ba0b9SThomas Bogendoerfer return &__appended_dtb;
129b83ba0b9SThomas Bogendoerfer
130b83ba0b9SThomas Bogendoerfer if (fw_arg0 == -2) /* UHI interface */
131b83ba0b9SThomas Bogendoerfer return (void *)fw_arg1;
132b83ba0b9SThomas Bogendoerfer
133b83ba0b9SThomas Bogendoerfer if (IS_ENABLED(CONFIG_BUILTIN_DTB))
134b83ba0b9SThomas Bogendoerfer if (&__dtb_start != &__dtb_end)
135b83ba0b9SThomas Bogendoerfer return &__dtb_start;
136b83ba0b9SThomas Bogendoerfer
137b83ba0b9SThomas Bogendoerfer return NULL;
138b83ba0b9SThomas Bogendoerfer }
13915f37e15SJonas Gorski #endif
14015f37e15SJonas Gorski
141384740dcSRalf Baechle /*
1422a3d47c9STiezhu Yang * Platform memory detection hook called by arch_mem_init()
143384740dcSRalf Baechle */
144384740dcSRalf Baechle extern void plat_mem_setup(void);
145384740dcSRalf Baechle
146ee71b7d2SDavid Daney #ifdef CONFIG_SWIOTLB
147ee71b7d2SDavid Daney /*
148ee71b7d2SDavid Daney * Optional platform hook to call swiotlb_setup().
149ee71b7d2SDavid Daney */
150ee71b7d2SDavid Daney extern void plat_swiotlb_setup(void);
151ee71b7d2SDavid Daney
152ee71b7d2SDavid Daney #else
153ee71b7d2SDavid Daney
plat_swiotlb_setup(void)154ee71b7d2SDavid Daney static inline void plat_swiotlb_setup(void) {}
155ee71b7d2SDavid Daney
156ee71b7d2SDavid Daney #endif /* CONFIG_SWIOTLB */
157ee71b7d2SDavid Daney
1585e7c1c91SMatt Redfearn #ifdef CONFIG_USE_OF
1595e7c1c91SMatt Redfearn /**
1605e7c1c91SMatt Redfearn * plat_get_fdt() - Return a pointer to the platform's device tree blob
1615e7c1c91SMatt Redfearn *
1625e7c1c91SMatt Redfearn * This function provides a platform independent API to get a pointer to the
1635e7c1c91SMatt Redfearn * flattened device tree blob. The interface between bootloader and kernel
1645e7c1c91SMatt Redfearn * is not consistent across platforms so it is necessary to provide this
1655e7c1c91SMatt Redfearn * API such that common startup code can locate the FDT.
1665e7c1c91SMatt Redfearn *
1675e7c1c91SMatt Redfearn * This is used by the KASLR code to get command line arguments and random
1685e7c1c91SMatt Redfearn * seed from the device tree. Any platform wishing to use KASLR should
1695e7c1c91SMatt Redfearn * provide this API and select SYS_SUPPORTS_RELOCATABLE.
1705e7c1c91SMatt Redfearn *
1715e7c1c91SMatt Redfearn * Return: Pointer to the flattened device tree blob.
1725e7c1c91SMatt Redfearn */
1735e7c1c91SMatt Redfearn extern void *plat_get_fdt(void);
1740063fdedSMarcin Nowakowski
1750063fdedSMarcin Nowakowski #ifdef CONFIG_RELOCATABLE
1760063fdedSMarcin Nowakowski
1770063fdedSMarcin Nowakowski /**
1780063fdedSMarcin Nowakowski * plat_fdt_relocated() - Update platform's information about relocated dtb
1790063fdedSMarcin Nowakowski *
1800063fdedSMarcin Nowakowski * This function provides a platform-independent API to set platform's
1810063fdedSMarcin Nowakowski * information about relocated DTB if it needs to be moved due to kernel
1820063fdedSMarcin Nowakowski * relocation occurring at boot.
1830063fdedSMarcin Nowakowski */
1840063fdedSMarcin Nowakowski void plat_fdt_relocated(void *new_location);
1850063fdedSMarcin Nowakowski
1860063fdedSMarcin Nowakowski #endif /* CONFIG_RELOCATABLE */
1875e7c1c91SMatt Redfearn #endif /* CONFIG_USE_OF */
1885e7c1c91SMatt Redfearn
189384740dcSRalf Baechle #endif /* _ASM_BOOTINFO_H */
190