VirtualBox

source: vbox/trunk/include/VBox/apic.h

Last change on this file was 106061, checked in by vboxsync, 7 weeks ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.7 KB
RevLine 
[33935]1/** @file
2 * X86 (and AMD64) Local APIC registers (VMM,++).
3 *
4 * apic.mac is generated from this file by running 'kmk incs' in the root.
5 */
6
7/*
[106061]8 * Copyright (C) 2010-2024 Oracle and/or its affiliates.
[33935]9 *
[96407]10 * This file is part of VirtualBox base platform packages, as
11 * available from https://www.virtualbox.org.
[33935]12 *
[96407]13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation, in version 3 of the
16 * License.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, see <https://www.gnu.org/licenses>.
25 *
[33935]26 * The contents of this file may alternatively be used under the terms
27 * of the Common Development and Distribution License Version 1.0
[96407]28 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
29 * in the VirtualBox distribution, in which case the provisions of the
[33935]30 * CDDL are applicable instead of those of the GPL.
31 *
32 * You may elect to license modified versions of this file under the
33 * terms and conditions of either the GPL or the CDDL or both.
[96407]34 *
35 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
[33935]36 */
37
[76558]38#ifndef VBOX_INCLUDED_apic_h
39#define VBOX_INCLUDED_apic_h
[76507]40#ifndef RT_WITHOUT_PRAGMA_ONCE
41# pragma once
42#endif
[33935]43
[36536]44#include <iprt/types.h>
[84652]45#include <iprt/x86.h>
[36536]46
[84652]47/** @todo These are defines used by CPUM and perhaps some assembly code. Remove
48 * these and use the XAPIC counterpart defines below later. */
[33935]49#define APIC_REG_VERSION 0x0030
[44004]50#define APIC_REG_VERSION_GET_VER(u32) (u32 & 0xff)
51#define APIC_REG_VERSION_GET_MAX_LVT(u32) ((u32 & 0xff0000) >> 16)
[33935]52
[44004]53/* Defines according to Figure 10-8 of the Intel Software Developers Manual Vol 3A */
[33935]54#define APIC_REG_LVT_LINT0 0x0350
55#define APIC_REG_LVT_LINT1 0x0360
56#define APIC_REG_LVT_ERR 0x0370
57#define APIC_REG_LVT_PC 0x0340
58#define APIC_REG_LVT_THMR 0x0330
[53835]59#define APIC_REG_LVT_CMCI 0x02F0
[54496]60#define APIC_REG_EILVT0 0x0500
61#define APIC_REG_EILVT1 0x0510
62#define APIC_REG_EILVT2 0x0520
[55254]63#define APIC_REG_EILVT3 0x0530
[44004]64#define APIC_REG_LVT_MODE_MASK (RT_BIT(8) | RT_BIT(9) | RT_BIT(10))
65#define APIC_REG_LVT_MODE_FIXED 0
66#define APIC_REG_LVT_MODE_NMI RT_BIT(10)
67#define APIC_REG_LVT_MODE_EXTINT (RT_BIT(8) | RT_BIT(9) | RT_BIT(10))
68#define APIC_REG_LVT_PIN_POLARIY RT_BIT(13)
69#define APIC_REG_LVT_REMOTE_IRR RT_BIT(14)
70#define APIC_REG_LVT_LEVEL_TRIGGER RT_BIT(15)
71#define APIC_REG_LVT_MASKED RT_BIT(16)
[33935]72
[84652]73/** The APIC hardware version number for Pentium 4. */
74#define XAPIC_HARDWARE_VERSION_P4 UINT8_C(0x14)
75/** Maximum number of LVT entries for Pentium 4. */
76#define XAPIC_MAX_LVT_ENTRIES_P4 UINT8_C(6)
77/** Size of the APIC ID bits for Pentium 4. */
78#define XAPIC_APIC_ID_BIT_COUNT_P4 UINT8_C(8)
79
80/** The APIC hardware version number for Pentium 6. */
81#define XAPIC_HARDWARE_VERSION_P6 UINT8_C(0x10)
82/** Maximum number of LVT entries for Pentium 6. */
83#define XAPIC_MAX_LVT_ENTRIES_P6 UINT8_C(4)
84/** Size of the APIC ID bits for Pentium 6. */
85#define XAPIC_APIC_ID_BIT_COUNT_P6 UINT8_C(4)
86
87/** Illegal APIC vector value start. */
88#define XAPIC_ILLEGAL_VECTOR_START UINT8_C(0)
89/** Illegal APIC vector value end (inclusive). */
90#define XAPIC_ILLEGAL_VECTOR_END UINT8_C(15)
91/** Reserved APIC vector value start. */
92#define XAPIC_RSVD_VECTOR_START UINT8_C(16)
93/** Reserved APIC vector value end (inclusive). */
94#define XAPIC_RSVD_VECTOR_END UINT8_C(31)
95
96/** ESR - Send checksum error for Pentium 6. */
97# define XAPIC_ESR_SEND_CHKSUM_ERROR_P6 RT_BIT(0)
98/** ESR - Send accept error for Pentium 6. */
99# define XAPIC_ESR_RECV_CHKSUM_ERROR_P6 RT_BIT(1)
100/** ESR - Send accept error for Pentium 6. */
101# define XAPIC_ESR_SEND_ACCEPT_ERROR_P6 RT_BIT(2)
102/** ESR - Receive accept error for Pentium 6. */
103# define XAPIC_ESR_RECV_ACCEPT_ERROR_P6 RT_BIT(3)
104
105/** ESR - Redirectable IPI. */
106#define XAPIC_ESR_REDIRECTABLE_IPI RT_BIT(4)
107/** ESR - Send accept error. */
108#define XAPIC_ESR_SEND_ILLEGAL_VECTOR RT_BIT(5)
109/** ESR - Send accept error. */
110#define XAPIC_ESR_RECV_ILLEGAL_VECTOR RT_BIT(6)
111/** ESR - Send accept error. */
112#define XAPIC_ESR_ILLEGAL_REG_ADDRESS RT_BIT(7)
113/** ESR - Valid write-only bits. */
114#define XAPIC_ESR_WO_VALID UINT32_C(0x0)
115
116/** TPR - Valid bits. */
117#define XAPIC_TPR_VALID UINT32_C(0xff)
118/** TPR - Task-priority class. */
119#define XAPIC_TPR_TP UINT32_C(0xf0)
120/** TPR - Task-priority subclass. */
121#define XAPIC_TPR_TP_SUBCLASS UINT32_C(0x0f)
122/** TPR - Gets the task-priority class. */
123#define XAPIC_TPR_GET_TP(a_Tpr) ((a_Tpr) & XAPIC_TPR_TP)
124/** TPR - Gets the task-priority subclass. */
125#define XAPIC_TPR_GET_TP_SUBCLASS(a_Tpr) ((a_Tpr) & XAPIC_TPR_TP_SUBCLASS)
126
127/** PPR - Valid bits. */
128#define XAPIC_PPR_VALID UINT32_C(0xff)
129/** PPR - Processor-priority class. */
130#define XAPIC_PPR_PP UINT32_C(0xf0)
131/** PPR - Processor-priority subclass. */
132#define XAPIC_PPR_PP_SUBCLASS UINT32_C(0x0f)
133/** PPR - Get the processor-priority class. */
134#define XAPIC_PPR_GET_PP(a_Ppr) ((a_Ppr) & XAPIC_PPR_PP)
135/** PPR - Get the processor-priority subclass. */
136#define XAPIC_PPR_GET_PP_SUBCLASS(a_Ppr) ((a_Ppr) & XAPIC_PPR_PP_SUBCLASS)
137
138/** Timer mode - One-shot. */
139#define XAPIC_TIMER_MODE_ONESHOT UINT32_C(0)
140/** Timer mode - Periodic. */
141#define XAPIC_TIMER_MODE_PERIODIC UINT32_C(1)
142/** Timer mode - TSC deadline. */
143#define XAPIC_TIMER_MODE_TSC_DEADLINE UINT32_C(2)
144
145/** LVT - The vector. */
146#define XAPIC_LVT_VECTOR UINT32_C(0xff)
147/** LVT - Gets the vector from an LVT entry. */
148#define XAPIC_LVT_GET_VECTOR(a_Lvt) ((a_Lvt) & XAPIC_LVT_VECTOR)
149/** LVT - The mask. */
150#define XAPIC_LVT_MASK RT_BIT(16)
151/** LVT - Is the LVT masked? */
152#define XAPIC_LVT_IS_MASKED(a_Lvt) RT_BOOL((a_Lvt) & XAPIC_LVT_MASK)
153/** LVT - Timer mode. */
154#define XAPIC_LVT_TIMER_MODE RT_BIT(17)
155/** LVT - Timer TSC-deadline timer mode. */
156#define XAPIC_LVT_TIMER_TSCDEADLINE RT_BIT(18)
157/** LVT - Gets the timer mode. */
158#define XAPIC_LVT_GET_TIMER_MODE(a_Lvt) (XAPICTIMERMODE)(((a_Lvt) >> 17) & UINT32_C(3))
159/** LVT - Delivery mode. */
160#define XAPIC_LVT_DELIVERY_MODE (RT_BIT(8) | RT_BIT(9) | RT_BIT(10))
161/** LVT - Gets the delivery mode. */
162#define XAPIC_LVT_GET_DELIVERY_MODE(a_Lvt) (XAPICDELIVERYMODE)(((a_Lvt) >> 8) & UINT32_C(7))
163/** LVT - Delivery status. */
164#define XAPIC_LVT_DELIVERY_STATUS RT_BIT(12)
165/** LVT - Trigger mode. */
166#define XAPIC_LVT_TRIGGER_MODE RT_BIT(15)
167/** LVT - Gets the trigger mode. */
168#define XAPIC_LVT_GET_TRIGGER_MODE(a_Lvt) (XAPICTRIGGERMODE)(((a_Lvt) >> 15) & UINT32_C(1))
169/** LVT - Remote IRR. */
170#define XAPIC_LVT_REMOTE_IRR RT_BIT(14)
171/** LVT - Gets the Remote IRR. */
172#define XAPIC_LVT_GET_REMOTE_IRR(a_Lvt) (((a_Lvt) >> 14) & 1)
173/** LVT - Interrupt Input Pin Polarity. */
174#define XAPIC_LVT_POLARITY RT_BIT(13)
175/** LVT - Gets the Interrupt Input Pin Polarity. */
176#define XAPIC_LVT_GET_POLARITY(a_Lvt) (((a_Lvt) >> 13) & 1)
177/** LVT - Valid bits common to all LVTs. */
178#define XAPIC_LVT_COMMON_VALID (XAPIC_LVT_VECTOR | XAPIC_LVT_DELIVERY_STATUS | XAPIC_LVT_MASK)
179/** LVT CMCI - Valid bits. */
180#define XAPIC_LVT_CMCI_VALID (XAPIC_LVT_COMMON_VALID | XAPIC_LVT_DELIVERY_MODE)
181/** LVT Timer - Valid bits. */
182#define XAPIC_LVT_TIMER_VALID (XAPIC_LVT_COMMON_VALID | XAPIC_LVT_TIMER_MODE | XAPIC_LVT_TIMER_TSCDEADLINE)
183/** LVT Thermal - Valid bits. */
184#define XAPIC_LVT_THERMAL_VALID (XAPIC_LVT_COMMON_VALID | XAPIC_LVT_DELIVERY_MODE)
185/** LVT Perf - Valid bits. */
186#define XAPIC_LVT_PERF_VALID (XAPIC_LVT_COMMON_VALID | XAPIC_LVT_DELIVERY_MODE)
187/** LVT LINTx - Valid bits. */
188#define XAPIC_LVT_LINT_VALID ( XAPIC_LVT_COMMON_VALID | XAPIC_LVT_DELIVERY_MODE | XAPIC_LVT_DELIVERY_STATUS \
189 | XAPIC_LVT_POLARITY | XAPIC_LVT_REMOTE_IRR | XAPIC_LVT_TRIGGER_MODE)
190/** LVT Error - Valid bits. */
191#define XAPIC_LVT_ERROR_VALID (XAPIC_LVT_COMMON_VALID)
192
193/** SVR - The vector. */
194#define XAPIC_SVR_VECTOR UINT32_C(0xff)
195/** SVR - APIC Software enable. */
196#define XAPIC_SVR_SOFTWARE_ENABLE RT_BIT(8)
197/** SVR - Supress EOI broadcast. */
198#define XAPIC_SVR_SUPRESS_EOI_BROADCAST RT_BIT(12)
199/** SVR - Valid bits for Pentium 4. */
200# define XAPIC_SVR_VALID_P4 (XAPIC_SVR_VECTOR | XAPIC_SVR_SOFTWARE_ENABLE)
201/** @todo SVR - Valid bits for Pentium 6. */
202
203/** DFR - Valid bits. */
204#define XAPIC_DFR_VALID UINT32_C(0xf0000000)
205/** DFR - Reserved bits that must always remain set. */
206#define XAPIC_DFR_RSVD_MB1 UINT32_C(0x0fffffff)
207/** DFR - The model. */
208#define XAPIC_DFR_MODEL UINT32_C(0xf)
209/** DFR - Gets the destination model. */
210#define XAPIC_DFR_GET_MODEL(a_uReg) (((a_uReg) >> 28) & XAPIC_DFR_MODEL)
211
212/** LDR - Valid bits. */
213#define XAPIC_LDR_VALID UINT32_C(0xff000000)
214/** LDR - Cluster ID mask (x2APIC). */
215#define X2APIC_LDR_CLUSTER_ID UINT32_C(0xffff0000)
216/** LDR - Mask of the LDR cluster ID (x2APIC). */
217#define X2APIC_LDR_GET_CLUSTER_ID(a_uReg) ((a_uReg) & X2APIC_LDR_CLUSTER_ID)
218/** LDR - Mask of the LDR logical ID (x2APIC). */
219#define X2APIC_LDR_LOGICAL_ID UINT32_C(0x0000ffff)
220
221/** LDR - Flat mode logical ID mask. */
222#define XAPIC_LDR_FLAT_LOGICAL_ID UINT32_C(0xff)
223/** LDR - Clustered mode cluster ID mask. */
224#define XAPIC_LDR_CLUSTERED_CLUSTER_ID UINT32_C(0xf0)
225/** LDR - Clustered mode logical ID mask. */
226#define XAPIC_LDR_CLUSTERED_LOGICAL_ID UINT32_C(0x0f)
227/** LDR - Gets the clustered mode cluster ID. */
228#define XAPIC_LDR_CLUSTERED_GET_CLUSTER_ID(a_uReg) ((a_uReg) & XAPIC_LDR_CLUSTERED_CLUSTER_ID)
229
230
231/** EOI - Valid write-only bits. */
232#define XAPIC_EOI_WO_VALID UINT32_C(0x0)
233/** Timer ICR - Valid bits. */
234#define XAPIC_TIMER_ICR_VALID UINT32_C(0xffffffff)
235/** Timer DCR - Valid bits. */
236#define XAPIC_TIMER_DCR_VALID (RT_BIT(0) | RT_BIT(1) | RT_BIT(3))
237
238/** Self IPI - Valid bits. */
239#define XAPIC_SELF_IPI_VALID UINT32_C(0xff)
240/** Self IPI - The vector. */
241#define XAPIC_SELF_IPI_VECTOR UINT32_C(0xff)
242/** Self IPI - Gets the vector. */
243#define XAPIC_SELF_IPI_GET_VECTOR(a_uReg) ((a_uReg) & XAPIC_SELF_IPI_VECTOR)
244
245/** ICR Low - The Vector. */
246#define XAPIC_ICR_LO_VECTOR UINT32_C(0xff)
247/** ICR Low - Gets the vector. */
248#define XAPIC_ICR_LO_GET_VECTOR(a_uIcr) ((a_uIcr) & XAPIC_ICR_LO_VECTOR)
249/** ICR Low - The delivery mode. */
250#define XAPIC_ICR_LO_DELIVERY_MODE (RT_BIT(8) | RT_BIT(9) | RT_BIT(10))
251/** ICR Low - The destination mode. */
252#define XAPIC_ICR_LO_DEST_MODE RT_BIT(11)
253/** ICR Low - The delivery status. */
254#define XAPIC_ICR_LO_DELIVERY_STATUS RT_BIT(12)
255/** ICR Low - The level. */
256#define XAPIC_ICR_LO_LEVEL RT_BIT(14)
257/** ICR Low - The trigger mode. */
258#define XAPIC_ICR_TRIGGER_MODE RT_BIT(15)
259/** ICR Low - The destination shorthand. */
260#define XAPIC_ICR_LO_DEST_SHORTHAND (RT_BIT(18) | RT_BIT(19))
261/** ICR Low - Valid write bits. */
262#define XAPIC_ICR_LO_WR_VALID ( XAPIC_ICR_LO_VECTOR | XAPIC_ICR_LO_DELIVERY_MODE | XAPIC_ICR_LO_DEST_MODE \
263 | XAPIC_ICR_LO_LEVEL | XAPIC_ICR_TRIGGER_MODE | XAPIC_ICR_LO_DEST_SHORTHAND)
264
265/** ICR High - The destination field. */
266#define XAPIC_ICR_HI_DEST UINT32_C(0xff000000)
267/** ICR High - Get the destination field. */
268#define XAPIC_ICR_HI_GET_DEST(a_u32IcrHi) (((a_u32IcrHi) >> 24) & XAPIC_ICR_HI_DEST)
269/** ICR High - Valid write bits in xAPIC mode. */
270#define XAPIC_ICR_HI_WR_VALID XAPIC_ICR_HI_DEST
271
272/** APIC ID broadcast mask - x2APIC mode. */
273#define X2APIC_ID_BROADCAST_MASK UINT32_C(0xffffffff)
274/** APIC ID broadcast mask - xAPIC mode for Pentium 4. */
275# define XAPIC_ID_BROADCAST_MASK_P4 UINT32_C(0xff)
276/** @todo Broadcast mask for Pentium 6. */
277
278/** Get an xAPIC page offset for an x2APIC MSR value. */
279#define X2APIC_GET_XAPIC_OFF(a_uMsr) ((((a_uMsr) - MSR_IA32_X2APIC_START) << 4) & UINT32_C(0xff0))
280/** Get an x2APIC MSR for an xAPIC page offset. */
281#define XAPIC_GET_X2APIC_MSR(a_offReg) ((((a_offReg) & UINT32_C(0xff0)) >> 4) | MSR_IA32_X2APIC_START)
282
283/** @name xAPIC and x2APIC register offsets.
284 * See Intel spec. 10.4.1 "The Local APIC Block Diagram".
285 * @{ */
286/** Offset of APIC ID Register. */
287#define XAPIC_OFF_ID 0x020
288/** Offset of APIC Version Register. */
289#define XAPIC_OFF_VERSION 0x030
290/** Offset of Task Priority Register. */
291#define XAPIC_OFF_TPR 0x080
292/** Offset of Arbitrartion Priority register. */
293#define XAPIC_OFF_APR 0x090
294/** Offset of Processor Priority register. */
295#define XAPIC_OFF_PPR 0x0A0
296/** Offset of End Of Interrupt register. */
297#define XAPIC_OFF_EOI 0x0B0
298/** Offset of Remote Read Register. */
299#define XAPIC_OFF_RRD 0x0C0
300/** Offset of Logical Destination Register. */
301#define XAPIC_OFF_LDR 0x0D0
302/** Offset of Destination Format Register. */
303#define XAPIC_OFF_DFR 0x0E0
304/** Offset of Spurious Interrupt Vector Register. */
305#define XAPIC_OFF_SVR 0x0F0
306/** Offset of In-service Register (bits 31:0). */
307#define XAPIC_OFF_ISR0 0x100
308/** Offset of In-service Register (bits 63:32). */
309#define XAPIC_OFF_ISR1 0x110
310/** Offset of In-service Register (bits 95:64). */
311#define XAPIC_OFF_ISR2 0x120
312/** Offset of In-service Register (bits 127:96). */
313#define XAPIC_OFF_ISR3 0x130
314/** Offset of In-service Register (bits 159:128). */
315#define XAPIC_OFF_ISR4 0x140
316/** Offset of In-service Register (bits 191:160). */
317#define XAPIC_OFF_ISR5 0x150
318/** Offset of In-service Register (bits 223:192). */
319#define XAPIC_OFF_ISR6 0x160
320/** Offset of In-service Register (bits 255:224). */
321#define XAPIC_OFF_ISR7 0x170
322/** Offset of Trigger Mode Register (bits 31:0). */
323#define XAPIC_OFF_TMR0 0x180
324/** Offset of Trigger Mode Register (bits 63:32). */
325#define XAPIC_OFF_TMR1 0x190
326/** Offset of Trigger Mode Register (bits 95:64). */
327#define XAPIC_OFF_TMR2 0x1A0
328/** Offset of Trigger Mode Register (bits 127:96). */
329#define XAPIC_OFF_TMR3 0x1B0
330/** Offset of Trigger Mode Register (bits 159:128). */
331#define XAPIC_OFF_TMR4 0x1C0
332/** Offset of Trigger Mode Register (bits 191:160). */
333#define XAPIC_OFF_TMR5 0x1D0
334/** Offset of Trigger Mode Register (bits 223:192). */
335#define XAPIC_OFF_TMR6 0x1E0
336/** Offset of Trigger Mode Register (bits 255:224). */
337#define XAPIC_OFF_TMR7 0x1F0
338/** Offset of Interrupt Request Register (bits 31:0). */
339#define XAPIC_OFF_IRR0 0x200
340/** Offset of Interrupt Request Register (bits 63:32). */
341#define XAPIC_OFF_IRR1 0x210
342/** Offset of Interrupt Request Register (bits 95:64). */
343#define XAPIC_OFF_IRR2 0x220
344/** Offset of Interrupt Request Register (bits 127:96). */
345#define XAPIC_OFF_IRR3 0x230
346/** Offset of Interrupt Request Register (bits 159:128). */
347#define XAPIC_OFF_IRR4 0x240
348/** Offset of Interrupt Request Register (bits 191:160). */
349#define XAPIC_OFF_IRR5 0x250
350/** Offset of Interrupt Request Register (bits 223:192). */
351#define XAPIC_OFF_IRR6 0x260
352/** Offset of Interrupt Request Register (bits 255:224). */
353#define XAPIC_OFF_IRR7 0x270
354/** Offset of Error Status Register. */
355#define XAPIC_OFF_ESR 0x280
356/** Offset of LVT CMCI Register. */
357#define XAPIC_OFF_LVT_CMCI 0x2F0
358/** Offset of Interrupt Command Register - Lo. */
359#define XAPIC_OFF_ICR_LO 0x300
360/** Offset of Interrupt Command Register - Hi. */
361#define XAPIC_OFF_ICR_HI 0x310
362/** Offset of LVT Timer Register. */
363#define XAPIC_OFF_LVT_TIMER 0x320
364/** Offset of LVT Thermal Sensor Register. */
365#define XAPIC_OFF_LVT_THERMAL 0x330
366/** Offset of LVT Performance Counter Register. */
367#define XAPIC_OFF_LVT_PERF 0x340
368/** Offset of LVT LINT0 Register. */
369#define XAPIC_OFF_LVT_LINT0 0x350
370/** Offset of LVT LINT1 Register. */
371#define XAPIC_OFF_LVT_LINT1 0x360
372/** Offset of LVT Error Register . */
373#define XAPIC_OFF_LVT_ERROR 0x370
374/** Offset of Timer Initial Count Register. */
375#define XAPIC_OFF_TIMER_ICR 0x380
376/** Offset of Timer Current Count Register. */
377#define XAPIC_OFF_TIMER_CCR 0x390
378/** Offset of Timer Divide Configuration Register. */
379#define XAPIC_OFF_TIMER_DCR 0x3E0
380/** Offset of Self-IPI Register (x2APIC only). */
381#define X2APIC_OFF_SELF_IPI 0x3F0
382
383/** Offset of LVT range start. */
384#define XAPIC_OFF_LVT_START XAPIC_OFF_LVT_TIMER
385/** Offset of LVT range end (inclusive). */
386#define XAPIC_OFF_LVT_END XAPIC_OFF_LVT_ERROR
387/** Offset of LVT extended range start. */
388#define XAPIC_OFF_LVT_EXT_START XAPIC_OFF_LVT_CMCI
389/** Offset of LVT extended range end (inclusive). */
390#define XAPIC_OFF_LVT_EXT_END XAPIC_OFF_LVT_CMCI
391/** Offset of the last register (incl. reserved) in the xAPIC/x2APIC range. */
392#define XAPIC_OFF_END 0x3F0
393/** @} */
394
395/** @name xAPIC Destination Format Register bits.
396 * See Intel spec. 10.6.2.2 "Logical Destination Mode".
397 * @{ */
398typedef enum XAPICDESTFORMAT
399{
400 XAPICDESTFORMAT_FLAT = 0xf,
401 XAPICDESTFORMAT_CLUSTER = 0
402} XAPICDESTFORMAT;
403/** @} */
404
405/** @name xAPIC Timer Mode bits.
406 * See Intel spec. 10.5.1 "Local Vector Table".
407 * @{ */
408typedef enum XAPICTIMERMODE
409{
410 XAPICTIMERMODE_ONESHOT = XAPIC_TIMER_MODE_ONESHOT,
411 XAPICTIMERMODE_PERIODIC = XAPIC_TIMER_MODE_PERIODIC,
412 XAPICTIMERMODE_TSC_DEADLINE = XAPIC_TIMER_MODE_TSC_DEADLINE
413} XAPICTIMERMODE;
414/** @} */
415
416/** @name xAPIC Interrupt Command Register bits.
417 * See Intel spec. 10.6.1 "Interrupt Command Register (ICR)".
418 * See Intel spec. 10.5.1 "Local Vector Table".
419 * @{ */
420/**
421 * xAPIC destination shorthand.
422 */
423typedef enum XAPICDESTSHORTHAND
424{
425 XAPICDESTSHORTHAND_NONE = 0,
426 XAPICDESTSHORTHAND_SELF,
427 XAPIDDESTSHORTHAND_ALL_INCL_SELF,
428 XAPICDESTSHORTHAND_ALL_EXCL_SELF
429} XAPICDESTSHORTHAND;
430
431/**
432 * xAPIC INIT level de-assert delivery mode.
433 */
434typedef enum XAPICINITLEVEL
435{
436 XAPICINITLEVEL_DEASSERT = 0,
437 XAPICINITLEVEL_ASSERT
438} XAPICLEVEL;
439
440/**
441 * xAPIC destination mode.
442 */
443typedef enum XAPICDESTMODE
444{
445 XAPICDESTMODE_PHYSICAL = 0,
446 XAPICDESTMODE_LOGICAL
447} XAPICDESTMODE;
448
449/**
450 * xAPIC delivery mode type.
451 */
452typedef enum XAPICDELIVERYMODE
453{
454 XAPICDELIVERYMODE_FIXED = 0,
455 XAPICDELIVERYMODE_LOWEST_PRIO = 1,
456 XAPICDELIVERYMODE_SMI = 2,
457 XAPICDELIVERYMODE_NMI = 4,
458 XAPICDELIVERYMODE_INIT = 5,
459 XAPICDELIVERYMODE_STARTUP = 6,
460 XAPICDELIVERYMODE_EXTINT = 7
461} XAPICDELIVERYMODE;
462
463/**
464 * xAPIC trigger mode.
465 */
466typedef enum XAPICTRIGGERMODE
467{
468 XAPICTRIGGERMODE_EDGE = 0,
469 XAPICTRIGGERMODE_LEVEL
470} XAPICTRIGGERMODE;
471/** @} */
472
473
[38959]474DECLINLINE(uint32_t) ApicRegRead(void *pvBase, uint32_t offReg)
[33935]475{
[38959]476 return *(const volatile uint32_t *)((uintptr_t)pvBase + offReg);
[33935]477}
478
[47844]479
[76557]480#ifdef IPRT_INCLUDED_asm_amd64_x86_h
[47844]481/**
482 * Reads an X2APIC register.
483 *
484 * @param offReg MMIO offset, APIC_REG_XXX.
485 */
486DECLINLINE(uint32_t) ApicX2RegRead32(uint32_t offReg)
487{
488 return ASMRdMsr((offReg >> 4) + MSR_IA32_X2APIC_START);
489}
490#endif
491
[76585]492#endif /* !VBOX_INCLUDED_apic_h */
[36536]493
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette