2 * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.
\r
4 * This software is available to you under the OpenIB.org BSD license
\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
11 * - Redistributions of source code must retain the above
\r
12 * copyright notice, this list of conditions and the following
\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
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 AND
\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
37 #if !defined _IOU_DRIVER_H_
\r
38 #define _IOU_DRIVER_H_
\r
40 #include "complib/cl_types.h"
\r
41 #include "complib/cl_atomic.h"
\r
42 #include "complib/cl_debug.h"
\r
43 #include "complib/cl_mutex.h"
\r
44 #include "complib/cl_qlist.h"
\r
45 #include "complib/cl_ptr_vector.h"
\r
46 #include "complib/cl_pnp_po.h"
\r
47 #include "iba/ib_al.h"
\r
48 #include "iou_ioc_mgr.h"
\r
50 /* Safe string functions. */
\r
53 * Windows 2000 doesn't support the inline version of safe strings.
\r
54 * Force the use of the library version of safe strings.
\r
56 #define NTSTRSAFE_LIB
\r
58 #include <ntstrsafe.h>
\r
62 * Main header for IB Bus driver.
\r
65 #define IOU_ENTER( lvl ) \
\r
66 CL_ENTER( lvl, iou_globals.dbg_lvl )
\r
68 #define IOU_EXIT( lvl ) \
\r
69 CL_EXIT( lvl, iou_globals.dbg_lvl )
\r
71 #define IOU_TRACE( lvl, msg ) \
\r
72 CL_TRACE( lvl, iou_globals.dbg_lvl, msg )
\r
74 #define IOU_TRACE_EXIT( lvl, msg ) \
\r
75 CL_TRACE_EXIT( lvl, iou_globals.dbg_lvl, msg )
\r
77 #define IOU_PRINT( lvl, msg ) \
\r
78 CL_PRINT( lvl, iou_globals.dbl_lvl, msg )
\r
80 #define IOU_DBG_ERROR CL_DBG_ERROR
\r
81 #define IOU_DBG_DRV (1 << 0)
\r
82 #define IOU_DBG_PNP (1 << 1)
\r
83 #define IOU_DBG_POWER (1 << 2)
\r
84 #define IOU_DBG_PORT (1 << 3)
\r
85 #define IOU_DBG_IOU (1 << 4)
\r
88 * ALLOC_PRAGMA sections:
\r
90 * Default pagable code. Won't be locked in memory.
\r
93 * Code that needs to be locked in memory when the device is
\r
94 * in the paging, crash dump, or hibernation path.
\r
99 * Device extension for the device object that serves as entry point for
\r
100 * the interface and IOCTL requests.
\r
102 typedef struct _iou_fdo_ext
\r
104 cl_pnp_po_ext_t cl_ext;
\r
107 * Device power map returned by the bus driver for the device, used
\r
108 * when sending IRP_MN_SET_POWER for device state in response to
\r
109 * IRP_MN_SET_POWER for system state.
\r
111 DEVICE_POWER_STATE po_state[PowerSystemMaximum];
\r
119 * Device extension for bus driver PDOs.
\r
121 typedef struct _iou_pdo_ext
\r
123 cl_pnp_po_ext_t cl_ext;
\r
125 cl_list_item_t list_item;
\r
127 POWER_STATE dev_po_state;
\r
130 * Pointer to the bus root device extension. Used to manage access to
\r
131 * child PDO pointer vector when a child is removed politely.
\r
133 iou_fdo_ext_t *p_parent_ext;
\r
136 * The following two flags are exclusively set, but can both be FALSE.
\r
137 * Flag that indicates whether the device is present in the system or not.
\r
138 * This affects how a IRP_MN_REMOVE_DEVICE IRP is handled for a child PDO.
\r
139 * This flag is cleared when:
\r
140 * - an HCA (for IPoIB devices) is removed from the system for all port
\r
141 * devices loaded for that HCA
\r
142 * - an IOU is reported as removed by the CIA.
\r
144 boolean_t b_present;
\r
147 * Flag that indicates whether the device has been reported to the PnP
\r
148 * manager as having been removed. That is, the device was reported
\r
149 * in a previous BusRelations query and not in a subsequent one.
\r
150 * This flag is set when
\r
151 * - the device is in the surprise remove state when the parent bus
\r
152 * device is removed
\r
153 * - the device is found to be not present during a BusRelations query
\r
154 * and thus not reported.
\r
156 boolean_t b_reported_missing;
\r
162 * Global Driver parameters.
\r
164 typedef struct _iou_globals
\r
169 /* Driver object. Used for creating child devices. */
\r
170 DRIVER_OBJECT *p_driver_obj;
\r
175 extern iou_globals_t iou_globals;
\r
178 #endif /* !defined _IOU_DRIVER_H_ */
\r