mb/google/brya: Create rull variant
[coreboot2.git] / src / vendorcode / amd / pi / Makefile.mk
blob446e9d477940cc7529207de1772c6c3b9bcdc3fd
1 ## SPDX-License-Identifier: BSD-3-Clause
3 #*****************************************************************************
5 # Copyright (c) 2012, 2016 Advanced Micro Devices, Inc.
6 # 2013 - 2014, Sage Electronic Engineering, LLC
7 # All rights reserved.
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.
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.
31 #*****************************************************************************
33 ifeq ($(CONFIG_SOC_AMD_STONEYRIDGE),y)
35 subdirs-y += 00670F00
37 # AGESA V5 Files
39 AGESA_ROOT = $(top)/$(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_VENDORCODE_PATH))
41 BINARY_PI_INC = -I$(AGESA_ROOT)
42 BINARY_PI_INC += -I$(AGESA_ROOT)/binaryPI
43 BINARY_PI_INC += -I$(AGESA_ROOT)/Include
44 BINARY_PI_INC += -I$(AGESA_ROOT)/Proc
45 BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Common
46 BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/CPU
47 BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/CPU/Family
48 BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Fch
49 BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Fch/Common
51 AGESA_INC = -I$(obj)
52 AGESA_INC += $(BINARY_PI_INC)
54 AGESA_INC += -I$(src)/soc/amd/stoneyridge/include
55 AGESA_INC += -I$(src)/soc/amd/common/block/include
57 AGESA_INC += -I$(src)/arch/x86/include
58 AGESA_INC += -I$(src)/include
59 AGESA_INC += -I$(src)/commonlib/include
60 AGESA_INC += -I$(VBOOT_SOURCE)/firmware/include
61 endif
63 ifeq ($(CONFIG_CPU_AMD_PI_00730F01),y)
64 # AGESA V5 Files
66 subdirs-y += 00730F01
68 AGESA_ROOT = $(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_VENDORCODE_PATH))
70 AGESA_INC = -I$(obj) -I$(src)/vendorcode/amd/include
72 AGESA_INC += -I$(src)/mainboard/$(MAINBOARDDIR)
73 AGESA_INC += -I$(AGESA_ROOT)/binaryPI
74 AGESA_INC += -I$(AGESA_ROOT)
75 AGESA_INC += -I$(AGESA_ROOT)/Include
76 AGESA_INC += -I$(src)/vendorcode/amd/pi
77 AGESA_INC += -I$(src)/vendorcode/amd/pi/Lib
79 AGESA_INC += -I$(AGESA_ROOT)/Proc
80 AGESA_INC += -I$(AGESA_ROOT)/Proc/Common
81 AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU
82 AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family
83 AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Feature
84 AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch
85 AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Common
87 AGESA_INC += -I$(src)/northbridge/amd/pi
88 AGESA_INC += -I$(src)/southbridge/amd/pi/hudson
90 AGESA_INC += -I$(src)/arch/x86/include
91 AGESA_INC += -I$(src)/include
92 AGESA_INC += -I$(src)/commonlib/include
93 AGESA_INC += -I$(src)/commonlib/bsd/include
94 AGESA_INC += -I$(VBOOT_SOURCE)/firmware/include
96 AGESA_CFLAGS += -Wno-pragma-pack
97 AGESA_CFLAGS += -fno-strict-aliasing -D__LIBAGESA__
98 CFLAGS_x86_32 += $(AGESA_CFLAGS)
99 CFLAGS_x86_64 += $(AGESA_CFLAGS)
101 export AGESA_ROOT := $(AGESA_ROOT)
102 export AGESA_INC := $(AGESA_INC)
103 export AGESA_CFLAGS := $(AGESA_CFLAGS)
105 CC_bootblock := $(CC_bootblock) $(AGESA_INC) $(AGESA_CFLAGS)
106 CC_romstage := $(CC_romstage) $(AGESA_INC) $(AGESA_CFLAGS)
107 CC_postcar:= $(CC_postcar) -I$(src)/southbridge/amd/pi/hudson -I$(AGESA_ROOT)/binaryPI
108 CC_ramstage := $(CC_ramstage) $(AGESA_INC) $(AGESA_CFLAGS)
110 CC_x86_32 := $(CC_x86_32) $(AGESA_INC) $(AGESA_CFLAGS)
111 CC_x86_64 := $(CC_x86_64) $(AGESA_INC) $(AGESA_CFLAGS)
113 #######################################################################
115 define create_agesa_cp_template
116 # $1 AGESA source file
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); \
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)
134 endef
136 agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/*.[cS])
138 ifeq ($(CONFIG_HUDSON_IMC_FWM),y)
139 agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/imc/*.c)
140 endif
142 classes-y += libagesa
144 ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
145 $(eval $(call create_class_compiler,libagesa,x86_32))
146 else
147 $(eval $(call create_class_compiler,libagesa,x86_64))
148 endif
150 agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file)))))
151 agesa_output_path := $(obj)/libagesa
152 agesa_src_path := $(agesa_output_path)
153 agesa_dirs := $(sort $(abspath $(dir $(call src-to-obj,libagesa,$(agesa_src_files)))))
155 additional-dirs += $(agesa_src_path) $(agesa_dirs)
157 $(foreach file,$(strip $(agesa_src_files)),$(eval $(call create_agesa_cp_template,$(file))))
159 $(agesa_output_path)/libagesa.a: $(call src-to-obj,libagesa,$(agesa_src_files))
160 @printf " AGESA $(subst $(obj)/,,$(@))\n"
161 $(AR_libagesa) rcsDT $@ $+
163 romstage-libs += $(agesa_output_path)/libagesa.a
164 ramstage-libs += $(agesa_output_path)/libagesa.a
166 #######################################################################
168 cbfs-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)
173 endif