linux-4.4.1/__reserved_mem_alloc_size()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#lbfea9f0]
#backlinks
*説明 [#d2a38b35]
-パス: [[linux-4.4.1/drivers/of/of_reserved_mem.c]]
-FIXME: これは何?
--説明
**引数 [#maa4204e]
-unsigned long node
--
-const char *uname
--
-phys_addr_t *res_base
--
--[[linux-4.4.1/phys_addr_t]]
-phys_addr_t *res_size
--
**返り値 [#w8476e30]
-int
--
**参考 [#m3de13f1]
*実装 [#s74636f2]
/**
* res_mem_alloc_size() - allocate reserved memory descr...
* and 'alloc-ranges' properties
*/
static int __init __reserved_mem_alloc_size(unsigned lon...
const char *uname, phys_addr_t *res_base, phys_addr_t *...
{
int t_len = (dt_root_addr_cells + dt_root_size_cells) *...
phys_addr_t start = 0, end = 0;
phys_addr_t base = 0, align = 0, size;
int len;
const __be32 *prop;
int nomap;
int ret;
-
--[[linux-4.4.1/dt_root_addr_cells(global)]]
--[[linux-4.4.1/dt_root_size_cells(global)]]
prop = of_get_flat_dt_prop(node, "size", &len);
if (!prop)
return -EINVAL;
-
--[[linux-4.4.1/of_get_flat_dt_prop()]]
if (len != dt_root_size_cells * sizeof(__be32)) {
pr_err("Reserved memory: invalid size property in '%s'...
uname);
return -EINVAL;
}
size = dt_mem_next_cell(dt_root_size_cells, &prop);
-
--[[linux-4.4.1/pr_err()]]
--[[linux-4.4.1/dt_mem_next_call()]]
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NU...
-
--[[linux-4.4.1/of_get_flat_dt_prop()]]
prop = of_get_flat_dt_prop(node, "alignment", &len);
if (prop) {
if (len != dt_root_addr_cells * sizeof(__be32)) {
pr_err("Reserved memory: invalid alignment property i...
uname);
return -EINVAL;
}
align = dt_mem_next_cell(dt_root_addr_cells, &prop);
}
/* Need adjust the alignment to satisfy the CMA require...
if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(...
align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_O...
prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);
if (prop) {
if (len % t_len != 0) {
pr_err("Reserved memory: invalid alloc-ranges propert...
uname);
return -EINVAL;
}
base = 0;
while (len > 0) {
start = dt_mem_next_cell(dt_root_addr_cells, &prop);
end = start + dt_mem_next_cell(dt_root_size_cells,
&prop);
ret = early_init_dt_alloc_reserved_memory_arch(size,
align, start, end, nomap, &base);
if (ret == 0) {
pr_debug("Reserved memory: allocated memory for '%s'...
uname, &base,
(unsigned long)size / SZ_1M);
break;
}
len -= t_len;
}
-
--[[linux-4.4.1/early_init_dt_alloc_reserved_memory_arch(...
--[[linux-4.4.1/pr_debug()]]
} else {
ret = early_init_dt_alloc_reserved_memory_arch(size, a...
0, 0, nomap, &base);
if (ret == 0)
pr_debug("Reserved memory: allocated memory for '%s' ...
uname, &base, (unsigned long)size / SZ_1M);
}
if (base == 0) {
pr_info("Reserved memory: failed to allocate memory fo...
uname);
return -ENOMEM;
}
-
--[[linux-4.4.1/pr_info()]]
*res_base = base;
*res_size = size;
return 0;
}
*コメント [#se0690c8]
終了行:
*参照元 [#lbfea9f0]
#backlinks
*説明 [#d2a38b35]
-パス: [[linux-4.4.1/drivers/of/of_reserved_mem.c]]
-FIXME: これは何?
--説明
**引数 [#maa4204e]
-unsigned long node
--
-const char *uname
--
-phys_addr_t *res_base
--
--[[linux-4.4.1/phys_addr_t]]
-phys_addr_t *res_size
--
**返り値 [#w8476e30]
-int
--
**参考 [#m3de13f1]
*実装 [#s74636f2]
/**
* res_mem_alloc_size() - allocate reserved memory descr...
* and 'alloc-ranges' properties
*/
static int __init __reserved_mem_alloc_size(unsigned lon...
const char *uname, phys_addr_t *res_base, phys_addr_t *...
{
int t_len = (dt_root_addr_cells + dt_root_size_cells) *...
phys_addr_t start = 0, end = 0;
phys_addr_t base = 0, align = 0, size;
int len;
const __be32 *prop;
int nomap;
int ret;
-
--[[linux-4.4.1/dt_root_addr_cells(global)]]
--[[linux-4.4.1/dt_root_size_cells(global)]]
prop = of_get_flat_dt_prop(node, "size", &len);
if (!prop)
return -EINVAL;
-
--[[linux-4.4.1/of_get_flat_dt_prop()]]
if (len != dt_root_size_cells * sizeof(__be32)) {
pr_err("Reserved memory: invalid size property in '%s'...
uname);
return -EINVAL;
}
size = dt_mem_next_cell(dt_root_size_cells, &prop);
-
--[[linux-4.4.1/pr_err()]]
--[[linux-4.4.1/dt_mem_next_call()]]
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NU...
-
--[[linux-4.4.1/of_get_flat_dt_prop()]]
prop = of_get_flat_dt_prop(node, "alignment", &len);
if (prop) {
if (len != dt_root_addr_cells * sizeof(__be32)) {
pr_err("Reserved memory: invalid alignment property i...
uname);
return -EINVAL;
}
align = dt_mem_next_cell(dt_root_addr_cells, &prop);
}
/* Need adjust the alignment to satisfy the CMA require...
if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(...
align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_O...
prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);
if (prop) {
if (len % t_len != 0) {
pr_err("Reserved memory: invalid alloc-ranges propert...
uname);
return -EINVAL;
}
base = 0;
while (len > 0) {
start = dt_mem_next_cell(dt_root_addr_cells, &prop);
end = start + dt_mem_next_cell(dt_root_size_cells,
&prop);
ret = early_init_dt_alloc_reserved_memory_arch(size,
align, start, end, nomap, &base);
if (ret == 0) {
pr_debug("Reserved memory: allocated memory for '%s'...
uname, &base,
(unsigned long)size / SZ_1M);
break;
}
len -= t_len;
}
-
--[[linux-4.4.1/early_init_dt_alloc_reserved_memory_arch(...
--[[linux-4.4.1/pr_debug()]]
} else {
ret = early_init_dt_alloc_reserved_memory_arch(size, a...
0, 0, nomap, &base);
if (ret == 0)
pr_debug("Reserved memory: allocated memory for '%s' ...
uname, &base, (unsigned long)size / SZ_1M);
}
if (base == 0) {
pr_info("Reserved memory: failed to allocate memory fo...
uname);
return -ENOMEM;
}
-
--[[linux-4.4.1/pr_info()]]
*res_base = base;
*res_size = size;
return 0;
}
*コメント [#se0690c8]
ページ名: