Page MenuHomeFreeBSD

smbios: expose useful DMI information as sysctl and dmesg
AbandonedPublic

Authored by val_packett.cool on Mar 15 2021, 9:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Feb 7, 8:22 PM
Unknown Object (File)
Jan 14 2024, 10:58 AM
Unknown Object (File)
Dec 29 2023, 1:03 AM
Unknown Object (File)
Dec 28 2023, 3:48 AM
Unknown Object (File)
Dec 20 2023, 4:27 AM
Unknown Object (File)
Nov 25 2023, 7:02 AM
Unknown Object (File)
Nov 23 2023, 9:10 PM
Unknown Object (File)
Nov 23 2023, 8:06 PM
Subscribers
None

Details

Reviewers
allanjude
rpokala
Group Reviewers
Contributor Reviews (src)
Summary

The main motivation for this is to allow libinput to apply quirks to input devices based on DMI information (namely laptop models).

Previously, this information was only accessible via tools like dmidecode that dig in /dev/mem, which obviously requires root access. Linux exposes this info in the /sys filesystem with permissions available to programs running as regular users, so we should allow similar access.

Also, we can print a couple lines to make dmesgs include laptop/mainboard models and firmware revisions, which can be quite useful for troubleshooting.

Test Plan

kldload smbios and then sysctl hw.dmi should report something along the lines of:

hw.dmi.sys_vendor: ASUS
hw.dmi.product_version: System Version
hw.dmi.product_name: System Product Name
hw.dmi.product_family: To be filled by O.E.M.
hw.dmi.chassis_version: Default string
hw.dmi.chassis_vendor: Default string
hw.dmi.chassis_type: 3
hw.dmi.chassis_asset_tag: Default string
hw.dmi.board_version: Rev X.0x
hw.dmi.board_vendor: ASUSTeK COMPUTER INC.
hw.dmi.board_name: ROG STRIX B550-E GAMING
hw.dmi.board_asset_tag: Default string
hw.dmi.bios_version: 1804
hw.dmi.bios_vendor: American Megatrends Inc.
hw.dmi.bios_date: 02/02/2021
hw.dmi.sys_vendor: Google
hw.dmi.product_version: 1.0
hw.dmi.product_name: Eve
hw.dmi.product_family: Google_Eve
hw.dmi.chassis_version:
hw.dmi.chassis_vendor: Google
hw.dmi.chassis_type: 31
hw.dmi.chassis_asset_tag:
hw.dmi.board_version: 1.0
hw.dmi.board_vendor: Google
hw.dmi.board_name: Eve
hw.dmi.board_asset_tag:
hw.dmi.bios_version: DankCore
hw.dmi.bios_vendor: coreboot
hw.dmi.bios_date: 06/19/2020
hw.dmi.sys_vendor: Apple Inc.
hw.dmi.product_version: 1.0
hw.dmi.product_name: MacBookPro12,1
hw.dmi.product_family: MacBook Pro
hw.dmi.chassis_version: Mac-E43C1C25D4880AD6
hw.dmi.chassis_vendor: Apple Inc.
hw.dmi.chassis_type: 9
hw.dmi.chassis_asset_tag:  
hw.dmi.board_version: MacBookPro12,1
hw.dmi.board_vendor: Apple Inc.
hw.dmi.board_name: Mac-E43C1C25D4880AD6
hw.dmi.board_asset_tag:  
hw.dmi.bios_version: 426.0.0.0.0
hw.dmi.bios_vendor: Apple Inc.
hw.dmi.bios_date: 12/17/2020
hw.dmi.sys_vendor: LENOVO
hw.dmi.product_version: ThinkPad X240
hw.dmi.product_name: 20AMX50300
hw.dmi.product_family: ThinkPad X240
hw.dmi.chassis_version: Not Available
hw.dmi.chassis_vendor: LENOVO
hw.dmi.chassis_type: 10
hw.dmi.chassis_asset_tag: No Asset Information
hw.dmi.board_version: 0B98401 PRO
hw.dmi.board_vendor: LENOVO
hw.dmi.board_name: 20AMX50300
hw.dmi.board_asset_tag: Not Available
hw.dmi.bios_version: GIET90WW (2.40 )
hw.dmi.bios_vendor: LENOVO
hw.dmi.bios_date: 09/14/2017

and dmesg

[91] smbios0: <System Management BIOS> at iomem 0x8afad000-0x8afad01e
[91] smbios0: Version: 2.7
[91] smbios0: Firmware: 426.0.0.0.0 (12/17/2020) Apple Inc.
[91] smbios0: Board: Apple Inc. Mac-E43C1C25D4880AD6 MacBookPro12,1

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Most of that info is already available through kenv(1) and/or kenv(2):

[threepio:~] rpokala% kenv | grep smbios
hint.smbios.0.mem="0xf05b0"
smbios.bios.reldate="11/22/2019"
smbios.bios.vendor="American Megatrends Inc."
smbios.bios.version="2.1"
smbios.chassis.maker="Supermicro"
smbios.chassis.serial="0123456789"
smbios.chassis.tag="To Be Filled By O.E.M."
smbios.chassis.type="Main Server Chassis"
smbios.chassis.version="0123456789"
smbios.memory.enabled="33554432"
smbios.planar.location="To be filled by O.E.M."
smbios.planar.maker="Supermicro"
smbios.planar.product="X10SDV-TLN4F"
smbios.planar.serial="ZM15AS030025"
smbios.planar.tag="To be filled by O.E.M."
smbios.planar.version="1.02"
smbios.socket.enabled="1"
smbios.socket.populated="1"
smbios.system.family="To be filled by O.E.M."
smbios.system.maker="Supermicro"
smbios.system.product="Super Server"
smbios.system.serial="0123456789"
smbios.system.sku="To be filled by O.E.M."
smbios.system.uuid="00000000-0000-0000-0000-0cc47a7c0a92"
smbios.system.version="0123456789"
smbios.version="2.7"

Most of that info is already available through kenv(1) and/or kenv(2):

Oh! I remember I've seen it somewhere.. *facepalm*

I guess this is not really necessary then.

(btw it's maybe not great that serial numbers are exposed to any unprivileged user there, Linux by default only gives root permission to view the serials…)