Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
megaraid_sas_base.c File Reference
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/list.h>
#include <linux/moduleparam.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/uio.h>
#include <linux/slab.h>
#include <asm/uaccess.h>
#include <linux/fs.h>
#include <linux/compat.h>
#include <linux/blkdev.h>
#include <linux/mutex.h>
#include <linux/poll.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include "megaraid_sas_fusion.h"
#include "megaraid_sas.h"

Go to the source code of this file.

Macros

#define megasas_suspend   NULL
 
#define megasas_resume   NULL
 

Functions

 module_param_named (max_sectors, max_sectors, int, 0)
 
 MODULE_PARM_DESC (max_sectors,"Maximum number of sectors per IO command")
 
 module_param (msix_disable, int, S_IRUGO)
 
 MODULE_PARM_DESC (msix_disable,"Disable MSI-X interrupt handling. Default: 0")
 
 module_param (msix_vectors, int, S_IRUGO)
 
 MODULE_PARM_DESC (msix_vectors,"MSI-X max vector count. Default: Set by FW")
 
 module_param (throttlequeuedepth, int, S_IRUGO)
 
 MODULE_PARM_DESC (throttlequeuedepth,"Adapter queue depth when throttled due to I/O timeout. Default: 16")
 
 module_param (resetwaittime, int, S_IRUGO)
 
 MODULE_PARM_DESC (resetwaittime,"Wait time in seconds after I/O timeout ""before resetting adapter. Default: 180")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_VERSION (MEGASAS_VERSION)
 
 MODULE_AUTHOR ("[email protected]")
 
 MODULE_DESCRIPTION ("LSI MegaRAID SAS Driver")
 
int megasas_transition_to_ready (struct megasas_instance *instance, int ocr)
 
 MODULE_DEVICE_TABLE (pci, megasas_pci_table)
 
void megasas_complete_cmd (struct megasas_instance *instance, struct megasas_cmd *cmd, u8 alt_status)
 
u32 megasas_build_and_issue_cmd (struct megasas_instance *instance, struct scsi_cmnd *scmd)
 
void megasas_release_fusion (struct megasas_instance *instance)
 
int megasas_ioc_init_fusion (struct megasas_instance *instance)
 
void megasas_free_cmds_fusion (struct megasas_instance *instance)
 
u8 megasas_get_map_info (struct megasas_instance *instance)
 
int megasas_sync_map_info (struct megasas_instance *instance)
 
int wait_and_poll (struct megasas_instance *instance, struct megasas_cmd *cmd)
 
void megasas_reset_reply_desc (struct megasas_instance *instance)
 
u8 MR_ValidateMapInfo (struct MR_FW_RAID_MAP_ALL *map, struct LD_LOAD_BALANCE_INFO *lbInfo)
 
int megasas_reset_fusion (struct Scsi_Host *shost)
 
void megasas_fusion_ocr_wq (struct work_struct *work)
 
void megasas_issue_dcmd (struct megasas_instance *instance, struct megasas_cmd *cmd)
 
struct megasas_cmdmegasas_get_cmd (struct megasas_instance *instance)
 
void megasas_return_cmd (struct megasas_instance *instance, struct megasas_cmd *cmd)
 
int megasas_issue_polled (struct megasas_instance *instance, struct megasas_cmd *cmd)
 
int megasas_is_ldio (struct scsi_cmnd *cmd)
 
void megaraid_sas_kill_hba (struct megasas_instance *instance)
 
void megasas_check_and_restore_queue_depth (struct megasas_instance *instance)
 
void megasas_do_ocr (struct megasas_instance *instance)
 
void megasas_free_cmds (struct megasas_instance *instance)
 
int megasas_alloc_cmds (struct megasas_instance *instance)
 
 module_init (megasas_init)
 
 module_exit (megasas_exit)
 

Variables

int resetwaittime = MEGASAS_RESET_WAIT_TIME
 
u32 megasas_dbg_lvl
 
spinlock_t poll_aen_lock
 
struct megasas_instance_template megasas_instance_template_fusion
 

Macro Definition Documentation

#define megasas_resume   NULL

Definition at line 4521 of file megaraid_sas_base.c.

#define megasas_suspend   NULL

Definition at line 4520 of file megaraid_sas_base.c.

Function Documentation

void megaraid_sas_kill_hba ( struct megasas_instance instance)

Definition at line 1589 of file megaraid_sas_base.c.

int megasas_alloc_cmds ( struct megasas_instance instance)

megasas_alloc_cmds - Allocates the command packets : Adapter soft state

Each command that is issued to the FW, whether IO commands from the OS or internal commands like IOCTLs, are wrapped in local data structure called megasas_cmd. The frame embedded in this megasas_cmd is actually issued to the FW.

Each frame has a 32-bit field called context (tag). This context is used to get back the megasas_cmd from the frame when a frame gets completed in the ISR. Typically the address of the megasas_cmd itself would be used as the context. But we wanted to keep the differences between 32 and 64 bit systems to the mininum. We always use 32 bit integers for the context. In this driver, the 32 bit values are the indices into an array cmd_list. This array is used only to look up the megasas_cmd given the context. The free commands themselves are maintained in a linked list called cmd_pool.

Definition at line 3000 of file megaraid_sas_base.c.

u32 megasas_build_and_issue_cmd ( struct megasas_instance instance,
struct scsi_cmnd scmd 
)

Definition at line 1417 of file megaraid_sas_base.c.

void megasas_check_and_restore_queue_depth ( struct megasas_instance instance)

megasas_check_and_restore_queue_depth - Check if queue depth needs to be restored to max value : Adapter soft state

Definition at line 1608 of file megaraid_sas_base.c.

void megasas_complete_cmd ( struct megasas_instance instance,
struct megasas_cmd cmd,
u8  alt_status 
)

megasas_complete_cmd - Completes a command : Adapter soft state : Command to be completed : If non-zero, use this value as status to SCSI mid-layer instead of the value returned by the FW. This should be used if caller wants an alternate status (as in the case of aborted commands)

Definition at line 2158 of file megaraid_sas_base.c.

void megasas_do_ocr ( struct megasas_instance instance)

Definition at line 1691 of file megaraid_sas_base.c.

void megasas_free_cmds ( struct megasas_instance instance)

megasas_free_cmds - Free all the cmds in the free cmd pool : Adapter soft state

Definition at line 2964 of file megaraid_sas_base.c.

void megasas_free_cmds_fusion ( struct megasas_instance instance)

megasas_free_cmds_fusion - Free all the cmds in the free cmd pool : Adapter soft state

Definition at line 253 of file megaraid_sas_fusion.c.

void megasas_fusion_ocr_wq ( struct work_struct work)

Definition at line 2330 of file megaraid_sas_fusion.c.

struct megasas_cmd* megasas_get_cmd ( struct megasas_instance instance)
read

megasas_get_cmd - Get a command from the free pool : Adapter soft state

Returns a free command from the pool

Definition at line 190 of file megaraid_sas_base.c.

u8 megasas_get_map_info ( struct megasas_instance instance)

Definition at line 767 of file megaraid_sas_fusion.c.

int megasas_ioc_init_fusion ( struct megasas_instance instance)

megasas_ioc_init_fusion - Initializes the FW : Adapter soft state

Issues the IOC Init cmd

Definition at line 587 of file megaraid_sas_fusion.c.

int megasas_is_ldio ( struct scsi_cmnd cmd)
inline

megasas_is_ldio - Checks if the cmd is for logical drive : SCSI command

Called by megasas_queue_command to find out if the command to be queued is a logical drive command

Definition at line 1334 of file megaraid_sas_base.c.

void megasas_issue_dcmd ( struct megasas_instance instance,
struct megasas_cmd cmd 
)

Definition at line 178 of file megaraid_sas_base.c.

int megasas_issue_polled ( struct megasas_instance instance,
struct megasas_cmd cmd 
)

megasas_issue_polled - Issues a polling command : Adapter soft state : Command packet to be issued

For polling, MFI requires the cmd_status to be set to 0xFF before posting.

Definition at line 860 of file megaraid_sas_base.c.

void megasas_release_fusion ( struct megasas_instance instance)

megasas_release_fusion - Reverses the FW initialization : Adapter soft state

Definition at line 2015 of file megaraid_sas_fusion.c.

int megasas_reset_fusion ( struct Scsi_Host shost)

Definition at line 2112 of file megaraid_sas_fusion.c.

void megasas_reset_reply_desc ( struct megasas_instance instance)

Definition at line 2096 of file megaraid_sas_fusion.c.

void megasas_return_cmd ( struct megasas_instance instance,
struct megasas_cmd cmd 
)
inline

megasas_return_cmd - Return a cmd to free command pool : Adapter soft state : Command packet to be returned to free command pool

Definition at line 216 of file megaraid_sas_base.c.

int megasas_sync_map_info ( struct megasas_instance instance)

Definition at line 791 of file megaraid_sas_fusion.c.

int megasas_transition_to_ready ( struct megasas_instance instance,
int  ocr 
)

megasas_transition_to_ready - Move the FW to READY state : Adapter soft state

During the initialization, FW passes can potentially be in any one of several possible states. If the FW in operational, waiting-for-handshake states, driver must take steps to bring it to ready state. Otherwise, it has to wait for the ready state.

Definition at line 2636 of file megaraid_sas_base.c.

MODULE_AUTHOR ( "[email protected] )
MODULE_DESCRIPTION ( "LSI MegaRAID SAS Driver"  )
MODULE_DEVICE_TABLE ( pci  ,
megasas_pci_table   
)
module_exit ( megasas_exit  )
module_init ( megasas_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( msix_disable  ,
int  ,
S_IRUGO   
)
module_param ( msix_vectors  ,
int  ,
S_IRUGO   
)
module_param ( throttlequeuedepth  ,
int  ,
S_IRUGO   
)
module_param ( resetwaittime  ,
int  ,
S_IRUGO   
)
module_param_named ( max_sectors  ,
max_sectors  ,
int  ,
 
)
MODULE_PARM_DESC ( max_sectors  ,
"Maximum number of sectors per IO command  
)
MODULE_PARM_DESC ( msix_disable  ,
"Disable MSI-X interrupt handling. Default: 0"   
)
MODULE_PARM_DESC ( msix_vectors  ,
"MSI-X max vector count. Default: Set by FW  
)
MODULE_PARM_DESC ( throttlequeuedepth  ,
"Adapter queue depth when throttled due to I/O timeout. Default: 16"   
)
MODULE_PARM_DESC ( resetwaittime  ,
"Wait time in seconds after I/O timeout ""before resetting adapter. Default: 180"   
)
MODULE_VERSION ( MEGASAS_VERSION  )
u8 MR_ValidateMapInfo ( struct MR_FW_RAID_MAP_ALL map,
struct LD_LOAD_BALANCE_INFO lbInfo 
)

Definition at line 151 of file megaraid_sas_fp.c.

int wait_and_poll ( struct megasas_instance instance,
struct megasas_cmd cmd 
)

wait_and_poll - Issues a polling command : Adapter soft state : Command packet to be issued

For polling, MFI requires the cmd_status to be set to 0xFF before posting.

Definition at line 559 of file megaraid_sas_fusion.c.

Variable Documentation

u32 megasas_dbg_lvl

Definition at line 138 of file megaraid_sas_base.c.

struct megasas_instance_template megasas_instance_template_fusion

This is the end of set of functions & definitions specific to gen2 (deviceid : 0x78, 0x79) controllers

Definition at line 2338 of file megaraid_sas_fusion.c.

spinlock_t poll_aen_lock

Definition at line 142 of file megaraid_sas_base.c.

int resetwaittime = MEGASAS_RESET_WAIT_TIME

Definition at line 83 of file megaraid_sas_base.c.