diff --git a/src/dapf.c b/src/dapf.c index dd7a0afff..dd4617819 100644 --- a/src/dapf.c +++ b/src/dapf.c @@ -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; diff --git a/tests/python/test_j713_dapf_instance.py b/tests/python/test_j713_dapf_instance.py index 1b5d4fb02..1ba6d47ee 100644 --- a/tests/python/test_j713_dapf_instance.py +++ b/tests/python/test_j713_dapf_instance.py @@ -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''' @@ -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); @@ -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)