GNU Linux-libre 4.19.264-gnu1
[releases.git] / arch / sparc / include / uapi / asm / oradax.h
1 /*
2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 /*
19  * Oracle DAX driver API definitions
20  */
21
22 #ifndef _ORADAX_H
23 #define _ORADAX_H
24
25 #include <linux/types.h>
26
27 #define CCB_KILL 0
28 #define CCB_INFO 1
29 #define CCB_DEQUEUE 2
30
31 struct dax_command {
32         __u16 command;          /* CCB_KILL/INFO/DEQUEUE */
33         __u16 ca_offset;        /* offset into mmapped completion area */
34 };
35
36 struct ccb_kill_result {
37         __u16 action;           /* action taken to kill ccb */
38 };
39
40 struct ccb_info_result {
41         __u16 state;            /* state of enqueued ccb */
42         __u16 inst_num;         /* dax instance number of enqueued ccb */
43         __u16 q_num;            /* queue number of enqueued ccb */
44         __u16 q_pos;            /* ccb position in queue */
45 };
46
47 struct ccb_exec_result {
48         __u64   status_data;    /* additional status data (e.g. bad VA) */
49         __u32   status;         /* one of DAX_SUBMIT_* */
50 };
51
52 union ccb_result {
53         struct ccb_exec_result exec;
54         struct ccb_info_result info;
55         struct ccb_kill_result kill;
56 };
57
58 #define DAX_MMAP_LEN            (16 * 1024)
59 #define DAX_MAX_CCBS            15
60 #define DAX_CCB_BUF_MAXLEN      (DAX_MAX_CCBS * 64)
61 #define DAX_NAME                "oradax"
62
63 /* CCB_EXEC status */
64 #define DAX_SUBMIT_OK                   0
65 #define DAX_SUBMIT_ERR_RETRY            1
66 #define DAX_SUBMIT_ERR_WOULDBLOCK       2
67 #define DAX_SUBMIT_ERR_BUSY             3
68 #define DAX_SUBMIT_ERR_THR_INIT         4
69 #define DAX_SUBMIT_ERR_ARG_INVAL        5
70 #define DAX_SUBMIT_ERR_CCB_INVAL        6
71 #define DAX_SUBMIT_ERR_NO_CA_AVAIL      7
72 #define DAX_SUBMIT_ERR_CCB_ARR_MMU_MISS 8
73 #define DAX_SUBMIT_ERR_NOMAP            9
74 #define DAX_SUBMIT_ERR_NOACCESS         10
75 #define DAX_SUBMIT_ERR_TOOMANY          11
76 #define DAX_SUBMIT_ERR_UNAVAIL          12
77 #define DAX_SUBMIT_ERR_INTERNAL         13
78
79 /* CCB_INFO states - must match HV_CCB_STATE_* definitions */
80 #define DAX_CCB_COMPLETED       0
81 #define DAX_CCB_ENQUEUED        1
82 #define DAX_CCB_INPROGRESS      2
83 #define DAX_CCB_NOTFOUND        3
84
85 /* CCB_KILL actions - must match HV_CCB_KILL_* definitions */
86 #define DAX_KILL_COMPLETED      0
87 #define DAX_KILL_DEQUEUED       1
88 #define DAX_KILL_KILLED         2
89 #define DAX_KILL_NOTFOUND       3
90
91 #endif /* _ORADAX_H */