forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/include/bcmmsgbuf.h
....@@ -1,18 +1,19 @@
1
-/* SPDX-License-Identifier: GPL-2.0 */
21 /*
32 * MSGBUF network driver ioctl/indication encoding
43 * Broadcom 802.11abg Networking Device Driver
54 *
65 * Definitions subject to change without notice.
76 *
8
- * Copyright (C) 1999-2019, Broadcom Corporation
9
- *
7
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
8
+ *
9
+ * Copyright (C) 1999-2017, Broadcom Corporation
10
+ *
1011 * Unless you and Broadcom execute a separate written software license
1112 * agreement governing use of this software, this software is licensed to you
1213 * under the terms of the GNU General Public License version 2 (the "GPL"),
1314 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
1415 * following added to such license:
15
- *
16
+ *
1617 * As a special exception, the copyright holders of this software give you
1718 * permission to link this software with independent modules, and to copy and
1819 * distribute the resulting executable under terms of your choice, provided that
....@@ -20,7 +21,7 @@
2021 * the license of that module. An independent module is a module which is not
2122 * derived from this software. The special exception does not apply to any
2223 * modifications of the software.
23
- *
24
+ *
2425 * Notwithstanding the above, under no circumstances may you combine this
2526 * software in any way with any other Broadcom software provided under a license
2627 * other than the GPL, without Broadcom's express prior written consent.
....@@ -28,12 +29,12 @@
2829 *
2930 * <<Broadcom-WL-IPTag/Open:>>
3031 *
31
- * $Id: bcmmsgbuf.h 541060 2015-03-13 23:28:01Z $
32
+ * $Id$
3233 */
3334 #ifndef _bcmmsgbuf_h_
3435 #define _bcmmsgbuf_h_
3536
36
-#include <proto/ethernet.h>
37
+#include <ethernet.h>
3738 #include <wlioctl.h>
3839 #include <bcmpcie.h>
3940
....@@ -48,15 +49,32 @@
4849 #define H2DRING_TXPOST_ITEMSIZE 48
4950 #define H2DRING_RXPOST_ITEMSIZE 32
5051 #define H2DRING_CTRL_SUB_ITEMSIZE 40
51
-#define D2HRING_TXCMPLT_ITEMSIZE 16
52
-#define D2HRING_RXCMPLT_ITEMSIZE 32
52
+
53
+#define D2HRING_TXCMPLT_ITEMSIZE 24
54
+#define D2HRING_RXCMPLT_ITEMSIZE 40
55
+
56
+#define D2HRING_TXCMPLT_ITEMSIZE_PREREV7 16
57
+#define D2HRING_RXCMPLT_ITEMSIZE_PREREV7 32
58
+
5359 #define D2HRING_CTRL_CMPLT_ITEMSIZE 24
60
+#define H2DRING_INFO_BUFPOST_ITEMSIZE H2DRING_CTRL_SUB_ITEMSIZE
61
+#define D2HRING_INFO_BUFCMPLT_ITEMSIZE D2HRING_CTRL_CMPLT_ITEMSIZE
62
+
63
+#define D2HRING_SNAPSHOT_CMPLT_ITEMSIZE 20
5464
5565 #define H2DRING_TXPOST_MAX_ITEM 512
5666 #define H2DRING_RXPOST_MAX_ITEM 512
5767 #define H2DRING_CTRL_SUB_MAX_ITEM 64
5868 #define D2HRING_TXCMPLT_MAX_ITEM 1024
5969 #define D2HRING_RXCMPLT_MAX_ITEM 512
70
+
71
+#define H2DRING_DYNAMIC_INFO_MAX_ITEM 32
72
+#define D2HRING_DYNAMIC_INFO_MAX_ITEM 32
73
+
74
+#define D2HRING_EDL_HDR_SIZE 48u
75
+#define D2HRING_EDL_ITEMSIZE 2048u
76
+#define D2HRING_EDL_MAX_ITEM 256u
77
+#define D2HRING_EDL_WATERMARK (D2HRING_EDL_MAX_ITEM >> 5u)
6078
6179 #define D2HRING_CTRL_CMPLT_MAX_ITEM 64
6280
....@@ -74,6 +92,11 @@
7492 };
7593
7694 #define MESSAGE_PAYLOAD(a) (a & MSG_TYPE_INTERNAL_USE_START) ? TRUE : FALSE
95
+#define PCIEDEV_FIRMWARE_TSINFO 0x1
96
+#define PCIEDEV_FIRMWARE_TSINFO_FIRST 0x1
97
+#define PCIEDEV_FIRMWARE_TSINFO_MIDDLE 0x2
98
+#define PCIEDEV_BTLOG_POST 0x3
99
+#define PCIEDEV_BT_SNAPSHOT_POST 0x4
77100
78101 #ifdef PCIE_API_REV1
79102
....@@ -136,12 +159,16 @@
136159
137160 /** message type */
138161 typedef enum bcmpcie_msgtype {
139
- MSG_TYPE_GEN_STATUS = 0x1,
162
+ MSG_TYPE_GEN_STATUS = 0x1,
140163 MSG_TYPE_RING_STATUS = 0x2,
141164 MSG_TYPE_FLOW_RING_CREATE = 0x3,
142165 MSG_TYPE_FLOW_RING_CREATE_CMPLT = 0x4,
166
+ /* Enum value as copied from BISON 7.15: new generic message */
167
+ MSG_TYPE_RING_CREATE_CMPLT = 0x4,
143168 MSG_TYPE_FLOW_RING_DELETE = 0x5,
144169 MSG_TYPE_FLOW_RING_DELETE_CMPLT = 0x6,
170
+ /* Enum value as copied from BISON 7.15: new generic message */
171
+ MSG_TYPE_RING_DELETE_CMPLT = 0x6,
145172 MSG_TYPE_FLOW_RING_FLUSH = 0x7,
146173 MSG_TYPE_FLOW_RING_FLUSH_CMPLT = 0x8,
147174 MSG_TYPE_IOCTLPTR_REQ = 0x9,
....@@ -154,7 +181,7 @@
154181 MSG_TYPE_TX_STATUS = 0x10,
155182 MSG_TYPE_RXBUF_POST = 0x11,
156183 MSG_TYPE_RX_CMPLT = 0x12,
157
- MSG_TYPE_LPBK_DMAXFER = 0x13,
184
+ MSG_TYPE_LPBK_DMAXFER = 0x13,
158185 MSG_TYPE_LPBK_DMAXFER_CMPLT = 0x14,
159186 MSG_TYPE_FLOW_RING_RESUME = 0x15,
160187 MSG_TYPE_FLOW_RING_RESUME_CMPLT = 0x16,
....@@ -172,7 +199,16 @@
172199 MSG_TYPE_D2H_RING_CONFIG_CMPLT = 0x22,
173200 MSG_TYPE_H2D_MAILBOX_DATA = 0x23,
174201 MSG_TYPE_D2H_MAILBOX_DATA = 0x24,
175
-
202
+ MSG_TYPE_TIMSTAMP_BUFPOST = 0x25,
203
+ MSG_TYPE_HOSTTIMSTAMP = 0x26,
204
+ MSG_TYPE_HOSTTIMSTAMP_CMPLT = 0x27,
205
+ MSG_TYPE_FIRMWARE_TIMESTAMP = 0x28,
206
+ MSG_TYPE_SNAPSHOT_UPLOAD = 0x29,
207
+ MSG_TYPE_SNAPSHOT_CMPLT = 0x2A,
208
+ MSG_TYPE_H2D_RING_DELETE = 0x2B,
209
+ MSG_TYPE_D2H_RING_DELETE = 0x2C,
210
+ MSG_TYPE_H2D_RING_DELETE_CMPLT = 0x2D,
211
+ MSG_TYPE_D2H_RING_DELETE_CMPLT = 0x2E,
176212 MSG_TYPE_API_MAX_RSVD = 0x3F
177213 } bcmpcie_msg_type_t;
178214
....@@ -184,7 +220,14 @@
184220 MSG_TYPE_HOST_FETCH = 0x44,
185221 MSG_TYPE_LPBK_DMAXFER_PYLD = 0x45,
186222 MSG_TYPE_TXMETADATA_PYLD = 0x46,
187
- MSG_TYPE_INDX_UPDATE = 0x47
223
+ MSG_TYPE_INDX_UPDATE = 0x47,
224
+ MSG_TYPE_INFO_PYLD = 0x48,
225
+ MSG_TYPE_TS_EVENT_PYLD = 0x49,
226
+ MSG_TYPE_PVT_BTLOG_CMPLT = 0x4A,
227
+ MSG_TYPE_BTLOG_PYLD = 0x4B,
228
+ MSG_TYPE_HMAPTEST_PYLD = 0x4C,
229
+ MSG_TYPE_PVT_BT_SNAPSHOT_CMPLT = 0x4D,
230
+ MSG_TYPE_BT_SNAPSHOT_PYLD = 0x4E
188231 } bcmpcie_msgtype_int_t;
189232
190233 typedef enum bcmpcie_msgtype_u {
....@@ -212,6 +255,44 @@
212255 uint16 msecs; /* interrupt coalescing: timeout in millisecs */
213256 } bcmpcie_soft_doorbell_t;
214257
258
+/**
259
+ * D2H interrupt using MSI instead of INTX
260
+ * Host configures MSI vector offset for each D2H interrupt
261
+ *
262
+ * D2H_RING_CONFIG_SUBTYPE_MSI_DOORBELL
263
+ */
264
+typedef enum bcmpcie_msi_intr_idx {
265
+ MSI_INTR_IDX_CTRL_CMPL_RING = 0,
266
+ MSI_INTR_IDX_TXP_CMPL_RING = 1,
267
+ MSI_INTR_IDX_RXP_CMPL_RING = 2,
268
+ MSI_INTR_IDX_INFO_CMPL_RING = 3,
269
+ MSI_INTR_IDX_MAILBOX = 4,
270
+ MSI_INTR_IDX_MAX = 5
271
+} bcmpcie_msi_intr_idx_t;
272
+
273
+#define BCMPCIE_D2H_MSI_OFFSET_SINGLE 0
274
+typedef enum bcmpcie_msi_offset_type {
275
+ BCMPCIE_D2H_MSI_OFFSET_MB0 = 2,
276
+ BCMPCIE_D2H_MSI_OFFSET_MB1 = 3,
277
+ BCMPCIE_D2H_MSI_OFFSET_DB0 = 4,
278
+ BCMPCIE_D2H_MSI_OFFSET_DB1 = 5,
279
+ BCMPCIE_D2H_MSI_OFFSET_H1_DB0 = 6,
280
+ BCMPCIE_D2H_MSI_OFFSET_MAX = 7
281
+} bcmpcie_msi_offset_type_t;
282
+
283
+typedef struct bcmpcie_msi_offset {
284
+ uint16 intr_idx; /* interrupt index */
285
+ uint16 msi_offset; /* msi vector offset */
286
+} bcmpcie_msi_offset_t;
287
+
288
+typedef struct bcmpcie_msi_offset_config {
289
+ uint32 len;
290
+ bcmpcie_msi_offset_t bcmpcie_msi_offset[MSI_INTR_IDX_MAX];
291
+} bcmpcie_msi_offset_config_t;
292
+
293
+#define BCMPCIE_D2H_MSI_OFFSET_DEFAULT BCMPCIE_D2H_MSI_OFFSET_DB1
294
+
295
+#define BCMPCIE_D2H_MSI_SINGLE 0xFFFE
215296
216297 /* if_id */
217298 #define BCMPCIE_CMNHDR_IFIDX_PHYINTF_SHFT 5
....@@ -226,13 +307,14 @@
226307 /* flags */
227308 #define BCMPCIE_CMNHDR_FLAGS_DMA_R_IDX 0x1
228309 #define BCMPCIE_CMNHDR_FLAGS_DMA_R_IDX_INTR 0x2
310
+#define BCMPCIE_CMNHDR_FLAGS_TS_SEQNUM_INIT 0x4
229311 #define BCMPCIE_CMNHDR_FLAGS_PHASE_BIT 0x80
230
-
312
+#define BCMPCIE_CMNHDR_PHASE_BIT_INIT 0x80
231313
232314 /* IOCTL request message */
233315 typedef struct ioctl_req_msg {
234316 /** common message header */
235
- cmn_msg_hdr_t cmn_hdr;
317
+ cmn_msg_hdr_t cmn_hdr;
236318 /** ioctl command type */
237319 uint32 cmd;
238320 /** ioctl transaction ID, to pair with a ioctl response */
....@@ -262,6 +344,76 @@
262344 uint32 rsvd[4];
263345 } ioctl_resp_evt_buf_post_msg_t;
264346
347
+/* buffer post messages for device to use to return dbg buffers */
348
+typedef ioctl_resp_evt_buf_post_msg_t info_buf_post_msg_t;
349
+
350
+#define DHD_INFOBUF_RX_BUFPOST_PKTSZ (2 * 1024)
351
+
352
+#define DHD_BTLOG_RX_BUFPOST_PKTSZ (2 * 1024)
353
+
354
+/* An infobuf host buffer starts with a 32 bit (LE) version. */
355
+#define PCIE_INFOBUF_V1 1
356
+/* Infobuf v1 type MSGTRACE's data is exactly the same as the MSGTRACE data that
357
+ * is wrapped previously/also in a WLC_E_TRACE event. See structure
358
+ * msgrace_hdr_t in msgtrace.h.
359
+*/
360
+#define PCIE_INFOBUF_V1_TYPE_MSGTRACE 1
361
+
362
+/* Infobuf v1 type LOGTRACE data is exactly the same as the LOGTRACE data that
363
+ * is wrapped previously/also in a WLC_E_TRACE event. See structure
364
+ * msgrace_hdr_t in msgtrace.h. (The only difference between a MSGTRACE
365
+ * and a LOGTRACE is the "trace type" field.)
366
+*/
367
+#define PCIE_INFOBUF_V1_TYPE_LOGTRACE 2
368
+
369
+/* An infobuf version 1 host buffer has a single TLV. The information on the
370
+ * version 1 types follow this structure definition. (int's LE)
371
+*/
372
+typedef struct info_buf_payload_hdr_s {
373
+ uint16 type;
374
+ uint16 length;
375
+} info_buf_payload_hdr_t;
376
+
377
+/* BT logs/memory to DMA directly from BT memory to host */
378
+typedef struct info_buf_btlog_s {
379
+ void (*status_cb)(void *ctx, void *p, int error); /* obsolete - to be removed */
380
+ void *ctx;
381
+ dma64addr_t src_addr;
382
+ uint32 length;
383
+ bool (*pcie_status_cb)(osl_t *osh, void *p, int error);
384
+ uint32 bt_intstatus;
385
+ int error;
386
+} info_buf_btlog_t;
387
+
388
+/** snapshot upload request message */
389
+typedef struct snapshot_upload_request_msg {
390
+ /** common message header */
391
+ cmn_msg_hdr_t cmn_hdr;
392
+ /** length of the snaphost buffer supplied */
393
+ uint32 snapshot_buf_len;
394
+ /** type of snapshot */
395
+ uint8 snapshot_type;
396
+ /** snapshot param */
397
+ uint8 snapshot_param;
398
+ /** to align the host address on 8 byte boundary */
399
+ uint8 reserved[2];
400
+ /** always align on 8 byte boundary */
401
+ bcm_addr64_t host_buf_addr;
402
+ uint32 rsvd[4];
403
+} snapshot_upload_request_msg_t;
404
+
405
+/** snapshot types */
406
+typedef enum bcmpcie_snapshot_type {
407
+ SNAPSHOT_TYPE_BT = 0, /* Bluetooth SRAM and patch RAM */
408
+ SNAPSHOT_TYPE_WLAN_SOCRAM = 1, /* WLAN SOCRAM */
409
+ SNAPSHOT_TYPE_WLAN_HEAP = 2, /* WLAN HEAP */
410
+ SNAPSHOT_TYPE_WLAN_REGISTER = 3 /* WLAN registers */
411
+} bcmpcie_snapshot_type_t;
412
+
413
+#define PCIE_DMA_XFER_FLG_D11_LPBK_MASK 0xF
414
+#define PCIE_DMA_XFER_FLG_D11_LPBK_SHIFT 2
415
+#define PCIE_DMA_XFER_FLG_CORE_NUMBER_MASK 3
416
+#define PCIE_DMA_XFER_FLG_CORE_NUMBER_SHIFT 0
265417
266418 typedef struct pcie_dma_xfer_params {
267419 /** common message header */
....@@ -279,20 +431,26 @@
279431 uint32 srcdelay;
280432 /** delay before doing the dest txfer */
281433 uint32 destdelay;
282
- uint32 rsvd;
434
+ uint8 rsvd[3];
435
+ /* bit0: D11 DMA loopback flag */
436
+ uint8 flags;
283437 } pcie_dma_xfer_params_t;
284438
439
+#define BCMPCIE_FLOW_RING_INTF_HP2P 0x1
285440 /** Complete msgbuf hdr for flow ring update from host to dongle */
286441 typedef struct tx_flowring_create_request {
287442 cmn_msg_hdr_t msg;
288443 uint8 da[ETHER_ADDR_LEN];
289444 uint8 sa[ETHER_ADDR_LEN];
290445 uint8 tid;
291
- uint8 if_flags;
446
+ uint8 if_flags;
292447 uint16 flow_ring_id;
293
- uint8 tc;
294
- uint8 priority;
295
- uint16 int_vector;
448
+ uint8 tc;
449
+ /* priority_ifrmmask is to define core mask in ifrm mode.
450
+ * currently it is not used for priority. so uses solely for ifrm mask
451
+ */
452
+ uint8 priority_ifrmmask;
453
+ uint16 int_vector;
296454 uint16 max_items;
297455 uint16 len_item;
298456 bcm_addr64_t flow_ring_ptr;
....@@ -301,14 +459,17 @@
301459 typedef struct tx_flowring_delete_request {
302460 cmn_msg_hdr_t msg;
303461 uint16 flow_ring_id;
304
- uint16 reason;
462
+ uint16 reason;
305463 uint32 rsvd[7];
306464 } tx_flowring_delete_request_t;
465
+
466
+typedef tx_flowring_delete_request_t d2h_ring_delete_req_t;
467
+typedef tx_flowring_delete_request_t h2d_ring_delete_req_t;
307468
308469 typedef struct tx_flowring_flush_request {
309470 cmn_msg_hdr_t msg;
310471 uint16 flow_ring_id;
311
- uint16 reason;
472
+ uint16 reason;
312473 uint32 rsvd[7];
313474 } tx_flowring_flush_request_t;
314475
....@@ -328,8 +489,73 @@
328489 uint32 data[6];
329490 /** D2H_RING_CONFIG_SUBTYPE_SOFT_DOORBELL */
330491 bcmpcie_soft_doorbell_t soft_doorbell;
492
+ /** D2H_RING_CONFIG_SUBTYPE_MSI_DOORBELL */
493
+ bcmpcie_msi_offset_config_t msi_offset;
331494 };
332495 } ring_config_req_t;
496
+
497
+/* data structure to use to create on the fly d2h rings */
498
+typedef struct d2h_ring_create_req {
499
+ cmn_msg_hdr_t msg;
500
+ uint16 ring_id;
501
+ uint16 ring_type;
502
+ uint32 flags;
503
+ bcm_addr64_t ring_ptr;
504
+ uint16 max_items;
505
+ uint16 len_item;
506
+ uint32 rsvd[3];
507
+} d2h_ring_create_req_t;
508
+
509
+/* data structure to use to create on the fly h2d rings */
510
+#define MAX_COMPLETION_RING_IDS_ASSOCIATED 4
511
+typedef struct h2d_ring_create_req {
512
+ cmn_msg_hdr_t msg;
513
+ uint16 ring_id;
514
+ uint8 ring_type;
515
+ uint8 n_completion_ids;
516
+ uint32 flags;
517
+ bcm_addr64_t ring_ptr;
518
+ uint16 max_items;
519
+ uint16 len_item;
520
+ uint16 completion_ring_ids[MAX_COMPLETION_RING_IDS_ASSOCIATED];
521
+ uint32 rsvd;
522
+} h2d_ring_create_req_t;
523
+
524
+typedef struct d2h_ring_config_req {
525
+ cmn_msg_hdr_t msg;
526
+ uint16 d2h_ring_config_subtype;
527
+ uint16 d2h_ring_id;
528
+ uint32 d2h_ring_config_data[4];
529
+ uint32 rsvd[3];
530
+} d2h_ring_config_req_t;
531
+
532
+typedef struct h2d_ring_config_req {
533
+ cmn_msg_hdr_t msg;
534
+ uint16 h2d_ring_config_subtype;
535
+ uint16 h2d_ring_id;
536
+ uint32 h2d_ring_config_data;
537
+ uint32 rsvd[6];
538
+} h2d_ring_config_req_t;
539
+
540
+typedef struct h2d_mailbox_data {
541
+ cmn_msg_hdr_t msg;
542
+ uint32 mail_box_data;
543
+ uint32 rsvd[7];
544
+} h2d_mailbox_data_t;
545
+typedef struct host_timestamp_msg {
546
+ cmn_msg_hdr_t msg;
547
+ uint16 xt_id; /* transaction ID */
548
+ uint16 input_data_len; /* data len at the host_buf_addr, data in TLVs */
549
+ uint16 seqnum; /* number of times host captured the timestamp */
550
+ uint16 rsvd;
551
+ /* always align on 8 byte boundary */
552
+ bcm_addr64_t host_buf_addr;
553
+ /* rsvd */
554
+ uint32 rsvd1[4];
555
+} host_timestamp_msg_t;
556
+
557
+/* buffer post message for timestamp events MSG_TYPE_TIMSTAMP_BUFPOST */
558
+typedef ioctl_resp_evt_buf_post_msg_t ts_buf_post_msg_t;
333559
334560 typedef union ctrl_submit_item {
335561 ioctl_req_msg_t ioctl_req;
....@@ -339,19 +565,77 @@
339565 tx_flowring_delete_request_t flow_delete;
340566 tx_flowring_flush_request_t flow_flush;
341567 ring_config_req_t ring_config_req;
568
+ d2h_ring_create_req_t d2h_create;
569
+ h2d_ring_create_req_t h2d_create;
570
+ d2h_ring_config_req_t d2h_config;
571
+ h2d_ring_config_req_t h2d_config;
572
+ h2d_mailbox_data_t h2d_mailbox_data;
573
+ host_timestamp_msg_t host_ts;
574
+ ts_buf_post_msg_t ts_buf_post;
575
+ d2h_ring_delete_req_t d2h_delete;
576
+ h2d_ring_delete_req_t h2d_delete;
342577 unsigned char check[H2DRING_CTRL_SUB_ITEMSIZE];
343578 } ctrl_submit_item_t;
579
+
580
+typedef struct info_ring_submit_item {
581
+ info_buf_post_msg_t info_buf_post;
582
+ unsigned char check[H2DRING_INFO_BUFPOST_ITEMSIZE];
583
+} info_sumbit_item_t;
344584
345585 /** Control Completion messages (20 bytes) */
346586 typedef struct compl_msg_hdr {
347587 /** status for the completion */
348588 int16 status;
349589 /** submisison flow ring id which generated this status */
350
- uint16 flow_ring_id;
590
+ union {
591
+ uint16 ring_id;
592
+ uint16 flow_ring_id;
593
+ };
351594 } compl_msg_hdr_t;
352595
353596 /** XOR checksum or a magic number to audit DMA done */
354597 typedef uint32 dma_done_t;
598
+
599
+#define MAX_CLKSRC_ID 0xF
600
+#define TX_PKT_RETRY_CNT_0_MASK 0x000000FF
601
+#define TX_PKT_RETRY_CNT_0_SHIFT 0
602
+#define TX_PKT_RETRY_CNT_1_MASK 0x0000FF00
603
+#define TX_PKT_RETRY_CNT_1_SHIFT 8
604
+#define TX_PKT_RETRY_CNT_2_MASK 0x00FF0000
605
+#define TX_PKT_RETRY_CNT_2_SHIFT 16
606
+#define TX_PKT_BAND_INFO 0x0F000000
607
+#define TX_PKT_BAND_INFO_SHIFT 24
608
+#define TX_PKT_VALID_INFO 0xF0000000
609
+#define TX_PKT_VALID_INFO_SHIFT 28
610
+
611
+typedef struct ts_timestamp_srcid {
612
+ union {
613
+ uint32 ts_low; /* time stamp low 32 bits */
614
+ uint32 rate_spec; /* use ratespec */
615
+ };
616
+ union {
617
+ uint32 ts_high; /* time stamp high 28 bits */
618
+ union {
619
+ uint32 ts_high_ext :28; /* time stamp high 28 bits */
620
+ uint32 clk_id_ext :3; /* clock ID source */
621
+ uint32 phase :1; /* Phase bit */
622
+ dma_done_t marker_ext;
623
+ };
624
+ uint32 tx_pkt_band_retry_info;
625
+ };
626
+} ts_timestamp_srcid_t;
627
+
628
+typedef ts_timestamp_srcid_t ipc_timestamp_t;
629
+
630
+typedef struct ts_timestamp {
631
+ uint32 low;
632
+ uint32 high;
633
+} ts_timestamp_t;
634
+
635
+typedef ts_timestamp_t tick_count_64_t;
636
+typedef ts_timestamp_t ts_timestamp_ns_64_t;
637
+typedef ts_timestamp_t ts_correction_m_t;
638
+typedef ts_timestamp_t ts_correction_b_t;
355639
356640 /* completion header status codes */
357641 #define BCMPCIE_SUCCESS 0
....@@ -366,6 +650,19 @@
366650 #define BCMPCIE_NO_IOCTLRESP_BUF 9
367651 #define BCMPCIE_MAX_IOCTLRESP_BUF 10
368652 #define BCMPCIE_MAX_EVENT_BUF 11
653
+#define BCMPCIE_BAD_PHASE 12
654
+#define BCMPCIE_INVALID_CPL_RINGID 13
655
+#define BCMPCIE_RING_TYPE_INVALID 14
656
+#define BCMPCIE_NO_TS_EVENT_BUF 15
657
+#define BCMPCIE_MAX_TS_EVENT_BUF 16
658
+#define BCMPCIE_PCIE_NO_BTLOG_BUF 17
659
+#define BCMPCIE_BT_DMA_ERR 18
660
+#define BCMPCIE_BT_DMA_DESCR_FETCH_ERR 19
661
+#define BCMPCIE_SNAPSHOT_ERR 20
662
+#define BCMPCIE_NOT_READY 21
663
+#define BCMPCIE_INVALID_DATA 22
664
+#define BCMPCIE_NO_RESPONSE 23
665
+#define BCMPCIE_NO_CLOCK 24
369666
370667 /** IOCTL completion response */
371668 typedef struct ioctl_compl_resp_msg {
....@@ -388,7 +685,7 @@
388685 /** common message header */
389686 cmn_msg_hdr_t cmn_hdr;
390687 /** completion message header */
391
- compl_msg_hdr_t compl_hdr;
688
+ compl_msg_hdr_t compl_hdr;
392689 /** cmd id */
393690 uint32 cmd;
394691 uint32 rsvd;
....@@ -447,25 +744,33 @@
447744 dma_done_t marker;
448745 } pcie_ring_status_t;
449746
450
-typedef struct tx_flowring_create_response {
451
- cmn_msg_hdr_t msg;
452
- compl_msg_hdr_t cmplt;
747
+typedef struct ring_create_response {
748
+ cmn_msg_hdr_t cmn_hdr;
749
+ compl_msg_hdr_t cmplt;
453750 uint32 rsvd[2];
454751 /** XOR checksum or a magic number to audit DMA done */
455752 dma_done_t marker;
456
-} tx_flowring_create_response_t;
753
+} ring_create_response_t;
754
+
755
+typedef ring_create_response_t tx_flowring_create_response_t;
756
+typedef ring_create_response_t h2d_ring_create_response_t;
757
+typedef ring_create_response_t d2h_ring_create_response_t;
457758
458759 typedef struct tx_flowring_delete_response {
459760 cmn_msg_hdr_t msg;
460
- compl_msg_hdr_t cmplt;
461
- uint32 rsvd[2];
761
+ compl_msg_hdr_t cmplt;
762
+ uint16 read_idx;
763
+ uint16 rsvd[3];
462764 /** XOR checksum or a magic number to audit DMA done */
463765 dma_done_t marker;
464766 } tx_flowring_delete_response_t;
465767
768
+typedef tx_flowring_delete_response_t h2d_ring_delete_response_t;
769
+typedef tx_flowring_delete_response_t d2h_ring_delete_response_t;
770
+
466771 typedef struct tx_flowring_flush_response {
467772 cmn_msg_hdr_t msg;
468
- compl_msg_hdr_t cmplt;
773
+ compl_msg_hdr_t cmplt;
469774 uint32 rsvd[2];
470775 /** XOR checksum or a magic number to audit DMA done */
471776 dma_done_t marker;
....@@ -487,10 +792,80 @@
487792 cmn_msg_hdr_t cmn_hdr;
488793 /** completion message header */
489794 compl_msg_hdr_t compl_hdr;
490
- uint32 rsvd[2];
795
+ uint16 subtype;
796
+ uint16 rsvd[3];
491797 /** XOR checksum or a magic number to audit DMA done */
492798 dma_done_t marker;
493799 } ring_config_resp_t;
800
+
801
+typedef struct d2h_mailbox_data {
802
+ cmn_msg_hdr_t msg;
803
+ compl_msg_hdr_t cmplt;
804
+ uint32 d2h_mailbox_data;
805
+ uint32 rsvd[1];
806
+ /* XOR checksum or a magic number to audit DMA done */
807
+ dma_done_t marker;
808
+} d2h_mailbox_data_t;
809
+
810
+/* dbg buf completion msg: send from device to host */
811
+typedef struct info_buf_resp {
812
+ /* common message header */
813
+ cmn_msg_hdr_t cmn_hdr;
814
+ /* completion message header */
815
+ compl_msg_hdr_t compl_hdr;
816
+ /* event data len valid with the event buffer */
817
+ uint16 info_data_len;
818
+ /* sequence number */
819
+ uint16 seqnum;
820
+ /* destination */
821
+ uint8 dest;
822
+ /* rsvd */
823
+ uint8 rsvd[3];
824
+ /* XOR checksum or a magic number to audit DMA done */
825
+ dma_done_t marker;
826
+} info_buf_resp_t;
827
+
828
+/* snapshot completion msg: send from device to host */
829
+typedef struct snapshot_resp {
830
+ /* common message header */
831
+ cmn_msg_hdr_t cmn_hdr;
832
+ /* completion message header */
833
+ compl_msg_hdr_t compl_hdr;
834
+ /* snapshot length uploaded */
835
+ uint32 resp_len;
836
+ /* snapshot type */
837
+ uint8 type;
838
+ /* rsvd */
839
+ uint8 rsvd[3];
840
+ /* XOR checksum or a magic number to audit DMA done */
841
+ dma_done_t marker;
842
+} snapshot_resp_t;
843
+
844
+typedef struct info_ring_cpl_item {
845
+ info_buf_resp_t info_buf_post;
846
+ unsigned char check[D2HRING_INFO_BUFCMPLT_ITEMSIZE];
847
+} info_cpl_item_t;
848
+
849
+typedef struct host_timestamp_msg_cpl {
850
+ cmn_msg_hdr_t msg;
851
+ compl_msg_hdr_t cmplt;
852
+ uint16 xt_id; /* transaction ID */
853
+ uint16 rsvd;
854
+ uint32 rsvd1;
855
+ /* XOR checksum or a magic number to audit DMA done */
856
+ dma_done_t marker;
857
+} host_timestamp_msg_cpl_t;
858
+
859
+typedef struct fw_timestamp_event_msg {
860
+ cmn_msg_hdr_t msg;
861
+ compl_msg_hdr_t cmplt;
862
+ /* fw captures time stamp info and passed that to host in TLVs */
863
+ uint16 buf_len; /* length of the time stamp data copied in host buf */
864
+ uint16 seqnum; /* number of times fw captured time stamp */
865
+ uint32 rsvd;
866
+ /* XOR checksum or a magic number to audit DMA done */
867
+ dma_done_t marker;
868
+} fw_timestamp_event_msg_t;
494869
495870 typedef union ctrl_completion_item {
496871 ioctl_comp_resp_msg_t ioctl_resp;
....@@ -504,7 +879,15 @@
504879 tx_flowring_flush_response_t txfl_flush_resp;
505880 ctrl_compl_msg_t ctrl_compl;
506881 ring_config_resp_t ring_config_resp;
507
- unsigned char check[D2HRING_CTRL_CMPLT_ITEMSIZE];
882
+ d2h_mailbox_data_t d2h_mailbox_data;
883
+ info_buf_resp_t dbg_resp;
884
+ h2d_ring_create_response_t h2d_ring_create_resp;
885
+ d2h_ring_create_response_t d2h_ring_create_resp;
886
+ host_timestamp_msg_cpl_t host_ts_cpl;
887
+ fw_timestamp_event_msg_t fw_ts_event;
888
+ h2d_ring_delete_response_t h2d_ring_delete_resp;
889
+ d2h_ring_delete_response_t d2h_ring_delete_resp;
890
+ unsigned char ctrl_response[D2HRING_CTRL_CMPLT_ITEMSIZE];
508891 } ctrl_completion_item_t;
509892
510893 /** H2D Rxpost ring work items */
....@@ -528,8 +911,7 @@
528911 unsigned char check[H2DRING_RXPOST_ITEMSIZE];
529912 } rxbuf_submit_item_t;
530913
531
-
532
-/** D2H Rxcompletion ring work items */
914
+/* D2H Rxcompletion ring work items for IPC rev7 */
533915 typedef struct host_rxbuf_cmpl {
534916 /** common message header */
535917 cmn_msg_hdr_t cmn_hdr;
....@@ -541,20 +923,22 @@
541923 uint16 data_len;
542924 /** offset in the host rx buffer where the data starts */
543925 uint16 data_offset;
544
- /** offset in the host rx buffer where the data starts */
926
+ /** Flags */
545927 uint16 flags;
546928 /** rx status */
547929 uint32 rx_status_0;
548930 uint32 rx_status_1;
549931 /** XOR checksum or a magic number to audit DMA done */
932
+ /* This is for rev6 only. For IPC rev7, this is a reserved field */
550933 dma_done_t marker;
934
+ /* timestamp */
935
+ ipc_timestamp_t ts;
551936 } host_rxbuf_cmpl_t;
552937
553938 typedef union rxbuf_complete_item {
554939 host_rxbuf_cmpl_t rxcmpl;
555940 unsigned char check[D2HRING_RXCMPLT_ITEMSIZE];
556941 } rxbuf_complete_item_t;
557
-
558942
559943 typedef struct host_txbuf_post {
560944 /** common message header */
....@@ -574,19 +958,41 @@
574958 uint16 metadata_buf_len;
575959 /** provided data buffer len to receive data */
576960 uint16 data_len;
577
- /** XOR checksum or a magic number to audit DMA done */
578
- dma_done_t marker;
961
+ union {
962
+ struct {
963
+ /** extended transmit flags */
964
+ uint8 ext_flags;
965
+ uint8 rsvd1;
966
+
967
+ /** user defined rate */
968
+ uint8 rate;
969
+ uint8 exp_time;
970
+ };
971
+ /** XOR checksum or a magic number to audit DMA done */
972
+ dma_done_t marker;
973
+ };
579974 } host_txbuf_post_t;
580975
581976 #define BCMPCIE_PKT_FLAGS_FRAME_802_3 0x01
582977 #define BCMPCIE_PKT_FLAGS_FRAME_802_11 0x02
583978
979
+#define BCMPCIE_PKT_FLAGS_FRAME_NORETRY 0x01 /* Disable retry on this frame */
980
+#define BCMPCIE_PKT_FLAGS_FRAME_NOAGGR 0x02 /* Disable aggregation for this frame */
981
+#define BCMPCIE_PKT_FLAGS_FRAME_UDR 0x04 /* User defined rate for this frame */
982
+#define BCMPCIE_PKT_FLAGS_FRAME_ATTR_MASK 0x07 /* Attribute mask */
983
+
584984 #define BCMPCIE_PKT_FLAGS_FRAME_EXEMPT_MASK 0x03 /* Exempt uses 2 bits */
585985 #define BCMPCIE_PKT_FLAGS_FRAME_EXEMPT_SHIFT 0x02 /* needs to be shifted past other bits */
586986
587
-
588987 #define BCMPCIE_PKT_FLAGS_PRIO_SHIFT 5
589988 #define BCMPCIE_PKT_FLAGS_PRIO_MASK (7 << BCMPCIE_PKT_FLAGS_PRIO_SHIFT)
989
+#define BCMPCIE_PKT_FLAGS_MONITOR_NO_AMSDU 0x00
990
+#define BCMPCIE_PKT_FLAGS_MONITOR_FIRST_PKT 0x01
991
+#define BCMPCIE_PKT_FLAGS_MONITOR_INTER_PKT 0x02
992
+#define BCMPCIE_PKT_FLAGS_MONITOR_LAST_PKT 0x03
993
+#define BCMPCIE_PKT_FLAGS_NO_FORWARD 0x04
994
+#define BCMPCIE_PKT_FLAGS_MONITOR_SHIFT 8
995
+#define BCMPCIE_PKT_FLAGS_MONITOR_MASK (3 << BCMPCIE_PKT_FLAGS_MONITOR_SHIFT)
590996
591997 /* These are added to fix up compile issues */
592998 #define BCMPCIE_TXPOST_FLAGS_FRAME_802_3 BCMPCIE_PKT_FLAGS_FRAME_802_3
....@@ -594,13 +1000,13 @@
5941000 #define BCMPCIE_TXPOST_FLAGS_PRIO_SHIFT BCMPCIE_PKT_FLAGS_PRIO_SHIFT
5951001 #define BCMPCIE_TXPOST_FLAGS_PRIO_MASK BCMPCIE_PKT_FLAGS_PRIO_MASK
5961002
597
-/** H2D Txpost ring work items */
1003
+/* H2D Txpost ring work items */
5981004 typedef union txbuf_submit_item {
5991005 host_txbuf_post_t txpost;
6001006 unsigned char check[H2DRING_TXPOST_ITEMSIZE];
6011007 } txbuf_submit_item_t;
6021008
603
-/** D2H Txcompletion ring work items */
1009
+/* D2H Txcompletion ring work items - extended for IOC rev7 */
6041010 typedef struct host_txbuf_cmpl {
6051011 /** common message header */
6061012 cmn_msg_hdr_t cmn_hdr;
....@@ -608,14 +1014,22 @@
6081014 compl_msg_hdr_t compl_hdr;
6091015 union {
6101016 struct {
611
- /** provided meta data len */
612
- uint16 metadata_len;
1017
+ union {
1018
+ /** provided meta data len */
1019
+ uint16 metadata_len;
1020
+ /** provided extended TX status */
1021
+ uint16 tx_status_ext;
1022
+ };
6131023 /** WLAN side txstatus */
6141024 uint16 tx_status;
6151025 };
6161026 /** XOR checksum or a magic number to audit DMA done */
1027
+ /* This is for rev6 only. For IPC rev7, this is not used */
6171028 dma_done_t marker;
6181029 };
1030
+ /* timestamp */
1031
+ ipc_timestamp_t ts;
1032
+
6191033 } host_txbuf_cmpl_t;
6201034
6211035 typedef union txbuf_complete_item {
....@@ -632,20 +1046,19 @@
6321046 uint32 high_addr;
6331047 } ret_buf_t;
6341048
635
-
6361049 #ifdef PCIE_API_REV1
6371050
6381051 /* ioctl specific hdr */
6391052 typedef struct ioctl_hdr {
640
- uint16 cmd;
1053
+ uint16 cmd;
6411054 uint16 retbuf_len;
6421055 uint32 cmd_id;
6431056 } ioctl_hdr_t;
6441057
6451058 typedef struct ioctlptr_hdr {
646
- uint16 cmd;
1059
+ uint16 cmd;
6471060 uint16 retbuf_len;
648
- uint16 buflen;
1061
+ uint16 buflen;
6491062 uint16 rsvd;
6501063 uint32 cmd_id;
6511064 } ioctlptr_hdr_t;
....@@ -654,15 +1067,14 @@
6541067
6551068 typedef struct ioctl_req_hdr {
6561069 uint32 pkt_id; /**< Packet ID */
657
- uint32 cmd; /**< IOCTL ID */
1070
+ uint32 cmd; /**< IOCTL ID */
6581071 uint16 retbuf_len;
659
- uint16 buflen;
1072
+ uint16 buflen;
6601073 uint16 xt_id; /**< transaction ID */
6611074 uint16 rsvd[1];
6621075 } ioctl_req_hdr_t;
6631076
6641077 #endif /* PCIE_API_REV1 */
665
-
6661078
6671079 /** Complete msgbuf hdr for ioctl from host to dongle */
6681080 typedef struct ioct_reqst_hdr {
....@@ -671,7 +1083,7 @@
6711083 ioctl_hdr_t ioct_hdr;
6721084 #else
6731085 ioctl_req_hdr_t ioct_hdr;
674
-#endif
1086
+#endif // endif
6751087 ret_buf_t ret_buf;
6761088 } ioct_reqst_hdr_t;
6771089
....@@ -681,7 +1093,7 @@
6811093 ioctlptr_hdr_t ioct_hdr;
6821094 #else
6831095 ioctl_req_hdr_t ioct_hdr;
684
-#endif
1096
+#endif // endif
6851097 ret_buf_t ret_buf;
6861098 ret_buf_t ioct_buf;
6871099 } ioctptr_reqst_hdr_t;
....@@ -693,7 +1105,7 @@
6931105 uint32 cmd_id;
6941106 #else
6951107 uint32 pkt_id;
696
-#endif
1108
+#endif // endif
6971109 uint32 status;
6981110 uint32 ret_len;
6991111 uint32 inline_data;
....@@ -701,7 +1113,7 @@
7011113 #else
7021114 uint16 xt_id; /**< transaction ID */
7031115 uint16 rsvd[1];
704
-#endif
1116
+#endif // endif
7051117 } ioct_resp_hdr_t;
7061118
7071119 /* ioct resp header used in dongle */
....@@ -835,30 +1247,99 @@
8351247 #define MAX_SUSPEND_REQ 15
8361248
8371249 typedef struct tx_idle_flowring_suspend_request {
838
- cmn_msg_hdr_t msg;
839
- uint16 ring_id[MAX_SUSPEND_REQ]; /**< ring Id's */
840
- uint16 num; /**< number of flowid's to suspend */
1250
+ cmn_msg_hdr_t msg;
1251
+ uint16 ring_id[MAX_SUSPEND_REQ]; /* ring Id's */
1252
+ uint16 num; /* number of flowid's to suspend */
8411253 } tx_idle_flowring_suspend_request_t;
8421254
8431255 typedef struct tx_idle_flowring_suspend_response {
844
- cmn_msg_hdr_t msg;
845
- compl_msg_hdr_t cmplt;
1256
+ cmn_msg_hdr_t msg;
1257
+ compl_msg_hdr_t cmplt;
8461258 uint32 rsvd[2];
8471259 dma_done_t marker;
8481260 } tx_idle_flowring_suspend_response_t;
8491261
8501262 typedef struct tx_idle_flowring_resume_request {
851
- cmn_msg_hdr_t msg;
1263
+ cmn_msg_hdr_t msg;
8521264 uint16 flow_ring_id;
8531265 uint16 reason;
8541266 uint32 rsvd[7];
8551267 } tx_idle_flowring_resume_request_t;
8561268
8571269 typedef struct tx_idle_flowring_resume_response {
858
- cmn_msg_hdr_t msg;
859
- compl_msg_hdr_t cmplt;
1270
+ cmn_msg_hdr_t msg;
1271
+ compl_msg_hdr_t cmplt;
8601272 uint32 rsvd[2];
8611273 dma_done_t marker;
8621274 } tx_idle_flowring_resume_response_t;
8631275
1276
+/* timesync related additions */
1277
+
1278
+typedef struct _bcm_xtlv {
1279
+ uint16 id; /* TLV idenitifier */
1280
+ uint16 len; /* TLV length in bytes */
1281
+} _bcm_xtlv_t;
1282
+
1283
+#define BCMMSGBUF_FW_CLOCK_INFO_TAG 0
1284
+#define BCMMSGBUF_HOST_CLOCK_INFO_TAG 1
1285
+#define BCMMSGBUF_HOST_CLOCK_SELECT_TAG 2
1286
+#define BCMMSGBUF_D2H_CLOCK_CORRECTION_TAG 3
1287
+#define BCMMSGBUF_HOST_TIMESTAMPING_CONFIG_TAG 4
1288
+#define BCMMSGBUF_MAX_TSYNC_TAG 5
1289
+
1290
+/* Flags in fw clock info TLV */
1291
+#define CAP_DEVICE_TS (1 << 0)
1292
+#define CAP_CORRECTED_TS (1 << 1)
1293
+#define TS_CLK_ACTIVE (1 << 2)
1294
+
1295
+typedef struct ts_fw_clock_info {
1296
+ _bcm_xtlv_t xtlv; /* BCMMSGBUF_FW_CLOCK_INFO_TAG */
1297
+ ts_timestamp_srcid_t ts; /* tick count */
1298
+ uchar clk_src[4]; /* clock source acronym ILP/AVB/TSF */
1299
+ uint32 nominal_clock_freq;
1300
+ uint32 reset_cnt;
1301
+ uint8 flags;
1302
+ uint8 rsvd[3];
1303
+} ts_fw_clock_info_t;
1304
+
1305
+typedef struct ts_host_clock_info {
1306
+ _bcm_xtlv_t xtlv; /* BCMMSGBUF_HOST_CLOCK_INFO_TAG */
1307
+ tick_count_64_t ticks; /* 64 bit host tick counter */
1308
+ ts_timestamp_ns_64_t ns; /* 64 bit host time in nano seconds */
1309
+} ts_host_clock_info_t;
1310
+
1311
+typedef struct ts_host_clock_sel {
1312
+ _bcm_xtlv_t xtlv; /* BCMMSGBUF_HOST_CLOCK_SELECT_TAG */
1313
+ uint32 seqnum; /* number of times GPIO time sync toggled */
1314
+ uint8 min_clk_idx; /* clock idenitifer configured for packet tiem stamping */
1315
+ uint8 max_clk_idx; /* clock idenitifer configured for packet tiem stamping */
1316
+ uint16 rsvd[1];
1317
+} ts_host_clock_sel_t;
1318
+
1319
+typedef struct ts_d2h_clock_correction {
1320
+ _bcm_xtlv_t xtlv; /* BCMMSGBUF_HOST_CLOCK_INFO_TAG */
1321
+ uint8 clk_id; /* clock source in the device */
1322
+ uint8 rsvd[3];
1323
+ ts_correction_m_t m; /* y = 'm' x + b */
1324
+ ts_correction_b_t b; /* y = 'm' x + 'c' */
1325
+} ts_d2h_clock_correction_t;
1326
+
1327
+typedef struct ts_host_timestamping_config {
1328
+ _bcm_xtlv_t xtlv; /* BCMMSGBUF_HOST_TIMESTAMPING_CONFIG_TAG */
1329
+ /* time period to capture the device time stamp and toggle WLAN_TIME_SYNC_GPIO */
1330
+ uint16 period_ms;
1331
+ uint8 flags;
1332
+ uint8 post_delay;
1333
+ uint32 reset_cnt;
1334
+} ts_host_timestamping_config_t;
1335
+
1336
+/* Flags in host timestamping config TLV */
1337
+#define FLAG_HOST_RESET (1 << 0)
1338
+#define IS_HOST_RESET(x) ((x) & FLAG_HOST_RESET)
1339
+#define CLEAR_HOST_RESET(x) ((x) & ~FLAG_HOST_RESET)
1340
+
1341
+#define FLAG_CONFIG_NODROP (1 << 1)
1342
+#define IS_CONFIG_NODROP(x) ((x) & FLAG_CONFIG_NODROP)
1343
+#define CLEAR_CONFIG_NODROP(x) ((x) & ~FLAG_CONFIG_NODROP)
1344
+
8641345 #endif /* _bcmmsgbuf_h_ */