blob: 01bbe7b8f9ee747a23bb3abc5124433088391295 [file] [log] [blame]
Arthur Heymans6d3682e2023-07-13 12:34:04 +02001## SPDX-License-Identifier: GPL-2.0-only
Felix Heldd123f8d2023-12-15 10:57:30 +01002ifeq ($(CONFIG_SOC_AMD_GENOA_POC),y)
Arthur Heymans6d3682e2023-07-13 12:34:04 +02003
Arthur Heymanse4eba132023-07-13 14:02:42 +02004all-y += mmap_boot.c
Arthur Heymansb4aaa6f2023-07-13 14:11:18 +02005all-y += reset.c
Arthur Heymansc5c35ce2023-07-13 14:05:08 +02006all-y += config.c
Varshit Pandya95d78d92023-10-04 19:30:21 +05307all-y += gpio.c
Felix Heldd26f5a12023-11-20 16:31:31 +01008all-y += i2c.c
Varshit Pandya970d7702023-10-06 18:14:02 +05309all-y += uart.c
Arthur Heymanse4eba132023-07-13 14:02:42 +020010
Arthur Heymans6d3682e2023-07-13 12:34:04 +020011bootblock-y += early_fch.c
Arthur Heymans4da9d6b42023-07-13 14:19:09 +020012bootblock-y += aoac.c
Arthur Heymans6d3682e2023-07-13 12:34:04 +020013
Felix Heldd1065a32023-12-12 19:36:55 +010014ramstage-y += acpi.c
Arthur Heymans4da9d6b42023-07-13 14:19:09 +020015ramstage-y += aoac.c
Arthur Heymans6d3682e2023-07-13 12:34:04 +020016ramstage-y += chip.c
Arthur Heymans2e2f1662023-07-14 22:58:49 +020017ramstage-y += cpu.c
Felix Held926887c2023-10-13 21:19:53 +020018ramstage-y += domain.c
Felix Held80434a62023-12-13 23:11:45 +010019ramstage-y += fch.c
Felix Heldbe9fcf12023-08-23 22:15:39 +020020ramstage-y += root_complex.c
Arthur Heymans2e2f1662023-07-14 22:58:49 +020021ramstage-y += smihandler.c
Arthur Heymans447e2792023-07-14 23:05:46 +020022ramstage-y += mca.c
Arthur Heymans2e2f1662023-07-14 22:58:49 +020023
24smm-y += smihandler.c
Arthur Heymans6d3682e2023-07-13 12:34:04 +020025
Felix Heldd123f8d2023-12-15 10:57:30 +010026CPPFLAGS_common += -I$(src)/soc/amd/genoa_poc/acpi
27CPPFLAGS_common += -I$(src)/soc/amd/genoa_poc/include
Arthur Heymans6d3682e2023-07-13 12:34:04 +020028
Arthur Heymans926d55c2023-07-13 12:50:45 +020029ifeq ($(call int-gt, $(CONFIG_ROM_SIZE) 0x1000000), 1)
30CBFSTOOL_ADD_CMD_OPTIONS+= --mmap 0:0xff000000:0x1000000
31endif
32
Arthur Heymans8f1c7072023-07-13 12:52:49 +020033#
34# PSP Directory Table items
35#
36# Certain ordering requirements apply, however these are ensured by amdfwtool.
37# For more information see "AMD Platform Security Processor BIOS Implementation
38# Guide for Server EPYC Processors" #57299
39#
40
41FIRMWARE_LOCATION=$(shell grep -e FIRMWARE_LOCATION $(CONFIG_AMDFW_CONFIG_FILE) | awk '{print $$2}')
42
43ifeq ($(CONFIG_PSP_DISABLE_POSTCODES),y)
44PSP_SOFTFUSE_BITS += 7
45endif
46
47ifeq ($(CONFIG_PSP_UNLOCK_SECURE_DEBUG),y)
48# Enable secure debug unlock
49PSP_SOFTFUSE_BITS += 0
50OPT_TOKEN_UNLOCK="--token-unlock"
51endif
52
53# Use additional Soft Fuse bits specified in Kconfig
54PSP_SOFTFUSE_BITS += $(call strip_quotes, $(CONFIG_PSP_SOFTFUSE_BITS))
55
56# type = 0x3a
57ifeq ($(CONFIG_HAVE_PSP_WHITELIST_FILE),y)
58PSP_WHITELIST_FILE=$(CONFIG_PSP_WHITELIST_FILE)
59endif
60
61# type = 0x55
Arthur Heymans8f1c7072023-07-13 12:52:49 +020062SPL_TABLE_FILE=$(CONFIG_SPL_TABLE_FILE)
Arthur Heymans8f1c7072023-07-13 12:52:49 +020063
64#
65# BIOS Directory Table items - proper ordering is managed by amdfwtool
66#
67
68# type = 0x60
69PSP_APCB_FILES=$(APCB_SOURCES) $(APCB1_SOURCES) $(APCB_SOURCES_RECOVERY) $(APCB_SOURCES_RECOVERY1) $(APCB_SOURCES_RECOVERY2)
70
71# type = 0x61
72PSP_APOB_BASE=$(CONFIG_PSP_APOB_DRAM_ADDRESS)
73
74# type = 0x62
75PSP_BIOSBIN_FILE=$(obj)/amd_biospsp.img
76PSP_ELF_FILE=$(objcbfs)/bootblock.elf
77PSP_BIOSBIN_SIZE=$(shell $(READELF_bootblock) -Wl $(PSP_ELF_FILE) | grep LOAD | awk '{print $$5}')
78PSP_BIOSBIN_DEST=$(shell $(READELF_bootblock) -Wl $(PSP_ELF_FILE) | grep LOAD | awk '{print $$3}')
79
80# Helper function to return a value with given bit set
81# Soft Fuse type = 0xb - See #57299 (NDA) for bit definitions.
82set-bit=$(call int-shift-left, 1 $(call _toint,$1))
83PSP_SOFTFUSE=$(shell A=$(call int-add, \
Matt DeVillier0daefa52023-10-30 20:58:41 -050084 $(foreach bit,$(sort $(PSP_SOFTFUSE_BITS)),$(call set-bit,$(bit)))); printf "0x%x" $$A)
Arthur Heymans8f1c7072023-07-13 12:52:49 +020085
86#
87# Build the arguments to amdfwtool (order is unimportant). Missing file names
88# result in empty OPT_ variables, i.e. the argument is not passed to amdfwtool.
89#
90
91add_opt_prefix=$(if $(call strip_quotes, $(1)), $(2) $(call strip_quotes, $(1)), )
92
93OPT_PSP_APCB_FILES= $(if $(APCB_SOURCES), --instance 0 --apcb $(APCB_SOURCES)) \
94 $(if $(APCB_SOURCES1), --instance 1 --apcb $(APCB_SOURCES1)) \
95 $(if $(APCB_SOURCES_RECOVERY), --instance 10 --apcb $(APCB_SOURCES_RECOVERY)) \
96 $(if $(APCB_SOURCES_RECOVERY1), --instance 18 --apcb $(APCB_SOURCES_RECOVERY1)) \
97 $(if $(APCB_SOURCES_RECOVERY2), --instance 19 --apcb $(APCB_SOURCES_RECOVERY2)) \
98 $(if $(APCB_SOURCES_68), --instance 18 --apcb $(APCB_SOURCES_68))
99
100OPT_APOB_ADDR=$(call add_opt_prefix, $(PSP_APOB_BASE), --apob-base)
101OPT_PSP_BIOSBIN_FILE=$(call add_opt_prefix, $(PSP_BIOSBIN_FILE), --bios-bin)
102OPT_PSP_BIOSBIN_DEST=$(call add_opt_prefix, $(PSP_BIOSBIN_DEST), --bios-bin-dest)
103OPT_PSP_BIOSBIN_SIZE=$(call add_opt_prefix, $(PSP_BIOSBIN_SIZE), --bios-uncomp-size)
104
105OPT_EFS_SPI_READ_MODE=$(call add_opt_prefix, $(CONFIG_EFS_SPI_READ_MODE), --spi-read-mode)
106OPT_EFS_SPI_SPEED=$(call add_opt_prefix, $(CONFIG_EFS_SPI_SPEED), --spi-speed)
107OPT_EFS_SPI_MICRON_FLAG=$(call add_opt_prefix, $(CONFIG_EFS_SPI_MICRON_FLAG), --spi-micron-flag)
108OPT_PSP_SOFTFUSE=$(call add_opt_prefix, $(PSP_SOFTFUSE), --soft-fuse)
109
110OPT_WHITELIST_FILE=$(call add_opt_prefix, $(PSP_WHITELIST_FILE), --whitelist)
111OPT_SPL_TABLE_FILE=$(call add_opt_prefix, $(SPL_TABLE_FILE), --spl-table)
112
113AMDFW_COMMON_ARGS=$(OPT_PSP_APCB_FILES) \
114 $(OPT_APOB_ADDR) \
115 $(OPT_DEBUG_AMDFWTOOL) \
116 $(OPT_PSP_BIOSBIN_FILE) \
117 $(OPT_PSP_BIOSBIN_DEST) \
118 $(OPT_PSP_BIOSBIN_SIZE) \
119 $(OPT_PSP_SOFTFUSE) \
120 --use-pspsecureos \
121 $(OPT_TOKEN_UNLOCK) \
122 $(OPT_WHITELIST_FILE) \
123 $(OPT_SPL_TABLE_FILE) \
124 $(OPT_EFS_SPI_READ_MODE) \
125 $(OPT_EFS_SPI_SPEED) \
126 $(OPT_EFS_SPI_MICRON_FLAG) \
127 --config $(CONFIG_AMDFW_CONFIG_FILE) \
128 --flashsize 0x1000000
129
130$(obj)/amdfw.rom: $(call strip_quotes, $(PSP_BIOSBIN_FILE)) \
131 $$(PSP_APCB_FILES) \
132 $(DEP_FILES) \
133 $(AMDFWTOOL) \
134 $(obj)/fmap_config.h \
135 $(objcbfs)/bootblock.elf # this target also creates the .map file
136 $(if $(PSP_APCB_FILES), ,$(error APCB_SOURCES is not set))
137 rm -f $@
138 @printf " AMDFWTOOL $(subst $(obj)/,,$(@))\n"
139 $(AMDFWTOOL) \
140 $(AMDFW_COMMON_ARGS) \
141 --location $(CONFIG_AMD_FWM_POSITION) \
142 --multilevel \
143 --output $@
144
145$(PSP_BIOSBIN_FILE): $(PSP_ELF_FILE) $(AMDCOMPRESS)
146 rm -f $@
147 @printf " AMDCOMPRS $(subst $(obj)/,,$(@))\n"
148 $(AMDCOMPRESS) --infile $(PSP_ELF_FILE) --outfile $@ --compress \
149 --maxsize $(PSP_BIOSBIN_SIZE)
150
Arthur Heymans6d3682e2023-07-13 12:34:04 +0200151endif