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