18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci/* 78c2ecf20Sopenharmony_ci * Oracle DAX driver API definitions 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifndef _ORADAX_H 118c2ecf20Sopenharmony_ci#define _ORADAX_H 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/types.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define CCB_KILL 0 168c2ecf20Sopenharmony_ci#define CCB_INFO 1 178c2ecf20Sopenharmony_ci#define CCB_DEQUEUE 2 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistruct dax_command { 208c2ecf20Sopenharmony_ci __u16 command; /* CCB_KILL/INFO/DEQUEUE */ 218c2ecf20Sopenharmony_ci __u16 ca_offset; /* offset into mmapped completion area */ 228c2ecf20Sopenharmony_ci}; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cistruct ccb_kill_result { 258c2ecf20Sopenharmony_ci __u16 action; /* action taken to kill ccb */ 268c2ecf20Sopenharmony_ci}; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistruct ccb_info_result { 298c2ecf20Sopenharmony_ci __u16 state; /* state of enqueued ccb */ 308c2ecf20Sopenharmony_ci __u16 inst_num; /* dax instance number of enqueued ccb */ 318c2ecf20Sopenharmony_ci __u16 q_num; /* queue number of enqueued ccb */ 328c2ecf20Sopenharmony_ci __u16 q_pos; /* ccb position in queue */ 338c2ecf20Sopenharmony_ci}; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistruct ccb_exec_result { 368c2ecf20Sopenharmony_ci __u64 status_data; /* additional status data (e.g. bad VA) */ 378c2ecf20Sopenharmony_ci __u32 status; /* one of DAX_SUBMIT_* */ 388c2ecf20Sopenharmony_ci}; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciunion ccb_result { 418c2ecf20Sopenharmony_ci struct ccb_exec_result exec; 428c2ecf20Sopenharmony_ci struct ccb_info_result info; 438c2ecf20Sopenharmony_ci struct ccb_kill_result kill; 448c2ecf20Sopenharmony_ci}; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define DAX_MMAP_LEN (16 * 1024) 478c2ecf20Sopenharmony_ci#define DAX_MAX_CCBS 15 488c2ecf20Sopenharmony_ci#define DAX_CCB_BUF_MAXLEN (DAX_MAX_CCBS * 64) 498c2ecf20Sopenharmony_ci#define DAX_NAME "oradax" 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* CCB_EXEC status */ 528c2ecf20Sopenharmony_ci#define DAX_SUBMIT_OK 0 538c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_RETRY 1 548c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_WOULDBLOCK 2 558c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_BUSY 3 568c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_THR_INIT 4 578c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_ARG_INVAL 5 588c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_CCB_INVAL 6 598c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_NO_CA_AVAIL 7 608c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_CCB_ARR_MMU_MISS 8 618c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_NOMAP 9 628c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_NOACCESS 10 638c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_TOOMANY 11 648c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_UNAVAIL 12 658c2ecf20Sopenharmony_ci#define DAX_SUBMIT_ERR_INTERNAL 13 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* CCB_INFO states - must match HV_CCB_STATE_* definitions */ 688c2ecf20Sopenharmony_ci#define DAX_CCB_COMPLETED 0 698c2ecf20Sopenharmony_ci#define DAX_CCB_ENQUEUED 1 708c2ecf20Sopenharmony_ci#define DAX_CCB_INPROGRESS 2 718c2ecf20Sopenharmony_ci#define DAX_CCB_NOTFOUND 3 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci/* CCB_KILL actions - must match HV_CCB_KILL_* definitions */ 748c2ecf20Sopenharmony_ci#define DAX_KILL_COMPLETED 0 758c2ecf20Sopenharmony_ci#define DAX_KILL_DEQUEUED 1 768c2ecf20Sopenharmony_ci#define DAX_KILL_KILLED 2 778c2ecf20Sopenharmony_ci#define DAX_KILL_NOTFOUND 3 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#endif /* _ORADAX_H */ 80