From nobody Sat Apr 25 16:26:52 2026 X-Original-To: dev-commits-src-branches@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 4g2wFm43Lxz6blvt for ; Sat, 25 Apr 2026 16:26:52 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g2wFm3TRQz42Jx for ; Sat, 25 Apr 2026 16:26:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777134412; 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=EIE7adLofvwil2S/7OVhquqimuofsR1tXyEgiBfT8J4=; b=ARAAv16Gjs34+H7wZ+3xPers0pBzMl3mIwMJz0QHsRVltQKARIaWG0UBqkotY+jFM9WlV/ M8T/BpPSUa6xxjM677PUHjL7QVO7Ib+vNm10p64eiTgf+ejB/D8GxpQTfna0q2POow90HX Z4n3zR1iNUk9d2DO3Ie2I4IqNRd8WgDi6MRgyFDBT9xAg0YLANyFJwsMOITMH+SvBH7NpW ge4+5D7xcFnq6zZBkgqdSmHAd2Yj8oU+uFJTvC0QXoSXTsmNw5YSRkrE1yg08wbkYWoUGt haQYCrh8B3EvPAHNLpfGFyRKtQBNWnvOQve0tRRYOuHdk7x2IRa9VQFhxYM74w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777134412; a=rsa-sha256; cv=none; b=Duf7Nnl1m7GpZVxm4hEQ30Xv2RKhWpnMDHEd4cC6fPbrg+xyV+526Uf1+cdY0Hc9VBo4yN F3Qvl8x9DiZRXwlRfp67yGvoDUnJyxebJ9hKlWrvardraK8kCSjTyTMNjjrgzqyKKCXpa7 bWu4jnscx/mhNLL7oPowJNNtbS0oxKjg+wvTQCmaBgz8FPE7a5hf1W213Pytpn9RVsHMQP 7/PZ35KwjlDcL9zmFEgZ6d8tZ/ufrYGyYIAwF7z3RDpIhZanAbLiY18Nvk23jE6ESCZ9TB X1Wnyli6+UTysV9kx2mapyAz/kQrIZ0MvGDpfEe6jwX1rH664NxE96xF0lJRsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777134412; 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=EIE7adLofvwil2S/7OVhquqimuofsR1tXyEgiBfT8J4=; b=dSWhb6QX62Q7pDfor1OxIy/k0/Xscefkyxj32sYrsFzxcK4wyxNvkwlo0dUB1EmLzB4Od+ bKN9bAzY3cs+eRcQnmIeGT9FaK/NSzp2ugECWs9hpQdoBL2Eaonm7xtsY36ODFIS0LLDst w2cwx78a5y4SYwxWbP5XsoR6rX3919pMk/dyuPAmNYg/3PjHVXA44ppqnFmufaAcSI4mlV W/oax0PpluWV6N/8hjrHPXjWyuHbX9jMmroO1sqyhBme3MGK/oqqMc2q09Ajh5Mknd+AQO cuwphlJKtk/hfQXmZZGHnBSycpFzocchTvGU93+e9ALotWXWBiwyejLf3Fz54g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g2wFm2nHxzhXD for ; Sat, 25 Apr 2026 16:26:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 442dc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 25 Apr 2026 16:26:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Enji Cooper Subject: git: 464afc5d0e85 - stable/14 - asmc: introduce the concept of generic models List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ngie X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 464afc5d0e855b478f7e8260a0ce8a1f7884806d Auto-Submitted: auto-generated Date: Sat, 25 Apr 2026 16:26:52 +0000 Message-Id: <69eceb4c.442dc.29159d19@gitrepo.freebsd.org> The branch stable/14 has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=464afc5d0e855b478f7e8260a0ce8a1f7884806d commit 464afc5d0e855b478f7e8260a0ce8a1f7884806d Author: Enji Cooper AuthorDate: 2026-02-20 06:37:05 +0000 Commit: Enji Cooper CommitDate: 2026-04-25 16:25:42 +0000 asmc: introduce the concept of generic models Having to enter in each of the models for Apple hardware, recompiling, etc, is tedious. Provide generic models so end-users can leverage some of the capabilities provided by the driver, i.e., common features like minimal fans and lights (if present on the generic model) support. The generic models are as follows: - Macmini - MacBookAir - MacBookPro - MacPro This sort of follows the pattern established by the `applesmc` driver in Linux. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D55395 (cherry picked from commit 3023bb49e115b4149f9fc0683dabde172ecb1336) --- sys/dev/asmc/asmc.c | 80 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c index b6b98b1c8953..56518269be07 100644 --- a/sys/dev/asmc/asmc.c +++ b/sys/dev/asmc/asmc.c @@ -160,6 +160,11 @@ static const struct asmc_model *asmc_match(device_t dev); #define ASMC_LIGHT_FUNCS_DISABLED NULL, NULL, NULL +#define ASMC_TEMPS_FUNCS_DISABLED \ + .smc_temps = {}, \ + .smc_tempnames = {}, \ + .smc_tempdescs = {} \ + static const struct asmc_model asmc_models[] = { { "MacBook1,1", "Apple SMC MacBook Core Duo", @@ -492,8 +497,42 @@ static const struct asmc_model asmc_models[] = { ASMC_FAN_FUNCS2, ASMC_LIGHT_FUNCS, ASMC_MBA7_TEMPS, ASMC_MBA7_TEMPNAMES, ASMC_MBA7_TEMPDESCS + } +}; + +static const struct asmc_model asmc_generic_models[] = { + { + .smc_model = "MacBookAir", + .smc_desc = NULL, + ASMC_SMS_FUNCS_DISABLED, + ASMC_FAN_FUNCS2, + ASMC_LIGHT_FUNCS, + ASMC_TEMPS_FUNCS_DISABLED + }, + { + .smc_model = "MacBookPro", + .smc_desc = NULL, + ASMC_SMS_FUNCS_DISABLED, + ASMC_FAN_FUNCS2, + ASMC_LIGHT_FUNCS, + ASMC_TEMPS_FUNCS_DISABLED + }, + { + .smc_model = "MacPro", + .smc_desc = NULL, + ASMC_SMS_FUNCS_DISABLED, + ASMC_FAN_FUNCS2, + ASMC_LIGHT_FUNCS_DISABLED, + ASMC_TEMPS_FUNCS_DISABLED }, - { NULL, NULL } + { + .smc_model = "Macmini", + .smc_desc = NULL, + ASMC_SMS_FUNCS_DISABLED, + ASMC_FAN_FUNCS2, + ASMC_LIGHT_FUNCS_DISABLED, + ASMC_TEMPS_FUNCS_DISABLED + } }; #undef ASMC_SMS_FUNCS @@ -541,28 +580,41 @@ MODULE_DEPEND(asmc, acpi, 1, 1, 1); static const struct asmc_model * asmc_match(device_t dev) { + const struct asmc_model *model; + char *model_name; int i; - char *model; - model = kern_getenv("smbios.system.product"); - if (model == NULL) - return (NULL); + model = NULL; + + model_name = kern_getenv("smbios.system.product"); + if (model_name == NULL) + goto out; - for (i = 0; asmc_models[i].smc_model; i++) { - if (!strncmp(model, asmc_models[i].smc_model, strlen(model))) { - freeenv(model); - return (&asmc_models[i]); + for (i = 0; i < nitems(asmc_models); i++) { + if (strncmp(model_name, asmc_models[i].smc_model, + strlen(model_name)) == 0) { + model = &asmc_models[i]; + goto out; + } + } + for (i = 0; i < nitems(asmc_generic_models); i++) { + if (strncmp(model_name, asmc_generic_models[i].smc_model, + strlen(asmc_generic_models[i].smc_model)) == 0) { + model = &asmc_generic_models[i]; + goto out; } } - freeenv(model); - return (NULL); +out: + freeenv(model_name); + return (model); } static int asmc_probe(device_t dev) { const struct asmc_model *model; + const char *device_desc; int rv; if (resource_disabled("asmc", 0)) @@ -572,11 +624,13 @@ asmc_probe(device_t dev) return (rv); model = asmc_match(dev); - if (!model) { + if (model == NULL) { device_printf(dev, "model not recognized\n"); return (ENXIO); } - device_set_desc(dev, model->smc_desc); + device_desc = model->smc_desc == NULL ? + model->smc_model : model->smc_desc; + device_set_desc(dev, device_desc); return (rv); }