Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 1 | #***************************************************************************** |
| 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 | |
| 31 | ifeq ($(CONFIG_CPU_AMD_PI_00630F01)$(CONFIG_CPU_AMD_PI_00730F01)$(CONFIG_CPU_AMD_PI_00660F01),y) |
| 32 | # AGESA V5 Files |
Marc Jones | 0b11bd0 | 2015-07-19 15:20:17 -0600 | [diff] [blame] | 33 | AGESA_ROOT = $(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_VENDORCODE_PATH)) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 34 | |
| 35 | AGESA_INC = -I$(obj) |
| 36 | |
| 37 | AGESA_INC += -I$(src)/mainboard/$(MAINBOARDDIR) |
| 38 | AGESA_INC += -I$(AGESA_ROOT)/binaryPI |
| 39 | AGESA_INC += -I$(AGESA_ROOT) |
| 40 | AGESA_INC += -I$(AGESA_ROOT)/Include |
| 41 | AGESA_INC += -I$(src)/vendorcode/amd/pi |
| 42 | AGESA_INC += -I$(src)/vendorcode/amd/pi/Lib |
| 43 | |
| 44 | AGESA_INC += -I$(AGESA_ROOT)/Proc |
| 45 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Common |
| 46 | AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU |
| 47 | AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family |
| 48 | AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Feature |
| 49 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch |
| 50 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Common |
| 51 | ifeq ($(CONFIG_CPU_AMD_PI_00660F01),y) |
| 52 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Kern |
| 53 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Psp/PspBaseLib |
| 54 | endif |
| 55 | ifeq ($(CONFIG_CPU_AMD_PI_00630F01),y) |
| 56 | AGESA_INC += -I$(AGESA_ROOT)/Proc/IDS |
| 57 | endif |
| 58 | |
| 59 | AGESA_INC += -I$(src)/northbridge/amd/pi |
| 60 | AGESA_INC += -I$(src)/southbridge/amd/pi/hudson |
| 61 | |
| 62 | AGESA_INC += -I$(src)/arch/x86/include |
| 63 | AGESA_INC += -I$(src)/include |
Aaron Durbin | dc9f5cd | 2015-09-08 13:34:43 -0500 | [diff] [blame] | 64 | AGESA_INC += -I$(src)/commonlib/include |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 65 | |
| 66 | AGESA_CFLAGS += -march=amdfam10 -mno-3dnow -fno-zero-initialized-in-bss -fno-strict-aliasing |
| 67 | CFLAGS_x86_32 += $(AGESA_CFLAGS) |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 68 | CFLAGS_x86_64 += $(AGESA_CFLAGS) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 69 | |
| 70 | export AGESA_ROOT := $(AGESA_ROOT) |
| 71 | export AGESA_INC := $(AGESA_INC) |
| 72 | export AGESA_CFLAGS := $(AGESA_CFLAGS) |
| 73 | |
| 74 | CC_bootblock := $(CC_bootblock) $(AGESA_INC) $(AGESA_CFLAGS) |
| 75 | CC_romstage := $(CC_romstage) $(AGESA_INC) $(AGESA_CFLAGS) |
| 76 | CC_ramstage := $(CC_ramstage) $(AGESA_INC) $(AGESA_CFLAGS) |
| 77 | CC_x86_32 := $(CC_x86_32) $(AGESA_INC) $(AGESA_CFLAGS) |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 78 | CC_x86_64 := $(CC_x86_64) $(AGESA_INC) $(AGESA_CFLAGS) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 79 | |
| 80 | ####################################################################### |
| 81 | |
| 82 | define 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 \ |
zbao | aeb2103 | 2015-09-11 09:11:49 -0400 | [diff] [blame] | 89 | cp -f $2 $$(@D); \ |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 90 | 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 | |
| 100 | endef |
| 101 | |
| 102 | agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/*.[cS]) |
| 103 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/binaryPI/*.[cS]) |
| 104 | ifeq ($(CONFIG_CPU_AMD_PI_00660F01),y) |
| 105 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Fch/Kern/KernImc/*.[cS]) |
| 106 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Fch/Common/*.[cS]) |
| 107 | agesa_raw_files += $(wildcard $(AGESA_ROOT)/Proc/Psp/PspBaseLib/*.[cS]) |
| 108 | endif |
WANG Siyuan | 3f95f1d | 2015-06-23 22:14:33 +0800 | [diff] [blame] | 109 | ifeq ($(CONFIG_HUDSON_IMC_FWM),y) |
| 110 | agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/imc/*.c) |
| 111 | endif |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 112 | |
| 113 | classes-$(CONFIG_CPU_AMD_AGESA_BINARY_PI) += libagesa |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 114 | |
| 115 | ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 116 | $(eval $(call create_class_compiler,libagesa,x86_32)) |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 117 | else |
| 118 | $(eval $(call create_class_compiler,libagesa,x86_64)) |
| 119 | endif |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 120 | |
| 121 | agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file))))) |
| 122 | agesa_obj_path := $(strip $(obj)/vendorcode/amd) |
| 123 | agesa_src_path := $(strip $(obj)/agesa) |
| 124 | agesa_src_copies := $(strip $(foreach file,$(agesa_src_files),$(agesa_obj_path)/$(notdir $(file)))) |
| 125 | agesa_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 | |
| 139 | romstage-libs += $(obj)/agesa/libagesa.a |
| 140 | ramstage-libs += $(obj)/agesa/libagesa.a |
| 141 | |
| 142 | ####################################################################### |
| 143 | |
| 144 | cbfs-files-$(CONFIG_CPU_AMD_AGESA_BINARY_PI) += AGESA |
Marc Jones | 0b11bd0 | 2015-07-19 15:20:17 -0600 | [diff] [blame] | 145 | AGESA-file := $(CONFIG_AGESA_BINARY_PI_FILE) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 146 | AGESA-type := raw |
| 147 | AGESA-position := $(CONFIG_AGESA_BINARY_PI_LOCATION) |
| 148 | |
| 149 | endif |