Commit a36c61f9 authored by Krishna Gudipati's avatar Krishna Gudipati Committed by James Bottomley

[SCSI] bfa: cleanup driver

We have flattened the BFA hierarchy and also reduced the number of
source and header files we used to have earlier.
Signed-off-by: default avatarKrishna Gudipati <kgudipat@brocade.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent edaed859
obj-$(CONFIG_SCSI_BFA_FC) := bfa.o 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 := bfad.o bfad_im.o bfad_attr.o bfad_debugfs.o
bfa-y += bfad_debugfs.o bfa-y += bfa_ioc.o bfa_ioc_cb.o bfa_ioc_ct.o bfa_hw_cb.o bfa_hw_ct.o
bfa-y += bfa_core.o bfa_ioc.o bfa_ioc_ct.o bfa_ioc_cb.o bfa_iocfc.o bfa_fcxp.o bfa-y += bfa_fcs.o bfa_fcs_lport.o bfa_fcs_rport.o bfa_fcs_fcpim.o bfa_fcbuild.o
bfa-y += bfa_lps.o bfa_hw_cb.o bfa_hw_ct.o bfa_intr.o bfa_timer.o bfa_rport.o bfa-y += bfa_port.o bfa_fcpim.o bfa_core.o bfa_drv.o bfa_svc.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 ccflags-y := -DBFA_PERF_BUILD
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 -DBFA_PERF_BUILD
This diff is collapsed.
/*
* 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__ */
/* /*
* Copyright (c) 2005-2009 Brocade Communications Systems, Inc. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* All rights reserved * All rights reserved
* www.brocade.com * www.brocade.com
* *
...@@ -15,37 +15,25 @@ ...@@ -15,37 +15,25 @@
* General Public License for more details. * General Public License for more details.
*/ */
/** #ifndef __BFA_HCB_IOIM_H__
* bfa_cb_ioim_macros.h BFA IOIM driver interface macros. #define __BFA_HCB_IOIM_H__
*/
#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"
#include "bfa_os_inc.h"
/* /*
* task attribute values in FCP-2 FCP_CMND IU * task attribute values in FCP-2 FCP_CMND IU
*/ */
#define SIMPLE_Q 0 #define SIMPLE_Q 0
#define HEAD_OF_Q 1 #define HEAD_OF_Q 1
#define ORDERED_Q 2 #define ORDERED_Q 2
#define ACA_Q 4 #define ACA_Q 4
#define UNTAGGED 5 #define UNTAGGED 5
static inline lun_t static inline lun_t
bfad_int_to_lun(u32 luno) bfad_int_to_lun(u32 luno)
{ {
union { union {
u16 scsi_lun[4]; u16 scsi_lun[4];
lun_t bfa_lun; lun_t bfa_lun;
} lun; } lun;
lun.bfa_lun = 0; lun.bfa_lun = 0;
...@@ -141,7 +129,7 @@ static inline u8 ...@@ -141,7 +129,7 @@ static inline u8
bfa_cb_ioim_get_taskattr(struct bfad_ioim_s *dio) bfa_cb_ioim_get_taskattr(struct bfad_ioim_s *dio)
{ {
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
u8 task_attr = UNTAGGED; u8 task_attr = UNTAGGED;
if (cmnd->device->tagged_supported) { if (cmnd->device->tagged_supported) {
switch (cmnd->tag) { switch (cmnd->tag) {
...@@ -178,4 +166,4 @@ bfa_cb_ioim_get_cdblen(struct bfad_ioim_s *dio) ...@@ -178,4 +166,4 @@ bfa_cb_ioim_get_cdblen(struct bfad_ioim_s *dio)
*/ */
#define bfa_cb_ioim_get_reqq(__dio) BFA_FALSE #define bfa_cb_ioim_get_reqq(__dio) BFA_FALSE
#endif /* __BFA_HCB_IOIM_MACROS_H__ */ #endif /* __BFA_HCB_IOIM_H__ */
This diff is collapsed.
This diff is collapsed.
/* /*
* Copyright (c) 2005-2009 Brocade Communications Systems, Inc. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* All rights reserved * All rights reserved
* www.brocade.com * www.brocade.com
* *
...@@ -14,10 +14,19 @@ ...@@ -14,10 +14,19 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
*/ */
#ifndef __BFA_TRC_H__
#define __BFA_TRC_H__
#include <bfa_os_inc.h> /**
* bfa_cs.h BFA common services
*/
#ifndef __BFA_CS_H__
#define __BFA_CS_H__
#include "bfa_os_inc.h"
/**
* BFA TRC
*/
#ifndef BFA_TRC_MAX #ifndef BFA_TRC_MAX
#define BFA_TRC_MAX (4 * 1024) #define BFA_TRC_MAX (4 * 1024)
...@@ -45,7 +54,6 @@ struct bfa_trc_s { ...@@ -45,7 +54,6 @@ struct bfa_trc_s {
} data; } data;
}; };
struct bfa_trc_mod_s { struct bfa_trc_mod_s {
u32 head; u32 head;
u32 tail; u32 tail;
...@@ -56,25 +64,11 @@ struct bfa_trc_mod_s { ...@@ -56,25 +64,11 @@ struct bfa_trc_mod_s {
struct bfa_trc_s trc[BFA_TRC_MAX]; struct bfa_trc_s trc[BFA_TRC_MAX];
}; };
enum { enum {
BFA_TRC_FW = 1, /* firmware modules */ BFA_TRC_HAL = 1, /* BFA modules */
BFA_TRC_HAL = 2, /* BFA modules */ BFA_TRC_FCS = 2, /* BFA FCS modules */
BFA_TRC_FCS = 3, /* BFA FCS modules */ BFA_TRC_LDRV = 3, /* Linux driver modules */
BFA_TRC_LDRV = 4, /* Linux driver modules */ BFA_TRC_CNA = 4, /* Common modules */
BFA_TRC_SDRV = 5, /* Solaris driver modules */
BFA_TRC_VDRV = 6, /* vmware driver modules */
BFA_TRC_WDRV = 7, /* windows driver modules */
BFA_TRC_AEN = 8, /* AEN module */
BFA_TRC_BIOS = 9, /* bios driver modules */
BFA_TRC_EFI = 10, /* EFI driver modules */
BNA_TRC_WDRV = 11, /* BNA windows driver modules */
BNA_TRC_VDRV = 12, /* BNA vmware driver modules */
BNA_TRC_SDRV = 13, /* BNA Solaris driver modules */
BNA_TRC_LDRV = 14, /* BNA Linux driver modules */
BNA_TRC_HAL = 15, /* BNA modules */
BFA_TRC_CNA = 16, /* Common modules */
BNA_TRC_IMDRV = 17 /* BNA windows intermediate driver modules */
}; };
#define BFA_TRC_MOD_SH 10 #define BFA_TRC_MOD_SH 10
#define BFA_TRC_MOD(__mod) ((BFA_TRC_ ## __mod) << BFA_TRC_MOD_SH) #define BFA_TRC_MOD(__mod) ((BFA_TRC_ ## __mod) << BFA_TRC_MOD_SH)
...@@ -89,18 +83,8 @@ enum { ...@@ -89,18 +83,8 @@ enum {
#define bfa_trc32(_trcp, _data) \ #define bfa_trc32(_trcp, _data) \
__bfa_trc((_trcp)->trcmod, __trc_fileno, __LINE__, (u32)_data) __bfa_trc((_trcp)->trcmod, __trc_fileno, __LINE__, (u32)_data)
#ifndef BFA_BOOT_BUILD
#define bfa_trc(_trcp, _data) \ #define bfa_trc(_trcp, _data) \
__bfa_trc((_trcp)->trcmod, __trc_fileno, __LINE__, (u64)_data) __bfa_trc((_trcp)->trcmod, __trc_fileno, __LINE__, (u64)_data)
#else
void bfa_boot_trc(struct bfa_trc_mod_s *trcmod, u16 fileno,
u16 line, u32 data);
#define bfa_trc(_trcp, _data) \
bfa_boot_trc((_trcp)->trcmod, __trc_fileno, __LINE__, (u32)_data)
#endif
static inline void static inline void
bfa_trc_init(struct bfa_trc_mod_s *trcm) bfa_trc_init(struct bfa_trc_mod_s *trcm)
...@@ -109,7 +93,6 @@ bfa_trc_init(struct bfa_trc_mod_s *trcm) ...@@ -109,7 +93,6 @@ bfa_trc_init(struct bfa_trc_mod_s *trcm)
trcm->ntrc = BFA_TRC_MAX; trcm->ntrc = BFA_TRC_MAX;
} }
static inline void static inline void
bfa_trc_stop(struct bfa_trc_mod_s *trcm) bfa_trc_stop(struct bfa_trc_mod_s *trcm)
{ {
...@@ -127,7 +110,7 @@ static inline void ...@@ -127,7 +110,7 @@ static inline void
__bfa_trc(struct bfa_trc_mod_s *trcm, int fileno, int line, u64 data) __bfa_trc(struct bfa_trc_mod_s *trcm, int fileno, int line, u64 data)
{ {
int tail = trcm->tail; int tail = trcm->tail;
struct bfa_trc_s *trc = &trcm->trc[tail]; struct bfa_trc_s *trc = &trcm->trc[tail];
if (trcm->stopped) if (trcm->stopped)
return; return;
...@@ -172,5 +155,210 @@ __bfa_trc32(struct bfa_trc_mod_s *trcm, int fileno, int line, u32 data) ...@@ -172,5 +155,210 @@ __bfa_trc32(struct bfa_trc_mod_s *trcm, int fileno, int line, u32 data)
#define bfa_trc_fp(_trcp, _data) #define bfa_trc_fp(_trcp, _data)
#endif #endif
#endif /* __BFA_TRC_H__ */ /**
* @ BFA LOG interfaces
*/
#define bfa_assert(__cond) do { \
if (!(__cond)) { \
printk(KERN_ERR "assert(%s) failed at %s:%d\\n", \
#__cond, __FILE__, __LINE__); \
} \
} while (0)
#define bfa_sm_fault(__mod, __event) do { \
bfa_trc(__mod, (((u32)0xDEAD << 16) | __event)); \
printk(KERN_ERR "Assertion failure: %s:%d: %d", \
__FILE__, __LINE__, (__event)); \
} while (0)
#ifndef BFA_PERF_BUILD
#define bfa_assert_fp(__cond) bfa_assert(__cond)
#else
#define bfa_assert_fp(__cond)
#endif
/* BFA queue definitions */
#define bfa_q_first(_q) ((void *)(((struct list_head *) (_q))->next))
#define bfa_q_next(_qe) (((struct list_head *) (_qe))->next)
#define bfa_q_prev(_qe) (((struct list_head *) (_qe))->prev)
/*
* bfa_q_qe_init - to initialize a queue element
*/
#define bfa_q_qe_init(_qe) { \
bfa_q_next(_qe) = (struct list_head *) NULL; \
bfa_q_prev(_qe) = (struct list_head *) NULL; \
}
/*
* bfa_q_deq - dequeue an element from head of the queue
*/
#define bfa_q_deq(_q, _qe) { \
if (!list_empty(_q)) { \
(*((struct list_head **) (_qe))) = bfa_q_next(_q); \
bfa_q_prev(bfa_q_next(*((struct list_head **) _qe))) = \
(struct list_head *) (_q); \
bfa_q_next(_q) = bfa_q_next(*((struct list_head **) _qe));\
BFA_Q_DBG_INIT(*((struct list_head **) _qe)); \
} else { \
*((struct list_head **) (_qe)) = (struct list_head *) NULL;\
} \
}
/*
* bfa_q_deq_tail - dequeue an element from tail of the queue
*/
#define bfa_q_deq_tail(_q, _qe) { \
if (!list_empty(_q)) { \
*((struct list_head **) (_qe)) = bfa_q_prev(_q); \
bfa_q_next(bfa_q_prev(*((struct list_head **) _qe))) = \
(struct list_head *) (_q); \
bfa_q_prev(_q) = bfa_q_prev(*(struct list_head **) _qe);\
BFA_Q_DBG_INIT(*((struct list_head **) _qe)); \
} else { \
*((struct list_head **) (_qe)) = (struct list_head *) NULL;\
} \
}
static inline int
bfa_q_is_on_q_func(struct list_head *q, struct list_head *qe)
{
struct list_head *tqe;
tqe = bfa_q_next(q);
while (tqe != q) {
if (tqe == qe)
return 1;
tqe = bfa_q_next(tqe);
if (tqe == NULL)
break;
}
return 0;
}
/*
* #ifdef BFA_DEBUG (Using bfa_assert to check for debug_build is not
* consistent across modules)
*/
#ifndef BFA_PERF_BUILD
#define BFA_Q_DBG_INIT(_qe) bfa_q_qe_init(_qe)
#else
#define BFA_Q_DBG_INIT(_qe)
#endif
#define bfa_q_is_on_q(_q, _qe) \
bfa_q_is_on_q_func(_q, (struct list_head *)(_qe))
/**
* @ BFA state machine interfaces
*/
typedef void (*bfa_sm_t)(void *sm, int event);
/**
* oc - object class eg. bfa_ioc
* st - state, eg. reset
* otype - object type, eg. struct bfa_ioc_s
* etype - object type, eg. enum ioc_event
*/
#define bfa_sm_state_decl(oc, st, otype, etype) \
static void oc ## _sm_ ## st(otype * fsm, etype event)
#define bfa_sm_set_state(_sm, _state) ((_sm)->sm = (bfa_sm_t)(_state))
#define bfa_sm_send_event(_sm, _event) ((_sm)->sm((_sm), (_event)))
#define bfa_sm_get_state(_sm) ((_sm)->sm)
#define bfa_sm_cmp_state(_sm, _state) ((_sm)->sm == (bfa_sm_t)(_state))
/**
* For converting from state machine function to state encoding.
*/
struct bfa_sm_table_s {
bfa_sm_t sm; /* state machine function */
int state; /* state machine encoding */
char *name; /* state name for display */
};
#define BFA_SM(_sm) ((bfa_sm_t)(_sm))
/**
* State machine with entry actions.
*/
typedef void (*bfa_fsm_t)(void *fsm, int event);
/**
* oc - object class eg. bfa_ioc
* st - state, eg. reset
* otype - object type, eg. struct bfa_ioc_s
* etype - object type, eg. enum ioc_event
*/
#define bfa_fsm_state_decl(oc, st, otype, etype) \
static void oc ## _sm_ ## st(otype * fsm, etype event); \
static void oc ## _sm_ ## st ## _entry(otype * fsm)
#define bfa_fsm_set_state(_fsm, _state) do { \
(_fsm)->fsm = (bfa_fsm_t)(_state); \
_state ## _entry(_fsm); \
} while (0)
#define bfa_fsm_send_event(_fsm, _event) ((_fsm)->fsm((_fsm), (_event)))
#define bfa_fsm_get_state(_fsm) ((_fsm)->fsm)
#define bfa_fsm_cmp_state(_fsm, _state) \
((_fsm)->fsm == (bfa_fsm_t)(_state))
static inline int
bfa_sm_to_state(struct bfa_sm_table_s *smt, bfa_sm_t sm)
{
int i = 0;
while (smt[i].sm && smt[i].sm != sm)
i++;
return smt[i].state;
}
/**
* @ Generic wait counter.
*/
typedef void (*bfa_wc_resume_t) (void *cbarg);
struct bfa_wc_s {
bfa_wc_resume_t wc_resume;
void *wc_cbarg;
int wc_count;
};
static inline void
bfa_wc_up(struct bfa_wc_s *wc)
{
wc->wc_count++;
}
static inline void
bfa_wc_down(struct bfa_wc_s *wc)
{
wc->wc_count--;
if (wc->wc_count == 0)
wc->wc_resume(wc->wc_cbarg);
}
/**
* Initialize a waiting counter.
*/
static inline void
bfa_wc_init(struct bfa_wc_s *wc, bfa_wc_resume_t wc_resume, void *wc_cbarg)
{
wc->wc_resume = wc_resume;
wc->wc_cbarg = wc_cbarg;
wc->wc_count = 0;
bfa_wc_up(wc);
}
/**
* Wait for counter to reach zero
*/
static inline void
bfa_wc_wait(struct bfa_wc_s *wc)
{
bfa_wc_down(wc);
}
#endif /* __BFA_CS_H__ */
/*
* 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.
*/
#include <cs/bfa_debug.h>
#include <bfa_os_inc.h>
#include <cs/bfa_q.h>
#include <log/bfa_log_hal.h>
/**
* cs_debug_api
*/
void
bfa_panic(int line, char *file, char *panicstr)
{
bfa_log(NULL, BFA_LOG_HAL_ASSERT, file, line, panicstr);
bfa_os_panic();
}
void
bfa_sm_panic(struct bfa_log_mod_s *logm, int line, char *file, int event)
{
bfa_log(logm, BFA_LOG_HAL_SM_ASSERT, file, line, event);
bfa_os_panic();
}
int
bfa_q_is_on_q_func(struct list_head *q, struct list_head *qe)
{
struct list_head *tqe;
tqe = bfa_q_next(q);
while (tqe != q) {
if (tqe == qe)
return 1;
tqe = bfa_q_next(tqe);
if (tqe == NULL)
break;
}
return 0;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* /*
* Copyright (c) 2005-2009 Brocade Communications Systems, Inc. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* All rights reserved * All rights reserved
* www.brocade.com * www.brocade.com
* *
...@@ -14,10 +14,8 @@ ...@@ -14,10 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
*/ */
#include <bfa.h>
#include <defs/bfa_defs_pci.h> #include "bfa_modules.h"
#include <cs/bfa_debug.h>
#include <bfa_iocfc.h>
/** /**
* BFA module list terminated by NULL * BFA module list terminated by NULL
...@@ -30,9 +28,6 @@ struct bfa_module_s *hal_mods[] = { ...@@ -30,9 +28,6 @@ struct bfa_module_s *hal_mods[] = {
&hal_mod_uf, &hal_mod_uf,
&hal_mod_rport, &hal_mod_rport,
&hal_mod_fcpim, &hal_mod_fcpim,
#ifdef BFA_CFG_PBIND
&hal_mod_pbind,
#endif
NULL NULL
}; };
...@@ -74,17 +69,39 @@ bfa_isr_func_t bfa_isrs[BFI_MC_MAX] = { ...@@ -74,17 +69,39 @@ bfa_isr_func_t bfa_isrs[BFI_MC_MAX] = {
bfa_isr_unhandled, /* --------- */ bfa_isr_unhandled, /* --------- */
}; };
/** /**
* Message handlers for mailbox command classes * Message handlers for mailbox command classes
*/ */
bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[BFI_MC_MAX] = { bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[BFI_MC_MAX] = {
NULL, NULL,
NULL, /* BFI_MC_IOC */ NULL, /* BFI_MC_IOC */
NULL, /* BFI_MC_DIAG */ NULL, /* BFI_MC_DIAG */
NULL, /* BFI_MC_FLASH */ NULL, /* BFI_MC_FLASH */
NULL, /* BFI_MC_CEE */ NULL, /* BFI_MC_CEE */
NULL, /* BFI_MC_PORT */ NULL, /* BFI_MC_PORT */
bfa_iocfc_isr, /* BFI_MC_IOCFC */ bfa_iocfc_isr, /* BFI_MC_IOCFC */
NULL, NULL,
}; };
void
bfa_com_port_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi)
{
struct bfa_port_s *port = &bfa->modules.port;
u32 dm_len;
u8 *dm_kva;
u64 dm_pa;
dm_len = bfa_port_meminfo();
dm_kva = bfa_meminfo_dma_virt(mi);
dm_pa = bfa_meminfo_dma_phys(mi);
memset(port, 0, sizeof(struct bfa_port_s));
bfa_port_attach(port, &bfa->ioc, bfa, bfa->trcmod);
bfa_port_mem_claim(port, dm_kva, dm_pa);
bfa_meminfo_dma_virt(mi) = dm_kva + dm_len;
bfa_meminfo_dma_phys(mi) = dm_pa + dm_len;
}
This diff is collapsed.
This diff is collapsed.
/*
* 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_FCPIM_PRIV_H__
#define __BFA_FCPIM_PRIV_H__
#include <bfa_fcpim.h>
#include <defs/bfa_defs_fcpim.h>
#include <cs/bfa_wc.h>
#include "bfa_sgpg_priv.h"
#define BFA_ITNIM_MIN 32
#define BFA_ITNIM_MAX 1024
#define BFA_IOIM_MIN 8
#define BFA_IOIM_MAX 2000
#define BFA_TSKIM_MIN 4
#define BFA_TSKIM_MAX 512
#define BFA_FCPIM_PATHTOV_DEF (30 * 1000) /* in millisecs */
#define BFA_FCPIM_PATHTOV_MAX (90 * 1000) /* in millisecs */
#define bfa_fcpim_stats(__fcpim, __stats) \
((__fcpim)->stats.__stats++)
struct bfa_fcpim_mod_s {
struct bfa_s *bfa;
struct bfa_itnim_s *itnim_arr;
struct bfa_ioim_s *ioim_arr;
struct bfa_ioim_sp_s *ioim_sp_arr;
struct bfa_tskim_s *tskim_arr;
struct bfa_dma_s snsbase;
int num_itnims;
int num_ioim_reqs;
int num_tskim_reqs;
u32 path_tov;
u16 q_depth;
u8 reqq; /* Request queue to be used */
u8 rsvd;
struct list_head itnim_q; /* queue of active itnim */
struct list_head ioim_free_q; /* free IO resources */
struct list_head ioim_resfree_q; /* IOs waiting for f/w */
struct list_head ioim_comp_q; /* IO global comp Q */
struct list_head tskim_free_q;
u32 ios_active; /* current active IOs */
u32 delay_comp;
struct bfa_fcpim_stats_s stats;
bfa_boolean_t ioredirect;
};
struct bfa_ioim_s;
struct bfa_tskim_s;
/**
* BFA IO (initiator mode)
*/
struct bfa_ioim_s {
struct list_head qe; /* queue elememt */
bfa_sm_t sm; /* BFA ioim state machine */
struct bfa_s *bfa; /* BFA module */
struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */
struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
struct bfad_ioim_s *dio; /* driver IO handle */
u16 iotag; /* FWI IO tag */
u16 abort_tag; /* unqiue abort request tag */
u16 nsges; /* number of SG elements */
u16 nsgpgs; /* number of SG pages */
struct bfa_sgpg_s *sgpg; /* first SG page */
struct list_head sgpg_q; /* allocated SG pages */
struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */
bfa_cb_cbfn_t io_cbfn; /* IO completion handler */
struct bfa_ioim_sp_s *iosp; /* slow-path IO handling */
u8 reqq; /* Request queue for I/O */
};
struct bfa_ioim_sp_s {
struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */
u8 *snsinfo; /* sense info for this IO */
struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */
struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
bfa_boolean_t abort_explicit; /* aborted by OS */
struct bfa_tskim_s *tskim; /* Relevant TM cmd */
};
/**
* BFA Task management command (initiator mode)
*/
struct bfa_tskim_s {
struct list_head qe;
bfa_sm_t sm;
struct bfa_s *bfa; /* BFA module */
struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */
struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */
bfa_boolean_t notify; /* notify itnim on TM comp */
lun_t lun; /* lun if applicable */
enum fcp_tm_cmnd tm_cmnd; /* task management command */
u16 tsk_tag; /* FWI IO tag */
u8 tsecs; /* timeout in seconds */
struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
struct list_head io_q; /* queue of affected IOs */
struct bfa_wc_s wc; /* waiting counter */
struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */
enum bfi_tskim_status tsk_status; /* TM status */
};
/**
* BFA i-t-n (initiator mode)
*/
struct bfa_itnim_s {
struct list_head qe; /* queue element */
bfa_sm_t sm; /* i-t-n im BFA state machine */
struct bfa_s *bfa; /* bfa instance */
struct bfa_rport_s *rport; /* bfa rport */
void *ditn; /* driver i-t-n structure */
struct bfi_mhdr_s mhdr; /* pre-built mhdr */
u8 msg_no; /* itnim/rport firmware handle */
u8 reqq; /* CQ for requests */
struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */
struct list_head pending_q; /* queue of pending IO requests*/
struct list_head io_q; /* queue of active IO requests */
struct list_head io_cleanup_q; /* IO being cleaned up */
struct list_head tsk_q; /* queue of active TM commands */
struct list_head delay_comp_q;/* queue of failed inflight cmds */
bfa_boolean_t seq_rec; /* SQER supported */
bfa_boolean_t is_online; /* itnim is ONLINE for IO */
bfa_boolean_t iotov_active; /* IO TOV timer is active */
struct bfa_wc_s wc; /* waiting counter */
struct bfa_timer_s timer; /* pending IO TOV */
struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
struct bfa_fcpim_mod_s *fcpim; /* fcpim module */
struct bfa_itnim_hal_stats_s stats;
struct bfa_itnim_latency_s io_latency;
};
#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online)
#define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod)
#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \
(&fcpim->ioim_arr[_iotag])
#define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \
(&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)])
/*
* function prototypes
*/
void bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim,
struct bfa_meminfo_s *minfo);
void bfa_ioim_detach(struct bfa_fcpim_mod_s *fcpim);
void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
void bfa_ioim_good_comp_isr(struct bfa_s *bfa,
struct bfi_msg_s *msg);
void bfa_ioim_cleanup(struct bfa_ioim_s *ioim);
void bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim,
struct bfa_tskim_s *tskim);
void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim);
void bfa_ioim_tov(struct bfa_ioim_s *ioim);
void bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim,
struct bfa_meminfo_s *minfo);
void bfa_tskim_detach(struct bfa_fcpim_mod_s *fcpim);
void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
void bfa_tskim_iodone(struct bfa_tskim_s *tskim);
void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim);
void bfa_tskim_cleanup(struct bfa_tskim_s *tskim);
void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
u32 *dm_len);
void bfa_itnim_attach(struct bfa_fcpim_mod_s *fcpim,
struct bfa_meminfo_s *minfo);
void bfa_itnim_detach(struct bfa_fcpim_mod_s *fcpim);
void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim);
void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
void bfa_itnim_iodone(struct bfa_itnim_s *itnim);
void bfa_itnim_tskdone(struct bfa_itnim_s *itnim);
bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim);
#endif /* __BFA_FCPIM_PRIV_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* 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_FWIMG_PRIV_H__
#define __BFA_FWIMG_PRIV_H__
#define BFI_FLASH_CHUNK_SZ 256 /* Flash chunk size */
#define BFI_FLASH_CHUNK_SZ_WORDS (BFI_FLASH_CHUNK_SZ/sizeof(u32))
/**
* BFI FW image type
*/
enum {
BFI_IMAGE_CB_FC,
BFI_IMAGE_CT_FC,
BFI_IMAGE_CT_CNA,
BFI_IMAGE_MAX,
};
extern u32 *bfi_image_get_chunk(int type, uint32_t off);
extern u32 bfi_image_get_size(int type);
extern u32 bfi_image_ct_fc_size;
extern u32 bfi_image_ct_cna_size;
extern u32 bfi_image_cb_fc_size;
extern u32 *bfi_image_ct_fc;
extern u32 *bfi_image_ct_cna;
extern u32 *bfi_image_cb_fc;
#endif /* __BFA_FWIMG_PRIV_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment