From nobody Thu Jun 29 14:35:32 2023 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 4QsLb84JP2z4jrmk; Thu, 29 Jun 2023 14:35: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QsLb83frLz3l4x; Thu, 29 Jun 2023 14:35:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688049332; 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=a3xqx99XPYlX0oWzuyt+fhttloo9YxrTcrPCRCNCVsU=; b=n5YiCI/09d3kDfqz/X6+Y0OlLMR7QXklGqwF/oxecZMXGZpYO4BUieB2SSMtnWP3/Xne66 AghKr76Qgfv/ie8RJTyKrTaQF0BTX0PJrYnHhniC2U4Fptu1XRNX1h6sbWb+7Erlm5J2nI gWkVFE7lc4EvEqJTtLVV94iOHsvWCqGDuDv5JVbuOGeH8yZtFkxD9MHdE3Br4w2lC23q3z NQe76UatyKRuwW2vzI2FDIddLsYZCJjK9LzF+MeaitsZWvOkJ5J0eSLulARTbTq51S8Rex RPgO/lc/hKSmBOHehShTCXuITKQnDPOWgZYhAgKgi4D0Y3XGjglfdN/7OaJe+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688049332; 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=a3xqx99XPYlX0oWzuyt+fhttloo9YxrTcrPCRCNCVsU=; b=TIUcIq2lafKuA+aJdiiaHUazEwgBPYZq7mGQ30imYvhDRLJkyD/NHNOQ8aRQOY/gONJYqd xMmxnsNXyLZCqIP9QmfN0GJgyMfeANODVLpis2Y8RjKeCJ39wEXyH79T9qzXTdHWIB6PtH d9kAt+ZdkAknF0fZPo9vn3KlRjEL5CSxEgP/jXu67zYZVfjMWNnYmIuUoGp0Gf4hb7DLuL 434EGxSL+VO/cNqzliLlnoJbookhHVOyxDn2Jjx7wZiKVaHS8go7jwoVAMpPdQ4kAmiP57 EF3cR1Xm/1pZwl/+yNN6wTWH5QjG8kVh/FI5hHRhvMQKzTXoLw6sND4nWsMS9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688049332; a=rsa-sha256; cv=none; b=XxNf2vidriWCGTJapOb+mQ9064Xi+WfV4kgtiWn1840DEpNa5SXsKkmIGRkqZ1pG3TfjHg 2Hz7QVV3SpcVPSRn2BZamYqk9KsxihM5/NIhHEwtTX8NpFz+oGSVim/zQbP7/d+WPSR2Nc AWdSXJDDAdoFG9/PuEHUnc/NxulEz656AFAXuoYBdeIQzvHfZtaZuX89uV7f0NYYr7HYEV GuO81opZ3GeA929Szvy/CAWwKCsloeW9/SUg8Pk/hkZ9cEhGzhKJGKKxMiBVV/YgvBAxK4 ce8B2jLbpnOlfQ4ccAzh+lK3Ii8MDrLRiUYkIfv1Qiv/TEA5u5ELkhOLkQqqaw== 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 4QsLb82knszKnf; Thu, 29 Jun 2023 14:35:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 35TEZWIv003498; Thu, 29 Jun 2023 14:35:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 35TEZWod003497; Thu, 29 Jun 2023 14:35:32 GMT (envelope-from git) Date: Thu, 29 Jun 2023 14:35:32 GMT Message-Id: <202306291435.35TEZWod003497@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: 319d2bf407b3 - main - atkbc: Better test for old chromebooks 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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: 319d2bf407b3762da6f1c67ffe8dce2fee587aaf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=319d2bf407b3762da6f1c67ffe8dce2fee587aaf commit 319d2bf407b3762da6f1c67ffe8dce2fee587aaf Author: Warner Losh AuthorDate: 2023-06-29 14:24:55 +0000 Commit: Warner Losh CommitDate: 2023-06-29 14:34:47 +0000 atkbc: Better test for old chromebooks Older Chromebooks have issues in their embedded controller (EC) firmware which need working around in atkbd and atkbdc. On these systems, rather than use a standard EC, Google used their own arm-based EC. For a while, its firmware incorrectly implemented the i8042, requiring workaroundsd in the driver. Implement a heuristic recommended by MrChromebox to detect them: If the bios.version starts with Google_, or the maker is either Google or GOOGLE, assume that it's a chromebook with the affected bios. While this isn't strictly true, the number of updated systems without the bug is very small and this will exclude all the non-Google coreboot user that use a standard EC. There's no simple way to test the hardware to see if it's implemented with the buggy EC. Sponsored by: Netflix Reviewed by: jon@thesoo.org, MrChromebox Differential Revision: https://reviews.freebsd.org/D40789 --- UPDATING | 6 ++++++ sys/dev/atkbdc/atkbdc.c | 40 +++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/UPDATING b/UPDATING index 002e30ce2835..3a6255bc6112 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20230629: + The heuristic for detecting old chromebooks with an EC bug that requires + atkbdc driver workarounds has changed. There should be no functional + change, but if your old chromebook's keyboard stops working, please + file a PR and assign it to imp. + 20230623: OpenSSL has been updated to version 3.0, including changes throughout the base system. It is important to rebuild third-party software diff --git a/sys/dev/atkbdc/atkbdc.c b/sys/dev/atkbdc/atkbdc.c index 9a8ab3397706..aa233972335e 100644 --- a/sys/dev/atkbdc/atkbdc.c +++ b/sys/dev/atkbdc/atkbdc.c @@ -109,21 +109,37 @@ struct atkbdc_quirks { const char *bios_vendor; const char *maker; const char *product; + const char *version; int quirk; }; +/* Old chromebooks running coreboot with i8042 emulation quirks */ +#define CHROMEBOOK_WORKAROUND \ + (KBDC_QUIRK_KEEP_ACTIVATED | KBDC_QUIRK_IGNORE_PROBE_RESULT | \ + KBDC_QUIRK_RESET_AFTER_PROBE | KBDC_QUIRK_SETLEDS_ON_INIT) + static struct atkbdc_quirks quirks[] = { - {"coreboot", "System76", NULL, 0}, - {"coreboot", "Purism", NULL, 0}, - {"coreboot", NULL, NULL, - KBDC_QUIRK_KEEP_ACTIVATED | KBDC_QUIRK_IGNORE_PROBE_RESULT | - KBDC_QUIRK_RESET_AFTER_PROBE | KBDC_QUIRK_SETLEDS_ON_INIT}, + /* + * Older chromebooks running coreboot have an EC that imperfectly emulates + * i8042 w/o fixes to its firmware. Since we can't probe for the problem, + * include all chromebooks by matching 'Google_' in the bios version string + * or a maker of either 'Google' or 'GOOGLE'. This is imperfect, but catches + * all chromebooks while omitting non-Google systems from System76 and + * Purism. + */ + {"coreboot", NULL, NULL, "Google_", CHROMEBOOK_WORKAROUND}, + {"coreboot", "GOOGLE", NULL, NULL, CHROMEBOOK_WORKAROUND}, + {"coreboot", "Google", NULL, NULL, CHROMEBOOK_WORKAROUND}, /* KBDC hangs on Lenovo X120e and X121e after disabling AUX MUX */ - {NULL, "LENOVO", NULL, KBDC_QUIRK_DISABLE_MUX_PROBE}, + {NULL, "LENOVO", NULL, NULL, KBDC_QUIRK_DISABLE_MUX_PROBE}, }; -#define QUIRK_STR_MATCH(s1, s2) (s1 == NULL || \ - (s2 != NULL && !strcmp(s1, s2))) +#define QUIRK_STR_EQUAL(s1, s2) \ + (s1 == NULL || \ + (s2 != NULL && strcmp(s1, s2) == 0)) +#define QUIRK_STR_MATCH(s1, s2) \ + (s1 == NULL || \ + (s2 != NULL && strncmp(s1, s2, strlen(s1)) == 0)) static int atkbdc_getquirks(void) @@ -132,11 +148,13 @@ atkbdc_getquirks(void) char *bios_vendor = kern_getenv("smbios.bios.vendor"); char *maker = kern_getenv("smbios.system.maker"); char *product = kern_getenv("smbios.system.product"); + char *version = kern_getenv("smbios.bios.version"); for (i = 0; i < nitems(quirks); i++) - if (QUIRK_STR_MATCH(quirks[i].bios_vendor, bios_vendor) && - QUIRK_STR_MATCH(quirks[i].maker, maker) && - QUIRK_STR_MATCH(quirks[i].product, product)) + if (QUIRK_STR_EQUAL(quirks[i].bios_vendor, bios_vendor) && + QUIRK_STR_EQUAL(quirks[i].maker, maker) && + QUIRK_STR_EQUAL(quirks[i].product, product) && + QUIRK_STR_MATCH(quirks[i].version, version)) return (quirks[i].quirk); return (0);