Skip to content

Commit 8df40df

Browse files
committed
nvme: Support nvme on die 1 for t6002
Signed-off-by: Hector Martin <[email protected]>
1 parent 6256bac commit 8df40df

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/nvme.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ static_assert(sizeof(struct nvme_completion) == 16, "invalid nvme_completion siz
120120
static_assert(sizeof(struct apple_nvmmu_tcb) == 128, "invalid apple_nvmmu_tcb size");
121121

122122
static bool nvme_initialized = false;
123+
static u8 nvme_die;
123124

124125
static asc_dev_t *nvme_asc = NULL;
125126
static rtkit_dev_t *nvme_rtkit = NULL;
@@ -300,6 +301,14 @@ bool nvme_init(void)
300301
return NULL;
301302
}
302303

304+
u32 cg;
305+
if (ADT_GETPROP(adt, node, "clock-gates", &cg) < 0) {
306+
printf("nvme: Error getting NVMe clock-gates\n");
307+
return NULL;
308+
}
309+
nvme_die = FIELD_GET(PMGR_DIE_ID, cg);
310+
printf("nvme: ANS is on die %d\n", nvme_die);
311+
303312
if (adt_get_reg(adt, adt_path, "reg", 3, &nvme_base, NULL) < 0) {
304313
printf("nvme: Error getting NVMe base address.\n");
305314
return NULL;
@@ -401,7 +410,7 @@ bool nvme_init(void)
401410
nvme_poll_syslog();
402411
out_shutdown:
403412
rtkit_sleep(nvme_rtkit);
404-
pmgr_reset(0, "ANS2");
413+
pmgr_reset(nvme_die, "ANS2");
405414
out_rtkit:
406415
rtkit_free(nvme_rtkit);
407416
out_sart:
@@ -443,7 +452,7 @@ void nvme_shutdown(void)
443452

444453
rtkit_sleep(nvme_rtkit);
445454
asc_cpu_stop(nvme_asc);
446-
pmgr_reset(0, "ANS2");
455+
pmgr_reset(nvme_die, "ANS2");
447456
rtkit_free(nvme_rtkit);
448457
sart_free(nvme_sart);
449458
asc_free(nvme_asc);

0 commit comments

Comments
 (0)