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) */
70 struct buf_ptr in[MAX_BUF_CNT];
71 struct buf_ptr out[MAX_BUF_CNT];
73 void (*callback)(int, void *); /* Kernel ASYNC request callabck */
74 void *callback_arg; /* Kernel ASYNC request callabck arg */
77 struct sglist_component {
93 struct cpt_info_buffer {
95 unsigned long time_in;
98 struct cpt_request_info *req;
99 dma_addr_t dptr_baddr;
101 dma_addr_t rptr_baddr;
102 dma_addr_t comp_baddr;
105 u8 *gather_components;
106 u8 *scatter_components;
108 struct pending_entry *pentry;
109 volatile u64 *completion_addr;
110 volatile u64 *alternate_caddr;
114 * CPT_INST_S software command definitions
130 #if defined(__BIG_ENDIAN_BITFIELD)
140 struct cpt_vq_command {
141 union vq_cmd_word0 cmd;
144 union vq_cmd_word3 cptr;
147 void vq_post_process(struct cpt_vf *cptvf, u32 qno);
148 int process_request(struct cpt_vf *cptvf, struct cpt_request_info *req);
149 #endif /* __REQUEST_MANAGER_H */