forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/scsi/fnic/vnic_devcmd.h
....@@ -170,7 +170,8 @@
170170
171171 /* variant of CMD_INIT, with provisioning info
172172 * (u64)a0=paddr of vnic_devcmd_provinfo
173
- * (u32)a1=sizeof provision info */
173
+ * (u32)a1=sizeof provision info
174
+ */
174175 CMD_INIT_PROV_INFO = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 27),
175176
176177 /* enable virtual link */
....@@ -262,11 +263,131 @@
262263 * non-zero for resetting vlan to the default
263264 * out: (u16)a0=old default vlan
264265 */
265
- CMD_SET_DEFAULT_VLAN = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 46)
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)
266385 };
267386
268387 /* flags for CMD_OPEN */
269388 #define CMD_OPENF_OPROM 0x1 /* open coming from option rom */
389
+
390
+#define CMD_OPENF_RQ_ENABLE_THEN_POST 0x2
270391
271392 /* flags for CMD_INIT */
272393 #define CMD_INITF_DEFAULT_MAC 0x1 /* init with default mac addr */
....@@ -321,7 +442,7 @@
321442 struct vnic_devcmd_provinfo {
322443 u8 oui[3];
323444 u8 type;
324
- u8 data[0];
445
+ u8 data[];
325446 };
326447
327448 /*
....@@ -345,4 +466,39 @@
345466 u64 args[VNIC_DEVCMD_NARGS]; /* RW cmd args (little-endian) */
346467 };
347468
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
+
348504 #endif /* _VNIC_DEVCMD_H_ */