blob: bb383b99a07e81800470c68b67f3eb306f58b136 [file] [log] [blame]
Stefan Reinauer55feadd2015-06-10 16:15:36 -07001#*****************************************************************************
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
31ifeq ($(CONFIG_CPU_AMD_PI_00630F01)$(CONFIG_CPU_AMD_PI_00730F01)$(CONFIG_CPU_AMD_PI_00660F01),y)
32# AGESA V5 Files
Marc Jones0b11bd02015-07-19 15:20:17 -060033AGESA_ROOT = $(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_VENDORCODE_PATH))
Stefan Reinauer55feadd2015-06-10 16:15:36 -070034
35AGESA_INC = -I$(obj)
36
37AGESA_INC += -I$(src)/mainboard/$(MAINBOARDDIR)
38AGESA_INC += -I$(AGESA_ROOT)/binaryPI
39AGESA_INC += -I$(AGESA_ROOT)
40AGESA_INC += -I$(AGESA_ROOT)/Include
41AGESA_INC += -I$(src)/vendorcode/amd/pi
42AGESA_INC += -I$(src)/vendorcode/amd/pi/Lib
43
44AGESA_INC += -I$(AGESA_ROOT)/Proc
45AGESA_INC += -I$(AGESA_ROOT)/Proc/Common
46AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU
47AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family
48AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Feature
49AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch
50AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Common
51ifeq ($(CONFIG_CPU_AMD_PI_00660F01),y)
52AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Kern
53AGESA_INC += -I$(AGESA_ROOT)/Proc/Psp/PspBaseLib
54endif
55ifeq ($(CONFIG_CPU_AMD_PI_00630F01),y)
56AGESA_INC += -I$(AGESA_ROOT)/Proc/IDS
57endif
58
59AGESA_INC += -I$(src)/northbridge/amd/pi
60AGESA_INC += -I$(src)/southbridge/amd/pi/hudson
61
62AGESA_INC += -I$(src)/arch/x86/include
63AGESA_INC += -I$(src)/include
Aaron Durbindc9f5cd2015-09-08 13:34:43 -050064AGESA_INC += -I$(src)/commonlib/include
Stefan Reinauer55feadd2015-06-10 16:15:36 -070065
66AGESA_CFLAGS += -march=amdfam10 -mno-3dnow -fno-zero-initialized-in-bss -fno-strict-aliasing
67CFLAGS_x86_32 += $(AGESA_CFLAGS)
Stefan Reinauerd91ddc82015-07-30 11:17:40 -070068CFLAGS_x86_64 += $(AGESA_CFLAGS)
Stefan Reinauer55feadd2015-06-10 16:15:36 -070069
70export AGESA_ROOT := $(AGESA_ROOT)
71export AGESA_INC := $(AGESA_INC)
72export AGESA_CFLAGS := $(AGESA_CFLAGS)
73
74CC_bootblock := $(CC_bootblock) $(AGESA_INC) $(AGESA_CFLAGS)
75CC_romstage := $(CC_romstage) $(AGESA_INC) $(AGESA_CFLAGS)
76CC_ramstage := $(CC_ramstage) $(AGESA_INC) $(AGESA_CFLAGS)
77CC_x86_32 := $(CC_x86_32) $(AGESA_INC) $(AGESA_CFLAGS)
Stefan Reinauerd91ddc82015-07-30 11:17:40 -070078CC_x86_64 := $(CC_x86_64) $(AGESA_INC) $(AGESA_CFLAGS)
Stefan Reinauer55feadd2015-06-10 16:15:36 -070079
80#######################################################################
81
82define create_agesa_cp_template
83
84# $1 AGESA source file
85# $2 AGESA copy-to location
86$(agesa_src_path)/$(notdir $2): $2 $(agesa_src_path)
87 @printf " AGESA Copying $$(notdir $2) => $$(@D)\n"
88 if [ ! -r $(agesa_src_path)/$(notdir $2) ]; then \
zbaoaeb21032015-09-11 09:11:49 -040089 cp -f $2 $$(@D); \
Stefan Reinauer55feadd2015-06-10 16:15:36 -070090 fi
91
92$(agesa_obj_path)/$1.libagesa.o: $(agesa_src_path)/$(notdir $2) $(obj)/config.h $(src)/include/kconfig.h $(agesa_obj_path)
93 @printf " CC $(subst $(agesa_obj_path)/,,$$(@))\n"
94 $(CC_libagesa) -c -MMD $(CFLAGS_libagesa) $(AGESA_CFLAGS) \
95 $(AGESA_INC) \
96 -include $(obj)/config.h -include $(src)/include/kconfig.h \
97 -o $$@ \
98 $(agesa_src_path)/$(notdir $2)
99
100endef
101
102agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/*.[cS])
103agesa_raw_files += $(wildcard $(AGESA_ROOT)/binaryPI/*.[cS])
104ifeq ($(CONFIG_CPU_AMD_PI_00660F01),y)
105agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Fch/Kern/KernImc/*.[cS])
106agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Fch/Common/*.[cS])
107agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Psp/PspBaseLib/*.[cS])
108endif
WANG Siyuan3f95f1d2015-06-23 22:14:33 +0800109ifeq ($(CONFIG_HUDSON_IMC_FWM),y)
110agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/imc/*.c)
111endif
Stefan Reinauer55feadd2015-06-10 16:15:36 -0700112
113classes-$(CONFIG_CPU_AMD_AGESA_BINARY_PI) += libagesa
Stefan Reinauerd91ddc82015-07-30 11:17:40 -0700114
115ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
Stefan Reinauer55feadd2015-06-10 16:15:36 -0700116$(eval $(call create_class_compiler,libagesa,x86_32))
Stefan Reinauerd91ddc82015-07-30 11:17:40 -0700117else
118$(eval $(call create_class_compiler,libagesa,x86_64))
119endif
Stefan Reinauer55feadd2015-06-10 16:15:36 -0700120
121agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file)))))
122agesa_obj_path := $(strip $(obj)/vendorcode/amd)
123agesa_src_path := $(strip $(obj)/agesa)
124agesa_src_copies := $(strip $(foreach file,$(agesa_src_files),$(agesa_obj_path)/$(notdir $(file))))
125agesa_obj_copies := $(strip $(agesa_src_copies:.c=.libagesa.o))
126
127$(agesa_src_path):
128 mkdir -p $@
129
130$(agesa_obj_path):
131 mkdir -p $@
132
133$(foreach file,$(strip $(agesa_src_files)),$(eval $(call create_agesa_cp_template,$(basename $(notdir $(file))),$(file))))
134
135$(obj)/agesa/libagesa.a: $(agesa_obj_copies)
136 @printf " AGESA $(subst $(agesa_obj_path)/,,$(@))\n"
137 ar rcs $@ $+
138
139romstage-libs += $(obj)/agesa/libagesa.a
140ramstage-libs += $(obj)/agesa/libagesa.a
141
142#######################################################################
143
144cbfs-files-$(CONFIG_CPU_AMD_AGESA_BINARY_PI) += AGESA
Marc Jones0b11bd02015-07-19 15:20:17 -0600145AGESA-file := $(CONFIG_AGESA_BINARY_PI_FILE)
Stefan Reinauer55feadd2015-06-10 16:15:36 -0700146AGESA-type := raw
147AGESA-position := $(CONFIG_AGESA_BINARY_PI_LOCATION)
148
149endif