Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 1 | #***************************************************************************** |
| 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älkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 31 | romstage-y += smbus.c smbus_spd.c |
| 32 | ramstage-y += hudson.c |
| 33 | ramstage-y += usb.c |
| 34 | ramstage-y += lpc.c |
| 35 | ramstage-y += sm.c |
| 36 | ramstage-y += ide.c |
| 37 | ramstage-y += sata.c |
| 38 | ramstage-y += hda.c |
| 39 | ramstage-y += pci.c |
| 40 | ramstage-y += pcie.c |
| 41 | ramstage-y += sd.c |
| 42 | |
| 43 | ramstage-$(CONFIG_HAVE_ACPI_TABLES) += fadt.c |
| 44 | ramstage-y += reset.c |
| 45 | romstage-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += enable_usbdebug.c |
| 46 | ramstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c |
| 47 | romstage-y += early_setup.c |
WANG Siyuan | c7667f0 | 2015-06-23 22:28:17 +0800 | [diff] [blame^] | 48 | ifeq ($(CONFIG_HUDSON_IMC_FWM), y) |
| 49 | romstage-y += imc.c |
| 50 | ramstage-y += imc.c |
| 51 | endif |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 52 | |
| 53 | smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c smi_util.c |
| 54 | ramstage-$(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 Roth | d12d65f | 2015-06-28 14:06:23 -0600 | [diff] [blame] | 65 | HUDSON_FWM_POS_CALC=$(call int-add, $(call int-subtract, 0xffffffff $(call int-multiply, $(CONFIG_COREBOOT_ROMSIZE_KB) 1024)) 0x20000 1) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 66 | HUDSON_FWM_POSITION=$(shell printf %u $(CONFIG_HUDSON_FWM_POSITION)) |
Marc Jones | f92a189 | 2015-07-19 15:41:15 -0600 | [diff] [blame] | 67 | HUDSON_FWM_INSIDE_CBFS=$(call int-lt, $(CBFS_BASE_ADDRESS) $(HUDSON_FWM_POSITION)) |
Martin Roth | d12d65f | 2015-06-28 14:06:23 -0600 | [diff] [blame] | 68 | |
| 69 | ifneq ($(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) ##### ) |
| 71 | endif |
Martin Roth | d139c48 | 2015-06-28 14:12:29 -0600 | [diff] [blame] | 72 | ifneq ($(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) ##### ) |
| 74 | endif |
Patrick Georgi | 4cfec53 | 2015-07-16 15:34:26 +0200 | [diff] [blame] | 75 | CBFS_HEADER_SIZE=0x60 |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 76 | |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 77 | #assume the cbfs header is less than $(CBFS_HEADER_SIZE) bytes. |
| 78 | ROMSIG_SIZE=4096 |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 79 | ifeq ($(CONFIG_HUDSON_XHCI_FWM), y) |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 80 | HUDSON_XHCI_POSITION=$(call int-add,$(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 81 | XHCI_FWM_SIZE=$(call file-size,$(CONFIG_HUDSON_XHCI_FWM_FILE)) |
| 82 | else |
| 83 | HUDSON_XHCI_POSITION=0 |
| 84 | XHCI_FWM_SIZE=0 |
| 85 | endif |
| 86 | |
| 87 | ifeq ($(CONFIG_HUDSON_GEC_FWM), y) |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 88 | HUDSON_GEC_POSITION=$(call int-add,$(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE) \ |
| 89 | $(XHCI_FWM_SIZE) $(CBFS_HEADER_SIZE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 90 | GEC_FWM_SIZE=$(call file-size,$(CONFIG_HUDSON_GEC_FWM_FILE)) |
| 91 | else |
| 92 | HUDSON_GEC_POSITION=0 |
| 93 | GEC_FWM_SIZE=0 |
| 94 | endif |
| 95 | |
| 96 | ifeq ($(CONFIG_HUDSON_IMC_FWM), y) |
| 97 | HUDSON_IMC_POSITION=$(call int-align,\ |
| 98 | $(call int-add,\ |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 99 | $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE) $(XHCI_FWM_SIZE)\ |
| 100 | $(CBFS_HEADER_SIZE) $(GEC_FWM_SIZE) $(CBFS_HEADER_SIZE)),\ |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 101 | 65536) |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 102 | IMC_FWM_SIZE=$(call file-size,$(CONFIG_HUDSON_IMC_FWM_FILE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 103 | else |
| 104 | HUDSON_IMC_POSITION=0 |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 105 | IMC_FWM_SIZE=0 |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 106 | endif |
| 107 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 108 | ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y) |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 109 | HUDSON_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) |
| 114 | HUDSON_PSP_DIRECTORY_SIZE=256 |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 115 | else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y) |
WANG Siyuan | c7667f0 | 2015-06-23 22:28:17 +0800 | [diff] [blame^] | 116 | ifeq ($(CONFIG_HUDSON_IMC_FWM), y) |
| 117 | HUDSON_PSP_OFFSET=131072 |
| 118 | else |
| 119 | HUDSON_PSP_OFFSET=0 |
| 120 | endif |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 121 | HUDSON_PSP_DIRECTORY_POSITION=$(call int-align,\ |
| 122 | $(call int-add,\ |
| 123 | $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE) $(XHCI_FWM_SIZE)\ |
WANG Siyuan | c7667f0 | 2015-06-23 22:28:17 +0800 | [diff] [blame^] | 124 | $(CBFS_HEADER_SIZE) $(GEC_FWM_SIZE) $(CBFS_HEADER_SIZE) $(IMC_FWM_SIZE) $(CBFS_HEADER_SIZE) $(HUDSON_PSP_OFFSET)),\ |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 125 | 65536) |
| 126 | HUDSON_PSP_DIRECTORY_SIZE=256 |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 127 | else |
| 128 | HUDSON_PSP_DIRECTORY_POSITION=0 |
| 129 | HUDSON_PSP_DIRECTORY_SIZE=0 |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 130 | endif |
| 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 $@" |
zbao | 3ad1f1c | 2015-06-17 20:03:29 -0400 | [diff] [blame] | 137 | printf %d $(ROMSIG_SIZE) | LC_ALL=C awk '{for (i=0; i<$$1; i++) {printf "%c", 255}}' > $@; \ |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 138 | 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 Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 144 | done > $@.tmp; \ |
| 145 | dd if=$@.tmp of=$@ conv=notrunc status=noxfer 2>/dev/null; \ |
| 146 | rm $@.tmp |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 147 | |
| 148 | ifeq ($(CONFIG_HUDSON_FWM), y) |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 149 | cbfs-files-y += fch/fwm |
| 150 | fch/fwm-file := $(obj)/coreboot_hudson_romsig.bin |
| 151 | fch/fwm-position := $(HUDSON_FWM_POSITION) |
| 152 | fch/fwm-size := $(ROMSIZE_SIG) |
| 153 | fch/fwm-type := raw |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 154 | endif |
| 155 | |
| 156 | ifeq ($(CONFIG_HUDSON_XHCI_FWM), y) |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 157 | cbfs-files-y += fch/xhci |
| 158 | fch/xhci-file := $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE)) |
| 159 | fch/xhci-position := $(HUDSON_XHCI_POSITION) |
| 160 | fch/xhci-type := raw |
Patrick Georgi | 26e24cc | 2015-05-05 22:27:25 +0200 | [diff] [blame] | 161 | fch/xhci-required := Hudson XHCI firmware (available in coreboot/3rdparty/blobs if enabled) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 162 | endif |
| 163 | |
| 164 | ifeq ($(CONFIG_HUDSON_IMC_FWM), y) |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 165 | cbfs-files-y += fch/imc |
| 166 | fch/imc-file := $(call strip_quotes, $(CONFIG_HUDSON_IMC_FWM_FILE)) |
| 167 | fch/imc-position := $(HUDSON_IMC_POSITION) |
| 168 | fch/imc-type := raw |
Patrick Georgi | 26e24cc | 2015-05-05 22:27:25 +0200 | [diff] [blame] | 169 | fch/imc-required := Hudson IMC Firmware (available in coreboot/3rdparty/blobs if enabled) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 170 | endif |
| 171 | |
| 172 | ifeq ($(CONFIG_HUDSON_GEC_FWM), y) |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 173 | cbfs-files-y += fch/gec |
| 174 | fch/gec-file := $(call strip_quotes, $(CONFIG_HUDSON_GEC_FWM_FILE)) |
| 175 | fch/gec-position := $(HUDSON_GEC_POSITION) |
| 176 | fch/gec-type := raw |
| 177 | fch/gec-required := Hudson Gigabit Ethernet Controller Firmware (Contact your AMD representative) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 178 | endif |
| 179 | |
| 180 | ifdef CONFIG_HUDSON_AHCI_ROM |
| 181 | stripped_ahci_rom_id = $(call strip_quotes,$(CONFIG_AHCI_ROM_ID)) |
| 182 | cbfs-files-y += pci$(stripped_ahci_rom_id).rom |
| 183 | pci$(stripped_ahci_rom_id).rom-file := $(call strip_quotes,$(CONFIG_AHCI_ROM_FILE)) |
| 184 | pci$(stripped_ahci_rom_id).rom-type := optionrom |
| 185 | pci$(stripped_ahci_rom_id).rom-required := Hudson AHCI Option ROM (Contact your AMD representative) |
| 186 | endif |
| 187 | |
| 188 | ifeq ($(CONFIG_HUDSON_PSP), y) |
| 189 | |
| 190 | # 0 |
| 191 | # catenate the pubkey and pspdir together to save some space. |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 192 | AMDPUBKEY_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) $(HUDSON_PSP_DIRECTORY_SIZE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 193 | AMDPUBKEY_SIZE=$(call file-size,$(CONFIG_AMD_PUBKEY_FILE)) |
| 194 | |
| 195 | ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y) |
| 196 | FIRMWARE_LOCATE=$(dir $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE))) |
| 197 | FIRMWARE_TYPE= |
| 198 | endif |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 199 | |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 200 | ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y) |
| 201 | FIRMWARE_LOCATE=$(dir $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE))) |
| 202 | FIRMWARE_TYPE=CZ |
| 203 | endif |
| 204 | |
| 205 | #5 |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 206 | CONFIG_PUBSIGNEDKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/RtmPubSigned$(FIRMWARE_TYPE).key |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 207 | PUBSIGNEDKEY_POS=$(call int-align, \ |
| 208 | $(call int-add,$(AMDPUBKEY_POS) $(AMDPUBKEY_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 209 | $(CBFS_HEADER_SIZE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 210 | PUBSIGNEDKEY_SIZE=$(call file-size,$(CONFIG_PUBSIGNEDKEY_FILE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 211 | |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 212 | #1 |
| 213 | ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y) |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 214 | CONFIG_PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader$(FIRMWARE_TYPE).Bypass.sbin |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 215 | else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y) |
| 216 | CONFIG_PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader_prod_$(FIRMWARE_TYPE).sbin |
| 217 | endif |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 218 | PSPBTLDR_POS=$(call int-align, \ |
| 219 | $(call int-add,$(PUBSIGNEDKEY_POS) $(PUBSIGNEDKEY_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 220 | $(CBFS_HEADER_SIZE)) |
| 221 | PSPBTLDR_SIZE=$(call file-size,$(CONFIG_PSPBTLDR_FILE)) |
| 222 | |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 223 | #3 |
| 224 | ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y) |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 225 | CONFIG_PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecovery$(FIRMWARE_TYPE).sbin |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 226 | else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y) |
| 227 | CONFIG_PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecoveryBootLoader_prod_$(FIRMWARE_TYPE).sbin |
| 228 | endif |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 229 | PSPRCVR_POS=$(call int-align, \ |
| 230 | $(call int-add,$(PSPBTLDR_POS) $(PSPBTLDR_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 231 | $(CBFS_HEADER_SIZE)) |
| 232 | PSPRCVR_SIZE=$(call file-size,$(CONFIG_PSPRCVR_FILE)) |
| 233 | |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 234 | #2 |
| 235 | ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 236 | CONFIG_PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs$(FIRMWARE_TYPE).sbin |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 237 | else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y) |
WANG Siyuan | db08765 | 2015-06-16 21:21:00 +0800 | [diff] [blame] | 238 | CONFIG_PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs_prod_$(FIRMWARE_TYPE).csbin |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 239 | endif |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 240 | PSPSECUREOS_POS=$(call int-align, \ |
| 241 | $(call int-add,$(PSPRCVR_POS) $(PSPRCVR_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 242 | $(CBFS_HEADER_SIZE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 243 | PSPSECUREOS_SIZE=$(call file-size,$(CONFIG_PSPSCUREOS_FILE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 244 | |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 245 | #4 |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 246 | CONFIG_PSPNVRAM_FILE=$(top)/$(FIRMWARE_LOCATE)/PspNvram$(FIRMWARE_TYPE).bin |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 247 | PSPNVRAM_POS=$(call int-align, \ |
| 248 | $(call int-add,$(PSPSECUREOS_POS) $(PSPSECUREOS_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 249 | $(CBFS_HEADER_SIZE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 250 | PSPNVRAM_SIZE=$(call file-size,$(CONFIG_PSPNVRAM_FILE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 251 | |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 252 | #8 |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 253 | CONFIG_SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE).sbin |
| 254 | SMUFWM_POS=$(call int-align, \ |
| 255 | $(call int-add,$(PSPNVRAM_POS) $(PSPNVRAM_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 256 | $(CBFS_HEADER_SIZE)) |
| 257 | SMUFWM_SIZE=$(call file-size,$(CONFIG_SMUFWM_FILE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 258 | |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 259 | #95 |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 260 | CONFIG_SMUSCS_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuScs$(FIRMWARE_TYPE).bin |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 261 | SMUSCS_POS=$(call int-align, \ |
| 262 | $(call int-add,$(SMUFWM_POS) $(SMUFWM_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 263 | $(CBFS_HEADER_SIZE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 264 | SMUSCS_SIZE=$(call file-size,$(CONFIG_SMUSCS_FILE)) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 265 | |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 266 | #9 |
| 267 | CONFIG_PSPSECUREDEBUG_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureDebug$(FIRMWARE_TYPE).Key |
| 268 | PSPSECUREDEBUG_POS=$(call int-align, \ |
| 269 | $(call int-add,$(SMUSCS_POS) $(SMUSCS_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 270 | $(CBFS_HEADER_SIZE)) |
| 271 | PSPSECUREDEBUG_SIZE=$(call file-size,$(CONFIG_PSPSECUREDEBUG_FILE)) |
| 272 | |
| 273 | #12 |
| 274 | ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y) |
| 275 | CONFIG_PSPTRUSTLETS_FILE=$(top)/$(FIRMWARE_LOCATE)/trustlets.bin |
| 276 | else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y) |
| 277 | CONFIG_PSPTRUSTLETS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspTrustlets_prod_$(FIRMWARE_TYPE).cbin |
| 278 | endif |
| 279 | PSPTRUSTLETS_POS=$(call int-align, \ |
| 280 | $(call int-add,$(PSPSECUREDEBUG_POS) $(PSPSECUREDEBUG_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 281 | $(CBFS_HEADER_SIZE)) |
| 282 | PSPTRUSTLETS_SIZE=$(call file-size,$(CONFIG_PSPTRUSTLETS_FILE)) |
| 283 | |
| 284 | #13 |
| 285 | ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y) |
| 286 | CONFIG_TRUSTLETKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/Trustlet.tkn.cert |
| 287 | else ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y) |
| 288 | CONFIG_TRUSTLETKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/TrustletKey_prod_$(FIRMWARE_TYPE).sbin |
| 289 | endif |
| 290 | TRUSTLETKEY_POS=$(call int-align, \ |
| 291 | $(call int-add,$(PSPTRUSTLETS_POS) $(PSPTRUSTLETS_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 292 | $(CBFS_HEADER_SIZE)) |
| 293 | TRUSTLETKEY_SIZE=$(call file-size,$(CONFIG_TRUSTLETKEY_FILE)) |
| 294 | |
| 295 | #18 |
| 296 | ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y) |
| 297 | CONFIG_SMUFIRMWARE2_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware2_prod_$(FIRMWARE_TYPE).sbin |
| 298 | SMUFIRMWARE2_POS=$(call int-align, \ |
| 299 | $(call int-add,$(TRUSTLETKEY_POS) $(TRUSTLETKEY_SIZE) $(CBFS_HEADER_SIZE)), \ |
| 300 | $(CBFS_HEADER_SIZE)) |
| 301 | SMUFIRMWARE2_SIZE=$(call file-size,$(CONFIG_SMUFIRMWARE2_FILE)) |
| 302 | endif |
| 303 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 304 | define output_hex |
| 305 | echo $(1) | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}' |
| 306 | endef |
| 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älkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 325 | 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 Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 331 | 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 |
| 340 | ifeq ($(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 |
| 344 | endif |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 345 | 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 Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 348 | for fwm in 11 4294967295 1 0; do \ |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 349 | 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 Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 363 | cbfs-files-y += apu/pspdir |
| 364 | apu/pspdir-file := $(obj)/coreboot_psp_directory_combine_pubkey.bin |
| 365 | apu/pspdir-position := $(HUDSON_PSP_DIRECTORY_POSITION) |
| 366 | apu/pspdir-type := raw |
| 367 | |
| 368 | # 5 |
| 369 | cbfs-files-y += apu/pubsignedkey |
| 370 | apu/pubsignedkey-file := $(CONFIG_PUBSIGNEDKEY_FILE) |
| 371 | apu/pubsignedkey-position := $(PUBSIGNEDKEY_POS) |
| 372 | apu/pubsignedkey-type := raw |
| 373 | |
| 374 | # 1 |
| 375 | cbfs-files-y += apu/pspbtldr |
| 376 | apu/pspbtldr-file := $(CONFIG_PSPBTLDR_FILE) |
| 377 | apu/pspbtldr-position := $(PSPBTLDR_POS) |
| 378 | apu/pspbtldr-type := raw |
| 379 | |
| 380 | #3 |
| 381 | cbfs-files-y += apu/psprcvr |
| 382 | apu/psprcvr-file := $(CONFIG_PSPRCVR_FILE) |
| 383 | apu/psprcvr-position := $(PSPRCVR_POS) |
| 384 | apu/psprcvr-type := raw |
| 385 | |
| 386 | # 2 |
| 387 | cbfs-files-y += apu/pspsecureos |
| 388 | apu/pspsecureos-file := $(CONFIG_PSPSCUREOS_FILE) |
| 389 | apu/pspsecureos-position := $(PSPSECUREOS_POS) |
| 390 | apu/pspsecureos-type := raw |
| 391 | |
| 392 | # 4 |
| 393 | cbfs-files-y += apu/pspnvram |
| 394 | apu/pspnvram-file := $(CONFIG_PSPNVRAM_FILE) |
| 395 | apu/pspnvram-position := $(PSPNVRAM_POS) |
| 396 | apu/pspnvram-type := raw |
| 397 | |
| 398 | #8 |
| 399 | cbfs-files-y += apu/smufwm |
| 400 | apu/smufwm-file := $(CONFIG_SMUFWM_FILE) |
| 401 | apu/smufwm-position := $(SMUFWM_POS) |
| 402 | apu/smufwm-type := raw |
| 403 | |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 404 | #95 |
Bruce Griffith | 5e2053e | 2014-12-05 19:38:53 -0700 | [diff] [blame] | 405 | cbfs-files-y += apu/smuscs |
| 406 | apu/smuscs-file := $(CONFIG_SMUSCS_FILE) |
| 407 | apu/smuscs-position := $(SMUSCS_POS) |
| 408 | apu/smuscs-type := raw |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 409 | |
WANG Siyuan | f2dfef0 | 2015-05-20 14:41:01 +0800 | [diff] [blame] | 410 | #9 |
| 411 | cbfs-files-y += apu/pspsecuredebug |
| 412 | apu/pspsecuredebug-file := $(CONFIG_PSPSECUREDEBUG_FILE) |
| 413 | apu/pspsecuredebug-position := $(PSPSECUREDEBUG_POS) |
| 414 | apu/pspsecuredebug-type := raw |
| 415 | |
| 416 | #12 |
| 417 | cbfs-files-y += apu/psptrustlets |
| 418 | apu/psptrustlets-file := $(CONFIG_PSPTRUSTLETS_FILE) |
| 419 | apu/psptrustlets-position := $(PSPTRUSTLETS_POS) |
| 420 | apu/psptrustlets-type := raw |
| 421 | |
| 422 | #13 |
| 423 | cbfs-files-y += apu/trustletkey |
| 424 | apu/trustletkey-file := $(CONFIG_TRUSTLETKEY_FILE) |
| 425 | apu/trustletkey-position := $(TRUSTLETKEY_POS) |
| 426 | apu/trustletkey-type := raw |
| 427 | |
| 428 | #18 |
| 429 | ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y) |
| 430 | cbfs-files-y += apu/smufirmware2 |
| 431 | apu/smufirmware2-file := $(CONFIG_SMUFIRMWARE2_FILE) |
| 432 | apu/smufirmware2-position := $(SMUFIRMWARE2_POS) |
| 433 | apu/smufirmware2-type := raw |
| 434 | endif |
| 435 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 436 | endif |