ia64/xen-unstable

changeset 19392:bedd3906979e

Add PVUSB and PVSCSI interface headers.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Mar 18 15:42:47 2009 +0000 (2009-03-18)
parents fe4b23bd3a95
children 6c20b04e5577
files xen/include/public/io/usbif.h xen/include/public/io/vscsiif.h
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xen/include/public/io/usbif.h	Wed Mar 18 15:42:47 2009 +0000
     1.3 @@ -0,0 +1,121 @@
     1.4 +/*
     1.5 + * usbif.h
     1.6 + *
     1.7 + * USB I/O interface for Xen guest OSes.
     1.8 + *
     1.9 + * Copyright (C) 2009, FUJITSU LABORATORIES LTD.
    1.10 + * Author: Noboru Iwamatsu <n_iwamatsu@jp.fujitsu.com>
    1.11 + *
    1.12 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    1.13 + * of this software and associated documentation files (the "Software"), to
    1.14 + * deal in the Software without restriction, including without limitation the
    1.15 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    1.16 + * sell copies of the Software, and to permit persons to whom the Software is
    1.17 + * furnished to do so, subject to the following conditions:
    1.18 + *
    1.19 + * The above copyright notice and this permission notice shall be included in
    1.20 + * all copies or substantial portions of the Software.
    1.21 + *
    1.22 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    1.23 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    1.24 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    1.25 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    1.26 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    1.27 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    1.28 + * DEALINGS IN THE SOFTWARE.
    1.29 + */
    1.30 +
    1.31 +#ifndef __XEN_PUBLIC_IO_USBIF_H__
    1.32 +#define __XEN_PUBLIC_IO_USBIF_H__
    1.33 +
    1.34 +#include "ring.h"
    1.35 +#include "../grant_table.h"
    1.36 +
    1.37 +/*
    1.38 + *  USB pipe in usbif_request
    1.39 + *
    1.40 + *  bits 0-5 are specific bits for virtual USB driver.
    1.41 + *  bits 7-31 are standard urb pipe.
    1.42 + *
    1.43 + *  - port number(NEW):	bits 0-4
    1.44 + *  				(USB_MAXCHILDREN is 31)
    1.45 + *
    1.46 + *  - operation flag(NEW):	bit 5
    1.47 + *  				(0 = submit urb,
    1.48 + *  				 1 = unlink urb)
    1.49 + *
    1.50 + *  - direction:		bit 7
    1.51 + *  				(0 = Host-to-Device [Out]
    1.52 + *                           1 = Device-to-Host [In])
    1.53 + *
    1.54 + *  - device address:	bits 8-14
    1.55 + *
    1.56 + *  - endpoint:		bits 15-18
    1.57 + *
    1.58 + *  - pipe type:		bits 30-31
    1.59 + *  				(00 = isochronous, 01 = interrupt,
    1.60 + *                           10 = control, 11 = bulk)
    1.61 + */
    1.62 +#define usbif_pipeportnum(pipe) ((pipe) & 0x1f)
    1.63 +#define usbif_setportnum_pipe(pipe,portnum) \
    1.64 +	((pipe)|(portnum))
    1.65 +#define usbif_pipeunlink(pipe) ((pipe) & 0x20)
    1.66 +#define usbif_setunlink_pipe(pipe) ((pipe)|(0x20))
    1.67 +
    1.68 +#define USBIF_BACK_MAX_PENDING_REQS (128)
    1.69 +#define USBIF_MAX_SEGMENTS_PER_REQUEST (10)
    1.70 +
    1.71 +struct usbif_request_segment {
    1.72 +	grant_ref_t gref;
    1.73 +	uint16_t offset;
    1.74 +	uint16_t length;
    1.75 +};
    1.76 +
    1.77 +struct usbif_request {
    1.78 +	uint16_t id; /* request id */
    1.79 +	uint16_t nr_buffer_segs; /* number of urb->transfer_buffer segments */
    1.80 +
    1.81 +	/* basic urb parameter */
    1.82 +	uint32_t pipe;
    1.83 +	uint16_t transfer_flags;
    1.84 +	uint16_t buffer_length;
    1.85 +	union {
    1.86 +		uint8_t ctrl[8]; /* setup_packet (Ctrl) */
    1.87 +
    1.88 +		struct {
    1.89 +			uint16_t interval; /* maximum (1024*8) in usb core */
    1.90 +			uint16_t start_frame; /* start frame */
    1.91 +			uint16_t number_of_packets; /* number of ISO packet */
    1.92 +			uint16_t nr_frame_desc_segs; /* number of iso_frame_desc segments */
    1.93 +		} isoc;
    1.94 +
    1.95 +		struct {
    1.96 +			uint16_t interval; /* maximum (1024*8) in usb core */
    1.97 +			uint16_t pad[3];
    1.98 +		} intr;
    1.99 +
   1.100 +		struct {
   1.101 +			uint16_t unlink_id; /* unlink request id */
   1.102 +			uint16_t pad[3];
   1.103 +		} unlink;
   1.104 +
   1.105 +	} u;
   1.106 +
   1.107 +	/* urb data segments */
   1.108 +	struct usbif_request_segment seg[USBIF_MAX_SEGMENTS_PER_REQUEST];
   1.109 +};
   1.110 +typedef struct usbif_request usbif_request_t;
   1.111 +
   1.112 +struct usbif_response {
   1.113 +	uint16_t id; /* request id */
   1.114 +	uint16_t start_frame;  /* start frame (ISO) */
   1.115 +	int32_t status; /* status (non-ISO) */
   1.116 +	int32_t actual_length; /* actual transfer length */
   1.117 +	int32_t error_count; /* number of ISO errors */
   1.118 +};
   1.119 +typedef struct usbif_response usbif_response_t;
   1.120 +
   1.121 +DEFINE_RING_TYPES(usbif, struct usbif_request, struct usbif_response);
   1.122 +#define USB_RING_SIZE __RING_SIZE((struct usbif_sring *)0, PAGE_SIZE)
   1.123 +
   1.124 +#endif /* __XEN_PUBLIC_IO_USBIF_H__ */
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/xen/include/public/io/vscsiif.h	Wed Mar 18 15:42:47 2009 +0000
     2.3 @@ -0,0 +1,105 @@
     2.4 +/******************************************************************************
     2.5 + * vscsiif.h
     2.6 + * 
     2.7 + * Based on the blkif.h code.
     2.8 + * 
     2.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    2.10 + * of this software and associated documentation files (the "Software"), to
    2.11 + * deal in the Software without restriction, including without limitation the
    2.12 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    2.13 + * sell copies of the Software, and to permit persons to whom the Software is
    2.14 + * furnished to do so, subject to the following conditions:
    2.15 + *
    2.16 + * The above copyright notice and this permission notice shall be included in
    2.17 + * all copies or substantial portions of the Software.
    2.18 + *
    2.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    2.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    2.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    2.24 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    2.25 + * DEALINGS IN THE SOFTWARE.
    2.26 + *
    2.27 + * Copyright(c) FUJITSU Limited 2008.
    2.28 + */
    2.29 +
    2.30 +#ifndef __XEN__PUBLIC_IO_SCSI_H__
    2.31 +#define __XEN__PUBLIC_IO_SCSI_H__
    2.32 +
    2.33 +#include "ring.h"
    2.34 +#include "../grant_table.h"
    2.35 +
    2.36 +/* command between backend and frontend */
    2.37 +#define VSCSIIF_ACT_SCSI_CDB         1    /* SCSI CDB command */
    2.38 +#define VSCSIIF_ACT_SCSI_ABORT       2    /* SCSI Device(Lun) Abort*/
    2.39 +#define VSCSIIF_ACT_SCSI_RESET       3    /* SCSI Device(Lun) Reset*/
    2.40 +
    2.41 +
    2.42 +#define VSCSIIF_BACK_MAX_PENDING_REQS    128
    2.43 +
    2.44 +/*
    2.45 + * Maximum scatter/gather segments per request.
    2.46 + *
    2.47 + * Considering balance between allocating al least 16 "vscsiif_request"
    2.48 + * structures on one page (4096bytes) and number of scatter gather 
    2.49 + * needed, we decided to use 26 as a magic number.
    2.50 + */
    2.51 +#define VSCSIIF_SG_TABLESIZE             26
    2.52 +
    2.53 +/*
    2.54 + * base on linux kernel 2.6.18
    2.55 + */
    2.56 +#define VSCSIIF_MAX_COMMAND_SIZE         16
    2.57 +#define VSCSIIF_SENSE_BUFFERSIZE         96
    2.58 +
    2.59 +
    2.60 +struct vscsiif_request {
    2.61 +    uint16_t rqid;          /* private guest value, echoed in resp  */
    2.62 +    uint8_t act;            /* command between backend and frontend */
    2.63 +    uint8_t cmd_len;
    2.64 +
    2.65 +    uint8_t cmnd[VSCSIIF_MAX_COMMAND_SIZE];
    2.66 +    uint16_t timeout_per_command;     /* The command is issued by twice 
    2.67 +                                         the value in Backend. */
    2.68 +    uint16_t channel, id, lun;
    2.69 +    uint16_t padding;
    2.70 +    uint8_t sc_data_direction;        /* for DMA_TO_DEVICE(1)
    2.71 +                                         DMA_FROM_DEVICE(2)
    2.72 +                                         DMA_NONE(3) requests  */
    2.73 +    uint8_t nr_segments;              /* Number of pieces of scatter-gather */
    2.74 +
    2.75 +    struct scsiif_request_segment {
    2.76 +        grant_ref_t gref;
    2.77 +        uint16_t offset;
    2.78 +        uint16_t length;
    2.79 +    } seg[VSCSIIF_SG_TABLESIZE];
    2.80 +    uint32_t reserved[3];
    2.81 +};
    2.82 +typedef struct vscsiif_request vscsiif_request_t;
    2.83 +
    2.84 +struct vscsiif_response {
    2.85 +    uint16_t rqid;
    2.86 +    uint8_t padding;
    2.87 +    uint8_t sense_len;
    2.88 +    uint8_t sense_buffer[VSCSIIF_SENSE_BUFFERSIZE];
    2.89 +    int32_t rslt;
    2.90 +    uint32_t residual_len;     /* request bufflen - 
    2.91 +                                  return the value from physical device */
    2.92 +    uint32_t reserved[36];
    2.93 +};
    2.94 +typedef struct vscsiif_response vscsiif_response_t;
    2.95 +
    2.96 +DEFINE_RING_TYPES(vscsiif, struct vscsiif_request, struct vscsiif_response);
    2.97 +
    2.98 +
    2.99 +#endif  /*__XEN__PUBLIC_IO_SCSI_H__*/
   2.100 +/*
   2.101 + * Local variables:
   2.102 + * mode: C
   2.103 + * c-set-style: "BSD"
   2.104 + * c-basic-offset: 4
   2.105 + * tab-width: 4
   2.106 + * indent-tabs-mode: nil
   2.107 + * End:
   2.108 + */