• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/drivers/scsi/bfa/include/bfi/
1/*
2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
5 *
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef __BFI_H__
19#define __BFI_H__
20
21#include <bfa_os_inc.h>
22#include <defs/bfa_defs_status.h>
23
24#pragma pack(1)
25
26/**
27 * Msg header common to all msgs
28 */
29struct bfi_mhdr_s {
30	u8         msg_class;	/*  @ref bfi_mclass_t	    */
31	u8         msg_id;		/*  msg opcode with in the class   */
32	union {
33		struct {
34			u8         rsvd;
35			u8         lpu_id;	/*  msg destination	    */
36		} h2i;
37		u16        i2htok;	/*  token in msgs to host	    */
38	} mtag;
39};
40
41#define bfi_h2i_set(_mh, _mc, _op, _lpuid) do {		\
42	(_mh).msg_class 		= (_mc);      \
43	(_mh).msg_id			= (_op);      \
44	(_mh).mtag.h2i.lpu_id	= (_lpuid);      \
45} while (0)
46
47#define bfi_i2h_set(_mh, _mc, _op, _i2htok) do {		\
48	(_mh).msg_class 		= (_mc);      \
49	(_mh).msg_id			= (_op);      \
50	(_mh).mtag.i2htok		= (_i2htok);      \
51} while (0)
52
53/*
54 * Message opcodes: 0-127 to firmware, 128-255 to host
55 */
56#define BFI_I2H_OPCODE_BASE	128
57#define BFA_I2HM(_x) 			((_x) + BFI_I2H_OPCODE_BASE)
58
59/**
60 ****************************************************************************
61 *
62 * Scatter Gather Element and Page definition
63 *
64 ****************************************************************************
65 */
66
67#define BFI_SGE_INLINE	1
68#define BFI_SGE_INLINE_MAX	(BFI_SGE_INLINE + 1)
69
70/**
71 * SG Flags
72 */
73enum {
74	BFI_SGE_DATA	= 0,	/*  data address, not last	     */
75	BFI_SGE_DATA_CPL	= 1,	/*  data addr, last in current page */
76	BFI_SGE_DATA_LAST	= 3,	/*  data address, last		     */
77	BFI_SGE_LINK	= 2,	/*  link address		     */
78	BFI_SGE_PGDLEN	= 2,	/*  cumulative data length for page */
79};
80
81/**
82 * DMA addresses
83 */
84union bfi_addr_u {
85	struct {
86		u32        addr_lo;
87		u32        addr_hi;
88	} a32;
89};
90
91/**
92 * Scatter Gather Element
93 */
94struct bfi_sge_s {
95#ifdef __BIGENDIAN
96	u32        flags:2,
97			rsvd:2,
98			sg_len:28;
99#else
100	u32        sg_len:28,
101			rsvd:2,
102			flags:2;
103#endif
104	union bfi_addr_u sga;
105};
106
107/**
108 * Scatter Gather Page
109 */
110#define BFI_SGPG_DATA_SGES		7
111#define BFI_SGPG_SGES_MAX		(BFI_SGPG_DATA_SGES + 1)
112#define BFI_SGPG_RSVD_WD_LEN	8
113struct bfi_sgpg_s {
114	struct bfi_sge_s sges[BFI_SGPG_SGES_MAX];
115	u32	rsvd[BFI_SGPG_RSVD_WD_LEN];
116};
117
118/*
119 * Large Message structure - 128 Bytes size Msgs
120 */
121#define BFI_LMSG_SZ		128
122#define BFI_LMSG_PL_WSZ	\
123			((BFI_LMSG_SZ - sizeof(struct bfi_mhdr_s)) / 4)
124
125struct bfi_msg_s {
126	struct bfi_mhdr_s mhdr;
127	u32	pl[BFI_LMSG_PL_WSZ];
128};
129
130/**
131 * Mailbox message structure
132 */
133#define BFI_MBMSG_SZ		7
134struct bfi_mbmsg_s {
135	struct bfi_mhdr_s	mh;
136	u32		pl[BFI_MBMSG_SZ];
137};
138
139/**
140 * Message Classes
141 */
142enum bfi_mclass {
143	BFI_MC_IOC		= 1,	/*  IO Controller (IOC)	    */
144	BFI_MC_DIAG		= 2,	/*  Diagnostic Msgs		    */
145	BFI_MC_FLASH		= 3,	/*  Flash message class	    */
146	BFI_MC_CEE		= 4,	/*  CEE                     */
147	BFI_MC_FCPORT		= 5,	/*  FC port		   	    */
148	BFI_MC_IOCFC		= 6,	/*  FC - IO Controller (IOC)	    */
149	BFI_MC_LL		= 7,	/*  Link Layer		 	    */
150	BFI_MC_UF		= 8,	/*  Unsolicited frame receive	    */
151	BFI_MC_FCXP		= 9,	/*  FC Transport		    */
152	BFI_MC_LPS		= 10,	/*  lport fc login services	    */
153	BFI_MC_RPORT		= 11,	/*  Remote port		    */
154	BFI_MC_ITNIM		= 12,	/*  I-T nexus (Initiator mode)	    */
155	BFI_MC_IOIM_READ	= 13,	/*  read IO (Initiator mode)	    */
156	BFI_MC_IOIM_WRITE	= 14,	/*  write IO (Initiator mode)	    */
157	BFI_MC_IOIM_IO		= 15,	/*  IO (Initiator mode)	    */
158	BFI_MC_IOIM		= 16,	/*  IO (Initiator mode)	    */
159	BFI_MC_IOIM_IOCOM	= 17,	/*  good IO completion		    */
160	BFI_MC_TSKIM		= 18,	/*  Initiator Task management	    */
161	BFI_MC_SBOOT		= 19,	/*  SAN boot services		    */
162	BFI_MC_IPFC		= 20,	/*  IP over FC Msgs		    */
163	BFI_MC_PORT		= 21,	/*  Physical port		    */
164	BFI_MC_MAX		= 32
165};
166
167#define BFI_IOC_MAX_CQS		4
168#define BFI_IOC_MAX_CQS_ASIC	8
169#define BFI_IOC_MSGLEN_MAX	32	/* 32 bytes */
170
171#pragma pack()
172
173#endif /* __BFI_H__ */
174