VirtualBox

source: vbox/trunk/src/VBox/VMM/PDMDevMiscHlp.cpp@ 20374

Last change on this file since 20374 was 20092, checked in by vboxsync, 15 years ago

DevAPIC,PDM: timer critsect.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 16.8 KB
Line 
1/* $Id: PDMDevMiscHlp.cpp 20092 2009-05-27 15:19:32Z vboxsync $ */
2/** @file
3 * PDM - Pluggable Device and Driver Manager, Misc. Device Helpers.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22
23/*******************************************************************************
24* Header Files *
25*******************************************************************************/
26#define LOG_GROUP LOG_GROUP_PDM_DEVICE
27#include "PDMInternal.h"
28#include <VBox/pdm.h>
29#include <VBox/rem.h>
30#include <VBox/vm.h>
31#include <VBox/vmm.h>
32
33#include <VBox/log.h>
34#include <VBox/err.h>
35#include <iprt/asm.h>
36#include <iprt/assert.h>
37#include <iprt/thread.h>
38
39
40
41/** @name HC PIC Helpers
42 * @{
43 */
44
45/** @copydoc PDMPICHLPR3::pfnSetInterruptFF */
46static DECLCALLBACK(void) pdmR3PicHlp_SetInterruptFF(PPDMDEVINS pDevIns)
47{
48 PDMDEV_ASSERT_DEVINS(pDevIns);
49 PVM pVM = pDevIns->Internal.s.pVMR3;
50 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */
51
52 LogFlow(("pdmR3PicHlp_SetInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT_PIC %d -> 1\n",
53 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC)));
54
55 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC);
56 REMR3NotifyInterruptSet(pVM, pVCpu);
57 VMR3NotifyCpuFFU(pVCpu->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM | VMNOTIFYFF_FLAGS_POKE);
58}
59
60
61/** @copydoc PDMPICHLPR3::pfnClearInterruptFF */
62static DECLCALLBACK(void) pdmR3PicHlp_ClearInterruptFF(PPDMDEVINS pDevIns)
63{
64 PDMDEV_ASSERT_DEVINS(pDevIns);
65 PVM pVM = pDevIns->Internal.s.pVMR3;
66 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */
67
68 LogFlow(("pdmR3PicHlp_ClearInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT_PIC %d -> 0\n",
69 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC)));
70
71 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC);
72 REMR3NotifyInterruptClear(pVM, pVCpu);
73}
74
75
76/** @copydoc PDMPICHLPR3::pfnLock */
77static DECLCALLBACK(int) pdmR3PicHlp_Lock(PPDMDEVINS pDevIns, int rc)
78{
79 PDMDEV_ASSERT_DEVINS(pDevIns);
80 return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
81}
82
83
84/** @copydoc PDMPICHLPR3::pfnUnlock */
85static DECLCALLBACK(void) pdmR3PicHlp_Unlock(PPDMDEVINS pDevIns)
86{
87 PDMDEV_ASSERT_DEVINS(pDevIns);
88 pdmUnlock(pDevIns->Internal.s.pVMR3);
89}
90
91
92/** @copydoc PDMPICHLPR3::pfnGetRCHelpers */
93static DECLCALLBACK(PCPDMPICHLPRC) pdmR3PicHlp_GetRCHelpers(PPDMDEVINS pDevIns)
94{
95 PDMDEV_ASSERT_DEVINS(pDevIns);
96 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
97 RTRCPTR pRCHelpers = 0;
98 int rc = PDMR3LdrGetSymbolRC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCPicHlp", &pRCHelpers);
99 AssertReleaseRC(rc);
100 AssertRelease(pRCHelpers);
101 LogFlow(("pdmR3PicHlp_GetRCHelpers: caller='%s'/%d: returns %RRv\n",
102 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pRCHelpers));
103 return pRCHelpers;
104}
105
106
107/** @copydoc PDMPICHLPR3::pfnGetR0Helpers */
108static DECLCALLBACK(PCPDMPICHLPR0) pdmR3PicHlp_GetR0Helpers(PPDMDEVINS pDevIns)
109{
110 PDMDEV_ASSERT_DEVINS(pDevIns);
111 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
112 PCPDMPICHLPR0 pR0Helpers = 0;
113 int rc = PDMR3LdrGetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0PicHlp", &pR0Helpers);
114 AssertReleaseRC(rc);
115 AssertRelease(pR0Helpers);
116 LogFlow(("pdmR3PicHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
117 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pR0Helpers));
118 return pR0Helpers;
119}
120
121
122/**
123 * PIC Device Helpers.
124 */
125const PDMPICHLPR3 g_pdmR3DevPicHlp =
126{
127 PDM_PICHLPR3_VERSION,
128 pdmR3PicHlp_SetInterruptFF,
129 pdmR3PicHlp_ClearInterruptFF,
130 pdmR3PicHlp_Lock,
131 pdmR3PicHlp_Unlock,
132 pdmR3PicHlp_GetRCHelpers,
133 pdmR3PicHlp_GetR0Helpers,
134 PDM_PICHLPR3_VERSION /* the end */
135};
136
137/** @} */
138
139
140
141
142/** @name HC APIC Helpers
143 * @{
144 */
145
146/** @copydoc PDMAPICHLPR3::pfnSetInterruptFF */
147static DECLCALLBACK(void) pdmR3ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns, VMCPUID idCpu)
148{
149 PDMDEV_ASSERT_DEVINS(pDevIns);
150 PVM pVM = pDevIns->Internal.s.pVMR3;
151 PVMCPU pVCpu = &pVM->aCpus[idCpu];
152
153 AssertReturnVoid(idCpu < pVM->cCPUs);
154
155 LogFlow(("pdmR3ApicHlp_SetInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT(%d) %d -> 1\n",
156 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, idCpu, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC)));
157
158 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC);
159 REMR3NotifyInterruptSet(pVM, pVCpu);
160 VMR3NotifyCpuFFU(pVCpu->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM | VMNOTIFYFF_FLAGS_POKE);
161}
162
163
164/** @copydoc PDMAPICHLPR3::pfnClearInterruptFF */
165static DECLCALLBACK(void) pdmR3ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns, VMCPUID idCpu)
166{
167 PDMDEV_ASSERT_DEVINS(pDevIns);
168 PVM pVM = pDevIns->Internal.s.pVMR3;
169 PVMCPU pVCpu = &pVM->aCpus[idCpu];
170
171 AssertReturnVoid(idCpu < pVM->cCPUs);
172
173 LogFlow(("pdmR3ApicHlp_ClearInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT(%d) %d -> 0\n",
174 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, idCpu, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC)));
175
176 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC);
177 REMR3NotifyInterruptClear(pVM, pVCpu);
178}
179
180
181/** @copydoc PDMAPICHLPR3::pfnChangeFeature */
182static DECLCALLBACK(void) pdmR3ApicHlp_ChangeFeature(PPDMDEVINS pDevIns, PDMAPICVERSION enmVersion)
183{
184 PDMDEV_ASSERT_DEVINS(pDevIns);
185 LogFlow(("pdmR3ApicHlp_ChangeFeature: caller='%s'/%d: version=%d\n",
186 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, (int)enmVersion));
187 switch (enmVersion)
188 {
189 case PDMAPICVERSION_NONE:
190 CPUMClearGuestCpuIdFeature(pDevIns->Internal.s.pVMR3, CPUMCPUIDFEATURE_APIC);
191 CPUMClearGuestCpuIdFeature(pDevIns->Internal.s.pVMR3, CPUMCPUIDFEATURE_X2APIC);
192 break;
193 case PDMAPICVERSION_APIC:
194 CPUMSetGuestCpuIdFeature(pDevIns->Internal.s.pVMR3, CPUMCPUIDFEATURE_APIC);
195 CPUMClearGuestCpuIdFeature(pDevIns->Internal.s.pVMR3, CPUMCPUIDFEATURE_X2APIC);
196 break;
197 case PDMAPICVERSION_X2APIC:
198 CPUMSetGuestCpuIdFeature(pDevIns->Internal.s.pVMR3, CPUMCPUIDFEATURE_X2APIC);
199 CPUMSetGuestCpuIdFeature(pDevIns->Internal.s.pVMR3, CPUMCPUIDFEATURE_APIC);
200 break;
201 default:
202 AssertMsgFailed(("Unknown APIC version: %d\n", (int)enmVersion));
203 }
204}
205
206/** @copydoc PDMAPICHLPR3::pfnGetCpuId */
207static DECLCALLBACK(VMCPUID) pdmR3ApicHlp_GetCpuId(PPDMDEVINS pDevIns)
208{
209 PDMDEV_ASSERT_DEVINS(pDevIns);
210 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
211 return VMMGetCpuId(pDevIns->Internal.s.pVMR3);
212}
213
214
215/** @copydoc PDMAPICHLPR3::pfnSendSipi */
216static DECLCALLBACK(void) pdmR3ApicHlp_SendSipi(PPDMDEVINS pDevIns, VMCPUID idCpu, uint32_t uVector)
217{
218 PDMDEV_ASSERT_DEVINS(pDevIns);
219 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
220 VMMR3SendSipi(pDevIns->Internal.s.pVMR3, idCpu, uVector);
221}
222
223/** @copydoc PDMAPICHLPR3::pfnSendInitIpi */
224static DECLCALLBACK(void) pdmR3ApicHlp_SendInitIpi(PPDMDEVINS pDevIns, VMCPUID idCpu)
225{
226 PDMDEV_ASSERT_DEVINS(pDevIns);
227 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
228 VMMR3SendInitIpi(pDevIns->Internal.s.pVMR3, idCpu);
229}
230
231/** @copydoc PDMAPICHLPR3::pfnGetRCHelpers */
232static DECLCALLBACK(PCPDMAPICHLPRC) pdmR3ApicHlp_GetRCHelpers(PPDMDEVINS pDevIns)
233{
234 PDMDEV_ASSERT_DEVINS(pDevIns);
235 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
236 RTRCPTR pRCHelpers = 0;
237 int rc = PDMR3LdrGetSymbolRC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCApicHlp", &pRCHelpers);
238 AssertReleaseRC(rc);
239 AssertRelease(pRCHelpers);
240 LogFlow(("pdmR3ApicHlp_GetRCHelpers: caller='%s'/%d: returns %RRv\n",
241 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pRCHelpers));
242 return pRCHelpers;
243}
244
245
246/** @copydoc PDMAPICHLPR3::pfnGetR0Helpers */
247static DECLCALLBACK(PCPDMAPICHLPR0) pdmR3ApicHlp_GetR0Helpers(PPDMDEVINS pDevIns)
248{
249 PDMDEV_ASSERT_DEVINS(pDevIns);
250 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
251 PCPDMAPICHLPR0 pR0Helpers = 0;
252 int rc = PDMR3LdrGetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0ApicHlp", &pR0Helpers);
253 AssertReleaseRC(rc);
254 AssertRelease(pR0Helpers);
255 LogFlow(("pdmR3ApicHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
256 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pR0Helpers));
257 return pR0Helpers;
258}
259
260
261/** @copydoc PDMAPICHLPR3::pfnGetR3CritSect */
262static DECLCALLBACK(R3PTRTYPE(PPDMCRITSECT)) pdmR3ApicHlp_GetR3CritSect(PPDMDEVINS pDevIns)
263{
264 PDMDEV_ASSERT_DEVINS(pDevIns);
265 LogFlow(("pdmR3ApicHlp_Lock: caller='%s'/%d\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
266 return &pDevIns->Internal.s.pVMR3->pdm.s.CritSect;
267}
268
269
270/** @copydoc PDMAPICHLPR3::pfnGetRCCritSect */
271static DECLCALLBACK(RCPTRTYPE(PPDMCRITSECT)) pdmR3ApicHlp_GetRCCritSect(PPDMDEVINS pDevIns)
272{
273 PDMDEV_ASSERT_DEVINS(pDevIns);
274 PVM pVM = pDevIns->Internal.s.pVMR3;
275 RTRCPTR RCPtr = MMHyperCCToRC(pVM, &pVM->pdm.s.CritSect);
276 LogFlow(("pdmR3ApicHlp_GetR0CritSect: caller='%s'/%d: return %RRv\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, RCPtr));
277 return RCPtr;
278}
279
280
281/** @copydoc PDMAPICHLPR3::pfnGetR3CritSect */
282static DECLCALLBACK(R0PTRTYPE(PPDMCRITSECT)) pdmR3ApicHlp_GetR0CritSect(PPDMDEVINS pDevIns)
283{
284 PDMDEV_ASSERT_DEVINS(pDevIns);
285 PVM pVM = pDevIns->Internal.s.pVMR3;
286 RTR0PTR R0Ptr = MMHyperCCToR0(pVM, &pVM->pdm.s.CritSect);
287 LogFlow(("pdmR3ApicHlp_GetR0CritSect: caller='%s'/%d: return %RHv\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, R0Ptr));
288 return R0Ptr;
289}
290
291
292
293/**
294 * APIC Device Helpers.
295 */
296const PDMAPICHLPR3 g_pdmR3DevApicHlp =
297{
298 PDM_APICHLPR3_VERSION,
299 pdmR3ApicHlp_SetInterruptFF,
300 pdmR3ApicHlp_ClearInterruptFF,
301 pdmR3ApicHlp_ChangeFeature,
302 pdmR3ApicHlp_GetCpuId,
303 pdmR3ApicHlp_SendSipi,
304 pdmR3ApicHlp_SendInitIpi,
305 pdmR3ApicHlp_GetRCHelpers,
306 pdmR3ApicHlp_GetR0Helpers,
307 pdmR3ApicHlp_GetR3CritSect,
308 pdmR3ApicHlp_GetRCCritSect,
309 pdmR3ApicHlp_GetR0CritSect,
310 PDM_APICHLPR3_VERSION /* the end */
311};
312
313/** @} */
314
315
316
317
318/** @name HC I/O APIC Helpers
319 * @{
320 */
321
322/** @copydoc PDMIOAPICHLPR3::pfnApicBusDeliver */
323static DECLCALLBACK(int) pdmR3IoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
324 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode)
325{
326 PDMDEV_ASSERT_DEVINS(pDevIns);
327 PVM pVM = pDevIns->Internal.s.pVMR3;
328 LogFlow(("pdmR3IoApicHlp_ApicBusDeliver: caller='%s'/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 iVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8\n",
329 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode));
330 if (pVM->pdm.s.Apic.pfnBusDeliverR3)
331 return pVM->pdm.s.Apic.pfnBusDeliverR3(pVM->pdm.s.Apic.pDevInsR3, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode);
332 return VINF_SUCCESS;
333}
334
335
336/** @copydoc PDMIOAPICHLPR3::pfnLock */
337static DECLCALLBACK(int) pdmR3IoApicHlp_Lock(PPDMDEVINS pDevIns, int rc)
338{
339 PDMDEV_ASSERT_DEVINS(pDevIns);
340 LogFlow(("pdmR3IoApicHlp_Lock: caller='%s'/%d: rc=%Rrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
341 return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
342}
343
344
345/** @copydoc PDMIOAPICHLPR3::pfnUnlock */
346static DECLCALLBACK(void) pdmR3IoApicHlp_Unlock(PPDMDEVINS pDevIns)
347{
348 PDMDEV_ASSERT_DEVINS(pDevIns);
349 LogFlow(("pdmR3IoApicHlp_Unlock: caller='%s'/%d:\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
350 pdmUnlock(pDevIns->Internal.s.pVMR3);
351}
352
353
354/** @copydoc PDMIOAPICHLPR3::pfnGetRCHelpers */
355static DECLCALLBACK(PCPDMIOAPICHLPRC) pdmR3IoApicHlp_GetRCHelpers(PPDMDEVINS pDevIns)
356{
357 PDMDEV_ASSERT_DEVINS(pDevIns);
358 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
359 RTRCPTR pRCHelpers = 0;
360 int rc = PDMR3LdrGetSymbolRC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCIoApicHlp", &pRCHelpers);
361 AssertReleaseRC(rc);
362 AssertRelease(pRCHelpers);
363 LogFlow(("pdmR3IoApicHlp_GetRCHelpers: caller='%s'/%d: returns %RRv\n",
364 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pRCHelpers));
365 return pRCHelpers;
366}
367
368
369/** @copydoc PDMIOAPICHLPR3::pfnGetR0Helpers */
370static DECLCALLBACK(PCPDMIOAPICHLPR0) pdmR3IoApicHlp_GetR0Helpers(PPDMDEVINS pDevIns)
371{
372 PDMDEV_ASSERT_DEVINS(pDevIns);
373 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
374 PCPDMIOAPICHLPR0 pR0Helpers = 0;
375 int rc = PDMR3LdrGetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0IoApicHlp", &pR0Helpers);
376 AssertReleaseRC(rc);
377 AssertRelease(pR0Helpers);
378 LogFlow(("pdmR3IoApicHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
379 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pR0Helpers));
380 return pR0Helpers;
381}
382
383
384/**
385 * I/O APIC Device Helpers.
386 */
387const PDMIOAPICHLPR3 g_pdmR3DevIoApicHlp =
388{
389 PDM_IOAPICHLPR3_VERSION,
390 pdmR3IoApicHlp_ApicBusDeliver,
391 pdmR3IoApicHlp_Lock,
392 pdmR3IoApicHlp_Unlock,
393 pdmR3IoApicHlp_GetRCHelpers,
394 pdmR3IoApicHlp_GetR0Helpers,
395 PDM_IOAPICHLPR3_VERSION /* the end */
396};
397
398/** @} */
399
400
401
402
403/** @name HC PCI Bus Helpers
404 * @{
405 */
406
407/** @copydoc PDMPCIHLPR3::pfnIsaSetIrq */
408static DECLCALLBACK(void) pdmR3PciHlp_IsaSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)
409{
410 PDMDEV_ASSERT_DEVINS(pDevIns);
411 Log4(("pdmR3PciHlp_IsaSetIrq: iIrq=%d iLevel=%d\n", iIrq, iLevel));
412 PDMIsaSetIrq(pDevIns->Internal.s.pVMR3, iIrq, iLevel);
413}
414
415
416/** @copydoc PDMPCIHLPR3::pfnIoApicSetIrq */
417static DECLCALLBACK(void) pdmR3PciHlp_IoApicSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)
418{
419 PDMDEV_ASSERT_DEVINS(pDevIns);
420 Log4(("pdmR3PciHlp_IsaSetIrq: iIrq=%d iLevel=%d\n", iIrq, iLevel));
421 PDMIoApicSetIrq(pDevIns->Internal.s.pVMR3, iIrq, iLevel);
422}
423
424
425/** @copydoc PDMPCIHLPR3::pfnIsMMIO2Base */
426static DECLCALLBACK(bool) pdmR3PciHlp_IsMMIO2Base(PPDMDEVINS pDevIns, PPDMDEVINS pOwner, RTGCPHYS GCPhys)
427{
428 PDMDEV_ASSERT_DEVINS(pDevIns);
429 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
430 bool fRc = PGMR3PhysMMIO2IsBase(pDevIns->Internal.s.pVMR3, pOwner, GCPhys);
431 Log4(("pdmR3PciHlp_IsMMIO2Base: pOwner=%p GCPhys=%RGp -> %RTbool\n", pOwner, GCPhys, fRc));
432 return fRc;
433}
434
435
436/** @copydoc PDMPCIHLPR3::pfnLock */
437static DECLCALLBACK(int) pdmR3PciHlp_Lock(PPDMDEVINS pDevIns, int rc)
438{
439 PDMDEV_ASSERT_DEVINS(pDevIns);
440 LogFlow(("pdmR3PciHlp_Lock: caller='%s'/%d: rc=%Rrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
441 return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
442}
443
444
445/** @copydoc PDMPCIHLPR3::pfnUnlock */
446static DECLCALLBACK(void) pdmR3PciHlp_Unlock(PPDMDEVINS pDevIns)
447{
448 PDMDEV_ASSERT_DEVINS(pDevIns);
449 LogFlow(("pdmR3PciHlp_Unlock: caller='%s'/%d:\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
450 pdmUnlock(pDevIns->Internal.s.pVMR3);
451}
452
453
454/** @copydoc PDMPCIHLPR3::pfnGetRCHelpers */
455static DECLCALLBACK(PCPDMPCIHLPRC) pdmR3PciHlp_GetRCHelpers(PPDMDEVINS pDevIns)
456{
457 PDMDEV_ASSERT_DEVINS(pDevIns);
458 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
459 RTRCPTR pRCHelpers = 0;
460 int rc = PDMR3LdrGetSymbolRC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCPciHlp", &pRCHelpers);
461 AssertReleaseRC(rc);
462 AssertRelease(pRCHelpers);
463 LogFlow(("pdmR3IoApicHlp_GetGCHelpers: caller='%s'/%d: returns %RRv\n",
464 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pRCHelpers));
465 return pRCHelpers;
466}
467
468
469/** @copydoc PDMPCIHLPR3::pfnGetR0Helpers */
470static DECLCALLBACK(PCPDMPCIHLPR0) pdmR3PciHlp_GetR0Helpers(PPDMDEVINS pDevIns)
471{
472 PDMDEV_ASSERT_DEVINS(pDevIns);
473 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
474 PCPDMPCIHLPR0 pR0Helpers = 0;
475 int rc = PDMR3LdrGetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0PciHlp", &pR0Helpers);
476 AssertReleaseRC(rc);
477 AssertRelease(pR0Helpers);
478 LogFlow(("pdmR3IoApicHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
479 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pR0Helpers));
480 return pR0Helpers;
481}
482
483
484/**
485 * PCI Bus Device Helpers.
486 */
487const PDMPCIHLPR3 g_pdmR3DevPciHlp =
488{
489 PDM_PCIHLPR3_VERSION,
490 pdmR3PciHlp_IsaSetIrq,
491 pdmR3PciHlp_IoApicSetIrq,
492 pdmR3PciHlp_IsMMIO2Base,
493 pdmR3PciHlp_GetRCHelpers,
494 pdmR3PciHlp_GetR0Helpers,
495 pdmR3PciHlp_Lock,
496 pdmR3PciHlp_Unlock,
497 PDM_PCIHLPR3_VERSION, /* the end */
498};
499
500/** @} */
501
502
503
504/* none yet */
505
506/**
507 * DMAC Device Helpers.
508 */
509const PDMDMACHLP g_pdmR3DevDmacHlp =
510{
511 PDM_DMACHLP_VERSION
512};
513
514
515
516
517/* none yet */
518
519/**
520 * RTC Device Helpers.
521 */
522const PDMRTCHLP g_pdmR3DevRtcHlp =
523{
524 PDM_RTCHLP_VERSION
525};
526
527
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