162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
362306a36Sopenharmony_ci * License.  See the file COPYING in the main directory of this archive
462306a36Sopenharmony_ci * for more details.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright (C) 1995, 1996, 2003 by Ralf Baechle
762306a36Sopenharmony_ci * Copyright (C) 1995, 1996 Andreas Busse
862306a36Sopenharmony_ci * Copyright (C) 1995, 1996 Stoned Elipot
962306a36Sopenharmony_ci * Copyright (C) 1995, 1996 Paul M. Antoine.
1062306a36Sopenharmony_ci * Copyright (C) 2009       Zhang Le
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci#ifndef _ASM_BOOTINFO_H
1362306a36Sopenharmony_ci#define _ASM_BOOTINFO_H
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#include <linux/types.h>
1662306a36Sopenharmony_ci#include <asm/setup.h>
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/*
1962306a36Sopenharmony_ci * The MACH_ IDs are sort of equivalent to PCI product IDs.  As such the
2062306a36Sopenharmony_ci * numbers do not necessarily reflect technical relations or similarities
2162306a36Sopenharmony_ci * between systems.
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/*
2562306a36Sopenharmony_ci * Valid machtype values for group unknown
2662306a36Sopenharmony_ci */
2762306a36Sopenharmony_ci#define  MACH_UNKNOWN		0	/* whatever...			*/
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/*
3062306a36Sopenharmony_ci * Valid machtype for group DEC
3162306a36Sopenharmony_ci */
3262306a36Sopenharmony_ci#define  MACH_DSUNKNOWN		0
3362306a36Sopenharmony_ci#define  MACH_DS23100		1	/* DECstation 2100 or 3100	*/
3462306a36Sopenharmony_ci#define  MACH_DS5100		2	/* DECsystem 5100		*/
3562306a36Sopenharmony_ci#define  MACH_DS5000_200	3	/* DECstation 5000/200		*/
3662306a36Sopenharmony_ci#define  MACH_DS5000_1XX	4	/* DECstation 5000/120, 125, 133, 150 */
3762306a36Sopenharmony_ci#define  MACH_DS5000_XX		5	/* DECstation 5000/20, 25, 33, 50 */
3862306a36Sopenharmony_ci#define  MACH_DS5000_2X0	6	/* DECstation 5000/240, 260	*/
3962306a36Sopenharmony_ci#define  MACH_DS5400		7	/* DECsystem 5400		*/
4062306a36Sopenharmony_ci#define  MACH_DS5500		8	/* DECsystem 5500		*/
4162306a36Sopenharmony_ci#define  MACH_DS5800		9	/* DECsystem 5800		*/
4262306a36Sopenharmony_ci#define  MACH_DS5900		10	/* DECsystem 5900		*/
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/*
4562306a36Sopenharmony_ci * Valid machtype for group Mikrotik
4662306a36Sopenharmony_ci */
4762306a36Sopenharmony_ci#define MACH_MIKROTIK_RB532	0	/* Mikrotik RouterBoard 532	*/
4862306a36Sopenharmony_ci#define MACH_MIKROTIK_RB532A	1	/* Mikrotik RouterBoard 532A	*/
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci/*
5162306a36Sopenharmony_ci * Valid machtype for Loongson family
5262306a36Sopenharmony_ci */
5362306a36Sopenharmony_cienum loongson2ef_machine_type {
5462306a36Sopenharmony_ci	MACH_LOONGSON_UNKNOWN,
5562306a36Sopenharmony_ci	MACH_LEMOTE_FL2E,
5662306a36Sopenharmony_ci	MACH_LEMOTE_FL2F,
5762306a36Sopenharmony_ci	MACH_LEMOTE_ML2F7,
5862306a36Sopenharmony_ci	MACH_LEMOTE_YL2F89,
5962306a36Sopenharmony_ci	MACH_DEXXON_GDIUM2F10,
6062306a36Sopenharmony_ci	MACH_LEMOTE_NAS,
6162306a36Sopenharmony_ci	MACH_LEMOTE_LL2F,
6262306a36Sopenharmony_ci	MACH_LOONGSON_END
6362306a36Sopenharmony_ci};
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/*
6662306a36Sopenharmony_ci * Valid machtype for group INGENIC
6762306a36Sopenharmony_ci */
6862306a36Sopenharmony_cienum ingenic_machine_type {
6962306a36Sopenharmony_ci	MACH_INGENIC_UNKNOWN,
7062306a36Sopenharmony_ci	MACH_INGENIC_JZ4720,
7162306a36Sopenharmony_ci	MACH_INGENIC_JZ4725,
7262306a36Sopenharmony_ci	MACH_INGENIC_JZ4725B,
7362306a36Sopenharmony_ci	MACH_INGENIC_JZ4730,
7462306a36Sopenharmony_ci	MACH_INGENIC_JZ4740,
7562306a36Sopenharmony_ci	MACH_INGENIC_JZ4750,
7662306a36Sopenharmony_ci	MACH_INGENIC_JZ4755,
7762306a36Sopenharmony_ci	MACH_INGENIC_JZ4760,
7862306a36Sopenharmony_ci	MACH_INGENIC_JZ4760B,
7962306a36Sopenharmony_ci	MACH_INGENIC_JZ4770,
8062306a36Sopenharmony_ci	MACH_INGENIC_JZ4775,
8162306a36Sopenharmony_ci	MACH_INGENIC_JZ4780,
8262306a36Sopenharmony_ci	MACH_INGENIC_X1000,
8362306a36Sopenharmony_ci	MACH_INGENIC_X1000E,
8462306a36Sopenharmony_ci	MACH_INGENIC_X1830,
8562306a36Sopenharmony_ci	MACH_INGENIC_X2000,
8662306a36Sopenharmony_ci	MACH_INGENIC_X2000E,
8762306a36Sopenharmony_ci	MACH_INGENIC_X2000H,
8862306a36Sopenharmony_ci	MACH_INGENIC_X2100,
8962306a36Sopenharmony_ci};
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ciextern char *system_type;
9262306a36Sopenharmony_ciconst char *get_system_type(void);
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ciextern unsigned long mips_machtype;
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ciextern void detect_memory_region(phys_addr_t start, phys_addr_t sz_min,  phys_addr_t sz_max);
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ciextern void prom_init(void);
9962306a36Sopenharmony_ciextern void prom_free_prom_memory(void);
10062306a36Sopenharmony_ciextern void prom_cleanup(void);
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ciextern void free_init_pages(const char *what,
10362306a36Sopenharmony_ci			    unsigned long begin, unsigned long end);
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ciextern void (*free_init_pages_eva)(void *begin, void *end);
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci/*
10862306a36Sopenharmony_ci * Initial kernel command line, usually setup by prom_init()
10962306a36Sopenharmony_ci */
11062306a36Sopenharmony_ciextern char arcs_cmdline[COMMAND_LINE_SIZE];
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci/*
11362306a36Sopenharmony_ci * Registers a0, a1, a2 and a3 as passed to the kernel entry by firmware
11462306a36Sopenharmony_ci */
11562306a36Sopenharmony_ciextern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci#ifdef CONFIG_USE_OF
11862306a36Sopenharmony_ci#include <linux/libfdt.h>
11962306a36Sopenharmony_ci#include <linux/of_fdt.h>
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ciextern char __appended_dtb[];
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_cistatic inline void *get_fdt(void)
12462306a36Sopenharmony_ci{
12562306a36Sopenharmony_ci	if (IS_ENABLED(CONFIG_MIPS_RAW_APPENDED_DTB) ||
12662306a36Sopenharmony_ci	    IS_ENABLED(CONFIG_MIPS_ELF_APPENDED_DTB))
12762306a36Sopenharmony_ci		if (fdt_magic(&__appended_dtb) == FDT_MAGIC)
12862306a36Sopenharmony_ci			return &__appended_dtb;
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci	if (fw_arg0 == -2) /* UHI interface */
13162306a36Sopenharmony_ci		return (void *)fw_arg1;
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci	if (IS_ENABLED(CONFIG_BUILTIN_DTB))
13462306a36Sopenharmony_ci		if (&__dtb_start != &__dtb_end)
13562306a36Sopenharmony_ci			return &__dtb_start;
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci	return NULL;
13862306a36Sopenharmony_ci}
13962306a36Sopenharmony_ci#endif
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci/*
14262306a36Sopenharmony_ci * Platform memory detection hook called by arch_mem_init()
14362306a36Sopenharmony_ci */
14462306a36Sopenharmony_ciextern void plat_mem_setup(void);
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci#ifdef CONFIG_SWIOTLB
14762306a36Sopenharmony_ci/*
14862306a36Sopenharmony_ci * Optional platform hook to call swiotlb_setup().
14962306a36Sopenharmony_ci */
15062306a36Sopenharmony_ciextern void plat_swiotlb_setup(void);
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci#else
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_cistatic inline void plat_swiotlb_setup(void) {}
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci#endif /* CONFIG_SWIOTLB */
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#ifdef CONFIG_USE_OF
15962306a36Sopenharmony_ci/**
16062306a36Sopenharmony_ci * plat_get_fdt() - Return a pointer to the platform's device tree blob
16162306a36Sopenharmony_ci *
16262306a36Sopenharmony_ci * This function provides a platform independent API to get a pointer to the
16362306a36Sopenharmony_ci * flattened device tree blob. The interface between bootloader and kernel
16462306a36Sopenharmony_ci * is not consistent across platforms so it is necessary to provide this
16562306a36Sopenharmony_ci * API such that common startup code can locate the FDT.
16662306a36Sopenharmony_ci *
16762306a36Sopenharmony_ci * This is used by the KASLR code to get command line arguments and random
16862306a36Sopenharmony_ci * seed from the device tree. Any platform wishing to use KASLR should
16962306a36Sopenharmony_ci * provide this API and select SYS_SUPPORTS_RELOCATABLE.
17062306a36Sopenharmony_ci *
17162306a36Sopenharmony_ci * Return: Pointer to the flattened device tree blob.
17262306a36Sopenharmony_ci */
17362306a36Sopenharmony_ciextern void *plat_get_fdt(void);
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci#ifdef CONFIG_RELOCATABLE
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci/**
17862306a36Sopenharmony_ci * plat_fdt_relocated() - Update platform's information about relocated dtb
17962306a36Sopenharmony_ci *
18062306a36Sopenharmony_ci * This function provides a platform-independent API to set platform's
18162306a36Sopenharmony_ci * information about relocated DTB if it needs to be moved due to kernel
18262306a36Sopenharmony_ci * relocation occurring at boot.
18362306a36Sopenharmony_ci */
18462306a36Sopenharmony_civoid plat_fdt_relocated(void *new_location);
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci#endif /* CONFIG_RELOCATABLE */
18762306a36Sopenharmony_ci#endif /* CONFIG_USE_OF */
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci#endif /* _ASM_BOOTINFO_H */
190