[opensm] removed opensm\user\include\ib_types.h, even though it was not used, it...
[mirror/winof/.git] / core / winverbs / kernel / wv_driver.h
1 /*\r
2  * Copyright (c) 2008 Intel Corporation. All rights reserved.\r
3  *\r
4  * This software is available to you under the OpenIB.org BSD license\r
5  * below:\r
6  *\r
7  *     Redistribution and use in source and binary forms, with or\r
8  *     without modification, are permitted provided that the following\r
9  *     conditions are met:\r
10  *\r
11  *      - Redistributions of source code must retain the above\r
12  *        copyright notice, this list of conditions and the following\r
13  *        disclaimer.\r
14  *\r
15  *      - Redistributions in binary form must reproduce the above\r
16  *        copyright notice, this list of conditions and the following\r
17  *        disclaimer in the documentation and/or other materials\r
18  *        provided with the distribution.\r
19  *\r
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV\r
23  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
24  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
25  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
26  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
27  * SOFTWARE.\r
28  */\r
29 \r
30 #pragma once\r
31 \r
32 #ifndef _WV_DRIVER_H_\r
33 #define _WV_DRIVER_H_\r
34 \r
35 #include <ntddk.h>\r
36 #include <wdm.h>\r
37 #include <wdf.h>\r
38 \r
39 #include <iba\ib_types.h>\r
40 #include <iba\ib_ci.h>\r
41 #include <iba\ib_cm_ifc.h>\r
42 #include <rdma\verbs.h>\r
43 #include "wv_ioctl.h"\r
44 \r
45 #if WINVER <= _WIN32_WINNT_WINXP\r
46 #define KGUARDED_MUTEX                   FAST_MUTEX\r
47 #define KeInitializeGuardedMutex ExInitializeFastMutex\r
48 #define KeAcquireGuardedMutex    ExAcquireFastMutex\r
49 #define KeReleaseGuardedMutex    ExReleaseFastMutex\r
50 #endif\r
51 \r
52 extern WDFDEVICE                                ControlDevice;\r
53 extern INFINIBAND_INTERFACE_CM  IbCmInterface;\r
54 extern ULONG                                    RandomSeed;\r
55 \r
56 typedef struct _WV_RDMA_DEVICE\r
57 {\r
58         LIST_ENTRY                              Entry;\r
59         LONG                                    Ref;\r
60         KEVENT                                  Event;\r
61         ib_ca_handle_t                  hDevice;\r
62         RDMA_INTERFACE_VERBS    Interface;\r
63 \r
64 }       WV_RDMA_DEVICE;\r
65 \r
66 WV_RDMA_DEVICE *WvRdmaDeviceGet(NET64 Guid);\r
67 void WvRdmaDevicePut(WV_RDMA_DEVICE *pDevice);\r
68 \r
69 static inline void WvInitVerbsData(ci_umv_buf_t *pVerbsData, UINT32 Command,\r
70                                                                    SIZE_T InputLength, SIZE_T OutputLength,\r
71                                                                    void *pBuffer)\r
72 {\r
73         pVerbsData->command = Command;\r
74         pVerbsData->input_size = (UINT32) InputLength;\r
75         pVerbsData->output_size = (UINT32) OutputLength;\r
76         pVerbsData->p_inout_buf = (ULONG_PTR) pBuffer;\r
77         pVerbsData->status = 0;\r
78 }\r
79 \r
80 void WvCompleteRequests(WDFQUEUE Queue, NTSTATUS ReqStatus);\r
81 void WvFlushQueue(WDFQUEUE Queue, NTSTATUS ReqStatus);\r
82 void WvCompleteRequestsWithInformation(WDFQUEUE Queue, NTSTATUS ReqStatus);\r
83 \r
84 #endif // _WV_DRIVER_H_\r