]> git.saurik.com Git - apple/xnu.git/blame - osfmk/i386/apic.h
xnu-792.12.6.tar.gz
[apple/xnu.git] / osfmk / i386 / apic.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
8ad349bb 4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
1c79356b 5 *
8ad349bb
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
1c79356b
A
29 */
30/*
31 * @OSF_COPYRIGHT@
32 *
33 */
91447636
A
34#ifndef _I386_APIC_H_
35#define _I386_APIC_H_
1c79356b
A
36
37#define LAPIC_START 0xFEE00000
38#define LAPIC_SIZE 0x00000400
39
40#define LAPIC_ID 0x00000020
41#define LAPIC_ID_SHIFT 24
42#define LAPIC_ID_MASK 0x0F
43#define LAPIC_VERSION 0x00000030
44#define LAPIC_VERSION_MASK 0xFF
45#define LAPIC_TPR 0x00000080
46#define LAPIC_TPR_MASK 0xFF
47#define LAPIC_APR 0x00000090
48#define LAPIC_APR_MASK 0xFF
49#define LAPIC_PPR 0x000000A0
50#define LAPIC_PPR_MASK 0xFF
51#define LAPIC_EOI 0x000000B0
52#define LAPIC_REMOTE_READ 0x000000C0
53#define LAPIC_LDR 0x000000D0
54#define LAPIC_LDR_SHIFT 24
55#define LAPIC_DFR 0x000000E0
56#define LAPIC_DFR_FLAT 0xFFFFFFFF
57#define LAPIC_DFR_CLUSTER 0x0FFFFFFF
58#define LAPIC_DFR_SHIFT 28
59#define LAPIC_SVR 0x000000F0
60#define LAPIC_SVR_MASK 0x0FF
61#define LAPIC_SVR_ENABLE 0x100
62#define LAPIC_SVR_FOCUS_OFF 0x200
63#define LAPIC_ISR_BASE 0x00000100
64#define LAPIC_TMR_BASE 0x00000180
65#define LAPIC_IRR_BASE 0x00000200
66#define LAPIC_ERROR_STATUS 0x00000280
67#define LAPIC_ICR 0x00000300
68#define LAPIC_ICR_VECTOR_MASK 0x000FF
69#define LAPIC_ICR_DM_MASK 0x00700
70#define LAPIC_ICR_DM_FIXED 0x00000
71#define LAPIC_ICR_DM_LOWEST 0x00100
72#define LAPIC_ICR_DM_SMI 0x00200
73#define LAPIC_ICR_DM_REMOTE 0x00300
74#define LAPIC_ICR_DM_NMI 0x00400
75#define LAPIC_ICR_DM_INIT 0x00500
76#define LAPIC_ICR_DM_STARTUP 0x00600
77#define LAPIC_ICR_DM_LOGICAL 0x00800
78#define LAPIC_ICR_DS_PENDING 0x01000
79#define LAPIC_ICR_LEVEL_ASSERT 0x04000
80#define LAPIC_ICR_TRIGGER_LEVEL 0x08000
81#define LAPIC_ICR_RR_MASK 0x30000
82#define LAPIC_ICR_RR_INVALID 0x00000
83#define LAPIC_ICR_RR_INPROGRESS 0x10000
84#define LAPIC_ICR_RR_VALID 0x20000
85#define LAPIC_ICR_DSS_MASK 0xC0000
86#define LAPIC_ICR_DSS_DEST 0x00000
87#define LAPIC_ICR_DSS_SELF 0x40000
88#define LAPIC_ICR_DSS_ALL 0x80000
89#define LAPIC_ICR_DSS_OTHERS 0xC0000
90#define LAPIC_ICRD 0x00000310
91#define LAPIC_ICRD_DEST_SHIFT 24
92#define LAPIC_LVT_TIMER 0x00000320
55e303ae
A
93#define LAPIC_LVT_THERMAL 0x00000330
94#define LAPIC_LVT_PERFCNT 0x00000340
1c79356b
A
95#define LAPIC_LVT_LINT0 0x00000350
96#define LAPIC_LVT_LINT1 0x00000360
97#define LAPIC_LVT_ERROR 0x00000370
55e303ae 98#define LAPIC_LVT_VECTOR_MASK 0x000FF
1c79356b
A
99#define LAPIC_LVT_DM_SHIFT 8
100#define LAPIC_LVT_DM_MASK 0x00007
101#define LAPIC_LVT_DM_FIXED 0x00000
102#define LAPIC_LVT_DM_NMI 0x00400
103#define LAPIC_LVT_DM_EXTINT 0x00700
104#define LAPIC_LVT_DS_PENDING 0x01000
105#define LAPIC_LVT_IP_PLRITY_LOW 0x02000
106#define LAPIC_LVT_REMOTE_IRR 0x04000
107#define LAPIC_LVT_TM_LEVEL 0x08000
108#define LAPIC_LVT_MASKED 0x10000
109#define LAPIC_LVT_PERIODIC 0x20000
91447636
A
110#define LAPIC_TIMER_INITIAL_COUNT 0x00000380
111#define LAPIC_TIMER_CURRENT_COUNT 0x00000390
1c79356b 112#define LAPIC_TIMER_DIVIDE_CONFIG 0x000003E0
91447636
A
113/* divisor encoded by bits 0,1,3 with bit 2 always 0: */
114#define LAPIC_TIMER_DIVIDE_MASK 0x0000000F
115#define LAPIC_TIMER_DIVIDE_2 0x00000000
116#define LAPIC_TIMER_DIVIDE_4 0x00000001
117#define LAPIC_TIMER_DIVIDE_8 0x00000002
118#define LAPIC_TIMER_DIVIDE_16 0x00000003
119#define LAPIC_TIMER_DIVIDE_32 0x00000008
120#define LAPIC_TIMER_DIVIDE_64 0x00000009
121#define LAPIC_TIMER_DIVIDE_128 0x0000000A
122#define LAPIC_TIMER_DIVIDE_1 0x0000000B
123
124#ifndef ASSEMBLER
125#include <stdint.h>
126typedef enum {
127 periodic,
128 one_shot
129} lapic_timer_mode_t;
130typedef enum {
131 divide_by_1 = LAPIC_TIMER_DIVIDE_1,
132 divide_by_2 = LAPIC_TIMER_DIVIDE_2,
133 divide_by_4 = LAPIC_TIMER_DIVIDE_4,
134 divide_by_8 = LAPIC_TIMER_DIVIDE_8,
135 divide_by_16 = LAPIC_TIMER_DIVIDE_16,
136 divide_by_32 = LAPIC_TIMER_DIVIDE_32,
137 divide_by_64 = LAPIC_TIMER_DIVIDE_64,
138 divide_by_128 = LAPIC_TIMER_DIVIDE_128
139} lapic_timer_divide_t;
140typedef uint32_t lapic_timer_count_t;
141#endif /* ASSEMBLER */
1c79356b
A
142
143#define IOAPIC_START 0xFEC00000
144#define IOAPIC_SIZE 0x00000020
145
146#define IOAPIC_RSELECT 0x00000000
147#define IOAPIC_RWINDOW 0x00000010
148#define IOA_R_ID 0x00
149#define IOA_R_ID_SHIFT 24
150#define IOA_R_VERSION 0x01
151#define IOA_R_VERSION_MASK 0xFF
152#define IOA_R_VERSION_ME_SHIFT 16
153#define IOA_R_VERSION_ME_MASK 0xFF
154#define IOA_R_REDIRECTION 0x10
155#define IOA_R_R_VECTOR_MASK 0x000FF
156#define IOA_R_R_DM_MASK 0x00700
157#define IOA_R_R_DM_FIXED 0x00000
158#define IOA_R_R_DM_LOWEST 0x00100
159#define IOA_R_R_DM_NMI 0x00400
160#define IOA_R_R_DM_RESET 0x00500
161#define IOA_R_R_DM_EXTINT 0x00700
162#define IOA_R_R_DEST_LOGICAL 0x00800
163#define IOA_R_R_DS_PENDING 0x01000
164#define IOA_R_R_IP_PLRITY_LOW 0x02000
165#define IOA_R_R_TM_LEVEL 0x08000
166#define IOA_R_R_MASKED 0x10000
91447636
A
167
168#endif /* _I386_APIC_H_ */
169