blob: c8949b055cdf543464b316c49159b4395b13cf72 [file] [log] [blame]
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +03001#*****************************************************************************
2#
Marc Jonesa84fa902016-09-20 20:33:42 -06003# Copyright (c) 2012, 2016 Advanced Micro Devices, Inc.
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +03004# 2013 - 2014, Sage Electronic Engineering, LLC
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are met:
9# * Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# * Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# * Neither the name of Advanced Micro Devices, Inc. nor the names of
15# its contributors may be used to endorse or promote products derived
16# from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21# DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
22# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29#*****************************************************************************
30
Arthur Heymansadc47532018-12-28 15:48:58 +010031bootblock-$(CONFIG_USBDEBUG) += enable_usbdebug.c
32
Marc Jones05b2f692017-05-03 15:52:09 -060033romstage-y += early_setup.c
Arthur Heymansadc47532018-12-28 15:48:58 +010034romstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
Marc Jones05b2f692017-05-03 15:52:09 -060035romstage-$(CONFIG_HUDSON_IMC_FWM) += imc.c
36romstage-y += smbus.c
37romstage-y += smbus_spd.c
38romstage-$(CONFIG_HUDSON_UART) += uart.c
39
40verstage-y += early_setup.c
41verstage-y += reset.c
42verstage-$(CONFIG_HUDSON_UART) += uart.c
43
44ramstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
45ramstage-$(CONFIG_HAVE_ACPI_TABLES) += fadt.c
46ramstage-$(CONFIG_SOUTHBRIDGE_AMD_PI_KERN) += gpio.c
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030047ramstage-y += hda.c
Marc Jones05b2f692017-05-03 15:52:09 -060048ramstage-y += hudson.c
49ramstage-y += ide.c
50ramstage-$(CONFIG_HUDSON_IMC_FWM) += imc.c
51ramstage-y += lpc.c
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030052ramstage-y += pci.c
53ramstage-y += pcie.c
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030054ramstage-y += reset.c
Marc Jones05b2f692017-05-03 15:52:09 -060055ramstage-y += sata.c
56ramstage-y += sd.c
57ramstage-y += sm.c
58ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi.c
59ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi_util.c
60ramstage-$(CONFIG_HUDSON_UART) += uart.c
61ramstage-y += usb.c
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030062
Kyösti Mälkki9265f892019-07-07 23:58:34 +030063smm-y += smihandler.c
64smm-y += smi_util.c
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030065
66# ROMSIG At ROMBASE + 0x20000:
67# +-----------+---------------+----------------+------------+
68# |0x55AA55AA |EC ROM Address |GEC ROM Address |USB3 ROM |
69# +-----------+---------------+----------------+------------+
70# |PSPDIR ADDR|
71# +-----------+
72#
73# EC ROM should be 64K aligned.
74
Ricardo Ribalda Delgadobaae9592016-12-20 10:51:08 +010075HUDSON_FWM_POSITION=$(call int-add, $(call int-subtract, 0xffffffff $(CONFIG_ROM_SIZE)) 0x20000 1)
Martin Rothd12d65f2015-06-28 14:06:23 -060076
Zheng Baoc64f21c2015-11-17 22:58:55 +080077##
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030078ifeq ($(CONFIG_HUDSON_PSP), y)
Zheng Baoc64f21c2015-11-17 22:58:55 +080079##
80### 0
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030081
Zheng Baoc64f21c2015-11-17 22:58:55 +080082##
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030083ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
84FIRMWARE_LOCATE=$(dir $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE)))
85FIRMWARE_TYPE=
86endif
Zheng Baoc64f21c2015-11-17 22:58:55 +080087##
WANG Siyuanf2dfef02015-05-20 14:41:01 +080088ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
89FIRMWARE_LOCATE=$(dir $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE)))
90FIRMWARE_TYPE=CZ
91endif
92
Zheng Baoc64f21c2015-11-17 22:58:55 +080093###5
Martin Rothde60e602017-09-07 13:52:19 -060094PUBSIGNEDKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/RtmPubSigned$(FIRMWARE_TYPE).key
Zheng Baoc64f21c2015-11-17 22:58:55 +080095###1
WANG Siyuanf2dfef02015-05-20 14:41:01 +080096ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
Martin Rothde60e602017-09-07 13:52:19 -060097PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader$(FIRMWARE_TYPE).Bypass.sbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +080098else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
Martin Rothde60e602017-09-07 13:52:19 -060099PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader_prod_$(FIRMWARE_TYPE).sbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800100endif
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700101
Zheng Baoc64f21c2015-11-17 22:58:55 +0800102###3
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800103ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
Martin Rothde60e602017-09-07 13:52:19 -0600104PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecovery$(FIRMWARE_TYPE).sbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800105else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
Martin Rothde60e602017-09-07 13:52:19 -0600106PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecoveryBootLoader_prod_$(FIRMWARE_TYPE).sbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800107endif
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700108
Zheng Baoc64f21c2015-11-17 22:58:55 +0800109###2
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800110ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
Martin Rothde60e602017-09-07 13:52:19 -0600111PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs$(FIRMWARE_TYPE).sbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800112else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
Martin Rothde60e602017-09-07 13:52:19 -0600113PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs_prod_$(FIRMWARE_TYPE).csbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800114endif
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300115
Zheng Baoc64f21c2015-11-17 22:58:55 +0800116###4
Martin Rothde60e602017-09-07 13:52:19 -0600117PSPNVRAM_FILE=$(top)/$(FIRMWARE_LOCATE)/PspNvram$(FIRMWARE_TYPE).bin
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300118
Zheng Baoc64f21c2015-11-17 22:58:55 +0800119###8
Martin Rothde60e602017-09-07 13:52:19 -0600120SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE).sbin
121SMUFWM_FN_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE)_FN.sbin
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300122
Zheng Baoc64f21c2015-11-17 22:58:55 +0800123###95
Martin Rothde60e602017-09-07 13:52:19 -0600124SMUSCS_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuScs$(FIRMWARE_TYPE).bin
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300125
Zheng Baoc64f21c2015-11-17 22:58:55 +0800126###9
Martin Rothde60e602017-09-07 13:52:19 -0600127PSPSECUREDEBUG_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureDebug$(FIRMWARE_TYPE).Key
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800128
Zheng Baoc64f21c2015-11-17 22:58:55 +0800129###12
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800130ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
Martin Rothde60e602017-09-07 13:52:19 -0600131PSPTRUSTLETS_FILE=$(top)/$(FIRMWARE_LOCATE)/trustlets.bin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800132else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
Martin Rothde60e602017-09-07 13:52:19 -0600133PSPTRUSTLETS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspTrustlets_prod_$(FIRMWARE_TYPE).cbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800134endif
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800135
Zheng Baoc64f21c2015-11-17 22:58:55 +0800136###13
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800137ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
Martin Rothde60e602017-09-07 13:52:19 -0600138TRUSTLETKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/Trustlet.tkn.cert
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800139else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
Martin Rothde60e602017-09-07 13:52:19 -0600140TRUSTLETKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/TrustletKey_prod_$(FIRMWARE_TYPE).sbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800141endif
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800142
Zheng Baoc64f21c2015-11-17 22:58:55 +0800143###18
Kyösti Mälkkifa2786a2017-07-07 23:05:40 +0300144ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
Martin Rothde60e602017-09-07 13:52:19 -0600145SMUFIRMWARE2_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware2_prod_$(FIRMWARE_TYPE).sbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800146endif
147
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300148endif
Zheng Baoc64f21c2015-11-17 22:58:55 +0800149
150add_opt_prefix=$(if $(call strip_quotes, $(1)), $(2) $(call strip_quotes, $(1)), )
151
152OPT_HUDSON_XHCI_FWM_FILE=$(call add_opt_prefix, $(CONFIG_HUDSON_XHCI_FWM_FILE), --xhci)
153OPT_HUDSON_IMC_FWM_FILE=$(call add_opt_prefix, $(CONFIG_HUDSON_IMC_FWM_FILE), --imc)
154OPT_HUDSON_GEC_FWM_FILE=$(call add_opt_prefix, $(CONFIG_HUDSON_GEC_FWM_FILEddd), --gec)
155
Kyösti Mälkkifa2786a2017-07-07 23:05:40 +0300156OPT_AMD_PUBKEY_FILE=$(call add_opt_prefix, $(CONFIG_AMD_PUBKEY_FILE), --pubkey)
Martin Rothde60e602017-09-07 13:52:19 -0600157OPT_PSPBTLDR_FILE=$(call add_opt_prefix, $(PSPBTLDR_FILE), --bootloader)
158OPT_SMUFWM_FILE=$(call add_opt_prefix, $(SMUFWM_FILE), --smufirmware)
159OPT_PSPRCVR_FILE=$(call add_opt_prefix, $(PSPRCVR_FILE), --recovery)
160OPT_PUBSIGNEDKEY_FILE=$(call add_opt_prefix, $(PUBSIGNEDKEY_FILE), --rtmpubkey)
161OPT_PSPSCUREOS_FILE=$(call add_opt_prefix, $(PSPSCUREOS_FILE), --secureos)
162OPT_PSPNVRAM_FILE=$(call add_opt_prefix, $(PSPNVRAM_FILE), --nvram)
163OPT_PSPSECUREDEBUG_FILE=$(call add_opt_prefix, $(PSPSECUREDEBUG_FILE), --securedebug)
164OPT_PSPTRUSTLETS_FILE=$(call add_opt_prefix, $(PSPTRUSTLETS_FILE), --trustlets)
165OPT_TRUSTLETKEY_FILE=$(call add_opt_prefix, $(TRUSTLETKEY_FILE), --trustletkey)
166OPT_SMUFIRMWARE2_FILE=$(call add_opt_prefix, $(SMUFIRMWARE2_FILE), --smufirmware2)
167OPT_SMUSCS_FILE=$(call add_opt_prefix, $(SMUSCS_FILE), --smuscs)
Zheng Baoc64f21c2015-11-17 22:58:55 +0800168
169$(obj)/amdfw.rom: $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE)) \
170 $(call strip_quotes, $(CONFIG_HUDSON_IMC_FWM_FILE)) \
171 $(call strip_quotes, $(CONFIG_HUDSON_GEC_FWM_FILE)) \
172 $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE)) \
Martin Rothde60e602017-09-07 13:52:19 -0600173 $(call strip_quotes, $(PUBSIGNEDKEY_FILE)) \
174 $(call strip_quotes, $(PSPBTLDR_FILE)) \
175 $(call strip_quotes, $(PSPRCVR_FILE)) \
176 $(call strip_quotes, $(PSPSCUREOS_FILE)) \
177 $(call strip_quotes, $(PSPNVRAM_FILE)) \
178 $(call strip_quotes, $(SMUFWM_FILE)) \
179 $(call strip_quotes, $(SMUSCS_FILE)) \
180 $(call strip_quotes, $(PSPSECUREDEBUG_FILE)) \
181 $(call strip_quotes, $(PSPTRUSTLETS_FILE)) \
182 $(call strip_quotes, $(TRUSTLETKEY_FILE)) \
183 $(call strip_quotes, $(SMUFIRMWARE2_FILE)) \
184 $(call strip_quotes, $(AMD_PUBKEY2_FILE)) \
185 $(call strip_quotes, $(PUBSIGNEDKEY2_FILE)) \
186 $(call strip_quotes, $(PSPBTLDR2_FILE)) \
187 $(call strip_quotes, $(SMUFWM2_FILE)) \
188 $(call strip_quotes, $(SMUFWM2_FN_FILE)) \
189 $(call strip_quotes, $(PSPRCVR2_FILE)) \
190 $(call strip_quotes, $(PSPSCUREOS2_FILE)) \
191 $(call strip_quotes, $(PSPNVRAM2_FILE)) \
192 $(call strip_quotes, $(SMUSCS2_FILE)) \
193 $(call strip_quotes, $(PSPSECUREDEBUG2_FILE)) \
194 $(call strip_quotes, $(PSPTRUSTLETS2_FILE)) \
195 $(call strip_quotes, $(TRUSTLETKEY2_FILE)) \
196 $(call strip_quotes, $(SMUFIRMWARE2_2_FILE)) \
197 $(call strip_quotes, $(SMUFIRMWARE2_2_FN_FILE)) \
Zheng Baoc64f21c2015-11-17 22:58:55 +0800198 $(AMDFWTOOL)
199 rm -f $@
Zheng Baoa962e062015-12-08 23:41:37 +0800200 @printf " AMDFWTOOL $(subst $(obj)/,,$(@))\n"
Zheng Baoc64f21c2015-11-17 22:58:55 +0800201 $(AMDFWTOOL) \
202 $(OPT_HUDSON_XHCI_FWM_FILE) \
203 $(OPT_HUDSON_IMC_FWM_FILE) \
204 $(OPT_HUDSON_GEC_FWM_FILE) \
205 $(OPT_AMD_PUBKEY_FILE) \
206 $(OPT_PSPBTLDR_FILE) \
207 $(OPT_SMUFWM_FILE) \
208 $(OPT_PSPRCVR_FILE) \
209 $(OPT_PUBSIGNEDKEY_FILE) \
210 $(OPT_PSPSCUREOS_FILE) \
211 $(OPT_PSPNVRAM_FILE) \
212 $(OPT_PSPSECUREDEBUG_FILE) \
213 $(OPT_PSPTRUSTLETS_FILE) \
214 $(OPT_TRUSTLETKEY_FILE) \
215 $(OPT_SMUFIRMWARE2_FILE) \
216 $(OPT_SMUSCS_FILE) \
217 $(OPT_2AMD_PUBKEY_FILE) \
218 $(OPT_2PSPBTLDR_FILE) \
219 $(OPT_2SMUFWM_FILE) \
Marshall Dawson0cd2cb62017-03-27 07:25:51 -0600220 $(OPT_2SMUFWM_FN_FILE) \
Zheng Baoc64f21c2015-11-17 22:58:55 +0800221 $(OPT_2PSPRCVR_FILE) \
222 $(OPT_2PUBSIGNEDKEY_FILE) \
223 $(OPT_2PSPSCUREOS_FILE) \
224 $(OPT_2PSPNVRAM_FILE) \
225 $(OPT_2PSPSECUREDEBUG_FILE) \
226 $(OPT_2PSPTRUSTLETS_FILE) \
227 $(OPT_2TRUSTLETKEY_FILE) \
228 $(OPT_2SMUFIRMWARE2_FILE) \
Marshall Dawson0cd2cb62017-03-27 07:25:51 -0600229 $(OPT_2SMUFIRMWARE2_FN_FILE) \
Zheng Baoc64f21c2015-11-17 22:58:55 +0800230 $(OPT_2SMUSCS_FILE) \
Martin Rothd61b5402016-11-08 11:49:58 -0700231 --flashsize $(CONFIG_ROM_SIZE) \
Zheng Baoc64f21c2015-11-17 22:58:55 +0800232 --output $@
233
Marshall Dawsonc6be0d82017-01-07 18:17:32 -0500234ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
235PHONY+=add_amdfw
236INTERMEDIATE+=add_amdfw
237
238add_amdfw: $(obj)/coreboot.pre $(obj)/amdfw.rom
239 printf " DD Adding AMD Firmware\n"
240 dd if=$(obj)/amdfw.rom \
241 of=$(obj)/coreboot.pre conv=notrunc bs=1 seek=131072 >/dev/null 2>&1
242
243else # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
244
Zheng Baoc64f21c2015-11-17 22:58:55 +0800245cbfs-files-y += apu/amdfw
246apu/amdfw-file := $(obj)/amdfw.rom
247apu/amdfw-position := $(HUDSON_FWM_POSITION)
248apu/amdfw-type := raw
Marshall Dawsonc6be0d82017-01-07 18:17:32 -0500249
250endif # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)