PDMR0Device.cpp revision cce0c6096dee0c5353bb74431dc47b05f87a1c6d
/* $Id$ */
/** @file
* PDM - Pluggable Device and Driver Manager, R0 Device parts.
*/
/*
* Copyright (C) 2006-2011 Oracle Corporation
*
* 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_PDM_DEVICE
#include "PDMInternal.h"
/*******************************************************************************
* Global Variables *
*******************************************************************************/
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
/** @name Ring-0 Device Helpers
* @{
*/
/** @interface_method_impl{PDMDEVHLPR0,pfnPCISetIrq} */
{
LogFlow(("pdmR0DevHlp_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"));
}
}
/** @interface_method_impl{PDMDEVHLPR0,pfnPCISetIrq} */
{
LogFlow(("pdmR0DevHlp_ISASetIrq: caller=%p/%d: iIrq=%d iLevel=%d\n", pDevIns, pDevIns->iInstance, iIrq, iLevel));
}
/** @interface_method_impl{PDMDEVHLPR0,pfnPhysRead} */
static DECLCALLBACK(int) pdmR0DevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
{
LogFlow(("pdmR0DevHlp_PhysRead: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbRead=%#x\n",
return rc;
}
/** @interface_method_impl{PDMDEVHLPR0,pfnPhysWrite} */
static DECLCALLBACK(int) pdmR0DevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
{
LogFlow(("pdmR0DevHlp_PhysWrite: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbWrite=%#x\n",
return rc;
}
/** @interface_method_impl{PDMDEVHLPR0,pfnA20IsEnabled} */
{
Log(("pdmR0DevHlp_A20IsEnabled: caller=%p/%d: returns %RTbool\n", pDevIns, pDevIns->iInstance, fEnabled));
return fEnabled;
}
/** @interface_method_impl{PDMDEVHLPR0,pfnVMState} */
{
LogFlow(("pdmR0DevHlp_VMState: caller=%p/%d: returns %d\n", pDevIns, pDevIns->iInstance, enmVMState));
return enmVMState;
}
/** @interface_method_impl{PDMDEVHLPR0,pfnVMSetError} */
static DECLCALLBACK(int) pdmR0DevHlp_VMSetError(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
{
int rc2 = VMSetErrorV(pDevIns->Internal.s.pVMR0, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
return rc;
}
/** @interface_method_impl{PDMDEVHLPR0,pfnVMSetErrorV} */
static DECLCALLBACK(int) pdmR0DevHlp_VMSetErrorV(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
{
int rc2 = VMSetErrorV(pDevIns->Internal.s.pVMR0, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2);
return rc;
}
/** @interface_method_impl{PDMDEVHLPR0,pfnVMSetRuntimeError} */
static DECLCALLBACK(int) pdmR0DevHlp_VMSetRuntimeError(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
{
return rc;
}
/** @interface_method_impl{PDMDEVHLPR0,pfnVMSetRuntimeErrorV} */
static DECLCALLBACK(int) pdmR0DevHlp_VMSetRuntimeErrorV(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)
{
return rc;
}
/** @copydoc PDMDEVHLPR0::pdmR0DevHlp_PATMSetMMIOPatchInfo*/
static DECLCALLBACK(int) pdmR0DevHlp_PATMSetMMIOPatchInfo(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPTR pCachedData)
{
AssertFailed();
/* return PATMSetMMIOPatchInfo(pDevIns->Internal.s.pVMR0, GCPhys, pCachedData); */
return VINF_SUCCESS;
}
/** @interface_method_impl{PDMDEVHLPR0,pfnGetVM} */
{
}
/** @interface_method_impl{PDMDEVHLPR0,pfnCanEmulateIoBlock} */
{
}
/** @interface_method_impl{PDMDEVHLPR0,pfnGetVMCPU} */
{
}
/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGet} */
{
}
/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGetFreq} */
{
}
/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGetNano} */
{
}
/**
* The Ring-0 Device Helper Callbacks.
*/
{
};
/** @} */
/** @name PIC Ring-0 Helpers
* @{
*/
/** @interface_method_impl{PDMPICHLPR0,pfnSetInterruptFF} */
{
{
LogFlow(("pdmR0PicHlp_SetInterruptFF: caller='%p'/%d: Setting local interrupt on LAPIC\n",
/* Raise the LAPIC's LINT0 line instead of signaling the CPU directly. */
return;
}
LogFlow(("pdmR0PicHlp_SetInterruptFF: caller=%p/%d: VMCPU_FF_INTERRUPT_PIC %d -> 1\n",
}
/** @interface_method_impl{PDMPICHLPR0,pfnClearInterruptFF} */
{
{
/* Raise the LAPIC's LINT0 line instead of signaling the CPU directly. */
LogFlow(("pdmR0PicHlp_ClearInterruptFF: caller='%s'/%d: Clearing local interrupt on LAPIC\n",
/* Lower the LAPIC's LINT0 line instead of signaling the CPU directly. */
return;
}
LogFlow(("pdmR0PicHlp_ClearInterruptFF: caller=%p/%d: VMCPU_FF_INTERRUPT_PIC %d -> 0\n",
}
/** @interface_method_impl{PDMPICHLPR0,pfnLock} */
{
}
/** @interface_method_impl{PDMPICHLPR0,pfnUnlock} */
{
}
/**
* The Ring-0 PIC Helper Callbacks.
*/
{
};
/** @} */
/** @name APIC Ring-0 Helpers
* @{
*/
/** @interface_method_impl{PDMAPICHLPR0,pfnSetInterruptFF} */
static DECLCALLBACK(void) pdmR0ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu)
{
LogFlow(("pdmR0ApicHlp_SetInterruptFF: CPU%d=caller=%p/%d: VM_FF_INTERRUPT %d -> 1 (CPU%d)\n",
VMMGetCpuId(pVM), pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC), idCpu));
switch (enmType)
{
case PDMAPICIRQ_HARDWARE:
break;
case PDMAPICIRQ_NMI:
break;
case PDMAPICIRQ_SMI:
break;
case PDMAPICIRQ_EXTINT:
break;
default:
break;
}
/* We need to wait up the target CPU. */
{
switch (VMCPU_GET_STATE(pVCpu))
{
case VMCPUSTATE_STARTED_EXEC:
break;
break;
default:
break; /* nothing to do in other states. */
}
}
}
/** @interface_method_impl{PDMAPICHLPR0,pfnClearInterruptFF} */
static DECLCALLBACK(void) pdmR0ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu)
{
LogFlow(("pdmR0ApicHlp_ClearInterruptFF: caller=%p/%d: VM_FF_INTERRUPT %d -> 0\n",
switch (enmType)
{
case PDMAPICIRQ_HARDWARE:
break;
case PDMAPICIRQ_EXTINT:
break;
default:
break;
}
}
/** @interface_method_impl{PDMAPICHLPR0,pfnChangeFeature} */
{
LogFlow(("pdmR0ApicHlp_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:
}
}
/** @interface_method_impl{PDMAPICHLPR0,pfnLock} */
{
}
/** @interface_method_impl{PDMAPICHLPR0,pfnUnlock} */
{
}
/** @interface_method_impl{PDMAPICHLPR0,pfnGetCpuId} */
{
}
/**
* The Ring-0 APIC Helper Callbacks.
*/
{
};
/** @} */
/** @name I/O APIC Ring-0 Helpers
* @{
*/
/** @interface_method_impl{PDMIOAPICHLPR0,pfnApicBusDeliver} */
static DECLCALLBACK(int) pdmR0IoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
{
LogFlow(("pdmR0IoApicHlp_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));
return pVM->pdm.s.Apic.pfnBusDeliverR0(pVM->pdm.s.Apic.pDevInsR0, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode);
return VINF_SUCCESS;
}
/** @interface_method_impl{PDMIOAPICHLPR0,pfnLock} */
{
}
/** @interface_method_impl{PDMIOAPICHLPR0,pfnUnlock} */
{
}
/**
* The Ring-0 I/O APIC Helper Callbacks.
*/
{
};
/** @} */
/** @name PCI Bus Ring-0 Helpers
* @{
*/
/** @interface_method_impl{PDMPCIHLPR0,pfnIsaSetIrq} */
{
}
/** @interface_method_impl{PDMPCIHLPR0,pfnIoApicSetIrq} */
{
}
/** @interface_method_impl{PDMPCIHLPR0,pfnIoApicSendMsi} */
static DECLCALLBACK(void) pdmR0PciHlp_IoApicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue)
{
}
/** @interface_method_impl{PDMPCIHLPR0,pfnLock} */
{
}
/** @interface_method_impl{PDMPCIHLPR0,pfnUnlock} */
{
}
/**
* The Ring-0 PCI Bus Helper Callbacks.
*/
{
PDM_PCIHLPR0_VERSION, /* the end */
};
/** @} */
/** @name HPET Ring-0 Helpers
* @{
*/
/* none */
/**
* The Ring-0 HPET Helper Callbacks.
*/
{
PDM_HPETHLPR0_VERSION, /* the end */
};
/** @} */
/** @name Raw PCI Ring-0 Helpers
* @{
*/
/* none */
/**
* The Ring-0 PCI raw Helper Callbacks.
*/
{
PDM_PCIRAWHLPR0_VERSION, /* the end */
};
/** @} */
/** @name Ring-0 Context Driver Helpers
* @{
*/
/** @interface_method_impl{PDMDRVHLPR0,pfnVMSetError} */
static DECLCALLBACK(int) pdmR0DrvHlp_VMSetError(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
{
int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR0, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
return rc;
}
/** @interface_method_impl{PDMDRVHLPR0,pfnVMSetErrorV} */
static DECLCALLBACK(int) pdmR0DrvHlp_VMSetErrorV(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
{
int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR0, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2);
return rc;
}
/** @interface_method_impl{PDMDRVHLPR0,pfnVMSetRuntimeError} */
static DECLCALLBACK(int) pdmR0DrvHlp_VMSetRuntimeError(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
{
return rc;
}
/** @interface_method_impl{PDMDRVHLPR0,pfnVMSetErrorV} */
static DECLCALLBACK(int) pdmR0DrvHlp_VMSetRuntimeErrorV(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)
{
return rc;
}
/** @interface_method_impl{PDMDRVHLPR0,pfnAssertEMT} */
static DECLCALLBACK(bool) pdmR0DrvHlp_AssertEMT(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
{
return true;
return false;
}
/** @interface_method_impl{PDMDRVHLPR0,pfnAssertOther} */
static DECLCALLBACK(bool) pdmR0DrvHlp_AssertOther(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
{
return true;
return false;
}
/** @interface_method_impl{PDMDRVHLPR0,pfnFTSetCheckpoint} */
{
}
/**
* The Ring-0 Context Driver Helper Callbacks.
*/
{
};
/** @} */
/**
* 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"));
}
}
/**
* PDMDevHlpCallR0 helper.
*
* @returns See PFNPDMDEVREQHANDLERR0.
* @param pVM The VM handle (for validation).
* @param pReq The request buffer.
*/
{
/*
* Validate input and make the call.
*/
AssertMsgReturn(pReq->Hdr.cbReq == sizeof(*pReq), ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(*pReq)), VERR_INVALID_PARAMETER);
}
/**
* Sends an MSI to I/O APIC.
*
* @param pVM The VM handle.
* @param GCAddr Address of the message.
* @param uValue Value of the message.
*/
{
{
}
}