diff options
author | Alexey Brodkin <abrodkin@synopsys.com> | 2014-12-28 02:42:12 +0300 |
---|---|---|
committer | Alexey Brodkin <abrodkin@synopsys.com> | 2015-01-15 22:40:49 +0300 |
commit | 660d5f0d495197b4057bc1b3bdd201e500b03f1a (patch) | |
tree | 1af828cf7be238a85134eab36e3d4232231e5037 /arch/arc/cpu/arc700/interrupts.c | |
parent | 70a0442a420ccea85e6255fedb760448c5b7b87f (diff) | |
download | u-boot-imx-660d5f0d495197b4057bc1b3bdd201e500b03f1a.zip u-boot-imx-660d5f0d495197b4057bc1b3bdd201e500b03f1a.tar.gz u-boot-imx-660d5f0d495197b4057bc1b3bdd201e500b03f1a.tar.bz2 |
arc: move common sources in library
"reset.c" and "cpu.c" have no architecture-specific code at all.
Others are applicable to either ARC CPU.
This change is a preparation to submission of ARCv2 architecture port.
Even though ARCv1 and ARCv2 ISAs are not binary compatible most of
built-in modules still have the same programming model - AUX registers
are mapped in the same addresses and hold the same data (new featues
extend existing ones).
So only low-level assembly code (start-up, interrupt handlers) is left
as CPU(actually ISA)-specific. This significantyl simplifies maintenance
of multiple CPUs/ISAs.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Igor Guryanov <guryanov@synopsys.com>
Diffstat (limited to 'arch/arc/cpu/arc700/interrupts.c')
-rw-r--r-- | arch/arc/cpu/arc700/interrupts.c | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/arch/arc/cpu/arc700/interrupts.c b/arch/arc/cpu/arc700/interrupts.c deleted file mode 100644 index d7cab3b..0000000 --- a/arch/arc/cpu/arc700/interrupts.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved. - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <asm/arcregs.h> -#include <asm/ptrace.h> - -/* Bit values in STATUS32 */ -#define E1_MASK (1 << 1) /* Level 1 interrupts enable */ -#define E2_MASK (1 << 2) /* Level 2 interrupts enable */ - -int interrupt_init(void) -{ - return 0; -} - -/* - * returns true if interrupts had been enabled before we disabled them - */ -int disable_interrupts(void) -{ - int status = read_aux_reg(ARC_AUX_STATUS32); - int state = (status & (E1_MASK | E2_MASK)) ? 1 : 0; - - status &= ~(E1_MASK | E2_MASK); - /* STATUS32 register is updated indirectly with "FLAG" instruction */ - __asm__("flag %0" : : "r" (status)); - return state; -} - -void enable_interrupts(void) -{ - unsigned int status = read_aux_reg(ARC_AUX_STATUS32); - - status |= E1_MASK | E2_MASK; - /* STATUS32 register is updated indirectly with "FLAG" instruction */ - __asm__("flag %0" : : "r" (status)); -} - -static void print_reg_file(long *reg_rev, int start_num) -{ - unsigned int i; - - /* Print 3 registers per line */ - for (i = start_num; i < start_num + 25; i++) { - printf("r%02u: 0x%08lx\t", i, (unsigned long)*reg_rev); - if (((i + 1) % 3) == 0) - printf("\n"); - - /* Because pt_regs has registers reversed */ - reg_rev--; - } - - /* Add new-line if none was inserted in the end of loop above */ - if (((i + 1) % 3) != 0) - printf("\n"); -} - -void show_regs(struct pt_regs *regs) -{ - printf("ECR:\t0x%08lx\n", regs->ecr); - printf("RET:\t0x%08lx\nBLINK:\t0x%08lx\nSTAT32:\t0x%08lx\n", - regs->ret, regs->blink, regs->status32); - printf("GP: 0x%08lx\t r25: 0x%08lx\t\n", regs->r26, regs->r25); - printf("BTA: 0x%08lx\t SP: 0x%08lx\t FP: 0x%08lx\n", regs->bta, - regs->sp, regs->fp); - printf("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n", regs->lp_start, - regs->lp_end, regs->lp_count); - - print_reg_file(&(regs->r0), 0); -} - -void bad_mode(struct pt_regs *regs) -{ - if (regs) - show_regs(regs); - - panic("Resetting CPU ...\n"); -} - -void do_memory_error(unsigned long address, struct pt_regs *regs) -{ - printf("Memory error exception @ 0x%lx\n", address); - bad_mode(regs); -} - -void do_instruction_error(unsigned long address, struct pt_regs *regs) -{ - printf("Instruction error exception @ 0x%lx\n", address); - bad_mode(regs); -} - -void do_machine_check_fault(unsigned long address, struct pt_regs *regs) -{ - printf("Machine check exception @ 0x%lx\n", address); - bad_mode(regs); -} - -void do_interrupt_handler(void) -{ - printf("Interrupt fired\n"); - bad_mode(0); -} - -void do_itlb_miss(struct pt_regs *regs) -{ - printf("I TLB miss exception\n"); - bad_mode(regs); -} - -void do_dtlb_miss(struct pt_regs *regs) -{ - printf("D TLB miss exception\n"); - bad_mode(regs); -} - -void do_tlb_prot_violation(unsigned long address, struct pt_regs *regs) -{ - printf("TLB protection violation or misaligned access @ 0x%lx\n", - address); - bad_mode(regs); -} - -void do_privilege_violation(struct pt_regs *regs) -{ - printf("Privilege violation exception\n"); - bad_mode(regs); -} - -void do_trap(struct pt_regs *regs) -{ - printf("Trap exception\n"); - bad_mode(regs); -} - -void do_extension(struct pt_regs *regs) -{ - printf("Extension instruction exception\n"); - bad_mode(regs); -} |