-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SCSI] bfa: Brocade BFA FC SCSI driver
Add new driver for Brocade Hardware Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
- Loading branch information
Jing Huang
authored and
James Bottomley
committed
Oct 2, 2009
1 parent
5415907
commit 7725ccf
Showing
198 changed files
with
49,189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
obj-$(CONFIG_SCSI_BFA_FC) := bfa.o | ||
|
||
bfa-y := bfad.o bfad_intr.o bfad_os.o bfad_im.o bfad_attr.o bfad_fwimg.o | ||
|
||
bfa-y += bfa_core.o bfa_ioc.o bfa_iocfc.o bfa_fcxp.o bfa_lps.o | ||
bfa-y += bfa_hw_cb.o bfa_hw_ct.o bfa_intr.o bfa_timer.o bfa_rport.o | ||
bfa-y += bfa_fcport.o bfa_port.o bfa_uf.o bfa_sgpg.o bfa_module.o bfa_ioim.o | ||
bfa-y += bfa_itnim.o bfa_fcpim.o bfa_tskim.o bfa_log.o bfa_log_module.o | ||
bfa-y += bfa_csdebug.o bfa_sm.o plog.o | ||
|
||
bfa-y += fcbuild.o fabric.o fcpim.o vfapi.o fcptm.o bfa_fcs.o bfa_fcs_port.o | ||
bfa-y += bfa_fcs_uf.o bfa_fcs_lport.o fab.o fdmi.o ms.o ns.o scn.o loop.o | ||
bfa-y += lport_api.o n2n.o rport.o rport_api.o rport_ftrs.o vport.o | ||
|
||
ccflags-y := -I$(obj) -I$(obj)/include -I$(obj)/include/cna |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (c) 2005-2009 Brocade Communications Systems, Inc. | ||
* All rights reserved | ||
* www.brocade.com | ||
* | ||
* Linux driver for Brocade Fibre Channel Host Bus Adapter. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License (GPL) Version 2 as | ||
* published by the Free Software Foundation | ||
* | ||
* 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. | ||
*/ | ||
|
||
#ifndef __BFA_CALLBACK_PRIV_H__ | ||
#define __BFA_CALLBACK_PRIV_H__ | ||
|
||
#include <cs/bfa_q.h> | ||
|
||
typedef void (*bfa_cb_cbfn_t) (void *cbarg, bfa_boolean_t complete); | ||
|
||
/** | ||
* Generic BFA callback element. | ||
*/ | ||
struct bfa_cb_qe_s { | ||
struct list_head qe; | ||
bfa_cb_cbfn_t cbfn; | ||
bfa_boolean_t once; | ||
u32 rsvd; | ||
void *cbarg; | ||
}; | ||
|
||
#define bfa_cb_queue(__bfa, __hcb_qe, __cbfn, __cbarg) do { \ | ||
(__hcb_qe)->cbfn = (__cbfn); \ | ||
(__hcb_qe)->cbarg = (__cbarg); \ | ||
list_add_tail(&(__hcb_qe)->qe, &(__bfa)->comp_q); \ | ||
} while (0) | ||
|
||
#define bfa_cb_dequeue(__hcb_qe) list_del(&(__hcb_qe)->qe) | ||
|
||
#define bfa_cb_queue_once(__bfa, __hcb_qe, __cbfn, __cbarg) do { \ | ||
(__hcb_qe)->cbfn = (__cbfn); \ | ||
(__hcb_qe)->cbarg = (__cbarg); \ | ||
if (!(__hcb_qe)->once) { \ | ||
list_add_tail((__hcb_qe), &(__bfa)->comp_q); \ | ||
(__hcb_qe)->once = BFA_TRUE; \ | ||
} \ | ||
} while (0) | ||
|
||
#define bfa_cb_queue_done(__hcb_qe) do { \ | ||
(__hcb_qe)->once = BFA_FALSE; \ | ||
} while (0) | ||
|
||
#endif /* __BFA_CALLBACK_PRIV_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
/* | ||
* Copyright (c) 2005-2009 Brocade Communications Systems, Inc. | ||
* All rights reserved | ||
* www.brocade.com | ||
* | ||
* Linux driver for Brocade Fibre Channel Host Bus Adapter. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License (GPL) Version 2 as | ||
* published by the Free Software Foundation | ||
* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* bfa_cb_ioim_macros.h BFA IOIM driver interface macros. | ||
*/ | ||
|
||
#ifndef __BFA_HCB_IOIM_MACROS_H__ | ||
#define __BFA_HCB_IOIM_MACROS_H__ | ||
|
||
#include <bfa_os_inc.h> | ||
/* | ||
* #include <linux/dma-mapping.h> | ||
* | ||
* #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> #include | ||
* <scsi/scsi_device.h> #include <scsi/scsi_host.h> | ||
*/ | ||
#include "bfad_im_compat.h" | ||
|
||
/* | ||
* task attribute values in FCP-2 FCP_CMND IU | ||
*/ | ||
#define SIMPLE_Q 0 | ||
#define HEAD_OF_Q 1 | ||
#define ORDERED_Q 2 | ||
#define ACA_Q 4 | ||
#define UNTAGGED 5 | ||
|
||
static inline lun_t | ||
bfad_int_to_lun(u32 luno) | ||
{ | ||
union { | ||
u16 scsi_lun[4]; | ||
lun_t bfa_lun; | ||
} lun; | ||
|
||
lun.bfa_lun = 0; | ||
lun.scsi_lun[0] = bfa_os_htons(luno); | ||
|
||
return (lun.bfa_lun); | ||
} | ||
|
||
/** | ||
* Get LUN for the I/O request | ||
*/ | ||
#define bfa_cb_ioim_get_lun(__dio) \ | ||
bfad_int_to_lun(((struct scsi_cmnd *)__dio)->device->lun) | ||
|
||
/** | ||
* Get CDB for the I/O request | ||
*/ | ||
static inline u8 * | ||
bfa_cb_ioim_get_cdb(struct bfad_ioim_s *dio) | ||
{ | ||
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
|
||
return ((u8 *) cmnd->cmnd); | ||
} | ||
|
||
/** | ||
* Get I/O direction (read/write) for the I/O request | ||
*/ | ||
static inline enum fcp_iodir | ||
bfa_cb_ioim_get_iodir(struct bfad_ioim_s *dio) | ||
{ | ||
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
enum dma_data_direction dmadir; | ||
|
||
dmadir = cmnd->sc_data_direction; | ||
if (dmadir == DMA_TO_DEVICE) | ||
return FCP_IODIR_WRITE; | ||
else if (dmadir == DMA_FROM_DEVICE) | ||
return FCP_IODIR_READ; | ||
else | ||
return FCP_IODIR_NONE; | ||
} | ||
|
||
/** | ||
* Get IO size in bytes for the I/O request | ||
*/ | ||
static inline u32 | ||
bfa_cb_ioim_get_size(struct bfad_ioim_s *dio) | ||
{ | ||
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
|
||
return (scsi_bufflen(cmnd)); | ||
} | ||
|
||
/** | ||
* Get timeout for the I/O request | ||
*/ | ||
static inline u8 | ||
bfa_cb_ioim_get_timeout(struct bfad_ioim_s *dio) | ||
{ | ||
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
/* | ||
* TBD: need a timeout for scsi passthru | ||
*/ | ||
if (cmnd->device->host == NULL) | ||
return 4; | ||
|
||
return 0; | ||
} | ||
|
||
/** | ||
* Get SG element for the I/O request given the SG element index | ||
*/ | ||
static inline union bfi_addr_u | ||
bfa_cb_ioim_get_sgaddr(struct bfad_ioim_s *dio, int sgeid) | ||
{ | ||
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
struct scatterlist *sge; | ||
u64 addr; | ||
|
||
sge = (struct scatterlist *)scsi_sglist(cmnd) + sgeid; | ||
addr = (u64) sg_dma_address(sge); | ||
|
||
return (*(union bfi_addr_u *) &addr); | ||
} | ||
|
||
static inline u32 | ||
bfa_cb_ioim_get_sglen(struct bfad_ioim_s *dio, int sgeid) | ||
{ | ||
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
struct scatterlist *sge; | ||
u32 len; | ||
|
||
sge = (struct scatterlist *)scsi_sglist(cmnd) + sgeid; | ||
len = sg_dma_len(sge); | ||
|
||
return len; | ||
} | ||
|
||
/** | ||
* Get Command Reference Number for the I/O request. 0 if none. | ||
*/ | ||
static inline u8 | ||
bfa_cb_ioim_get_crn(struct bfad_ioim_s *dio) | ||
{ | ||
return 0; | ||
} | ||
|
||
/** | ||
* Get SAM-3 priority for the I/O request. 0 is default. | ||
*/ | ||
static inline u8 | ||
bfa_cb_ioim_get_priority(struct bfad_ioim_s *dio) | ||
{ | ||
return 0; | ||
} | ||
|
||
/** | ||
* Get task attributes for the I/O request. Default is FCP_TASK_ATTR_SIMPLE(0). | ||
*/ | ||
static inline u8 | ||
bfa_cb_ioim_get_taskattr(struct bfad_ioim_s *dio) | ||
{ | ||
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
u8 task_attr = UNTAGGED; | ||
|
||
if (cmnd->device->tagged_supported) { | ||
switch (cmnd->tag) { | ||
case HEAD_OF_QUEUE_TAG: | ||
task_attr = HEAD_OF_Q; | ||
break; | ||
case ORDERED_QUEUE_TAG: | ||
task_attr = ORDERED_Q; | ||
break; | ||
default: | ||
task_attr = SIMPLE_Q; | ||
break; | ||
} | ||
} | ||
|
||
return task_attr; | ||
} | ||
|
||
/** | ||
* Get CDB length in bytes for the I/O request. Default is FCP_CMND_CDB_LEN(16). | ||
*/ | ||
static inline u8 | ||
bfa_cb_ioim_get_cdblen(struct bfad_ioim_s *dio) | ||
{ | ||
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
|
||
return (cmnd->cmd_len); | ||
} | ||
|
||
|
||
|
||
#endif /* __BFA_HCB_IOIM_MACROS_H__ */ |
Oops, something went wrong.