drivers/console: Link console framework code by default
authorJulius Werner <jwerner@chromium.org>
Wed, 28 Nov 2018 01:50:28 +0000 (17:50 -0800)
committerJulius Werner <jwerner@chromium.org>
Fri, 7 Dec 2018 00:13:50 +0000 (16:13 -0800)
This patch makes the build system link the console framework code by
default, like it already does with other common libraries (e.g. cache
helpers). This should not make a difference in practice since TF is
linked with --gc-sections, so the linker will garbage collect all
functions and data that are not referenced by any other code. Thus, if a
platform doesn't want to include console code for size reasons and
doesn't make any references to console functions, the code will not be
included in the final binary.

To avoid compatibility issues with older platform ports, only make this
change for the MULTI_CONSOLE_API.

Change-Id: I153a9dbe680d57aadb860d1c829759ba701130d3
Signed-off-by: Julius Werner <jwerner@chromium.org>
20 files changed:
Makefile
drivers/arm/pl011/aarch32/pl011_console.S
drivers/arm/pl011/aarch64/pl011_console.S
drivers/console/aarch32/console.S
drivers/console/aarch32/multi_console.S
drivers/console/aarch64/console.S
drivers/console/aarch64/multi_console.S
plat/allwinner/common/allwinner-common.mk
plat/imx/imx8qm/platform.mk
plat/imx/imx8qx/platform.mk
plat/layerscape/board/ls1043/platform.mk
plat/marvell/a3700/common/a3700_common.mk
plat/marvell/a8k/common/a8k_common.mk
plat/meson/gxbb/platform.mk
plat/rockchip/rk3328/platform.mk
plat/rockchip/rk3368/platform.mk
plat/rockchip/rk3399/platform.mk
plat/rpi3/platform.mk
plat/st/stm32mp1/platform.mk
plat/ti/k3/common/plat_common.mk

index c79264bc9e9bdb804d90006983cd7b55da7b1a71..63f283f3e25f2e13c10b7d39b9eb388ef2d5d01e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -214,6 +214,7 @@ include lib/libc/libc.mk
 BL_COMMON_SOURCES      +=      common/bl_common.c                      \
                                common/tf_log.c                         \
                                common/${ARCH}/debug.S                  \
+                               drivers/console/${ARCH}/multi_console.S \
                                lib/${ARCH}/cache_helpers.S             \
                                lib/${ARCH}/misc_helpers.S              \
                                plat/common/plat_bl_common.c            \
index 46ff225870c57d799f6b6e043c06e5c99295a7c7..5d6b95fe3ea5e4e9afd25e2a164762db8594158b 100644 (file)
 #include <console_macros.S>
 #include <pl011.h>
 
+#if !MULTI_CONSOLE_API
 /*
  * Pull in generic functions to provide backwards compatibility for
  * platform makefiles
  */
 #include "../../../console/aarch32/console.S"
+#endif
 
        /*
         * "core" functions are low-level implementations that don't require
index 3886f3b77c72909435c8b6560a88360dd77b6dcf..7fec0904d9189c3a01c9682fe6ae9abcd3d088e2 100644 (file)
 #include <console_macros.S>
 #include <pl011.h>
 
+#if !MULTI_CONSOLE_API
 /*
  * Pull in generic functions to provide backwards compatibility for
  * platform makefiles
  */
 #include "../../../console/aarch64/console.S"
+#endif
 
        /*
         * "core" functions are low-level implementations that don't require
index f909609469a849a0667ebf0d925b42b039a28e95..1c380944d47d2a52d73baa045427677e3dd5dadf 100644 (file)
@@ -5,7 +5,9 @@
  */
 
  #if MULTI_CONSOLE_API
- #include "multi_console.S"
+ #if ERROR_DEPRECATED
+ #error "console.S is deprecated, platforms should no longer link it explicitly"
+ #endif
  #else
  #include "deprecated_console.S"
  #endif
index e23b20e56ae7083e0b2ca4b7317df01b0da64f04..713dc3c7dce2f21b85ea729ffa2181c6843d181a 100644 (file)
@@ -4,6 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#if MULTI_CONSOLE_API
+
 #include <asm_macros.S>
 #include <assert_macros.S>
 #include <console.h>
@@ -316,3 +318,5 @@ flush_done:
        mov     r0, r5
        pop     {r5-r6, pc}
 endfunc console_flush
+
+#endif /* MULTI_CONSOLE_API */
index f847ed597811ba338b93c56476849b5727fd2e9c..669b31a6672dd68522ea1ebc7b7b00fd6708daab 100644 (file)
@@ -5,7 +5,9 @@
  */
 
 #if MULTI_CONSOLE_API
-#include "multi_console.S"
+#if ERROR_DEPRECATED
+#error "console.S is deprecated, platforms should no longer link it explicitly"
+#endif
 #else
 #include "deprecated_console.S"
 #endif
index 95423b0278be56a3370639fd6ce41d32cab32869..40d500d2f8183c4e1982bb3ca6515269ef450718 100644 (file)
@@ -4,6 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#if MULTI_CONSOLE_API
+
 #include <asm_macros.S>
 #include <assert_macros.S>
 #include <console.h>
@@ -323,3 +325,5 @@ flush_done:
        ldp     x30, xzr, [sp], #16
        ret
 endfunc console_flush
+
+#endif /* MULTI_CONSOLE_API */
index 2dc058f5422ffd76268ce455b72be071a9231133..f20f5157e96267f42e3d490175b27fa4830c5232 100644 (file)
@@ -15,8 +15,7 @@ PLAT_INCLUDES         :=      -Iinclude/plat/arm/common               \
 
 include lib/libfdt/libfdt.mk
 
-PLAT_BL_COMMON_SOURCES :=      drivers/console/${ARCH}/console.S       \
-                               drivers/ti/uart/${ARCH}/16550_console.S \
+PLAT_BL_COMMON_SOURCES :=      drivers/ti/uart/${ARCH}/16550_console.S \
                                ${XLAT_TABLES_LIB_SRCS}                 \
                                ${AW_PLAT}/common/plat_helpers.S        \
                                ${AW_PLAT}/common/sunxi_common.c
index ce84e2baa2b49503b4bf0d8682a8cf67004a39d2..dc45e901d885950e8deb5c35b1dbcc9cdf0b0f58 100644 (file)
@@ -26,7 +26,6 @@ BL31_SOURCES          +=      plat/imx/common/lpuart_console.S        \
                                lib/xlat_tables/xlat_tables_common.c            \
                                lib/cpus/aarch64/cortex_a53.S                   \
                                lib/cpus/aarch64/cortex_a72.S                   \
-                               drivers/console/aarch64/console.S               \
                                drivers/arm/cci/cci.c                           \
                                ${IMX_GIC_SOURCES}                              \
 
index 02559b46256274718a6a730a8fb67fe7da7536ca..a831bf2f05f1181fc4b3b8ee63a38ca686917020 100644 (file)
@@ -25,7 +25,6 @@ BL31_SOURCES          +=      plat/imx/common/lpuart_console.S        \
                                lib/xlat_tables/xlat_tables_common.c    \
                                lib/xlat_tables/aarch64/xlat_tables.c   \
                                lib/cpus/aarch64/cortex_a35.S           \
-                               drivers/console/aarch64/console.S       \
                                ${IMX_GIC_SOURCES}                      \
 
 include plat/imx/common/sci/sci_api.mk
index 678205cd32309035fa658c41470367475fd0e44f..795d924828b77ee35290964b4847ba3e7f043910 100644 (file)
@@ -28,8 +28,7 @@ PLAT_INCLUDES                 :=      -Iplat/layerscape/board/ls1043/include   \
                                        -Iinclude/drivers/io
 
 
-PLAT_BL_COMMON_SOURCES         :=      drivers/console/aarch64/console.S       \
-                                       plat/layerscape/common/aarch64/ls_console.S
+PLAT_BL_COMMON_SOURCES         :=      plat/layerscape/common/aarch64/ls_console.S
 
 LS1043_CPU_LIBS                        :=      lib/cpus/${ARCH}/aem_generic.S
 
index 3983c707c0c0cfae3e34f7aa2bb853be9e695292..e2ac97ffc9b9eebf63ea9308f34cb41a6417f354 100644 (file)
@@ -96,7 +96,6 @@ PLAT_INCLUDES         :=      -I$(PLAT_FAMILY_BASE)/$(PLAT)           \
                                $(ATF_INCLUDES)
 
 PLAT_BL_COMMON_SOURCES :=      $(PLAT_COMMON_BASE)/aarch64/a3700_common.c \
-                               drivers/console/aarch64/console.S          \
                                $(MARVELL_COMMON_BASE)/marvell_cci.c       \
                                $(MARVELL_DRV_BASE)/uart/a3700_console.S
 
index 6136a1f596685d0222dcf9dba4be7457c0bcbf69..7f01e13b2dfa234f11b2f5709503958c356fdda8 100644 (file)
@@ -52,7 +52,6 @@ PLAT_INCLUDES         :=      -I$(PLAT_FAMILY_BASE)/$(PLAT)           \
                                $(ATF_INCLUDES)
 
 PLAT_BL_COMMON_SOURCES :=      $(PLAT_COMMON_BASE)/aarch64/a8k_common.c \
-                               drivers/console/aarch64/console.S        \
                                drivers/ti/uart/aarch64/16550_console.S
 
 BLE_PORTING_SOURCES    :=      $(PLAT_FAMILY_BASE)/$(PLAT)/board/dram_port.c \
index e6f5ae4894f5b08f86430a29cb552471f381d402..68ff4007519119b70719cbdc9e4709ba0b70aac5 100644 (file)
@@ -14,8 +14,7 @@ GXBB_GIC_SOURCES      :=      drivers/arm/gic/common/gic_common.c     \
                                drivers/arm/gic/v2/gicv2_helpers.c      \
                                plat/common/plat_gicv2.c
 
-PLAT_BL_COMMON_SOURCES :=      drivers/console/aarch64/multi_console.S \
-                               drivers/meson/console/aarch64/meson_console.S \
+PLAT_BL_COMMON_SOURCES :=      drivers/meson/console/aarch64/meson_console.S \
                                plat/meson/gxbb/gxbb_common.c           \
                                plat/meson/gxbb/gxbb_topology.c         \
                                ${XLAT_TABLES_LIB_SRCS}
index 785f640367a15d27c1faa653e546841be4fbf2a1..2b2ac51c47e9a9478015c00bca5ca76841e0098d 100644 (file)
@@ -34,7 +34,6 @@ PLAT_BL_COMMON_SOURCES        :=      lib/xlat_tables/aarch64/xlat_tables.c           \
 
 BL31_SOURCES           +=      ${RK_GIC_SOURCES}                               \
                                drivers/arm/cci/cci.c                           \
-                               drivers/console/aarch64/console.S               \
                                drivers/ti/uart/aarch64/16550_console.S         \
                                drivers/delay_timer/delay_timer.c               \
                                drivers/delay_timer/generic_delay_timer.c       \
index a3e593e60553ad0d1826107b6c53f5f73bd00ac1..c0164c1797dae8cafdaf0171424079a1133176f7 100644 (file)
@@ -31,7 +31,6 @@ PLAT_BL_COMMON_SOURCES        :=      lib/xlat_tables/xlat_tables_common.c            \
 
 BL31_SOURCES           +=      ${RK_GIC_SOURCES}                               \
                                drivers/arm/cci/cci.c                           \
-                               drivers/console/aarch64/console.S               \
                                drivers/ti/uart/aarch64/16550_console.S         \
                                drivers/delay_timer/delay_timer.c               \
                                drivers/delay_timer/generic_delay_timer.c       \
index eccf1cc850e164d8a681403ba505f9e5a85abca1..b624717dda7ff64137db4a3fb181fd3df3a0e581 100644 (file)
@@ -37,7 +37,6 @@ PLAT_BL_COMMON_SOURCES        :=      lib/xlat_tables/xlat_tables_common.c    \
 
 BL31_SOURCES   +=      ${RK_GIC_SOURCES}                               \
                        drivers/arm/cci/cci.c                           \
-                       drivers/console/aarch64/console.S               \
                        drivers/ti/uart/aarch64/16550_console.S         \
                        drivers/delay_timer/delay_timer.c               \
                        drivers/delay_timer/generic_delay_timer.c       \
index db96de821173ca513a33ad5cccf9e0d0db0f2403..46c139eac43f1ea7f725605b523e236fdc2de3dc 100644 (file)
@@ -10,8 +10,7 @@ include lib/xlat_tables_v2/xlat_tables.mk
 PLAT_INCLUDES          :=      -Iinclude/common/tbbr                   \
                                -Iplat/rpi3/include
 
-PLAT_BL_COMMON_SOURCES :=      drivers/console/aarch64/console.S       \
-                               drivers/ti/uart/aarch64/16550_console.S \
+PLAT_BL_COMMON_SOURCES :=      drivers/ti/uart/aarch64/16550_console.S \
                                plat/rpi3/rpi3_common.c                 \
                                ${XLAT_TABLES_LIB_SRCS}
 
index f4a0ca4a7a234cfdf17846637083203e3c3d1954..545b140d8828d672a7231617b8b8bb7662b18093 100644 (file)
@@ -35,8 +35,7 @@ include lib/libfdt/libfdt.mk
 
 PLAT_BL_COMMON_SOURCES :=      plat/st/stm32mp1/stm32mp1_common.c
 
-PLAT_BL_COMMON_SOURCES +=      drivers/console/aarch32/console.S                       \
-                               drivers/st/uart/aarch32/stm32_console.S
+PLAT_BL_COMMON_SOURCES +=      drivers/st/uart/aarch32/stm32_console.S
 
 ifneq (${ENABLE_STACK_PROTECTOR},0)
 PLAT_BL_COMMON_SOURCES +=      plat/st/stm32mp1/stm32mp1_stack_protector.c
index fbd79b4ad9b98d17972a27d0a7fba231537f7856..9b3e7d84f51a263f2f58b4d5845a30ba1ac68415 100644 (file)
@@ -39,7 +39,6 @@ PLAT_INCLUDES         +=      \
                                -I${PLAT_PATH}/common/drivers/ti_sci    \
 
 K3_CONSOLE_SOURCES     +=      \
-                               drivers/console/aarch64/console.S       \
                                drivers/ti/uart/aarch64/16550_console.S \
                                ${PLAT_PATH}/common/k3_console.c        \