]> bbs.cooldavid.org Git - net-next-2.6.git/blame - drivers/staging/hv/storvsc_api.h
Merge branch 'for-rmk' of git://git.pengutronix.de/git/imx/linux-2.6
[net-next-2.6.git] / drivers / staging / hv / storvsc_api.h
CommitLineData
ab057781
HJ
1/*
2 *
3 * Copyright (c) 2009, Microsoft Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 * Authors:
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
21 *
22 */
23
24
25#ifndef _STORVSC_API_H_
26#define _STORVSC_API_H_
27
447fc67e 28#include "vmbus_api.h"
ab057781 29
454f18a9 30/* Defines */
15dd1c9f 31#define STORVSC_RING_BUFFER_SIZE (20*PAGE_SIZE)
9bcd786a 32#define BLKVSC_RING_BUFFER_SIZE (20*PAGE_SIZE)
ab057781 33
15dd1c9f 34#define STORVSC_MAX_IO_REQUESTS 128
ab057781 35
454f18a9
BP
36/*
37 * In Hyper-V, each port/path/target maps to 1 scsi host adapter. In
38 * reality, the path/target is not used (ie always set to 0) so our
39 * scsi host adapter essentially has 1 bus with 1 target that contains
40 * up to 256 luns.
41 */
ab057781 42#define STORVSC_MAX_LUNS_PER_TARGET 64
9bcd786a 43#define STORVSC_MAX_TARGETS 1
ab057781
HJ
44#define STORVSC_MAX_CHANNELS 1
45
0b3f6834 46struct hv_storvsc_request;
ab057781 47
454f18a9 48/* Matches Windows-end */
9f0c7d2c 49enum storvsc_request_type{
ab057781
HJ
50 WRITE_TYPE,
51 READ_TYPE,
52 UNKNOWN_TYPE,
9f0c7d2c 53};
ab057781 54
0b3f6834 55struct hv_storvsc_request {
9f0c7d2c 56 enum storvsc_request_type Type;
9bcd786a
GKH
57 u32 Host;
58 u32 Bus;
59 u32 TargetId;
60 u32 LunId;
61 u8 *Cdb;
62 u32 CdbLen;
63 u32 Status;
64 u32 BytesXfer;
ab057781 65
9bcd786a
GKH
66 unsigned char *SenseBuffer;
67 u32 SenseBufferSize;
ab057781 68
9bcd786a 69 void *Context;
ab057781 70
f25c749b 71 void (*OnIOCompletion)(struct hv_storvsc_request *Request);
ab057781 72
454f18a9 73 /* This points to the memory after DataBuffer */
9bcd786a 74 void *Extension;
ab057781 75
ee3d7ddf 76 struct hv_multipage_buffer DataBuffer;
0b3f6834 77};
ab057781 78
454f18a9 79/* Represents the block vsc driver */
9f0c7d2c 80struct storvsc_driver_object {
9bcd786a
GKH
81 /* Must be the first field */
82 /* Which is a bug FIXME! */
83 struct hv_driver Base;
ab057781 84
454f18a9 85 /* Set by caller (in bytes) */
9bcd786a 86 u32 RingBufferSize;
ab057781 87
454f18a9 88 /* Allocate this much private extension for each I/O request */
9bcd786a 89 u32 RequestExtSize;
ab057781 90
454f18a9 91 /* Maximum # of requests in flight per channel/device */
9bcd786a 92 u32 MaxOutstandingRequestsPerChannel;
ab057781 93
454f18a9 94 /* Specific to this driver */
f25c749b
GKH
95 int (*OnIORequest)(struct hv_device *Device,
96 struct hv_storvsc_request *Request);
9f0c7d2c 97};
ab057781 98
9f0c7d2c 99struct storvsc_device_info {
9bcd786a
GKH
100 unsigned int PortNumber;
101 unsigned char PathId;
102 unsigned char TargetId;
9f0c7d2c 103};
ab057781 104
454f18a9 105/* Interface */
9bcd786a 106int StorVscInitialize(struct hv_driver *driver);
354b0a64 107int StorVscOnHostReset(struct hv_device *Device);
9bcd786a 108int BlkVscInitialize(struct hv_driver *driver);
454f18a9 109
454f18a9 110#endif /* _STORVSC_API_H_ */