Files
@ d6b9b2ac5869
Branch filter:
Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public-bincomp/vmkernel64/release/core/vmkapi_driver.h
d6b9b2ac5869
10.2 KiB
text/x-chdr
ESXi-5.5-U2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
/***************************************************************************
* Copyright 2010 VMware, Inc. All rights reserved.
***************************************************************************/
/*
* @VMKAPIMOD_LICENSE@
*/
/*
***********************************************************************
* Driver */ /**
* \addtogroup Device
* @{
* \defgroup Driver Driver Interfaces
* @{
***********************************************************************
*/
#ifndef _VMKAPI_DRIVER_H_
#define _VMKAPI_DRIVER_H_
/** \cond never */
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
#error This vmkapi file should never be included directly but only via vmkapi.h
#endif
/** \endcond never */
/*
***********************************************************************
* vmk_DriverAttachDevice -- */ /**
*
* \brief Attach a device to a driver.
*
* This callback is invoked to offer an unclaimed device to a driver.
*
* The driver should check whether it is capable of driving the given
* device, and do initial device set up, e.g. allocate device resources.
* If the driver is not capable of driving the given device, the device
* must be restored to its original state at callback entry, and an
* error should be returned.
*
* \param[in] device Handle to device to be added to the driver.
*
* \retval VMK_OK Driver has claimed this device.
* \retval VMK_FAILURE Driver did not claim this device.
* All other error codes are treated as
* VMK_FAILURE.
*
***********************************************************************
*/
typedef VMK_ReturnStatus (*vmk_DriverAttachDevice)(vmk_Device device);
/*
***********************************************************************
* vmk_DriverStartDevice-- */ /**
*
* \brief Prepare a device to accept IO.
*
* This callback is invoked to place the device in an IO-able state.
* This can be when the device is implicitly in a quiescent state after
* a successful driver attach operation, or at any other time when the
* device has been explicitly put in a quiescent state by the callback
* vmk_DriverQuiesceDevice().
*
* The driver should prepare the device for IO.
*
* \param[in] device Handle to device to prepare for IO.
*
* \retval VMK_OK Driver will accept IO for this device.
* \retval VMK_FAILURE Driver could not prepare device for IO.
* All other error codes are treated as
* VMK_FAILURE.
*
***********************************************************************
*/
typedef VMK_ReturnStatus (*vmk_DriverStartDevice)(vmk_Device device);
/*
***********************************************************************
* vmk_DriverScanDevice -- */ /**
*
* \brief Register any child devices.
*
* This callback is invoked only on devices in IO-able state. It is
* invoked at least once after a device has been successfully attached
* to a driver and started. It may be invoked for other device hotplug
* events as appropriate.
*
* The driver may register new devices by calling vmk_DeviceRegister()
* from this callback. New devices may be registered only from this
* callback.
*
* \param[in] device Handle to device whose children may be registered.
*
* \retval VMK_OK Devices registered, or nothing to register.
* \retval VMK_FAILURE Driver could not register a child device.
* All other error codes are treated as
* VMK_FAILURE.
*
***********************************************************************
*/
typedef VMK_ReturnStatus (*vmk_DriverScanDevice)(vmk_Device device);
/*
***********************************************************************
* vmk_DriverQuiesceDevice -- */ /**
*
* \brief Place a device in quiescent state.
*
* This callback may be invoked any time after a device is in an IO-able
* state, in preparation for operations such as system shutdown, driver
* unload, or device removal.
*
* The driver should complete any IO on the device and flush any device
* caches as necessary to place the device in a quiescent state. When a
* device is in quiescent state, the driver must not report any IO to,
* and will not receive any IO from, any kernel subsystem.
*
* \param[in] device Handle to device to be quiesced.
*
* \retval VMK_OK Device has been quiesced.
* \retval VMK_FAILURE Driver could not quiesce IO on device.
* All other error codes are treated as
* VMK_FAILURE.
*
***********************************************************************
*/
typedef VMK_ReturnStatus (*vmk_DriverQuiesceDevice)(vmk_Device device);
/*
***********************************************************************
* vmk_DriverDetachDevice -- */ /**
*
* \brief Detach a device from its driver.
*
* This callback is invoked only on devices in a quiescent state.
* A device may be detached for operations such as system shutdown,
* driver unload, or device removal.
*
* The driver should stop driving this device, and undo all device setup
* performed in vmk_DriverAttachDevice. E.g. release device resources.
*
* \param[in] device Handle to device to be detached.
*
* \retval VMK_OK Device has been released.
* \retval VMK_FAILURE Driver could not detach itself from device.
* All other error codes are treated as
* VMK_FAILURE.
*
***********************************************************************
*/
typedef VMK_ReturnStatus (*vmk_DriverDetachDevice)(vmk_Device device);
/*
***********************************************************************
* vmk_DriverForgetDevice-- */ /**
*
* \brief Mark a device as inaccessible.
*
* This callback is a notification. It may be invoked at any time to
* notify the driver that a device is inaccessible, so that the driver
* does not wait indefinitely for any subsequent device operations.
*
* The driver must note that the device is inaccessible. The driver must
* return successfully, in deterministic time, on any subsequent device
* callbacks, e.g. vmk_DriverQuiesceDevice, vmk_DriverDetachDevice.
*
* \param[in] device Handle to device that is inaccessible.
*
***********************************************************************
*/
typedef void (*vmk_DriverForgetDevice)(vmk_Device device);
/**
* \brief Driver operations.
*/
typedef struct {
/** \brief Attach a device to a driver */
vmk_DriverAttachDevice attachDevice;
/** \brief Scan a device for new child devices */
vmk_DriverScanDevice scanDevice;
/** \brief Detach a device from its driver */
vmk_DriverDetachDevice detachDevice;
/** \brief Quiesce a device */
vmk_DriverQuiesceDevice quiesceDevice;
/** \brief Prepare device for IO */
vmk_DriverStartDevice startDevice;
/** \brief Notify driver of a lost device */
vmk_DriverForgetDevice forgetDevice;
} vmk_DriverOps;
/**
* \brief Driver registration data.
*/
typedef struct {
/** Module registering this driver */
vmk_ModuleID moduleID;
/** Identifying name for the driver */
vmk_Name name;
/** Driver operations */
vmk_DriverOps *ops;
/** Driver private data */
vmk_AddrCookie privateData;
} vmk_DriverProps;
/*
***********************************************************************
* vmk_DriverRegister -- */ /**
*
* \brief Register a driver with the driver database
*
* vmk_DriverRegister must be called from within the driver module's
* initialization routine. A successful registration returns a
* a new driver handle to the caller.
*
* \note This function will not block.
*
* \param[in] driverProps Driver registration data
* \param[out] driver New driver handle.
*
* \retval VMK_BAD_PARAM Name or ops argument is NULL.
* \retval VMK_EXISTS A driver by this name is already registered.
* \retval VMK_NO_MEMORY Unable to allocate memory for device handle.
* \retval VMK_NOT_FOUND Unable to find module registering this driver.
* \retval VMK_OK Successfully registered driver.
* \retval VMK_MODULE_FAILED Call was not from the module's initialization routine.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DriverRegister(vmk_DriverProps *driverProps,
vmk_Driver *driver);
/*
***********************************************************************
* vmk_DriverUnregister -- */ /**
*
* \brief Unregister a driver from the driver database.
*
* vmk_DriverUnregister is normally called from within the driver module's
* cleanup routine. A driver is also permitted to call it from its
* initialization routine if the module fails to initialize (load failure).
*
* \note This function will not block.
*
* \param[in] driver Driver handle
*
* \retval VMK_OK Successfully unregistered driver.
* \retval VMK_MODULE_FAILED Call was not from the module's cleanup or
* initialization routines.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DriverUnregister(vmk_Driver driver);
/*
***********************************************************************
* vmk_DriverGetPrivateData -- */ /**
*
* \brief Get private data for driver.
*
* \note This function will not block.
*
* \param[in] driver Driver handle
* \param[out] data Driver data.
*
* \retval VMK_OK Successfully returned driver private data.
* \retval VMK_BAD_PARAM Invalid driver handle.
* \retval VMK_BAD_PARAM data argument is NULL.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DriverGetPrivateData(vmk_Driver driver,
vmk_AddrCookie *data);
#endif /* _VMKAPI_DRIVER_H_ */
/** @} */
/** @} */
|