From nobody Wed Jan 15 02:26:32 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXqcm5gQPz5klp7; Wed, 15 Jan 2025 02:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXqcm4jf6z3dlZ; Wed, 15 Jan 2025 02:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736907992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1YWYzpAF1QoJeRWRWfI85GQ/8uBg/fHxVZkK3JNxI5M=; b=eUgqLvNpO2va64oxXVBGEs+hYZvM+yO+D+WRP7NoAjQLSePca9e9WmieHD25rkBromYby0 erabZQPpJv/3kE9315tFxXJTPJtkVU5wqH351Q4afKRBNN//F4HZjiowq8cIvvS7gY3TXm gNmODJC1+FtBLJ4IXO2fOawLL6SADv5GjaGHtkrja6e7VBXFQzvGrhOV/A6KE3JEslz6+W 1Tz2QWVlkBqkGlekSk4kqpCZa9CGyOwYHrOW2O6+SGQgSx6vtbR4HbZa/NzdSAaZl8yCyb OgZARy2rKfnTzThNW+LuAjaukF7VC6t6pPEKrvPAfNg5K0JsvXS8rqgoUAK5rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736907992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1YWYzpAF1QoJeRWRWfI85GQ/8uBg/fHxVZkK3JNxI5M=; b=kud0czpS0h+Hn9dccEtuQdASG6RjHb9l1apQIgHRmhSGfZgzP2VWb8Ux9iaznPleAQYLyI ofIxK4vOo84jmlbJgkhdaow4v3H/Ds367QI/gAq7EiYjDw+BgSM610KexORzzj3t8+KkWa lDkUR9Wial0XxrD7pl0bWhOcyJ6Qo3qkpA2uVPik6t9tQ6rFRW/f0ZXEXvXJYbdTQwjqwG pbNNLOCkvoPKXvv06BniFo27vUb8HLQCtkpTZx4B59+iKzL+RkocBuKIFKanqolf67fmCu a12lsUJt1E9YsM3FFHggL5Yq+x+OjrL8/y9VQbW7BFJ7w/kSM0Y1RKvD6VNTqg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736907992; a=rsa-sha256; cv=none; b=P2sQD6tG2eqjyw0nq0R2qi0SQ9Ju997o1UyuHS+4HA+79EDVRF0tDNfKN0QhGaTh3fTcBT gBquigQIRKSDLtnT+Z1WXmgGjLsBZ86b+LS4N96lQ067DmscLhpYtxtQ8ZKCckY0i3IWEM ETVvw7wtdUH634lJt7/YFtALHyEKT6mGecbMY79iaEUT2UZ+vwYVhZRsV1qMh0X71d2rCl iAqJX1Huo7FT4zaUc2aI5pqtqzVnaAu5ASFMf6e2u2eGOCjr9/kfRw2E2W4cOOfUtQi7ol kARc41JX2uqxLQzGoELCqVb/WGMnBqpDtet3xo+fYyZZXsc7j90He5PYoZGWpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YXqcm42lczBxj; Wed, 15 Jan 2025 02:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50F2QWYf028336; Wed, 15 Jan 2025 02:26:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50F2QWvU028333; Wed, 15 Jan 2025 02:26:32 GMT (envelope-from git) Date: Wed, 15 Jan 2025 02:26:32 GMT Message-Id: <202501150226.50F2QWvU028333@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: dea3eef94caf - main - uart: Ingore pl011 historic mistakes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dea3eef94cafb3bb1e5f04bc96b5636ffca92ee7 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dea3eef94cafb3bb1e5f04bc96b5636ffca92ee7 commit dea3eef94cafb3bb1e5f04bc96b5636ffca92ee7 Author: Warner Losh AuthorDate: 2025-01-15 02:17:46 +0000 Commit: Warner Losh CommitDate: 2025-01-15 02:24:35 +0000 uart: Ingore pl011 historic mistakes Some veresions of EDK-II and QEMU reported the wrong values for the register shift and the region I/O size. Detect those and set it to the correct values. In general, anything other than a shift of 2 and a regio width of 4 (bytes, or 32 bits) is a mistake. However, allow for overrides in the future by only overriding the buggy values. Otherwise, we will fail to boot. PR: 282936 Sponsored by: Netflix Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D47946 --- sys/dev/uart/uart_dev_pl011.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/dev/uart/uart_dev_pl011.c b/sys/dev/uart/uart_dev_pl011.c index 4f946f7c5f36..e7a2ff7a85f1 100644 --- a/sys/dev/uart/uart_dev_pl011.c +++ b/sys/dev/uart/uart_dev_pl011.c @@ -172,6 +172,27 @@ static int uart_pl011_probe(struct uart_bas *bas) { + /* + * Versions of QEMU before 41f7b58b634e (8.3) reported bogus values for + * this tabel. The PL011 IP is always 32-bits wide and should be shifted + * 2 to match the 4-byte size of the data. QEMU reported these values + * incorrectly before that. + * https://github.com/qemu/qemu/commit/41f7b58b634ec3b60ae874375d2bbb61d790971e + * + * In additon, other hardware vendors also reported this value + * incorrectly. It's not tied to what the ACPI device node is, but was a + * misunderstanding coupled with a Linux driver that didn't need the + * right values. Quirks used to be used to ignore the bad values, now we + * detect the historic mistake and override (to allow for a future where + * we may need to override these values). + * + * PL011 Docs: https://developer.arm.com/documentation/ddi0183/latest/ + */ + if (bas->regshft == 0 || bas->regiowidth == 1) { + bas->regshft = 2; + bas->regiowidth = 4; + } + return (0); } @@ -356,7 +377,8 @@ static struct uart_class uart_pl011_class = { .uc_ops = &uart_pl011_ops, .uc_range = 0x48, .uc_rclk = 0, - .uc_rshift = 2 + .uc_rshift = 2, + .uc_riowidth = 4, }; UART_CLASS(uart_pl011_class);