1 /******************************************************************************
4 * Based on the blkif.h code.
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:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
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.
24 * Copyright(c) FUJITSU Limited 2008.
27 #ifndef __XEN__PUBLIC_IO_SCSI_H__
28 #define __XEN__PUBLIC_IO_SCSI_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
42 * Maximum scatter/gather segments per request.
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.
48 #define VSCSIIF_SG_TABLESIZE 26
51 * base on linux kernel 2.6.18
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 */
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;
67 uint8_t sc_data_direction; /* for DMA_TO_DEVICE(1)
69 DMA_NONE(3) requests */
70 uint8_t nr_segments; /* Number of pieces of scatter-gather */
72 struct scsiif_request_segment {
76 } seg[VSCSIIF_SG_TABLESIZE];
79 typedef struct vscsiif_request vscsiif_request_t;
81 struct vscsiif_response {
85 uint8_t sense_buffer[VSCSIIF_SENSE_BUFFERSIZE];
87 uint32_t residual_len; /* request bufflen -
88 return the value from physical device */
89 uint32_t reserved[36];
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__*/
103 * indent-tabs-mode: nil