]> Pileus Git - ~andy/linux/blob - drivers/staging/hv/include/StorVscApi.h
Staging: hv: remove UINT32 and INT32 typedefs
[~andy/linux] / drivers / staging / hv / include / StorVscApi.h
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
28 #include "VmbusApi.h"
29
30 //
31 // Defines
32 //
33
34 #define STORVSC_RING_BUFFER_SIZE                        10*PAGE_SIZE
35 #define BLKVSC_RING_BUFFER_SIZE                         20*PAGE_SIZE
36
37 #define STORVSC_MAX_IO_REQUESTS                         64
38
39 // In Hyper-V, each port/path/target maps to 1 scsi host adapter.
40 // In reality, the path/target is not used (ie always set to 0) so
41 // our scsi host adapter essentially has 1 bus with 1 target that contains
42 // up to 256 luns.
43
44 #define STORVSC_MAX_LUNS_PER_TARGET                     64
45 #define STORVSC_MAX_TARGETS                                     1
46 #define STORVSC_MAX_CHANNELS                            1
47
48
49 // Fwd decl
50 //
51 //struct VMBUS_CHANNEL;
52 typedef struct _STORVSC_REQUEST* PSTORVSC_REQUEST;
53
54 //
55 // Data types
56 //
57 typedef int (*PFN_ON_IO_REQUEST)(PDEVICE_OBJECT Device, PSTORVSC_REQUEST Request);
58 typedef void (*PFN_ON_IO_REQUEST_COMPLTN)(PSTORVSC_REQUEST Request);
59
60 typedef int (*PFN_ON_HOST_RESET)(PDEVICE_OBJECT Device);
61 typedef void (*PFN_ON_HOST_RESCAN)(PDEVICE_OBJECT Device);
62
63
64 // Matches Windows-end
65 typedef enum _STORVSC_REQUEST_TYPE{
66         WRITE_TYPE,
67         READ_TYPE,
68         UNKNOWN_TYPE,
69 } STORVSC_REQUEST_TYPE;
70
71
72 typedef struct _STORVSC_REQUEST {
73         STORVSC_REQUEST_TYPE            Type;
74         u32                                     Host;
75         u32                                     Bus;
76         u32                                     TargetId;
77         u32                                     LunId;
78         u8 *                                    Cdb;
79         u32                                     CdbLen;
80         u32                                     Status;
81         u32                                     BytesXfer;
82
83         UCHAR*                                  SenseBuffer;
84         u32                                     SenseBufferSize;
85
86         void *                                  Context;
87
88         PFN_ON_IO_REQUEST_COMPLTN       OnIOCompletion;
89
90         // This points to the memory after DataBuffer
91         void *                                  Extension;
92
93         MULTIPAGE_BUFFER                DataBuffer;
94 } STORVSC_REQUEST;
95
96
97 // Represents the block vsc driver
98 typedef struct _STORVSC_DRIVER_OBJECT {
99         DRIVER_OBJECT                   Base; // Must be the first field
100
101         // Set by caller (in bytes)
102         u32                                     RingBufferSize;
103
104         // Allocate this much private extension for each I/O request
105         u32                                     RequestExtSize;
106
107         // Maximum # of requests in flight per channel/device
108         u32                                     MaxOutstandingRequestsPerChannel;
109
110         // Set by the caller to allow us to re-enumerate the bus on the host
111         PFN_ON_HOST_RESCAN              OnHostRescan;
112
113         // Specific to this driver
114         PFN_ON_IO_REQUEST               OnIORequest;
115         PFN_ON_HOST_RESET               OnHostReset;
116
117 } STORVSC_DRIVER_OBJECT;
118
119 typedef struct _STORVSC_DEVICE_INFO {
120         ULONG   PortNumber;
121     UCHAR       PathId;
122     UCHAR       TargetId;
123 } STORVSC_DEVICE_INFO;
124
125 //
126 // Interface
127 //
128 int
129 StorVscInitialize(
130         DRIVER_OBJECT   *Driver
131         );
132
133 int
134 BlkVscInitialize(
135         DRIVER_OBJECT   *Driver
136         );
137 #endif // _STORVSC_API_H_