162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef _LOONGARCH_SETUP_H
762306a36Sopenharmony_ci#define _LOONGARCH_SETUP_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/types.h>
1062306a36Sopenharmony_ci#include <asm/sections.h>
1162306a36Sopenharmony_ci#include <uapi/asm/setup.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define VECSIZE 0x200
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciextern unsigned long eentry;
1662306a36Sopenharmony_ciextern unsigned long tlbrentry;
1762306a36Sopenharmony_ciextern char init_command_line[COMMAND_LINE_SIZE];
1862306a36Sopenharmony_ciextern void tlb_init(int cpu);
1962306a36Sopenharmony_ciextern void cpu_cache_init(void);
2062306a36Sopenharmony_ciextern void cache_error_setup(void);
2162306a36Sopenharmony_ciextern void per_cpu_trap_init(int cpu);
2262306a36Sopenharmony_ciextern void set_handler(unsigned long offset, void *addr, unsigned long len);
2362306a36Sopenharmony_ciextern void set_merr_handler(unsigned long offset, void *addr, unsigned long len);
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#ifdef CONFIG_RELOCATABLE
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistruct rela_la_abs {
2862306a36Sopenharmony_ci	long pc;
2962306a36Sopenharmony_ci	long symvalue;
3062306a36Sopenharmony_ci};
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciextern long __la_abs_begin;
3362306a36Sopenharmony_ciextern long __la_abs_end;
3462306a36Sopenharmony_ciextern long __rela_dyn_begin;
3562306a36Sopenharmony_ciextern long __rela_dyn_end;
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciextern unsigned long __init relocate_kernel(void);
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci#endif
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_cistatic inline unsigned long kaslr_offset(void)
4262306a36Sopenharmony_ci{
4362306a36Sopenharmony_ci	return (unsigned long)&_text - VMLINUX_LOAD_ADDRESS;
4462306a36Sopenharmony_ci}
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#endif /* __SETUP_H */
47