[U-Boot] [PATCH v4 33/42] common: Move interrupt functions into a new header

Simon Glass sjg at chromium.org
Thu Nov 14 19:57:41 UTC 2019


These functions do not use driver model but are fairly widely used in
U-Boot. But it is not clear that they will use driver model anytime soon,
so we don't want to label them as 'legacy'.

Move them to a new irq_func.h header file. Avoid the name 'irq.h' since it
is widely used in U-Boot already.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Tom Rini <trini at konsulko.com>
---

Changes in v4: None
Changes in v3:
- Rename irq_legacy to irq_func to avoid the 'legacy' label
- Update commit message

Changes in v2: None

 arch/arc/lib/interrupts.c             |  1 +
 arch/arm/lib/interrupts.c             |  1 +
 arch/arm/lib/interrupts_64.c          |  1 +
 arch/arm/lib/interrupts_m.c           |  1 +
 arch/m68k/cpu/mcf5227x/interrupts.c   |  1 +
 arch/m68k/cpu/mcf523x/interrupts.c    |  1 +
 arch/m68k/cpu/mcf52x2/interrupts.c    |  1 +
 arch/m68k/cpu/mcf530x/interrupts.c    |  1 +
 arch/m68k/cpu/mcf532x/interrupts.c    |  1 +
 arch/m68k/cpu/mcf5445x/interrupts.c   |  1 +
 arch/m68k/cpu/mcf547x_8x/interrupts.c |  1 +
 arch/m68k/cpu/mcf547x_8x/slicetimer.c |  1 +
 arch/m68k/lib/interrupts.c            |  1 +
 arch/m68k/lib/time.c                  |  1 +
 arch/microblaze/cpu/interrupts.c      |  1 +
 arch/mips/cpu/interrupts.c            |  1 +
 arch/mips/mach-jz47xx/jz4780/timer.c  |  1 +
 arch/nds32/cpu/n1213/ag101/timer.c    |  1 +
 arch/nds32/lib/interrupts.c           |  1 +
 arch/nios2/cpu/interrupts.c           |  1 +
 arch/powerpc/cpu/mpc83xx/interrupts.c |  1 +
 arch/powerpc/cpu/mpc85xx/interrupts.c |  1 +
 arch/powerpc/cpu/mpc85xx/traps.c      |  1 +
 arch/powerpc/cpu/mpc86xx/interrupts.c |  1 +
 arch/powerpc/cpu/mpc8xx/interrupts.c  |  1 +
 arch/powerpc/lib/interrupts.c         |  1 +
 arch/riscv/lib/interrupts.c           |  1 +
 arch/sandbox/lib/interrupts.c         |  1 +
 arch/sh/cpu/sh4/interrupts.c          |  1 +
 arch/x86/cpu/i386/interrupt.c         |  1 +
 arch/x86/cpu/x86_64/interrupts.c      |  1 +
 arch/x86/lib/bios.c                   |  1 +
 arch/x86/lib/interrupts.c             |  1 +
 arch/x86/lib/spl.c                    |  1 +
 arch/xtensa/cpu/exceptions.c          |  1 +
 common/board_r.c                      |  1 +
 common/spl/spl.c                      |  1 +
 drivers/mtd/cfi_flash.c               |  1 +
 drivers/timer/mpc83xx_timer.c         |  1 +
 include/common.h                      |  7 -------
 include/exports.h                     |  2 ++
 include/irq_func.h                    | 19 +++++++++++++++++++
 42 files changed, 60 insertions(+), 7 deletions(-)
 create mode 100644 include/irq_func.h

diff --git a/arch/arc/lib/interrupts.c b/arch/arc/lib/interrupts.c
index 24ff751220..db21fbb114 100644
--- a/arch/arc/lib/interrupts.c
+++ b/arch/arc/lib/interrupts.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <asm/arcregs.h>
 #include <asm/ptrace.h>
 
diff --git a/arch/arm/lib/interrupts.c b/arch/arm/lib/interrupts.c
index e78ca56d25..75b70d9125 100644
--- a/arch/arm/lib/interrupts.c
+++ b/arch/arm/lib/interrupts.c
@@ -20,6 +20,7 @@
 
 #include <common.h>
 #include <efi_loader.h>
+#include <irq_func.h>
 #include <asm/proc-armv/ptrace.h>
 #include <asm/u-boot-arm.h>
 
diff --git a/arch/arm/lib/interrupts_64.c b/arch/arm/lib/interrupts_64.c
index a32a4b6868..dffdf57aa2 100644
--- a/arch/arm/lib/interrupts_64.c
+++ b/arch/arm/lib/interrupts_64.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <linux/compiler.h>
 #include <efi_loader.h>
 
diff --git a/arch/arm/lib/interrupts_m.c b/arch/arm/lib/interrupts_m.c
index 95df6cb1eb..e4373f3781 100644
--- a/arch/arm/lib/interrupts_m.c
+++ b/arch/arm/lib/interrupts_m.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 
 /*
  * Upon exception entry ARMv7-M processors automatically save stack
diff --git a/arch/m68k/cpu/mcf5227x/interrupts.c b/arch/m68k/cpu/mcf5227x/interrupts.c
index d38f01950b..5a6a88cd57 100644
--- a/arch/m68k/cpu/mcf5227x/interrupts.c
+++ b/arch/m68k/cpu/mcf5227x/interrupts.c
@@ -10,6 +10,7 @@
 
 /* CPU specific interrupt routine */
 #include <common.h>
+#include <irq_func.h>
 #include <asm/immap.h>
 #include <asm/io.h>
 
diff --git a/arch/m68k/cpu/mcf523x/interrupts.c b/arch/m68k/cpu/mcf523x/interrupts.c
index 1d03724f15..b554c51fcb 100644
--- a/arch/m68k/cpu/mcf523x/interrupts.c
+++ b/arch/m68k/cpu/mcf523x/interrupts.c
@@ -7,6 +7,7 @@
 
 /* CPU specific interrupt routine */
 #include <common.h>
+#include <irq_func.h>
 #include <asm/immap.h>
 #include <asm/io.h>
 
diff --git a/arch/m68k/cpu/mcf52x2/interrupts.c b/arch/m68k/cpu/mcf52x2/interrupts.c
index f874675b12..35ed1e7901 100644
--- a/arch/m68k/cpu/mcf52x2/interrupts.c
+++ b/arch/m68k/cpu/mcf52x2/interrupts.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <watchdog.h>
 #include <asm/processor.h>
 #include <asm/immap.h>
diff --git a/arch/m68k/cpu/mcf530x/interrupts.c b/arch/m68k/cpu/mcf530x/interrupts.c
index cd85c69f12..2659e3478f 100644
--- a/arch/m68k/cpu/mcf530x/interrupts.c
+++ b/arch/m68k/cpu/mcf530x/interrupts.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <asm/immap.h>
 #include <asm/io.h>
 
diff --git a/arch/m68k/cpu/mcf532x/interrupts.c b/arch/m68k/cpu/mcf532x/interrupts.c
index 43a903ed72..8f2df452ba 100644
--- a/arch/m68k/cpu/mcf532x/interrupts.c
+++ b/arch/m68k/cpu/mcf532x/interrupts.c
@@ -7,6 +7,7 @@
 
 /* CPU specific interrupt routine */
 #include <common.h>
+#include <irq_func.h>
 #include <asm/immap.h>
 #include <asm/io.h>
 
diff --git a/arch/m68k/cpu/mcf5445x/interrupts.c b/arch/m68k/cpu/mcf5445x/interrupts.c
index d38f01950b..5a6a88cd57 100644
--- a/arch/m68k/cpu/mcf5445x/interrupts.c
+++ b/arch/m68k/cpu/mcf5445x/interrupts.c
@@ -10,6 +10,7 @@
 
 /* CPU specific interrupt routine */
 #include <common.h>
+#include <irq_func.h>
 #include <asm/immap.h>
 #include <asm/io.h>
 
diff --git a/arch/m68k/cpu/mcf547x_8x/interrupts.c b/arch/m68k/cpu/mcf547x_8x/interrupts.c
index 2cdf53ea09..703090ddc2 100644
--- a/arch/m68k/cpu/mcf547x_8x/interrupts.c
+++ b/arch/m68k/cpu/mcf547x_8x/interrupts.c
@@ -7,6 +7,7 @@
 
 /* CPU specific interrupt routine */
 #include <common.h>
+#include <irq_func.h>
 #include <asm/immap.h>
 #include <asm/io.h>
 
diff --git a/arch/m68k/cpu/mcf547x_8x/slicetimer.c b/arch/m68k/cpu/mcf547x_8x/slicetimer.c
index 544bfd2083..885659e342 100644
--- a/arch/m68k/cpu/mcf547x_8x/slicetimer.c
+++ b/arch/m68k/cpu/mcf547x_8x/slicetimer.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 
 #include <asm/timer.h>
 #include <asm/immap.h>
diff --git a/arch/m68k/lib/interrupts.c b/arch/m68k/lib/interrupts.c
index 85ae3b4ee0..ddc91993a1 100644
--- a/arch/m68k/lib/interrupts.c
+++ b/arch/m68k/lib/interrupts.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <watchdog.h>
 #include <asm/processor.h>
 #include <asm/immap.h>
diff --git a/arch/m68k/lib/time.c b/arch/m68k/lib/time.c
index c76c5fedc9..8957d194d4 100644
--- a/arch/m68k/lib/time.c
+++ b/arch/m68k/lib/time.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <time.h>
 
 #include <asm/timer.h>
diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index aea612eef1..910c596884 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <command.h>
 #include <fdtdec.h>
+#include <irq_func.h>
 #include <malloc.h>
 #include <asm/microblaze_intc.h>
 #include <asm/asm.h>
diff --git a/arch/mips/cpu/interrupts.c b/arch/mips/cpu/interrupts.c
index 1c5192ed33..b3ba9aaeae 100644
--- a/arch/mips/cpu/interrupts.c
+++ b/arch/mips/cpu/interrupts.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 
 int interrupt_init(void)
 {
diff --git a/arch/mips/mach-jz47xx/jz4780/timer.c b/arch/mips/mach-jz47xx/jz4780/timer.c
index 988ebd2671..b32a2f5643 100644
--- a/arch/mips/mach-jz47xx/jz4780/timer.c
+++ b/arch/mips/mach-jz47xx/jz4780/timer.c
@@ -9,6 +9,7 @@
 #include <config.h>
 #include <common.h>
 #include <div64.h>
+#include <irq_func.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/mipsregs.h>
diff --git a/arch/nds32/cpu/n1213/ag101/timer.c b/arch/nds32/cpu/n1213/ag101/timer.c
index cbfe07e351..f2e362102e 100644
--- a/arch/nds32/cpu/n1213/ag101/timer.c
+++ b/arch/nds32/cpu/n1213/ag101/timer.c
@@ -9,6 +9,7 @@
  */
 #ifndef CONFIG_TIMER
 #include <common.h>
+#include <irq_func.h>
 #include <time.h>
 #include <asm/io.h>
 #include <faraday/fttmr010.h>
diff --git a/arch/nds32/lib/interrupts.c b/arch/nds32/lib/interrupts.c
index 966c19a1ae..88cc7b98d8 100644
--- a/arch/nds32/lib/interrupts.c
+++ b/arch/nds32/lib/interrupts.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <asm/ptrace.h>
 #include <asm/system.h>
 #undef INTERRUPT_MODE
diff --git a/arch/nios2/cpu/interrupts.c b/arch/nios2/cpu/interrupts.c
index 96c3020935..e9d1ff911b 100644
--- a/arch/nios2/cpu/interrupts.c
+++ b/arch/nios2/cpu/interrupts.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <irq_func.h>
 #include <asm/nios2.h>
 #include <asm/types.h>
 #include <asm/io.h>
diff --git a/arch/powerpc/cpu/mpc83xx/interrupts.c b/arch/powerpc/cpu/mpc83xx/interrupts.c
index 04cd147321..e83895deab 100644
--- a/arch/powerpc/cpu/mpc83xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc83xx/interrupts.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <irq_func.h>
 #include <mpc83xx.h>
 #include <asm/processor.h>
 
diff --git a/arch/powerpc/cpu/mpc85xx/interrupts.c b/arch/powerpc/cpu/mpc85xx/interrupts.c
index b5a6ead8bd..e767573193 100644
--- a/arch/powerpc/cpu/mpc85xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc85xx/interrupts.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <watchdog.h>
 #include <command.h>
 #include <asm/processor.h>
diff --git a/arch/powerpc/cpu/mpc85xx/traps.c b/arch/powerpc/cpu/mpc85xx/traps.c
index e1d492f05a..804788d050 100644
--- a/arch/powerpc/cpu/mpc85xx/traps.c
+++ b/arch/powerpc/cpu/mpc85xx/traps.c
@@ -21,6 +21,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <irq_func.h>
 #include <kgdb.h>
 #include <asm/processor.h>
 
diff --git a/arch/powerpc/cpu/mpc86xx/interrupts.c b/arch/powerpc/cpu/mpc86xx/interrupts.c
index 04c8f25af6..0f930fcd9e 100644
--- a/arch/powerpc/cpu/mpc86xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc86xx/interrupts.c
@@ -15,6 +15,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <mpc86xx.h>
 #include <command.h>
 #include <asm/processor.h>
diff --git a/arch/powerpc/cpu/mpc8xx/interrupts.c b/arch/powerpc/cpu/mpc8xx/interrupts.c
index 26aa7a5645..6ee6088fa8 100644
--- a/arch/powerpc/cpu/mpc8xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc8xx/interrupts.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <mpc8xx.h>
 #include <mpc8xx_irq.h>
 #include <asm/cpm_8xx.h>
diff --git a/arch/powerpc/lib/interrupts.c b/arch/powerpc/lib/interrupts.c
index a58ddfa569..64ee0cc210 100644
--- a/arch/powerpc/lib/interrupts.c
+++ b/arch/powerpc/lib/interrupts.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <asm/processor.h>
 #include <watchdog.h>
 #ifdef CONFIG_LED_STATUS
diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c
index 74c1e561c7..3b25c5b7a7 100644
--- a/arch/riscv/lib/interrupts.c
+++ b/arch/riscv/lib/interrupts.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <asm/ptrace.h>
 #include <asm/system.h>
 #include <asm/encoding.h>
diff --git a/arch/sandbox/lib/interrupts.c b/arch/sandbox/lib/interrupts.c
index 4ddcd37522..21f761ac3b 100644
--- a/arch/sandbox/lib/interrupts.c
+++ b/arch/sandbox/lib/interrupts.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 
 int interrupt_init(void)
 {
diff --git a/arch/sh/cpu/sh4/interrupts.c b/arch/sh/cpu/sh4/interrupts.c
index 5982aad54e..278a3e32ac 100644
--- a/arch/sh/cpu/sh4/interrupts.c
+++ b/arch/sh/cpu/sh4/interrupts.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 
 int interrupt_init(void)
 {
diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c
index 1445204878..78aa51a3ea 100644
--- a/arch/x86/cpu/i386/interrupt.c
+++ b/arch/x86/cpu/i386/interrupt.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <dm.h>
 #include <efi_loader.h>
+#include <irq_func.h>
 #include <asm/control_regs.h>
 #include <asm/i8259.h>
 #include <asm/interrupt.h>
diff --git a/arch/x86/cpu/x86_64/interrupts.c b/arch/x86/cpu/x86_64/interrupts.c
index 15830d6a1a..634f7660c0 100644
--- a/arch/x86/cpu/x86_64/interrupts.c
+++ b/arch/x86/cpu/x86_64/interrupts.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <asm/processor-flags.h>
 
 void enable_interrupts(void)
diff --git a/arch/x86/lib/bios.c b/arch/x86/lib/bios.c
index b990f53bfd..30c0997fd0 100644
--- a/arch/x86/lib/bios.c
+++ b/arch/x86/lib/bios.c
@@ -7,6 +7,7 @@
  */
 #include <common.h>
 #include <bios_emul.h>
+#include <irq_func.h>
 #include <vbe.h>
 #include <linux/linkage.h>
 #include <asm/cache.h>
diff --git a/arch/x86/lib/interrupts.c b/arch/x86/lib/interrupts.c
index 39f8deaed1..b23b8fd402 100644
--- a/arch/x86/lib/interrupts.c
+++ b/arch/x86/lib/interrupts.c
@@ -30,6 +30,7 @@
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <asm/interrupt.h>
 
 #if !CONFIG_IS_ENABLED(X86_64)
diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c
index d4e647777a..f0e2bf053d 100644
--- a/arch/x86/lib/spl.c
+++ b/arch/x86/lib/spl.c
@@ -7,6 +7,7 @@
 #include <cpu_func.h>
 #include <debug_uart.h>
 #include <dm.h>
+#include <irq_func.h>
 #include <malloc.h>
 #include <spl.h>
 #include <syscon.h>
diff --git a/arch/xtensa/cpu/exceptions.c b/arch/xtensa/cpu/exceptions.c
index fe2dedf3c4..3b8f4a36d3 100644
--- a/arch/xtensa/cpu/exceptions.c
+++ b/arch/xtensa/cpu/exceptions.c
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <irq_func.h>
 #include <asm/string.h>
 #include <asm/regs.h>
 
diff --git a/common/board_r.c b/common/board_r.c
index 6a421002dd..9e4eb35a54 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -28,6 +28,7 @@
 #if defined(CONFIG_CMD_KGDB)
 #include <kgdb.h>
 #endif
+#include <irq_func.h>
 #include <malloc.h>
 #include <mapmem.h>
 #ifdef CONFIG_BITBANGMII
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 82fd54c984..d51dbe9942 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -11,6 +11,7 @@
 #include <binman_sym.h>
 #include <dm.h>
 #include <handoff.h>
+#include <irq_func.h>
 #include <serial.h>
 #include <spl.h>
 #include <asm/u-boot.h>
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 0574fa63a4..4ce183b6f3 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -22,6 +22,7 @@
 #include <env.h>
 #include <errno.h>
 #include <fdt_support.h>
+#include <irq_func.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c
index 69949d5333..72cb58b693 100644
--- a/drivers/timer/mpc83xx_timer.c
+++ b/drivers/timer/mpc83xx_timer.c
@@ -8,6 +8,7 @@
 #include <board.h>
 #include <clk.h>
 #include <dm.h>
+#include <irq_func.h>
 #include <status_led.h>
 #include <time.h>
 #include <timer.h>
diff --git a/include/common.h b/include/common.h
index 6dedb37a06..81387d561e 100644
--- a/include/common.h
+++ b/include/common.h
@@ -208,13 +208,6 @@ ulong	get_bus_freq  (ulong);
 int get_serial_clock(void);
 
 /* $(CPU)/interrupts.c */
-int	interrupt_init	   (void);
-void	timer_interrupt	   (struct pt_regs *);
-void	external_interrupt (struct pt_regs *);
-void	irq_install_handler(int, interrupt_handler_t *, void *);
-void	irq_free_handler   (int);
-void	reset_timer	   (void);
-
 void	enable_interrupts  (void);
 int	disable_interrupts (void);
 
diff --git a/include/exports.h b/include/exports.h
index 147a00f860..8899622738 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -1,6 +1,8 @@
 #ifndef __EXPORTS_H__
 #define __EXPORTS_H__
 
+#include <irq_func.h>
+
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_PHY_AQUANTIA
 #include <env.h>
diff --git a/include/irq_func.h b/include/irq_func.h
new file mode 100644
index 0000000000..11d2bdd912
--- /dev/null
+++ b/include/irq_func.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Header file for interrupt functions
+ *
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ */
+
+#ifndef __IRQ_FUNC_H
+#define __IRQ_FUNC_H
+
+int interrupt_init(void);
+void timer_interrupt(struct pt_regs *regs);
+void external_interrupt(struct pt_regs *regs);
+void irq_install_handler (int vec, interrupt_handler_t *handler, void *arg);
+void irq_free_handler(int vec);
+void reset_timer(void);
+
+#endif
-- 
2.24.0.rc1.363.gb1bccd3e3d-goog



More information about the U-Boot mailing list