pdmdev.h revision ea0316554d23852601ee840c4a856339501411a4
/** @file
* PDM - Pluggable Device Manager, Devices. (VMM)
*/
/*
* Copyright (C) 2006-2010 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___VBox_pdmdev_h
#define ___VBox_pdmdev_h
#include <VBox/pdmqueue.h>
#include <VBox/pdmcritsect.h>
#include <VBox/pdmthread.h>
#include <VBox/pdmcommon.h>
/** @defgroup grp_pdm_device The PDM Devices API
* @ingroup grp_pdm
* @{
*/
/**
* Construct a device instance for a VM.
*
* @returns VBox status.
* @param pDevIns The device instance data. If the registration structure
* is needed, it can be accessed thru pDevIns->pReg.
* @param iInstance Instance number. Use this to figure out which registers
* and such to use. The instance number is also found in
* pDevIns->iInstance, but since it's likely to be
* freqently used PDM passes it as parameter.
* @param pCfg Configuration node handle for the driver. This is
* expected to be in high demand in the constructor and is
* therefore passed as an argument. When using it at other
* times, it can be found in pDrvIns->pCfg.
*/
/** Pointer to a FNPDMDEVCONSTRUCT() function. */
typedef FNPDMDEVCONSTRUCT *PFNPDMDEVCONSTRUCT;
/**
* Destruct a device instance.
*
* Most VM resources are freed by the VM. This callback is provided so that any non-VM
* resources can be freed correctly.
*
* @returns VBox status.
* @param pDevIns The device instance data.
*/
/** Pointer to a FNPDMDEVDESTRUCT() function. */
typedef FNPDMDEVDESTRUCT *PFNPDMDEVDESTRUCT;
/**
* Device relocation callback.
*
* This is called when the instance data has been relocated in raw-mode context
* (RC). It is also called when the RC hypervisor selects changes. The device
* must fixup all necessary pointers and re-query all interfaces to other RC
* devices and drivers.
*
* Before the RC code is executed the first time, this function will be called
* with a 0 delta so RC pointer calculations can be one in one place.
*
* @param pDevIns Pointer to the device instance.
* @param offDelta The relocation delta relative to the old location.
*
* @remark A relocation CANNOT fail.
*/
/** Pointer to a FNPDMDEVRELOCATE() function. */
typedef FNPDMDEVRELOCATE *PFNPDMDEVRELOCATE;
/**
* Device I/O Control interface.
*
* This is used by external components, such as the COM interface, to
* communicate with devices using a class wide interface or a device
* specific interface.
*
* @returns VBox status code.
* @param pDevIns Pointer to the device instance.
* @param uFunction Function to perform.
* @param pvIn Pointer to input data.
* @param cbIn Size of input data.
* @param pvOut Pointer to output data.
* @param cbOut Size of output data.
* @param pcbOut Where to store the actual size of the output data.
*/
/** Pointer to a FNPDMDEVIOCTL() function. */
typedef FNPDMDEVIOCTL *PFNPDMDEVIOCTL;
/**
* Power On notification.
*
* @returns VBox status.
* @param pDevIns The device instance data.
*/
/** Pointer to a FNPDMDEVPOWERON() function. */
typedef FNPDMDEVPOWERON *PFNPDMDEVPOWERON;
/**
* Reset notification.
*
* @returns VBox status.
* @param pDevIns The device instance data.
*/
/** Pointer to a FNPDMDEVRESET() function. */
typedef FNPDMDEVRESET *PFNPDMDEVRESET;
/**
* Suspend notification.
*
* @returns VBox status.
* @param pDevIns The device instance data.
* @thread EMT(0)
*/
/** Pointer to a FNPDMDEVSUSPEND() function. */
typedef FNPDMDEVSUSPEND *PFNPDMDEVSUSPEND;
/**
* Resume notification.
*
* @returns VBox status.
* @param pDevIns The device instance data.
*/
/** Pointer to a FNPDMDEVRESUME() function. */
typedef FNPDMDEVRESUME *PFNPDMDEVRESUME;
/**
* Power Off notification.
*
* This is only called when the VMR3PowerOff call is made on a running VM. This
* means that there is no notification if the VM was suspended before being
* powered of. There will also be no callback when hot plugging devices.
*
* @param pDevIns The device instance data.
* @thread EMT(0)
*/
/** Pointer to a FNPDMDEVPOWEROFF() function. */
typedef FNPDMDEVPOWEROFF *PFNPDMDEVPOWEROFF;
/**
* Attach command.
*
* This is called to let the device attach to a driver for a specified LUN
* at runtime. This is not called during VM construction, the device
* constructor have to attach to all the available drivers.
*
* This is like plugging in the keyboard or mouse after turning on the PC.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param iLUN The logical unit which is being detached.
* @param fFlags Flags, combination of the PDM_TACH_FLAGS_* \#defines.
*/
/** Pointer to a FNPDMDEVATTACH() function. */
typedef FNPDMDEVATTACH *PFNPDMDEVATTACH;
/**
* Detach notification.
*
* This is called when a driver is detaching itself from a LUN of the device.
* The device should adjust it's state to reflect this.
*
* This is like unplugging the network cable to use it for the laptop or
* something while the PC is still running.
*
* @param pDevIns The device instance.
* @param iLUN The logical unit which is being detached.
* @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
*/
/** Pointer to a FNPDMDEVDETACH() function. */
typedef FNPDMDEVDETACH *PFNPDMDEVDETACH;
/**
* Query the base interface of a logical unit.
*
* @returns VBOX status code.
* @param pDevIns The device instance.
* @param iLUN The logicial unit to query.
* @param ppBase Where to store the pointer to the base interface of the LUN.
*/
typedef DECLCALLBACK(int) FNPDMDEVQUERYINTERFACE(PPDMDEVINS pDevIns, unsigned iLUN, PPDMIBASE *ppBase);
/** Pointer to a FNPDMDEVQUERYINTERFACE() function. */
/**
* Init complete notification.
* This can be done to do communication with other devices and other
* initialization which requires everything to be in place.
*
* @returns VBOX status code.
* @param pDevIns The device instance.
*/
/** Pointer to a FNPDMDEVINITCOMPLETE() function. */
typedef FNPDMDEVINITCOMPLETE *PFNPDMDEVINITCOMPLETE;
/**
* PDM Device Registration Structure.
*
* This structure is used when registering a device from VBoxInitDevices() in HC
* Ring-3. PDM will continue use till the VM is terminated.
*/
typedef struct PDMDEVREG
{
/** Structure version. PDM_DEVREG_VERSION defines the current version. */
/** Device name. */
char szName[32];
/** Name of the raw-mode context module (no path).
* Only evalutated if PDM_DEVREG_FLAGS_RC is set. */
char szRCMod[32];
/** Name of the ring-0 module (no path).
* Only evalutated if PDM_DEVREG_FLAGS_R0 is set. */
char szR0Mod[32];
/** The description of the device. The UTF-8 string pointed to shall, like this structure,
* remain unchanged from registration till VM destruction. */
const char *pszDescription;
/** Flags, combination of the PDM_DEVREG_FLAGS_* \#defines. */
/** Device class(es), combination of the PDM_DEVREG_CLASS_* \#defines. */
/** Maximum number of instances (per VM). */
/** Size of the instance data. */
/** Construct instance - required. */
/** Destruct instance - optional. */
/** Relocation command - optional. */
/** I/O Control interface - optional. */
/** Power on notification - optional. */
/** Reset notification - optional. */
/** Suspend notification - optional. */
/** Resume notification - optional. */
/** Attach command - optional. */
/** Detach notification - optional. */
/** Query a LUN base interface - optional. */
/** Init complete notification - optional. */
/** Power off notification - optional. */
/** @todo */
/** Initialization safty marker. */
} PDMDEVREG;
/** Pointer to a PDM Device Structure. */
typedef PDMDEVREG *PPDMDEVREG;
/** Const pointer to a PDM Device Structure. */
typedef PDMDEVREG const *PCPDMDEVREG;
/** Current DEVREG version number. */
/** PDM Device Flags.
* @{ */
/** This flag is used to indicate that the device has a RC component. */
#define PDM_DEVREG_FLAGS_RC 0x00000001
/** This flag is used to indicate that the device has a R0 component. */
#define PDM_DEVREG_FLAGS_R0 0x00000002
/** @def PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT
* The bit count for the current host. */
#if HC_ARCH_BITS == 32
# define PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT 0x00000010
# define PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT 0x00000020
#else
#endif
/** The host bit count mask. */
#define PDM_DEVREG_FLAGS_HOST_BITS_MASK 0x00000030
/** The device support only 32-bit guests. */
#define PDM_DEVREG_FLAGS_GUEST_BITS_32 0x00000100
/** The device support only 64-bit guests. */
#define PDM_DEVREG_FLAGS_GUEST_BITS_64 0x00000200
/** The device support both 32-bit & 64-bit guests. */
#define PDM_DEVREG_FLAGS_GUEST_BITS_32_64 0x00000300
/** @def PDM_DEVREG_FLAGS_GUEST_BITS_DEFAULT
* The guest bit count for the current compilation. */
#if GC_ARCH_BITS == 32
#else
#endif
/** The guest bit count mask. */
#define PDM_DEVREG_FLAGS_GUEST_BITS_MASK 0x00000300
/** A convenience. */
#define PDM_DEVREG_FLAGS_DEFAULT_BITS (PDM_DEVREG_FLAGS_GUEST_BITS_DEFAULT | PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT)
/** Indicates that the devices support PAE36 on a 32-bit guest. */
#define PDM_DEVREG_FLAGS_PAE36 0x00001000
/** Indicates that the device needs to be notified before the drivers when suspending. */
#define PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION 0x00002000
/** Indicates that the device needs to be notified before the drivers when powering off. */
#define PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION 0x00004000
/** @} */
/** PDM Device Classes.
* The order is important, lower bit earlier instantiation.
* @{ */
/** Architecture device. */
#define PDM_DEVREG_CLASS_ARCH RT_BIT(0)
/** Architecture BIOS device. */
/** PCI bus brigde. */
/** ISA bus brigde. */
/** Input device (mouse, keyboard, joystick, HID, ...). */
/** Interrupt controller (PIC). */
/** Interval controoler (PIT). */
/** DMA controller. */
/** VMM Device. */
/** Graphics device, like VGA. */
/** Storage controller device. */
/** Network interface controller. */
/** Audio. */
/** USB HIC. */
/** ACPI. */
/** Serial controller device. */
/** Parallel controller device */
/** Host PCI pass-through device */
/** Misc devices (always last). */
/** @} */
/** @name IRQ Level for use with the *SetIrq APIs.
* @{
*/
/** Assert the IRQ (can assume value 1). */
#define PDM_IRQ_LEVEL_HIGH RT_BIT(0)
/** Deassert the IRQ (can assume value 0). */
#define PDM_IRQ_LEVEL_LOW 0
/** flip-flop - assert and then deassert it again immediately. */
/** @} */
/**
* Registration record for MSI.
*/
typedef struct PDMMSIREG
{
/** Number of interrupt vectors */
/** Offset of MSI capability */
/** Offset of next capability */
/** Value to initialize message control register */
} PDMMSIREG;
typedef PDMMSIREG *PPDMMSIREG;
/**
* PCI Bus registration structure.
* All the callbacks, except the PCIBIOS hack, are working on PCI devices.
*/
typedef struct PDMPCIBUSREG
{
/** Structure version number. PDM_PCIBUSREG_VERSION defines the current version. */
/**
* Registers the device with the default PCI bus.
*
* @returns VBox status code.
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev The PCI device structure.
* Any PCI enabled device must keep this in it's instance data!
* Fill in the PCI data config before registration, please.
* @param pszName Pointer to device name (permanent, readonly). For debugging, not unique.
* @param iDev The device number ((dev << 3) | function) the device should have on the bus.
* If negative, the pci bus device will assign one.
*/
DECLR3CALLBACKMEMBER(int, pfnRegisterR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, const char *pszName, int iDev));
/**
* Initialize MSI support in a PCI device.
*
* @returns VBox status code.
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev The PCI device structure.
* @param pMsiReg MSI registration structure
*/
DECLR3CALLBACKMEMBER(int, pfnRegisterMsiR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PPDMMSIREG pMsiReg));
/**
* Registers a I/O region (memory mapped or I/O ports) for a PCI device.
*
* @returns VBox status code.
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev The PCI device structure.
* @param iRegion The region number.
* @param cbRegion Size of the region.
* @param iType PCI_ADDRESS_SPACE_MEM, PCI_ADDRESS_SPACE_IO or PCI_ADDRESS_SPACE_MEM_PREFETCH.
* @param pfnCallback Callback for doing the mapping.
*/
DECLR3CALLBACKMEMBER(int, pfnIORegionRegisterR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback));
/**
*
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev The PCI device structure.
* @param pfnRead Pointer to the user defined PCI config read function.
* @param ppfnReadOld Pointer to function pointer which will receive the old (default)
* PCI config read function. This way, user can decide when (and if)
* to call default PCI config read function. Can be NULL.
* @param pfnWrite Pointer to the user defined PCI config write function.
* @param pfnWriteOld Pointer to function pointer which will receive the old (default)
* PCI config write function. This way, user can decide when (and if)
* to call default PCI config write function. Can be NULL.
* @thread EMT
*/
DECLR3CALLBACKMEMBER(void, pfnSetConfigCallbacksR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
/**
* Set the IRQ for a PCI device.
*
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev The PCI device structure.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
*/
DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel));
/**
* Saves a state of the PCI device.
*
* @returns VBox status code.
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev Pointer to PCI device.
* @param pSSMHandle The handle to save the state to.
*/
DECLR3CALLBACKMEMBER(int, pfnSaveExecR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSMHandle));
/**
* Loads a saved PCI device state.
*
* @returns VBox status code.
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev Pointer to PCI device.
* @param pSSMHandle The handle to the saved state.
*/
DECLR3CALLBACKMEMBER(int, pfnLoadExecR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSMHandle));
/**
* Called to perform the job of the bios.
* This is only called for the first PCI Bus - it is expected to
* service all the PCI buses.
*
* @returns VBox status.
* @param pDevIns Device instance of the first bus.
*/
/** The name of the SetIrq RC entry point. */
const char *pszSetIrqRC;
/** The name of the SetIrq R0 entry point. */
const char *pszSetIrqR0;
} PDMPCIBUSREG;
/** Pointer to a PCI bus registration structure. */
typedef PDMPCIBUSREG *PPDMPCIBUSREG;
/** Current PDMPCIBUSREG version number. */
/**
* PCI Bus RC helpers.
*/
typedef struct PDMPCIHLPRC
{
/** Structure version. PDM_PCIHLPRC_VERSION defines the current version. */
/**
* Set an ISA IRQ.
*
* @param pDevIns PCI device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread EMT only.
*/
/**
*
* @param pDevIns PCI device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread EMT only.
*/
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns rc if we failed to acquire the lock.
* @param pDevIns The PCI device instance.
* @param rc What to return if we fail to acquire the lock.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The PCI device instance.
*/
/** Just a safety precaution. */
} PDMPCIHLPRC;
/** Pointer to PCI helpers. */
/** Pointer to const PCI helpers. */
/** Current PDMPCIHLPR3 version number. */
/**
* PCI Bus R0 helpers.
*/
typedef struct PDMPCIHLPR0
{
/** Structure version. PDM_PCIHLPR0_VERSION defines the current version. */
/**
* Set an ISA IRQ.
*
* @param pDevIns PCI device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread EMT only.
*/
/**
*
* @param pDevIns PCI device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread EMT only.
*/
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns rc if we failed to acquire the lock.
* @param pDevIns The PCI device instance.
* @param rc What to return if we fail to acquire the lock.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The PCI device instance.
*/
/** Just a safety precaution. */
} PDMPCIHLPR0;
/** Pointer to PCI helpers. */
/** Pointer to const PCI helpers. */
/** Current PDMPCIHLPR0 version number. */
/**
* PCI device helpers.
*/
typedef struct PDMPCIHLPR3
{
/** Structure version. PDM_PCIHLPR3_VERSION defines the current version. */
/**
* Set an ISA IRQ.
*
* @param pDevIns The PCI device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread EMT only.
*/
/**
*
* @param pDevIns The PCI device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread EMT only.
*/
/**
* Checks if the given address is an MMIO2 base address or not.
*
* @param pDevIns The PCI device instance.
* @param pOwner The owner of the memory, optional.
* @param GCPhys The address to check.
*/
DECLR3CALLBACKMEMBER(bool, pfnIsMMIO2Base,(PPDMDEVINS pDevIns, PPDMDEVINS pOwner, RTGCPHYS GCPhys));
/**
* Gets the address of the RC PCI Bus helpers.
*
* This should be called at both construction and relocation time
* to obtain the correct address of the RC helpers.
*
* @returns RC pointer to the PCI Bus helpers.
* @param pDevIns Device instance of the PCI Bus.
* @thread EMT only.
*/
/**
* Gets the address of the R0 PCI Bus helpers.
*
* This should be called at both construction and relocation time
* to obtain the correct address of the R0 helpers.
*
* @returns R0 pointer to the PCI Bus helpers.
* @param pDevIns Device instance of the PCI Bus.
* @thread EMT only.
*/
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns Fatal error on failure.
* @param pDevIns The PCI device instance.
* @param rc Dummy for making the interface identical to the RC and R0 versions.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The PCI device instance.
*/
/** Just a safety precaution. */
} PDMPCIHLPR3;
/** Pointer to PCI helpers. */
/** Pointer to const PCI helpers. */
/** Current PDMPCIHLPR3 version number. */
/**
* Programmable Interrupt Controller registration structure.
*/
typedef struct PDMPICREG
{
/** Structure version number. PDM_PICREG_VERSION defines the current version. */
/**
* Set the an IRQ.
*
* @param pDevIns Device instance of the PIC.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
*/
/**
* Get a pending interrupt.
*
* @returns Pending interrupt number.
* @param pDevIns Device instance of the PIC.
*/
/** The name of the RC SetIrq entry point. */
const char *pszSetIrqRC;
/** The name of the RC GetInterrupt entry point. */
const char *pszGetInterruptRC;
/** The name of the R0 SetIrq entry point. */
const char *pszSetIrqR0;
/** The name of the R0 GetInterrupt entry point. */
const char *pszGetInterruptR0;
} PDMPICREG;
/** Pointer to a PIC registration structure. */
typedef PDMPICREG *PPDMPICREG;
/** Current PDMPICREG version number. */
/**
* PIC RC helpers.
*/
typedef struct PDMPICHLPRC
{
/** Structure version. PDM_PICHLPRC_VERSION defines the current version. */
/**
* Set the interrupt force action flag.
*
* @param pDevIns Device instance of the PIC.
*/
/**
* Clear the interrupt force action flag.
*
* @param pDevIns Device instance of the PIC.
*/
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns rc if we failed to acquire the lock.
* @param pDevIns The PIC device instance.
* @param rc What to return if we fail to acquire the lock.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The PIC device instance.
*/
/** Just a safety precaution. */
} PDMPICHLPRC;
/** Pointer to PIC RC helpers. */
/** Pointer to const PIC RC helpers. */
/** Current PDMPICHLPRC version number. */
/**
* PIC R0 helpers.
*/
typedef struct PDMPICHLPR0
{
/** Structure version. PDM_PICHLPR0_VERSION defines the current version. */
/**
* Set the interrupt force action flag.
*
* @param pDevIns Device instance of the PIC.
*/
/**
* Clear the interrupt force action flag.
*
* @param pDevIns Device instance of the PIC.
*/
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns rc if we failed to acquire the lock.
* @param pDevIns The PIC device instance.
* @param rc What to return if we fail to acquire the lock.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The PCI device instance.
*/
/** Just a safety precaution. */
} PDMPICHLPR0;
/** Pointer to PIC R0 helpers. */
/** Pointer to const PIC R0 helpers. */
/** Current PDMPICHLPR0 version number. */
/**
* PIC R3 helpers.
*/
typedef struct PDMPICHLPR3
{
/** Structure version. PDM_PICHLP_VERSION defines the current version. */
/**
* Set the interrupt force action flag.
*
* @param pDevIns Device instance of the PIC.
*/
/**
* Clear the interrupt force action flag.
*
* @param pDevIns Device instance of the PIC.
*/
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns Fatal error on failure.
* @param pDevIns The PIC device instance.
* @param rc Dummy for making the interface identical to the RC and R0 versions.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The PIC device instance.
*/
/**
* Gets the address of the RC PIC helpers.
*
* This should be called at both construction and relocation time
* to obtain the correct address of the RC helpers.
*
* @returns RC pointer to the PIC helpers.
* @param pDevIns Device instance of the PIC.
*/
/**
* Gets the address of the R0 PIC helpers.
*
* This should be called at both construction and relocation time
* to obtain the correct address of the R0 helpers.
*
* @returns R0 pointer to the PIC helpers.
* @param pDevIns Device instance of the PIC.
*/
/** Just a safety precaution. */
} PDMPICHLPR3;
/** Pointer to PIC R3 helpers. */
/** Pointer to const PIC R3 helpers. */
/** Current PDMPICHLPR3 version number. */
/**
* Advanced Programmable Interrupt Controller registration structure.
*/
typedef struct PDMAPICREG
{
/** Structure version number. PDM_APICREG_VERSION defines the current version. */
/**
* Get a pending interrupt.
*
* @returns Pending interrupt number.
* @param pDevIns Device instance of the APIC.
*/
/**
*
* @param pDevIns Device instance of the APIC.
*/
/**
* Set the APIC base.
*
* @param pDevIns Device instance of the APIC.
* @param u64Base The new base.
*/
/**
* Get the APIC base.
*
* @returns Current base.
* @param pDevIns Device instance of the APIC.
*/
/**
* Set the TPR (task priority register).
*
* @param pDevIns Device instance of the APIC.
* @param idCpu VCPU id
* @param u8TPR The new TPR.
*/
/**
* Get the TPR (task priority register).
*
* @returns The current TPR.
* @param pDevIns Device instance of the APIC.
* @param idCpu VCPU id
*/
/**
* Write MSR in APIC range.
*
* @returns VBox status code.
* @param pDevIns Device instance of the APIC.
* @param idCpu Target CPU.
* @param u32Reg MSR to write.
* @param u64Value Value to write.
*/
DECLR3CALLBACKMEMBER(int, pfnWriteMSRR3, (PPDMDEVINS pDevIns, VMCPUID idCpu, uint32_t u32Reg, uint64_t u64Value));
/**
* Read MSR in APIC range.
*
* @returns VBox status code.
* @param pDevIns Device instance of the APIC.
* @param idCpu Target CPU.
* @param u32Reg MSR to read.
* @param pu64Value Value read.
*/
DECLR3CALLBACKMEMBER(int, pfnReadMSRR3, (PPDMDEVINS pDevIns, VMCPUID idCpu, uint32_t u32Reg, uint64_t *pu64Value));
/**
* Private interface between the IOAPIC and APIC.
*
* which is registered with PDM only because it makes life so much
* simpler right now (GC bits). This is a bad bad hack! The correct
* way of doing this would involve some way of querying GC interfaces
* and relocating them. Perhaps doing some kind of device init in GC...
*
* @returns status code.
* @param pDevIns Device instance of the APIC.
* @param u8Dest See APIC implementation.
* @param u8DestMode See APIC implementation.
* @param u8DeliveryMode See APIC implementation.
* @param iVector See APIC implementation.
* @param u8Polarity See APIC implementation.
* @param u8TriggerMode See APIC implementation.
*/
DECLR3CALLBACKMEMBER(int, pfnBusDeliverR3,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
/**
* virtual wire mode when interrupts from the PIC are passed through LAPIC.
*
* @returns status code.
* @param pDevIns Device instance of the APIC.
* @param u8Pin Local pin number (0 or 1 for current CPUs).
*/
DECLR3CALLBACKMEMBER(int, pfnLocalInterruptR3,(PPDMDEVINS pDevIns, uint8_t u8Pin, uint8_t u8Level));
/** The name of the RC GetInterrupt entry point. */
const char *pszGetInterruptRC;
/** The name of the RC HasPendingIrq entry point. */
const char *pszHasPendingIrqRC;
/** The name of the RC SetBase entry point. */
const char *pszSetBaseRC;
/** The name of the RC GetBase entry point. */
const char *pszGetBaseRC;
/** The name of the RC SetTPR entry point. */
const char *pszSetTPRRC;
/** The name of the RC GetTPR entry point. */
const char *pszGetTPRRC;
/** The name of the RC WriteMSR entry point. */
const char *pszWriteMSRRC;
/** The name of the RC ReadMSR entry point. */
const char *pszReadMSRRC;
/** The name of the RC BusDeliver entry point. */
const char *pszBusDeliverRC;
/** The name of the RC LocalInterrupt entry point. */
const char *pszLocalInterruptRC;
/** The name of the R0 GetInterrupt entry point. */
const char *pszGetInterruptR0;
/** The name of the R0 HasPendingIrq entry point. */
const char *pszHasPendingIrqR0;
/** The name of the R0 SetBase entry point. */
const char *pszSetBaseR0;
/** The name of the R0 GetBase entry point. */
const char *pszGetBaseR0;
/** The name of the R0 SetTPR entry point. */
const char *pszSetTPRR0;
/** The name of the R0 GetTPR entry point. */
const char *pszGetTPRR0;
/** The name of the R0 WriteMSR entry point. */
const char *pszWriteMSRR0;
/** The name of the R0 ReadMSR entry point. */
const char *pszReadMSRR0;
/** The name of the R0 BusDeliver entry point. */
const char *pszBusDeliverR0;
/** The name of the R0 LocalInterrupt entry point. */
const char *pszLocalInterruptR0;
} PDMAPICREG;
/** Pointer to an APIC registration structure. */
typedef PDMAPICREG *PPDMAPICREG;
/** Current PDMAPICREG version number. */
/**
* APIC version argument for pfnChangeFeature.
*/
typedef enum PDMAPICVERSION
{
/** Invalid 0 entry. */
/** No APIC. */
/** Standard APIC (X86_CPUID_FEATURE_EDX_APIC). */
/** Intel X2APIC (X86_CPUID_FEATURE_ECX_X2APIC). */
/** The usual 32-bit paranoia. */
PDMAPICVERSION_32BIT_HACK = 0x7fffffff
/**
* APIC irq argument for SetInterruptFF.
*/
typedef enum PDMAPICIRQ
{
/** Invalid 0 entry. */
PDMAPICIRQ_INVALID = 0,
/** Normal hardware interrupt. */
/** NMI. */
/** SMI. */
/** ExtINT (HW interrupt via PIC). */
/** The usual 32-bit paranoia. */
PDMAPICIRQ_32BIT_HACK = 0x7fffffff
} PDMAPICIRQ;
/**
* APIC RC helpers.
*/
typedef struct PDMAPICHLPRC
{
/** Structure version. PDM_APICHLPRC_VERSION defines the current version. */
/**
* Set the interrupt force action flag.
*
* @param pDevIns Device instance of the APIC.
* @param enmType IRQ type.
* @param idCpu Virtual CPU to set flag upon.
*/
DECLRCCALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
/**
* Clear the interrupt force action flag.
*
* @param pDevIns Device instance of the APIC.
* @param enmType IRQ type.
* @param idCpu Virtual CPU to clear flag upon.
*/
DECLRCCALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
/**
* Modifies APIC-related bits in the CPUID feature mask.
*
* @param pDevIns Device instance of the APIC.
* @param enmVersion Supported APIC version.
*/
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns rc if we failed to acquire the lock.
* @param pDevIns The APIC device instance.
* @param rc What to return if we fail to acquire the lock.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The APIC device instance.
*/
/**
* Get the virtual CPU id corresponding to the current EMT.
*
* @param pDevIns The APIC device instance.
*/
/** Just a safety precaution. */
} PDMAPICHLPRC;
/** Pointer to APIC GC helpers. */
/** Pointer to const APIC helpers. */
/** Current PDMAPICHLPRC version number. */
/**
* APIC R0 helpers.
*/
typedef struct PDMAPICHLPR0
{
/** Structure version. PDM_APICHLPR0_VERSION defines the current version. */
/**
* Set the interrupt force action flag.
*
* @param pDevIns Device instance of the APIC.
* @param enmType IRQ type.
* @param idCpu Virtual CPU to set flag upon.
*/
DECLR0CALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
/**
* Clear the interrupt force action flag.
*
* @param pDevIns Device instance of the APIC.
* @param enmType IRQ type.
* @param idCpu Virtual CPU to clear flag upon.
*/
DECLR0CALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
/**
* Modifies APIC-related bits in the CPUID feature mask.
*
* @param pDevIns Device instance of the APIC.
* @param enmVersion Supported APIC version.
*/
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns rc if we failed to acquire the lock.
* @param pDevIns The APIC device instance.
* @param rc What to return if we fail to acquire the lock.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The APIC device instance.
*/
/**
* Get the virtual CPU id corresponding to the current EMT.
*
* @param pDevIns The APIC device instance.
*/
/** Just a safety precaution. */
} PDMAPICHLPR0;
/** Pointer to APIC GC helpers. */
/** Pointer to const APIC helpers. */
/** Current PDMAPICHLPR0 version number. */
/**
* APIC R3 helpers.
*/
typedef struct PDMAPICHLPR3
{
/** Structure version. PDM_APICHLPR3_VERSION defines the current version. */
/**
* Set the interrupt force action flag.
*
* @param pDevIns Device instance of the APIC.
* @param enmType IRQ type.
* @param idCpu Virtual CPU to set flag upon.
*/
DECLR3CALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
/**
* Clear the interrupt force action flag.
*
* @param pDevIns Device instance of the APIC.
* @param enmType IRQ type.
* @param idCpu Virtual CPU to clear flag upon.
*/
DECLR3CALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
/**
* Modifies APIC-related bits in the CPUID feature mask.
*
* @param pDevIns Device instance of the APIC.
* @param enmVersion Supported APIC version.
*/
/**
* Get the virtual CPU id corresponding to the current EMT.
*
* @param pDevIns The APIC device instance.
*/
/**
* Sends SIPI to given virtual CPU.
*
* @param pDevIns The APIC device instance.
* @param idCpu Virtual CPU to perform SIPI on
* @param iVector SIPI vector
*/
/**
* Sends init IPI to given virtual CPU, should result in reset and
* halting till SIPI.
*
* @param pDevIns The APIC device instance.
* @param idCpu Virtual CPU to perform SIPI on
*/
/**
* Gets the address of the RC APIC helpers.
*
* This should be called at both construction and relocation time
* to obtain the correct address of the RC helpers.
*
* @returns GC pointer to the APIC helpers.
* @param pDevIns Device instance of the APIC.
*/
/**
* Gets the address of the R0 APIC helpers.
*
* This should be called at both construction and relocation time
* to obtain the correct address of the R0 helpers.
*
* @returns R0 pointer to the APIC helpers.
* @param pDevIns Device instance of the APIC.
*/
/**
* Get the critical section used to synchronize the PICs, PCI and stuff.
*
* @returns Ring-3 pointer to the critical section.
* @param pDevIns The APIC device instance.
*/
/**
* Get the critical section used to synchronize the PICs, PCI and stuff.
*
* @returns Raw-mode context pointer to the critical section.
* @param pDevIns The APIC device instance.
*/
/**
* Get the critical section used to synchronize the PICs, PCI and stuff.
*
* @returns Ring-0 pointer to the critical section.
* @param pDevIns The APIC device instance.
*/
/** Just a safety precaution. */
} PDMAPICHLPR3;
/** Pointer to APIC helpers. */
/** Pointer to const APIC helpers. */
/** Current PDMAPICHLP version number. */
/**
* I/O APIC registration structure.
*/
typedef struct PDMIOAPICREG
{
/** Struct version+magic number (PDM_IOAPICREG_VERSION). */
/**
* Set the an IRQ.
*
* @param pDevIns Device instance of the I/O APIC.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
*/
/** The name of the GC SetIrq entry point. */
const char *pszSetIrqRC;
/** The name of the R0 SetIrq entry point. */
const char *pszSetIrqR0;
} PDMIOAPICREG;
/** Pointer to an APIC registration structure. */
typedef PDMIOAPICREG *PPDMIOAPICREG;
/** Current PDMAPICREG version number. */
/**
* IOAPIC RC helpers.
*/
typedef struct PDMIOAPICHLPRC
{
/** Structure version. PDM_IOAPICHLPRC_VERSION defines the current version. */
/**
* Private interface between the IOAPIC and APIC.
*
* See comments about this hack on PDMAPICREG::pfnBusDeliverR3.
*
* @returns status code.
* @param pDevIns Device instance of the IOAPIC.
* @param u8Dest See APIC implementation.
* @param u8DestMode See APIC implementation.
* @param u8DeliveryMode See APIC implementation.
* @param iVector See APIC implementation.
* @param u8Polarity See APIC implementation.
* @param u8TriggerMode See APIC implementation.
*/
DECLRCCALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns rc if we failed to acquire the lock.
* @param pDevIns The IOAPIC device instance.
* @param rc What to return if we fail to acquire the lock.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The IOAPIC device instance.
*/
/** Just a safety precaution. */
/** Pointer to IOAPIC RC helpers. */
/** Pointer to const IOAPIC helpers. */
/** Current PDMIOAPICHLPRC version number. */
/**
* IOAPIC R0 helpers.
*/
typedef struct PDMIOAPICHLPR0
{
/** Structure version. PDM_IOAPICHLPR0_VERSION defines the current version. */
/**
* Private interface between the IOAPIC and APIC.
*
* See comments about this hack on PDMAPICREG::pfnBusDeliverR3.
*
* @returns status code.
* @param pDevIns Device instance of the IOAPIC.
* @param u8Dest See APIC implementation.
* @param u8DestMode See APIC implementation.
* @param u8DeliveryMode See APIC implementation.
* @param iVector See APIC implementation.
* @param u8Polarity See APIC implementation.
* @param u8TriggerMode See APIC implementation.
*/
DECLR0CALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns rc if we failed to acquire the lock.
* @param pDevIns The IOAPIC device instance.
* @param rc What to return if we fail to acquire the lock.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The IOAPIC device instance.
*/
/** Just a safety precaution. */
/** Pointer to IOAPIC R0 helpers. */
/** Pointer to const IOAPIC helpers. */
/** Current PDMIOAPICHLPR0 version number. */
/**
* IOAPIC R3 helpers.
*/
typedef struct PDMIOAPICHLPR3
{
/** Structure version. PDM_IOAPICHLPR3_VERSION defines the current version. */
/**
* Private interface between the IOAPIC and APIC.
*
* See comments about this hack on PDMAPICREG::pfnBusDeliverR3.
*
* @returns status code
* @param pDevIns Device instance of the IOAPIC.
* @param u8Dest See APIC implementation.
* @param u8DestMode See APIC implementation.
* @param u8DeliveryMode See APIC implementation.
* @param iVector See APIC implementation.
* @param u8Polarity See APIC implementation.
* @param u8TriggerMode See APIC implementation.
*/
DECLR3CALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
/**
* Acquires the PDM lock.
*
* @returns VINF_SUCCESS on success.
* @returns Fatal error on failure.
* @param pDevIns The IOAPIC device instance.
* @param rc Dummy for making the interface identical to the GC and R0 versions.
*/
/**
* Releases the PDM lock.
*
* @param pDevIns The IOAPIC device instance.
*/
/**
* Gets the address of the RC IOAPIC helpers.
*
* This should be called at both construction and relocation time
* to obtain the correct address of the RC helpers.
*
* @returns RC pointer to the IOAPIC helpers.
* @param pDevIns Device instance of the IOAPIC.
*/
/**
* Gets the address of the R0 IOAPIC helpers.
*
* This should be called at both construction and relocation time
* to obtain the correct address of the R0 helpers.
*
* @returns R0 pointer to the IOAPIC helpers.
* @param pDevIns Device instance of the IOAPIC.
*/
/** Just a safety precaution. */
/** Pointer to IOAPIC R3 helpers. */
/** Pointer to const IOAPIC helpers. */
/** Current PDMIOAPICHLPR3 version number. */
/**
* HPET registration structure.
*/
typedef struct PDMHPETREG
{
/** Struct version+magic number (PDM_HPETREG_VERSION). */
} PDMHPETREG;
/** Pointer to an HPET registration structure. */
typedef PDMHPETREG *PPDMHPETREG;
/** Current PDMHPETREG version number. */
/**
* HPET RC helpers.
*
* @remarks Keep this around in case HPET will need PDM interaction in again RC
* at some later point.
*/
typedef struct PDMHPETHLPRC
{
/** Structure version. PDM_HPETHLPRC_VERSION defines the current version. */
/** Just a safety precaution. */
} PDMHPETHLPRC;
/** Pointer to HPET RC helpers. */
/** Pointer to const HPET RC helpers. */
/** Current PDMHPETHLPRC version number. */
/**
* HPET R0 helpers.
*
* @remarks Keep this around in case HPET will need PDM interaction in again R0
* at some later point.
*/
typedef struct PDMHPETHLPR0
{
/** Structure version. PDM_HPETHLPR0_VERSION defines the current version. */
/** Just a safety precaution. */
} PDMHPETHLPR0;
/** Pointer to HPET R0 helpers. */
/** Pointer to const HPET R0 helpers. */
/** Current PDMHPETHLPR0 version number. */
/**
* HPET R3 helpers.
*/
typedef struct PDMHPETHLPR3
{
/** Structure version. PDM_HPETHLP_VERSION defines the current version. */
/**
* Gets the address of the RC HPET helpers.
*
* This should be called at both construction and relocation time
* to obtain the correct address of the RC helpers.
*
* @returns RC pointer to the HPET helpers.
* @param pDevIns Device instance of the HPET.
*/
/**
* Gets the address of the R0 HPET helpers.
*
* This should be called at both construction and relocation time
* to obtain the correct address of the R0 helpers.
*
* @returns R0 pointer to the HPET helpers.
* @param pDevIns Device instance of the HPET.
*/
/**
* Set legacy mode on PIT and RTC.
*
* @returns VINF_SUCCESS on success.
* @returns rc if we failed to set legacy mode.
* @param pDevIns Device instance of the HPET.
* @param fActivated Whether legacy mode is activated or deactivated.
*/
/**
* Set IRQ, bypassing ISA bus override rules.
*
* @returns VINF_SUCCESS on success.
* @returns rc if we failed to set legacy mode.
* @param pDevIns Device instance of the HPET.
* @param fActivate Activate or deactivate legacy mode.
*/
/** Just a safety precaution. */
} PDMHPETHLPR3;
/** Pointer to HPET R3 helpers. */
/** Pointer to const HPET R3 helpers. */
/** Current PDMHPETHLPR3 version number. */
#ifdef IN_RING3
/**
* DMA Transfer Handler.
*
* @returns Number of bytes transferred.
* @param pDevIns Device instance of the DMA.
* @param pvUser User pointer.
* @param uChannel Channel number.
* @param off DMA position.
* @param cb Block size.
*/
typedef DECLCALLBACK(uint32_t) FNDMATRANSFERHANDLER(PPDMDEVINS pDevIns, void *pvUser, unsigned uChannel, uint32_t off, uint32_t cb);
/** Pointer to a FNDMATRANSFERHANDLER(). */
typedef FNDMATRANSFERHANDLER *PFNDMATRANSFERHANDLER;
/**
* DMA Controller registration structure.
*/
typedef struct PDMDMAREG
{
/** Structure version number. PDM_DMACREG_VERSION defines the current version. */
/**
* Execute pending transfers.
*
* @returns A more work indiciator. I.e. 'true' if there is more to be done, and 'false' if all is done.
* @param pDevIns Device instance of the DMAC.
*/
/**
* Register transfer function for DMA channel.
*
* @param pDevIns Device instance of the DMAC.
* @param uChannel Channel number.
* @param pfnTransferHandler Device specific transfer function.
* @param pvUSer User pointer to be passed to the callback.
*/
DECLR3CALLBACKMEMBER(void, pfnRegister,(PPDMDEVINS pDevIns, unsigned uChannel, PFNDMATRANSFERHANDLER pfnTransferHandler, void *pvUser));
/**
* Read memory
*
* @returns Number of bytes read.
* @param pDevIns Device instance of the DMAC.
* @param pvBuffer Pointer to target buffer.
* @param off DMA position.
* @param cbBlock Block size.
*/
DECLR3CALLBACKMEMBER(uint32_t, pfnReadMemory,(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock));
/**
* Write memory
*
* @returns Number of bytes written.
* @param pDevIns Device instance of the DMAC.
* @param pvBuffer Memory to write.
* @param off DMA position.
* @param cbBlock Block size.
*/
DECLR3CALLBACKMEMBER(uint32_t, pfnWriteMemory,(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock));
/**
* Set the DREQ line.
*
* @param pDevIns Device instance of the DMAC.
* @param uChannel Channel number.
* @param uLevel Level of the line.
*/
/**
* Get channel mode
*
* @returns Channel mode.
* @param pDevIns Device instance of the DMAC.
* @param uChannel Channel number.
*/
} PDMDMACREG;
/** Pointer to a DMAC registration structure. */
typedef PDMDMACREG *PPDMDMACREG;
/** Current PDMDMACREG version number. */
/**
* DMA Controller device helpers.
*/
typedef struct PDMDMACHLP
{
/** Structure version. PDM_DMACHLP_VERSION defines the current version. */
/* to-be-defined */
} PDMDMACHLP;
/** Pointer to DMAC helpers. */
typedef PDMDMACHLP *PPDMDMACHLP;
/** Pointer to const DMAC helpers. */
typedef const PDMDMACHLP *PCPDMDMACHLP;
/** Current PDMDMACHLP version number. */
#endif /* IN_RING3 */
/**
* RTC registration structure.
*/
typedef struct PDMRTCREG
{
/** Structure version number. PDM_RTCREG_VERSION defines the current version. */
/**
* Write to a CMOS register and update the checksum if necessary.
*
* @returns VBox status code.
* @param pDevIns Device instance of the RTC.
* @param iReg The CMOS register index.
* @param u8Value The CMOS register value.
*/
/**
* Read a CMOS register.
*
* @returns VBox status code.
* @param pDevIns Device instance of the RTC.
* @param iReg The CMOS register index.
* @param pu8Value Where to store the CMOS register value.
*/
} PDMRTCREG;
/** Pointer to a RTC registration structure. */
typedef PDMRTCREG *PPDMRTCREG;
/** Pointer to a const RTC registration structure. */
typedef const PDMRTCREG *PCPDMRTCREG;
/** Current PDMRTCREG version number. */
/**
* RTC device helpers.
*/
typedef struct PDMRTCHLP
{
/** Structure version. PDM_RTCHLP_VERSION defines the current version. */
/* to-be-defined */
} PDMRTCHLP;
/** Pointer to RTC helpers. */
typedef PDMRTCHLP *PPDMRTCHLP;
/** Pointer to const RTC helpers. */
typedef const PDMRTCHLP *PCPDMRTCHLP;
/** Current PDMRTCHLP version number. */
#ifdef IN_RING3
/**
* PDM Device API.
*/
typedef struct PDMDEVHLPR3
{
/** Structure version. PDM_DEVHLP_VERSION defines the current version. */
/**
* Register a number of I/O ports with a device.
*
* These callbacks are of course for the host context (HC).
* Register HC handlers before guest context (GC) handlers! There must be a
* HC handler for every GC handler!
*
* @returns VBox status.
* @param pDevIns The device instance to register the ports with.
* @param Port First port number in the range.
* @param cPorts Number of ports to register.
* @param pvUser User argument.
* @param pfnOut Pointer to function which is gonna handle OUT operations.
* @param pfnIn Pointer to function which is gonna handle IN operations.
* @param pfnOutStr Pointer to function which is gonna handle string OUT operations.
* @param pfnInStr Pointer to function which is gonna handle string IN operations.
* @param pszDesc Pointer to description string. This must not be freed.
*/
DECLR3CALLBACKMEMBER(int, pfnIOPortRegister,(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTHCPTR pvUser,
/**
* Register a number of I/O ports with a device for RC.
*
* These callbacks are for the raw-mode context (RC). Register ring-3 context
* (R3) handlers before raw-mode context handlers! There must be a R3 handler
* for every RC handler!
*
* @returns VBox status.
* @param pDevIns The device instance to register the ports with
* and which RC module to resolve the names
* against.
* @param Port First port number in the range.
* @param cPorts Number of ports to register.
* @param pvUser User argument.
* @param pszOut Name of the RC function which is gonna handle OUT operations.
* @param pszIn Name of the RC function which is gonna handle IN operations.
* @param pszOutStr Name of the RC function which is gonna handle string OUT operations.
* @param pszInStr Name of the RC function which is gonna handle string IN operations.
* @param pszDesc Pointer to description string. This must not be freed.
*/
DECLR3CALLBACKMEMBER(int, pfnIOPortRegisterRC,(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTRCPTR pvUser,
/**
* Register a number of I/O ports with a device.
*
* These callbacks are of course for the ring-0 host context (R0).
* Register R3 (HC) handlers before R0 (R0) handlers! There must be a R3 (HC) handler for every R0 handler!
*
* @returns VBox status.
* @param pDevIns The device instance to register the ports with.
* @param Port First port number in the range.
* @param cPorts Number of ports to register.
* @param pvUser User argument. (if pointer, then it must be in locked memory!)
* @param pszOut Name of the R0 function which is gonna handle OUT operations.
* @param pszIn Name of the R0 function which is gonna handle IN operations.
* @param pszOutStr Name of the R0 function which is gonna handle string OUT operations.
* @param pszInStr Name of the R0 function which is gonna handle string IN operations.
* @param pszDesc Pointer to description string. This must not be freed.
*/
DECLR3CALLBACKMEMBER(int, pfnIOPortRegisterR0,(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTR0PTR pvUser,
/**
* Deregister I/O ports.
*
*
* @returns VBox status.
* @param pDevIns The device instance owning the ports.
* @param Port First port number in the range.
* @param cPorts Number of ports to deregister.
*/
/**
* Register a Memory Mapped I/O (MMIO) region.
*
* These callbacks are of course for the ring-3 context (R3). Register HC
* handlers before raw-mode context (RC) and ring-0 context (R0) handlers! There
* must be a R3 handler for every RC and R0 handler!
*
* @returns VBox status.
* @param pDevIns The device instance to register the MMIO with.
* @param GCPhysStart First physical address in the range.
* @param cbRange The size of the range (in bytes).
* @param pvUser User argument.
* @param pfnWrite Pointer to function which is gonna handle Write operations.
* @param pfnRead Pointer to function which is gonna handle Read operations.
* @param pszDesc Pointer to description string. This must not be freed.
*/
DECLR3CALLBACKMEMBER(int, pfnMMIORegister,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTHCPTR pvUser,
const char *pszDesc));
/**
* Register a Memory Mapped I/O (MMIO) region for GC.
*
* These callbacks are for the raw-mode context (RC). Register ring-3 context
* (R3) handlers before guest context handlers! There must be a R3 handler for
* every RC handler!
*
* @returns VBox status.
* @param pDevIns The device instance to register the MMIO with.
* @param GCPhysStart First physical address in the range.
* @param cbRange The size of the range (in bytes).
* @param pvUser User argument.
* @param pszWrite Name of the RC function which is gonna handle Write operations.
* @param pszRead Name of the RC function which is gonna handle Read operations.
* @param pszDesc Obsolete. NULL is fine.
* @todo Remove pszDesc in the next major revision of PDMDEVHLPR3.
*/
DECLR3CALLBACKMEMBER(int, pfnMMIORegisterRC,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTGCPTR pvUser,
const char *pszDesc));
/**
* Register a Memory Mapped I/O (MMIO) region for R0.
*
* These callbacks are for the ring-0 host context (R0). Register ring-3
* constext (R3) handlers before R0 handlers! There must be a R3 handler for
* every R0 handler!
*
* @returns VBox status.
* @param pDevIns The device instance to register the MMIO with.
* @param GCPhysStart First physical address in the range.
* @param cbRange The size of the range (in bytes).
* @param pvUser User argument. (if pointer, then it must be in locked memory!)
* @param pszWrite Name of the RC function which is gonna handle Write operations.
* @param pszRead Name of the RC function which is gonna handle Read operations.
* @param pszDesc Obsolete. NULL is fine.
* @todo Remove pszDesc in the next major revision of PDMDEVHLPR3.
*/
DECLR3CALLBACKMEMBER(int, pfnMMIORegisterR0,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTR0PTR pvUser,
const char *pszDesc));
/**
* Deregister a Memory Mapped I/O (MMIO) region.
*
*
* @returns VBox status.
* @param pDevIns The device instance owning the MMIO region(s).
* @param GCPhysStart First physical address in the range.
* @param cbRange The size of the range (in bytes).
*/
DECLR3CALLBACKMEMBER(int, pfnMMIODeregister,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange));
/**
* Allocate and register a MMIO2 region.
*
* As mentioned elsewhere, MMIO2 is just RAM spelled differently. It's
* RAM associated with a device. It is also non-shared memory with a
* permanent ring-3 mapping and page backing (presently).
*
* @returns VBox status.
* @param pDevIns The device instance.
* @param iRegion The region number. Use the PCI region number as
* this must be known to the PCI bus device too. If
* it's not associated with the PCI device, then
* any number up to UINT8_MAX is fine.
* @param cb The size (in bytes) of the region.
* @param fFlags Reserved for future use, must be zero.
* @param ppv Where to store the address of the ring-3 mapping
* of the memory.
* @param pszDesc Pointer to description string. This must not be
* freed.
* @thread EMT.
*/
DECLR3CALLBACKMEMBER(int, pfnMMIO2Register,(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc));
/**
* Deregisters and frees a MMIO2 region.
*
* Any physical (and virtual) access handlers registered for the region must
* be deregistered before calling this function.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param iRegion The region number used during registration.
* @thread EMT.
*/
/**
* Maps a MMIO2 region into the physical memory space.
*
* A MMIO2 range may overlap with base memory if a lot of RAM
* is configured for the VM, in which case we'll drop the base
* memory pages. Presently we will make no attempt to preserve
* anything that happens to be present in the base memory that
* is replaced, this is of course incorrectly but it's too much
* effort.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param iRegion The region number used during registration.
* @param GCPhys The physical address to map it at.
* @thread EMT.
*/
/**
* Unmaps a MMIO2 region previously mapped using pfnMMIO2Map.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param iRegion The region number used during registration.
* @param GCPhys The physical address it's currently mapped at.
* @thread EMT.
*/
/**
* Maps a portion of an MMIO2 region into the hypervisor region.
*
* Callers of this API must never deregister the MMIO2 region before the
* VM is powered off.
*
* @return VBox status code.
* @param pDevIns The device owning the MMIO2 memory.
* @param iRegion The region.
* @param off The offset into the region. Will be rounded down
* to closest page boundrary.
* @param cb The number of bytes to map. Will be rounded up
* to the closest page boundrary.
* @param pszDesc Mapping description.
* @param pRCPtr Where to store the RC address.
*/
DECLR3CALLBACKMEMBER(int, pfnMMHyperMapMMIO2,(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
/**
* Maps a portion of an MMIO2 region into kernel space (host).
*
* The kernel mapping will become invalid when the MMIO2 memory is deregistered
* or the VM is terminated.
*
* @return VBox status code.
* @param pDevIns The device owning the MMIO2 memory.
* @param iRegion The region.
* @param off The offset into the region. Must be page
* aligned.
* @param cb The number of bytes to map. Must be page
* aligned.
* @param pszDesc Mapping description.
* @param pR0Ptr Where to store the R0 address.
*/
DECLR3CALLBACKMEMBER(int, pfnMMIO2MapKernel,(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
/**
* Register a ROM (BIOS) region.
*
* It goes without saying that this is read-only memory. The memory region must be
* in unassigned memory. I.e. from the top of the address space or on the PC in
* the 0xa0000-0xfffff range.
*
* @returns VBox status.
* @param pDevIns The device instance owning the ROM region.
* @param GCPhysStart First physical address in the range.
* Must be page aligned!
* @param cbRange The size of the range (in bytes).
* Must be page aligned!
* @param pvBinary Pointer to the binary data backing the ROM image.
* This must be cbRange bytes big.
* It will be copied and doesn't have to stick around if fShadow is clear.
* @param fFlags Shadow ROM flags, PGMPHYS_ROM_FLAGS_* in pgm.h.
* @param pszDesc Pointer to description string. This must not be freed.
*
* @remark There is no way to remove the rom, automatically on device cleanup or
* manually from the device yet. At present I doubt we need such features...
*/
DECLR3CALLBACKMEMBER(int, pfnROMRegister,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, uint32_t fFlags, const char *pszDesc));
/**
* Changes the protection of shadowed ROM mapping.
*
* This is intented for use by the system BIOS, chipset or device in question to
* change the protection of shadowed ROM code after init and on reset.
*
* @param pDevIns The device instance.
* @param GCPhysStart Where the mapping starts.
* @param cbRange The size of the mapping.
* @param enmProt The new protection type.
*/
DECLR3CALLBACKMEMBER(int, pfnROMProtectShadow,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, PGMROMPROT enmProt));
/**
* Register a save state data unit.
*
* @returns VBox status.
* @param pDevIns The device instance.
* @param pszName Data unit name.
* @param uInstance The instance identifier of the data unit.
* This must together with the name be unique.
* @param uVersion Data layout version number.
* @param cbGuess The approximate amount of data in the unit.
* Only for progress indicators.
* @param pszBefore Name of data unit which we should be put in
* front of. Optional (NULL).
*
* @param pfnLivePrep Prepare live save callback, optional.
* @param pfnLiveExec Execute live save callback, optional.
* @param pfnLiveVote Vote live save callback, optional.
*
* @param pfnSavePrep Prepare save callback, optional.
* @param pfnSaveExec Execute save callback, optional.
* @param pfnSaveDone Done save callback, optional.
*
* @param pfnLoadPrep Prepare load callback, optional.
* @param pfnLoadExec Execute load callback, optional.
* @param pfnLoadDone Done load callback, optional.
*/
DECLR3CALLBACKMEMBER(int, pfnSSMRegister,(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess, const char *pszBefore,
/**
* Creates a timer.
*
* @returns VBox status.
* @param pDevIns The device instance.
* @param enmClock The clock to use on this timer.
* @param pfnCallback Callback function.
* @param pvUser User argument for the callback.
* @param fFlags Flags, see TMTIMER_FLAGS_*.
* @param pszDesc Pointer to description string which must stay around
* until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
* @param ppTimer Where to store the timer on success.
*/
DECLR3CALLBACKMEMBER(int, pfnTMTimerCreate,(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer));
/**
* Get the real world UTC time adjusted for VM lag, user offset and warpdrive.
*
* @returns pTime.
* @param pDevIns The device instance.
* @param pTime Where to store the time.
*/
/**
* Read physical memory.
*
* @returns VINF_SUCCESS (for now).
* @param pDevIns The device instance.
* @param GCPhys Physical address start reading from.
* @param pvBuf Where to put the read bits.
* @param cbRead How many bytes to read.
* @thread Any thread, but the call may involve the emulation thread.
*/
DECLR3CALLBACKMEMBER(int, pfnPhysRead,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead));
/**
* Write to physical memory.
*
* @returns VINF_SUCCESS for now, and later maybe VERR_EM_MEMORY.
* @param pDevIns The device instance.
* @param GCPhys Physical address to write to.
* @param pvBuf What to write.
* @param cbWrite How many bytes to write.
* @thread Any thread, but the call may involve the emulation thread.
*/
DECLR3CALLBACKMEMBER(int, pfnPhysWrite,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite));
/**
* Requests the mapping of a guest page into ring-3.
*
* When you're done with the page, call pfnPhysReleasePageMappingLock() ASAP to
* release it.
*
* This API will assume your intention is to write to the page, and will
* therefore replace shared and zero pages. If you do not intend to modify the
* page, use the pfnPhysGCPhys2CCPtrReadOnly() API.
*
* @returns VBox status code.
* @retval VINF_SUCCESS on success.
* @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical
* backing or if the page has any active access handlers. The caller
* must fall back on using PGMR3PhysWriteExternal.
* @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address.
*
* @param pVM The VM handle.
* @param GCPhys The guest physical address of the page that
* should be mapped.
* @param fFlags Flags reserved for future use, MBZ.
* @param ppv Where to store the address corresponding to
* GCPhys.
* @param pLock Where to store the lock information that
* pfnPhysReleasePageMappingLock needs.
*
* @remark Avoid calling this API from within critical sections (other than the
* PGM one) because of the deadlock risk when we have to delegating the
* task to an EMT.
* @thread Any.
*/
DECLR3CALLBACKMEMBER(int, pfnPhysGCPhys2CCPtr,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, void **ppv, PPGMPAGEMAPLOCK pLock));
/**
* Requests the mapping of a guest page into ring-3, external threads.
*
* When you're done with the page, call pfnPhysReleasePageMappingLock() ASAP to
* release it.
*
* @returns VBox status code.
* @retval VINF_SUCCESS on success.
* @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical
* backing or if the page as an active ALL access handler. The caller
* must fall back on using PGMPhysRead.
* @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address.
*
* @param pDevIns The device instance.
* @param GCPhys The guest physical address of the page that
* should be mapped.
* @param fFlags Flags reserved for future use, MBZ.
* @param ppv Where to store the address corresponding to
* GCPhys.
* @param pLock Where to store the lock information that
* pfnPhysReleasePageMappingLock needs.
*
* @remark Avoid calling this API from within critical sections.
* @thread Any.
*/
DECLR3CALLBACKMEMBER(int, pfnPhysGCPhys2CCPtrReadOnly,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, void const **ppv, PPGMPAGEMAPLOCK pLock));
/**
* Release the mapping of a guest page.
*
* This is the counter part of pfnPhysGCPhys2CCPtr and
* pfnPhysGCPhys2CCPtrReadOnly.
*
* @param pDevIns The device instance.
* @param pLock The lock structure initialized by the mapping
* function.
*/
DECLR3CALLBACKMEMBER(void, pfnPhysReleasePageMappingLock,(PPDMDEVINS pDevIns, PPGMPAGEMAPLOCK pLock));
/**
* Read guest physical memory by virtual address.
*
* @param pDevIns The device instance.
* @param pvDst Where to put the read bits.
* @param GCVirtSrc Guest virtual address to start reading from.
* @param cb How many bytes to read.
* @thread The emulation thread.
*/
DECLR3CALLBACKMEMBER(int, pfnPhysReadGCVirt,(PPDMDEVINS pDevIns, void *pvDst, RTGCPTR GCVirtSrc, size_t cb));
/**
* Write to guest physical memory by virtual address.
*
* @param pDevIns The device instance.
* @param GCVirtDst Guest virtual address to write to.
* @param pvSrc What to write.
* @param cb How many bytes to write.
* @thread The emulation thread.
*/
DECLR3CALLBACKMEMBER(int, pfnPhysWriteGCVirt,(PPDMDEVINS pDevIns, RTGCPTR GCVirtDst, const void *pvSrc, size_t cb));
/**
* Convert a guest virtual address to a guest physical address.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param GCPtr Guest virtual address.
* @param pGCPhys Where to store the GC physical address
* corresponding to GCPtr.
* @thread The emulation thread.
* @remark Careful with page boundraries.
*/
DECLR3CALLBACKMEMBER(int, pfnPhysGCPtr2GCPhys, (PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys));
/**
* Allocate memory which is associated with current VM instance
* and automatically freed on it's destruction.
*
* @returns Pointer to allocated memory. The memory is *NOT* zero-ed.
* @param pDevIns The device instance.
* @param cb Number of bytes to allocate.
*/
/**
* Allocate memory which is associated with current VM instance
* and automatically freed on it's destruction. The memory is ZEROed.
*
* @returns Pointer to allocated memory. The memory is *NOT* zero-ed.
* @param pDevIns The device instance.
* @param cb Number of bytes to allocate.
*/
/**
* Free memory allocated with pfnMMHeapAlloc() and pfnMMHeapAllocZ().
*
* @param pDevIns The device instance.
* @param pv Pointer to the memory to free.
*/
/**
* Gets the VM state.
*
* @returns VM state.
* @param pDevIns The device instance.
* @thread Any thread (just keep in mind that it's volatile info).
*/
/**
* Checks if the VM was teleported and hasn't been fully resumed yet.
*
* @returns true / false.
* @param pDevIns The device instance.
* @thread Any thread.
*/
/**
* Set the VM error message
*
* @returns rc.
* @param pDevIns The device instance.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param ... Error message arguments.
*/
DECLR3CALLBACKMEMBER(int, pfnVMSetError,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...));
/**
* Set the VM error message
*
* @returns rc.
* @param pDevIns The device instance.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param va Error message arguments.
*/
DECLR3CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va));
/**
* Set the VM runtime error message
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
* @param pszErrorId Error ID string.
* @param pszFormat Error message format string.
* @param ... Error message arguments.
*/
DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...));
/**
* Set the VM runtime error message
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
* @param pszErrorId Error ID string.
* @param pszFormat Error message format string.
* @param va Error message arguments.
*/
DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va));
/**
* Stops the VM and enters the debugger to look at the guest state.
*
* Use the PDMDeviceDBGFStop() inline function with the RT_SRC_POS macro instead of
* invoking this function directly.
*
* @returns VBox status code which must be passed up to the VMM.
* @param pDevIns The device instance.
* @param pszFile Filename of the assertion location.
* @param iLine The linenumber of the assertion location.
* @param pszFunction Function of the assertion location.
* @param pszFormat Message. (optional)
* @param args Message parameters.
*/
DECLR3CALLBACKMEMBER(int, pfnDBGFStopV,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction, const char *pszFormat, va_list args));
/**
* Register a info handler with DBGF,
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pszName The identifier of the info.
* @param pszDesc The description of the info and any arguments
* the handler may take.
* @param pfnHandler The handler function to be called to display the
* info.
*/
DECLR3CALLBACKMEMBER(int, pfnDBGFInfoRegister,(PPDMDEVINS pDevIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler));
/**
* Registers a statistics sample if statistics are enabled.
*
* @param pDevIns Device instance of the DMA.
* @param pvSample Pointer to the sample.
* @param enmType Sample type. This indicates what pvSample is
* pointing at.
* @param pszName Sample name. The name is on this form
* "/<component>/<sample>". Further nesting is
* possible.
* @param enmUnit Sample unit.
* @param pszDesc Sample description.
*/
DECLR3CALLBACKMEMBER(void, pfnSTAMRegister,(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc));
/**
* Same as pfnSTAMRegister except that the name is specified in a
* RTStrPrintf like fashion.
*
* @returns VBox status.
* @param pDevIns Device instance of the DMA.
* @param pvSample Pointer to the sample.
* @param enmType Sample type. This indicates what pvSample is
* pointing at.
* @param enmVisibility Visibility type specifying whether unused
* statistics should be visible or not.
* @param enmUnit Sample unit.
* @param pszDesc Sample description.
* @param pszName The sample name format string.
* @param ... Arguments to the format string.
*/
DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterF,(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
/**
* Same as pfnSTAMRegister except that the name is specified in a
* RTStrPrintfV like fashion.
*
* @returns VBox status.
* @param pDevIns Device instance of the DMA.
* @param pvSample Pointer to the sample.
* @param enmType Sample type. This indicates what pvSample is
* pointing at.
* @param enmVisibility Visibility type specifying whether unused
* statistics should be visible or not.
* @param enmUnit Sample unit.
* @param pszDesc Sample description.
* @param pszName The sample name format string.
* @param args Arguments to the format string.
*/
DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
/**
* Registers the device with the default PCI bus.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pPciDev The PCI device structure.
* Any PCI enabled device must keep this in it's instance data!
* Fill in the PCI data config before registration, please.
* @remark This is the simple interface, a Ex interface will be created if
* more features are needed later.
*/
/**
* Initialize MSI support in a PCI device.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pMsiReg MSI registartion structure.
*/
/**
* Registers a I/O region (memory mapped or I/O ports) for a PCI device.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param iRegion The region number.
* @param cbRegion Size of the region.
* @param enmType PCI_ADDRESS_SPACE_MEM, PCI_ADDRESS_SPACE_IO or PCI_ADDRESS_SPACE_MEM_PREFETCH.
* @param pfnCallback Callback for doing the mapping.
*/
DECLR3CALLBACKMEMBER(int, pfnPCIIORegionRegister,(PPDMDEVINS pDevIns, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback));
/**
*
* @param pDevIns The device instance.
* @param pPciDev The PCI device structure.
* If NULL the default PCI device for this device instance is used.
* @param pfnRead Pointer to the user defined PCI config read function.
* @param ppfnReadOld Pointer to function pointer which will receive the old (default)
* PCI config read function. This way, user can decide when (and if)
* to call default PCI config read function. Can be NULL.
* @param pfnWrite Pointer to the user defined PCI config write function.
* @param pfnWriteOld Pointer to function pointer which will receive the old (default)
* PCI config write function. This way, user can decide when (and if)
* to call default PCI config write function. Can be NULL.
* @thread EMT
*/
DECLR3CALLBACKMEMBER(void, pfnPCISetConfigCallbacks,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
/**
* Set the IRQ for a PCI device.
*
* @param pDevIns The device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread Any thread, but will involve the emulation thread.
*/
/**
* Set the IRQ for a PCI device, but don't wait for EMT to process
* the request when not called from EMT.
*
* @param pDevIns The device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level.
* @thread Any thread, but will involve the emulation thread.
*/
/**
* Set ISA IRQ for a device.
*
* @param pDevIns The device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread Any thread, but will involve the emulation thread.
*/
/**
* Set the ISA IRQ for a device, but don't wait for EMT to process
* the request when not called from EMT.
*
* @param pDevIns The device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread Any thread, but will involve the emulation thread.
*/
/**
* Attaches a driver (chain) to the device.
*
* The first call for a LUN this will serve as a registartion of the LUN. The pBaseInterface and
* the pszDesc string will be registered with that LUN and kept around for PDMR3QueryDeviceLun().
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param iLun The logical unit to attach.
* @param pBaseInterface Pointer to the base interface for that LUN. (device side / down)
* @param ppBaseInterface Where to store the pointer to the base interface. (driver side / up)
* @param pszDesc Pointer to a string describing the LUN. This string must remain valid
* for the live of the device instance.
*/
DECLR3CALLBACKMEMBER(int, pfnDriverAttach,(PPDMDEVINS pDevIns, RTUINT iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc));
/**
* Create a queue.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param cbItem The size of a queue item.
* @param cItems The number of items in the queue.
* @param cMilliesInterval The number of milliseconds between polling the queue.
* If 0 then the emulation thread will be notified whenever an item arrives.
* @param pfnCallback The consumer function.
* @param fRZEnabled Set if the queue should work in RC and R0.
* @param pszName The queue base name. The instance number will be
* appended automatically.
* @param ppQueue Where to store the queue handle on success.
* @thread The emulation thread.
*/
DECLR3CALLBACKMEMBER(int, pfnQueueCreate,(PPDMDEVINS pDevIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
/**
* Initializes a PDM critical section.
*
* The PDM critical sections are derived from the IPRT critical sections, but
* works in RC and R0 as well.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pCritSect Pointer to the critical section.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszNameFmt Format string for namging the critical section.
* For statistics and lock validation.
* @param va Arguments for the format string.
*/
DECLR3CALLBACKMEMBER(int, pfnCritSectInit,(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, RT_SRC_POS_DECL,
/**
* Creates a PDM thread.
*
* This differs from the RTThreadCreate() API in that PDM takes care of suspending,
* resuming, and destroying the thread as the VM state changes.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param ppThread Where to store the thread 'handle'.
* @param pvUser The user argument to the thread function.
* @param pfnThread The thread function.
* @param pfnWakeup The wakup callback. This is called on the EMT
* thread when a state change is pending.
* @param cbStack See RTThreadCreate.
* @param enmType See RTThreadCreate.
* @param pszName See RTThreadCreate.
*/
DECLR3CALLBACKMEMBER(int, pfnThreadCreate,(PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread,
/**
* Set up asynchronous handling of a suspend, reset or power off notification.
*
* This shall only be called when getting the notification. It must be called
* for each one.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pfnAsyncNotify The callback.
* @thread EMT(0)
*/
DECLR3CALLBACKMEMBER(int, pfnSetAsyncNotification, (PPDMDEVINS pDevIns, PFNPDMDEVASYNCNOTIFY pfnAsyncNotify));
/**
* Notify EMT(0) that the device has completed the asynchronous notification
* handling.
*
* This can be called at any time, spurious calls will simply be ignored.
*
* @param pDevIns The device instance.
* @thread Any
*/
/**
* Register the RTC device.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pRtcReg Pointer to a RTC registration structure.
* @param ppRtcHlp Where to store the pointer to the helper
* functions.
*/
DECLR3CALLBACKMEMBER(int, pfnRTCRegister,(PPDMDEVINS pDevIns, PCPDMRTCREG pRtcReg, PCPDMRTCHLP *ppRtcHlp));
/**
* Register the PCI Bus.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pPciBusReg Pointer to PCI bus registration structure.
* @param ppPciHlpR3 Where to store the pointer to the PCI Bus
* helpers.
*/
DECLR3CALLBACKMEMBER(int, pfnPCIBusRegister,(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, PCPDMPCIHLPR3 *ppPciHlpR3));
/**
* Register the PIC device.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pPicReg Pointer to a PIC registration structure.
* @param ppPicHlpR3 Where to store the pointer to the PIC HC
* helpers.
*/
DECLR3CALLBACKMEMBER(int, pfnPICRegister,(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3));
/**
* Register the APIC device.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pApicReg Pointer to a APIC registration structure.
* @param ppApicHlpR3 Where to store the pointer to the APIC helpers.
*/
DECLR3CALLBACKMEMBER(int, pfnAPICRegister,(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg, PCPDMAPICHLPR3 *ppApicHlpR3));
/**
* Register the I/O APIC device.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pIoApicReg Pointer to a I/O APIC registration structure.
* @param ppIoApicHlpR3 Where to store the pointer to the IOAPIC
* helpers.
*/
DECLR3CALLBACKMEMBER(int, pfnIOAPICRegister,(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3));
/**
* Register the HPET device.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pHpetReg Pointer to a HPET registration structure.
* @param ppHpetHlpR3 Where to store the pointer to the HPET
* helpers.
*/
DECLR3CALLBACKMEMBER(int, pfnHPETRegister,(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR3 *ppHpetHlpR3));
/**
* Register the DMA device.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pDmacReg Pointer to a DMAC registration structure.
* @param ppDmacHlp Where to store the pointer to the DMA helpers.
*/
DECLR3CALLBACKMEMBER(int, pfnDMACRegister,(PPDMDEVINS pDevIns, PPDMDMACREG pDmacReg, PCPDMDMACHLP *ppDmacHlp));
/**
* Register transfer function for DMA channel.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param uChannel Channel number.
* @param pfnTransferHandler Device specific transfer callback function.
* @param pvUser User pointer to pass to the callback.
* @thread EMT
*/
DECLR3CALLBACKMEMBER(int, pfnDMARegister,(PPDMDEVINS pDevIns, unsigned uChannel, PFNDMATRANSFERHANDLER pfnTransferHandler, void *pvUser));
/**
* Read memory.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param uChannel Channel number.
* @param pvBuffer Pointer to target buffer.
* @param off DMA position.
* @param cbBlock Block size.
* @param pcbRead Where to store the number of bytes which was
* read. optional.
* @thread EMT
*/
DECLR3CALLBACKMEMBER(int, pfnDMAReadMemory,(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbRead));
/**
* Write memory.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param uChannel Channel number.
* @param pvBuffer Memory to write.
* @param off DMA position.
* @param cbBlock Block size.
* @param pcbWritten Where to store the number of bytes which was
* written. optional.
* @thread EMT
*/
DECLR3CALLBACKMEMBER(int, pfnDMAWriteMemory,(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbWritten));
/**
* Set the DREQ line.
*
* @returns VBox status code.
* @param pDevIns Device instance.
* @param uChannel Channel number.
* @param uLevel Level of the line.
* @thread EMT
*/
/**
* Get channel mode.
*
* @returns Channel mode. See specs.
* @param pDevIns The device instance.
* @param uChannel Channel number.
* @thread EMT
*/
/**
* Schedule DMA execution.
*
* @param pDevIns The device instance.
* @thread Any thread.
*/
/**
* Write CMOS value and update the checksum(s).
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param iReg The CMOS register index.
* @param u8Value The CMOS register value.
* @thread EMT
*/
/**
* Read CMOS value.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param iReg The CMOS register index.
* @param pu8Value Where to store the CMOS register value.
* @thread EMT
*/
/**
* Assert that the current thread is the emulation thread.
*
* @returns True if correct.
* @returns False if wrong.
* @param pDevIns The device instance.
* @param pszFile Filename of the assertion location.
* @param iLine The linenumber of the assertion location.
* @param pszFunction Function of the assertion location.
*/
DECLR3CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction));
/**
* Assert that the current thread is NOT the emulation thread.
*
* @returns True if correct.
* @returns False if wrong.
* @param pDevIns The device instance.
* @param pszFile Filename of the assertion location.
* @param iLine The linenumber of the assertion location.
* @param pszFunction Function of the assertion location.
*/
DECLR3CALLBACKMEMBER(bool, pfnAssertOther,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction));
/**
* Resolves the symbol for a raw-mode context interface.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pvInterface The interface structure.
* @param cbInterface The size of the interface structure.
* @param pszSymPrefix What to prefix the symbols in the list with
* before resolving them. This must start with
* 'dev' and contain the driver name.
* @param pszSymList List of symbols corresponding to the interface.
* There is generally a there is generally a define
* holding this list associated with the interface
* definition (INTERFACE_SYM_LIST). For more
* details see PDMR3LdrGetInterfaceSymbols.
* @thread EMT
*/
DECLR3CALLBACKMEMBER(int, pfnLdrGetRCInterfaceSymbols,(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
const char *pszSymPrefix, const char *pszSymList));
/**
* Resolves the symbol for a ring-0 context interface.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pvInterface The interface structure.
* @param cbInterface The size of the interface structure.
* @param pszSymPrefix What to prefix the symbols in the list with
* before resolving them. This must start with
* 'dev' and contain the driver name.
* @param pszSymList List of symbols corresponding to the interface.
* There is generally a there is generally a define
* holding this list associated with the interface
* definition (INTERFACE_SYM_LIST). For more
* details see PDMR3LdrGetInterfaceSymbols.
* @thread EMT
*/
DECLR3CALLBACKMEMBER(int, pfnLdrGetR0InterfaceSymbols,(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
const char *pszSymPrefix, const char *pszSymList));
/**
* Call the ring-0 request handler routine of the device.
*
* For this to work, the device must be ring-0 enabled and export a request
* handler function. The name of the function must be the device name in
* the PDMDRVREG struct prefixed with 'drvR0' and suffixed with
* 'ReqHandler'. The device name will be captialized. It shall take the
* exact same arguments as this function and be declared using
* PDMBOTHCBDECL. See FNPDMDEVREQHANDLERR0.
*
* Unlike PDMDrvHlpCallR0, this is current unsuitable for more than a call
* or two as the handler address will be resolved on each invocation. This
* is the reason for the EMT only restriction as well.
*
* @returns VBox status code.
* @retval VERR_SYMBOL_NOT_FOUND if the device doesn't export the required
* handler function.
* @retval VERR_ACCESS_DENIED if the device isn't ring-0 capable.
*
* @param pDevIns The device instance.
* @param uOperation The operation to perform.
* @param u64Arg 64-bit integer argument.
* @thread EMT
*/
/** Space reserved for future members.
* @{ */
DECLR3CALLBACKMEMBER(void, pfnReserved1,(void));
DECLR3CALLBACKMEMBER(void, pfnReserved2,(void));
DECLR3CALLBACKMEMBER(void, pfnReserved3,(void));
DECLR3CALLBACKMEMBER(void, pfnReserved4,(void));
DECLR3CALLBACKMEMBER(void, pfnReserved5,(void));
DECLR3CALLBACKMEMBER(void, pfnReserved6,(void));
DECLR3CALLBACKMEMBER(void, pfnReserved7,(void));
DECLR3CALLBACKMEMBER(void, pfnReserved8,(void));
DECLR3CALLBACKMEMBER(void, pfnReserved9,(void));
DECLR3CALLBACKMEMBER(void, pfnReserved10,(void));
/** @} */
/** API available to trusted devices only.
*
* These APIs are providing unrestricted access to the guest and the VM,
* or they are interacting intimately with PDM.
*
* @{
*/
/**
* Gets the VM handle. Restricted API.
*
* @returns VM Handle.
* @param pDevIns The device instance.
*/
/**
* Gets the VMCPU handle. Restricted API.
*
* @returns VMCPU Handle.
* @param pDevIns The device instance.
*/
/**
* Registers the VMM device heap
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param GCPhys The physical address.
* @param pvHeap Ring 3 heap pointer.
* @param cbSize Size of the heap.
* @thread EMT.
*/
DECLR3CALLBACKMEMBER(int, pfnRegisterVMMDevHeap,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbSize));
/**
* Unregisters the VMM device heap
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param GCPhys The physical address.
* @thread EMT.
*/
/**
* Resets the VM.
*
* @returns The appropriate VBox status code to pass around on reset.
* @param pDevIns The device instance.
* @thread The emulation thread.
*/
/**
* Suspends the VM.
*
* @returns The appropriate VBox status code to pass around on suspend.
* @param pDevIns The device instance.
* @thread The emulation thread.
*/
/**
* Suspends, saves and powers off the VM.
*
* @returns The appropriate VBox status code to pass around.
* @param pDevIns The device instance.
* @thread An emulation thread.
*/
/**
* Power off the VM.
*
* @returns The appropriate VBox status code to pass around on power off.
* @param pDevIns The device instance.
* @thread The emulation thread.
*/
/**
* Checks if the Gate A20 is enabled or not.
*
* @returns true if A20 is enabled.
* @returns false if A20 is disabled.
* @param pDevIns The device instance.
* @thread The emulation thread.
*/
/**
* Enables or disables the Gate A20.
*
* @param pDevIns The device instance.
* @param fEnable Set this flag to enable the Gate A20; clear it
* to disable.
* @thread The emulation thread.
*/
/**
* Get the specified CPUID leaf for the virtual CPU associated with the calling
* thread.
*
* @param pDevIns The device instance.
* @param iLeaf The CPUID leaf to get.
* @param pEax Where to store the EAX value.
* @param pEbx Where to store the EBX value.
* @param pEcx Where to store the ECX value.
* @param pEdx Where to store the EDX value.
* @thread EMT.
*/
DECLR3CALLBACKMEMBER(void, pfnGetCpuId,(PPDMDEVINS pDevIns, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx));
/** @} */
/** Just a safety precaution. (PDM_DEVHLP_VERSION) */
} PDMDEVHLPR3;
#endif /* !IN_RING3 */
/** Pointer to the R3 PDM Device API. */
/** Pointer to the R3 PDM Device API, const variant. */
/** Current PDMDEVHLPR3 version number. */
/**
* PDM Device API - RC Variant.
*/
typedef struct PDMDEVHLPRC
{
/** Structure version. PDM_DEVHLPRC_VERSION defines the current version. */
/**
* Set the IRQ for a PCI device.
*
* @param pDevIns Device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread Any thread, but will involve the emulation thread.
*/
/**
* Set ISA IRQ for a device.
*
* @param pDevIns Device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread Any thread, but will involve the emulation thread.
*/
/**
* Read physical memory.
*
* @returns VINF_SUCCESS (for now).
* @param pDevIns Device instance.
* @param GCPhys Physical address start reading from.
* @param pvBuf Where to put the read bits.
* @param cbRead How many bytes to read.
*/
DECLRCCALLBACKMEMBER(int, pfnPhysRead,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead));
/**
* Write to physical memory.
*
* @returns VINF_SUCCESS for now, and later maybe VERR_EM_MEMORY.
* @param pDevIns Device instance.
* @param GCPhys Physical address to write to.
* @param pvBuf What to write.
* @param cbWrite How many bytes to write.
*/
DECLRCCALLBACKMEMBER(int, pfnPhysWrite,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite));
/**
* Checks if the Gate A20 is enabled or not.
*
* @returns true if A20 is enabled.
* @returns false if A20 is disabled.
* @param pDevIns Device instance.
* @thread The emulation thread.
*/
/**
* Gets the VM state.
*
* @returns VM state.
* @param pDevIns The device instance.
* @thread Any thread (just keep in mind that it's volatile info).
*/
/**
* Set the VM error message
*
* @returns rc.
* @param pDrvIns Driver instance.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param ... Error message arguments.
*/
DECLRCCALLBACKMEMBER(int, pfnVMSetError,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...));
/**
* Set the VM error message
*
* @returns rc.
* @param pDrvIns Driver instance.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param va Error message arguments.
*/
DECLRCCALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va));
/**
* Set the VM runtime error message
*
* @returns VBox status code.
* @param pDevIns Device instance.
* @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
* @param pszErrorId Error ID string.
* @param pszFormat Error message format string.
* @param ... Error message arguments.
*/
DECLRCCALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...));
/**
* Set the VM runtime error message
*
* @returns VBox status code.
* @param pDevIns Device instance.
* @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
* @param pszErrorId Error ID string.
* @param pszFormat Error message format string.
* @param va Error message arguments.
*/
DECLRCCALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va));
/**
* Set parameters for pending MMIO patch operation
*
* @returns VBox status code.
* @param pDevIns Device instance.
* @param GCPhys MMIO physical address
* @param pCachedData GC pointer to cached data
*/
DECLRCCALLBACKMEMBER(int, pfnPATMSetMMIOPatchInfo,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPTR pCachedData));
/**
* Gets the VM handle. Restricted API.
*
* @returns VM Handle.
* @param pDevIns Device instance.
*/
/**
* Gets the VMCPU handle. Restricted API.
*
* @returns VMCPU Handle.
* @param pDevIns The device instance.
*/
/** Just a safety precaution. */
} PDMDEVHLPRC;
/** Pointer PDM Device RC API. */
/** Pointer PDM Device RC API. */
/** Current PDMDEVHLP version number. */
/**
* PDM Device API - R0 Variant.
*/
typedef struct PDMDEVHLPR0
{
/** Structure version. PDM_DEVHLPR0_VERSION defines the current version. */
/**
* Set the IRQ for a PCI device.
*
* @param pDevIns Device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread Any thread, but will involve the emulation thread.
*/
/**
* Set ISA IRQ for a device.
*
* @param pDevIns Device instance.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
* @thread Any thread, but will involve the emulation thread.
*/
/**
* Read physical memory.
*
* @returns VINF_SUCCESS (for now).
* @param pDevIns Device instance.
* @param GCPhys Physical address start reading from.
* @param pvBuf Where to put the read bits.
* @param cbRead How many bytes to read.
*/
DECLR0CALLBACKMEMBER(int, pfnPhysRead,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead));
/**
* Write to physical memory.
*
* @returns VINF_SUCCESS for now, and later maybe VERR_EM_MEMORY.
* @param pDevIns Device instance.
* @param GCPhys Physical address to write to.
* @param pvBuf What to write.
* @param cbWrite How many bytes to write.
*/
DECLR0CALLBACKMEMBER(int, pfnPhysWrite,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite));
/**
* Checks if the Gate A20 is enabled or not.
*
* @returns true if A20 is enabled.
* @returns false if A20 is disabled.
* @param pDevIns Device instance.
* @thread The emulation thread.
*/
/**
* Gets the VM state.
*
* @returns VM state.
* @param pDevIns The device instance.
* @thread Any thread (just keep in mind that it's volatile info).
*/
/**
* Set the VM error message
*
* @returns rc.
* @param pDrvIns Driver instance.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param ... Error message arguments.
*/
DECLR0CALLBACKMEMBER(int, pfnVMSetError,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...));
/**
* Set the VM error message
*
* @returns rc.
* @param pDrvIns Driver instance.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param va Error message arguments.
*/
DECLR0CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va));
/**
* Set the VM runtime error message
*
* @returns VBox status code.
* @param pDevIns Device instance.
* @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
* @param pszErrorId Error ID string.
* @param pszFormat Error message format string.
* @param ... Error message arguments.
*/
DECLR0CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...));
/**
* Set the VM runtime error message
*
* @returns VBox status code.
* @param pDevIns Device instance.
* @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
* @param pszErrorId Error ID string.
* @param pszFormat Error message format string.
* @param va Error message arguments.
*/
DECLR0CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va));
/**
* Set parameters for pending MMIO patch operation
*
* @returns rc.
* @param pDevIns Device instance.
* @param GCPhys MMIO physical address
* @param pCachedData GC pointer to cached data
*/
DECLR0CALLBACKMEMBER(int, pfnPATMSetMMIOPatchInfo,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPTR pCachedData));
/**
* Gets the VM handle. Restricted API.
*
* @returns VM Handle.
* @param pDevIns Device instance.
*/
/**
* Checks if our current CPU state allows for IO block emulation fallback to the recompiler
*
* @returns true = yes, false = no
* @param pDevIns Device instance.
*/
/**
* Gets the VMCPU handle. Restricted API.
*
* @returns VMCPU Handle.
* @param pDevIns The device instance.
*/
/** Just a safety precaution. */
} PDMDEVHLPR0;
/** Pointer PDM Device R0 API. */
/** Pointer PDM Device GC API. */
/** Current PDMDEVHLP version number. */
/**
* PDM Device Instance.
*/
typedef struct PDMDEVINS
{
/** Structure version. PDM_DEVINS_VERSION defines the current version. */
/** Device instance number. */
/** Pointer the GC PDM Device API. */
/** Pointer to device instance data. */
/** The critical section for the device, see pCritSectR3.
* This is automatically resolved by PDM when pCritSectR3 is set by the
* constructor. */
/** Alignment padding. */
/** Pointer the R0 PDM Device API. */
/** Pointer to device instance data (R0). */
/** The critical section for the device, see pCritSectR3.
* This is automatically resolved by PDM when pCritSectR3 is set by the
* constructor. */
/** Pointer the HC PDM Device API. */
/** Pointer to device instance data. */
/** The critical section for the device. (Optional)
*
* The device constructor initializes this if it has a critical section for
* the device and desires it to be taken automatically by MMIO, I/O port
* and timer callbacks to the device. The advantages using this locking
* approach is both less code and avoiding the global IOM lock.
*
* @remarks Will not yet be taken by SSM.
*/
/** Pointer to device registration structure. */
/** Configuration handle. */
/** The base interface of the device.
*
* The device constructor initializes this if it has any
* device level interfaces to export. To obtain this interface
* call PDMR3QueryDevice(). */
/** Align the internal data more naturally. */
/** Internal data. */
union
{
#ifdef PDMDEVINSINT_DECLARED
PDMDEVINSINT s;
#endif
} Internal;
/** Device instance data. The size of this area is defined
* in the PDMDEVREG::cbInstanceData field. */
char achInstanceData[8];
} PDMDEVINS;
/** Current PDMDEVINS version number. */
/** Converts a pointer to the PDMDEVINS::IBase to a pointer to PDMDEVINS. */
#define PDMIBASE_2_PDMDEV(pInterface) ( (PPDMDEVINS)((char *)(pInterface) - RT_OFFSETOF(PDMDEVINS, IBase)) )
/**
* Checks the structure versions of the device instance and device helpers,
* returning if they are incompatible.
*
* This is for use in the constructor.
*
* @param pDevIns The device instance pointer.
*/
#define PDMDEV_CHECK_VERSIONS_RETURN(pDevIns) \
do \
{ \
AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pDevIns)->pHlpR3->u32Version, PDM_DEVHLPR3_VERSION), \
} while (0)
/**
* Quietly checks the structure versions of the device instance and device
* helpers, returning if they are incompatible.
*
* This is for use in the destructor.
*
* @param pDevIns The device instance pointer.
*/
#define PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns) \
do \
{ \
return VERR_VERSION_MISMATCH; \
} while (0)
/**
* Wrapper around CFGMR3ValidateConfig for the root config for use in the
* constructor - returns on failure.
*
* This should be invoked after having initialized the instance data
* sufficiently for the correct operation of the destructor. The destructor is
* always called!
*
* @param pDevIns Pointer to the PDM device instance.
* @param pszValidValues Patterns describing the valid value names. See
* RTStrSimplePatternMultiMatch for details on the
* pattern syntax.
* @param pszValidNodes Patterns describing the valid node (key) names.
* Pass empty string if no valid nodess.
*/
do \
{ \
if (RT_FAILURE(rcValCfg)) \
return rcValCfg; \
} while (0)
/** @def PDMDEV_ASSERT_EMT
* Assert that the current thread is the emulation thread.
*/
#ifdef VBOX_STRICT
# define PDMDEV_ASSERT_EMT(pDevIns) pDevIns->pHlpR3->pfnAssertEMT(pDevIns, __FILE__, __LINE__, __FUNCTION__)
#else
# define PDMDEV_ASSERT_EMT(pDevIns) do { } while (0)
#endif
/** @def PDMDEV_ASSERT_OTHER
* Assert that the current thread is NOT the emulation thread.
*/
#ifdef VBOX_STRICT
# define PDMDEV_ASSERT_OTHER(pDevIns) pDevIns->pHlpR3->pfnAssertOther(pDevIns, __FILE__, __LINE__, __FUNCTION__)
#else
# define PDMDEV_ASSERT_OTHER(pDevIns) do { } while (0)
#endif
/** @def PDMDEV_ASSERT_VMLOCK_OWNER
* Assert that the current thread is owner of the VM lock.
*/
#ifdef VBOX_STRICT
# define PDMDEV_ASSERT_VMLOCK_OWNER(pDevIns) pDevIns->pHlpR3->pfnAssertVMLock(pDevIns, __FILE__, __LINE__, __FUNCTION__)
#else
# define PDMDEV_ASSERT_VMLOCK_OWNER(pDevIns) do { } while (0)
#endif
/** @def PDMDEV_SET_ERROR
* Set the VM error. See PDMDevHlpVMSetError() for printf like message formatting.
*/
/** @def PDMDEV_SET_RUNTIME_ERROR
* Set the VM runtime error. See PDMDevHlpVMSetRuntimeError() for printf like message formatting.
*/
/** @def PDMDEVINS_2_RCPTR
* Converts a PDM Device instance pointer a RC PDM Device instance pointer.
*/
#define PDMDEVINS_2_RCPTR(pDevIns) ( (RCPTRTYPE(PPDMDEVINS))((RTGCUINTPTR)(pDevIns)->pvInstanceDataRC - RT_OFFSETOF(PDMDEVINS, achInstanceData)) )
/** @def PDMDEVINS_2_R3PTR
* Converts a PDM Device instance pointer a R3 PDM Device instance pointer.
*/
#define PDMDEVINS_2_R3PTR(pDevIns) ( (R3PTRTYPE(PPDMDEVINS))((RTHCUINTPTR)(pDevIns)->pvInstanceDataR3 - RT_OFFSETOF(PDMDEVINS, achInstanceData)) )
/** @def PDMDEVINS_2_R0PTR
* Converts a PDM Device instance pointer a R0 PDM Device instance pointer.
*/
#define PDMDEVINS_2_R0PTR(pDevIns) ( (R0PTRTYPE(PPDMDEVINS))((RTR0UINTPTR)(pDevIns)->pvInstanceDataR0 - RT_OFFSETOF(PDMDEVINS, achInstanceData)) )
#ifdef IN_RING3
/**
* @copydoc PDMDEVHLPR3::pfnIOPortRegister
*/
DECLINLINE(int) PDMDevHlpIOPortRegister(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTHCPTR pvUser,
{
return pDevIns->pHlpR3->pfnIOPortRegister(pDevIns, Port, cPorts, pvUser, pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc);
}
/**
* @copydoc PDMDEVHLPR3::pfnIOPortRegisterRC
*/
DECLINLINE(int) PDMDevHlpIOPortRegisterRC(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTRCPTR pvUser,
{
return pDevIns->pHlpR3->pfnIOPortRegisterRC(pDevIns, Port, cPorts, pvUser, pszOut, pszIn, pszOutStr, pszInStr, pszDesc);
}
/**
* @copydoc PDMDEVHLPR3::pfnIOPortRegisterR0
*/
DECLINLINE(int) PDMDevHlpIOPortRegisterR0(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTR0PTR pvUser,
{
return pDevIns->pHlpR3->pfnIOPortRegisterR0(pDevIns, Port, cPorts, pvUser, pszOut, pszIn, pszOutStr, pszInStr, pszDesc);
}
/**
* @copydoc PDMDEVHLPR3::pfnIOPortDeregister
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIORegister
*/
DECLINLINE(int) PDMDevHlpMMIORegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTHCPTR pvUser,
const char *pszDesc)
{
return pDevIns->pHlpR3->pfnMMIORegister(pDevIns, GCPhysStart, cbRange, pvUser, pfnWrite, pfnRead, pfnFill, pszDesc);
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIORegisterRC
*/
DECLINLINE(int) PDMDevHlpMMIORegisterRC(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTGCPTR pvUser,
{
return pDevIns->pHlpR3->pfnMMIORegisterRC(pDevIns, GCPhysStart, cbRange, pvUser, pszWrite, pszRead, pszFill, NULL);
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIORegisterR0
*/
DECLINLINE(int) PDMDevHlpMMIORegisterR0(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTR0PTR pvUser,
{
return pDevIns->pHlpR3->pfnMMIORegisterR0(pDevIns, GCPhysStart, cbRange, pvUser, pszWrite, pszRead, pszFill, NULL);
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIODeregister
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIO2Register
*/
DECLINLINE(int) PDMDevHlpMMIO2Register(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIO2Deregister
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIO2Map
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIO2Unmap
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnMMHyperMapMMIO2
*/
DECLINLINE(int) PDMDevHlpMMHyperMapMMIO2(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
{
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIO2MapKernel
*/
DECLINLINE(int) PDMDevHlpMMIO2MapKernel(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
{
}
/**
* @copydoc PDMDEVHLPR3::pfnROMRegister
*/
DECLINLINE(int) PDMDevHlpROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, uint32_t fFlags, const char *pszDesc)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnROMProtectShadow
*/
DECLINLINE(int) PDMDevHlpROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, PGMROMPROT enmProt)
{
}
/**
* Register a save state data unit.
*
* @returns VBox status.
* @param pDevIns The device instance.
* @param uVersion Data layout version number.
* @param cbGuess The approximate amount of data in the unit.
* Only for progress indicators.
* @param pfnSaveExec Execute save callback, optional.
* @param pfnLoadExec Execute load callback, optional.
*/
{
}
/**
* Register a save state data unit with a live save callback as well.
*
* @returns VBox status.
* @param pDevIns The device instance.
* @param uVersion Data layout version number.
* @param cbGuess The approximate amount of data in the unit.
* Only for progress indicators.
* @param pfnLiveExec Execute live callback, optional.
* @param pfnSaveExec Execute save callback, optional.
* @param pfnLoadExec Execute load callback, optional.
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnSSMRegister
*/
DECLINLINE(int) PDMDevHlpSSMRegisterEx(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess, const char *pszBefore,
{
}
/**
* @copydoc PDMDEVHLPR3::pfnTMTimerCreate
*/
DECLINLINE(int) PDMDevHlpTMTimerCreate(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback, void *pvUser, uint32_t fFlags,
{
return pDevIns->pHlpR3->pfnTMTimerCreate(pDevIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer);
}
/**
* @copydoc PDMDEVHLPR3::pfnTMUtcNow
*/
{
}
#endif /* IN_RING3 */
/**
* @copydoc PDMDEVHLPR3::pfnPhysRead
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPhysWrite
*/
DECLINLINE(int) PDMDevHlpPhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
{
}
#ifdef IN_RING3
/**
* @copydoc PDMDEVHLPR3::pfnPhysGCPhys2CCPtr
*/
DECLINLINE(int) PDMDevHlpPhysGCPhys2CCPtr(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, void **ppv, PPGMPAGEMAPLOCK pLock)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPhysGCPhys2CCPtrReadOnly
*/
DECLINLINE(int) PDMDevHlpPhysGCPhys2CCPtrReadOnly(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, void const **ppv, PPGMPAGEMAPLOCK pLock)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPhysReleasePageMappingLock
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPhysReadGCVirt
*/
DECLINLINE(int) PDMDevHlpPhysReadGCVirt(PPDMDEVINS pDevIns, void *pvDst, RTGCPTR GCVirtSrc, size_t cb)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPhysWriteGCVirt
*/
DECLINLINE(int) PDMDevHlpPhysWriteGCVirt(PPDMDEVINS pDevIns, RTGCPTR GCVirtDst, const void *pvSrc, size_t cb)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPhysGCPtr2GCPhys
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnMMHeapAlloc
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnMMHeapAllocZ
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnMMHeapFree
*/
{
}
#endif /* IN_RING3 */
/**
* @copydoc PDMDEVHLPR3::pfnVMState
*/
{
}
#ifdef IN_RING3
/**
* @copydoc PDMDEVHLPR3::pfnVMTeleportedAndNotFullyResumedYet
*/
{
}
#endif /* IN_RING3 */
/**
* @copydoc PDMDEVHLPR3::pfnVMSetError
*/
DECLINLINE(int) PDMDevHlpVMSetError(PPDMDEVINS pDevIns, const int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
{
return rc;
}
/**
* @copydoc PDMDEVHLPR3::pfnVMSetRuntimeError
*/
DECLINLINE(int) PDMDevHlpVMSetRuntimeError(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
{
int rc;
return rc;
}
/**
* VBOX_STRICT wrapper for pHlp->pfnDBGFStopV.
*
* @returns VBox status code which must be passed up to the VMM. This will be
* VINF_SUCCESS in non-strict builds.
* @param pDevIns The device instance.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Message. (optional)
* @param ... Message parameters.
*/
{
#ifdef VBOX_STRICT
# ifdef IN_RING3
int rc;
return rc;
# else
return VINF_EM_DBG_STOP;
# endif
#else
return VINF_SUCCESS;
#endif
}
#ifdef IN_RING3
/**
* @copydoc PDMDEVHLPR3::pfnDBGFInfoRegister
*/
DECLINLINE(int) PDMDevHlpDBGFInfoRegister(PPDMDEVINS pDevIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnSTAMRegister
*/
DECLINLINE(void) PDMDevHlpSTAMRegister(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnSTAMRegisterF
*/
DECLINLINE(void) PDMDevHlpSTAMRegisterF(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
{
pDevIns->pHlpR3->pfnSTAMRegisterV(pDevIns, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va);
}
/**
* @copydoc PDMDEVHLPR3::pfnPCIRegister
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPCIIORegionRegister
*/
DECLINLINE(int) PDMDevHlpPCIIORegionRegister(PPDMDEVINS pDevIns, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPCIRegisterMsi
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPCISetConfigCallbacks
*/
DECLINLINE(void) PDMDevHlpPCISetConfigCallbacks(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
{
pDevIns->pHlpR3->pfnPCISetConfigCallbacks(pDevIns, pPciDev, pfnRead, ppfnReadOld, pfnWrite, ppfnWriteOld);
}
#endif /* IN_RING3 */
/**
* @copydoc PDMDEVHLPR3::pfnPCISetIrq
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPCISetIrqNoWait
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnISASetIrq
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnISASetIrqNoWait
*/
{
}
#ifdef IN_RING3
/**
* @copydoc PDMDEVHLPR3::pfnDriverAttach
*/
DECLINLINE(int) PDMDevHlpDriverAttach(PPDMDEVINS pDevIns, RTUINT iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnQueueCreate
*/
DECLINLINE(int) PDMDevHlpQueueCreate(PPDMDEVINS pDevIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
{
return pDevIns->pHlpR3->pfnQueueCreate(pDevIns, cbItem, cItems, cMilliesInterval, pfnCallback, fGCEnabled, pszName, ppQueue);
}
/**
* Initializes a PDM critical section.
*
* The PDM critical sections are derived from the IPRT critical sections, but
* works in RC and R0 as well.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pCritSect Pointer to the critical section.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszNameFmt Format string for namging the critical section.
* For statistics and lock validation.
* @param ... Arguments for the format string.
*/
DECLINLINE(int) PDMDevHlpCritSectInit(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, RT_SRC_POS_DECL, const char *pszNameFmt, ...)
{
int rc;
return rc;
}
/**
* @copydoc PDMDEVHLPR3::pfnThreadCreate
*/
DECLINLINE(int) PDMDevHlpThreadCreate(PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread,
{
return pDevIns->pHlpR3->pfnThreadCreate(pDevIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
}
/**
* @copydoc PDMDEVHLPR3::pfnSetAsyncNotification
*/
DECLINLINE(int) PDMDevHlpSetAsyncNotification(PPDMDEVINS pDevIns, PFNPDMDEVASYNCNOTIFY pfnAsyncNotify)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnAsyncNotificationCompleted
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnA20Set
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnRTCRegister
*/
DECLINLINE(int) PDMDevHlpRTCRegister(PPDMDEVINS pDevIns, PCPDMRTCREG pRtcReg, PCPDMRTCHLP *ppRtcHlp)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPCIBusRegister
*/
DECLINLINE(int) PDMDevHlpPCIBusRegister(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, PCPDMPCIHLPR3 *ppPciHlpR3)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnPICRegister
*/
DECLINLINE(int) PDMDevHlpPICRegister(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnAPICRegister
*/
DECLINLINE(int) PDMDevHlpAPICRegister(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg, PCPDMAPICHLPR3 *ppApicHlpR3)
{
}
/**
* @copydoc PDMDEVHLPR3::pfn
*/
DECLINLINE(int) PDMDevHlpIOAPICRegister(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnHPETRegister
*/
DECLINLINE(int) PDMDevHlpHPETRegister(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR3 *ppHpetHlpR3)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnDMACRegister
*/
DECLINLINE(int) PDMDevHlpDMACRegister(PPDMDEVINS pDevIns, PPDMDMACREG pDmacReg, PCPDMDMACHLP *ppDmacHlp)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnDMARegister
*/
DECLINLINE(int) PDMDevHlpDMARegister(PPDMDEVINS pDevIns, unsigned uChannel, PFNDMATRANSFERHANDLER pfnTransferHandler, void *pvUser)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnDMAReadMemory
*/
DECLINLINE(int) PDMDevHlpDMAReadMemory(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbRead)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnDMAWriteMemory
*/
DECLINLINE(int) PDMDevHlpDMAWriteMemory(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbWritten)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnDMASetDREQ
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnDMAGetChannelMode
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnDMASchedule
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnCMOSWrite
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnCMOSRead
*/
{
}
/**
* @copydoc PDMDEVHLP::pfnCallR0
*/
{
}
#endif /* IN_RING3 */
/**
* @copydoc PDMDEVHLPR3::pfnGetVM
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnGetVMCPU
*/
{
}
#ifdef IN_RING3
/**
* @copydoc PDMDEVHLPR3::pfnRegisterVMMDevHeap
*/
DECLINLINE(int) PDMDevHlpRegisterVMMDevHeap(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbSize)
{
}
/**
* @copydoc PDMDEVHLPR3::pfnUnregisterVMMDevHeap
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnVMReset
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnVMSuspend
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnVMSuspendSaveAndPowerOff
*/
{
}
/**
* @copydoc PDMDEVHLPR3::pfnVMPowerOff
*/
{
}
#endif /* IN_RING3 */
/**
* @copydoc PDMDEVHLPR3::pfnA20IsEnabled
*/
{
}
#ifdef IN_RING3
/**
* @copydoc PDMDEVHLPR3::pfnGetCpuId
*/
DECLINLINE(void) PDMDevHlpGetCpuId(PPDMDEVINS pDevIns, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
{
}
#endif /* IN_RING3 */
#ifdef IN_RING0
/**
* @copydoc PDMDEVHLPR0::pfnCanEmulateIoBlock
*/
{
}
#endif /* IN_RING0 */
/** Pointer to callbacks provided to the VBoxDeviceRegister() call. */
typedef struct PDMDEVREGCB *PPDMDEVREGCB;
/**
* Callbacks for VBoxDeviceRegister().
*/
typedef struct PDMDEVREGCB
{
/** Interface version.
* This is set to PDM_DEVREG_CB_VERSION. */
/**
* Registers a device with the current VM instance.
*
* @returns VBox status code.
* @param pCallbacks Pointer to the callback table.
* @param pReg Pointer to the device registration record.
* This data must be permanent and readonly.
*/
} PDMDEVREGCB;
/** Current version of the PDMDEVREGCB structure. */
/**
* The VBoxDevicesRegister callback function.
*
* PDM will invoke this function after loading a device module and letting
* the module decide which devices to register and how to handle conflicts.
*
* @returns VBox status code.
* @param pCallbacks Pointer to the callback table.
* @param u32Version VBox version number.
*/
/** @} */
#endif