gdth.c

来自「Linux Kernel 2.6.9 for OMAP1710」· C语言 代码 · 共 1,814 行 · 第 1/5 页

C
1,814
字号
/************************************************************************ * Linux driver for                                                     *   * ICP vortex GmbH:    GDT ISA/EISA/PCI Disk Array Controllers          * * Intel Corporation:  Storage RAID Controllers                         * *                                                                      * * gdth.c                                                               * * Copyright (C) 1995-04 ICP vortex GmbH, Achim Leubner                 * * Copyright (C) 2002-04 Intel Corporation                              * * Copyright (C) 2003-04 Adaptec Inc.                                   * * <achim_leubner@adaptec.com>                                          * *                                                                      * * Additions/Fixes:                                                     * * Boji Tony Kannanthanam <boji.t.kannanthanam@intel.com>               * * Johannes Dinner <johannes_dinner@adaptec.com>                        * *                                                                      * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published    * * by the Free Software Foundation; either version 2 of the License,    * * or (at your option) any later version.                               * *                                                                      * * This program is distributed in the hope that it will be useful,      * * but WITHOUT ANY WARRANTY; without even the implied warranty of       * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the         * * GNU General Public License for more details.                         * *                                                                      * * You should have received a copy of the GNU General Public License    * * along with this kernel; if not, write to the Free Software           * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            * *                                                                      * * Linux kernel 2.2.x, 2.4.x, 2.6.x supported                           * *                                                                      * * $Log: gdth.c,v $ * Revision 1.73  2004/03/31 13:33:03  achim * Special command 0xfd implemented to detect 64-bit DMA support * * Revision 1.72  2004/03/17 08:56:04  achim * 64-bit DMA only enabled if FW >= x.43 * * Revision 1.71  2004/03/05 15:51:29  achim * Screen service: separate message buffer, bugfixes * * Revision 1.70  2004/02/27 12:19:07  achim * Bugfix: Reset bit in config (0xfe) call removed * * Revision 1.69  2004/02/20 09:50:24  achim * Compatibility changes for kernels < 2.4.20 * Bugfix screen service command size * pci_set_dma_mask() error handling added * * Revision 1.68  2004/02/19 15:46:54  achim * 64-bit DMA bugfixes * Drive size bugfix for drives > 1TB * * Revision 1.67  2004/01/14 13:11:57  achim * Tool access over /proc no longer supported * Bugfixes IOCTLs * * Revision 1.66  2003/12/19 15:04:06  achim * Bugfixes support for drives > 2TB * * Revision 1.65  2003/12/15 11:21:56  achim * 64-bit DMA support added * Support for drives > 2 TB implemented * Kernels 2.2.x, 2.4.x, 2.6.x supported * * Revision 1.64  2003/09/17 08:30:26  achim * EISA/ISA controller scan disabled * Command line switch probe_eisa_isa added * * Revision 1.63  2003/07/12 14:01:00  Daniele Bellucci <bellucda@tiscali.it> * Minor cleanups in gdth_ioctl. * * Revision 1.62  2003/02/27 15:01:59  achim * Dynamic DMA mapping implemented * New (character device) IOCTL interface added * Other controller related changes made * * Revision 1.61  2002/11/08 13:09:52  boji * Added support for XSCALE based RAID Controllers * Fixed SCREENSERVICE initialization in SMP cases * Added checks for gdth_polling before GDTH_HA_LOCK * * Revision 1.60  2002/02/05 09:35:22  achim * MODULE_LICENSE only if kernel >= 2.4.11 * * Revision 1.59  2002/01/30 09:46:33  achim * Small changes * * Revision 1.58  2002/01/29 15:30:02  achim * Set default value of shared_access to Y * New status S_CACHE_RESERV for clustering added * * Revision 1.57  2001/08/21 11:16:35  achim * Bugfix free_irq() * * Revision 1.56  2001/08/09 11:19:39  achim * Scsi_Host_Template changes * * Revision 1.55  2001/08/09 10:11:28  achim * Command HOST_UNFREEZE_IO before cache service init. * * Revision 1.54  2001/07/20 13:48:12  achim * Expand: gdth_analyse_hdrive() removed * * Revision 1.53  2001/07/17 09:52:49  achim * Small OEM related change * * Revision 1.52  2001/06/19 15:06:20  achim * New host command GDT_UNFREEZE_IO added * * Revision 1.51  2001/05/22 06:42:37  achim * PCI: Subdevice ID added * * Revision 1.50  2001/05/17 13:42:16  achim * Support for Intel Storage RAID Controllers added * * Revision 1.50  2001/05/17 12:12:34  achim * Support for Intel Storage RAID Controllers added * * Revision 1.49  2001/03/15 15:07:17  achim * New __setup interface for boot command line options added * * Revision 1.48  2001/02/06 12:36:28  achim * Bugfix Cluster protocol * * Revision 1.47  2001/01/10 14:42:06  achim * New switch shared_access added * * Revision 1.46  2001/01/09 08:11:35  achim * gdth_command() removed * meaning of Scsi_Pointer members changed * * Revision 1.45  2000/11/16 12:02:24  achim * Changes for kernel 2.4 * * Revision 1.44  2000/10/11 08:44:10  achim * Clustering changes: New flag media_changed added * * Revision 1.43  2000/09/20 12:59:01  achim * DPMEM remap functions for all PCI controller types implemented * Small changes for ia64 platform * * Revision 1.42  2000/07/20 09:04:50  achim * Small changes for kernel 2.4 * * Revision 1.41  2000/07/04 14:11:11  achim * gdth_analyse_hdrive() added to rescan drives after online expansion * * Revision 1.40  2000/06/27 11:24:16  achim * Changes Clustering, Screenservice * * Revision 1.39  2000/06/15 13:09:04  achim * Changes for gdth_do_cmd() * * Revision 1.38  2000/06/15 12:08:43  achim * Bugfix gdth_sync_event(), service SCREENSERVICE * Data direction for command 0xc2 changed to DOU * * Revision 1.37  2000/05/25 13:50:10  achim * New driver parameter virt_ctr added * * Revision 1.36  2000/05/04 08:50:46  achim * Event buffer now in gdth_ha_str * * Revision 1.35  2000/03/03 10:44:08  achim * New event_string only valid for the RP controller family * * Revision 1.34  2000/03/02 14:55:29  achim * New mechanism for async. event handling implemented * * Revision 1.33  2000/02/21 15:37:37  achim * Bugfix Alpha platform + DPMEM above 4GB * * Revision 1.32  2000/02/14 16:17:37  achim * Bugfix sense_buffer[] + raw devices * * Revision 1.31  2000/02/10 10:29:00  achim * Delete sense_buffer[0], if command OK * * Revision 1.30  1999/11/02 13:42:39  achim * ARRAY_DRV_LIST2 implemented * Now 255 log. and 100 host drives supported * * Revision 1.29  1999/10/05 13:28:47  achim * GDT_CLUST_RESET added * * Revision 1.28  1999/08/12 13:44:54  achim * MOUNTALL removed * Cluster drives -> removeable drives * * Revision 1.27  1999/06/22 07:22:38  achim * Small changes * * Revision 1.26  1999/06/10 16:09:12  achim * Cluster Host Drive support: Bugfixes * * Revision 1.25  1999/06/01 16:03:56  achim * gdth_init_pci(): Manipulate config. space to start RP controller * * Revision 1.24  1999/05/26 11:53:06  achim * Cluster Host Drive support added * * Revision 1.23  1999/03/26 09:12:31  achim * Default value for hdr_channel set to 0 * * Revision 1.22  1999/03/22 16:27:16  achim * Bugfix: gdth_store_event() must not be locked with GDTH_LOCK_HA() * * Revision 1.21  1999/03/16 13:40:34  achim * Problems with reserved drives solved * gdth_eh_bus_reset() implemented * * Revision 1.20  1999/03/10 09:08:13  achim * Bugfix: Corrections in gdth_direction_tab[] made * Bugfix: Increase command timeout (gdth_update_timeout()) NOT in gdth_putq() * * Revision 1.19  1999/03/05 14:38:16  achim * Bugfix: Heads/Sectors mapping for reserved devices possibly wrong * -> gdth_eval_mapping() implemented, changes in gdth_bios_param() * INIT_RETRIES set to 100s to avoid DEINIT-Timeout for controllers * with BIOS disabled and memory test set to Intensive * Enhanced /proc support * * Revision 1.18  1999/02/24 09:54:33  achim * Command line parameter hdr_channel implemented * Bugfix for EISA controllers + Linux 2.2.x * * Revision 1.17  1998/12/17 15:58:11  achim * Command line parameters implemented * Changes for Alpha platforms * PCI controller scan changed * SMP support improved (spin_lock_irqsave(),...) * New async. events, new scan/reserve commands included * * Revision 1.16  1998/09/28 16:08:46  achim * GDT_PCIMPR: DPMEM remapping, if required * mdelay() added * * Revision 1.15  1998/06/03 14:54:06  achim * gdth_delay(), gdth_flush() implemented * Bugfix: gdth_release() changed * * Revision 1.14  1998/05/22 10:01:17  achim * mj: pcibios_strerror() removed * Improved SMP support (if version >= 2.1.95) * gdth_halt(): halt_called flag added (if version < 2.1) * * Revision 1.13  1998/04/16 09:14:57  achim * Reserve drives (for raw service) implemented * New error handling code enabled * Get controller name from board_info() IOCTL * Final round of PCI device driver patches by Martin Mares * * Revision 1.12  1998/03/03 09:32:37  achim * Fibre channel controller support added * * Revision 1.11  1998/01/27 16:19:14  achim * SA_SHIRQ added * add_timer()/del_timer() instead of GDTH_TIMER * scsi_add_timer()/scsi_del_timer() instead of SCSI_TIMER * New error handling included * * Revision 1.10  1997/10/31 12:29:57  achim * Read heads/sectors from host drive * * Revision 1.9  1997/09/04 10:07:25  achim * IO-mapping with virt_to_bus(), gdth_readb(), gdth_writeb(), ... * register_reboot_notifier() to get a notify on shutown used * * Revision 1.8  1997/04/02 12:14:30  achim * Version 1.00 (see gdth.h), tested with kernel 2.0.29 * * Revision 1.7  1997/03/12 13:33:37  achim * gdth_reset() changed, new async. events * * Revision 1.6  1997/03/04 14:01:11  achim * Shutdown routine gdth_halt() implemented * * Revision 1.5  1997/02/21 09:08:36  achim * New controller included (RP, RP1, RP2 series) * IOCTL interface implemented * * Revision 1.4  1996/07/05 12:48:55  achim * Function gdth_bios_param() implemented * New constant GDTH_MAXC_P_L inserted * GDT_WRITE_THR, GDT_EXT_INFO implemented * Function gdth_reset() changed * * Revision 1.3  1996/05/10 09:04:41  achim * Small changes for Linux 1.2.13 * * Revision 1.2  1996/05/09 12:45:27  achim * Loadable module support implemented * /proc support corrections made * * Revision 1.1  1996/04/11 07:35:57  achim * Initial revision * ************************************************************************//* All GDT Disk Array Controllers are fully supported by this driver. * This includes the PCI/EISA/ISA SCSI Disk Array Controllers and the * PCI Fibre Channel Disk Array Controllers. See gdth.h for a complete * list of all controller types. *  * If you have one or more GDT3000/3020 EISA controllers with  * controller BIOS disabled, you have to set the IRQ values with the  * command line option "gdth=irq1,irq2,...", where the irq1,irq2,... are * the IRQ values for the EISA controllers. *  * After the optional list of IRQ values, other possible  * command line options are: * disable:Y                    disable driver * disable:N                    enable driver * reserve_mode:0               reserve no drives for the raw service * reserve_mode:1               reserve all not init., removable drives * reserve_mode:2               reserve all not init. drives * reserve_list:h,b,t,l,h,b,t,l,...     reserve particular drive(s) with  *                              h- controller no., b- channel no.,  *                              t- target ID, l- LUN * reverse_scan:Y               reverse scan order for PCI controllers          * reverse_scan:N               scan PCI controllers like BIOS * max_ids:x                    x - target ID count per channel (1..MAXID) * rescan:Y                     rescan all channels/IDs  * rescan:N                     use all devices found until now * virt_ctr:Y                   map every channel to a virtual controller  * virt_ctr:N                   use multi channel support  * hdr_channel:x                x - number of virtual bus for host drives * shared_access:Y              disable driver reserve/release protocol to  *                              access a shared resource from several nodes,  *                              appropiate controller firmware required * shared_access:N              enable driver reserve/release protocol * probe_eisa_isa:Y             scan for EISA/ISA controllers * probe_eisa_isa:N             do not scan for EISA/ISA controllers * force_dma32:Y                use only 32 bit DMA mode * force_dma32:N                use 64 bit DMA mode, if supported * * The default values are: "gdth=disable:N,reserve_mode:1,reverse_scan:N, *                          max_ids:127,rescan:N,virt_ctr:N,hdr_channel:0, *                          shared_access:Y,probe_eisa_isa:N,force_dma32:N". * Here is another example: "gdth=reserve_list:0,1,2,0,0,1,3,0,rescan:Y". *  * When loading the gdth driver as a module, the same options are available.  * You can set the IRQs with "IRQ=...". However, the syntax to specify the * options changes slightly. You must replace all ',' between options  * with ' ' and all ':' with '=' and you must use  * '1' in place of 'Y' and '0' in place of 'N'. *  * Default: "modprobe gdth disable=0 reserve_mode=1 reverse_scan=0 *           max_ids=127 rescan=0 virt_ctr=0 hdr_channel=0 shared_access=0  *           probe_eisa_isa=0 force_dma32=0" * The other example: "modprobe gdth reserve_list=0,1,2,0,0,1,3,0 rescan=1". *//* The meaning of the Scsi_Pointer members in this driver is as follows: * ptr:                     Chaining * this_residual:           Command priority * buffer:                  phys. DMA sense buffer  * dma_handle:              phys. DMA buffer (kernel >= 2.4.0) * buffers_residual:        Timeout value * Status:                  Command status (gdth_do_cmd()), DMA mem. mappings * Message:                 Additional info (gdth_do_cmd()), DMA direction * have_data_in:            Flag for gdth_wait_completion()

⌨️ 快捷键说明

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