x86: Make x86 architecture makefiles x64 aware
Almost all of the code between x86 and x64 can be shared, so select it for either architecture. Change-Id: I681149ed7698c08b702bb19f074f369699cef1bf Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Signed-off-by: Scott Duplichan <scott@notabs.org> Reviewed-on: http://review.coreboot.org/8693 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
parent
6867120a80
commit
181b77324f
|
@ -58,19 +58,18 @@ cbfs-files-$(CONFIG_INTEL_MBI) += mbi.bin
|
||||||
mbi.bin-file := $(call strip_quotes,$(CONFIG_MBI_FILE))
|
mbi.bin-file := $(call strip_quotes,$(CONFIG_MBI_FILE))
|
||||||
mbi.bin-type := mbi
|
mbi.bin-type := mbi
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
|
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y)
|
||||||
CBFSTOOL_PRE1_OPTS = -m x86 -s $(CONFIG_ROM_SIZE) \
|
CBFSTOOL_PRE1_OPTS = -m x86 -s $(CONFIG_ROM_SIZE) \
|
||||||
-o $$(( $(CONFIG_ROM_SIZE) - $(CONFIG_CBFS_SIZE) ))
|
-o $$(( $(CONFIG_ROM_SIZE) - $(CONFIG_CBFS_SIZE) ))
|
||||||
# Make sure that segment for .car.data is ignored while adding romstage.
|
# Make sure that segment for .car.data is ignored while adding romstage.
|
||||||
CBFSTOOL_PRE_OPTS = -b $(shell cat $(objcbfs)/base_xip.txt) -S ".car.data"
|
CBFSTOOL_PRE_OPTS = -b $(shell cat $(objcbfs)/base_xip.txt) -S ".car.data"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# bootblock
|
# bootblock
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
|
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32)$(CONFIG_ARCH_BOOTBLOCK_X86_64),y)
|
||||||
|
|
||||||
bootblock-srcs += $(src)/arch/x86/init/failover.ld
|
bootblock-srcs += $(src)/arch/x86/init/failover.ld
|
||||||
bootblock-srcs += $(src)/cpu/x86/16bit/entry16.ld
|
bootblock-srcs += $(src)/cpu/x86/16bit/entry16.ld
|
||||||
|
@ -112,7 +111,7 @@ $(objgenerated)/bootblock_inc.S: $$(bootblock_inc)
|
||||||
|
|
||||||
$(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s
|
$(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s
|
||||||
@printf " CC $(subst $(obj)/,,$(@))\n"
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
||||||
$(CC_bootblock) $(CFLAGS_x86_32) -c -o $@ $< > $(basename $@).disasm
|
$(CC_bootblock) $(CFLAGS_bootblock) -c -o $@ $< > $(basename $@).disasm
|
||||||
|
|
||||||
$(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h
|
$(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h
|
||||||
@printf " CC $(subst $(obj)/,,$(@))\n"
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
||||||
|
@ -129,13 +128,13 @@ $(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootbloc
|
||||||
$(LD_bootblock) -m elf_i386 -static -o $@ -L$(obj) $< -T $(objgenerated)/bootblock.ld
|
$(LD_bootblock) -m elf_i386 -static -o $@ -L$(obj) $< -T $(objgenerated)/bootblock.ld
|
||||||
|
|
||||||
|
|
||||||
endif # CONFIG_ARCH_BOOTBLOCK_X86_32
|
endif # CONFIG_ARCH_BOOTBLOCK_X86_32 / CONFIG_ARCH_BOOTBLOCK_X86_64
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# romstage
|
# romstage
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
|
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y)
|
||||||
|
|
||||||
crt0s = $(src)/arch/x86/init/prologue.inc
|
crt0s = $(src)/arch/x86/init/prologue.inc
|
||||||
romstage-srcs += $(src)/arch/x86/init/romstage.ld
|
romstage-srcs += $(src)/arch/x86/init/romstage.ld
|
||||||
|
@ -238,13 +237,13 @@ $(objgenerated)/crt0.S: $$(crt0s)
|
||||||
# Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428
|
# Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428
|
||||||
romstage-S-ccopts += -I. -g0
|
romstage-S-ccopts += -I. -g0
|
||||||
|
|
||||||
endif # CONFIG_ARCH_ROMSTAGE_X86_32
|
endif # CONFIG_ARCH_ROMSTAGE_X86_32 / CONFIG_ARCH_ROMSTAGE_X86_64
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# ramstage
|
# ramstage
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32)$(CONFIG_ARCH_RAMSTAGE_X86_64),y)
|
||||||
|
|
||||||
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
|
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
|
||||||
ifeq ($(CONFIG_GENERATE_MP_TABLE),y)
|
ifeq ($(CONFIG_GENERATE_MP_TABLE),y)
|
||||||
|
@ -278,7 +277,11 @@ ramstage-libs ?=
|
||||||
|
|
||||||
ifeq ($(CONFIG_RELOCATABLE_RAMSTAGE),y)
|
ifeq ($(CONFIG_RELOCATABLE_RAMSTAGE),y)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
||||||
$(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o, $(CONFIG_HEAP_SIZE),x86_32))
|
$(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o, $(CONFIG_HEAP_SIZE),x86_32))
|
||||||
|
else
|
||||||
|
$(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o, $(CONFIG_HEAP_SIZE),x86_64))
|
||||||
|
endif
|
||||||
|
|
||||||
# The rmodule_link defintion creates an elf file with .rmod extension.
|
# The rmodule_link defintion creates an elf file with .rmod extension.
|
||||||
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
|
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
|
||||||
|
@ -296,9 +299,13 @@ endif
|
||||||
|
|
||||||
$(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs)
|
$(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs)
|
||||||
@printf " CC $(subst $(obj)/,,$(@))\n"
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
||||||
|
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
|
||||||
$(LD_ramstage) -m elf_i386 -r -o $@ $(COMPILER_RT_FLAGS_ramstage) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) --no-whole-archive $(COMPILER_RT_ramstage) --end-group
|
$(LD_ramstage) -m elf_i386 -r -o $@ $(COMPILER_RT_FLAGS_ramstage) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) --no-whole-archive $(COMPILER_RT_ramstage) --end-group
|
||||||
|
else
|
||||||
|
$(LD_ramstage) -m elf_x86_64 -r -o $@ $(COMPILER_RT_FLAGS_ramstage) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) --no-whole-archive $(COMPILER_RT_ramstage) --end-group
|
||||||
|
endif
|
||||||
|
|
||||||
endif # CONFIG_ARCH_RAMSTAGE_X86_32
|
endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
|
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y)
|
||||||
|
|
||||||
romstage-y += cbmem.c
|
romstage-y += cbmem.c
|
||||||
romstage-y += boot.c
|
romstage-y += boot.c
|
||||||
|
|
||||||
endif # CONFIG_ARCH_ROMSTAGE_X86_32
|
endif # CONFIG_ARCH_ROMSTAGE_X86_32 / CONFIG_ARCH_ROMSTAGE_X86_64
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32)$(CONFIG_ARCH_RAMSTAGE_X86_64),y)
|
||||||
|
|
||||||
ramstage-y += boot.c
|
ramstage-y += boot.c
|
||||||
ramstage-y += gdt.c
|
ramstage-y += gdt.c
|
||||||
|
@ -19,4 +19,4 @@ ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c
|
||||||
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpigen.c
|
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpigen.c
|
||||||
ramstage-$(CONFIG_HAVE_ACPI_RESUME) += wakeup.S
|
ramstage-$(CONFIG_HAVE_ACPI_RESUME) += wakeup.S
|
||||||
|
|
||||||
endif # CONFIG_ARCH_RAMSTAGE_X86_32
|
endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
|
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y)
|
||||||
|
|
||||||
romstage-y += cbfs_and_run.c
|
romstage-y += cbfs_and_run.c
|
||||||
romstage-y += memset.c
|
romstage-y += memset.c
|
||||||
|
@ -7,9 +7,9 @@ romstage-y += memcpy.c
|
||||||
romstage-y += memmove.c
|
romstage-y += memmove.c
|
||||||
romstage-y += mmap_boot.c
|
romstage-y += mmap_boot.c
|
||||||
|
|
||||||
endif # CONFIG_ARCH_ROMSTAGE_X86_32
|
endif # CONFIG_ARCH_ROMSTAGE_X86_32 / CONFIG_ARCH_ROMSTAGE_X86_64
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32)$(CONFIG_ARCH_RAMSTAGE_X86_64),y)
|
||||||
|
|
||||||
ramstage-y += c_start.S
|
ramstage-y += c_start.S
|
||||||
ramstage-y += cpu.c
|
ramstage-y += cpu.c
|
||||||
|
@ -33,8 +33,14 @@ smm-y += memcpy.c
|
||||||
smm-y += memmove.c
|
smm-y += memmove.c
|
||||||
smm-y += mmap_boot.c
|
smm-y += mmap_boot.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
||||||
rmodules_x86_32-y += memset.c
|
rmodules_x86_32-y += memset.c
|
||||||
rmodules_x86_32-y += memcpy.c
|
rmodules_x86_32-y += memcpy.c
|
||||||
rmodules_x86_32-y += memmove.c
|
rmodules_x86_32-y += memmove.c
|
||||||
|
else
|
||||||
|
rmodules_x86_64-y += memset.c
|
||||||
|
rmodules_x86_64-y += memcpy.c
|
||||||
|
rmodules_x86_64-y += memmove.c
|
||||||
|
endif
|
||||||
|
|
||||||
endif # CONFIG_ARCH_RAMSTAGE_X86_32
|
endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
|
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y)
|
||||||
romstage-$(CONFIG_CACHE_AS_RAM) += car.c
|
romstage-$(CONFIG_CACHE_AS_RAM) += car.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -19,11 +19,19 @@ rmodules_$(ARCH-ramstage-y)-$(CONFIG_PARALLEL_MP) += sipi_vector.S
|
||||||
$(SIPI_DOTO): $(dir $(SIPI_ELF))sipi_vector.rmodules_$(ARCH-ramstage-y).o
|
$(SIPI_DOTO): $(dir $(SIPI_ELF))sipi_vector.rmodules_$(ARCH-ramstage-y).o
|
||||||
$(CC_rmodules_$(ARCH-ramstage-y)) $(CFLAGS_rmodules_$(ARCH-ramstage-y)) -nostdlib -r -o $@ $^
|
$(CC_rmodules_$(ARCH-ramstage-y)) $(CFLAGS_rmodules_$(ARCH-ramstage-y)) -nostdlib -r -o $@ $^
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
||||||
$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_ELF:.elf=.o), 0,x86_32))
|
$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_ELF:.elf=.o), 0,x86_32))
|
||||||
|
else
|
||||||
|
$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_ELF:.elf=.o), 0,x86_64))
|
||||||
|
endif
|
||||||
|
|
||||||
$(SIPI_BIN): $(SIPI_RMOD)
|
$(SIPI_BIN): $(SIPI_RMOD)
|
||||||
$(OBJCOPY_ramstage) -O binary $< $@
|
$(OBJCOPY_ramstage) -O binary $< $@
|
||||||
|
|
||||||
$(SIPI_BIN).ramstage.manual: $(SIPI_BIN)
|
$(SIPI_BIN).ramstage.manual: $(SIPI_BIN)
|
||||||
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
|
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
|
||||||
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
||||||
cd $(dir $@); $(OBJCOPY_rmodules_$(ARCH-ramstage-y)) -I binary $(notdir $<) -O elf32-i386 -B i386 $(notdir $@)
|
cd $(dir $@); $(OBJCOPY_rmodules_$(ARCH-ramstage-y)) -I binary $(notdir $<) -O elf32-i386 -B i386 $(notdir $@)
|
||||||
|
else
|
||||||
|
cd $(dir $@); $(OBJCOPY_rmodules_$(ARCH-ramstage-y)) -I binary $(notdir $<) -O elf64-x86_64 -B x86_64 $(notdir $@)
|
||||||
|
endif
|
||||||
|
|
Loading…
Reference in New Issue