Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 8 additions & 9 deletions src/dapf.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,15 +844,14 @@ int dapf_init_fdt(const void *fdt)
j614s_isp_ready = false;
dapf_nprogrammed = dapf_nfailed = 0;
if (chip_id == T8132) {
/* M4 laptops whose trees state the same DAPF handoff contract as the J713. */
static const char *const boards[] = {"apple,j713", "apple,j604", NULL};
bool known = false;

for (const char *const *board = boards; fdt && *board; board++)
known |= !fdt_node_check_compatible(fdt, 0, *board);
if (!known)
return 0; /* No other M4 board's power/DAPF contract is qualified. */
return dapf_init_j713((void *)fdt);
/*
* The tree states the handoff contract itself: /chosen's
* linux-enablement-mac,dapf-handoff names the consumers whose filters
* are handed off, and dapf_init_j713() preserves the firmware state
* of a tree that names none. No board list: a T8132 Mac whose tree
* carries the property gets the handoff with no change here.
*/
return fdt ? dapf_init_j713((void *)fdt) : 0;
}

int ret = 0;
Expand Down
7 changes: 5 additions & 2 deletions tests/python/test_j713_dapf_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ def block(source, marker):
if(!strcmp(key,"linux-enablement-mac,dapf-halted-handoff"))return (halted_requested&(1U<<(n-4)))?0:-1;
return ((!strcmp(key,"linux-enablement-mac,dapf-handoff")?requested:power_requested)&(1U<<(n-4)))?0:-1;
}
static int fdt_node_check_compatible(const void *dt,int node,const char *compat)
{(void)dt;(void)node;(void)compat;return 0;}
'''

TESTS = r'''
Expand Down Expand Up @@ -200,6 +198,10 @@ def block(source, marker):
reset();halted_requested=2;assert(dapf_init_j713((void *)1)==1);
assert(asc_inits==1&&!asc_frees);preserved();
reset();assert(dapf_init_j713((void *)1)==1);assert(!asc_inits);preserved();
/* The tree, not a board list, decides: every T8132 tree reaches dapf_init_j713(). */
reset();assert(dapf_init_fdt((void *)1)==1);
reset();handoff=false;assert(!dapf_init_fdt((void *)1));preserved();
reset();assert(!dapf_init_fdt(NULL));preserved();
/* The central T8132 branch is the only change to the legacy flow. */
reset();chip_id=0x8110;dart_gates=true;assert(!dapf_init("/arm-io/dart-aop",1));
assert(filter_writes==5*(nodes[0].config_len/52)&&dart_enables==1&&disables==1);
Expand Down Expand Up @@ -253,6 +255,7 @@ def run(text, negative=False, label="production"):
("inactive consumer", 'if (powered <= 0)', 'if (powered <= 0 && false)'),
("halted check", "bool running = !asc || asc_cpu_running(asc);",
"bool running = !asc || (asc_cpu_running(asc) && false);"),
("tree decides", "return fdt ? dapf_init_j713((void *)fdt) : 0;", "return 0;"),
]
for title, old, new in controls:
bad = harness.replace(old, new, 1)
Expand Down
Loading