win-pvdrivers

view common/include/public/io/vscsiif.h @ 463:7f9bedb7dcf9

Updated vscsi header file to 3.3.0 version
author James Harper <james.harper@bendigoit.com.au>
date Sun Nov 23 14:58:25 2008 +1100 (2008-11-23)
parents 874c3640830e
children
line source
1 /******************************************************************************
2 * vscsiif.h
3 *
4 * Based on the blkif.h code.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Copyright(c) FUJITSU Limited 2008.
25 */
27 #ifndef __XEN__PUBLIC_IO_SCSI_H__
28 #define __XEN__PUBLIC_IO_SCSI_H__
30 #include "ring.h"
31 #include "../grant_table.h"
33 /* command between backend and frontend */
34 #define VSCSIIF_ACT_SCSI_CDB 1 /* SCSI CDB command */
35 #define VSCSIIF_ACT_SCSI_ABORT 2 /* SCSI Device(Lun) Abort*/
36 #define VSCSIIF_ACT_SCSI_RESET 3 /* SCSI Device(Lun) Reset*/
39 #define VSCSIIF_BACK_MAX_PENDING_REQS 128
41 /*
42 * Maximum scatter/gather segments per request.
43 *
44 * Considering balance between allocating al least 16 "vscsiif_request"
45 * structures on one page (4096bytes) and number of scatter gather
46 * needed, we decided to use 26 as a magic number.
47 */
48 #define VSCSIIF_SG_TABLESIZE 26
50 /*
51 * base on linux kernel 2.6.18
52 */
53 #define VSCSIIF_MAX_COMMAND_SIZE 16
54 #define VSCSIIF_SENSE_BUFFERSIZE 96
57 struct vscsiif_request {
58 uint16_t rqid; /* private guest value, echoed in resp */
59 uint8_t act; /* command between backend and frontend */
60 uint8_t cmd_len;
62 uint8_t cmnd[VSCSIIF_MAX_COMMAND_SIZE];
63 uint16_t timeout_per_command; /* The command is issued by twice
64 the value in Backend. */
65 uint16_t channel, id, lun;
66 uint16_t padding;
67 uint8_t sc_data_direction; /* for DMA_TO_DEVICE(1)
68 DMA_FROM_DEVICE(2)
69 DMA_NONE(3) requests */
70 uint8_t nr_segments; /* Number of pieces of scatter-gather */
72 struct scsiif_request_segment {
73 grant_ref_t gref;
74 uint16_t offset;
75 uint16_t length;
76 } seg[VSCSIIF_SG_TABLESIZE];
77 uint32_t reserved[3];
78 };
79 typedef struct vscsiif_request vscsiif_request_t;
81 struct vscsiif_response {
82 uint16_t rqid;
83 uint8_t padding;
84 uint8_t sense_len;
85 uint8_t sense_buffer[VSCSIIF_SENSE_BUFFERSIZE];
86 int32_t rslt;
87 uint32_t residual_len; /* request bufflen -
88 return the value from physical device */
89 uint32_t reserved[36];
90 };
91 typedef struct vscsiif_response vscsiif_response_t;
93 DEFINE_RING_TYPES(vscsiif, struct vscsiif_request, struct vscsiif_response);
96 #endif /*__XEN__PUBLIC_IO_SCSI_H__*/
97 /*
98 * Local variables:
99 * mode: C
100 * c-set-style: "BSD"
101 * c-basic-offset: 4
102 * tab-width: 4
103 * indent-tabs-mode: nil
104 * End:
105 */