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