linux/drivers/scsi/advansys.c
<<
>>
Prefs
   1#define DRV_NAME "advansys"
   2#define ASC_VERSION "3.4"       /* AdvanSys Driver Version */
   3
   4/*
   5 * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters
   6 *
   7 * Copyright (c) 1995-2000 Advanced System Products, Inc.
   8 * Copyright (c) 2000-2001 ConnectCom Solutions, Inc.
   9 * Copyright (c) 2007 Matthew Wilcox <matthew@wil.cx>
  10 * All Rights Reserved.
  11 *
  12 * This program is free software; you can redistribute it and/or modify
  13 * it under the terms of the GNU General Public License as published by
  14 * the Free Software Foundation; either version 2 of the License, or
  15 * (at your option) any later version.
  16 */
  17
  18/*
  19 * As of March 8, 2000 Advanced System Products, Inc. (AdvanSys)
  20 * changed its name to ConnectCom Solutions, Inc.
  21 * On June 18, 2001 Initio Corp. acquired ConnectCom's SCSI assets
  22 */
  23
  24#include <linux/module.h>
  25#include <linux/string.h>
  26#include <linux/kernel.h>
  27#include <linux/types.h>
  28#include <linux/ioport.h>
  29#include <linux/interrupt.h>
  30#include <linux/delay.h>
  31#include <linux/slab.h>
  32#include <linux/mm.h>
  33#include <linux/proc_fs.h>
  34#include <linux/init.h>
  35#include <linux/blkdev.h>
  36#include <linux/isa.h>
  37#include <linux/eisa.h>
  38#include <linux/pci.h>
  39#include <linux/spinlock.h>
  40#include <linux/dma-mapping.h>
  41#include <linux/firmware.h>
  42
  43#include <asm/io.h>
  44#include <asm/dma.h>
  45
  46#include <scsi/scsi_cmnd.h>
  47#include <scsi/scsi_device.h>
  48#include <scsi/scsi_tcq.h>
  49#include <scsi/scsi.h>
  50#include <scsi/scsi_host.h>
  51
  52/* FIXME:
  53 *
  54 *  1. Although all of the necessary command mapping places have the
  55 *     appropriate dma_map.. APIs, the driver still processes its internal
  56 *     queue using bus_to_virt() and virt_to_bus() which are illegal under
  57 *     the API.  The entire queue processing structure will need to be
  58 *     altered to fix this.
  59 *  2. Need to add memory mapping workaround. Test the memory mapping.
  60 *     If it doesn't work revert to I/O port access. Can a test be done
  61 *     safely?
  62 *  3. Handle an interrupt not working. Keep an interrupt counter in
  63 *     the interrupt handler. In the timeout function if the interrupt
  64 *     has not occurred then print a message and run in polled mode.
  65 *  4. Need to add support for target mode commands, cf. CAM XPT.
  66 *  5. check DMA mapping functions for failure
  67 *  6. Use scsi_transport_spi
  68 *  7. advansys_info is not safe against multiple simultaneous callers
  69 *  8. Add module_param to override ISA/VLB ioport array
  70 */
  71#warning this driver is still not properly converted to the DMA API
  72
  73/* Enable driver /proc statistics. */
  74#define ADVANSYS_STATS
  75
  76/* Enable driver tracing. */
  77#undef ADVANSYS_DEBUG
  78
  79/*
  80 * Portable Data Types
  81 *
  82 * Any instance where a 32-bit long or pointer type is assumed
  83 * for precision or HW defined structures, the following define
  84 * types must be used. In Linux the char, short, and int types
  85 * are all consistent at 8, 16, and 32 bits respectively. Pointers
  86 * and long types are 64 bits on Alpha and UltraSPARC.
  87 */
  88#define ASC_PADDR __u32         /* Physical/Bus address data type. */
  89#define ASC_VADDR __u32         /* Virtual address data type. */
  90#define ASC_DCNT  __u32         /* Unsigned Data count type. */
  91#define ASC_SDCNT __s32         /* Signed Data count type. */
  92
  93typedef unsigned char uchar;
  94
  95#ifndef TRUE
  96#define TRUE     (1)
  97#endif
  98#ifndef FALSE
  99#define FALSE    (0)
 100#endif
 101
 102#define ERR      (-1)
 103#define UW_ERR   (uint)(0xFFFF)
 104#define isodd_word(val)   ((((uint)val) & (uint)0x0001) != 0)
 105
 106#define PCI_VENDOR_ID_ASP               0x10cd
 107#define PCI_DEVICE_ID_ASP_1200A         0x1100
 108#define PCI_DEVICE_ID_ASP_ABP940        0x1200
 109#define PCI_DEVICE_ID_ASP_ABP940U       0x1300
 110#define PCI_DEVICE_ID_ASP_ABP940UW      0x2300
 111#define PCI_DEVICE_ID_38C0800_REV1      0x2500
__9 
      de=FALSE" class3PCI_DEVICE_="sref">PCI_DEVICE_ID_ASP_ABP