1 /* $OpenBSD: i82489reg.h,v 1.2 2004/06/13 21:49:16 niklas Exp $ */
2 /* $NetBSD: i82489reg.h,v 1.1.2.1 2000/02/20 16:30:27 sommerfeld Exp $ */
3
4 /*-
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Frank van der Linden.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the NetBSD
22 * Foundation, Inc. and its contributors.
23 * 4. Neither the name of The NetBSD Foundation nor the names of its
24 * contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40
41 /*
42 * Registers and constants for the 82489DX and Pentium (and up) integrated
43 * "local" APIC.
44 */
45
46 #define LAPIC_ID 0x020 /* ID. RW */
47 # define LAPIC_ID_MASK 0x0f000000
48 # define LAPIC_ID_SHIFT 24
49
50 #define LAPIC_VERS 0x030 /* Version. R */
51 # define LAPIC_VERSION_MASK 0x000000ff
52 # define LAPIC_VERSION_LVT_MASK 0x00ff0000
53 # define LAPIC_VERSION_LVT_SHIFT 16
54
55 #define LAPIC_TPRI 0x080 /* Task Prio. RW */
56 # define LAPIC_TPRI_MASK 0x000000ff
57 # define LAPIC_TPRI_INT_MASK 0x000000f0
58 # define LAPIC_TPRI_SUB_MASK 0x0000000f
59
60 #define LAPIC_APRI 0x090 /* Arbitration prio R */
61 # define LAPIC_APRI_MASK 0x000000ff
62
63 #define LAPIC_PPRI 0x0a0 /* Processor prio. R */
64 #define LAPIC_EOI 0x0b0 /* End Int. W */
65 #define LAPIC_RRR 0x0c0 /* Remote read R */
66 #define LAPIC_LDR 0x0d0 /* Logical dest. RW */
67 #define LAPIC_DFR 0x0e0 /* Dest. format RW */
68
69 #define LAPIC_SVR 0x0f0 /* Spurious intvec RW */
70 # define LAPIC_SVR_VECTOR_MASK 0x000000ff
71 # define LAPIC_SVR_VEC_FIX 0x0000000f
72 # define LAPIC_SVR_VEC_PROG 0x000000f0
73 # define LAPIC_SVR_ENABLE 0x00000100
74 # define LAPIC_SVR_SWEN 0x00000100
75 # define LAPIC_SVR_FOCUS 0x00000200
76 # define LAPIC_SVR_FDIS 0x00000200
77
78 #define LAPIC_ISR 0x100 /* Int. status. R */
79 #define LAPIC_TMR 0x180
80 #define LAPIC_IRR 0x200
81 #define LAPIC_ESR 0x280 /* Err status. R */
82
83 #define LAPIC_ICRLO 0x300 /* Int. cmd. RW */
84 # define LAPIC_DLMODE_MASK 0x00000700
85 # define LAPIC_DLMODE_FIXED 0x00000000
86 # define LAPIC_DLMODE_LOW 0x00000100
87 # define LAPIC_DLMODE_SMI 0x00000200
88 # define LAPIC_DLMODE_RR 0x00000300
89 # define LAPIC_DLMODE_NMI 0x00000400
90 # define LAPIC_DLMODE_INIT 0x00000500
91 # define LAPIC_DLMODE_STARTUP 0x00000600
92
93 # define LAPIC_DSTMODE_LOG 0x00000800
94
95 # define LAPIC_DLSTAT_BUSY 0x00001000
96
97 # define LAPIC_LVL_ASSERT 0x00004000
98 # define LAPIC_LVL_DEASSERT 0x00000000
99
100 # define LAPIC_LVL_TRIG 0x00008000
101
102 # define LAPIC_RRSTAT_MASK 0x00030000
103 # define LAPIC_RRSTAT_INPROG 0x00010000
104 # define LAPIC_RRSTAT_VALID 0x00020000
105
106 # define LAPIC_DEST_MASK 0x000c0000
107 # define LAPIC_DEST_SELF 0x00040000
108 # define LAPIC_DEST_ALLINCL 0x00080000
109 # define LAPIC_DEST_ALLEXCL 0x000c0000
110
111 # define LAPIC_RESV2_MASK 0xfff00000
112
113
114 #define LAPIC_ICRHI 0x310 /* Int. cmd. RW */
115 # define LAPIC_ID_MASK 0x0f000000
116 # define LAPIC_ID_SHIFT 24
117
118 #define LAPIC_LVTT 0x320 /* Loc.vec.(timer) RW */
119 # define LAPIC_LVTT_VEC_MASK 0x000000ff
120 # define LAPIC_LVTT_DS 0x00001000
121 # define LAPIC_LVTT_M 0x00010000
122 # define LAPIC_LVTT_TM 0x00020000
123
124 #define LAPIC_PCINT 0x340
125 #define LAPIC_LVINT0 0x350 /* Loc.vec (LINT0) RW */
126 # define LAPIC_LVT_PERIODIC 0x00020000
127 # define LAPIC_LVT_MASKED 0x00010000
128 # define LAPIC_LVT_LEVTRIG 0x00008000
129 # define LAPIC_LVT_REMOTE_IRR 0x00004000
130 # define LAPIC_INP_POL 0x00002000
131 # define LAPIC_PEND_SEND 0x00001000
132
133 #define LAPIC_LVINT1 0x360 /* Loc.vec (LINT1) RW */
134 #define LAPIC_LVERR 0x370 /* Loc.vec (ERROR) RW */
135 #define LAPIC_ICR_TIMER 0x380 /* Initial count RW */
136 #define LAPIC_CCR_TIMER 0x390 /* Current count RO */
137
138 #define LAPIC_DCR_TIMER 0x3e0 /* Divisor config register */
139 # define LAPIC_DCRT_DIV1 0x0b
140 # define LAPIC_DCRT_DIV2 0x00
141 # define LAPIC_DCRT_DIV4 0x01
142 # define LAPIC_DCRT_DIV8 0x02
143 # define LAPIC_DCRT_DIV16 0x03
144 # define LAPIC_DCRT_DIV32 0x08
145 # define LAPIC_DCRT_DIV64 0x09
146 # define LAPIC_DCRT_DIV128 0x0a
147
148 #define LAPIC_BASE 0xfee00000
149
150 #define LAPIC_IRQ_MASK(i) (1 << ((i) + 1))