Skip to content

Commit 3d7fc66

Browse files
Krishna GudipatiJames Bottomley
authored andcommitted
[SCSI] bfa: Added HBA diagnostics support.
- Added diagnostics sub-module to BFA. - Implemented interface to perform memtest/loopback test and some other diagnostics tests. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent 5a54b1d commit 3d7fc66

11 files changed

Lines changed: 1665 additions & 9 deletions

File tree

‎drivers/scsi/bfa/bfa_core.c‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ BFA_TRC_FILE(HAL, CORE);
2525
* BFA module list terminated by NULL
2626
*/
2727
static struct bfa_module_s *hal_mods[] = {
28+
&hal_mod_fcdiag,
2829
&hal_mod_sgpg,
2930
&hal_mod_fcport,
3031
&hal_mod_fcxp,
@@ -41,7 +42,7 @@ static struct bfa_module_s *hal_mods[] = {
4142
static bfa_isr_func_t bfa_isrs[BFI_MC_MAX] = {
4243
bfa_isr_unhandled, /* NONE */
4344
bfa_isr_unhandled, /* BFI_MC_IOC */
44-
bfa_isr_unhandled, /* BFI_MC_DIAG */
45+
bfa_fcdiag_intr, /* BFI_MC_DIAG */
4546
bfa_isr_unhandled, /* BFI_MC_FLASH */
4647
bfa_isr_unhandled, /* BFI_MC_CEE */
4748
bfa_fcport_isr, /* BFI_MC_FCPORT */
@@ -143,6 +144,16 @@ bfa_com_flash_attach(struct bfa_s *bfa, bfa_boolean_t mincfg)
143144
flash_dma->dma_curp, mincfg);
144145
}
145146

147+
static void
148+
bfa_com_diag_attach(struct bfa_s *bfa)
149+
{
150+
struct bfa_diag_s *diag = BFA_DIAG_MOD(bfa);
151+
struct bfa_mem_dma_s *diag_dma = BFA_MEM_DIAG_DMA(bfa);
152+
153+
bfa_diag_attach(diag, &bfa->ioc, bfa, bfa_fcport_beacon, bfa->trcmod);
154+
bfa_diag_memclaim(diag, diag_dma->kva_curp, diag_dma->dma_curp);
155+
}
156+
146157
/*
147158
* BFA IOC FC related definitions
148159
*/
@@ -1383,6 +1394,7 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo,
13831394
struct bfa_mem_dma_s *cee_dma = BFA_MEM_CEE_DMA(bfa);
13841395
struct bfa_mem_dma_s *sfp_dma = BFA_MEM_SFP_DMA(bfa);
13851396
struct bfa_mem_dma_s *flash_dma = BFA_MEM_FLASH_DMA(bfa);
1397+
struct bfa_mem_dma_s *diag_dma = BFA_MEM_DIAG_DMA(bfa);
13861398

13871399
WARN_ON((cfg == NULL) || (meminfo == NULL));
13881400

@@ -1404,6 +1416,7 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo,
14041416
bfa_mem_dma_setup(meminfo, sfp_dma, bfa_sfp_meminfo());
14051417
bfa_mem_dma_setup(meminfo, flash_dma,
14061418
bfa_flash_meminfo(cfg->drvcfg.min_cfg));
1419+
bfa_mem_dma_setup(meminfo, diag_dma, bfa_diag_meminfo());
14071420
}
14081421

14091422
/*
@@ -1474,6 +1487,7 @@ bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
14741487
bfa_com_cee_attach(bfa);
14751488
bfa_com_sfp_attach(bfa);
14761489
bfa_com_flash_attach(bfa, cfg->drvcfg.min_cfg);
1490+
bfa_com_diag_attach(bfa);
14771491
}
14781492

14791493
/*

‎drivers/scsi/bfa/bfa_defs.h‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,27 +132,35 @@ enum bfa_status {
132132
BFA_STATUS_EPROTOCOL = 6, /* Protocol error */
133133
BFA_STATUS_SFP_UNSUPP = 10, /* Unsupported SFP - Replace SFP */
134134
BFA_STATUS_UNKNOWN_VFID = 11, /* VF_ID not found */
135+
BFA_STATUS_DATACORRUPTED = 12, /* Diag returned data corrupted */
135136
BFA_STATUS_DEVBUSY = 13, /* Device busy - Retry operation */
137+
BFA_STATUS_HDMA_FAILED = 16, /* Host dma failed contact support */
136138
BFA_STATUS_FLASH_BAD_LEN = 17, /* Flash bad length */
137139
BFA_STATUS_UNKNOWN_LWWN = 18, /* LPORT PWWN not found */
138140
BFA_STATUS_UNKNOWN_RWWN = 19, /* RPORT PWWN not found */
139141
BFA_STATUS_VPORT_EXISTS = 21, /* VPORT already exists */
140142
BFA_STATUS_VPORT_MAX = 22, /* Reached max VPORT supported limit */
141143
BFA_STATUS_UNSUPP_SPEED = 23, /* Invalid Speed Check speed setting */
142144
BFA_STATUS_INVLD_DFSZ = 24, /* Invalid Max data field size */
145+
BFA_STATUS_CMD_NOTSUPP = 26, /* Command/API not supported */
143146
BFA_STATUS_FABRIC_RJT = 29, /* Reject from attached fabric */
144147
BFA_STATUS_PORT_OFFLINE = 34, /* Port is not online */
145148
BFA_STATUS_VPORT_WWN_BP = 46, /* WWN is same as base port's WWN */
149+
BFA_STATUS_PORT_NOT_DISABLED = 47, /* Port not disabled disable port */
146150
BFA_STATUS_NO_FCPIM_NEXUS = 52, /* No FCP Nexus exists with the rport */
147151
BFA_STATUS_IOC_FAILURE = 56, /* IOC failure - Retry, if persists
148152
* contact support */
149153
BFA_STATUS_INVALID_WWN = 57, /* Invalid WWN */
154+
BFA_STATUS_ADAPTER_ENABLED = 60, /* Adapter is not disabled */
150155
BFA_STATUS_IOC_NON_OP = 61, /* IOC is not operational */
151156
BFA_STATUS_VERSION_FAIL = 70, /* Application/Driver version mismatch */
152157
BFA_STATUS_DIAG_BUSY = 71, /* diag busy */
158+
BFA_STATUS_BEACON_ON = 72, /* Port Beacon already on */
153159
BFA_STATUS_ENOFSAVE = 78, /* No saved firmware trace */
154160
BFA_STATUS_IOC_DISABLED = 82, /* IOC is already disabled */
155161
BFA_STATUS_NO_SFP_DEV = 89, /* No SFP device check or replace SFP */
162+
BFA_STATUS_MEMTEST_FAILED = 90, /* Memory test failed contact support */
163+
BFA_STATUS_LEDTEST_OP = 109, /* LED test is operating */
156164
BFA_STATUS_INVALID_MAC = 134, /* Invalid MAC address */
157165
BFA_STATUS_PBC = 154, /* Operation not allowed for pre-boot
158166
* configuration */
@@ -881,6 +889,56 @@ struct bfa_flash_attr_s {
881889
struct bfa_flash_part_attr_s part[BFA_FLASH_PART_MAX];
882890
};
883891

892+
/*
893+
* DIAG module specific
894+
*/
895+
#define LB_PATTERN_DEFAULT 0xB5B5B5B5
896+
#define QTEST_CNT_DEFAULT 10
897+
#define QTEST_PAT_DEFAULT LB_PATTERN_DEFAULT
898+
899+
struct bfa_diag_memtest_s {
900+
u8 algo;
901+
u8 rsvd[7];
902+
};
903+
904+
struct bfa_diag_memtest_result {
905+
u32 status;
906+
u32 addr;
907+
u32 exp; /* expect value read from reg */
908+
u32 act; /* actually value read */
909+
u32 err_status; /* error status reg */
910+
u32 err_status1; /* extra error info reg */
911+
u32 err_addr; /* error address reg */
912+
u8 algo;
913+
u8 rsv[3];
914+
};
915+
916+
struct bfa_diag_loopback_result_s {
917+
u32 numtxmfrm; /* no. of transmit frame */
918+
u32 numosffrm; /* no. of outstanding frame */
919+
u32 numrcvfrm; /* no. of received good frame */
920+
u32 badfrminf; /* mis-match info */
921+
u32 badfrmnum; /* mis-match fram number */
922+
u8 status; /* loopback test result */
923+
u8 rsvd[3];
924+
};
925+
926+
struct bfa_diag_ledtest_s {
927+
u32 cmd; /* bfa_led_op_t */
928+
u32 color; /* bfa_led_color_t */
929+
u16 freq; /* no. of blinks every 10 secs */
930+
u8 led; /* bitmap of LEDs to be tested */
931+
u8 rsvd[5];
932+
};
933+
934+
struct bfa_diag_loopback_s {
935+
u32 loopcnt;
936+
u32 pattern;
937+
u8 lb_mode; /* bfa_port_opmode_t */
938+
u8 speed; /* bfa_port_speed_t */
939+
u8 rsvd[2];
940+
};
941+
884942
#pragma pack()
885943

886944
#endif /* __BFA_DEFS_H__ */

0 commit comments

Comments
 (0)