#include <asm/kprobes.h>
 #include <asm/runlatch.h>
 
+/* BookE/4xx */
+#define INTERRUPT_CRITICAL_INPUT  0x100
+
+/* BookE */
+#define INTERRUPT_DEBUG           0xd00
+#ifdef CONFIG_BOOKE
+#define INTERRUPT_PERFMON         0x260
+#define INTERRUPT_DOORBELL        0x280
+#endif
+
+/* BookS/4xx/8xx */
+#define INTERRUPT_MACHINE_CHECK   0x200
+
+/* BookS/8xx */
+#define INTERRUPT_SYSTEM_RESET    0x100
+
+/* BookS */
+#define INTERRUPT_DATA_SEGMENT    0x380
+#define INTERRUPT_INST_SEGMENT    0x480
+#define INTERRUPT_TRACE           0xd00
+#define INTERRUPT_H_DATA_STORAGE  0xe00
+#define INTERRUPT_H_FAC_UNAVAIL   0xf80
+#ifdef CONFIG_PPC_BOOK3S
+#define INTERRUPT_DOORBELL        0xa00
+#define INTERRUPT_PERFMON         0xf00
+#endif
+
+/* BookE/BookS/4xx/8xx */
+#define INTERRUPT_DATA_STORAGE    0x300
+#define INTERRUPT_INST_STORAGE    0x400
+#define INTERRUPT_ALIGNMENT       0x600
+#define INTERRUPT_PROGRAM         0x700
+#define INTERRUPT_SYSCALL         0xc00
+
+/* BookE/BookS/44x */
+#define INTERRUPT_FP_UNAVAIL      0x800
+
+/* BookE/BookS/44x/8xx */
+#define INTERRUPT_DECREMENTER     0x900
+
+#ifndef INTERRUPT_PERFMON
+#define INTERRUPT_PERFMON         0x0
+#endif
+
 static inline void nap_adjust_return(struct pt_regs *regs)
 {
 #ifdef CONFIG_PPC_970_NAP
                 * CT_WARN_ON comes here via program_check_exception,
                 * so avoid recursion.
                 */
-               if (TRAP(regs) != 0x700)
+               if (TRAP(regs) != INTERRUPT_PROGRAM)
                        CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
        }
 #endif
 {
        /* Allow DEC and PMI to be traced when they are soft-NMI */
        if (IS_ENABLED(CONFIG_PPC_BOOK3S_64)) {
-               if (TRAP(regs) == 0x900)
+               if (TRAP(regs) == INTERRUPT_DECREMENTER)
                       return false;
-               if (TRAP(regs) == 0xf00)
+               if (TRAP(regs) == INTERRUPT_PERFMON)
                       return false;
        }
        if (IS_ENABLED(CONFIG_PPC_BOOK3E)) {
-               if (TRAP(regs) == 0x260)
+               if (TRAP(regs) == INTERRUPT_PERFMON)
                        return false;
        }
 
 
         * If we came in via system reset, wait a while for the secondary
         * CPUs to enter.
         */
-       if (TRAP(&(fdh->regs)) == 0x100) {
+       if (TRAP(&(fdh->regs)) == INTERRUPT_SYSTEM_RESET) {
                msecs = CRASH_TIMEOUT;
                while ((atomic_read(&cpus_in_fadump) < ncpus) && (--msecs > 0))
                        mdelay(1);
 
         * CT_WARN_ON comes here via program_check_exception,
         * so avoid recursion.
         */
-       if (TRAP(regs) != 0x700)
+       if (TRAP(regs) != INTERRUPT_PROGRAM)
                CT_WARN_ON(ct_state() == CONTEXT_USER);
 
        kuap = kuap_get_and_assert_locked();
 
        trap = TRAP(regs);
        if (!trap_is_syscall(regs) && cpu_has_feature(CPU_FTR_CFAR))
                pr_cont("CFAR: "REG" ", regs->orig_gpr3);
-       if (trap == 0x200 || trap == 0x300 || trap == 0x600) {
+       if (trap == INTERRUPT_MACHINE_CHECK ||
+           trap == INTERRUPT_DATA_STORAGE ||
+           trap == INTERRUPT_ALIGNMENT) {
                if (IS_ENABLED(CONFIG_4xx) || IS_ENABLED(CONFIG_BOOKE))
                        pr_cont("DEAR: "REG" ESR: "REG" ", regs->dar, regs->dsisr);
                else
 
        /*
         * system_reset_excption handles debugger, crash dump, panic, for 0x100
         */
-       if (TRAP(regs) == 0x100)
+       if (TRAP(regs) == INTERRUPT_SYSTEM_RESET)
                return;
 
        crash_fadump(regs, "die oops");
        /*
         * system_reset_excption handles debugger, crash dump, panic, for 0x100
         */
-       if (TRAP(regs) != 0x100) {
+       if (TRAP(regs) != INTERRUPT_SYSTEM_RESET) {
                if (debugger(regs))
                        return;
        }
        u8 status;
        bool hv;
 
-       hv = (TRAP(regs) == 0xf80);
+       hv = (TRAP(regs) == INTERRUPT_H_FAC_UNAVAIL);
        if (hv)
                value = mfspr(SPRN_HFSCR);
        else
 
 #include <asm/smp.h>
 #include <asm/setjmp.h>
 #include <asm/debug.h>
+#include <asm/interrupt.h>
 
 /*
  * The primary CPU waits a while for all secondary CPUs to enter. This is to
         * If we came in via system reset, wait a while for the secondary
         * CPUs to enter.
         */
-       if (TRAP(regs) == 0x100)
+       if (TRAP(regs) == INTERRUPT_SYSTEM_RESET)
                mdelay(PRIMARY_TIMEOUT);
 
        crash_kexec_prepare_cpus(crashing_cpu);
 
 
        /* page is dirty */
        if (!test_bit(PG_dcache_clean, &page->flags) && !PageReserved(page)) {
-               if (trap == 0x400) {
+               if (trap == INTERRUPT_INST_STORAGE) {
                        flush_dcache_icache_page(page);
                        set_bit(PG_dcache_clean, &page->flags);
                } else
        if (user_mode(regs) || (region_id == USER_REGION_ID))
                access &= ~_PAGE_PRIVILEGED;
 
-       if (TRAP(regs) == 0x400)
+       if (TRAP(regs) == INTERRUPT_INST_STORAGE)
                access |= _PAGE_EXEC;
 
        err = hash_page_mm(mm, ea, access, TRAP(regs), flags);
 
 static bool bad_kernel_fault(struct pt_regs *regs, unsigned long error_code,
                             unsigned long address, bool is_write)
 {
-       int is_exec = TRAP(regs) == 0x400;
+       int is_exec = TRAP(regs) == INTERRUPT_INST_STORAGE;
 
        /* NX faults set DSISR_PROTFAULT on the 8xx, DSISR_NOEXEC_OR_G on others */
        if (is_exec && (error_code & (DSISR_NOEXEC_OR_G | DSISR_KEYFAULT |
        struct vm_area_struct * vma;
        struct mm_struct *mm = current->mm;
        unsigned int flags = FAULT_FLAG_DEFAULT;
-       int is_exec = TRAP(regs) == 0x400;
+       int is_exec = TRAP(regs) == INTERRUPT_INST_STORAGE;
        int is_user = user_mode(regs);
        int is_write = page_fault_is_write(error_code);
        vm_fault_t fault, major = 0;
        /* kernel has accessed a bad area */
 
        switch (TRAP(regs)) {
-       case 0x300:
-       case 0x380:
-       case 0xe00:
+       case INTERRUPT_DATA_STORAGE:
+       case INTERRUPT_DATA_SEGMENT:
+       case INTERRUPT_H_DATA_STORAGE:
                pr_alert("BUG: %s on %s at 0x%08lx\n",
                         regs->dar < PAGE_SIZE ? "Kernel NULL pointer dereference" :
                         "Unable to handle kernel data access",
                         is_write ? "write" : "read", regs->dar);
                break;
-       case 0x400:
-       case 0x480:
+       case INTERRUPT_INST_STORAGE:
+       case INTERRUPT_INST_SEGMENT:
                pr_alert("BUG: Unable to handle kernel instruction fetch%s",
                         regs->nip < PAGE_SIZE ? " (NULL pointer?)\n" : "\n");
                break;
-       case 0x600:
+       case INTERRUPT_ALIGNMENT:
                pr_alert("BUG: Unable to handle kernel unaligned access at 0x%08lx\n",
                         regs->dar);
                break;
 
 #include <asm/firmware.h>
 #include <asm/ptrace.h>
 #include <asm/code-patching.h>
+#include <asm/interrupt.h>
 
 #ifdef CONFIG_PPC64
 #include "internal.h"
         * they have not been setup using perf_read_regs() and so regs->result
         * is something random.
         */
-       return ((TRAP(regs) == 0xf00) && regs->result);
+       return ((TRAP(regs) == INTERRUPT_PERFMON) && regs->result);
 }
 
 /*
         * hypervisor samples as well as samples in the kernel with
         * interrupts off hence the userspace check.
         */
-       if (TRAP(regs) != 0xf00)
+       if (TRAP(regs) != INTERRUPT_PERFMON)
                use_siar = 0;
        else if ((ppmu->flags & PPMU_NO_SIAR))
                use_siar = 0;
 
 #include <asm/code-patching.h>
 #include <asm/sections.h>
 #include <asm/inst.h>
+#include <asm/interrupt.h>
 
 #ifdef CONFIG_PPC64
 #include <asm/hvcall.h>
                         * debugger break (IPI). This is similar to
                         * crash_kexec_secondary().
                         */
-                       if (TRAP(regs) != 0x100 || !wait_for_other_cpus(ncpus))
+                       if (TRAP(regs) !=  INTERRUPT_SYSTEM_RESET || !wait_for_other_cpus(ncpus))
                                smp_send_debugger_break();
 
                        wait_for_other_cpus(ncpus);
 
                if (!locked_down) {
                        /* for breakpoint or single step, print curr insn */
-                       if (bp || TRAP(regs) == 0xd00)
+                       if (bp || TRAP(regs) == INTERRUPT_TRACE)
                                ppc_inst_dump(regs->nip, 1, 0);
                        printf("enter ? for help\n");
                }
                disable_surveillance();
                if (!locked_down) {
                        /* for breakpoint or single step, print current insn */
-                       if (bp || TRAP(regs) == 0xd00)
+                       if (bp || TRAP(regs) == INTERRUPT_TRACE)
                                ppc_inst_dump(regs->nip, 1, 0);
                        printf("enter ? for help\n");
                }
        printf("    sp: %lx\n", fp->gpr[1]);
        printf("   msr: %lx\n", fp->msr);
 
-       if (trap == 0x300 || trap == 0x380 || trap == 0x600 || trap == 0x200) {
+       if (trap == INTERRUPT_DATA_STORAGE ||
+           trap == INTERRUPT_DATA_SEGMENT ||
+           trap == INTERRUPT_ALIGNMENT ||
+           trap == INTERRUPT_MACHINE_CHECK) {
                printf("   dar: %lx\n", fp->dar);
-               if (trap != 0x380)
+               if (trap != INTERRUPT_DATA_SEGMENT)
                        printf(" dsisr: %lx\n", fp->dsisr);
        }
 
                       current->pid, current->comm);
        }
 
-       if (trap == 0x700)
+       if (trap == INTERRUPT_PROGRAM)
                print_bug_trap(fp);
 
        printf(linux_banner);
        printf("ctr = "REG"   xer = "REG"   trap = %4lx\n",
               fp->ctr, fp->xer, fp->trap);
        trap = TRAP(fp);
-       if (trap == 0x300 || trap == 0x380 || trap == 0x600)
+       if (trap == INTERRUPT_DATA_STORAGE ||
+           trap == INTERRUPT_DATA_SEGMENT ||
+           trap == INTERRUPT_ALIGNMENT)
                printf("dar = "REG"   dsisr = %.8lx\n", fp->dar, fp->dsisr);
 }