Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
3f9f08cf
U
U-Boot.Mirror
项目概览
OS
/
U-Boot.Mirror
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
U-Boot.Mirror
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f9f08cf
编写于
4月 14, 2007
作者:
G
Gerald Van Baren
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add some utilities to manipulate the reserved memory map.
上级
64dbbd40
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
103 addition
and
0 deletion
+103
-0
include/libfdt.h
include/libfdt.h
+5
-0
libfdt/fdt_ro.c
libfdt/fdt_ro.c
+72
-0
libfdt/fdt_wip.c
libfdt/fdt_wip.c
+26
-0
未找到文件。
include/libfdt.h
浏览文件 @
3f9f08cf
...
...
@@ -86,6 +86,8 @@ void *fdt_getprop(const void *fdt, int nodeoffset,
uint32_t
fdt_next_tag
(
const
void
*
fdt
,
int
offset
,
int
*
nextoffset
,
char
**
namep
);
int
fdt_num_reservemap
(
void
*
fdt
,
int
*
used
,
int
*
total
);
int
fdt_get_reservemap
(
void
*
fdt
,
int
n
,
struct
fdt_reserve_entry
*
re
);
/* Write-in-place functions */
int
fdt_setprop_inplace
(
void
*
fdt
,
int
nodeoffset
,
const
char
*
name
,
...
...
@@ -99,6 +101,8 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
int
fdt_nop_property
(
void
*
fdt
,
int
nodeoffset
,
const
char
*
name
);
int
fdt_nop_node
(
void
*
fdt
,
int
nodeoffset
);
int
fdt_insert_reservemap_entry
(
void
*
fdt
,
int
n
,
uint64_t
addr
,
uint64_t
size
);
/* Sequential-write functions */
int
fdt_create
(
void
*
buf
,
int
bufsize
);
...
...
@@ -115,6 +119,7 @@ int fdt_property(void *fdt, const char *name, const void *val, int len);
fdt_property(fdt, name, str, strlen(str)+1)
int
fdt_end_node
(
void
*
fdt
);
int
fdt_finish
(
void
*
fdt
);
int
fdt_replace_reservemap_entry
(
void
*
fdt
,
int
n
,
uint64_t
addr
,
uint64_t
size
);
/* Read-write functions */
int
fdt_open_into
(
void
*
fdt
,
void
*
buf
,
int
bufsize
);
...
...
libfdt/fdt_ro.c
浏览文件 @
3f9f08cf
...
...
@@ -329,3 +329,75 @@ uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset, char **namep
return
tag
;
}
/*
* Return the number of used reserve map entries and total slots available.
*/
int
fdt_num_reservemap
(
void
*
fdt
,
int
*
used
,
int
*
total
)
{
struct
fdt_reserve_entry
*
re
;
int
start
;
int
end
;
int
err
=
fdt_check_header
(
fdt
);
if
(
err
!=
0
)
return
err
;
start
=
fdt_off_mem_rsvmap
(
fdt
);
/*
* Convention is that the reserve map is before the dt_struct,
* but it does not have to be.
*/
end
=
fdt_totalsize
(
fdt
);
if
(
end
>
fdt_off_dt_struct
(
fdt
))
end
=
fdt_off_dt_struct
(
fdt
);
if
(
end
>
fdt_off_dt_strings
(
fdt
))
end
=
fdt_off_dt_strings
(
fdt
);
/*
* Since the reserved area list is zero terminated, you get one fewer.
*/
if
(
total
)
*
total
=
((
end
-
start
)
/
sizeof
(
struct
fdt_reserve_entry
))
-
1
;
if
(
used
)
{
*
used
=
0
;
while
(
start
<
end
)
{
re
=
(
struct
fdt_reserve_entry
*
)(
fdt
+
start
);
if
(
re
->
size
==
0
)
return
0
;
/* zero size terminates the list */
*
used
+=
1
;
start
+=
sizeof
(
struct
fdt_reserve_entry
);
}
/*
* If we get here, there was no zero size termination.
*/
return
-
FDT_ERR_BADLAYOUT
;
}
return
0
;
}
/*
* Return the nth reserve map entry.
*/
int
fdt_get_reservemap
(
void
*
fdt
,
int
n
,
struct
fdt_reserve_entry
*
re
)
{
int
used
;
int
total
;
int
err
;
err
=
fdt_num_reservemap
(
fdt
,
&
used
,
&
total
);
if
(
err
!=
0
)
return
err
;
if
(
n
>=
total
)
return
-
FDT_ERR_NOSPACE
;
if
(
re
)
{
*
re
=
*
(
struct
fdt_reserve_entry
*
)
_fdt_offset_ptr
(
fdt
,
n
*
sizeof
(
struct
fdt_reserve_entry
));
}
return
0
;
}
libfdt/fdt_wip.c
浏览文件 @
3f9f08cf
...
...
@@ -110,3 +110,29 @@ int fdt_nop_node(void *fdt, int nodeoffset)
nop_region
(
fdt_offset_ptr
(
fdt
,
nodeoffset
,
0
),
endoffset
-
nodeoffset
);
return
0
;
}
/*
* Replace a reserve map entry in the nth slot.
*/
int
fdt_replace_reservemap_entry
(
void
*
fdt
,
int
n
,
uint64_t
addr
,
uint64_t
size
)
{
struct
fdt_reserve_entry
*
re
;
int
used
;
int
total
;
int
err
;
err
=
fdt_num_reservemap
(
fdt
,
&
used
,
&
total
);
if
(
err
!=
0
)
return
err
;
if
(
n
>=
total
)
return
-
FDT_ERR_NOSPACE
;
re
=
(
struct
fdt_reserve_entry
*
)
(
fdt
+
fdt_off_mem_rsvmap
(
fdt
)
+
(
n
*
sizeof
(
struct
fdt_reserve_entry
)));
re
->
address
=
cpu_to_fdt64
(
addr
);
re
->
size
=
cpu_to_fdt64
(
size
);
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录