summaryrefslogtreecommitdiff
path: root/chip/mt8192_scp/cache.h
blob: 633937aa3560bf2127bd0834ea1804b0370e9434 (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
43
44
45
46
47
48
49
50
51
/* Copyright 2020 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __CROS_EC_CACHE_H
#define __CROS_EC_CACHE_H

#include "csr.h"
#include "stdint.h"

struct mpu_entry {
	/* 1k alignment and the address is inclusive */
	uintptr_t start_addr;
	/* 1k alignment in 4GB boundary and non-inclusive */
	uintptr_t end_addr;
	/* MPU_ATTR */
	uint32_t attribute;
};

/* memory barrier of I$ */
void cache_barrier_icache(void);
/* invalidate all I$ */
void cache_invalidate_icache(void);
/* invalidate a range of I$ */
int cache_invalidate_icache_range(uintptr_t addr, uint32_t length);

/* memory barrier of D$ */
void cache_barrier_dcache(void);
/* writeback all D$ */
void cache_writeback_dcache(void);
/* writeback a range of D$ */
int cache_writeback_dcache_range(uintptr_t addr, uint32_t length);
/* invalidate all D$ */
void cache_invalidate_dcache(void);
/* invalidate a range of D$ */
int cache_invalidate_dcache_range(uintptr_t addr, uint32_t length);
/* writeback and invalidate all D$ */
void cache_flush_dcache(void);
/* writeback and invalidate a range of D$ */
int cache_flush_dcache_range(uintptr_t addr, uint32_t length);

void cache_init(void);

#ifdef DEBUG
int command_enable_pmu(int argc, char **argv);
int command_disable_pmu(int argc, char **argv);
int command_show_pmu(int argc, char **argv);
#endif

#endif /* #ifndef __CROS_EC_CACHE_H */