blob: 27385f81e5553c47a446d8107a6e6bb56813eb2e (
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
52
53
54
55
56
57
58
59
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2015 Google, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __MIPS_ARCH_MMU_H
#define __MIPS_ARCH_MMU_H
#include <arch/cpu.h>
#include <stddef.h>
#include <stdint.h>
static inline void tlb_write_indexed(void)
{
__asm__ __volatile__(
".set noreorder\n\t"
"tlbwi\n\t"
".set reorder");
}
static inline uint32_t get_max_pagesize(void)
{
uint32_t max_pgsize;
write_c0_pagemask(C0_PAGEMASK_MASK << C0_PAGEMASK_SHIFT);
back_to_back_c0_hazard();
max_pgsize = (((read_c0_pagemask() >> C0_PAGEMASK_SHIFT) &
C0_PAGEMASK_MASK) + 1) * 4 * KiB;
return max_pgsize;
}
static inline uint32_t get_tlb_size(void)
{
uint32_t tlbsize;
tlbsize = ((read_c0_config1() >> C0_CONFIG1_MMUSIZE_SHIFT) &
C0_CONFIG1_MMUSIZE_MASK) + 1;
return tlbsize;
}
int identity_map(uint32_t start, size_t len);
#endif /* __MIPS_ARCH_MMU_H */
|