How intel/pfr-wilson-city works
1. This repository is an Intel Platform Firmware Resiliency (PFR) reference design for an Intel MAX 10 FPGA. It is not a single app, but a hardware-and-embedded-firmware system that protects and recovers platform firmware for the host platform.
2. The repo is split into three architectural layers:
- FPGA RTL at the root and under src/
- Embedded Nios firmware under fw/code/
- C++ test harnesses and mocks under fw/test/
That boundary is important for any diagram: the FPGA logic enforces protection in hardware, while the Nios software performs policy, validation, and update orchestration.
3. There are three top-level FPGA configurations: pfr, non_pfr, and recovery. The files pfr_top.sv, non_pfr_top.sv, and recovery_top.sv plus their corresponding cores/QSFs show that the design can be built into different modes, with recovery as a distinct minimal rescue path.
4. The central hardware subsystem is the PFR core in src/core_cpld/wilson_city/Source/. This contains the platform-specific sequencing and protection logic for power, reset, thermal, and fault handling, including modules like Pch_Seq, Bmc_Seq, Cpu_Seq, PwrgdLogic, Prochot, SmaRT, and PFR_ByPass. This is the logic that sits between the board and the protected platform signals.
5. Firmware-facing control and data paths are implemented as FPGA IP blocks under src/:
- smbus_mailbox for host/management communication over SMBus/I2C
- smbus_filtered_relay for gating or relaying bus traffic
- spi_control for flash access and filtering
- rfnvram_smbus_master for reading/writing protected nonvolatile state over SMBus/I2C
- timer_bank for timing/timeout infrastructure
- jtag_lock_controller for limiting debug access
These blocks are the main interfaces between the embedded firmware and the board environment.
6. The embedded firmware in fw/code/ is the policy and orchestration layer running on Nios II inside pfr_sys or recovery_sys. Its headers show the major responsibilities: authentication, capsule validation, decompression, firmware update/recovery, flash validation, key cancellation, PFM handling, UFM/RFNVRAM access, mailbox handling, and watchdog/timing. The firmware is organized around those security and lifecycle functions rather than a general-purpose application model.
7. The security pipeline is anchored by the crypto and validation modules. Under src/crypto/ there is dedicated SHA-256 and ECDSA-256 RTL, while the firmware headers authentication.h, capsule_validation.h, pfm_validation.h, and flash_validation.h show how signatures, hashes, and image structure checks are composed. The update path therefore depends on hardware crypto plus firmware policy enforcement.
8. The update and recovery flow is image-centric. Test data and headers reference signed capsules, PFM images, anti-rollback cases, key-cancellation certificates, and full PFR images. This indicates the system validates signed update capsules, checks rollback/version rules, and then writes to protected flash partitions or staging areas through spi_control. If validation fails or the system is in a degraded state, recovery logic can restore known-good images from protected storage.
9. Persistent security state is split across protected storage domains. ufm/ufm_rw_utils suggests FPGA UFM is used for secrets, keys, or provisioning data, while rfnvram/rfnvram_utils indicates additional retained configuration or state stored externally and accessed through the SMBus master. keychain, keychain_utils, and key_cancellation show that trust anchors are managed explicitly, not embedded as static constants only.
10. The platform-specific design is parameterized for the “Wilson City” board family. The board wrappers under fw/code/hw/wilson_city_fab2 and src/core_cpld/wilson_city/ contain the board-specific pin/control logic, while generated packages like gen_gpi_signals_pkg, gen_gpo_controls_pkg, and gen_smbus_relay_config_pkg indicate that board I/O and relay behavior are generated from configuration. This is the boundary where a generic PFR architecture becomes a specific board implementation.
11. The system also includes a recovery-focused subsystem in src/recovery_sys/ and matching firmware under fw/code/hw/wilson_city_fab2_recovery. That path exists so the platform can boot and execute a reduced feature set when the main PFR path is unavailable or compromised.
12. Verification is a major part of the repository architecture. fw/test/ contains extensive unit and flow tests, plus mocks for SPI, SMBus, UFM, RFNVRAM, timers, crypto, and mailbox interfaces. The test corpus includes many signed-good and signed-bad capsule images, anti-rollback cases, key-cancellation cases, and recovery/update scenarios, which reflects the real system’s state-machine complexity and security-critical branching.
13. In diagram terms, the core data flow is: platform buses and flash traffic enter the FPGA protection layer; the mailbox/SMBus and SPI subsystems hand requests to the Nios firmware; firmware validates images using crypto and policy state from UFM/RFNVRAM; approved updates are written to flash; and recovery paths restore protected images when the active image is invalid or compromised.
14. The build/tooling model reflects the same split: Quartus/Qsys project files define the FPGA systems, Makefiles and shell scripts build the alternate images, and the Nios firmware is compiled separately from the RTL. So the architecture is a tightly coupled hardware/software security appliance, not just an FPGA peripheral.
Main entry points: pfr_sys.qsys PFR system · pfr_main.h Nios firmware · Wilson_City_Main.v Wilson core · main.cpp Test suite
Components 25
FPGA RTL
Top-level hardware designs, board-specific core logic, and FPGA IP blocks.
- Build/Top · Entry scripts and top-level FPGA configurations for alternate images.
Makefile - PFR top · Main protected platform firmware configuration.
pfr_top.sv - Non-PFR top · Alternate non-protected configuration.
non_pfr_top.sv - Recovery top · Minimal rescue configuration for degraded or compromised states.
recovery_top.sv - PFR system · Main FPGA system integration for the protected path.
src/pfr_sys/pfr_sys.qsys - Recovery sys · Reduced FPGA system used by the recovery path.
src/recovery_sys/recovery_sys.qsys - Wilson core · Board-specific protection and sequencing logic for Wilson City.
src/core_cpld/wilson_city/Source/Wilson_City_Main.v - Sequencing · Power, reset, thermal, and fault sequencing blocks.
src/core_cpld/wilson_city/Source/Pch_Seq.v - Fault control · Bypass, power-good, prochot, and SmaRT handling.
src/core_cpld/wilson_city/Source/PFR_ByPass.v - Mailbox · Host/management control path over SMBus/I2C.
src/smbus_mailbox/smbus_mailbox.sv - Relay gate · Gates or relays SMBus traffic based on protection state.
src/smbus_filtered_relay/smbus_filtered_relay.sv - SPI control · Protected flash access, filtering, and command handling.
src/spi_control/spi_control.sv - RFNVRAM master · External retained-state access over SMBus/I2C.
src/rfnvram_smbus_master/rfnvram_smbus_master.sv - Timer bank · Timing and timeout infrastructure for policy enforcement.
src/timer_bank/timer_bank.sv - JTAG lock · Limits debug access to the platform.
src/jtag_lock_controller/jtag_lock_controller.sv - Crypto RTL · Hardware SHA-256 and ECDSA-256 used by authentication and image validation.
src/crypto/crypto256_top.sv
Embedded Firmware
Nios II policy, validation, and update orchestration.
- Nios firmware · Embedded orchestration layer for validation, update, recovery, and provisioning.
fw/code/inc/pfr_main.h - Update flow · Capsule validation, decompression, flash programming, and recovery orchestration.
fw/code/inc/firmware_update.h - Security state · UFM, RFNVRAM, keychain, and cancellation state management.
fw/code/inc/ufm.h - Mailbox policy · Firmware-side mailbox parsing and command routing.
fw/code/inc/mailbox_utils.h - Validation · Authentication, capsule, PFM, and flash validation pipeline.
fw/code/inc/authentication.h - Recovery logic · Recovery entry points for compromised or unavailable active images.
fw/code/inc/firmware_recovery.h
Verification
C++ unit tests, mocks, and security scenario data.
- Test suite · Unit tests, flow tests, fuzz harnesses, and scenario coverage.
fw/test/main.cpp - Mocks · SPI, SMBus, UFM, RFNVRAM, timer, crypto, and mailbox mocks.
fw/test/system/system_mock.h - Test data · Signed capsules, PFMs, anti-rollback cases, key-cancellation certs, and recovery images.
fw/test/testdata/signed_capsule_pch.bin.gz
Connections 26
- Build/Top → PFR top: builds · Build script and top-level artifacts produce the protected image.
- Build/Top → Non-PFR top: builds · Build script can produce a non-protected variant.
- Build/Top → Recovery top: builds · Build script can produce the recovery image.
- PFR top → PFR system: integrates · Main protected top wraps the primary system integration.
- Recovery top → Recovery sys: integrates · Recovery top wraps the minimal recovery system.
- PFR top → Wilson core: hosts · Protected top connects to the Wilson City core CPLD logic.
- Non-PFR top → Wilson core: hosts · Non-PFR top uses the same board core with different mode behavior.
- Recovery top → Wilson core: hosts · Recovery top retains the board-level control boundary.
- Wilson core → Sequencing: sequencing · Core logic sequences power, reset, and platform state.
- Wilson core → Fault control: faults · Core logic handles bypass, power-good, thermal, and fault responses.
- PFR system → Mailbox: exposes · Main system exposes management commands through the mailbox.
- PFR system → Relay gate: routes · System gates SMBus traffic through protection relay logic.
- PFR system → SPI control: controls · System mediates protected flash access through SPI control.
- PFR system → RFNVRAM master: reads/writes · System accesses retained security state over SMBus/I2C.
- PFR system → Timer bank: times · System uses timing and timeout infrastructure.
- PFR system → JTAG lock: guards · System restricts debug access through JTAG lock control.
- Validation → Crypto RTL: verifies · Firmware validation depends on hardware SHA/ECDSA.
- Nios firmware → Validation: uses · Firmware performs authentication and image structure checks.
- Nios firmware → Update flow: orchestrates · Firmware manages update, decompression, and flash programming.
- Nios firmware → Security state: persists · Firmware manages keys, UFM, and RFNVRAM-backed state.
- Nios firmware → Mailbox policy: handles · Firmware implements mailbox command policy.
- Nios firmware → Recovery logic: recovers · Firmware enters recovery flows on failure or compromise.
- Test suite → Mocks: stubs · Verification uses mocks for hardware-facing interfaces.
- Test suite → Test data: covers · Verification exercises signed-good, signed-bad, rollback, and recovery scenarios.
- Test suite → Nios firmware: validates · Test suite targets the firmware policy and lifecycle behavior.
- Test suite → Crypto RTL: validates · Tests cover crypto and authentication behavior.