Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
aic94xx_hwi.h File Reference
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <scsi/libsas.h>
#include "aic94xx.h"
#include "aic94xx_sas.h"

Go to the source code of this file.

Data Structures

struct  asd_ha_addrspace
 
struct  bios_struct
 
struct  unit_element_struct
 
struct  flash_struct
 
struct  asd_phy_desc
 
struct  asd_dma_tok
 
struct  hw_profile
 
struct  asd_ascb
 
struct  asd_seq_data
 
struct  asd_port
 
struct  asd_ha_struct
 

Macros

#define ASD_MAX_PHYS   8
 
#define ASD_PCBA_SN_SIZE   12
 
#define ASD_CRC_DIS   1
 
#define ASD_SATA_SPINUP_HOLD   2
 
#define ASD_DL_SIZE_BITS   0x8
 
#define ASD_DL_SIZE   (1<<(2+ASD_DL_SIZE_BITS))
 
#define ASD_DEF_DL_TOGGLE   0x01
 
#define ASD_BUSADDR_LO(__dma_handle)   ((u32)(__dma_handle))
 
#define ASD_BUSADDR_HI(__dma_handle)
 
#define dev_to_asd_ha(__dev)   pci_get_drvdata(to_pci_dev(__dev))
 
#define SCB_SITE_VALID(__site_no)
 
#define for_each_sequencer(__lseq_mask, __mc, __lseq)
 
#define for_each_phy(__lseq_mask, __mc, __lseq)
 
#define PHY_ENABLED(_HA, _I)   ((_HA)->hw_prof.enabled_phys & (1<<(_I)))
 

Functions

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_mask)
 
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)
 
int asd_init_post_escbs (struct asd_ha_struct *asd_ha)
 
void asd_build_control_phy (struct asd_ascb *ascb, int phy_id, u8 subfunc)
 
void asd_control_led (struct asd_ha_struct *asd_ha, int phy_id, int op)
 
void asd_turn_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)
 
void asd_ascb_timedout (unsigned long data)
 
int asd_chip_hardrst (struct asd_ha_struct *asd_ha)
 

Macro Definition Documentation

#define ASD_BUSADDR_HI (   __dma_handle)
Value:
(((sizeof(dma_addr_t))==8) \
? ((u32)((__dma_handle) >> 32)) \
: ((u32)0))

Definition at line 227 of file aic94xx_hwi.h.

#define ASD_BUSADDR_LO (   __dma_handle)    ((u32)(__dma_handle))

Definition at line 226 of file aic94xx_hwi.h.

#define ASD_CRC_DIS   1

Definition at line 88 of file aic94xx_hwi.h.

#define ASD_DEF_DL_TOGGLE   0x01

Definition at line 158 of file aic94xx_hwi.h.

#define ASD_DL_SIZE   (1<<(2+ASD_DL_SIZE_BITS))

Definition at line 157 of file aic94xx_hwi.h.

#define ASD_DL_SIZE_BITS   0x8

Definition at line 156 of file aic94xx_hwi.h.

#define ASD_MAX_PHYS   8

Definition at line 40 of file aic94xx_hwi.h.

#define ASD_PCBA_SN_SIZE   12

Definition at line 41 of file aic94xx_hwi.h.

#define ASD_SATA_SPINUP_HOLD   2

Definition at line 89 of file aic94xx_hwi.h.

#define dev_to_asd_ha (   __dev)    pci_get_drvdata(to_pci_dev(__dev))

Definition at line 231 of file aic94xx_hwi.h.

#define for_each_phy (   __lseq_mask,
  __mc,
  __lseq 
)
Value:
for ((__mc)=(__lseq_mask),(__lseq)=0;(__mc)!=0;(__lseq++),(__mc)>>=1)\
if (((__mc) & 1))

Definition at line 241 of file aic94xx_hwi.h.

#define for_each_sequencer (   __lseq_mask,
  __mc,
  __lseq 
)
Value:
for ((__mc)=(__lseq_mask),(__lseq)=0;(__mc)!=0;(__lseq++),(__mc)>>=1)\
if (((__mc) & 1))

Definition at line 238 of file aic94xx_hwi.h.

#define PHY_ENABLED (   _HA,
  _I 
)    ((_HA)->hw_prof.enabled_phys & (1<<(_I)))

Definition at line 245 of file aic94xx_hwi.h.

#define SCB_SITE_VALID (   __site_no)
Value:
(((__site_no) & 0xF0FF) != 0x00FF \
&& ((__site_no) & 0xF0FF) > 0x001F)

Definition at line 232 of file aic94xx_hwi.h.

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.

void asd_ascb_timedout ( unsigned long  data)

asd_ascb_timedout – called when a pending SCB's timer has expired : unsigned long, a pointer to the ascb in question

This is the default timeout function which does the most necessary. Upper layers can implement their own timeout function, say to free resources they have with this SCB, and then call this one at the end of their timeout function. To do this, one should initialize the ascb->timer.{function, data, expires} prior to calling the post function. The timer is started by the post function.

Definition at line 872 of file aic94xx_scb.c.

void asd_build_control_phy ( struct asd_ascb ascb,
int  phy_id,
u8  subfunc 
)

asd_build_control_phy – build a CONTROL PHY SCB : pointer to an ascb : phy id to control, integer : subfunction, what to actually to do the phy

This function builds a CONTROL PHY scb. No allocation of any kind is performed. is allocated with the list function. The caller can override the ascb->tasklet_complete to point to its own callback function. It must call asd_ascb_free() at its tasklet complete function. See the default implementation.

Definition at line 776 of file aic94xx_scb.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_init_post_escbs ( struct asd_ha_struct asd_ha)

Definition at line 613 of file aic94xx_scb.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.