Skip to content

Commit 2abf2b1

Browse files
committed
kboot: Forward DCP firmware versions into the DT
Signed-off-by: Hector Martin <[email protected]>
1 parent e1b2c45 commit 2abf2b1

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

src/kboot.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,37 @@ static struct disp_mapping dcpext_reserved_regions_t600x[MAX_DCPEXT][2] = {
12681268

12691269
#define ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
12701270

1271+
static int dt_set_dcp_firmware(const char *alias)
1272+
{
1273+
const char *path = fdt_get_alias(dt, alias);
1274+
1275+
if (!path)
1276+
return 0;
1277+
1278+
int node = fdt_path_offset(dt, path);
1279+
if (node < 0)
1280+
return 0;
1281+
1282+
if (firmware_set_fdt(dt, node, "apple,firmware-version", &os_firmware) < 0)
1283+
bail("FDT: Could not set apple,firmware-version for %s\n", path);
1284+
1285+
const struct fw_version_info *compat;
1286+
1287+
switch (os_firmware.version) {
1288+
case V12_4:
1289+
compat = &fw_versions[V12_3];
1290+
break;
1291+
default:
1292+
compat = &os_firmware;
1293+
break;
1294+
}
1295+
1296+
if (firmware_set_fdt(dt, node, "apple,firmware-compat", compat) < 0)
1297+
bail("FDT: Could not set apple,firmware-compat for %s\n", path);
1298+
1299+
return 0;
1300+
}
1301+
12711302
static int dt_set_display(void)
12721303
{
12731304
/* lock dart-disp0 to prevent old software from resetting it */
@@ -1281,6 +1312,11 @@ static int dt_set_display(void)
12811312
* they are missing. */
12821313

12831314
int ret = 0;
1315+
1316+
ret = dt_set_dcp_firmware("dcp");
1317+
if (ret)
1318+
return ret;
1319+
12841320
if (!fdt_node_check_compatible(dt, 0, "apple,t8103")) {
12851321
ret = dt_carveout_reserved_regions("dcp", "disp0", "disp0_piodma",
12861322
disp_reserved_regions_t8103,
@@ -1312,6 +1348,9 @@ static int dt_set_display(void)
13121348
char dcpext_alias[16];
13131349

13141350
snprintf(dcpext_alias, sizeof(dcpext_alias), "dcpext%d", n);
1351+
ret = dt_set_dcp_firmware(dcpext_alias);
1352+
if (ret)
1353+
break;
13151354
ret = dt_carveout_reserved_regions(dcpext_alias, NULL, NULL,
13161355
dcpext_reserved_regions_t600x[n],
13171356
ARRAY_SIZE(dcpext_reserved_regions_t600x[n]));

0 commit comments

Comments
 (0)