Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 1 | #***************************************************************************** |
| 2 | # |
Marc Jones | 21e5dd8 | 2016-09-20 20:32:47 -0600 | [diff] [blame] | 3 | # Copyright (c) 2012, 2016 Advanced Micro Devices, Inc. |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 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 | |
Marc Jones | 21cde8b | 2017-05-07 16:47:36 -0600 | [diff] [blame] | 31 | ifeq ($(CONFIG_CPU_AMD_PI_00630F01)$(CONFIG_CPU_AMD_PI_00730F01)$(CONFIG_CPU_AMD_PI_00670F00_FP4)$(CONFIG_CPU_AMD_PI_00670F00_FT4)$(CONFIG_CPU_AMD_PI_00660F01)$(CONFIG_SOC_AMD_STONEYRIDGE_FP4)$(CONFIG_SOC_AMD_STONEYRIDGE_FT4),y) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 32 | # AGESA V5 Files |
Marc Jones | 21cde8b | 2017-05-07 16:47:36 -0600 | [diff] [blame] | 33 | |
Marc Jones | 0b11bd0 | 2015-07-19 15:20:17 -0600 | [diff] [blame] | 34 | AGESA_ROOT = $(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_VENDORCODE_PATH)) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 35 | |
| 36 | AGESA_INC = -I$(obj) |
| 37 | |
| 38 | AGESA_INC += -I$(src)/mainboard/$(MAINBOARDDIR) |
| 39 | AGESA_INC += -I$(AGESA_ROOT)/binaryPI |
| 40 | AGESA_INC += -I$(AGESA_ROOT) |
| 41 | AGESA_INC += -I$(AGESA_ROOT)/Include |
| 42 | AGESA_INC += -I$(src)/vendorcode/amd/pi |
| 43 | AGESA_INC += -I$(src)/vendorcode/amd/pi/Lib |
| 44 | |
| 45 | AGESA_INC += -I$(AGESA_ROOT)/Proc |
| 46 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Common |
| 47 | AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU |
| 48 | AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family |
| 49 | AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Feature |
| 50 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch |
| 51 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Common |
Marc Jones | 21cde8b | 2017-05-07 16:47:36 -0600 | [diff] [blame] | 52 | ifeq ($(CONFIG_CPU_AMD_PI_00670F00_FP4)$(CONFIG_CPU_AMD_PI_00670F00_FT4)$(CONFIG_SOC_AMD_STONEYRIDGE_FP4)$(CONFIG_SOC_AMD_STONEYRIDGE_FT4),y) |
Marc Jones | 21e5dd8 | 2016-09-20 20:32:47 -0600 | [diff] [blame] | 53 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Kern |
| 54 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Psp/PspBaseLib |
| 55 | endif |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 56 | ifeq ($(CONFIG_CPU_AMD_PI_00660F01),y) |
| 57 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Kern |
| 58 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Psp/PspBaseLib |
| 59 | endif |
| 60 | ifeq ($(CONFIG_CPU_AMD_PI_00630F01),y) |
| 61 | AGESA_INC += -I$(AGESA_ROOT)/Proc/IDS |
| 62 | endif |
| 63 | |
Marc Jones | 21cde8b | 2017-05-07 16:47:36 -0600 | [diff] [blame] | 64 | ifeq ($(CONFIG_SOC_AMD_STONEYRIDGE_FP4)$(CONFIG_SOC_AMD_STONEYRIDGE_FT4),y) |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 65 | AGESA_INC += -I$(src)/soc/amd/stoneyridge/include |
Marc Jones | 1587dc8 | 2017-05-15 18:55:11 -0600 | [diff] [blame^] | 66 | AGESA_INC += -I$(src)/soc/amd/common |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 67 | else |
Marc Jones | 1587dc8 | 2017-05-15 18:55:11 -0600 | [diff] [blame^] | 68 | AGESA_INC += -I$(src)/northbridge/amd/pi |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 69 | AGESA_INC += -I$(src)/southbridge/amd/pi/hudson |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 70 | endif |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 71 | |
| 72 | AGESA_INC += -I$(src)/arch/x86/include |
| 73 | AGESA_INC += -I$(src)/include |
Aaron Durbin | dc9f5cd | 2015-09-08 13:34:43 -0500 | [diff] [blame] | 74 | AGESA_INC += -I$(src)/commonlib/include |
Paul Kocialkowski | 4611451 | 2016-07-24 12:10:38 +0200 | [diff] [blame] | 75 | AGESA_INC += -I$(VBOOT_SOURCE)/firmware/include |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 76 | |
| 77 | AGESA_CFLAGS += -march=amdfam10 -mno-3dnow -fno-zero-initialized-in-bss -fno-strict-aliasing |
| 78 | CFLAGS_x86_32 += $(AGESA_CFLAGS) |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 79 | CFLAGS_x86_64 += $(AGESA_CFLAGS) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 80 | |
| 81 | export AGESA_ROOT := $(AGESA_ROOT) |
| 82 | export AGESA_INC := $(AGESA_INC) |
| 83 | export AGESA_CFLAGS := $(AGESA_CFLAGS) |
| 84 | |
| 85 | CC_bootblock := $(CC_bootblock) $(AGESA_INC) $(AGESA_CFLAGS) |
| 86 | CC_romstage := $(CC_romstage) $(AGESA_INC) $(AGESA_CFLAGS) |
| 87 | CC_ramstage := $(CC_ramstage) $(AGESA_INC) $(AGESA_CFLAGS) |
| 88 | CC_x86_32 := $(CC_x86_32) $(AGESA_INC) $(AGESA_CFLAGS) |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 89 | CC_x86_64 := $(CC_x86_64) $(AGESA_INC) $(AGESA_CFLAGS) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 90 | |
| 91 | ####################################################################### |
| 92 | |
| 93 | define create_agesa_cp_template |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 94 | # $1 AGESA source file |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 95 | |
| 96 | $(agesa_src_path)/$(notdir $1): $1 |
| 97 | @printf " AGESA Copying $$(notdir $1) => $$(@D)\n" |
| 98 | if [ ! -r $(agesa_src_path)/$(notdir $1) ]; then \ |
| 99 | cp -f $1 $$(@D); \ |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 100 | fi |
| 101 | |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 102 | $(call src-to-obj,libagesa,$1): $(agesa_src_path)/$(notdir $1) $(obj)/config.h $(src)/include/kconfig.h |
| 103 | @printf " CC $$(subst $(obj)/,,$$(@))\n" |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 104 | $(CC_libagesa) -c -MMD $(CFLAGS_libagesa) $(AGESA_CFLAGS) \ |
| 105 | $(AGESA_INC) \ |
Kyösti Mälkki | 211b1d8 | 2016-12-01 07:59:16 +0200 | [diff] [blame] | 106 | -include $(src)/include/rules.h -include $(src)/include/kconfig.h \ |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 107 | -o $$@ \ |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 108 | $(agesa_src_path)/$(notdir $1) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 109 | |
| 110 | endef |
| 111 | |
| 112 | agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/*.[cS]) |
| 113 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/binaryPI/*.[cS]) |
Marc Jones | 21cde8b | 2017-05-07 16:47:36 -0600 | [diff] [blame] | 114 | ifeq ($(CONFIG_CPU_AMD_PI_00670F00_FP4)$(CONFIG_CPU_AMD_PI_00670F00_FT4)$(CONFIG_SOC_AMD_STONEYRIDGE_FP4)$(CONFIG_SOC_AMD_STONEYRIDGE_FT4),y) |
Marc Jones | 21e5dd8 | 2016-09-20 20:32:47 -0600 | [diff] [blame] | 115 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Fch/Kern/KernImc/*.[cS]) |
| 116 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Fch/Common/*.[cS]) |
| 117 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Psp/PspBaseLib/*.[cS]) |
| 118 | endif |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 119 | ifeq ($(CONFIG_CPU_AMD_PI_00660F01),y) |
| 120 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Fch/Kern/KernImc/*.[cS]) |
| 121 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Fch/Common/*.[cS]) |
| 122 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Psp/PspBaseLib/*.[cS]) |
| 123 | endif |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 124 | ifeq ($(CONFIG_HUDSON_IMC_FWM)$(CONFIG_STONEYRIDGE_IMC_FWM),y) |
WANG Siyuan | 3f95f1d | 2015-06-23 22:14:33 +0800 | [diff] [blame] | 125 | agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/imc/*.c) |
| 126 | endif |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 127 | |
| 128 | classes-$(CONFIG_CPU_AMD_AGESA_BINARY_PI) += libagesa |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 129 | |
| 130 | ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 131 | $(eval $(call create_class_compiler,libagesa,x86_32)) |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 132 | else |
| 133 | $(eval $(call create_class_compiler,libagesa,x86_64)) |
| 134 | endif |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 135 | |
| 136 | agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file))))) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 137 | agesa_src_path := $(strip $(obj)/agesa) |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 138 | agesa_dirs := $(sort $(abspath $(dir $(call src-to-obj,libagesa,$(agesa_src_files))))) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 139 | |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 140 | additional-dirs += $(agesa_src_path) $(agesa_dirs) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 141 | |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 142 | $(foreach file,$(strip $(agesa_src_files)),$(eval $(call create_agesa_cp_template,$(file)))) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 143 | |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 144 | $(obj)/agesa/libagesa.a: $(call src-to-obj,libagesa,$(agesa_src_files)) |
| 145 | @printf " AGESA $(subst $(obj)/,,$(@))\n" |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 146 | ar rcs $@ $+ |
| 147 | |
| 148 | romstage-libs += $(obj)/agesa/libagesa.a |
| 149 | ramstage-libs += $(obj)/agesa/libagesa.a |
| 150 | |
| 151 | ####################################################################### |
| 152 | |
| 153 | cbfs-files-$(CONFIG_CPU_AMD_AGESA_BINARY_PI) += AGESA |
Marc Jones | 0b11bd0 | 2015-07-19 15:20:17 -0600 | [diff] [blame] | 154 | AGESA-file := $(CONFIG_AGESA_BINARY_PI_FILE) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 155 | AGESA-type := raw |
| 156 | AGESA-position := $(CONFIG_AGESA_BINARY_PI_LOCATION) |
| 157 | |
| 158 | endif |