Skip to content

Commit 7e3e9ac

Browse files
hoshinolinamarcan
authored andcommitted
isp, kboot: Misc changes for t8112
Probably doesn't do anything... Signed-off-by: Asahi Lina <[email protected]>
1 parent 5e2e537 commit 7e3e9ac

3 files changed

Lines changed: 15 additions & 18 deletions

File tree

src/isp.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ int isp_get_heap(u64 *phys, u64 *iova, u64 *size)
2929
return -1;
3030

3131
*phys = heap_phys;
32-
*iova = heap_iova;
32+
*iova = heap_iova | isp_iova_base();
3333
*size = heap_size;
3434
return 0;
3535
}
3636

37-
bool isp_uses_remap(void)
37+
u64 isp_iova_base(void)
3838
{
3939
switch (chip_id) {
4040
case 0x6020 ... 0x6fff:
41-
return true;
41+
return 0x10000000000;
4242
default:
43-
return false;
43+
return 0;
4444
}
4545
}
4646

@@ -104,8 +104,6 @@ int isp_init(void)
104104

105105
pmgr_set_mode(pmgr_base + pmgr_off, PMGR_PS_PWRGATE);
106106

107-
bool remap = false;
108-
109107
/* TODO: confirm versions */
110108
switch (ver_rev) {
111109
case ISP_VER_T8103:
@@ -136,11 +134,9 @@ int isp_init(void)
136134
}
137135
break;
138136
case ISP_VER_T6020:
139-
remap = true;
140-
141137
switch (os_firmware.version) {
142138
case V13_5:
143-
heap_top = 0x10000f00000;
139+
heap_top = 0xf00000;
144140
break;
145141
default:
146142
printf("isp: unsupported firmware\n");
@@ -158,13 +154,14 @@ int isp_init(void)
158154
seg = adt_getprop(adt, isp_node, "segment-ranges", &segments_len);
159155
unsigned int count = segments_len / sizeof(*seg);
160156

161-
if (remap)
162-
heap_iova = seg[count - 1].remap + seg[count - 1].size;
163-
else
164-
heap_iova = seg[count - 1].iova + seg[count - 1].size;
157+
heap_iova = seg[count - 1].iova + seg[count - 1].size;
165158
heap_size = heap_top - heap_iova;
166159
heap_phys = top_of_memory_alloc(heap_size);
167160

161+
printf("isp: Code: 0x%lx..0x%lx (0x%x @ 0x%lx)\n", seg[0].iova, seg[0].iova + seg[0].size,
162+
seg[0].size, seg[0].phys);
163+
printf("isp: Data: 0x%lx..0x%lx (0x%x @ 0x%lx)\n", seg[1].iova, seg[1].iova + seg[1].size,
164+
seg[1].size, seg[1].phys);
168165
printf("isp: Heap: 0x%lx..0x%lx (0x%lx @ 0x%lx)\n", heap_iova, heap_top, heap_size, heap_phys);
169166

170167
isp_initialized = true;

src/isp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
int isp_init(void);
99
int isp_get_heap(u64 *phys, u64 *iova, u64 *size);
10-
bool isp_uses_remap(void);
10+
u64 isp_iova_base(void);
1111

1212
#endif

src/kboot.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ static int dt_vram_reserved_region(const char *dcp_alias, const char *disp_alias
15731573
}
15741574

15751575
static int dt_reserve_asc_firmware(const char *adt_path, const char *adt_path_alt,
1576-
const char *fdt_path, bool remap)
1576+
const char *fdt_path, bool remap, u64 base)
15771577
{
15781578
int ret = 0;
15791579

@@ -1605,7 +1605,7 @@ static int dt_reserve_asc_firmware(const char *adt_path, const char *adt_path_al
16051605
unsigned int num_maps = segments_len / sizeof(*seg);
16061606

16071607
for (unsigned i = 0; i < num_maps; i++) {
1608-
u64 iova = remap ? seg->remap : seg->iova;
1608+
u64 iova = (remap ? seg->remap : seg->iova) | base;
16091609

16101610
char node_name[64];
16111611
snprintf(node_name, sizeof(node_name), "asc-firmware@%lx", seg->phys);
@@ -2225,11 +2225,11 @@ int kboot_prepare_dt(void *fdt)
22252225
return -1;
22262226
if (dt_disable_missing_devs("i2c", "i2c@", 8))
22272227
return -1;
2228-
if (dt_reserve_asc_firmware("/arm-io/sio", NULL, "sio", true))
2228+
if (dt_reserve_asc_firmware("/arm-io/sio", NULL, "sio", true, 0))
22292229
return -1;
22302230
if (dt_set_sio_fwdata())
22312231
return -1;
2232-
if (dt_reserve_asc_firmware("/arm-io/isp", "/arm-io/isp0", "isp", isp_uses_remap()))
2232+
if (dt_reserve_asc_firmware("/arm-io/isp", "/arm-io/isp0", "isp", false, isp_iova_base()))
22332233
return -1;
22342234
if (dt_set_isp_fwdata())
22352235
return -1;

0 commit comments

Comments
 (0)