Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6398389ybe; Wed, 18 Sep 2019 02:50:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKjQZYPWVRPYDUEZeT2xl/4wJyjgLlc/qZZli1ze3cD3g1kdtIkNrypacRLDxsZ2l777PI X-Received: by 2002:a50:b6a8:: with SMTP id d37mr1576824ede.63.1568800221389; Wed, 18 Sep 2019 02:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568800221; cv=none; d=google.com; s=arc-20160816; b=rQ2DAgMJwYB+8pKaSZoHfmc2EmN77HAzWhCBqUyXdUzX0Tb/rK8y63X8quKKtZWfLR abHNbMWMVx+98aJVZIaUK9RIdePOd0VCpNpu6OMDM1k8vt8D+0V48Hfr5S58VNDypYJW e+qZXoBC0t//BeRh0zx0V9ArrYcvNZoXSrrnrXEQFyb5r82W6wXdTuDcye+jkjt9rU/x ORzm0+46ggrgJRdooYBMax4MNO/ES/iAIqpBkgy0CPiz9CbBoBAPjB0/yauAEb0+QovW WgQ5m5jx9S7bPz2QJ6CYgdErV0gsuYpYmAYe+Z6wDHE9KPtecOxMUZklvcLf5jzJZKVq CzVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=v8YSQLFy7mi0y7GPIl5MMvWVppKyDodjvZc0MIFH8E8=; b=TVFa4DclCCADSKAydp0o48JPa1oVjwZ8Abwe1oP6uLW+tninNA6LHPAyB8TWRDMAMv WsHz2pBatlLhTfQXYH2aa6/DNkGkk4gGh24og7EeU7F7+5WRPn+S1VZ0blgw4hjQl4IK FkR2CmcQtkKLMQjqKuL2YZH7ucqT3jSW5n7Dtan/pHS1DpHDlcogjoOeiKu9PAS98+db SHLcNb8wOOjmzXdgkVOmKtpsYztOX2TDIHyYfZwnN4xrUYnkoswES+OrJ+1ASNgri5Hi P+hkGOOaLINNMTNW6sb0WSk0Dbtc4JCrLs29N8wMbxgRp8NawKXajb7oLG0aWGlP3eeD PARQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=n8C5E2rW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y17si2732377edt.101.2019.09.18.02.49.58; Wed, 18 Sep 2019 02:50:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=n8C5E2rW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728316AbfIRJoi (ORCPT + 99 others); Wed, 18 Sep 2019 05:44:38 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42522 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbfIRJoi (ORCPT ); Wed, 18 Sep 2019 05:44:38 -0400 Received: by mail-wr1-f65.google.com with SMTP id n14so5268997wrw.9; Wed, 18 Sep 2019 02:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=v8YSQLFy7mi0y7GPIl5MMvWVppKyDodjvZc0MIFH8E8=; b=n8C5E2rWnglaX5nCXksoDHQCq1NAX+PgfC7glCxBe5jC59VjBNbXeK+kNenXeEMkjO luY0AAropdWXhPSA6Gbes7FHMW80iFF1htllfawIr6TqOyTKwh7v5k2evvVXtMyp3Wu/ yBmkEP4vyUAkAfEjvWeEQaIGfAsX+bg5Bvhv3eNOHd2RIB3YK+eBmL9QIWeRYV+rcrPg FUiThL90az14LREiFMF++v0WR06hQkmsOP2fQ9NyZfpPeBQqZWdB6+u1Ns5ytDmWDBnf TzydNmqM1R6CVS4leCy6VR9vQDk2Nx/TsWCS6jBV2GWmjYq/dHZAYkmyYr0iJWSGu4lZ fuuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=v8YSQLFy7mi0y7GPIl5MMvWVppKyDodjvZc0MIFH8E8=; b=OcNSZvO33NrOMBoBy8F30mmqSE4DJzhwpG1xZ0sVNoBn/p6mChMPVR86PC5/GBHqB5 ScSiU0Sg6nxYvpKSNH1Tbt5dmR5ys28IFL7wssQgJvYj8QjrBGw7E00oiJW9wg7uq0w4 spUaJFyy95vLvN8JdaJUPSvfKmdbSHQdNjSrwzZWLRwg/ih5FgjPO41JUQy04INKo0s6 1qwK+WN4FUA4wvkztjfIRuf9t1FeNE1LC1ig5S/xa3r/gVcIIYUtTZyJ9U3QmZQ1W5WI b9wI2Q7w943nBVYa7bNRPhRLV8zDNvg2dWyakksWlYa0Mav+x3QCv4Tsog4Wwcb+ydyR pE0Q== X-Gm-Message-State: APjAAAXuOiZ6SR+KAW1ZsEmqkVD2k2tXcG/8YLkMGQVxKkWrDgoNIX/x GKALngdj0dIf7K8LdozMDZmWHA68REdt0Q== X-Received: by 2002:a5d:6846:: with SMTP id o6mr2122745wrw.73.1568799876364; Wed, 18 Sep 2019 02:44:36 -0700 (PDT) Received: from t1700.criteois.lan ([91.199.242.236]) by smtp.gmail.com with ESMTPSA id t8sm3776341wrx.76.2019.09.18.02.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 02:44:35 -0700 (PDT) From: Erwan Velu X-Google-Original-From: Erwan Velu Cc: Erwan Velu , Jean Delvare , Masahiro Yamada , Michal Marek , Mattias Jacobsson <2pi@mok.nu>, Andy Shevchenko , Mauro Carvalho Chehab , Jens Wiklander , Sumit Garg , Changbin Du , Boris Brezillon , "Robert P. J. Day" , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH 1/3] firmware/dmi_scan: Add dmi_save_release to save releases fields Date: Wed, 18 Sep 2019 11:43:19 +0200 Message-Id: <20190918094323.17515-1-e.velu@criteo.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In DMI type 0, there is several fields that encodes a release. The dmi_save_release() function have the logic to check if the field is valid. If so, it reports the actual value. Signed-off-by: Erwan Velu --- drivers/firmware/dmi_scan.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 35ed56b9c34f..202bd2c69d0f 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -181,6 +181,32 @@ static void __init dmi_save_ident(const struct dmi_header *dm, int slot, dmi_ident[slot] = p; } +static void __init dmi_save_release(const struct dmi_header *dm, int slot, + int index) +{ + const u8 *d; + char *s; + + // If the table doesn't have the field, let's return + if (dmi_ident[slot] || dm->length < index) + return; + + d = (u8 *) dm + index; + + // As per the specification, + // if the system doesn't have the field, the value is FF + if (d[0] == 0xFF) + return; + + s = dmi_alloc(4); + if (!s) + return; + + sprintf(s, "%u", d[0]); + + dmi_ident[slot] = s; +} + static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int index) { -- 2.21.0