summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2022-03-01 20:45:28 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2022-03-01 20:45:28 +0000
commit45f0870f5b3e3d4f4a63e8a2c48b7fe82aa189bc (patch)
tree849051e24ba505d1408d96571e7053594ede6c2c
parentb97b78cd452582999868d8e05b2865483b6f3291 (diff)
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@
-rw-r--r--sys/arch/arm64/dev/apldart.c24
1 files 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 <kettenis@openbsd.org>
*
@@ -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) {
@@ -223,6 +223,26 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
}
/*
+ * 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
* IOMMUs, which is somewhat difficult to implement with our