usbdebug: Make the EHCI debug console work in the bootblock
[coreboot.git] / src / soc / amd / stoneyridge / Makefile.inc
blob0f6290bc499e52374e8afdf3b9473849feb129bc
1 #*****************************************************************************
3 # Copyright (c) 2012, 2016-2017 Advanced Micro Devices, Inc.
4 #               2013 - 2014 Sage Electronic Engineering, LLC
5 # All rights reserved.
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.
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.
29 #*****************************************************************************
30 ifeq ($(CONFIG_SOC_AMD_STONEYRIDGE_FP4)$(CONFIG_SOC_AMD_STONEYRIDGE_FT4),y)
32 subdirs-y += ../../../cpu/amd/mtrr/
33 subdirs-y += ../../../cpu/x86/tsc
34 subdirs-y += ../../../cpu/x86/lapic
35 subdirs-y += ../../../cpu/x86/cache
36 subdirs-y += ../../../cpu/x86/mtrr
37 subdirs-y += ../../../cpu/x86/pae
38 subdirs-y += ../../../cpu/x86/smm
40 bootblock-$(CONFIG_STONEYRIDGE_UART) += uart.c
41 bootblock-y += BiosCallOuts.c
42 bootblock-y += bootblock/bootblock.c
43 bootblock-y += gpio.c
44 bootblock-y += i2c.c
45 bootblock-$(CONFIG_USBDEBUG) += enable_usbdebug.c
46 bootblock-y += monotonic_timer.c
47 bootblock-y += pmutil.c
48 bootblock-y += reset.c
49 bootblock-y += sb_util.c
50 bootblock-y += tsc_freq.c
51 bootblock-y += southbridge.c
52 bootblock-y += nb_util.c
53 bootblock-$(CONFIG_SPI_FLASH) += spi.c
54 bootblock-$(CONFIG_HAVE_SMI_HANDLER) += smi_util.c
56 romstage-y += BiosCallOuts.c
57 romstage-y += i2c.c
58 romstage-y += romstage.c
59 romstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
60 romstage-y += gpio.c
61 romstage-y += monotonic_timer.c
62 romstage-y += pmutil.c
63 romstage-y += reset.c
64 romstage-y += sb_util.c
65 romstage-y += smbus.c
66 romstage-y += smbus_spd.c
67 romstage-y += ramtop.c
68 romstage-$(CONFIG_STONEYRIDGE_UART) += uart.c
69 romstage-y += tsc_freq.c
70 romstage-y += southbridge.c
71 romstage-y += nb_util.c
72 romstage-$(CONFIG_SPI_FLASH) += spi.c
73 romstage-$(CONFIG_HAVE_SMI_HANDLER) += smi_util.c
75 verstage-y += gpio.c
76 verstage-y += i2c.c
77 verstage-y += monotonic_timer.c
78 verstage-y += sb_util.c
79 verstage-y += pmutil.c
80 verstage-y += reset.c
81 verstage-$(CONFIG_STONEYRIDGE_UART) += uart.c
82 verstage-y += tsc_freq.c
83 verstage-y += nb_util.c
84 verstage-$(CONFIG_SPI_FLASH) += spi.c
86 postcar-y += monotonic_timer.c
87 postcar-$(CONFIG_STONEYRIDGE_UART) += uart.c
88 postcar-y += ramtop.c
89 postcar-y += sb_util.c
90 postcar-y += nb_util.c
91 postcar-$(CONFIG_VBOOT_MEASURED_BOOT) += i2c.c
93 ramstage-y += BiosCallOuts.c
94 ramstage-y += i2c.c
95 ramstage-y += chip.c
96 ramstage-y += cpu.c
97 ramstage-y += mca.c
98 ramstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
99 ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c
100 ramstage-y += gpio.c
101 ramstage-y += hda.c
102 ramstage-y += iommu.c
103 ramstage-y += monotonic_timer.c
104 ramstage-y += southbridge.c
105 ramstage-y += sb_util.c
106 ramstage-y += lpc.c
107 ramstage-y += northbridge.c
108 ramstage-y += pmutil.c
109 ramstage-y += reset.c
110 ramstage-y += sata.c
111 ramstage-y += sm.c
112 ramstage-y += smbus.c
113 ramstage-y += ramtop.c
114 ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi.c
115 ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi_util.c
116 ramstage-$(CONFIG_STONEYRIDGE_UART) += uart.c
117 ramstage-y += usb.c
118 ramstage-y += tsc_freq.c
119 ramstage-$(CONFIG_SPI_FLASH) += spi.c
120 ramstage-y += finalize.c
121 ramstage-y += nb_util.c
123 smm-y += monotonic_timer.c
124 smm-y += smihandler.c
125 smm-y += smi_util.c
126 smm-y += sb_util.c
127 smm-y += tsc_freq.c
128 smm-$(CONFIG_DEBUG_SMI) += uart.c
129 smm-$(CONFIG_SPI_FLASH) += spi.c
130 smm-y += nb_util.c
131 smm-y += gpio.c
133 CPPFLAGS_common += -I$(src)/soc/amd/stoneyridge
134 CPPFLAGS_common += -I$(src)/soc/amd/stoneyridge/include
135 CPPFLAGS_common += -I$(src)/soc/amd/stoneyridge/acpi
137 # ROMSIG Normally At ROMBASE + 0x20000
138 # Overridden by CONFIG_AMD_FWM_POSITION_INDEX
139 # +-----------+---------------+----------------+------------+
140 # |0x55AA55AA |EC ROM Address |GEC ROM Address |USB3 ROM    |
141 # +-----------+---------------+----------------+------------+
142 # |PSPDIR ADDR|
143 # +-----------+
145 # EC ROM should be 64K aligned.
146 STONEYRIDGE_FWM_POSITION=$(call int-add, \
147         $(call int-subtract, 0xffffffff \
148         $(call int-shift-left, \
149         0x80000 $(CONFIG_AMD_FWM_POSITION_INDEX))) 0x20000 1)
151 ### 0
152 FIRMWARE_LOCATE=$(dir $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE)))
153 FIRMWARE_TYPE=ST
155 ###5
156 PUBSIGNEDKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/RtmPubSigned$(FIRMWARE_TYPE).key
158 ###1
159 PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader_prod_$(FIRMWARE_TYPE).sbin
161 ###3
162 PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecoveryBootLoader_prod_$(FIRMWARE_TYPE).sbin
164 ###4
165 PSPNVRAM_FILE=$(top)/$(FIRMWARE_LOCATE)/PspNvram$(FIRMWARE_TYPE).bin
167 ###8 - Check for SMU firmware named either *.sbin or *.csbin
168 ###    TODO: Remove *.sbin section after the blobs repo is updated.
169 SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware_$(FIRMWARE_TYPE).csbin
170 SMUFWM_FN_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware_$(FIRMWARE_TYPE)_FN.csbin
171 ifeq ("$(wildcard $(SMUFWM_FILE))","")
172 SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE).sbin
173 SMUFWM_FN_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE)_FN.sbin
174 endif
176 ###95
177 SMUSCS_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuScs$(FIRMWARE_TYPE).bin
179 ###9
180 PSPSECUREDEBUG_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureDebug$(FIRMWARE_TYPE).Key
182 ifeq ($(CONFIG_USE_PSPSCUREOS),y)
183 ###2
184 PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs_prod_$(FIRMWARE_TYPE).csbin
186 ###12
187 PSPTRUSTLETS_FILE=$(wildcard $(top)/$(FIRMWARE_LOCATE)/PspTrustlets*_prod_$(FIRMWARE_TYPE).cbin)
189 ###13
190 TRUSTLETKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/TrustletKey_prod_$(FIRMWARE_TYPE).sbin
191 endif
193 ###18- Check for SMU firmware2 named either *.sbin or *.csbin
194 ###    TODO: Remove *.sbin section after the blobs repo is updated.
195 SMUFIRMWARE2_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware2_prod_$(FIRMWARE_TYPE).csbin
196 SMUFIRMWARE2_FN_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware2_prod_$(FIRMWARE_TYPE)_FN.csbin
197 ifeq ("$(wildcard $(SMUFIRMWARE2_FILE))","")
198 SMUFIRMWARE2_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware2_prod_$(FIRMWARE_TYPE).sbin
199 SMUFIRMWARE2_FN_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware2_prod_$(FIRMWARE_TYPE)_FN.sbin
200 endif
202 add_opt_prefix=$(if $(call strip_quotes, $(1)), $(2) $(call strip_quotes, $(1)), )
204 OPT_STONEYRIDGE_XHCI_FWM_FILE=$(call add_opt_prefix, $(CONFIG_STONEYRIDGE_XHCI_FWM_FILE), --xhci)
205 OPT_STONEYRIDGE_GEC_FWM_FILE=$(call add_opt_prefix, $(CONFIG_STONEYRIDGE_GEC_FWM_FILEddd), --gec)
207 OPT_2AMD_PUBKEY_FILE=$(call add_opt_prefix, $(CONFIG_AMD_PUBKEY_FILE), --pubkey2)
208 OPT_2PSPBTLDR_FILE=$(call add_opt_prefix, $(PSPBTLDR_FILE), --bootloader2)
209 OPT_2SMUFWM_FILE=$(call add_opt_prefix, $(SMUFWM_FILE), --smufirmware_2)
210 OPT_2PSPRCVR_FILE=$(call add_opt_prefix, $(PSPRCVR_FILE), --recovery2)
211 OPT_2PUBSIGNEDKEY_FILE=$(call add_opt_prefix, $(PUBSIGNEDKEY_FILE), --rtmpubkey2)
212 OPT_2PSPNVRAM_FILE=$(call add_opt_prefix, $(PSPNVRAM_FILE), --nvram2)
213 OPT_2PSPSECUREDEBUG_FILE=$(call add_opt_prefix, $(PSPSECUREDEBUG_FILE), --securedebug2)
214 ifeq ($(CONFIG_USE_PSPSCUREOS),y)
215 OPT_2PSPSCUREOS_FILE=$(call add_opt_prefix, $(PSPSCUREOS_FILE), --secureos2)
216 OPT_2PSPTRUSTLETS_FILE=$(call add_opt_prefix, $(PSPTRUSTLETS_FILE), --trustlets2)
217 OPT_2TRUSTLETKEY_FILE=$(call add_opt_prefix, $(TRUSTLETKEY_FILE), --trustletkey2)
218 endif
219 OPT_2SMUFIRMWARE2_FILE=$(call add_opt_prefix, $(SMUFIRMWARE2_FILE), --smufirmware2_2)
220 OPT_2SMUSCS_FILE=$(call add_opt_prefix, $(SMUSCS_FILE), --smuscs2)
221 OPT_2SMUFWM_FN_FILE=$(call add_opt_prefix, $(SMUFWM_FN_FILE), --smufnfirmware_2)
222 OPT_2SMUFIRMWARE2_FN_FILE=$(call add_opt_prefix, $(SMUFIRMWARE2_FN_FILE), --smufnfirmware2_2)
225 $(obj)/amdfw.rom:       $(call strip_quotes, $(CONFIG_STONEYRIDGE_XHCI_FWM_FILE)) \
226                         $(call strip_quotes, $(CONFIG_STONEYRIDGE_GEC_FWM_FILE)) \
227                         $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE)) \
228                         $(call strip_quotes, $(PUBSIGNEDKEY_FILE)) \
229                         $(call strip_quotes, $(PSPBTLDR_FILE)) \
230                         $(call strip_quotes, $(PSPRCVR_FILE)) \
231                         $(call strip_quotes, $(PSPSCUREOS_FILE)) \
232                         $(call strip_quotes, $(PSPNVRAM_FILE)) \
233                         $(call strip_quotes, $(SMUFWM_FILE)) \
234                         $(call strip_quotes, $(SMUFWM_FN_FILE)) \
235                         $(call strip_quotes, $(SMUSCS_FILE)) \
236                         $(call strip_quotes, $(PSPSECUREDEBUG_FILE)) \
237                         $(call strip_quotes, $(PSPTRUSTLETS_FILE)) \
238                         $(call strip_quotes, $(TRUSTLETKEY_FILE)) \
239                         $(call strip_quotes, $(SMUFIRMWARE2_FILE)) \
240                         $(call strip_quotes, $(SMUFIRMWARE2_FN_FILE)) \
241                         $(AMDFWTOOL)
242         rm -f $@
243         @printf "    AMDFWTOOL  $(subst $(obj)/,,$(@))\n"
244         $(AMDFWTOOL) \
245                 $(OPT_STONEYRIDGE_XHCI_FWM_FILE) \
246                 $(OPT_STONEYRIDGE_GEC_FWM_FILE) \
247                 $(OPT_AMD_PUBKEY_FILE) \
248                 $(OPT_PSPBTLDR_FILE) \
249                 $(OPT_SMUFWM_FILE) \
250                 $(OPT_PSPRCVR_FILE) \
251                 $(OPT_PUBSIGNEDKEY_FILE) \
252                 $(OPT_PSPSCUREOS_FILE) \
253                 $(OPT_PSPNVRAM_FILE) \
254                 $(OPT_PSPSECUREDEBUG_FILE) \
255                 $(OPT_PSPTRUSTLETS_FILE) \
256                 $(OPT_TRUSTLETKEY_FILE) \
257                 $(OPT_SMUFIRMWARE2_FILE) \
258                 $(OPT_SMUSCS_FILE) \
259                 $(OPT_2AMD_PUBKEY_FILE) \
260                 $(OPT_2PSPBTLDR_FILE) \
261                 $(OPT_2SMUFWM_FILE) \
262                 $(OPT_2SMUFWM_FN_FILE) \
263                 $(OPT_2PSPRCVR_FILE) \
264                 $(OPT_2PUBSIGNEDKEY_FILE) \
265                 $(OPT_2PSPSCUREOS_FILE) \
266                 $(OPT_2PSPNVRAM_FILE) \
267                 $(OPT_2PSPSECUREDEBUG_FILE) \
268                 $(OPT_2PSPTRUSTLETS_FILE) \
269                 $(OPT_2TRUSTLETKEY_FILE) \
270                 $(OPT_2SMUFIRMWARE2_FILE) \
271                 $(OPT_2SMUFIRMWARE2_FN_FILE) \
272                 $(OPT_2SMUSCS_FILE) \
273                 --flashsize $(CONFIG_ROM_SIZE) \
274                 --location $(shell printf "0x%x" $(STONEYRIDGE_FWM_POSITION)) \
275                 --output        $@
277 ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
278 PHONY+=add_amdfw
279 INTERMEDIATE+=add_amdfw
281 # Calculate firmware position inside the ROM
282 STONEYRIDGE_FWM_ROM_POSITION=$(call int-add, \
283         $(call int-subtract, $(CONFIG_ROM_SIZE) \
284         $(call int-shift-left, \
285         0x80000 $(CONFIG_AMD_FWM_POSITION_INDEX))) 0x20000)
287 add_amdfw: $(obj)/coreboot.pre $(obj)/amdfw.rom
288         printf "    DD         Adding AMD Firmware at ROM offset 0x%x\n" \
289                 "$(STONEYRIDGE_FWM_ROM_POSITION)"
290         dd if=$(obj)/amdfw.rom \
291                 of=$(obj)/coreboot.pre conv=notrunc bs=1 \
292                 seek=$(STONEYRIDGE_FWM_ROM_POSITION) >/dev/null 2>&1
294 else # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
296 cbfs-files-y += apu/amdfw
297 apu/amdfw-file := $(obj)/amdfw.rom
298 apu/amdfw-position := $(STONEYRIDGE_FWM_POSITION)
299 apu/amdfw-type := raw
301 endif # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
303 ifeq ($(CONFIG_SOC_AMD_PSP_SELECTABLE_SMU_FW),y)
305 cbfs-files-y += smu_fw
306 cbfs-files-y += smu_fw2
307 smu_fw-type := raw
308 smu_fw2-type := raw
310 ifeq ($(CONFIG_SOC_AMD_SMU_FANLESS),y)
311 smu_fw-file := $(SMUFWM_FN_FILE)
312 smu_fw2-file := $(SMUFIRMWARE2_FN_FILE)
313 else ifeq ($(CONFIG_SOC_AMD_SMU_FANNED),y)
314 smu_fw-file := $(SMUFWM_FILE)
315 smu_fw2-file := $(SMUFIRMWARE2_FILE)
316 else
317 $(error "Proper SMU Firmware not selected")
318 endif
320 endif # ifeq ($(CONFIG_SOC_AMD_PSP_SELECTABLE_SMU_FW),y)
322 endif # ($(CONFIG_SOC_AMD_STONEYRIDGE_FP4)$(CONFIG_SOC_AMD_STONEYRIDGE_FT4),y)