RTEMS 6.1-rc7
Loading...
Searching...
No Matches
mmu.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2011, 2015 embedded brains GmbH & Co. KG
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef LIBBSP_POWERPC_QORIQ_MMU_H
37#define LIBBSP_POWERPC_QORIQ_MMU_H
38
39#include <stdint.h>
40#include <stdbool.h>
41
42#include <bspopts.h>
43
44#ifdef __cplusplus
45extern "C" {
46#endif /* __cplusplus */
47
58#define QORIQ_MMU_MIN_POWER 12
59#define QORIQ_MMU_MAX_POWER 30
60#define QORIQ_MMU_POWER_STEP 2
61
62typedef struct {
63 uintptr_t begin;
64 uintptr_t last;
65 uint32_t mas1;
66 uint32_t mas2;
67 uint32_t mas3;
68 uint32_t mas7;
70
71typedef struct {
72 int count;
73 qoriq_mmu_entry entries [QORIQ_TLB1_ENTRY_COUNT];
75
76void qoriq_mmu_context_init(qoriq_mmu_context *self);
77
78bool qoriq_mmu_add(
80 uintptr_t begin,
81 uintptr_t last,
82 uint32_t mas1,
83 uint32_t mas2,
84 uint32_t mas3,
85 uint32_t mas7
86);
87
88void qoriq_mmu_partition(qoriq_mmu_context *self, int max_count);
89
90void qoriq_mmu_write_to_tlb1(qoriq_mmu_context *self, int first_tlb);
91
92void qoriq_mmu_change_perm(uint32_t test, uint32_t set, uint32_t clear);
93
94int qoriq_mmu_find_free_tlb1_entry(void);
95
96void qoriq_mmu_config(bool boot_processor, int first_tlb, int scratch_tlb);
97
98void qoriq_tlb1_write(
99 int esel,
100 uint32_t mas1,
101 uint32_t mas2,
102 uint32_t mas3,
103 uint32_t mas7,
104 uintptr_t ea,
105 int tsize
106);
107
108void qoriq_mmu_adjust_and_write_to_tlb1(
109 int tlb,
110 uintptr_t begin,
111 uintptr_t last,
112 uint32_t mas1,
113 uint32_t mas2,
114 uint32_t mas3,
115 uint32_t mas7
116);
117
118void qoriq_tlb1_invalidate(int esel);
119
122#ifdef __cplusplus
123}
124#endif /* __cplusplus */
125
126#endif /* LIBBSP_POWERPC_QORIQ_MMU_H */
Definition: mmu.h:71
Definition: mmu.h:62