Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,9 @@ tools/unit-tests/unit-hifive1-flash-write
tools/unit-tests/unit-hifive1-hfrosccfg
tools/unit-tests/unit-keygen-keystore
tools/unit-tests/unit-kontron-tgl-spi
tools/unit-tests/unit-fsp-nvs
tools/unit-tests/unit-fsp-nvs-save
tools/unit-tests/unit-tgl-spi-hwseq
tools/unit-tests/unit-nrf5340-flash-protect
tools/unit-tests/unit-nrf5340-uart-crlf
tools/unit-tests/unit-nrf54l-uart-write
Expand Down Expand Up @@ -670,6 +673,7 @@ tools/unit-tests/keystore_gen
tools/unit-tests/kinetis_erase_extract.h
tools/unit-tests/kontron_spi_extract.h
tools/unit-tests/kontron_spi_fn_extract.h
tools/unit-tests/tgl_spi_hwseq_extract.h
tools/unit-tests/nrf5340_protect_fn_extract.h
tools/unit-tests/nrf54l_uart_write_extract.h
tools/unit-tests/p1021_erase_extract.h
Expand Down
6 changes: 6 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2500,6 +2500,9 @@ ifeq ("${FSP}", "1")
OBJS+=src/x86/tgl_fsp.o
OBJS+=src/ucode0.o
CFLAGS += -DUCODE0_ADDRESS=$(UCODE0_BASE)
ifeq ($(FSP_NVS_CACHE),1)
OBJS+=src/x86/fsp_nvs.o
endif
endif
else
# building wolfBoot
Expand Down Expand Up @@ -2546,6 +2549,9 @@ ifeq ("${FSP}", "1")
endif
ifeq ($(FSP_TGL), 1)
OBJS+=src/x86/tgl_fsp.o
ifeq ($(FSP_NVS_CACHE),1)
OBJS+=src/x86/fsp_nvs.o
endif
endif
endif
ifeq ($(64BIT),1)
Expand Down
6 changes: 6 additions & 0 deletions config/examples/nai_68int6.config
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ BIOS_REGION_SIZE=0xc00000
UCODE0_BASE=0xffd90000
UCODE0_BIN=src/x86/ucode0.bin

# FSP memory training data cache: 128 KB of the BIOS region just below the
# wolfBoot window, so it survives a reflash of the window.
FSP_NVS_CACHE=1
FSP_NVS_BASE=0xff9e0000
FSP_NVS_SIZE=0x20000

FSP_T_BIN=./src/x86/fsp_t.bin
FSP_M_BIN=./src/x86/fsp_m.bin
FSP_S_BIN=./src/x86/fsp_s.bin
Expand Down
24 changes: 22 additions & 2 deletions docs/Targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -9096,7 +9096,8 @@ Notable options in [config/examples/nai_68int6.config](../config/examples/nai_68
| Option | Meaning |
|---|---|
| `X86_UART_NUMBER=2` | LPSS UART2 for all three FSP phases (Kontron uses 0) |
| `ACPI=1` | Required. Generates ACPI tables (RSDP/XSDT/FADT/MADT/MCFG and a minimal DSDT); the board's PCI interrupt routing is only in the DSDT `_PRT`, since the MP table is the Kontron one |
| `ACPI=1` | Required. Generates ACPI tables (RSDP/XSDT/FADT/MADT/MCFG and a minimal DSDT); the board's PCI interrupt routing is only in the DSDT `_PRT`, since the MP table is the Kontron one. The DSDT also declares the board devices on LPSS I2C0 (EEPROMs, RTC/watchdog) and GSPI0 (the PRC, for NAI's `naigspi` driver) |
| `FSP_NVS_CACHE=1`, `FSP_NVS_BASE`, `FSP_NVS_SIZE` | Keeps FSP-M's memory training data (its non-volatile storage HOB) in a 128 KB area of the BIOS region below the wolfBoot window, so later boots skip full memory training. Stage 1 passes a valid copy back through `NvsBufferPtr`; stage 2 rewrites it, before FSP-S and before the BIOS region is locked, only when it changes. The record is keyed on the FSP-M revision and UPDs, so a change to either falls back to full training |
| `ANTI_ROLLBACK=1` | Persistent version floor and boot audit counters in TPM NV |
| `MEASURED_BOOT=1`, `MEASURED_PCR_OS=4` | Firmware into PCR 0, the verified OS image into PCR 4 |
| `WOLFBOOT_BOOT_DISK=0` | Boot from GPT partitions; the A/B indices (sda3/sda4) are set in `src/update_disk.c` |
Expand All @@ -9117,7 +9118,26 @@ The booted OS cannot lower the floor. The index is platform-created and writable

### Boot, programming and recovery

wolfBoot boots the highest-versioned signed 64-bit `bzImage` that verifies from the two GPT boot partitions. It falls back to the other slot only if that is not a downgrade (see Anti-rollback), and halts if neither boots. Program the flash with a Dediprog SF100 on JP4 while the board is off; the BIOS region lock blocks `flashrom` from the booted OS. JP36 selects which bank boots and which one the programmer sees; move it only with the board off.
wolfBoot boots the highest-versioned signed 64-bit `bzImage` or Multiboot2 ELF that verifies from the two GPT boot partitions. It falls back to the other slot only if that is not a downgrade (see Anti-rollback), and halts if neither boots. Program the flash with a Dediprog SF100 on JP4 while the board is off; the BIOS region lock blocks `flashrom` from the booted OS. JP36 selects which bank boots and which one the programmer sees; move it only with the board off.

### Multiboot2 ELF payloads

The configuration builds both payload paths (`LINUX_PAYLOAD=1`, `ELF=1`, `MULTIBOOT2=1`), and `do_boot()` picks one per image: an image that starts with the ELF magic takes the Multiboot2 path, and anything else boots as Linux. A Multiboot2 RTOS image such as Green Hills INTEGRITY-178 is signed and written to an A/B slot the same way as a kernel:

```
./tools/keytools/sign --ecc384 --sha384 <payload.elf> wolfboot_signing_private_key.der <version>
```

The two paths differ only in the handoff:

| | Linux `bzImage` | Multiboot2 ELF |
|---|---|---|
| Entry | 64-bit Linux boot protocol, `boot_params` and the command line | ELF segments loaded at their physical addresses, virtual addresses mapped in wolfBoot's page tables, jump to `e_entry` in 64-bit mode with EAX=`0x36d76289` and EBX pointing to the Multiboot2 information |
| Memory map | E820 table in `boot_params` | Multiboot2 memory map and basic memory information tags, from the FSP HOBs |
| ACPI tables | Generated (`ACPI=1`) | None; they are only built on the Linux path |
| RTC | The legacy CMOS RTC is ignored under the hardware-reduced ACPI tables; the I2C0 RTC is declared in the DSDT | The CMOS RTC is usable directly; I2C0 is enabled for the board RTC |

Everything else is shared: FSP silicon setup (VT-d at the stock BIOS addresses, Hyper-Threading off), the halted PCH TCO watchdog, the BIOS region lock, measured boot, anti-rollback and A/B selection.

## Infineon PSOC Control C3

Expand Down
151 changes: 151 additions & 0 deletions hal/x86_fsp_tgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "wolfboot/wolfboot.h"
#include <stdint.h>
#include <string.h>

#ifdef __WOLFBOOT

Expand Down Expand Up @@ -190,6 +191,156 @@ int hal_flash_protect(haladdr_t address, int len)
* hook's address/len are the same range FREG1 describes. */
return tgl_lock_bios_region();
}

#ifdef WOLFBOOT_FSP_NVS_CACHE
/* Hardware-sequencing flash cycles, used to save the FSP memory training
* data before the BIOS region is locked. Runs from RAM (stage 2) only. */
#define SPI_BIOS_CNTL (0xdc)
#define SPI_BIOS_CNTL_WPD (1U << 0)
#define SPI_FADDR (0x8)
#define SPI_FDATA0 (0x10)
#define SPI_HSFSTS_FDONE (1U << 0)
#define SPI_HSFSTS_FCERR (1U << 1)
#define SPI_HSFSTS_AEL (1U << 2)
#define SPI_HSFSTS_SCIP (1U << 5)
#define SPI_HSFSTS_FGO (1U << 16)
#define SPI_HSFSTS_FCYCLE_SHIFT (17)
#define SPI_HSFSTS_FDBC_SHIFT (24)
#define SPI_FCYCLE_WRITE (2)
#define SPI_FCYCLE_ERASE_4K (3)
#define SPI_HWSEQ_MAX_DATA (64)
#define SPI_ERASE_SIZE (0x1000)
#define SPI_HWSEQ_TIMEOUT_MS (1000)

static uint32_t tgl_spi_begin(uint32_t *cmd)
{
uint32_t spi_bar, cntl;

spi_bar = pci_config_read32(0, SPI_PCI_DEV, SPI_PCI_FUN, PCI_BAR0_OFFSET);
spi_bar &= PCI_BAR_MASK;
*cmd = pci_config_read32(0, SPI_PCI_DEV, SPI_PCI_FUN, PCI_COMMAND_OFFSET);
pci_config_write32(0, SPI_PCI_DEV, SPI_PCI_FUN, PCI_COMMAND_OFFSET,
*cmd | PCI_COMMAND_MEM_SPACE);
cntl = pci_config_read8(0, SPI_PCI_DEV, SPI_PCI_FUN, SPI_BIOS_CNTL);
pci_config_write8(0, SPI_PCI_DEV, SPI_PCI_FUN, SPI_BIOS_CNTL,
cntl | SPI_BIOS_CNTL_WPD);
if ((pci_config_read8(0, SPI_PCI_DEV, SPI_PCI_FUN, SPI_BIOS_CNTL) &
SPI_BIOS_CNTL_WPD) == 0)
return 0;
return spi_bar;
}

static void tgl_spi_end(uint32_t cmd)
{
uint8_t cntl;

cntl = pci_config_read8(0, SPI_PCI_DEV, SPI_PCI_FUN, SPI_BIOS_CNTL);
pci_config_write8(0, SPI_PCI_DEV, SPI_PCI_FUN, SPI_BIOS_CNTL,
cntl & ~SPI_BIOS_CNTL_WPD);
pci_config_write32(0, SPI_PCI_DEV, SPI_PCI_FUN, PCI_COMMAND_OFFSET, cmd);
}

/* The BIOS region is mapped so that its last byte sits at 4 GB - 1;
* returns the flash linear address of the memory-mapped address, or -1
* when the range is outside the BIOS region. */
static int64_t tgl_spi_linear(uint32_t spi_bar, uint32_t address,
uint32_t len)
{
uint32_t reg, base, top;
uint64_t lin;

reg = mmio_read32(spi_bar + SPI_FREG1);
base = (reg & SPI_FREG_BASE_MASK) << SPI_FREG_ADDR_SHIFT;
top = (((reg & SPI_FREG_LIMIT_MASK) >> SPI_FREG_LIMIT_SHIFT)
<< SPI_FREG_ADDR_SHIFT) | 0xfffU;
if (top < base || len == 0)
return -1;
lin = (uint64_t)top - (0xffffffffULL - address);
if (lin < base || lin + len - 1 > top)
return -1;
return (int64_t)lin;
}

static int tgl_spi_cycle(uint32_t spi_bar, uint32_t cycle, uint32_t faddr,
uint32_t len)
{
uint32_t sts = 0;
int ms;

for (ms = 0; ms < SPI_HWSEQ_TIMEOUT_MS; ms++) {
if ((mmio_read32(spi_bar + SPI_BIOS_HSFSTS_CTL) &
SPI_HSFSTS_SCIP) == 0)
break;
delay(1);
}
if (ms == SPI_HWSEQ_TIMEOUT_MS)
return -1;
mmio_write32(spi_bar + SPI_BIOS_HSFSTS_CTL,
SPI_HSFSTS_FDONE | SPI_HSFSTS_FCERR | SPI_HSFSTS_AEL);
mmio_write32(spi_bar + SPI_FADDR, faddr);
mmio_write32(spi_bar + SPI_BIOS_HSFSTS_CTL,
((len - 1) << SPI_HSFSTS_FDBC_SHIFT) |
(cycle << SPI_HSFSTS_FCYCLE_SHIFT) | SPI_HSFSTS_FGO);
for (ms = 0; ms < SPI_HWSEQ_TIMEOUT_MS; ms++) {
sts = mmio_read32(spi_bar + SPI_BIOS_HSFSTS_CTL);
if (sts & (SPI_HSFSTS_FDONE | SPI_HSFSTS_FCERR))
break;
delay(1);
}
mmio_write32(spi_bar + SPI_BIOS_HSFSTS_CTL,
SPI_HSFSTS_FDONE | SPI_HSFSTS_FCERR | SPI_HSFSTS_AEL);
if (ms == SPI_HWSEQ_TIMEOUT_MS || (sts & SPI_HSFSTS_FCERR))
return -1;
return 0;
}

int tgl_spi_flash_erase(uint32_t address, uint32_t len)
{
uint32_t spi_bar, cmd, off;
int64_t lin;
int ret = 0;

if ((address | len) & (SPI_ERASE_SIZE - 1))
return -1;
spi_bar = tgl_spi_begin(&cmd);
lin = (spi_bar != 0) ? tgl_spi_linear(spi_bar, address, len) : -1;
if (lin < 0)
ret = -1;
for (off = 0; ret == 0 && off < len; off += SPI_ERASE_SIZE)
ret = tgl_spi_cycle(spi_bar, SPI_FCYCLE_ERASE_4K,
(uint32_t)lin + off, 1);
tgl_spi_end(cmd);
return ret;
}

int tgl_spi_flash_write(uint32_t address, const uint8_t *buf, uint32_t len)
{
uint32_t spi_bar, cmd, off, chunk, word, i;
int64_t lin;
int ret = 0;

spi_bar = tgl_spi_begin(&cmd);
lin = (spi_bar != 0) ? tgl_spi_linear(spi_bar, address, len) : -1;
if (lin < 0)
ret = -1;
for (off = 0; ret == 0 && off < len; off += chunk) {
/* 64-byte aligned cycles never cross a flash page */
chunk = SPI_HWSEQ_MAX_DATA - (((uint32_t)lin + off) &
(SPI_HWSEQ_MAX_DATA - 1));
if (chunk > len - off)
chunk = len - off;
for (i = 0; i < chunk; i += 4) {
word = 0xffffffffU;
memcpy(&word, buf + off + i, (chunk - i < 4) ? chunk - i : 4);
mmio_write32(spi_bar + SPI_FDATA0 + i, word);
}
ret = tgl_spi_cycle(spi_bar, SPI_FCYCLE_WRITE, (uint32_t)lin + off,
chunk);
}
tgl_spi_end(cmd);
return ret;
}
#endif /* WOLFBOOT_FSP_NVS_CACHE */
#endif /* WOLFBOOT_TGL */
#endif

3 changes: 3 additions & 0 deletions include/stage2_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ struct stage2_parameter {
/* Verified payload length, set by the disk loader before do_boot so the
* Linux loader can bound the signed container header against the image. */
uint32_t payload_size;
#ifdef WOLFBOOT_FSP_NVS_CACHE
uint32_t fsp_nvs_key;
#endif
#ifdef WOLFBOOT_TPM_SEAL
uint32_t tpm_policy;
uint16_t tpm_policy_size;
Expand Down
73 changes: 69 additions & 4 deletions include/x86/acpi_dsdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
* Regenerate: iasl src/x86/acpi_dsdt.asl &&
* xxd -i -n acpi_dsdt_aml src/x86/acpi_dsdt.aml (append below this header). */
static const unsigned char acpi_dsdt_aml[] = {
0x44, 0x53, 0x44, 0x54, 0x1e, 0x02, 0x00, 0x00, 0x02, 0x48, 0x57, 0x4f,
0x44, 0x53, 0x44, 0x54, 0x29, 0x05, 0x00, 0x00, 0x02, 0xa7, 0x57, 0x4f,
0x4c, 0x46, 0x42, 0x54, 0x4e, 0x41, 0x49, 0x54, 0x47, 0x4c, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x49, 0x4e, 0x54, 0x4c, 0x28, 0x06, 0x23, 0x20,
0x10, 0x49, 0x1f, 0x5f, 0x53, 0x42, 0x5f, 0x5b, 0x82, 0x41, 0x1f, 0x50,
0x10, 0x44, 0x50, 0x5f, 0x53, 0x42, 0x5f, 0x5b, 0x82, 0x4c, 0x4f, 0x50,
0x43, 0x49, 0x30, 0x08, 0x5f, 0x48, 0x49, 0x44, 0x0c, 0x41, 0xd0, 0x0a,
0x08, 0x08, 0x5f, 0x43, 0x49, 0x44, 0x0c, 0x41, 0xd0, 0x0a, 0x03, 0x08,
0x5f, 0x53, 0x45, 0x47, 0x00, 0x08, 0x5f, 0x42, 0x42, 0x4e, 0x00, 0x08,
Expand Down Expand Up @@ -67,6 +67,71 @@ static const unsigned char acpi_dsdt_aml[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x79, 0x00
0x79, 0x00, 0x5b, 0x82, 0x49, 0x25, 0x49, 0x32, 0x43, 0x30, 0x08, 0x5f,
0x41, 0x44, 0x52, 0x0c, 0x00, 0x00, 0x15, 0x00, 0x5b, 0x82, 0x43, 0x0c,
0x45, 0x45, 0x50, 0x32, 0x08, 0x5f, 0x48, 0x49, 0x44, 0x0d, 0x31, 0x35,
0x41, 0x43, 0x30, 0x30, 0x30, 0x32, 0x00, 0x08, 0x5f, 0x43, 0x49, 0x44,
0x0d, 0x50, 0x52, 0x50, 0x30, 0x30, 0x30, 0x31, 0x00, 0x08, 0x5f, 0x44,
0x44, 0x4e, 0x0d, 0x4e, 0x41, 0x49, 0x20, 0x4d, 0x6f, 0x74, 0x68, 0x65,
0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20, 0x45, 0x45, 0x50, 0x52, 0x4f,
0x4d, 0x00, 0x08, 0x5f, 0x43, 0x52, 0x53, 0x11, 0x26, 0x0a, 0x23, 0x8e,
0x1e, 0x00, 0x02, 0x00, 0x01, 0x02, 0x00, 0x00, 0x01, 0x06, 0x00, 0xa0,
0x86, 0x01, 0x00, 0x56, 0x00, 0x5c, 0x5f, 0x53, 0x42, 0x2e, 0x50, 0x43,
0x49, 0x30, 0x2e, 0x49, 0x32, 0x43, 0x30, 0x00, 0x79, 0x00, 0x08, 0x5f,
0x44, 0x53, 0x44, 0x12, 0x41, 0x05, 0x02, 0x11, 0x13, 0x0a, 0x10, 0x14,
0xd8, 0xff, 0xda, 0xba, 0x6e, 0x8c, 0x4d, 0x8a, 0x91, 0xbc, 0x9b, 0xbf,
0x4a, 0xa3, 0x01, 0x12, 0x39, 0x03, 0x12, 0x1b, 0x02, 0x0d, 0x63, 0x6f,
0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x6c, 0x65, 0x00, 0x0d, 0x61, 0x74,
0x6d, 0x65, 0x6c, 0x2c, 0x32, 0x34, 0x63, 0x30, 0x32, 0x00, 0x12, 0x0b,
0x02, 0x0d, 0x73, 0x69, 0x7a, 0x65, 0x00, 0x0b, 0x00, 0x01, 0x12, 0x0e,
0x02, 0x0d, 0x70, 0x61, 0x67, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x00, 0x0a,
0x08, 0x5b, 0x82, 0x46, 0x0d, 0x45, 0x45, 0x50, 0x33, 0x08, 0x5f, 0x48,
0x49, 0x44, 0x0d, 0x31, 0x35, 0x41, 0x43, 0x30, 0x30, 0x30, 0x33, 0x00,
0x08, 0x5f, 0x43, 0x49, 0x44, 0x0d, 0x50, 0x52, 0x50, 0x30, 0x30, 0x30,
0x31, 0x00, 0x08, 0x5f, 0x44, 0x44, 0x4e, 0x0d, 0x4e, 0x41, 0x49, 0x20,
0x4d, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20,
0x45, 0x45, 0x50, 0x52, 0x4f, 0x4d, 0x20, 0x53, 0x4e, 0x00, 0x08, 0x5f,
0x43, 0x52, 0x53, 0x11, 0x26, 0x0a, 0x23, 0x8e, 0x1e, 0x00, 0x02, 0x00,
0x01, 0x02, 0x00, 0x00, 0x01, 0x06, 0x00, 0xa0, 0x86, 0x01, 0x00, 0x5e,
0x00, 0x5c, 0x5f, 0x53, 0x42, 0x2e, 0x50, 0x43, 0x49, 0x30, 0x2e, 0x49,
0x32, 0x43, 0x30, 0x00, 0x79, 0x00, 0x08, 0x5f, 0x44, 0x53, 0x44, 0x12,
0x41, 0x06, 0x02, 0x11, 0x13, 0x0a, 0x10, 0x14, 0xd8, 0xff, 0xda, 0xba,
0x6e, 0x8c, 0x4d, 0x8a, 0x91, 0xbc, 0x9b, 0xbf, 0x4a, 0xa3, 0x01, 0x12,
0x49, 0x04, 0x04, 0x12, 0x1c, 0x02, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x61,
0x74, 0x69, 0x62, 0x6c, 0x65, 0x00, 0x0d, 0x61, 0x74, 0x6d, 0x65, 0x6c,
0x2c, 0x32, 0x34, 0x63, 0x73, 0x30, 0x32, 0x00, 0x12, 0x0a, 0x02, 0x0d,
0x73, 0x69, 0x7a, 0x65, 0x00, 0x0a, 0x10, 0x12, 0x0e, 0x02, 0x0d, 0x70,
0x61, 0x67, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x00, 0x0a, 0x08, 0x12, 0x0e,
0x02, 0x0d, 0x72, 0x65, 0x61, 0x64, 0x2d, 0x6f, 0x6e, 0x6c, 0x79, 0x00,
0x01, 0x5b, 0x82, 0x4a, 0x0a, 0x52, 0x54, 0x43, 0x31, 0x08, 0x5f, 0x48,
0x49, 0x44, 0x0d, 0x31, 0x35, 0x41, 0x43, 0x30, 0x30, 0x30, 0x34, 0x00,
0x08, 0x5f, 0x43, 0x49, 0x44, 0x0d, 0x50, 0x52, 0x50, 0x30, 0x30, 0x30,
0x31, 0x00, 0x08, 0x5f, 0x44, 0x44, 0x4e, 0x0d, 0x4e, 0x41, 0x49, 0x20,
0x4d, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20,
0x57, 0x44, 0x54, 0x20, 0x52, 0x54, 0x43, 0x00, 0x08, 0x5f, 0x43, 0x52,
0x53, 0x11, 0x26, 0x0a, 0x23, 0x8e, 0x1e, 0x00, 0x02, 0x00, 0x01, 0x02,
0x00, 0x00, 0x01, 0x06, 0x00, 0xa0, 0x86, 0x01, 0x00, 0x68, 0x00, 0x5c,
0x5f, 0x53, 0x42, 0x2e, 0x50, 0x43, 0x49, 0x30, 0x2e, 0x49, 0x32, 0x43,
0x30, 0x00, 0x79, 0x00, 0x08, 0x5f, 0x44, 0x53, 0x44, 0x12, 0x37, 0x02,
0x11, 0x13, 0x0a, 0x10, 0x14, 0xd8, 0xff, 0xda, 0xba, 0x6e, 0x8c, 0x4d,
0x8a, 0x91, 0xbc, 0x9b, 0xbf, 0x4a, 0xa3, 0x01, 0x12, 0x20, 0x01, 0x12,
0x1d, 0x02, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x6c,
0x65, 0x00, 0x0d, 0x64, 0x61, 0x6c, 0x6c, 0x61, 0x73, 0x2c, 0x64, 0x73,
0x31, 0x33, 0x37, 0x34, 0x00, 0x5b, 0x82, 0x4e, 0x0a, 0x53, 0x50, 0x49,
0x30, 0x08, 0x5f, 0x41, 0x44, 0x52, 0x0c, 0x02, 0x00, 0x1e, 0x00, 0x5b,
0x82, 0x4c, 0x09, 0x50, 0x52, 0x43, 0x30, 0x08, 0x5f, 0x48, 0x49, 0x44,
0x0d, 0x31, 0x35, 0x41, 0x43, 0x30, 0x30, 0x30, 0x31, 0x00, 0x08, 0x5f,
0x53, 0x54, 0x52, 0x11, 0x42, 0x05, 0x0a, 0x4e, 0x4e, 0x00, 0x41, 0x00,
0x49, 0x00, 0x20, 0x00, 0x47, 0x00, 0x53, 0x00, 0x50, 0x00, 0x49, 0x00,
0x20, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x63, 0x00, 0x65, 0x00,
0x73, 0x00, 0x73, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x20, 0x00, 0x52, 0x00,
0x65, 0x00, 0x67, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65, 0x00,
0x72, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x74, 0x00,
0x72, 0x00, 0x6f, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x72, 0x00,
0x00, 0x00, 0x08, 0x5f, 0x43, 0x52, 0x53, 0x11, 0x29, 0x0a, 0x26, 0x8e,
0x21, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x09, 0x00, 0x20,
0xa1, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x5f, 0x53, 0x42,
0x2e, 0x50, 0x43, 0x49, 0x30, 0x2e, 0x53, 0x50, 0x49, 0x30, 0x00, 0x79,
0x00
};
static const unsigned int acpi_dsdt_aml_len = 542;
static const unsigned int acpi_dsdt_aml_len = 1321;
46 changes: 46 additions & 0 deletions include/x86/fsp_nvs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* fsp_nvs.h
*
* Copyright (C) 2026 wolfSSL Inc.
*
* This file is part of wolfBoot.
*
* wolfBoot is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* wolfBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef FSP_NVS_H
#define FSP_NVS_H

#include <stdint.h>

/* Flash record holding the FSP-M non-volatile storage (memory training)
* data. The key covers the FSP-M revision and the FSP-M UPDs, so a change
* to either invalidates the record. */
#define FSP_NVS_MAGIC 0x5356464BU /* "KFVS" */

struct fsp_nvs_record {
uint32_t magic;
uint32_t key;
uint32_t len;
uint32_t crc;
uint32_t reserved[4];
uint8_t data[];
} __attribute__((packed));

uint32_t fsp_nvs_crc32(uint32_t crc, const uint8_t *buf, uint32_t len);
int fsp_nvs_record_valid(const struct fsp_nvs_record *rec, uint32_t key,
uint32_t area_size);
void fsp_nvs_apply(uint8_t *udp_m, uint32_t udp_size, uint32_t fsp_m_revision);
void fsp_nvs_save(void);

#endif /* FSP_NVS_H */
Loading
Loading