xref: /openbmc/linux/arch/sparc/include/uapi/asm/oradax.h (revision 799fb82aa132fa3a3886b7872997a5a84e820062)
1  /* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */
2  /*
3   * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
4   */
5  
6  /*
7   * Oracle DAX driver API definitions
8   */
9  
10  #ifndef _ORADAX_H
11  #define	_ORADAX_H
12  
13  #include <linux/types.h>
14  
15  #define	CCB_KILL 0
16  #define	CCB_INFO 1
17  #define	CCB_DEQUEUE 2
18  
19  struct dax_command {
20  	__u16 command;		/* CCB_KILL/INFO/DEQUEUE */
21  	__u16 ca_offset;	/* offset into mmapped completion area */
22  };
23  
24  struct ccb_kill_result {
25  	__u16 action;		/* action taken to kill ccb */
26  };
27  
28  struct ccb_info_result {
29  	__u16 state;		/* state of enqueued ccb */
30  	__u16 inst_num;		/* dax instance number of enqueued ccb */
31  	__u16 q_num;		/* queue number of enqueued ccb */
32  	__u16 q_pos;		/* ccb position in queue */
33  };
34  
35  struct ccb_exec_result {
36  	__u64	status_data;	/* additional status data (e.g. bad VA) */
37  	__u32	status;		/* one of DAX_SUBMIT_* */
38  };
39  
40  union ccb_result {
41  	struct ccb_exec_result exec;
42  	struct ccb_info_result info;
43  	struct ccb_kill_result kill;
44  };
45  
46  #define	DAX_MMAP_LEN		(16 * 1024)
47  #define	DAX_MAX_CCBS		15
48  #define	DAX_CCB_BUF_MAXLEN	(DAX_MAX_CCBS * 64)
49  #define	DAX_NAME		"oradax"
50  
51  /* CCB_EXEC status */
52  #define	DAX_SUBMIT_OK			0
53  #define	DAX_SUBMIT_ERR_RETRY		1
54  #define	DAX_SUBMIT_ERR_WOULDBLOCK	2
55  #define	DAX_SUBMIT_ERR_BUSY		3
56  #define	DAX_SUBMIT_ERR_THR_INIT		4
57  #define	DAX_SUBMIT_ERR_ARG_INVAL	5
58  #define	DAX_SUBMIT_ERR_CCB_INVAL	6
59  #define	DAX_SUBMIT_ERR_NO_CA_AVAIL	7
60  #define	DAX_SUBMIT_ERR_CCB_ARR_MMU_MISS	8
61  #define	DAX_SUBMIT_ERR_NOMAP		9
62  #define	DAX_SUBMIT_ERR_NOACCESS		10
63  #define	DAX_SUBMIT_ERR_TOOMANY		11
64  #define	DAX_SUBMIT_ERR_UNAVAIL		12
65  #define	DAX_SUBMIT_ERR_INTERNAL		13
66  
67  /* CCB_INFO states - must match HV_CCB_STATE_* definitions */
68  #define	DAX_CCB_COMPLETED	0
69  #define	DAX_CCB_ENQUEUED	1
70  #define	DAX_CCB_INPROGRESS	2
71  #define	DAX_CCB_NOTFOUND	3
72  
73  /* CCB_KILL actions - must match HV_CCB_KILL_* definitions */
74  #define	DAX_KILL_COMPLETED	0
75  #define	DAX_KILL_DEQUEUED	1
76  #define	DAX_KILL_KILLED		2
77  #define	DAX_KILL_NOTFOUND	3
78  
79  #endif /* _ORADAX_H */
80