3 * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
25 #ifndef _STORVSC_API_H_
26 #define _STORVSC_API_H_
34 #define STORVSC_RING_BUFFER_SIZE 10*PAGE_SIZE
35 #define BLKVSC_RING_BUFFER_SIZE 20*PAGE_SIZE
37 #define STORVSC_MAX_IO_REQUESTS 64
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
44 #define STORVSC_MAX_LUNS_PER_TARGET 64
45 #define STORVSC_MAX_TARGETS 1
46 #define STORVSC_MAX_CHANNELS 1
51 //struct VMBUS_CHANNEL;
52 typedef struct _STORVSC_REQUEST* PSTORVSC_REQUEST;
57 typedef int (*PFN_ON_IO_REQUEST)(PDEVICE_OBJECT Device, PSTORVSC_REQUEST Request);
58 typedef void (*PFN_ON_IO_REQUEST_COMPLTN)(PSTORVSC_REQUEST Request);
60 typedef int (*PFN_ON_HOST_RESET)(PDEVICE_OBJECT Device);
61 typedef void (*PFN_ON_HOST_RESCAN)(PDEVICE_OBJECT Device);
64 // Matches Windows-end
65 typedef enum _STORVSC_REQUEST_TYPE{
69 } STORVSC_REQUEST_TYPE;
72 typedef struct _STORVSC_REQUEST {
73 STORVSC_REQUEST_TYPE Type;
88 PFN_ON_IO_REQUEST_COMPLTN OnIOCompletion;
90 // This points to the memory after DataBuffer
93 MULTIPAGE_BUFFER DataBuffer;
97 // Represents the block vsc driver
98 typedef struct _STORVSC_DRIVER_OBJECT {
99 DRIVER_OBJECT Base; // Must be the first field
101 // Set by caller (in bytes)
104 // Allocate this much private extension for each I/O request
107 // Maximum # of requests in flight per channel/device
108 u32 MaxOutstandingRequestsPerChannel;
110 // Set by the caller to allow us to re-enumerate the bus on the host
111 PFN_ON_HOST_RESCAN OnHostRescan;
113 // Specific to this driver
114 PFN_ON_IO_REQUEST OnIORequest;
115 PFN_ON_HOST_RESET OnHostReset;
117 } STORVSC_DRIVER_OBJECT;
119 typedef struct _STORVSC_DEVICE_INFO {
123 } STORVSC_DEVICE_INFO;
130 DRIVER_OBJECT *Driver
135 DRIVER_OBJECT *Driver
137 #endif // _STORVSC_API_H_