Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
aic94xx_hwi.c File Reference
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/firmware.h>
#include "aic94xx.h"
#include "aic94xx_reg.h"
#include "aic94xx_hwi.h"
#include "aic94xx_seq.h"
#include "aic94xx_dump.h"

Go to the source code of this file.

Macros

#define MAX_DEVS   ((OCM_MAX_SIZE) / (ASD_DDB_SIZE))
 

Functions

int asd_chip_hardrst (struct asd_ha_struct *asd_ha)
 
 module_param_named (max_devs, max_devs, int, S_IRUGO)
 
 MODULE_PARM_DESC (max_devs,"\n""\tMaximum number of SAS devices to support (not LUs).\n""\tDefault: 2176, Maximum: 65663.\n")
 
 module_param_named (max_cmnds, max_cmnds, int, S_IRUGO)
 
 MODULE_PARM_DESC (max_cmnds,"\n""\tMaximum number of commands queuable.\n""\tDefault: 512, Maximum: 66047.\n")
 
int asd_init_hw (struct asd_ha_struct *asd_ha)
 
irqreturn_t asd_hw_isr (int irq, void *dev_id)
 
struct asd_ascbasd_ascb_alloc_list (struct asd_ha_struct *asd_ha, int *num, gfp_t gfp_flags)
 
int asd_post_ascb_list (struct asd_ha_struct *asd_ha, struct asd_ascb *ascb, int num)
 
int asd_post_escb_list (struct asd_ha_struct *asd_ha, struct asd_ascb *ascb, int num)
 
void asd_turn_led (struct asd_ha_struct *asd_ha, int phy_id, int op)
 
void asd_control_led (struct asd_ha_struct *asd_ha, int phy_id, int op)
 
int asd_enable_phys (struct asd_ha_struct *asd_ha, const u8 phy_mask)
 

Variables

u32 MBAR0_SWB_SIZE
 

Macro Definition Documentation

#define MAX_DEVS   ((OCM_MAX_SIZE) / (ASD_DDB_SIZE))

Definition at line 488 of file aic94xx_hwi.c.

Function Documentation

struct asd_ascb* asd_ascb_alloc_list ( struct asd_ha_struct asd_ha,
int num,
gfp_t  gfp_flags 
)
read

asd_ascb_alloc_list – allocate a list of aSCBs : pointer to host adapter structure : pointer to integer number of aSCBs : GFP_ flags.

This is the only function which is used to allocate aSCBs. It can allocate one or many. If more than one, then they form a linked list in two ways: by their list field of the ascb struct and by the next_scb field of the scb_header.

Returns NULL if no memory was available, else pointer to a list of ascbs. When this function returns, would be the number of SCBs which were not able to be allocated, 0 if all requested were able to be allocated.

Definition at line 1102 of file aic94xx_hwi.c.

int asd_chip_hardrst ( struct asd_ha_struct asd_ha)

asd_chip_hardrst – hard reset the chip : pointer to host adapter structure

This takes 16 cycles and is synchronous to CFCLK, which runs at 200 MHz, so this should take at most 80 nanoseconds.

Definition at line 427 of file aic94xx_hwi.c.

void asd_control_led ( struct asd_ha_struct asd_ha,
int  phy_id,
int  op 
)

asd_control_led – enable/disable an LED on the board : pointer to host adapter structure : integer, the phy id : integer, 1 to enable, 0 to disable the LED

First we output enable the LED, then we set the source to be an external module.

Definition at line 1301 of file aic94xx_hwi.c.

int asd_enable_phys ( struct asd_ha_struct asd_ha,
const u8  phy_mask 
)

Definition at line 1354 of file aic94xx_hwi.c.

irqreturn_t asd_hw_isr ( int  irq,
void dev_id 
)

asd_hw_isr – host adapter interrupt service routine : ignored : pointer to host adapter structure

The ISR processes done list entries and level 3 error handling.

Definition at line 1019 of file aic94xx_hwi.c.

int asd_init_hw ( struct asd_ha_struct asd_ha)

Definition at line 620 of file aic94xx_hwi.c.

int asd_post_ascb_list ( struct asd_ha_struct asd_ha,
struct asd_ascb ascb,
int  num 
)

asd_post_ascb_list – post a list of 1 or more aSCBs to the host adapter : pointer to a host adapter structure : pointer to the first aSCB in the list : number of aSCBs in the list (to be posted)

See queueing comment in asd_post_escb_list().

Additional note on queuing: In order to minimize the ratio of memcpy() to the number of ascbs sent, we try to batch-send as many ascbs as possible in one go. Two cases are possible: A) can_queue >= num, B) can_queue < num. Case A: we can send the whole batch at once. Increment "pending" in the beginning of this function, when it is checked, in order to eliminate races when this function is called by multiple processes. Case B: should never happen if the managing layer considers lldd_queue_size.

Definition at line 1206 of file aic94xx_hwi.c.

int asd_post_escb_list ( struct asd_ha_struct asd_ha,
struct asd_ascb ascb,
int  num 
)

asd_post_escb_list – post a list of 1 or more empty scb : pointer to a host adapter structure : pointer to the first empty SCB in the list : number of aSCBs in the list (to be posted)

This is essentially the same as asd_post_ascb_list, but we do not increment pending, add those to the pending list or get indexes. See asd_init_escbs() and asd_init_post_escbs().

Since sending a list of ascbs is a superset of sending a single ascb, this function exists to generalize this. More specifically, when sending a list of those, we want to do only a single memcpy() at swap head, as opposed to for each ascb sent (in the case of sending them one by one). That is, we want to minimize the ratio of memcpy() operations to the number of ascbs sent. The same logic applies to asd_post_ascb_list().

Definition at line 1258 of file aic94xx_hwi.c.

void asd_turn_led ( struct asd_ha_struct asd_ha,
int  phy_id,
int  op 
)

asd_turn_led – turn on/off an LED : pointer to host adapter structure : the PHY id whose LED we want to manupulate : 1 to turn on, 0 to turn off

Definition at line 1280 of file aic94xx_hwi.c.

module_param_named ( max_devs  ,
max_devs  ,
int  ,
S_IRUGO   
)
module_param_named ( max_cmnds  ,
max_cmnds  ,
int  ,
S_IRUGO   
)
MODULE_PARM_DESC ( max_devs  ,
"\n""\tMaximum number of SAS devices to support (not LUs).\n""\tDefault:  2176,
Maximum:65663.\n  
)
MODULE_PARM_DESC ( max_cmnds  ,
"\n""\tMaximum number of commands queuable.\n""\tDefault:  512,
Maximum:66047.\n  
)

Variable Documentation

u32 MBAR0_SWB_SIZE

Definition at line 39 of file aic94xx_hwi.c.