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

📄 gdth.c

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 C
📖 第 1 页 / 共 5 页
字号:
/************************************************************************ * Linux driver for                                                     *   * ICP vortex GmbH:    GDT ISA/EISA/PCI Disk Array Controllers          * * Intel Corporation:  Storage RAID Controllers                         * *                                                                      * * gdth.c                                                               * * Copyright (C) 1995-01 ICP vortex, an Intel company,  Achim Leubner   * *                                                                      * * <achim@vortex.de>                                                    * *                                                                      * * 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.            * *                                                                      * * Tested with Linux 1.2.13, ..., 2.2.19, ..., 2.4.7                    * *                                                                      * * $Log: gdth.c,v $ * 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 shutdown 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 * ************************************************************************/#ident "$Id: gdth.c,v 1.57 2001/08/21 11:16:35 achim Exp $" /* 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 * * 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: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" * 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:                      Unused * buffers_residual:            Timeout value * Status:                      Command status (gdth_do_cmd()) * Message:                     Additional info (gdth_do_cmd()) * have_data_in:                Flag for gdth_wait_completion() * sent_command:                Opcode special command * phase:                       Service/parameter/return code special command */#include <linux/module.h>#include <linux/version.h>#include <linux/kernel.h>#include <linux/types.h>#include <linux/pci.h>#include <linux/string.h>#include <linux/ctype.h>#include <linux/ioport.h>#include <linux/delay.h>#include <linux/sched.h>#include <linux/in.h>#include <linux/proc_fs.h>#include <linux/time.h>#include <linux/timer.h>#ifdef GDTH_RTC#include <linux/mc146818rtc.h>#endif#if LINUX_VERSION_CODE >= 0x020100#include <linux/reboot.h>#else#include <linux/bios32.h>#endif#include <asm/dma.h>#include <asm/system.h>#include <asm/io.h>#if LINUX_VERSION_CODE >= 0x020322#include <linux/spinlock.h>#elif LINUX_VERSION_CODE >= 0x02015F#include <asm/spinlock.h>#endif#if LINUX_VERSION_CODE >= 0x010300#include <linux/blk.h>#else#include "../block/blk.h"#endif#include "scsi.h"#include "hosts.h"#include "sd.h"#include "gdth.h"static void gdth_delay(int milliseconds);static void gdth_eval_mapping(ulong32 size, int *cyls, int *heads, int *secs);#if LINUX_VERSION_CODE >= 0x010346static void gdth_interrupt(int irq,void *dev_id,struct pt_regs *regs);#elsestatic void gdth_interrupt(int irq,struct pt_regs *regs);#endifstatic int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp);static int gdth_async_event(int hanum);static void gdth_log_event(gdth_evt_data *dvr, char *buffer);static void gdth_putq(int hanum,Scsi_Cmnd *scp,unchar priority);static void gdth_next(int hanum);static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b);static int gdth_special_cmd(int hanum,Scsi_Cmnd *scp);static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, ushort source,                                      ushort idx, gdth_evt_data *evt);

⌨️ 快捷键说明

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