blob: cb73d17999dc9a71e243c98fd57bd15460656adf [file] [log] [blame]
Daniel Hellstrom9d7c6b22008-03-28 09:47:00 +01001/*
2 * (C) Copyright 2000-2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * (C) Copyright 2003
6 * Gleb Natapov <gnatapov@mrv.com>
7 *
8 * (C) Copyright 2007
9 * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
10 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +020011 * SPDX-License-Identifier: GPL-2.0+
Daniel Hellstrom9d7c6b22008-03-28 09:47:00 +010012 */
13
14#include <common.h>
15#include <asm/processor.h>
16#include <asm/irq.h>
17
18/* Implemented by SPARC CPUs */
19extern int interrupt_init_cpu(void);
20extern void timer_interrupt_cpu(void *arg);
21extern int timer_interrupt_init_cpu(void);
22
23int intLock(void)
24{
25 unsigned int pil;
26
27 pil = get_pil();
28
29 /* set PIL to 15 ==> no pending interrupts will interrupt CPU */
30 set_pil(15);
31
32 return pil;
33}
34
35void intUnlock(int oldLevel)
36{
37 set_pil(oldLevel);
38}
39
40void enable_interrupts(void)
41{
42 set_pil(0); /* enable all interrupts */
43}
44
45int disable_interrupts(void)
46{
47 return intLock();
48}
49
Daniel Hellstrom2063ccf2010-01-22 11:57:49 +010050int interrupt_is_enabled(void)
51{
52 if (get_pil() == 15)
53 return 0;
54 return 1;
55}
56
Daniel Hellstrom9d7c6b22008-03-28 09:47:00 +010057int interrupt_init(void)
58{
59 int ret;
60
61 /* call cpu specific function from $(CPU)/interrupts.c */
62 ret = interrupt_init_cpu();
63
64 /* enable global interrupts */
65 enable_interrupts();
66
67 return ret;
68}