i82093reg.h revision 1.1.2.1 1 /*-
2 * Copyright (c) 2000 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by RedBack Networks Inc.
7 *
8 * Author: Bill Sommerfeld
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 by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND 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 THE FOUNDATION OR CONTRIBUTORS
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 /*
40 * Typically, the first apic lives here.
41 */
42 #define IOAPIC_BASE_DEFAULT 0xfec00000
43
44 /*
45 * Memory-space registers.
46 */
47
48 /*
49 * The externally visible registers are all 32 bits wide;
50 * store the register number of interest in IOAPIC_REG, and store/fetch
51 * the real value in IOAPIC_DATA.
52 */
53
54
55
56 #define IOAPIC_REG 0x0000
57 #define IOAPIC_DATA 0x0010
58
59 /*
60 * Internal I/O APIC registers.
61 */
62
63 #define IOAPIC_ID 0x00
64
65 #define IOAPIC_ID_SHIFT 24
66 #define IOAPIC_ID_MASK 0x0f000000
67
68 /* Version, and maximum interrupt pin number. */
69
70 #define IOAPIC_VER 0x01
71
72 #define IOAPIC_VER_SHIFT 0
73 #define IOAPIC_VER_MASK 0x000000ff
74
75 #define IOAPIC_MAX_SHIFT 16
76 #define IOAPIC_MAX_MASK 0x00ff0000
77
78 /*
79 * Arbitration ID. Same format as IOAPIC_ID register.
80 */
81 #define IOAPIC_ARB 0x02
82
83 /*
84 * Redirection table registers.
85 */
86
87 #define IOAPIC_REDHI(pin) (0x11 + ((pin)<<1))
88 #define IOAPIC_REDLO(pin) (0x10 + ((pin)<<1))
89
90 #define IOAPIC_REDHI_DEST_SHIFT 24 /* destination. */
91 #define IOAPIC_REDHI_DEST_MASK 0xff000000
92
93 #define IOAPIC_REDLO_MASK 0x00010000 /* 0=enabled; 1=masked */
94
95 #define IOAPIC_REDLO_LEVEL 0x00008000 /* 0=edge, 1=level */
96 #define IOAPIC_REDLO_RIRR 0x00004000 /* remote IRR; read only */
97 #define IOAPIC_REDLO_ACTLO 0x00002000 /* 0=act. hi; 1=act. lo */
98 #define IOAPIC_REDLO_DELSTS 0x00001000 /* 0=idle; 1=send pending */
99 #define IOAPIC_REDLO_DSTMOD 0x00000800 /* 0=physical; 1=logical */
100
101 #define IOAPIC_REDLO_DEL_MASK 0x00000700 /* del. mode mask */
102 #define IOAPIC_REDLO_DEL_SHIFT 8
103
104 #define IOAPIC_REDLO_DEL_FIXED 0
105 #define IOAPIC_REDLO_DEL_LOPRI 1
106 #define IOAPIC_REDLO_DEL_SMI 2
107 #define IOAPIC_REDLO_DEL_NMI 4
108 #define IOAPIC_REDLO_DEL_INIT 5
109 #define IOAPIC_REDLO_DEL_EXTINT 7
110
111 #define IOAPIC_REDLO_VECTOR_MASK 0x000000ff /* delivery vector */
112
113 #define IMCR_ADDR 0x22
114 #define IMCR_DATA 0x23
115
116 #define IMCR_REGISTER 0x70
117 #define IMCR_PIC 0x00
118 #define IMCR_APIC 0x01
119