RTEMS 6.1-rc6
Loading...
Searching...
No Matches
mmu-vmsav8-64.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2021 On-Line Applications Research Corporation (OAR)
13 * Written by Kinsey Moore <kinsey.moore@oarcorp.com>
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef LIBCPU_AARCH64_MMU_VMSAV8_64_H
38#define LIBCPU_AARCH64_MMU_VMSAV8_64_H
39
40#ifndef ASM
41
42#ifdef __cplusplus
43extern "C" {
44#endif /* __cplusplus */
45
46#include <rtems.h>
47
48/* VMSAv8 Long-descriptor fields */
49#define MMU_DESC_AF ( 1 << 10 )
50#define MMU_DESC_SH_INNER ( ( 1 << 9 ) | ( 1 << 8 ) )
51#define MMU_DESC_WRITE_DISABLE ( 1 << 7 )
52/* PAGE and TABLE flags are the same bit, but only apply on certain levels */
53#define MMU_DESC_TYPE_TABLE ( 1 << 1 )
54#define MMU_DESC_TYPE_PAGE ( 1 << 1 )
55#define MMU_DESC_VALID ( 1 << 0 )
56#define MMU_DESC_MAIR_ATTR( val ) ( ( val & 0x3 ) << 2 )
57#define MMU_DESC_PAGE_TABLE_MASK 0xFFFFFFFFF000LL
58
59/* Page table configuration */
60#define MMU_PAGE_BITS 12
61#define MMU_PAGE_SIZE ( 1 << MMU_PAGE_BITS )
62#define MMU_BITS_PER_LEVEL 9
63
64#define AARCH64_MMU_FLAGS_BASE \
65 ( MMU_DESC_VALID | MMU_DESC_SH_INNER | MMU_DESC_AF )
66
67#define AARCH64_MMU_DATA_RO_CACHED \
68 ( AARCH64_MMU_FLAGS_BASE | MMU_DESC_MAIR_ATTR( 3 ) | MMU_DESC_WRITE_DISABLE )
69#define AARCH64_MMU_CODE_CACHED AARCH64_MMU_DATA_RO_CACHED
70#define AARCH64_MMU_CODE_RW_CACHED AARCH64_MMU_DATA_RW_CACHED
71
72#define AARCH64_MMU_DATA_RO \
73 ( AARCH64_MMU_FLAGS_BASE | MMU_DESC_MAIR_ATTR( 2 ) | MMU_DESC_WRITE_DISABLE )
74#define AARCH64_MMU_CODE AARCH64_MMU_DATA_RO
75#define AARCH64_MMU_CODE_RW AARCH64_MMU_DATA_RW
76
77/* RW implied by not ORing in RO */
78#define AARCH64_MMU_DATA_RW_CACHED \
79 ( AARCH64_MMU_FLAGS_BASE | MMU_DESC_MAIR_ATTR( 3 ) )
80#define AARCH64_MMU_DATA_RW \
81 ( AARCH64_MMU_FLAGS_BASE | MMU_DESC_MAIR_ATTR( 2 ) )
82#define AARCH64_MMU_DEVICE ( AARCH64_MMU_FLAGS_BASE | MMU_DESC_MAIR_ATTR( 0 ) )
83
84rtems_status_code aarch64_mmu_map(
85 uintptr_t addr,
86 uint64_t size,
87 uint64_t flags
88);
89
90#ifdef __cplusplus
91}
92#endif /* __cplusplus */
93
94#endif /* ASM */
95
96#endif /* LIBCPU_AARCH64_MMU_VMSAV8_64_H */
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
This header file defines the RTEMS Classic API.