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 | |
Martin Roth | 81da643 | 2023-08-24 18:15:59 -0600 | [diff] [blame^] | 31 | ifeq ($(CONFIG_SOC_AMD_STONEYRIDGE),y) |
| 32 | |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 33 | subdirs-y += 00670F00 |
| 34 | |
Elyes Haouas | ced8fe0 | 2023-01-12 07:47:39 +0100 | [diff] [blame] | 35 | # AGESA V5 Files |
| 36 | |
| 37 | AGESA_ROOT = $(top)/$(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_VENDORCODE_PATH)) |
| 38 | |
| 39 | BINARY_PI_INC = -I$(AGESA_ROOT) |
| 40 | BINARY_PI_INC += -I$(AGESA_ROOT)/binaryPI |
| 41 | BINARY_PI_INC += -I$(AGESA_ROOT)/Include |
| 42 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc |
| 43 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Common |
| 44 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/CPU |
| 45 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/CPU/Family |
| 46 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Fch |
| 47 | BINARY_PI_INC += -I$(AGESA_ROOT)/Proc/Fch/Common |
| 48 | |
| 49 | AGESA_INC = -I$(obj) |
| 50 | AGESA_INC += $(BINARY_PI_INC) |
| 51 | |
| 52 | AGESA_INC += -I$(src)/soc/amd/stoneyridge/include |
| 53 | AGESA_INC += -I$(src)/soc/amd/common/block/include |
| 54 | |
| 55 | AGESA_INC += -I$(src)/arch/x86/include |
| 56 | AGESA_INC += -I$(src)/include |
| 57 | AGESA_INC += -I$(src)/commonlib/include |
| 58 | AGESA_INC += -I$(VBOOT_SOURCE)/firmware/include |
| 59 | endif |
| 60 | |
Michał Żygowski | 0784482 | 2021-05-09 17:23:17 +0200 | [diff] [blame] | 61 | ifeq ($(CONFIG_CPU_AMD_PI_00730F01),y) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 62 | # AGESA V5 Files |
Marc Jones | 21cde8b | 2017-05-07 16:47:36 -0600 | [diff] [blame] | 63 | |
Martin Roth | 81da643 | 2023-08-24 18:15:59 -0600 | [diff] [blame^] | 64 | subdirs-y += 00730F01 |
| 65 | |
Marc Jones | 0b11bd0 | 2015-07-19 15:20:17 -0600 | [diff] [blame] | 66 | AGESA_ROOT = $(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_VENDORCODE_PATH)) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 67 | |
Stefan Reinauer | f652f82 | 2017-06-24 21:57:30 +0200 | [diff] [blame] | 68 | AGESA_INC = -I$(obj) -I$(src)/vendorcode/amd/include |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 69 | |
| 70 | AGESA_INC += -I$(src)/mainboard/$(MAINBOARDDIR) |
| 71 | AGESA_INC += -I$(AGESA_ROOT)/binaryPI |
| 72 | AGESA_INC += -I$(AGESA_ROOT) |
| 73 | AGESA_INC += -I$(AGESA_ROOT)/Include |
| 74 | AGESA_INC += -I$(src)/vendorcode/amd/pi |
| 75 | AGESA_INC += -I$(src)/vendorcode/amd/pi/Lib |
| 76 | |
| 77 | AGESA_INC += -I$(AGESA_ROOT)/Proc |
| 78 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Common |
| 79 | AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU |
| 80 | AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family |
| 81 | AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Feature |
| 82 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch |
| 83 | AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Common |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 84 | |
Marc Jones | 1587dc8 | 2017-05-15 18:55:11 -0600 | [diff] [blame] | 85 | AGESA_INC += -I$(src)/northbridge/amd/pi |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 86 | AGESA_INC += -I$(src)/southbridge/amd/pi/hudson |
| 87 | |
| 88 | AGESA_INC += -I$(src)/arch/x86/include |
| 89 | AGESA_INC += -I$(src)/include |
Aaron Durbin | dc9f5cd | 2015-09-08 13:34:43 -0500 | [diff] [blame] | 90 | AGESA_INC += -I$(src)/commonlib/include |
Julius Werner | 98eeb96 | 2019-12-11 15:47:42 -0800 | [diff] [blame] | 91 | AGESA_INC += -I$(src)/commonlib/bsd/include |
Paul Kocialkowski | 4611451 | 2016-07-24 12:10:38 +0200 | [diff] [blame] | 92 | AGESA_INC += -I$(VBOOT_SOURCE)/firmware/include |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 93 | |
Arthur Heymans | d683bf5 | 2022-03-23 22:03:51 +0100 | [diff] [blame] | 94 | AGESA_CFLAGS += -Wno-pragma-pack |
Martin Roth | 5b2954e | 2017-06-29 21:42:02 -0600 | [diff] [blame] | 95 | AGESA_CFLAGS += -fno-strict-aliasing -D__LIBAGESA__ |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 96 | CFLAGS_x86_32 += $(AGESA_CFLAGS) |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 97 | CFLAGS_x86_64 += $(AGESA_CFLAGS) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 98 | |
| 99 | export AGESA_ROOT := $(AGESA_ROOT) |
| 100 | export AGESA_INC := $(AGESA_INC) |
| 101 | export AGESA_CFLAGS := $(AGESA_CFLAGS) |
| 102 | |
| 103 | CC_bootblock := $(CC_bootblock) $(AGESA_INC) $(AGESA_CFLAGS) |
| 104 | CC_romstage := $(CC_romstage) $(AGESA_INC) $(AGESA_CFLAGS) |
Kyösti Mälkki | b8cb142 | 2020-06-23 21:36:14 +0300 | [diff] [blame] | 105 | CC_postcar:= $(CC_postcar) -I$(src)/southbridge/amd/pi/hudson -I$(AGESA_ROOT)/binaryPI |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 106 | CC_ramstage := $(CC_ramstage) $(AGESA_INC) $(AGESA_CFLAGS) |
Kyösti Mälkki | 63fac81 | 2017-09-02 16:41:43 +0300 | [diff] [blame] | 107 | |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 108 | CC_x86_32 := $(CC_x86_32) $(AGESA_INC) $(AGESA_CFLAGS) |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 109 | CC_x86_64 := $(CC_x86_64) $(AGESA_INC) $(AGESA_CFLAGS) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 110 | |
| 111 | ####################################################################### |
| 112 | |
| 113 | define create_agesa_cp_template |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 114 | # $1 AGESA source file |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 115 | |
| 116 | $(agesa_src_path)/$(notdir $1): $1 |
| 117 | @printf " AGESA Copying $$(notdir $1) => $$(@D)\n" |
| 118 | if [ ! -r $(agesa_src_path)/$(notdir $1) ]; then \ |
| 119 | cp -f $1 $$(@D); \ |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 120 | fi |
| 121 | |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 122 | $(call src-to-obj,libagesa,$1): $(agesa_src_path)/$(notdir $1) $(obj)/config.h $(src)/include/kconfig.h |
| 123 | @printf " CC $$(subst $(obj)/,,$$(@))\n" |
Julius Werner | 98eeb96 | 2019-12-11 15:47:42 -0800 | [diff] [blame] | 124 | $(CC_libagesa) -c -MMD $(CFLAGS_libagesa) $(AGESA_CFLAGS) \ |
| 125 | $(AGESA_INC) \ |
| 126 | -include $(src)/include/kconfig.h \ |
| 127 | -include $(src)/include/rules.h \ |
| 128 | -include $(src)/commonlib/bsd/include/commonlib/bsd/compiler.h \ |
| 129 | -o $$@ \ |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 130 | $(agesa_src_path)/$(notdir $1) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 131 | |
| 132 | endef |
| 133 | |
| 134 | agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/*.[cS]) |
Kyösti Mälkki | 903ce25 | 2016-11-25 11:21:02 +0200 | [diff] [blame] | 135 | |
Martin Roth | 059988d | 2017-11-11 20:06:19 -0700 | [diff] [blame] | 136 | ifeq ($(CONFIG_HUDSON_IMC_FWM),y) |
WANG Siyuan | 3f95f1d | 2015-06-23 22:14:33 +0800 | [diff] [blame] | 137 | agesa_raw_files += $(wildcard $(src)/vendorcode/amd/pi/Lib/imc/*.c) |
| 138 | endif |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 139 | |
Arthur Heymans | 81a4fef | 2022-11-01 23:33:45 +0100 | [diff] [blame] | 140 | classes-y += libagesa |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 141 | |
| 142 | ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 143 | $(eval $(call create_class_compiler,libagesa,x86_32)) |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 144 | else |
| 145 | $(eval $(call create_class_compiler,libagesa,x86_64)) |
| 146 | endif |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 147 | |
| 148 | agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file))))) |
Martin Roth | 4460e8f | 2017-09-26 10:07:35 -0600 | [diff] [blame] | 149 | agesa_output_path := $(obj)/libagesa |
| 150 | agesa_src_path := $(agesa_output_path) |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 151 | 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] | 152 | |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 153 | additional-dirs += $(agesa_src_path) $(agesa_dirs) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 154 | |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 155 | $(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] | 156 | |
Martin Roth | 4460e8f | 2017-09-26 10:07:35 -0600 | [diff] [blame] | 157 | $(agesa_output_path)/libagesa.a: $(call src-to-obj,libagesa,$(agesa_src_files)) |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 158 | @printf " AGESA $(subst $(obj)/,,$(@))\n" |
Kyösti Mälkki | 807e423 | 2017-10-08 21:51:06 +0300 | [diff] [blame] | 159 | $(AR_libagesa) rcsDT $@ $+ |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 160 | |
Martin Roth | 4460e8f | 2017-09-26 10:07:35 -0600 | [diff] [blame] | 161 | bootblock-libs += $(agesa_output_path)/libagesa.a |
| 162 | romstage-libs += $(agesa_output_path)/libagesa.a |
| 163 | ramstage-libs += $(agesa_output_path)/libagesa.a |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 164 | |
| 165 | ####################################################################### |
| 166 | |
Arthur Heymans | 81a4fef | 2022-11-01 23:33:45 +0100 | [diff] [blame] | 167 | cbfs-files-y += $(CONFIG_AGESA_CBFS_NAME) |
Kyösti Mälkki | 7104fe2 | 2017-05-27 20:53:29 +0300 | [diff] [blame] | 168 | $(CONFIG_AGESA_CBFS_NAME)-file := $(CONFIG_AGESA_BINARY_PI_FILE) |
| 169 | $(CONFIG_AGESA_CBFS_NAME)-type := raw |
| 170 | $(CONFIG_AGESA_CBFS_NAME)-position := $(CONFIG_AGESA_BINARY_PI_LOCATION) |
Stefan Reinauer | 55feadd | 2015-06-10 16:15:36 -0700 | [diff] [blame] | 171 | |
| 172 | endif |