| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
ifeq ($(CONFIG_SOC_AMD_STONEYRIDGE),y) |
| 30 |
|
| 31 |
AGESA_CFLAGS += -march=amdfam10 -fno-strict-aliasing -D__LIBAGESA__ |
| 32 |
|
| 33 |
CC_bootblock := $(CC_bootblock) $(BINARY_PI_INC) |
| 34 |
CC_romstage := $(CC_romstage) $(BINARY_PI_INC) |
| 35 |
CC_postcar:= $(CC_postcar) -I$(AGESA_ROOT)/binaryPI |
| 36 |
CC_ramstage := $(CC_ramstage) $(BINARY_PI_INC) |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
define create_agesa_cp_template |
| 41 |
# $1 AGESA source file |
| 42 |
|
| 43 |
$(agesa_src_path)/$(notdir $1): $1 |
| 44 |
@printf " AGESA Copying $$(notdir $1) => $$(@D)\n" |
| 45 |
if [ ! -r $(agesa_src_path)/$(notdir $1) ]; then \ |
| 46 |
cp -f $1 $$(@D); \ |
| 47 |
fi |
| 48 |
|
| 49 |
$(call src-to-obj,libagesa,$1): $(agesa_src_path)/$(notdir $1) $(obj)/config.h $(src)/include/kconfig.h |
| 50 |
@printf " CC $$(subst $(obj)/,,$$(@))\n" |
| 51 |
$(CC_libagesa) -c -MMD $(CFLAGS_libagesa) $(AGESA_CFLAGS) \ |
| 52 |
$(AGESA_INC) \ |
| 53 |
-include $(src)/include/kconfig.h \ |
| 54 |
-include $(src)/include/rules.h \ |
| 55 |
-include $(src)/commonlib/bsd/include/commonlib/bsd/compiler.h \ |
| 56 |
-o $$@ \ |
| 57 |
$(agesa_src_path)/$(notdir $1) |
| 58 |
|
| 59 |
endef |
| 60 |
|
| 61 |
agesa_raw_files += $(wildcard $(AGESA_ROOT)/Lib/*.[cS]) |
| 62 |
|
| 63 |
agesa_raw_files += $(wildcard $(AGESA_ROOT)/binaryPI/*.[cS]) |
| 64 |
|
| 65 |
classes-y += libagesa |
| 66 |
|
| 67 |
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y) |
| 68 |
$(eval $(call create_class_compiler,libagesa,x86_32)) |
| 69 |
else |
| 70 |
$(eval $(call create_class_compiler,libagesa,x86_64)) |
| 71 |
endif |
| 72 |
|
| 73 |
agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file))))) |
| 74 |
agesa_output_path := $(obj)/libagesa |
| 75 |
agesa_src_path := $(agesa_output_path) |
| 76 |
agesa_dirs := $(sort $(abspath $(dir $(call src-to-obj,libagesa,$(agesa_src_files))))) |
| 77 |
|
| 78 |
additional-dirs += $(agesa_src_path) $(agesa_dirs) |
| 79 |
|
| 80 |
$(foreach file,$(strip $(agesa_src_files)),$(eval $(call create_agesa_cp_template,$(file)))) |
| 81 |
|
| 82 |
$(agesa_output_path)/libagesa.a: $(call src-to-obj,libagesa,$(agesa_src_files)) |
| 83 |
@printf " AGESA $(subst $(obj)/,,$(@))\n" |
| 84 |
$(AR_libagesa) rcs $@ $+ |
| 85 |
|
| 86 |
bootblock-libs += $(agesa_output_path)/libagesa.a |
| 87 |
romstage-libs += $(agesa_output_path)/libagesa.a |
| 88 |
ramstage-libs += $(agesa_output_path)/libagesa.a |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
warn_no_agesa: |
| 93 |
printf "\n\t** WARNING **\n" |
| 94 |
printf "coreboot has been built with no AGESA support. Successfully " |
| 95 |
printf "booting this image will be impossible.\n\n" |
| 96 |
|
| 97 |
PHONY+=warn_no_agesa |
| 98 |
|
| 99 |
ifeq ($(CONFIG_AGESA_SPLIT_MEMORY_FILES), y) |
| 100 |
|
| 101 |
# convert input elf to rmodule |
| 102 |
AGESA_POST_MEM_INPUT_ELF = $(call strip_quotes,$(CONFIG_AGESA_POST_MEMORY_BINARY_PI_FILE)) |
| 103 |
|
| 104 |
# If no post-mem file then also skip pre-mem file |
| 105 |
ifeq ($(AGESA_POST_MEM_INPUT_ELF),) |
| 106 |
show_notices:: warn_no_agesa |
| 107 |
else |
| 108 |
AGESA_POST_MEM_ELF = $(objcbfs)/$(patsubst %.elf,%.debug,$(notdir $(AGESA_POST_MEM_INPUT_ELF))) |
| 109 |
AGESA_POST_MEM_ELF_RMOD = $(AGESA_POST_MEM_ELF).rmod |
| 110 |
|
| 111 |
$(AGESA_POST_MEM_ELF): $(AGESA_POST_MEM_INPUT_ELF) |
| 112 |
cp $< $@ |
| 113 |
|
| 114 |
$(AGESA_POST_MEM_ELF_RMOD): $(AGESA_POST_MEM_ELF) |
| 115 |
|
| 116 |
cbfs-files-y += $(CONFIG_AGESA_PRE_MEMORY_CBFS_NAME) |
| 117 |
$(CONFIG_AGESA_PRE_MEMORY_CBFS_NAME)-file := $(CONFIG_AGESA_PRE_MEMORY_BINARY_PI_FILE) |
| 118 |
$(CONFIG_AGESA_PRE_MEMORY_CBFS_NAME)-type := stage |
| 119 |
$(CONFIG_AGESA_PRE_MEMORY_CBFS_NAME)-options := --xip |
| 120 |
|
| 121 |
|
| 122 |
$(CONFIG_AGESA_PRE_MEMORY_CBFS_NAME)-align := 4096 |
| 123 |
|
| 124 |
cbfs-files-y += $(CONFIG_AGESA_POST_MEMORY_CBFS_NAME) |
| 125 |
$(CONFIG_AGESA_POST_MEMORY_CBFS_NAME)-file := $(AGESA_POST_MEM_ELF_RMOD) |
| 126 |
$(CONFIG_AGESA_POST_MEMORY_CBFS_NAME)-type := stage |
| 127 |
$(CONFIG_AGESA_POST_MEMORY_CBFS_NAME)-compression := $(CBFS_COMPRESS_FLAG) |
| 128 |
|
| 129 |
endif # AGESA_POST_MEM_INPUT_ELF == "" |
| 130 |
|
| 131 |
else |
| 132 |
|
| 133 |
AGESA_BINARYPI_INPUT_FILE = $(call strip_quotes,$(CONFIG_AGESA_BINARY_PI_FILE)) |
| 134 |
ifeq ($(AGESA_BINARYPI_INPUT_FILE),) |
| 135 |
show_notices:: warn_no_agesa |
| 136 |
else |
| 137 |
|
| 138 |
cbfs-files-y += $(CONFIG_AGESA_CBFS_NAME) |
| 139 |
$(CONFIG_AGESA_CBFS_NAME)-file := $(AGESA_BINARYPI_INPUT_FILE) |
| 140 |
|
| 141 |
ifeq ($(CONFIG_AGESA_BINARY_PI_AS_STAGE),y) |
| 142 |
$(CONFIG_AGESA_CBFS_NAME)-type := stage |
| 143 |
$(CONFIG_AGESA_CBFS_NAME)-options := --xip |
| 144 |
|
| 145 |
|
| 146 |
$(CONFIG_AGESA_CBFS_NAME)-align := 4096 |
| 147 |
else |
| 148 |
$(CONFIG_AGESA_CBFS_NAME)-type := raw |
| 149 |
$(CONFIG_AGESA_CBFS_NAME)-position := $(CONFIG_AGESA_BINARY_PI_LOCATION) |
| 150 |
regions-for-file-$(CONFIG_AGESA_CBFS_NAME) = COREBOOT |
| 151 |
endif |
| 152 |
|
| 153 |
endif |
| 154 |
endif |
| 155 |
|
| 156 |
endif |