xref: /openbmc/linux/drivers/scsi/fnic/vnic_devcmd.h (revision e7bae9bb)
1 /*
2  * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
3  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
4  *
5  * This program is free software; you may redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; version 2 of the License.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
10  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
12  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
13  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
14  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
15  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16  * SOFTWARE.
17  */
18 #ifndef _VNIC_DEVCMD_H_
19 #define _VNIC_DEVCMD_H_
20 
21 #define _CMD_NBITS      14
22 #define _CMD_VTYPEBITS	10
23 #define _CMD_FLAGSBITS  6
24 #define _CMD_DIRBITS	2
25 
26 #define _CMD_NMASK      ((1 << _CMD_NBITS)-1)
27 #define _CMD_VTYPEMASK  ((1 << _CMD_VTYPEBITS)-1)
28 #define _CMD_FLAGSMASK  ((1 << _CMD_FLAGSBITS)-1)
29 #define _CMD_DIRMASK    ((1 << _CMD_DIRBITS)-1)
30 
31 #define _CMD_NSHIFT     0
32 #define _CMD_VTYPESHIFT (_CMD_NSHIFT+_CMD_NBITS)
33 #define _CMD_FLAGSSHIFT (_CMD_VTYPESHIFT+_CMD_VTYPEBITS)
34 #define _CMD_DIRSHIFT   (_CMD_FLAGSSHIFT+_CMD_FLAGSBITS)
35 
36 /*
37  * Direction bits (from host perspective).
38  */
39 #define _CMD_DIR_NONE   0U
40 #define _CMD_DIR_WRITE  1U
41 #define _CMD_DIR_READ   2U
42 #define _CMD_DIR_RW     (_CMD_DIR_WRITE | _CMD_DIR_READ)
43 
44 /*
45  * Flag bits.
46  */
47 #define _CMD_FLAGS_NONE 0U
48 #define _CMD_FLAGS_NOWAIT 1U
49 
50 /*
51  * vNIC type bits.
52  */
53 #define _CMD_VTYPE_NONE  0U
54 #define _CMD_VTYPE_ENET  1U
55 #define _CMD_VTYPE_FC    2U
56 #define _CMD_VTYPE_SCSI  4U
57 #define _CMD_VTYPE_ALL   (_CMD_VTYPE_ENET | _CMD_VTYPE_FC | _CMD_VTYPE_SCSI)
58 
59 /*
60  * Used to create cmds..
61 */
62 #define _CMDCF(dir, flags, vtype, nr)  \
63 	(((dir)   << _CMD_DIRSHIFT) | \
64 	((flags) << _CMD_FLAGSSHIFT) | \
65 	((vtype) << _CMD_VTYPESHIFT) | \
66 	((nr)    << _CMD_NSHIFT))
67 #define _CMDC(dir, vtype, nr)    _CMDCF(dir, 0, vtype, nr)
68 #define _CMDCNW(dir, vtype, nr)  _CMDCF(dir, _CMD_FLAGS_NOWAIT, vtype, nr)
69 
70 /*
71  * Used to decode cmds..
72 */
73 #define _CMD_DIR(cmd)            (((cmd) >> _CMD_DIRSHIFT) & _CMD_DIRMASK)
74 #define _CMD_FLAGS(cmd)          (((cmd) >> _CMD_FLAGSSHIFT) & _CMD_FLAGSMASK)
75 #define _CMD_VTYPE(cmd)          (((cmd) >> _CMD_VTYPESHIFT) & _CMD_VTYPEMASK)
76 #define _CMD_N(cmd)              (((cmd) >> _CMD_NSHIFT) & _CMD_NMASK)
77 
78 enum vnic_devcmd_cmd {
79 	CMD_NONE                = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_NONE, 0),
80 
81 	/* mcpu fw info in mem: (u64)a0=paddr to struct vnic_devcmd_fw_info */
82 	CMD_MCPU_FW_INFO        = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 1),
83 
84 	/* dev-specific block member:
85 	 *    in: (u16)a0=offset,(u8)a1=size
86 	 *    out: a0=value */
87 	CMD_DEV_SPEC            = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 2),
88 
89 	/* stats clear */
90 	CMD_STATS_CLEAR         = _CMDCNW(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 3),
91 
92 	/* stats dump in mem: (u64)a0=paddr to stats area,
93 	 *                    (u16)a1=sizeof stats area */
94 	CMD_STATS_DUMP          = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 4),
95 
96 	/* set Rx packet filter: (u32)a0=filters (see CMD_PFILTER_*) */
97 	CMD_PACKET_FILTER       = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 7),
98 
99 	/* hang detection notification */
100 	CMD_HANG_NOTIFY         = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 8),
101 
102 	/* MAC address in (u48)a0 */
103 	CMD_MAC_ADDR            = _CMDC(_CMD_DIR_READ,
104 					_CMD_VTYPE_ENET | _CMD_VTYPE_FC, 9),
105 
106 	/* disable/enable promisc mode: (u8)a0=0/1 */
107 /***** XXX DEPRECATED *****/
108 	CMD_PROMISC_MODE        = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 10),
109 
110 	/* disable/enable all-multi mode: (u8)a0=0/1 */
111 /***** XXX DEPRECATED *****/
112 	CMD_ALLMULTI_MODE       = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 11),
113 
114 	/* add addr from (u48)a0 */
115 	CMD_ADDR_ADD            = _CMDCNW(_CMD_DIR_WRITE,
116 					_CMD_VTYPE_ENET | _CMD_VTYPE_FC, 12),
117 
118 	/* del addr from (u48)a0 */
119 	CMD_ADDR_DEL            = _CMDCNW(_CMD_DIR_WRITE,
120 					_CMD_VTYPE_ENET | _CMD_VTYPE_FC, 13),
121 
122 	/* add VLAN id in (u16)a0 */
123 	CMD_VLAN_ADD            = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 14),
124 
125 	/* del VLAN id in (u16)a0 */
126 	CMD_VLAN_DEL            = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 15),
127 
128 	/* nic_cfg in (u32)a0 */
129 	CMD_NIC_CFG             = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 16),
130 
131 	/* union vnic_rss_key in mem: (u64)a0=paddr, (u16)a1=len */
132 	CMD_RSS_KEY             = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 17),
133 
134 	/* union vnic_rss_cpu in mem: (u64)a0=paddr, (u16)a1=len */
135 	CMD_RSS_CPU             = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 18),
136 
137 	/* initiate softreset */
138 	CMD_SOFT_RESET          = _CMDCNW(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 19),
139 
140 	/* softreset status:
141 	 *    out: a0=0 reset complete, a0=1 reset in progress */
142 	CMD_SOFT_RESET_STATUS   = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 20),
143 
144 	/* set struct vnic_devcmd_notify buffer in mem:
145 	 * in:
146 	 *   (u64)a0=paddr to notify (set paddr=0 to unset)
147 	 *   (u32)a1 & 0x00000000ffffffff=sizeof(struct vnic_devcmd_notify)
148 	 *   (u16)a1 & 0x0000ffff00000000=intr num (-1 for no intr)
149 	 * out:
150 	 *   (u32)a1 = effective size
151 	 */
152 	CMD_NOTIFY              = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 21),
153 
154 	/* UNDI API: (u64)a0=paddr to s_PXENV_UNDI_ struct,
155 	 *           (u8)a1=PXENV_UNDI_xxx */
156 	CMD_UNDI                = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 22),
157 
158 	/* initiate open sequence (u32)a0=flags (see CMD_OPENF_*) */
159 	CMD_OPEN		= _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 23),
160 
161 	/* open status:
162 	 *    out: a0=0 open complete, a0=1 open in progress */
163 	CMD_OPEN_STATUS		= _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 24),
164 
165 	/* close vnic */
166 	CMD_CLOSE		= _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 25),
167 
168 	/* initialize virtual link: (u32)a0=flags (see CMD_INITF_*) */
169 	CMD_INIT		= _CMDCNW(_CMD_DIR_READ, _CMD_VTYPE_ALL, 26),
170 
171 	/* variant of CMD_INIT, with provisioning info
172 	 *     (u64)a0=paddr of vnic_devcmd_provinfo
173 	 *     (u32)a1=sizeof provision info
174 	 */
175 	CMD_INIT_PROV_INFO	= _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 27),
176 
177 	/* enable virtual link */
178 	CMD_ENABLE		= _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 28),
179 
180 	/* disable virtual link */
181 	CMD_DISABLE		= _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 29),
182 
183 	/* stats dump all vnics on uplink in mem: (u64)a0=paddr (u32)a1=uif */
184 	CMD_STATS_DUMP_ALL	= _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 30),
185 
186 	/* init status:
187 	 *    out: a0=0 init complete, a0=1 init in progress
188 	 *         if a0=0, a1=errno */
189 	CMD_INIT_STATUS		= _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 31),
190 
191 	/* INT13 API: (u64)a0=paddr to vnic_int13_params struct
192 	 *            (u8)a1=INT13_CMD_xxx */
193 	CMD_INT13               = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_FC, 32),
194 
195 	/* logical uplink enable/disable: (u64)a0: 0/1=disable/enable */
196 	CMD_LOGICAL_UPLINK      = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 33),
197 
198 	/* undo initialize of virtual link */
199 	CMD_DEINIT		= _CMDCNW(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 34),
200 
201 	/* check fw capability of a cmd:
202 	 * in:  (u32)a0=cmd
203 	 * out: (u32)a0=errno, 0:valid cmd, a1=supported VNIC_STF_* bits */
204 	CMD_CAPABILITY      = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 36),
205 
206 	/* persistent binding info
207 	 * in:  (u64)a0=paddr of arg
208 	 *      (u32)a1=CMD_PERBI_XXX */
209 	CMD_PERBI       = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_FC, 37),
210 
211 	/* Interrupt Assert Register functionality
212 	 * in: (u16)a0=interrupt number to assert
213 	 */
214 	CMD_IAR         = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 38),
215 
216 	/* initiate hangreset, like softreset after hang detected */
217 	CMD_HANG_RESET      = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 39),
218 
219 	/* hangreset status:
220 	 *    out: a0=0 reset complete, a0=1 reset in progress */
221 	CMD_HANG_RESET_STATUS   = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 40),
222 
223 	/*
224 	 * Set hw ingress packet vlan rewrite mode:
225 	 * in:  (u32)a0=new vlan rewrite mode
226 	 * out: (u32)a0=old vlan rewrite mode */
227 	CMD_IG_VLAN_REWRITE_MODE = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 41),
228 
229 	/*
230 	 * in:  (u16)a0=bdf of target vnic
231 	 *      (u32)a1=cmd to proxy
232 	 *      a2-a15=args to cmd in a1
233 	 * out: (u32)a0=status of proxied cmd
234 	 *      a1-a15=out args of proxied cmd */
235 	CMD_PROXY_BY_BDF =  _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 42),
236 
237 	/*
238 	 * As for BY_BDF except a0 is index of hvnlink subordinate vnic
239 	 * or SR-IOV virtual vnic
240 	 */
241 	CMD_PROXY_BY_INDEX =    _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 43),
242 
243 	/*
244 	 * For HPP toggle:
245 	 * adapter-info-get
246 	 * in:  (u64)a0=phsical address of buffer passed in from caller.
247 	 *      (u16)a1=size of buffer specified in a0.
248 	 * out: (u64)a0=phsical address of buffer passed in from caller.
249 	 *      (u16)a1=actual bytes from VIF-CONFIG-INFO TLV, or
250 	 *              0 if no VIF-CONFIG-INFO TLV was ever received. */
251 	CMD_CONFIG_INFO_GET = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44),
252 
253 	/*
254 	 * INT13 API: (u64)a0=paddr to vnic_int13_params struct
255 	 *            (u32)a1=INT13_CMD_xxx
256 	 */
257 	CMD_INT13_ALL = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 45),
258 
259 	/*
260 	 * Set default vlan:
261 	 * in: (u16)a0=new default vlan
262 	 *     (u16)a1=zero for overriding vlan with param a0,
263 	 *             non-zero for resetting vlan to the default
264 	 * out: (u16)a0=old default vlan
265 	 */
266 	CMD_SET_DEFAULT_VLAN = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 46),
267 
268 	/* init_prov_info2:
269 	 * Variant of CMD_INIT_PROV_INFO, where it will not try to enable
270 	 * the vnic until CMD_ENABLE2 is issued.
271 	 *     (u64)a0=paddr of vnic_devcmd_provinfo
272 	 *     (u32)a1=sizeof provision info
273 	 */
274 	CMD_INIT_PROV_INFO2  = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 47),
275 
276 	/* enable2:
277 	 *      (u32)a0=0                  ==> standby
278 	 *             =CMD_ENABLE2_ACTIVE ==> active
279 	 */
280 	CMD_ENABLE2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 48),
281 
282 	/*
283 	 * cmd_status:
284 	 *     Returns the status of the specified command
285 	 * Input:
286 	 *     a0 = command for which status is being queried.
287 	 *          Possible values are:
288 	 *              CMD_SOFT_RESET
289 	 *              CMD_HANG_RESET
290 	 *              CMD_OPEN
291 	 *              CMD_INIT
292 	 *              CMD_INIT_PROV_INFO
293 	 *              CMD_DEINIT
294 	 *              CMD_INIT_PROV_INFO2
295 	 *              CMD_ENABLE2
296 	 * Output:
297 	 *     if status == STAT_ERROR
298 	 *        a0 = ERR_ENOTSUPPORTED - status for command in a0 is
299 	 *                                 not supported
300 	 *     if status == STAT_NONE
301 	 *        a0 = status of the devcmd specified in a0 as follows.
302 	 *             ERR_SUCCESS   - command in a0 completed successfully
303 	 *             ERR_EINPROGRESS - command in a0 is still in progress
304 	 */
305 	CMD_STATUS = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 49),
306 
307 	/*
308 	 * Returns interrupt coalescing timer conversion factors.
309 	 * After calling this devcmd, ENIC driver can convert
310 	 * interrupt coalescing timer in usec into CPU cycles as follows:
311 	 *
312 	 *   intr_timer_cycles = intr_timer_usec * multiplier / divisor
313 	 *
314 	 * Interrupt coalescing timer in usecs can be be converted/obtained
315 	 * from CPU cycles as follows:
316 	 *
317 	 *   intr_timer_usec = intr_timer_cycles * divisor / multiplier
318 	 *
319 	 * in: none
320 	 * out: (u32)a0 = multiplier
321 	 *      (u32)a1 = divisor
322 	 *      (u32)a2 = maximum timer value in usec
323 	 */
324 	CMD_INTR_COAL_CONVERT = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 50),
325 
326 	/*
327 	 * ISCSI DUMP API:
328 	 * in: (u64)a0=paddr of the param or param itself
329 	 *     (u32)a1=ISCSI_CMD_xxx
330 	 */
331 	CMD_ISCSI_DUMP_REQ = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 51),
332 
333 	/*
334 	 * ISCSI DUMP STATUS API:
335 	 * in: (u32)a0=cmd tag
336 	 * in: (u32)a1=ISCSI_CMD_xxx
337 	 * out: (u32)a0=cmd status
338 	 */
339 	CMD_ISCSI_DUMP_STATUS = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 52),
340 
341 	/*
342 	 * Subvnic migration from MQ <--> VF.
343 	 * Enable the LIF migration from MQ to VF and vice versa. MQ and VF
344 	 * indexes are statically bound at the time of initialization.
345 	 * Based on the
346 	 * direction of migration, the resources of either MQ or the VF shall
347 	 * be attached to the LIF.
348 	 * in:        (u32)a0=Direction of Migration
349 	 *					0=> Migrate to VF
350 	 *					1=> Migrate to MQ
351 	 *            (u32)a1=VF index (MQ index)
352 	 */
353 	CMD_MIGRATE_SUBVNIC = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 53),
354 
355 	/*
356 	 * Register / Deregister the notification block for MQ subvnics
357 	 * in:
358 	 *   (u64)a0=paddr to notify (set paddr=0 to unset)
359 	 *   (u32)a1 & 0x00000000ffffffff=sizeof(struct vnic_devcmd_notify)
360 	 *   (u16)a1 & 0x0000ffff00000000=intr num (-1 for no intr)
361 	 * out:
362 	 *   (u32)a1 = effective size
363 	 */
364 	CMD_SUBVNIC_NOTIFY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 54),
365 
366 	/*
367 	 * Set the predefined mac address as default
368 	 * in:
369 	 *   (u48)a0=mac addr
370 	 */
371 	CMD_SET_MAC_ADDR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 55),
372 
373 	/* Update the provisioning info of the given VIF
374 	 *     (u64)a0=paddr of vnic_devcmd_provinfo
375 	 *     (u32)a1=sizeof provision info
376 	 */
377 	CMD_PROV_INFO_UPDATE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 56),
378 
379 	/*
380 	 * Initialization for the devcmd2 interface.
381 	 * in: (u64) a0=host result buffer physical address
382 	 * in: (u16) a1=number of entries in result buffer
383 	 */
384 	CMD_INITIALIZE_DEVCMD2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 57)
385 };
386 
387 /* flags for CMD_OPEN */
388 #define CMD_OPENF_OPROM		0x1	/* open coming from option rom */
389 
390 #define CMD_OPENF_RQ_ENABLE_THEN_POST   0x2
391 
392 /* flags for CMD_INIT */
393 #define CMD_INITF_DEFAULT_MAC	0x1	/* init with default mac addr */
394 
395 /* flags for CMD_PACKET_FILTER */
396 #define CMD_PFILTER_DIRECTED		0x01
397 #define CMD_PFILTER_MULTICAST		0x02
398 #define CMD_PFILTER_BROADCAST		0x04
399 #define CMD_PFILTER_PROMISCUOUS		0x08
400 #define CMD_PFILTER_ALL_MULTICAST	0x10
401 
402 enum vnic_devcmd_status {
403 	STAT_NONE = 0,
404 	STAT_BUSY = 1 << 0,	/* cmd in progress */
405 	STAT_ERROR = 1 << 1,	/* last cmd caused error (code in a0) */
406 };
407 
408 enum vnic_devcmd_error {
409 	ERR_SUCCESS = 0,
410 	ERR_EINVAL = 1,
411 	ERR_EFAULT = 2,
412 	ERR_EPERM = 3,
413 	ERR_EBUSY = 4,
414 	ERR_ECMDUNKNOWN = 5,
415 	ERR_EBADSTATE = 6,
416 	ERR_ENOMEM = 7,
417 	ERR_ETIMEDOUT = 8,
418 	ERR_ELINKDOWN = 9,
419 };
420 
421 struct vnic_devcmd_fw_info {
422 	char fw_version[32];
423 	char fw_build[32];
424 	char hw_version[32];
425 	char hw_serial_number[32];
426 };
427 
428 struct vnic_devcmd_notify {
429 	u32 csum;		/* checksum over following words */
430 
431 	u32 link_state;		/* link up == 1 */
432 	u32 port_speed;		/* effective port speed (rate limit) */
433 	u32 mtu;		/* MTU */
434 	u32 msglvl;		/* requested driver msg lvl */
435 	u32 uif;		/* uplink interface */
436 	u32 status;		/* status bits (see VNIC_STF_*) */
437 	u32 error;		/* error code (see ERR_*) for first ERR */
438 	u32 link_down_cnt;	/* running count of link down transitions */
439 };
440 #define VNIC_STF_FATAL_ERR	0x0001	/* fatal fw error */
441 
442 struct vnic_devcmd_provinfo {
443 	u8 oui[3];
444 	u8 type;
445 	u8 data[];
446 };
447 
448 /*
449  * Writing cmd register causes STAT_BUSY to get set in status register.
450  * When cmd completes, STAT_BUSY will be cleared.
451  *
452  * If cmd completed successfully STAT_ERROR will be clear
453  * and args registers contain cmd-specific results.
454  *
455  * If cmd error, STAT_ERROR will be set and args[0] contains error code.
456  *
457  * status register is read-only.  While STAT_BUSY is set,
458  * all other register contents are read-only.
459  */
460 
461 /* Make sizeof(vnic_devcmd) a power-of-2 for I/O BAR. */
462 #define VNIC_DEVCMD_NARGS 15
463 struct vnic_devcmd {
464 	u32 status;			/* RO */
465 	u32 cmd;			/* RW */
466 	u64 args[VNIC_DEVCMD_NARGS];	/* RW cmd args (little-endian) */
467 };
468 
469 /*
470  * Version 2 of the interface.
471  *
472  * Some things are carried over, notably the vnic_devcmd_cmd enum.
473  */
474 
475 /*
476  * Flags for vnic_devcmd2.flags
477  */
478 
479 #define DEVCMD2_FNORESULT	0x1 /* Don't copy result to host */
480 
481 #define VNIC_DEVCMD2_NARGS			VNIC_DEVCMD_NARGS
482 
483 struct vnic_devcmd2 {
484 	u16 pad;
485 	u16 flags;
486 	u32 cmd;                /* same command #defines as original */
487 	u64 args[VNIC_DEVCMD2_NARGS];
488 };
489 
490 #define VNIC_DEVCMD2_NRESULTS			VNIC_DEVCMD_NARGS
491 struct devcmd2_result {
492 	u64 results[VNIC_DEVCMD2_NRESULTS];
493 	u32 pad;
494 	u16 completed_index;    /* into copy WQ */
495 	u8  error;              /* same error codes as original */
496 	u8  color;              /* 0 or 1 as with completion queues */
497 };
498 
499 #define DEVCMD2_RING_SIZE			32
500 #define DEVCMD2_DESC_SIZE			128
501 
502 #define DEVCMD2_RESULTS_SIZE_MAX		((1 << 16) - 1)
503 
504 #endif /* _VNIC_DEVCMD_H_ */
505