PDMGCDevice.cpp revision 2a08e12d5dcc1bb5057a9620e87ad361d41a1c1f
/* $Id$ */
/** @file
* PDM - Pluggable Device and Driver Manager, GC Device parts.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_PDM_DEVICE
#include "PDMInternal.h"
/*******************************************************************************
* Global Variables *
*******************************************************************************/
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
/** @name GC Device Helpers
* @{
*/
static DECLCALLBACK(void) pdmGCDevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead);
static DECLCALLBACK(void) pdmGCDevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite);
static DECLCALLBACK(int) pdmGCDevHlp_VMSetError(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...);
static DECLCALLBACK(int) pdmGCDevHlp_VMSetErrorV(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va);
static DECLCALLBACK(int) pdmGCDevHlp_VMSetRuntimeError(PPDMDEVINS pDevIns, bool fFatal, const char *pszErrorID, const char *pszFormat, ...);
static DECLCALLBACK(int) pdmGCDevHlp_VMSetRuntimeErrorV(PPDMDEVINS pDevIns, bool fFatal, const char *pszErrorID, const char *pszFormat, va_list va);
static DECLCALLBACK(int) pdmGCDevHlp_PATMSetMMIOPatchInfo(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPTR pCachedData);
/** @} */
/** @name PIC GC Helpers
* @{
*/
/** @} */
/** @name APIC RC Helpers
* @{
*/
static DECLCALLBACK(void) pdmRCApicHlp_ChangeFeature(PPDMDEVINS pDevIns, PDMAPICVERSION enmVersion);
/** @} */
/** @name I/O APIC RC Helpers
* @{
*/
static DECLCALLBACK(void) pdmRCIoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
/** @} */
/** @name PCI Bus RC Helpers
* @{
*/
/** @} */
/**
* The Guest Context Device Helper Callbacks.
*/
{
};
/**
* The Raw-Mode Context PIC Helper Callbacks.
*/
{
};
/**
* The Raw-Mode Context APIC Helper Callbacks.
*/
{
};
/**
* The Raw-Mode Context I/O APIC Helper Callbacks.
*/
{
};
/**
* The Raw-Mode Context PCI Bus Helper Callbacks.
*/
{
PDM_PCIHLPRC_VERSION, /* the end */
};
/** @copydoc PDMDEVHLPRC::pfnPCISetIrq */
{
LogFlow(("pdmGCDevHlp_PCISetIrq: caller=%p/%d: iIrq=%d iLevel=%d\n", pDevIns, pDevIns->iInstance, iIrq, iLevel));
if ( pPciDev
&& pPciBus
{
}
else
{
/* queue for ring-3 execution. */
if (pTask)
{
}
else
AssertMsgFailed(("We're out of devhlp queue items!!!\n"));
}
}
/** @copydoc PDMDEVHLPRC::pfnPCISetIrq */
{
LogFlow(("pdmGCDevHlp_ISASetIrq: caller=%p/%d: iIrq=%d iLevel=%d\n", pDevIns, pDevIns->iInstance, iIrq, iLevel));
}
/** @copydoc PDMDEVHLPRC::pfnPhysRead */
static DECLCALLBACK(void) pdmGCDevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
{
LogFlow(("pdmGCDevHlp_PhysRead: caller=%p/%d: GCPhys=%VGp pvBuf=%p cbRead=%#x\n",
}
/** @copydoc PDMDEVHLPRC::pfnPhysWrite */
static DECLCALLBACK(void) pdmGCDevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
{
LogFlow(("pdmGCDevHlp_PhysWrite: caller=%p/%d: GCPhys=%VGp pvBuf=%p cbWrite=%#x\n",
}
/** @copydoc PDMDEVHLPRC::pfnA20IsEnabled */
{
Log(("pdmGCDevHlp_A20IsEnabled: caller=%p/%d: returns %RTbool\n", pDevIns, pDevIns->iInstance, fEnabled));
return fEnabled;
}
/** @copydoc PDMDEVHLPRC::pfnVMSetError */
static DECLCALLBACK(int) pdmGCDevHlp_VMSetError(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
{
int rc2 = VMSetErrorV(pDevIns->Internal.s.pVMRC, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
return rc;
}
/** @copydoc PDMDEVHLPRC::pfnVMSetErrorV */
static DECLCALLBACK(int) pdmGCDevHlp_VMSetErrorV(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
{
int rc2 = VMSetErrorV(pDevIns->Internal.s.pVMRC, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2);
return rc;
}
/** @copydoc PDMDEVHLPRC::pfnVMSetRuntimeError */
static DECLCALLBACK(int) pdmGCDevHlp_VMSetRuntimeError(PPDMDEVINS pDevIns, bool fFatal, const char *pszErrorID, const char *pszFormat, ...)
{
return rc;
}
/** @copydoc PDMDEVHLPRC::pfnVMSetErrorV */
static DECLCALLBACK(int) pdmGCDevHlp_VMSetRuntimeErrorV(PPDMDEVINS pDevIns, bool fFatal, const char *pszErrorID, const char *pszFormat, va_list va)
{
return rc;
}
/** @copydoc PDMDEVHLPRC::pfnPATMSetMMIOPatchInfo */
static DECLCALLBACK(int) pdmGCDevHlp_PATMSetMMIOPatchInfo(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPTR pCachedData)
{
}
/** @copydoc PDMDEVHLPRC::pfnGetVM */
{
}
/** @copydoc PDMPICHLPGC::pfnSetInterruptFF */
{
LogFlow(("pdmRCPicHlp_SetInterruptFF: caller=%p/%d: VM_FF_INTERRUPT_PIC %d -> 1\n",
/* for PIC we always deliver to CPU 0, MP use APIC */
}
/** @copydoc PDMPICHLPGC::pfnClearInterruptFF */
{
LogFlow(("pdmRCPicHlp_ClearInterruptFF: caller=%p/%d: VM_FF_INTERRUPT_PIC %d -> 0\n",
/* for PIC we always deliver to CPU 0, MP use APIC */
}
/** @copydoc PDMPICHLPGC::pfnLock */
{
}
/** @copydoc PDMPICHLPGC::pfnUnlock */
{
}
/** @copydoc PDMAPICHLPRC::pfnSetInterruptFF */
{
LogFlow(("pdmRCApicHlp_SetInterruptFF: caller=%p/%d: VM_FF_INTERRUPT %d -> 1\n",
pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMRC, idCpu, VM_FF_INTERRUPT_APIC)));
}
/** @copydoc PDMAPICHLPRC::pfnClearInterruptFF */
{
LogFlow(("pdmRCApicHlp_ClearInterruptFF: caller=%p/%d: VM_FF_INTERRUPT %d -> 0\n",
pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMRC, idCpu, VM_FF_INTERRUPT_APIC)));
}
/** @copydoc PDMAPICHLPRC::pfnChangeFeature */
{
LogFlow(("pdmRCApicHlp_ChangeFeature: caller=%p/%d: version=%d\n", pDevIns, pDevIns->iInstance, (int)enmVersion));
switch (enmVersion)
{
case PDMAPICVERSION_NONE:
break;
case PDMAPICVERSION_APIC:
break;
case PDMAPICVERSION_X2APIC:
break;
default:
}
}
/** @copydoc PDMAPICHLPRC::pfnLock */
{
}
/** @copydoc PDMAPICHLPRC::pfnUnlock */
{
}
/** @copydoc PDMAPICHLPRC::pfnGetCpuId */
{
}
/** @copydoc PDMIOAPICHLPRC::pfnApicBusDeliver */
static DECLCALLBACK(void) pdmRCIoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
{
LogFlow(("pdmRCIoApicHlp_ApicBusDeliver: caller=%p/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 iVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8\n",
pDevIns, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode));
pVM->pdm.s.Apic.pfnBusDeliverRC(pVM->pdm.s.Apic.pDevInsRC, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode);
}
/** @copydoc PDMIOAPICHLPRC::pfnLock */
{
}
/** @copydoc PDMIOAPICHLPRC::pfnUnlock */
{
}
/** @copydoc PDMPCIHLPRC::pfnIsaSetIrq */
{
}
/** @copydoc PDMPCIHLPRC::pfnIoApicSetIrq */
{
}
/** @copydoc PDMPCIHLPRC::pfnLock */
{
}
/** @copydoc PDMPCIHLPRC::pfnUnlock */
{
}
/**
* Sets an irq on the I/O APIC.
*
* @param pVM The VM handle.
* @param iIrq The irq.
* @param iLevel The new level.
*/
{
{
}
else
{
/* queue for ring-3 execution. */
if (pTask)
{
}
else
AssertMsgFailed(("We're out of devhlp queue items!!!\n"));
}
}
/**
* Sets an irq on the I/O APIC.
*
* @param pVM The VM handle.
* @param iIrq The irq.
* @param iLevel The new level.
*/
{
{
}
{
/* queue for ring-3 execution. */
if (pTask)
{
}
else
AssertMsgFailed(("We're out of devhlp queue items!!!\n"));
}
}