Deleted Added
full compact
icu.h (22975) icu.h (25164)
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: @(#)icu.h 5.6 (Berkeley) 5/9/91
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: @(#)icu.h 5.6 (Berkeley) 5/9/91
37 * $Id$
37 * $Id: icu.h,v 1.10 1997/02/22 09:36:13 peter Exp $
38 */
39
40/*
41 * AT/386 Interrupt Control constants
42 * W. Jolitz 8/89
43 */
44
45#ifndef _I386_ISA_ICU_H_
46#define _I386_ISA_ICU_H_
47
48#ifndef LOCORE
49
38 */
39
40/*
41 * AT/386 Interrupt Control constants
42 * W. Jolitz 8/89
43 */
44
45#ifndef _I386_ISA_ICU_H_
46#define _I386_ISA_ICU_H_
47
48#ifndef LOCORE
49
50#include "opt_smp.h" /* so we dont have to change EVERY file including icu.h */
51
50/*
51 * Interrupt "level" mechanism variables, masks, and macros
52 */
53extern unsigned imen; /* interrupt mask enable */
54
52/*
53 * Interrupt "level" mechanism variables, masks, and macros
54 */
55extern unsigned imen; /* interrupt mask enable */
56
57#if defined(APIC_IO)
58
59# if !defined(_MACHINE_SMP_H_)
60/** XXX what a hack, its this or include <machine/smp.h>! */
61void write_io_apic_mask24 __P((int, u_int32_t)); /* i386/i386/mpapic.c */
62# endif /* _MACHINE_SMP_H_ */
63
64#if defined(MULTIPLE_IOAPICS)
65#error MULTIPLE_IOAPICSXXX: cannot assume apic #0 in the following functions.
66#endif /* MULTIPLE_IOAPICS */
67
68static __inline u_int32_t
69INTRGET( void )
70{
71 return (imen & 0x00ffffff); /* return our global copy */
72}
73
74static __inline void
75INTRSET( unsigned s )
76{
77 write_io_apic_mask24( 0, s );
78 imen = s;
79}
80
81static __inline void
82INTREN( unsigned s )
83{
84 write_io_apic_mask24( 0, imen & ~s );
85 imen &= ~s;
86}
87
88static __inline void
89INTRDIS( unsigned s )
90{
91 write_io_apic_mask24( 0, imen | s );
92 imen |= s;
93}
94
95
96#define INTRMASK(msk,s) (msk |= (s))
97#define INTRUNMASK(msk,s) (msk &= ~(s))
98
99#else /* APIC_IO */
100
55#define INTREN(s) (imen &= ~(s), SET_ICUS())
56#define INTRDIS(s) (imen |= (s), SET_ICUS())
57#define INTRMASK(msk,s) (msk |= (s))
58#define INTRUNMASK(msk,s) (msk &= ~(s))
101#define INTREN(s) (imen &= ~(s), SET_ICUS())
102#define INTRDIS(s) (imen |= (s), SET_ICUS())
103#define INTRMASK(msk,s) (msk |= (s))
104#define INTRUNMASK(msk,s) (msk &= ~(s))
105
59#if 0
60#ifdef PC98
61#define SET_ICUS() (outb(IO_ICU1 + 2, imen), outb(IU_ICU2 + 2, imen >> 8))
62#else /* IBM-PC */
63#define SET_ICUS() (outb(IO_ICU1 + 1, imen), outb(IU_ICU2 + 1, imen >> 8))
64#endif /* PC98 */
65#else
66/*
67 * XXX - IO_ICU* are defined in isa.h, not icu.h, and nothing much bothers to
68 * include isa.h, while too many things include icu.h.
69 */
70#ifdef PC98
71#define SET_ICUS() (outb(0x02, imen), outb(0x0a, imen >> 8))
72#else
73#define SET_ICUS() (outb(0x21, imen), outb(0xa1, imen >> 8))
74#endif
75#endif
76
106#if 0
107#ifdef PC98
108#define SET_ICUS() (outb(IO_ICU1 + 2, imen), outb(IU_ICU2 + 2, imen >> 8))
109#else /* IBM-PC */
110#define SET_ICUS() (outb(IO_ICU1 + 1, imen), outb(IU_ICU2 + 1, imen >> 8))
111#endif /* PC98 */
112#else
113/*
114 * XXX - IO_ICU* are defined in isa.h, not icu.h, and nothing much bothers to
115 * include isa.h, while too many things include icu.h.
116 */
117#ifdef PC98
118#define SET_ICUS() (outb(0x02, imen), outb(0x0a, imen >> 8))
119#else
120#define SET_ICUS() (outb(0x21, imen), outb(0xa1, imen >> 8))
121#endif
122#endif
123
124#endif /* APIC_IO */
125
77#endif /* LOCORE */
78
79/*
80 * Interrupt enable bits - in normal order of priority (which we change)
81 */
82#define IRQ0 0x0001 /* highest priority - timer */
83#define IRQ1 0x0002
84#define IRQ_SLAVE 0x0004

--- 18 unchanged lines hidden (view full) ---

103#undef IRQ_SLAVE
104#define IRQ_SLAVE 0x0080
105#endif
106
107/*
108 * Interrupt Control offset into Interrupt descriptor table (IDT)
109 */
110#define ICU_OFFSET 32 /* 0-31 are processor exceptions */
126#endif /* LOCORE */
127
128/*
129 * Interrupt enable bits - in normal order of priority (which we change)
130 */
131#define IRQ0 0x0001 /* highest priority - timer */
132#define IRQ1 0x0002
133#define IRQ_SLAVE 0x0004

--- 18 unchanged lines hidden (view full) ---

152#undef IRQ_SLAVE
153#define IRQ_SLAVE 0x0080
154#endif
155
156/*
157 * Interrupt Control offset into Interrupt descriptor table (IDT)
158 */
159#define ICU_OFFSET 32 /* 0-31 are processor exceptions */
160
161#if defined(APIC_IO)
162
163#include <machine/apic.h>
164#if defined(IPI_INTS)
165/* 32-47: ISA IRQ0-IRQ15, 48-55: IO APIC IRQ16-IRQ23, 56-59: LOCAL APIC IPI */
166#define ICU_LEN 28
167#else
168/* 32-47: ISA IRQ0-IRQ15, 48-55: IO APIC IRQ16-IRQ23 */
169#define ICU_LEN 24
170#endif /* IPI_INTS */
171
172#else
173
111#define ICU_LEN 16 /* 32-47 are ISA interrupts */
112
174#define ICU_LEN 16 /* 32-47 are ISA interrupts */
175
176#endif /* APIC_IO */
177
113#endif /* !_I386_ISA_ICU_H_ */
178#endif /* !_I386_ISA_ICU_H_ */