Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 1 | #***************************************************************************** |
| 2 | # |
| 3 | # Copyright (c) 2012, 2016 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 | |
| 31 | ifeq ($(CONFIG_SOC_AMD_STONEYRIDGE_FP4)$(CONFIG_SOC_AMD_STONEYRIDGE_FT4),y) |
| 32 | # AGESA V5 Files |
| 33 | |
| 34 | AGESA_ROOT = $(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_VENDORCODE_PATH)) |
| 35 | |
Martin Roth | ece69f2 | 2017-11-16 22:34:26 -0700 | [diff] [blame] | 36 | BINARY_PI_INC = -I$(AGESA_ROOT) |
| 37 | BINARY_PI_INC += -I$(AGESA_ROOT)/binaryPI |
| 38 | BINARY_PI_INC += -I$(AGESA_ROOT)/Include |
| 39 | BINARY_PI_INC += -I$(AGESA_ROOT)/Lib |
| 40 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc |
| 41 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Common |
| 42 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/CPU |
| 43 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/CPU/Family |
| 44 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Fch |
| 45 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Fch/Common |
| 46 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Psp/PspBaseLib |
| 47 | |
| 48 | |
Martin Roth | 2413918 | 2017-11-16 16:00:53 -0700 | [diff] [blame] | 49 | AGESA_INC = -I$(obj) |
Martin Roth | ece69f2 | 2017-11-16 22:34:26 -0700 | [diff] [blame] | 50 | AGESA_INC += $(BINARY_PI_INC) |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 51 | |
| 52 | AGESA_INC += -I$(src)/soc/amd/stoneyridge/include |
Aaron Durbin | 49ec3f0 | 2017-12-12 10:01:06 -0700 | [diff] [blame] | 53 | AGESA_INC += -I$(src)/soc/amd/common/block/include |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 54 | |
| 55 | AGESA_INC += -I$(src)/arch/x86/include |
| 56 | AGESA_INC += -I$(src)/include |
| 57 | AGESA_INC += -I$(src)/commonlib/include |
| 58 | AGESA_INC += -I$(VBOOT_SOURCE)/firmware/include |
| 59 | |
Martin Roth | ece69f2 | 2017-11-16 22:34:26 -0700 | [diff] [blame] | 60 | AGESA_CFLAGS += -march=amdfam10 -fno-strict-aliasing -D__LIBAGESA__ |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 61 | |
Martin Roth | ece69f2 | 2017-11-16 22:34:26 -0700 | [diff] [blame] | 62 | CC_bootblock := $(CC_bootblock) $(BINARY_PI_INC) |
| 63 | CC_romstage := $(CC_romstage) $(BINARY_PI_INC) |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 64 | CC_postcar:= $(CC_postcar) -I$(AGESA_ROOT)/binaryPI |
Martin Roth | ece69f2 | 2017-11-16 22:34:26 -0700 | [diff] [blame] | 65 | CC_ramstage := $(CC_ramstage) $(BINARY_PI_INC) |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 66 | |
| 67 | ####################################################################### |
| 68 | |
| 69 | define create_agesa_cp_template |
| 70 | # $1 AGESA source file |
| 71 | |
| 72 | $(agesa_src_path)/$(notdir $1): $1 |
| 73 | @printf " AGESA Copying $$(notdir $1) => $$(@D)\n" |
| 74 | if [ ! -r $(agesa_src_path)/$(notdir $1) ]; then \ |
| 75 | cp -f $1 $$(@D); \ |
| 76 | fi |
| 77 | |
| 78 | $(call src-to-obj,libagesa,$1): $(agesa_src_path)/$(notdir $1) $(obj)/config.h $(src)/include/kconfig.h |
| 79 | @printf " CC $$(subst $(obj)/,,$$(@))\n" |
Martin Roth | ece69f2 | 2017-11-16 22:34:26 -0700 | [diff] [blame] | 80 | $(CC_libagesa) -c -MMD $(CFLAGS_libagesa) $(AGESA_CFLAGS) \ |
| 81 | $(AGESA_INC) \ |
| 82 | -include $(src)/include/rules.h \ |
| 83 | -include $(src)/include/kconfig.h \ |
| 84 | -o $$@ \ |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 85 | $(agesa_src_path)/$(notdir $1) |
| 86 | |
| 87 | endef |
| 88 | |
Martin Roth | 744104e | 2017-11-12 09:59:37 -0700 | [diff] [blame] | 89 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Lib/*.[cS]) |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 90 | |
| 91 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/binaryPI/*.[cS]) |
| 92 | |
| 93 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Fch/Common/*.[cS]) |
| 94 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Psp/PspBaseLib/*.[cS]) |
| 95 | ifeq ($(CONFIG_STONEYRIDGE_IMC_FWM),y) |
Martin Roth | 744104e | 2017-11-12 09:59:37 -0700 | [diff] [blame] | 96 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Lib/imc/*.c) |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 97 | endif |
| 98 | |
| 99 | classes-$(CONFIG_CPU_AMD_AGESA_BINARY_PI) += libagesa |
| 100 | |
| 101 | ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y) |
| 102 | $(eval $(call create_class_compiler,libagesa,x86_32)) |
| 103 | else |
| 104 | $(eval $(call create_class_compiler,libagesa,x86_64)) |
| 105 | endif |
| 106 | |
| 107 | agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file))))) |
| 108 | agesa_output_path := $(obj)/libagesa |
| 109 | agesa_src_path := $(agesa_output_path) |
| 110 | agesa_dirs := $(sort $(abspath $(dir $(call src-to-obj,libagesa,$(agesa_src_files))))) |
| 111 | |
| 112 | additional-dirs += $(agesa_src_path) $(agesa_dirs) |
| 113 | |
| 114 | $(foreach file,$(strip $(agesa_src_files)),$(eval $(call create_agesa_cp_template,$(file)))) |
| 115 | |
| 116 | $(agesa_output_path)/libagesa.a: $(call src-to-obj,libagesa,$(agesa_src_files)) |
| 117 | @printf " AGESA $(subst $(obj)/,,$(@))\n" |
| 118 | $(AR_libagesa) rcs $@ $+ |
| 119 | |
| 120 | bootblock-libs += $(agesa_output_path)/libagesa.a |
| 121 | romstage-libs += $(agesa_output_path)/libagesa.a |
| 122 | ramstage-libs += $(agesa_output_path)/libagesa.a |
| 123 | |
| 124 | ####################################################################### |
| 125 | |
| 126 | cbfs-files-$(CONFIG_CPU_AMD_AGESA_BINARY_PI) += $(CONFIG_AGESA_CBFS_NAME) |
| 127 | $(CONFIG_AGESA_CBFS_NAME)-file := $(CONFIG_AGESA_BINARY_PI_FILE) |
| 128 | $(CONFIG_AGESA_CBFS_NAME)-type := raw |
| 129 | $(CONFIG_AGESA_CBFS_NAME)-position := $(CONFIG_AGESA_BINARY_PI_LOCATION) |
| 130 | |
| 131 | endif |