Felix Held | 4a8cd72 | 2020-04-18 22:26:39 +0200 | [diff] [blame] | 1 | # SPDX-License-Identifier: BSD-3-Clause |
Felix Held | 4a8cd72 | 2020-04-18 22:26:39 +0200 | [diff] [blame] | 2 | |
Marshall Dawson | d786843 | 2019-11-25 11:47:32 -0700 | [diff] [blame] | 3 | ifeq ($(CONFIG_SOC_AMD_STONEYRIDGE),y) |
Marc Jones | 21cde8b | 2017-05-07 16:47:36 -0600 | [diff] [blame] | 4 | |
| 5 | subdirs-y += ../../../cpu/amd/mtrr/ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 6 | |
Felix Held | fbfb906 | 2021-12-15 19:35:00 +0100 | [diff] [blame] | 7 | bootblock-y += aoac.c |
Martin Roth | c450fbe | 2017-10-02 13:46:50 -0600 | [diff] [blame] | 8 | bootblock-y += BiosCallOuts.c |
Felix Held | 0aada3c | 2020-11-24 22:55:53 +0100 | [diff] [blame] | 9 | bootblock-y += bootblock.c |
Felix Held | 2d020e1 | 2021-12-15 20:52:10 +0100 | [diff] [blame] | 10 | bootblock-y += early_fch.c |
Chris Ching | 2269a3c | 2018-02-05 16:46:41 -0700 | [diff] [blame] | 11 | bootblock-y += gpio.c |
Chris Ching | 6fc39d4 | 2017-12-20 16:06:03 -0700 | [diff] [blame] | 12 | bootblock-y += i2c.c |
Arthur Heymans | c63649b | 2019-11-16 12:13:03 +0100 | [diff] [blame] | 13 | bootblock-y += enable_usbdebug.c |
Marshall Dawson | 9df969a | 2017-07-25 18:46:46 -0600 | [diff] [blame] | 14 | |
Martin Roth | c450fbe | 2017-10-02 13:46:50 -0600 | [diff] [blame] | 15 | romstage-y += BiosCallOuts.c |
Chris Ching | 6fc39d4 | 2017-12-20 16:06:03 -0700 | [diff] [blame] | 16 | romstage-y += i2c.c |
Marshall Dawson | 9df969a | 2017-07-25 18:46:46 -0600 | [diff] [blame] | 17 | romstage-y += romstage.c |
Arthur Heymans | c63649b | 2019-11-16 12:13:03 +0100 | [diff] [blame] | 18 | romstage-y += enable_usbdebug.c |
Felix Held | 25aa560 | 2021-12-15 20:52:10 +0100 | [diff] [blame] | 19 | romstage-y += fch_agesa.c |
Marc Jones | a1b0793 | 2017-06-22 21:39:03 -0600 | [diff] [blame] | 20 | romstage-y += gpio.c |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 21 | romstage-y += smbus_spd.c |
Kyösti Mälkki | 1dbf310 | 2019-08-03 21:28:40 +0300 | [diff] [blame] | 22 | romstage-y += memmap.c |
Felix Held | dba3229 | 2020-03-31 23:54:44 +0200 | [diff] [blame] | 23 | romstage-y += psp.c |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 24 | |
Chris Ching | 2269a3c | 2018-02-05 16:46:41 -0700 | [diff] [blame] | 25 | verstage-y += gpio.c |
Chris Ching | 6fc39d4 | 2017-12-20 16:06:03 -0700 | [diff] [blame] | 26 | verstage-y += i2c.c |
Marshall Dawson | e7557de | 2017-06-09 16:35:14 -0600 | [diff] [blame] | 27 | |
Kyösti Mälkki | 1dbf310 | 2019-08-03 21:28:40 +0300 | [diff] [blame] | 28 | postcar-y += memmap.c |
Patrick Georgi | 47282a9 | 2023-11-24 14:39:56 +0100 | [diff] [blame] | 29 | postcar-$(CONFIG_TPM_MEASURED_BOOT) += i2c.c |
Marshall Dawson | 18b477e | 2017-09-21 12:27:12 -0600 | [diff] [blame] | 30 | |
Matt DeVillier | 66ff4fb | 2023-08-08 12:28:03 -0500 | [diff] [blame] | 31 | ramstage-y += aoac.c |
Martin Roth | c450fbe | 2017-10-02 13:46:50 -0600 | [diff] [blame] | 32 | ramstage-y += BiosCallOuts.c |
Chris Ching | 6fc39d4 | 2017-12-20 16:06:03 -0700 | [diff] [blame] | 33 | ramstage-y += i2c.c |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 34 | ramstage-y += chip.c |
Marshall Dawson | a7bfbbe | 2017-09-13 17:24:53 -0600 | [diff] [blame] | 35 | ramstage-y += cpu.c |
Marshall Dawson | 0b4a1e2 | 2018-09-04 13:11:42 -0600 | [diff] [blame] | 36 | ramstage-y += mca.c |
Arthur Heymans | c63649b | 2019-11-16 12:13:03 +0100 | [diff] [blame] | 37 | ramstage-y += enable_usbdebug.c |
Marc Jones | 257db58 | 2017-06-18 17:33:30 -0600 | [diff] [blame] | 38 | ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c |
Felix Held | 2d020e1 | 2021-12-15 20:52:10 +0100 | [diff] [blame] | 39 | ramstage-y += fch.c |
Felix Held | 25aa560 | 2021-12-15 20:52:10 +0100 | [diff] [blame] | 40 | ramstage-y += fch_agesa.c |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 41 | ramstage-y += gpio.c |
Felix Held | 1d66ad1 | 2023-03-27 14:39:29 +0200 | [diff] [blame] | 42 | ramstage-y += graphics.c |
Marc Jones | 1587dc8 | 2017-05-15 18:55:11 -0600 | [diff] [blame] | 43 | ramstage-y += northbridge.c |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 44 | ramstage-y += sata.c |
Kyösti Mälkki | 1dbf310 | 2019-08-03 21:28:40 +0300 | [diff] [blame] | 45 | ramstage-y += memmap.c |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 46 | ramstage-y += usb.c |
Felix Held | dba3229 | 2020-03-31 23:54:44 +0200 | [diff] [blame] | 47 | ramstage-y += psp.c |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 48 | |
Felix Held | 3924e18 | 2023-03-31 15:29:13 +0200 | [diff] [blame] | 49 | all-y += monotonic_timer.c |
Felix Held | 8c75d4b | 2023-03-31 15:37:14 +0200 | [diff] [blame] | 50 | all-y += pstate_util.c |
Kyösti Mälkki | 9db3987 | 2019-12-13 18:11:05 +0200 | [diff] [blame] | 51 | all-y += reset.c |
Felix Held | 3924e18 | 2023-03-31 15:29:13 +0200 | [diff] [blame] | 52 | all-y += tsc_freq.c |
| 53 | all-y += uart.c |
Kyösti Mälkki | 9db3987 | 2019-12-13 18:11:05 +0200 | [diff] [blame] | 54 | |
Felix Held | 8c75d4b | 2023-03-31 15:37:14 +0200 | [diff] [blame] | 55 | smm-y += pstate_util.c |
Aaron Durbin | 2407932 | 2018-01-23 10:53:05 -0700 | [diff] [blame] | 56 | smm-y += monotonic_timer.c |
Marshall Dawson | 6746d37 | 2017-09-27 13:32:00 -0600 | [diff] [blame] | 57 | smm-y += smihandler.c |
Marshall Dawson | 6746d37 | 2017-09-27 13:32:00 -0600 | [diff] [blame] | 58 | smm-y += tsc_freq.c |
Marshall Dawson | abac64d | 2017-09-27 13:26:23 -0600 | [diff] [blame] | 59 | smm-$(CONFIG_DEBUG_SMI) += uart.c |
Marc Jones | 85aec31 | 2018-07-14 17:08:27 -0600 | [diff] [blame] | 60 | smm-y += gpio.c |
Felix Held | dba3229 | 2020-03-31 23:54:44 +0200 | [diff] [blame] | 61 | smm-y += psp.c |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 62 | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 63 | CPPFLAGS_common += -I$(src)/soc/amd/stoneyridge/include |
| 64 | CPPFLAGS_common += -I$(src)/soc/amd/stoneyridge/acpi |
| 65 | |
Martin Roth | 6d8ef24 | 2017-09-08 14:39:35 -0600 | [diff] [blame] | 66 | # ROMSIG Normally At ROMBASE + 0x20000 |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 67 | # +-----------+---------------+----------------+------------+ |
| 68 | # |0x55AA55AA |EC ROM Address |GEC ROM Address |USB3 ROM | |
| 69 | # +-----------+---------------+----------------+------------+ |
| 70 | # |PSPDIR ADDR| |
| 71 | # +-----------+ |
| 72 | # |
| 73 | # EC ROM should be 64K aligned. |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 74 | ### 0 |
Zheng Bao | c5e28ab | 2020-10-28 11:38:09 +0800 | [diff] [blame] | 75 | |
Zheng Bao | 3384e4a | 2020-10-06 12:03:11 +0800 | [diff] [blame] | 76 | FIRMWARE_LOCATION=$(shell grep -e FIRMWARE_LOCATION $(CONFIG_AMDFW_CONFIG_FILE) | awk '{print $$2}') |
Zheng Bao | c5e28ab | 2020-10-28 11:38:09 +0800 | [diff] [blame] | 77 | |
Zheng Bao | 3384e4a | 2020-10-06 12:03:11 +0800 | [diff] [blame] | 78 | ifneq ($(FIRMWARE_LOCATION),) |
Marshall Dawson | 12294d0 | 2019-11-25 07:21:18 -0700 | [diff] [blame] | 79 | |
| 80 | ifeq ($(CONFIG_AMD_APU_STONEYRIDGE),y) |
| 81 | FIRMWARE_TYPE=ST |
| 82 | else |
Marshall Dawson | 12294d0 | 2019-11-25 07:21:18 -0700 | [diff] [blame] | 83 | ifeq ($(CONFIG_AMD_APU_MERLINFALCON),y) |
Richard Spiegel | 1bc578a | 2019-06-18 18:19:47 -0700 | [diff] [blame] | 84 | FIRMWARE_TYPE=CZ |
| 85 | else |
Marshall Dawson | e1988f5 | 2019-11-25 11:15:35 -0700 | [diff] [blame] | 86 | ifeq ($(CONFIG_AMD_APU_PRAIRIEFALCON),y) |
| 87 | FIRMWARE_TYPE=ST |
| 88 | else |
Marshall Dawson | 91e7fe7 | 2019-11-24 17:19:19 -0700 | [diff] [blame] | 89 | $(error soc/amd/stoneyridge: Unusable FIRMWARE_TYPE) |
Marshall Dawson | 12294d0 | 2019-11-25 07:21:18 -0700 | [diff] [blame] | 90 | |
Marshall Dawson | e1988f5 | 2019-11-25 11:15:35 -0700 | [diff] [blame] | 91 | endif # CONFIG_AMD_APU_PRAIRIEFALCON |
Marshall Dawson | 12294d0 | 2019-11-25 07:21:18 -0700 | [diff] [blame] | 92 | endif # CONFIG_AMD_APU_MERLINFALCON |
| 93 | endif # CONFIG_AMD_APU_STONEYRIDGE |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 94 | |
Zheng Bao | c5e28ab | 2020-10-28 11:38:09 +0800 | [diff] [blame] | 95 | add_opt_prefix=$(if $(call strip_quotes, $(1)), $(2) $(call strip_quotes, $(1)), ) |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 96 | |
Zheng Bao | c5e28ab | 2020-10-28 11:38:09 +0800 | [diff] [blame] | 97 | OPT_STONEYRIDGE_XHCI_FWM_FILE=$(call add_opt_prefix, $(CONFIG_STONEYRIDGE_XHCI_FWM_FILE), --xhci) |
| 98 | OPT_STONEYRIDGE_GEC_FWM_FILE=$(call add_opt_prefix, $(CONFIG_STONEYRIDGE_GEC_FWM_FILE), --gec) |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 99 | |
Zheng Bao | 3384e4a | 2020-10-06 12:03:11 +0800 | [diff] [blame] | 100 | SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATION)/$(shell awk '($$1=="PSP_SMUFW1_SUB0_FILE") {print $$2}' $(CONFIG_AMDFW_CONFIG_FILE)) |
| 101 | SMUFWM_FN_FILE=$(top)/$(FIRMWARE_LOCATION)/$(shell awk '($$1=="PSP_SMUFW1_SUB1_FILE") {print $$2}' $(CONFIG_AMDFW_CONFIG_FILE)) |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 102 | |
Zheng Bao | 3384e4a | 2020-10-06 12:03:11 +0800 | [diff] [blame] | 103 | SMUFIRMWARE2_FILE=$(top)/$(FIRMWARE_LOCATION)/$(shell awk '($$1=="PSP_SMUFW2_SUB0_FILE") {print $$2}' $(CONFIG_AMDFW_CONFIG_FILE)) |
| 104 | SMUFIRMWARE2_FN_FILE=$(top)/$(FIRMWARE_LOCATION)/$(shell awk '($$1=="PSP_SMUFW2_SUB1_FILE") {print $$2}' $(CONFIG_AMDFW_CONFIG_FILE)) |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 105 | |
Richard Spiegel | 1bc578a | 2019-06-18 18:19:47 -0700 | [diff] [blame] | 106 | ifeq ("$(wildcard $(SMUFWM_FN_FILE))","") |
| 107 | SMUFWM_FN_FILE= |
| 108 | SMUFIRMWARE2_FN_FILE= |
| 109 | endif |
| 110 | |
Zheng Bao | c5e28ab | 2020-10-28 11:38:09 +0800 | [diff] [blame] | 111 | ifeq ($(CONFIG_USE_PSPSECUREOS),y) |
| 112 | PSP_USE_PSPSECUREOS="--use-pspsecureos" |
| 113 | endif |
| 114 | |
| 115 | OPT_PSP_USE_PSPSECUREOS=$(call strip_quotes, $(PSP_USE_PSPSECUREOS)) |
| 116 | |
Zheng Bao | 570645d | 2021-11-03 10:25:03 +0800 | [diff] [blame] | 117 | OPT_EFS_SPI_READ_MODE=$(call add_opt_prefix, $(CONFIG_EFS_SPI_READ_MODE), --spi-read-mode) |
| 118 | OPT_EFS_SPI_SPEED=$(call add_opt_prefix, $(CONFIG_EFS_SPI_SPEED), --spi-speed) |
| 119 | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 120 | $(obj)/amdfw.rom: $(call strip_quotes, $(CONFIG_STONEYRIDGE_XHCI_FWM_FILE)) \ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 121 | $(call strip_quotes, $(CONFIG_STONEYRIDGE_GEC_FWM_FILE)) \ |
Zheng Bao | c5e28ab | 2020-10-28 11:38:09 +0800 | [diff] [blame] | 122 | $(DEP_FILES) \ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 123 | $(AMDFWTOOL) |
| 124 | rm -f $@ |
| 125 | @printf " AMDFWTOOL $(subst $(obj)/,,$(@))\n" |
| 126 | $(AMDFWTOOL) \ |
| 127 | $(OPT_STONEYRIDGE_XHCI_FWM_FILE) \ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 128 | $(OPT_STONEYRIDGE_GEC_FWM_FILE) \ |
Zheng Bao | c5e28ab | 2020-10-28 11:38:09 +0800 | [diff] [blame] | 129 | $(OPT_PSP_USE_PSPSECUREOS) \ |
Zheng Bao | 570645d | 2021-11-03 10:25:03 +0800 | [diff] [blame] | 130 | $(OPT_EFS_SPI_READ_MODE) \ |
| 131 | $(OPT_EFS_SPI_SPEED) \ |
Martin Roth | 0acf59d | 2023-03-08 15:18:24 -0700 | [diff] [blame] | 132 | $(OPT_DEBUG_AMDFWTOOL) \ |
Zheng Bao | c5e28ab | 2020-10-28 11:38:09 +0800 | [diff] [blame] | 133 | --config $(CONFIG_AMDFW_CONFIG_FILE) \ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 134 | --flashsize $(CONFIG_ROM_SIZE) \ |
Zheng Bao | 6bc0698 | 2023-02-14 13:26:31 +0800 | [diff] [blame] | 135 | --location $(CONFIG_AMD_FWM_POSITION) \ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 136 | --output $@ |
| 137 | |
| 138 | ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y) |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 139 | |
Patrick Georgi | 2cc5bcb | 2021-01-13 09:15:07 +0100 | [diff] [blame] | 140 | $(call add_intermediate, add_amdfw, $(obj)/amdfw.rom) |
Martin Roth | 30f9b95 | 2017-10-03 15:54:45 -0600 | [diff] [blame] | 141 | printf " DD Adding AMD Firmware at ROM offset 0x%x\n" \ |
Zheng Bao | 6bc0698 | 2023-02-14 13:26:31 +0800 | [diff] [blame] | 142 | "$(CONFIG_AMD_FWM_POSITION)" |
Patrick Georgi | 0b7d3a1 | 2021-01-13 09:16:41 +0100 | [diff] [blame] | 143 | dd if=$(obj)/amdfw.rom \ |
Arthur Heymans | 8ceef40 | 2021-07-06 16:20:09 +0200 | [diff] [blame] | 144 | of=$< conv=notrunc bs=1 \ |
Zheng Bao | 6bc0698 | 2023-02-14 13:26:31 +0800 | [diff] [blame] | 145 | seek=$(CONFIG_AMD_FWM_POSITION) >/dev/null 2>&1 |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 146 | |
| 147 | else # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y) |
| 148 | |
Zheng Bao | 6bc0698 | 2023-02-14 13:26:31 +0800 | [diff] [blame] | 149 | STONEYRIDGE_FWM_POSITION=$(call int-add, \ |
| 150 | $(call int-subtract, 0xffffffff $(CONFIG_ROM_SIZE)) \ |
| 151 | 1 \ |
| 152 | $(CONFIG_AMD_FWM_POSITION)) |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 153 | cbfs-files-y += apu/amdfw |
| 154 | apu/amdfw-file := $(obj)/amdfw.rom |
| 155 | apu/amdfw-position := $(STONEYRIDGE_FWM_POSITION) |
| 156 | apu/amdfw-type := raw |
| 157 | |
| 158 | endif # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y) |
| 159 | |
Marshall Dawson | 5f0520a | 2017-10-30 16:11:45 -0600 | [diff] [blame] | 160 | ifeq ($(CONFIG_SOC_AMD_PSP_SELECTABLE_SMU_FW),y) |
| 161 | |
| 162 | cbfs-files-y += smu_fw |
| 163 | cbfs-files-y += smu_fw2 |
| 164 | smu_fw-type := raw |
| 165 | smu_fw2-type := raw |
| 166 | |
| 167 | ifeq ($(CONFIG_SOC_AMD_SMU_FANLESS),y) |
| 168 | smu_fw-file := $(SMUFWM_FN_FILE) |
| 169 | smu_fw2-file := $(SMUFIRMWARE2_FN_FILE) |
| 170 | else ifeq ($(CONFIG_SOC_AMD_SMU_FANNED),y) |
| 171 | smu_fw-file := $(SMUFWM_FILE) |
| 172 | smu_fw2-file := $(SMUFIRMWARE2_FILE) |
| 173 | else |
| 174 | $(error "Proper SMU Firmware not selected") |
| 175 | endif |
| 176 | |
| 177 | endif # ifeq ($(CONFIG_SOC_AMD_PSP_SELECTABLE_SMU_FW),y) |
| 178 | |
Zheng Bao | 3384e4a | 2020-10-06 12:03:11 +0800 | [diff] [blame] | 179 | else # ifneq ($(FIRMWARE_LOCATION),) |
Marshall Dawson | 91e7fe7 | 2019-11-24 17:19:19 -0700 | [diff] [blame] | 180 | |
| 181 | warn_no_amdfw: |
| 182 | printf "\n\t** WARNING **\n" |
| 183 | printf "coreboot has been built with no PSP firmware and " |
| 184 | printf "a non-booting image has been generated.\n\n" |
| 185 | |
| 186 | PHONY+=warn_no_amdfw |
| 187 | |
Martin Roth | 372503f | 2023-12-08 00:43:23 -0700 | [diff] [blame] | 188 | show_notices:: warn_no_amdfw |
Marshall Dawson | 91e7fe7 | 2019-11-24 17:19:19 -0700 | [diff] [blame] | 189 | |
Zheng Bao | 3384e4a | 2020-10-06 12:03:11 +0800 | [diff] [blame] | 190 | endif # ifneq ($(FIRMWARE_LOCATION),) |
Marshall Dawson | 91e7fe7 | 2019-11-24 17:19:19 -0700 | [diff] [blame] | 191 | |
Marshall Dawson | d786843 | 2019-11-25 11:47:32 -0700 | [diff] [blame] | 192 | endif # ($(CONFIG_SOC_AMD_STONEYRIDGE),y) |