NVIDIA DRIVE OS Linux API Reference

5.1.3.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Device Driver Framework

Detailed Description

Declares the APIs for Quickboot device driver framework.

Data Structures

struct  QbDev
 
struct  QbDevOperations
 Holds callbacks for device drivers. More...
 

Macros

#define QB_MAX_DEV_INSTANCE   16U
 
#define QB_MAX_DRIVER_TYPES   100U
 

Enumerations

enum  QbDeviceStatus {
  QbDeviceStatus_None = 0,
  QbDeviceStatus_Idle,
  QbDeviceStatus_ReadInProgress,
  QbDeviceStatus_ReadFailure,
  QbDeviceStatus_WriteInProgress,
  QbDeviceStatus_WriteFailure,
  QbDeviceStatus_EccFailure,
  QbDeviceStatus_CorrectedEccFailure,
  QbDeviceStatus_DataCrcFailure,
  QbDeviceStatus_DataTimeout,
  QbDeviceStatus_DataEndBitError,
  QbDeviceStatus_CorrectedReadFailure,
  QbDeviceStatus_UnknownFailure,
  QbDeviceStatus_Max,
  QbDeviceStatus_Force32 = 0x7fffffff
}
 Defines the current status of a transfer request. More...
 

Functions

NvError QbDeviceRead (QbDriver DriverType, NvU32 Instance, void *Buffer, NvU64 Size, NvU64 Offset)
 Performs a read operation for the device and instance passed as parameter. More...
 
NvError QbDevicePartRead (NvU32 PartitionId, void *Buffer, NvU64 Size, NvU64 Offset)
 Performs a read operation on the partition passed as parameter. More...
 
NvError QbDeviceWrite (QbDriver DriverType, NvU32 Instance, void *Buffer, NvU64 Size, NvU64 Offset)
 Performs a write operation on the device passed as parameter. More...
 
NvError QbDevicePartWrite (NvU32 PartitionId, void *Buffer, NvU64 Size, NvU64 Offset)
 Performs a write operation for partition passed as parameter. More...
 
NvError QbDeviceIoctl (QbDriver DriverType, NvU32 Instance, NvU32 Cmd, void *Buffer)
 Performs a ioctl operation on given driver. More...
 
NvError QbCleanExit (QbDriver DriverType, NvU32 Instance)
 Function to trigger clean exit of driver when it's not longer used. More...
 
NvError QbRegisterDriver (QbDriver Driver, struct QbDevOperations *pDevOps)
 Registers a driver to the device driver framework. More...
 
NvError QbRegisterDevice (struct QbDev *pDevice)
 Registers a device to the device driver framework. More...
 
NvError QbLateRegisterDevice (QbDriver DriverType, NvU32 Instance)
 Board Call back to trigger registration and intialization of driver. More...
 
NvBool QbIsDeviceRegistered (QbDriver DriverType, NvU32 Instance)
 Function to check if Device is registered already in the driver framework. More...
 

Macro Definition Documentation

#define QB_MAX_DEV_INSTANCE   16U

Definition at line 36 of file device.h.

#define QB_MAX_DRIVER_TYPES   100U

Definition at line 37 of file device.h.

Enumeration Type Documentation

Defines the current status of a transfer request.

Enumerator
QbDeviceStatus_None 
QbDeviceStatus_Idle 
QbDeviceStatus_ReadInProgress 
QbDeviceStatus_ReadFailure 
QbDeviceStatus_WriteInProgress 
QbDeviceStatus_WriteFailure 
QbDeviceStatus_EccFailure 
QbDeviceStatus_CorrectedEccFailure 
QbDeviceStatus_DataCrcFailure 
QbDeviceStatus_DataTimeout 
QbDeviceStatus_DataEndBitError 
QbDeviceStatus_CorrectedReadFailure 

Read error occurred but was corrected.

QbDeviceStatus_UnknownFailure 
QbDeviceStatus_Max 
QbDeviceStatus_Force32 

Definition at line 48 of file device.h.

Function Documentation

NvError QbCleanExit ( QbDriver  DriverType,
NvU32  Instance 
)

Function to trigger clean exit of driver when it's not longer used.

This serves as a cleanup function, so that controller is passed to OS in a clean state.

Parameters
DriverTypeDriver type as defined in the QbDriver enumeration.
InstanceDevice instance for which to perform the cleanup.
Return values
NvSuccessif successful, or the appropriate error code.
NvError QbDeviceIoctl ( QbDriver  DriverType,
NvU32  Instance,
NvU32  Cmd,
void *  Buffer 
)

Performs a ioctl operation on given driver.

Perform IOCTL Cmd on the given driver. Cmd will be driver specific and the buffer as well will be driver specific

Parameters
DriverTypeDriver type as defined in the QbDriver enumeration.
InstanceDevice instance for which to perform the write.
CmdCommand which need to be perform by the driver
BufferA pointer to a buffer location containing structure for corresponding command
Return values
NvSuccessif successful, or the appropriate error code.
NvError QbDevicePartRead ( NvU32  PartitionId,
void *  Buffer,
NvU64  Size,
NvU64  Offset 
)

Performs a read operation on the partition passed as parameter.

This function is applicable for storage devices only and it must have a partition on it. (Partitions are created while flashing.) Internally, QbDevicePartRead translates the PartitionId into a device ID and device instance and adjusts the offset with the start of the device.

Parameters
PartitionIdPartition ID in the partition table
BufferA pointer to the buffer location in memory.
SizeSize of the data to be read.
OffsetOffset from the start of the partition.
Returns
NvSuccess if successful, or the appropriate error code.
NvError QbDevicePartWrite ( NvU32  PartitionId,
void *  Buffer,
NvU64  Size,
NvU64  Offset 
)

Performs a write operation for partition passed as parameter.

Use this function for storage devices only, where the devices have a partition. (Partitions are created during flashing.) Internally, QbDevicePartWrite translates the PartitionId into device ID and device instance and adjusts the offset with the start of the device.

Parameters
PartitionIdPartition ID.
BufferA pointer to a buffer location in memory to which data must be written to the device.
SizeSize of the data to be written.
OffsetOffset from the start of the partition.
Return values
NvSuccessif successful, or the appropriate error code.
NvError QbDeviceRead ( QbDriver  DriverType,
NvU32  Instance,
void *  Buffer,
NvU64  Size,
NvU64  Offset 
)

Performs a read operation for the device and instance passed as parameter.

This function can be used for both storage and non-storage devices. For storage devices, QbDevicePartRead is also supported, which can be used to read a given partition.

Parameters
DriverTypeDriver type as defined in the QbDriver enumeration.
InstanceDevice Instance on which to perform the read.
BufferA pointer to the buffer location in memory.
SizeSize of the data to be read.
OffsetOffset from the start of the device.
Returns
NvSuccess if successful, or the appropriate error code.
NvError QbDeviceWrite ( QbDriver  DriverType,
NvU32  Instance,
void *  Buffer,
NvU64  Size,
NvU64  Offset 
)

Performs a write operation on the device passed as parameter.

This function can be used for both storage and non-storage devices. For storage devices, QbDevicePartWrite is also supported, which can be used to write to a given parition.

Parameters
DriverTypeDriver type as defined in the QbDriver enumeration.
InstanceDevice instance for which to perform the write.
BufferA pointer to a buffer location in memory.
SizeSize of the data to be read.
OffsetOffset from the start of the device.
Return values
NvSuccessif successful, or the appropriate error code.
NvBool QbIsDeviceRegistered ( QbDriver  DriverType,
NvU32  Instance 
)

Function to check if Device is registered already in the driver framework.

Parameters
DriverTypeDevice for which query need to be made.
InstanceInstance for which query need to be made
Return values
NV_TRUEif instance is registered else NV_FALSE
NvError QbLateRegisterDevice ( QbDriver  DriverType,
NvU32  Instance 
)

Board Call back to trigger registration and intialization of driver.

Internally this function will first find deviceID and Instance for given PartId. And then look-up if device is registered or not. If device is not registered, it will register the same after retrieving the platform data from DT for corresponding instance

Parameters
DriverTypeDriver to register.
InstanceInstance to be registered
Return values
NvSuccessif successful, or the appropriate error code.
NvError QbRegisterDevice ( struct QbDev pDevice)

Registers a device to the device driver framework.

Internally this fuction calls the probe function to probe and initialize the device

Parameters
pDeviceA pointer to the device-specific information.
Returns
NvSuccess if successful, or the appropriate error code.
NvError QbRegisterDriver ( QbDriver  Driver,
struct QbDevOperations pDevOps 
)

Registers a driver to the device driver framework.

Parameters
DriverDriver to register.
pDevOpsA pointer to the set of callbacks defined through function pointers.
Returns
NvSuccess if successful, or the appropriate error code.