blob: e7ec1b73ec5aef88053b0ef810131e5653dd7801 [file] [log] [blame]
Martin Roth683bc5a2023-08-11 14:57:53 -06001## SPDX-License-Identifier: BSD-3-Clause
2
3# Copyright (c) 2012, Advanced Micro Devices, Inc.
4# 2013 - 2014, Sage Electronic Engineering, LLC
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +03005
Michał Żygowski8cee45c2019-11-23 18:03:46 +01006bootblock-y += bootblock.c
7bootblock-y += early_setup.c
8bootblock-$(CONFIG_USBDEBUG) += enable_usbdebug.c
Arthur Heymansadc47532018-12-28 15:48:58 +01009
Marc Jones05b2f692017-05-03 15:52:09 -060010romstage-y += early_setup.c
Arthur Heymansc63649b2019-11-16 12:13:03 +010011romstage-y += enable_usbdebug.c
Marc Jones05b2f692017-05-03 15:52:09 -060012romstage-$(CONFIG_HUDSON_IMC_FWM) += imc.c
13romstage-y += smbus.c
14romstage-y += smbus_spd.c
Marc Jones05b2f692017-05-03 15:52:09 -060015
16verstage-y += early_setup.c
Marc Jones05b2f692017-05-03 15:52:09 -060017
Arthur Heymansc63649b2019-11-16 12:13:03 +010018ramstage-y += enable_usbdebug.c
Marc Jones05b2f692017-05-03 15:52:09 -060019ramstage-$(CONFIG_HAVE_ACPI_TABLES) += fadt.c
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030020ramstage-y += hda.c
Marc Jones05b2f692017-05-03 15:52:09 -060021ramstage-y += hudson.c
22ramstage-y += ide.c
23ramstage-$(CONFIG_HUDSON_IMC_FWM) += imc.c
24ramstage-y += lpc.c
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030025ramstage-y += pci.c
26ramstage-y += pcie.c
Marc Jones05b2f692017-05-03 15:52:09 -060027ramstage-y += sata.c
28ramstage-y += sd.c
29ramstage-y += sm.c
30ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi.c
31ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi_util.c
Marc Jones05b2f692017-05-03 15:52:09 -060032ramstage-y += usb.c
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030033
Kyösti Mälkki9db39872019-12-13 18:11:05 +020034all-y += reset.c
35
Kyösti Mälkki9265f892019-07-07 23:58:34 +030036smm-y += smihandler.c
37smm-y += smi_util.c
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030038
Felix Held2768e362024-01-08 17:26:52 +010039CPPFLAGS_common += -I$(src)/southbridge/amd/pi/hudson/include
40
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030041# ROMSIG At ROMBASE + 0x20000:
42# +-----------+---------------+----------------+------------+
43# |0x55AA55AA |EC ROM Address |GEC ROM Address |USB3 ROM |
44# +-----------+---------------+----------------+------------+
45# |PSPDIR ADDR|
46# +-----------+
47#
48# EC ROM should be 64K aligned.
49
Kyösti Mälkki503f9fd2019-01-24 15:10:09 +020050ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
Ricardo Ribalda Delgadobaae9592016-12-20 10:51:08 +010051HUDSON_FWM_POSITION=$(call int-add, $(call int-subtract, 0xffffffff $(CONFIG_ROM_SIZE)) 0x20000 1)
Kyösti Mälkki503f9fd2019-01-24 15:10:09 +020052else
53HUDSON_FWM_POSITION=0xfff20000
54endif
Martin Rothd12d65f2015-06-28 14:06:23 -060055
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030056ifeq ($(CONFIG_HUDSON_PSP), y)
57
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030058ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030059FIRMWARE_TYPE=
Kyösti Mälkki8b8fbaf2019-01-24 15:07:37 +020060
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030061endif
Kyösti Mälkki8b8fbaf2019-01-24 15:07:37 +020062
Zheng Bao3384e4a2020-10-06 12:03:11 +080063#PUBSIGNEDKEY_FILE=$(top)/$(FIRMWARE_LOCATION)/RtmPubSigned$(FIRMWARE_TYPE).key
64#PSPNVRAM_FILE=$(top)/$(FIRMWARE_LOCATION)/PspNvram$(FIRMWARE_TYPE).bin
65#PSPSECUREDEBUG_FILE=$(top)/$(FIRMWARE_LOCATION)/PspSecureDebug$(FIRMWARE_TYPE).Key
WANG Siyuanf2dfef02015-05-20 14:41:01 +080066
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030067endif
Zheng Baoc64f21c2015-11-17 22:58:55 +080068
69add_opt_prefix=$(if $(call strip_quotes, $(1)), $(2) $(call strip_quotes, $(1)), )
70
71OPT_HUDSON_XHCI_FWM_FILE=$(call add_opt_prefix, $(CONFIG_HUDSON_XHCI_FWM_FILE), --xhci)
72OPT_HUDSON_IMC_FWM_FILE=$(call add_opt_prefix, $(CONFIG_HUDSON_IMC_FWM_FILE), --imc)
73OPT_HUDSON_GEC_FWM_FILE=$(call add_opt_prefix, $(CONFIG_HUDSON_GEC_FWM_FILEddd), --gec)
74
Kyösti Mälkkifa2786a2017-07-07 23:05:40 +030075OPT_AMD_PUBKEY_FILE=$(call add_opt_prefix, $(CONFIG_AMD_PUBKEY_FILE), --pubkey)
Martin Rothde60e602017-09-07 13:52:19 -060076OPT_PSPBTLDR_FILE=$(call add_opt_prefix, $(PSPBTLDR_FILE), --bootloader)
77OPT_SMUFWM_FILE=$(call add_opt_prefix, $(SMUFWM_FILE), --smufirmware)
78OPT_PSPRCVR_FILE=$(call add_opt_prefix, $(PSPRCVR_FILE), --recovery)
79OPT_PUBSIGNEDKEY_FILE=$(call add_opt_prefix, $(PUBSIGNEDKEY_FILE), --rtmpubkey)
Zheng Bao6252b602020-09-11 17:06:19 +080080OPT_PSPSECUREOS_FILE=$(call add_opt_prefix, $(PSPSECUREOS_FILE), --secureos)
Martin Rothde60e602017-09-07 13:52:19 -060081OPT_PSPNVRAM_FILE=$(call add_opt_prefix, $(PSPNVRAM_FILE), --nvram)
82OPT_PSPSECUREDEBUG_FILE=$(call add_opt_prefix, $(PSPSECUREDEBUG_FILE), --securedebug)
83OPT_PSPTRUSTLETS_FILE=$(call add_opt_prefix, $(PSPTRUSTLETS_FILE), --trustlets)
84OPT_TRUSTLETKEY_FILE=$(call add_opt_prefix, $(TRUSTLETKEY_FILE), --trustletkey)
85OPT_SMUFIRMWARE2_FILE=$(call add_opt_prefix, $(SMUFIRMWARE2_FILE), --smufirmware2)
86OPT_SMUSCS_FILE=$(call add_opt_prefix, $(SMUSCS_FILE), --smuscs)
Zheng Baoc64f21c2015-11-17 22:58:55 +080087
88$(obj)/amdfw.rom: $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE)) \
89 $(call strip_quotes, $(CONFIG_HUDSON_IMC_FWM_FILE)) \
90 $(call strip_quotes, $(CONFIG_HUDSON_GEC_FWM_FILE)) \
Martin Rothde60e602017-09-07 13:52:19 -060091 $(call strip_quotes, $(AMD_PUBKEY2_FILE)) \
92 $(call strip_quotes, $(PUBSIGNEDKEY2_FILE)) \
93 $(call strip_quotes, $(PSPBTLDR2_FILE)) \
94 $(call strip_quotes, $(SMUFWM2_FILE)) \
95 $(call strip_quotes, $(SMUFWM2_FN_FILE)) \
96 $(call strip_quotes, $(PSPRCVR2_FILE)) \
Zheng Bao6252b602020-09-11 17:06:19 +080097 $(call strip_quotes, $(PSPSECUREOS2_FILE)) \
Martin Rothde60e602017-09-07 13:52:19 -060098 $(call strip_quotes, $(PSPNVRAM2_FILE)) \
99 $(call strip_quotes, $(SMUSCS2_FILE)) \
100 $(call strip_quotes, $(PSPSECUREDEBUG2_FILE)) \
101 $(call strip_quotes, $(PSPTRUSTLETS2_FILE)) \
102 $(call strip_quotes, $(TRUSTLETKEY2_FILE)) \
103 $(call strip_quotes, $(SMUFIRMWARE2_2_FILE)) \
104 $(call strip_quotes, $(SMUFIRMWARE2_2_FN_FILE)) \
Zheng Baoc5e28ab2020-10-28 11:38:09 +0800105 $(DEP_FILES) \
Zheng Baoc64f21c2015-11-17 22:58:55 +0800106 $(AMDFWTOOL)
107 rm -f $@
Zheng Baoa962e062015-12-08 23:41:37 +0800108 @printf " AMDFWTOOL $(subst $(obj)/,,$(@))\n"
Zheng Baoc64f21c2015-11-17 22:58:55 +0800109 $(AMDFWTOOL) \
110 $(OPT_HUDSON_XHCI_FWM_FILE) \
111 $(OPT_HUDSON_IMC_FWM_FILE) \
112 $(OPT_HUDSON_GEC_FWM_FILE) \
Zheng Baoc64f21c2015-11-17 22:58:55 +0800113 $(OPT_2AMD_PUBKEY_FILE) \
114 $(OPT_2PSPBTLDR_FILE) \
115 $(OPT_2SMUFWM_FILE) \
Marshall Dawson0cd2cb62017-03-27 07:25:51 -0600116 $(OPT_2SMUFWM_FN_FILE) \
Zheng Baoc64f21c2015-11-17 22:58:55 +0800117 $(OPT_2PSPRCVR_FILE) \
118 $(OPT_2PUBSIGNEDKEY_FILE) \
Zheng Bao6252b602020-09-11 17:06:19 +0800119 $(OPT_2PSPSECUREOS_FILE) \
Zheng Baoc64f21c2015-11-17 22:58:55 +0800120 $(OPT_2PSPNVRAM_FILE) \
121 $(OPT_2PSPSECUREDEBUG_FILE) \
122 $(OPT_2PSPTRUSTLETS_FILE) \
123 $(OPT_2TRUSTLETKEY_FILE) \
124 $(OPT_2SMUFIRMWARE2_FILE) \
Marshall Dawson0cd2cb62017-03-27 07:25:51 -0600125 $(OPT_2SMUFIRMWARE2_FN_FILE) \
Zheng Baoc64f21c2015-11-17 22:58:55 +0800126 $(OPT_2SMUSCS_FILE) \
Martin Rothd61b5402016-11-08 11:49:58 -0700127 --flashsize $(CONFIG_ROM_SIZE) \
Kyösti Mälkki503f9fd2019-01-24 15:10:09 +0200128 --location $(HUDSON_FWM_POSITION) \
Zheng Baoc5e28ab2020-10-28 11:38:09 +0800129 --config $(CONFIG_AMDFW_CONFIG_FILE) \
Zheng Baoc64f21c2015-11-17 22:58:55 +0800130 --output $@
131
Marshall Dawsonc6be0d82017-01-07 18:17:32 -0500132ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
Patrick Georgi2cc5bcb2021-01-13 09:15:07 +0100133$(call add_intermediate, add_amdfw, $(obj)/amdfw.rom)
Marshall Dawsonc6be0d82017-01-07 18:17:32 -0500134 printf " DD Adding AMD Firmware\n"
Patrick Georgi0b7d3a12021-01-13 09:16:41 +0100135 dd if=$(obj)/amdfw.rom \
Arthur Heymans8ceef402021-07-06 16:20:09 +0200136 of=$< conv=notrunc bs=1 seek=131072 >/dev/null 2>&1
Marshall Dawsonc6be0d82017-01-07 18:17:32 -0500137
138else # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
139
Zheng Baoc64f21c2015-11-17 22:58:55 +0800140cbfs-files-y += apu/amdfw
141apu/amdfw-file := $(obj)/amdfw.rom
142apu/amdfw-position := $(HUDSON_FWM_POSITION)
143apu/amdfw-type := raw
Marshall Dawsonc6be0d82017-01-07 18:17:32 -0500144
145endif # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)