Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
823cc7a9
Commit
823cc7a9
authored
May 12, 2017
by
davidcunado-arm
Committed by
GitHub
May 12, 2017
Browse files
Merge pull request #930 from antonio-nino-diaz-arm/an/fixes-xlat-v2
Minor fixes to the xlat tables lib v2
parents
b4b541cb
e769db3e
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/lib/xlat_tables/xlat_tables_v2.h
View file @
823cc7a9
...
@@ -83,18 +83,25 @@ typedef struct mmap_region {
...
@@ -83,18 +83,25 @@ typedef struct mmap_region {
}
mmap_region_t
;
}
mmap_region_t
;
/* Generic translation table APIs */
/* Generic translation table APIs */
/*
* Initialize translation tables from the current list of mmap regions. Calling
* this function marks the transition point after which static regions can no
* longer be added.
*/
void
init_xlat_tables
(
void
);
void
init_xlat_tables
(
void
);
/*
/*
* Add a region with defined base PA and base VA. This type of region can only
* Add a static region with defined base PA and base VA. This function can only
* be added before initializing the MMU and cannot be removed later.
* be used before initializing the translation tables. The region cannot be
* removed afterwards.
*/
*/
void
mmap_add_region
(
unsigned
long
long
base_pa
,
uintptr_t
base_va
,
void
mmap_add_region
(
unsigned
long
long
base_pa
,
uintptr_t
base_va
,
size_t
size
,
mmap_attr_t
attr
);
size_t
size
,
mmap_attr_t
attr
);
/*
/*
* Add a region with defined base PA and base VA. This type of region
can be
* Add a
dynamic
region with defined base PA and base VA. This type of region
* added and removed even
if the MMU is enabl
ed.
*
can be
added and removed even
after the translation tables are initializ
ed.
*
*
* Returns:
* Returns:
* 0: Success.
* 0: Success.
...
@@ -107,15 +114,16 @@ int mmap_add_dynamic_region(unsigned long long base_pa, uintptr_t base_va,
...
@@ -107,15 +114,16 @@ int mmap_add_dynamic_region(unsigned long long base_pa, uintptr_t base_va,
size_t
size
,
mmap_attr_t
attr
);
size_t
size
,
mmap_attr_t
attr
);
/*
/*
* Add an array of static regions with defined base PA and base VA. This
type
* Add an array of static regions with defined base PA and base VA. This
*
of reg
ion can only be
add
ed before initializing the
MMU and cannot b
e
*
funct
ion can only be
us
ed before initializing the
translation tables. Th
e
* removed
l
ater.
*
regions cannot be
removed a
f
ter
wards
.
*/
*/
void
mmap_add
(
const
mmap_region_t
*
mm
);
void
mmap_add
(
const
mmap_region_t
*
mm
);
/*
/*
* Remove a region with the specified base VA and size. Only dynamic regions can
* Remove a region with the specified base VA and size. Only dynamic regions can
* be removed, and they can be removed even if the MMU is enabled.
* be removed, and they can be removed even if the translation tables are
* initialized.
*
*
* Returns:
* Returns:
* 0: Success.
* 0: Success.
...
...
lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
View file @
823cc7a9
...
@@ -60,7 +60,7 @@ static const unsigned int pa_range_bits_arr[] = {
...
@@ -60,7 +60,7 @@ static const unsigned int pa_range_bits_arr[] = {
PARANGE_0101
PARANGE_0101
};
};
unsigned
long
long
xlat_arch_get_max_supported_pa
(
void
)
static
unsigned
long
long
xlat_arch_get_max_supported_pa
(
void
)
{
{
u_register_t
pa_range
=
read_id_aa64mmfr0_el1
()
&
u_register_t
pa_range
=
read_id_aa64mmfr0_el1
()
&
ID_AA64MMFR0_EL1_PARANGE_MASK
;
ID_AA64MMFR0_EL1_PARANGE_MASK
;
...
...
lib/xlat_tables_v2/xlat_tables_common.c
View file @
823cc7a9
...
@@ -34,8 +34,6 @@ static uint64_t tf_xlat_tables[MAX_XLAT_TABLES][XLAT_TABLE_ENTRIES]
...
@@ -34,8 +34,6 @@ static uint64_t tf_xlat_tables[MAX_XLAT_TABLES][XLAT_TABLE_ENTRIES]
static
uint64_t
tf_base_xlat_table
[
NUM_BASE_LEVEL_ENTRIES
]
static
uint64_t
tf_base_xlat_table
[
NUM_BASE_LEVEL_ENTRIES
]
__aligned
(
NUM_BASE_LEVEL_ENTRIES
*
sizeof
(
uint64_t
));
__aligned
(
NUM_BASE_LEVEL_ENTRIES
*
sizeof
(
uint64_t
));
static
mmap_region_t
tf_mmap
[
MAX_MMAP_REGIONS
+
1
];
#if PLAT_XLAT_TABLES_DYNAMIC
#if PLAT_XLAT_TABLES_DYNAMIC
static
int
xlat_tables_mapped_regions
[
MAX_XLAT_TABLES
];
static
int
xlat_tables_mapped_regions
[
MAX_XLAT_TABLES
];
#endif
/* PLAT_XLAT_TABLES_DYNAMIC */
#endif
/* PLAT_XLAT_TABLES_DYNAMIC */
...
...
lib/xlat_tables_v2/xlat_tables_private.h
View file @
823cc7a9
...
@@ -47,8 +47,11 @@ typedef struct {
...
@@ -47,8 +47,11 @@ typedef struct {
* Array of all memory regions stored in order of ascending end address
* Array of all memory regions stored in order of ascending end address
* and ascending size to simplify the code that allows overlapping
* and ascending size to simplify the code that allows overlapping
* regions. The list is terminated by the first entry with size == 0.
* regions. The list is terminated by the first entry with size == 0.
* The max size of the list is stored in `mmap_num`. `mmap` points to an
* array of mmap_num + 1 elements, so that there is space for the final
* null entry.
*/
*/
mmap_region_t
*
mmap
;
/* mmap_num + 1 elements */
mmap_region_t
*
mmap
;
int
mmap_num
;
int
mmap_num
;
/*
/*
...
@@ -75,6 +78,11 @@ typedef struct {
...
@@ -75,6 +78,11 @@ typedef struct {
uint64_t
*
base_table
;
uint64_t
*
base_table
;
int
base_table_entries
;
int
base_table_entries
;
/*
* Max Physical and Virtual addresses currently in use by the
* translation tables. These might get updated as we map/unmap memory
* regions but they will never go beyond pa/va_max_address.
*/
unsigned
long
long
max_pa
;
unsigned
long
long
max_pa
;
uintptr_t
max_va
;
uintptr_t
max_va
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment