Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros
mega_common.h File Reference
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/blkdev.h>
#include <linux/list.h>
#include <linux/moduleparam.h>
#include <linux/dma-mapping.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>

Go to the source code of this file.

Data Structures

struct  scb_t
 
struct  adapter_t
 
struct  mraid_pci_blk
 

Macros

#define LSI_MAX_CHANNELS   16
 
#define LSI_MAX_LOGICAL_DRIVES_64LD   (64+1)
 
#define HBA_SIGNATURE_64_BIT   0x299
 
#define PCI_CONF_AMISIG64   0xa4
 
#define MEGA_SCSI_INQ_EVPD   1
 
#define MEGA_INVALID_FIELD_IN_CDB   0x24
 
#define SCB_FREE   0x0000 /* on the free list */
 
#define SCB_ACTIVE   0x0001 /* off the free list */
 
#define SCB_PENDQ   0x0002 /* on the pending queue */
 
#define SCB_ISSUED   0x0004 /* issued - owner f/w */
 
#define SCB_ABORT   0x0008 /* Got an abort for this one */
 
#define SCB_RESET   0x0010 /* Got a reset for this one */
 
#define MRAID_DMA_NONE   0x0000 /* no data transfer for this command */
 
#define MRAID_DMA_WSG   0x0001 /* data transfer using a sg list */
 
#define MRAID_DMA_WBUF   0x0002 /* data transfer using a contiguous buffer */
 
#define VERSION_SIZE   16
 
#define SCSI_FREE_LIST_LOCK(adapter)   (&adapter->kscb_pool_lock)
 
#define USER_FREE_LIST_LOCK(adapter)   (&adapter->uscb_pool_lock)
 
#define PENDING_LIST_LOCK(adapter)   (&adapter->pend_list_lock)
 
#define COMPLETED_LIST_LOCK(adapter)   (&adapter->completed_list_lock)
 
#define SCP2HOST(scp)   (scp)->device->host
 
#define SCP2HOSTDATA(scp)   SCP2HOST(scp)->hostdata
 
#define SCP2CHANNEL(scp)   (scp)->device->channel
 
#define SCP2TARGET(scp)   (scp)->device->id
 
#define SCP2LUN(scp)   (scp)->device->lun
 
#define SCSIHOST2ADAP(host)   (((caddr_t *)(host->hostdata))[0])
 
#define SCP2ADAPTER(scp)   (adapter_t *)SCSIHOST2ADAP(SCP2HOST(scp))
 
#define MRAID_IS_LOGICAL(adp, scp)   (SCP2CHANNEL(scp) == (adp)->max_channel) ? 1 : 0
 
#define MRAID_IS_LOGICAL_SDEV(adp, sdev)   (sdev->channel == (adp)->max_channel) ? 1 : 0
 
#define MRAID_GET_DEVICE_MAP(adp, scp, p_chan, target, islogical)
 
#define LSI_DBGLVL   mraid_debug_level
 
#define ASSERT(expression)
 

Macro Definition Documentation

#define ASSERT (   expression)

Definition at line 267 of file mega_common.h.

#define COMPLETED_LIST_LOCK (   adapter)    (&adapter->completed_list_lock)

Definition at line 199 of file mega_common.h.

#define HBA_SIGNATURE_64_BIT   0x299

Definition at line 40 of file mega_common.h.

#define LSI_DBGLVL   mraid_debug_level

Definition at line 251 of file mega_common.h.

#define LSI_MAX_CHANNELS   16

Definition at line 37 of file mega_common.h.

#define LSI_MAX_LOGICAL_DRIVES_64LD   (64+1)

Definition at line 38 of file mega_common.h.

#define MEGA_INVALID_FIELD_IN_CDB   0x24

Definition at line 44 of file mega_common.h.

#define MEGA_SCSI_INQ_EVPD   1

Definition at line 43 of file mega_common.h.

#define MRAID_DMA_NONE   0x0000 /* no data transfer for this command */

Definition at line 95 of file mega_common.h.

#define MRAID_DMA_WBUF   0x0002 /* data transfer using a contiguous buffer */

Definition at line 97 of file mega_common.h.

#define MRAID_DMA_WSG   0x0001 /* data transfer using a sg list */

Definition at line 96 of file mega_common.h.

#define MRAID_GET_DEVICE_MAP (   adp,
  scp,
  p_chan,
  target,
  islogical 
)
Value:
/* \
* Is the request coming for the virtual channel \
*/ \
islogical = MRAID_IS_LOGICAL(adp, scp); \
\
/* \
* Get an index into our table of drive ids mapping \
*/ \
if (islogical) { \
p_chan = 0xFF; \
target = \
(adp)->device_ids[(adp)->max_channel][SCP2TARGET(scp)]; \
} \
else { \
p_chan = ((adp)->device_ids[SCP2CHANNEL(scp)] \
[SCP2TARGET(scp)] >> 8) & 0xFF; \
target = ((adp)->device_ids[SCP2CHANNEL(scp)] \
[SCP2TARGET(scp)] & 0xFF); \
}

MRAID_GET_DEVICE_MAP - device ids : adapter's soft state : mid-layer scsi command pointer : physical channel on the controller : target id of the device or logical drive number : set if the command is for the logical drive

Macro to retrieve information about device class, logical or physical and the corresponding physical channel and target or logical drive number

Definition at line 231 of file mega_common.h.

#define MRAID_IS_LOGICAL (   adp,
  scp 
)    (SCP2CHANNEL(scp) == (adp)->max_channel) ? 1 : 0

Definition at line 214 of file mega_common.h.

#define MRAID_IS_LOGICAL_SDEV (   adp,
  sdev 
)    (sdev->channel == (adp)->max_channel) ? 1 : 0

Definition at line 217 of file mega_common.h.

#define PCI_CONF_AMISIG64   0xa4

Definition at line 41 of file mega_common.h.

#define PENDING_LIST_LOCK (   adapter)    (&adapter->pend_list_lock)

Definition at line 198 of file mega_common.h.

#define SCB_ABORT   0x0008 /* Got an abort for this one */

Definition at line 89 of file mega_common.h.

#define SCB_ACTIVE   0x0001 /* off the free list */

Definition at line 86 of file mega_common.h.

#define SCB_FREE   0x0000 /* on the free list */

Definition at line 85 of file mega_common.h.

#define SCB_ISSUED   0x0004 /* issued - owner f/w */

Definition at line 88 of file mega_common.h.

#define SCB_PENDQ   0x0002 /* on the pending queue */

Definition at line 87 of file mega_common.h.

#define SCB_RESET   0x0010 /* Got a reset for this one */

Definition at line 90 of file mega_common.h.

#define SCP2ADAPTER (   scp)    (adapter_t *)SCSIHOST2ADAP(SCP2HOST(scp))

Definition at line 211 of file mega_common.h.

#define SCP2CHANNEL (   scp)    (scp)->device->channel

Definition at line 205 of file mega_common.h.

#define SCP2HOST (   scp)    (scp)->device->host

Definition at line 203 of file mega_common.h.

#define SCP2HOSTDATA (   scp)    SCP2HOST(scp)->hostdata

Definition at line 204 of file mega_common.h.

#define SCP2LUN (   scp)    (scp)->device->lun

Definition at line 207 of file mega_common.h.

#define SCP2TARGET (   scp)    (scp)->device->id

Definition at line 206 of file mega_common.h.

#define SCSI_FREE_LIST_LOCK (   adapter)    (&adapter->kscb_pool_lock)

Definition at line 196 of file mega_common.h.

#define SCSIHOST2ADAP (   host)    (((caddr_t *)(host->hostdata))[0])

Definition at line 210 of file mega_common.h.

#define USER_FREE_LIST_LOCK (   adapter)    (&adapter->uscb_pool_lock)

Definition at line 197 of file mega_common.h.

#define VERSION_SIZE   16

struct adapter_t - driver's initialization structure dpc_h : tasklet handle : pci configuration pointer for kernel : pointer to host structure of mid-layer : synchronization lock for mid-layer and driver : driver is quiescent for now. : number of commands pending in the driver : pointer to the bulk of SCBs pointers for IO : pool of free scbs for IO : lock for pool of free scbs : pending commands list : exclusion lock for pending commands list : list of completed commands : exclusion lock for list of completed commands : max sg elements supported : to convert kernel device addr to our devices. : raid adapter specific pointer : maximum channel number supported - inclusive : max target supported - inclusive : max lun supported - inclusive : unique identifier for each adapter : IRQ for this adapter : internal timeout value, (-1) means no timeout : buffer to issue internal commands : dma handle for the above buffer : SCB pointers for user cmds, common mgmt module : pool of SCBs for user commands : exclusion lock for these SCBs : max outstanding commands : firmware version : bios version : biggest CDB size supported. : is high availability present - clustering : initiator ID, the default value should be 7 : max sectors per request : max outstanding commands per LUN : set when unloading, no more mgmt calls

mraid_setup_device_map() can be called anytime after the device map is available and MRAID_GET_DEVICE_MAP() can be called whenever the mapping is required, usually from LLD's queue entry point. The formar API sets up the MRAID_IS_LOGICAL(adapter_t *, struct scsi_cmnd *) to find out if the device in question is a logical drive.

quiescent flag should be set by the driver if it is not accepting more commands

NOTE: The fields of this structures are placed to minimize cache misses

Definition at line 153 of file mega_common.h.