xref: /dflybsd-src/sys/platform/pc64/apic/apicreg.h (revision c8fe38ae0761c8117b13caf9b76ad5fb86ac2135)
1*c8fe38aeSMatthew Dillon /*
2*c8fe38aeSMatthew Dillon  * Copyright (c) 2003,2004,2008 The DragonFly Project.  All rights reserved.
3*c8fe38aeSMatthew Dillon  *
4*c8fe38aeSMatthew Dillon  * This code is derived from software contributed to The DragonFly Project
5*c8fe38aeSMatthew Dillon  * by Matthew Dillon <dillon@backplane.com>
6*c8fe38aeSMatthew Dillon  *
7*c8fe38aeSMatthew Dillon  * Redistribution and use in source and binary forms, with or without
8*c8fe38aeSMatthew Dillon  * modification, are permitted provided that the following conditions
9*c8fe38aeSMatthew Dillon  * are met:
10*c8fe38aeSMatthew Dillon  *
11*c8fe38aeSMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
12*c8fe38aeSMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
13*c8fe38aeSMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
14*c8fe38aeSMatthew Dillon  *    notice, this list of conditions and the following disclaimer in
15*c8fe38aeSMatthew Dillon  *    the documentation and/or other materials provided with the
16*c8fe38aeSMatthew Dillon  *    distribution.
17*c8fe38aeSMatthew Dillon  * 3. Neither the name of The DragonFly Project nor the names of its
18*c8fe38aeSMatthew Dillon  *    contributors may be used to endorse or promote products derived
19*c8fe38aeSMatthew Dillon  *    from this software without specific, prior written permission.
20*c8fe38aeSMatthew Dillon  *
21*c8fe38aeSMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22*c8fe38aeSMatthew Dillon  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23*c8fe38aeSMatthew Dillon  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24*c8fe38aeSMatthew Dillon  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25*c8fe38aeSMatthew Dillon  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26*c8fe38aeSMatthew Dillon  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27*c8fe38aeSMatthew Dillon  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28*c8fe38aeSMatthew Dillon  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29*c8fe38aeSMatthew Dillon  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30*c8fe38aeSMatthew Dillon  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31*c8fe38aeSMatthew Dillon  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*c8fe38aeSMatthew Dillon  * SUCH DAMAGE.
33*c8fe38aeSMatthew Dillon  *
34*c8fe38aeSMatthew Dillon  * Copyright (c) 1996, by Peter Wemm and Steve Passe, All rights reserved.
35*c8fe38aeSMatthew Dillon  *
36*c8fe38aeSMatthew Dillon  * Redistribution and use in source and binary forms, with or without
37*c8fe38aeSMatthew Dillon  * modification, are permitted provided that the following conditions
38*c8fe38aeSMatthew Dillon  * are met:
39*c8fe38aeSMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
40*c8fe38aeSMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
41*c8fe38aeSMatthew Dillon  * 2. The name of the developer may NOT be used to endorse or promote products
42*c8fe38aeSMatthew Dillon  *    derived from this software without specific prior written permission.
43*c8fe38aeSMatthew Dillon  *
44*c8fe38aeSMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
45*c8fe38aeSMatthew Dillon  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46*c8fe38aeSMatthew Dillon  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47*c8fe38aeSMatthew Dillon  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
48*c8fe38aeSMatthew Dillon  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49*c8fe38aeSMatthew Dillon  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
50*c8fe38aeSMatthew Dillon  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51*c8fe38aeSMatthew Dillon  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52*c8fe38aeSMatthew Dillon  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53*c8fe38aeSMatthew Dillon  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54*c8fe38aeSMatthew Dillon  * SUCH DAMAGE.
55*c8fe38aeSMatthew Dillon  *
56*c8fe38aeSMatthew Dillon  * $FreeBSD: src/sys/i386/include/apic.h,v 1.14.2.2 2003/03/21 21:46:15 jhb Exp $
57*c8fe38aeSMatthew Dillon  * $DragonFly: src/sys/platform/pc64/apic/apicreg.h,v 1.1 2008/08/29 17:07:12 dillon Exp $
58*c8fe38aeSMatthew Dillon  */
59*c8fe38aeSMatthew Dillon 
60*c8fe38aeSMatthew Dillon #ifndef _MACHINE_APICREG_H_
61*c8fe38aeSMatthew Dillon #define _MACHINE_APICREG_H_
62*c8fe38aeSMatthew Dillon 
63*c8fe38aeSMatthew Dillon /*
64*c8fe38aeSMatthew Dillon  * Local && I/O APIC definitions for Pentium P54C+ Built-in APIC.
65*c8fe38aeSMatthew Dillon  *
66*c8fe38aeSMatthew Dillon  * A per-cpu APIC resides in memory location 0xFEE00000.
67*c8fe38aeSMatthew Dillon  *
68*c8fe38aeSMatthew Dillon  *		  31 ... 24   23 ... 16   15 ... 8     7 ... 0
69*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
70*c8fe38aeSMatthew Dillon  * 0000 	|           |           |           |           |
71*c8fe38aeSMatthew Dillon  * 0010 	|           |           |           |           |
72*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
73*c8fe38aeSMatthew Dillon  *
74*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
75*c8fe38aeSMatthew Dillon  * 0020 ID	|     | ID  |           |           |           | RW
76*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
77*c8fe38aeSMatthew Dillon  *
78*c8fe38aeSMatthew Dillon  *		    The physical APIC ID is used with physical interrupt
79*c8fe38aeSMatthew Dillon  *		    delivery modes.
80*c8fe38aeSMatthew Dillon  *
81*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
82*c8fe38aeSMatthew Dillon  * 0030 VER	|           |           |           |           |
83*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
84*c8fe38aeSMatthew Dillon  * 0040 	|           |           |           |           |
85*c8fe38aeSMatthew Dillon  * 0050 	|           |           |           |           |
86*c8fe38aeSMatthew Dillon  * 0060 	|           |           |           |           |
87*c8fe38aeSMatthew Dillon  * 0070 	|           |           |           |           |
88*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
89*c8fe38aeSMatthew Dillon  * 0080 TPR	|           |           |           | PRIO SUBC |
90*c8fe38aeSMatthew Dillon  * 0090 APR	|           |           |           |           |
91*c8fe38aeSMatthew Dillon  * 00A0 PPR	|           |           |           |           |
92*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
93*c8fe38aeSMatthew Dillon  *
94*c8fe38aeSMatthew Dillon  *		    The Task Priority Register provides a priority threshold
95*c8fe38aeSMatthew Dillon  *		    mechanism for interrupting the processor.  Only interrupts
96*c8fe38aeSMatthew Dillon  *		    with a higher priority then that specified in the TPR will
97*c8fe38aeSMatthew Dillon  *		    be served.   Other interrupts are recorded and serviced
98*c8fe38aeSMatthew Dillon  *		    as soon as the TPR value decreases enough to allow that
99*c8fe38aeSMatthew Dillon  *		    (unless EOId by another APIC).
100*c8fe38aeSMatthew Dillon  *
101*c8fe38aeSMatthew Dillon  *		    PRIO (7:4).  Main priority.  If 15 the APIC will not
102*c8fe38aeSMatthew Dillon  *		    		 accept any interrupts.
103*c8fe38aeSMatthew Dillon  *		    SUBC (3:0)	 Sub priority.  See APR/PPR.
104*c8fe38aeSMatthew Dillon  *
105*c8fe38aeSMatthew Dillon  *
106*c8fe38aeSMatthew Dillon  *		    The Processor Priority Register determines whether a
107*c8fe38aeSMatthew Dillon  *		    pending interrupt can be dispensed to the processor.  ISRV
108*c8fe38aeSMatthew Dillon  *		    Is the vector of the highest priority ISR bit set or
109*c8fe38aeSMatthew Dillon  *		    zero if no ISR bit is set.
110*c8fe38aeSMatthew Dillon  *
111*c8fe38aeSMatthew Dillon  *		    IF TPR[7:4] >= ISRV[7:4]
112*c8fe38aeSMatthew Dillon  *			PPR[7:0] = TPR[7:0]
113*c8fe38aeSMatthew Dillon  *		    ELSE
114*c8fe38aeSMatthew Dillon  *			PPR[7:0] = ISRV[7:4].000
115*c8fe38aeSMatthew Dillon  *
116*c8fe38aeSMatthew Dillon  *		    The Arbitration Priority Register holds the current
117*c8fe38aeSMatthew Dillon  *		    lowest priority of the procsesor, a value used during
118*c8fe38aeSMatthew Dillon  *		    lowest-priority arbitration.
119*c8fe38aeSMatthew Dillon  *
120*c8fe38aeSMatthew Dillon  *		    IF (TPR[7:4] >= IRRV[7:4] AND TPR[7:4] > ISRV[7:4])
121*c8fe38aeSMatthew Dillon  *			APR[7:0] = TPR[7:0]
122*c8fe38aeSMatthew Dillon  *		    ELSE
123*c8fe38aeSMatthew Dillon  *			APR[7:4] = max((TPR[7:4]&ISRV[7:4]),IRRV[7:4]).000
124*c8fe38aeSMatthew Dillon  *
125*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
126*c8fe38aeSMatthew Dillon  * 00B0 EOI	|           |           |           |           |
127*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
128*c8fe38aeSMatthew Dillon  * 00C0 	|           |           |           |           |
129*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
130*c8fe38aeSMatthew Dillon  * 00D0 LDR	|LOG APICID |           |           |           |
131*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
132*c8fe38aeSMatthew Dillon  * 00E0 DFR	|MODEL|     |           |           |           |
133*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
134*c8fe38aeSMatthew Dillon  *
135*c8fe38aeSMatthew Dillon  *		    The logical APIC ID is used with logical interrupt
136*c8fe38aeSMatthew Dillon  *		    delivery modes.  Interpretation of logical destination
137*c8fe38aeSMatthew Dillon  *		    information depends on the MODEL bits in the Destination
138*c8fe38aeSMatthew Dillon  *		    Format Regiuster.
139*c8fe38aeSMatthew Dillon  *
140*c8fe38aeSMatthew Dillon  *		    MODEL=1111 FLAT MODEL - The MDA is interpreted as
141*c8fe38aeSMatthew Dillon  *					    a decoded address.  By setting
142*c8fe38aeSMatthew Dillon  *					    one bit in the LDR for each
143*c8fe38aeSMatthew Dillon  *					    local apic 8 APICs can coexist.
144*c8fe38aeSMatthew Dillon  *
145*c8fe38aeSMatthew Dillon  *		    MODEL=0000 CLUSTER MODEL -
146*c8fe38aeSMatthew Dillon  *
147*c8fe38aeSMatthew Dillon  *		  31 ... 24   23 ... 16   15 ... 8     7 ... 0
148*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
149*c8fe38aeSMatthew Dillon  * 00F0 SVR	|           |           |       FE  |  vvvvvvvv |
150*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
151*c8fe38aeSMatthew Dillon  *
152*c8fe38aeSMatthew Dillon  *		    Spurious interrupt vector register.  The 4 low
153*c8fe38aeSMatthew Dillon  *		    vector bits must be programmed to 1111, e.g.
154*c8fe38aeSMatthew Dillon  *		    vvvv1111.
155*c8fe38aeSMatthew Dillon  *
156*c8fe38aeSMatthew Dillon  *		    E - LAPIC disable (1 = disable, 0 = enable)
157*c8fe38aeSMatthew Dillon  *
158*c8fe38aeSMatthew Dillon  *		    F - Focus processor disable (1 = disable, 0 = enable)
159*c8fe38aeSMatthew Dillon  *
160*c8fe38aeSMatthew Dillon  *		    NOTE: The handler for the spurious interrupt vector
161*c8fe38aeSMatthew Dillon  *		    should *NOT* issue an EOI because the spurious
162*c8fe38aeSMatthew Dillon  *		    interrupt does not effect the ISR.
163*c8fe38aeSMatthew Dillon  *
164*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
165*c8fe38aeSMatthew Dillon  * 0100-0170 ISR|           |           |           |           |
166*c8fe38aeSMatthew Dillon  * 0180-01F0 TMR|           |           |           |           |
167*c8fe38aeSMatthew Dillon  * 0200-0270 IRR|           |           |           |           |
168*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
169*c8fe38aeSMatthew Dillon  *
170*c8fe38aeSMatthew Dillon  *		    These registers represent 256 bits, one bit for each
171*c8fe38aeSMatthew Dillon  *		    possible interrupt.  Interrupts 0-15 are reserved so
172*c8fe38aeSMatthew Dillon  *		    bits 0-15 are also reserved.
173*c8fe38aeSMatthew Dillon  *
174*c8fe38aeSMatthew Dillon  *		    TMR - Trigger mode register.  Upon acceptance of an int
175*c8fe38aeSMatthew Dillon  *			  the corresponding bit is cleared for edge-trig and
176*c8fe38aeSMatthew Dillon  *			  set for level-trig.  If the TMR bit is set (level),
177*c8fe38aeSMatthew Dillon  *			  the local APIC sends an EOI to all I/O APICs as
178*c8fe38aeSMatthew Dillon  *			  a result of software issuing an EOI command.
179*c8fe38aeSMatthew Dillon  *
180*c8fe38aeSMatthew Dillon  *		    IRR - Interrupt Request Register.  Contains active
181*c8fe38aeSMatthew Dillon  *			  interrupt requests that have been accepted but not
182*c8fe38aeSMatthew Dillon  *			  yet dispensed by the current local APIC.  The bit is
183*c8fe38aeSMatthew Dillon  *			  cleared and the corresponding ISR bit is set when
184*c8fe38aeSMatthew Dillon  *			  the INTA cycle is issued.
185*c8fe38aeSMatthew Dillon  *
186*c8fe38aeSMatthew Dillon  *		    ISR - Interrupt In-Service register.  Interrupt has been
187*c8fe38aeSMatthew Dillon  *			  delivered but not yet fully serviced.  Cleared when
188*c8fe38aeSMatthew Dillon  *			  an EOI is issued from the processor.  An EOI will
189*c8fe38aeSMatthew Dillon  *			  also send an EOI to all I/O APICs if TMR was set.
190*c8fe38aeSMatthew Dillon  *
191*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
192*c8fe38aeSMatthew Dillon  * 0280 ESR	|           |           |           |           |
193*c8fe38aeSMatthew Dillon  * 0290-02F0    |           |           |           |           |
194*c8fe38aeSMatthew Dillon  *		+--FEDCBA98-+--76543210-+--FEDCBA98-+-----------+
195*c8fe38aeSMatthew Dillon  * 0300	ICR_LO	|           |      XX   |  TL SDMMM | vector    |
196*c8fe38aeSMatthew Dillon  * 0310	ICR_HI	| DEST FIELD|           |           |           |
197*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
198*c8fe38aeSMatthew Dillon  *
199*c8fe38aeSMatthew Dillon  *		    The interrupt command register.  Generally speaking
200*c8fe38aeSMatthew Dillon  *		    writing to ICR_LO initiates a command.  All fields
201*c8fe38aeSMatthew Dillon  *		    are R/W except the 'S' (delivery status) field, which
202*c8fe38aeSMatthew Dillon  *		    is read-only.  When
203*c8fe38aeSMatthew Dillon  *
204*c8fe38aeSMatthew Dillon  *
205*c8fe38aeSMatthew Dillon  *			XX:	Destination Shorthand field:
206*c8fe38aeSMatthew Dillon  *
207*c8fe38aeSMatthew Dillon  *				00	Use Destination field
208*c8fe38aeSMatthew Dillon  *				01	Self only.  Dest field ignored.
209*c8fe38aeSMatthew Dillon  *				10	All including self (uses a
210*c8fe38aeSMatthew Dillon  *					destination field of 0x0F)
211*c8fe38aeSMatthew Dillon  *				11	All excluding self (uses a
212*c8fe38aeSMatthew Dillon  *					destination field of 0x0F)
213*c8fe38aeSMatthew Dillon  *
214*c8fe38aeSMatthew Dillon  *			T:	1 = Level 0 = Edge Trigger modde, used for
215*c8fe38aeSMatthew Dillon  *				the INIT level de-assert delivery mode only
216*c8fe38aeSMatthew Dillon  *				to de-assert a request.
217*c8fe38aeSMatthew Dillon  *
218*c8fe38aeSMatthew Dillon  *			L:	0 = De-Assert, 1 = Assert.  Always write as
219*c8fe38aeSMatthew Dillon  *				1 when initiating a new command.  Can only
220*c8fe38aeSMatthew Dillon  *				write as 0 for INIT mode de-assertion of
221*c8fe38aeSMatthew Dillon  *				command.
222*c8fe38aeSMatthew Dillon  *
223*c8fe38aeSMatthew Dillon  *			S:	1 = Send Pending.  Interrupt has been injected
224*c8fe38aeSMatthew Dillon  *				but APIC has not yet accepted it.
225*c8fe38aeSMatthew Dillon  *
226*c8fe38aeSMatthew Dillon  *			D:	0=physical 1=logical.  In physical mode
227*c8fe38aeSMatthew Dillon  *				only 24-27 of DEST FIELD is used from ICR_HI.
228*c8fe38aeSMatthew Dillon  *
229*c8fe38aeSMatthew Dillon  *			MMM:	000 Fixed. Deliver to all processors according
230*c8fe38aeSMatthew Dillon  *				    to the ICR.  Always treated as edge trig.
231*c8fe38aeSMatthew Dillon  *
232*c8fe38aeSMatthew Dillon  *				001 Lowest Priority.  Deliver to just the
233*c8fe38aeSMatthew Dillon  *				    processor running at the lowest priority.
234*c8fe38aeSMatthew Dillon  *
235*c8fe38aeSMatthew Dillon  *				010 SMI.  The vector must be 00B.  Only edge
236*c8fe38aeSMatthew Dillon  *				    triggered is allowed.  The vector field
237*c8fe38aeSMatthew Dillon  *				    must be programmed to zero (huh?).
238*c8fe38aeSMatthew Dillon  *
239*c8fe38aeSMatthew Dillon  *				011 <reserved>
240*c8fe38aeSMatthew Dillon  *
241*c8fe38aeSMatthew Dillon  *				100 NMI.  Deliver as an NMI to all processors
242*c8fe38aeSMatthew Dillon  *				    listed in the destination field.  The
243*c8fe38aeSMatthew Dillon  *				    vector is ignored.  Alawys treated as
244*c8fe38aeSMatthew Dillon  *				    edge triggered.
245*c8fe38aeSMatthew Dillon  *
246*c8fe38aeSMatthew Dillon  *				101 INIT.  Deliver as an INIT signal to all
247*c8fe38aeSMatthew Dillon  *				    processors (like FIXED).  Vector is ignored
248*c8fe38aeSMatthew Dillon  *				    and it is always edge-triggered.
249*c8fe38aeSMatthew Dillon  *
250*c8fe38aeSMatthew Dillon  *				110 Start Up.  Sends a special message between
251*c8fe38aeSMatthew Dillon  *				    cpus.  the vector contains a start-up
252*c8fe38aeSMatthew Dillon  *				    address for MP boot protocol.
253*c8fe38aeSMatthew Dillon  *				    Always edge triggered.  Note: a startup
254*c8fe38aeSMatthew Dillon  *				    int is not automatically tried in case of
255*c8fe38aeSMatthew Dillon  *				    failure.
256*c8fe38aeSMatthew Dillon  *
257*c8fe38aeSMatthew Dillon  *				111 <reserved>
258*c8fe38aeSMatthew Dillon  *
259*c8fe38aeSMatthew Dillon  *		+-----------+--------10-+--FEDCBA98-+-----------+
260*c8fe38aeSMatthew Dillon  * 0320	LTIMER  |           |        TM |  ---S---- | vector    |
261*c8fe38aeSMatthew Dillon  * 0330		|           |           |           |           |
262*c8fe38aeSMatthew Dillon  *		+-----------+--------10-+--FEDCBA98-+-----------+
263*c8fe38aeSMatthew Dillon  * 0340	LVPCINT	|           |        -M |  ---S-MMM | vector    |
264*c8fe38aeSMatthew Dillon  * 0350	LVINT0	|           |        -M |  LRPS-MMM | vector    |
265*c8fe38aeSMatthew Dillon  * 0360 LVINT1	|           |        -M |  LRPS-MMM | vector    |
266*c8fe38aeSMatthew Dillon  * 0370	LVERROR	|           |        -M |  -------- | vector    |
267*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
268*c8fe38aeSMatthew Dillon  *
269*c8fe38aeSMatthew Dillon  *			T:	1 = periodic, 0 = one-shot
270*c8fe38aeSMatthew Dillon  *
271*c8fe38aeSMatthew Dillon  *			M:	1 = masked
272*c8fe38aeSMatthew Dillon  *
273*c8fe38aeSMatthew Dillon  *			L:	1 = level, 0 = edge
274*c8fe38aeSMatthew Dillon  *
275*c8fe38aeSMatthew Dillon  *			R:	For level triggered only, set to 1 when a
276*c8fe38aeSMatthew Dillon  *				level int is accepted, cleared by EOI.
277*c8fe38aeSMatthew Dillon  *
278*c8fe38aeSMatthew Dillon  *			P:	Pin Polarity 0 = Active High, 1 = Active Low
279*c8fe38aeSMatthew Dillon  *
280*c8fe38aeSMatthew Dillon  *			S:	1 = Send Pending.  Interrupt has been injected
281*c8fe38aeSMatthew Dillon  *				but APIC has not yet accepted it.
282*c8fe38aeSMatthew Dillon  *
283*c8fe38aeSMatthew Dillon  *			MMM 	000 = Fixed	deliver to cpu according to LVT
284*c8fe38aeSMatthew Dillon  *
285*c8fe38aeSMatthew Dillon  *			MMM 	100 = NMI	deliver as an NMI.  Always edge
286*c8fe38aeSMatthew Dillon  *
287*c8fe38aeSMatthew Dillon  *			MMM 	111 = ExtInt	deliver from 8259, routes INTA
288*c8fe38aeSMatthew Dillon  *						bus cycle to external
289*c8fe38aeSMatthew Dillon  *						controller.  Controller is
290*c8fe38aeSMatthew Dillon  *						expected to supply vector.
291*c8fe38aeSMatthew Dillon  *						Always level.
292*c8fe38aeSMatthew Dillon  *
293*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
294*c8fe38aeSMatthew Dillon  * 0380	TMR_ICR	|           |           |           |           |
295*c8fe38aeSMatthew Dillon  * 0390	TMR_CCR	|           |           |           |           |
296*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
297*c8fe38aeSMatthew Dillon  *
298*c8fe38aeSMatthew Dillon  *		The timer initial count register and current count
299*c8fe38aeSMatthew Dillon  *		register (32 bits)
300*c8fe38aeSMatthew Dillon  *
301*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
302*c8fe38aeSMatthew Dillon  * 03A0		|           |           |           |           |
303*c8fe38aeSMatthew Dillon  * 03B0		|           |           |           |           |
304*c8fe38aeSMatthew Dillon  * 03C0		|           |           |           |           |
305*c8fe38aeSMatthew Dillon  * 03D0		|           |           |           |           |
306*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
307*c8fe38aeSMatthew Dillon  * 03E0 TMR_DCR	|           |           |           |      d-dd |
308*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
309*c8fe38aeSMatthew Dillon  *
310*c8fe38aeSMatthew Dillon  *		The timer divide configuration register.  d-dd is:
311*c8fe38aeSMatthew Dillon  *
312*c8fe38aeSMatthew Dillon  *		0000 - divide by 2
313*c8fe38aeSMatthew Dillon  *		0001 - divide by 4
314*c8fe38aeSMatthew Dillon  *		0010 - divide by 8
315*c8fe38aeSMatthew Dillon  *		0011 - divide by 16
316*c8fe38aeSMatthew Dillon  *		1000 - divide by 32
317*c8fe38aeSMatthew Dillon  *		1001 - divide by 64
318*c8fe38aeSMatthew Dillon  *		1010 - divide by 128
319*c8fe38aeSMatthew Dillon  *		1011 - divide by 1
320*c8fe38aeSMatthew Dillon  *
321*c8fe38aeSMatthew Dillon  *	NOTE ON EOI: Upon receiving an EOI the APIC clears the highest priority
322*c8fe38aeSMatthew Dillon  *	interrupt in the ISR and selects the next highest priority interrupt
323*c8fe38aeSMatthew Dillon  *	for posting to the CPU.  If the interrupt being EOId was level
324*c8fe38aeSMatthew Dillon  *	triggered the APIC will send an EOI to all I/O APICs.  For the moment
325*c8fe38aeSMatthew Dillon  *	you can write garbage to the EOI register but for future compatibility
326*c8fe38aeSMatthew Dillon  *	0 should be written.
327*c8fe38aeSMatthew Dillon  */
328*c8fe38aeSMatthew Dillon 
329*c8fe38aeSMatthew Dillon #ifndef LOCORE
330*c8fe38aeSMatthew Dillon #include <sys/types.h>
331*c8fe38aeSMatthew Dillon 
332*c8fe38aeSMatthew Dillon #define PAD3	int : 32; int : 32; int : 32
333*c8fe38aeSMatthew Dillon #define PAD4	int : 32; int : 32; int : 32; int : 32
334*c8fe38aeSMatthew Dillon 
335*c8fe38aeSMatthew Dillon struct LAPIC {
336*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
337*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
338*c8fe38aeSMatthew Dillon 	u_int32_t id;		PAD3;	/* 0020	R/W */
339*c8fe38aeSMatthew Dillon 	u_int32_t version;	PAD3;	/* 0030	RO */
340*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
341*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
342*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
343*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
344*c8fe38aeSMatthew Dillon 	u_int32_t tpr;		PAD3;
345*c8fe38aeSMatthew Dillon 	u_int32_t apr;		PAD3;
346*c8fe38aeSMatthew Dillon 	u_int32_t ppr;		PAD3;
347*c8fe38aeSMatthew Dillon 	u_int32_t eoi;		PAD3;
348*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
349*c8fe38aeSMatthew Dillon 	u_int32_t ldr;		PAD3;
350*c8fe38aeSMatthew Dillon 	u_int32_t dfr;		PAD3;
351*c8fe38aeSMatthew Dillon 	u_int32_t svr;		PAD3;
352*c8fe38aeSMatthew Dillon 	u_int32_t isr0;		PAD3;
353*c8fe38aeSMatthew Dillon 	u_int32_t isr1;		PAD3;
354*c8fe38aeSMatthew Dillon 	u_int32_t isr2;		PAD3;
355*c8fe38aeSMatthew Dillon 	u_int32_t isr3;		PAD3;
356*c8fe38aeSMatthew Dillon 	u_int32_t isr4;		PAD3;
357*c8fe38aeSMatthew Dillon 	u_int32_t isr5;		PAD3;
358*c8fe38aeSMatthew Dillon 	u_int32_t isr6;		PAD3;
359*c8fe38aeSMatthew Dillon 	u_int32_t isr7;		PAD3;
360*c8fe38aeSMatthew Dillon 	u_int32_t tmr0;		PAD3;
361*c8fe38aeSMatthew Dillon 	u_int32_t tmr1;		PAD3;
362*c8fe38aeSMatthew Dillon 	u_int32_t tmr2;		PAD3;
363*c8fe38aeSMatthew Dillon 	u_int32_t tmr3;		PAD3;
364*c8fe38aeSMatthew Dillon 	u_int32_t tmr4;		PAD3;
365*c8fe38aeSMatthew Dillon 	u_int32_t tmr5;		PAD3;
366*c8fe38aeSMatthew Dillon 	u_int32_t tmr6;		PAD3;
367*c8fe38aeSMatthew Dillon 	u_int32_t tmr7;		PAD3;
368*c8fe38aeSMatthew Dillon 	u_int32_t irr0;		PAD3;
369*c8fe38aeSMatthew Dillon 	u_int32_t irr1;		PAD3;
370*c8fe38aeSMatthew Dillon 	u_int32_t irr2;		PAD3;
371*c8fe38aeSMatthew Dillon 	u_int32_t irr3;		PAD3;
372*c8fe38aeSMatthew Dillon 	u_int32_t irr4;		PAD3;
373*c8fe38aeSMatthew Dillon 	u_int32_t irr5;		PAD3;
374*c8fe38aeSMatthew Dillon 	u_int32_t irr6;		PAD3;
375*c8fe38aeSMatthew Dillon 	u_int32_t irr7;		PAD3;
376*c8fe38aeSMatthew Dillon 	u_int32_t esr;		PAD3;
377*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
378*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
379*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
380*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
381*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
382*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
383*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
384*c8fe38aeSMatthew Dillon 	u_int32_t icr_lo;	PAD3;
385*c8fe38aeSMatthew Dillon 	u_int32_t icr_hi;	PAD3;
386*c8fe38aeSMatthew Dillon 	u_int32_t lvt_timer;	PAD3;
387*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
388*c8fe38aeSMatthew Dillon 	u_int32_t lvt_pcint;	PAD3;
389*c8fe38aeSMatthew Dillon 	u_int32_t lvt_lint0;	PAD3;
390*c8fe38aeSMatthew Dillon 	u_int32_t lvt_lint1;	PAD3;
391*c8fe38aeSMatthew Dillon 	u_int32_t lvt_error;	PAD3;
392*c8fe38aeSMatthew Dillon 	u_int32_t icr_timer;	PAD3;
393*c8fe38aeSMatthew Dillon 	u_int32_t ccr_timer;	PAD3;
394*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
395*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
396*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
397*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
398*c8fe38aeSMatthew Dillon 	u_int32_t dcr_timer;	PAD3;
399*c8fe38aeSMatthew Dillon 	/* reserved */		PAD4;
400*c8fe38aeSMatthew Dillon };
401*c8fe38aeSMatthew Dillon 
402*c8fe38aeSMatthew Dillon typedef struct LAPIC lapic_t;
403*c8fe38aeSMatthew Dillon 
404*c8fe38aeSMatthew Dillon /******************************************************************************
405*c8fe38aeSMatthew Dillon  * I/O APIC structure
406*c8fe38aeSMatthew Dillon  */
407*c8fe38aeSMatthew Dillon 
408*c8fe38aeSMatthew Dillon struct IOAPIC {
409*c8fe38aeSMatthew Dillon 	u_int32_t ioregsel;	PAD3;
410*c8fe38aeSMatthew Dillon 	u_int32_t iowin;	PAD3;
411*c8fe38aeSMatthew Dillon };
412*c8fe38aeSMatthew Dillon 
413*c8fe38aeSMatthew Dillon typedef struct IOAPIC ioapic_t;
414*c8fe38aeSMatthew Dillon 
415*c8fe38aeSMatthew Dillon #undef PAD4
416*c8fe38aeSMatthew Dillon #undef PAD3
417*c8fe38aeSMatthew Dillon 
418*c8fe38aeSMatthew Dillon #endif  /* !LOCORE */
419*c8fe38aeSMatthew Dillon 
420*c8fe38aeSMatthew Dillon 
421*c8fe38aeSMatthew Dillon /******************************************************************************
422*c8fe38aeSMatthew Dillon  * various code 'logical' values
423*c8fe38aeSMatthew Dillon  */
424*c8fe38aeSMatthew Dillon 
425*c8fe38aeSMatthew Dillon /*
426*c8fe38aeSMatthew Dillon  * TPR loads to prioritize which cpu grabs an interrupt
427*c8fe38aeSMatthew Dillon  *
428*c8fe38aeSMatthew Dillon  * (note: some fields of the TPR are reserved)
429*c8fe38aeSMatthew Dillon  */
430*c8fe38aeSMatthew Dillon #define LOPRIO_LEVEL		0x00000010	/* TPR of CPU accepting INTs */
431*c8fe38aeSMatthew Dillon #define ALLHWI_LEVEL		0x00000000	/* TPR of CPU grabbing INTs */
432*c8fe38aeSMatthew Dillon 
433*c8fe38aeSMatthew Dillon /******************************************************************************
434*c8fe38aeSMatthew Dillon  * LOCAL APIC defines
435*c8fe38aeSMatthew Dillon  */
436*c8fe38aeSMatthew Dillon 
437*c8fe38aeSMatthew Dillon /*
438*c8fe38aeSMatthew Dillon  * default physical location for the LOCAL (CPU) APIC
439*c8fe38aeSMatthew Dillon  */
440*c8fe38aeSMatthew Dillon #define DEFAULT_APIC_BASE	0xfee00000
441*c8fe38aeSMatthew Dillon 
442*c8fe38aeSMatthew Dillon /*
443*c8fe38aeSMatthew Dillon  * lapic.id (rw)
444*c8fe38aeSMatthew Dillon  */
445*c8fe38aeSMatthew Dillon #define APIC_ID_MASK		0xff000000
446*c8fe38aeSMatthew Dillon #define APIC_ID_SHIFT		24
447*c8fe38aeSMatthew Dillon #define APIC_ID_CLUSTER		0xf0
448*c8fe38aeSMatthew Dillon #define APIC_ID_CLUSTER_ID	0x0f
449*c8fe38aeSMatthew Dillon #define APIC_MAX_CLUSTER	0xe
450*c8fe38aeSMatthew Dillon #define APIC_MAX_INTRACLUSTER_ID 3
451*c8fe38aeSMatthew Dillon #define APIC_ID_CLUSTER_SHIFT   4
452*c8fe38aeSMatthew Dillon 
453*c8fe38aeSMatthew Dillon /*
454*c8fe38aeSMatthew Dillon  * lapic.ver (ro)
455*c8fe38aeSMatthew Dillon  */
456*c8fe38aeSMatthew Dillon #define APIC_VER_VERSION	0x000000ff
457*c8fe38aeSMatthew Dillon #define APIC_VER_MAXLVT		0x00ff0000
458*c8fe38aeSMatthew Dillon #define MAXLVTSHIFT		16
459*c8fe38aeSMatthew Dillon 
460*c8fe38aeSMatthew Dillon /*
461*c8fe38aeSMatthew Dillon  * lapic.ldr (rw)
462*c8fe38aeSMatthew Dillon  */
463*c8fe38aeSMatthew Dillon #define APIC_LDR_RESERVED       0x00ffffff
464*c8fe38aeSMatthew Dillon 
465*c8fe38aeSMatthew Dillon /*
466*c8fe38aeSMatthew Dillon  * lapic.dfr (rw)
467*c8fe38aeSMatthew Dillon  *
468*c8fe38aeSMatthew Dillon  * The logical APIC ID is used with logical interrupt
469*c8fe38aeSMatthew Dillon  * delivery modes.  Interpretation of logical destination
470*c8fe38aeSMatthew Dillon  * information depends on the MODEL bits in the Destination
471*c8fe38aeSMatthew Dillon  * Format Regiuster.
472*c8fe38aeSMatthew Dillon  *
473*c8fe38aeSMatthew Dillon  * MODEL=1111 FLAT MODEL - The MDA is interpreted as
474*c8fe38aeSMatthew Dillon  * 			   a decoded address.  By setting
475*c8fe38aeSMatthew Dillon  * 			   one bit in the LDR for each
476*c8fe38aeSMatthew Dillon  *			   local apic 8 APICs can coexist.
477*c8fe38aeSMatthew Dillon  *
478*c8fe38aeSMatthew Dillon  * MODEL=0000 CLUSTER MODEL -
479*c8fe38aeSMatthew Dillon  */
480*c8fe38aeSMatthew Dillon #define APIC_DFR_RESERVED	0x0fffffff
481*c8fe38aeSMatthew Dillon #define APIC_DFR_MODEL_MASK	0xf0000000
482*c8fe38aeSMatthew Dillon #define APIC_DFR_MODEL_FLAT	0xf0000000
483*c8fe38aeSMatthew Dillon #define APIC_DFR_MODEL_CLUSTER	0x00000000
484*c8fe38aeSMatthew Dillon 
485*c8fe38aeSMatthew Dillon /*
486*c8fe38aeSMatthew Dillon  * lapic.svr
487*c8fe38aeSMatthew Dillon  *
488*c8fe38aeSMatthew Dillon  * Contains the spurious interrupt vector and bits to enable/disable
489*c8fe38aeSMatthew Dillon  * the local apic and focus processor.
490*c8fe38aeSMatthew Dillon  */
491*c8fe38aeSMatthew Dillon #define APIC_SVR_VECTOR		0x000000ff
492*c8fe38aeSMatthew Dillon #define APIC_SVR_ENABLE		0x00000100
493*c8fe38aeSMatthew Dillon #define APIC_SVR_FOCUS_DISABLE	0x00000200
494*c8fe38aeSMatthew Dillon 
495*c8fe38aeSMatthew Dillon /*
496*c8fe38aeSMatthew Dillon  * lapic.tpr
497*c8fe38aeSMatthew Dillon  *
498*c8fe38aeSMatthew Dillon  *    PRIO (7:4).  Main priority.  If 15 the APIC will not
499*c8fe38aeSMatthew Dillon  *    		 accept any interrupts.
500*c8fe38aeSMatthew Dillon  *    SUBC (3:0)	 Sub priority.  See APR/PPR.
501*c8fe38aeSMatthew Dillon  */
502*c8fe38aeSMatthew Dillon #define APIC_TPR_PRIO		0x000000ff
503*c8fe38aeSMatthew Dillon #define APIC_TPR_INT		0x000000f0
504*c8fe38aeSMatthew Dillon #define APIC_TPR_SUB		0x0000000f
505*c8fe38aeSMatthew Dillon 
506*c8fe38aeSMatthew Dillon /*
507*c8fe38aeSMatthew Dillon  * lapic.icr_lo	  -------- ----XXRR TL-SDMMM vvvvvvvv
508*c8fe38aeSMatthew Dillon  *
509*c8fe38aeSMatthew Dillon  *	The interrupt command register.  Generally speaking
510*c8fe38aeSMatthew Dillon  * 	writing to ICR_LO initiates a command.  All fields
511*c8fe38aeSMatthew Dillon  * 	are R/W except the 'S' (delivery status) field, which
512*c8fe38aeSMatthew Dillon  * 	is read-only.  When
513*c8fe38aeSMatthew Dillon  *
514*c8fe38aeSMatthew Dillon  *      XX:     Destination Shorthand field:
515*c8fe38aeSMatthew Dillon  *
516*c8fe38aeSMatthew Dillon  *		00 -	Use Destination field
517*c8fe38aeSMatthew Dillon  *		01 -	Self only.  Dest field ignored.
518*c8fe38aeSMatthew Dillon  *		10 -	All including self (uses a
519*c8fe38aeSMatthew Dillon  *			destination field of 0x0F)
520*c8fe38aeSMatthew Dillon  *		11 -	All excluding self (uses a
521*c8fe38aeSMatthew Dillon  *			destination field of 0x0F)
522*c8fe38aeSMatthew Dillon  *
523*c8fe38aeSMatthew Dillon  *	RR:	RR mode (? needs documentation)
524*c8fe38aeSMatthew Dillon  *
525*c8fe38aeSMatthew Dillon  *      T:      1 = Level 0 = Edge Trigger modde, used for
526*c8fe38aeSMatthew Dillon  *      	the INIT level de-assert delivery mode only
527*c8fe38aeSMatthew Dillon  *      	to de-assert a request.
528*c8fe38aeSMatthew Dillon  *
529*c8fe38aeSMatthew Dillon  *	L:      0 = De-Assert, 1 = Assert.  Always write as
530*c8fe38aeSMatthew Dillon  *      	1 when initiating a new command.  Can only
531*c8fe38aeSMatthew Dillon  *		write as 0 for INIT mode de-assertion of
532*c8fe38aeSMatthew Dillon  *		command.
533*c8fe38aeSMatthew Dillon  *
534*c8fe38aeSMatthew Dillon  *	S:	1 = Send Pending.  Interrupt has been injected but the APIC
535*c8fe38aeSMatthew Dillon  *		has not yet accepted it.
536*c8fe38aeSMatthew Dillon  *
537*c8fe38aeSMatthew Dillon  *	D:	0 = physical 1 = logical.  In physical mode only bits 24-27
538*c8fe38aeSMatthew Dillon  *		of the DEST field is used from ICR_HI.
539*c8fe38aeSMatthew Dillon  *
540*c8fe38aeSMatthew Dillon  *	MMM:	Delivery mode
541*c8fe38aeSMatthew Dillon  *
542*c8fe38aeSMatthew Dillon  *		000 - Fixed.  Deliver to all processors according to the
543*c8fe38aeSMatthew Dillon  *		      ICR.  Always treated as edge triggered.
544*c8fe38aeSMatthew Dillon  *
545*c8fe38aeSMatthew Dillon  *		001 - Lowest Priority.  Deliver to just the processor
546*c8fe38aeSMatthew Dillon  *		      running at the lowest priority.
547*c8fe38aeSMatthew Dillon  *
548*c8fe38aeSMatthew Dillon  *		010 - SMI.  The vector must be 00B.  Only edge triggered
549*c8fe38aeSMatthew Dillon  *		      is allowed.  The vector field must be programmed to
550*c8fe38aeSMatthew Dillon  *		      0 (huh?)
551*c8fe38aeSMatthew Dillon  *
552*c8fe38aeSMatthew Dillon  *		011 - RR Delivery mode (?? needs documentation).
553*c8fe38aeSMatthew Dillon  *
554*c8fe38aeSMatthew Dillon  *		100 - NMI.  Deliver as an NMI to all processors listed in
555*c8fe38aeSMatthew Dillon  *		      the destination field.  The vector is ignored.  Always
556*c8fe38aeSMatthew Dillon  *		      treated as edge triggered.
557*c8fe38aeSMatthew Dillon  *
558*c8fe38aeSMatthew Dillon  *		101 - INIT.  Deliver as an INIT signal to all processors
559*c8fe38aeSMatthew Dillon  *		      (like FIXED) according to the ICR.  The vector is
560*c8fe38aeSMatthew Dillon  *		      ignored and delivery is always edge-triggered.
561*c8fe38aeSMatthew Dillon  *
562*c8fe38aeSMatthew Dillon  *		110 - Startup.  Send a special message between cpus.  The
563*c8fe38aeSMatthew Dillon  *		      vector contains a startup address for the MP boot
564*c8fe38aeSMatthew Dillon  *		      protocol.  Always edge triggered.  Note: a startup
565*c8fe38aeSMatthew Dillon  *		      interrupt is not automatically tried in case of failure.
566*c8fe38aeSMatthew Dillon  *
567*c8fe38aeSMatthew Dillon  *		111 - <reserved>
568*c8fe38aeSMatthew Dillon  */
569*c8fe38aeSMatthew Dillon #define APIC_VECTOR_MASK	0x000000ff
570*c8fe38aeSMatthew Dillon 
571*c8fe38aeSMatthew Dillon #define APIC_DELMODE_MASK	0x00000700
572*c8fe38aeSMatthew Dillon #define APIC_DELMODE_FIXED	0x00000000
573*c8fe38aeSMatthew Dillon #define APIC_DELMODE_LOWPRIO	0x00000100
574*c8fe38aeSMatthew Dillon #define APIC_DELMODE_SMI	0x00000200
575*c8fe38aeSMatthew Dillon #define APIC_DELMODE_RR		0x00000300
576*c8fe38aeSMatthew Dillon #define APIC_DELMODE_NMI	0x00000400
577*c8fe38aeSMatthew Dillon #define APIC_DELMODE_INIT	0x00000500
578*c8fe38aeSMatthew Dillon #define APIC_DELMODE_STARTUP	0x00000600
579*c8fe38aeSMatthew Dillon #define APIC_DELMODE_RESV7	0x00000700
580*c8fe38aeSMatthew Dillon 
581*c8fe38aeSMatthew Dillon #define APIC_DESTMODE_MASK	0x00000800
582*c8fe38aeSMatthew Dillon #define APIC_DESTMODE_PHY	0x00000000
583*c8fe38aeSMatthew Dillon #define APIC_DESTMODE_LOG	0x00000800
584*c8fe38aeSMatthew Dillon 
585*c8fe38aeSMatthew Dillon #define APIC_DELSTAT_MASK	0x00001000
586*c8fe38aeSMatthew Dillon #define APIC_DELSTAT_IDLE	0x00000000
587*c8fe38aeSMatthew Dillon #define APIC_DELSTAT_PEND	0x00001000
588*c8fe38aeSMatthew Dillon 
589*c8fe38aeSMatthew Dillon #define APIC_LEVEL_MASK		0x00004000
590*c8fe38aeSMatthew Dillon #define APIC_LEVEL_DEASSERT	0x00000000
591*c8fe38aeSMatthew Dillon #define APIC_LEVEL_ASSERT	0x00004000
592*c8fe38aeSMatthew Dillon 
593*c8fe38aeSMatthew Dillon #define APIC_TRIGMOD_MASK	0x00008000
594*c8fe38aeSMatthew Dillon #define APIC_TRIGMOD_EDGE	0x00000000
595*c8fe38aeSMatthew Dillon #define APIC_TRIGMOD_LEVEL	0x00008000
596*c8fe38aeSMatthew Dillon 
597*c8fe38aeSMatthew Dillon #define APIC_RRSTAT_MASK	0x00030000
598*c8fe38aeSMatthew Dillon #define APIC_RRSTAT_INVALID	0x00000000
599*c8fe38aeSMatthew Dillon #define APIC_RRSTAT_INPROG	0x00010000
600*c8fe38aeSMatthew Dillon #define APIC_RRSTAT_VALID	0x00020000
601*c8fe38aeSMatthew Dillon #define APIC_RRSTAT_RESV	0x00030000
602*c8fe38aeSMatthew Dillon 
603*c8fe38aeSMatthew Dillon #define APIC_DEST_MASK		0x000c0000
604*c8fe38aeSMatthew Dillon #define APIC_DEST_DESTFLD	0x00000000
605*c8fe38aeSMatthew Dillon #define APIC_DEST_SELF		0x00040000
606*c8fe38aeSMatthew Dillon #define APIC_DEST_ALLISELF	0x00080000
607*c8fe38aeSMatthew Dillon #define APIC_DEST_ALLESELF	0x000c0000
608*c8fe38aeSMatthew Dillon 
609*c8fe38aeSMatthew Dillon #define APIC_ICRLO_RESV_MASK	0xfff02000
610*c8fe38aeSMatthew Dillon 
611*c8fe38aeSMatthew Dillon /*
612*c8fe38aeSMatthew Dillon  * lapic.icr_hi
613*c8fe38aeSMatthew Dillon  */
614*c8fe38aeSMatthew Dillon #define APIC_ICRH_ID_MASK	APIC_ID_MASK
615*c8fe38aeSMatthew Dillon 
616*c8fe38aeSMatthew Dillon /*
617*c8fe38aeSMatthew Dillon  * lapic.lvt_timer
618*c8fe38aeSMatthew Dillon  * lapic.lvt_pcint
619*c8fe38aeSMatthew Dillon  * lapic.lvt_lint0
620*c8fe38aeSMatthew Dillon  * lapic.lvt_lint1
621*c8fe38aeSMatthew Dillon  * lapic.lvt_error
622*c8fe38aeSMatthew Dillon  *
623*c8fe38aeSMatthew Dillon  *		+-----------+--------10-+--FEDCBA98-+-----------+
624*c8fe38aeSMatthew Dillon  * 0320	LTIMER  |           |        TM |  ---S---- | vector    |
625*c8fe38aeSMatthew Dillon  * 0330		|           |           |           |           |
626*c8fe38aeSMatthew Dillon  *		+-----------+--------10-+--FEDCBA98-+-----------+
627*c8fe38aeSMatthew Dillon  * 0340	LVPCINT	|           |        -M |  ---S-MMM | vector    |
628*c8fe38aeSMatthew Dillon  * 0350	LVINT0	|           |        -M |  LRPS-MMM | vector    |
629*c8fe38aeSMatthew Dillon  * 0360 LVINT1	|           |        -M |  LRPS-MMM | vector    |
630*c8fe38aeSMatthew Dillon  * 0370	LVERROR	|           |        -M |  -------- | vector    |
631*c8fe38aeSMatthew Dillon  *		+-----------+-----------+-----------+-----------+
632*c8fe38aeSMatthew Dillon  *
633*c8fe38aeSMatthew Dillon  *			T:	1 = periodic, 0 = one-shot
634*c8fe38aeSMatthew Dillon  *				(LTIMER only)
635*c8fe38aeSMatthew Dillon  *
636*c8fe38aeSMatthew Dillon  *			M:	1 = masked
637*c8fe38aeSMatthew Dillon  *
638*c8fe38aeSMatthew Dillon  *			L:	1 = level, 0 = edge
639*c8fe38aeSMatthew Dillon  *				(LVINT0/1 only)
640*c8fe38aeSMatthew Dillon  *
641*c8fe38aeSMatthew Dillon  *			R:	For level triggered only, set to 1 when a
642*c8fe38aeSMatthew Dillon  *				level int is accepted, cleared by EOI.
643*c8fe38aeSMatthew Dillon  *				(LVINT0/1 only)
644*c8fe38aeSMatthew Dillon  *
645*c8fe38aeSMatthew Dillon  *			P:	Pin Polarity 0 = Active High, 1 = Active Low
646*c8fe38aeSMatthew Dillon  *				(LVINT0/1 only)
647*c8fe38aeSMatthew Dillon  *
648*c8fe38aeSMatthew Dillon  *			S:	1 = Send Pending.  Interrupt has been injected
649*c8fe38aeSMatthew Dillon  *				but APIC has not yet accepted it.
650*c8fe38aeSMatthew Dillon  *
651*c8fe38aeSMatthew Dillon  *			MMM 	000 = Fixed	deliver to cpu according to LVT
652*c8fe38aeSMatthew Dillon  *
653*c8fe38aeSMatthew Dillon  *			MMM 	100 = NMI	deliver as an NMI.  Always edge
654*c8fe38aeSMatthew Dillon  *
655*c8fe38aeSMatthew Dillon  *			MMM 	111 = ExtInt	deliver from 8259, routes INTA
656*c8fe38aeSMatthew Dillon  *						bus cycle to external
657*c8fe38aeSMatthew Dillon  *						controller.  Controller is
658*c8fe38aeSMatthew Dillon  *						expected to supply vector.
659*c8fe38aeSMatthew Dillon  *						Always level.
660*c8fe38aeSMatthew Dillon  */
661*c8fe38aeSMatthew Dillon #define APIC_LVT_VECTOR		0x000000ff
662*c8fe38aeSMatthew Dillon 
663*c8fe38aeSMatthew Dillon #define APIC_LVT_DM_MASK	0x00000700
664*c8fe38aeSMatthew Dillon #define APIC_LVT_DM_FIXED	0x00000000
665*c8fe38aeSMatthew Dillon #define APIC_LVT_DM_NMI		0x00000400
666*c8fe38aeSMatthew Dillon #define APIC_LVT_DM_EXTINT	0x00000700
667*c8fe38aeSMatthew Dillon 
668*c8fe38aeSMatthew Dillon #define APIC_LVT_DS		0x00001000	/* (S) Send Pending */
669*c8fe38aeSMatthew Dillon #define APIC_LVT_POLARITY_MASK	0x00002000
670*c8fe38aeSMatthew Dillon #define APIC_LVT_POLARITY_LO	0x00002000	/* (P) Pin Polarity */
671*c8fe38aeSMatthew Dillon #define APIC_LVT_POLARITY_HI	0x00000000
672*c8fe38aeSMatthew Dillon #define APIC_LVT_LEVELSTATUS	0x00004000	/* (R) level trig status */
673*c8fe38aeSMatthew Dillon #define APIC_LVT_TRIG_MASK	0x00008000
674*c8fe38aeSMatthew Dillon #define APIC_LVT_LEVELTRIG	0x00008000	/* (L) 1 = level, 0 = edge */
675*c8fe38aeSMatthew Dillon #define APIC_LVT_MASKED		0x00010000	/* (M) 1 = masked */
676*c8fe38aeSMatthew Dillon 
677*c8fe38aeSMatthew Dillon /*
678*c8fe38aeSMatthew Dillon  * lapic.lvt_timer
679*c8fe38aeSMatthew Dillon  */
680*c8fe38aeSMatthew Dillon #define APIC_LVTT_VECTOR	APIC_LVT_VECTOR
681*c8fe38aeSMatthew Dillon #define APIC_LVTT_DS		APIC_LVT_DS
682*c8fe38aeSMatthew Dillon #define APIC_LVTT_MASKED	APIC_LVT_MASKED
683*c8fe38aeSMatthew Dillon #define APIC_LVTT_PERIODIC	0x00020000
684*c8fe38aeSMatthew Dillon 
685*c8fe38aeSMatthew Dillon #define APIC_TIMER_MAX_COUNT    0xffffffff
686*c8fe38aeSMatthew Dillon 
687*c8fe38aeSMatthew Dillon /*
688*c8fe38aeSMatthew Dillon  * lapic.icr_timer - initial count register (32 bits)
689*c8fe38aeSMatthew Dillon  * lapic.ccr_timer - current count register (32 bits)
690*c8fe38aeSMatthew Dillon  */
691*c8fe38aeSMatthew Dillon 
692*c8fe38aeSMatthew Dillon /*
693*c8fe38aeSMatthew Dillon  * lapic.dcr_timer - timer divider register
694*c8fe38aeSMatthew Dillon  *
695*c8fe38aeSMatthew Dillon  * d0dd
696*c8fe38aeSMatthew Dillon  *
697*c8fe38aeSMatthew Dillon  *	0000 - divide by 2
698*c8fe38aeSMatthew Dillon  *	0001 - divide by 4
699*c8fe38aeSMatthew Dillon  *	0010 - divide by 8
700*c8fe38aeSMatthew Dillon  *	0011 - divide by 16
701*c8fe38aeSMatthew Dillon  *	1000 - divide by 32
702*c8fe38aeSMatthew Dillon  *	1001 - divide by 64
703*c8fe38aeSMatthew Dillon  *	1010 - divide by 128
704*c8fe38aeSMatthew Dillon  *	1011 - divide by 1
705*c8fe38aeSMatthew Dillon  */
706*c8fe38aeSMatthew Dillon #define APIC_TDCR_2		0x00
707*c8fe38aeSMatthew Dillon #define APIC_TDCR_4		0x01
708*c8fe38aeSMatthew Dillon #define APIC_TDCR_8		0x02
709*c8fe38aeSMatthew Dillon #define APIC_TDCR_16		0x03
710*c8fe38aeSMatthew Dillon #define APIC_TDCR_32		0x08
711*c8fe38aeSMatthew Dillon #define APIC_TDCR_64		0x09
712*c8fe38aeSMatthew Dillon #define APIC_TDCR_128		0x0a
713*c8fe38aeSMatthew Dillon #define APIC_TDCR_1		0x0b
714*c8fe38aeSMatthew Dillon 
715*c8fe38aeSMatthew Dillon /*
716*c8fe38aeSMatthew Dillon  * fields in IRR
717*c8fe38aeSMatthew Dillon  * ISA INTerrupts are in bits 16-31 of the 1st IRR register.
718*c8fe38aeSMatthew Dillon  * these masks DON'T EQUAL the isa IRQs of the same name.
719*c8fe38aeSMatthew Dillon  */
720*c8fe38aeSMatthew Dillon #define APIC_IRQ0		0
721*c8fe38aeSMatthew Dillon #define APIC_IRQ1		1
722*c8fe38aeSMatthew Dillon #define APIC_IRQ2		2
723*c8fe38aeSMatthew Dillon #define APIC_IRQ3		3
724*c8fe38aeSMatthew Dillon #define APIC_IRQ4		4
725*c8fe38aeSMatthew Dillon #define APIC_IRQ5		5
726*c8fe38aeSMatthew Dillon #define APIC_IRQ6		6
727*c8fe38aeSMatthew Dillon #define APIC_IRQ7		7
728*c8fe38aeSMatthew Dillon #define APIC_IRQ8		8
729*c8fe38aeSMatthew Dillon #define APIC_IRQ9		9
730*c8fe38aeSMatthew Dillon #define APIC_IRQ10		10
731*c8fe38aeSMatthew Dillon #define APIC_IRQ11		11
732*c8fe38aeSMatthew Dillon #define APIC_IRQ12		12
733*c8fe38aeSMatthew Dillon #define APIC_IRQ13		13
734*c8fe38aeSMatthew Dillon #define APIC_IRQ14		14
735*c8fe38aeSMatthew Dillon #define APIC_IRQ15		15
736*c8fe38aeSMatthew Dillon #define APIC_IRQ16		16
737*c8fe38aeSMatthew Dillon #define APIC_IRQ17		17
738*c8fe38aeSMatthew Dillon #define APIC_IRQ18		18
739*c8fe38aeSMatthew Dillon #define APIC_IRQ19		19
740*c8fe38aeSMatthew Dillon #define APIC_IRQ20		20
741*c8fe38aeSMatthew Dillon #define APIC_IRQ21		21
742*c8fe38aeSMatthew Dillon #define APIC_IRQ22		22
743*c8fe38aeSMatthew Dillon #define APIC_IRQ23		23
744*c8fe38aeSMatthew Dillon 
745*c8fe38aeSMatthew Dillon /******************************************************************************
746*c8fe38aeSMatthew Dillon  * I/O APIC defines
747*c8fe38aeSMatthew Dillon  */
748*c8fe38aeSMatthew Dillon 
749*c8fe38aeSMatthew Dillon /* default physical locations of an IO APIC */
750*c8fe38aeSMatthew Dillon #define DEFAULT_IO_APIC_BASE	0xfec00000
751*c8fe38aeSMatthew Dillon 
752*c8fe38aeSMatthew Dillon /* window register offset */
753*c8fe38aeSMatthew Dillon #define IOAPIC_WINDOW		0x10
754*c8fe38aeSMatthew Dillon 
755*c8fe38aeSMatthew Dillon /*
756*c8fe38aeSMatthew Dillon  * indexes into IO APIC (index into array of 32 bit entities)
757*c8fe38aeSMatthew Dillon  */
758*c8fe38aeSMatthew Dillon #define IOAPIC_ID		0x00
759*c8fe38aeSMatthew Dillon #define IOAPIC_VER		0x01
760*c8fe38aeSMatthew Dillon #define IOAPIC_ARB		0x02
761*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL		0x10
762*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL0		IOAPIC_REDTBL
763*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL1		(IOAPIC_REDTBL+0x02)
764*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL2		(IOAPIC_REDTBL+0x04)
765*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL3		(IOAPIC_REDTBL+0x06)
766*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL4		(IOAPIC_REDTBL+0x08)
767*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL5		(IOAPIC_REDTBL+0x0a)
768*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL6		(IOAPIC_REDTBL+0x0c)
769*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL7		(IOAPIC_REDTBL+0x0e)
770*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL8		(IOAPIC_REDTBL+0x10)
771*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL9		(IOAPIC_REDTBL+0x12)
772*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL10		(IOAPIC_REDTBL+0x14)
773*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL11		(IOAPIC_REDTBL+0x16)
774*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL12		(IOAPIC_REDTBL+0x18)
775*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL13		(IOAPIC_REDTBL+0x1a)
776*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL14		(IOAPIC_REDTBL+0x1c)
777*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL15		(IOAPIC_REDTBL+0x1e)
778*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL16		(IOAPIC_REDTBL+0x20)
779*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL17		(IOAPIC_REDTBL+0x22)
780*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL18		(IOAPIC_REDTBL+0x24)
781*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL19		(IOAPIC_REDTBL+0x26)
782*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL20		(IOAPIC_REDTBL+0x28)
783*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL21		(IOAPIC_REDTBL+0x2a)
784*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL22		(IOAPIC_REDTBL+0x2c)
785*c8fe38aeSMatthew Dillon #define IOAPIC_REDTBL23		(IOAPIC_REDTBL+0x2e)
786*c8fe38aeSMatthew Dillon 
787*c8fe38aeSMatthew Dillon /* fields in VER */
788*c8fe38aeSMatthew Dillon #define IOART_VER_VERSION	0x000000ff
789*c8fe38aeSMatthew Dillon #define IOART_VER_MAXREDIR	0x00ff0000
790*c8fe38aeSMatthew Dillon #define MAXREDIRSHIFT		16
791*c8fe38aeSMatthew Dillon 
792*c8fe38aeSMatthew Dillon /*
793*c8fe38aeSMatthew Dillon  * fields in the IO APIC's redirection table entries
794*c8fe38aeSMatthew Dillon  */
795*c8fe38aeSMatthew Dillon 
796*c8fe38aeSMatthew Dillon /*
797*c8fe38aeSMatthew Dillon  * High 32 bit word.  The high 8 bits contain the destination field.
798*c8fe38aeSMatthew Dillon  *
799*c8fe38aeSMatthew Dillon  * If this entry is set up for Physical Mode, bits 59:56 (the low 4 bits
800*c8fe38aeSMatthew Dillon  * of the 8 bit destination field) contain an APIC ID.
801*c8fe38aeSMatthew Dillon  *
802*c8fe38aeSMatthew Dillon  * If this entry is set up for Logical Mode, the destination field potentially
803*c8fe38aeSMatthew Dillon  * defines a set of processors.  Bits 63:56 (all 8 bits) specify the logical
804*c8fe38aeSMatthew Dillon  * destination address.
805*c8fe38aeSMatthew Dillon  *
806*c8fe38aeSMatthew Dillon  * Current we use IOART_HI_DEST_BROADCAST to broadcast to all LAPICs
807*c8fe38aeSMatthew Dillon  */
808*c8fe38aeSMatthew Dillon #define IOART_HI_DEST_MASK	APIC_ID_MASK
809*c8fe38aeSMatthew Dillon #define IOART_HI_DEST_RESV	~APIC_ID_MASK
810*c8fe38aeSMatthew Dillon #define IOART_HI_DEST_BROADCAST	IOART_HI_DEST_MASK
811*c8fe38aeSMatthew Dillon 
812*c8fe38aeSMatthew Dillon /*
813*c8fe38aeSMatthew Dillon  * Low 32 bit word
814*c8fe38aeSMatthew Dillon  */
815*c8fe38aeSMatthew Dillon #define IOART_RESV	0x00fe0000	/* reserved */
816*c8fe38aeSMatthew Dillon 
817*c8fe38aeSMatthew Dillon /*
818*c8fe38aeSMatthew Dillon  * Interrupt mask bit.  If 1 the interrupt is masked.  An edge sensitive
819*c8fe38aeSMatthew Dillon  * interrupt which is masked will be lost.
820*c8fe38aeSMatthew Dillon  */
821*c8fe38aeSMatthew Dillon #define IOART_INTMASK	0x00010000	/* R/W: INTerrupt mask */
822*c8fe38aeSMatthew Dillon #define IOART_INTMCLR	0x00000000	/*       clear, allow INTs */
823*c8fe38aeSMatthew Dillon #define IOART_INTMSET	0x00010000	/*       set, inhibit INTs */
824*c8fe38aeSMatthew Dillon 
825*c8fe38aeSMatthew Dillon /*
826*c8fe38aeSMatthew Dillon  * Select trigger mode.
827*c8fe38aeSMatthew Dillon  */
828*c8fe38aeSMatthew Dillon #define IOART_TRGRMOD	0x00008000	/* R/W: trigger mode */
829*c8fe38aeSMatthew Dillon #define IOART_TRGREDG	0x00000000	/*       edge */
830*c8fe38aeSMatthew Dillon #define IOART_TRGRLVL	0x00008000	/*       level */
831*c8fe38aeSMatthew Dillon 
832*c8fe38aeSMatthew Dillon /*
833*c8fe38aeSMatthew Dillon  * Remote IRR.  Only applies to level triggered interrupts, this bit
834*c8fe38aeSMatthew Dillon  * is set to 1 when the IOAPIC has delivered a level triggered interrupt
835*c8fe38aeSMatthew Dillon  * to a local APIC.  It is cleared when the LAPIC EOI's the interrupt.
836*c8fe38aeSMatthew Dillon  * This field is read-only.
837*c8fe38aeSMatthew Dillon  */
838*c8fe38aeSMatthew Dillon #define IOART_REM_IRR	0x00004000	/* RO: remote IRR */
839*c8fe38aeSMatthew Dillon 
840*c8fe38aeSMatthew Dillon /*
841*c8fe38aeSMatthew Dillon  * Select interrupt pin polarity
842*c8fe38aeSMatthew Dillon  */
843*c8fe38aeSMatthew Dillon #define IOART_INTPOL	0x00002000	/* R/W: INT input pin polarity */
844*c8fe38aeSMatthew Dillon #define IOART_INTAHI	0x00000000	/*      active high */
845*c8fe38aeSMatthew Dillon #define IOART_INTALO	0x00002000	/*      active low */
846*c8fe38aeSMatthew Dillon 
847*c8fe38aeSMatthew Dillon /*
848*c8fe38aeSMatthew Dillon  * Delivery Status (read only).  0 = no interrupt pending, 1 = interrupt
849*c8fe38aeSMatthew Dillon  * pending for tranmission to an LAPIC.  Note that this bit does not
850*c8fe38aeSMatthew Dillon  * indicate whether the interrupt has been processed or is undergoing
851*c8fe38aeSMatthew Dillon  * processing by a cpu.
852*c8fe38aeSMatthew Dillon  */
853*c8fe38aeSMatthew Dillon #define IOART_DELIVS	0x00001000	/* RO: delivery status */
854*c8fe38aeSMatthew Dillon 
855*c8fe38aeSMatthew Dillon /*
856*c8fe38aeSMatthew Dillon  * Destination mode.
857*c8fe38aeSMatthew Dillon  *
858*c8fe38aeSMatthew Dillon  * In physical mode the destination APIC is identified by its ID.
859*c8fe38aeSMatthew Dillon  * Bits 56-59 specify the 4 bit APIC ID.
860*c8fe38aeSMatthew Dillon  *
861*c8fe38aeSMatthew Dillon  * In logical mode destinations are identified by matching on the logical
862*c8fe38aeSMatthew Dillon  * destination under the control of the destination format register and
863*c8fe38aeSMatthew Dillon  * logical destination register in each local APIC.
864*c8fe38aeSMatthew Dillon  *
865*c8fe38aeSMatthew Dillon  */
866*c8fe38aeSMatthew Dillon #define IOART_DESTMOD	0x00000800	/* R/W: destination mode */
867*c8fe38aeSMatthew Dillon #define IOART_DESTPHY	0x00000000	/*      physical */
868*c8fe38aeSMatthew Dillon #define IOART_DESTLOG	0x00000800	/*      logical */
869*c8fe38aeSMatthew Dillon 
870*c8fe38aeSMatthew Dillon /*
871*c8fe38aeSMatthew Dillon  * Delivery mode.
872*c8fe38aeSMatthew Dillon  *
873*c8fe38aeSMatthew Dillon  *	000	Fixed		Deliver the signal on the INTR signal for
874*c8fe38aeSMatthew Dillon  *				all processor core's LAPICs listed in the
875*c8fe38aeSMatthew Dillon  *				destination.  The trigger mode may be
876*c8fe38aeSMatthew Dillon  *				edge or level.
877*c8fe38aeSMatthew Dillon  *
878*c8fe38aeSMatthew Dillon  *	001	Lowest Pri	Deliver to the processor core whos LAPIC
879*c8fe38aeSMatthew Dillon  *				is operating at the lowest priority (TPR).
880*c8fe38aeSMatthew Dillon  *				The trigger mode may be edge or level.
881*c8fe38aeSMatthew Dillon  *
882*c8fe38aeSMatthew Dillon  *	010	SMI		System management interrupt.  the vector
883*c8fe38aeSMatthew Dillon  *				information is ignored but must be programmed
884*c8fe38aeSMatthew Dillon  *				to all zero's for future compatibility.
885*c8fe38aeSMatthew Dillon  *				Must be edge triggered.
886*c8fe38aeSMatthew Dillon  *
887*c8fe38aeSMatthew Dillon  *	011	Reserved
888*c8fe38aeSMatthew Dillon  *
889*c8fe38aeSMatthew Dillon  *	100	NMI		Deliver on the NMI signal for all cpu cores
890*c8fe38aeSMatthew Dillon  *				listed in the destination.  Vector information
891*c8fe38aeSMatthew Dillon  *				is ignored.  NMIs are treated as edge triggered
892*c8fe38aeSMatthew Dillon  *				interrupts even if programmed as level
893*c8fe38aeSMatthew Dillon  *				triggered.  For proper operation the pin must
894*c8fe38aeSMatthew Dillon  *				be programmed as an edge trigger.
895*c8fe38aeSMatthew Dillon  *
896*c8fe38aeSMatthew Dillon  *	101	INIT		Deliver to all processor cores listed in
897*c8fe38aeSMatthew Dillon  *				the destination by asserting their INIT signal.
898*c8fe38aeSMatthew Dillon  *				All addressed LAPICs will assume their INIT
899*c8fe38aeSMatthew Dillon  *				state.  Always treated as edge-triggered even
900*c8fe38aeSMatthew Dillon  *				if programmed as level.  For proper operation
901*c8fe38aeSMatthew Dillon  *				the pin must be programed as an edge trigger.
902*c8fe38aeSMatthew Dillon  *
903*c8fe38aeSMatthew Dillon  *	110	Reserved
904*c8fe38aeSMatthew Dillon  *
905*c8fe38aeSMatthew Dillon  *	111	ExINT		Deliver as an INTR signal to all processor
906*c8fe38aeSMatthew Dillon  *				cores listed in the destination as an
907*c8fe38aeSMatthew Dillon  *				interrupt originating in an externally
908*c8fe38aeSMatthew Dillon  *				connected interrupt controller.
909*c8fe38aeSMatthew Dillon  *				The INTA cycle corresponding to this ExINT
910*c8fe38aeSMatthew Dillon  *				will be routed to the external controller
911*c8fe38aeSMatthew Dillon  *				that is expected to supply the vector.
912*c8fe38aeSMatthew Dillon  *				Must be edge triggered.
913*c8fe38aeSMatthew Dillon  *
914*c8fe38aeSMatthew Dillon  */
915*c8fe38aeSMatthew Dillon #define IOART_DELMOD	0x00000700	/* R/W: delivery mode */
916*c8fe38aeSMatthew Dillon #define IOART_DELFIXED	0x00000000	/*       fixed */
917*c8fe38aeSMatthew Dillon #define IOART_DELLOPRI	0x00000100	/*       lowest priority */
918*c8fe38aeSMatthew Dillon #define IOART_DELSMI	0x00000200	/*       System Management INT */
919*c8fe38aeSMatthew Dillon #define IOART_DELRSV1	0x00000300	/*       reserved */
920*c8fe38aeSMatthew Dillon #define IOART_DELNMI	0x00000400	/*       NMI signal */
921*c8fe38aeSMatthew Dillon #define IOART_DELINIT	0x00000500	/*       INIT signal */
922*c8fe38aeSMatthew Dillon #define IOART_DELRSV2	0x00000600	/*       reserved */
923*c8fe38aeSMatthew Dillon #define IOART_DELEXINT	0x00000700	/*       External INTerrupt */
924*c8fe38aeSMatthew Dillon 
925*c8fe38aeSMatthew Dillon /*
926*c8fe38aeSMatthew Dillon  * The interrupt vector.  Valid values range from 0x10 to 0xFE.
927*c8fe38aeSMatthew Dillon  */
928*c8fe38aeSMatthew Dillon #define IOART_INTVEC	0x000000ff	/* R/W: INTerrupt vector field */
929*c8fe38aeSMatthew Dillon 
930*c8fe38aeSMatthew Dillon #endif /* _MACHINE_APIC_H_ */
931