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

📄 qla1280.c

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 C
📖 第 1 页 / 共 5 页
字号:
STATIC uint8_t qla12160_set_target_parameters(scsi_qla_host_t *, uint32_t, uint32_t, uint32_t, nvram160_t *);STATIC void qla12160_get_target_parameters(scsi_qla_host_t *, uint32_t, uint32_t, uint32_t);#if QL1280_TARGET_MODE_SUPPORTSTATIC void      qla1280_enable_lun(scsi_qla_host_t *, uint8_t, uint32_t),                 qla1280_notify_ack(scsi_qla_host_t *, notify_entry_t *),                 qla1280_immed_notify(scsi_qla_host_t *, notify_entry_t *),                 qla1280_accept_io(scsi_qla_host_t *, ctio_ret_entry_t *),#if  QLA1280_64BIT_SUPPORT                 qla1280_64bit_continue_io(scsi_qla_host_t *, atio_entry_t *, uint32_t,                                     paddr32_t *),#endif                 qla1280_32bit_continue_io(scsi_qla_host_t *, atio_entry_t *, uint32_t,                                     paddr32_t *),                 qla1280_atio_entry(scsi_qla_host_t *, atio_entry_t *),                 qla1280_notify_entry(scsi_qla_host_t *, notify_entry_t *);#endif  /* QLA1280_TARGET_MODE_SUPPORT */#ifdef QL_DEBUG_ROUTINES/* *  Driver Debug Function Prototypes. */STATIC uint8_t  qla1280_getbyte(uint8_t *);STATIC uint16_t qla1280_getword(uint16_t *);STATIC uint32_t qla1280_getdword(uint32_t *);STATIC void     qla1280_putbyte(uint8_t *, uint8_t),                qla1280_putword(uint16_t *, uint16_t),                qla1280_putdword(uint32_t *, uint32_t),                qla1280_print(caddr_t),                qla1280_output_number(uint32_t, uint8_t),                qla1280_putc(uint8_t),                qla1280_dump_buffer(caddr_t, uint32_t);char          debug_buff[80];#if DEBUG_QLA1280 STATIC uint8_t ql_debug_print = 1;#elseSTATIC uint8_t ql_debug_print = 0;#endif#endif/* * insmod needs to find the variable and make it point to something */#ifdef MODULEstatic char *options = NULL;#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,18)/* insmod qla1280 options=verbose" */MODULE_PARM(options, "s");  #endif/* * 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 add commas in your insmod command!!\n";#endif/* We use the Scsi_Pointer structure that's included with each command * SCSI_Cmnd as a scratchpad for our SRB. * * SCp will always point to the SRB structure (defined in qla1280.h). * It is define as follows: *  - SCp.ptr  -- > pointer back to the cmd *  - SCp.this_residual --> used as forward pointer to next srb *  - SCp.buffer --> used as backward pointer to next srb *  - SCp.buffers_residual --> used as flags field *  - SCp.have_data_in --> not used *  - SCp.sent_command --> not used *  - SCp.phase --> not used */#define	CMD_SP(Cmnd)		(&(Cmnd)->SCp)#define	CMD_XFRLEN(Cmnd)	(Cmnd)->request_bufflen#define	CMD_CDBLEN(Cmnd)	(Cmnd)->cmd_len#define	CMD_CDBP(Cmnd)		(Cmnd)->cmnd#define	CMD_SNSP(Cmnd)		(Cmnd)->sense_buffer#define	CMD_SNSLEN(Cmnd)	(sizeof (Cmnd)->sense_buffer)#define	CMD_RESULT(Cmnd)	((Cmnd)->result)#define	CMD_HANDLE(Cmnd)	((Cmnd)->host_scribble)/*****************************************//*   ISP Boards supported by this driver *//*****************************************/#define QLA1280_VENDOR_ID   0x1077#define QLA1080_DEVICE_ID   0x1080#define QLA1240_DEVICE_ID   0x1240#define QLA1280_DEVICE_ID   0x1280#define QLA12160_DEVICE_ID  0x1216#define QLA10160_DEVICE_ID  0x1016#define NUM_OF_ISP_DEVICES        6typedef struct _qlaboards {   unsigned char   bdName[9];       /* Board ID String */   unsigned long   device_id;       /* Device PCI ID   */   int   numPorts;                  /* Number of SCSI ports */   unsigned short   *fwcode;        /* pointer to FW array         */   unsigned long    *fwlen;         /* number of words in array    */   unsigned short   *fwstart;       /* start address for F/W       */   unsigned char   *fwver;          /* Ptr to F/W version array    */} qla_boards_t;struct _qlaboards   QLBoardTbl[NUM_OF_ISP_DEVICES] = {   /* Name ,  Board PCI Device ID,         Number of ports */  {"QLA1080 ", QLA1080_DEVICE_ID,           1,                       &fw1280ei_code01[0],  (unsigned long *)&fw1280ei_length01,&fw1280ei_addr01, &fw1280ei_version_str[0] },         {"QLA1240 ", QLA1240_DEVICE_ID,           2,                      &fw1280ei_code01[0],  (unsigned long *)&fw1280ei_length01,&fw1280ei_addr01, &fw1280ei_version_str[0] },         {"QLA1280 ", QLA1280_DEVICE_ID,           2,                     &fw1280ei_code01[0],  (unsigned long *)&fw1280ei_length01,&fw1280ei_addr01, &fw1280ei_version_str[0] },         {"QLA12160 ", QLA12160_DEVICE_ID,          2,                     &fw12160i_code01[0],  (unsigned long *)&fw12160i_length01,&fw12160i_addr01, &fw12160i_version_str[0] },         {"QLA10160 ", QLA10160_DEVICE_ID,          1,                     &fw12160i_code01[0],  (unsigned long *)&fw12160i_length01,&fw12160i_addr01, &fw12160i_version_str[0] },         {"        ",                 0,           0}};static unsigned long qla1280_verbose = 1L;static scsi_qla_host_t *qla1280_hostlist = NULL;#ifdef QLA1280_PROFILEstatic int qla1280_buffer_size = 0;static char *qla1280_buffer = NULL;#endif#ifdef QL_DEBUG_LEVEL_3 #define ENTER(x)	sprintf(debug_buff,"qla1280 : Entering %s()\n\r", x); \                        qla1280_print(debug_buff);#define LEAVE(x)	sprintf(debug_buff,"qla1280 : Leaving %s()\n\r", x); \                        qla1280_print(debug_buff);#define ENTER_INTR(x)	sprintf(debug_buff,"qla1280 : Entering %s()\n\r", x); \                        qla1280_print(debug_buff);#define LEAVE_INTR(x)	sprintf(debug_buff,"qla1280 : Leaving %s()\n\r", x); \                        qla1280_print(debug_buff);#define DEBUG3(x)	x#else#define ENTER(x)#define LEAVE(x)#define ENTER_INTR(x)#define LEAVE_INTR(x)#define DEBUG3(x)#endif#if  DEBUG_QLA1280  #define COMTRACE(x)/* #define COMTRACE(x)     qla1280_putc(x); */#define DEBUG(x)	x#else#define DEBUG(x)#define COMTRACE(x)#endif#ifdef QL_DEBUG_LEVEL_2 #define DEBUG2(x)	x#else#define DEBUG2(x)#endif#define DEBUG5(x)#if (BITS_PER_LONG==64)#   define OFFSET(w)   (((uint64_t) &w) & 0xFF)   /* 256 byte offsets */#else#   define OFFSET(w)   (((uint32_t) &w) & 0xFF)   /* 256 byte offsets */#endif#define SCSI_BUS_32(scp)   ((scp)->channel)#define SCSI_TCN_32(scp)    ((scp)->target)#define SCSI_LUN_32(scp)    ((scp)->lun)/****************************************************************************//*  LINUX -  Loadable Module Functions.                                     *//****************************************************************************//************************************************************************* *   qla1280_set_info * * Description: *   Set parameters for the driver from the /proc filesystem. * * Returns: *************************************************************************/intqla1280_set_info(char *buffer, int length, struct Scsi_Host *HBAptr){  return (-ENOSYS);  /* Currently this is a no-op */}/************************************************************************* * qla1280_proc_info * * Description: *   Return information to handle /proc support for the driver. * * buffer - ptrs to a page buffer * * Returns: *************************************************************************/#ifdef QLA1280_PROFILE#define	PROC_BUF	(&qla1280_buffer[size])#define LUN_ID       (targ_lun>>(MAX_T_BITS+MAX_L_BITS)),((targ_lun>>MAX_L_BITS)&0xf), targ_lun&0x7 #endifintqla1280_proc_info ( char *buffer, char **start, off_t offset, int length,                     int hostno, int inout){#ifdef QLA1280_PROFILE  struct Scsi_Host *host;  scsi_qla_host_t *ha;  int    size = 0;  int  targ_lun;  scsi_lu_t  *up;  int   no_devices;  printk("Entering proc_info 0x%p,0x%lx,0x%x,0x%x\n",buffer,offset,length,hostno);  host = NULL;  /* find the host they want to look at */  for(ha=qla1280_hostlist; (ha != NULL) && ha->host->host_no != hostno; ha=ha->next)    ;  if (!ha)  {    size += sprintf(buffer, "Can't find adapter for host number %d\n", hostno);    if (size > length)    {      return (size);    }    else    {      return (length);    }  }  host = ha->host;  if (inout == TRUE) /* Has data been written to the file? */   {    return (qla1280_set_info(buffer, length, host));  }  /* compute number of active devices */  no_devices = 0;  for (targ_lun = 0; targ_lun < MAX_EQ; targ_lun++)  {          if( (up = ha->dev[targ_lun]) == NULL )              continue;          no_devices++;  }  /* size = 112 * no_devices; */  size = 4096;  /* round up to the next page */    /*    * if our old buffer is the right size use it otherwise    * allocate a new one.   */  if (qla1280_buffer_size != size)  {    /* deallocate this buffer and get a new one */    if (qla1280_buffer != NULL)     {      kfree(qla1280_buffer);      qla1280_buffer_size = 0;    }    qla1280_buffer = kmalloc(size, GFP_KERNEL);  }  if (qla1280_buffer == NULL)  {    size = sprintf(buffer, "qla1280 - kmalloc error at line %d\n",        __LINE__);    return size;  }  qla1280_buffer_size = size;  size = 0;  size += sprintf(PROC_BUF, "Qlogic 1280/1080 SCSI driver version: ");   /* 43 bytes */  size += sprintf(PROC_BUF, "%5s, ", QLA1280_VERSION);                         /* 5        */  size += sprintf(PROC_BUF, "Qlogic Firmware version: ");                     /* 25       */  size += sprintf(PROC_BUF, "%2d.%2d.%2d",_firmware_version[0],           /* 8        */                                          ql12_firmware_version[1],                                          ql12_firmware_version[2]);  size += sprintf(PROC_BUF, "\n");                                             /* 1       */                             size += sprintf(PROC_BUF, "SCSI Host Adapter Information: %s\n", QLBoardTbl[ha->devnum].bdName);  size += sprintf(PROC_BUF, "Request Queue = 0x%lx, Response Queue = 0x%lx\n",                        ha->request_dma,                        ha->response_dma);  size += sprintf(PROC_BUF, "Request Queue count= 0x%x, Response Queue count= 0x%x\n",                        REQUEST_ENTRY_CNT,                        RESPONSE_ENTRY_CNT);  size += sprintf(PROC_BUF,"Number of pending commands = 0x%lx\n", ha->actthreads);  size += sprintf(PROC_BUF,"Number of queued commands = 0x%lx\n", ha->qthreads);  size += sprintf(PROC_BUF,"Number of free request entries = %d\n",ha->req_q_cnt);  size += sprintf(PROC_BUF, "\n");                                             /* 1       */                          size += sprintf(PROC_BUF, "Attached devices:\n");  /* scan for all equipment stats */   for (targ_lun = 0; targ_lun < MAX_EQ; targ_lun++)  {      if( (up = ha->dev[targ_lun]) == NULL )           continue;      if( up->io_cnt == 0 )      {          size += sprintf(PROC_BUF,"(%2d:%2d:%2d) No stats\n",LUN_ID);           continue;      }      /* total reads since boot */      /* total writes since boot */      /* total requests since boot  */      size += sprintf(PROC_BUF, "Total requests %ld,",up->io_cnt);      /* current number of pending requests */      size += sprintf(PROC_BUF, "(%2d:%2d:%2d) pending requests %d,",LUN_ID,up->q_outcnt);      /* avg response time */      size += sprintf(PROC_BUF, "Avg response time %ld%%,",(up->resp_time/up->io_cnt)*100);            /* avg active time */      size += sprintf(PROC_BUF, "Avg active time %ld%%\n",(up->act_time/up->io_cnt)*100);  }  if (size >= qla1280_buffer_size)  {    printk(KERN_WARNING "qla1280: Overflow buffer in qla1280_proc.c\n");  }  if (offset > size - 1)  {    kfree(qla1280_buffer);    qla1280_buffer = NULL;    qla1280_buffer_size = length = 0;    *start = NULL;  }  else  {    *start = &qla1280_buffer[offset];   /* Start of wanted data */    if (size - offset < length)    {      length = size - offset;    }  }#endif  return (length);}/************************************************************************** * qla1280_detect *    This routine will probe for Qlogic 1280 SCSI host adapters. *    It returns the number of host adapters of a particular *    type that were found.	 It also initialize all data necessary for  *    the driver.  It is passed-in the host number, so that it *    knows where its first entry is in the scsi_hosts[] array. * * Input: *     template - pointer to SCSI template * * Returns: *  num - number of host adapters found.   **************************************************************************/intqla1280_detect(Scsi_Host_Template *template){    int num_hosts = 0;    struct Scsi_Host *host;

⌨️ 快捷键说明

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