isp, kboot: Misc changes for t8112

Probably doesn't do anything...

Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
Asahi Lina 2023-09-30 18:51:17 +09:00 committed by Hector Martin
parent 5e2e537506
commit 7e3e9ac301
3 changed files with 15 additions and 18 deletions

View file

@ -29,18 +29,18 @@ int isp_get_heap(u64 *phys, u64 *iova, u64 *size)
return -1;
*phys = heap_phys;
*iova = heap_iova;
*iova = heap_iova | isp_iova_base();
*size = heap_size;
return 0;
}
bool isp_uses_remap(void)
u64 isp_iova_base(void)
{
switch (chip_id) {
case 0x6020 ... 0x6fff:
return true;
return 0x10000000000;
default:
return false;
return 0;
}
}
@ -104,8 +104,6 @@ int isp_init(void)
pmgr_set_mode(pmgr_base + pmgr_off, PMGR_PS_PWRGATE);
bool remap = false;
/* TODO: confirm versions */
switch (ver_rev) {
case ISP_VER_T8103:
@ -136,11 +134,9 @@ int isp_init(void)
}
break;
case ISP_VER_T6020:
remap = true;
switch (os_firmware.version) {
case V13_5:
heap_top = 0x10000f00000;
heap_top = 0xf00000;
break;
default:
printf("isp: unsupported firmware\n");
@ -158,13 +154,14 @@ int isp_init(void)
seg = adt_getprop(adt, isp_node, "segment-ranges", &segments_len);
unsigned int count = segments_len / sizeof(*seg);
if (remap)
heap_iova = seg[count - 1].remap + seg[count - 1].size;
else
heap_iova = seg[count - 1].iova + seg[count - 1].size;
heap_iova = seg[count - 1].iova + seg[count - 1].size;
heap_size = heap_top - heap_iova;
heap_phys = top_of_memory_alloc(heap_size);
printf("isp: Code: 0x%lx..0x%lx (0x%x @ 0x%lx)\n", seg[0].iova, seg[0].iova + seg[0].size,
seg[0].size, seg[0].phys);
printf("isp: Data: 0x%lx..0x%lx (0x%x @ 0x%lx)\n", seg[1].iova, seg[1].iova + seg[1].size,
seg[1].size, seg[1].phys);
printf("isp: Heap: 0x%lx..0x%lx (0x%lx @ 0x%lx)\n", heap_iova, heap_top, heap_size, heap_phys);
isp_initialized = true;

View file

@ -7,6 +7,6 @@
int isp_init(void);
int isp_get_heap(u64 *phys, u64 *iova, u64 *size);
bool isp_uses_remap(void);
u64 isp_iova_base(void);
#endif

View file

@ -1573,7 +1573,7 @@ static int dt_vram_reserved_region(const char *dcp_alias, const char *disp_alias
}
static int dt_reserve_asc_firmware(const char *adt_path, const char *adt_path_alt,
const char *fdt_path, bool remap)
const char *fdt_path, bool remap, u64 base)
{
int ret = 0;
@ -1605,7 +1605,7 @@ static int dt_reserve_asc_firmware(const char *adt_path, const char *adt_path_al
unsigned int num_maps = segments_len / sizeof(*seg);
for (unsigned i = 0; i < num_maps; i++) {
u64 iova = remap ? seg->remap : seg->iova;
u64 iova = (remap ? seg->remap : seg->iova) | base;
char node_name[64];
snprintf(node_name, sizeof(node_name), "asc-firmware@%lx", seg->phys);
@ -2225,11 +2225,11 @@ int kboot_prepare_dt(void *fdt)
return -1;
if (dt_disable_missing_devs("i2c", "i2c@", 8))
return -1;
if (dt_reserve_asc_firmware("/arm-io/sio", NULL, "sio", true))
if (dt_reserve_asc_firmware("/arm-io/sio", NULL, "sio", true, 0))
return -1;
if (dt_set_sio_fwdata())
return -1;
if (dt_reserve_asc_firmware("/arm-io/isp", "/arm-io/isp0", "isp", isp_uses_remap()))
if (dt_reserve_asc_firmware("/arm-io/isp", "/arm-io/isp0", "isp", false, isp_iova_base()))
return -1;
if (dt_set_isp_fwdata())
return -1;