📄 advansys.c
字号:
#define ASC_VERSION "3.3G" /* AdvanSys Driver Version *//* * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters * * Copyright (c) 1995-2000 Advanced System Products, Inc. * Copyright (c) 2000-2001 ConnectCom Solutions, Inc. * All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that redistributions of source * code retain the above copyright notice and this comment without * modification. * * As of March 8, 2000 Advanced System Products, Inc. (AdvanSys) * changed its name to ConnectCom Solutions, Inc. * * There is an AdvanSys Linux WWW page at: * http://www.connectcom.net/downloads/software/os/linux.html * http://www.advansys.com/linux.html * * The latest released version of the AdvanSys driver is available at: * ftp://ftp.advansys.com/pub/linux/linux.tgz * ftp://ftp.connectcom.net/pub/linux/linux.tgz * * Please send questions, comments, bug reports to: * support@connectcom.net *//* Documentation for the AdvanSys Driver A. Linux Kernels Supported by this Driver B. Adapters Supported by this Driver C. Linux source files modified by AdvanSys Driver D. Source Comments E. Driver Compile Time Options and Debugging F. Driver LILO Option G. Tests to run before releasing new driver H. Release History I. Known Problems/Fix List J. Credits (Chronological Order) K. ConnectCom (AdvanSys) Contact Information A. Linux Kernels Supported by this Driver This driver has been tested in the following Linux kernels: v2.2.18 v2.4.0. The driver is supported on v2.2 and v2.4 kernels and on x86, alpha, and PowerPC platforms. B. Adapters Supported by this Driver AdvanSys (Advanced System Products, Inc.) manufactures the following RISC-based, Bus-Mastering, Fast (10 Mhz) and Ultra (20 Mhz) Narrow (8-bit transfer) SCSI Host Adapters for the ISA, EISA, VL, and PCI buses and RISC-based, Bus-Mastering, Ultra (20 Mhz) Wide (16-bit transfer) SCSI Host Adapters for the PCI bus. The CDB counts below indicate the number of SCSI CDB (Command Descriptor Block) requests that can be stored in the RISC chip cache and board LRAM. A CDB is a single SCSI command. The driver detect routine will display the number of CDBs available for each adapter detected. The number of CDBs used by the driver can be lowered in the BIOS by changing the 'Host Queue Size' adapter setting. Laptop Products: ABP-480 - Bus-Master CardBus (16 CDB) (2.4 kernel and greater) Connectivity Products: ABP510/5150 - Bus-Master ISA (240 CDB) ABP5140 - Bus-Master ISA PnP (16 CDB) ABP5142 - Bus-Master ISA PnP with floppy (16 CDB) ABP902/3902 - Bus-Master PCI (16 CDB) ABP3905 - Bus-Master PCI (16 CDB) ABP915 - Bus-Master PCI (16 CDB) ABP920 - Bus-Master PCI (16 CDB) ABP3922 - Bus-Master PCI (16 CDB) ABP3925 - Bus-Master PCI (16 CDB) ABP930 - Bus-Master PCI (16 CDB) ABP930U - Bus-Master PCI Ultra (16 CDB) ABP930UA - Bus-Master PCI Ultra (16 CDB) ABP960 - Bus-Master PCI MAC/PC (16 CDB) ABP960U - Bus-Master PCI MAC/PC Ultra (16 CDB) Single Channel Products: ABP542 - Bus-Master ISA with floppy (240 CDB) ABP742 - Bus-Master EISA (240 CDB) ABP842 - Bus-Master VL (240 CDB) ABP940 - Bus-Master PCI (240 CDB) ABP940U - Bus-Master PCI Ultra (240 CDB) ABP940UA/3940UA - Bus-Master PCI Ultra (240 CDB) ABP970 - Bus-Master PCI MAC/PC (240 CDB) ABP970U - Bus-Master PCI MAC/PC Ultra (240 CDB) ABP3960UA - Bus-Master PCI MAC/PC Ultra (240 CDB) ABP940UW/3940UW - Bus-Master PCI Ultra-Wide (253 CDB) ABP970UW - Bus-Master PCI MAC/PC Ultra-Wide (253 CDB) ABP3940U2W - Bus-Master PCI LVD/Ultra2-Wide (253 CDB) Multi-Channel Products: ABP752 - Dual Channel Bus-Master EISA (240 CDB Per Channel) ABP852 - Dual Channel Bus-Master VL (240 CDB Per Channel) ABP950 - Dual Channel Bus-Master PCI (240 CDB Per Channel) ABP950UW - Dual Channel Bus-Master PCI Ultra-Wide (253 CDB Per Channel) ABP980 - Four Channel Bus-Master PCI (240 CDB Per Channel) ABP980U - Four Channel Bus-Master PCI Ultra (240 CDB Per Channel) ABP980UA/3980UA - Four Channel Bus-Master PCI Ultra (16 CDB Per Chan.) ABP3950U2W - Bus-Master PCI LVD/Ultra2-Wide and Ultra-Wide (253 CDB) ABP3950U3W - Bus-Master PCI Dual LVD2/Ultra3-Wide (253 CDB) C. Linux source files modified by AdvanSys Driver This section for historical purposes documents the changes originally made to the Linux kernel source to add the advansys driver. As Linux has changed some of these files have also been modified. 1. linux/arch/i386/config.in: bool 'AdvanSys SCSI support' CONFIG_SCSI_ADVANSYS y 2. linux/drivers/scsi/hosts.c: #ifdef CONFIG_SCSI_ADVANSYS #include "advansys.h" #endif and after "static Scsi_Host_Template builtin_scsi_hosts[] =": #ifdef CONFIG_SCSI_ADVANSYS ADVANSYS, #endif 3. linux/drivers/scsi/Makefile: ifdef CONFIG_SCSI_ADVANSYS SCSI_SRCS := $(SCSI_SRCS) advansys.c SCSI_OBJS := $(SCSI_OBJS) advansys.o else SCSI_MODULE_OBJS := $(SCSI_MODULE_OBJS) advansys.o endif 4. linux/init/main.c: extern void advansys_setup(char *str, int *ints); and add the following lines to the bootsetups[] array. #ifdef CONFIG_SCSI_ADVANSYS { "advansys=", advansys_setup }, #endif D. Source Comments 1. Use tab stops set to 4 for the source files. For vi use 'se tabstops=4'. 2. This driver should be maintained in multiple files. But to make it easier to include with Linux and to follow Linux conventions, the whole driver is maintained in the source files advansys.h and advansys.c. In this file logical sections of the driver begin with a comment that contains '---'. The following are the logical sections of the driver below. --- Linux Version --- Linux Include File --- Driver Options --- Debugging Header --- Asc Library Constants and Macros --- Adv Library Constants and Macros --- Driver Constants and Macros --- Driver Structures --- Driver Data --- Driver Function Prototypes --- Linux 'Scsi_Host_Template' and advansys_setup() Functions --- Loadable Driver Support --- Miscellaneous Driver Functions --- Functions Required by the Asc Library --- Functions Required by the Adv Library --- Tracing and Debugging Functions --- Asc Library Functions --- Adv Library Functions 3. The string 'XXX' is used to flag code that needs to be re-written or that contains a problem that needs to be addressed. 4. I have stripped comments from and reformatted the source for the Asc Library and Adv Library to reduce the size of this file. This source can be found under the following headings. The Asc Library is used to support Narrow Boards. The Adv Library is used to support Wide Boards. --- Asc Library Constants and Macros --- Adv Library Constants and Macros --- Asc Library Functions --- Adv Library Functions E. Driver Compile Time Options and Debugging In this source file the following constants can be defined. They are defined in the source below. Both of these options are enabled by default. 1. ADVANSYS_ASSERT - Enable driver assertions (Def: Enabled) Enabling this option adds assertion logic statements to the driver. If an assertion fails a message will be displayed to the console, but the system will continue to operate. Any assertions encountered should be reported to the person responsible for the driver. Assertion statements may proactively detect problems with the driver and facilitate fixing these problems. Enabling assertions will add a small overhead to the execution of the driver. 2. ADVANSYS_DEBUG - Enable driver debugging (Def: Disabled) Enabling this option adds tracing functions to the driver and the ability to set a driver tracing level at boot time. This option will also export symbols not required outside the driver to the kernel name space. This option is very useful for debugging the driver, but it will add to the size of the driver execution image and add overhead to the execution of the driver. The amount of debugging output can be controlled with the global variable 'asc_dbglvl'. The higher the number the more output. By default the debug level is 0. If the driver is loaded at boot time and the LILO Driver Option is included in the system, the debug level can be changed by specifying a 5th (ASC_NUM_IOPORT_PROBE + 1) I/O Port. The first three hex digits of the pseudo I/O Port must be set to 'deb' and the fourth hex digit specifies the debug level: 0 - F. The following command line will look for an adapter at 0x330 and set the debug level to 2. linux advansys=0x330,0,0,0,0xdeb2 If the driver is built as a loadable module this variable can be defined when the driver is loaded. The following insmod command will set the debug level to one. insmod advansys.o asc_dbglvl=1 Debugging Message Levels: 0: Errors Only 1: High-Level Tracing 2-N: Verbose Tracing To enable debug output to console, please make sure that: a. System and kernel logging is enabled (syslogd, klogd running). b. Kernel messages are routed to console output. Check /etc/syslog.conf for an entry similar to this: kern.* /dev/console c. klogd is started with the appropriate -c parameter (e.g. klogd -c 8) This will cause printk() messages to be be displayed on the current console. Refer to the klogd(8) and syslogd(8) man pages for details. Alternatively you can enable printk() to console with this program. However, this is not the 'official' way to do this. Debug output is logged in /var/log/messages. main() { syscall(103, 7, 0, 0); } Increasing LOG_BUF_LEN in kernel/printk.c to something like 40960 allows more debug messages to be buffered in the kernel and written to the console or log file. 3. ADVANSYS_STATS - Enable statistics (Def: Enabled >= v1.3.0) Enabling this option adds statistics collection and display through /proc to the driver. The information is useful for monitoring driver and device performance. It will add to the size of the driver execution image and add minor overhead to the execution of the driver. Statistics are maintained on a per adapter basis. Driver entry point call counts and transfer size counts are maintained. Statistics are only available for kernels greater than or equal to v1.3.0 with the CONFIG_PROC_FS (/proc) file system configured. AdvanSys SCSI adapter files have the following path name format: /proc/scsi/advansys/[0-(ASC_NUM_BOARD_SUPPORTED-1)] This information can be displayed with cat. For example: cat /proc/scsi/advansys/0 When ADVANSYS_STATS is not defined the AdvanSys /proc files only contain adapter and device configuration information. F. Driver LILO Option If init/main.c is modified as described in the 'Directions for Adding the AdvanSys Driver to Linux' section (B.4.) above, the driver will recognize the 'advansys' LILO command line and /etc/lilo.conf option. This option can be used to either disable I/O port scanning or to limit scanning to 1 - 4 I/O ports. Regardless of the option setting EISA and PCI boards will still be searched for and detected. This option only affects searching for ISA and VL boards. Examples: 1. Eliminate I/O port scanning: boot: linux advansys= or boot: linux advansys=0x0 2. Limit I/O port scanning to one I/O port: boot: linux advansys=0x110 3. Limit I/O port scanning to four I/O ports: boot: linux advansys=0x110,0x210,0x230,0x330 For a loadable module the same effect can be achieved by setting the 'asc_iopflag' variable and 'asc_ioport' array when loading the driver, e.g. insmod advansys.o asc_iopflag=1 asc_ioport=0x110,0x330 If ADVANSYS_DEBUG is defined a 5th (ASC_NUM_IOPORT_PROBE + 1) I/O Port may be added to specify the driver debug level. Refer to the 'Driver Compile Time Options and Debugging' section above for more information. G. Tests to run before releasing new driver 1. In the supported kernels verify there are no warning or compile errors when the kernel is built as both a driver and as a module and with the following options: ADVANSYS_DEBUG - enabled and disabled CONFIG_SMP - enabled and disabled CONFIG_PROC_FS - enabled and disabled
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -