PDMInternal.h revision 73dfebace7e93189b94f88808326284834d15b7d
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * PDM - Internal header file.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * available from http://www.virtualbox.org. This file is free software;
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * General Public License (GPL) as published by the Free Software
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * additional information or have any questions.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** @defgroup grp_pdm_int Internal
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * @ingroup grp_pdm
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * @internal
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/*******************************************************************************
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync* Structures and Typedefs *
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync*******************************************************************************/
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a PDM Device. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a pointer to a PDM Device. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a PDM USB Device. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a pointer to a PDM USB Device. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a PDM Driver. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a pointer to a PDM Driver. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a PDM Logical Unit. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a pointer to a PDM Logical Unit. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a PDM PCI Bus instance. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a DMAC instance. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to a RTC instance. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/** Pointer to an USB HUB registration record. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * Private device instance data.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsynctypedef struct PDMDEVINSINT
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the next instance (HC Ptr).
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * (Head is pointed to by PDM::pDevInstances.) */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the next per device instance (HC Ptr).
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * (Head is pointed to by PDMDEV::pInstances.) */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to device structure - HC Ptr. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the VM this instance was created for - HC Ptr. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the list of logical units associated with the device. (FIFO) */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Configuration handle to the instance node. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** HC pointer to associated PCI device structure. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** HC pointer to associated PCI bus structure. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** GC pointer to associated PCI device structure. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the VM this instance was created for - GC Ptr. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** GC pointer to associated PCI bus structure. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Alignment padding. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * Private USB device instance data.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsynctypedef struct PDMUSBINSINT
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The UUID of this instance. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the next instance.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * (Head is pointed to by PDM::pUsbInstances.) */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the next per USB device instance.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * (Head is pointed to by PDMUSB::pInstances.) */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to device structure. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the VM this instance was created for. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the list of logical units associated with the device. (FIFO) */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The per instance device configuration. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Same as pCfg if the configuration should be deleted when detaching the device. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The global device configuration. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the USB hub this device is attached to.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * This is NULL if the device isn't connected to any HUB. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The port number that we're connected to. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * Private driver instance data.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsynctypedef struct PDMDRVINSINT
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the driver instance above.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * This is NULL for the topmost drive. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the driver instance below.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * This is NULL for the bottommost driver. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the logical unit this driver chained on. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to driver structure from which this was instantiated. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the VM this instance was created for. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Flag indicating that the driver is being detached and destroyed.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * (Helps detect potential recursive detaching.) */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Configuration handle to the instance node. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * Private critical section data.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The critical section core which is shared with IPRT. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the next critical section.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * This chain is used for relocating pVMGC and device cleanup. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Owner identifier.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * This is pDevIns if the owner is a device. Similarily for a driver or service.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * PDMR3CritSectInit() sets this to point to the critsect itself. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the VM - R3Ptr. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the VM - R0Ptr. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the VM - GCPtr. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Event semaphore that is scheduled to be signaled upon leaving the
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * critical section. This is Ring-3 only of course. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** R0/GC lock contention. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** R0/GC unlock contention. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** R3 lock contention. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Profiling the time the section is locked. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsynctypedef enum
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The usual invalid entry. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Device type. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** USB Device type. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Driver type. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Internal type. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** External type. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The usual 32-bit hack. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * The internal structure for the thread.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsynctypedef struct PDMTHREADINT
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The VM pointer. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The event semaphore the thread blocks on. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the next thread. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The thread type. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync/* Must be included after PDMDEVINSINT is defined. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# error "Invalid header PDM order. Include PDMInternal.h before VBox/pdm.h!"
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * PDM Logical Unit.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * This typically the representation of a physical port on a
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * device, like for instance the PS/2 keyboard port on the
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * keyboard controller device. The LUNs are chained on the
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * device the belong to (PDMDEVINSINT::pLunsHC).
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsynctypedef struct PDMLUN
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** The LUN - The Logical Unit Number. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the next LUN. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the top driver in the driver chain. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the bottom driver in the driver chain. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the device instance which the LUN belongs to.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * Either this is set or pUsbIns is set. Both is never set at the same time. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the USB device instance which the LUN belongs to. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the device base interface. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Description of this LUN. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync const char *pszDesc;
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * PDM Device.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsynctypedef struct PDMDEV
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the next device (HC Ptr). */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Device name length. (search optimization) */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Registration structure. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Number of instances. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to chain of instances (HC Ptr). */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync * PDM USB Device.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsynctypedef struct PDMUSB
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Pointer to the next device (R3 Ptr). */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Device name length. (search optimization) */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Registration structure. */
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync /** Next instance number. */
} PDMUSB;
typedef struct PDMDRV
} PDMDRV;
typedef struct PDMPIC
} PDMPIC;
typedef struct PDMAPIC
DECLR3CALLBACKMEMBER(void, pfnBusDeliverR3,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
DECLR0CALLBACKMEMBER(void, pfnBusDeliverR0,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
DECLRCCALLBACKMEMBER(void, pfnBusDeliverRC,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
} PDMAPIC;
typedef struct PDMIOAPIC
} PDMIOAPIC;
typedef struct PDMPCIBUS
DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel));
DECLR3CALLBACKMEMBER(int, pfnRegisterR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, const char *pszName, int iDev));
DECLR3CALLBACKMEMBER(int, pfnIORegionRegisterR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iRegion, uint32_t cbRegion,
DECLR3CALLBACKMEMBER(void, pfnSetConfigCallbacksR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead,
DECLR3CALLBACKMEMBER(int, pfnSaveExecR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSMHandle));
DECLR3CALLBACKMEMBER(int, pfnLoadExecR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSMHandle));
DECLR0CALLBACKMEMBER(void, pfnSetIrqR0,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel));
DECLRCCALLBACKMEMBER(void, pfnSetIrqRC,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel));
} PDMPCIBUS;
#ifdef IN_RING3
typedef struct PDMDMAC
} PDMDMAC;
typedef struct PDMRTC
} PDMRTC;
typedef enum PDMMODTYPE
typedef struct PDMMOD
void *pvBits;
} PDMMOD;
typedef enum PDMQUEUETYPE
} PDMQUEUETYPE;
typedef struct PDMQUEUE
} Dev;
} Drv;
} Int;
} Ext;
struct PDMQUEUEFREEITEM
} PDMQUEUE;
typedef enum PDMDEVHLPTASKOP
typedef struct PDMDEVHLPTASK
union PDMDEVHLPTASKPARAMS
struct PDMDEVHLPTASKSETIRQ
int iIrq;
int iLevel;
} SetIRQ;
typedef struct PDMUSBHUB
} PDMUSBHUB;
typedef struct PDM
} PDM;
typedef struct PDMUSERPERVM
} PDMUSERPERVM;
#ifdef IN_RING3
#ifdef IN_RING3
int pdmR3CritSectInitDevice(PVM pVM, PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, const char *pszName);
int pdmR3DevFindLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMLUN *ppLun);
int pdmR3UsbFindLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMLUN *ppLun);
int pdmR3UsbRegisterHub(PVM pVM, PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp);
int pdmR3ThreadCreateDevice(PVM pVM, PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread,
int pdmR3ThreadCreateUsb(PVM pVM, PPDMDRVINS pUsbIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADUSB pfnThread,
int pdmR3ThreadCreateDriver(PVM pVM, PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,