summaryrefslogtreecommitdiff
path: root/include/soc/sifive/sifive_l2_cache.h
blob: f472e4cb1232e756e59c35cb1fe8c97393eee0c1 (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
33
34
35
36
37
38
39
40
41
42
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * SiFive L2 Cache Controller header file
 *
 */

#ifndef __SOC_SIFIVE_L2_CACHE_H
#define __SOC_SIFIVE_L2_CACHE_H

#include <linux/io.h>
#include <linux/jump_label.h>

extern int register_sifive_l2_error_notifier(struct notifier_block *nb);
extern int unregister_sifive_l2_error_notifier(struct notifier_block *nb);

#define SIFIVE_L2_ERR_TYPE_CE 0
#define SIFIVE_L2_ERR_TYPE_UE 1

DECLARE_STATIC_KEY_FALSE(sifive_l2_handle_noncoherent_key);

static inline bool sifive_l2_handle_noncoherent(void)
{
#ifdef CONFIG_SIFIVE_L2
	return static_branch_unlikely(&sifive_l2_handle_noncoherent_key);
#else
	return false;
#endif
}

void sifive_ccache_flush_range(phys_addr_t start, size_t len);
void sifive_l2_flush_range(phys_addr_t start, size_t len);
void *sifive_l2_set_uncached(void *addr, size_t size);
static inline void sifive_l2_clear_uncached(void *addr, size_t size)
{
	memunmap(addr);
}

#ifdef CONFIG_SIFIVE_L2_FLUSH
void sifive_l2_flush64_range(unsigned long start, unsigned long len);
#endif

#endif /* __SOC_SIFIVE_L2_CACHE_H */