From dcd24535cf751fcdaa7c5f025c2e54705e4053f3 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 23 Sep 2021 22:28:52 +0000 Subject: chip/mt_scp: Declaration needs to come before definition We are already disabling -Wignored-attributes to work around the declaration and definition order issue: error: attribute declaration must precede definition [-Werror,-Wignored-attributes] However, although there are no compiler errors, the linker (lld) will still fail: ld.lld: error: undefined symbol: clock_control_irq >>> referenced by clock.c:347 (src/platform/ec/chip/mt_scp/mt8183/clock.c:347) >>> lto.tmp:(irq_13_handler) ... ld.lld: error: undefined symbol: clock_fast_wakeup_irq >>> referenced by clock.c:355 (src/platform/ec/chip/mt_scp/mt8183/clock.c:355) >>> lto.tmp:(irq_44_handler) Tested with the compare_build.sh script to validate that the resulting binaries are identical. BRANCH=none BUG=b:172020503 TEST=CC=arm-none-eabi-clang make BOARD=kukui_scp -j TEST=./util/compare_build.sh --boards all -j 50 Signed-off-by: Tom Hughes Change-Id: Ib622fb98784a4c3ad3c199c72ee7604c7f709d6c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3182621 Reviewed-by: Diana Z --- chip/mt_scp/mt8183/clock.c | 4 ++-- chip/mt_scp/mt8183/hrtimer.c | 4 ++-- chip/mt_scp/mt8183/ipi.c | 2 +- chip/mt_scp/mt8183/uart.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chip/mt_scp/mt8183/clock.c b/chip/mt_scp/mt8183/clock.c index a6f1883d31..3029a00a01 100644 --- a/chip/mt_scp/mt8183/clock.c +++ b/chip/mt_scp/mt8183/clock.c @@ -338,21 +338,21 @@ void scp_enable_clock(void) AP_CLK_CFG_5_CLR = PWRAP_ULPOSC_CG; } +DECLARE_IRQ(SCP_IRQ_CLOCK, clock_control_irq, 3); void clock_control_irq(void) { /* Read ack CLK_IRQ */ (SCP_CLK_IRQ_ACK); task_clear_pending_irq(SCP_IRQ_CLOCK); } -DECLARE_IRQ(SCP_IRQ_CLOCK, clock_control_irq, 3); +DECLARE_IRQ(SCP_IRQ_CLOCK2, clock_fast_wakeup_irq, 3); void clock_fast_wakeup_irq(void) { /* Ack fast wakeup */ SCP_SLEEP_IRQ2 = 1; task_clear_pending_irq(SCP_IRQ_CLOCK2); } -DECLARE_IRQ(SCP_IRQ_CLOCK2, clock_fast_wakeup_irq, 3); /* Console command */ int command_ulposc(int argc, char *argv[]) diff --git a/chip/mt_scp/mt8183/hrtimer.c b/chip/mt_scp/mt8183/hrtimer.c index f970af6eb5..92887af2a7 100644 --- a/chip/mt_scp/mt8183/hrtimer.c +++ b/chip/mt_scp/mt8183/hrtimer.c @@ -242,8 +242,8 @@ static void __hw_clock_source_irq(int n) } #define DECLARE_TIMER_IRQ(n) \ - void __hw_clock_source_irq_##n(void) { __hw_clock_source_irq(n); } \ - DECLARE_IRQ(IRQ_TIMER(n), __hw_clock_source_irq_##n, 2) + DECLARE_IRQ(IRQ_TIMER(n), __hw_clock_source_irq_##n, 2); \ + void __hw_clock_source_irq_##n(void) { __hw_clock_source_irq(n); } DECLARE_TIMER_IRQ(0); DECLARE_TIMER_IRQ(1); diff --git a/chip/mt_scp/mt8183/ipi.c b/chip/mt_scp/mt8183/ipi.c index e6a79fca9a..8e13781db3 100644 --- a/chip/mt_scp/mt8183/ipi.c +++ b/chip/mt_scp/mt8183/ipi.c @@ -381,6 +381,7 @@ static void ipi_init(void) } DECLARE_HOOK(HOOK_INIT, ipi_init, HOOK_PRIO_DEFAULT); +DECLARE_IRQ(SCP_IRQ_IPC0, ipc_handler, 4); void ipc_handler(void) { /* TODO(b/117917141): We only support IPC_ID(0) for now. */ @@ -391,4 +392,3 @@ void ipc_handler(void) SCP_GIPC_IN &= (SCP_GPIC_IN_CLEAR_ALL & ~SCP_GIPC_IN_CLEAR_IPCN(0)); } -DECLARE_IRQ(SCP_IRQ_IPC0, ipc_handler, 4); diff --git a/chip/mt_scp/mt8183/uart.c b/chip/mt_scp/mt8183/uart.c index 78ea594c6b..7907f9537d 100644 --- a/chip/mt_scp/mt8183/uart.c +++ b/chip/mt_scp/mt8183/uart.c @@ -93,6 +93,7 @@ void uart_process(void) } #if (UARTN < SCP_UART_COUNT) +DECLARE_IRQ(UART_IRQ(UARTN), uart_interrupt, 2); void uart_interrupt(void) { uint8_t ier; @@ -103,8 +104,8 @@ void uart_interrupt(void) UART_IER(UARTN) = 0; UART_IER(UARTN) = ier; } -DECLARE_IRQ(UART_IRQ(UARTN), uart_interrupt, 2); +DECLARE_IRQ(UART_RX_IRQ(UARTN), uart_rx_interrupt, 2); void uart_rx_interrupt(void) { uint8_t ier; @@ -117,7 +118,6 @@ void uart_rx_interrupt(void) UART_IER(UARTN) = ier; SCP_INTC_UART_RX_IRQ |= 1 << UARTN; } -DECLARE_IRQ(UART_RX_IRQ(UARTN), uart_rx_interrupt, 2); #endif void uart_task(void) -- cgit v1.2.1