aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfi.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/bfi.h')
-rw-r--r--drivers/scsi/bfa/bfi.h637
1 files changed, 595 insertions, 42 deletions
diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h
index 72b69a0c3b51..1e258d5f8aec 100644
--- a/drivers/scsi/bfa/bfi.h
+++ b/drivers/scsi/bfa/bfi.h
@@ -23,17 +23,29 @@
23 23
24#pragma pack(1) 24#pragma pack(1)
25 25
26/* Per dma segment max size */
27#define BFI_MEM_DMA_SEG_SZ (131072)
28
29/* Get number of dma segments required */
30#define BFI_MEM_DMA_NSEGS(_num_reqs, _req_sz) \
31 ((u16)(((((_num_reqs) * (_req_sz)) + BFI_MEM_DMA_SEG_SZ - 1) & \
32 ~(BFI_MEM_DMA_SEG_SZ - 1)) / BFI_MEM_DMA_SEG_SZ))
33
34/* Get num dma reqs - that fit in a segment */
35#define BFI_MEM_NREQS_SEG(_rqsz) (BFI_MEM_DMA_SEG_SZ / (_rqsz))
36
37/* Get segment num from tag */
38#define BFI_MEM_SEG_FROM_TAG(_tag, _rqsz) ((_tag) / BFI_MEM_NREQS_SEG(_rqsz))
39
40/* Get dma req offset in a segment */
41#define BFI_MEM_SEG_REQ_OFFSET(_tag, _sz) \
42 ((_tag) - (BFI_MEM_SEG_FROM_TAG(_tag, _sz) * BFI_MEM_NREQS_SEG(_sz)))
43
26/* 44/*
27 * BFI FW image type 45 * BFI FW image type
28 */ 46 */
29#define BFI_FLASH_CHUNK_SZ 256 /* Flash chunk size */ 47#define BFI_FLASH_CHUNK_SZ 256 /* Flash chunk size */
30#define BFI_FLASH_CHUNK_SZ_WORDS (BFI_FLASH_CHUNK_SZ/sizeof(u32)) 48#define BFI_FLASH_CHUNK_SZ_WORDS (BFI_FLASH_CHUNK_SZ/sizeof(u32))
31enum {
32 BFI_IMAGE_CB_FC,
33 BFI_IMAGE_CT_FC,
34 BFI_IMAGE_CT_CNA,
35 BFI_IMAGE_MAX,
36};
37 49
38/* 50/*
39 * Msg header common to all msgs 51 * Msg header common to all msgs
@@ -43,17 +55,20 @@ struct bfi_mhdr_s {
43 u8 msg_id; /* msg opcode with in the class */ 55 u8 msg_id; /* msg opcode with in the class */
44 union { 56 union {
45 struct { 57 struct {
46 u8 rsvd; 58 u8 qid;
47 u8 lpu_id; /* msg destination */ 59 u8 fn_lpu; /* msg destination */
48 } h2i; 60 } h2i;
49 u16 i2htok; /* token in msgs to host */ 61 u16 i2htok; /* token in msgs to host */
50 } mtag; 62 } mtag;
51}; 63};
52 64
53#define bfi_h2i_set(_mh, _mc, _op, _lpuid) do { \ 65#define bfi_fn_lpu(__fn, __lpu) ((__fn) << 1 | (__lpu))
66#define bfi_mhdr_2_fn(_mh) ((_mh)->mtag.h2i.fn_lpu >> 1)
67
68#define bfi_h2i_set(_mh, _mc, _op, _fn_lpu) do { \
54 (_mh).msg_class = (_mc); \ 69 (_mh).msg_class = (_mc); \
55 (_mh).msg_id = (_op); \ 70 (_mh).msg_id = (_op); \
56 (_mh).mtag.h2i.lpu_id = (_lpuid); \ 71 (_mh).mtag.h2i.fn_lpu = (_fn_lpu); \
57} while (0) 72} while (0)
58 73
59#define bfi_i2h_set(_mh, _mc, _op, _i2htok) do { \ 74#define bfi_i2h_set(_mh, _mc, _op, _i2htok) do { \
@@ -101,7 +116,7 @@ union bfi_addr_u {
101}; 116};
102 117
103/* 118/*
104 * Scatter Gather Element 119 * Scatter Gather Element used for fast-path IO requests
105 */ 120 */
106struct bfi_sge_s { 121struct bfi_sge_s {
107#ifdef __BIG_ENDIAN 122#ifdef __BIG_ENDIAN
@@ -116,6 +131,14 @@ struct bfi_sge_s {
116 union bfi_addr_u sga; 131 union bfi_addr_u sga;
117}; 132};
118 133
134/**
135 * Generic DMA addr-len pair.
136 */
137struct bfi_alen_s {
138 union bfi_addr_u al_addr; /* DMA addr of buffer */
139 u32 al_len; /* length of buffer */
140};
141
119/* 142/*
120 * Scatter Gather Page 143 * Scatter Gather Page
121 */ 144 */
@@ -127,6 +150,12 @@ struct bfi_sgpg_s {
127 u32 rsvd[BFI_SGPG_RSVD_WD_LEN]; 150 u32 rsvd[BFI_SGPG_RSVD_WD_LEN];
128}; 151};
129 152
153/* FCP module definitions */
154#define BFI_IO_MAX (2000)
155#define BFI_IOIM_SNSLEN (256)
156#define BFI_IOIM_SNSBUF_SEGS \
157 BFI_MEM_DMA_NSEGS(BFI_IO_MAX, BFI_IOIM_SNSLEN)
158
130/* 159/*
131 * Large Message structure - 128 Bytes size Msgs 160 * Large Message structure - 128 Bytes size Msgs
132 */ 161 */
@@ -149,18 +178,29 @@ struct bfi_mbmsg_s {
149}; 178};
150 179
151/* 180/*
181 * Supported PCI function class codes (personality)
182 */
183enum bfi_pcifn_class {
184 BFI_PCIFN_CLASS_FC = 0x0c04,
185 BFI_PCIFN_CLASS_ETH = 0x0200,
186};
187
188/*
152 * Message Classes 189 * Message Classes
153 */ 190 */
154enum bfi_mclass { 191enum bfi_mclass {
155 BFI_MC_IOC = 1, /* IO Controller (IOC) */ 192 BFI_MC_IOC = 1, /* IO Controller (IOC) */
193 BFI_MC_DIAG = 2, /* Diagnostic Msgs */
194 BFI_MC_FLASH = 3, /* Flash message class */
195 BFI_MC_CEE = 4, /* CEE */
156 BFI_MC_FCPORT = 5, /* FC port */ 196 BFI_MC_FCPORT = 5, /* FC port */
157 BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */ 197 BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */
158 BFI_MC_LL = 7, /* Link Layer */ 198 BFI_MC_ABLK = 7, /* ASIC block configuration */
159 BFI_MC_UF = 8, /* Unsolicited frame receive */ 199 BFI_MC_UF = 8, /* Unsolicited frame receive */
160 BFI_MC_FCXP = 9, /* FC Transport */ 200 BFI_MC_FCXP = 9, /* FC Transport */
161 BFI_MC_LPS = 10, /* lport fc login services */ 201 BFI_MC_LPS = 10, /* lport fc login services */
162 BFI_MC_RPORT = 11, /* Remote port */ 202 BFI_MC_RPORT = 11, /* Remote port */
163 BFI_MC_ITNIM = 12, /* I-T nexus (Initiator mode) */ 203 BFI_MC_ITN = 12, /* I-T nexus (Initiator mode) */
164 BFI_MC_IOIM_READ = 13, /* read IO (Initiator mode) */ 204 BFI_MC_IOIM_READ = 13, /* read IO (Initiator mode) */
165 BFI_MC_IOIM_WRITE = 14, /* write IO (Initiator mode) */ 205 BFI_MC_IOIM_WRITE = 14, /* write IO (Initiator mode) */
166 BFI_MC_IOIM_IO = 15, /* IO (Initiator mode) */ 206 BFI_MC_IOIM_IO = 15, /* IO (Initiator mode) */
@@ -168,6 +208,8 @@ enum bfi_mclass {
168 BFI_MC_IOIM_IOCOM = 17, /* good IO completion */ 208 BFI_MC_IOIM_IOCOM = 17, /* good IO completion */
169 BFI_MC_TSKIM = 18, /* Initiator Task management */ 209 BFI_MC_TSKIM = 18, /* Initiator Task management */
170 BFI_MC_PORT = 21, /* Physical port */ 210 BFI_MC_PORT = 21, /* Physical port */
211 BFI_MC_SFP = 22, /* SFP module */
212 BFI_MC_PHY = 25, /* External PHY message class */
171 BFI_MC_MAX = 32 213 BFI_MC_MAX = 32
172}; 214};
173 215
@@ -175,23 +217,28 @@ enum bfi_mclass {
175#define BFI_IOC_MAX_CQS_ASIC 8 217#define BFI_IOC_MAX_CQS_ASIC 8
176#define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */ 218#define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */
177 219
178#define BFI_BOOT_TYPE_OFF 8
179#define BFI_BOOT_LOADER_OFF 12
180
181#define BFI_BOOT_TYPE_NORMAL 0
182#define BFI_BOOT_TYPE_FLASH 1
183#define BFI_BOOT_TYPE_MEMTEST 2
184
185#define BFI_BOOT_LOADER_OS 0
186#define BFI_BOOT_LOADER_BIOS 1
187#define BFI_BOOT_LOADER_UEFI 2
188
189/* 220/*
190 *---------------------------------------------------------------------- 221 *----------------------------------------------------------------------
191 * IOC 222 * IOC
192 *---------------------------------------------------------------------- 223 *----------------------------------------------------------------------
193 */ 224 */
194 225
226/*
227 * Different asic generations
228 */
229enum bfi_asic_gen {
230 BFI_ASIC_GEN_CB = 1, /* crossbow 8G FC */
231 BFI_ASIC_GEN_CT = 2, /* catapult 8G FC or 10G CNA */
232 BFI_ASIC_GEN_CT2 = 3, /* catapult-2 16G FC or 10G CNA */
233};
234
235enum bfi_asic_mode {
236 BFI_ASIC_MODE_FC = 1, /* FC upto 8G speed */
237 BFI_ASIC_MODE_FC16 = 2, /* FC upto 16G speed */
238 BFI_ASIC_MODE_ETH = 3, /* Ethernet ports */
239 BFI_ASIC_MODE_COMBO = 4, /* FC 16G and Ethernet 10G port */
240};
241
195enum bfi_ioc_h2i_msgs { 242enum bfi_ioc_h2i_msgs {
196 BFI_IOC_H2I_ENABLE_REQ = 1, 243 BFI_IOC_H2I_ENABLE_REQ = 1,
197 BFI_IOC_H2I_DISABLE_REQ = 2, 244 BFI_IOC_H2I_DISABLE_REQ = 2,
@@ -204,8 +251,8 @@ enum bfi_ioc_i2h_msgs {
204 BFI_IOC_I2H_ENABLE_REPLY = BFA_I2HM(1), 251 BFI_IOC_I2H_ENABLE_REPLY = BFA_I2HM(1),
205 BFI_IOC_I2H_DISABLE_REPLY = BFA_I2HM(2), 252 BFI_IOC_I2H_DISABLE_REPLY = BFA_I2HM(2),
206 BFI_IOC_I2H_GETATTR_REPLY = BFA_I2HM(3), 253 BFI_IOC_I2H_GETATTR_REPLY = BFA_I2HM(3),
207 BFI_IOC_I2H_READY_EVENT = BFA_I2HM(4), 254 BFI_IOC_I2H_HBEAT = BFA_I2HM(4),
208 BFI_IOC_I2H_HBEAT = BFA_I2HM(5), 255 BFI_IOC_I2H_ACQ_ADDR_REPLY = BFA_I2HM(5),
209}; 256};
210 257
211/* 258/*
@@ -220,7 +267,8 @@ struct bfi_ioc_attr_s {
220 wwn_t mfg_pwwn; /* Mfg port wwn */ 267 wwn_t mfg_pwwn; /* Mfg port wwn */
221 wwn_t mfg_nwwn; /* Mfg node wwn */ 268 wwn_t mfg_nwwn; /* Mfg node wwn */
222 mac_t mfg_mac; /* Mfg mac */ 269 mac_t mfg_mac; /* Mfg mac */
223 u16 rsvd_a; 270 u8 port_mode; /* bfi_port_mode */
271 u8 rsvd_a;
224 wwn_t pwwn; 272 wwn_t pwwn;
225 wwn_t nwwn; 273 wwn_t nwwn;
226 mac_t mac; /* PBC or Mfg mac */ 274 mac_t mac; /* PBC or Mfg mac */
@@ -272,21 +320,33 @@ struct bfi_ioc_getattr_reply_s {
272#define BFI_IOC_FW_SIGNATURE (0xbfadbfad) 320#define BFI_IOC_FW_SIGNATURE (0xbfadbfad)
273#define BFI_IOC_MD5SUM_SZ 4 321#define BFI_IOC_MD5SUM_SZ 4
274struct bfi_ioc_image_hdr_s { 322struct bfi_ioc_image_hdr_s {
275 u32 signature; /* constant signature */ 323 u32 signature; /* constant signature */
276 u32 rsvd_a; 324 u8 asic_gen; /* asic generation */
277 u32 exec; /* exec vector */ 325 u8 asic_mode;
278 u32 param; /* parameters */ 326 u8 port0_mode; /* device mode for port 0 */
327 u8 port1_mode; /* device mode for port 1 */
328 u32 exec; /* exec vector */
329 u32 bootenv; /* fimware boot env */
279 u32 rsvd_b[4]; 330 u32 rsvd_b[4];
280 u32 md5sum[BFI_IOC_MD5SUM_SZ]; 331 u32 md5sum[BFI_IOC_MD5SUM_SZ];
281}; 332};
282 333
283/* 334#define BFI_FWBOOT_DEVMODE_OFF 4
284 * BFI_IOC_I2H_READY_EVENT message 335#define BFI_FWBOOT_TYPE_OFF 8
285 */ 336#define BFI_FWBOOT_ENV_OFF 12
286struct bfi_ioc_rdy_event_s { 337#define BFI_FWBOOT_DEVMODE(__asic_gen, __asic_mode, __p0_mode, __p1_mode) \
287 struct bfi_mhdr_s mh; /* common msg header */ 338 (((u32)(__asic_gen)) << 24 | \
288 u8 init_status; /* init event status */ 339 ((u32)(__asic_mode)) << 16 | \
289 u8 rsvd[3]; 340 ((u32)(__p0_mode)) << 8 | \
341 ((u32)(__p1_mode)))
342
343#define BFI_FWBOOT_TYPE_NORMAL 0
344#define BFI_FWBOOT_TYPE_MEMTEST 2
345#define BFI_FWBOOT_ENV_OS 0
346
347enum bfi_port_mode {
348 BFI_PORT_MODE_FC = 1,
349 BFI_PORT_MODE_ETH = 2,
290}; 350};
291 351
292struct bfi_ioc_hbeat_s { 352struct bfi_ioc_hbeat_s {
@@ -345,8 +405,8 @@ enum {
345 */ 405 */
346struct bfi_ioc_ctrl_req_s { 406struct bfi_ioc_ctrl_req_s {
347 struct bfi_mhdr_s mh; 407 struct bfi_mhdr_s mh;
348 u8 ioc_class; 408 u16 clscode;
349 u8 rsvd[3]; 409 u16 rsvd;
350 u32 tv_sec; 410 u32 tv_sec;
351}; 411};
352#define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s; 412#define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
@@ -358,7 +418,9 @@ struct bfi_ioc_ctrl_req_s {
358struct bfi_ioc_ctrl_reply_s { 418struct bfi_ioc_ctrl_reply_s {
359 struct bfi_mhdr_s mh; /* Common msg header */ 419 struct bfi_mhdr_s mh; /* Common msg header */
360 u8 status; /* enable/disable status */ 420 u8 status; /* enable/disable status */
361 u8 rsvd[3]; 421 u8 port_mode; /* bfa_mode_s */
422 u8 cap_bm; /* capability bit mask */
423 u8 rsvd;
362}; 424};
363#define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s; 425#define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s;
364#define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s; 426#define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s;
@@ -380,7 +442,7 @@ union bfi_ioc_h2i_msg_u {
380 */ 442 */
381union bfi_ioc_i2h_msg_u { 443union bfi_ioc_i2h_msg_u {
382 struct bfi_mhdr_s mh; 444 struct bfi_mhdr_s mh;
383 struct bfi_ioc_rdy_event_s rdy_event; 445 struct bfi_ioc_ctrl_reply_s fw_event;
384 u32 mboxmsg[BFI_IOC_MSGSZ]; 446 u32 mboxmsg[BFI_IOC_MSGSZ];
385}; 447};
386 448
@@ -393,6 +455,7 @@ union bfi_ioc_i2h_msg_u {
393 455
394#define BFI_PBC_MAX_BLUNS 8 456#define BFI_PBC_MAX_BLUNS 8
395#define BFI_PBC_MAX_VPORTS 16 457#define BFI_PBC_MAX_VPORTS 16
458#define BFI_PBC_PORT_DISABLED 2
396 459
397/* 460/*
398 * PBC boot lun configuration 461 * PBC boot lun configuration
@@ -574,6 +637,496 @@ union bfi_port_i2h_msg_u {
574 struct bfi_port_generic_rsp_s clearstats_rsp; 637 struct bfi_port_generic_rsp_s clearstats_rsp;
575}; 638};
576 639
640/*
641 *----------------------------------------------------------------------
642 * ABLK
643 *----------------------------------------------------------------------
644 */
645enum bfi_ablk_h2i_msgs_e {
646 BFI_ABLK_H2I_QUERY = 1,
647 BFI_ABLK_H2I_ADPT_CONFIG = 2,
648 BFI_ABLK_H2I_PORT_CONFIG = 3,
649 BFI_ABLK_H2I_PF_CREATE = 4,
650 BFI_ABLK_H2I_PF_DELETE = 5,
651 BFI_ABLK_H2I_PF_UPDATE = 6,
652 BFI_ABLK_H2I_OPTROM_ENABLE = 7,
653 BFI_ABLK_H2I_OPTROM_DISABLE = 8,
654};
655
656enum bfi_ablk_i2h_msgs_e {
657 BFI_ABLK_I2H_QUERY = BFA_I2HM(BFI_ABLK_H2I_QUERY),
658 BFI_ABLK_I2H_ADPT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_ADPT_CONFIG),
659 BFI_ABLK_I2H_PORT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_PORT_CONFIG),
660 BFI_ABLK_I2H_PF_CREATE = BFA_I2HM(BFI_ABLK_H2I_PF_CREATE),
661 BFI_ABLK_I2H_PF_DELETE = BFA_I2HM(BFI_ABLK_H2I_PF_DELETE),
662 BFI_ABLK_I2H_PF_UPDATE = BFA_I2HM(BFI_ABLK_H2I_PF_UPDATE),
663 BFI_ABLK_I2H_OPTROM_ENABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_ENABLE),
664 BFI_ABLK_I2H_OPTROM_DISABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_DISABLE),
665};
666
667/* BFI_ABLK_H2I_QUERY */
668struct bfi_ablk_h2i_query_s {
669 struct bfi_mhdr_s mh;
670 union bfi_addr_u addr;
671};
672
673/* BFI_ABL_H2I_ADPT_CONFIG, BFI_ABLK_H2I_PORT_CONFIG */
674struct bfi_ablk_h2i_cfg_req_s {
675 struct bfi_mhdr_s mh;
676 u8 mode;
677 u8 port;
678 u8 max_pf;
679 u8 max_vf;
680};
681
682/*
683 * BFI_ABLK_H2I_PF_CREATE, BFI_ABLK_H2I_PF_DELETE,
684 */
685struct bfi_ablk_h2i_pf_req_s {
686 struct bfi_mhdr_s mh;
687 u8 pcifn;
688 u8 port;
689 u16 pers;
690 u32 bw;
691};
692
693/* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */
694struct bfi_ablk_h2i_optrom_s {
695 struct bfi_mhdr_s mh;
696};
697
698/*
699 * BFI_ABLK_I2H_QUERY
700 * BFI_ABLK_I2H_PORT_CONFIG
701 * BFI_ABLK_I2H_PF_CREATE
702 * BFI_ABLK_I2H_PF_DELETE
703 * BFI_ABLK_I2H_PF_UPDATE
704 * BFI_ABLK_I2H_OPTROM_ENABLE
705 * BFI_ABLK_I2H_OPTROM_DISABLE
706 */
707struct bfi_ablk_i2h_rsp_s {
708 struct bfi_mhdr_s mh;
709 u8 status;
710 u8 pcifn;
711 u8 port_mode;
712};
713
714
715/*
716 * CEE module specific messages
717 */
718
719/* Mailbox commands from host to firmware */
720enum bfi_cee_h2i_msgs_e {
721 BFI_CEE_H2I_GET_CFG_REQ = 1,
722 BFI_CEE_H2I_RESET_STATS = 2,
723 BFI_CEE_H2I_GET_STATS_REQ = 3,
724};
725
726enum bfi_cee_i2h_msgs_e {
727 BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
728 BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
729 BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
730};
731
732/*
733 * H2I command structure for resetting the stats
734 */
735struct bfi_cee_reset_stats_s {
736 struct bfi_mhdr_s mh;
737};
738
739/*
740 * Get configuration command from host
741 */
742struct bfi_cee_get_req_s {
743 struct bfi_mhdr_s mh;
744 union bfi_addr_u dma_addr;
745};
746
747/*
748 * Reply message from firmware
749 */
750struct bfi_cee_get_rsp_s {
751 struct bfi_mhdr_s mh;
752 u8 cmd_status;
753 u8 rsvd[3];
754};
755
756/*
757 * Reply message from firmware
758 */
759struct bfi_cee_stats_rsp_s {
760 struct bfi_mhdr_s mh;
761 u8 cmd_status;
762 u8 rsvd[3];
763};
764
765/* Mailbox message structures from firmware to host */
766union bfi_cee_i2h_msg_u {
767 struct bfi_mhdr_s mh;
768 struct bfi_cee_get_rsp_s get_rsp;
769 struct bfi_cee_stats_rsp_s stats_rsp;
770};
771
772/*
773 * SFP related
774 */
775
776enum bfi_sfp_h2i_e {
777 BFI_SFP_H2I_SHOW = 1,
778 BFI_SFP_H2I_SCN = 2,
779};
780
781enum bfi_sfp_i2h_e {
782 BFI_SFP_I2H_SHOW = BFA_I2HM(BFI_SFP_H2I_SHOW),
783 BFI_SFP_I2H_SCN = BFA_I2HM(BFI_SFP_H2I_SCN),
784};
785
786/*
787 * SFP state
788 */
789enum bfa_sfp_stat_e {
790 BFA_SFP_STATE_INIT = 0, /* SFP state is uninit */
791 BFA_SFP_STATE_REMOVED = 1, /* SFP is removed */
792 BFA_SFP_STATE_INSERTED = 2, /* SFP is inserted */
793 BFA_SFP_STATE_VALID = 3, /* SFP is valid */
794 BFA_SFP_STATE_UNSUPPORT = 4, /* SFP is unsupport */
795 BFA_SFP_STATE_FAILED = 5, /* SFP i2c read fail */
796};
797
798/*
799 * SFP memory access type
800 */
801enum bfi_sfp_mem_e {
802 BFI_SFP_MEM_ALL = 0x1, /* access all data field */
803 BFI_SFP_MEM_DIAGEXT = 0x2, /* access diag ext data field only */
804};
805
806struct bfi_sfp_req_s {
807 struct bfi_mhdr_s mh;
808 u8 memtype;
809 u8 rsvd[3];
810 struct bfi_alen_s alen;
811};
812
813struct bfi_sfp_rsp_s {
814 struct bfi_mhdr_s mh;
815 u8 status;
816 u8 state;
817 u8 rsvd[2];
818};
819
820/*
821 * FLASH module specific
822 */
823enum bfi_flash_h2i_msgs {
824 BFI_FLASH_H2I_QUERY_REQ = 1,
825 BFI_FLASH_H2I_ERASE_REQ = 2,
826 BFI_FLASH_H2I_WRITE_REQ = 3,
827 BFI_FLASH_H2I_READ_REQ = 4,
828 BFI_FLASH_H2I_BOOT_VER_REQ = 5,
829};
830
831enum bfi_flash_i2h_msgs {
832 BFI_FLASH_I2H_QUERY_RSP = BFA_I2HM(1),
833 BFI_FLASH_I2H_ERASE_RSP = BFA_I2HM(2),
834 BFI_FLASH_I2H_WRITE_RSP = BFA_I2HM(3),
835 BFI_FLASH_I2H_READ_RSP = BFA_I2HM(4),
836 BFI_FLASH_I2H_BOOT_VER_RSP = BFA_I2HM(5),
837 BFI_FLASH_I2H_EVENT = BFA_I2HM(127),
838};
839
840/*
841 * Flash query request
842 */
843struct bfi_flash_query_req_s {
844 struct bfi_mhdr_s mh; /* Common msg header */
845 struct bfi_alen_s alen;
846};
847
848/*
849 * Flash erase request
850 */
851struct bfi_flash_erase_req_s {
852 struct bfi_mhdr_s mh; /* Common msg header */
853 u32 type; /* partition type */
854 u8 instance; /* partition instance */
855 u8 rsv[3];
856};
857
858/*
859 * Flash write request
860 */
861struct bfi_flash_write_req_s {
862 struct bfi_mhdr_s mh; /* Common msg header */
863 struct bfi_alen_s alen;
864 u32 type; /* partition type */
865 u8 instance; /* partition instance */
866 u8 last;
867 u8 rsv[2];
868 u32 offset;
869 u32 length;
870};
871
872/*
873 * Flash read request
874 */
875struct bfi_flash_read_req_s {
876 struct bfi_mhdr_s mh; /* Common msg header */
877 u32 type; /* partition type */
878 u8 instance; /* partition instance */
879 u8 rsv[3];
880 u32 offset;
881 u32 length;
882 struct bfi_alen_s alen;
883};
884
885/*
886 * Flash query response
887 */
888struct bfi_flash_query_rsp_s {
889 struct bfi_mhdr_s mh; /* Common msg header */
890 u32 status;
891};
892
893/*
894 * Flash read response
895 */
896struct bfi_flash_read_rsp_s {
897 struct bfi_mhdr_s mh; /* Common msg header */
898 u32 type; /* partition type */
899 u8 instance; /* partition instance */
900 u8 rsv[3];
901 u32 status;
902 u32 length;
903};
904
905/*
906 * Flash write response
907 */
908struct bfi_flash_write_rsp_s {
909 struct bfi_mhdr_s mh; /* Common msg header */
910 u32 type; /* partition type */
911 u8 instance; /* partition instance */
912 u8 rsv[3];
913 u32 status;
914 u32 length;
915};
916
917/*
918 * Flash erase response
919 */
920struct bfi_flash_erase_rsp_s {
921 struct bfi_mhdr_s mh; /* Common msg header */
922 u32 type; /* partition type */
923 u8 instance; /* partition instance */
924 u8 rsv[3];
925 u32 status;
926};
927
928/*
929 *----------------------------------------------------------------------
930 * DIAG
931 *----------------------------------------------------------------------
932 */
933enum bfi_diag_h2i {
934 BFI_DIAG_H2I_PORTBEACON = 1,
935 BFI_DIAG_H2I_LOOPBACK = 2,
936 BFI_DIAG_H2I_FWPING = 3,
937 BFI_DIAG_H2I_TEMPSENSOR = 4,
938 BFI_DIAG_H2I_LEDTEST = 5,
939 BFI_DIAG_H2I_QTEST = 6,
940};
941
942enum bfi_diag_i2h {
943 BFI_DIAG_I2H_PORTBEACON = BFA_I2HM(BFI_DIAG_H2I_PORTBEACON),
944 BFI_DIAG_I2H_LOOPBACK = BFA_I2HM(BFI_DIAG_H2I_LOOPBACK),
945 BFI_DIAG_I2H_FWPING = BFA_I2HM(BFI_DIAG_H2I_FWPING),
946 BFI_DIAG_I2H_TEMPSENSOR = BFA_I2HM(BFI_DIAG_H2I_TEMPSENSOR),
947 BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST),
948 BFI_DIAG_I2H_QTEST = BFA_I2HM(BFI_DIAG_H2I_QTEST),
949};
950
951#define BFI_DIAG_MAX_SGES 2
952#define BFI_DIAG_DMA_BUF_SZ (2 * 1024)
953#define BFI_BOOT_MEMTEST_RES_ADDR 0x900
954#define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3
955
956struct bfi_diag_lb_req_s {
957 struct bfi_mhdr_s mh;
958 u32 loopcnt;
959 u32 pattern;
960 u8 lb_mode; /*!< bfa_port_opmode_t */
961 u8 speed; /*!< bfa_port_speed_t */
962 u8 rsvd[2];
963};
964
965struct bfi_diag_lb_rsp_s {
966 struct bfi_mhdr_s mh; /* 4 bytes */
967 struct bfa_diag_loopback_result_s res; /* 16 bytes */
968};
969
970struct bfi_diag_fwping_req_s {
971 struct bfi_mhdr_s mh; /* 4 bytes */
972 struct bfi_alen_s alen; /* 12 bytes */
973 u32 data; /* user input data pattern */
974 u32 count; /* user input dma count */
975 u8 qtag; /* track CPE vc */
976 u8 rsv[3];
977};
978
979struct bfi_diag_fwping_rsp_s {
980 struct bfi_mhdr_s mh; /* 4 bytes */
981 u32 data; /* user input data pattern */
982 u8 qtag; /* track CPE vc */
983 u8 dma_status; /* dma status */
984 u8 rsv[2];
985};
986
987/*
988 * Temperature Sensor
989 */
990struct bfi_diag_ts_req_s {
991 struct bfi_mhdr_s mh; /* 4 bytes */
992 u16 temp; /* 10-bit A/D value */
993 u16 brd_temp; /* 9-bit board temp */
994 u8 status;
995 u8 ts_junc; /* show junction tempsensor */
996 u8 ts_brd; /* show board tempsensor */
997 u8 rsv;
998};
999#define bfi_diag_ts_rsp_t struct bfi_diag_ts_req_s
1000
1001struct bfi_diag_ledtest_req_s {
1002 struct bfi_mhdr_s mh; /* 4 bytes */
1003 u8 cmd;
1004 u8 color;
1005 u8 portid;
1006 u8 led; /* bitmap of LEDs to be tested */
1007 u16 freq; /* no. of blinks every 10 secs */
1008 u8 rsv[2];
1009};
1010
1011/* notify host led operation is done */
1012struct bfi_diag_ledtest_rsp_s {
1013 struct bfi_mhdr_s mh; /* 4 bytes */
1014};
1015
1016struct bfi_diag_portbeacon_req_s {
1017 struct bfi_mhdr_s mh; /* 4 bytes */
1018 u32 period; /* beaconing period */
1019 u8 beacon; /* 1: beacon on */
1020 u8 rsvd[3];
1021};
1022
1023/* notify host the beacon is off */
1024struct bfi_diag_portbeacon_rsp_s {
1025 struct bfi_mhdr_s mh; /* 4 bytes */
1026};
1027
1028struct bfi_diag_qtest_req_s {
1029 struct bfi_mhdr_s mh; /* 4 bytes */
1030 u32 data[BFI_LMSG_PL_WSZ]; /* fill up tcm prefetch area */
1031};
1032#define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s
1033
1034/*
1035 * PHY module specific
1036 */
1037enum bfi_phy_h2i_msgs_e {
1038 BFI_PHY_H2I_QUERY_REQ = 1,
1039 BFI_PHY_H2I_STATS_REQ = 2,
1040 BFI_PHY_H2I_WRITE_REQ = 3,
1041 BFI_PHY_H2I_READ_REQ = 4,
1042};
1043
1044enum bfi_phy_i2h_msgs_e {
1045 BFI_PHY_I2H_QUERY_RSP = BFA_I2HM(1),
1046 BFI_PHY_I2H_STATS_RSP = BFA_I2HM(2),
1047 BFI_PHY_I2H_WRITE_RSP = BFA_I2HM(3),
1048 BFI_PHY_I2H_READ_RSP = BFA_I2HM(4),
1049};
1050
1051/*
1052 * External PHY query request
1053 */
1054struct bfi_phy_query_req_s {
1055 struct bfi_mhdr_s mh; /* Common msg header */
1056 u8 instance;
1057 u8 rsv[3];
1058 struct bfi_alen_s alen;
1059};
1060
1061/*
1062 * External PHY stats request
1063 */
1064struct bfi_phy_stats_req_s {
1065 struct bfi_mhdr_s mh; /* Common msg header */
1066 u8 instance;
1067 u8 rsv[3];
1068 struct bfi_alen_s alen;
1069};
1070
1071/*
1072 * External PHY write request
1073 */
1074struct bfi_phy_write_req_s {
1075 struct bfi_mhdr_s mh; /* Common msg header */
1076 u8 instance;
1077 u8 last;
1078 u8 rsv[2];
1079 u32 offset;
1080 u32 length;
1081 struct bfi_alen_s alen;
1082};
1083
1084/*
1085 * External PHY read request
1086 */
1087struct bfi_phy_read_req_s {
1088 struct bfi_mhdr_s mh; /* Common msg header */
1089 u8 instance;
1090 u8 rsv[3];
1091 u32 offset;
1092 u32 length;
1093 struct bfi_alen_s alen;
1094};
1095
1096/*
1097 * External PHY query response
1098 */
1099struct bfi_phy_query_rsp_s {
1100 struct bfi_mhdr_s mh; /* Common msg header */
1101 u32 status;
1102};
1103
1104/*
1105 * External PHY stats response
1106 */
1107struct bfi_phy_stats_rsp_s {
1108 struct bfi_mhdr_s mh; /* Common msg header */
1109 u32 status;
1110};
1111
1112/*
1113 * External PHY read response
1114 */
1115struct bfi_phy_read_rsp_s {
1116 struct bfi_mhdr_s mh; /* Common msg header */
1117 u32 status;
1118 u32 length;
1119};
1120
1121/*
1122 * External PHY write response
1123 */
1124struct bfi_phy_write_rsp_s {
1125 struct bfi_mhdr_s mh; /* Common msg header */
1126 u32 status;
1127 u32 length;
1128};
1129
577#pragma pack() 1130#pragma pack()
578 1131
579#endif /* __BFI_H__ */ 1132#endif /* __BFI_H__ */