/*
* dc395x.c
*
* Device Driver for Tekram DC395(U/UW/F), DC315(U)
* PCI SCSI Bus Master Host Adapter
* (SCSI chip set used Tekram ASIC TRM-S1040)
*
* Authors:
* C.L. Huang <ching@tekram.com.tw>
* Erich Chen <erich@tekram.com.tw>
* (C) Copyright 1995-1999 Tekram Technology Co., Ltd.
*
* Kurt Garloff <garloff@suse.de>
* (C) 1999-2000 Kurt Garloff
*
* Oliver Neukum <oliver@neukum.name>
* Ali Akcaagac <aliakc@web.de>
* Jamie Lenehan <lenehan@twibble.org>
* (C) 2003
*
* License: GNU GPL
*
*************************************************************************
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************
*/
#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 <asm/io.h>
#include <scsi/scsi.h>
#include <scsi/scsicam.h> /* needed for scsicam_bios_param */
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include "dc395x.h"
#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"
/*---------------------------------------------------------------------------
Features
---------------------------------------------------------------------------*/
/*
* Set to disable parts of the driver
*/
/*#define DC395x_NO_DISCONNECT*/
/*#define DC395x_NO_TAGQ*/
/*#define DC395x_NO_SYNC*/
/*#define DC395x_NO_WIDE*/
/*---------------------------------------------------------------------------
Debugging
---------------------------------------------------------------------------*/
/*
* Types of debugging that can be enabled and disabled
*/
#define DBG_KG 0x0001
#define DBG_0 0x0002
#define DBG_1 0x0004
#define DBG_SG 0x0020
#define DBG_FIFO 0x0040
#define DBG_PIO 0x0080
/*
* Set set of things to output debugging for.
* Undefine to remove all debugging
*/
/*#define DEBUG_MASK (DBG_0|DBG_1|DBG_SG|DBG_FIFO|DBG_PIO)*/
/*#define DEBUG_MASK DBG_0*/
/*
* Output a kernel mesage at the specified level and append the
* driver name and a ": " to the start of the message
*/
#define dprintkl(level, format, arg...) \
printk(level DC395X_NAME ": " format , ## arg)
#ifdef DEBUG_MASK
/*
* print a debug message - this is formated with KERN_DEBUG, then the
* driver name followed by a ": " and then the message is output.
* This also checks that the specified debug level is enabled before
* outputing the message
*/
#define dprintkdbg(type, format, arg...) \
do { \
if ((type) & (DEBUG_MASK)) \
dprintkl(KERN_DEBUG , format , ## arg); \
} while (0)
/*
* Check if the specified type of debugging is enabled
*/
#define debug_enabled(type) ((DEBUG_MASK) & (type))
#else
/*
* No debugging. Do nothing
*/
#define dprintkdbg(type, format, arg...) \
do {} while (0)
#define debug_enabled(type) (0)
#endif
#ifndef PCI_VENDOR_ID_TEKRAM
#define PCI_VENDOR_ID_TEKRAM 0x1DE1 /* Vendor ID */
#endif
#ifndef PCI_DEVICE_ID_TEKRAM_TRMS1040
#define PCI_DEVICE_ID_TEKRAM_TRMS1040 0x0391 /* Device ID */
#endif
#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))
/* cmd->result */
#define RES_TARGET 0x000000FF /* Target State */
|