Skip to content

Commit

Permalink
nvme: t6022: Derive die from nvme_base address
Browse files Browse the repository at this point in the history
For some reason the ans node for t602x devices has an empty
"clock-gates" property. Use the MMIO address instead to determine on
which die the device is.

Fixes: 34f49a5 ("nvme: assume die 0 if clock-gates not set")
Signed-off-by: Janne Grunau <[email protected]>
  • Loading branch information
jannau committed Dec 11, 2023
1 parent 7112506 commit ddea8ba
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,19 +302,19 @@ bool nvme_init(void)
return NULL;
}

if (adt_get_reg(adt, adt_path, "reg", 3, &nvme_base, NULL) < 0) {
printf("nvme: Error getting NVMe base address.\n");
return NULL;
}
u32 cg;
if (ADT_GETPROP(adt, node, "clock-gates", &cg) < 0) {
printf("nvme: clock-gates not set\n");
cg = 0;
nvme_die = (nvme_base >> 37) & 3;
} else {
nvme_die = FIELD_GET(PMGR_DIE_ID, cg);
}
nvme_die = FIELD_GET(PMGR_DIE_ID, cg);
printf("nvme: ANS is on die %d\n", nvme_die);

if (adt_get_reg(adt, adt_path, "reg", 3, &nvme_base, NULL) < 0) {
printf("nvme: Error getting NVMe base address.\n");
return NULL;
}

if (!alloc_queue(&adminq)) {
printf("nvme: Error allocating admin queue\n");
return NULL;
Expand Down

0 comments on commit ddea8ba

Please sign in to comment.