1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2016 Cavium, Inc.
6 #ifndef __REQUEST_MANAGER_H
7 #define __REQUEST_MANAGER_H
9 #include "cpt_common.h"
11 #define TIME_IN_RESET_COUNT 5
12 #define COMPLETION_CODE_SIZE 8
13 #define COMPLETION_CODE_INIT 0
14 #define PENDING_THOLD 100
15 #define MAX_SG_IN_CNT 12
16 #define MAX_SG_OUT_CNT 13
17 #define SG_LIST_HDR_SIZE 8
18 #define MAX_BUF_CNT 16
23 #if defined(__BIG_ENDIAN_BITFIELD)
25 u32 grp
:3; /* Group bits */
26 u32 dma_mode
:2; /* DMA mode */
27 u32 se_req
:1;/* To SE core */
29 u32 se_req
:1; /* To SE core */
30 u32 dma_mode
:2; /* DMA mode */
31 u32 grp
:3; /* Group bits */
45 struct cptvf_request
{
46 union opcode_info opcode
;
58 struct cpt_request_info
{
59 u8 incnt
; /* Number of input buffers */
60 u8 outcnt
; /* Number of output buffers */
61 u16 rlen
; /* Output length */
62 union ctrl_info ctrl
; /* User control information */
63 struct cptvf_request req
; /* Request Information (Core specific) */
65 struct buf_ptr in
[MAX_BUF_CNT
];
66 struct buf_ptr out
[MAX_BUF_CNT
];
68 void (*callback
)(int, void *); /* Kernel ASYNC request callabck */
69 void *callback_arg
; /* Kernel ASYNC request callabck arg */
72 struct sglist_component
{
88 struct cpt_info_buffer
{
90 unsigned long time_in
;
93 struct cpt_request_info
*req
;
94 dma_addr_t dptr_baddr
;
96 dma_addr_t rptr_baddr
;
97 dma_addr_t comp_baddr
;
100 u8
*gather_components
;
101 u8
*scatter_components
;
103 struct pending_entry
*pentry
;
104 volatile u64
*completion_addr
;
105 volatile u64
*alternate_caddr
;
109 * CPT_INST_S software command definitions
125 #if defined(__BIG_ENDIAN_BITFIELD)
135 struct cpt_vq_command
{
136 union vq_cmd_word0 cmd
;
139 union vq_cmd_word3 cptr
;
142 void vq_post_process(struct cpt_vf
*cptvf
, u32 qno
);
143 int process_request(struct cpt_vf
*cptvf
, struct cpt_request_info
*req
);
144 #endif /* __REQUEST_MANAGER_H */