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
0c7c4411
Commit
0c7c4411
authored
Apr 24, 2017
by
davidcunado-arm
Committed by
GitHub
Apr 24, 2017
Browse files
Merge pull request #909 from sandrine-bailleux-arm/sb/xlat-lib-misc-improvements
xlat lib: Use mmap_attr_t type consistently
parents
3fb340a2
28fa2e9e
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/lib/xlat_tables/xlat_tables.h
View file @
0c7c4411
...
@@ -108,7 +108,7 @@ typedef struct mmap_region {
...
@@ -108,7 +108,7 @@ typedef struct mmap_region {
/* Generic translation table APIs */
/* Generic translation table APIs */
void
init_xlat_tables
(
void
);
void
init_xlat_tables
(
void
);
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
,
unsigned
in
t
attr
);
size_t
size
,
mmap_attr_
t
attr
);
void
mmap_add
(
const
mmap_region_t
*
mm
);
void
mmap_add
(
const
mmap_region_t
*
mm
);
#endif
/*__ASSEMBLY__*/
#endif
/*__ASSEMBLY__*/
...
...
include/lib/xlat_tables/xlat_tables_v2.h
View file @
0c7c4411
...
@@ -114,7 +114,7 @@ void init_xlat_tables(void);
...
@@ -114,7 +114,7 @@ void init_xlat_tables(void);
* be added before initializing the MMU and cannot be removed later.
* be added before initializing the MMU and cannot be removed later.
*/
*/
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
,
unsigned
in
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 region with defined base PA and base VA. This type of region can be
...
@@ -128,7 +128,7 @@ void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
...
@@ -128,7 +128,7 @@ void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
* EPERM: It overlaps another region in an invalid way.
* EPERM: It overlaps another region in an invalid way.
*/
*/
int
mmap_add_dynamic_region
(
unsigned
long
long
base_pa
,
uintptr_t
base_va
,
int
mmap_add_dynamic_region
(
unsigned
long
long
base_pa
,
uintptr_t
base_va
,
size_t
size
,
unsigned
in
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 type
...
...
lib/xlat_tables/xlat_tables_common.c
View file @
0c7c4411
...
@@ -87,7 +87,7 @@ void print_mmap(void)
...
@@ -87,7 +87,7 @@ void print_mmap(void)
}
}
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
,
unsigned
in
t
attr
)
size_t
size
,
mmap_attr_
t
attr
)
{
{
mmap_region_t
*
mm
=
mmap
;
mmap_region_t
*
mm
=
mmap
;
mmap_region_t
*
mm_last
=
mm
+
ARRAY_SIZE
(
mmap
)
-
1
;
mmap_region_t
*
mm_last
=
mm
+
ARRAY_SIZE
(
mmap
)
-
1
;
...
@@ -199,7 +199,7 @@ void mmap_add(const mmap_region_t *mm)
...
@@ -199,7 +199,7 @@ void mmap_add(const mmap_region_t *mm)
}
}
}
}
static
uint64_t
mmap_desc
(
unsigned
attr
,
unsigned
long
long
addr_pa
,
static
uint64_t
mmap_desc
(
mmap_attr_t
attr
,
unsigned
long
long
addr_pa
,
int
level
)
int
level
)
{
{
uint64_t
desc
;
uint64_t
desc
;
...
@@ -277,11 +277,11 @@ static uint64_t mmap_desc(unsigned attr, unsigned long long addr_pa,
...
@@ -277,11 +277,11 @@ static uint64_t mmap_desc(unsigned attr, unsigned long long addr_pa,
* attributes of the innermost region that contains it. If there are partial
* attributes of the innermost region that contains it. If there are partial
* overlaps, it returns -1, as a smaller size is needed.
* overlaps, it returns -1, as a smaller size is needed.
*/
*/
static
in
t
mmap_region_attr
(
mmap_region_t
*
mm
,
uintptr_t
base_va
,
static
mmap_attr_
t
mmap_region_attr
(
mmap_region_t
*
mm
,
uintptr_t
base_va
,
size_t
size
)
size_t
size
)
{
{
/* Don't assume that the area is contained in the first region */
/* Don't assume that the area is contained in the first region */
in
t
attr
=
-
1
;
mmap_attr_
t
attr
=
-
1
;
/*
/*
* Get attributes from last (innermost) region that contains the
* Get attributes from last (innermost) region that contains the
...
@@ -360,7 +360,8 @@ static mmap_region_t *init_xlation_table_inner(mmap_region_t *mm,
...
@@ -360,7 +360,8 @@ static mmap_region_t *init_xlation_table_inner(mmap_region_t *mm,
* there are partially overlapping regions. On success,
* there are partially overlapping regions. On success,
* it will return the innermost region's attributes.
* it will return the innermost region's attributes.
*/
*/
int
attr
=
mmap_region_attr
(
mm
,
base_va
,
level_size
);
mmap_attr_t
attr
=
mmap_region_attr
(
mm
,
base_va
,
level_size
);
if
(
attr
>=
0
)
{
if
(
attr
>=
0
)
{
desc
=
mmap_desc
(
attr
,
desc
=
mmap_desc
(
attr
,
base_va
-
mm
->
base_va
+
mm
->
base_pa
,
base_va
-
mm
->
base_va
+
mm
->
base_pa
,
...
...
lib/xlat_tables_v2/xlat_tables_common.c
View file @
0c7c4411
...
@@ -92,7 +92,7 @@ xlat_ctx_t tf_xlat_ctx = {
...
@@ -92,7 +92,7 @@ xlat_ctx_t tf_xlat_ctx = {
};
};
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
,
unsigned
in
t
attr
)
size_t
size
,
mmap_attr_
t
attr
)
{
{
mmap_region_t
mm
=
{
mmap_region_t
mm
=
{
.
base_va
=
base_va
,
.
base_va
=
base_va
,
...
@@ -114,7 +114,7 @@ void mmap_add(const mmap_region_t *mm)
...
@@ -114,7 +114,7 @@ void mmap_add(const mmap_region_t *mm)
#if PLAT_XLAT_TABLES_DYNAMIC
#if PLAT_XLAT_TABLES_DYNAMIC
int
mmap_add_dynamic_region
(
unsigned
long
long
base_pa
,
int
mmap_add_dynamic_region
(
unsigned
long
long
base_pa
,
uintptr_t
base_va
,
size_t
size
,
unsigned
in
t
attr
)
uintptr_t
base_va
,
size_t
size
,
mmap_attr_
t
attr
)
{
{
mmap_region_t
mm
=
{
mmap_region_t
mm
=
{
.
base_va
=
base_va
,
.
base_va
=
base_va
,
...
...
lib/xlat_tables_v2/xlat_tables_internal.c
View file @
0c7c4411
...
@@ -115,7 +115,7 @@ static uint64_t *xlat_table_get_empty(xlat_ctx_t *ctx)
...
@@ -115,7 +115,7 @@ static uint64_t *xlat_table_get_empty(xlat_ctx_t *ctx)
#endif
/* PLAT_XLAT_TABLES_DYNAMIC */
#endif
/* PLAT_XLAT_TABLES_DYNAMIC */
/* Returns a block/page table descriptor for the given level and attributes. */
/* Returns a block/page table descriptor for the given level and attributes. */
static
uint64_t
xlat_desc
(
unsigned
in
t
attr
,
unsigned
long
long
addr_pa
,
static
uint64_t
xlat_desc
(
mmap_attr_
t
attr
,
unsigned
long
long
addr_pa
,
int
level
)
int
level
)
{
{
uint64_t
desc
;
uint64_t
desc
;
...
@@ -609,7 +609,7 @@ void print_mmap(mmap_region_t *const mmap)
...
@@ -609,7 +609,7 @@ void print_mmap(mmap_region_t *const mmap)
*/
*/
static
int
mmap_add_region_check
(
xlat_ctx_t
*
ctx
,
unsigned
long
long
base_pa
,
static
int
mmap_add_region_check
(
xlat_ctx_t
*
ctx
,
unsigned
long
long
base_pa
,
uintptr_t
base_va
,
size_t
size
,
uintptr_t
base_va
,
size_t
size
,
unsigned
in
t
attr
)
mmap_attr_
t
attr
)
{
{
mmap_region_t
*
mm
=
ctx
->
mmap
;
mmap_region_t
*
mm
=
ctx
->
mmap
;
unsigned
long
long
end_pa
=
base_pa
+
size
-
1
;
unsigned
long
long
end_pa
=
base_pa
+
size
-
1
;
...
...
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