📄 aic7xxx_old.c
字号:
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_OLD_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 found after this fake one. *adapter_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 AHA-2940UW Pro Ultra SCSI host adapter", /* AIC_7887 */ "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 0xCFF#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) */#define CFRESETB 0x0040 /* reset SCSI bus at boot */#define CFBPRIMARY 0x0100 /* Channel B primary on 7895 chipsets */#define CFSEAUTOTERM 0x0400 /* aic7890 Perform SE Auto Term */#define CFLVDSTERM 0x0800 /* aic7890 LVD Termination *//* UNUSED 0xF280 */ unsigned short adapter_control; /* word 17 *//* * Bus Release, Host Adapter ID */#define CFSCSIID 0x000F /* host adapter SCSI ID *//* UNUSED 0x00F0 */#define CFBRTIME 0xFF00 /* bus release time */ unsigned short brtime_id; /* word 18 *//* * Maximum targets */#define CFMAXTARG 0x00FF /* maximum targets *//* UNUSED 0xFF00 */ unsigned short max_targets; /* word 19 */ unsigned short res_1[11]; /* words 20-30 */ unsigned short checksum; /* word 31 */};#define SELBUS_MASK 0x0a#define SELNARROW 0x00#define SELBUSB 0x08#define SINGLE_BUS 0x00#define SCB_TARGET(scb) \ (((scb)->hscb->target_channel_lun & TID) >> 4)#define SCB_LUN(scb) \ ((scb)->hscb->target_channel_lun & LID)#define SCB_IS_SCSIBUS_B(scb) \ (((scb)->hscb->target_channel_lun & SELBUSB) != 0)/* * If an error occurs during a data transfer phase, run the command * to completion - it's easier that way - making a note of the error * condition in this location. This then will modify a DID_OK status * into an appropriate error for the higher-level SCSI code. */#define aic7xxx_error(cmd) ((cmd)->SCp.Status)/* * Keep track of the targets returned status. */#define aic7xxx_status(cmd) ((cmd)->SCp.sent_command)/* * The position of the SCSI commands scb within the scb array. */#define aic7xxx_position(cmd) ((cmd)->SCp.have_data_in)/* * The stored DMA mapping for single-buffer data transfers. */#define aic7xxx_mapping(cmd) ((cmd)->SCp.phase)/* * So we can keep track of our host structs */static struct aic7xxx_host *first_aic7xxx = NULL;/* * As of Linux 2.1, the mid-level SCSI code uses virtual addresses * in the scatter-gather lists. We need to convert the virtual * addresses to physical addresses. */struct hw_scatterlist { unsigned int address; unsigned int length;};/* * Maximum number of SG segments these cards can support. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -