From nobody Thu Mar 03 14:20:39 2022 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 8B29819E5F10; Thu, 3 Mar 2022 14:20:39 +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 4K8Y6v2tLSz3LKh; Thu, 3 Mar 2022 14:20:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646317239; 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=5QhbcvzRmjW2bQGnyGE9S/fgKbwsZqBbQccp1k5Zezg=; b=mknsIHQnEaLXHOWzugRWAh7s2aVdX60geF9VmquwTTEoL+S1w+RdT+5xGHHmT9E+0GGna+ X1uvsa7LQvQAYSo8XYLSJGh5FgTQPFfk7PpC1i7n3d/ilTEtksZhG6t7ChpgfZ9MLKNGbu XFxCHhD5Q9P05VJOsZbdFDaQtNJl26YhHCIRiJYhnY9y++jb6AvU5RvtZFZpBSgia2oJH8 Q1oiD+66AlYKL/dhcuK4dPuzp8lr1sDZQd7/6YZP4h3fjhPbPBkBR1R6FsTnqKK/Pqh6vR Dh2Wa0s3PKVpnIEhFd8RBtAGf98aq+ZoNJmRFVTlHCFI+gbyrPvpCguA6txBrA== 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 30EC118F4C; Thu, 3 Mar 2022 14:20:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 223EKdeC090654; Thu, 3 Mar 2022 14:20:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 223EKdiq090653; Thu, 3 Mar 2022 14:20:39 GMT (envelope-from git) Date: Thu, 3 Mar 2022 14:20:39 GMT Message-Id: <202203031420.223EKdiq090653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric van Gyzen Subject: git: 4cfd4d54822b - stable/13 - smbios: support getting address from EFI 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: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4cfd4d54822bae9794558c988bb59ca9039e9feb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646317239; 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=5QhbcvzRmjW2bQGnyGE9S/fgKbwsZqBbQccp1k5Zezg=; b=GBWlXBoTsRDTWbDcO9oxQTNOzlwPtmqAw3XVlz2edzpGs3MqCmqub+S95bIj1+MIhELvKo toBVQQIQxE8BZha78IlugTWh2mJOwi9vxMJ+Njmsh85y9qifK3pvvaRyNEhi3k1iTeOvzN N5mLuAy32be356GQxW3YEyL+88cmg5FgnKdmN949aFy/pbnTFUgi1PpH9ovLS6nzslEQKf 38+pEyC+sLmX1ofQ/n4IX7G2wbENXFxFrkWEXAinXinNLaOvDI0XfQct1SyKAj2A11smR5 aqA8VvxOaYT9fDPnyhLrUe8WVyH9u1gl5fDipSX8F2A7UVxbubsoG+8QZ+827Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646317239; a=rsa-sha256; cv=none; b=D85Ok/fAebKsop0WQqUaPxN7846QjAIvDe3TggIuwvxaYWEdd0WB3yOdFboMWwGgg0IzuJ zYJhaPsIW9VDzUd+q0yGVaD1v25vbayJLJRe2g66QPK9udxATCbzU+urWa62vK8rBMH8fG fjzkbEYm++sWkuiSDj/AOIokppQ/9VKraesb/p9t6Gc3khSJ9/SbUcPtYh4HlcvVZd56Sw z3/znY2G8eDwWU2YkBdRTsAohOMPO7hCxi1xKEhnu3d6cdrUqBCZlgc1PsQlgkANidpE+k amrCixA6IDZrDrNYqMSTwrVAgSi6eV4WAyydMSV4iIjTawvezDVOC/NzzQtKFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=4cfd4d54822bae9794558c988bb59ca9039e9feb commit 4cfd4d54822bae9794558c988bb59ca9039e9feb Author: Greg V AuthorDate: 2021-04-07 19:46:29 +0000 Commit: Eric van Gyzen CommitDate: 2022-03-03 14:20:07 +0000 smbios: support getting address from EFI On some systems (e.g. Lenovo ThinkPad X240, Apple MacBookPro12,1) the SMBIOS entry point is not found in the <0xFFFFF space. Follow the SMBIOS spec and use the EFI Configuration Table for locating the entry point on EFI systems. Reviewed by: rpokala, dab MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29276 (cherry picked from commit a29bff7a5216bd5f4a76228788e7eacf235004de) --- sys/amd64/conf/MINIMAL | 1 - sys/amd64/conf/NOTES | 2 +- sys/amd64/include/efi.h | 1 + sys/arm64/include/efi.h | 2 ++ sys/dev/smbios/smbios.c | 22 +++++++++++++++++----- sys/sys/efi.h | 8 ++++---- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index 030fb171c43a..a55a63d6b3ad 100644 --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -93,7 +93,6 @@ device cpufreq # Bus support. device acpi -device smbios options IOMMU device pci diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index bf75a0eb4184..229a63bd23b9 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -516,7 +516,7 @@ device xenpci # Xen HVM Hypervisor services driver # # ipmi: Intelligent Platform Management Interface # pbio: Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724) -# smbios: DMI/SMBIOS entry point +# smbios: DMI/SMBIOS entry point (requires EFIRT option) # vpd: Vital Product Data kernel interface # asmc: Apple System Management Controller # si: Specialix International SI/XIO or SX intelligent serial card diff --git a/sys/amd64/include/efi.h b/sys/amd64/include/efi.h index a0037084d3d4..b7bda5388c21 100644 --- a/sys/amd64/include/efi.h +++ b/sys/amd64/include/efi.h @@ -46,6 +46,7 @@ #ifdef _KERNEL #include +#define ARCH_MAY_USE_EFI #define EFI_TIME_LOCK() mtx_lock(&atrtc_time_lock) #define EFI_TIME_UNLOCK() mtx_unlock(&atrtc_time_lock) diff --git a/sys/arm64/include/efi.h b/sys/arm64/include/efi.h index a8fddfad8d0f..6db16e5b8291 100644 --- a/sys/arm64/include/efi.h +++ b/sys/arm64/include/efi.h @@ -36,6 +36,8 @@ #define EFIABI_ATTR #ifdef _KERNEL +#define ARCH_MAY_USE_EFI + #define EFI_TIME_LOCK() #define EFI_TIME_UNLOCK() #define EFI_TIME_OWNED() diff --git a/sys/dev/smbios/smbios.c b/sys/dev/smbios/smbios.c index 10589ed8d49d..f3519634e1a4 100644 --- a/sys/dev/smbios/smbios.c +++ b/sys/dev/smbios/smbios.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,20 +80,28 @@ static int smbios_cksum (struct smbios_eps *); static void smbios_identify (driver_t *driver, device_t parent) { +#ifdef ARCH_MAY_USE_EFI + struct uuid efi_smbios = EFI_TABLE_SMBIOS; + void *addr_efi; +#endif struct smbios_eps *eps; device_t child; - vm_paddr_t addr; + vm_paddr_t addr = 0; int length; int rid; if (!device_is_alive(parent)) return; +#ifdef ARCH_MAY_USE_EFI + if (!efi_get_table(&efi_smbios, &addr_efi)) + addr = (vm_paddr_t)addr_efi; +#endif + #if defined(__amd64__) || defined(__i386__) - addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN, - SMBIOS_STEP, SMBIOS_OFF); -#else - addr = 0; + if (addr == 0) + addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN, + SMBIOS_STEP, SMBIOS_OFF); #endif if (addr != 0) { @@ -242,6 +251,9 @@ static driver_t smbios_driver = { }; DRIVER_MODULE(smbios, nexus, smbios_driver, smbios_devclass, smbios_modevent, 0); +#ifdef ARCH_MAY_USE_EFI +MODULE_DEPEND(smbios, efirt, 1, 1, 1); +#endif MODULE_VERSION(smbios, 1); static int diff --git a/sys/sys/efi.h b/sys/sys/efi.h index 220509853cb2..c71a3f23b8e8 100644 --- a/sys/sys/efi.h +++ b/sys/sys/efi.h @@ -36,10 +36,10 @@ #define EFI_PAGE_SIZE (1 << EFI_PAGE_SHIFT) #define EFI_PAGE_MASK (EFI_PAGE_SIZE - 1) -#define EFI_TABLE_ACPI20 \ - {0x8868e871,0xe4f1,0x11d3,0xbc,0x22,{0x00,0x80,0xc7,0x3c,0x88,0x81}} -#define EFI_TABLE_SAL \ - {0xeb9d2d32,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}} +#define EFI_TABLE_SMBIOS \ + {0xeb9d2d31,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}} +#define EFI_TABLE_SMBIOS3 \ + {0xf2fd1544,0x9794,0x4a2c,0x99,0x2e,{0xe5,0xbb,0xcf,0x20,0xe3,0x94}} enum efi_reset { EFI_RESET_COLD = 0,