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

📄 qla1280.c

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 C
📖 第 1 页 / 共 5 页
字号:
/******************************************************************************** *                  QLOGIC LINUX SOFTWARE * * QLogic ISP1x80/1x160 device driver for Linux 2.3.x (redhat 6.X). * * COPYRIGHT (C) 1999-2000 QLOGIC CORPORATION     * * This program is free software; you can redistribute it and/or modify * it under the terms of the Qlogic's Linux Software License. See below. * * This program is WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistribution's or source code must retain the above copyright *    notice, this list of conditions, and the following disclaimer, *    without modification, immediately at the beginning of the file. * 2. The name of the author may not be used to endorse or promote products *    derived from this software without specific prior written permission. * ********************************************************************************/ /*****************************************************************************************			QLOGIC CORPORATION SOFTWARE           "GNU" GENERAL PUBLIC LICENSE    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION                 AND MODIFICATIONThis GNU General Public License ("License") applies solely to QLogic Linux Software ("Software") and may be distributed under the terms of this License.   1. You may copy and distribute verbatim copies of the Software's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty;keep intact all the notices that refer to this License and to the absence of anywarranty; and give any other recipients of the Software a copy of this License alongwith the Software. You may charge a fee for the physical act of transferring a copy, and you may at youroption offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Software or any portion of it, thus forminga work based on the Software, and copy and distribute such modifications or work underthe terms of Section 1 above, provided that you also meet all of these conditions: * a) You must cause the modified files to carry prominent notices stating that youchanged the files and the date of any change. * b) You must cause any work that you distribute or publish that in whole or in partcontains or is derived from the Software or any part thereof, to be licensed as awhole at no charge to all third parties under the terms of this License. * c) If the modified Software normally reads commands interactively when run, youmust cause it, when started running for such interactive use in the most ordinary way,to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and thatusers may redistribute the Software under these conditions, and telling the user how toview a copy of this License. (Exception:if the Software itself is interactive but does not normally print such an announcement, your work based on the Software is not requiredto print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections ofthat work are not derived from the Software, and can be reasonably considered independentand separate works in themselves, then this License, and its terms, do not apply to thosesections when you distribute them as separate works. But when you distribute the samesections as part of a whole which is a work based on the Software, the distribution of thewhole must be on the terms of this License, whose permissions for other licensees extendto the entire whole, and thus to each and every part regardless of who wrote it. 3. You may copy and distribute the Software (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided thatyou also do one of the following: * a) Accompany it with the complete corresponding machine-readable source code, which mustbe distributed under the terms of Sections 1 and 2 above on a medium customarily used forsoftware interchange; or, * b) Accompany it with a written offer, valid for at least three years, to give any thirdparty, for a charge no more than your cost of physically performing source distribution,a complete machine-readable copy of the corresponding source code, to be distributed underthe terms of Sections 1 and 2 above on a medium customarily used for software interchange;or,* c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distributionand only if you received the Software in object code or executable form with such an offer,in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modificationsto it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts usedto control compilation and installation of the executable.     If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the sameplace counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Software except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Software is void, and will automatically terminate your rights under thisLicense. However, parties who have received copies, or rights, from you under this Licensewill not have their licenses terminated so long as such parties remain in full compliance. 5. This license grants you world wide, royalty free non-exclusive rights to modify or distribute the Software or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Software(or any work based on the Software), you indicate your acceptance of this License to doso, and all its terms and conditions for copying, distributing or modifying the Softwareor works based on it. 6. Each time you redistribute the Software (or any work based on the Software), the recipient automatically receives a license from the original licensor to copy, distributeor modify the Software subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You arenot responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or forany other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of thisLicense, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute theSoftware at all.    If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a wholeis intended to apply in other circumstances. NO WARRANTY11. THE SOFTWARE IS PROVIDED WITHOUT A WARRANTY OF ANY KIND. THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARES), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS *******************************************************************************************/ /****************************************************************************    Revision History:    Rev. 3.00       Jan 17, 1999    DG  Qlogic	   - Added 64-bit support.    Rev. 2.07       Nov 9, 1999     DG  Qlogic	   - Added new routine to set target parameters for ISP12160.     Rev. 2.06       Sept 10, 1999     DG  Qlogic       - Added support for ISP12160 Ultra 3 chip.    Rev. 2.03       August 3, 1999    Fred Lewis, Intel DuPont	- Modified code to remove errors generated when compiling with	  Cygnus IA64 Compiler.        - Changed conversion of pointers to unsigned longs instead of integers.        - Changed type of I/O port variables from uint32_t to unsigned long.        - Modified OFFSET macro to work with 64-bit as well as 32-bit.        - Changed sprintf and printk format specifiers for pointers to %p.        - Changed some int to long type casts where needed in sprintf & printk.        - Added l modifiers to sprintf and printk format specifiers for longs.        - Removed unused local variables.    Rev. 1.20       June 8, 1999      DG,  Qlogic         Changes to support RedHat release 6.0 (kernel 2.2.5).         - Added SCSI exclusive access lock (io_request_lock) when accessing          the adapter.       - Added changes for the new LINUX interface template. Some new error         handling routines have been added to the template, but for now we         will use the old ones.    -   Initial Beta Release.  *****************************************************************************/#ifdef MODULE#include <linux/module.h>#endif#define QLA1280_VERSION      " 3.00-Beta"#include <stdarg.h>#include <asm/io.h>#include <asm/irq.h>#include <asm/segment.h>#include <asm/byteorder.h>#include <linux/version.h>#include <linux/types.h>#include <linux/string.h>#include <linux/errno.h>#include <linux/kernel.h>#include <linux/ioport.h>#include <linux/delay.h>#include <linux/timer.h>#include <linux/sched.h>#include <linux/pci.h>#include <linux/proc_fs.h>#include <linux/blk.h>#include <linux/tqueue.h>/* MRS #include <linux/tasks.h> */#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95)# include <linux/bios32.h>#endif#include "sd.h"#include "scsi.h"#include "hosts.h"#define UNIQUE_FW_NAME#include "qla1280.h"#include "ql12160_fw.h"                     /* ISP RISC code */#include "ql1280_fw.h"#include <linux/stat.h>#include <linux/slab.h>        /* for kmalloc() */#ifndef KERNEL_VERSION#  define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))#endif/* * Compile time Options:  *            0 - Disable and 1 - Enable  */#define  QLA1280_64BIT_SUPPORT         1   /* 64-bit Support */#define  QL1280_TARGET_MODE_SUPPORT    0   /* Target mode support */#define  WATCHDOGTIMER                 0#define  MEMORY_MAPPED_IO              0#define  DEBUG_QLA1280_INTR            0#define  USE_NVRAM_DEFAULTS	       0#define  DEBUG_PRINT_NVRAM             0#define  LOADING_RISC_ACTIVITY         0#define  AUTO_ESCALATE_RESET           0   /* Automatically escalate resets */#define  AUTO_ESCALATE_ABORT           0   /* Automatically escalate aborts */#define  STOP_ON_ERROR                 0   /* Stop on aborts and resets  */#define  STOP_ON_RESET                 0 #define  STOP_ON_ABORT                 0 #undef   DYNAMIC_MEM_ALLOC#define  DEBUG_QLA1280                 0    /* Debugging  *//* #define CHECKSRBSIZE *//* * These macros to assist programming */#define	BZERO(ptr, amt)		memset(ptr, 0, amt)#define	BCOPY(src, dst, amt)	memcpy(dst, src, amt)#define	KMALLOC(siz)	kmalloc((siz), GFP_ATOMIC)#define	KMFREE(ip,siz)	kfree((ip))#define	SYS_DELAY(x)		udelay(x);barrier()#define QLA1280_DELAY(sec)  mdelay(sec * 1000)#define VIRT_TO_BUS(a) virt_to_bus((a))#if  QLA1280_64BIT_SUPPORT#if  BITS_PER_LONG <= 32#define  VIRT_TO_BUS_LOW(a) (uint32_t)virt_to_bus((a))#define  VIRT_TO_BUS_HIGH(a) (uint32_t)(0x0)#else#define  VIRT_TO_BUS_LOW(a) (uint32_t)(0xffffffff & virt_to_bus((a)))#define  VIRT_TO_BUS_HIGH(a) (uint32_t)(0xffffffff & (virt_to_bus((a))>>32))#endif#endif  /* QLA1280_64BIT_SUPPORT */#define STATIC     #define NVRAM_DELAY() udelay(500) /* 2 microsecond delay */void qla1280_device_queue_depth(scsi_qla_host_t *, Scsi_Device *);#define  CACHE_FLUSH(a) (RD_REG_WORD(a))#define  INVALID_HANDLE    (MAX_OUTSTANDING_COMMANDS+1)#define  MSW(x)          (uint16_t)((uint32_t)(x) >> 16)#define  LSW(x)          (uint16_t)(x)#define  MSB(x)          (uint8_t)((uint16_t)(x) >> 8)#define  LSB(x)          (uint8_t)(x)#if  BITS_PER_LONG <= 32#define  LS_64BITS(x) (uint32_t)(x)#define  MS_64BITS(x) (uint32_t)(0x0)#else#define  LS_64BITS(x) (uint32_t)(0xffffffff & (x))#define  MS_64BITS(x) (uint32_t)(0xffffffff & ((x)>>32) )#endif/* *  QLogic Driver Support Function Prototypes. */STATIC void   qla1280_done(scsi_qla_host_t *, srb_t **, srb_t **);STATIC void   qla1280_next(scsi_qla_host_t *, scsi_lu_t *, uint8_t);STATIC void   qla1280_putq_t(scsi_lu_t *, srb_t *);STATIC void   qla1280_done_q_put(srb_t *, srb_t **, srb_t **);STATIC void qla1280_select_queue_depth(struct Scsi_Host *, Scsi_Device *);#ifdef  QLA1280_UNUSED static void qla1280_dump_regs(struct Scsi_Host *host);#endif#if  STOP_ON_ERROR static void qla1280_panic(char *, struct Scsi_Host *host);#endifvoid qla1280_print_scsi_cmd(Scsi_Cmnd *cmd);STATIC void qla1280_abort_queue_single(scsi_qla_host_t *,uint32_t,uint32_t,uint32_t,uint32_t);STATIC int qla1280_return_status( sts_entry_t *sts, Scsi_Cmnd       *cp);STATIC void qla1280_removeq(scsi_lu_t *q, srb_t *sp);STATIC void qla1280_mem_free(scsi_qla_host_t *ha);static void qla1280_do_dpc(void *p);#ifdef  QLA1280_UNUSED static void qla1280_set_flags(char * s);#endifstatic char	*qla1280_get_token(char *, char *);#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)STATIC inline void mdelay(int);#endifstatic inline void qla1280_enable_intrs(scsi_qla_host_t *);static inline void qla1280_disable_intrs(scsi_qla_host_t *);/* *  QLogic ISP1280 Hardware Support Function Prototypes. */STATIC uint8_t   qla1280_initialize_adapter(struct scsi_qla_host   *ha);STATIC uint8_t   qla1280_enable_tgt(scsi_qla_host_t *, uint8_t);STATIC uint8_t   qla1280_isp_firmware(scsi_qla_host_t *);STATIC uint8_t   qla1280_pci_config(scsi_qla_host_t *);STATIC uint8_t   qla1280_chip_diag(scsi_qla_host_t *);STATIC uint8_t   qla1280_setup_chip(scsi_qla_host_t *);STATIC uint8_t   qla1280_init_rings(scsi_qla_host_t *);STATIC uint8_t   qla1280_nvram_config(scsi_qla_host_t *);STATIC uint8_t   qla1280_mailbox_command(scsi_qla_host_t *, uint8_t, uint16_t *);STATIC uint8_t   qla1280_bus_reset(scsi_qla_host_t *, uint8_t);STATIC uint8_t   qla1280_device_reset(scsi_qla_host_t *, uint8_t, uint32_t);STATIC uint8_t   qla1280_abort_device(scsi_qla_host_t *, uint8_t, uint32_t, uint32_t);STATIC uint8_t   qla1280_abort_command(scsi_qla_host_t *, srb_t *),#if  QLA1280_64BIT_SUPPORT                 qla1280_64bit_start_scsi(scsi_qla_host_t *, srb_t *),#endif                 qla1280_32bit_start_scsi(scsi_qla_host_t *, srb_t *),                 qla1280_abort_isp(scsi_qla_host_t *);STATIC void      qla1280_nv_write(scsi_qla_host_t *, uint16_t),                 qla1280_nv_delay(scsi_qla_host_t *),                 qla1280_poll(scsi_qla_host_t *),                 qla1280_reset_adapter(scsi_qla_host_t *),                 qla1280_marker(scsi_qla_host_t *, uint8_t, uint32_t, uint32_t, uint8_t),                 qla1280_isp_cmd(scsi_qla_host_t *),                 qla1280_isr(scsi_qla_host_t *, srb_t **, srb_t **),                 qla1280_rst_aen(scsi_qla_host_t *),                 qla1280_status_entry(scsi_qla_host_t *, sts_entry_t *, srb_t **,                                      srb_t **),                 qla1280_error_entry(scsi_qla_host_t *, response_t *, srb_t **,                                     srb_t **),                 qla1280_restart_queues(scsi_qla_host_t *),                 qla1280_abort_queues(scsi_qla_host_t *);STATIC uint16_t  qla1280_get_nvram_word(scsi_qla_host_t *, uint32_t),                 qla1280_nvram_request(scsi_qla_host_t *, uint32_t),                 qla1280_debounce_register(volatile uint16_t *);STATIC request_t *qla1280_req_pkt(scsi_qla_host_t *);int  qla1280_check_for_dead_scsi_bus(scsi_qla_host_t *ha, srb_t *sp);STATIC uint8_t qla1280_mem_alloc(scsi_qla_host_t *ha);STATIC uint8_t  qla1280_register_with_Linux(scsi_qla_host_t *ha, uint8_t maxchannels);

⌨️ 快捷键说明

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