mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-12-18 17:53:10 +00:00
kboot: Split dt_device_set_reserved_mem
Make dt_device_set_reserved_mem take in an explicit iova instead of reading it off from a DART. Add a separate 'from_dart' variety of the function for getting the iova from DART. Signed-off-by: Martin Povišer <povik@cutebit.org>
This commit is contained in:
parent
5ad92458b7
commit
f996295045
1 changed files with 18 additions and 12 deletions
26
src/kboot.c
26
src/kboot.c
|
@ -1125,15 +1125,11 @@ static u64 dart_get_mapping(dart_dev_t *dart, const char *path, u64 paddr, size_
|
|||
return iova;
|
||||
}
|
||||
|
||||
static int dt_device_set_reserved_mem(int node, dart_dev_t *dart, const char *name,
|
||||
uint32_t phandle, u64 paddr, u64 size)
|
||||
static int dt_device_set_reserved_mem(int node, const char *name, uint32_t phandle, u64 iova,
|
||||
u64 size)
|
||||
{
|
||||
int ret;
|
||||
|
||||
u64 iova = dart_get_mapping(dart, name, paddr, size);
|
||||
if (DART_IS_ERR(iova))
|
||||
bail("ADT: no mapping found for '%s' 0x%012lx iova:0x%08lx)\n", name, paddr, iova);
|
||||
|
||||
ret = fdt_appendprop_u32(dt, node, "iommu-addresses", phandle);
|
||||
if (ret != 0)
|
||||
bail("DT: could not append phandle '%s.compatible' property: %d\n", name, ret);
|
||||
|
@ -1149,6 +1145,16 @@ static int dt_device_set_reserved_mem(int node, dart_dev_t *dart, const char *na
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dt_device_set_reserved_mem_from_dart(int node, dart_dev_t *dart, const char *name,
|
||||
uint32_t phandle, u64 paddr, u64 size)
|
||||
{
|
||||
u64 iova = dart_get_mapping(dart, name, paddr, size);
|
||||
if (DART_IS_ERR(iova))
|
||||
bail("ADT: no mapping found for '%s' 0x%012lx iova:0x%08lx)\n", name, paddr, iova);
|
||||
|
||||
return dt_device_set_reserved_mem(node, name, phandle, iova, size);
|
||||
}
|
||||
|
||||
static int dt_get_or_add_reserved_mem(const char *node_name, const char *compat, u64 paddr,
|
||||
size_t size)
|
||||
{
|
||||
|
@ -1320,20 +1326,20 @@ static int dt_add_reserved_regions(const char *dcp_alias, const char *disp_alias
|
|||
uint32_t mem_phandle = fdt_get_phandle(dt, mem_node);
|
||||
|
||||
if (maps[i].map_dcp && dart_dcp) {
|
||||
ret = dt_device_set_reserved_mem(mem_node, dart_dcp, node_name, dcp_phandle,
|
||||
ret = dt_device_set_reserved_mem_from_dart(mem_node, dart_dcp, node_name, dcp_phandle,
|
||||
region[i].paddr, region[i].size);
|
||||
if (ret != 0)
|
||||
goto err;
|
||||
}
|
||||
if (maps[i].map_disp && dart_disp) {
|
||||
ret = dt_device_set_reserved_mem(mem_node, dart_disp, node_name, disp_phandle,
|
||||
ret = dt_device_set_reserved_mem_from_dart(mem_node, dart_disp, node_name, disp_phandle,
|
||||
region[i].paddr, region[i].size);
|
||||
if (ret != 0)
|
||||
goto err;
|
||||
}
|
||||
if (maps[i].map_piodma && dart_piodma) {
|
||||
ret = dt_device_set_reserved_mem(mem_node, dart_piodma, node_name, piodma_phandle,
|
||||
region[i].paddr, region[i].size);
|
||||
ret = dt_device_set_reserved_mem_from_dart(
|
||||
mem_node, dart_piodma, node_name, piodma_phandle, region[i].paddr, region[i].size);
|
||||
if (ret != 0)
|
||||
goto err;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue