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