1 | /** @file
|
---|
2 | * APIC - Advanced Programmable Interrupt Controller.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2022 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef VBOX_INCLUDED_vmm_apic_h
|
---|
27 | #define VBOX_INCLUDED_vmm_apic_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/types.h>
|
---|
33 | #include <VBox/apic.h>
|
---|
34 | struct PDMDEVREGCB;
|
---|
35 |
|
---|
36 | /** @defgroup grp_apic The local APIC VMM API
|
---|
37 | * @ingroup grp_vmm
|
---|
38 | * @{
|
---|
39 | */
|
---|
40 |
|
---|
41 | RT_C_DECLS_BEGIN
|
---|
42 |
|
---|
43 | #ifdef VBOX_INCLUDED_vmm_pdmdev_h
|
---|
44 | extern const PDMDEVREG g_DeviceAPIC;
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | /* These functions are exported as they are called from external modules (recompiler). */
|
---|
48 | VMMDECL(void) APICUpdatePendingInterrupts(PVMCPUCC pVCpu);
|
---|
49 | VMMDECL(int) APICGetTpr(PCVMCPUCC pVCpu, uint8_t *pu8Tpr, bool *pfPending, uint8_t *pu8PendingIntr);
|
---|
50 | VMMDECL(int) APICSetTpr(PVMCPUCC pVCpu, uint8_t u8Tpr);
|
---|
51 |
|
---|
52 | /* These functions are VMM internal. */
|
---|
53 | VMM_INT_DECL(bool) APICIsEnabled(PCVMCPUCC pVCpu);
|
---|
54 | VMM_INT_DECL(bool) APICGetHighestPendingInterrupt(PVMCPUCC pVCpu, uint8_t *pu8PendingIntr);
|
---|
55 | VMM_INT_DECL(bool) APICQueueInterruptToService(PVMCPUCC pVCpu, uint8_t u8PendingIntr);
|
---|
56 | VMM_INT_DECL(void) APICDequeueInterruptFromService(PVMCPUCC pVCpu, uint8_t u8PendingIntr);
|
---|
57 | VMM_INT_DECL(VBOXSTRICTRC) APICReadMsr(PVMCPUCC pVCpu, uint32_t u32Reg, uint64_t *pu64Value);
|
---|
58 | VMM_INT_DECL(VBOXSTRICTRC) APICWriteMsr(PVMCPUCC pVCpu, uint32_t u32Reg, uint64_t u64Value);
|
---|
59 | VMM_INT_DECL(int) APICGetTimerFreq(PVMCC pVM, uint64_t *pu64Value);
|
---|
60 | VMM_INT_DECL(VBOXSTRICTRC) APICLocalInterrupt(PVMCPUCC pVCpu, uint8_t u8Pin, uint8_t u8Level, int rcRZ);
|
---|
61 | VMM_INT_DECL(uint64_t) APICGetBaseMsrNoCheck(PCVMCPUCC pVCpu);
|
---|
62 | VMM_INT_DECL(VBOXSTRICTRC) APICGetBaseMsr(PVMCPUCC pVCpu, uint64_t *pu64Value);
|
---|
63 | VMM_INT_DECL(int) APICSetBaseMsr(PVMCPUCC pVCpu, uint64_t u64BaseMsr);
|
---|
64 | VMM_INT_DECL(int) APICGetInterrupt(PVMCPUCC pVCpu, uint8_t *pu8Vector, uint32_t *pu32TagSrc);
|
---|
65 | VMM_INT_DECL(int) APICBusDeliver(PVMCC pVM, uint8_t uDest, uint8_t uDestMode, uint8_t uDeliveryMode, uint8_t uVector,
|
---|
66 | uint8_t uPolarity, uint8_t uTriggerMode, uint32_t uTagSrc);
|
---|
67 | VMM_INT_DECL(int) APICGetApicPageForCpu(PCVMCPUCC pVCpu, PRTHCPHYS pHCPhys, PRTR0PTR pR0Ptr, PRTR3PTR pR3Ptr);
|
---|
68 |
|
---|
69 | /** @name Hyper-V interface (Ring-3 and all-context API).
|
---|
70 | * @{ */
|
---|
71 | #ifdef IN_RING3
|
---|
72 | VMMR3_INT_DECL(void) APICR3HvSetCompatMode(PVM pVM, bool fHyperVCompatMode);
|
---|
73 | #endif
|
---|
74 | VMM_INT_DECL(void) APICHvSendInterrupt(PVMCPUCC pVCpu, uint8_t uVector, bool fAutoEoi, XAPICTRIGGERMODE enmTriggerMode);
|
---|
75 | VMM_INT_DECL(VBOXSTRICTRC) APICHvSetTpr(PVMCPUCC pVCpu, uint8_t uTpr);
|
---|
76 | VMM_INT_DECL(uint8_t) APICHvGetTpr(PVMCPUCC pVCpu);
|
---|
77 | VMM_INT_DECL(VBOXSTRICTRC) APICHvSetIcr(PVMCPUCC pVCpu, uint64_t uIcr);
|
---|
78 | VMM_INT_DECL(uint64_t) APICHvGetIcr(PVMCPUCC pVCpu);
|
---|
79 | VMM_INT_DECL(VBOXSTRICTRC) APICHvSetEoi(PVMCPUCC pVCpu, uint32_t uEoi);
|
---|
80 | /** @} */
|
---|
81 |
|
---|
82 | #ifdef IN_RING3
|
---|
83 | /** @defgroup grp_apic_r3 The APIC Host Context Ring-3 API
|
---|
84 | * @{
|
---|
85 | */
|
---|
86 | VMMR3_INT_DECL(int) APICR3RegisterDevice(struct PDMDEVREGCB *pCallbacks);
|
---|
87 | VMMR3_INT_DECL(void) APICR3InitIpi(PVMCPU pVCpu);
|
---|
88 | VMMR3_INT_DECL(void) APICR3HvEnable(PVM pVM);
|
---|
89 | /** @} */
|
---|
90 | #endif /* IN_RING3 */
|
---|
91 |
|
---|
92 | RT_C_DECLS_END
|
---|
93 |
|
---|
94 | /** @} */
|
---|
95 |
|
---|
96 | #endif /* !VBOX_INCLUDED_vmm_apic_h */
|
---|
97 |
|
---|