From d3634c108d63d07ce004a66e3abb05e8da57d65b Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 13 Nov 2015 13:28:41 -0800 Subject: rules.h: Add ENV_ macros to detect current architecture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch expands the existing ENV_ macros in with a set of ENV_ macros which can be used to detect which architecture the current compilation unit is built for. These are more consistent than compiler-defined macros (like '#ifdef __arm__') and will make it easier to write small, architecture-dependent differences in common code (where we currently often use IS_ENABLED(CONFIG_ARCH_...), which is technically incorrect in a world where every stage can run on a different architecture, and merely kinda happened to work out for now). Also remove a vestigal from ARM64 which was no longer used, and genericise ARM subarchitecture Makefiles a little to make things like __COREBOOT_ARM_ARCH__ available from all file types (including .ld). BUG=None TEST=Compiled Falco, Blaze, Jerry and Smaug. Change-Id: Id51aeb290b5c215c653e42a51919d0838e28621f Signed-off-by: Julius Werner Reviewed-on: http://review.coreboot.org/12433 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Kyösti Mälkki Tested-by: Raptor Engineering Automated Test Stand --- src/arch/arm/armv4/Makefile.inc | 18 +++++-------- src/arch/arm/armv7/Makefile.inc | 42 +++++++++++++++---------------- src/arch/arm64/armv8/Makefile.inc | 23 ++++++----------- src/arch/arm64/include/armv8/arch/rules.h | 30 ---------------------- 4 files changed, 33 insertions(+), 80 deletions(-) delete mode 100644 src/arch/arm64/include/armv8/arch/rules.h (limited to 'src/arch') diff --git a/src/arch/arm/armv4/Makefile.inc b/src/arch/arm/armv4/Makefile.inc index ee1879c..1b91961 100644 --- a/src/arch/arm/armv4/Makefile.inc +++ b/src/arch/arm/armv4/Makefile.inc @@ -30,8 +30,7 @@ endif bootblock-y += cache.c -bootblock-c-ccopts += $(armv4_flags) -bootblock-S-ccopts += $(armv4_flags) +bootblock-generic-ccopts += $(armv4_flags) endif # CONFIG_ARCH_BOOTBLOCK_ARMV4 @@ -40,10 +39,8 @@ endif # CONFIG_ARCH_BOOTBLOCK_ARMV4 ################################################################################ ifeq ($(CONFIG_ARCH_VERSTAGE_ARMV4),y) -libverstage-c-ccopts += $(armv4_flags) -libverstage-S-ccopts += $(armv4_flags) -verstage-c-ccopts += $(armv4_flags) -verstage-S-ccopts += $(armv4_flags) +libverstage-generic-ccopts += $(armv4_flags) +verstage-generic-ccopts += $(armv4_flags) verstage-y += cache.c endif # CONFIG_ARCH_VERSTAGE_ARMV4 @@ -55,12 +52,10 @@ endif # CONFIG_ARCH_VERSTAGE_ARMV4 ifeq ($(CONFIG_ARCH_ROMSTAGE_ARMV4),y) -romstage-c-ccopts += $(armv4_flags) -romstage-S-ccopts += $(armv4_flags) +romstage-generic-ccopts += $(armv4_flags) romstage-y += cache.c -rmodules_arm-c-ccopts += $(armv4_flags) -rmodules_arm-S-ccopts += $(armv4_flags) +rmodules_arm-generic-ccopts += $(armv4_flags) endif # CONFIG_ARCH_ROMSTAGE_ARMV4 @@ -70,7 +65,6 @@ endif # CONFIG_ARCH_ROMSTAGE_ARMV4 ifeq ($(CONFIG_ARCH_RAMSTAGE_ARMV4),y) -ramstage-c-ccopts += $(armv4_flags) -ramstage-S-ccopts += $(armv4_flags) +ramstage-generic-ccopts += $(armv4_flags) endif # CONFIG_ARCH_RAMSTAGE_ARMV4 diff --git a/src/arch/arm/armv7/Makefile.inc b/src/arch/arm/armv7/Makefile.inc index 3a489cb..2e9c49c 100644 --- a/src/arch/arm/armv7/Makefile.inc +++ b/src/arch/arm/armv7/Makefile.inc @@ -20,16 +20,14 @@ armv7-a_flags = -march=armv7-a $(armv7_flags) armv7-m_flags = -march=armv7-m $(armv7_flags) armv7_asm_flags = -Wa,-mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -armv7-a_asm_flags = $(armv7-a_flags) $(armv7_asm_flags) -armv7-m_asm_flags = $(armv7-m_flags) $(armv7_asm_flags) ############################################################################### # bootblock ############################################################################### ifeq ($(CONFIG_ARCH_BOOTBLOCK_ARMV7),y) -bootblock-c-ccopts += $(armv7-a_flags) -bootblock-S-ccopts += $(armv7-a_asm_flags) +bootblock-generic-ccopts += $(armv7-a_flags) +bootblock-S-ccopts += $(armv7_asm_flags) ifneq ($(CONFIG_BOOTBLOCK_CUSTOM),y) bootblock-y += bootblock.S @@ -42,8 +40,8 @@ bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += exception_asm.S bootblock-y += mmu.c else ifeq ($(CONFIG_ARCH_BOOTBLOCK_ARMV7_M),y) -bootblock-c-ccopts += $(armv7-m_flags) -bootblock-S-ccopts += $(armv7-m_asm_flags) +bootblock-generic-ccopts += $(armv7-m_flags) +bootblock-S-ccopts += $(armv7_asm_flags) ifneq ($(CONFIG_BOOTBLOCK_CUSTOM),y) bootblock-y += bootblock_m.S @@ -58,10 +56,10 @@ endif # CONFIG_ARCH_BOOTBLOCK_ARMV7 ################################################################################ ifeq ($(CONFIG_ARCH_VERSTAGE_ARMV7),y) -libverstage-c-ccopts += $(armv7-a_flags) -libverstage-S-ccopts += $(armv7-a_asm_flags) -verstage-c-ccopts += $(armv7-a_flags) -verstage-S-ccopts += $(armv7-a_asm_flags) +libverstage-generic-ccopts += $(armv7-a_flags) +libverstage-S-ccopts += $(armv7_asm_flags) +verstage-generic-ccopts += $(armv7-a_flags) +verstage-S-ccopts += $(armv7_asm_flags) verstage-y += cache.c verstage-y += cpu.S @@ -70,10 +68,10 @@ verstage-y += exception_asm.S verstage-y += mmu.c else ifeq ($(CONFIG_ARCH_VERSTAGE_ARMV7_M),y) -libverstage-c-ccopts += $(armv7-m_flags) -libverstage-S-ccopts += $(armv7-m_asm_flags) -verstage-c-ccopts += $(armv7-m_flags) -verstage-S-ccopts += $(armv7-m_asm_flags) +libverstage-generic-ccopts += $(armv7-m_flags) +libverstage-S-ccopts += $(armv7_asm_flags) +verstage-generic-ccopts += $(armv7-m_flags) +verstage-S-ccopts += $(armv7_asm_flags) endif # CONFIG_ARCH_VERSTAGE_ARMV7_M @@ -87,11 +85,11 @@ romstage-y += exception.c romstage-y += exception_asm.S romstage-y += mmu.c -romstage-c-ccopts += $(armv7-a_flags) -romstage-S-ccopts += $(armv7-a_asm_flags) +romstage-generic-ccopts += $(armv7-a_flags) +romstage-S-ccopts += $(armv7_asm_flags) -rmodules_arm-c-ccopts += $(armv7-a_flags) -rmodules_arm-S-ccopts += $(armv7-a_asm_flags) +rmodules_arm-generic-ccopts += $(armv7-a_flags) +rmodules_arm-S-ccopts += $(armv7_asm_flags) endif # CONFIG_ARCH_ROMSTAGE_ARMV7 @@ -107,10 +105,10 @@ ramstage-y += exception.c ramstage-y += exception_asm.S ramstage-y += mmu.c -ramstage-c-ccopts += $(armv7-a_flags) -ramstage-S-ccopts += $(armv7-a_asm_flags) +ramstage-generic-ccopts += $(armv7-a_flags) +ramstage-S-ccopts += $(armv7_asm_flags) # All rmodule code is armv7 if ramstage is armv7. -rmodules_arm-c-ccopts += $(armv7-a_flags) -rmodules_arm-S-ccopts += $(armv7-a_asm_flags) +rmodules_arm-generic-ccopts += $(armv7-a_flags) +rmodules_arm-S-ccopts += $(armv7_asm_flags) endif # CONFIG_ARCH_RAMSTAGE_ARMV7 diff --git a/src/arch/arm64/armv8/Makefile.inc b/src/arch/arm64/armv8/Makefile.inc index f25a567..53d0e46 100644 --- a/src/arch/arm64/armv8/Makefile.inc +++ b/src/arch/arm64/armv8/Makefile.inc @@ -19,8 +19,6 @@ subdirs-y += lib/ armv8_flags = -march=armv8-a -I$(src)/arch/arm64/include/armv8/ -D__COREBOOT_ARM_ARCH__=8 -armv8_asm_flags = $(armv8_flags) - ################################################################################ ## bootblock ################################################################################ @@ -34,8 +32,7 @@ bootblock-y += cache_helpers.S bootblock-y += cpu.S bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += exception.c -bootblock-c-ccopts += $(armv8_flags) -bootblock-S-ccopts += $(armv8_asm_flags) +bootblock-generic-ccopts += $(armv8_flags) # Required to access unaligned timestamp struct members before MMU is active # (TODO: Maybe use explicit unaligned accesses in timestamp code instead, or @@ -54,10 +51,8 @@ verstage-y += cpu.S verstage-y += cache_helpers.S verstage-y += exception.c -libverstage-c-ccopts += $(armv8_flags) -libverstage-S-ccopts += $(armv8_asm_flags) -verstage-c-ccopts += $(armv8_flags) -verstage-S-ccopts += $(armv8_asm_flags) +libverstage-generic-ccopts += $(armv8_flags) +verstage-generic-ccopts += $(armv8_flags) endif @@ -71,11 +66,9 @@ romstage-y += cache_helpers.S romstage-y += cpu.S romstage-y += exception.c -romstage-c-ccopts += $(armv8_flags) -romstage-S-ccopts += $(armv8_asm_flags) +romstage-generic-ccopts += $(armv8_flags) -rmodules_arm64-c-ccopts += $(armv8_flags) -rmodules_arm64-S-ccopts += $(armv8_asm_flags) +rmodules_arm64-generic-ccopts += $(armv8_flags) endif @@ -90,10 +83,8 @@ ramstage-y += cpu.S ramstage-y += exception.c ramstage-y += mmu.c -ramstage-c-ccopts += $(armv8_flags) -ramstage-S-ccopts += $(armv8_asm_flags) +ramstage-generic-ccopts += $(armv8_flags) -rmodules_arm64-c-ccopts += $(armv8_flags) -rmodules_arm64-S-ccopts += $(armv8_asm_flags) +rmodules_arm64-generic-ccopts += $(armv8_flags) endif diff --git a/src/arch/arm64/include/armv8/arch/rules.h b/src/arch/arm64/include/armv8/arch/rules.h deleted file mode 100644 index a252894..0000000 --- a/src/arch/arm64/include/armv8/arch/rules.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _ARCH_RULES_H -#define _ARCH_RULES_H - -/* For romstage and ramstage always build with simple device model, ie. - * PCI, PNP and CPU functions operate without use of devicetree. - * - * For ramstage individual source file may define __SIMPLE_DEVICE__ - * before including any header files to force that particular source - * be built with simple device model. - */ - -#if defined(__PRE_RAM__) -#define __SIMPLE_DEVICE__ -#endif - -#endif /* _ARCH_RULES_H */ -- cgit v1.1