blob: 73b15f95553749bbdea06a62c21d3ffd178b72d0 [file] [log] [blame]
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +03001#*****************************************************************************
2#
3# Copyright (c) 2012, Advanced Micro Devices, Inc.
4# 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
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030031romstage-y += smbus.c smbus_spd.c
32ramstage-y += hudson.c
33ramstage-y += usb.c
34ramstage-y += lpc.c
35ramstage-y += sm.c
36ramstage-y += ide.c
37ramstage-y += sata.c
38ramstage-y += hda.c
39ramstage-y += pci.c
40ramstage-y += pcie.c
41ramstage-y += sd.c
42
43ramstage-$(CONFIG_HAVE_ACPI_TABLES) += fadt.c
44ramstage-y += reset.c
45romstage-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += enable_usbdebug.c
46ramstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
47romstage-y += early_setup.c
WANG Siyuanc7667f02015-06-23 22:28:17 +080048ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
49romstage-y += imc.c
50ramstage-y += imc.c
51endif
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030052
53smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c smi_util.c
54ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi.c smi_util.c
55
56# ROMSIG At ROMBASE + 0x20000:
57# +-----------+---------------+----------------+------------+
58# |0x55AA55AA |EC ROM Address |GEC ROM Address |USB3 ROM |
59# +-----------+---------------+----------------+------------+
60# |PSPDIR ADDR|
61# +-----------+
62#
63# EC ROM should be 64K aligned.
64
Martin Rothd12d65f2015-06-28 14:06:23 -060065HUDSON_FWM_POS_CALC=$(call int-add, $(call int-subtract, 0xffffffff $(call int-multiply, $(CONFIG_COREBOOT_ROMSIZE_KB) 1024)) 0x20000 1)
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030066HUDSON_FWM_POSITION=$(shell printf %u $(CONFIG_HUDSON_FWM_POSITION))
Marc Jonesf92a1892015-07-19 15:41:15 -060067HUDSON_FWM_INSIDE_CBFS=$(call int-lt, $(CBFS_BASE_ADDRESS) $(HUDSON_FWM_POSITION))
Martin Rothd12d65f2015-06-28 14:06:23 -060068
69ifneq ($(HUDSON_FWM_POS_CALC), $(HUDSON_FWM_POSITION))
70$(warning ##### WARNING: CONFIG_HUDSON_FWM_POSITION does not match calculated firmware position $(HUDSON_FWM_POS_CALC) != $(HUDSON_FWM_POSITION) ##### )
71endif
Martin Rothd139c482015-06-28 14:12:29 -060072ifneq ($(HUDSON_FWM_INSIDE_CBFS), 1)
73$(warning ##### WARNING: CONFIG_HUDSON_FWM_POSITION ($(HUDSON_FWM_POSITION)) is outside of CBFS area ($(CBFS_BASE_ADDRESS) to 4294967295) ##### )
74endif
Patrick Georgi4cfec532015-07-16 15:34:26 +020075CBFS_HEADER_SIZE=0x60
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030076
Bruce Griffith5e2053e2014-12-05 19:38:53 -070077#assume the cbfs header is less than $(CBFS_HEADER_SIZE) bytes.
78ROMSIG_SIZE=4096
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030079ifeq ($(CONFIG_HUDSON_XHCI_FWM), y)
Bruce Griffith5e2053e2014-12-05 19:38:53 -070080HUDSON_XHCI_POSITION=$(call int-add,$(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030081XHCI_FWM_SIZE=$(call file-size,$(CONFIG_HUDSON_XHCI_FWM_FILE))
82else
83HUDSON_XHCI_POSITION=0
84XHCI_FWM_SIZE=0
85endif
86
87ifeq ($(CONFIG_HUDSON_GEC_FWM), y)
Bruce Griffith5e2053e2014-12-05 19:38:53 -070088HUDSON_GEC_POSITION=$(call int-add,$(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE) \
89 $(XHCI_FWM_SIZE) $(CBFS_HEADER_SIZE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030090GEC_FWM_SIZE=$(call file-size,$(CONFIG_HUDSON_GEC_FWM_FILE))
91else
92HUDSON_GEC_POSITION=0
93GEC_FWM_SIZE=0
94endif
95
96ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
97HUDSON_IMC_POSITION=$(call int-align,\
98 $(call int-add,\
Bruce Griffith5e2053e2014-12-05 19:38:53 -070099 $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE) $(XHCI_FWM_SIZE)\
100 $(CBFS_HEADER_SIZE) $(GEC_FWM_SIZE) $(CBFS_HEADER_SIZE)),\
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300101 65536)
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700102IMC_FWM_SIZE=$(call file-size,$(CONFIG_HUDSON_IMC_FWM_FILE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300103else
104HUDSON_IMC_POSITION=0
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700105IMC_FWM_SIZE=0
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300106endif
107
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300108ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700109HUDSON_PSP_DIRECTORY_POSITION=$(call int-align,\
110 $(call int-add,\
111 $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE) $(XHCI_FWM_SIZE)\
112 $(CBFS_HEADER_SIZE) $(GEC_FWM_SIZE) $(CBFS_HEADER_SIZE) $(IMC_FWM_SIZE) $(CBFS_HEADER_SIZE)),\
113 65536)
114HUDSON_PSP_DIRECTORY_SIZE=256
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800115else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
WANG Siyuanc7667f02015-06-23 22:28:17 +0800116ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
117HUDSON_PSP_OFFSET=131072
118else
119HUDSON_PSP_OFFSET=0
120endif
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800121HUDSON_PSP_DIRECTORY_POSITION=$(call int-align,\
122 $(call int-add,\
123 $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE) $(XHCI_FWM_SIZE)\
WANG Siyuanc7667f02015-06-23 22:28:17 +0800124 $(CBFS_HEADER_SIZE) $(GEC_FWM_SIZE) $(CBFS_HEADER_SIZE) $(IMC_FWM_SIZE) $(CBFS_HEADER_SIZE) $(HUDSON_PSP_OFFSET)),\
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800125 65536)
126HUDSON_PSP_DIRECTORY_SIZE=256
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700127else
128HUDSON_PSP_DIRECTORY_POSITION=0
129HUDSON_PSP_DIRECTORY_SIZE=0
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300130endif
131
132$(obj)/coreboot_hudson_romsig.bin: $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE)) \
133 $(call strip_quotes, $(CONFIG_HUDSON_IMC_FWM_FILE)) \
134 $(call strip_quotes, $(CONFIG_HUDSON_GEC_FWM_FILE)) \
135 $(obj)/config.h
136 echo " Hudson FW $@"
zbao3ad1f1c2015-06-17 20:03:29 -0400137 printf %d $(ROMSIG_SIZE) | LC_ALL=C awk '{for (i=0; i<$$1; i++) {printf "%c", 255}}' > $@; \
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300138 for fwm in 1437226410 \
139 $(HUDSON_IMC_POSITION) \
140 $(HUDSON_GEC_POSITION) \
141 $(HUDSON_XHCI_POSITION) \
142 $(HUDSON_PSP_DIRECTORY_POSITION); do \
143 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700144 done > $@.tmp; \
145 dd if=$@.tmp of=$@ conv=notrunc status=noxfer 2>/dev/null; \
146 rm $@.tmp
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300147
148ifeq ($(CONFIG_HUDSON_FWM), y)
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700149cbfs-files-y += fch/fwm
150fch/fwm-file := $(obj)/coreboot_hudson_romsig.bin
151fch/fwm-position := $(HUDSON_FWM_POSITION)
152fch/fwm-size := $(ROMSIZE_SIG)
153fch/fwm-type := raw
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300154endif
155
156ifeq ($(CONFIG_HUDSON_XHCI_FWM), y)
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700157cbfs-files-y += fch/xhci
158fch/xhci-file := $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE))
159fch/xhci-position := $(HUDSON_XHCI_POSITION)
160fch/xhci-type := raw
Patrick Georgi26e24cc2015-05-05 22:27:25 +0200161fch/xhci-required := Hudson XHCI firmware (available in coreboot/3rdparty/blobs if enabled)
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300162endif
163
164ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700165cbfs-files-y += fch/imc
166fch/imc-file := $(call strip_quotes, $(CONFIG_HUDSON_IMC_FWM_FILE))
167fch/imc-position := $(HUDSON_IMC_POSITION)
168fch/imc-type := raw
Patrick Georgi26e24cc2015-05-05 22:27:25 +0200169fch/imc-required := Hudson IMC Firmware (available in coreboot/3rdparty/blobs if enabled)
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300170endif
171
172ifeq ($(CONFIG_HUDSON_GEC_FWM), y)
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700173cbfs-files-y += fch/gec
174fch/gec-file := $(call strip_quotes, $(CONFIG_HUDSON_GEC_FWM_FILE))
175fch/gec-position := $(HUDSON_GEC_POSITION)
176fch/gec-type := raw
177fch/gec-required := Hudson Gigabit Ethernet Controller Firmware (Contact your AMD representative)
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300178endif
179
180ifdef CONFIG_HUDSON_AHCI_ROM
181stripped_ahci_rom_id = $(call strip_quotes,$(CONFIG_AHCI_ROM_ID))
182cbfs-files-y += pci$(stripped_ahci_rom_id).rom
183pci$(stripped_ahci_rom_id).rom-file := $(call strip_quotes,$(CONFIG_AHCI_ROM_FILE))
184pci$(stripped_ahci_rom_id).rom-type := optionrom
185pci$(stripped_ahci_rom_id).rom-required := Hudson AHCI Option ROM (Contact your AMD representative)
186endif
187
188ifeq ($(CONFIG_HUDSON_PSP), y)
189
190# 0
191# catenate the pubkey and pspdir together to save some space.
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700192AMDPUBKEY_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) $(HUDSON_PSP_DIRECTORY_SIZE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300193AMDPUBKEY_SIZE=$(call file-size,$(CONFIG_AMD_PUBKEY_FILE))
194
195ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
196FIRMWARE_LOCATE=$(dir $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE)))
197FIRMWARE_TYPE=
198endif
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300199
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800200ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
201FIRMWARE_LOCATE=$(dir $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE)))
202FIRMWARE_TYPE=CZ
203endif
204
205#5
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300206CONFIG_PUBSIGNEDKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/RtmPubSigned$(FIRMWARE_TYPE).key
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700207PUBSIGNEDKEY_POS=$(call int-align, \
208 $(call int-add,$(AMDPUBKEY_POS) $(AMDPUBKEY_SIZE) $(CBFS_HEADER_SIZE)), \
209 $(CBFS_HEADER_SIZE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300210PUBSIGNEDKEY_SIZE=$(call file-size,$(CONFIG_PUBSIGNEDKEY_FILE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300211
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800212#1
213ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700214CONFIG_PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader$(FIRMWARE_TYPE).Bypass.sbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800215else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
216CONFIG_PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader_prod_$(FIRMWARE_TYPE).sbin
217endif
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700218PSPBTLDR_POS=$(call int-align, \
219 $(call int-add,$(PUBSIGNEDKEY_POS) $(PUBSIGNEDKEY_SIZE) $(CBFS_HEADER_SIZE)), \
220 $(CBFS_HEADER_SIZE))
221PSPBTLDR_SIZE=$(call file-size,$(CONFIG_PSPBTLDR_FILE))
222
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800223#3
224ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700225CONFIG_PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecovery$(FIRMWARE_TYPE).sbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800226else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
227CONFIG_PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecoveryBootLoader_prod_$(FIRMWARE_TYPE).sbin
228endif
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700229PSPRCVR_POS=$(call int-align, \
230 $(call int-add,$(PSPBTLDR_POS) $(PSPBTLDR_SIZE) $(CBFS_HEADER_SIZE)), \
231 $(CBFS_HEADER_SIZE))
232PSPRCVR_SIZE=$(call file-size,$(CONFIG_PSPRCVR_FILE))
233
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800234#2
235ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300236CONFIG_PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs$(FIRMWARE_TYPE).sbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800237else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
WANG Siyuandb087652015-06-16 21:21:00 +0800238CONFIG_PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs_prod_$(FIRMWARE_TYPE).csbin
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800239endif
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700240PSPSECUREOS_POS=$(call int-align, \
241 $(call int-add,$(PSPRCVR_POS) $(PSPRCVR_SIZE) $(CBFS_HEADER_SIZE)), \
242 $(CBFS_HEADER_SIZE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300243PSPSECUREOS_SIZE=$(call file-size,$(CONFIG_PSPSCUREOS_FILE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300244
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800245#4
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300246CONFIG_PSPNVRAM_FILE=$(top)/$(FIRMWARE_LOCATE)/PspNvram$(FIRMWARE_TYPE).bin
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700247PSPNVRAM_POS=$(call int-align, \
248 $(call int-add,$(PSPSECUREOS_POS) $(PSPSECUREOS_SIZE) $(CBFS_HEADER_SIZE)), \
249 $(CBFS_HEADER_SIZE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300250PSPNVRAM_SIZE=$(call file-size,$(CONFIG_PSPNVRAM_FILE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300251
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800252#8
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700253CONFIG_SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE).sbin
254SMUFWM_POS=$(call int-align, \
255 $(call int-add,$(PSPNVRAM_POS) $(PSPNVRAM_SIZE) $(CBFS_HEADER_SIZE)), \
256 $(CBFS_HEADER_SIZE))
257SMUFWM_SIZE=$(call file-size,$(CONFIG_SMUFWM_FILE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300258
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800259#95
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300260CONFIG_SMUSCS_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuScs$(FIRMWARE_TYPE).bin
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700261SMUSCS_POS=$(call int-align, \
262 $(call int-add,$(SMUFWM_POS) $(SMUFWM_SIZE) $(CBFS_HEADER_SIZE)), \
263 $(CBFS_HEADER_SIZE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300264SMUSCS_SIZE=$(call file-size,$(CONFIG_SMUSCS_FILE))
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300265
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800266#9
267CONFIG_PSPSECUREDEBUG_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureDebug$(FIRMWARE_TYPE).Key
268PSPSECUREDEBUG_POS=$(call int-align, \
269 $(call int-add,$(SMUSCS_POS) $(SMUSCS_SIZE) $(CBFS_HEADER_SIZE)), \
270 $(CBFS_HEADER_SIZE))
271PSPSECUREDEBUG_SIZE=$(call file-size,$(CONFIG_PSPSECUREDEBUG_FILE))
272
273#12
274ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
275CONFIG_PSPTRUSTLETS_FILE=$(top)/$(FIRMWARE_LOCATE)/trustlets.bin
276else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
277CONFIG_PSPTRUSTLETS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspTrustlets_prod_$(FIRMWARE_TYPE).cbin
278endif
279PSPTRUSTLETS_POS=$(call int-align, \
280 $(call int-add,$(PSPSECUREDEBUG_POS) $(PSPSECUREDEBUG_SIZE) $(CBFS_HEADER_SIZE)), \
281 $(CBFS_HEADER_SIZE))
282PSPTRUSTLETS_SIZE=$(call file-size,$(CONFIG_PSPTRUSTLETS_FILE))
283
284#13
285ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y)
286CONFIG_TRUSTLETKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/Trustlet.tkn.cert
287else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
288CONFIG_TRUSTLETKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/TrustletKey_prod_$(FIRMWARE_TYPE).sbin
289endif
290TRUSTLETKEY_POS=$(call int-align, \
291 $(call int-add,$(PSPTRUSTLETS_POS) $(PSPTRUSTLETS_SIZE) $(CBFS_HEADER_SIZE)), \
292 $(CBFS_HEADER_SIZE))
293TRUSTLETKEY_SIZE=$(call file-size,$(CONFIG_TRUSTLETKEY_FILE))
294
295#18
296ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
297CONFIG_SMUFIRMWARE2_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware2_prod_$(FIRMWARE_TYPE).sbin
298SMUFIRMWARE2_POS=$(call int-align, \
299 $(call int-add,$(TRUSTLETKEY_POS) $(TRUSTLETKEY_SIZE) $(CBFS_HEADER_SIZE)), \
300 $(CBFS_HEADER_SIZE))
301SMUFIRMWARE2_SIZE=$(call file-size,$(CONFIG_SMUFIRMWARE2_FILE))
302endif
303
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300304define output_hex
305echo $(1) | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'
306endef
307
308$(obj)/coreboot_psp_directory.bin: $(obj)/config.h $(FLETCHER) $(RTM_FILE)
309 echo " PSPDir $@"
310 for fwm in 0 $(AMDPUBKEY_SIZE) $(AMDPUBKEY_POS) 0; do \
311 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
312 done > $@_tail.tmp
313 for fwm in 1 $(PSPBTLDR_SIZE) $(PSPBTLDR_POS) 0; do \
314 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
315 done >> $@_tail.tmp
316 for fwm in 8 $(SMUFWM_SIZE) $(SMUFWM_POS) 0; do \
317 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
318 done >> $@_tail.tmp
319 for fwm in 3 $(PSPRCVR_SIZE) $(PSPRCVR_POS) 0; do \
320 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
321 done >> $@_tail.tmp
322 for fwm in 5 $(PUBSIGNEDKEY_SIZE) $(PUBSIGNEDKEY_POS) 0; do \
323 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
324 done >> $@_tail.tmp
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300325 for fwm in 2 $(PSPSECUREOS_SIZE) $(PSPSECUREOS_POS) 0; do \
326 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
327 done >> $@_tail.tmp
328 for fwm in 4 $(PSPNVRAM_SIZE) $(PSPNVRAM_POS) 0; do \
329 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
330 done >> $@_tail.tmp
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800331 for fwm in 9 $(PSPSECUREDEBUG_SIZE) $(PSPSECUREDEBUG_POS) 0; do \
332 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
333 done >> $@_tail.tmp
334 for fwm in 12 $(PSPTRUSTLETS_SIZE) $(PSPTRUSTLETS_POS) 0; do \
335 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
336 done >> $@_tail.tmp
337 for fwm in 13 $(TRUSTLETKEY_SIZE) $(TRUSTLETKEY_POS) 0; do \
338 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
339 done >> $@_tail.tmp
340ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
341 for fwm in 18 $(SMUFIRMWARE2_SIZE) $(SMUFIRMWARE2_POS) 0; do \
342 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
343 done >> $@_tail.tmp
344endif
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300345 for fwm in 95 $(SMUSCS_SIZE) $(SMUSCS_POS) 0; do \
346 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
347 done >> $@_tail.tmp
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800348 for fwm in 11 4294967295 1 0; do \
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300349 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
350 done >> $@_tail.tmp
351 for fwm in 1347637284 0 `ls -l $@_tail.tmp | awk '{printf("%d", $$5/16);}'` 0; do \
352 echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
353 done > $@_head.tmp
354 cat $@_head.tmp $@_tail.tmp > $@.tmp
355 $(FLETCHER) < $@.tmp > $@
356 rm $@_head.tmp $@_tail.tmp $@.tmp
357
358$(obj)/coreboot_psp_directory_combine_pubkey.bin: $(obj)/coreboot_psp_directory.bin
359 cat $(obj)/coreboot_psp_directory.bin > $@
360 ls -l $(obj)/coreboot_psp_directory.bin | LC_ALL=C awk '{for (i=0; i<256-$$5; i++) {printf "%c", 255}}' >> $@
361 cat $(top)/$(FIRMWARE_LOCATE)/AmdPubKey$(FIRMWARE_TYPE).bin >> $@
362
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700363cbfs-files-y += apu/pspdir
364apu/pspdir-file := $(obj)/coreboot_psp_directory_combine_pubkey.bin
365apu/pspdir-position := $(HUDSON_PSP_DIRECTORY_POSITION)
366apu/pspdir-type := raw
367
368# 5
369cbfs-files-y += apu/pubsignedkey
370apu/pubsignedkey-file := $(CONFIG_PUBSIGNEDKEY_FILE)
371apu/pubsignedkey-position := $(PUBSIGNEDKEY_POS)
372apu/pubsignedkey-type := raw
373
374# 1
375cbfs-files-y += apu/pspbtldr
376apu/pspbtldr-file := $(CONFIG_PSPBTLDR_FILE)
377apu/pspbtldr-position := $(PSPBTLDR_POS)
378apu/pspbtldr-type := raw
379
380#3
381cbfs-files-y += apu/psprcvr
382apu/psprcvr-file := $(CONFIG_PSPRCVR_FILE)
383apu/psprcvr-position := $(PSPRCVR_POS)
384apu/psprcvr-type := raw
385
386# 2
387cbfs-files-y += apu/pspsecureos
388apu/pspsecureos-file := $(CONFIG_PSPSCUREOS_FILE)
389apu/pspsecureos-position := $(PSPSECUREOS_POS)
390apu/pspsecureos-type := raw
391
392# 4
393cbfs-files-y += apu/pspnvram
394apu/pspnvram-file := $(CONFIG_PSPNVRAM_FILE)
395apu/pspnvram-position := $(PSPNVRAM_POS)
396apu/pspnvram-type := raw
397
398#8
399cbfs-files-y += apu/smufwm
400apu/smufwm-file := $(CONFIG_SMUFWM_FILE)
401apu/smufwm-position := $(SMUFWM_POS)
402apu/smufwm-type := raw
403
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800404#95
Bruce Griffith5e2053e2014-12-05 19:38:53 -0700405cbfs-files-y += apu/smuscs
406apu/smuscs-file := $(CONFIG_SMUSCS_FILE)
407apu/smuscs-position := $(SMUSCS_POS)
408apu/smuscs-type := raw
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300409
WANG Siyuanf2dfef02015-05-20 14:41:01 +0800410#9
411cbfs-files-y += apu/pspsecuredebug
412apu/pspsecuredebug-file := $(CONFIG_PSPSECUREDEBUG_FILE)
413apu/pspsecuredebug-position := $(PSPSECUREDEBUG_POS)
414apu/pspsecuredebug-type := raw
415
416#12
417cbfs-files-y += apu/psptrustlets
418apu/psptrustlets-file := $(CONFIG_PSPTRUSTLETS_FILE)
419apu/psptrustlets-position := $(PSPTRUSTLETS_POS)
420apu/psptrustlets-type := raw
421
422#13
423cbfs-files-y += apu/trustletkey
424apu/trustletkey-file := $(CONFIG_TRUSTLETKEY_FILE)
425apu/trustletkey-position := $(TRUSTLETKEY_POS)
426apu/trustletkey-type := raw
427
428#18
429ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
430cbfs-files-y += apu/smufirmware2
431apu/smufirmware2-file := $(CONFIG_SMUFIRMWARE2_FILE)
432apu/smufirmware2-position := $(SMUFIRMWARE2_POS)
433apu/smufirmware2-type := raw
434endif
435
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +0300436endif