Skip to content

Commit

Permalink
[SCSI] qla2xxx: Factor-out ISP specific functions to method-based cal…
Browse files Browse the repository at this point in the history
…l tables.

Factor-out ISP specific functions to method-based call tables.

In anticipation of ISP24xx/ISP25xx support, factor-out ISP
specific functions into a method-based call table.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
Andrew Vasquez authored and James Bottomley committed Jul 14, 2005
1 parent eb1dd68 commit abbd887
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 199 deletions.
5 changes: 1 addition & 4 deletions drivers/scsi/qla2xxx/qla_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf, loff_t off,
"Firmware dump ready for read on (%ld).\n",
ha->host_no);
memset(ha->fw_dump_buffer, 0, dump_size);
if (IS_QLA2100(ha) || IS_QLA2200(ha))
qla2100_ascii_fw_dump(ha);
else
qla2300_ascii_fw_dump(ha);
ha->isp_ops.ascii_fw_dump(ha);
ha->fw_dump_buffer_len = strlen(ha->fw_dump_buffer);
}
break;
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/qla2xxx/qla_dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ qla2300_ascii_fw_dump(scsi_qla_host_t *ha)
fw = ha->fw_dump;

qla_uprintf(&uiter, "%s Firmware Version %s\n", ha->model_number,
qla2x00_get_fw_version_str(ha, fw_info));
ha->isp_ops.fw_version_str(ha, fw_info));

qla_uprintf(&uiter, "\n[==>BEG]\n");

Expand Down Expand Up @@ -819,7 +819,7 @@ qla2100_ascii_fw_dump(scsi_qla_host_t *ha)
fw = ha->fw_dump;

qla_uprintf(&uiter, "%s Firmware Version %s\n", ha->model_number,
qla2x00_get_fw_version_str(ha, fw_info));
ha->isp_ops.fw_version_str(ha, fw_info));

qla_uprintf(&uiter, "\n[==>BEG]\n");

Expand Down
46 changes: 44 additions & 2 deletions drivers/scsi/qla2xxx/qla_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <linux/mempool.h>
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/interrupt.h>
#include <asm/semaphore.h>

#include <scsi/scsi.h>
Expand Down Expand Up @@ -1949,6 +1950,47 @@ struct gid_list_info {
};
#define GID_LIST_SIZE (sizeof(struct gid_list_info) * MAX_FIBRE_DEVICES)

/*
* ISP operations
*/
struct isp_operations {

int (*pci_config) (struct scsi_qla_host *);
void (*reset_chip) (struct scsi_qla_host *);
int (*chip_diag) (struct scsi_qla_host *);
void (*config_rings) (struct scsi_qla_host *);
void (*reset_adapter) (struct scsi_qla_host *);
int (*nvram_config) (struct scsi_qla_host *);
void (*update_fw_options) (struct scsi_qla_host *);
int (*load_risc) (struct scsi_qla_host *, uint32_t *);

char * (*pci_info_str) (struct scsi_qla_host *, char *);
char * (*fw_version_str) (struct scsi_qla_host *, char *);

irqreturn_t (*intr_handler) (int, void *, struct pt_regs *);
void (*enable_intrs) (struct scsi_qla_host *);
void (*disable_intrs) (struct scsi_qla_host *);

int (*abort_command) (struct scsi_qla_host *, srb_t *);
int (*abort_target) (struct fc_port *);
int (*fabric_login) (struct scsi_qla_host *, uint16_t, uint8_t,
uint8_t, uint8_t, uint16_t *, uint8_t);
int (*fabric_logout) (struct scsi_qla_host *, uint16_t);

uint16_t (*calc_req_entries) (uint16_t);
void (*build_iocbs) (srb_t *, cmd_entry_t *, uint16_t);
ms_iocb_entry_t * (*prep_ms_iocb) (struct scsi_qla_host *, uint32_t,
uint32_t);

uint8_t * (*read_nvram) (struct scsi_qla_host *, uint8_t *,
uint32_t, uint32_t);
int (*write_nvram) (struct scsi_qla_host *, uint8_t *, uint32_t,
uint32_t);

void (*fw_dump) (struct scsi_qla_host *, int);
void (*ascii_fw_dump) (struct scsi_qla_host *);
};

/*
* Linux Host Adapter structure
*/
Expand Down Expand Up @@ -2055,8 +2097,7 @@ typedef struct scsi_qla_host {
uint16_t rsp_ring_index; /* Current index. */
uint16_t response_q_length;

uint16_t (*calc_request_entries)(uint16_t);
void (*build_scsi_iocbs)(srb_t *, cmd_entry_t *, uint16_t);
struct isp_operations isp_ops;

/* Outstandings ISP commands. */
srb_t *outstanding_cmds[MAX_OUTSTANDING_COMMANDS];
Expand Down Expand Up @@ -2149,6 +2190,7 @@ typedef struct scsi_qla_host {

dma_addr_t gid_list_dma;
struct gid_list_info *gid_list;
int gid_list_info_size;

dma_addr_t rlc_rsp_dma;
rpt_lun_cmd_rsp_t *rlc_rsp;
Expand Down
13 changes: 13 additions & 0 deletions drivers/scsi/qla2xxx/qla_gbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ extern int qla2x00_probe_one(struct pci_dev *, struct qla_board_info *);
* Global Function Prototypes in qla_init.c source file.
*/
extern int qla2x00_initialize_adapter(scsi_qla_host_t *);

extern int qla2100_pci_config(struct scsi_qla_host *);
extern int qla2300_pci_config(struct scsi_qla_host *);
extern void qla2x00_reset_chip(struct scsi_qla_host *);
extern int qla2x00_chip_diag(struct scsi_qla_host *);
extern void qla2x00_config_rings(struct scsi_qla_host *);
extern void qla2x00_reset_adapter(struct scsi_qla_host *);
extern int qla2x00_nvram_config(struct scsi_qla_host *);
extern void qla2x00_update_fw_options(struct scsi_qla_host *);
extern int qla2x00_load_risc(struct scsi_qla_host *, uint32_t *);

extern fc_port_t *qla2x00_alloc_fcport(scsi_qla_host_t *, int);

extern int qla2x00_loop_resync(scsi_qla_host_t *);
Expand Down Expand Up @@ -205,6 +216,8 @@ extern void qla2x00_print_scsi_cmd(struct scsi_cmnd *);
/*
* Global Function Prototypes in qla_gs.c source file.
*/
extern ms_iocb_entry_t *qla2x00_prep_ms_iocb(scsi_qla_host_t *, uint32_t,
uint32_t);
extern int qla2x00_ga_nxt(scsi_qla_host_t *, fc_port_t *);
extern int qla2x00_gid_pt(scsi_qla_host_t *, sw_info_t *);
extern int qla2x00_gpn_id(scsi_qla_host_t *, sw_info_t *);
Expand Down
5 changes: 1 addition & 4 deletions drivers/scsi/qla2xxx/qla_gs.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
*/
#include "qla_def.h"

static inline ms_iocb_entry_t *
qla2x00_prep_ms_iocb(scsi_qla_host_t *, uint32_t, uint32_t);

static inline struct ct_sns_req *
qla2x00_prep_ct_req(struct ct_sns_req *, uint16_t, uint16_t);

Expand All @@ -42,7 +39,7 @@ static int qla2x00_sns_rnn_id(scsi_qla_host_t *);
*
* Returns a pointer to the @ha's ms_iocb.
*/
static inline ms_iocb_entry_t *
ms_iocb_entry_t *
qla2x00_prep_ms_iocb(scsi_qla_host_t *ha, uint32_t req_size, uint32_t rsp_size)
{
ms_iocb_entry_t *ms_pkt;
Expand Down
Loading

0 comments on commit abbd887

Please sign in to comment.