[U-Boot] [PATCH v2 32/41] common: Move interrupt functions into a new header

Simon Glass sjg at chromium.org
Fri Nov 8 19:53:39 UTC 2019


These functions do not use driver model but are fairly widely used in
U-Boot. Move them to a new irq_legacy.h header file.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

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_legacy.h                  | 17 +++++++++++++++++
 42 files changed, 58 insertions(+), 7 deletions(-)
 create mode 100644 include/irq_legacy.h

diff --git a/arch/arc/lib/interrupts.c b/arch/arc/lib/interrupts.c
index 24ff751220..4aef49aea3 100644
--- a/arch/arc/lib/interrupts.c
+++ b/arch/arc/lib/interrupts.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..82802c0004 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_legacy.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..a2a1c8e712 100644
--- a/arch/arm/lib/interrupts_64.c
+++ b/arch/arm/lib/interrupts_64.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..6a4beaf3ec 100644
--- a/arch/arm/lib/interrupts_m.c
+++ b/arch/arm/lib/interrupts_m.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..0d0ad5ed02 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_legacy.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..a524801151 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_legacy.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..4b20cf5751 100644
--- a/arch/m68k/cpu/mcf52x2/interrupts.c
+++ b/arch/m68k/cpu/mcf52x2/interrupts.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..9e61de7d95 100644
--- a/arch/m68k/cpu/mcf530x/interrupts.c
+++ b/arch/m68k/cpu/mcf530x/interrupts.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..83c9c2e1b3 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_legacy.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..0d0ad5ed02 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_legacy.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..934343bc4a 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_legacy.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..7ced4db5f1 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_legacy.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..00953ac92f 100644
--- a/arch/m68k/lib/interrupts.c
+++ b/arch/m68k/lib/interrupts.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..9b5364b4a4 100644
--- a/arch/m68k/lib/time.c
+++ b/arch/m68k/lib/time.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.h>
 #include <time.h>
 
 #include <asm/timer.h>
diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index aea612eef1..900cc61824 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_legacy.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..05e4b0fdca 100644
--- a/arch/mips/cpu/interrupts.c
+++ b/arch/mips/cpu/interrupts.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..e2d38e6373 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_legacy.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..21a9044b98 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_legacy.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..1a47c5c3a9 100644
--- a/arch/nds32/lib/interrupts.c
+++ b/arch/nds32/lib/interrupts.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..e414b4feac 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_legacy.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..5bee590b76 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_legacy.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..7e862f11f3 100644
--- a/arch/powerpc/cpu/mpc85xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc85xx/interrupts.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..9a249c9b40 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_legacy.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..176c2b06c9 100644
--- a/arch/powerpc/cpu/mpc86xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc86xx/interrupts.c
@@ -15,6 +15,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..03579ef4a6 100644
--- a/arch/powerpc/cpu/mpc8xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc8xx/interrupts.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..906713575d 100644
--- a/arch/powerpc/lib/interrupts.c
+++ b/arch/powerpc/lib/interrupts.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..b82b800630 100644
--- a/arch/riscv/lib/interrupts.c
+++ b/arch/riscv/lib/interrupts.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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..a0a5373c23 100644
--- a/arch/sandbox/lib/interrupts.c
+++ b/arch/sandbox/lib/interrupts.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.h>
 
 int interrupt_init(void)
 {
diff --git a/arch/sh/cpu/sh4/interrupts.c b/arch/sh/cpu/sh4/interrupts.c
index 5982aad54e..5cb1fcf7ba 100644
--- a/arch/sh/cpu/sh4/interrupts.c
+++ b/arch/sh/cpu/sh4/interrupts.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.h>
 
 int interrupt_init(void)
 {
diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c
index 1445204878..24d034787c 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_legacy.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..270162f461 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_legacy.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..7ca72d1579 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_legacy.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..d3f1b4bf91 100644
--- a/arch/x86/lib/interrupts.c
+++ b/arch/x86/lib/interrupts.c
@@ -30,6 +30,7 @@
  */
 
 #include <common.h>
+#include <irq_legacy.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 b1dfffe9d4..e5c70ecfa7 100644
--- a/arch/x86/lib/spl.c
+++ b/arch/x86/lib/spl.c
@@ -7,6 +7,7 @@
 #include <cpu_legacy.h>
 #include <debug_uart.h>
 #include <dm.h>
+#include <irq_legacy.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..6e70f322af 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_legacy.h>
 #include <asm/string.h>
 #include <asm/regs.h>
 
diff --git a/common/board_r.c b/common/board_r.c
index 8189d1f31b..fd1c29fcaa 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_legacy.h>
 #include <malloc.h>
 #include <mapmem.h>
 #ifdef CONFIG_BITBANGMII
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 82fd54c984..bc4fcaf6b1 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_legacy.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..0910fd8ab9 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_legacy.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..773f0c310a 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_legacy.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..fc06c83f84 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -1,6 +1,8 @@
 #ifndef __EXPORTS_H__
 #define __EXPORTS_H__
 
+#include <irq_legacy.h>
+
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_PHY_AQUANTIA
 #include <env.h>
diff --git a/include/irq_legacy.h b/include/irq_legacy.h
new file mode 100644
index 0000000000..72a3af65d7
--- /dev/null
+++ b/include/irq_legacy.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ */
+
+#ifndef __IRQ_LEGACY_H
+#define __IRQ_LEGACY_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