Annotation of sys/arch/armish/include/armish_intr.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: armish_intr.h,v 1.4 2007/05/19 15:47:18 miod Exp $ */
2: /* $NetBSD: i80321_intr.h,v 1.4 2003/07/05 06:53:08 dogcow Exp $ */
3:
4: /*
5: * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
6: * All rights reserved.
7: *
8: * Written by Jason R. Thorpe for Wasabi Systems, Inc.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: * 3. All advertising materials mentioning features or use of this software
19: * must display the following acknowledgement:
20: * This product includes software developed for the NetBSD Project by
21: * Wasabi Systems, Inc.
22: * 4. The name of Wasabi Systems, Inc. may not be used to endorse
23: * or promote products derived from this software without specific prior
24: * written permission.
25: *
26: * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
27: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
30: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36: * POSSIBILITY OF SUCH DAMAGE.
37: */
38:
39: #ifndef _I80321_INTR_H_
40: #define _I80321_INTR_H_
41:
42: #define ARM_IRQ_HANDLER _C_LABEL(i80321_irq_handler)
43:
44: #ifndef _LOCORE
45:
46: #include <arm/armreg.h>
47: #include <arm/cpufunc.h>
48: #include <arm/softintr.h>
49:
50: extern __volatile int current_ipl_level;
51: extern __volatile int softint_pending;
52: extern int i80321_imask[];
53: void i80321_do_pending(void);
54:
55: void i80321_setipl(int new);
56: void i80321_splx(int new);
57: int i80321_splraise(int ipl);
58: int i80321_spllower(int ipl);
59: void i80321_setsoftintr(int si);
60:
61: /*
62: * An useful function for interrupt handlers.
63: * XXX: This shouldn't be here.
64: */
65: static __inline int
66: find_first_bit( uint32_t bits )
67: {
68: int count;
69:
70: /* since CLZ is available only on ARMv5, this isn't portable
71: * to all ARM CPUs. This file is for I80321 processor.
72: */
73: asm( "clz %0, %1" : "=r" (count) : "r" (bits) );
74: return 31-count;
75: }
76:
77:
78: int _splraise(int);
79: int _spllower(int);
80: void splx(int);
81: void _setsoftintr(int);
82:
83: /*
84: * This function *MUST* be called very early on in a port's
85: * initarm() function, before ANY spl*() functions are called.
86: *
87: * The parameter is the virtual address of the I80321's Interrupt
88: * Controller registers.
89: */
90: void i80321_intr_bootstrap(vaddr_t);
91:
92: void i80321_irq_handler(void *);
93: void *i80321_intr_establish(int irqno, int level, int (*func)(void *),
94: void *cookie, char *name);
95: void i80321_intr_disestablish(void *cookie);
96: const char *i80321_intr_string(void *cookie);
97:
98: #ifdef DIAGNOSTIC
99: /*
100: * Although this function is implemented in MI code, it must be in this MD
101: * header because we don't want this header to include MI includes.
102: */
103: void splassert_fail(int, int, const char *);
104: extern int splassert_ctl;
105: void i80321_splassert_check(int, const char *);
106: #define splassert(__wantipl) do { \
107: if (splassert_ctl > 0) { \
108: i80321_splassert_check(__wantipl, __func__); \
109: } \
110: } while (0)
111: #else
112: #define splassert(wantipl) do { /* nothing */ } while (0)
113: #endif
114:
115: #endif /* ! _LOCORE */
116:
117: #endif /* _I80321_INTR_H_ */
118:
CVSweb