Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 6 additions & 38 deletions src/kboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1824,9 +1824,12 @@ static int dt_reserve_asc_firmware(const char *adt_path, const char *adt_path_al
return ret;
uint32_t mem_phandle = fdt_get_phandle(dt, mem_node);

ret = dt_device_set_reserved_mem(mem_node, node_name, dev_phandle, iova, seg_size);
if (ret < 0)
return ret;
/* Identity segments are reserved data, not existing device mappings. */
if (iova != seg->phys) {
ret = dt_device_set_reserved_mem(mem_node, node_name, dev_phandle, iova, seg_size);
if (ret < 0)
return ret;
}

ret = dt_device_add_mem_region(fdt_path, mem_phandle, NULL);
if (ret < 0)
Expand All @@ -1843,29 +1846,8 @@ static const char dcpext_aliases[][8] = {
"dcpext4", "dcpext5", "dcpext6", "dcpext7",
};

/*
* Boards whose external DCPs have no working output under Linux. Their
* firmware is still pre-loaded by iBoot, so its memory stays reserved, but the
* nodes keep the "disabled" status from the board DT. On J773g (M4 Mac mini)
* the USB-C DisplayPort path is unused, and both dcpext firmwares crash on
* ~9% of boots right after shmem setup.
*/
static const char *const dcpext_disabled_boards[] = {
"apple,j773g",
};

static bool dt_dcpext_disabled_board(void)
{
for (size_t i = 0; i < ARRAY_SIZE(dcpext_disabled_boards); i++)
if (!fdt_node_check_compatible(dt, 0, dcpext_disabled_boards[i]))
return true;
return false;
}

static int dt_reserve_dcpext_firmware(void)
{
bool keep_disabled = dt_dcpext_disabled_board();

/* reserve asc for all */
for (size_t n = 0; n < ARRAY_SIZE(dcpext_aliases); n++) {
const char *dcpext_alias = dcpext_aliases[n];
Expand All @@ -1890,11 +1872,6 @@ static int dt_reserve_dcpext_firmware(void)
if (ret)
continue;

if (keep_disabled) {
printf("FDT: leaving '%s' disabled on this board\n", dcpext_alias);
continue;
}

// refresh dcpext_node
dcpext_node = fdt_path_offset(dt, dcpext_alias);
if ((dcpext_node < 0) || (fdt_setprop_string(dt, dcpext_node, "status", "okay") < 0))
Expand Down Expand Up @@ -2876,15 +2853,6 @@ int kboot_prepare_dt(void *fdt)
return -1;
if (dt_set_isp_fwdata())
return -1;
/*
* The MTP coprocessor DMAs to its iBoot-provided segments (__OS_LOG in
* DRAM) before it sends the RTKit HELLO, so its DART must map them from
* the first instruction. Its DVAs are the segments' remap addresses,
* which fall in the DART's vm-base window. Boards without an "mtp"
* alias are skipped.
*/
if (dt_reserve_asc_firmware("/arm-io/mtp", NULL, "mtp", true, 0))
return -1;
if (dt_set_pmgr())
return -1;
#ifndef RELEASE
Expand Down
Loading