2 * Copyright (C) 2016 Cavium, Inc.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License
6 * as published by the Free Software Foundation.
9 #ifndef __REQUEST_MANAGER_H
10 #define __REQUEST_MANAGER_H
12 #include "cpt_common.h"
14 #define TIME_IN_RESET_COUNT 5
15 #define COMPLETION_CODE_SIZE 8
16 #define COMPLETION_CODE_INIT 0
17 #define PENDING_THOLD 100
18 #define MAX_SG_IN_CNT 12
19 #define MAX_SG_OUT_CNT 13
20 #define SG_LIST_HDR_SIZE 8
21 #define MAX_BUF_CNT 16
26 #if defined(__BIG_ENDIAN_BITFIELD)
28 u32 grp:3; /* Group bits */
29 u32 dma_mode:2; /* DMA mode */
30 u32 se_req:1;/* To SE core */
32 u32 se_req:1; /* To SE core */
33 u32 dma_mode:2; /* DMA mode */
34 u32 grp:3; /* Group bits */
48 struct cptvf_request {
49 union opcode_info opcode;
61 struct cpt_request_info {
62 u8 incnt; /* Number of input buffers */
63 u8 outcnt; /* Number of output buffers */
64 u16 rlen; /* Output length */
65 union ctrl_info ctrl; /* User control information */
66 struct cptvf_request req; /* Request Information (Core specific) */
68 struct buf_ptr in[MAX_BUF_CNT];
69 struct buf_ptr out[MAX_BUF_CNT];
71 void (*callback)(int, void *); /* Kernel ASYNC request callabck */
72 void *callback_arg; /* Kernel ASYNC request callabck arg */
75 struct sglist_component {
91 struct cpt_info_buffer {
93 unsigned long time_in;
96 struct cpt_request_info *req;
97 dma_addr_t dptr_baddr;
99 dma_addr_t rptr_baddr;
100 dma_addr_t comp_baddr;
103 u8 *gather_components;
104 u8 *scatter_components;
106 struct pending_entry *pentry;
107 volatile u64 *completion_addr;
108 volatile u64 *alternate_caddr;
112 * CPT_INST_S software command definitions
128 #if defined(__BIG_ENDIAN_BITFIELD)
138 struct cpt_vq_command {
139 union vq_cmd_word0 cmd;
142 union vq_cmd_word3 cptr;
145 void vq_post_process(struct cpt_vf *cptvf, u32 qno);
146 int process_request(struct cpt_vf *cptvf, struct cpt_request_info *req);
147 #endif /* __REQUEST_MANAGER_H */