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