blob: 3ca81e78961ec5cdc733966aa2bc3ec3f4d4ebe3 [file] [log] [blame]
Patrick Georgic49d7a32020-05-08 22:50:46 +02001## SPDX-License-Identifier: GPL-2.0-only
David Hendricks8cbd5692017-12-01 20:49:48 -08002
3ifeq ($(CONFIG_SOC_CAVIUM_COMMON),y)
4
Patrick Rudolph71c0a942019-01-02 13:52:51 +01005subdirs-y += pci
6
Elyes HAOUASf2e1d0a2019-09-25 08:47:43 +02007# -Wstack-usage doesn't recognize hexadecimal numbers.
8CFLAGS_arm64 += -Wstack-usage=$(shell printf "%d" $(CONFIG_STACK_SIZE))
David Hendricks8cbd5692017-12-01 20:49:48 -08009
10bootblock-$(CONFIG_BOOTBLOCK_CUSTOM) += bootblock.c
11
12################################################################################
13# romstage
14
David Hendricks8cbd5692017-12-01 20:49:48 -080015romstage-y += bdk-coreboot.c
Patrick Rudolphb94ecc42019-02-22 12:05:16 +010016romstage-y += ecam.c
David Hendricks8cbd5692017-12-01 20:49:48 -080017
18################################################################################
19# ramstage
20
Patrick Rudolph52acef12018-08-08 12:46:18 +020021ramstage-y += bdk-coreboot.c
Patrick Rudolphb94ecc42019-02-22 12:05:16 +010022ramstage-y += ecam.c
David Hendricks8cbd5692017-12-01 20:49:48 -080023
24CPPFLAGS_common += -Isrc/soc/cavium/common/include
25
26ROM_HEADER_BIN := $(objgenerated)/rom_header.bin
27ROM_HEADER_SOURCES += rom_clib_s_nbl1fw
28ROM_HEADER_SOURCES += rom_csib_s_nbl1fw
29
30ROM_HEADER_DEPS := $(foreach f, $(ROM_HEADER_SOURCES), src/soc/cavium/common/$(f).bin.hex)
31
32# Include ROM header
33$(ROM_HEADER_BIN): $(ROM_HEADER_DEPS)
34 for f in $+; \
35 do for c in $$(cat $$f | grep -v ^#); \
36 do printf $$(printf '\%o' 0x$$c); \
37 done; \
38 done > $@
39
40$(objcbfs)/bootblock.bin: $(objcbfs)/bootblock.raw.bin $(ROM_HEADER_BIN)
41 @printf " GEN $(subst $(obj)/,,$(@))\n"
42 dd if=/dev/zero ibs=1 count=$$(($(shell stat --printf="%s" $(objcbfs)/bootblock.raw.bin) + 0x10000)) of=$@ status=none
43 # Insert CLIB at 0x0 and CSIB at 0x100
44 dd if=$(ROM_HEADER_BIN) of=$@ bs=1 seek=0 conv=notrunc status=none
45 # Insert bootblock at 0x10000
46 dd if=$(objcbfs)/bootblock.raw.bin of=$@ bs=1 seek=$$((0x10000)) conv=notrunc status=none
47
48endif