Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: BSD-3-Clause |
| 2 | |
| 3 | # TODO: Check if this is still correct |
| 4 | |
Jon Murphy | 4f73242 | 2022-08-05 15:43:44 -0600 | [diff] [blame] | 5 | ifeq ($(CONFIG_SOC_AMD_MENDOCINO),y) |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 6 | |
| 7 | subdirs-$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK) += psp_verstage |
| 8 | |
| 9 | # Beware that all-y also adds the compilation unit to verstage on PSP |
| 10 | all-y += config.c |
| 11 | all-y += aoac.c |
| 12 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 13 | bootblock-y += early_fch.c |
Raul E Rangel | d0b059f | 2022-03-24 17:04:11 -0600 | [diff] [blame] | 14 | bootblock-y += espi_util.c |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 15 | bootblock-y += gpio.c |
| 16 | bootblock-y += i2c.c |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 17 | bootblock-y += uart.c |
| 18 | |
| 19 | verstage-y += i2c.c |
Karthikeyan Ramasubramanian | a99c9e3 | 2022-07-14 14:52:00 -0600 | [diff] [blame] | 20 | verstage-y += espi_util.c |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 21 | verstage_x86-y += gpio.c |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 22 | verstage_x86-y += uart.c |
| 23 | |
| 24 | romstage-y += fsp_m_params.c |
| 25 | romstage-y += gpio.c |
| 26 | romstage-y += i2c.c |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 27 | romstage-y += romstage.c |
| 28 | romstage-y += uart.c |
| 29 | |
| 30 | ramstage-y += acpi.c |
| 31 | ramstage-y += agesa_acpi.c |
| 32 | ramstage-y += chip.c |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 33 | ramstage-y += cpu.c |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 34 | ramstage-y += fch.c |
| 35 | ramstage-y += fsp_s_params.c |
| 36 | ramstage-y += gpio.c |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 37 | ramstage-y += i2c.c |
| 38 | ramstage-y += mca.c |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 39 | ramstage-y += root_complex.c |
| 40 | ramstage-y += uart.c |
| 41 | ramstage-y += xhci.c |
| 42 | |
| 43 | smm-y += gpio.c |
| 44 | smm-y += smihandler.c |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 45 | smm-$(CONFIG_DEBUG_SMI) += uart.c |
| 46 | |
Jon Murphy | 4f73242 | 2022-08-05 15:43:44 -0600 | [diff] [blame] | 47 | CPPFLAGS_common += -I$(src)/soc/amd/mendocino/include |
| 48 | CPPFLAGS_common += -I$(src)/soc/amd/mendocino/acpi |
| 49 | CPPFLAGS_common += -I$(src)/vendorcode/amd/fsp/mendocino |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 50 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 51 | # ROMSIG Normally At ROMBASE + 0x20000 |
| 52 | # Overridden by CONFIG_AMD_FWM_POSITION_INDEX |
| 53 | # +-----------+---------------+----------------+------------+ |
| 54 | # |0x55AA55AA | | | | |
| 55 | # +-----------+---------------+----------------+------------+ |
| 56 | # | | PSPDIR ADDR | BIOSDIR ADDR | |
| 57 | # +-----------+---------------+----------------+ |
| 58 | |
| 59 | $(if $(CONFIG_AMD_FWM_POSITION_INDEX), ,\ |
| 60 | $(error Invalid AMD firmware position index. Check if the board sets a valid ROM size)) |
| 61 | |
Jon Murphy | 4f73242 | 2022-08-05 15:43:44 -0600 | [diff] [blame] | 62 | MENDOCINO_FWM_POSITION=$(call int-add, \ |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 63 | $(call int-subtract, 0xffffffff \ |
| 64 | $(call int-shift-left, \ |
| 65 | 0x80000 $(CONFIG_AMD_FWM_POSITION_INDEX))) 0x20000 1) |
| 66 | |
Karthikeyan Ramasubramanian | e30e4f5 | 2022-08-16 17:39:41 -0600 | [diff] [blame] | 67 | # 0x80 accounts for the cbfs_file struct + filename + metadata structs, aligned to 64 bytes |
Robert Zieba | b26d005 | 2022-01-24 16:37:47 -0700 | [diff] [blame] | 68 | # Building the cbfs image will fail if the offset isn't large enough |
Karthikeyan Ramasubramanian | e30e4f5 | 2022-08-16 17:39:41 -0600 | [diff] [blame] | 69 | AMD_FW_AB_POSITION := 0x80 |
Robert Zieba | b26d005 | 2022-01-24 16:37:47 -0700 | [diff] [blame] | 70 | |
Jon Murphy | 4f73242 | 2022-08-05 15:43:44 -0600 | [diff] [blame] | 71 | MENDOCINO_FW_A_POSITION=$(call int-add, \ |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 72 | $(shell awk '$$2 == "FMAP_SECTION_FW_MAIN_A_START" {print $$3}' $(obj)/fmap_config.h) \ |
Robert Zieba | b26d005 | 2022-01-24 16:37:47 -0700 | [diff] [blame] | 73 | $(AMD_FW_AB_POSITION)) |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 74 | |
Jon Murphy | 4f73242 | 2022-08-05 15:43:44 -0600 | [diff] [blame] | 75 | MENDOCINO_FW_B_POSITION=$(call int-add, \ |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 76 | $(shell awk '$$2 == "FMAP_SECTION_FW_MAIN_B_START" {print $$3}' $(obj)/fmap_config.h) \ |
Robert Zieba | b26d005 | 2022-01-24 16:37:47 -0700 | [diff] [blame] | 77 | $(AMD_FW_AB_POSITION)) |
Karthikeyan Ramasubramanian | 716c8f0 | 2022-12-15 14:57:05 -0700 | [diff] [blame] | 78 | |
| 79 | MENDOCINO_FW_BODY_OFFSET := 0x100 |
| 80 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 81 | # |
| 82 | # PSP Directory Table items |
| 83 | # |
| 84 | # Certain ordering requirements apply, however these are ensured by amdfwtool. |
| 85 | # For more information see "AMD Platform Security Processor BIOS Architecture |
| 86 | # Design Guide for AMD Family 17h Processors" (PID #55758, NDA only). |
| 87 | # |
| 88 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 89 | ifeq ($(CONFIG_PSP_DISABLE_POSTCODES),y) |
| 90 | PSP_SOFTFUSE_BITS += 7 |
| 91 | endif |
| 92 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 93 | ifeq ($(CONFIG_PSP_UNLOCK_SECURE_DEBUG),y) |
| 94 | # Enable secure debug unlock |
| 95 | PSP_SOFTFUSE_BITS += 0 |
| 96 | OPT_TOKEN_UNLOCK="--token-unlock" |
| 97 | endif |
| 98 | |
| 99 | ifeq ($(CONFIG_PSP_LOAD_MP2_FW),y) |
| 100 | OPT_PSP_LOAD_MP2_FW="--load-mp2-fw" |
| 101 | else |
| 102 | # Disable MP2 firmware loading |
| 103 | PSP_SOFTFUSE_BITS += 29 |
| 104 | endif |
| 105 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 106 | # Use additional Soft Fuse bits specified in Kconfig |
| 107 | PSP_SOFTFUSE_BITS += $(call strip_quotes, $(CONFIG_PSP_SOFTFUSE_BITS)) |
| 108 | |
| 109 | # type = 0x3a |
| 110 | ifeq ($(CONFIG_HAVE_PSP_WHITELIST_FILE),y) |
| 111 | PSP_WHITELIST_FILE=$(CONFIG_PSP_WHITELIST_FILE) |
| 112 | endif |
| 113 | |
Karthikeyan Ramasubramanian | 8ee9429 | 2022-04-01 17:21:14 -0600 | [diff] [blame] | 114 | # type = 0x55 |
| 115 | ifeq ($(CONFIG_HAVE_SPL_FILE),y) |
| 116 | SPL_TABLE_FILE=$(CONFIG_SPL_TABLE_FILE) |
Felix Held | 40a38cc | 2022-09-12 16:18:45 +0200 | [diff] [blame] | 117 | ifeq ($(CONFIG_HAVE_SPL_RW_AB_FILE),y) |
| 118 | SPL_RW_AB_TABLE_FILE=$(CONFIG_SPL_RW_AB_TABLE_FILE) |
| 119 | else |
| 120 | SPL_RW_AB_TABLE_FILE=$(CONFIG_SPL_TABLE_FILE) |
| 121 | endif |
Karthikeyan Ramasubramanian | 8ee9429 | 2022-04-01 17:21:14 -0600 | [diff] [blame] | 122 | endif |
| 123 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 124 | # |
| 125 | # BIOS Directory Table items - proper ordering is managed by amdfwtool |
| 126 | # |
| 127 | |
| 128 | # type = 0x60 |
| 129 | PSP_APCB_FILES=$(APCB_SOURCES) $(APCB_SOURCES_RECOVERY) |
| 130 | |
| 131 | # type = 0x61 |
| 132 | PSP_APOB_BASE=$(CONFIG_PSP_APOB_DRAM_ADDRESS) |
| 133 | |
| 134 | # type = 0x62 |
| 135 | PSP_BIOSBIN_FILE=$(obj)/amd_biospsp.img |
| 136 | PSP_ELF_FILE=$(objcbfs)/bootblock.elf |
Felix Held | 3b89c95 | 2022-11-22 20:02:46 +0100 | [diff] [blame] | 137 | PSP_BIOSBIN_SIZE=$(shell $(READELF_bootblock) -Wl $(PSP_ELF_FILE) | grep LOAD | awk '{print $$5}') |
| 138 | PSP_BIOSBIN_DEST=$(shell $(READELF_bootblock) -Wl $(PSP_ELF_FILE) | grep LOAD | awk '{print $$3}') |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 139 | |
| 140 | # type = 0x63 - construct APOB NV base/size from flash map |
| 141 | # The flashmap section used for this is expected to be named RW_MRC_CACHE |
| 142 | APOB_NV_SIZE=$(shell awk '$$2 == "FMAP_SECTION_RW_MRC_CACHE_SIZE" {print $$3}' $(obj)/fmap_config.h) |
| 143 | APOB_NV_BASE=$(shell awk '$$2 == "FMAP_SECTION_RW_MRC_CACHE_START" {print $$3}' $(obj)/fmap_config.h) |
| 144 | |
| 145 | ifeq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) |
| 146 | # type = 0x6B - PSP Shared memory location |
| 147 | ifneq ($(CONFIG_PSP_SHAREDMEM_SIZE),0x0) |
| 148 | PSP_SHAREDMEM_SIZE=$(CONFIG_PSP_SHAREDMEM_SIZE) |
| 149 | PSP_SHAREDMEM_BASE=$(shell awk '$$3 == "_psp_sharedmem_dram" {printf "0x" $$1}' $(objcbfs)/bootblock.map) |
| 150 | endif |
| 151 | |
| 152 | # type = 0x52 - PSP Bootloader Userspace Application (verstage) |
| 153 | PSP_VERSTAGE_FILE=$(call strip_quotes,$(CONFIG_PSP_VERSTAGE_FILE)) |
| 154 | PSP_VERSTAGE_SIG_FILE=$(call strip_quotes,$(CONFIG_PSP_VERSTAGE_SIGNING_TOKEN)) |
| 155 | endif # CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK |
| 156 | |
Karthikeyan Ramasubramanian | 6e44364 | 2022-08-25 16:13:17 -0600 | [diff] [blame] | 157 | ifeq ($(CONFIG_SEPARATE_SIGNED_PSPFW),y) |
| 158 | SIGNED_AMDFW_A_POSITION=$(call int-subtract, \ |
| 159 | $(shell awk '$$2 == "FMAP_SECTION_SIGNED_AMDFW_A_START" {print $$3}' $(obj)/fmap_config.h) \ |
| 160 | $(shell awk '$$2 == "FMAP_SECTION_FLASH_START" {print $$3}' $(obj)/fmap_config.h)) |
| 161 | SIGNED_AMDFW_B_POSITION=$(call int-subtract, \ |
| 162 | $(shell awk '$$2 == "FMAP_SECTION_SIGNED_AMDFW_B_START" {print $$3}' $(obj)/fmap_config.h) \ |
| 163 | $(shell awk '$$2 == "FMAP_SECTION_FLASH_START" {print $$3}' $(obj)/fmap_config.h)) |
| 164 | SIGNED_AMDFW_A_FILE=$(obj)/amdfw_a.rom.signed |
| 165 | SIGNED_AMDFW_B_FILE=$(obj)/amdfw_b.rom.signed |
| 166 | endif # CONFIG_SEPARATE_SIGNED_PSPFW |
| 167 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 168 | # Helper function to return a value with given bit set |
| 169 | # Soft Fuse type = 0xb - See #55758 (NDA) for bit definitions. |
| 170 | set-bit=$(call int-shift-left, 1 $(call _toint,$1)) |
| 171 | PSP_SOFTFUSE=$(shell A=$(call int-add, \ |
| 172 | $(foreach bit,$(PSP_SOFTFUSE_BITS),$(call set-bit,$(bit)))); printf "0x%x" $$A) |
| 173 | |
| 174 | # |
| 175 | # Build the arguments to amdfwtool (order is unimportant). Missing file names |
| 176 | # result in empty OPT_ variables, i.e. the argument is not passed to amdfwtool. |
| 177 | # |
| 178 | |
| 179 | add_opt_prefix=$(if $(call strip_quotes, $(1)), $(2) $(call strip_quotes, $(1)), ) |
| 180 | |
| 181 | OPT_VERSTAGE_FILE=$(call add_opt_prefix, $(PSP_VERSTAGE_FILE), --verstage) |
| 182 | OPT_VERSTAGE_SIG_FILE=$(call add_opt_prefix, $(PSP_VERSTAGE_SIG_FILE), --verstage_sig) |
| 183 | |
| 184 | OPT_PSP_APCB_FILES= $(if $(APCB_SOURCES), --instance 0 --apcb $(APCB_SOURCES)) \ |
| 185 | $(if $(APCB_SOURCES_RECOVERY), --instance 10 --apcb $(APCB_SOURCES_RECOVERY)) \ |
| 186 | $(if $(APCB_SOURCES_68), --instance 18 --apcb $(APCB_SOURCES_68)) |
| 187 | |
| 188 | OPT_APOB_ADDR=$(call add_opt_prefix, $(PSP_APOB_BASE), --apob-base) |
| 189 | OPT_PSP_BIOSBIN_FILE=$(call add_opt_prefix, $(PSP_BIOSBIN_FILE), --bios-bin) |
| 190 | OPT_PSP_BIOSBIN_DEST=$(call add_opt_prefix, $(PSP_BIOSBIN_DEST), --bios-bin-dest) |
| 191 | OPT_PSP_BIOSBIN_SIZE=$(call add_opt_prefix, $(PSP_BIOSBIN_SIZE), --bios-uncomp-size) |
| 192 | |
| 193 | OPT_PSP_SHAREDMEM_BASE=$(call add_opt_prefix, $(PSP_SHAREDMEM_BASE), --sharedmem) |
| 194 | OPT_PSP_SHAREDMEM_SIZE=$(call add_opt_prefix, $(PSP_SHAREDMEM_SIZE), --sharedmem-size) |
| 195 | OPT_APOB_NV_SIZE=$(call add_opt_prefix, $(APOB_NV_SIZE), --apob-nv-size) |
| 196 | OPT_APOB_NV_BASE=$(call add_opt_prefix, $(APOB_NV_BASE),--apob-nv-base) |
| 197 | OPT_EFS_SPI_READ_MODE=$(call add_opt_prefix, $(CONFIG_EFS_SPI_READ_MODE), --spi-read-mode) |
| 198 | OPT_EFS_SPI_SPEED=$(call add_opt_prefix, $(CONFIG_EFS_SPI_SPEED), --spi-speed) |
| 199 | OPT_EFS_SPI_MICRON_FLAG=$(call add_opt_prefix, $(CONFIG_EFS_SPI_MICRON_FLAG), --spi-micron-flag) |
| 200 | |
Karthikeyan Ramasubramanian | 6e44364 | 2022-08-25 16:13:17 -0600 | [diff] [blame] | 201 | OPT_SIGNED_AMDFW_A_POSITION=$(call add_opt_prefix, $(SIGNED_AMDFW_A_POSITION), --signed-addr) |
| 202 | OPT_SIGNED_AMDFW_A_FILE=$(call add_opt_prefix, $(SIGNED_AMDFW_A_FILE), --signed-output) |
| 203 | OPT_SIGNED_AMDFW_B_POSITION=$(call add_opt_prefix, $(SIGNED_AMDFW_B_POSITION), --signed-addr) |
| 204 | OPT_SIGNED_AMDFW_B_FILE=$(call add_opt_prefix, $(SIGNED_AMDFW_B_FILE), --signed-output) |
| 205 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 206 | OPT_PSP_SOFTFUSE=$(call add_opt_prefix, $(PSP_SOFTFUSE), --soft-fuse) |
| 207 | |
| 208 | OPT_WHITELIST_FILE=$(call add_opt_prefix, $(PSP_WHITELIST_FILE), --whitelist) |
Karthikeyan Ramasubramanian | 8ee9429 | 2022-04-01 17:21:14 -0600 | [diff] [blame] | 209 | OPT_SPL_TABLE_FILE=$(call add_opt_prefix, $(SPL_TABLE_FILE), --spl-table) |
Felix Held | 40a38cc | 2022-09-12 16:18:45 +0200 | [diff] [blame] | 210 | OPT_SPL_RW_AB_TABLE_FILE=$(call add_opt_prefix, $(SPL_RW_AB_TABLE_FILE), --spl-table) |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 211 | |
Karthikeyan Ramasubramanian | 176b563 | 2022-04-08 17:40:50 -0600 | [diff] [blame] | 212 | # If vboot uses 2 RW slots, then 2 copies of PSP binaries are redundant |
| 213 | OPT_RECOVERY_AB_SINGLE_COPY=$(if $(CONFIG_VBOOT_SLOTS_RW_AB), --recovery-ab-single-copy) |
| 214 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 215 | AMDFW_COMMON_ARGS=$(OPT_PSP_APCB_FILES) \ |
| 216 | $(OPT_APOB_ADDR) \ |
| 217 | $(OPT_PSP_BIOSBIN_FILE) \ |
| 218 | $(OPT_PSP_BIOSBIN_DEST) \ |
| 219 | $(OPT_PSP_BIOSBIN_SIZE) \ |
| 220 | $(OPT_PSP_SOFTFUSE) \ |
| 221 | $(OPT_PSP_LOAD_MP2_FW) \ |
| 222 | --use-pspsecureos \ |
| 223 | --load-s0i3 \ |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 224 | $(OPT_TOKEN_UNLOCK) \ |
| 225 | $(OPT_WHITELIST_FILE) \ |
| 226 | $(OPT_PSP_SHAREDMEM_BASE) \ |
| 227 | $(OPT_PSP_SHAREDMEM_SIZE) \ |
| 228 | $(OPT_EFS_SPI_READ_MODE) \ |
| 229 | $(OPT_EFS_SPI_SPEED) \ |
| 230 | $(OPT_EFS_SPI_MICRON_FLAG) \ |
| 231 | --config $(CONFIG_AMDFW_CONFIG_FILE) \ |
Karthikeyan Ramasubramanian | 176b563 | 2022-04-08 17:40:50 -0600 | [diff] [blame] | 232 | --flashsize $(CONFIG_ROM_SIZE) \ |
| 233 | $(OPT_RECOVERY_AB_SINGLE_COPY) |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 234 | |
| 235 | $(obj)/amdfw.rom: $(call strip_quotes, $(PSP_BIOSBIN_FILE)) \ |
| 236 | $(PSP_VERSTAGE_FILE) \ |
| 237 | $(PSP_VERSTAGE_SIG_FILE) \ |
| 238 | $$(PSP_APCB_FILES) \ |
| 239 | $(DEP_FILES) \ |
| 240 | $(AMDFWTOOL) \ |
| 241 | $(obj)/fmap_config.h \ |
| 242 | $(objcbfs)/bootblock.elf # this target also creates the .map file |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 243 | rm -f $@ |
| 244 | @printf " AMDFWTOOL $(subst $(obj)/,,$(@))\n" |
| 245 | $(AMDFWTOOL) \ |
| 246 | $(AMDFW_COMMON_ARGS) \ |
| 247 | $(OPT_APOB_NV_SIZE) \ |
| 248 | $(OPT_APOB_NV_BASE) \ |
| 249 | $(OPT_VERSTAGE_FILE) \ |
| 250 | $(OPT_VERSTAGE_SIG_FILE) \ |
Felix Held | 40a38cc | 2022-09-12 16:18:45 +0200 | [diff] [blame] | 251 | $(OPT_SPL_TABLE_FILE) \ |
Jon Murphy | 4f73242 | 2022-08-05 15:43:44 -0600 | [diff] [blame] | 252 | --location $(shell printf "%#x" $(MENDOCINO_FWM_POSITION)) \ |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 253 | --output $@ |
| 254 | |
Karthikeyan Ramasubramanian | 0a0e751 | 2022-09-21 00:41:04 -0600 | [diff] [blame] | 255 | ifeq ($(CONFIG_CBFS_VERIFICATION)$(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK),yy) |
| 256 | $(PSP_BIOSBIN_FILE): $(PSP_ELF_FILE) |
| 257 | rm -f $@ |
| 258 | $(OBJCOPY_bootblock) -O binary $< $@ |
| 259 | else |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 260 | $(PSP_BIOSBIN_FILE): $(PSP_ELF_FILE) $(AMDCOMPRESS) |
| 261 | rm -f $@ |
| 262 | @printf " AMDCOMPRS $(subst $(obj)/,,$(@))\n" |
| 263 | $(AMDCOMPRESS) --infile $(PSP_ELF_FILE) --outfile $@ --compress \ |
| 264 | --maxsize $(PSP_BIOSBIN_SIZE) |
Karthikeyan Ramasubramanian | 0a0e751 | 2022-09-21 00:41:04 -0600 | [diff] [blame] | 265 | endif |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 266 | |
| 267 | $(obj)/amdfw_a.rom: $(obj)/amdfw.rom |
| 268 | rm -f $@ |
| 269 | @printf " AMDFWTOOL $(subst $(obj)/,,$(@))\n" |
| 270 | $(AMDFWTOOL) \ |
| 271 | $(AMDFW_COMMON_ARGS) \ |
| 272 | $(OPT_APOB_NV_SIZE) \ |
| 273 | $(OPT_APOB_NV_BASE) \ |
Felix Held | 40a38cc | 2022-09-12 16:18:45 +0200 | [diff] [blame] | 274 | $(OPT_SPL_RW_AB_TABLE_FILE) \ |
Karthikeyan Ramasubramanian | 6e44364 | 2022-08-25 16:13:17 -0600 | [diff] [blame] | 275 | $(OPT_SIGNED_AMDFW_A_POSITION) \ |
| 276 | $(OPT_SIGNED_AMDFW_A_FILE) \ |
Jon Murphy | 4f73242 | 2022-08-05 15:43:44 -0600 | [diff] [blame] | 277 | --location $(shell printf "%#x" $(MENDOCINO_FW_A_POSITION)) \ |
Karthikeyan Ramasubramanian | 716c8f0 | 2022-12-15 14:57:05 -0700 | [diff] [blame] | 278 | --body-location $(shell printf "%#x" $$(($(MENDOCINO_FW_A_POSITION) + $(MENDOCINO_FW_BODY_OFFSET)))) \ |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 279 | --anywhere \ |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 280 | --output $@ |
| 281 | |
| 282 | $(obj)/amdfw_b.rom: $(obj)/amdfw.rom |
| 283 | rm -f $@ |
| 284 | @printf " AMDFWTOOL $(subst $(obj)/,,$(@))\n" |
| 285 | $(AMDFWTOOL) \ |
| 286 | $(AMDFW_COMMON_ARGS) \ |
| 287 | $(OPT_APOB_NV_SIZE) \ |
| 288 | $(OPT_APOB_NV_BASE) \ |
Felix Held | 40a38cc | 2022-09-12 16:18:45 +0200 | [diff] [blame] | 289 | $(OPT_SPL_RW_AB_TABLE_FILE) \ |
Karthikeyan Ramasubramanian | 6e44364 | 2022-08-25 16:13:17 -0600 | [diff] [blame] | 290 | $(OPT_SIGNED_AMDFW_B_POSITION) \ |
| 291 | $(OPT_SIGNED_AMDFW_B_FILE) \ |
Jon Murphy | 4f73242 | 2022-08-05 15:43:44 -0600 | [diff] [blame] | 292 | --location $(shell printf "%#x" $(MENDOCINO_FW_B_POSITION)) \ |
Karthikeyan Ramasubramanian | 716c8f0 | 2022-12-15 14:57:05 -0700 | [diff] [blame] | 293 | --body-location $(shell printf "%#x" $$(($(MENDOCINO_FW_B_POSITION) + $(MENDOCINO_FW_BODY_OFFSET)))) \ |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 294 | --anywhere \ |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 295 | --output $@ |
| 296 | |
Karthikeyan Ramasubramanian | 716c8f0 | 2022-12-15 14:57:05 -0700 | [diff] [blame] | 297 | $(obj)/amdfw_a.rom.efs: $(obj)/amdfw_a.rom |
| 298 | $(obj)/amdfw_b.rom.efs: $(obj)/amdfw_b.rom |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 299 | |
Matt DeVillier | f9fea86 | 2022-10-04 16:41:28 -0500 | [diff] [blame] | 300 | ifeq ($(CONFIG_VBOOT_SLOTS_RW_A)$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),yy) |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 301 | cbfs-files-y += apu/amdfw_a |
Karthikeyan Ramasubramanian | 716c8f0 | 2022-12-15 14:57:05 -0700 | [diff] [blame] | 302 | apu/amdfw_a-file := $(obj)/amdfw_a.rom.efs |
Robert Zieba | b26d005 | 2022-01-24 16:37:47 -0700 | [diff] [blame] | 303 | apu/amdfw_a-position := $(AMD_FW_AB_POSITION) |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 304 | apu/amdfw_a-type := raw |
Karthikeyan Ramasubramanian | 716c8f0 | 2022-12-15 14:57:05 -0700 | [diff] [blame] | 305 | |
| 306 | cbfs-files-y += apu/amdfw_a_body |
| 307 | apu/amdfw_a_body-file := $(obj)/amdfw_a.rom |
| 308 | apu/amdfw_a_body-position := $(call int-add, $(AMD_FW_AB_POSITION) $(MENDOCINO_FW_BODY_OFFSET)) |
| 309 | apu/amdfw_a_body-type := raw |
Matt DeVillier | f9fea86 | 2022-10-04 16:41:28 -0500 | [diff] [blame] | 310 | endif |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 311 | |
Matt DeVillier | f9fea86 | 2022-10-04 16:41:28 -0500 | [diff] [blame] | 312 | ifeq ($(CONFIG_VBOOT_SLOTS_RW_AB)$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),yy) |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 313 | cbfs-files-y += apu/amdfw_b |
Karthikeyan Ramasubramanian | 716c8f0 | 2022-12-15 14:57:05 -0700 | [diff] [blame] | 314 | apu/amdfw_b-file := $(obj)/amdfw_b.rom.efs |
Robert Zieba | b26d005 | 2022-01-24 16:37:47 -0700 | [diff] [blame] | 315 | apu/amdfw_b-position := $(AMD_FW_AB_POSITION) |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 316 | apu/amdfw_b-type := raw |
Karthikeyan Ramasubramanian | 716c8f0 | 2022-12-15 14:57:05 -0700 | [diff] [blame] | 317 | |
| 318 | cbfs-files-y += apu/amdfw_b_body |
| 319 | apu/amdfw_b_body-file := $(obj)/amdfw_b.rom |
| 320 | apu/amdfw_b_body-position := $(call int-add, $(AMD_FW_AB_POSITION) $(MENDOCINO_FW_BODY_OFFSET)) |
| 321 | apu/amdfw_b_body-type := raw |
Matt DeVillier | f9fea86 | 2022-10-04 16:41:28 -0500 | [diff] [blame] | 322 | endif |
Karthikeyan Ramasubramanian | 6e44364 | 2022-08-25 16:13:17 -0600 | [diff] [blame] | 323 | |
Matt DeVillier | f9fea86 | 2022-10-04 16:41:28 -0500 | [diff] [blame] | 324 | ifeq ($(CONFIG_SEPARATE_SIGNED_PSPFW)$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),yy) |
Karthikeyan Ramasubramanian | 6e44364 | 2022-08-25 16:13:17 -0600 | [diff] [blame] | 325 | build_complete:: $(obj)/amdfw_a.rom $(obj)/amdfw_b.rom |
| 326 | @printf " Adding Signed ROM and HASH\n" |
| 327 | $(CBFSTOOL) $(obj)/coreboot.rom write -u -r SIGNED_AMDFW_A -i 0 -f $(obj)/amdfw_a.rom.signed |
| 328 | $(CBFSTOOL) $(obj)/coreboot.rom write -u -r SIGNED_AMDFW_B -i 0 -f $(obj)/amdfw_b.rom.signed |
| 329 | $(CBFSTOOL) $(obj)/coreboot.rom add -r FW_MAIN_A -f $(obj)/amdfw_a.rom.signed.hash \ |
| 330 | -n apu/amdfw_a_hash -t raw |
| 331 | $(CBFSTOOL) $(obj)/coreboot.rom add -r FW_MAIN_B -f $(obj)/amdfw_b.rom.signed.hash \ |
| 332 | -n apu/amdfw_b_hash -t raw |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 333 | endif |
| 334 | |
Karthikeyan Ramasubramanian | d1130b7 | 2022-08-16 17:42:57 -0600 | [diff] [blame] | 335 | # Add ranges for all components up until the first segment of BIOS to be verified by GSC |
| 336 | ifeq ($(CONFIG_VBOOT_GSCVD),y) |
| 337 | # Adding range for Bootblock |
| 338 | vboot-gscvd-ranges += $(call amdfwread-range-cmd,BIOSL2: 0x62) |
| 339 | # Adding range for PSP Stage1 Bootloader |
| 340 | vboot-gscvd-ranges += $(call amdfwread-range-cmd,PSPL2: 0x01) |
| 341 | |
| 342 | ifeq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) |
| 343 | # Adding range for PSP Verstage |
| 344 | vboot-gscvd-ranges += $(call amdfwread-range-cmd,PSPL2: 0x52) |
| 345 | endif # ifeq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) |
| 346 | endif # ifeq ($(CONFIG_VBOOT_GSCVD),y) |
| 347 | |
Jon Murphy | 4f73242 | 2022-08-05 15:43:44 -0600 | [diff] [blame] | 348 | endif # ($(CONFIG_SOC_AMD_MENDOCINO),y) |