Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
scsi_eh.h File Reference
#include <linux/scatterlist.h>
#include <scsi/scsi_cmnd.h>

Go to the source code of this file.

Data Structures

struct  scsi_sense_hdr
 
struct  scsi_eh_save
 

Macros

#define SCSI_TRY_RESET_DEVICE   1
 
#define SCSI_TRY_RESET_BUS   2
 
#define SCSI_TRY_RESET_HOST   3
 
#define SCSI_TRY_RESET_TARGET   4
 

Functions

void scsi_eh_finish_cmd (struct scsi_cmnd *scmd, struct list_head *done_q)
 
void scsi_eh_flush_done_q (struct list_head *done_q)
 
void scsi_report_bus_reset (struct Scsi_Host *, int)
 
void scsi_report_device_reset (struct Scsi_Host *, int, int)
 
int scsi_block_when_processing_errors (struct scsi_device *)
 
int scsi_normalize_sense (const u8 *sense_buffer, int sb_len, struct scsi_sense_hdr *sshdr)
 
int scsi_command_normalize_sense (struct scsi_cmnd *cmd, struct scsi_sense_hdr *sshdr)
 
const u8scsi_sense_desc_find (const u8 *sense_buffer, int sb_len, int desc_type)
 
int scsi_get_sense_info_fld (const u8 *sense_buffer, int sb_len, u64 *info_out)
 
void scsi_build_sense_buffer (int desc, u8 *buf, u8 key, u8 asc, u8 ascq)
 
int scsi_reset_provider (struct scsi_device *, int)
 
void scsi_eh_prep_cmnd (struct scsi_cmnd *scmd, struct scsi_eh_save *ses, unsigned char *cmnd, int cmnd_size, unsigned sense_bytes)
 
void scsi_eh_restore_cmnd (struct scsi_cmnd *scmd, struct scsi_eh_save *ses)
 

Macro Definition Documentation

#define SCSI_TRY_RESET_BUS   2

Definition at line 67 of file scsi_eh.h.

#define SCSI_TRY_RESET_DEVICE   1

Definition at line 66 of file scsi_eh.h.

#define SCSI_TRY_RESET_HOST   3

Definition at line 68 of file scsi_eh.h.

#define SCSI_TRY_RESET_TARGET   4

Definition at line 69 of file scsi_eh.h.

Function Documentation

int scsi_block_when_processing_errors ( struct scsi_device sdev)

scsi_block_when_processing_errors - Prevent cmds from being queued. : Device on which we are performing recovery.

Description: We block until the host is out of error recovery, and then check to see whether the host or the device is offline.

Return value: 0 when dev was taken offline by error recovery. 1 OK to proceed.

Definition at line 167 of file scsi_error.c.

void scsi_build_sense_buffer ( int  desc,
u8 buf,
u8  key,
u8  asc,
u8  ascq 
)

scsi_build_sense_buffer - build sense data in a buffer : Sense format (non zero == descriptor format, 0 == fixed format) : Where to build sense data : Sense key : Additional sense code : Additional sense code qualifier

Definition at line 2215 of file scsi_error.c.

int scsi_command_normalize_sense ( struct scsi_cmnd cmd,
struct scsi_sense_hdr sshdr 
)

Definition at line 2108 of file scsi_error.c.

void scsi_eh_finish_cmd ( struct scsi_cmnd scmd,
struct list_head done_q 
)

scsi_eh_finish_cmd - Handle a cmd that eh is finished with. : Original SCSI cmd that eh has finished. : Queue for processed commands.

Notes: We don't want to use the normal command completion while we are are still handling errors - it may cause other commands to be queued, and that would disturb what we are doing. Thus we really want to keep a list of pending commands for final completion, and once we are ready to leave error handling we handle completion for real.

Definition at line 882 of file scsi_error.c.

void scsi_eh_flush_done_q ( struct list_head done_q)

scsi_eh_flush_done_q - finish processed commands or retry them. : list_head of processed commands.

Definition at line 1742 of file scsi_error.c.

void scsi_eh_prep_cmnd ( struct scsi_cmnd scmd,
struct scsi_eh_save ses,
unsigned char cmnd,
int  cmnd_size,
unsigned  sense_bytes 
)

scsi_eh_prep_cmnd - Save a scsi command info as part of error recovery : SCSI command structure to hijack : structure to save restore information : CDB to send. Can be NULL if no new cmnd is needed : size in bytes of (must be <= BLK_MAX_CDB) : size of sense data to copy. or 0 (if != 0 is ignored)

This function is used to save a scsi command information before re-execution as part of the error recovery process. If is 0 the command sent must be one that does not transfer any data. If != 0 is ignored and this functions sets up a REQUEST_SENSE command and cmnd buffers to read into ->sense_buffer.

Definition at line 690 of file scsi_error.c.

void scsi_eh_restore_cmnd ( struct scsi_cmnd scmd,
struct scsi_eh_save ses 
)

scsi_eh_restore_cmnd - Restore a scsi command info as part of error recovery : SCSI command structure to restore : saved information from a coresponding call to scsi_eh_prep_cmnd

Undo any damage done by above scsi_eh_prep_cmnd().

Definition at line 758 of file scsi_error.c.

int scsi_get_sense_info_fld ( const u8 sense_buffer,
int  sb_len,
u64 info_out 
)

scsi_get_sense_info_fld - get information field from sense data (either fixed or descriptor format) : byte array of sense data : number of valid bytes in sense_buffer : pointer to 64 integer where 8 or 4 byte information field will be placed if found.

Return value: 1 if information field found, 0 if not found.

Definition at line 2165 of file scsi_error.c.

int scsi_normalize_sense ( const u8 sense_buffer,
int  sb_len,
struct scsi_sense_hdr sshdr 
)

scsi_normalize_sense - normalize main elements from either fixed or descriptor sense data format into a common format.

: byte array containing sense data returned by device : number of valid bytes in sense_buffer : pointer to instance of structure that common elements are written to.

Notes: The "main elements" from sense data are: response_code, sense_key, asc, ascq and additional_length (only for descriptor format).

Typically this function can be called after a device has responded to a SCSI command with the CHECK_CONDITION status.

Return value: 1 if valid sense data information found, else 0;

Definition at line 2063 of file scsi_error.c.

void scsi_report_bus_reset ( struct Scsi_Host ,
int   
)

Definition at line 1907 of file scsi_error.c.

void scsi_report_device_reset ( struct Scsi_Host ,
int  ,
int   
)

Definition at line 1940 of file scsi_error.c.

int scsi_reset_provider ( struct scsi_device ,
int   
)

Definition at line 1971 of file scsi_error.c.

const u8* scsi_sense_desc_find ( const u8 sense_buffer,
int  sb_len,
int  desc_type 
)

scsi_sense_desc_find - search for a given descriptor type in descriptor sense data format. : byte array of descriptor format sense data : number of valid bytes in sense_buffer : value of descriptor type to find (e.g. 0 -> information)

Notes: only valid when sense data is in descriptor format

Return value: pointer to start of (first) descriptor if found else NULL

Definition at line 2129 of file scsi_error.c.