1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef __TARGET_CORE_USER_H 20 #define __TARGET_CORE_USER_H 21 #include <linux/types.h> 22 #include <linux/uio.h> 23 #define TCMU_VERSION "2.0" 24 #define TCMU_MAILBOX_VERSION 2 25 #define ALIGN_SIZE 64 26 #define TCMU_MAILBOX_FLAG_CAP_OOOC (1 << 0) 27 #define TCMU_MAILBOX_FLAG_CAP_READ_LEN (1 << 1) 28 #define TCMU_MAILBOX_FLAG_CAP_TMR (1 << 2) 29 struct tcmu_mailbox { 30 __u16 version; 31 __u16 flags; 32 __u32 cmdr_off; 33 __u32 cmdr_size; 34 __u32 cmd_head; 35 __u32 cmd_tail __attribute__((__aligned__(ALIGN_SIZE))); 36 } __packed; 37 enum tcmu_opcode { 38 TCMU_OP_PAD = 0, 39 TCMU_OP_CMD, 40 TCMU_OP_TMR, 41 }; 42 struct tcmu_cmd_entry_hdr { 43 __u32 len_op; 44 __u16 cmd_id; 45 __u8 kflags; 46 #define TCMU_UFLAG_UNKNOWN_OP 0x1 47 #define TCMU_UFLAG_READ_LEN 0x2 48 __u8 uflags; 49 } __packed; 50 #define TCMU_OP_MASK 0x7 51 #define TCMU_SENSE_BUFFERSIZE 96 52 struct tcmu_cmd_entry { 53 struct tcmu_cmd_entry_hdr hdr; 54 union { 55 struct { 56 __u32 iov_cnt; 57 __u32 iov_bidi_cnt; 58 __u32 iov_dif_cnt; 59 __u64 cdb_off; 60 __u64 __pad1; 61 __u64 __pad2; 62 struct iovec iov[0]; 63 } req; 64 struct { 65 __u8 scsi_status; 66 __u8 __pad1; 67 __u16 __pad2; 68 __u32 read_len; 69 char sense_buffer[TCMU_SENSE_BUFFERSIZE]; 70 } rsp; 71 }; 72 } __packed; 73 struct tcmu_tmr_entry { 74 struct tcmu_cmd_entry_hdr hdr; 75 #define TCMU_TMR_UNKNOWN 0 76 #define TCMU_TMR_ABORT_TASK 1 77 #define TCMU_TMR_ABORT_TASK_SET 2 78 #define TCMU_TMR_CLEAR_ACA 3 79 #define TCMU_TMR_CLEAR_TASK_SET 4 80 #define TCMU_TMR_LUN_RESET 5 81 #define TCMU_TMR_TARGET_WARM_RESET 6 82 #define TCMU_TMR_TARGET_COLD_RESET 7 83 #define TCMU_TMR_LUN_RESET_PRO 128 84 __u8 tmr_type; 85 __u8 __pad1; 86 __u16 __pad2; 87 __u32 cmd_cnt; 88 __u64 __pad3; 89 __u64 __pad4; 90 __u16 cmd_ids[0]; 91 } __packed; 92 #define TCMU_OP_ALIGN_SIZE sizeof(__u64) 93 enum tcmu_genl_cmd { 94 TCMU_CMD_UNSPEC, 95 TCMU_CMD_ADDED_DEVICE, 96 TCMU_CMD_REMOVED_DEVICE, 97 TCMU_CMD_RECONFIG_DEVICE, 98 TCMU_CMD_ADDED_DEVICE_DONE, 99 TCMU_CMD_REMOVED_DEVICE_DONE, 100 TCMU_CMD_RECONFIG_DEVICE_DONE, 101 TCMU_CMD_SET_FEATURES, 102 __TCMU_CMD_MAX, 103 }; 104 #define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1) 105 enum tcmu_genl_attr { 106 TCMU_ATTR_UNSPEC, 107 TCMU_ATTR_DEVICE, 108 TCMU_ATTR_MINOR, 109 TCMU_ATTR_PAD, 110 TCMU_ATTR_DEV_CFG, 111 TCMU_ATTR_DEV_SIZE, 112 TCMU_ATTR_WRITECACHE, 113 TCMU_ATTR_CMD_STATUS, 114 TCMU_ATTR_DEVICE_ID, 115 TCMU_ATTR_SUPP_KERN_CMD_REPLY, 116 __TCMU_ATTR_MAX, 117 }; 118 #define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1) 119 #endif 120