From 774316355a79277521b8242e13120bf5e8a52c2e Mon Sep 17 00:00:00 2001 From: kettenis Date: Tue, 1 Mar 2022 20:45:27 +0000 Subject: [PATCH] The display controller sits behind a DART. We must make sure we keep that DART enabled with the mappings provided by the firmware. Otherwise the display controller can no longer access the framebuffer and the display goes black. ok jsg@ --- sys/arch/arm64/dev/apldart.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/sys/arch/arm64/dev/apldart.c b/sys/arch/arm64/dev/apldart.c index 949517cb397..5b4f65e7459 100644 --- a/sys/arch/arm64/dev/apldart.c +++ b/sys/arch/arm64/dev/apldart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apldart.c,v 1.11 2022/02/28 15:51:02 kettenis Exp $ */ +/* $OpenBSD: apldart.c,v 1.12 2022/03/01 20:45:27 kettenis Exp $ */ /* * Copyright (c) 2021 Mark Kettenis * @@ -198,7 +198,7 @@ apldart_attach(struct device *parent, struct device *self, void *aux) paddr_t pa; volatile uint64_t *l1; int ntte, nl1, nl2; - uint32_t config, params2; + uint32_t config, params2, tcr, ttbr; int sid, idx; if (faa->fa_nreg < 1) { @@ -222,6 +222,26 @@ apldart_attach(struct device *parent, struct device *self, void *aux) return; } + /* + * Resetting the DART used for the display controller will + * kill the framebuffer. This should be the only DART that + * has translation enabled and a valid translation table + * installed. Skip this DART for now. + */ + for (sid = 0; sid < DART_NUM_STREAMS; sid++) { + tcr = HREAD4(sc, DART_TCR(sid)); + if ((tcr & DART_TCR_TRANSLATE_ENABLE) == 0) + continue; + + for (idx = 0; idx < 4; idx++) { + ttbr = HREAD4(sc, DART_TTBR(sid, idx)); + if (ttbr & DART_TTBR_VALID) { + printf(": translating\n"); + return; + } + } + } + /* * Use bypass mode if supported. This avoids an issue with * the USB3 controllers which need mappings entered into two -- 2.20.1