VirtualBox

Changeset 24730 in vbox for trunk/include


Ignore:
Timestamp:
Nov 17, 2009 4:51:03 PM (15 years ago)
Author:
vboxsync
Message:

PDM: Implemented making device/driver/usb-device suspend and poweroff notifications asynchronous when needed. Also prepped the way for failing poweron and resume.

Location:
trunk/include/VBox
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/pdmcommon.h

    r24703 r24730  
    11/** @file
    2  * PDM - Pluggable Device Manager, Common Device & Driver Definitions. (VMM)
     2 * PDM - Pluggable Device Manager, Common Definitions & Types. (VMM)
    33 */
    44
     
    2828 */
    2929
    30 #ifndef ___VBox_pdmdevdrv_h
    31 #define ___VBox_pdmdevdrv_h
     30#ifndef ___VBox_pdmcommon_h
     31#define ___VBox_pdmcommon_h
    3232
    33 /** @defgroup grp_pdm_devdrv    Common Device & Driver Definitions
     33/** @defgroup grp_pdm_common    Common Definitions & Types
    3434 * @ingroup grp_pdm
     35 *
     36 * Not all the types here are "common", they are here to work around header
     37 * ordering issues.
     38 *
    3539 * @{
    3640 */
     
    3842/** PDM Attach/Detach Callback Flags.
    3943 * Used by PDMDeviceAttach, PDMDeviceDetach, PDMDriverAttach, PDMDriverDetach,
    40  * FNPDMDEVATTACH, FNPDMDEVDETACH, FNPDMDRVATTACH, FNPDMDRVDETACH and 
    41  * FNPDMDRVCONSTRUCT. 
    42  @{ */ 
     44 * FNPDMDEVATTACH, FNPDMDEVDETACH, FNPDMDRVATTACH, FNPDMDRVDETACH and
     45 * FNPDMDRVCONSTRUCT.
     46 @{ */
    4347/** The attach/detach command is not a hotplug event. */
    4448#define PDM_TACH_FLAGS_NOT_HOT_PLUG     RT_BIT_32(0)
    4549/* @} */
     50
     51
     52/**
     53 * Is asynchronous handling of suspend or power off notification completed?
     54 *
     55 * This is called to check whether the USB device has quiesced.  Don't deadlock.
     56 * Avoid blocking.  Do NOT wait for anything.
     57 *
     58 * @returns true if done, false if more work to be done.
     59 *
     60 * @param   pUsbIns             The USB device instance.
     61 *
     62 * @thread  EMT(0)
     63 */
     64typedef DECLCALLBACK(bool) FNPDMUSBASYNCNOTIFY(PPDMUSBINS pUsbIns);
     65/** Pointer to a FNPDMUSBASYNCNOTIFY. */
     66typedef FNPDMUSBASYNCNOTIFY *PFNPDMUSBASYNCNOTIFY;
     67
     68/**
     69 * Is asynchronous handling of suspend or power off notification completed?
     70 *
     71 * This is called to check whether the device has quiesced.  Don't deadlock.
     72 * Avoid blocking.  Do NOT wait for anything.
     73 *
     74 * @returns true if done, false if more work to be done.
     75 *
     76 * @param   pDevIns             The device instance.
     77 *
     78 * @thread  EMT(0)
     79 */
     80typedef DECLCALLBACK(bool) FNPDMDEVASYNCNOTIFY(PPDMDEVINS pDevIns);
     81/** Pointer to a FNPDMDEVASYNCNOTIFY. */
     82typedef FNPDMDEVASYNCNOTIFY *PFNPDMDEVASYNCNOTIFY;
     83
     84/**
     85 * Is asynchronous handling of suspend or power off notification completed?
     86 *
     87 * This is called to check whether the driver has quiesced.  Don't deadlock.
     88 * Avoid blocking.  Do NOT wait for anything.
     89 *
     90 * @returns true if done, false if more work to be done.
     91 *
     92 * @param   pDrvIns             The driver instance.
     93 *
     94 * @thread  EMT(0)
     95 */
     96typedef DECLCALLBACK(bool) FNPDMDRVASYNCNOTIFY(PPDMDRVINS pDrvIns);
     97/** Pointer to a FNPDMDRVASYNCNOTIFY. */
     98typedef FNPDMDRVASYNCNOTIFY *PFNPDMDRVASYNCNOTIFY;
    4699
    47100/** @} */
  • trunk/include/VBox/pdmdev.h

    r24125 r24730  
    3636#include <VBox/pdmifs.h>
    3737#include <VBox/pdmins.h>
    38 #include <VBox/pdmdevdrv.h>
     38#include <VBox/pdmcommon.h>
    3939#include <VBox/iom.h>
    4040#include <VBox/tm.h>
     
    151151 * @returns VBox status.
    152152 * @param   pDevIns     The device instance data.
     153 * @thread  EMT(0)
    153154 */
    154155typedef DECLCALLBACK(void)  FNPDMDEVSUSPEND(PPDMDEVINS pDevIns);
     
    170171 *
    171172 * @param   pDevIns     The device instance data.
     173 * @thread  EMT(0)
    172174 */
    173175typedef DECLCALLBACK(void)   FNPDMDEVPOWEROFF(PPDMDEVINS pDevIns);
     
    406408#define PDM_IRQ_LEVEL_HIGH                      RT_BIT(0)
    407409/** Deassert the IRQ (can assume value 0). */
    408 #define PDM_IRQ_LEVEL_LOW           0
     410#define PDM_IRQ_LEVEL_LOW                       0
    409411/** flip-flop - assert and then deassert it again immediately. */
    410412#define PDM_IRQ_LEVEL_FLIP_FLOP                 (RT_BIT(1) | PDM_IRQ_LEVEL_HIGH)
     
    24052407    DECLR3CALLBACKMEMBER(int, pfnPhysGCPtr2GCPhys, (PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys));
    24062408
     2409    /**
     2410     * Set up asynchronous handling of a suspend or power off notification.
     2411     *
     2412     * This shall only be called when getting the notification.  It must be called
     2413     * for each one.
     2414     *
     2415     * @returns VBox status code.
     2416     * @param   pDevIns             The device instance.
     2417     * @param   pfnAsyncNotify      The callback.
     2418     * @thread  EMT(0)
     2419     */
     2420    DECLR3CALLBACKMEMBER(int, pfnSetAsyncNotification, (PPDMDEVINS pDevIns, PFNPDMDEVASYNCNOTIFY pfnAsyncNotify));
     2421
    24072422    /** Space reserved for future members.
    24082423     * @{ */
     
    37163731
    37173732/**
     3733 * @copydoc PDMDEVHLPR3::pfnSetAsyncNotification
     3734 */
     3735DECLINLINE(int) PDMDevHlpSetAsyncNotification(PPDMDEVINS pDevIns, PFNPDMDEVASYNCNOTIFY pfnAsyncNotify)
     3736{
     3737    return pDevIns->pDevHlpR3->pfnSetAsyncNotification(pDevIns, pfnAsyncNotify);
     3738}
     3739
     3740/**
    37183741 * @copydoc PDMDEVHLPR3::pfnVMState
    37193742 */
  • trunk/include/VBox/pdmdrv.h

    r23915 r24730  
    3636#include <VBox/pdmifs.h>
    3737#include <VBox/pdmins.h>
    38 #include <VBox/pdmdevdrv.h>
     38#include <VBox/pdmcommon.h>
    3939#include <VBox/tm.h>
    4040#include <VBox/ssm.h>
     
    698698
    699699    /**
     700     * Set up asynchronous handling of a suspend or power off notification.
     701     *
     702     * This shall only be called when getting the notification.  It must be called
     703     * for each one.
     704     *
     705     * @returns VBox status code.
     706     * @param   pDrvIns             The driver instance.
     707     * @param   pfnAsyncNotify      The callback.
     708     * @thread  EMT(0)
     709     */
     710    DECLR3CALLBACKMEMBER(int, pfnSetAsyncNotification, (PPDMDRVINS pDrvIns, PFNPDMDRVASYNCNOTIFY pfnAsyncNotify));
     711
     712    /**
    700713     * Creates a PDM thread.
    701714     *
  • trunk/include/VBox/pdmusb.h

    r21217 r24730  
    3535#include <VBox/pdmthread.h>
    3636#include <VBox/pdmifs.h>
     37#include <VBox/pdmcommon.h>
    3738#include <VBox/tm.h>
    3839#include <VBox/ssm.h>
     
    374375/** @} */
    375376
     377
    376378#ifdef IN_RING3
     379
    377380/**
    378381 * PDM USB Device API.
     
    570573     */
    571574    DECLR3CALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMUSBINS pUsbIns));
     575
     576    /**
     577     * Set up asynchronous handling of a suspend or power off notification.
     578     *
     579     * This shall only be called when getting the notification.  It must be called
     580     * for each one.
     581     *
     582     * @returns VBox status code.
     583     * @param   pUSBIns             The USB device instance.
     584     * @param   pfnAsyncNotify      The callback.
     585     * @thread  EMT(0)
     586     */
     587    DECLR3CALLBACKMEMBER(int, pfnSetAsyncNotification, (PPDMUSBINS pUSbIns, PFNPDMUSBASYNCNOTIFY pfnAsyncNotify));
    572588
    573589    /** Just a safety precaution. */
     
    607623        PDMUSBINSINT            s;
    608624#endif
    609         uint8_t                 padding[HC_ARCH_BITS == 32 ? 64 : 96];
     625        uint8_t                 padding[HC_ARCH_BITS == 32 ? 96 : 128];
    610626    } Internal;
    611627
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