Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 1 | # SPDX-License-Identifier: BSD-3-Clause |
| 2 | |
| 3 | # TODO: Move as much as possible to common |
Martin Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 4 | # TODO: Update for Phoenix |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 5 | |
Martin Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 6 | ifeq ($(CONFIG_SOC_AMD_PHOENIX),y) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 7 | |
| 8 | subdirs-$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK) += psp_verstage |
| 9 | |
| 10 | # Beware that all-y also adds the compilation unit to verstage on PSP |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 11 | all-y += aoac.c |
Felix Held | 46cd1b5 | 2023-04-01 01:21:27 +0200 | [diff] [blame] | 12 | all-y += config.c |
| 13 | all-y += i2c.c |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 14 | |
Felix Held | f008e0a | 2023-04-01 01:31:24 +0200 | [diff] [blame] | 15 | # all_x86-y adds the compilation unit to all stages that run on the x86 cores |
| 16 | all_x86-y += gpio.c |
| 17 | all_x86-y += uart.c |
| 18 | |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 19 | bootblock-y += early_fch.c |
| 20 | bootblock-y += espi_util.c |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 21 | |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 22 | verstage-y += espi_util.c |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 23 | |
| 24 | romstage-y += fsp_m_params.c |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 25 | romstage-y += romstage.c |
Felix Held | 8f705b9 | 2023-02-06 19:56:35 +0100 | [diff] [blame] | 26 | romstage-y += soc_util.c |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 27 | |
| 28 | ramstage-y += acpi.c |
| 29 | ramstage-y += agesa_acpi.c |
| 30 | ramstage-y += chip.c |
| 31 | ramstage-y += cpu.c |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 32 | ramstage-y += fch.c |
| 33 | ramstage-y += fsp_s_params.c |
Ritul Guru | 4843ded | 2023-02-20 00:45:11 +0530 | [diff] [blame] | 34 | ramstage-y += graphics.c |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 35 | ramstage-y += mca.c |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 36 | ramstage-y += root_complex.c |
Felix Held | 8f705b9 | 2023-02-06 19:56:35 +0100 | [diff] [blame] | 37 | ramstage-y += soc_util.c |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 38 | ramstage-y += xhci.c |
| 39 | |
| 40 | smm-y += gpio.c |
| 41 | smm-y += smihandler.c |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 42 | smm-$(CONFIG_DEBUG_SMI) += uart.c |
| 43 | |
Martin Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 44 | CPPFLAGS_common += -I$(src)/soc/amd/phoenix/include |
| 45 | CPPFLAGS_common += -I$(src)/soc/amd/phoenix/acpi |
| 46 | CPPFLAGS_common += -I$(src)/vendorcode/amd/fsp/phoenix |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 47 | CPPFLAGS_common += -I$(src)/vendorcode/amd/fsp/common |
| 48 | |
Karthikeyan Ramasubramanian | 3167fb7 | 2023-10-16 14:53:57 -0600 | [diff] [blame] | 49 | # Building the cbfs image will fail if the offset, aligned to 64 bytes, isn't large enough |
| 50 | ifeq ($(CONFIG_CBFS_VERIFICATION),y) |
| 51 | # 0x80 accounts for the cbfs_file struct + filename + metadata structs |
Karthikeyan Ramasubramanian | 244e3ff | 2023-10-04 17:42:37 -0600 | [diff] [blame] | 52 | AMD_FW_AB_POSITION := 0x80 |
Karthikeyan Ramasubramanian | 3167fb7 | 2023-10-16 14:53:57 -0600 | [diff] [blame] | 53 | else # ($(CONFIG_CBFS_VERIFICATION), y) |
| 54 | # 0x40 accounts for the cbfs_file struct + filename + metadata structs without hash attribute |
| 55 | AMD_FW_AB_POSITION := 0x40 |
| 56 | endif # ($(CONFIG_CBFS_VERIFICATION), y) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 57 | |
Martin Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 58 | PHOENIX_FW_A_POSITION=$(call int-add, \ |
Matt DeVillier | 163dbdd | 2023-06-29 16:56:09 -0500 | [diff] [blame] | 59 | $(call get_fmap_value,FMAP_SECTION_FW_MAIN_A_START) $(AMD_FW_AB_POSITION)) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 60 | |
Martin Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 61 | PHOENIX_FW_B_POSITION=$(call int-add, \ |
Matt DeVillier | 163dbdd | 2023-06-29 16:56:09 -0500 | [diff] [blame] | 62 | $(call get_fmap_value,FMAP_SECTION_FW_MAIN_B_START) $(AMD_FW_AB_POSITION)) |
Fred Reitberger | dbf1b63 | 2023-06-30 13:44:14 -0400 | [diff] [blame] | 63 | |
| 64 | FMAP_FLASH_START=$(call get_fmap_value,FMAP_SECTION_FLASH_START) |
| 65 | |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 66 | # |
| 67 | # PSP Directory Table items |
| 68 | # |
| 69 | # Certain ordering requirements apply, however these are ensured by amdfwtool. |
| 70 | # For more information see "AMD Platform Security Processor BIOS Architecture |
| 71 | # Design Guide for AMD Family 17h Processors" (PID #55758, NDA only). |
| 72 | # |
| 73 | |
| 74 | ifeq ($(CONFIG_PSP_DISABLE_POSTCODES),y) |
| 75 | PSP_SOFTFUSE_BITS += 7 |
| 76 | endif |
| 77 | |
| 78 | ifeq ($(CONFIG_PSP_UNLOCK_SECURE_DEBUG),y) |
| 79 | # Enable secure debug unlock |
| 80 | PSP_SOFTFUSE_BITS += 0 |
| 81 | OPT_TOKEN_UNLOCK="--token-unlock" |
| 82 | endif |
| 83 | |
| 84 | ifeq ($(CONFIG_PSP_LOAD_MP2_FW),y) |
| 85 | OPT_PSP_LOAD_MP2_FW="--load-mp2-fw" |
| 86 | else |
| 87 | # Disable MP2 firmware loading |
| 88 | PSP_SOFTFUSE_BITS += 29 |
| 89 | endif |
| 90 | |
| 91 | # Use additional Soft Fuse bits specified in Kconfig |
| 92 | PSP_SOFTFUSE_BITS += $(call strip_quotes, $(CONFIG_PSP_SOFTFUSE_BITS)) |
| 93 | |
| 94 | # type = 0x3a |
| 95 | ifeq ($(CONFIG_HAVE_PSP_WHITELIST_FILE),y) |
| 96 | PSP_WHITELIST_FILE=$(CONFIG_PSP_WHITELIST_FILE) |
| 97 | endif |
| 98 | |
| 99 | # type = 0x55 |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 100 | SPL_TABLE_FILE=$(CONFIG_SPL_TABLE_FILE) |
| 101 | ifeq ($(CONFIG_HAVE_SPL_RW_AB_FILE),y) |
| 102 | SPL_RW_AB_TABLE_FILE=$(CONFIG_SPL_RW_AB_TABLE_FILE) |
| 103 | else |
| 104 | SPL_RW_AB_TABLE_FILE=$(CONFIG_SPL_TABLE_FILE) |
| 105 | endif |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 106 | |
| 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}') |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [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) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [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) |
Fred Reitberger | e66ce2f | 2023-07-05 15:43:19 -0400 | [diff] [blame] | 127 | APOB_NV_BASE=$(call _tohex,$(call int-subtract, \ |
Fred Reitberger | dbf1b63 | 2023-06-30 13:44:14 -0400 | [diff] [blame] | 128 | $(call get_fmap_value,FMAP_SECTION_RW_MRC_CACHE_START) $(FMAP_FLASH_START))) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 129 | |
Fred Reitberger | 097f540 | 2023-02-24 13:27:13 -0500 | [diff] [blame] | 130 | ifeq ($(CONFIG_HAS_RECOVERY_MRC_CACHE),y) |
| 131 | # On boards with recovery MRC cache, point type 0x63 entry to RECOVERY_MRC_CACHE. |
| 132 | # 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] | 133 | APOB_NV_RO_SIZE=$(call get_fmap_value,FMAP_SECTION_RECOVERY_MRC_CACHE_SIZE) |
Fred Reitberger | e66ce2f | 2023-07-05 15:43:19 -0400 | [diff] [blame] | 134 | APOB_NV_RO_BASE=$(call _tohex,$(call int-subtract, \ |
Fred Reitberger | dbf1b63 | 2023-06-30 13:44:14 -0400 | [diff] [blame] | 135 | $(call get_fmap_value,FMAP_SECTION_RECOVERY_MRC_CACHE_START) $(FMAP_FLASH_START))) |
Fred Reitberger | 097f540 | 2023-02-24 13:27:13 -0500 | [diff] [blame] | 136 | else |
| 137 | APOB_NV_RO_SIZE=$(APOB_NV_SIZE) |
| 138 | APOB_NV_RO_BASE=$(APOB_NV_BASE) |
| 139 | endif |
Fred Reitberger | 2a1fc73 | 2023-07-17 09:09:42 -0400 | [diff] [blame] | 140 | endif # !CONFIG_SOC_AMD_COMMON_BLOCK_APOB_NV_DISABLE |
Fred Reitberger | 097f540 | 2023-02-24 13:27:13 -0500 | [diff] [blame] | 141 | |
Zheng Bao | a4284b0 | 2023-02-01 13:16:52 +0800 | [diff] [blame] | 142 | ifeq ($(CONFIG_AMDFW_SPLIT),y) |
Matt DeVillier | 163dbdd | 2023-06-29 16:56:09 -0500 | [diff] [blame] | 143 | FMAP_AMDFW_BODY_LOCATION=$(call get_fmap_value,FMAP_SECTION_AMDFWBODY_START) |
Zheng Bao | a4284b0 | 2023-02-01 13:16:52 +0800 | [diff] [blame] | 144 | endif |
| 145 | |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 146 | ifeq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) |
| 147 | # type = 0x6B - PSP Shared memory location |
| 148 | ifneq ($(CONFIG_PSP_SHAREDMEM_SIZE),0x0) |
| 149 | PSP_SHAREDMEM_SIZE=$(CONFIG_PSP_SHAREDMEM_SIZE) |
| 150 | PSP_SHAREDMEM_BASE=$(shell awk '$$3 == "_psp_sharedmem_dram" {printf "0x" $$1}' $(objcbfs)/bootblock.map) |
| 151 | endif |
| 152 | |
| 153 | # type = 0x52 - PSP Bootloader Userspace Application (verstage) |
| 154 | PSP_VERSTAGE_FILE=$(call strip_quotes,$(CONFIG_PSP_VERSTAGE_FILE)) |
| 155 | PSP_VERSTAGE_SIG_FILE=$(call strip_quotes,$(CONFIG_PSP_VERSTAGE_SIGNING_TOKEN)) |
| 156 | endif # CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK |
| 157 | |
| 158 | ifeq ($(CONFIG_SEPARATE_SIGNED_PSPFW),y) |
| 159 | SIGNED_AMDFW_A_POSITION=$(call int-subtract, \ |
Fred Reitberger | dbf1b63 | 2023-06-30 13:44:14 -0400 | [diff] [blame] | 160 | $(call get_fmap_value,FMAP_SECTION_SIGNED_AMDFW_A_START) $(FMAP_FLASH_START)) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 161 | SIGNED_AMDFW_B_POSITION=$(call int-subtract, \ |
Fred Reitberger | dbf1b63 | 2023-06-30 13:44:14 -0400 | [diff] [blame] | 162 | $(call get_fmap_value,FMAP_SECTION_SIGNED_AMDFW_B_START) $(FMAP_FLASH_START)) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 163 | SIGNED_AMDFW_A_FILE=$(obj)/amdfw_a.rom.signed |
| 164 | SIGNED_AMDFW_B_FILE=$(obj)/amdfw_b.rom.signed |
| 165 | endif # CONFIG_SEPARATE_SIGNED_PSPFW |
| 166 | |
| 167 | # Helper function to return a value with given bit set |
| 168 | # Soft Fuse type = 0xb - See #55758 (NDA) for bit definitions. |
| 169 | set-bit=$(call int-shift-left, 1 $(call _toint,$1)) |
| 170 | PSP_SOFTFUSE=$(shell A=$(call int-add, \ |
Matt DeVillier | 0daefa5 | 2023-10-30 20:58:41 -0500 | [diff] [blame^] | 171 | $(foreach bit,$(sort $(PSP_SOFTFUSE_BITS)),$(call set-bit,$(bit)))); printf "0x%x" $$A) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 172 | |
| 173 | # |
| 174 | # Build the arguments to amdfwtool (order is unimportant). Missing file names |
| 175 | # result in empty OPT_ variables, i.e. the argument is not passed to amdfwtool. |
| 176 | # |
| 177 | |
| 178 | add_opt_prefix=$(if $(call strip_quotes, $(1)), $(2) $(call strip_quotes, $(1)), ) |
| 179 | |
| 180 | OPT_VERSTAGE_FILE=$(call add_opt_prefix, $(PSP_VERSTAGE_FILE), --verstage) |
| 181 | OPT_VERSTAGE_SIG_FILE=$(call add_opt_prefix, $(PSP_VERSTAGE_SIG_FILE), --verstage_sig) |
| 182 | |
| 183 | OPT_PSP_APCB_FILES= $(if $(APCB_SOURCES), --instance 0 --apcb $(APCB_SOURCES)) \ |
| 184 | $(if $(APCB_SOURCES_RECOVERY), --instance 10 --apcb $(APCB_SOURCES_RECOVERY)) \ |
| 185 | $(if $(APCB_SOURCES_68), --instance 18 --apcb $(APCB_SOURCES_68)) |
| 186 | |
| 187 | OPT_APOB_ADDR=$(call add_opt_prefix, $(PSP_APOB_BASE), --apob-base) |
| 188 | OPT_PSP_BIOSBIN_FILE=$(call add_opt_prefix, $(PSP_BIOSBIN_FILE), --bios-bin) |
| 189 | OPT_PSP_BIOSBIN_DEST=$(call add_opt_prefix, $(PSP_BIOSBIN_DEST), --bios-bin-dest) |
| 190 | OPT_PSP_BIOSBIN_SIZE=$(call add_opt_prefix, $(PSP_BIOSBIN_SIZE), --bios-uncomp-size) |
| 191 | |
| 192 | OPT_PSP_SHAREDMEM_BASE=$(call add_opt_prefix, $(PSP_SHAREDMEM_BASE), --sharedmem) |
| 193 | OPT_PSP_SHAREDMEM_SIZE=$(call add_opt_prefix, $(PSP_SHAREDMEM_SIZE), --sharedmem-size) |
| 194 | OPT_APOB_NV_SIZE=$(call add_opt_prefix, $(APOB_NV_SIZE), --apob-nv-size) |
| 195 | OPT_APOB_NV_BASE=$(call add_opt_prefix, $(APOB_NV_BASE),--apob-nv-base) |
Fred Reitberger | 097f540 | 2023-02-24 13:27:13 -0500 | [diff] [blame] | 196 | OPT_APOB_NV_RO_SIZE=$(call add_opt_prefix, $(APOB_NV_RO_SIZE), --apob-nv-size) |
| 197 | OPT_APOB_NV_RO_BASE=$(call add_opt_prefix, $(APOB_NV_RO_BASE),--apob-nv-base) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 198 | OPT_EFS_SPI_READ_MODE=$(call add_opt_prefix, $(CONFIG_EFS_SPI_READ_MODE), --spi-read-mode) |
| 199 | OPT_EFS_SPI_SPEED=$(call add_opt_prefix, $(CONFIG_EFS_SPI_SPEED), --spi-speed) |
| 200 | OPT_EFS_SPI_MICRON_FLAG=$(call add_opt_prefix, $(CONFIG_EFS_SPI_MICRON_FLAG), --spi-micron-flag) |
| 201 | |
| 202 | OPT_SIGNED_AMDFW_A_POSITION=$(call add_opt_prefix, $(SIGNED_AMDFW_A_POSITION), --signed-addr) |
| 203 | OPT_SIGNED_AMDFW_A_FILE=$(call add_opt_prefix, $(SIGNED_AMDFW_A_FILE), --signed-output) |
| 204 | OPT_SIGNED_AMDFW_B_POSITION=$(call add_opt_prefix, $(SIGNED_AMDFW_B_POSITION), --signed-addr) |
| 205 | OPT_SIGNED_AMDFW_B_FILE=$(call add_opt_prefix, $(SIGNED_AMDFW_B_FILE), --signed-output) |
| 206 | |
| 207 | OPT_PSP_SOFTFUSE=$(call add_opt_prefix, $(PSP_SOFTFUSE), --soft-fuse) |
| 208 | |
| 209 | OPT_WHITELIST_FILE=$(call add_opt_prefix, $(PSP_WHITELIST_FILE), --whitelist) |
| 210 | OPT_SPL_TABLE_FILE=$(call add_opt_prefix, $(SPL_TABLE_FILE), --spl-table) |
| 211 | OPT_SPL_RW_AB_TABLE_FILE=$(call add_opt_prefix, $(SPL_RW_AB_TABLE_FILE), --spl-table) |
| 212 | |
| 213 | # If vboot uses 2 RW slots, then 2 copies of PSP binaries are redundant |
| 214 | OPT_RECOVERY_AB_SINGLE_COPY=$(if $(CONFIG_VBOOT_SLOTS_RW_AB), --recovery-ab-single-copy) |
| 215 | |
Zheng Bao | a4284b0 | 2023-02-01 13:16:52 +0800 | [diff] [blame] | 216 | OPT_AMDFW_BODY_LOCATION=$(call add_opt_prefix, $(FMAP_AMDFW_BODY_LOCATION), --body-location) |
| 217 | |
Fred Reitberger | 5f5e73c | 2023-07-17 09:12:39 -0400 | [diff] [blame] | 218 | MANIFEST_FILE=$(obj)/amdfw_manifest |
| 219 | OPT_MANIFEST=$(call add_opt_prefix, $(MANIFEST_FILE), --output-manifest) |
| 220 | |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 221 | AMDFW_COMMON_ARGS=$(OPT_PSP_APCB_FILES) \ |
| 222 | $(OPT_APOB_ADDR) \ |
Martin Roth | 0acf59d | 2023-03-08 15:18:24 -0700 | [diff] [blame] | 223 | $(OPT_DEBUG_AMDFWTOOL) \ |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 224 | $(OPT_PSP_BIOSBIN_FILE) \ |
| 225 | $(OPT_PSP_BIOSBIN_DEST) \ |
| 226 | $(OPT_PSP_BIOSBIN_SIZE) \ |
| 227 | $(OPT_PSP_SOFTFUSE) \ |
| 228 | $(OPT_PSP_LOAD_MP2_FW) \ |
| 229 | --use-pspsecureos \ |
| 230 | --load-s0i3 \ |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 231 | $(OPT_TOKEN_UNLOCK) \ |
| 232 | $(OPT_WHITELIST_FILE) \ |
| 233 | $(OPT_PSP_SHAREDMEM_BASE) \ |
| 234 | $(OPT_PSP_SHAREDMEM_SIZE) \ |
| 235 | $(OPT_EFS_SPI_READ_MODE) \ |
| 236 | $(OPT_EFS_SPI_SPEED) \ |
| 237 | $(OPT_EFS_SPI_MICRON_FLAG) \ |
| 238 | --config $(CONFIG_AMDFW_CONFIG_FILE) \ |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 239 | --flashsize $(CONFIG_ROM_SIZE) \ |
Zheng Bao | a4284b0 | 2023-02-01 13:16:52 +0800 | [diff] [blame] | 240 | $(OPT_RECOVERY_AB_SINGLE_COPY) \ |
| 241 | $(OPT_AMDFW_BODY_LOCATION) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 242 | |
| 243 | $(obj)/amdfw.rom: $(call strip_quotes, $(PSP_BIOSBIN_FILE)) \ |
| 244 | $(PSP_VERSTAGE_FILE) \ |
| 245 | $(PSP_VERSTAGE_SIG_FILE) \ |
| 246 | $$(PSP_APCB_FILES) \ |
| 247 | $(DEP_FILES) \ |
| 248 | $(AMDFWTOOL) \ |
| 249 | $(obj)/fmap_config.h \ |
| 250 | $(objcbfs)/bootblock.elf # this target also creates the .map file |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 251 | rm -f $@ |
| 252 | @printf " AMDFWTOOL $(subst $(obj)/,,$(@))\n" |
| 253 | $(AMDFWTOOL) \ |
| 254 | $(AMDFW_COMMON_ARGS) \ |
Fred Reitberger | 097f540 | 2023-02-24 13:27:13 -0500 | [diff] [blame] | 255 | $(OPT_APOB_NV_RO_SIZE) \ |
| 256 | $(OPT_APOB_NV_RO_BASE) \ |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 257 | $(OPT_VERSTAGE_FILE) \ |
| 258 | $(OPT_VERSTAGE_SIG_FILE) \ |
| 259 | $(OPT_SPL_TABLE_FILE) \ |
Fred Reitberger | 5f5e73c | 2023-07-17 09:12:39 -0400 | [diff] [blame] | 260 | $(OPT_MANIFEST) \ |
Zheng Bao | 6bc0698 | 2023-02-14 13:26:31 +0800 | [diff] [blame] | 261 | --location $(CONFIG_AMD_FWM_POSITION) \ |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 262 | --output $@ |
| 263 | |
Zheng Bao | a4284b0 | 2023-02-01 13:16:52 +0800 | [diff] [blame] | 264 | ifeq ($(CONFIG_AMDFW_SPLIT),y) |
| 265 | $(obj)/amdfw.rom.body: $(obj)/amdfw.rom |
| 266 | $(call add_intermediate, add_amdfwbody, $(obj)/amdfw.rom.body) |
| 267 | $(CBFSTOOL) $(obj)/coreboot.pre write -r AMDFWBODY -f $(obj)/amdfw.rom.body --fill-upward |
| 268 | endif |
| 269 | |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 270 | $(PSP_BIOSBIN_FILE): $(PSP_ELF_FILE) $(AMDCOMPRESS) |
| 271 | rm -f $@ |
| 272 | @printf " AMDCOMPRS $(subst $(obj)/,,$(@))\n" |
| 273 | $(AMDCOMPRESS) --infile $(PSP_ELF_FILE) --outfile $@ --compress \ |
| 274 | --maxsize $(PSP_BIOSBIN_SIZE) |
| 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) \ |
| 283 | $(OPT_SPL_RW_AB_TABLE_FILE) \ |
| 284 | $(OPT_SIGNED_AMDFW_A_POSITION) \ |
| 285 | $(OPT_SIGNED_AMDFW_A_FILE) \ |
Fred Reitberger | e66ce2f | 2023-07-05 15:43:19 -0400 | [diff] [blame] | 286 | --location $(call _tohex,$(PHOENIX_FW_A_POSITION)) \ |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 287 | --anywhere \ |
| 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) \ |
| 297 | $(OPT_SPL_RW_AB_TABLE_FILE) \ |
| 298 | $(OPT_SIGNED_AMDFW_B_POSITION) \ |
| 299 | $(OPT_SIGNED_AMDFW_B_FILE) \ |
Fred Reitberger | e66ce2f | 2023-07-05 15:43:19 -0400 | [diff] [blame] | 300 | --location $(call _tohex,$(PHOENIX_FW_B_POSITION)) \ |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 301 | --anywhere \ |
| 302 | --output $@ |
| 303 | |
| 304 | |
Fred Reitberger | 5f5e73c | 2023-07-17 09:12:39 -0400 | [diff] [blame] | 305 | $(MANIFEST_FILE): $(obj)/amdfw.rom |
| 306 | cbfs-files-y += amdfw_manifest |
| 307 | amdfw_manifest-file := $(MANIFEST_FILE) |
| 308 | amdfw_manifest-type := raw |
| 309 | |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 310 | ifeq ($(CONFIG_VBOOT_SLOTS_RW_AB)$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),yy) |
| 311 | cbfs-files-y += apu/amdfw_a |
| 312 | apu/amdfw_a-file := $(obj)/amdfw_a.rom |
| 313 | apu/amdfw_a-position := $(AMD_FW_AB_POSITION) |
| 314 | apu/amdfw_a-type := raw |
| 315 | |
| 316 | cbfs-files-y += apu/amdfw_b |
| 317 | apu/amdfw_b-file := $(obj)/amdfw_b.rom |
| 318 | apu/amdfw_b-position := $(AMD_FW_AB_POSITION) |
| 319 | apu/amdfw_b-type := raw |
| 320 | |
| 321 | ifeq ($(CONFIG_SEPARATE_SIGNED_PSPFW),y) |
| 322 | build_complete:: $(obj)/amdfw_a.rom $(obj)/amdfw_b.rom |
| 323 | @printf " Adding Signed ROM and HASH\n" |
| 324 | $(CBFSTOOL) $(obj)/coreboot.rom write -u -r SIGNED_AMDFW_A -i 0 -f $(obj)/amdfw_a.rom.signed |
| 325 | $(CBFSTOOL) $(obj)/coreboot.rom write -u -r SIGNED_AMDFW_B -i 0 -f $(obj)/amdfw_b.rom.signed |
| 326 | $(CBFSTOOL) $(obj)/coreboot.rom add -r FW_MAIN_A -f $(obj)/amdfw_a.rom.signed.hash \ |
| 327 | -n apu/amdfw_a_hash -t raw |
| 328 | $(CBFSTOOL) $(obj)/coreboot.rom add -r FW_MAIN_B -f $(obj)/amdfw_b.rom.signed.hash \ |
| 329 | -n apu/amdfw_b_hash -t raw |
Karthikeyan Ramasubramanian | 647abfd | 2023-07-14 16:30:07 -0600 | [diff] [blame] | 330 | if [ -n "$(wildcard $(obj)/amdfw_a.rom.signed.1.hash)" ]; then \ |
| 331 | $(CBFSTOOL) $(obj)/coreboot.rom add -r FW_MAIN_A -f \ |
| 332 | $(obj)/amdfw_a.rom.signed.1.hash -n apu/amdfw_a_hash1 -t raw; \ |
| 333 | $(CBFSTOOL) $(obj)/coreboot.rom add -r FW_MAIN_B -f \ |
| 334 | $(obj)/amdfw_b.rom.signed.1.hash -n apu/amdfw_b_hash1 -t raw; \ |
| 335 | fi |
| 336 | if [ -n "$(wildcard $(obj)/amdfw_a.rom.signed.2.hash)" ]; then \ |
| 337 | $(CBFSTOOL) $(obj)/coreboot.rom add -r FW_MAIN_A -f \ |
| 338 | $(obj)/amdfw_a.rom.signed.2.hash -n apu/amdfw_a_hash2 -t raw; \ |
| 339 | $(CBFSTOOL) $(obj)/coreboot.rom add -r FW_MAIN_B -f \ |
| 340 | $(obj)/amdfw_b.rom.signed.2.hash -n apu/amdfw_b_hash2 -t raw; \ |
| 341 | fi |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 342 | endif # CONFIG_SEPARATE_SIGNED_PSPFW |
| 343 | endif |
| 344 | |
Karthikeyan Ramasubramanian | 244e3ff | 2023-10-04 17:42:37 -0600 | [diff] [blame] | 345 | # Add ranges for all components up until the first segment of BIOS to be verified by GSC |
| 346 | ifeq ($(CONFIG_VBOOT_GSCVD),y) |
| 347 | # Adding range for Bootblock |
| 348 | vboot-gscvd-ranges += $(call amdfwread-range-cmd,BIOSL2: 0x62) |
| 349 | # Adding range for PSP Stage1 Bootloader |
| 350 | vboot-gscvd-ranges += $(call amdfwread-range-cmd,PSPL2: 0x01) |
| 351 | |
| 352 | ifeq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) |
| 353 | # Adding range for PSP Verstage |
| 354 | vboot-gscvd-ranges += $(call amdfwread-range-cmd,PSPL2: 0x52) |
| 355 | endif # ifeq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) |
| 356 | endif # ifeq ($(CONFIG_VBOOT_GSCVD),y) |
| 357 | |
Martin Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 358 | endif # ($(CONFIG_SOC_AMD_PHOENIX),y) |