Patrick Georgi | c49d7a3 | 2020-05-08 22:50:46 +0200 | [diff] [blame] | 1 | ## SPDX-License-Identifier: GPL-2.0-only |
David Hendricks | 8cbd569 | 2017-12-01 20:49:48 -0800 | [diff] [blame] | 2 | |
| 3 | ifeq ($(CONFIG_SOC_CAVIUM_COMMON),y) |
| 4 | |
Patrick Rudolph | 71c0a94 | 2019-01-02 13:52:51 +0100 | [diff] [blame] | 5 | subdirs-y += pci |
| 6 | |
Elyes HAOUAS | f2e1d0a | 2019-09-25 08:47:43 +0200 | [diff] [blame] | 7 | # -Wstack-usage doesn't recognize hexadecimal numbers. |
Arthur Heymans | 94efac5 | 2023-04-18 18:53:05 +0200 | [diff] [blame^] | 8 | ifeq ($(CONFIG_COMPILER_GCC),y) |
Elyes HAOUAS | f2e1d0a | 2019-09-25 08:47:43 +0200 | [diff] [blame] | 9 | CFLAGS_arm64 += -Wstack-usage=$(shell printf "%d" $(CONFIG_STACK_SIZE)) |
Arthur Heymans | 94efac5 | 2023-04-18 18:53:05 +0200 | [diff] [blame^] | 10 | endif |
David Hendricks | 8cbd569 | 2017-12-01 20:49:48 -0800 | [diff] [blame] | 11 | |
| 12 | bootblock-$(CONFIG_BOOTBLOCK_CUSTOM) += bootblock.c |
| 13 | |
| 14 | ################################################################################ |
| 15 | # romstage |
| 16 | |
David Hendricks | 8cbd569 | 2017-12-01 20:49:48 -0800 | [diff] [blame] | 17 | romstage-y += bdk-coreboot.c |
Patrick Rudolph | b94ecc4 | 2019-02-22 12:05:16 +0100 | [diff] [blame] | 18 | romstage-y += ecam.c |
David Hendricks | 8cbd569 | 2017-12-01 20:49:48 -0800 | [diff] [blame] | 19 | |
| 20 | ################################################################################ |
| 21 | # ramstage |
| 22 | |
Patrick Rudolph | 52acef1 | 2018-08-08 12:46:18 +0200 | [diff] [blame] | 23 | ramstage-y += bdk-coreboot.c |
Patrick Rudolph | b94ecc4 | 2019-02-22 12:05:16 +0100 | [diff] [blame] | 24 | ramstage-y += ecam.c |
David Hendricks | 8cbd569 | 2017-12-01 20:49:48 -0800 | [diff] [blame] | 25 | |
| 26 | CPPFLAGS_common += -Isrc/soc/cavium/common/include |
| 27 | |
| 28 | ROM_HEADER_BIN := $(objgenerated)/rom_header.bin |
| 29 | ROM_HEADER_SOURCES += rom_clib_s_nbl1fw |
| 30 | ROM_HEADER_SOURCES += rom_csib_s_nbl1fw |
| 31 | |
| 32 | ROM_HEADER_DEPS := $(foreach f, $(ROM_HEADER_SOURCES), src/soc/cavium/common/$(f).bin.hex) |
| 33 | |
| 34 | # Include ROM header |
| 35 | $(ROM_HEADER_BIN): $(ROM_HEADER_DEPS) |
| 36 | for f in $+; \ |
| 37 | do for c in $$(cat $$f | grep -v ^#); \ |
| 38 | do printf $$(printf '\%o' 0x$$c); \ |
| 39 | done; \ |
| 40 | done > $@ |
| 41 | |
| 42 | $(objcbfs)/bootblock.bin: $(objcbfs)/bootblock.raw.bin $(ROM_HEADER_BIN) |
| 43 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
| 44 | dd if=/dev/zero ibs=1 count=$$(($(shell stat --printf="%s" $(objcbfs)/bootblock.raw.bin) + 0x10000)) of=$@ status=none |
| 45 | # Insert CLIB at 0x0 and CSIB at 0x100 |
| 46 | dd if=$(ROM_HEADER_BIN) of=$@ bs=1 seek=0 conv=notrunc status=none |
| 47 | # Insert bootblock at 0x10000 |
| 48 | dd if=$(objcbfs)/bootblock.raw.bin of=$@ bs=1 seek=$$((0x10000)) conv=notrunc status=none |
| 49 | |
| 50 | endif |