VirtualBox

Changeset 3852 in vbox for trunk/src


Ignore:
Timestamp:
Jul 25, 2007 7:09:09 PM (17 years ago)
Author:
vboxsync
Message:

Finally splitting up pdm.h. Working on integrating USB into PDM (USBProxy needs CFGM stuff).

Location:
trunk/src/VBox/VMM
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PDM.cpp

    r3520 r3852  
    627627     * Resume all threads.
    628628     */
    629     ///@todo pdmR3ThreadResumeAll(pVM);   
     629    ///@todo pdmR3ThreadResumeAll(pVM);
    630630
    631631    LogFlow(("PDMR3PowerOn: returns void\n"));
     
    717717     * Suspend all threads.
    718718     */
    719     ///@todo pdmR3ThreadSuspendAll(pVM);   
     719    ///@todo pdmR3ThreadSuspendAll(pVM);
    720720
    721721    LogFlow(("PDMR3Suspend: returns void\n"));
     
    760760     * Resume all threads.
    761761     */
    762     ///@todo pdmR3ThreadResumeAll(pVM);   
     762    ///@todo pdmR3ThreadResumeAll(pVM);
    763763
    764764    LogFlow(("PDMR3Resume: returns void\n"));
     
    820820 * @param   iInstance       Device instance.
    821821 * @param   ppBase          Where to store the pointer to the base device interface on success.
    822  * @remark  We're doing any locking ATM, so don't try call this at times when the
     822 * @remark  We're not doing any locking ATM, so don't try call this at times when the
    823823 *          device chain is known to be updated.
    824824 */
     
    877877 * @param   iLun            The Logical Unit to obtain the interface of.
    878878 * @param   ppBase          Where to store the base interface pointer.
    879  * @remark  We're doing any locking ATM, so don't try call this at times when the
     879 * @remark  We're not doing any locking ATM, so don't try call this at times when the
    880880 *          device chain is known to be updated.
    881881 */
     
    910910 * @param   iLun            The Logical Unit to obtain the interface of.
    911911 * @param   ppBase          Where to store the base interface pointer.
    912  * @remark  We're doing any locking ATM, so don't try call this at times when the
     912 * @remark  We're not doing any locking ATM, so don't try call this at times when the
    913913 *          device chain is known to be updated.
    914914 */
  • trunk/src/VBox/VMM/PDMDriver.cpp

    r3520 r3852  
    9393static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterV(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args);
    9494static DECLCALLBACK(int) pdmR3DrvHlp_SUPCallVMMR0Ex(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg);
     95static DECLCALLBACK(int) pdmR3DrvHlp_USBRegisterHub(PPDMDRVINS pDrvIns, void *pvReservedIn, void **ppvReservedHlp);
    9596
    9697/** @def PDMDRV_ASSERT_DRVINS
     
    138139    pdmR3DrvHlp_STAMRegisterV,
    139140    pdmR3DrvHlp_SUPCallVMMR0Ex,
     141    pdmR3DrvHlp_USBRegisterHub,
    140142    0 /* the end */
    141143};
     
    996998    }
    997999
    998     LogFlow(("pdmR3DrvHlp_SSMDeregister: caller='%s'/%d: returns %Vrc\n", pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, rc));
    999     return rc;
    1000 }
    1001 
     1000    LogFlow(("pdmR3DrvHlp_SUPCallVMMR0Ex: caller='%s'/%d: returns %Vrc\n", pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, rc));
     1001    return rc;
     1002}
     1003
     1004
     1005
     1006/** @copydoc PDMDRVHLP::pfnUSBRegisterHub */
     1007static DECLCALLBACK(int) pdmR3DrvHlp_USBRegisterHub(PPDMDRVINS pDrvIns, void *pvReservedIn, void **ppvReservedHlp)
     1008{
     1009    PDMDRV_ASSERT_DRVINS(pDrvIns);
     1010    VM_ASSERT_EMT(pDrvIns->Internal.s.pVM);
     1011    LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: pvReservedIn=%p ppvReservedHlp=%p\n",
     1012             pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, pvReservedIn, ppvReservedHlp));
     1013
     1014//    int rc = PDMUSBRegisterHub(pDrvIns->Internal.s.pVM, pvReservedIn, ppvReservedHlp);
     1015    int rc = VERR_NOT_IMPLEMENTED;
     1016
     1017    LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: returns %Vrc\n", pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, rc));
     1018    return rc;
     1019}
     1020
  • trunk/src/VBox/VMM/PDMInternal.h

    r3723 r3852  
    4848typedef PPDMDEV *PPPDMDEV;
    4949
     50/** Pointer to a PDM USB Device. */
     51typedef struct PDMUSB *PPDMUSB;
     52/** Pointer to a pointer to a PDM USB Device. */
     53typedef PPDMUSB *PPPDMUSB;
     54
    5055/** Pointer to a PDM Driver. */
    5156typedef struct PDMDRV *PPDMDRV;
     
    6570typedef struct PDMRTC *PPDMRTC;
    6671
    67 
    68 /**
    69  * Private instance data.
     72/** Pointer to an USB HUB registration record. */
     73typedef struct PDMUSBHUB *PPDMUSBHUB;
     74
     75/**
     76 * Private device instance data.
    7077 */
    7178typedef struct PDMDEVINSINT
     
    105112
    106113/**
    107  * Private instance data.
     114 * Private USB device instance data.
     115 */
     116typedef struct PDMUSBINSINT
     117{
     118    /** Pointer to the next instance.
     119     * (Head is pointed to by PDM::pUsbInstances.) */
     120    R3PTRTYPE(PPDMUSBINS)           pNext;
     121    /** Pointer to the next per USB device instance.
     122     * (Head is pointed to by PDMUSB::pInstances.) */
     123    R3PTRTYPE(PPDMUSBINS)           pPerDeviceNext;
     124
     125    /** Pointer to device structure. */
     126    R3PTRTYPE(PPDMUSB)              pUsb;
     127
     128    /** Pointer to the VM this instance was created for. */
     129    PVMR3                           pVM;
     130    /** Pointer to the list of logical units associated with the device. (FIFO) */
     131    R3PTRTYPE(PPDMLUN)              pLuns;
     132    /** The per instance device configuration. */
     133    R3PTRTYPE(PCFGMNODE)            pCfg;
     134    /** The global device configuration. */
     135    R3PTRTYPE(PCFGMNODE)            pCfgGlobal;
     136
     137    /** Pointer to the USB hub this device is connected to. */
     138    R3PTRTYPE(PPDMUSBHUB)           pHub;
     139    /** The port number that we're connected to. */
     140    uint32_t                        iPort;
     141#if HC_ARCH_BITS == 64
     142    uint32_t                        Alignment0;
     143#endif
     144} PDMUSBINSINT;
     145
     146
     147/**
     148 * Private driver instance data.
    108149 */
    109150typedef struct PDMDRVINSINT
     
    206247/* Must be included after PDMDEVINSINT is defined. */
    207248#define PDMDEVINSINT_DECLARED
     249#define PDMUSBINSINT_DECLARED
    208250#define PDMDRVINSINT_DECLARED
    209251#define PDMCRITSECTINT_DECLARED
     
    213255#endif
    214256#include <VBox/pdm.h>
    215 
    216257
    217258
     
    232273    /** Pointer to the top driver in the driver chain. */
    233274    PPDMDRVINS          pTop;
    234     /** Pointer to the device instance which the LUN belongs to. */
     275    /** Pointer to the device instance which the LUN belongs to.
     276     * Either this is set or pUsbIns is set. Both is never set at the same time. */
    235277    PPDMDEVINS          pDevIns;
     278    /** Pointer to the USB device instance which the LUN belongs to. */
     279    PPDMUSBINS          pUsbIns;
    236280    /** Pointer to the device base interface. */
    237281    PPDMIBASE           pBase;
     
    256300    /** Pointer to chain of instances (HC Ptr). */
    257301    HCPTRTYPE(PPDMDEVINS)               pInstances;
    258 
    259302} PDMDEV;
    260303
    261304
    262305/**
     306 * PDM USB Device.
     307 */
     308typedef struct PDMUSB
     309{
     310    /** Pointer to the next device (R3 Ptr). */
     311    R3PTRTYPE(PPDMUSB)                  pNext;
     312    /** Device name length. (search optimization) */
     313    RTUINT                              cchName;
     314    /** Registration structure. */
     315    R3PTRTYPE(const struct PDMUSBREG *) pUsbReg;
     316    /** Number of instances. */
     317    RTUINT                              cInstances;
     318    /** Pointer to chain of instances (R3 Ptr). */
     319    R3PTRTYPE(PPDMUSBINS)               pInstances;
     320} PDMUSB;
     321
     322
     323/**
    263324 * PDM Driver.
    264325 */
     
    266327{
    267328    /** Pointer to the next device. */
    268     PPDMDRV                 pNext;
     329    PPDMDRV                             pNext;
    269330    /** Registration structure. */
    270     const struct PDMDRVREG *pDrvReg;
     331    const struct PDMDRVREG *            pDrvReg;
    271332    /** Number of instances. */
    272     RTUINT                  cInstances;
    273 
     333    RTUINT                              cInstances;
    274334} PDMDRV;
    275335
     
    657717
    658718/**
     719 * An USB hub registration record.
     720 */
     721typedef struct PDMUSBHUB
     722{
     723    /** The USB versions this hub support.
     724     * Note that 1.1 hubs can take on 2.0 devices. */
     725    uint32_t            fVersions;
     726    /** The number of occupied ports. */
     727    uint32_t            cAvailablePorts;
     728    /** Pointer to the next hub in the list. */
     729    struct PDMUSBHUB   *pNext;
     730    /** The driver instance of the hub.. */
     731    PPDMDRVINS          pDrvIns;
     732
     733} PDMUSBHUB;
     734
     735/** Pointer to a const USB HUB registration record. */
     736typedef const PDMUSBHUB *PCPDMUSBHUB;
     737
     738
     739/**
    659740 * Converts a PDM pointer into a VM pointer.
    660741 * @returns Pointer to the VM structure the PDM is part of.
     
    682763    /** List of devices instances. (FIFO) */
    683764    HCPTRTYPE(PPDMDEVINS)           pDevInstances;
     765    /** List of registered USB devices. (FIFO) */
     766    R3PTRTYPE(PPDMUSB)              pUsbDevs;
     767    /** List of USB devices instances. (FIFO) */
     768    R3PTRTYPE(PPDMUSBINS)           pUsbInstances;
    684769    /** List of registered drivers. (FIFO) */
    685770    HCPTRTYPE(PPDMDRV)              pDrvs;
     
    698783    /** The registered RTC device. */
    699784    HCPTRTYPE(PPDMRTC)              pRtc;
     785    /** The registered USB HUBs. (FIFO) */
     786    R3PTRTYPE(PPDMUSBHUB)           pUSBHubs;
    700787
    701788    /** Queue in which devhlp tasks are queued for R3 execution - HC Ptr. */
     
    719806    /** Pointer to the queue which should be manually flushed - GCPtr. */
    720807    GCPTRTYPE(struct PDMQUEUE *)    pQueueFlushGC;
    721 
    722808#if HC_ARCH_BITS == 64
    723809    uint32_t                        padding0;
     
    778864int         pdmR3DevFindLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMLUN *ppLun);
    779865
     866int         pdmR3UsbInit(PVM pVM);
     867PPDMUSB     pdmR3UsbLookup(PVM pVM, const char *pszName);
     868int         pdmR3UsbFindLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMLUN *ppLun);
     869
    780870int         pdmR3DrvInit(PVM pVM);
    781871int         pdmR3DrvDetach(PPDMDRVINS pDrvIns);
     
    790880
    791881void        pdmR3ThreadDestroyDevice(PVM pVM, PPDMDEVINS pDevIns);
     882void        pdmR3ThreadDestroyUsb(PVM pVM, PPDMUSBINS pUsbIns);
    792883void        pdmR3ThreadDestroyDriver(PVM pVM, PPDMDRVINS pDrvIns);
    793884void        pdmR3ThreadDestroyAll(PVM pVM);
  • trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp

    r2981 r3852  
    177177    GEN_CHECK_OFF(PDM, pDevs);
    178178    GEN_CHECK_OFF(PDM, pDevInstances);
     179    GEN_CHECK_OFF(PDM, pUsbDevs);
     180    GEN_CHECK_OFF(PDM, pUsbInstances);
    179181    GEN_CHECK_OFF(PDM, pDrvs);
    180182    GEN_CHECK_OFF(PDM, pCritSects);
     
    233235    GEN_CHECK_OFF(PDM, pDmac);
    234236    GEN_CHECK_OFF(PDM, pRtc);
     237    GEN_CHECK_OFF(PDM, pUSBHubs);
    235238    GEN_CHECK_OFF(PDM, pDevHlpQueueGC);
    236239    GEN_CHECK_OFF(PDM, pDevHlpQueueHC);
     
    241244    GEN_CHECK_OFF(PDM, pQueueFlushGC);
    242245    GEN_CHECK_OFF(PDM, pQueueFlushHC);
     246    GEN_CHECK_OFF(PDM, pThreads);
     247    GEN_CHECK_OFF(PDM, pThreadsTail);
    243248    GEN_CHECK_OFF(PDM, cPollers);
    244249    GEN_CHECK_OFF(PDM, apfnPollers);
     
    804809    GEN_CHECK_OFF(PATCHINFO, aPrivInstr[MAX_INSTR_SIZE - 1]);
    805810    GEN_CHECK_OFF(PATCHINFO, cbPrivInstr);
    806     GEN_CHECK_OFF(PATCHINFO, opcode);     
     811    GEN_CHECK_OFF(PATCHINFO, opcode);
    807812    GEN_CHECK_OFF(PATCHINFO, cbPatchJump);
    808813    GEN_CHECK_OFF(PATCHINFO, pPatchJumpDestGC);
  • trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp

    r2981 r3852  
    33 * tstVMStructSize - testcase for check structure sizes/alignment
    44 *                   and to verify that HC and GC uses the same
    5  *                   representation of the structures.               
     5 *                   representation of the structures.
    66 */
    77
     
    202202        rc++;
    203203    }
    204 #endif 
     204#endif
    205205
    206206    /* pdm */
    207207    CHECK_MEMBER_ALIGNMENT(PDMDEVINS, achInstanceData, 16);
    208208    CHECK_PADDING(PDMDEVINS, Internal);
     209    CHECK_MEMBER_ALIGNMENT(PDMUSBINS, achInstanceData, 16);
     210    CHECK_PADDING(PDMUSBINS, Internal);
    209211    CHECK_MEMBER_ALIGNMENT(PDMDRVINS, achInstanceData, 16);
    210212    CHECK_PADDING(PDMDRVINS, Internal);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette