From nobody Sat Apr 25 16:26:52 2026 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 4g2wFs6nKkz6bm2m for ; Sat, 25 Apr 2026 16:26:57 +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 4g2wFs4GfQz42Sw for ; Sat, 25 Apr 2026 16:26:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777134417; 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=bARfbdABwQlrpgY1dafwCbdnUJS468SxAu2175HmM/rcmP+NO2cSj6wJWWCbFDe7DWm02a k0I/fW75hQURmHy98N6IMkJhk/eGdyLOtuzhsQk5+3JVVlbO6lmiKFsEwTdUSAWp7VRwAH OG2I4LVHcNGi+cPyuSdjL9xwLy3AS8xFBDihwPr7KGRXcKqvf7esgdxw2t4tfjRhyrYQeE ei7gBXCSAapTqYrVQVZNeVEWCkQq6RI41z/Bu8DQUEfEMeN+pCaQurXYxvidYKV2OO2rN/ 8PtCHYQY2Xt3vBMh3CJysTUPQQ+SdPQaAw2qdv3yENBtVzoYyFGEvjpokXmVPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777134417; a=rsa-sha256; cv=none; b=IeuLFQePMDkR0E8bxwQI6T3A3xnfJ8OzqrI+xy8ckyXLDhDdULKI4SwncyUUVVKoAHBmfE td9qdgGTbgbxNheL67j+c0AIiHlkFY1Df93c+PgLApg5O8G6SakLsc3UM05fZ7bm73EByh EOwq/lYCeyFr2geVKR7/WTqOJsDnhLDRgEJV+5ugm1OUpAGdrFY5gJZE7hSQEEaHo+ADPT bMLAtgDdhjSi5cCWaBpVDe6qmvwk3GGJZUatdvZcu+42Y6rrm9LQTKHfvS95Vkffc6KORL q738jDP18nrAzGBApTI3IyBXuIvu/GeW/Wd/YSEkHvz4INYYyLbm5/I2IjdnTQ== 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=1777134417; 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=ggdEZmRl/eDKeQVnbr1DRg9dGDCEtzKDNusIMT5IOoQHAm9m2XOYQoTq84d1QQGzbBAAq1 P1JziV1b4gHA30UniBVem7JxG0GZXvj4T14q2/u68CW5jySPKmltmhrTcOnEXjTkOdMsXF 7ke9PnBCEtTddmFi6hIPJ+DLYm48cgryBTcY2UnPOL7WCqXAPkEdN0F6uhutoyNfrDsbZi vpDL0CWb11O/g/h3T/mJvw6+qjC+v5kV5+OjWsol5ahDci7wCQGxKEuoXnaFtDr5BwVRZV CgqUF1d2ffNAf79GGSZ1MRkt4KlawTqqQ2AivGhCB751oMbFJQ5QvN2yU8OLqQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g2wFs3scRzhm7 for ; Sat, 25 Apr 2026 16:26:57 +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: 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: 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); }