[Concept,00/25] Selection of devicetree using CHIDs

Message ID 20250903133639.3235920-1-sjg@u-boot.org
Headers
Series Selection of devicetree using CHIDs |

Message

Simon Glass Sept. 3, 2025, 1:36 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

This series implements support for Microsoft's Computer Hardware
Identifier (CHID) specification in U-Boot. CHIDs provide a standardised
way to identify hardware configurations using SMBIOS data, enabling
automatic selection of appropriate device tree overlays and drivers when
the firmware itself lacks support for devicetree.

The CHID system generates UUIDs from various combinations of hardware
information (manufacturer, product name, BIOS version, etc.) creating a
hierarchy from most to least specific. This allows U-Boot to
automatically select the correct devicetree compatible-string for the
hardware on which it running.

This series includes:

* Core CHID Infrastructure:
   - UUID v5 generation with Microsoft's CHID namespace
   - Support for all 15 CHID variants (HardwareID-00 through HardwareID-14)
   - SMBIOS data extraction and processing

* Devicetree Integration:
   - hwids_to_dtsi.py script to convert CHID files to devicetree .dtsi
   - Automatic inclusion of the .dtsi into the board'' devicetree
   - Runtime compatible-string-selection based on hardware CHIDs

* chid command:
   - chid show - show current hardware information and generated CHIDs
   - chid list - list all supported CHID variants and generated UUIDs
   - chid variants - show information about CHID variant restrictions
   - chid compat - select the compatible string for current hardware

* ARM/EFI Support:
   - CHID mappings for a selection of ARM-based Windows devices
   - Support for Qualcomm Snapdragon platforms (MSM8998, SC7180, SC8180X,
     SC8280XP, SDM850, X1E series)

* Testing:
   - Sandbox tests using mock SMBIOS data
   - CI integration for hwids_to_dtsi validation
   - Validation against Microsoft's ComputerHardwareIds.exe output

Documentation is provided for this new subsystem and associated
commands.


Simon Glass (25):
  lib: Rename gen_v5_guid() to indicate it is little-endian
  uuid: Refactor v5 GUID generation into BE and LE variants
  smbios: Correct logic in smbios_get_header()
  smbios: Update smbios_get_header() to return a void *
  smbios: Expand the documentation
  smbios: Provide a sandbox test
  smbios: Improve comments for entry-point structures
  smbios: Add comments for smbios_type1 (System Information)
  smbios: Add docs for the main types
  test: Add more SMBIOS data to sandbox
  efi: arm: Provide CHIDs for the app
  efi: arm: Provide a mapping from CHIDs to compatible
  chid: Create a basic CHID header and smbios interface
  chid: Provide a command to access chid features
  uuid: Add a constant for the length of a UUID
  chid: Support calculating values for each variant
  chid: Add subcommand for dealing with variants
  chid: Provide some developer docs
  scripts: Add a tool to convert CHIDs to devicetree
  CI: Plumb in the hwids_to_dtsi tests
  sandbox: Provide hwid files for testing
  Makefile: Integrate CHID files into the build
  chid: Implement selection of the compatible string
  chid: doc: Describe how the CHID feature works
  cmd: chid: Add 'compat' subcommand to find compatible string

 .gitlab-ci.yml                                |   3 +-
 arch/sandbox/dts/test.dts                     |  24 +
 board/coreboot/coreboot/sysinfo.c             |  31 +-
 .../efi/efi-arm_app/hwids/compatible.hwidmap  |  45 +
 .../hwids/msm8998-lenovo-miix-630-81f1.txt    |  33 +
 .../efi-arm_app/hwids/sc7180-acer-aspire1.txt |  32 +
 .../hwids/sc8180x-lenovo-flex-5g-81xe.txt     |  32 +
 .../hwids/sc8180x-lenovo-flex-5g-82ak.txt     |  33 +
 .../hwids/sc8280xp-huawei-gaokun3.txt         |  38 +
 .../sc8280xp-lenovo-thinkpad-x13s-21bx.txt    |  33 +
 .../sc8280xp-lenovo-thinkpad-x13s-21by.txt    |  32 +
 .../hwids/sc8280xp-microsoft-blackrock.txt    |  32 +
 .../sc8280xp-microsoft-surface-pro-9-5G.txt   |  32 +
 .../hwids/sdm850-lenovo-yoga-c630.txt         |  32 +
 .../efi/efi-arm_app/hwids/x1e001de-devkit.txt |  30 +
 .../x1e78100-lenovo-thinkpad-t14s-21n1.txt    |  38 +
 .../x1e78100-lenovo-thinkpad-t14s-21n2.txt    |  37 +
 .../hwids/x1e80100-asus-vivobook-s15.txt      |  38 +
 .../hwids/x1e80100-asus-zenbook-a14.txt       |  37 +
 board/efi/efi-arm_app/hwids/x1e80100-crd.txt  |  34 +
 .../x1e80100-dell-inspiron-14-plus-7441.txt   |  37 +
 .../hwids/x1e80100-dell-latitude-7455.txt     |  33 +
 .../hwids/x1e80100-dell-xps13-9345.txt        |  32 +
 .../hwids/x1e80100-hp-omnibook-x14.txt        |  33 +
 .../hwids/x1e80100-lenovo-yoga-slim7x.txt     |  32 +
 .../hwids/x1e80100-microsoft-denali.txt       |  37 +
 .../hwids/x1e80100-microsoft-romulus13.txt    |  37 +
 .../hwids/x1e80100-microsoft-romulus15.txt    |  37 +
 .../hwids/x1p42100-asus-vivobook-s15.txt      |  37 +
 .../hwids/x1p42100-asus-zenbook-a14.txt       |  37 +
 .../hwids/x1p42100-hp-omnibook-x14.txt        |  33 +
 .../hwids/x1p42100-lenovo-ideapad-5-2in1.txt  |  37 +
 .../x1p42100-microsoft-surface-pro-12in.txt   |  37 +
 .../hwids/x1p64100-acer-swift-sf14-11.txt     |  37 +
 board/sandbox/hwids/compatible.hwidmap        |  12 +
 board/sandbox/hwids/test-device-1.txt         |  22 +
 board/sandbox/hwids/test-device-2.txt         |  19 +
 cmd/Kconfig                                   |  10 +
 cmd/Makefile                                  |   1 +
 cmd/chid.c                                    | 160 ++++
 cmd/smbios.c                                  |   4 +-
 doc/develop/chid.rst                          | 338 ++++++++
 doc/develop/index.rst                         |   1 +
 doc/develop/smbios.rst                        |  65 ++
 doc/usage/cmd/chid.rst                        | 114 +++
 doc/usage/cmd/smbios.rst                      |   3 +-
 doc/usage/index.rst                           |   2 +
 doc/usage/smbios.rst                          | 180 ++++
 include/chid.h                                | 230 +++++
 include/smbios.h                              | 239 +++++-
 include/u-boot/uuid.h                         |  16 +-
 lib/Kconfig                                   |   9 +
 lib/Makefile                                  |   2 +
 lib/chid.c                                    | 515 ++++++++++++
 lib/efi_loader/efi_firmware.c                 |   8 +-
 lib/smbios-parser.c                           |  15 +-
 lib/uuid.c                                    |  30 +-
 scripts/Makefile.lib                          |  21 +
 scripts/hwids_to_dtsi.py                      | 795 ++++++++++++++++++
 test/cmd/Makefile                             |   2 +
 test/cmd/chid.c                               | 125 +++
 test/cmd/smbios.c                             | 137 +++
 test/lib/Makefile                             |   1 +
 test/lib/chid.c                               | 392 +++++++++
 test/lib/uuid.c                               |  10 +-
 test/py/tests/test_smbios.py                  |   2 +-
 test/run                                      |   1 +
 test/scripts/test_hwids_to_dtsi.py            | 306 +++++++
 tools/mkeficapsule.c                          |   7 +-
 69 files changed, 4867 insertions(+), 69 deletions(-)
 create mode 100644 board/efi/efi-arm_app/hwids/compatible.hwidmap
 create mode 100644 board/efi/efi-arm_app/hwids/msm8998-lenovo-miix-630-81f1.txt
 create mode 100644 board/efi/efi-arm_app/hwids/sc7180-acer-aspire1.txt
 create mode 100644 board/efi/efi-arm_app/hwids/sc8180x-lenovo-flex-5g-81xe.txt
 create mode 100644 board/efi/efi-arm_app/hwids/sc8180x-lenovo-flex-5g-82ak.txt
 create mode 100644 board/efi/efi-arm_app/hwids/sc8280xp-huawei-gaokun3.txt
 create mode 100644 board/efi/efi-arm_app/hwids/sc8280xp-lenovo-thinkpad-x13s-21bx.txt
 create mode 100644 board/efi/efi-arm_app/hwids/sc8280xp-lenovo-thinkpad-x13s-21by.txt
 create mode 100644 board/efi/efi-arm_app/hwids/sc8280xp-microsoft-blackrock.txt
 create mode 100644 board/efi/efi-arm_app/hwids/sc8280xp-microsoft-surface-pro-9-5G.txt
 create mode 100644 board/efi/efi-arm_app/hwids/sdm850-lenovo-yoga-c630.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e001de-devkit.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e78100-lenovo-thinkpad-t14s-21n1.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e78100-lenovo-thinkpad-t14s-21n2.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-asus-vivobook-s15.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-asus-zenbook-a14.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-crd.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-dell-inspiron-14-plus-7441.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-dell-latitude-7455.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-dell-xps13-9345.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-hp-omnibook-x14.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-lenovo-yoga-slim7x.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-microsoft-denali.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-microsoft-romulus13.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1e80100-microsoft-romulus15.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1p42100-asus-vivobook-s15.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1p42100-asus-zenbook-a14.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1p42100-hp-omnibook-x14.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1p42100-lenovo-ideapad-5-2in1.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1p42100-microsoft-surface-pro-12in.txt
 create mode 100644 board/efi/efi-arm_app/hwids/x1p64100-acer-swift-sf14-11.txt
 create mode 100644 board/sandbox/hwids/compatible.hwidmap
 create mode 100644 board/sandbox/hwids/test-device-1.txt
 create mode 100644 board/sandbox/hwids/test-device-2.txt
 create mode 100644 cmd/chid.c
 create mode 100644 doc/develop/chid.rst
 create mode 100644 doc/usage/cmd/chid.rst
 create mode 100644 doc/usage/smbios.rst
 create mode 100644 include/chid.h
 create mode 100644 lib/chid.c
 create mode 100755 scripts/hwids_to_dtsi.py
 create mode 100644 test/cmd/chid.c
 create mode 100644 test/cmd/smbios.c
 create mode 100644 test/lib/chid.c
 create mode 100644 test/scripts/test_hwids_to_dtsi.py