Skip to content

NAI 68INT6: board devices in the DSDT, Linux or Multiboot2 payload per image, and faster cold boot - #959

Open
dgarske wants to merge 3 commits into
wolfSSL:masterfrom
dgarske:nai_lpss_acpi
Open

dgarske wants to merge 3 commits into
wolfSSL:masterfrom
dgarske:nai_lpss_acpi

Conversation

@dgarske

@dgarske dgarske commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Description

Exposes the 68INT6 board devices on the LPSS I2C0 and GSPI0 controllers to Linux, the same way NAI's stock BIOS declares them, so NAI's Linux drivers (naigspi, plus at24 for the EEPROMs) bind under wolfBoot. It also lets one build boot either a Linux bzImage or a Multiboot2 ELF (an RTOS), chosen per image, cuts cold boot time by caching FSP-M's memory training data and removing a global reset on every cold boot, and brings up the PCIe switch the way the stock BIOS does.

What it adds

  • src/x86/acpi_dsdt.asl, include/x86/acpi_dsdt.h - I2C0 (00:15.0) and SPI0 (00:1e.2) under the PCI root, with:
    • the PRC register controller on GSPI0 CS0 (15AC0001)
    • EEPROM (15AC0002, 0x56) and serial-number EEPROM (15AC0003, 0x5E)
    • RTC/watchdog (15AC0004, 0x68)
  • include/x86/gpio_config.h - GSPI0 (GPP_B15-B18) and I2C0 (GPP_C16/C17) pads in native mode, with the stock pad values; C15, E12, F9 and the USB power enables H7-H9 driven high, D2 held low for the OS
  • include/x86/gpio_config.h, include/x86/fsp_config.h, options.mk - the stock BIOS PCIe sequence: switch lane straps, NT mode and backplane clock before memory init (NAI_68INT6_PCIE_LANES, NAI_68INT6_PCIE_NT, NAI_68INT6_BACKPLANE_CLK), then the PCIE_RDY (GPP_C23) wait and GPP_B12 release before PCI enumeration, with the BIOS delays as options timed from the TSC rate in CPUID
  • src/x86/tgl_fsp.c - on nai_68int6, SerialIoI2cMode[0] set to PCI mode (it was disabled), and CnviMode left on Auto: no CNVi module is fitted, and forcing Disable made FSP-S request a global reset on every cold boot
  • docs/Targets.md - notes the board devices in the DSDT, documents Multiboot2 ELF payloads and how their handoff differs from Linux, and the training data cache
  • src/x86/fsp_nvs.c, include/x86/fsp_nvs.h - training data cache (FSP_NVS_CACHE=1, Tiger Lake only, enabled for nai_68int6 in a 128 KB area below the wolfBoot window). Stage 1 hands a valid saved record to FspMemInit; the record is keyed on a CRC of the FSP-M image and its UPDs, so a change to either falls back to full training. Stage 2 saves the FSP non-volatile storage HOB, only when it changed, after TempRamExit and before FSP-S and the BIOS region lock; the header is written last.
  • hal/x86_fsp_tgl.c - 4 KB erase and write through SPI hardware sequencing, BIOS region only
  • tools/unit-tests/unit-fsp-nvs.c, unit-fsp-nvs-save.c, unit-tgl-spi-hwseq.c - the cache record check, the save path, and the SPI cycles against a modeled controller
    The serial-number EEPROM's read-only property is written as a name/value pair, as ACPI device properties require.

Touches shared code

  • src/boot_x86_fsp_payload.c - with both LINUX_PAYLOAD and ELF built in, do_boot() sends an image that starts with the ELF magic down the ELF/Multiboot2 path and boots anything else as Linux. The ELF path moves unchanged into boot_elf(). Builds with only one payload type behave as before.
  • src/boot_x86_fsp.c, src/x86/fsp.c, include/stage2_params.h - cache call sites and the record key passed from stage 1 to stage 2, all under FSP_NVS_CACHE
  • src/x86/tgl_fsp.c, src/x86/fsp.c - the Tiger Lake pad writer can set a pad's output level (GPIO_SET_TX), and a fsp_pre_pci_enum_cb() hook runs before PCI enumeration (a no-op on Kontron and QEMU)

Testing

Builds for nai_68int6 (both payloads, ELF only, Linux only) and kontron_vx3060_s2. Tested on a 68INT6 Rev D5: one image boots a Multiboot2 RTOS test ELF and Ubuntu 22.04 (5.15). Under Linux the EEPROMs bind to at24, NAI's naigspi binds to the PRC, and rtc-ds1374 binds the RTC. The first boot after flashing saves the training data, later cold boots use it, a changed UPD set falls back to full training, and the per-boot global reset is gone. The PCIe switch enumerates as under the stock BIOS, the lane straps change its port layout, and the delays match wall-clock time. The warm reset FspMemInit requests on each power-on is not caused by any wolfBoot UPD and is left for follow-up with the FSP vendor.

@dgarske dgarske self-assigned this Oct 28, 2026
@dgarske dgarske changed the title NAI 68INT6: enable LPSS I2C0 and declare the board I2C0/GSPI0 devices in the DSDT NAI 68INT6: board I2C0/GSPI0 devices in the DSDT and Linux or Multiboot2 payload per image Oct 30, 2026
@dgarske
dgarske force-pushed the nai_lpss_acpi branch 2 times, most recently from 2b369ac to e7f091a Compare October 31, 2026 17:47
@dgarske dgarske changed the title NAI 68INT6: board I2C0/GSPI0 devices in the DSDT and Linux or Multiboot2 payload per image NAI 68INT6: board devices in the DSDT, Linux or Multiboot2 payload per image, and faster cold boot Oct 31, 2026
Copilot AI balanced review requested due to automatic review settings November 2, 2026 19:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Pre-FSP-S flash writes and persistent memory-training reuse require platform/FSP-owner review of flash ownership and reset or interrupted-write recovery guarantees not established by host models or reported board testing.

No open issues 🎉

What changed in this PR

Extends wolfBoot’s NAI 68INT6 support with Linux-visible board devices, per-image Linux or Multiboot2 payload selection, and faster cold boots through cached memory training data.

Changes:

  • Declares board I2C/SPI devices in ACPI and configures their native GPIO pads and controllers.
  • Selects the ELF or Linux boot path from the image format when both are enabled.
  • Adds FSP memory-training caching, Tiger Lake SPI erase/write support, and unit tests; adjusts NAI CNVi configuration to avoid recurring cold-boot global resets.
File Description
tools/​unit-tests/​unit-tgl-spi-hwseq.c Tests SPI address mapping, erase/write cycles, and failure handling.
tools/​unit-tests/​unit-fsp-nvs.c Tests cache validation and stage 1 handoff.
tools/​unit-tests/​unit-fsp-nvs-save.c Tests cache persistence using synthetic HOBs and flash.
tools/​unit-tests/​Makefile Registers and builds the three new test suites.
src/​x86/​tgl_fsp.c Enables NAI I2C0 and selects CNVi Auto mode.
src/​x86/​fsp.c Saves training data after TempRamExit, before FSP-S.
src/​x86/​fsp_nvs.c Implements cache validation, reuse, and persistence.
src/​x86/​acpi_dsdt.asl Declares EEPROMs, RTC/watchdog, and PRC devices.
src/​boot_x86_fsp.c Applies cached training data before memory initialization.
src/​boot_x86_fsp_payload.c Extracts ELF boot logic and adds per-image dispatch.
options.mk Validates cache configuration and supplies compiler defines.
include/​x86/​tgl_fsp.h Declares SPI flash erase/write interfaces.
include/​x86/​gpio_config.h Adds native-mode GSPI0 and I2C0 pad configuration.
include/​x86/​fsp_nvs.h Defines the cache record and public interfaces.
include/​x86/​acpi_dsdt.h Updates embedded AML for the board devices.
include/​stage2_params.h Carries the cache key between boot stages.
hal/​x86_fsp_tgl.c Implements BIOS-region SPI hardware-sequenced erase/write.
docs/​Targets.md Documents board devices, caching, and payload handoff differences.
config/​examples/​nai_68int6.config Enables a 128 KB training-data cache below wolfBoot.
arch.mk Includes cache implementation in both boot stages.
.gitignore Excludes new test binaries and the generated extraction header.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants