1## SPDX-License-Identifier: BSD-3-Clause 2 3#***************************************************************************** 4# 5# Copyright (c) 2012, 2016 Advanced Micro Devices, Inc. 6# 2013 - 2014, Sage Electronic Engineering, LLC 7# All rights reserved. 8# 9# Redistribution and use in source and binary forms, with or without 10# modification, are permitted provided that the following conditions are met: 11# * Redistributions of source code must retain the above copyright 12# notice, this list of conditions and the following disclaimer. 13# * Redistributions in binary form must reproduce the above copyright 14# notice, this list of conditions and the following disclaimer in the 15# documentation and/or other materials provided with the distribution. 16# * Neither the name of Advanced Micro Devices, Inc. nor the names of 17# its contributors may be used to endorse or promote products derived 18# from this software without specific prior written permission. 19# 20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23# DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY 24# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30# 31#***************************************************************************** 32 33ifeq ($(CONFIG_SOC_AMD_STONEYRIDGE),y) 34 35subdirs-y += 00670F00 36 37# AGESA V5 Files 38 39AGESA_ROOT = $(top)/$(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_VENDORCODE_PATH)) 40 41BINARY_PI_INC = -I$(AGESA_ROOT) 42BINARY_PI_INC += -I$(AGESA_ROOT)/binaryPI 43BINARY_PI_INC += -I$(AGESA_ROOT)/Include 44BINARY_PI_INC += -I$(AGESA_ROOT)/Proc 45BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Common 46BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/CPU 47BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/CPU/Family 48BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Fch 49BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Fch/Common 50 51AGESA_INC = -I$(obj) 52AGESA_INC += $(BINARY_PI_INC) 53 54AGESA_INC += -I$(src)/soc/amd/stoneyridge/include 55AGESA_INC += -I$(src)/soc/amd/common/block/include 56 57AGESA_INC += -I$(src)/arch/x86/include 58AGESA_INC += -I$(src)/include 59AGESA_INC += -I$(src)/commonlib/include 60AGESA_INC += -I$(VBOOT_SOURCE)/firmware/include 61endif 62 63ifeq ($(CONFIG_CPU_AMD_PI_00730F01),y) 64# AGESA V5 Files 65 66subdirs-y += 00730F01 67 68AGESA_ROOT = $(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_VENDORCODE_PATH)) 69 70AGESA_INC = -I$(obj) -I$(src)/vendorcode/amd/include 71 72AGESA_INC += -I$(src)/mainboard/$(MAINBOARDDIR) 73AGESA_INC += -I$(AGESA_ROOT)/binaryPI 74AGESA_INC += -I$(AGESA_ROOT) 75AGESA_INC += -I$(AGESA_ROOT)/Include 76AGESA_INC += -I$(src)/vendorcode/amd/pi 77AGESA_INC += -I$(src)/vendorcode/amd/pi/Lib 78 79AGESA_INC += -I$(AGESA_ROOT)/Proc 80AGESA_INC += -I$(AGESA_ROOT)/Proc/Common 81AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU 82AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family 83AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Feature 84AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch 85AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Common 86 87AGESA_INC += -I$(src)/northbridge/amd/pi 88AGESA_INC += -I$(src)/southbridge/amd/pi/hudson 89 90AGESA_INC += -I$(src)/arch/x86/include 91AGESA_INC += -I$(src)/include 92AGESA_INC += -I$(src)/commonlib/include 93AGESA_INC += -I$(src)/commonlib/bsd/include 94AGESA_INC += -I$(VBOOT_SOURCE)/firmware/include 95 96AGESA_CFLAGS += -Wno-pragma-pack 97AGESA_CFLAGS += -fno-strict-aliasing -D__LIBAGESA__ 98CFLAGS_x86_32 += $(AGESA_CFLAGS) 99CFLAGS_x86_64 += $(AGESA_CFLAGS) 100 101export AGESA_ROOT := $(AGESA_ROOT) 102export AGESA_INC := $(AGESA_INC) 103export AGESA_CFLAGS := $(AGESA_CFLAGS) 104 105CC_bootblock := $(CC_bootblock) $(AGESA_INC) $(AGESA_CFLAGS) 106CC_romstage := $(CC_romstage) $(AGESA_INC) $(AGESA_CFLAGS) 107CC_postcar:= $(CC_postcar) -I$(src)/southbridge/amd/pi/hudson -I$(AGESA_ROOT)/binaryPI 108CC_ramstage := $(CC_ramstage) $(AGESA_INC) $(AGESA_CFLAGS) 109 110CC_x86_32 := $(CC_x86_32) $(AGESA_INC) $(AGESA_CFLAGS) 111CC_x86_64 := $(CC_x86_64) $(AGESA_INC) $(AGESA_CFLAGS) 112 113####################################################################### 114 115define create_agesa_cp_template 116# $1 AGESA source file 117 118$(agesa_src_path)/$(notdir $1): $1 119 @printf " AGESA Copying $$(notdir $1) => $$(@D)\n" 120 if [ ! -r $(agesa_src_path)/$(notdir $1) ]; then \ 121 cp -f $1 $$(@D); \ 122 fi 123 124$(call src-to-obj,libagesa,$1): $(agesa_src_path)/$(notdir $1) $(obj)/config.h $(src)/include/kconfig.h 125 @printf " CC $$(subst $(obj)/,,$$(@))\n" 126 $(CC_libagesa) -c -MMD $(CFLAGS_libagesa) $(AGESA_CFLAGS) \ 127 $(AGESA_INC) \ 128 -include $(src)/include/kconfig.h \ 129 -include $(src)/include/rules.h \ 130 -include $(src)/commonlib/bsd/include/commonlib/bsd/compiler.h \ 131 -o $$@ \ 132 $(agesa_src_path)/$(notdir $1) 133 134endef 135 136agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/*.[cS]) 137 138ifeq ($(CONFIG_HUDSON_IMC_FWM),y) 139agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/imc/*.c) 140endif 141 142classes-y += libagesa 143 144ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y) 145$(eval $(call create_class_compiler,libagesa,x86_32)) 146else 147$(eval $(call create_class_compiler,libagesa,x86_64)) 148endif 149 150agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file))))) 151agesa_output_path := $(obj)/libagesa 152agesa_src_path := $(agesa_output_path) 153agesa_dirs := $(sort $(abspath $(dir $(call src-to-obj,libagesa,$(agesa_src_files))))) 154 155additional-dirs += $(agesa_src_path) $(agesa_dirs) 156 157$(foreach file,$(strip $(agesa_src_files)),$(eval $(call create_agesa_cp_template,$(file)))) 158 159$(agesa_output_path)/libagesa.a: $(call src-to-obj,libagesa,$(agesa_src_files)) 160 @printf " AGESA $(subst $(obj)/,,$(@))\n" 161 $(AR_libagesa) rcsDT $@ $+ 162 163romstage-libs += $(agesa_output_path)/libagesa.a 164ramstage-libs += $(agesa_output_path)/libagesa.a 165 166####################################################################### 167 168cbfs-files-y += $(CONFIG_AGESA_CBFS_NAME) 169$(CONFIG_AGESA_CBFS_NAME)-file := $(CONFIG_AGESA_BINARY_PI_FILE) 170$(CONFIG_AGESA_CBFS_NAME)-type := raw 171$(CONFIG_AGESA_CBFS_NAME)-position := $(CONFIG_AGESA_BINARY_PI_LOCATION) 172 173endif 174