⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aic7xxx.c

📁 基于组件方式开发操作系统的OSKIT源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
         p->cpu_lock_count[cpuid]++; \       } else { \         p->cpu_lock_count[cpuid]++; \       }#    define DRIVER_UNLOCK \       if(--p->cpu_lock_count[cpuid] == 0) \         spin_unlock_irqrestore(&p->spin_lock, cpu_flags);#  else#    define DRIVER_LOCK_INIT#    define DRIVER_LOCK#    define DRIVER_UNLOCK#  endif#else#  define cpuid 0#  define DRIVER_LOCK_INIT#  define DRIVER_LOCK \       save_flags(cpu_flags); \       cli();#  define DRIVER_UNLOCK \       restore_flags(cpu_flags);#  define le32_to_cpu(x) (x)#  define cpu_to_le32(x) (x)#endif/* * You can try raising me if tagged queueing is enabled, or lowering * me if you only have 4 SCBs. */#ifdef CONFIG_AIC7XXX_CMDS_PER_DEVICE#define AIC7XXX_CMDS_PER_DEVICE CONFIG_AIC7XXX_CMDS_PER_DEVICE#else#define AIC7XXX_CMDS_PER_DEVICE 8#endif/* Set this to the delay in seconds after SCSI bus reset. */#ifdef CONFIG_AIC7XXX_RESET_DELAY#define AIC7XXX_RESET_DELAY CONFIG_AIC7XXX_RESET_DELAY#else#define AIC7XXX_RESET_DELAY 5#endif/* * Control collection of SCSI transfer statistics for the /proc filesystem. * * NOTE: Do NOT enable this when running on kernels version 1.2.x and below. * NOTE: This does affect performance since it has to maintain statistics. */#ifdef CONFIG_AIC7XXX_PROC_STATS#define AIC7XXX_PROC_STATS#endif/* * NOTE: Uncommenting the define below no longer has any effect, the *       tagged queue value array is always active now.  I've added *       a setup option to set this particular array and I'm hoping *       insmod will be smart enough to set it properly as well.  It's *       by use of this array that a person can enable tagged queueing. *       The DEFAULT_TAG_COMMANDS define has been changed to disable *       tagged queueing by default, so if your devices can handle tagged *       queueing you will need to add a line to their lilo.conf file like: *       append="aic7xxx=verbose,tag_info:{{32,32,32,32},{32,32,32,32}}" *       which will result in the first four devices on the first two *       controllers being set to a tagged queue depth of 32. * * Set this for defining the number of tagged commands on a device * by device, and controller by controller basis.  The first set * of tagged commands will be used for the first detected aic7xxx * controller, the second set will be used for the second detected * aic7xxx controller, and so on.  These values will *only* be used * for targets that are tagged queueing capable; these values will * be ignored in all other cases.  The tag_commands is an array of * 16 to allow for wide and twin adapters.  Twin adapters will use * indexes 0-7 for channel 0, and indexes 8-15 for channel 1. * * *** Determining commands per LUN *** *  * When AIC7XXX_CMDS_PER_DEVICE is not defined, the driver will use its * own algorithm to determine the commands/LUN.  If SCB paging is * enabled, which is always now, the default is 8 commands per lun * that indicates it supports tagged queueing.  All non-tagged devices * use an internal queue depth of 3, with no more than one of those * three commands active at one time. *//* #define AIC7XXX_TAGGED_QUEUEING_BY_DEVICE */typedef struct{  unsigned char tag_commands[16];   /* Allow for wide/twin adapters. */} adapter_tag_info_t;/* * Make a define that will tell the driver not to use tagged queueing * by default. */#ifdef CONFIG_AIC7XXX_TCQ_ON_BY_DEFAULT#define DEFAULT_TAG_COMMANDS {0, 0, 0, 0, 0, 0, 0, 0,\                              0, 0, 0, 0, 0, 0, 0, 0}#else#define DEFAULT_TAG_COMMANDS {255, 255, 255, 255, 255, 255, 255, 255,\                              255, 255, 255, 255, 255, 255, 255, 255}#endif/* * Modify this as you see fit for your system.  By setting tag_commands * to 0, the driver will use it's own algorithm for determining the * number of commands to use (see above).  When 255, the driver will * not enable tagged queueing for that particular device.  When positive * (> 0) and (< 255) the values in the array are used for the queue_depth. * Note that the maximum value for an entry is 254, but you're insane if * you try to use that many commands on one device. * * In this example, the first line will disable tagged queueing for all * the devices on the first probed aic7xxx adapter. * * The second line enables tagged queueing with 4 commands/LUN for IDs * (1, 2-11, 13-15), disables tagged queueing for ID 12, and tells the * driver to use its own algorithm for ID 1. * * The third line is the same as the first line. * * The fourth line disables tagged queueing for devices 0 and 3.  It * enables tagged queueing for the other IDs, with 16 commands/LUN * for IDs 1 and 4, 127 commands/LUN for ID 8, and 4 commands/LUN for * IDs 2, 5-7, and 9-15. *//* * NOTE: The below structure is for reference only, the actual structure *       to modify in order to change things is located around line *       number 1305adapter_tag_info_t aic7xxx_tag_info[] ={  {DEFAULT_TAG_COMMANDS},  {{4, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 255, 4, 4, 4}},  {DEFAULT_TAG_COMMANDS},  {{255, 16, 4, 255, 16, 4, 4, 4, 127, 4, 4, 4, 4, 4, 4, 4}}};*/static adapter_tag_info_t aic7xxx_tag_info[] ={  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS},  {DEFAULT_TAG_COMMANDS}};/* * Define an array of board names that can be indexed by aha_type. * Don't forget to change this when changing the types! */static const char *board_names[] = {  "AIC-7xxx Unknown",                                   /* AIC_NONE */  "Adaptec AIC-7810 Hardware RAID Controller",          /* AIC_7810 */  "Adaptec AIC-7770 SCSI host adapter",                 /* AIC_7770 */  "Adaptec AHA-274X SCSI host adapter",                 /* AIC_7771 */  "Adaptec AHA-284X SCSI host adapter",                 /* AIC_284x */  "Adaptec AIC-7850 SCSI host adapter",                 /* AIC_7850 */  "Adaptec AIC-7855 SCSI host adapter",                 /* AIC_7855 */  "Adaptec AIC-7860 Ultra SCSI host adapter",           /* AIC_7860 */  "Adaptec AHA-2940A Ultra SCSI host adapter",          /* AIC_7861 */  "Adaptec AIC-7870 SCSI host adapter",                 /* AIC_7870 */  "Adaptec AHA-294X SCSI host adapter",                 /* AIC_7871 */  "Adaptec AHA-394X SCSI host adapter",                 /* AIC_7872 */  "Adaptec AHA-398X SCSI host adapter",                 /* AIC_7873 */  "Adaptec AHA-2944 SCSI host adapter",                 /* AIC_7874 */  "Adaptec AIC-7880 Ultra SCSI host adapter",           /* AIC_7880 */  "Adaptec AHA-294X Ultra SCSI host adapter",           /* AIC_7881 */  "Adaptec AHA-394X Ultra SCSI host adapter",           /* AIC_7882 */  "Adaptec AHA-398X Ultra SCSI host adapter",           /* AIC_7883 */  "Adaptec AHA-2944 Ultra SCSI host adapter",           /* AIC_7884 */  "Adaptec AIC-7895 Ultra SCSI host adapter",           /* AIC_7895 */  "Adaptec AIC-7890/1 Ultra2 SCSI host adapter",        /* AIC_7890 */  "Adaptec AHA-293X Ultra2 SCSI host adapter",          /* AIC_7890 */  "Adaptec AHA-294X Ultra2 SCSI host adapter",          /* AIC_7890 */  "Adaptec AIC-7896/7 Ultra2 SCSI host adapter",        /* AIC_7896 */  "Adaptec AHA-394X Ultra2 SCSI host adapter",          /* AIC_7897 */  "Adaptec AHA-395X Ultra2 SCSI host adapter",          /* AIC_7897 */  "Adaptec PCMCIA SCSI controller",                     /* card bus stuff */  "Adaptec AIC-7892 Ultra 160/m SCSI host adapter",     /* AIC_7892 */  "Adaptec AIC-7899 Ultra 160/m SCSI host adapter",     /* AIC_7899 */};/* * There should be a specific return value for this in scsi.h, but * it seems that most drivers ignore it. */#define DID_UNDERFLOW   DID_ERROR/* *  What we want to do is have the higher level scsi driver requeue *  the command to us. There is no specific driver status for this *  condition, but the higher level scsi driver will requeue the *  command on a DID_BUS_BUSY error. * *  Upon further inspection and testing, it seems that DID_BUS_BUSY *  will *always* retry the command.  We can get into an infinite loop *  if this happens when we really want some sort of counter that *  will automatically abort/reset the command after so many retries. *  Using DID_ERROR will do just that.  (Made by a suggestion by *  Doug Ledford 8/1/96) */#define DID_RETRY_COMMAND DID_ERROR#define HSCSIID        0x07#define SCSI_RESET     0x040/* * EISA/VL-bus stuff */#define MINSLOT                1#define MAXSLOT                15#define SLOTBASE(x)        ((x) << 12)#define BASE_TO_SLOT(x) ((x) >> 12)/* * Standard EISA Host ID regs  (Offset from slot base) */#define AHC_HID0              0x80   /* 0,1: msb of ID2, 2-7: ID1      */#define AHC_HID1              0x81   /* 0-4: ID3, 5-7: LSB ID2         */#define AHC_HID2              0x82   /* product                        */#define AHC_HID3              0x83   /* firmware revision              *//* * AIC-7770 I/O range to reserve for a card */#define MINREG                0xC00#define MAXREG                0xCBF#define INTDEF                0x5C      /* Interrupt Definition Register *//* * AIC-78X0 PCI registers */#define        CLASS_PROGIF_REVID        0x08#define                DEVREVID        0x000000FFul#define                PROGINFC        0x0000FF00ul#define                SUBCLASS        0x00FF0000ul#define                BASECLASS        0xFF000000ul#define        CSIZE_LATTIME                0x0C#define                CACHESIZE        0x0000003Ful        /* only 5 bits */#define                LATTIME                0x0000FF00ul#define        DEVCONFIG                0x40#define                SCBSIZE32        0x00010000ul        /* aic789X only */#define                MPORTMODE        0x00000400ul        /* aic7870 only */#define                RAMPSM           0x00000200ul        /* aic7870 only */#define                RAMPSM_ULTRA2    0x00000004#define                VOLSENSE         0x00000100ul#define                SCBRAMSEL        0x00000080ul#define                SCBRAMSEL_ULTRA2 0x00000008#define                MRDCEN           0x00000040ul#define                EXTSCBTIME       0x00000020ul        /* aic7870 only */#define                EXTSCBPEN        0x00000010ul        /* aic7870 only */#define                BERREN           0x00000008ul#define                DACEN            0x00000004ul#define                STPWLEVEL        0x00000002ul#define                DIFACTNEGEN      0x00000001ul        /* aic7870 only */#define        SCAMCTL                  0x1a                /* Ultra2 only  */#define        CCSCBBADDR               0xf0                /* aic7895/6/7  *//* * Define the different types of SEEPROMs on aic7xxx adapters * and make it also represent the address size used in accessing * its registers.  The 93C46 chips have 1024 bits organized into * 64 16-bit words, while the 93C56 chips have 2048 bits organized * into 128 16-bit words.  The C46 chips use 6 bits to address * each word, while the C56 and C66 (4096 bits) use 8 bits to * address each word. */typedef enum {C46 = 6, C56_66 = 8} seeprom_chip_type;/* * * Define the format of the SEEPROM registers (16 bits). * */struct seeprom_config {/* * SCSI ID Configuration Flags */#define CFXFER                0x0007      /* synchronous transfer rate */#define CFSYNCH               0x0008      /* enable synchronous transfer */#define CFDISC                0x0010      /* enable disconnection */#define CFWIDEB               0x0020      /* wide bus device (wide card) */#define CFSYNCHISULTRA        0x0040      /* CFSYNC is an ultra offset */#define CFNEWULTRAFORMAT      0x0080      /* Use the Ultra2 SEEPROM format */#define CFSTART               0x0100      /* send start unit SCSI command */#define CFINCBIOS             0x0200      /* include in BIOS scan */#define CFRNFOUND             0x0400      /* report even if not found */#define CFMULTILUN            0x0800      /* probe mult luns in BIOS scan */#define CFWBCACHEYES          0x4000      /* Enable W-Behind Cache on drive */#define CFWBCACHENC           0xc000      /* Don't change W-Behind Cache *//* UNUSED                0x3000 */  unsigned short device_flags[16];        /* words 0-15 *//* * BIOS Control Bits */#define CFSUPREM        0x0001  /* support all removable drives */#define CFSUPREMB       0x0002  /* support removable drives for boot only */#define CFBIOSEN        0x0004  /* BIOS enabled *//* UNUSED                0x0008 */#define CFSM2DRV        0x0010  /* support more than two drives */#define CF284XEXTEND    0x0020  /* extended translation (284x cards) *//* UNUSED                0x0040 */#define CFEXTEND        0x0080  /* extended translation enabled *//* UNUSED                0xFF00 */  unsigned short bios_control;  /* word 16 *//* * Host Adapter Control Bits */#define CFAUTOTERM      0x0001  /* Perform Auto termination */#define CFULTRAEN       0x0002  /* Ultra SCSI speed enable (Ultra cards) */#define CF284XSELTO     0x0003  /* Selection timeout (284x cards) */#define CF284XFIFO      0x000C  /* FIFO Threshold (284x cards) */#define CFSTERM         0x0004  /* SCSI low byte termination */#define CFWSTERM        0x0008  /* SCSI high byte termination (wide card) */#define CFSPARITY       0x0010  /* SCSI parity */#define CF284XSTERM     0x0020  /* SCSI low byte termination (284x cards) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -