linux/include/scsi/scsi_tgt_if.h
<<
>>
Prefs
   1/*
   2 * SCSI target kernel/user interface
   3 *
   4 * Copyright (C) 2005 FUJITA Tomonori <tomof@acm.org>
   5 * Copyright (C) 2005 Mike Christie <michaelc@cs.wisc.edu>
   6 *
   7 * This program is free software; you can redistribute it and/or
   8 * modify it under the terms of the GNU General Public License as
   9 * published by the Free Software Foundation; either version 2 of the
  10 * License, or (at your option) any later version.
  11 *
  12 * This program is distributed in the hope that it will be useful, but
  13 * WITHOUT ANY WARRANTY; without even the implied warranty of
  14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15 * General Public License for more details.
  16 *
  17 * You should have received a copy of the GNU General Public License
  18 * along with this program; if not, write to the Free Software
  19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20 * 02110-1301 USA
  21 */
  22#ifndef __SCSI_TARGET_IF_H
  23#define __SCSI_TARGET_IF_H
  24
  25/* user -> kernel */
  26#define TGT_UEVENT_CMD_RSP              0x0001
  27#define TGT_UEVENT_IT_NEXUS_RSP         0x0002
  28#define TGT_UEVENT_TSK_MGMT_RSP         0x0003
  29
  30/* kernel -> user */
  31#define TGT_KEVENT_CMD_REQ              0x1001
  32#define TGT_KEVENT_CMD_DONE             0x1002
  33#define TGT_KEVENT_IT_NEXUS_REQ         0x1003
  34#define TGT_KEVENT_TSK_MGMT_REQ         0x1004
  35
  36struct tgt_event_hdr {
  37        uint16_t version;
  38        uint16_t status;
  39        uint16_t type;
  40        uint16_t len;
  41} __attribute__ ((aligned (sizeof(uint64_t))));
  42
  43struct tgt_event {
  44        struct tgt_event_hdr hdr;
  45
  46        union {
  47                /* user-> kernel */
  48                struct {
  49                        int host_no;
  50                        int result;
  51                        aligned_u64 itn_id;
  52                        aligned_u64 tag;
  53                        aligned_u64 uaddr;
  54                        aligned_u64 sense_uaddr;
  55                        uint32_t len;
  56                        uint32_t sense_len;
  57                        uint8_t rw;
  58                } cmd_rsp;
  59                struct {
  60                        int host_no;
  61                        int result;
  62                        aligned_u64 itn_id;
  63                        aligned_u64 mid;
  64                } tsk_mgmt_rsp;
  65                struct {
  66                        __s32 host_no;
  67                        __s32 result;
  68                        aligned_u64 itn_id;
  69                        __u32 function;
  70                } it_nexus_rsp;
  71
  72                /* kernel -> user */
  73                struct {
  74                        int host_no;
  75                        uint32_t data_len;
  76                        aligned_u64 itn_id;
  77                        uint8_t scb[16];
  78                        uint8_t lun[8];
  79                        int attribute;
  80                        aligned_u64 tag;
  81                } cmd_req;
  82                struct {
  83                        int host_no;
  84                        int result;
  85                        aligned_u64 itn_id;
  86                        aligned_u64 tag;
  87                } cmd_done;
  88                struct {
  89                        int host_no;
  90                        int function;
  91                        aligned_u64 itn_id;
  92                        aligned_u64 tag;
  93                        uint8_t lun[8];
  94                        aligned_u64 mid;
  95                } tsk_mgmt_req;
  96                struct {
  97                        __s32 host_no;
  98                        __u32 function;
  99                        aligned_u64 itn_id;
 100                        __u32 max_cmds;
 101                        __u8 initiator_id[16];
 102                } it_nexus_req;
 103        } p;
 104} __attribute__ ((aligned (sizeof(uint64_t))));
 105
 106#define TGT_RING_SIZE (1UL << 16)
 107
 108#endif
 109