]>
Commit | Line | Data |
---|---|---|
97f78759 FT |
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_TSK_MGMT_RSP 0x0002 | |
28 | ||
29 | /* kernel -> user */ | |
30 | #define TGT_KEVENT_CMD_REQ 0x1001 | |
31 | #define TGT_KEVENT_CMD_DONE 0x1002 | |
32 | #define TGT_KEVENT_TSK_MGMT_REQ 0x1003 | |
33 | ||
34 | struct tgt_event_hdr { | |
35 | uint16_t version; | |
36 | uint16_t status; | |
37 | uint16_t type; | |
38 | uint16_t len; | |
39 | } __attribute__ ((aligned (sizeof(uint64_t)))); | |
40 | ||
41 | struct tgt_event { | |
42 | struct tgt_event_hdr hdr; | |
43 | ||
44 | union { | |
45 | /* user-> kernel */ | |
46 | struct { | |
47 | int host_no; | |
48 | uint32_t len; | |
49 | int result; | |
50 | aligned_u64 uaddr; | |
51 | uint8_t rw; | |
52 | aligned_u64 tag; | |
53 | } cmd_rsp; | |
54 | struct { | |
55 | int host_no; | |
56 | aligned_u64 mid; | |
57 | int result; | |
58 | } tsk_mgmt_rsp; | |
59 | ||
60 | ||
61 | /* kernel -> user */ | |
62 | struct { | |
63 | int host_no; | |
64 | uint32_t data_len; | |
65 | uint8_t scb[16]; | |
66 | uint8_t lun[8]; | |
67 | int attribute; | |
68 | aligned_u64 tag; | |
69 | } cmd_req; | |
70 | struct { | |
71 | int host_no; | |
72 | aligned_u64 tag; | |
73 | int result; | |
74 | } cmd_done; | |
75 | struct { | |
76 | int host_no; | |
77 | int function; | |
78 | aligned_u64 tag; | |
79 | uint8_t lun[8]; | |
80 | aligned_u64 mid; | |
81 | } tsk_mgmt_req; | |
82 | } p; | |
83 | } __attribute__ ((aligned (sizeof(uint64_t)))); | |
84 | ||
85 | #define TGT_RING_SIZE (1UL << 16) | |
97f78759 FT |
86 | |
87 | #endif |