ia64/linux-2.6.18-xen.hg

changeset 564:1bc7c710abd7

vscsiif.h: define interface between frontend and backend driver

Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
Signed-off-by: Jun Kamada <kama@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 02 09:59:29 2008 +0100 (2008-06-02)
parents 3b3701ad4eec
children 105239038a17
files include/xen/interface/io/vscsiif.h
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/xen/interface/io/vscsiif.h	Mon Jun 02 09:59:29 2008 +0100
     1.3 @@ -0,0 +1,103 @@
     1.4 +/******************************************************************************
     1.5 + * vscsiif.h
     1.6 + * 
     1.7 + * Based on the blkif.h code.
     1.8 + * 
     1.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    1.10 + * of this software and associated documentation files (the "Software"), to
    1.11 + * deal in the Software without restriction, including without limitation the
    1.12 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    1.13 + * sell copies of the Software, and to permit persons to whom the Software is
    1.14 + * furnished to do so, subject to the following conditions:
    1.15 + *
    1.16 + * The above copyright notice and this permission notice shall be included in
    1.17 + * all copies or substantial portions of the Software.
    1.18 + *
    1.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    1.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    1.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    1.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    1.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    1.24 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    1.25 + * DEALINGS IN THE SOFTWARE.
    1.26 + *
    1.27 + * Copyright(c) FUJITSU Limited 2008.
    1.28 + */
    1.29 +
    1.30 +#ifndef __XEN__PUBLIC_IO_SCSI_H__
    1.31 +#define __XEN__PUBLIC_IO_SCSI_H__
    1.32 +
    1.33 +#include "ring.h"
    1.34 +#include "../grant_table.h"
    1.35 +
    1.36 +/* command between backend and frontend */
    1.37 +#define VSCSIIF_ACT_SCSI_CDB         1    /* SCSI CDB command */
    1.38 +#define VSCSIIF_ACT_SCSI_ABORT       2    /* SCSI Device(Lun) Abort*/
    1.39 +#define VSCSIIF_ACT_SCSI_RESET       3    /* SCSI Device(Lun) Reset*/
    1.40 +
    1.41 +
    1.42 +#define VSCSIIF_BACK_MAX_PENDING_REQS    128
    1.43 +
    1.44 +/*
    1.45 + * Maximum scatter/gather segments per request.
    1.46 + *
    1.47 + * Considering balance between allocating al least 16 "vscsiif_request"
    1.48 + * structures on one page (4096bytes) and number of scatter gather 
    1.49 + * needed, we decided to use 26 as a magic number.
    1.50 + */
    1.51 +#define VSCSIIF_SG_TABLESIZE             26
    1.52 +
    1.53 +/*
    1.54 + * base on linux kernel 2.6.18
    1.55 + */
    1.56 +#define VSCSIIF_MAX_COMMAND_SIZE         16
    1.57 +#define VSCSIIF_SENSE_BUFFERSIZE         96
    1.58 +
    1.59 +
    1.60 +struct vscsiif_request {
    1.61 +    uint16_t rqid;          /* private guest value, echoed in resp  */
    1.62 +    uint8_t act;            /* command between backend and frontend */
    1.63 +    uint8_t cmd_len;
    1.64 +
    1.65 +    uint8_t cmnd[VSCSIIF_MAX_COMMAND_SIZE];
    1.66 +    uint16_t timeout_per_command;     /* The command is issued by twice 
    1.67 +                                         the value in Backend. */
    1.68 +    uint16_t channel, id, lun;
    1.69 +    uint16_t padding;
    1.70 +    uint8_t sc_data_direction;        /* for DMA_TO_DEVICE(1)
    1.71 +                                         DMA_FROM_DEVICE(2)
    1.72 +                                         DMA_NONE(3) requests  */
    1.73 +    uint8_t nr_segments;              /* Number of pieces of scatter-gather */
    1.74 +
    1.75 +    struct scsiif_request_segment {
    1.76 +        grant_ref_t gref;
    1.77 +        uint16_t offset;
    1.78 +        uint16_t length;
    1.79 +    } seg[VSCSIIF_SG_TABLESIZE];
    1.80 +    uint32_t reserved[3];
    1.81 +};
    1.82 +typedef struct vscsiif_request vscsiif_request_t;
    1.83 +
    1.84 +struct vscsiif_response {
    1.85 +    uint16_t rqid;
    1.86 +    uint8_t padding;
    1.87 +    uint8_t sense_len;
    1.88 +    uint8_t sense_buffer[VSCSIIF_SENSE_BUFFERSIZE];
    1.89 +    int32_t rslt;
    1.90 +    uint32_t reserved[37];
    1.91 +};
    1.92 +typedef struct vscsiif_response vscsiif_response_t;
    1.93 +
    1.94 +DEFINE_RING_TYPES(vscsiif, struct vscsiif_request, struct vscsiif_response);
    1.95 +
    1.96 +
    1.97 +#endif  /*__XEN__PUBLIC_IO_SCSI_H__*/
    1.98 +/*
    1.99 + * Local variables:
   1.100 + * mode: C
   1.101 + * c-set-style: "BSD"
   1.102 + * c-basic-offset: 4
   1.103 + * tab-width: 4
   1.104 + * indent-tabs-mode: nil
   1.105 + * End:
   1.106 + */