Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x86 fsp backport #443

Merged
merged 96 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
c4e2afd
kontron: update default config to load wolfboot at 1408 MB
rizlik Sep 28, 2023
b663ebe
tpm seal: add define to choose the key id to seal with
rizlik Oct 3, 2023
7f4db82
user_settings: allow multiples HAVE_ECC* defines
rizlik Oct 3, 2023
c3bf126
fsp: stage1: init TPM if TPM_VERIFY = 1 or MEASURED_BOOT = 1
rizlik Oct 3, 2023
7e7c5f3
tgl: fsp: check CPU shutdown mode
rizlik Oct 5, 2023
9c0ca1f
elf: correct newlines
rizlik Oct 9, 2023
abee55e
tpm: policy_sign: fix: modulo by zero
rizlik Oct 9, 2023
ddd7fb1
x86_fsp: qemu: make_hd: allow image from env variable
rizlik Oct 9, 2023
84350a9
x86_fsp: add QEMU test app (ELF 64bit)
rizlik Oct 9, 2023
6d6a9c9
x86_fsp: qemu: add qemu build and test script
rizlik Oct 9, 2023
371c03e
Enhance QEMU scripts
tmael Oct 12, 2023
9f314ce
A few extra minor improvements to scripts
danielinux Oct 12, 2023
e434ddb
x86: ahci: check get_key_sha256() return code
rizlik Oct 20, 2023
bb7d90c
x86: qemu: improve test_qemu.sh script, add it to github action
rizlik Oct 20, 2023
7247d11
x86: sata: separate sata_unlock_disk() as a separate operation
rizlik Oct 25, 2023
bc1e40b
x86: ata: add check on drive number
rizlik Oct 25, 2023
fd457e5
x86: fsp: move stage1 to stage2 related function in a separate file
rizlik Oct 25, 2023
97b3bee
ahci: allow to delete sealed secret on error
rizlik Oct 26, 2023
46b3d82
test_qemu.sh: support rebuild-only testing
rizlik Oct 26, 2023
e7a6262
gpt: support partition label
rizlik Oct 31, 2023
84be0dd
x86_fsp: update qemu script to support GPT labels
rizlik Oct 31, 2023
fdcb83f
x86_fsp: scripts: print output of QEMU during test
rizlik Oct 31, 2023
d89b44e
x86: use hlt instruction in panic()
rizlik Nov 6, 2023
0833c4b
fsp: stage1: use temporary parameters struct in pre-mem stage
rizlik Nov 9, 2023
4bbe43e
x86: support cpu exceptions
rizlik Apr 23, 2024
24067be
tgl: improved GPIO configuration
rizlik Nov 13, 2023
ffb8653
tgl: kontron_vx3060_S2 GPIOs configuration
rizlik Nov 13, 2023
62c938f
x86: tgl: remove binary FSP_S upd parameters
rizlik Nov 23, 2023
70024c4
fsp: tgl: flash BIOS read/write protection
rizlik Nov 23, 2023
b621744
x86: paging: increase Page Table Page to 512
rizlik Dec 20, 2023
2d67742
x86: ahci: make freeze optional in sata_unlock_disk
rizlik Dec 20, 2023
e90ddca
ata: add missing prototypes
rizlik Jan 19, 2024
604ec62
ahci: minor fixes
rizlik Jan 19, 2024
992bb4c
ata: support aync ATA command operation
rizlik Jan 18, 2024
85d6437
ata: enable to compare against master password
rizlik Jan 19, 2024
4b957bd
ahci: sata_disable_password() function
rizlik Jan 19, 2024
311ed5f
sata_get_random_base64: fix: don't "overflow" the '\0' terminator
rizlik Jan 19, 2024
160e402
x86_fsp: fix: printf wrong parameter
rizlik Jan 29, 2024
77211cb
x86_fsp: add tool to print flash map
rizlik Jan 30, 2024
22b1f3e
kontron: fix WOLFBOOT load address to not touch memory <1408MB
rizlik Jan 31, 2024
fe5d1a9
x86_fsp: linker: add KEEP to sections that may be removed by gc
rizlik Feb 8, 2024
1374f79
x86_fsp: linker: remove unused .eh_frame from linking
rizlik Feb 8, 2024
94733b5
arch.mk: x86_fsp: be more precise with symbol parsing
rizlik Feb 8, 2024
d0e6a7e
x86_fsp: enable linker sections garbage collection
rizlik Feb 8, 2024
d7f509b
ata: fix: forward master parameter
rizlik Feb 22, 2024
37e8d7d
ahci: support WOLFBOOT_ATA_DISABLE_USER_PASSWORD compile define
rizlik Apr 23, 2024
7a72bc7
ata: support master password in ata_security_erase_unit()
rizlik Feb 15, 2024
c33c85a
fsp: support printing of FSP Image Revision
rizlik Feb 25, 2024
c94e691
fsp: version bump to 0A.00.7E build 70
rizlik Feb 27, 2024
42d367a
fsp: update MemoryInit parameters
rizlik Mar 5, 2024
ceb7e65
fsp: update SiliconInit parameters
rizlik Mar 5, 2024
8dc8c8c
fsp: tgl: retraing 0.6.0 link after SiliconInit
rizlik Mar 6, 2024
e784c75
ahci: move MASTER_PASSWORD in options.mk as ATA_MASTER_PASSWORD
rizlik Apr 23, 2024
37fb0aa
tpm: include self test wrapper
rizlik Mar 20, 2024
587c745
x86: fsp: add TPM self test
rizlik Mar 20, 2024
0aac8e2
pci: add device present check in pcie_retraining_link()
rizlik Mar 14, 2024
a96b738
ahci: allow ATA_SEC0 on qemu target
rizlik Mar 14, 2024
0e33438
fsp: minor FSP UPD settings adjustments
rizlik Mar 13, 2024
7ce14a2
pci: dump pci bus, lspci format
rizlik Mar 13, 2024
e96babe
refactor: rename stage1.{h,c} in stage2_params.{h,c}
rizlik Mar 14, 2024
0aa8867
fsp: support stage2_get_parameters() helper
rizlik Mar 14, 2024
91bc67c
fsp: add comment on stage2_parameters storage cycle
rizlik Mar 14, 2024
b82b435
x86: paging: fix typo
rizlik Mar 19, 2024
a0e61f3
x86: fsp: fix: remove unused variable
rizlik Mar 19, 2024
71a4306
pci: stage2: uniform parameter-less function prototype
rizlik Mar 20, 2024
9a37b85
pci: fsp: update doxygen comments
rizlik Mar 20, 2024
41efa29
pci: fix: add \r to new line in pci_dump
rizlik Mar 27, 2024
30ed1fa
x86: fsp: tgl: enable usb
rizlik Mar 27, 2024
fc08eac
tpm: fix scan-build not null argument
rizlik Apr 2, 2024
0b5f718
fsp: mk: remove --print-gc-sections flag to reduce build output
rizlik Apr 2, 2024
1959f19
fsp: add pre_mem and pre_silicon cbs()
rizlik Apr 3, 2024
a3cba9e
fsp: tgl: add DEBUG_GPIO capabilities
rizlik Apr 3, 2024
e6cf0b0
fsp: tgl: remove duplicate GPIO
rizlik Apr 3, 2024
af90fd7
fsp: tgl: disable T2 and T3 GPIOs configuration
rizlik Apr 3, 2024
09a2c21
fsp: tgl: staggering GPIOs configuration
rizlik Apr 3, 2024
ccf093d
.gitignore: x86_fsp: add TPM key and intermediate files
rizlik Apr 10, 2024
d072f44
x86_fsp: qemu: remove redundant and unused qemu launch scripts
rizlik Apr 24, 2024
ac1465e
x86_fsp: qemu: move fsp qemu script in tools/x86_fsp/qemu folder
rizlik Apr 24, 2024
4e99075
x86_fsp: remove unused configuration
rizlik Apr 24, 2024
db2b538
tools: qemu64-tpm.sh: make TPM optional
rizlik Apr 24, 2024
9410292
tools: rename qemu64-tpm.sh in the more general qemu.sh
rizlik Apr 24, 2024
6c5efe2
config: examples: use ecc256 and sha256 for basic QEMU FSP example
rizlik Apr 24, 2024
cb9decc
mk: x86_fsp: stage1: don't remove fsp_s_signature file
rizlik Apr 24, 2024
5331244
config: examples: kontron vx3060 s2
rizlik Apr 24, 2024
5fd8094
x86_fsp: add helper script to compute TPM PCR reg
rizlik Apr 24, 2024
96654a3
x86_fsp: tgl: helper script
rizlik Apr 24, 2024
2f4abd5
docs: update QEMU FSP targets documentation
rizlik Apr 24, 2024
a8cbc61
docs: add Kontron VX3060-S2 FSP target
rizlik Apr 24, 2024
943edf9
tools: move tools/x86_fsp in tools/scripts/x86_fsp
rizlik Apr 29, 2024
53d012f
x86_fsp: test_qemu.sh: allow grep to return error when checking output
rizlik Apr 29, 2024
ee4747e
pci: move pcie_retraining_link in boot_x86_fsp
rizlik Apr 29, 2024
a98e74f
fix: user_settings.h: fix typo in ECC521 defines
rizlik Apr 29, 2024
843c86b
ahci: lock the disk if security disabled
rizlik Jan 19, 2024
292e737
docs: add ATA security documentation
rizlik May 2, 2024
3ece783
fixup! docs: add ATA security documentation
rizlik May 8, 2024
5dd9fa9
minor fixes
rizlik May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/test-x86-fsp-qemu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: X86 FSP QEMU test

on:
pull_request:
branches: [ '*' ]
jobs:
fsp_qemu_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: install req
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y -q nasm gcc-multilib qemu-system-x86 swtpm
- name: setup git
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
- name: run test
run: |
./tools/scripts/x86_fsp/qemu/test_qemu.sh
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ CMakeCache.txt

# Stage 1
stage1/loader_stage1.ld
hal/x86_fsp_tgl_stage1.ld
hal/x86_fsp_qemu_stage1.ld

debug/lauterbach

Expand Down Expand Up @@ -177,3 +179,12 @@ IDE/Renesas/e2studio/RZN2L/wolfboot/.secure_azone
IDE/Renesas/e2studio/RZN2L/wolfboot/.secure_xml
IDE/Renesas/e2studio/RZN2L/wolfboot/configuration.xml


tpm_seal_key.key

# FSP downloaded headers
include/x86/fsp/FspUpd.h
include/x86/fsp/FspmUpd.h
include/x86/fsp/FspsUpd.h
include/x86/fsp/FsptUpd.h
include/x86/fsp/MemInfoHob.h
17 changes: 10 additions & 7 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ endif
ifeq ($(filter $(TARGET),x86_fsp_qemu kontron_vx3060_s2),$(TARGET))
FSP=1
CFLAGS+=-DWOLFBOOT_FSP=1
CFLAGS+=-ffunction-sections -fdata-sections
ifeq ($(TARGET), kontron_vx3060_s2)
FSP_TGL=1
CFLAGS+=-DWOLFBOOT_TGL=1
Expand All @@ -675,11 +676,11 @@ ifeq ("${FSP}", "1")
LSCRIPT_IN = ../hal/$(TARGET)_stage1.ld
endif
# using ../wolfboot.map as stage1 is built from stage1 sub-directory
LDFLAGS = --defsym main=`grep main ../wolfboot.map | awk '{print $$1}'` \
--defsym wb_start_bss=`grep _start_bss ../wolfboot.map | awk '{print $$1}'` \
--defsym wb_end_bss=`grep _end_bss ../wolfboot.map | awk '{print $$1}'` \
--defsym _stage2_params=`grep _stage2_params ../wolfboot.map | awk '{print $$1}'`
LDFLAGS += --no-gc-sections --print-gc-sections -T $(LSCRIPT) -m elf_i386 -Map=loader_stage1.map
LDFLAGS = --defsym main=0x`nm ../wolfboot.elf | grep -w main | awk '{print $$1}'` \
--defsym wb_start_bss=0x`nm ../wolfboot.elf | grep -w _start_bss | awk '{print $$1}'` \
--defsym wb_end_bss=0x`nm ../wolfboot.elf | grep -w _end_bss | awk '{print $$1}'` \
--defsym _stage2_params=0x`nm ../wolfboot.elf | grep -w _stage2_params | awk '{print $$1}'`
LDFLAGS += --gc-sections --entry=reset_vector -T $(LSCRIPT) -m elf_i386 -Map=loader_stage1.map
OBJS += src/boot_x86_fsp.o
OBJS += src/boot_x86_fsp_start.o
OBJS += src/fsp_m.o
Expand All @@ -691,6 +692,7 @@ ifeq ("${FSP}", "1")
OBJS += src/pci.o
OBJS += hal/x86_uart.o
OBJS += src/string.o
OBJS += src/stage2_params.o
ifeq ($(filter-out $(STAGE1_AUTH),1),)
OBJS += src/libwolfboot.o
OBJS += src/image.o
Expand All @@ -707,7 +709,6 @@ ifeq ("${FSP}", "1")
CFLAGS += -fno-stack-protector -m32 -fno-PIC -fno-pie -mno-mmx -mno-sse -DDEBUG_UART
ifeq ($(FSP_TGL), 1)
OBJS+=src/x86/tgl_fsp.o
OBJS+=src/fsp_tgl_s_upd.o
OBJS+=src/ucode0.o
CFLAGS += -DUCODE0_ADDRESS=$(UCODE0_BASE)
endif
Expand All @@ -721,7 +722,7 @@ ifeq ("${FSP}", "1")
else
LSCRIPT_IN = hal/$(TARGET).ld.in
endif
LDFLAGS = --no-gc-sections --print-gc-sections -T $(LSCRIPT) -Map=wolfboot.map
LDFLAGS = --gc-sections --entry=main -T $(LSCRIPT) -Map=wolfboot.map
CFLAGS += -fno-stack-protector -fno-PIC -fno-pie -mno-mmx -mno-sse -Os -DDEBUG_UART
OBJS += hal/x86_fsp_tgl.o
OBJS += hal/x86_uart.o
Expand All @@ -733,6 +734,8 @@ ifeq ("${FSP}", "1")
OBJS += src/x86/ata.o
OBJS += src/x86/gpt.o
OBJS += src/x86/mptable.o
OBJS += src/stage2_params.o
OBJS += src/x86/exceptions.o
UPDATE_OBJS := src/update_disk.o
ifeq ($(64BIT),1)
LDFLAGS += -m elf_x86_64 --oformat elf64-x86-64
Expand Down
20 changes: 10 additions & 10 deletions config/examples/kontron_vx3060_s2.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARCH=x86_64
TARGET=kontron_vx3060_s2
WOLFBOOT_SMALL_STACK=0
SIGN=ECC256
SIGN=ECC384
HASH=SHA256
DEBUG=1
SPMATH=1
Expand All @@ -14,17 +14,15 @@ WOLFBOOT_PARTITION_BOOT_ADDRESS=0xff400000
WOLFBOOT_PARTITION_SWAP_ADDRESS=0x0
WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x0

# 128mb
WOLFBOOT_LOAD_BASE=0x8000000
WOLFBOOT_LOAD_ADDRESS=0x1000000
# 1408mb + 0x200 (For the header)
WOLFBOOT_LOAD_BASE=0x58000200

# required for keytools
WOLFBOOT_SECTOR_SIZE?=0x1000
WOLFBOOT_DATA_ADDRESS=0x1000000


FSP_S_BASE=0xffea0000
FSP_S_UPD_DATA_BASE=0xffd00000
FSP_T_BASE=0xfff59000
FSP_M_BASE=0xfff60000

Expand Down Expand Up @@ -59,8 +57,10 @@ MULTIBOOT2=1

FSP_S_LOAD_BASE=0x0FED5F00
STAGE1_AUTH=1
# MEASURED_BOOT=1
# MEASURED_PCR_A=0
# DISK_LOCK=1
# WOLFTPM=1
# WOLFBOOT_TPM_SEAL=1
MEASURED_BOOT=1
MEASURED_PCR_A=0
DISK_LOCK=0
WOLFTPM=1
WOLFBOOT_TPM_SEAL=1
WOLFBOOT_TPM_SEAL_KEY_ID=1
WOLFBOOT_UNIVERSAL_KEYSTORE=1
15 changes: 7 additions & 8 deletions config/examples/x86_fsp_qemu.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARCH=x86_64
TARGET=x86_fsp_qemu
WOLFBOOT_SMALL_STACK=1
SIGN?=ECC384
HASH?=SHA384
SIGN=ECC256
HASH=SHA256
DEBUG=1
SPMATH=1
FORCE_32BIT=1
Expand All @@ -16,9 +16,6 @@ WOLFTPM=0
#WOLFBOOT_TPM_POLICY_NV_INDEX?=0x01800201

# 4gb - 8mb
WOLFBOOT_PARTITION_BOOT_ADDRESS=0xff800000
WOLFBOOT_PARTITION_SWAP_ADDRESS=0x0
WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x0
WOLFBOOT_LOAD_BASE=0x2000000
WOLFBOOT_LOAD_ADDRESS=0x1000000

Expand All @@ -30,13 +27,15 @@ FSP_M_BASE=0xffe30000
FSP_S_BASE=0xffed6000
FSP_T_BASE=0xfffe0000
FSP_S_LOAD_BASE=0x0FED5F00
WOLFBOOT_ORIGIN=0xfffa0000
LINUX_PAYLOAD=1
WOLFBOOT_ORIGIN=0xfff80000

BOOTLOADER_PARTITION_SIZE=0xa0000
BOOTLOADER_PARTITION_SIZE=0xe0000
BIOS_REGION_SIZE=0x800000
MACHINE_OBJ=src/x86/qemu_fsp.o
FSP_T_BIN=./src/x86/fsp_t.bin
FSP_M_BIN=./src/x86/fsp_m.bin
FSP_S_BIN=./src/x86/fsp_s.bin
STAGE1_AUTH=1
64BIT=1
ELF=1
MULTIBOOT2=1
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
ARCH=x86_64
TARGET=x86_fsp_qemu
WOLFBOOT_SMALL_STACK=0
SIGN?=ECC256
HASH?=SHA256
SIGN=ECC384
HASH=SHA256
DEBUG=1
SPMATH=1
FORCE_32BIT=1
ENCRYPTION=0
WOLFBOOT_NO_PARTITIONS=1
WOLFTPM=1

# Measured boot
MEASURED_BOOT=1
MEASURED_PCR_A=0
WOLFBOOT_TPM_SEAL=1
DISK_LOCK=1

# TPM Keystore options
#WOLFBOOT_TPM_KEYSTORE?=1
#WOLFBOOT_TPM_KEYSTORE_NV_BASE?=0x01800200
#WOLFBOOT_TPM_POLICY_NV_INDEX?=0x01800201

# 4gb - 8mb
WOLFBOOT_PARTITION_BOOT_ADDRESS=0xff800000
WOLFBOOT_PARTITION_SWAP_ADDRESS=0x0
WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x0
WOLFBOOT_LOAD_BASE=0x2000000
WOLFBOOT_LOAD_ADDRESS=0x1000000

Expand All @@ -36,13 +27,22 @@ FSP_M_BASE=0xffe30000
FSP_S_BASE=0xffed6000
FSP_T_BASE=0xfffe0000
FSP_S_LOAD_BASE=0x0FED5F00
WOLFBOOT_ORIGIN=0xfff90000
LINUX_PAYLOAD=1
WOLFBOOT_ORIGIN=0xfff80000

BOOTLOADER_PARTITION_SIZE=0xb0000
BOOTLOADER_PARTITION_SIZE=0xe0000
BIOS_REGION_SIZE=0x800000
MACHINE_OBJ=src/x86/qemu_fsp.o
FSP_T_BIN=./src/x86/fsp_t.bin
FSP_M_BIN=./src/x86/fsp_m.bin
FSP_S_BIN=./src/x86/fsp_s.bin

STAGE1_AUTH=1
64BIT=1
ELF=1
MULTIBOOT2=1
MEASURED_BOOT=1
MEASURED_PCR_A=0
WOLFBOOT_TPM_SEAL=1
WOLFBOOT_TPM_SEAL_KEY_ID=1
DISK_LOCK=1
WOLFBOOT_UNIVERSAL_KEYSTORE=1
42 changes: 0 additions & 42 deletions config/examples/x86_fsp_qemu_stage1_auth.config

This file was deleted.

40 changes: 0 additions & 40 deletions config/examples/x86_fsp_qemu_tpm_keystore.config

This file was deleted.