1164426Ssam/*	$NetBSD: ixp425_intr.h,v 1.6 2005/12/24 20:06:52 perry Exp $	*/
2164426Ssam
3164426Ssam/*
4164426Ssam * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
5164426Ssam * All rights reserved.
6164426Ssam *
7164426Ssam * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8164426Ssam *
9164426Ssam * Redistribution and use in source and binary forms, with or without
10164426Ssam * modification, are permitted provided that the following conditions
11164426Ssam * are met:
12164426Ssam * 1. Redistributions of source code must retain the above copyright
13164426Ssam *    notice, this list of conditions and the following disclaimer.
14164426Ssam * 2. Redistributions in binary form must reproduce the above copyright
15164426Ssam *    notice, this list of conditions and the following disclaimer in the
16164426Ssam *    documentation and/or other materials provided with the distribution.
17164426Ssam * 3. All advertising materials mentioning features or use of this software
18164426Ssam *    must display the following acknowledgement:
19164426Ssam *	This product includes software developed for the NetBSD Project by
20164426Ssam *	Wasabi Systems, Inc.
21164426Ssam * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22164426Ssam *    or promote products derived from this software without specific prior
23164426Ssam *    written permission.
24164426Ssam *
25164426Ssam * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26164426Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27164426Ssam * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28164426Ssam * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
29164426Ssam * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30164426Ssam * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31164426Ssam * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32164426Ssam * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33164426Ssam * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34164426Ssam * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35164426Ssam * POSSIBILITY OF SUCH DAMAGE.
36164426Ssam *
37164426Ssam * $FreeBSD$
38164426Ssam *
39164426Ssam */
40164426Ssam
41164426Ssam#ifndef _IXP425_INTR_H_
42164426Ssam#define _IXP425_INTR_H_
43164426Ssam
44164426Ssam#define	ARM_IRQ_HANDLER	_C_LABEL(ixp425_intr_dispatch)
45164426Ssam
46164426Ssam#ifndef _LOCORE
47164426Ssam
48164426Ssam#include <machine/armreg.h>
49164426Ssam#include <machine/cpufunc.h>
50164426Ssam
51164426Ssam#include <arm/xscale/ixp425/ixp425reg.h>
52164426Ssam
53164426Ssam#define IXPREG(reg)     *((__volatile u_int32_t*) (reg))
54164426Ssam
55164426Ssamvoid ixp425_do_pending(void);
56164426Ssam
57164426Ssamextern __volatile uint32_t intr_enabled;
58164426Ssamextern uint32_t intr_steer;
59164426Ssam
60164426Ssamstatic __inline void __attribute__((__unused__))
61164426Ssamixp425_set_intrmask(void)
62164426Ssam{
63164426Ssam	IXPREG(IXP425_INT_ENABLE) = intr_enabled & IXP425_INT_HWMASK;
64164426Ssam}
65164426Ssam
66164426Ssamstatic __inline void
67164426Ssamixp425_set_intrsteer(void)
68164426Ssam{
69164426Ssam	IXPREG(IXP425_INT_SELECT) = intr_steer & IXP425_INT_HWMASK;
70164426Ssam}
71164426Ssam
72186352Ssamextern __volatile uint32_t intr_enabled2;
73186352Ssamextern uint32_t intr_steer2;
74164426Ssam
75164426Ssamstatic __inline void __attribute__((__unused__))
76186352Ssamixp435_set_intrmask(void)
77164426Ssam{
78186352Ssam	IXPREG(IXP435_INT_ENABLE2) = intr_enabled2 & IXP435_INT_HWMASK;
79164426Ssam}
80164426Ssam
81186352Ssamstatic __inline void
82186352Ssamixp435_set_intrsteer(void)
83164426Ssam{
84186352Ssam	IXPREG(IXP435_INT_SELECT2) = intr_steer2 & IXP435_INT_HWMASK;
85164426Ssam}
86164426Ssam
87164426Ssam#endif /* _LOCORE */
88164426Ssam
89164426Ssam#endif /* _IXP425_INTR_H_ */
90