summaryrefslogtreecommitdiffstats
path: root/arch/kvx/cpu/cpu.c
blob: 788d3194fe5418508b5f39b5bf254448dc3c0f1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2019 Kalray Inc.
 */

#include <common.h>
#include <asm/sfr.h>
#include <asm/sys_arch.h>

extern char __dtb_start[];

/* Default to builtin dtb */
void *boot_dtb = __dtb_start;

void kvx_lowlevel_setup(unsigned long r0, void *dtb_ptr)
{
	uint64_t ev_val = (uint64_t) &_exception_start | EXCEPTION_STRIDE;

	if (r0 == FSBL_PARAM_MAGIC) {
		boot_dtb = dtb_ptr;
		pr_info("Using DTB provided by FSBL\n");
	}

	/* Install exception handlers */
	kvx_sfr_set(EV, ev_val);

	/* Clear exception taken bit now that we setup our handlers */
	kvx_sfr_set_field(PS, ET, 0);

	/* Finally, make sure nobody disabled hardware trap before us */
	kvx_sfr_set_field(PS, HTD, 0);
}