📄 aic7xxx_old.c
字号:
volatile scb_queue_type delayed_scbs[MAX_TARGETS]; unsigned char msg_buf[13]; /* The message for the target */ unsigned char msg_type;#define MSG_TYPE_NONE 0x00#define MSG_TYPE_INITIATOR_MSGOUT 0x01#define MSG_TYPE_INITIATOR_MSGIN 0x02 unsigned char msg_len; /* Length of message */ unsigned char msg_index; /* Index into msg_buf array */ transinfo_type transinfo[MAX_TARGETS]; /* * We put the less frequently used host structure items after the more * frequently used items to try and ease the burden on the cache subsystem. * These entries are not *commonly* accessed, whereas the preceding entries * are accessed very often. */ unsigned int irq; /* IRQ for this adapter */ int instance; /* aic7xxx instance number */ int scsi_id; /* host adapter SCSI ID */ int scsi_id_b; /* channel B for twin adapters */ unsigned int bios_address; int board_name_index; unsigned short needppr_copy; /* default config */ unsigned short needsdtr_copy; /* default config */ unsigned short needwdtr_copy; /* default config */ unsigned short ultraenb; /* Ultra mode target list */ unsigned short bios_control; /* bios control - SEEPROM */ unsigned short adapter_control; /* adapter control - SEEPROM */ struct pci_dev *pdev; unsigned char pci_bus; unsigned char pci_device_fn; struct seeprom_config sc; unsigned short sc_type; unsigned short sc_size; struct aic7xxx_host *next; /* allow for multiple IRQs */ struct Scsi_Host *host; /* pointer to scsi host */ int host_no; /* SCSI host number */ unsigned long mbase; /* I/O memory address */ ahc_chip chip; /* chip type */ ahc_bugs bugs; dma_addr_t fifo_dma; /* DMA handle for fifo arrays */ /* * Statistics Kept: * * Total Xfers (count for each command that has a data xfer), * broken down further by reads && writes. * * Binned sizes, writes && reads: * < 512, 512, 1-2K, 2-4K, 4-8K, 8-16K, 16-32K, 32-64K, 64K-128K, > 128K * * Total amounts read/written above 512 bytes (amts under ignored) * * NOTE: Enabling this feature is likely to cause a noticeable performance * decrease as the accesses into the stats structures blows apart multiple * cache lines and is CPU time consuming. * * NOTE: Since it doesn't really buy us much, but consumes *tons* of RAM * and blows apart all sorts of cache lines, I modified this so that we * no longer look at the LUN. All LUNs now go into the same bin on each * device for stats purposes. */ struct aic7xxx_xferstats { long w_total; /* total writes */ long r_total; /* total reads */#ifdef AIC7XXX_PROC_STATS long w_bins[8]; /* binned write */ long r_bins[8]; /* binned reads */#endif /* AIC7XXX_PROC_STATS */ } stats[MAX_TARGETS]; /* [(channel << 3)|target] */#if 0 struct target_cmd *targetcmds; unsigned int num_targetcmds;#endif};/* * Valid SCSIRATE values. (p. 3-17) * Provides a mapping of transfer periods in ns/4 to the proper value to * stick in the SCSIRATE reg to use that transfer rate. */#define AHC_SYNCRATE_ULTRA3 0#define AHC_SYNCRATE_ULTRA2 1#define AHC_SYNCRATE_ULTRA 3#define AHC_SYNCRATE_FAST 6#define AHC_SYNCRATE_CRC 0x40#define AHC_SYNCRATE_SE 0x10static struct aic7xxx_syncrate { /* Rates in Ultra mode have bit 8 of sxfr set */#define ULTRA_SXFR 0x100 int sxfr_ultra2; int sxfr; unsigned char period; const char *rate[2];} aic7xxx_syncrates[] = { { 0x42, 0x000, 9, {"80.0", "160.0"} }, { 0x13, 0x000, 10, {"40.0", "80.0"} }, { 0x14, 0x000, 11, {"33.0", "66.6"} }, { 0x15, 0x100, 12, {"20.0", "40.0"} }, { 0x16, 0x110, 15, {"16.0", "32.0"} }, { 0x17, 0x120, 18, {"13.4", "26.8"} }, { 0x18, 0x000, 25, {"10.0", "20.0"} }, { 0x19, 0x010, 31, {"8.0", "16.0"} }, { 0x1a, 0x020, 37, {"6.67", "13.3"} }, { 0x1b, 0x030, 43, {"5.7", "11.4"} }, { 0x10, 0x040, 50, {"5.0", "10.0"} }, { 0x00, 0x050, 56, {"4.4", "8.8" } }, { 0x00, 0x060, 62, {"4.0", "8.0" } }, { 0x00, 0x070, 68, {"3.6", "7.2" } }, { 0x00, 0x000, 0, {NULL, NULL} },};#define CTL_OF_SCB(scb) (((scb->hscb)->target_channel_lun >> 3) & 0x1), \ (((scb->hscb)->target_channel_lun >> 4) & 0xf), \ ((scb->hscb)->target_channel_lun & 0x07)#define CTL_OF_CMD(cmd) ((cmd->channel) & 0x01), \ ((cmd->target) & 0x0f), \ ((cmd->lun) & 0x07)#define TARGET_INDEX(cmd) ((cmd)->target | ((cmd)->channel << 3))/* * A nice little define to make doing our printks a little easier */#define WARN_LEAD KERN_WARNING "(scsi%d:%d:%d:%d) "#define INFO_LEAD KERN_INFO "(scsi%d:%d:%d:%d) "/* * XXX - these options apply unilaterally to _all_ 274x/284x/294x * cards in the system. This should be fixed. Exceptions to this * rule are noted in the comments. *//* * Skip the scsi bus reset. Non 0 make us skip the reset at startup. This * has no effect on any later resets that might occur due to things like * SCSI bus timeouts. */static unsigned int aic7xxx_no_reset = 0;/* * Certain PCI motherboards will scan PCI devices from highest to lowest, * others scan from lowest to highest, and they tend to do all kinds of * strange things when they come into contact with PCI bridge chips. The * net result of all this is that the PCI card that is actually used to boot * the machine is very hard to detect. Most motherboards go from lowest * PCI slot number to highest, and the first SCSI controller found is the * one you boot from. The only exceptions to this are when a controller * has its BIOS disabled. So, we by default sort all of our SCSI controllers * from lowest PCI slot number to highest PCI slot number. We also force * all controllers with their BIOS disabled to the end of the list. This * works on *almost* all computers. Where it doesn't work, we have this * option. Setting this option to non-0 will reverse the order of the sort * to highest first, then lowest, but will still leave cards with their BIOS * disabled at the very end. That should fix everyone up unless there are * really strange cirumstances. */static int aic7xxx_reverse_scan = 0;/* * Should we force EXTENDED translation on a controller. * 0 == Use whatever is in the SEEPROM or default to off * 1 == Use whatever is in the SEEPROM or default to on */static unsigned int aic7xxx_extended = 0;/* * The IRQ trigger method used on EISA controllers. Does not effect PCI cards. * -1 = Use detected settings. * 0 = Force Edge triggered mode. * 1 = Force Level triggered mode. */static int aic7xxx_irq_trigger = -1;/* * This variable is used to override the termination settings on a controller. * This should not be used under normal conditions. However, in the case * that a controller does not have a readable SEEPROM (so that we can't * read the SEEPROM settings directly) and that a controller has a buggered * version of the cable detection logic, this can be used to force the * correct termination. It is preferable to use the manual termination * settings in the BIOS if possible, but some motherboard controllers store * those settings in a format we can't read. In other cases, auto term * should also work, but the chipset was put together with no auto term * logic (common on motherboard controllers). In those cases, we have * 32 bits here to work with. That's good for 8 controllers/channels. The * bits are organized as 4 bits per channel, with scsi0 getting the lowest * 4 bits in the int. A 1 in a bit position indicates the termination setting * that corresponds to that bit should be enabled, a 0 is disabled. * It looks something like this: * * 0x0f = 1111-Single Ended Low Byte Termination on/off * ||\-Single Ended High Byte Termination on/off * |\-LVD Low Byte Termination on/off * \-LVD High Byte Termination on/off * * For non-Ultra2 controllers, the upper 2 bits are not important. So, to * enable both high byte and low byte termination on scsi0, I would need to * make sure that the override_term variable was set to 0x03 (bits 0011). * To make sure that all termination is enabled on an Ultra2 controller at * scsi2 and only high byte termination on scsi1 and high and low byte * termination on scsi0, I would set override_term=0xf23 (bits 1111 0010 0011) * * For the most part, users should never have to use this, that's why I * left it fairly cryptic instead of easy to understand. If you need it, * most likely someone will be telling you what your's needs to be set to. */static int aic7xxx_override_term = -1;/* * Certain motherboard chipset controllers tend to screw * up the polarity of the term enable output pin. Use this variable * to force the correct polarity for your system. This is a bitfield variable * similar to the previous one, but this one has one bit per channel instead * of four. * 0 = Force the setting to active low. * 1 = Force setting to active high. * Most Adaptec cards are active high, several motherboards are active low. * To force a 2940 card at SCSI 0 to active high and a motherboard 7895 * controller at scsi1 and scsi2 to active low, and a 2910 card at scsi3 * to active high, you would need to set stpwlev=0x9 (bits 1001). * * People shouldn't need to use this, but if you are experiencing lots of * SCSI timeout problems, this may help. There is one sure way to test what * this option needs to be. Using a boot floppy to boot the system, configure * your system to enable all SCSI termination (in the Adaptec SCSI BIOS) and * if needed then also pass a value to override_term to make sure that the * driver is enabling SCSI termination, then set this variable to either 0 * or 1. When the driver boots, make sure there are *NO* SCSI cables * connected to your controller. If it finds and inits the controller * without problem, then the setting you passed to stpwlev was correct. If * the driver goes into a reset loop and hangs the system, then you need the * other setting for this variable. If neither setting lets the machine * boot then you have definite termination problems that may not be fixable. */static int aic7xxx_stpwlev = -1;/* * Set this to non-0 in order to force the driver to panic the kernel * and print out debugging info on a SCSI abort or reset cycle. */static int aic7xxx_panic_on_abort = 0;/* * PCI bus parity checking of the Adaptec controllers. This is somewhat * dubious at best. To my knowledge, this option has never actually * solved a PCI parity problem, but on certain machines with broken PCI * chipset configurations, it can generate tons of false error messages. * It's included in the driver for completeness. * 0 = Shut off PCI parity check * -1 = Normal polarity pci parity checking * 1 = reverse polarity pci parity checking * * NOTE: you can't actually pass -1 on the lilo prompt. So, to set this * variable to -1 you would actually want to simply pass the variable * name without a number. That will invert the 0 which will result in * -1. */static int aic7xxx_pci_parity = 0;/* * Set this to any non-0 value to cause us to dump the contents of all * the card's registers in a hex dump format tailored to each model of * controller. * * NOTE: THE CONTROLLER IS LEFT IN AN UNUSEABLE STATE BY THIS OPTION. * YOU CANNOT BOOT UP WITH THIS OPTION, IT IS FOR DEBUGGING PURPOSES * ONLY */static int aic7xxx_dump_card = 0;/* * Set this to a non-0 value to make us dump out the 32 bit instruction * registers on the card after completing the sequencer download. This * allows the actual sequencer download to be verified. It is possible * to use this option and still boot up and run your system. This is * only intended for debugging purposes. */static int aic7xxx_dump_sequencer = 0;/* * Certain newer motherboards have put new PCI based devices into the * IO spaces that used to typically be occupied by VLB or EISA cards. * This overlap can cause these newer motherboards to lock up when scanned * for older EISA and VLB devices. Setting this option to non-0 will * cause the driver to skip scanning for any VLB or EISA controllers and * only support the PCI controllers. NOTE: this means that if the kernel * os compiled with PCI support disabled, then setting this to non-0 * would result in never finding any devices :) */static int aic7xxx_no_probe = 0;/* * On some machines, enabling the external SCB RAM isn't reliable yet. I * haven't had time to make test patches for things like changing the * timing mode on that external RAM either. Some of those changes may * fix the problem. Until then though, we default to external SCB RAM * off and give a command line option to enable it. */static int aic7xxx_scbram = 0;/* * So that we can set how long each device is given as a selection timeout. * The table of values goes like this: * 0 - 256ms * 1 - 128ms * 2 - 64ms * 3 - 32ms * We default to 64ms because it's fast. Some old SCSI-I devices need a * longer time. The final value has to be left shifted by 3, hence 0x10 * is the final value. */static int aic7xxx_seltime = 0x10;/* * So that insmod can find the variable and make it point to something */#ifdef MODULEstatic char * aic7xxx = NULL;MODULE_PARM(aic7xxx, "s");/* * Just in case someone uses commas to separate items on the insmod * command line, we define a dummy buffer here to avoid having insmod * write wild stuff into our code segment */static char dummy_buffer[60] = "Please don't trounce on me insmod!!\n";#endif#define VERBOSE_NORMAL 0x0000#define VERBOSE_NEGOTIATION 0x0001#define VERBOSE_SEQINT 0x0002#define VERBOSE_SCSIINT 0x0004#define VERBOSE_PROBE 0x0008#define VERBOSE_PROBE2 0x0010#define VERBOSE_NEGOTIATION2 0x0020
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -