182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris/****************************************************************************
282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ****************************************************************************
382d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***
482d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   This header was automatically generated from a Linux kernel header
582d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   of the same name, to make information necessary for userspace to
682d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   call into the kernel available to libc.  It contains only constants,
782d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   structures, and macros generated from the original header, and thus,
882d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   contains no copyrightable information.
982d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***
1082d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   To edit the content of this header, modify the corresponding
1182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   source file (e.g. under external/kernel-headers/original/) then
1282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   run bionic/libc/kernel/tools/update_all.py
1382d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***
1482d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   Any manual change here will be lost the next time this script will
1582d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   be run. You've been warned!
1682d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***
1782d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ****************************************************************************
1882d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ****************************************************************************/
1982d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#ifndef __TARGET_CORE_USER_H
2082d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define __TARGET_CORE_USER_H
2182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#include <linux/types.h>
2282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#include <linux/uio.h>
2305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define TCMU_VERSION "2.0"
2405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define TCMU_MAILBOX_VERSION 2
2582d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define ALIGN_SIZE 64
26106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define TCMU_MAILBOX_FLAG_CAP_OOOC (1 << 0)
27106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferrisstruct tcmu_mailbox {
28e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferris  __u16 version;
29d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 flags;
30d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 cmdr_off;
31106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u32 cmdr_size;
32e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferris  __u32 cmd_head;
33d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 cmd_tail __attribute__((__aligned__(ALIGN_SIZE)));
3482d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris} __packed;
35106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferrisenum tcmu_opcode {
36e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferris  TCMU_OP_PAD = 0,
37d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  TCMU_OP_CMD,
3882d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris};
39106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferrisstruct tcmu_cmd_entry_hdr {
40e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferris  __u32 len_op;
4105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u16 cmd_id;
4205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u8 kflags;
43106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define TCMU_UFLAG_UNKNOWN_OP 0x1
4405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u8 uflags;
4582d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris} __packed;
4682d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define TCMU_OP_MASK 0x7
47106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define TCMU_SENSE_BUFFERSIZE 96
48e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferrisstruct tcmu_cmd_entry {
49d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  struct tcmu_cmd_entry_hdr hdr;
50e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferris  union {
51106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris    struct {
52525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris      __u32 iov_cnt;
53525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris      __u32 iov_bidi_cnt;
54525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris      __u32 iov_dif_cnt;
55525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris      __u64 cdb_off;
56525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris      __u64 __pad1;
57525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris      __u64 __pad2;
58e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferris      struct iovec iov[0];
59106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris    } req;
60d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct {
61525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris      __u8 scsi_status;
62525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris      __u8 __pad1;
63525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris      __u16 __pad2;
64525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris      __u32 __pad3;
65d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao      char sense_buffer[TCMU_SENSE_BUFFERSIZE];
66e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferris    } rsp;
67106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  };
6882d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris} __packed;
69525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris#define TCMU_OP_ALIGN_SIZE sizeof(__u64)
70e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferrisenum tcmu_genl_cmd {
71106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  TCMU_CMD_UNSPEC,
72d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  TCMU_CMD_ADDED_DEVICE,
73d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  TCMU_CMD_REMOVED_DEVICE,
741308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_CMD_RECONFIG_DEVICE,
751308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_CMD_ADDED_DEVICE_DONE,
761308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_CMD_REMOVED_DEVICE_DONE,
771308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_CMD_RECONFIG_DEVICE_DONE,
781308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_CMD_SET_FEATURES,
79e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferris  __TCMU_CMD_MAX,
80106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris};
8182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1)
8282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisenum tcmu_genl_attr {
83e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferris  TCMU_ATTR_UNSPEC,
84106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  TCMU_ATTR_DEVICE,
85d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  TCMU_ATTR_MINOR,
861308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_ATTR_PAD,
871308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_ATTR_DEV_CFG,
881308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_ATTR_DEV_SIZE,
891308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_ATTR_WRITECACHE,
901308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_ATTR_CMD_STATUS,
911308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_ATTR_DEVICE_ID,
921308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  TCMU_ATTR_SUPP_KERN_CMD_REPLY,
93d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __TCMU_ATTR_MAX,
94e01d32f8022966df2c1e697b679f9efe148c12c8Christopher Ferris};
95106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1)
9682d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#endif
97