Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
dc395x.c File Reference
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/delay.h>
#include <linux/ctype.h>
#include <linux/blkdev.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/pci.h>
#include <linux/list.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <asm/io.h>
#include <scsi/scsi.h>
#include <scsi/scsicam.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include "dc395x.h"

Go to the source code of this file.

Data Structures

struct  SGentry
 
struct  NVRamTarget
 
struct  NvRamType
 
struct  ScsiReqBlk
 
struct  DeviceCtlBlk
 
struct  AdapterCtlBlk
 
struct  ParameterData
 

Macros

#define DC395X_NAME   "dc395x"
 
#define DC395X_BANNER   "Tekram DC395(U/UW/F), DC315(U) - ASIC TRM-S1040"
 
#define DC395X_VERSION   "v2.05, 2004/03/08"
 
#define DBG_KG   0x0001
 
#define DBG_0   0x0002
 
#define DBG_1   0x0004
 
#define DBG_SG   0x0020
 
#define DBG_FIFO   0x0040
 
#define DBG_PIO   0x0080
 
#define dprintkl(level, format, arg...)   printk(level DC395X_NAME ": " format , ## arg)
 
#define dprintkdbg(type, format, arg...)   do {} while (0)
 
#define debug_enabled(type)   (0)
 
#define PCI_VENDOR_ID_TEKRAM   0x1DE1 /* Vendor ID */
 
#define PCI_DEVICE_ID_TEKRAM_TRMS1040   0x0391 /* Device ID */
 
#define DC395x_LOCK_IO(dev, flags)   spin_lock_irqsave(((struct Scsi_Host *)dev)->host_lock, flags)
 
#define DC395x_UNLOCK_IO(dev, flags)   spin_unlock_irqrestore(((struct Scsi_Host *)dev)->host_lock, flags)
 
#define DC395x_read8(acb, address)   (u8)(inb(acb->io_port_base + (address)))
 
#define DC395x_read16(acb, address)   (u16)(inw(acb->io_port_base + (address)))
 
#define DC395x_read32(acb, address)   (u32)(inl(acb->io_port_base + (address)))
 
#define DC395x_write8(acb, address, value)   outb((value), acb->io_port_base + (address))
 
#define DC395x_write16(acb, address, value)   outw((value), acb->io_port_base + (address))
 
#define DC395x_write32(acb, address, value)   outl((value), acb->io_port_base + (address))
 
#define RES_TARGET   0x000000FF /* Target State */
 
#define RES_TARGET_LNX   STATUS_MASK /* Only official ... */
 
#define RES_ENDMSG   0x0000FF00 /* End Message */
 
#define RES_DID   0x00FF0000 /* DID_ codes */
 
#define RES_DRV   0xFF000000 /* DRIVER_ codes */
 
#define MK_RES(drv, did, msg, tgt)   ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt))
 
#define MK_RES_LNX(drv, did, msg, tgt)   ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt)<<1)
 
#define SET_RES_TARGET(who, tgt)   { who &= ~RES_TARGET; who |= (int)(tgt); }
 
#define SET_RES_TARGET_LNX(who, tgt)   { who &= ~RES_TARGET_LNX; who |= (int)(tgt) << 1; }
 
#define SET_RES_MSG(who, msg)   { who &= ~RES_ENDMSG; who |= (int)(msg) << 8; }
 
#define SET_RES_DID(who, did)   { who &= ~RES_DID; who |= (int)(did) << 16; }
 
#define SET_RES_DRV(who, drv)   { who &= ~RES_DRV; who |= (int)(drv) << 24; }
 
#define TAG_NONE   255
 
#define SEGMENTX_LEN   (sizeof(struct SGentry)*DC395x_MAX_SG_LISTENTRY)
 
#define CFG_ADAPTER_ID   0
 
#define CFG_MAX_SPEED   1
 
#define CFG_DEV_MODE   2
 
#define CFG_ADAPTER_MODE   3
 
#define CFG_TAGS   4
 
#define CFG_RESET_DELAY   5
 
#define CFG_NUM   6 /* number of configuration items */
 
#define CFG_PARAM_UNSET   -1
 
#define DC395x_ENABLE_MSGOUT
 
#define DC395x_LASTPIO   4
 
#define SPRINTF(args...)   pos += sprintf(pos, args)
 
#define YESNO(YN)
 

Functions

 module_param_named (safe, use_safe_settings, bool, 0)
 
 MODULE_PARM_DESC (safe,"Use safe and slow settings only. Default: false")
 
 module_param_named (adapter_id, cfg_data[CFG_ADAPTER_ID].value, int, 0)
 
 MODULE_PARM_DESC (adapter_id,"Adapter SCSI ID. Default 7 (0-15)")
 
 module_param_named (max_speed, cfg_data[CFG_MAX_SPEED].value, int, 0)
 
 MODULE_PARM_DESC (max_speed,"Maximum bus speed. Default 1 (0-7) Speeds: 0=20, 1=13.3, 2=10, 3=8, 4=6.7, 5=5.8, 6=5, 7=4 Mhz")
 
 module_param_named (dev_mode, cfg_data[CFG_DEV_MODE].value, int, 0)
 
 MODULE_PARM_DESC (dev_mode,"Device mode.")
 
 module_param_named (adapter_mode, cfg_data[CFG_ADAPTER_MODE].value, int, 0)
 
 MODULE_PARM_DESC (adapter_mode,"Adapter mode.")
 
 module_param_named (tags, cfg_data[CFG_TAGS].value, int, 0)
 
 MODULE_PARM_DESC (tags,"Number of tags (1<<x). Default 3 (0-5)")
 
 module_param_named (reset_delay, cfg_data[CFG_RESET_DELAY].value, int, 0)
 
 MODULE_PARM_DESC (reset_delay,"Reset delay in seconds. Default 1 (0-180)")
 
 MODULE_DEVICE_TABLE (pci, dc395x_pci_table)
 
 module_init (dc395x_module_init)
 
 module_exit (dc395x_module_exit)
 
 MODULE_AUTHOR ("C.L. Huang / Erich Chen / Kurt Garloff")
 
 MODULE_DESCRIPTION ("SCSI host adapter driver for Tekram TRM-S1040 based adapters: Tekram DC395 and DC315 series")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define CFG_ADAPTER_ID   0

Definition at line 465 of file dc395x.c.

#define CFG_ADAPTER_MODE   3

Definition at line 468 of file dc395x.c.

#define CFG_DEV_MODE   2

Definition at line 467 of file dc395x.c.

#define CFG_MAX_SPEED   1

Definition at line 466 of file dc395x.c.

#define CFG_NUM   6 /* number of configuration items */

Definition at line 472 of file dc395x.c.

#define CFG_PARAM_UNSET   -1

Definition at line 479 of file dc395x.c.

#define CFG_RESET_DELAY   5

Definition at line 470 of file dc395x.c.

#define CFG_TAGS   4

Definition at line 469 of file dc395x.c.

#define DBG_0   0x0002

Definition at line 93 of file dc395x.c.

#define DBG_1   0x0004

Definition at line 94 of file dc395x.c.

#define DBG_FIFO   0x0040

Definition at line 96 of file dc395x.c.

#define DBG_KG   0x0001

Definition at line 92 of file dc395x.c.

#define DBG_PIO   0x0080

Definition at line 97 of file dc395x.c.

#define DBG_SG   0x0020

Definition at line 95 of file dc395x.c.

#define DC395X_BANNER   "Tekram DC395(U/UW/F), DC315(U) - ASIC TRM-S1040"

Definition at line 72 of file dc395x.c.

#define DC395x_ENABLE_MSGOUT
#define DC395x_LASTPIO   4

Definition at line 2034 of file dc395x.c.

#define DC395x_LOCK_IO (   dev,
  flags 
)    spin_lock_irqsave(((struct Scsi_Host *)dev)->host_lock, flags)

Definition at line 153 of file dc395x.c.

#define DC395X_NAME   "dc395x"

Definition at line 71 of file dc395x.c.

#define DC395x_read16 (   acb,
  address 
)    (u16)(inw(acb->io_port_base + (address)))

Definition at line 157 of file dc395x.c.

#define DC395x_read32 (   acb,
  address 
)    (u32)(inl(acb->io_port_base + (address)))

Definition at line 158 of file dc395x.c.

#define DC395x_read8 (   acb,
  address 
)    (u8)(inb(acb->io_port_base + (address)))

Definition at line 156 of file dc395x.c.

#define DC395x_UNLOCK_IO (   dev,
  flags 
)    spin_unlock_irqrestore(((struct Scsi_Host *)dev)->host_lock, flags)

Definition at line 154 of file dc395x.c.

#define DC395X_VERSION   "v2.05, 2004/03/08"

Definition at line 73 of file dc395x.c.

#define DC395x_write16 (   acb,
  address,
  value 
)    outw((value), acb->io_port_base + (address))

Definition at line 160 of file dc395x.c.

#define DC395x_write32 (   acb,
  address,
  value 
)    outl((value), acb->io_port_base + (address))

Definition at line 161 of file dc395x.c.

#define DC395x_write8 (   acb,
  address,
  value 
)    outb((value), acb->io_port_base + (address))

Definition at line 159 of file dc395x.c.

#define debug_enabled (   type)    (0)

Definition at line 140 of file dc395x.c.

#define dprintkdbg (   type,
  format,
  arg... 
)    do {} while (0)

Definition at line 138 of file dc395x.c.

#define dprintkl (   level,
  format,
  arg... 
)    printk(level DC395X_NAME ": " format , ## arg)

Definition at line 112 of file dc395x.c.

#define MK_RES (   drv,
  did,
  msg,
  tgt 
)    ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt))

Definition at line 170 of file dc395x.c.

#define MK_RES_LNX (   drv,
  did,
  msg,
  tgt 
)    ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt)<<1)

Definition at line 171 of file dc395x.c.

#define PCI_DEVICE_ID_TEKRAM_TRMS1040   0x0391 /* Device ID */

Definition at line 149 of file dc395x.c.

#define PCI_VENDOR_ID_TEKRAM   0x1DE1 /* Vendor ID */

Definition at line 146 of file dc395x.c.

#define RES_DID   0x00FF0000 /* DID_ codes */

Definition at line 167 of file dc395x.c.

#define RES_DRV   0xFF000000 /* DRIVER_ codes */

Definition at line 168 of file dc395x.c.

#define RES_ENDMSG   0x0000FF00 /* End Message */

Definition at line 166 of file dc395x.c.

#define RES_TARGET   0x000000FF /* Target State */

Definition at line 164 of file dc395x.c.

#define RES_TARGET_LNX   STATUS_MASK /* Only official ... */

Definition at line 165 of file dc395x.c.

#define SEGMENTX_LEN   (sizeof(struct SGentry)*DC395x_MAX_SG_LISTENTRY)

Definition at line 186 of file dc395x.c.

#define SET_RES_DID (   who,
  did 
)    { who &= ~RES_DID; who |= (int)(did) << 16; }

Definition at line 176 of file dc395x.c.

#define SET_RES_DRV (   who,
  drv 
)    { who &= ~RES_DRV; who |= (int)(drv) << 24; }

Definition at line 177 of file dc395x.c.

#define SET_RES_MSG (   who,
  msg 
)    { who &= ~RES_ENDMSG; who |= (int)(msg) << 8; }

Definition at line 175 of file dc395x.c.

#define SET_RES_TARGET (   who,
  tgt 
)    { who &= ~RES_TARGET; who |= (int)(tgt); }

Definition at line 173 of file dc395x.c.

#define SET_RES_TARGET_LNX (   who,
  tgt 
)    { who &= ~RES_TARGET_LNX; who |= (int)(tgt) << 1; }

Definition at line 174 of file dc395x.c.

#define SPRINTF (   args...)    pos += sprintf(pos, args)

Definition at line 4619 of file dc395x.c.

#define TAG_NONE   255

Definition at line 179 of file dc395x.c.

#define YESNO (   YN)
Value:
if (YN) SPRINTF(" Yes ");\
else SPRINTF(" No ")

Definition at line 4622 of file dc395x.c.

Function Documentation

MODULE_AUTHOR ( "C.L. Huang / Erich Chen / Kurt Garloff"  )
MODULE_DESCRIPTION ( "SCSI host adapter driver for Tekram TRM-S1040 based adapters: Tekram DC395 and DC315 series"  )
MODULE_DEVICE_TABLE ( pci  ,
dc395x_pci_table   
)
module_exit ( dc395x_module_exit  )
module_init ( dc395x_module_init  )
MODULE_LICENSE ( "GPL"  )
module_param_named ( safe  ,
use_safe_settings  ,
bool  ,
 
)
module_param_named ( adapter_id  ,
cfg_data.  value[CFG_ADAPTER_ID],
int  ,
 
)
module_param_named ( max_speed  ,
cfg_data.  value[CFG_MAX_SPEED],
int  ,
 
)
module_param_named ( dev_mode  ,
cfg_data.  value[CFG_DEV_MODE],
int  ,
 
)
module_param_named ( adapter_mode  ,
cfg_data.  value[CFG_ADAPTER_MODE],
int  ,
 
)
module_param_named ( tags  ,
cfg_data.  value[CFG_TAGS],
int  ,
 
)
module_param_named ( reset_delay  ,
cfg_data.  value[CFG_RESET_DELAY],
int  ,
 
)
MODULE_PARM_DESC ( safe  ,
"Use safe and slow settings only. Default: false  
)
MODULE_PARM_DESC ( adapter_id  ,
"Adapter SCSI ID. Default 7 (0-15)"   
)
MODULE_PARM_DESC ( max_speed  ,
"Maximum bus speed. Default 1 (0-7) Speeds:  0 = 20,
= 13.3,
= 10,
= 8,
= 6.7,
= 5.8,
= 5 
)
MODULE_PARM_DESC ( dev_mode  ,
"Device mode."   
)
MODULE_PARM_DESC ( adapter_mode  ,
"Adapter mode."   
)
MODULE_PARM_DESC ( tags  ,
"Number of tags (1<<x). Default 3 (0-5)"   
)
MODULE_PARM_DESC ( reset_delay  ,
"Reset delay in seconds. Default 1 (0-180)"   
)