Files
@ d6b9b2ac5869
Branch filter:
Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public-bincomp/vmkernel64/release/core/vmkapi_device.h
d6b9b2ac5869
11.9 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 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | /***************************************************************************
* Copyright 2007 - 2013 VMware, Inc. All rights reserved.
***************************************************************************/
/*
* @VMKAPIMOD_LICENSE@
*/
/*
***********************************************************************
* Devices */ /**
* \defgroup Device Device interface
* @{
***********************************************************************
*/
#ifndef _VMKAPI_DEVICE_H_
#define _VMKAPI_DEVICE_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 */
/**
* \brief Device identification.
*/
typedef struct {
/** Type of bus device is on */
vmk_BusType busType;
/** Bus-specific address for device */
char *busAddress;
/**
* String length of bus-specific address (excluding terminating NUL).
* The maximum length supported is 511.
*/
vmk_uint32 busAddressLen;
/** Bus-specific identifier for device */
char *busIdentifier;
/**
* String length of bus-specific identifier (excluding terminating NUL).
* The maximum length supported is 63.
*/
vmk_uint32 busIdentifierLen;
} vmk_DeviceID;
/*
***********************************************************************
* vmk_DeviceRemove -- */ /**
*
* \ingroup Device
* \brief Remove a device.
*
* This callback is invoked only on devices in an unclaimed state.
* A device may be removed for operations such as system shutdown,
* driver unload, or explicit device removal.
*
* Driver should carry out any operations required for the physical
* removal of the device, and the device object must be unregistered
* by calling vmk_DeviceUnregister(). Driver's private data for the
* device, including registeringDriverData, must be freed only after
* successful unregistration of the device.
*
* If the device is not unregistered, this callback may be invoked
* again later.
*
* \param[in] device Handle to device to be removed.
*
* \retval VMK_OK Device unregistered successfully.
* \retval VMK_FAILURE Driver could not unregister device.
* All other error codes are treated as
* VMK_FAILURE.
*
***********************************************************************
*/
typedef VMK_ReturnStatus (*vmk_DeviceRemove)(vmk_Device device);
/**
* \brief Device operations.
*/
typedef struct {
/** \brief Remove a device from the system. */
vmk_DeviceRemove removeDevice;
} vmk_DeviceOps;
/**
* \brief Device registration data.
*/
typedef struct {
/** Driver registering this device */
vmk_Driver registeringDriver;
/** Device identification */
vmk_DeviceID *deviceID;
/** Device operations */
vmk_DeviceOps *deviceOps;
/** Opaque data set by registering driver for its private use */
vmk_AddrCookie registeringDriverData;
/** Opaque data set by registering driver for attaching driver */
vmk_AddrCookie registrationData;
} vmk_DeviceProps;
/*
***********************************************************************
* vmk_DeviceRegister -- */ /**
*
* \ingroup Device
* \brief Register a device with the device database and get a device
* handle back.
*
* A device can be physical (e.g. a PCI device) or logical
* (e.g. an uplink, or a similar software construct).
*
* Devices can be registered only from a driver's scan callback.
*
* The '#' character is not permitted in the busAddress of the device,
* except if it is a logical device whose busAddress is generated using
* vmk_LogicalCreateBusAddress.
*
* The registering driver's module heap is used for temporary scratch
* purposes by this service. No memory allocated from this heap will
* persist after vmk_DeviceRegister returns.
*
* \note This function will not block.
*
* \param[in] deviceProps Device information.
* \param[in] parent Parent device handle.
* \param[out] newDevice New device handle.
*
* \retval VMK_OK Successfully registered device.
* \retval VMK_NOT_SUPPORTED Registration not from a driver's scan
* callback.
* \retval VMK_BAD_PARAM Device ID is NULL or incomplete.
* \retval VMK_BAD_PARAM The deviceID's busAddress is improperly
* formatted for the specified bus type.
* \retval VMK_EXISTS Device with this data already registered.
* \retval VMK_NO_MEMORY Unable to allocate memory for device
* handle.
* \retval VMK_NO_MODULE_HEAP The registeringDriver's module
* (specified in deviceProps) has no heap.
* \retval VMK_NAME_TOO_LONG The deviceID's busAddressLen is greater
* then the system defined maximum.
* \retval VMK_NAME_TOO_LONG The deviceID's busIdentifierLen is
* greater then the system defined maximum.
***********************************************************************
*/
VMK_ReturnStatus
vmk_DeviceRegister(vmk_DeviceProps *deviceProps,
vmk_Device parent,
vmk_Device *newDevice);
/*
***********************************************************************
* vmk_DeviceUnregister -- */ /**
*
* \ingroup Device
* \brief Unregister a device from the device database.
*
* A device must be unregistered only from its device remove callback
* provided by the registering driver.
*
* \note This function will not block.
*
* \param[in] device Device handle.
*
* \retval VMK_OK Successfully unregistered device.
* \retval VMK_NOT_SUPPORTED Unregistration was not from the device's
* remove callback.
* \retval VMK_BAD_PARAM Device handle is invalid.
* \retval VMK_BUSY Device has references or resources allocated.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DeviceUnregister(vmk_Device device);
/*
***********************************************************************
* vmk_DeviceGetDeviceID -- */ /**
*
* \ingroup Device
* \brief Return a handle to device identification data.
*
* \note This function will not block.
*
* \param[in] heap Heap from which device ID should be allocated.
* \param[in] device Device handle.
* \param[out] devID Device identification data.
*
* \retval VMK_OK Successfully returned device id.
* \retval VMK_BAD_PARAM Device handle is invalid.
* \retval VMK_NO_MEMORY Unable to allocate memory for device ID.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DeviceGetDeviceID(vmk_HeapID heap,
vmk_Device device,
vmk_DeviceID **devID);
/*
***********************************************************************
* vmk_DevicePutDeviceID -- */ /**
*
* \ingroup Device
* \brief Release device identification data.
*
* \note This function will not block.
*
* \param[in] heap Heap from which device ID was allocated.
* \param[in] devID Device identification data.
*
* \retval VMK_OK Successfully released device id data.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DevicePutDeviceID(vmk_HeapID heap,
vmk_DeviceID *devID);
/*
***********************************************************************
* vmk_DeviceGetRegisteringDriverData -- */ /**
*
* \ingroup Device
* \brief Get registering driver's private data for device.
*
* \note This function will not block.
*
* \param[in] device Device handle.
* \param[out] data Registering driver's private data for device.
*
* \retval VMK_OK Successfully returned device data.
* \retval VMK_BAD_PARAM Invalid device handle.
* \retval VMK_BAD_PARAM data argument is NULL.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DeviceGetRegisteringDriverData(vmk_Device device,
vmk_AddrCookie *data);
/*
***********************************************************************
* vmk_DeviceGetRegistrationData -- */ /**
*
* \ingroup Device
* \brief Get device registration data for attaching driver.
*
* \note This function will not block.
*
* \param[in] device Device handle.
* \param[out] data Device registration data.
*
* \retval VMK_OK Successfully returned device data.
* \retval VMK_BAD_PARAM Invalid device handle.
* \retval VMK_BAD_PARAM data argument is NULL.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DeviceGetRegistrationData(vmk_Device device,
vmk_AddrCookie *data);
/*
***********************************************************************
* vmk_DeviceGetAttachedDriverData -- */ /**
*
* \ingroup Device
* \brief Get attached driver's private data for device.
*
* \note This function will not block.
*
* \param[in] device Device handle.
* \param[out] data Attached driver's private data for device.
*
* \retval VMK_OK Successfully returned private data.
* \retval VMK_BAD_PARAM Invalid device handle.
* \retval VMK_BAD_PARAM data argument is NULL.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DeviceGetAttachedDriverData(vmk_Device device,
vmk_AddrCookie *data);
/*
***********************************************************************
* vmk_DeviceSetAttachedDriverData -- */ /**
*
* \ingroup Device
* \brief Set attached driver's private data for device.
*
* \note This function will not block.
*
* \param[in] device Device handle.
* \param[in] data Attached driver's private data for device.
*
* \retval VMK_OK Successfully set private data.
* \retval VMK_BAD_PARAM Invalid device handle.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DeviceSetAttachedDriverData(vmk_Device device,
vmk_AddrCookie data);
/*
***********************************************************************
* vmk_DeviceRelease -- */ /**
*
* \ingroup Device
* \brief Release the device reference obtained using any of the Find
* functions.
*
* \note This function will not block.
*
* \param[in] device Device to be released.
*
* \retval VMK_OK Successfully released reference on device.
* \retval VMK_BAD_PARAM Device handle is invalid.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DeviceRelease(vmk_Device device);
/*
***********************************************************************
* vmk_DeviceRequestRescan -- */ /**
*
* \ingroup Device
* \brief Request a rescan of the device to register new children.
*
* This call submits a request to the device layer to schedule an
* invocation of the device driver's vmk_DriverScanDevice() callback.
*
* \param[in] driver Requesting driver
* \param[in] device Device to be scanned
*
* \retval VMK_OK Request accepted.
* \retval VMK_BAD_PARAM Invalid device handle.
* \retval VMK_NO_PERMISSION Driver cannot submit this request.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_DeviceRequestRescan(vmk_Driver driver,
vmk_Device device);
#endif /* _VMKAPI_DEVICE_H_ */
/** @} */
|